Skip to content

Commit

Permalink
list and grid rendering fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Jul 8, 2021
1 parent 7e51df9 commit ddad3e0
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 45 deletions.
25 changes: 0 additions & 25 deletions src/eez/gui/assets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,31 +104,6 @@ static FixPointersFunctionType *g_fixWidgetPointersFunctions[] = {
};
#undef WIDGET_TYPE

// static FixWidgetPointersFunction g_fixWidgetPointersFunctions[] = {
// nullptr, // WIDGET_TYPE_NONE
// ContainerWidget_fixPointers, // WIDGET_TYPE_CONTAINER
// ListWidget_fixPointers, // WIDGET_TYPE_LIST
// GridWidget_fixPointers, // WIDGET_TYPE_GRID
// SelectWidget_fixPointers, // WIDGET_TYPE_SELECT
// nullptr, // WIDGET_TYPE_DISPLAY_DATA
// TextWidget_fixPointers, // WIDGET_TYPE_TEXT
// MultilineTextWidget_fixPointers, // WIDGET_TYPE_MULTILINE_TEXT
// nullptr, // WIDGET_TYPE_RECTANGLE
// nullptr, // WIDGET_TYPE_BITMAP
// ButtonWidget_fixPointers, // WIDGET_TYPE_BUTTON
// ToggleButtonWidget_fixPointers, // WIDGET_TYPE_TOGGLE_BUTTON
// nullptr, // WIDGET_TYPE_BUTTON_GROUP
// nullptr, // WIDGET_TYPE_RESERVED
// nullptr, // WIDGET_TYPE_BAR_GRAPH
// nullptr, // WIDGET_TYPE_LAYOUT_VIEW
// nullptr, // WIDGET_TYPE_YT_GRAPH
// UpDownWidget_fixPointers, // WIDGET_TYPE_UP_DOWN
// nullptr, // WIDGET_TYPE_LIST_GRAPH
// nullptr, // WIDGET_TYPE_APP_VIEW
// ScrollBarWidget_fixPointers, // WIDGET_TYPE_SCROLL_BAR
// nullptr, // WIDGET_TYPE_SCROLL_BAR
// };

void Widget_fixPointers(Widget *widget) {
widget->specific = (void *)((uint8_t *)g_fixPointersAssets->document + (uint32_t)widget->specific);
if (*g_fixWidgetPointersFunctions[widget->type]) {
Expand Down
2 changes: 1 addition & 1 deletion src/eez/gui/data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ void STR_value_to_text(const Value &value, char *text, int count) {
}

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

void VERSIONED_STR_value_to_text(const Value &value, char *text, int count) {
Expand Down
4 changes: 2 additions & 2 deletions src/eez/gui/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ struct Value {
{
}

Value(int, const char *str)
: type_(VALUE_TYPE_VERSIONED_STR), options_(0), unit_(UNIT_UNKNOWN), str_(str)
Value(int version, const char *str)
: type_(VALUE_TYPE_VERSIONED_STR), options_(0), unit_(version), str_(str)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/eez/gui/widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace gui {
WIDGET_TYPE(CANVAS, 22) \

#define WIDGET_TYPE(NAME, ID) WIDGET_TYPE_##NAME = ID,
enum ValueTypes {
enum WidgetTypes {
WIDGET_TYPES
};
#undef WIDGET_TYPE
Expand Down
16 changes: 8 additions & 8 deletions src/eez/gui/widgets/grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,6 @@ EnumFunctionType GRID_enum = [](WidgetCursor &widgetCursor, EnumWidgetsCallback
endOfContainerInPreviousState = nextWidgetState(widgetCursor.previousState);
}

// move to the first child widget state
if (widgetCursor.previousState) {
++widgetCursor.previousState;
}
if (widgetCursor.currentState) {
++widgetCursor.currentState;
}

auto savedWidget = widgetCursor.widget;

auto parentWidget = savedWidget;
Expand All @@ -71,6 +63,14 @@ EnumFunctionType GRID_enum = [](WidgetCursor &widgetCursor, EnumWidgetsCallback
}
}

// move to the first child widget state
if (widgetCursor.previousState) {
++widgetCursor.previousState;
}
if (widgetCursor.currentState) {
++widgetCursor.currentState;
}

const Widget *childWidget = GET_WIDGET_PROPERTY(gridWidget, itemWidget, const Widget *);
widgetCursor.widget = childWidget;

Expand Down
16 changes: 8 additions & 8 deletions src/eez/gui/widgets/list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,6 @@ EnumFunctionType LIST_enum = [](WidgetCursor &widgetCursor, EnumWidgetsCallback
endOfContainerInPreviousState = nextWidgetState(widgetCursor.previousState);
}

// move to the first child widget state
if (widgetCursor.previousState) {
++widgetCursor.previousState;
}
if (widgetCursor.currentState) {
++widgetCursor.currentState;
}

auto savedWidget = widgetCursor.widget;

auto parentWidget = savedWidget;
Expand All @@ -72,6 +64,14 @@ EnumFunctionType LIST_enum = [](WidgetCursor &widgetCursor, EnumWidgetsCallback
}
}

// move to the first child widget state
if (widgetCursor.previousState) {
++widgetCursor.previousState;
}
if (widgetCursor.currentState) {
++widgetCursor.currentState;
}

const Widget *childWidget = GET_WIDGET_PROPERTY(listWidget, itemWidget, const Widget *);
widgetCursor.widget = childWidget;

Expand Down

0 comments on commit ddad3e0

Please sign in to comment.