diff --git a/companion/src/firmwares/opentx/simulator/opentxsimulator.cpp b/companion/src/firmwares/opentx/simulator/opentxsimulator.cpp index 73e21329d..5ba719020 100644 --- a/companion/src/firmwares/opentx/simulator/opentxsimulator.cpp +++ b/companion/src/firmwares/opentx/simulator/opentxsimulator.cpp @@ -175,6 +175,7 @@ namespace NAMESPACE { #include "radio/src/gui/horus/widget.cpp" #include "radio/src/gui/horus/layout.cpp" #include "radio/src/gui/horus/layouts/layout2+1.cpp" +#include "radio/src/gui/horus/layouts/layout1x1.cpp" #include "radio/src/gui/horus/layouts/layout2x2.cpp" #include "radio/src/gui/horus/layouts/layout2x4.cpp" #include "radio/src/gui/horus/widgets/gauge.cpp" diff --git a/radio/src/gui/horus/layouts/layout1x1.cpp b/radio/src/gui/horus/layouts/layout1x1.cpp new file mode 100644 index 000000000..a50811835 --- /dev/null +++ b/radio/src/gui/horus/layouts/layout1x1.cpp @@ -0,0 +1,95 @@ +/* + * 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" + +class Layout1x1: public Layout +{ + public: + Layout1x1(const LayoutFactory * factory, Layout::PersistentData * persistentData): + Layout(factory, persistentData) + { + } + + virtual void create() + { + persistentData->options[0].boolValue = true; + persistentData->options[1].boolValue = true; + } + + virtual unsigned int getZonesCount() const + { + return 1; + } + + virtual Zone getZone(unsigned int index) const + { + Zone zone = { 10, 10, LCD_W - 2*10, LCD_H - 2*10 }; + if (persistentData->options[0].boolValue) { + zone.y += MENU_HEADER_HEIGHT; + zone.h -= MENU_HEADER_HEIGHT; + } + if (persistentData->options[1].boolValue) { + zone.x += 35; + zone.w -= 2*35; + zone.h -= 35; + } + return zone; + } + + virtual void refresh(bool setup=false); + + static const ZoneOption options[]; + +}; + +const ZoneOption Layout1x1::options[] = { + { "Top bar", ZoneOption::Bool }, + { "Sliders+Trims", ZoneOption::Bool }, + { NULL, ZoneOption::Bool } +}; + +void Layout1x1::refresh(bool setup) +{ + lcdDrawBitmap(0, 0, LBM_MAINVIEW_BACKGROUND); + + if (persistentData->options[0].boolValue) { + // Top Bar + drawMainViewTopBar(); + } + + if (persistentData->options[1].boolValue) { + // Sliders + Trims + Flight mode + lcdDrawSizedText(LCD_W / 2 - getTextWidth(g_model.flightModeData[mixerCurrentFlightMode].name, sizeof(g_model.flightModeData[mixerCurrentFlightMode].name), ZCHAR | SMLSIZE) / 2, + 237, + g_model.flightModeData[mixerCurrentFlightMode].name, + sizeof(g_model.flightModeData[mixerCurrentFlightMode].name), ZCHAR | SMLSIZE); + drawMainPots(); + drawTrims(mixerCurrentFlightMode); + } + + Layout::refresh(setup); +} + +const uint8_t LBM_LAYOUT_1x1[] __DMA = { +#include "mask_layout1x1.lbm" +}; + +BaseLayoutFactory layout1x1("Layout1x1", LBM_LAYOUT_1x1, Layout1x1::options); diff --git a/radio/src/gui/horus/layouts/layout2x2.cpp b/radio/src/gui/horus/layouts/layout2x2.cpp index 1d370dabe..39bd9c568 100644 --- a/radio/src/gui/horus/layouts/layout2x2.cpp +++ b/radio/src/gui/horus/layouts/layout2x2.cpp @@ -31,9 +31,6 @@ class Layout2x2: public Layout virtual void create() { persistentData->options[0].boolValue = true; - persistentData->options[1].boolValue = true; - persistentData->options[2].boolValue = true; - persistentData->options[3].boolValue = true; } virtual unsigned int getZonesCount() const diff --git a/radio/src/gui/horus/layouts/mask_layout1x1.png b/radio/src/gui/horus/layouts/mask_layout1x1.png new file mode 100644 index 000000000..ba76e857b Binary files /dev/null and b/radio/src/gui/horus/layouts/mask_layout1x1.png differ diff --git a/radio/src/gui/horus/lcd.cpp b/radio/src/gui/horus/lcd.cpp index 81f077955..901c45604 100644 --- a/radio/src/gui/horus/lcd.cpp +++ b/radio/src/gui/horus/lcd.cpp @@ -34,7 +34,7 @@ void lcdColorsInit() lcdColorTable[TEXT_BGCOLOR_INDEX] = WHITE; lcdColorTable[TEXT_INVERTED_COLOR_INDEX] = WHITE; lcdColorTable[TEXT_INVERTED_BGCOLOR_INDEX] = RED; - lcdColorTable[LINE_COLOR_INDEX] = RGB(88, 88, 90); + lcdColorTable[LINE_COLOR_INDEX] = GREY; lcdColorTable[SCROLLBOX_COLOR_INDEX] = RED; lcdColorTable[MENU_TITLE_BGCOLOR_INDEX] = DARKGREY; lcdColorTable[MENU_TITLE_COLOR_INDEX] = WHITE; @@ -42,8 +42,8 @@ void lcdColorsInit() lcdColorTable[HEADER_COLOR_INDEX] = DARKGREY; lcdColorTable[ALARM_COLOR_INDEX] = RED; lcdColorTable[WARNING_COLOR_INDEX] = YELLOW; - lcdColorTable[TEXT_DISABLE_COLOR_INDEX] = RGB(0x60, 0x60, 0x60); - lcdColorTable[CURVE_AXIS_COLOR_INDEX] = RGB(180, 180, 180); + 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; diff --git a/radio/src/gui/horus/lcd.h b/radio/src/gui/horus/lcd.h index 8ab125103..7b0b7310f 100644 --- a/radio/src/gui/horus/lcd.h +++ b/radio/src/gui/horus/lcd.h @@ -83,7 +83,9 @@ #define BLACK RGB(0, 0, 0) #define YELLOW RGB(0xF0, 0xD0, 0x10) #define BLUE RGB(0x30, 0xA0, 0xE0) -#define DARKGREY RGB(0x40, 0x40, 0x40) +#define GREY RGB(96, 96, 96) +#define DARKGREY RGB(64, 64, 64) +#define LIGHTGREY RGB(180, 180, 180) #define RED RGB(229, 32, 30) #define DARKRED RGB(160, 0, 6) diff --git a/radio/src/gui/horus/menu_general.cpp b/radio/src/gui/horus/menu_general.cpp index 2b459d3b5..547d68f24 100644 --- a/radio/src/gui/horus/menu_general.cpp +++ b/radio/src/gui/horus/menu_general.cpp @@ -18,10 +18,10 @@ * GNU General Public License for more details. */ -#include "../../opentx.h" - -bool menuGeneralCustomFunctions(evt_t event) -{ - MENU(STR_MENUGLOBALFUNCS, menuTabGeneral, e_GeneralCustomFunctions, NUM_CFN, DEFAULT_SCROLLBAR_X, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ }); - return menuCustomFunctions(event, g_eeGeneral.customFn, globalFunctionsContext); -} +#include "../../opentx.h" + +bool menuGeneralCustomFunctions(evt_t event) +{ + MENU(STR_MENUGLOBALFUNCS, LBM_RADIO_ICONS, menuTabGeneral, e_GeneralCustomFunctions, NUM_CFN, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ }); + return menuCustomFunctions(event, g_eeGeneral.customFn, globalFunctionsContext); +} diff --git a/radio/src/gui/horus/menu_general_hardware.cpp b/radio/src/gui/horus/menu_general_hardware.cpp index 96b15d766..e9775468f 100644 --- a/radio/src/gui/horus/menu_general_hardware.cpp +++ b/radio/src/gui/horus/menu_general_hardware.cpp @@ -57,7 +57,7 @@ enum menuGeneralHwItems { bool menuGeneralHardware(evt_t event) { - MENU(STR_HARDWARE, menuTabGeneral, e_Hardware, ITEM_SETUP_HW_MAX, DEFAULT_SCROLLBAR_X, { 0, LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, BLUETOOTH_ROWS 0 }); + MENU(STR_HARDWARE, LBM_RADIO_ICONS, menuTabGeneral, e_Hardware, ITEM_SETUP_HW_MAX, { 0, LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, BLUETOOTH_ROWS 0 }); uint8_t sub = menuVerticalPosition; diff --git a/radio/src/gui/horus/menu_general_sdmanager.cpp b/radio/src/gui/horus/menu_general_sdmanager.cpp index 95cebd4e2..d18557e86 100644 --- a/radio/src/gui/horus/menu_general_sdmanager.cpp +++ b/radio/src/gui/horus/menu_general_sdmanager.cpp @@ -169,7 +169,7 @@ bool menuGeneralSdManager(evt_t _event) } evt_t event = (EVT_KEY_MASK(_event) == KEY_ENTER ? 0 : _event); - SIMPLE_MENU(SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD, menuTabGeneral, e_Sd, reusableBuffer.sdmanager.count, DEFAULT_SCROLLBAR_X); + SIMPLE_MENU(SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD, LBM_RADIO_ICONS, menuTabGeneral, e_Sd, reusableBuffer.sdmanager.count); int index = menuVerticalPosition-menuVerticalOffset; diff --git a/radio/src/gui/horus/menu_general_setup.cpp b/radio/src/gui/horus/menu_general_setup.cpp index 19ec3848a..1c690e33b 100644 --- a/radio/src/gui/horus/menu_general_setup.cpp +++ b/radio/src/gui/horus/menu_general_setup.cpp @@ -112,7 +112,7 @@ bool menuGeneralSetup(evt_t event) } #endif - MENU(STR_MENURADIOSETUP, menuTabGeneral, e_Setup, ITEM_SETUP_MAX, DEFAULT_SCROLLBAR_X, { + MENU(STR_MENURADIOSETUP, LBM_RADIO_ICONS, menuTabGeneral, e_Setup, ITEM_SETUP_MAX, { 2|NAVIGATION_LINE_BY_LINE, 2|NAVIGATION_LINE_BY_LINE, 1|NAVIGATION_LINE_BY_LINE, LABEL(SOUND), 0, 0, 0, 0, 0, 0, 0, CASE_VARIO(LABEL(VARIO)) CASE_VARIO(0) CASE_VARIO(0) CASE_VARIO(0) CASE_VARIO(0) diff --git a/radio/src/gui/horus/menu_general_trainer.cpp b/radio/src/gui/horus/menu_general_trainer.cpp index 73b28966d..946db75d7 100644 --- a/radio/src/gui/horus/menu_general_trainer.cpp +++ b/radio/src/gui/horus/menu_general_trainer.cpp @@ -25,14 +25,12 @@ #define TRAINER_COLUMN_2 TRAINER_COLUMN_1+TRAINER_COLUMN_WIDTH #define TRAINER_COLUMN_3 TRAINER_COLUMN_2+TRAINER_COLUMN_WIDTH -#define TRAINER_CALIB_POS 12 - bool menuGeneralTrainer(evt_t event) { uint8_t y; bool slave = SLAVE_MODE(); - MENU(STR_MENUTRAINER, menuTabGeneral, e_Trainer, (slave ? 0 : 6), DEFAULT_SCROLLBAR_X, { 2, 2, 2, 2, 0/*, 0*/ }); + MENU(STR_MENUTRAINER, LBM_RADIO_ICONS, menuTabGeneral, e_Trainer, (slave ? 0 : 6), { 2, 2, 2, 2, 0/*, 0*/ }); if (slave) { lcd_putsCenter(5*FH, STR_SLAVE, TEXT_COLOR); diff --git a/radio/src/gui/horus/menu_general_version.cpp b/radio/src/gui/horus/menu_general_version.cpp index 967b4a362..f5d83abb2 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, menuTabGeneral, e_Vers, 1, DEFAULT_SCROLLBAR_X); + SIMPLE_MENU(STR_MENUVERSION, LBM_RADIO_ICONS, menuTabGeneral, e_Vers, 1); 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_curves.cpp b/radio/src/gui/horus/menu_model_curves.cpp index e1941026c..7dd682e3e 100644 --- a/radio/src/gui/horus/menu_model_curves.cpp +++ b/radio/src/gui/horus/menu_model_curves.cpp @@ -333,7 +333,7 @@ void editCurveRef(coord_t x, coord_t y, CurveRef & curve, evt_t event, uint8_t a bool menuModelCurvesAll(evt_t event) { - SIMPLE_MENU(STR_MENUCURVES, menuTabModel, e_CurvesAll, MAX_CURVES, DEFAULT_SCROLLBAR_X); + SIMPLE_MENU(STR_MENUCURVES, LBM_MODEL_ICONS, menuTabModel, e_CurvesAll, MAX_CURVES); int8_t sub = menuVerticalPosition; diff --git a/radio/src/gui/horus/menu_model_custom_functions.cpp b/radio/src/gui/horus/menu_model_custom_functions.cpp index aa0bbfc4b..46b7997eb 100644 --- a/radio/src/gui/horus/menu_model_custom_functions.cpp +++ b/radio/src/gui/horus/menu_model_custom_functions.cpp @@ -352,6 +352,6 @@ bool menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunc bool menuModelCustomFunctions(evt_t event) { - MENU(STR_MENUCUSTOMFUNC, menuTabModel, e_CustomFunctions, NUM_CFN, DEFAULT_SCROLLBAR_X, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ }); + MENU(STR_MENUCUSTOMFUNC, LBM_MODEL_ICONS, menuTabModel, e_CustomFunctions, NUM_CFN, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ }); return menuCustomFunctions(event, g_model.customFn, modelFunctionsContext); } diff --git a/radio/src/gui/horus/menu_model_custom_scripts.cpp b/radio/src/gui/horus/menu_model_custom_scripts.cpp index e86b37ac9..fa6cb5df6 100644 --- a/radio/src/gui/horus/menu_model_custom_scripts.cpp +++ b/radio/src/gui/horus/menu_model_custom_scripts.cpp @@ -126,7 +126,7 @@ bool menuModelCustomScripts(evt_t event) // lcdDrawNumber(19*FW, 0, luaGetMemUsed(), 0); // lcdDrawText(19*FW+1, 0, STR_BYTES); - MENU(STR_MENUCUSTOMSCRIPTS, menuTabModel, e_CustomScripts, MAX_SCRIPTS, DEFAULT_SCROLLBAR_X, { NAVIGATION_LINE_BY_LINE|3/*repeated*/ }); + MENU(STR_MENUCUSTOMSCRIPTS, LBM_MODEL_ICONS, menuTabModel, e_CustomScripts, MAX_SCRIPTS, { NAVIGATION_LINE_BY_LINE|3/*repeated*/ }); int8_t sub = menuVerticalPosition; diff --git a/radio/src/gui/horus/menu_model_flightmodes.cpp b/radio/src/gui/horus/menu_model_flightmodes.cpp index dbf021979..f256f4cfc 100644 --- a/radio/src/gui/horus/menu_model_flightmodes.cpp +++ b/radio/src/gui/horus/menu_model_flightmodes.cpp @@ -78,7 +78,7 @@ bool isTrimModeAvailable(int mode) bool menuModelFlightModesAll(evt_t event) { - MENU(STR_MENUFLIGHTPHASES, menuTabModel, e_FlightModesAll, MAX_FLIGHT_MODES+1, DEFAULT_SCROLLBAR_X, { NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, 0}); + MENU(STR_MENUFLIGHTPHASES, LBM_MODEL_ICONS, menuTabModel, e_FlightModesAll, MAX_FLIGHT_MODES+1, { NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, 0}); int sub = menuVerticalPosition; diff --git a/radio/src/gui/horus/menu_model_gvars.cpp b/radio/src/gui/horus/menu_model_gvars.cpp index b1b74e491..17011a646 100644 --- a/radio/src/gui/horus/menu_model_gvars.cpp +++ b/radio/src/gui/horus/menu_model_gvars.cpp @@ -44,7 +44,7 @@ void onGVARSMenu(const char *result) bool menuModelGVars(evt_t event) { - MENU(STR_MENUGLOBALVARS, menuTabModel, e_GVars/* TODO, first2seconds ? CHECK_FLAG_NO_SCREEN_INDEX : 0*/, MAX_GVARS, DEFAULT_SCROLLBAR_X, { NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES}); + MENU(STR_MENUGLOBALVARS, LBM_MODEL_ICONS, menuTabModel, e_GVars/* TODO, first2seconds ? CHECK_FLAG_NO_SCREEN_INDEX : 0*/, MAX_GVARS, { NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES}); int sub = menuVerticalPosition; diff --git a/radio/src/gui/horus/menu_model_heli.cpp b/radio/src/gui/horus/menu_model_heli.cpp index 5a0e99270..f37d4217c 100644 --- a/radio/src/gui/horus/menu_model_heli.cpp +++ b/radio/src/gui/horus/menu_model_heli.cpp @@ -36,7 +36,7 @@ enum menuModelHeliItems { bool menuModelHeli(evt_t event) { - SIMPLE_MENU(STR_MENUHELISETUP, menuTabModel, e_Heli, ITEM_HELI_MAX, DEFAULT_SCROLLBAR_X); + SIMPLE_MENU(STR_MENUHELISETUP, LBM_MODEL_ICONS, menuTabModel, e_Heli, ITEM_HELI_MAX); int sub = menuVerticalPosition; diff --git a/radio/src/gui/horus/menu_model_inputs.cpp b/radio/src/gui/horus/menu_model_inputs.cpp index ef2be1e89..72cb3b17e 100644 --- a/radio/src/gui/horus/menu_model_inputs.cpp +++ b/radio/src/gui/horus/menu_model_inputs.cpp @@ -370,7 +370,7 @@ bool menuModelExposAll(evt_t event) uint8_t chn = expoAddress(s_currIdx)->chn + 1; int linesCount = getExposLinesCount(); - SIMPLE_MENU(STR_MENUINPUTS, menuTabModel, e_InputsAll, linesCount, DEFAULT_SCROLLBAR_X); + SIMPLE_MENU(STR_MENUINPUTS, LBM_MODEL_ICONS, menuTabModel, e_InputsAll, linesCount); switch (event) { case EVT_ENTRY: diff --git a/radio/src/gui/horus/menu_model_limits.cpp b/radio/src/gui/horus/menu_model_limits.cpp index af5ee12bd..2d885732e 100644 --- a/radio/src/gui/horus/menu_model_limits.cpp +++ b/radio/src/gui/horus/menu_model_limits.cpp @@ -93,7 +93,7 @@ void onLimitsMenu(const char *result) bool menuModelLimits(evt_t event) { - MENU(STR_MENULIMITS, menuTabModel, e_Limits, NUM_CHNOUT+1, DEFAULT_SCROLLBAR_X, + MENU(STR_MENULIMITS, LBM_MODEL_ICONS, menuTabModel, e_Limits, NUM_CHNOUT+1, { NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, diff --git a/radio/src/gui/horus/menu_model_logical_switches.cpp b/radio/src/gui/horus/menu_model_logical_switches.cpp index cad2d16b0..6a79aaa2b 100644 --- a/radio/src/gui/horus/menu_model_logical_switches.cpp +++ b/radio/src/gui/horus/menu_model_logical_switches.cpp @@ -80,7 +80,7 @@ bool menuModelLogicalSwitches(evt_t event) { INCDEC_DECLARE_VARS(EE_MODEL); - MENU(STR_MENULOGICALSWITCHES, menuTabModel, e_LogicalSwitches, NUM_LOGICAL_SWITCH, DEFAULT_SCROLLBAR_X, { NAVIGATION_LINE_BY_LINE|LS_FIELD_LAST/*repeated...*/} ); + MENU(STR_MENULOGICALSWITCHES, LBM_MODEL_ICONS, menuTabModel, e_LogicalSwitches, NUM_LOGICAL_SWITCH, { NAVIGATION_LINE_BY_LINE|LS_FIELD_LAST/*repeated...*/} ); int k = 0; int sub = menuVerticalPosition; diff --git a/radio/src/gui/horus/menu_model_mixes.cpp b/radio/src/gui/horus/menu_model_mixes.cpp index cc2adc260..eca5b4e14 100644 --- a/radio/src/gui/horus/menu_model_mixes.cpp +++ b/radio/src/gui/horus/menu_model_mixes.cpp @@ -341,7 +341,7 @@ bool menuModelMixAll(evt_t event) uint8_t chn = mixAddress(s_currIdx)->destCh + 1; int linesCount = getMixesLinesCount(); - SIMPLE_MENU(STR_MIXER, menuTabModel, e_MixAll, linesCount, DEFAULT_SCROLLBAR_X); + SIMPLE_MENU(STR_MIXER, LBM_MODEL_ICONS, menuTabModel, e_MixAll, linesCount); switch (event) { case EVT_ENTRY: diff --git a/radio/src/gui/horus/menu_model_setup.cpp b/radio/src/gui/horus/menu_model_setup.cpp index b37426ed0..759a0b21c 100644 --- a/radio/src/gui/horus/menu_model_setup.cpp +++ b/radio/src/gui/horus/menu_model_setup.cpp @@ -181,7 +181,7 @@ bool menuModelSetup(evt_t event) horzpos_t l_posHorz = menuHorizontalPosition; bool CURSOR_ON_CELL = (menuHorizontalPosition >= 0); - MENU(STR_MENUSETUP, menuTabModel, e_ModelSetup, ITEM_MODEL_SETUP_MAX, DEFAULT_SCROLLBAR_X, + MENU(STR_MENUSETUP, LBM_MODEL_ICONS, menuTabModel, e_ModelSetup, ITEM_MODEL_SETUP_MAX, { 0, 0, TIMERS_ROWS, 0, 1, 0, 0, LABEL(Throttle), 0, 0, 0, LABEL(PreflightCheck), 0, 0, SW_WARN_ITEMS(), POT_WARN_ITEMS(), NAVIGATION_LINE_BY_LINE|(NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1), 0, diff --git a/radio/src/gui/horus/menu_model_telemetry.cpp b/radio/src/gui/horus/menu_model_telemetry.cpp index 74c505b7f..216f332e3 100644 --- a/radio/src/gui/horus/menu_model_telemetry.cpp +++ b/radio/src/gui/horus/menu_model_telemetry.cpp @@ -407,7 +407,7 @@ bool menuModelTelemetry(evt_t event) } } - MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX, DEFAULT_SCROLLBAR_X, { TELEMETRY_TYPE_ROWS RSSI_ROWS SENSORS_ROWS VARIO_ROWS }); + MENU(STR_MENUTELEMETRY, LBM_MODEL_ICONS, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX, { TELEMETRY_TYPE_ROWS RSSI_ROWS SENSORS_ROWS VARIO_ROWS }); for (int i=0; igetFactory()->getOptions(); for (const ZoneOption * option = options; option->name; option++) { linesCount++; } - SUBMENU_WITH_OPTIONS("Main views setup", LBM_MAINVIEWS_ICON, linesCount, OPTION_MENU_TITLE_BAR, { uint8_t(countRegisteredLayouts-1), ORPHAN_ROW, 0, 0, 0, 0 }); + SUBMENU_WITH_OPTIONS("Main views setup", LBM_MAINVIEWS_ICON, linesCount, OPTION_MENU_TITLE_BAR, { NAVIGATION_LINE_BY_LINE|uint8_t(countRegisteredLayouts-1), ORPHAN_ROW, 0, 0, 0, 0 }); for (int i=0; i(0, min(layoutIndex - 1, countRegisteredLayouts - 4)); - menuHorizontalPosition = layoutIndex; + if (needsOffsetCheck) { + if (layoutIndex < menuHorizontalOffset) { + menuHorizontalOffset = layoutIndex; } - else if (menuHorizontalPosition < menuHorizontalOffset) { - menuHorizontalOffset = menuHorizontalPosition; - } - else if (menuHorizontalPosition > menuHorizontalOffset + 3) { - menuHorizontalOffset = menuHorizontalPosition - 3; + 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; + } } } - lastPositionVertical = menuVerticalPosition; int lastDisplayedLayout = min(menuHorizontalOffset + 4, countRegisteredLayouts); for (int i=menuHorizontalOffset, x=SCREENS_SETUP_2ND_COLUMN; idrawThumb(x, y, currentScreen->getFactory() == factory ? TEXT_INVERTED_BGCOLOR : LINE_COLOR); + factory->drawThumb(x, y, currentScreen->getFactory() == factory ? (menuHorizontalPosition < 0 ? TEXT_INVERTED_COLOR : TEXT_INVERTED_BGCOLOR) : LINE_COLOR); } - if (menuHorizontalOffset > 0) - lcdDrawBitmapPattern(SCREENS_SETUP_2ND_COLUMN - 12, y, LBM_CARROUSSEL_LEFT, LINE_COLOR); - if (lastDisplayedLayout < countRegisteredLayouts) - lcdDrawBitmapPattern(SCREENS_SETUP_2ND_COLUMN + 4 * 56, y, LBM_CARROUSSEL_RIGHT, LINE_COLOR); - if (attr) { + 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; } } diff --git a/radio/src/gui/horus/view_about.cpp b/radio/src/gui/horus/view_about.cpp index f2f5d0567..978351364 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; } - drawMenuTemplate("About"); + drawScreenTemplate("About", LBM_TOPMENU_OPENTX); uint8_t screenDuration = 150; diff --git a/radio/src/gui/horus/view_text.cpp b/radio/src/gui/horus/view_text.cpp index 20a57abca..a1795b91d 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; - drawMenuTemplate("TEXT VIEWER"); + drawScreenTemplate("TEXT VIEWER", LBM_TOPMENU_OPENTX); switch (event) { case EVT_ENTRY: diff --git a/radio/src/gui/horus/widgets.cpp b/radio/src/gui/horus/widgets.cpp index 126165751..af145c887 100644 --- a/radio/src/gui/horus/widgets.cpp +++ b/radio/src/gui/horus/widgets.cpp @@ -191,10 +191,8 @@ void drawScreenTemplate(const char * title, const uint8_t * icon, uint32_t optio } } -void drawMenuTemplate(const char * title, uint16_t scrollbar_X, uint32_t options) +void drawMenuTemplate(const char * title, const uint8_t * const * icons, uint32_t options) { - const uint8_t * const * icons = (menuVerticalPositions[0] == 0 ? LBM_MODEL_ICONS : LBM_RADIO_ICONS); - drawScreenTemplate(title, icons[0], OPTION_MENU_TITLE_BAR); if (menuVerticalPosition < 0) { diff --git a/radio/src/gui/horus/widgets.h b/radio/src/gui/horus/widgets.h index 83a32141e..f9cb3a526 100644 --- a/radio/src/gui/horus/widgets.h +++ b/radio/src/gui/horus/widgets.h @@ -72,7 +72,7 @@ int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int // Screen templates void drawScreenTemplate(const char * title, const uint8_t * icon, uint32_t options=0); -void drawMenuTemplate(const char * title, uint16_t scrollbar_X=0, uint32_t options=0); +void drawMenuTemplate(const char * title, const uint8_t * const * icons, uint32_t options=0); void drawSplash(); void drawSleepBitmap(); void drawShutdownBitmap(uint32_t index); diff --git a/radio/src/gui/horus/widgets/modelpanel.cpp b/radio/src/gui/horus/widgets/modelpanel.cpp index c027a87e2..0539c7945 100644 --- a/radio/src/gui/horus/widgets/modelpanel.cpp +++ b/radio/src/gui/horus/widgets/modelpanel.cpp @@ -41,7 +41,7 @@ void ModelPanelWidget::refresh() int scale = getBitmapScale(modelBitmap, zone.w, zone.h); int width = getBitmapScaledSize(getBitmapWidth(modelBitmap), scale); int height = getBitmapScaledSize(getBitmapHeight(modelBitmap), scale); - lcdDrawBitmap(zone.x + (zone.w - width) / 2, zone.y + zone.h - MODEL_BITMAP_HEIGHT / 2 - height / 2, modelBitmap, 0, 0, scale); + lcdDrawBitmap(zone.x + (zone.w - width) / 2, zone.y + zone.h - height / 2 - height / 2, modelBitmap, 0, 0, scale); } else { int scale = getBitmapScale(modelBitmap, zone.w, zone.h);