From 02f06706c250078a95fbc6345ed69b0dcd7e2146 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Thu, 11 Feb 2016 22:58:43 +0100 Subject: [PATCH] [Horus] Themes introduction --- radio/src/CMakeLists.txt | 5 +- radio/src/bitmaps/horus/CMakeLists.txt | 3 +- .../src/bitmaps/horus/bmp_topmenu_opentx.png | Bin 0 -> 1142 bytes radio/src/gui/horus/bitmaps.cpp | 43 ++-- radio/src/gui/horus/bitmaps.h | 8 +- radio/src/gui/horus/gui.h | 1 + radio/src/gui/horus/layout.h | 1 + radio/src/gui/horus/layouts/layout1x1.cpp | 2 +- radio/src/gui/horus/layouts/layout2+1.cpp | 2 +- radio/src/gui/horus/layouts/layout2x2.cpp | 2 +- radio/src/gui/horus/layouts/layout2x4.cpp | 2 +- radio/src/gui/horus/lcd.cpp | 24 +-- radio/src/gui/horus/lcd.h | 35 ++-- radio/src/gui/horus/menu_general_version.cpp | 2 +- radio/src/gui/horus/menu_model_select.cpp | 5 +- radio/src/gui/horus/menus.h | 19 +- radio/src/gui/horus/navigation.cpp | 17 +- radio/src/gui/horus/screens_setup.cpp | 194 +++++++++++++----- radio/src/gui/horus/splash.cpp | 2 +- radio/src/gui/horus/theme.cpp | 42 ++++ radio/src/gui/horus/theme.h | 66 ++++++ radio/src/gui/horus/themes/bmp_darkblue.png | Bin 0 -> 1184 bytes radio/src/gui/horus/themes/bmp_default.png | Bin 0 -> 3409 bytes radio/src/gui/horus/themes/darkblue.cpp | 89 ++++++++ radio/src/gui/horus/themes/default.cpp | 94 +++++++++ radio/src/gui/horus/view_about.cpp | 2 +- radio/src/gui/horus/view_main.cpp | 10 +- radio/src/gui/horus/view_text.cpp | 2 +- radio/src/gui/horus/widgets.cpp | 22 +- radio/src/gui/horus/widgets.h | 2 +- radio/src/gui/horus/widgets/modelpanel.cpp | 8 +- radio/src/gui/horus/widgets/timer.cpp | 6 +- radio/src/opentx.cpp | 2 +- radio/src/targets/simu/simpgmspace.cpp | 4 +- 34 files changed, 555 insertions(+), 161 deletions(-) create mode 100644 radio/src/bitmaps/horus/bmp_topmenu_opentx.png create mode 100644 radio/src/gui/horus/theme.cpp create mode 100644 radio/src/gui/horus/theme.h create mode 100644 radio/src/gui/horus/themes/bmp_darkblue.png create mode 100644 radio/src/gui/horus/themes/bmp_default.png create mode 100644 radio/src/gui/horus/themes/darkblue.cpp create mode 100644 radio/src/gui/horus/themes/default.cpp diff --git a/radio/src/CMakeLists.txt b/radio/src/CMakeLists.txt index fd7bd5064..e55e354b5 100644 --- a/radio/src/CMakeLists.txt +++ b/radio/src/CMakeLists.txt @@ -65,6 +65,7 @@ if(PCB STREQUAL HORUS) add_definitions(-DEEPROM_VARIANT=0 -DAUDIO -DVOICE -DRTCLOCK) add_definitions(-DLUAINPUTS -DXCURVES -DVARIO) include_directories(${RADIO_SRC_DIRECTORY}/fonts/horus gui/${GUI_DIR} gui/${GUI_DIR}/layouts) + file(GLOB THEMES_SRC RELATIVE ${RADIO_SRC_DIRECTORY}/gui/horus ${RADIO_SRC_DIRECTORY}/gui/horus/themes/*.cpp) file(GLOB LAYOUTS_SRC RELATIVE ${RADIO_SRC_DIRECTORY}/gui/horus ${RADIO_SRC_DIRECTORY}/gui/horus/layouts/*.cpp) file(GLOB WIDGETS_SRC RELATIVE ${RADIO_SRC_DIRECTORY}/gui/horus ${RADIO_SRC_DIRECTORY}/gui/horus/widgets/*.cpp) set(GUI_SRC @@ -78,8 +79,10 @@ if(PCB STREQUAL HORUS) view_about.cpp view_text.cpp screens_setup.cpp - widget.cpp + theme.cpp layout.cpp + widget.cpp + ${THEMES_SRC} ${LAYOUTS_SRC} ${WIDGETS_SRC} ) diff --git a/radio/src/bitmaps/horus/CMakeLists.txt b/radio/src/bitmaps/horus/CMakeLists.txt index 5f7f1f5b0..081ae6d38 100644 --- a/radio/src/bitmaps/horus/CMakeLists.txt +++ b/radio/src/bitmaps/horus/CMakeLists.txt @@ -14,5 +14,6 @@ add_bitmaps_target(horus_alpha_calibration_bitmaps "${RADIO_SRC_DIRECTORY}/bitma add_bitmaps_target(horus_masks ${RADIO_SRC_DIRECTORY}/bitmaps/horus/mask_*.png 480 8bits) add_bitmaps_target(horus_slider_masks "${RADIO_SRC_DIRECTORY}/bitmaps/horus/slider/*.png" 480 8bits) add_bitmaps_target(horus_layouts_masks "${RADIO_SRC_DIRECTORY}/gui/horus/layouts/*.png" 480 8bits) +add_bitmaps_target(horus_themes_bitmaps "${RADIO_SRC_DIRECTORY}/gui/horus/themes/*.png" 480 5/6/5) add_bitmaps_target(horus_fonts ${RADIO_SRC_DIRECTORY}/fonts/horus/*.png 480 8bits) -add_dependencies(horus_bitmaps horus_calibration_bitmaps horus_alpha_bitmaps horus_alpha_calibration_bitmaps horus_masks horus_slider_masks horus_layouts_masks horus_fonts) +add_dependencies(horus_bitmaps horus_calibration_bitmaps horus_alpha_bitmaps horus_alpha_calibration_bitmaps horus_masks horus_slider_masks horus_themes_bitmaps horus_layouts_masks horus_fonts) diff --git a/radio/src/bitmaps/horus/bmp_topmenu_opentx.png b/radio/src/bitmaps/horus/bmp_topmenu_opentx.png new file mode 100644 index 0000000000000000000000000000000000000000..b119d2a0caa70da0648c3203ae785bfc3aa0de83 GIT binary patch literal 1142 zcmV-+1d02JP)`5El%`T>!4fMb4G3johS@YoLdQ<4s1ry0H~Rd#$eWkP|=iA0?E zhK2^2rm1u~Ez7b*GMUuI#)c{?Djc#@DkVuebLNbPyt1;=W7pKwc*t|(-7QDHxw)xC zA|b#bH$$Ni*=&}zwKZ}W85sc}6bj)+cXu~KLqh+2L06kr&J(|P>(aR63URy-5b)zx8H7E@DGT)1$-<1-9{=H_MsfdGbK zu(h@2@lQ@p5{*U~7#QHONI*0il_WJbHVRO6b+sdF?kI9Na^#3i)AY!?TiMT^J*#jy z?963ZmZ++#((3A}Bxz=5#+j(TzWzT6m&;&xD=RB={PXkkT3lRII-S;u6DI_yrKLrZ zbne_a0U912cH#?XXJ-in0z@JaYHMqmo13Grua8tJ1kcrKKeR?%lh`)vH%YCX)a(H8nZkhP{KQ0+XkR!t2+sW172LLve929UpXXf8jpV z1KTd=3h>1#JR9*rK$wv^Wz6gF(8w zx;(LigM-|@efzPphYm44J^jS_J@5*UD`u8$j{xhyTP|Pj2)=#N=ecUfjvez(4qU!` zng0I%ouxPhT=Mn(1M~wQ*^9_w2KZz@uiEeSj@@`3c;81{0(`UI_k0`p)Yi~>;(#Jw z+)d!GgD5g7VA{6;d>Q`ZK~}gg?1aik{FPmV4vc&gn9tKM;E#i@?Qa0j?cnRke65zv_{Amph|iw|-nF0KJ&~6Ib-rEC06)3x4g3DP@r=EIJ&|AW)%0TE z>pXD@Amh9DF9Sz+LGJ!5b#N32`TBkak~`G?&+H>{=fyklFY2^b*I3g7n*aa+07*qo IM6N<$f}|Q8BLDyZ literal 0 HcmV?d00001 diff --git a/radio/src/gui/horus/bitmaps.cpp b/radio/src/gui/horus/bitmaps.cpp index cf0304680..2104a4c86 100644 --- a/radio/src/gui/horus/bitmaps.cpp +++ b/radio/src/gui/horus/bitmaps.cpp @@ -48,14 +48,6 @@ const uint8_t LBM_CURRENT_DOT[] = { * Main view bitmaps */ -const uint8_t LBM_MAINVIEW_BACKGROUND[] = { -#include "bmp_background.lbm" -}; - -const uint8_t LBM_TOPMENU_OPENTX[] = { -#include "mask_topmenu_opentx.lbm" -}; - const uint8_t LBM_TOPMENU_USB[] = { #include "mask_topmenu_usb.lbm" }; @@ -182,10 +174,6 @@ const uint8_t LBM_TELEMETRY_ICON[] = { #include "mask_telemetry.lbm" }; -const uint8_t LBM_MAINVIEWS_ICON[] = { -#include "mask_mainviews.lbm" -}; - const uint8_t * const LBM_MODEL_ICONS[] = { LBM_MODEL_ICON, LBM_MODEL_SETUP_ICON, @@ -204,6 +192,36 @@ const uint8_t * const LBM_MODEL_ICONS[] = { LBM_TELEMETRY_ICON }; +/* + * UI (theme / layout / widgets bitmaps + */ + +const uint8_t LBM_MAINVIEWS_ICON[] = { +#include "mask_mainviews.lbm" +}; + +const uint8_t LBM_MAINVIEWS_TOPBAR_ICON[] = { +#include "mask_mainviews_topbar.lbm" +}; + +const uint8_t LBM_MAINVIEWS_ITEM_OUT_ICON[] = { +#include "mask_mainviews_item_out.lbm" +}; + +const uint8_t LBM_MAINVIEWS_ADD_ICON[] = { +#include "mask_mainviews_add.lbm" +}; + +const uint8_t * LBM_MAINVIEWS_ICONS[] = { + LBM_MAINVIEWS_ICON, + LBM_MAINVIEWS_TOPBAR_ICON, + LBM_MAINVIEWS_ITEM_OUT_ICON, + LBM_MAINVIEWS_ITEM_OUT_ICON, + LBM_MAINVIEWS_ITEM_OUT_ICON, + LBM_MAINVIEWS_ITEM_OUT_ICON, + LBM_MAINVIEWS_ITEM_OUT_ICON +}; + /* * Model selection screen bitmaps */ @@ -324,4 +342,3 @@ const uint8_t LBM_BUTTON_OFF[] __DMA = { #include "alpha_button_off.lbm" }; - diff --git a/radio/src/gui/horus/bitmaps.h b/radio/src/gui/horus/bitmaps.h index 4cc2943ba..f1869b51c 100644 --- a/radio/src/gui/horus/bitmaps.h +++ b/radio/src/gui/horus/bitmaps.h @@ -29,8 +29,6 @@ extern const uint8_t LBM_CURRENT_SHADOW[]; extern const uint8_t LBM_CURRENT_DOT[]; // Main view icons -extern const uint8_t LBM_MAINVIEW_BACKGROUND[]; -extern const uint8_t LBM_TOPMENU_OPENTX[]; extern const uint8_t LBM_TOPMENU_USB[]; extern const uint8_t LBM_HTRIM_FRAME[]; extern const uint8_t LBM_VTRIM_FRAME[]; @@ -51,7 +49,13 @@ extern const uint8_t LBM_INPUTS_ICON[]; extern const uint8_t LBM_MIXER_ICON[]; extern const uint8_t LBM_CURVES_ICON[]; extern const uint8_t LBM_TELEMETRY_ICON[]; + +// UI (theme / layout / widgets bitmaps extern const uint8_t LBM_MAINVIEWS_ICON[]; +extern const uint8_t LBM_MAINVIEWS_TOPBAR_ICON[]; +extern const uint8_t LBM_MAINVIEWS_ITEM_OUT_ICON[]; +extern const uint8_t LBM_MAINVIEWS_ADD_ICON[]; +extern const uint8_t * LBM_MAINVIEWS_ICONS[]; // Model selection icons extern const uint8_t LBM_LIBRARY_ICON[]; diff --git a/radio/src/gui/horus/gui.h b/radio/src/gui/horus/gui.h index 1007c9ae1..703bef4bc 100644 --- a/radio/src/gui/horus/gui.h +++ b/radio/src/gui/horus/gui.h @@ -22,6 +22,7 @@ #include "menus.h" #include "widgets.h" #include "bitmaps.h" +#include "theme.h" #define MENU_HEADER_HEIGHT 45 #define MENU_TITLE_TOP 48 diff --git a/radio/src/gui/horus/layout.h b/radio/src/gui/horus/layout.h index f22ffa7de..f4f28a3af 100644 --- a/radio/src/gui/horus/layout.h +++ b/radio/src/gui/horus/layout.h @@ -124,6 +124,7 @@ class BaseLayoutFactory: public LayoutFactory extern void lcdDrawBitmapPattern(int x, int y, const uint8_t * bitmap, uint32_t flags, int width=0, int offset=0); lcdDrawBitmapPattern(x, y, bitmap, flags); } + virtual const ZoneOption * getOptions() const { return options; diff --git a/radio/src/gui/horus/layouts/layout1x1.cpp b/radio/src/gui/horus/layouts/layout1x1.cpp index a50811835..102b1855a 100644 --- a/radio/src/gui/horus/layouts/layout1x1.cpp +++ b/radio/src/gui/horus/layouts/layout1x1.cpp @@ -68,7 +68,7 @@ const ZoneOption Layout1x1::options[] = { void Layout1x1::refresh(bool setup) { - lcdDrawBitmap(0, 0, LBM_MAINVIEW_BACKGROUND); + theme->drawBackground(); if (persistentData->options[0].boolValue) { // Top Bar diff --git a/radio/src/gui/horus/layouts/layout2+1.cpp b/radio/src/gui/horus/layouts/layout2+1.cpp index a7d660e6a..477641fbd 100644 --- a/radio/src/gui/horus/layouts/layout2+1.cpp +++ b/radio/src/gui/horus/layouts/layout2+1.cpp @@ -70,7 +70,7 @@ const ZoneOption Layout2P1::options[] = { void Layout2P1::refresh(bool setup) { - lcdDrawBitmap(0, 0, LBM_MAINVIEW_BACKGROUND); + theme->drawBackground(); if (persistentData->options[0].boolValue) { // Top Bar diff --git a/radio/src/gui/horus/layouts/layout2x2.cpp b/radio/src/gui/horus/layouts/layout2x2.cpp index 39bd9c568..d73175cc6 100644 --- a/radio/src/gui/horus/layouts/layout2x2.cpp +++ b/radio/src/gui/horus/layouts/layout2x2.cpp @@ -70,7 +70,7 @@ const ZoneOption Layout2x2::options[] = { void Layout2x2::refresh(bool setup) { - lcdDrawBitmap(0, 0, LBM_MAINVIEW_BACKGROUND); + theme->drawBackground(); if (persistentData->options[0].boolValue) { // Top Bar diff --git a/radio/src/gui/horus/layouts/layout2x4.cpp b/radio/src/gui/horus/layouts/layout2x4.cpp index ecfea25f3..f0d3ede5f 100644 --- a/radio/src/gui/horus/layouts/layout2x4.cpp +++ b/radio/src/gui/horus/layouts/layout2x4.cpp @@ -75,7 +75,7 @@ const ZoneOption Layout2x4::options[] = { void Layout2x4::refresh(bool setup) { - lcdDrawBitmap(0, 0, LBM_MAINVIEW_BACKGROUND); + theme->drawBackground(); if (persistentData->options[0].boolValue) { // Top Bar diff --git a/radio/src/gui/horus/lcd.cpp b/radio/src/gui/horus/lcd.cpp index 901c45604..8407e5b78 100644 --- a/radio/src/gui/horus/lcd.cpp +++ b/radio/src/gui/horus/lcd.cpp @@ -28,28 +28,6 @@ display_t displayBuf[DISPLAY_BUFFER_SIZE]; uint16_t lcdColorTable[LCD_COLOR_COUNT]; -void lcdColorsInit() -{ - lcdColorTable[TEXT_COLOR_INDEX] = BLACK; - lcdColorTable[TEXT_BGCOLOR_INDEX] = WHITE; - lcdColorTable[TEXT_INVERTED_COLOR_INDEX] = WHITE; - lcdColorTable[TEXT_INVERTED_BGCOLOR_INDEX] = RED; - lcdColorTable[LINE_COLOR_INDEX] = GREY; - lcdColorTable[SCROLLBOX_COLOR_INDEX] = RED; - lcdColorTable[MENU_TITLE_BGCOLOR_INDEX] = DARKGREY; - lcdColorTable[MENU_TITLE_COLOR_INDEX] = WHITE; - lcdColorTable[MENU_TITLE_DISABLE_COLOR_INDEX] = RGB(130, 1, 5); - lcdColorTable[HEADER_COLOR_INDEX] = DARKGREY; - lcdColorTable[ALARM_COLOR_INDEX] = RED; - lcdColorTable[WARNING_COLOR_INDEX] = YELLOW; - lcdColorTable[TEXT_DISABLE_COLOR_INDEX] = GREY; - lcdColorTable[CURVE_AXIS_COLOR_INDEX] = LIGHTGREY; - lcdColorTable[CURVE_COLOR_INDEX] = RED; - lcdColorTable[CURVE_CURSOR_COLOR_INDEX] = RED; - lcdColorTable[TITLE_BGCOLOR_INDEX] = RED; - lcdColorTable[HEADER_BGCOLOR_INDEX] = DARKRED; -} - coord_t lcdNextPos; #define FONT_CHARS_COUNT 103 @@ -973,7 +951,7 @@ void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * bmp, coord_t offset, co void lcdDrawBlackOverlay() { - lcdDrawFilledRect(0, 0, LCD_W, LCD_H, SOLID, TEXT_COLOR | (8<<24)); + lcdDrawFilledRect(0, 0, LCD_W, LCD_H, SOLID, OVERLAY_COLOR | (8<<24)); } void lcdDrawCircle(int x0, int y0, int radius) diff --git a/radio/src/gui/horus/lcd.h b/radio/src/gui/horus/lcd.h index 7b0b7310f..5db9f49fa 100644 --- a/radio/src/gui/horus/lcd.h +++ b/radio/src/gui/horus/lcd.h @@ -36,7 +36,6 @@ #define LCD_COLS 30 #define BSS 0x00 -#define FIXEDWIDTH 0x00 #define BOLD 0x00 /* lcd common flags */ @@ -65,7 +64,6 @@ #define MIDSIZE 0x0300 #define DBLSIZE 0x0400 #define XXLSIZE 0x0500 -#define ERASEBG 0x8000 #define VERTICAL 0x0800 #define TIMEBLINK 0x1000 @@ -91,6 +89,9 @@ #define LcdFlags uint32_t +#define OPACITY_MAX 0x0F +#define OPACITY(x) ((x)<<24) + enum LcdColorIndex { TEXT_COLOR_INDEX, @@ -110,18 +111,23 @@ enum LcdColorIndex CURVE_COLOR_INDEX, CURVE_CURSOR_COLOR_INDEX, HEADER_BGCOLOR_INDEX, + HEADER_ICON_BGCOLOR_INDEX, + HEADER_CURRENT_BGCOLOR_INDEX, TITLE_BGCOLOR_INDEX, + TRIM_BGCOLOR_INDEX, + TRIM_SHADOW_COLOR_INDEX, + MAINVIEW_PANES_COLOR_INDEX, + MAINVIEW_GRAPHICS_COLOR_INDEX, + OVERLAY_COLOR_INDEX, CUSTOM_COLOR_INDEX, LCD_COLOR_COUNT }; extern uint16_t lcdColorTable[LCD_COLOR_COUNT]; -void lcdColorsInit(); - -#define OPACITY_MAX 0x0F -#define OPACITY(x) ((x)<<24) #define COLOR(index) ((index) << 16) +#define COLOR_IDX(att) uint8_t((att) >> 16) + #define TEXT_COLOR COLOR(TEXT_COLOR_INDEX) #define TEXT_BGCOLOR COLOR(TEXT_BGCOLOR_INDEX) #define TEXT_INVERTED_COLOR COLOR(TEXT_INVERTED_COLOR_INDEX) @@ -140,11 +146,16 @@ void lcdColorsInit(); #define CURVE_COLOR COLOR(CURVE_COLOR_INDEX) #define CURVE_CURSOR_COLOR COLOR(CURVE_CURSOR_COLOR_INDEX) #define TITLE_BGCOLOR COLOR(TITLE_BGCOLOR_INDEX) +#define TRIM_BGCOLOR COLOR(TRIM_BGCOLOR_INDEX) +#define TRIM_SHADOW_COLOR COLOR(TRIM_SHADOW_COLOR_INDEX) #define HEADER_BGCOLOR COLOR(HEADER_BGCOLOR_INDEX) +#define HEADER_ICON_BGCOLOR COLOR(HEADER_ICON_BGCOLOR_INDEX) +#define HEADER_CURRENT_BGCOLOR COLOR(HEADER_CURRENT_BGCOLOR_INDEX) +#define MAINVIEW_PANES_COLOR COLOR(MAINVIEW_PANES_COLOR_INDEX) +#define MAINVIEW_GRAPHICS_COLOR COLOR(MAINVIEW_GRAPHICS_COLOR_INDEX) +#define OVERLAY_COLOR COLOR(OVERLAY_COLOR_INDEX) #define CUSTOM_COLOR COLOR(CUSTOM_COLOR_INDEX) -#define COLOR_IDX(att) uint8_t((att) >> 16) - #define COLOR_SPLIT(color, r, g, b) \ uint16_t r = ((color) & 0xF800) >> 11; \ uint16_t g = ((color) & 0x07E0) >> 5; \ @@ -171,10 +182,10 @@ extern uint32_t CurrentFrameBuffer; extern coord_t lcdNextPos; -void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags attr=TEXT_COLOR); -void lcdDrawText(coord_t x, coord_t y, const pm_char * s, LcdFlags attr=TEXT_COLOR); -void lcdDrawTextAtIndex(coord_t x, coord_t y, const pm_char * s, uint8_t idx, LcdFlags attr=TEXT_COLOR); -void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, uint8_t len, LcdFlags attr=TEXT_COLOR); +void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags attr=0); +void lcdDrawText(coord_t x, coord_t y, const pm_char * s, LcdFlags attr=0); +void lcdDrawTextAtIndex(coord_t x, coord_t y, const pm_char * s, uint8_t idx, LcdFlags attr=0); +void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, uint8_t len, LcdFlags attr=0); void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, unsigned char len); void lcd_putsCenter(coord_t y, const pm_char * s, LcdFlags attr=0); void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags mode=0); diff --git a/radio/src/gui/horus/menu_general_version.cpp b/radio/src/gui/horus/menu_general_version.cpp index f5d83abb2..3acd45539 100644 --- a/radio/src/gui/horus/menu_general_version.cpp +++ b/radio/src/gui/horus/menu_general_version.cpp @@ -22,7 +22,7 @@ bool menuGeneralVersion(evt_t event) { - SIMPLE_MENU(STR_MENUVERSION, LBM_RADIO_ICONS, menuTabGeneral, e_Vers, 1); + SIMPLE_MENU(STR_MENUVERSION, LBM_RADIO_ICONS, menuTabGeneral, e_Vers, 0); lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + FH, vers_stamp); lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 2*FH, date_stamp); diff --git a/radio/src/gui/horus/menu_model_select.cpp b/radio/src/gui/horus/menu_model_select.cpp index 276ada059..e4de85be1 100644 --- a/radio/src/gui/horus/menu_model_select.cpp +++ b/radio/src/gui/horus/menu_model_select.cpp @@ -200,10 +200,7 @@ bool menuModelSelect(evt_t event) } // Header - lcdDrawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR); - lcdDrawBitmapPattern(0, 0, LBM_TOPMENU_POLYGON, TITLE_BGCOLOR); - lcdDrawBitmapPattern(5, 7, LBM_LIBRARY_ICON, MENU_TITLE_COLOR); - drawTopmenuDatetime(); + theme->drawTopbarBackground(LBM_LIBRARY_ICON); // Body lcdDrawSolidFilledRect(0, MENU_HEADER_HEIGHT, CATEGORIES_WIDTH, LCD_H-MENU_HEADER_HEIGHT-MENU_FOOTER_HEIGHT, TITLE_BGCOLOR); diff --git a/radio/src/gui/horus/menus.h b/radio/src/gui/horus/menus.h index ba9a4dc48..55c65914c 100644 --- a/radio/src/gui/horus/menus.h +++ b/radio/src/gui/horus/menus.h @@ -34,17 +34,15 @@ #define MIXES_2ND_COLUMN 100 #define COLUMN_HEADER_X 150 -typedef int16_t vertpos_t; - typedef evt_t & check_event_t; #define horzpos_t int8_t extern uint8_t menuPageIndex; extern uint8_t menuPageCount; extern uint16_t linesCount; -extern vertpos_t menuVerticalPosition; +extern int menuVerticalPosition; extern horzpos_t menuHorizontalPosition; -extern vertpos_t menuVerticalOffset; +extern int menuVerticalOffset; extern uint8_t calibrationState; // Temporary no highlight @@ -158,7 +156,7 @@ bool menuMainViewChannelsMonitor(evt_t event); bool menuChannelsView(evt_t event); bool menuChannelsView(evt_t event); bool menuTextView(evt_t event); -bool menuSetupScreensView(evt_t event); +bool menuScreensTheme(evt_t event); #if defined(DEBUG_TRACE_BUFFER) void menuTraceBuffer(evt_t event); @@ -260,18 +258,21 @@ swsrc_t checkIncDecMovedSwitch(swsrc_t val); checkIncDec(event, var, min, max, incdecFlag, isValueAvailable) bool navigate(evt_t event, int count, int rows, int columns=1); -bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow, uint8_t flags=0); -bool check_simple(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, vertpos_t maxrow); +bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, int maxrow, uint8_t flags=0); +bool check_simple(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, int maxrow); bool check_submenu_simple(check_event_t event, uint8_t maxrow); #define MENU_TAB(...) const uint8_t mstate_tab[] = __VA_ARGS__ -#define MENU(title, icons, tab, menu, lines_count, ...) \ +#define MENU_WITH_OPTIONS(title, icons, tab, tabCount, menu, lines_count, ...) \ MENU_TAB(__VA_ARGS__); \ if (event == EVT_ENTRY || event == EVT_ENTRY_UP) TRACE("Menu %s displayed ...", title); \ - if (!check(event, menu, tab, DIM(tab), mstate_tab, DIM(mstate_tab)-1, lines_count)) return false; \ + if (!check(event, menu, tab, tabCount, mstate_tab, DIM(mstate_tab)-1, lines_count)) return false; \ drawMenuTemplate(title, icons); \ +#define MENU(title, icons, tab, menu, lines_count, ...) \ + MENU_WITH_OPTIONS(title, icons, tab, DIM(tab), menu, lines_count, __VA_ARGS__) + #define SIMPLE_MENU(title, icons, tab, menu, lines_count) \ if (event == EVT_ENTRY || event == EVT_ENTRY_UP) TRACE("Menu %s displayed ...", title); \ if (!check_simple(event, menu, tab, DIM(tab), lines_count)) return false; \ diff --git a/radio/src/gui/horus/navigation.cpp b/radio/src/gui/horus/navigation.cpp index fbf726447..79448eec2 100644 --- a/radio/src/gui/horus/navigation.cpp +++ b/radio/src/gui/horus/navigation.cpp @@ -20,8 +20,8 @@ #include "../../opentx.h" -vertpos_t menuVerticalOffset; -vertpos_t menuVerticalPosition; +int menuVerticalOffset; +int menuVerticalPosition; horzpos_t menuHorizontalPosition; int8_t s_editMode; uint8_t noHighlightCounter; @@ -325,10 +325,10 @@ int checkIncDec(evt_t event, int val, int i_min, int i_max, unsigned int i_flags } #define CURSOR_NOT_ALLOWED_IN_ROW(row) ((int8_t)MAXCOL(row) < 0) -#define MAXCOL_RAW(row) ((row) >= 0 && horTab ? pgm_read_byte(horTab+min(row, (vertpos_t)horTabMax)) : (const uint8_t)0) +#define MAXCOL_RAW(row) ((row) >= 0 && horTab ? pgm_read_byte(horTab+min(row, (int)horTabMax)) : (const uint8_t)0) #define MAXCOL(row) (MAXCOL_RAW(row) >= HIDDEN_ROW ? MAXCOL_RAW(row) : (const uint8_t)(MAXCOL_RAW(row) & (~NAVIGATION_LINE_BY_LINE))) #define COLATTR(row) (MAXCOL_RAW(row) == (uint8_t)-1 ? (const uint8_t)0 : (const uint8_t)(MAXCOL_RAW(row) & NAVIGATION_LINE_BY_LINE)) -#define INC(val, min, max) if (val=0) {val=min;} #define DEC(val, min, max) if (val>min) {val--;} else {val=max;} uint8_t menuPageIndex; @@ -407,7 +407,7 @@ bool navigate(evt_t event, int count, int rows, int columns) return (prevPosHorz != menuHorizontalPosition || prevPosVert != menuVerticalPosition); } -bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const pm_uint8_t * horTab, uint8_t horTabMax, vertpos_t rowcount, uint8_t flags) +bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const pm_uint8_t * horTab, uint8_t horTabMax, int rowcount, uint8_t flags) { uint8_t maxcol = MAXCOL(menuVerticalPosition); @@ -543,6 +543,7 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u do { INC(menuVerticalPosition, MENU_FIRST_LINE_EDIT, rowcount-1); } while (CURSOR_NOT_ALLOWED_IN_ROW(menuVerticalPosition)); + s_editMode = 0; // if we go down, we must be in this mode uint8_t newmaxcol = MAXCOL(menuVerticalPosition); if (COLATTR(menuVerticalPosition) & NAVIGATION_LINE_BY_LINE) { @@ -612,7 +613,7 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u else if (horTab) { if (rowcount > linesDisplayed) { while (1) { - vertpos_t firstLine = 0; + int firstLine = 0; for (int numLines=0; firstLine=horTabMax || horTab[firstLine] != HIDDEN_ROW) { numLines++; @@ -622,7 +623,7 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u menuVerticalOffset--; } else { - vertpos_t lastLine = firstLine; + int lastLine = firstLine; for (int numLines=0; lastLine= horTabMax || horTab[lastLine] != HIDDEN_ROW) { numLines++; @@ -656,7 +657,7 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u return true; } -bool check_simple(check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, vertpos_t rowcount) +bool check_simple(check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, int rowcount) { return check(event, curr, menuTab, menuTabSize, NULL, 0, rowcount); } diff --git a/radio/src/gui/horus/screens_setup.cpp b/radio/src/gui/horus/screens_setup.cpp index 9a9073cee..8baa19cc7 100644 --- a/radio/src/gui/horus/screens_setup.cpp +++ b/radio/src/gui/horus/screens_setup.cpp @@ -28,6 +28,7 @@ Widget * currentWidget; void onWidgetChoiceMenu(const char * result) { customScreens[0]->setWidget(menuVerticalPosition, result); + storageDirty(EE_MODEL); } ZoneOptionValue editZoneOption(coord_t y, const ZoneOption * option, ZoneOptionValue value, LcdFlags attr, evt_t event) @@ -117,6 +118,7 @@ void onZoneMenu(const char * result) } else if (result == STR_REMOVE_WIDGET) { currentScreen->setWidget(menuVerticalPosition, NULL); + storageDirty(EE_MODEL); } } @@ -160,20 +162,112 @@ bool menuSetupWidgets(evt_t event) return true; } -bool menuSetupScreensView(evt_t event) +extern MenuHandlerFunc menuTabMainviews[1+MAX_CUSTOM_SCREENS]; +extern int updateMainviewsMenu(); + +template +T * editThemeChoice(coord_t x, coord_t y, T * array[], uint8_t count, T * current, bool needsOffsetCheck, LcdFlags attr, evt_t event) { static uint8_t menuHorizontalOffset; - currentScreen = customScreens[0]; - - int layoutIndex = 0; - for (unsigned int i=0; igetFactory()) { - layoutIndex = i; + int currentIndex = 0; + for (unsigned int i=0; i menuHorizontalOffset + 3) { + menuHorizontalOffset = currentIndex - 3; + } + } + if (attr) { + if (menuHorizontalPosition < 0) { + lcdDrawSolidFilledRect(x-3, y-2, min(4, count)*56+1, 2*FH-5, TEXT_INVERTED_BGCOLOR); + } + else { + if (needsOffsetCheck) { + menuHorizontalPosition = currentIndex; + } + else if (menuHorizontalPosition < menuHorizontalOffset) { + menuHorizontalOffset = menuHorizontalPosition; + } + else if (menuHorizontalPosition > menuHorizontalOffset + 3) { + menuHorizontalOffset = menuHorizontalPosition - 3; + } + } + } + unsigned int last = min(menuHorizontalOffset + 4, count); + for (unsigned int i=menuHorizontalOffset, pos=x; idrawThumb(pos, y, current == element ? ((attr && menuHorizontalPosition < 0) ? TEXT_INVERTED_COLOR : TEXT_INVERTED_BGCOLOR) : LINE_COLOR); + } + if (count > 4) { + lcdDrawBitmapPattern(x - 12, y, LBM_CARROUSSEL_LEFT, menuHorizontalOffset > 0 ? LINE_COLOR : CURVE_AXIS_COLOR); + lcdDrawBitmapPattern(x + 4 * 56, y, LBM_CARROUSSEL_RIGHT, last < countRegisteredLayouts ? LINE_COLOR : CURVE_AXIS_COLOR); + } + if (attr && menuHorizontalPosition >= 0) { + lcdDrawSolidRect(x + (menuHorizontalPosition - menuHorizontalOffset) * 56 - 3, y - 2, 57, 35, TEXT_INVERTED_BGCOLOR); + if (menuHorizontalPosition != currentIndex && event == EVT_KEY_BREAK(KEY_ENTER)) { + s_editMode = 0; + return array[menuHorizontalPosition]; + } + } + return NULL; +} + +bool menuScreensTheme(evt_t event) +{ + bool needsOffsetCheck = (menuVerticalPosition != 0 || menuHorizontalPosition < 0); + + int menuItemsCount = updateMainviewsMenu(); + MENU_WITH_OPTIONS("User interface", LBM_MAINVIEWS_ICONS, menuTabMainviews, menuItemsCount, 0, 1, { uint8_t(NAVIGATION_LINE_BY_LINE|uint8_t(countRegisteredLayouts-1)), ORPHAN_ROW, 0, 0, 0, 0 }); + + for (int i=0; i 0) ? BLINK | INVERS : INVERS); + LcdFlags attr = (menuVerticalPosition == k ? blink : 0); + switch (k) { + case 0: { + lcdDrawText(MENUS_MARGIN_LEFT, y + FH / 2, "Theme"); + const Theme * new_theme = editThemeChoice(SCREENS_SETUP_2ND_COLUMN, y, registeredThemes, countRegisteredThemes, theme, needsOffsetCheck, attr, event); + if (new_theme) { + theme = new_theme; + theme->load(); + // strncpy(g_model.screenData[T].layoutName, factory->getName(), sizeof(g_model.screenData[T].layoutName)); + storageDirty(EE_MODEL); + } + break; + } + + case 1: + break; + } + } +} + +bool menuScreenAdd(evt_t event) +{ + int menuItemsCount = updateMainviewsMenu(); + MENU_WITH_OPTIONS("Add main view", LBM_MAINVIEWS_ICONS, menuTabMainviews, menuItemsCount, menuItemsCount-1, 0, { uint8_t(NAVIGATION_LINE_BY_LINE|uint8_t(countRegisteredLayouts-1)), ORPHAN_ROW, 0, 0, 0, 0 }); +} + +template +bool menuScreenSetup(evt_t event) +{ + currentScreen = customScreens[T]; + bool needsOffsetCheck = (menuVerticalPosition != 0 || menuHorizontalPosition < 0); linesCount = 3; @@ -182,7 +276,10 @@ bool menuSetupScreensView(evt_t event) linesCount++; } - SUBMENU_WITH_OPTIONS("Main views setup", LBM_MAINVIEWS_ICON, linesCount, OPTION_MENU_TITLE_BAR, { uint8_t(NAVIGATION_LINE_BY_LINE|uint8_t(countRegisteredLayouts-1)), ORPHAN_ROW, 0, 0, 0, 0 }); + char title[] = "Main view X"; + title[sizeof(title)-2] = '1' + T; + int menuItemsCount = updateMainviewsMenu(); + MENU_WITH_OPTIONS(title, LBM_MAINVIEWS_ICONS, menuTabMainviews, menuItemsCount, T+1, linesCount, { uint8_t(NAVIGATION_LINE_BY_LINE|uint8_t(countRegisteredLayouts-1)), ORPHAN_ROW, 0, 0, 0, 0 }); for (int i=0; i0) ? BLINK|INVERS : INVERS); LcdFlags attr = (menuVerticalPosition == k ? blink : 0); switch(k) { - case 0: { + case 0: + { lcdDrawText(MENUS_MARGIN_LEFT, y + FH / 2, "Layout"); - if (needsOffsetCheck) { - if (layoutIndex < menuHorizontalOffset) { - menuHorizontalOffset = layoutIndex; - } - else if (layoutIndex > menuHorizontalOffset + 3) { - menuHorizontalOffset = layoutIndex - 3; - } - } - if (attr) { - if (menuHorizontalPosition < 0) { - lcdDrawSolidFilledRect(SCREENS_SETUP_2ND_COLUMN-3, y-2, 4*56+1, 2*FH-5, TEXT_INVERTED_BGCOLOR); - } - else { - if (needsOffsetCheck) { - menuHorizontalPosition = layoutIndex; - } - else if (menuHorizontalPosition < menuHorizontalOffset) { - menuHorizontalOffset = menuHorizontalPosition; - } - else if (menuHorizontalPosition > menuHorizontalOffset + 3) { - menuHorizontalOffset = menuHorizontalPosition - 3; - } - } - } - unsigned int lastDisplayedLayout = min(menuHorizontalOffset + 4, countRegisteredLayouts); - for (unsigned int i=menuHorizontalOffset, x=SCREENS_SETUP_2ND_COLUMN; idrawThumb(x, y, currentScreen->getFactory() == factory ? (menuHorizontalPosition < 0 ? TEXT_INVERTED_COLOR : TEXT_INVERTED_BGCOLOR) : LINE_COLOR); - } - lcdDrawBitmapPattern(SCREENS_SETUP_2ND_COLUMN - 12, y, LBM_CARROUSSEL_LEFT, menuHorizontalOffset > 0 ? LINE_COLOR : CURVE_AXIS_COLOR); - lcdDrawBitmapPattern(SCREENS_SETUP_2ND_COLUMN + 4 * 56, y, LBM_CARROUSSEL_RIGHT, lastDisplayedLayout < countRegisteredLayouts ? LINE_COLOR : CURVE_AXIS_COLOR); - if (attr && menuHorizontalPosition >= 0) { - lcdDrawSolidRect(SCREENS_SETUP_2ND_COLUMN + (menuHorizontalPosition - menuHorizontalOffset) * 56 - 3, y - 2, 57, 35, TEXT_INVERTED_BGCOLOR); - if (menuHorizontalPosition != layoutIndex && event == EVT_KEY_BREAK(KEY_ENTER)) { - s_editMode = 0; - customScreens[0] = registeredLayouts[menuHorizontalPosition]->create(&g_model.screenData[0].layoutData); - strncpy(g_model.screenData[0].layoutName, customScreens[0]->getFactory()->getName(), sizeof(g_model.screenData[0].layoutName)); - storageDirty(EE_MODEL); - return false; - } + const LayoutFactory * factory = editThemeChoice(SCREENS_SETUP_2ND_COLUMN, y, registeredLayouts, countRegisteredLayouts, currentScreen->getFactory(), needsOffsetCheck, attr, event); + if (factory) { + customScreens[T] = factory->create(&g_model.screenData[T].layoutData); + strncpy(g_model.screenData[T].layoutName, factory->getName(), sizeof(g_model.screenData[T].layoutName)); + storageDirty(EE_MODEL); } break; } @@ -262,3 +325,36 @@ bool menuSetupScreensView(evt_t event) return true; } + +MenuHandlerFunc menuTabMainviews[1+MAX_CUSTOM_SCREENS] = { + menuScreensTheme, + menuScreenSetup<0>, + menuScreenSetup<1>, + menuScreenSetup<2>, + menuScreenSetup<3>, + menuScreenSetup<4> +}; + +const MenuHandlerFunc menuMainviews[MAX_CUSTOM_SCREENS] = { + menuScreenSetup<0>, + menuScreenSetup<1>, + menuScreenSetup<2>, + menuScreenSetup<3>, + menuScreenSetup<4> +}; + +int updateMainviewsMenu() +{ + for (int index=1; indexgetName())) { + return theme; + } + } + return NULL; +} + diff --git a/radio/src/gui/horus/theme.h b/radio/src/gui/horus/theme.h new file mode 100644 index 000000000..b0b842d69 --- /dev/null +++ b/radio/src/gui/horus/theme.h @@ -0,0 +1,66 @@ +/* + * 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 _THEME_H_ +#define _THEME_H_ + +class Theme; + +void registerTheme(const Theme * theme); + +class Theme +{ + public: + Theme(const char * name, const uint8_t * bitmap): + name(name), + bitmap(bitmap) + { + registerTheme(this); + } + + const char * getName() const + { + return name; + } + + virtual void drawThumb(uint16_t x, uint16_t y, uint32_t flags) const + { + extern void lcdDrawBitmap(int x, int y, const uint8_t * bitmap, int offset=0, int height=0, int scale=0); + lcdDrawBitmap(x, y, bitmap); + } + + virtual void load() const = 0; + + virtual void drawBackground() const = 0; + + virtual void drawTopbarBackground(const uint8_t * icon) const = 0; + + protected: + const char * name; + const uint8_t * bitmap; +}; + +extern const Theme * theme; + +#define MAX_REGISTERED_THEMES 10 +extern unsigned int countRegisteredThemes; +extern const Theme * registeredThemes[MAX_REGISTERED_THEMES]; // TODO dynamic + +#endif // _THEME_H_ diff --git a/radio/src/gui/horus/themes/bmp_darkblue.png b/radio/src/gui/horus/themes/bmp_darkblue.png new file mode 100644 index 0000000000000000000000000000000000000000..108b4c007e8c8ddef327b2771e1437001a928627 GIT binary patch literal 1184 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 literal 0 HcmV?d00001 diff --git a/radio/src/gui/horus/themes/darkblue.cpp b/radio/src/gui/horus/themes/darkblue.cpp new file mode 100644 index 000000000..583510c47 --- /dev/null +++ b/radio/src/gui/horus/themes/darkblue.cpp @@ -0,0 +1,89 @@ +/* + * 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 "opentx.h" + +const uint8_t LBM_TOPMENU_BMP_OPENTX[] = { +#include "bmp_topmenu_opentx.lbm" +}; + +class DarkblueTheme: public Theme +{ + public: + DarkblueTheme(const char * name, const uint8_t * bitmap): + Theme(name, bitmap) + { + } + + virtual void load() const + { + lcdColorTable[TEXT_COLOR_INDEX] = WHITE; + lcdColorTable[TEXT_BGCOLOR_INDEX] = RGB(10, 78, 121); + lcdColorTable[TEXT_INVERTED_COLOR_INDEX] = WHITE; + lcdColorTable[TEXT_INVERTED_BGCOLOR_INDEX] = RGB(32, 34, 42); + lcdColorTable[LINE_COLOR_INDEX] = GREY; + lcdColorTable[SCROLLBOX_COLOR_INDEX] = WHITE; + lcdColorTable[MENU_TITLE_BGCOLOR_INDEX] = DARKGREY; + lcdColorTable[MENU_TITLE_COLOR_INDEX] = WHITE; + lcdColorTable[MENU_TITLE_DISABLE_COLOR_INDEX] = BLACK; + lcdColorTable[HEADER_COLOR_INDEX] = RGB(32, 34, 42); + lcdColorTable[ALARM_COLOR_INDEX] = RGB(32, 34, 42); + lcdColorTable[WARNING_COLOR_INDEX] = YELLOW; + lcdColorTable[TEXT_DISABLE_COLOR_INDEX] = GREY; + lcdColorTable[CURVE_AXIS_COLOR_INDEX] = LIGHTGREY; + lcdColorTable[CURVE_COLOR_INDEX] = RGB(32, 34, 42); + lcdColorTable[CURVE_CURSOR_COLOR_INDEX] = RGB(32, 34, 42); + lcdColorTable[TITLE_BGCOLOR_INDEX] = RGB(32, 34, 42); + lcdColorTable[TRIM_BGCOLOR_INDEX] = RGB(32, 34, 42); + lcdColorTable[TRIM_SHADOW_COLOR_INDEX] = RGB(100, 100, 100); + lcdColorTable[MAINVIEW_PANES_COLOR_INDEX] = GREY; + lcdColorTable[MAINVIEW_GRAPHICS_COLOR_INDEX] = WHITE; + lcdColorTable[HEADER_BGCOLOR_INDEX] = RGB(32, 34, 42); + lcdColorTable[HEADER_ICON_BGCOLOR_INDEX] = BLACK; + lcdColorTable[HEADER_CURRENT_BGCOLOR_INDEX] = RGB(10, 78, 121); + lcdColorTable[OVERLAY_COLOR_INDEX] = BLACK; + } + + virtual void drawBackground() const + { + lcdDrawSolidFilledRect(0, 0, LCD_W, LCD_H, TEXT_BGCOLOR); + } + + void drawTopbarBackground(const uint8_t * icon) const + { + lcdDrawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR); + lcdDrawSolidFilledRect(0, 0, 41, MENU_HEADER_HEIGHT, HEADER_ICON_BGCOLOR); + + if (icon) { + lcdDrawBitmapPattern(5, 7, icon, MENU_TITLE_COLOR); + } + else { + lcdDrawBitmap(5, 7, LBM_TOPMENU_BMP_OPENTX); + } + + drawTopbarDatetime(); + } +}; + +const uint8_t LBM_THEME_DARKBLUE[] __DMA = { +#include "bmp_darkblue.lbm" +}; + +DarkblueTheme darkblueTheme("Darkblue", LBM_THEME_DARKBLUE); \ No newline at end of file diff --git a/radio/src/gui/horus/themes/default.cpp b/radio/src/gui/horus/themes/default.cpp new file mode 100644 index 000000000..934902476 --- /dev/null +++ b/radio/src/gui/horus/themes/default.cpp @@ -0,0 +1,94 @@ +/* + * 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 "opentx.h" + +const uint8_t LBM_TOPMENU_MASK_OPENTX[] = { +#include "mask_topmenu_opentx.lbm" +}; + +const uint8_t LBM_MAINVIEW_BACKGROUND[] = { +#include "bmp_background.lbm" +}; + +class DefaultTheme: public Theme +{ + public: + DefaultTheme(const char * name, const uint8_t * bitmap): + Theme(name, bitmap) + { + } + + virtual void load() const + { + lcdColorTable[TEXT_COLOR_INDEX] = BLACK; + lcdColorTable[TEXT_BGCOLOR_INDEX] = WHITE; + lcdColorTable[TEXT_INVERTED_COLOR_INDEX] = WHITE; + lcdColorTable[TEXT_INVERTED_BGCOLOR_INDEX] = RED; + lcdColorTable[LINE_COLOR_INDEX] = GREY; + lcdColorTable[SCROLLBOX_COLOR_INDEX] = RED; + lcdColorTable[MENU_TITLE_BGCOLOR_INDEX] = DARKGREY; + lcdColorTable[MENU_TITLE_COLOR_INDEX] = WHITE; + lcdColorTable[MENU_TITLE_DISABLE_COLOR_INDEX] = RGB(130, 1, 5); + lcdColorTable[HEADER_COLOR_INDEX] = DARKGREY; + lcdColorTable[ALARM_COLOR_INDEX] = RED; + lcdColorTable[WARNING_COLOR_INDEX] = YELLOW; + lcdColorTable[TEXT_DISABLE_COLOR_INDEX] = GREY; + lcdColorTable[CURVE_AXIS_COLOR_INDEX] = LIGHTGREY; + lcdColorTable[CURVE_COLOR_INDEX] = RED; + lcdColorTable[CURVE_CURSOR_COLOR_INDEX] = RED; + lcdColorTable[TITLE_BGCOLOR_INDEX] = RED; + lcdColorTable[TRIM_BGCOLOR_INDEX] = RED; + lcdColorTable[TRIM_SHADOW_COLOR_INDEX] = BLACK; + lcdColorTable[MAINVIEW_PANES_COLOR_INDEX] = WHITE; + lcdColorTable[MAINVIEW_GRAPHICS_COLOR_INDEX] = RED; + lcdColorTable[HEADER_BGCOLOR_INDEX] = DARKRED; + lcdColorTable[HEADER_ICON_BGCOLOR_INDEX] = RED; + lcdColorTable[HEADER_CURRENT_BGCOLOR_INDEX] = RED; + lcdColorTable[OVERLAY_COLOR_INDEX] = BLACK; + } + + virtual void drawBackground() const + { + lcdDrawBitmap(0, 0, LBM_MAINVIEW_BACKGROUND); + } + + virtual void drawTopbarBackground(const uint8_t * icon) const + { + lcdDrawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR); + lcdDrawBitmapPattern(0, 0, LBM_TOPMENU_POLYGON, TITLE_BGCOLOR); + + if (icon) { + lcdDrawBitmapPattern(5, 7, icon, MENU_TITLE_COLOR); + } + else { + lcdDrawBitmapPattern(4, 10, LBM_TOPMENU_MASK_OPENTX, MENU_TITLE_COLOR); + } + + drawTopbarDatetime(); + } +}; + +const uint8_t LBM_THEME_DEFAULT[] __DMA = { +#include "bmp_default.lbm" +}; + +const DefaultTheme defaultTheme("Default", LBM_THEME_DEFAULT); +const Theme * theme = &defaultTheme; \ No newline at end of file diff --git a/radio/src/gui/horus/view_about.cpp b/radio/src/gui/horus/view_about.cpp index 978351364..ae6e86a1d 100644 --- a/radio/src/gui/horus/view_about.cpp +++ b/radio/src/gui/horus/view_about.cpp @@ -62,7 +62,7 @@ bool menuAboutView(evt_t event) break; } - drawScreenTemplate("About", LBM_TOPMENU_OPENTX); + drawScreenTemplate("About", NULL); uint8_t screenDuration = 150; diff --git a/radio/src/gui/horus/view_main.cpp b/radio/src/gui/horus/view_main.cpp index be9b842f5..272f618c7 100644 --- a/radio/src/gui/horus/view_main.cpp +++ b/radio/src/gui/horus/view_main.cpp @@ -88,13 +88,7 @@ void drawMainViewTopBar() const int ALTITUDE_H = 30; const int PADDING = 4; - // Background - lcdDrawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR); - lcdDrawBitmapPattern(0, 0, LBM_TOPMENU_POLYGON, TITLE_BGCOLOR); - lcdDrawBitmapPattern(4, 10, LBM_TOPMENU_OPENTX, MENU_TITLE_COLOR); - - // Date & Time - drawTopmenuDatetime(); + theme->drawTopbarBackground(NULL); // USB icon if (usbPlugged()) { @@ -193,7 +187,7 @@ void onMainViewMenu(const char *result) chainMenu(menuStatisticsView); } else if (result == STR_SETUP_SCREENS) { - pushMenu(menuSetupScreensView); + pushMenu(menuScreensTheme); } else if (result == STR_ABOUT_US) { chainMenu(menuAboutView); diff --git a/radio/src/gui/horus/view_text.cpp b/radio/src/gui/horus/view_text.cpp index a1795b91d..6e86afeb4 100644 --- a/radio/src/gui/horus/view_text.cpp +++ b/radio/src/gui/horus/view_text.cpp @@ -91,7 +91,7 @@ bool menuTextView(evt_t event) { static int lines_count; - drawScreenTemplate("TEXT VIEWER", LBM_TOPMENU_OPENTX); + drawScreenTemplate("TEXT VIEWER", NULL); switch (event) { case EVT_ENTRY: diff --git a/radio/src/gui/horus/widgets.cpp b/radio/src/gui/horus/widgets.cpp index af145c887..924786965 100644 --- a/radio/src/gui/horus/widgets.cpp +++ b/radio/src/gui/horus/widgets.cpp @@ -33,7 +33,7 @@ const char * STR_MONTHS[] = { "Jan", "Fev", "Mar", "Apr", "May", "Jun", "Jul", " #define DATETIME_LINE2 23 #define DATETIME_LEFT(s) (LCD_W+DATETIME_SEPARATOR_X+8-getTextWidth(s, SMLSIZE))/2 -void drawTopmenuDatetime() +void drawTopbarDatetime() { lcdDrawSolidVerticalLine(DATETIME_SEPARATOR_X, 7, 31, TEXT_INVERTED_COLOR); @@ -149,11 +149,7 @@ void drawScreenTemplate(const char * title, const uint8_t * icon, uint32_t optio { coord_t bodyTop, bodyBottom; - // Header - lcdDrawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR); - lcdDrawBitmapPattern(0, 0, LBM_TOPMENU_POLYGON, TITLE_BGCOLOR); - lcdDrawBitmapPattern(5, 7, icon, MENU_TITLE_COLOR); - drawTopmenuDatetime(); + theme->drawTopbarBackground(icon); // Menu title bar if (options & OPTION_MENU_TITLE_BAR) { @@ -196,10 +192,13 @@ void drawMenuTemplate(const char * title, const uint8_t * const * icons, uint32_ drawScreenTemplate(title, icons[0], OPTION_MENU_TITLE_BAR); if (menuVerticalPosition < 0) { - lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING-10, 0, LBM_CURRENT_BG, TITLE_BGCOLOR); + lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING-10, 0, LBM_CURRENT_BG, HEADER_CURRENT_BGCOLOR); + + lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING-10, 0, LBM_CURRENT_SHADOW, TRIM_SHADOW_COLOR); + lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING, MENU_TITLE_TOP-9, LBM_CURRENT_DOT, MENU_TITLE_COLOR); } else { - lcdDrawSolidFilledRect(58+menuPageIndex*MENU_ICONS_SPACING-9, 0, 32, MENU_HEADER_HEIGHT, TITLE_BGCOLOR); + lcdDrawSolidFilledRect(58+menuPageIndex*MENU_ICONS_SPACING-9, 0, 32, MENU_HEADER_HEIGHT, HEADER_CURRENT_BGCOLOR); lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING, MENU_TITLE_TOP-9, LBM_DOT, MENU_TITLE_COLOR); } @@ -208,8 +207,7 @@ void drawMenuTemplate(const char * title, const uint8_t * const * icons, uint32_ } if (menuVerticalPosition < 0) { - lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING-10, 0, LBM_CURRENT_SHADOW, TEXT_COLOR); - lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING, MENU_TITLE_TOP-9, LBM_CURRENT_DOT, MENU_TITLE_COLOR); + } } @@ -235,8 +233,8 @@ int8_t switchMenuItem(coord_t x, coord_t y, int8_t value, LcdFlags attr, evt_t e void drawTrimSquare(coord_t x, coord_t y) { - lcdDrawSolidFilledRect(x-2, y, 15, 15, TITLE_BGCOLOR); - lcdDrawBitmapPattern(x-2, y, LBM_TRIM_SHADOW, TEXT_COLOR); + lcdDrawSolidFilledRect(x-2, y, 15, 15, TRIM_BGCOLOR); + lcdDrawBitmapPattern(x-2, y, LBM_TRIM_SHADOW, TRIM_SHADOW_COLOR); } void drawHorizontalTrimPosition(coord_t x, coord_t y, int16_t dir) diff --git a/radio/src/gui/horus/widgets.h b/radio/src/gui/horus/widgets.h index f9cb3a526..123e011bb 100644 --- a/radio/src/gui/horus/widgets.h +++ b/radio/src/gui/horus/widgets.h @@ -41,7 +41,7 @@ void drawColumnHeader(const char * const * headers, uint8_t index); -void drawTopmenuDatetime(); +void drawTopbarDatetime(); void drawStick(coord_t x, coord_t y, int16_t xval, int16_t yval); #define BUTTON_ON 0x10 diff --git a/radio/src/gui/horus/widgets/modelpanel.cpp b/radio/src/gui/horus/widgets/modelpanel.cpp index db73d6dbc..b3830294f 100644 --- a/radio/src/gui/horus/widgets/modelpanel.cpp +++ b/radio/src/gui/horus/widgets/modelpanel.cpp @@ -34,10 +34,10 @@ class ModelPanelWidget: public Widget void ModelPanelWidget::refresh() { if (zone.h >= MODEL_BITMAP_HEIGHT) { - lcdDrawFilledRect(zone.x, zone.y, zone.w, zone.h, SOLID, TEXT_BGCOLOR | OPACITY(5)); - lcdDrawBitmapPattern(zone.x + 6, zone.y + 4, LBM_MODEL_ICON, TITLE_BGCOLOR); + lcdDrawFilledRect(zone.x, zone.y, zone.w, zone.h, SOLID, MAINVIEW_PANES_COLOR | OPACITY(5)); + lcdDrawBitmapPattern(zone.x + 6, zone.y + 4, LBM_MODEL_ICON, MAINVIEW_GRAPHICS_COLOR); lcdDrawSizedText(zone.x + 45, zone.y + 10, g_model.header.name, LEN_MODEL_NAME, ZCHAR | SMLSIZE); - lcdDrawSolidHorizontalLine(zone.x + 39, zone.y + 27, zone.w - 48, TITLE_BGCOLOR); + lcdDrawSolidHorizontalLine(zone.x + 39, zone.y + 27, zone.w - 48, MAINVIEW_GRAPHICS_COLOR); int scale = getBitmapScale(modelBitmap, zone.w, zone.h - 25); int width = getBitmapScaledSize(getBitmapWidth(modelBitmap), scale); int height = getBitmapScaledSize(getBitmapHeight(modelBitmap), scale); @@ -47,7 +47,7 @@ void ModelPanelWidget::refresh() int scale = getBitmapScale(modelBitmap, zone.w, zone.h); int width = getBitmapScaledSize(getBitmapWidth(modelBitmap), scale); int height = getBitmapScaledSize(getBitmapHeight(modelBitmap), scale); - lcdDrawFilledRect(zone.x, zone.y, zone.w, height, SOLID, TEXT_BGCOLOR | OPACITY(5)); + lcdDrawFilledRect(zone.x, zone.y, zone.w, height, SOLID, MAINVIEW_PANES_COLOR | OPACITY(5)); lcdDrawSizedText(zone.x + 5, zone.y + 10, g_model.header.name, LEN_MODEL_NAME, ZCHAR | SMLSIZE); lcdDrawBitmap(zone.x + zone.w - width, zone.y, modelBitmap, 0, 0, scale); } diff --git a/radio/src/gui/horus/widgets/timer.cpp b/radio/src/gui/horus/widgets/timer.cpp index 5c39d302f..ef646c444 100644 --- a/radio/src/gui/horus/widgets/timer.cpp +++ b/radio/src/gui/horus/widgets/timer.cpp @@ -44,12 +44,12 @@ void TimerWidget::refresh() TimerData & timerData = g_model.timers[index]; TimerState & timerState = timersStates[index]; - lcdDrawBitmapPattern(zone.x, zone.y, LBM_TIMER_BACKGROUND, TEXT_BGCOLOR); + lcdDrawBitmapPattern(zone.x, zone.y, LBM_TIMER_BACKGROUND, MAINVIEW_PANES_COLOR); if (timerData.start) { - lcdDrawBitmapPatternPie(zone.x+2, zone.y+3, LBM_RSCALE, TITLE_BGCOLOR, 0, timerState.val <= 0 ? 360 : 360*(timerData.start-timerState.val)/timerData.start); + lcdDrawBitmapPatternPie(zone.x+2, zone.y+3, LBM_RSCALE, MAINVIEW_GRAPHICS_COLOR, 0, timerState.val <= 0 ? 360 : 360*(timerData.start-timerState.val)/timerData.start); } else { - lcdDrawBitmapPattern(zone.x+3, zone.y+4, LBM_TIMER, TITLE_BGCOLOR); + lcdDrawBitmapPattern(zone.x+3, zone.y+4, LBM_TIMER, MAINVIEW_GRAPHICS_COLOR); } putsTimer(zone.x+76, zone.y+31, abs(timerState.val), TEXT_COLOR|DBLSIZE|LEFT); if (ZLEN(timerData.name) > 0) { diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index dadd433d5..524d36000 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -2602,7 +2602,7 @@ int main(void) #endif #if defined(COLORLCD) - lcdColorsInit(); + theme->load(); #endif stackPaint(); diff --git a/radio/src/targets/simu/simpgmspace.cpp b/radio/src/targets/simu/simpgmspace.cpp index 0171652cf..5f566ee6d 100644 --- a/radio/src/targets/simu/simpgmspace.cpp +++ b/radio/src/targets/simu/simpgmspace.cpp @@ -317,7 +317,7 @@ void *eeprom_write_function(void *) uint8_t main_thread_running = 0; char * main_thread_error = NULL; extern void opentxStart(); -void *main_thread(void *) +void * main_thread(void *) { #ifdef SIMU_EXCEPTIONS signal(SIGFPE, sig); @@ -327,7 +327,7 @@ void *main_thread(void *) #endif #if defined(PCBHORUS) - lcdColorsInit(); + theme->load(); #endif #if defined(CPUARM)