From bc1b1ee3a97a15ce1f9edb5a5d1a84573fc058de Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Tue, 3 Mar 2020 17:15:42 +0100 Subject: [PATCH] Cosmetics --- radio/src/thirdparty/libopenui/src/form.cpp | 12 +++++++++--- radio/src/thirdparty/libopenui/src/modal_window.cpp | 6 ++---- radio/src/thirdparty/libopenui/src/modal_window.h | 4 ---- radio/src/thirdparty/libopenui/src/window.cpp | 3 +-- radio/src/thirdparty/libopenui/src/window.h | 4 ++-- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/radio/src/thirdparty/libopenui/src/form.cpp b/radio/src/thirdparty/libopenui/src/form.cpp index 0159bc9ef..25f9575c6 100644 --- a/radio/src/thirdparty/libopenui/src/form.cpp +++ b/radio/src/thirdparty/libopenui/src/form.cpp @@ -35,7 +35,7 @@ FormField::FormField(Window *parent, const rect_t & rect, WindowFlags windowFlag #if defined(HARDWARE_KEYS) void FormField::onEvent(event_t event) { - TRACE_WINDOWS("%s received event 0x%X", FormField::getWindowDebugString().c_str(), event); + TRACE_WINDOWS("%s received event 0x%X", FormField::getWindowDebugString("FormField").c_str(), event); if (event == EVT_ROTARY_RIGHT/*EVT_KEY_BREAK(KEY_DOWN)*/) { if (next) { @@ -151,7 +151,7 @@ void FormGroup::setFocus(uint8_t flag) #if defined(HARDWARE_KEYS) void FormGroup::onEvent(event_t event) { - TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event); + TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString("FormGroup").c_str(), event); if (event == EVT_KEY_BREAK(KEY_ENTER)) { first->setFocus(); @@ -159,6 +159,12 @@ void FormGroup::onEvent(event_t event) else if (event == EVT_KEY_BREAK(KEY_EXIT) && !hasFocus()) { setFocus(SET_FOCUS_DEFAULT); } + else if (event == EVT_ROTARY_RIGHT && !next) { + first->setFocus(); + } + else if (event == EVT_ROTARY_LEFT && !previous) { + last->setFocus(); + } else { FormField::onEvent(event); } @@ -180,7 +186,7 @@ void FormGroup::paint(BitmapBuffer * dc) #if defined(HARDWARE_KEYS) void FormWindow::onEvent(event_t event) { - TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event); + TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString("FormWindow").c_str(), event); if (event == EVT_KEY_BREAK(KEY_EXIT) && first) { Window * currentFocus = getFocus(); diff --git a/radio/src/thirdparty/libopenui/src/modal_window.cpp b/radio/src/thirdparty/libopenui/src/modal_window.cpp index f7c1de20a..303071027 100644 --- a/radio/src/thirdparty/libopenui/src/modal_window.cpp +++ b/radio/src/thirdparty/libopenui/src/modal_window.cpp @@ -22,10 +22,8 @@ #include "font.h" ModalWindow::ModalWindow(Window * parent): - Window(parent->getFullScreenWindow(), {0, 0, LCD_W, LCD_H}) -#if !defined(HARDWARE_TOUCH) - , previousFocus(focusWindow) -#endif + Window(parent->getFullScreenWindow(), {0, 0, LCD_W, LCD_H}), + previousFocus(focusWindow) { } diff --git a/radio/src/thirdparty/libopenui/src/modal_window.h b/radio/src/thirdparty/libopenui/src/modal_window.h index 0f33abf71..39bc6103a 100644 --- a/radio/src/thirdparty/libopenui/src/modal_window.h +++ b/radio/src/thirdparty/libopenui/src/modal_window.h @@ -36,11 +36,9 @@ class ModalWindow: public Window void deleteLater() { -#if !defined(HARDWARE_TOUCH) if (previousFocus) { previousFocus->setFocus(); } -#endif Window::deleteLater(); } @@ -68,9 +66,7 @@ class ModalWindow: public Window #endif protected: -#if !defined(HARDWARE_TOUCH) Window * previousFocus = nullptr; -#endif }; class ModalWindowContent: public Window { diff --git a/radio/src/thirdparty/libopenui/src/window.cpp b/radio/src/thirdparty/libopenui/src/window.cpp index 328b0479a..99dbec8d8 100644 --- a/radio/src/thirdparty/libopenui/src/window.cpp +++ b/radio/src/thirdparty/libopenui/src/window.cpp @@ -286,7 +286,6 @@ void Window::checkEvents() if (this == focusWindow) { event_t event = getWindowEvent(); if (event) { - TRACE_WINDOWS("Event 0x%x received ...", event); this->onEvent(event); } } @@ -315,7 +314,7 @@ void Window::checkEvents() void Window::onEvent(event_t event) { - TRACE_WINDOWS("%s received event 0x%X", Window::getWindowDebugString().c_str(), event); + TRACE_WINDOWS("%s received event 0x%X", Window::getWindowDebugString("Window").c_str(), event); if (parent) { parent->onEvent(event); } diff --git a/radio/src/thirdparty/libopenui/src/window.h b/radio/src/thirdparty/libopenui/src/window.h index fb2723e2a..1f8ed5a53 100644 --- a/radio/src/thirdparty/libopenui/src/window.h +++ b/radio/src/thirdparty/libopenui/src/window.h @@ -87,9 +87,9 @@ class Window { return result; } - std::string getWindowDebugString() + std::string getWindowDebugString(const char * name = nullptr) { - return getIndentString() + getName() + " " + getRectString(); + return getIndentString() + getName() + (name ? std::string("/") + name : "") + " " + getRectString(); } #endif