Cosmetics

This commit is contained in:
Bertrand Songis
2020-03-03 17:15:42 +01:00
parent 0704de36c4
commit bc1b1ee3a9
5 changed files with 14 additions and 15 deletions
+9 -3
View File
@@ -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();
+2 -4
View File
@@ -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)
{
}
-4
View File
@@ -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 {
+1 -2
View File
@@ -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);
}
+2 -2
View File
@@ -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