Skip to content

Commit ddad3e0

Browse files
committed
list and grid rendering fix
1 parent 7e51df9 commit ddad3e0

File tree

6 files changed

+20
-45
lines changed

6 files changed

+20
-45
lines changed

src/eez/gui/assets.cpp

-25
Original file line numberDiff line numberDiff line change
@@ -104,31 +104,6 @@ static FixPointersFunctionType *g_fixWidgetPointersFunctions[] = {
104104
};
105105
#undef WIDGET_TYPE
106106

107-
// static FixWidgetPointersFunction g_fixWidgetPointersFunctions[] = {
108-
// nullptr, // WIDGET_TYPE_NONE
109-
// ContainerWidget_fixPointers, // WIDGET_TYPE_CONTAINER
110-
// ListWidget_fixPointers, // WIDGET_TYPE_LIST
111-
// GridWidget_fixPointers, // WIDGET_TYPE_GRID
112-
// SelectWidget_fixPointers, // WIDGET_TYPE_SELECT
113-
// nullptr, // WIDGET_TYPE_DISPLAY_DATA
114-
// TextWidget_fixPointers, // WIDGET_TYPE_TEXT
115-
// MultilineTextWidget_fixPointers, // WIDGET_TYPE_MULTILINE_TEXT
116-
// nullptr, // WIDGET_TYPE_RECTANGLE
117-
// nullptr, // WIDGET_TYPE_BITMAP
118-
// ButtonWidget_fixPointers, // WIDGET_TYPE_BUTTON
119-
// ToggleButtonWidget_fixPointers, // WIDGET_TYPE_TOGGLE_BUTTON
120-
// nullptr, // WIDGET_TYPE_BUTTON_GROUP
121-
// nullptr, // WIDGET_TYPE_RESERVED
122-
// nullptr, // WIDGET_TYPE_BAR_GRAPH
123-
// nullptr, // WIDGET_TYPE_LAYOUT_VIEW
124-
// nullptr, // WIDGET_TYPE_YT_GRAPH
125-
// UpDownWidget_fixPointers, // WIDGET_TYPE_UP_DOWN
126-
// nullptr, // WIDGET_TYPE_LIST_GRAPH
127-
// nullptr, // WIDGET_TYPE_APP_VIEW
128-
// ScrollBarWidget_fixPointers, // WIDGET_TYPE_SCROLL_BAR
129-
// nullptr, // WIDGET_TYPE_SCROLL_BAR
130-
// };
131-
132107
void Widget_fixPointers(Widget *widget) {
133108
widget->specific = (void *)((uint8_t *)g_fixPointersAssets->document + (uint32_t)widget->specific);
134109
if (*g_fixWidgetPointersFunctions[widget->type]) {

src/eez/gui/data.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ void STR_value_to_text(const Value &value, char *text, int count) {
270270
}
271271

272272
bool compare_VERSIONED_STR_value(const Value &a, const Value &b) {
273-
return a.getInt() == b.getInt();
273+
return a.unit_ == b.unit_; // here unit_ is used as string version
274274
}
275275

276276
void VERSIONED_STR_value_to_text(const Value &value, char *text, int count) {

src/eez/gui/data.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ struct Value {
101101
{
102102
}
103103

104-
Value(int, const char *str)
105-
: type_(VALUE_TYPE_VERSIONED_STR), options_(0), unit_(UNIT_UNKNOWN), str_(str)
104+
Value(int version, const char *str)
105+
: type_(VALUE_TYPE_VERSIONED_STR), options_(0), unit_(version), str_(str)
106106
{
107107
}
108108

src/eez/gui/widget.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ namespace gui {
5151
WIDGET_TYPE(CANVAS, 22) \
5252

5353
#define WIDGET_TYPE(NAME, ID) WIDGET_TYPE_##NAME = ID,
54-
enum ValueTypes {
54+
enum WidgetTypes {
5555
WIDGET_TYPES
5656
};
5757
#undef WIDGET_TYPE

src/eez/gui/widgets/grid.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,6 @@ EnumFunctionType GRID_enum = [](WidgetCursor &widgetCursor, EnumWidgetsCallback
4646
endOfContainerInPreviousState = nextWidgetState(widgetCursor.previousState);
4747
}
4848

49-
// move to the first child widget state
50-
if (widgetCursor.previousState) {
51-
++widgetCursor.previousState;
52-
}
53-
if (widgetCursor.currentState) {
54-
++widgetCursor.currentState;
55-
}
56-
5749
auto savedWidget = widgetCursor.widget;
5850

5951
auto parentWidget = savedWidget;
@@ -71,6 +63,14 @@ EnumFunctionType GRID_enum = [](WidgetCursor &widgetCursor, EnumWidgetsCallback
7163
}
7264
}
7365

66+
// move to the first child widget state
67+
if (widgetCursor.previousState) {
68+
++widgetCursor.previousState;
69+
}
70+
if (widgetCursor.currentState) {
71+
++widgetCursor.currentState;
72+
}
73+
7474
const Widget *childWidget = GET_WIDGET_PROPERTY(gridWidget, itemWidget, const Widget *);
7575
widgetCursor.widget = childWidget;
7676

src/eez/gui/widgets/list.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,6 @@ EnumFunctionType LIST_enum = [](WidgetCursor &widgetCursor, EnumWidgetsCallback
4747
endOfContainerInPreviousState = nextWidgetState(widgetCursor.previousState);
4848
}
4949

50-
// move to the first child widget state
51-
if (widgetCursor.previousState) {
52-
++widgetCursor.previousState;
53-
}
54-
if (widgetCursor.currentState) {
55-
++widgetCursor.currentState;
56-
}
57-
5850
auto savedWidget = widgetCursor.widget;
5951

6052
auto parentWidget = savedWidget;
@@ -72,6 +64,14 @@ EnumFunctionType LIST_enum = [](WidgetCursor &widgetCursor, EnumWidgetsCallback
7264
}
7365
}
7466

67+
// move to the first child widget state
68+
if (widgetCursor.previousState) {
69+
++widgetCursor.previousState;
70+
}
71+
if (widgetCursor.currentState) {
72+
++widgetCursor.currentState;
73+
}
74+
7575
const Widget *childWidget = GET_WIDGET_PROPERTY(listWidget, itemWidget, const Widget *);
7676
widgetCursor.widget = childWidget;
7777

0 commit comments

Comments
 (0)