diff --git a/radio/src/bitmaps/colorlcd/mask_dropdown.png b/radio/src/bitmaps/colorlcd/mask_dropdown.png index 5e876fd9f..6b4b038df 100644 Binary files a/radio/src/bitmaps/colorlcd/mask_dropdown.png and b/radio/src/bitmaps/colorlcd/mask_dropdown.png differ diff --git a/radio/src/bitmaps/colorlcd/mask_folder.png b/radio/src/bitmaps/colorlcd/mask_folder.png index 0edea4cb2..24a45582f 100644 Binary files a/radio/src/bitmaps/colorlcd/mask_folder.png and b/radio/src/bitmaps/colorlcd/mask_folder.png differ diff --git a/radio/src/gui/colorlcd/CMakeLists.txt b/radio/src/gui/colorlcd/CMakeLists.txt index 99c5de4cb..64648e2a5 100644 --- a/radio/src/gui/colorlcd/CMakeLists.txt +++ b/radio/src/gui/colorlcd/CMakeLists.txt @@ -93,7 +93,6 @@ endforeach() add_gui_src(fullscreen_dialog.cpp) add_gui_src(confirm_dialog.cpp) -add_gui_src(message_dialog.cpp) add_gui_src(timeedit.cpp) add_gui_src(curve.cpp) add_gui_src(sourcechoice.cpp) diff --git a/radio/src/gui/colorlcd/libopenui.h b/radio/src/gui/colorlcd/libopenui.h index 190cb5b2b..9a581eeae 100644 --- a/radio/src/gui/colorlcd/libopenui.h +++ b/radio/src/gui/colorlcd/libopenui.h @@ -56,4 +56,9 @@ #include "coloredit.h" #include "draw_functions.h" +inline void POPUP_INFORMATION(const char * str) +{ + new MessageDialog("Message", str); +} + #endif // _LIBOPENUI_H_ diff --git a/radio/src/gui/colorlcd/message_dialog.cpp b/radio/src/gui/colorlcd/message_dialog.cpp deleted file mode 100644 index 685bf57cd..000000000 --- a/radio/src/gui/colorlcd/message_dialog.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include "message_dialog.h" -#include "static.h" - -MessageDialog::MessageDialog(const char * title, const char * message): - Dialog(title, {50, 73, LCD_W - 100, LCD_H - 146}) -{ - new StaticText(this, {0, height() / 2, width(), PAGE_LINE_HEIGHT}, message, CENTERED); -} - -#if defined(HARDWARE_KEYS) -void MessageDialog::onKeyEvent(event_t event) -{ - TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event); - - if (event == EVT_KEY_BREAK(KEY_EXIT) || event == EVT_KEY_BREAK(KEY_ENTER)) { - deleteLater(); - } -} -#endif diff --git a/radio/src/gui/colorlcd/message_dialog.h b/radio/src/gui/colorlcd/message_dialog.h deleted file mode 100644 index 904bbfe48..000000000 --- a/radio/src/gui/colorlcd/message_dialog.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#ifndef _MESSAGE_DIALOG_H_ -#define _MESSAGE_DIALOG_H_ - -#include "dialog.h" - -class MessageDialog: public Dialog { - public: - MessageDialog(const char * title, const char * message); - -#if defined(HARDWARE_KEYS) - void onKeyEvent(event_t event) override; -#endif -}; - -inline void POPUP_INFORMATION(const char * str) -{ - new MessageDialog("Message", str); -} - -#endif // _MESSAGE_DIALOG_H_ diff --git a/radio/src/gui/colorlcd/theme.cpp b/radio/src/gui/colorlcd/theme.cpp index d2ecc954c..e63aaf996 100644 --- a/radio/src/gui/colorlcd/theme.cpp +++ b/radio/src/gui/colorlcd/theme.cpp @@ -25,6 +25,14 @@ const BitmapBuffer * ThemeBase::asterisk = NULL; const BitmapBuffer * ThemeBase::question = NULL; const BitmapBuffer * ThemeBase::busy = NULL; +const uint8_t LBM_FOLDER[] = { +#include "mask_folder.lbm" +}; + +const uint8_t LBM_DROPDOWN[] = { +#include "mask_dropdown.lbm" +}; + std::list & getRegisteredThemes() { static std::list themes; @@ -154,6 +162,22 @@ void ThemeBase::drawCheckBox(BitmapBuffer * dc, bool value, bool focus) const } } +void ThemeBase::drawChoice(BitmapBuffer * dc, ChoiceBase * choice, const char * str) const +{ + LcdFlags textColor; + if (choice->isEditMode()) + textColor = TEXT_INVERTED_COLOR; + else if (choice->hasFocus()) + textColor = TEXT_INVERTED_BGCOLOR; + else if (!str || str[0] == '\0') + textColor = CURVE_AXIS_COLOR; + else + textColor = TEXT_COLOR; + + dc->drawText(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, str[0] == '\0' ? "---" : str, textColor); + dc->drawBitmapPattern(choice->getRect().w - 20, (choice->getRect().h - 11) / 2, choice->getType() == CHOICE_TYPE_FOLDER ? LBM_FOLDER : LBM_DROPDOWN, textColor); +} + void ThemeBase::drawSlider(BitmapBuffer * dc, int vmin, int vmax, int value, const rect_t & rect, bool edit, bool focus) const { int val = limit(vmin, value, vmax); diff --git a/radio/src/gui/colorlcd/theme.h b/radio/src/gui/colorlcd/theme.h index 2215b87ed..fd5815913 100644 --- a/radio/src/gui/colorlcd/theme.h +++ b/radio/src/gui/colorlcd/theme.h @@ -84,6 +84,8 @@ class ThemeBase: public Theme void drawCheckBox(BitmapBuffer * dc, bool value, bool focus) const override; + void drawChoice(BitmapBuffer * dc, ChoiceBase * choice, const char * str) const override; + void drawSlider(BitmapBuffer * dc, int vmin, int vmax, int value, const rect_t & rect, bool edit, bool focus) const override; void drawPageHeader(BitmapBuffer * dc, const PageHeader * page) const override; diff --git a/radio/src/thirdparty/libopenui b/radio/src/thirdparty/libopenui index aacc3e382..67cf7faea 160000 --- a/radio/src/thirdparty/libopenui +++ b/radio/src/thirdparty/libopenui @@ -1 +1 @@ -Subproject commit aacc3e382e914a8c38f039df4f2f1976d0ff44eb +Subproject commit 67cf7faeafd8dc9c57319e5deae624c82aefe83a