From a02b4e61520dfa2233882b4dab6b1e91981ba474 Mon Sep 17 00:00:00 2001 From: Martin Vladic Date: Sun, 2 Feb 2020 10:28:39 +0100 Subject: [PATCH] gui cleanup --- src/eez/gui/app_context.h | 3 --- src/eez/gui/event.cpp | 4 ++++ src/eez/gui/gui.h | 1 + src/eez/gui/widgets/display_data.cpp | 2 +- src/eez/gui/widgets/text.cpp | 2 +- src/eez/gui/widgets/yt_graph.cpp | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/eez/gui/app_context.h b/src/eez/gui/app_context.h index 03e09c159..bcf4c1c02 100644 --- a/src/eez/gui/app_context.h +++ b/src/eez/gui/app_context.h @@ -70,9 +70,6 @@ class AppContext { Page *getActivePage(); bool isActivePageInternal(); - InternalPage *getActivePageInternal() { - return (InternalPage *)getActivePage(); - } void pushSelectFromEnumPage(const data::EnumItem *enumDefinition, uint16_t currentValue, bool (*disabledCallback)(uint16_t value), void (*onSet)(uint16_t), diff --git a/src/eez/gui/event.cpp b/src/eez/gui/event.cpp index e63714905..7a972044d 100644 --- a/src/eez/gui/event.cpp +++ b/src/eez/gui/event.cpp @@ -64,6 +64,10 @@ bool isActiveWidget(const WidgetCursor &widgetCursor) { return result; } +bool isFocusWidget(const WidgetCursor &widgetCursor) { + return g_appContext->isFocusWidget(widgetCursor); +} + int getAction(const WidgetCursor &widgetCursor) { return (int16_t)widgetCursor.widget->action; } diff --git a/src/eez/gui/gui.h b/src/eez/gui/gui.h index b7862f8df..8bb1cde38 100644 --- a/src/eez/gui/gui.h +++ b/src/eez/gui/gui.h @@ -56,6 +56,7 @@ void stateManagmentHook(); WidgetCursor &getFoundWidgetAtDown(); void clearFoundWidgetAtDown(); bool isActiveWidget(const WidgetCursor &widgetCursor); +bool isFocusWidget(const WidgetCursor &widgetCursor); uint32_t getShowPageTime(); void setShowPageTime(uint32_t time); void refreshScreen(); diff --git a/src/eez/gui/widgets/display_data.cpp b/src/eez/gui/widgets/display_data.cpp index 3578bbb45..9e9b44bd1 100644 --- a/src/eez/gui/widgets/display_data.cpp +++ b/src/eez/gui/widgets/display_data.cpp @@ -47,7 +47,7 @@ void DisplayDataWidget_draw(const WidgetCursor &widgetCursor) { DisplayDataState *previousState = (DisplayDataState *)widgetCursor.previousState; widgetCursor.currentState->size = sizeof(DisplayDataState); - widgetCursor.currentState->flags.focused = g_appContext->isFocusWidget(widgetCursor); + widgetCursor.currentState->flags.focused = isFocusWidget(widgetCursor); const Style *style = getStyle(overrideStyleHook(widgetCursor, widgetCursor.currentState->flags.focused ? display_data_widget->focusStyle : widget->style)); diff --git a/src/eez/gui/widgets/text.cpp b/src/eez/gui/widgets/text.cpp index 32fcfe382..f94fd6125 100644 --- a/src/eez/gui/widgets/text.cpp +++ b/src/eez/gui/widgets/text.cpp @@ -47,7 +47,7 @@ void TextWidget_draw(const WidgetCursor &widgetCursor) { const TextWidgetSpecific *textWidget = GET_WIDGET_PROPERTY(widget, specific, const TextWidgetSpecific *); widgetCursor.currentState->size = sizeof(WidgetState); - widgetCursor.currentState->flags.focused = g_appContext->isFocusWidget(widgetCursor); + widgetCursor.currentState->flags.focused = isFocusWidget(widgetCursor); const Style *style = getStyle(widgetCursor.currentState->flags.focused ? textWidget->focusStyle : widget->style); diff --git a/src/eez/gui/widgets/yt_graph.cpp b/src/eez/gui/widgets/yt_graph.cpp index bb9d78f3c..11b07365f 100644 --- a/src/eez/gui/widgets/yt_graph.cpp +++ b/src/eez/gui/widgets/yt_graph.cpp @@ -455,7 +455,7 @@ void YTGraphWidget_draw(const WidgetCursor &widgetCursor) { YTGraphWidgetState *previousState = (YTGraphWidgetState *)widgetCursor.previousState; widgetCursor.currentState->size = sizeof(YTGraphWidgetState); - widgetCursor.currentState->flags.focused = g_appContext->isFocusWidget(widgetCursor); + widgetCursor.currentState->flags.focused = isFocusWidget(widgetCursor); widgetCursor.currentState->data = data::get(widgetCursor.cursor, widget->data); currentState->refreshCounter = data::ytDataGetRefreshCounter(widgetCursor.cursor, widget->data);