1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-15 12:25:12 +03:00

[Horus] Menus icons now in cache

I hope it will reduce calculation time a little bit!
This commit is contained in:
Bertrand Songis 2016-04-07 08:26:04 +02:00
parent b1e5e06d5b
commit eaed9dd1a9
86 changed files with 373 additions and 352 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 510 KiB

View file

Before

Width:  |  Height:  |  Size: 335 B

After

Width:  |  Height:  |  Size: 335 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 293 B

After

Width:  |  Height:  |  Size: 293 B

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 873 B

After

Width:  |  Height:  |  Size: 873 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 978 B

After

Width:  |  Height:  |  Size: 978 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 674 B

After

Width:  |  Height:  |  Size: 674 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 814 B

After

Width:  |  Height:  |  Size: 814 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 807 B

After

Width:  |  Height:  |  Size: 807 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 671 B

After

Width:  |  Height:  |  Size: 671 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 796 B

After

Width:  |  Height:  |  Size: 796 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 980 B

After

Width:  |  Height:  |  Size: 980 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 604 B

After

Width:  |  Height:  |  Size: 604 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 811 B

After

Width:  |  Height:  |  Size: 811 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 575 B

After

Width:  |  Height:  |  Size: 575 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 686 B

After

Width:  |  Height:  |  Size: 686 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 544 B

After

Width:  |  Height:  |  Size: 544 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 800 B

After

Width:  |  Height:  |  Size: 800 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 641 B

After

Width:  |  Height:  |  Size: 641 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 860 B

After

Width:  |  Height:  |  Size: 860 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 536 B

After

Width:  |  Height:  |  Size: 536 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 545 B

After

Width:  |  Height:  |  Size: 545 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 425 B

After

Width:  |  Height:  |  Size: 425 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 400 B

After

Width:  |  Height:  |  Size: 400 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 525 B

After

Width:  |  Height:  |  Size: 525 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 597 B

After

Width:  |  Height:  |  Size: 597 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 506 B

After

Width:  |  Height:  |  Size: 506 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 549 B

After

Width:  |  Height:  |  Size: 549 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 625 B

After

Width:  |  Height:  |  Size: 625 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 486 B

After

Width:  |  Height:  |  Size: 486 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 659 B

After

Width:  |  Height:  |  Size: 659 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 559 B

View file

@ -222,6 +222,35 @@ void BitmapBuffer::drawPie(int x0, int y0, int radius, int startAngle, int endAn
} }
} }
void BitmapBuffer::drawMask(coord_t x, coord_t y, BitmapBuffer * mask, LcdFlags flags, coord_t offset, coord_t width)
{
if (mask == NULL) {
return;
}
coord_t w = mask->getWidth();
coord_t height = mask->getHeight();
if (!width || width > w) {
width = w;
}
if (x+width > this->width) {
width = this->width-x;
}
display_t color = lcdColorTable[COLOR_IDX(flags)];
for (coord_t row=0; row<height; row++) {
display_t * p = getPixelPtr(x, y+row);
display_t * q = mask->getPixelPtr(offset, row);
for (coord_t col=0; col<width; col++) {
drawAlphaPixel(p, *((uint8_t *)q), color);
p++; q++;
}
}
}
void BitmapBuffer::drawBitmapPattern(coord_t x, coord_t y, const uint8_t * bmp, LcdFlags flags, coord_t offset, coord_t width) void BitmapBuffer::drawBitmapPattern(coord_t x, coord_t y, const uint8_t * bmp, LcdFlags flags, coord_t offset, coord_t width)
{ {
coord_t w = *((uint16_t *)bmp); coord_t w = *((uint16_t *)bmp);
@ -432,6 +461,19 @@ BitmapBuffer * BitmapBuffer::load(const char * filename)
return load_stb(filename); return load_stb(filename);
} }
BitmapBuffer * BitmapBuffer::loadMask(const char * filename)
{
BitmapBuffer * bitmap = BitmapBuffer::load(filename);
if (bitmap) {
display_t * p = bitmap->getData();
for (int i = bitmap->getWidth() * bitmap->getHeight(); i > 0; i--) {
*((uint8_t *)p) = OPACITY_MAX - ((*p) >> 12);
p++;
}
}
return bitmap;
}
FIL imgFile __DMA; FIL imgFile __DMA;
BitmapBuffer * BitmapBuffer::load_bmp(const char * filename) BitmapBuffer * BitmapBuffer::load_bmp(const char * filename)

View file

@ -174,6 +174,10 @@ class BitmapBuffer: public BitmapBufferBase<uint16_t>
static BitmapBuffer * load(const char * filename); static BitmapBuffer * load(const char * filename);
static BitmapBuffer * loadMask(const char * filename);
void drawMask(coord_t x, coord_t y, BitmapBuffer * mask, LcdFlags flags, coord_t offset=0, coord_t width=0);
void drawBitmapPattern(coord_t x, coord_t y, const uint8_t * bmp, LcdFlags flags, coord_t offset=0, coord_t width=0); void drawBitmapPattern(coord_t x, coord_t y, const uint8_t * bmp, LcdFlags flags, coord_t offset=0, coord_t width=0);
void drawCharWithoutCache(coord_t x, coord_t y, const uint8_t * font, const uint16_t * spec, int index, LcdFlags flags); void drawCharWithoutCache(coord_t x, coord_t y, const uint8_t * font, const uint16_t * spec, int index, LcdFlags flags);

View file

@ -32,18 +32,6 @@ const uint8_t LBM_DOT[] = {
#include "mask_dot.lbm" #include "mask_dot.lbm"
}; };
const uint8_t LBM_CURRENT_BG[] = {
#include "mask_current_bg.lbm"
};
const uint8_t LBM_CURRENT_SHADOW[] = {
#include "mask_current_shadow.lbm"
};
const uint8_t LBM_CURRENT_DOT[] = {
#include "mask_current_dot.lbm"
};
/* /*
* Main view bitmaps * Main view bitmaps
*/ */
@ -104,208 +92,10 @@ const uint8_t LBM_RSCALE[] = {
#include "mask_rscale.lbm" #include "mask_rscale.lbm"
}; };
/*
* Stats / Debug menu bitmaps
*/
const uint8_t LBM_STATS_ICON[] = {
#include "mask_stats.lbm"
};
const uint8_t LBM_STATS_GRAPH_ICON[] = {
#include "mask_stats_graph.lbm"
};
const uint8_t LBM_STATS_TIME_ICON[] = {
#include "mask_stats_time.lbm"
};
const uint8_t LBM_STATS_DEBUG_ICON[] = {
#include "mask_stats_debug.lbm"
};
const uint8_t LBM_STATS_ANALOGS_ICON[] = {
#include "mask_analogs.lbm"
};
const uint8_t * const LBM_STATS_ICONS[] = {
LBM_STATS_ICON,
LBM_STATS_GRAPH_ICON,
LBM_STATS_TIME_ICON,
LBM_STATS_ANALOGS_ICON,
#if defined(DEBUG_TRACE_BUFFER)
LBM_STATS_DEBUG_ICON
#endif
};
/*
* Radio menu bitmaps
*/
const uint8_t LBM_RADIO_ICON[] = {
#include "mask_menu_radio.lbm"
};
const uint8_t LBM_RADIO_SETUP_ICON[] = {
#include "mask_radio_setup.lbm"
};
const uint8_t LBM_SD_BROWSER_ICON[] = {
#include "mask_sd_browser.lbm"
};
const uint8_t LBM_GLOBAL_FUNCTIONS_ICON[] = {
#include "mask_global_functions.lbm"
};
const uint8_t LBM_TRAINER_ICON[] = {
#include "mask_trainer.lbm"
};
const uint8_t LBM_CALIBRATION_ICON[] = {
#include "mask_calibration.lbm"
};
const uint8_t LBM_VERSION_ICON[] = {
#include "mask_version.lbm"
};
const uint8_t * const LBM_RADIO_ICONS[] = {
LBM_RADIO_ICON,
LBM_RADIO_SETUP_ICON,
LBM_SD_BROWSER_ICON,
LBM_GLOBAL_FUNCTIONS_ICON,
LBM_TRAINER_ICON,
LBM_CALIBRATION_ICON,
LBM_VERSION_ICON
};
/*
* Model menu bitmaps
*/
const uint8_t LBM_MODEL_ICON[] = {
#include "mask_menu_model.lbm"
};
const uint8_t LBM_MODEL_SETUP_ICON[] = {
#include "mask_model_setup.lbm"
};
const uint8_t LBM_HELI_ICON[] = {
#include "mask_heli.lbm"
};
const uint8_t LBM_FLIGHT_MODES_ICON[] = {
#include "mask_flight_modes.lbm"
};
const uint8_t LBM_INPUTS_ICON[] = {
#include "mask_inputs.lbm"
};
const uint8_t LBM_MIXER_ICON[] = {
#include "mask_mixer.lbm"
};
const uint8_t LBM_OUTPUTS_ICON[] = {
#include "mask_outputs.lbm"
};
const uint8_t LBM_CURVES_ICON[] = {
#include "mask_curves.lbm"
};
const uint8_t LBM_GVARS_ICON[] = {
#include "mask_gvars.lbm"
};
const uint8_t LBM_LOGICAL_SWITCHES_ICON[] = {
#include "mask_logical_switches.lbm"
};
const uint8_t LBM_SPECIAL_FUNCTIONS_ICON[] = {
#include "mask_special_functions.lbm"
};
const uint8_t LBM_LUA_SCRIPTS_ICON[] = {
#include "mask_lua_scripts.lbm"
};
const uint8_t LBM_TELEMETRY_ICON[] = {
#include "mask_telemetry.lbm"
};
const uint8_t * const LBM_MODEL_ICONS[] = {
LBM_MODEL_ICON,
LBM_MODEL_SETUP_ICON,
CASE_HELI(LBM_HELI_ICON)
CASE_FLIGHT_MODES(LBM_FLIGHT_MODES_ICON)
LBM_INPUTS_ICON,
LBM_MIXER_ICON,
LBM_OUTPUTS_ICON,
CASE_CURVES(LBM_CURVES_ICON)
CASE_GVARS(LBM_GVARS_ICON)
LBM_LOGICAL_SWITCHES_ICON,
LBM_SPECIAL_FUNCTIONS_ICON,
#if defined(LUA_MODEL_SCRIPTS)
LBM_LUA_SCRIPTS_ICON,
#endif
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_1_ICON[] = {
#include "mask_mainviews_1.lbm"
};
const uint8_t LBM_MAINVIEWS_2_ICON[] = {
#include "mask_mainviews_2.lbm"
};
const uint8_t LBM_MAINVIEWS_3_ICON[] = {
#include "mask_mainviews_3.lbm"
};
const uint8_t LBM_MAINVIEWS_4_ICON[] = {
#include "mask_mainviews_4.lbm"
};
const uint8_t LBM_MAINVIEWS_5_ICON[] = {
#include "mask_mainviews_5.lbm"
};
const uint8_t LBM_MAINVIEWS_ADD_ICON[] = {
#include "mask_mainviews_add.lbm"
};
const uint8_t * const LBM_MAINVIEWS_ICONS[] = {
LBM_MAINVIEWS_1_ICON,
LBM_MAINVIEWS_2_ICON,
LBM_MAINVIEWS_3_ICON,
LBM_MAINVIEWS_4_ICON,
LBM_MAINVIEWS_5_ICON
};
/* /*
* Model selection screen bitmaps * Model selection screen bitmaps
*/ */
const uint8_t LBM_LIBRARY_ICON[] = {
#include "mask_library.lbm"
};
const uint8_t LBM_LIBRARY_SLOT[] = { const uint8_t LBM_LIBRARY_SLOT[] = {
#include "mask_library_slot.lbm" #include "mask_library_slot.lbm"
}; };

View file

@ -24,9 +24,6 @@
// Header bitmaps // Header bitmaps
extern const uint8_t LBM_TOPMENU_POLYGON[]; extern const uint8_t LBM_TOPMENU_POLYGON[];
extern const uint8_t LBM_DOT[]; extern const uint8_t LBM_DOT[];
extern const uint8_t LBM_CURRENT_BG[];
extern const uint8_t LBM_CURRENT_SHADOW[];
extern const uint8_t LBM_CURRENT_DOT[];
// Main view icons // Main view icons
extern const uint8_t LBM_TOPMENU_USB[]; extern const uint8_t LBM_TOPMENU_USB[];
@ -40,34 +37,11 @@ extern const uint8_t LBM_TOPMENU_TXBATT[];
extern const uint8_t LBM_HTRIM_FRAME[]; extern const uint8_t LBM_HTRIM_FRAME[];
extern const uint8_t LBM_VTRIM_FRAME[]; extern const uint8_t LBM_VTRIM_FRAME[];
extern const uint8_t LBM_TRIM_SHADOW[]; extern const uint8_t LBM_TRIM_SHADOW[];
extern const uint8_t LBM_RADIO_ICON[];
extern const uint8_t LBM_MODEL_ICON[];
extern const uint8_t LBM_TIMER_BACKGROUND[]; extern const uint8_t LBM_TIMER_BACKGROUND[];
extern const uint8_t LBM_TIMER[]; extern const uint8_t LBM_TIMER[];
extern const uint8_t LBM_RSCALE[]; extern const uint8_t LBM_RSCALE[];
// Menu icons
extern const uint8_t * const LBM_RADIO_ICONS[];
extern const uint8_t * const LBM_MODEL_ICONS[];
extern const uint8_t * const LBM_STATS_ICONS[];
extern const uint8_t LBM_RADIO_ICON[];
extern const uint8_t LBM_SD_BROWSER_ICON[];
extern const uint8_t LBM_CALIBRATION_ICON[];
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_LUA_SCRIPTS_ICON[];
extern const uint8_t LBM_TELEMETRY_ICON[];
extern const uint8_t LBM_STATS_ANALOGS_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_ADD_ICON[];
extern const uint8_t * const LBM_MAINVIEWS_ICONS[];
// Model selection icons // Model selection icons
extern const uint8_t LBM_LIBRARY_ICON[];
extern const uint8_t LBM_LIBRARY_SLOT[]; extern const uint8_t LBM_LIBRARY_SLOT[];
extern const uint8_t LBM_ACTIVE_MODEL[]; extern const uint8_t LBM_ACTIVE_MODEL[];
extern const uint8_t LBM_LIBRARY_CURSOR[]; extern const uint8_t LBM_LIBRARY_CURSOR[];

View file

@ -59,7 +59,12 @@
#define MENU_TITLE_NEXT_POS (lcdNextPos + 10) #define MENU_TITLE_NEXT_POS (lcdNextPos + 10)
#define MENU_INIT_VPOS -1 #define MENU_INIT_VPOS -1
#if defined(HELI) && defined(GVARS) && defined(LUA_MODEL_SCRIPTS)
#define MENU_ICONS_SPACING 31 #define MENU_ICONS_SPACING 31
#else
#define MENU_ICONS_SPACING 33
#endif
#define SUBMENU_LINE_WIDTH 230 #define SUBMENU_LINE_WIDTH 230
#define LOAD_MODEL_BITMAP() #define LOAD_MODEL_BITMAP()

View file

@ -18,10 +18,10 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include "../../opentx.h" #include "opentx.h"
bool menuGeneralCustomFunctions(evt_t event) bool menuGeneralCustomFunctions(evt_t event)
{ {
MENU(STR_MENUGLOBALFUNCS, LBM_RADIO_ICONS, menuTabGeneral, e_GeneralCustomFunctions, NUM_CFN, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ }); MENU(STR_MENUGLOBALFUNCS, RADIO_ICONS, menuTabGeneral, e_GeneralCustomFunctions, NUM_CFN, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ });
return menuCustomFunctions(event, g_eeGeneral.customFn, globalFunctionsContext); return menuCustomFunctions(event, g_eeGeneral.customFn, globalFunctionsContext);
} }

View file

@ -65,7 +65,7 @@ void drawPots()
bool menuCommonCalib(evt_t event) bool menuCommonCalib(evt_t event)
{ {
drawScreenTemplate(NULL, LBM_CALIBRATION_ICON, OPTION_MENU_NO_FOOTER); drawMenuTemplate(NULL, ICON_RADIO_CALIBRATION, NULL, OPTION_MENU_NO_FOOTER);
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) { // get low and high vals for sticks and trims for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) { // get low and high vals for sticks and trims
int16_t vt = anaIn(i); int16_t vt = anaIn(i);

View file

@ -18,7 +18,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include "../../opentx.h" #include "opentx.h"
enum menuGeneralHwItems { enum menuGeneralHwItems {
ITEM_SETUP_HW_CALIBRATION, ITEM_SETUP_HW_CALIBRATION,
@ -58,7 +58,7 @@ enum menuGeneralHwItems {
bool menuGeneralHardware(evt_t event) bool menuGeneralHardware(evt_t event)
{ {
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 }); MENU(STR_HARDWARE, 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; uint8_t sub = menuVerticalPosition;

View file

@ -31,7 +31,7 @@ BitmapBuffer * currentBitmap = NULL;
bool menuGeneralSdManagerInfo(evt_t event) bool menuGeneralSdManagerInfo(evt_t event)
{ {
SIMPLE_SUBMENU(STR_SD_INFO_TITLE, LBM_SD_BROWSER_ICON, 1); SIMPLE_SUBMENU(STR_SD_INFO_TITLE, ICON_RADIO_SD_BROWSER, 1);
lcdDrawText(MENUS_MARGIN_LEFT, 2*FH, STR_SD_TYPE); lcdDrawText(MENUS_MARGIN_LEFT, 2*FH, STR_SD_TYPE);
lcdDrawText(100, 2*FH, SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD); lcdDrawText(100, 2*FH, SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD);
@ -170,7 +170,7 @@ bool menuGeneralSdManager(evt_t _event)
} }
evt_t event = (EVT_KEY_MASK(_event) == KEY_ENTER ? 0 : _event); evt_t event = (EVT_KEY_MASK(_event) == KEY_ENTER ? 0 : _event);
SIMPLE_MENU(SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD, LBM_RADIO_ICONS, menuTabGeneral, e_Sd, reusableBuffer.sdmanager.count); SIMPLE_MENU(SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD, RADIO_ICONS, menuTabGeneral, e_Sd, reusableBuffer.sdmanager.count);
int index = menuVerticalPosition-menuVerticalOffset; int index = menuVerticalPosition-menuVerticalOffset;

View file

@ -114,7 +114,7 @@ bool menuGeneralSetup(evt_t event)
} }
#endif #endif
MENU(STR_MENURADIOSETUP, LBM_RADIO_ICONS, menuTabGeneral, e_Setup, ITEM_SETUP_MAX, { MENU(STR_MENURADIOSETUP, RADIO_ICONS, menuTabGeneral, e_Setup, ITEM_SETUP_MAX, {
2|NAVIGATION_LINE_BY_LINE, 2|NAVIGATION_LINE_BY_LINE, 1|NAVIGATION_LINE_BY_LINE, 2|NAVIGATION_LINE_BY_LINE, 2|NAVIGATION_LINE_BY_LINE, 1|NAVIGATION_LINE_BY_LINE,
LABEL(SOUND), 0, 0, 0, 0, 0, 0, 0, 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) CASE_VARIO(LABEL(VARIO)) CASE_VARIO(0) CASE_VARIO(0) CASE_VARIO(0) CASE_VARIO(0)

View file

@ -30,7 +30,7 @@ bool menuGeneralTrainer(evt_t event)
uint8_t y; uint8_t y;
bool slave = SLAVE_MODE(); bool slave = SLAVE_MODE();
MENU(STR_MENUTRAINER, LBM_RADIO_ICONS, menuTabGeneral, e_Trainer, (slave ? 0 : 6), { 2, 2, 2, 2, 0/*, 0*/ }); MENU(STR_MENUTRAINER, RADIO_ICONS, menuTabGeneral, e_Trainer, (slave ? 0 : 6), { 2, 2, 2, 2, 0/*, 0*/ });
if (slave) { if (slave) {
// TODO lcd_putsCenter(5*FH, STR_SLAVE, TEXT_COLOR); // TODO lcd_putsCenter(5*FH, STR_SLAVE, TEXT_COLOR);

View file

@ -24,7 +24,7 @@ bool menuGeneralVersion(evt_t event)
{ {
DEBUG_TIMER_START(debugTimerVersion); DEBUG_TIMER_START(debugTimerVersion);
DEBUG_TIMER_START(debugTimerSimpleMenu); DEBUG_TIMER_START(debugTimerSimpleMenu);
SIMPLE_MENU(STR_MENUVERSION, LBM_RADIO_ICONS, menuTabGeneral, e_Vers, 0); SIMPLE_MENU(STR_MENUVERSION, RADIO_ICONS, menuTabGeneral, e_Vers, 0);
DEBUG_TIMER_STOP(debugTimerSimpleMenu); DEBUG_TIMER_STOP(debugTimerSimpleMenu);
DEBUG_TIMER_START(debugTimerDrawText); DEBUG_TIMER_START(debugTimerDrawText);

View file

@ -139,7 +139,7 @@ bool menuModelCurveOne(evt_t event)
CurveData & crv = g_model.curves[s_curveChan]; CurveData & crv = g_model.curves[s_curveChan];
int8_t * points = curveAddress(s_curveChan); int8_t * points = curveAddress(s_curveChan);
SUBMENU_WITH_OPTIONS(STR_MENUCURVE, LBM_CURVES_ICON, crv.type==CURVE_TYPE_CUSTOM ? 6 : 5, OPTION_MENU_NO_FOOTER, { 0, 0, 0, 0, uint8_t(5+crv.points-1), uint8_t(5+crv.points-1) }); SUBMENU_WITH_OPTIONS(STR_MENUCURVE, ICON_MODEL_CURVES, crv.type==CURVE_TYPE_CUSTOM ? 6 : 5, OPTION_MENU_NO_FOOTER, { 0, 0, 0, 0, uint8_t(5+crv.points-1), uint8_t(5+crv.points-1) });
drawStringWithIndex(50, 3+FH, STR_CV, s_curveChan+1, MENU_TITLE_COLOR); drawStringWithIndex(50, 3+FH, STR_CV, s_curveChan+1, MENU_TITLE_COLOR);
lcdDrawSolidFilledRect(0, MENU_FOOTER_TOP, 250, MENU_FOOTER_HEIGHT, HEADER_BGCOLOR); lcdDrawSolidFilledRect(0, MENU_FOOTER_TOP, 250, MENU_FOOTER_HEIGHT, HEADER_BGCOLOR);
@ -335,7 +335,7 @@ void editCurveRef(coord_t x, coord_t y, CurveRef & curve, evt_t event, uint8_t a
bool menuModelCurvesAll(evt_t event) bool menuModelCurvesAll(evt_t event)
{ {
SIMPLE_MENU(STR_MENUCURVES, LBM_MODEL_ICONS, menuTabModel, e_CurvesAll, MAX_CURVES); SIMPLE_MENU(STR_MENUCURVES, MODEL_ICONS, menuTabModel, e_CurvesAll, MAX_CURVES);
int8_t sub = menuVerticalPosition; int8_t sub = menuVerticalPosition;

View file

@ -407,6 +407,6 @@ bool menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunc
bool menuModelCustomFunctions(evt_t event) bool menuModelCustomFunctions(evt_t event)
{ {
MENU(STR_MENUCUSTOMFUNC, LBM_MODEL_ICONS, menuTabModel, e_CustomFunctions, NUM_CFN, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ }); MENU(STR_MENUCUSTOMFUNC, MODEL_ICONS, menuTabModel, e_CustomFunctions, NUM_CFN, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ });
return menuCustomFunctions(event, g_model.customFn, modelFunctionsContext); return menuCustomFunctions(event, g_model.customFn, modelFunctionsContext);
} }

View file

@ -53,7 +53,7 @@ bool menuModelCustomScriptOne(evt_t event)
// drawStringWithIndex(lcdLastPos+FW, 0, "LUA", s_currIdx+1, 0); // drawStringWithIndex(lcdLastPos+FW, 0, "LUA", s_currIdx+1, 0);
SUBMENU(STR_MENUCUSTOMSCRIPTS, LBM_LUA_SCRIPTS_ICON, 3+scriptInputsOutputs[s_currIdx].inputsCount, { 0, 0, LABEL(inputs), 0/*repeated*/ }); SUBMENU(STR_MENUCUSTOMSCRIPTS, ICON_MODEL_LUA_SCRIPTS, 3+scriptInputsOutputs[s_currIdx].inputsCount, { 0, 0, LABEL(inputs), 0/*repeated*/ });
int8_t sub = menuVerticalPosition; int8_t sub = menuVerticalPosition;
@ -127,7 +127,7 @@ bool menuModelCustomScripts(evt_t event)
// lcdDrawNumber(19*FW, 0, luaGetMemUsed(), 0); // lcdDrawNumber(19*FW, 0, luaGetMemUsed(), 0);
// lcdDrawText(19*FW+1, 0, STR_BYTES); // lcdDrawText(19*FW+1, 0, STR_BYTES);
MENU(STR_MENUCUSTOMSCRIPTS, LBM_MODEL_ICONS, menuTabModel, e_CustomScripts, MAX_SCRIPTS, { NAVIGATION_LINE_BY_LINE|3/*repeated*/ }); MENU(STR_MENUCUSTOMSCRIPTS, MODEL_ICONS, menuTabModel, e_CustomScripts, MAX_SCRIPTS, { NAVIGATION_LINE_BY_LINE|3/*repeated*/ });
int8_t sub = menuVerticalPosition; int8_t sub = menuVerticalPosition;

View file

@ -78,7 +78,7 @@ bool isTrimModeAvailable(int mode)
bool menuModelFlightModesAll(evt_t event) bool menuModelFlightModesAll(evt_t event)
{ {
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}); MENU(STR_MENUFLIGHTPHASES, 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; int sub = menuVerticalPosition;

View file

@ -44,7 +44,7 @@ void onGVARSMenu(const char *result)
bool menuModelGVars(evt_t event) bool menuModelGVars(evt_t event)
{ {
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}); MENU(STR_MENUGLOBALVARS, 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; int sub = menuVerticalPosition;

View file

@ -36,7 +36,7 @@ enum menuModelHeliItems {
bool menuModelHeli(evt_t event) bool menuModelHeli(evt_t event)
{ {
SIMPLE_MENU(STR_MENUHELISETUP, LBM_MODEL_ICONS, menuTabModel, e_Heli, ITEM_HELI_MAX); SIMPLE_MENU(STR_MENUHELISETUP, MODEL_ICONS, menuTabModel, e_Heli, ITEM_HELI_MAX);
int sub = menuVerticalPosition; int sub = menuVerticalPosition;

View file

@ -175,7 +175,7 @@ bool menuModelExpoOne(evt_t event)
{ {
ExpoData * ed = expoAddress(s_currIdx); ExpoData * ed = expoAddress(s_currIdx);
SUBMENU_WITH_OPTIONS(STR_MENUINPUTS, LBM_INPUTS_ICON, EXPO_FIELD_MAX, OPTION_MENU_NO_FOOTER|OPTION_MENU_NO_SCROLLBAR, { 0, 0, (ed->srcRaw >= MIXSRC_FIRST_TELEM ? (uint8_t)1 : (uint8_t)0), 0, 0, CASE_CURVES(CURVE_ROWS) CASE_FLIGHT_MODES((MAX_FLIGHT_MODES-1) | NAVIGATION_LINE_BY_LINE) 0 /*, ...*/}); SUBMENU_WITH_OPTIONS(STR_MENUINPUTS, ICON_MODEL_INPUTS, EXPO_FIELD_MAX, OPTION_MENU_NO_FOOTER|OPTION_MENU_NO_SCROLLBAR, { 0, 0, (ed->srcRaw >= MIXSRC_FIRST_TELEM ? (uint8_t)1 : (uint8_t)0), 0, 0, CASE_CURVES(CURVE_ROWS) CASE_FLIGHT_MODES((MAX_FLIGHT_MODES-1) | NAVIGATION_LINE_BY_LINE) 0 /*, ...*/});
lcdDrawSizedText(50, 3+FH, g_model.inputNames[ed->chn], LEN_INPUT_NAME, ZCHAR|MENU_TITLE_COLOR); lcdDrawSizedText(50, 3+FH, g_model.inputNames[ed->chn], LEN_INPUT_NAME, ZCHAR|MENU_TITLE_COLOR);
lcdDrawSolidFilledRect(0, MENU_FOOTER_TOP, 230, MENU_FOOTER_HEIGHT, HEADER_BGCOLOR); lcdDrawSolidFilledRect(0, MENU_FOOTER_TOP, 230, MENU_FOOTER_HEIGHT, HEADER_BGCOLOR);
@ -370,7 +370,7 @@ bool menuModelExposAll(evt_t event)
uint8_t chn = expoAddress(s_currIdx)->chn + 1; uint8_t chn = expoAddress(s_currIdx)->chn + 1;
int linesCount = getExposLinesCount(); int linesCount = getExposLinesCount();
SIMPLE_MENU(STR_MENUINPUTS, LBM_MODEL_ICONS, menuTabModel, e_InputsAll, linesCount); SIMPLE_MENU(STR_MENUINPUTS, MODEL_ICONS, menuTabModel, e_InputsAll, linesCount);
switch (event) { switch (event) {
case EVT_ENTRY: case EVT_ENTRY:

View file

@ -93,7 +93,7 @@ void onLimitsMenu(const char *result)
bool menuModelLimits(evt_t event) bool menuModelLimits(evt_t event)
{ {
MENU(STR_MENULIMITS, LBM_MODEL_ICONS, menuTabModel, e_Limits, NUM_CHNOUT+1, MENU(STR_MENULIMITS, 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, 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,

View file

@ -77,7 +77,7 @@ bool menuModelLogicalSwitches(evt_t event)
{ {
INCDEC_DECLARE_VARS(EE_MODEL); INCDEC_DECLARE_VARS(EE_MODEL);
MENU(STR_MENULOGICALSWITCHES, LBM_MODEL_ICONS, menuTabModel, e_LogicalSwitches, NUM_LOGICAL_SWITCH, { NAVIGATION_LINE_BY_LINE|LS_FIELD_LAST/*repeated...*/} ); MENU(STR_MENULOGICALSWITCHES, MODEL_ICONS, menuTabModel, e_LogicalSwitches, NUM_LOGICAL_SWITCH, { NAVIGATION_LINE_BY_LINE|LS_FIELD_LAST/*repeated...*/} );
int k = 0; int k = 0;
int sub = menuVerticalPosition; int sub = menuVerticalPosition;

View file

@ -174,7 +174,7 @@ bool menuModelMixOne(evt_t event)
{ {
MixData * md2 = mixAddress(s_currIdx) ; MixData * md2 = mixAddress(s_currIdx) ;
SUBMENU_WITH_OPTIONS(STR_MIXER, LBM_MIXER_ICON, MIX_FIELD_COUNT, OPTION_MENU_NO_SCROLLBAR, { 0, 0, 0, 0, 0, CASE_CURVES(1) CASE_FLIGHT_MODES((MAX_FLIGHT_MODES-1) | NAVIGATION_LINE_BY_LINE) 0 /*, ...*/ }); SUBMENU_WITH_OPTIONS(STR_MIXER, ICON_MODEL_MIXER, MIX_FIELD_COUNT, OPTION_MENU_NO_SCROLLBAR, { 0, 0, 0, 0, 0, CASE_CURVES(1) CASE_FLIGHT_MODES((MAX_FLIGHT_MODES-1) | NAVIGATION_LINE_BY_LINE) 0 /*, ...*/ });
putsChn(50, 3+FH, md2->destCh+1, MENU_TITLE_COLOR); putsChn(50, 3+FH, md2->destCh+1, MENU_TITLE_COLOR);
// The separation line between 2 columns // The separation line between 2 columns
@ -341,7 +341,7 @@ bool menuModelMixAll(evt_t event)
uint8_t chn = mixAddress(s_currIdx)->destCh + 1; uint8_t chn = mixAddress(s_currIdx)->destCh + 1;
int linesCount = getMixesLinesCount(); int linesCount = getMixesLinesCount();
SIMPLE_MENU(STR_MIXER, LBM_MODEL_ICONS, menuTabModel, e_MixAll, linesCount); SIMPLE_MENU(STR_MIXER, MODEL_ICONS, menuTabModel, e_MixAll, linesCount);
switch (event) { switch (event) {
case EVT_ENTRY: case EVT_ENTRY:

View file

@ -218,7 +218,7 @@ bool menuModelSelect(evt_t event)
} }
// Header // Header
theme->drawTopbarBackground(LBM_LIBRARY_ICON); theme->drawTopbarBackground(ICON_LIBRARY);
// Body // Body
lcdDrawSolidFilledRect(0, MENU_HEADER_HEIGHT, CATEGORIES_WIDTH, LCD_H-MENU_HEADER_HEIGHT-MENU_FOOTER_HEIGHT, TITLE_BGCOLOR); lcdDrawSolidFilledRect(0, MENU_HEADER_HEIGHT, CATEGORIES_WIDTH, LCD_H-MENU_HEADER_HEIGHT-MENU_FOOTER_HEIGHT, TITLE_BGCOLOR);

View file

@ -186,7 +186,7 @@ bool menuModelSetup(evt_t event)
g_model.moduleData[INTERNAL_MODULE].ppm.pulsePol = XJT_EXTERNAL_ANTENNA; g_model.moduleData[INTERNAL_MODULE].ppm.pulsePol = XJT_EXTERNAL_ANTENNA;
} }
MENU(STR_MENUSETUP, LBM_MODEL_ICONS, menuTabModel, e_ModelSetup, ITEM_MODEL_SETUP_MAX, MENU(STR_MENUSETUP, MODEL_ICONS, menuTabModel, e_ModelSetup, ITEM_MODEL_SETUP_MAX,
{ 0, 0, TIMERS_ROWS, 0, 1, 0, 0, { 0, 0, TIMERS_ROWS, 0, 1, 0, 0,
LABEL(Throttle), 0, 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, LABEL(PreflightCheck), 0, 0, SW_WARN_ITEMS(), POT_WARN_ITEMS(), NAVIGATION_LINE_BY_LINE|(NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1), 0,
@ -753,7 +753,7 @@ bool menuModelFailsafe(evt_t event)
} }
} }
SIMPLE_SUBMENU_WITH_OPTIONS("FAILSAFE", LBM_STATS_ANALOGS_ICON, NUM_CHANNELS(g_moduleIdx), OPTION_MENU_NO_SCROLLBAR); SIMPLE_SUBMENU_WITH_OPTIONS("FAILSAFE", ICON_STATS_ANALOGS, NUM_CHANNELS(g_moduleIdx), OPTION_MENU_NO_SCROLLBAR);
drawStringWithIndex(50, 3+FH, "Module", g_moduleIdx+1, MENU_TITLE_COLOR); drawStringWithIndex(50, 3+FH, "Module", g_moduleIdx+1, MENU_TITLE_COLOR);
#define COL_W (LCD_W/2) #define COL_W (LCD_W/2)

View file

@ -127,7 +127,7 @@ bool menuModelSensor(evt_t event)
{ {
TelemetrySensor * sensor = &g_model.telemetrySensors[s_currIdx]; TelemetrySensor * sensor = &g_model.telemetrySensors[s_currIdx];
SUBMENU("SENSOR", LBM_TELEMETRY_ICON, SENSOR_FIELD_MAX, { 0, 0, sensor->type == TELEM_TYPE_CALCULATED ? (uint8_t)0 : (uint8_t)1, SENSOR_UNIT_ROWS, SENSOR_PREC_ROWS, SENSOR_PARAM1_ROWS, SENSOR_PARAM2_ROWS, SENSOR_PARAM3_ROWS, SENSOR_PARAM4_ROWS, 0, 0, 0, 0, 0 }); SUBMENU("SENSOR", ICON_MODEL_TELEMETRY, SENSOR_FIELD_MAX, { 0, 0, sensor->type == TELEM_TYPE_CALCULATED ? (uint8_t)0 : (uint8_t)1, SENSOR_UNIT_ROWS, SENSOR_PREC_ROWS, SENSOR_PARAM1_ROWS, SENSOR_PARAM2_ROWS, SENSOR_PARAM3_ROWS, SENSOR_PARAM4_ROWS, 0, 0, 0, 0, 0 });
lcdDrawNumber(lcdNextPos, 3, s_currIdx+1, MENU_TITLE_COLOR|LEFT); lcdDrawNumber(lcdNextPos, 3, s_currIdx+1, MENU_TITLE_COLOR|LEFT);
putsTelemetryChannelValue(50, 3+FH, s_currIdx, getValue(MIXSRC_FIRST_TELEM+3*s_currIdx), MENU_TITLE_COLOR|LEFT); putsTelemetryChannelValue(50, 3+FH, s_currIdx, getValue(MIXSRC_FIRST_TELEM+3*s_currIdx), MENU_TITLE_COLOR|LEFT);
@ -407,7 +407,7 @@ bool menuModelTelemetry(evt_t event)
} }
} }
MENU(STR_MENUTELEMETRY, LBM_MODEL_ICONS, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX, { TELEMETRY_TYPE_ROWS RSSI_ROWS SENSORS_ROWS VARIO_ROWS }); MENU(STR_MENUTELEMETRY, MODEL_ICONS, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX, { TELEMETRY_TYPE_ROWS RSSI_ROWS SENSORS_ROWS VARIO_ROWS });
for (int i=0; i<NUM_BODY_LINES; i++) { for (int i=0; i<NUM_BODY_LINES; i++) {
coord_t y = MENU_CONTENT_TOP + i*FH; coord_t y = MENU_CONTENT_TOP + i*FH;

View file

@ -60,11 +60,50 @@ extern evt_t menuEvent;
void chainMenu(MenuHandlerFunc newMenu); void chainMenu(MenuHandlerFunc newMenu);
/// goto given Menu, store current menu in menuStack /// goto given Menu, store current menu in menuStack
void pushMenu(MenuHandlerFunc newMenu); void pushMenu(MenuHandlerFunc newMenu);
/// return to last menu in menustack /// return to last menu in menuStack
void popMenu(); void popMenu();
enum MenuIcons {
ICON_OPENTX,
ICON_RADIO,
ICON_RADIO_SETUP,
ICON_RADIO_SD_BROWSER,
ICON_RADIO_GLOBAL_FUNCTIONS,
ICON_RADIO_TRAINER,
ICON_RADIO_HARDWARE,
ICON_RADIO_CALIBRATION,
ICON_RADIO_VERSION,
ICON_MODEL,
ICON_MODEL_SETUP,
ICON_MODEL_HELI,
ICON_MODEL_FLIGHT_MODES,
ICON_MODEL_INPUTS,
ICON_MODEL_MIXER,
ICON_MODEL_OUTPUTS,
ICON_MODEL_CURVES,
ICON_MODEL_GVARS,
ICON_MODEL_LOGICAL_SWITCHES,
ICON_MODEL_SPECIAL_FUNCTIONS,
ICON_MODEL_LUA_SCRIPTS,
ICON_MODEL_TELEMETRY,
ICON_LIBRARY,
ICON_THEME,
ICON_THEME_SETUP,
ICON_THEME_VIEW1,
ICON_THEME_VIEW2,
ICON_THEME_VIEW3,
ICON_THEME_VIEW4,
ICON_THEME_VIEW5,
ICON_THEME_ADD_VIEW,
ICON_STATS,
ICON_STATS_THROTTLE_GRAPH,
ICON_STATS_TIMERS,
ICON_STATS_ANALOGS,
ICON_STATS_DEBUG,
MENUS_ICONS_COUNT
};
enum EnumTabModel { enum EnumTabModel {
// e_ModelSelect,
e_ModelSetup, e_ModelSetup,
CASE_HELI(e_Heli) CASE_HELI(e_Heli)
CASE_FLIGHT_MODES(e_FlightModesAll) CASE_FLIGHT_MODES(e_FlightModesAll)
@ -81,6 +120,44 @@ enum EnumTabModel {
CASE_FRSKY(e_Telemetry) CASE_FRSKY(e_Telemetry)
}; };
const uint8_t RADIO_ICONS[] = {
ICON_RADIO,
ICON_RADIO_SETUP,
ICON_RADIO_SD_BROWSER,
ICON_RADIO_GLOBAL_FUNCTIONS,
ICON_RADIO_TRAINER,
ICON_RADIO_HARDWARE,
ICON_RADIO_VERSION
};
const uint8_t MODEL_ICONS[] = {
ICON_MODEL,
ICON_MODEL_SETUP,
CASE_HELI(ICON_MODEL_HELI)
CASE_FLIGHT_MODES(ICON_MODEL_FLIGHT_MODES)
ICON_MODEL_INPUTS,
ICON_MODEL_MIXER,
ICON_MODEL_OUTPUTS,
CASE_CURVES(ICON_MODEL_CURVES)
CASE_GVARS(ICON_MODEL_GVARS)
ICON_MODEL_LOGICAL_SWITCHES,
ICON_MODEL_SPECIAL_FUNCTIONS,
#if defined(LUA_MODEL_SCRIPTS)
ICON_MODEL_LUA_SCRIPTS,
#endif
ICON_MODEL_TELEMETRY
};
const uint8_t STATS_ICONS[] = {
ICON_STATS,
ICON_STATS_THROTTLE_GRAPH,
ICON_STATS_TIMERS,
ICON_STATS_ANALOGS,
#if defined(DEBUG_TRACE_BUFFER)
ICON_STATS_DEBUG
#endif
};
bool menuModelSetup(evt_t event); bool menuModelSetup(evt_t event);
bool menuModelHeli(evt_t event); bool menuModelHeli(evt_t event);
bool menuModelFlightModesAll(evt_t event); bool menuModelFlightModesAll(evt_t event);
@ -287,12 +364,12 @@ bool check_submenu_simple(check_event_t event, uint8_t maxrow);
MENU_TAB(__VA_ARGS__); \ MENU_TAB(__VA_ARGS__); \
if (event == EVT_ENTRY || event == EVT_ENTRY_UP) TRACE("Menu %s displayed ...", title); \ if (event == EVT_ENTRY || event == EVT_ENTRY_UP) TRACE("Menu %s displayed ...", title); \
if (!check(event, menu, tab, tabCount, 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); drawMenuTemplate(title, 0, icons, OPTION_MENU_TITLE_BAR);
#define CUSTOM_MENU_WITH_OPTIONS(title, icons, tab, tabCount, menu, lines_count) \ #define CUSTOM_MENU_WITH_OPTIONS(title, icons, tab, tabCount, menu, lines_count) \
if (event == EVT_ENTRY || event == EVT_ENTRY_UP) TRACE("Menu %s displayed ...", title); \ if (event == EVT_ENTRY || event == EVT_ENTRY_UP) TRACE("Menu %s displayed ...", title); \
if (!check(event, menu, tab, tabCount, 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); drawMenuTemplate(title, 0, icons, OPTION_MENU_TITLE_BAR);
#define MENU(title, icons, tab, menu, lines_count, ...) \ #define MENU(title, icons, tab, menu, lines_count, ...) \
MENU_WITH_OPTIONS(title, icons, tab, DIM(tab), menu, lines_count, __VA_ARGS__) MENU_WITH_OPTIONS(title, icons, tab, DIM(tab), menu, lines_count, __VA_ARGS__)
@ -300,7 +377,7 @@ bool check_submenu_simple(check_event_t event, uint8_t maxrow);
#define SIMPLE_MENU_WITH_OPTIONS(title, icons, tab, tabCount, menu, lines_count) \ #define SIMPLE_MENU_WITH_OPTIONS(title, icons, tab, tabCount, menu, lines_count) \
if (event == EVT_ENTRY || event == EVT_ENTRY_UP) TRACE("Menu %s displayed ...", title); \ if (event == EVT_ENTRY || event == EVT_ENTRY_UP) TRACE("Menu %s displayed ...", title); \
if (!check_simple(event, menu, tab, tabCount, lines_count)) return false; \ if (!check_simple(event, menu, tab, tabCount, lines_count)) return false; \
drawMenuTemplate(title, icons); drawMenuTemplate(title, 0, icons, OPTION_MENU_TITLE_BAR);
#define SIMPLE_MENU(title, icons, tab, menu, lines_count) \ #define SIMPLE_MENU(title, icons, tab, menu, lines_count) \
SIMPLE_MENU_WITH_OPTIONS(title, icons, tab, DIM(tab), menu, lines_count) SIMPLE_MENU_WITH_OPTIONS(title, icons, tab, DIM(tab), menu, lines_count)
@ -308,24 +385,24 @@ bool check_submenu_simple(check_event_t event, uint8_t maxrow);
#define SUBMENU(title, icon, lines_count, ...) \ #define SUBMENU(title, icon, lines_count, ...) \
MENU_TAB(__VA_ARGS__); \ MENU_TAB(__VA_ARGS__); \
if (!check(event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, lines_count)) return false; \ if (!check(event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, lines_count)) return false; \
drawScreenTemplate(title, icon); drawMenuTemplate(title, icon);
#define SUBMENU_WITH_OPTIONS(title, icon, lines_count, options, ...) \ #define SUBMENU_WITH_OPTIONS(title, icon, lines_count, options, ...) \
MENU_TAB(__VA_ARGS__); \ MENU_TAB(__VA_ARGS__); \
if (!check(event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, lines_count)) return false; \ if (!check(event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, lines_count)) return false; \
drawScreenTemplate(title, icon, options); drawMenuTemplate(title, icon, NULL, options);
#define CUSTOM_SUBMENU_WITH_OPTIONS(title, icon, lines_count, options) \ #define CUSTOM_SUBMENU_WITH_OPTIONS(title, icon, lines_count, options) \
if (!check(event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, lines_count)) return false; \ if (!check(event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, lines_count)) return false; \
drawScreenTemplate(title, icon, options); drawMenuTemplate(title, icon, NULL, options);
#define SIMPLE_SUBMENU(title, icon, lines_count) \ #define SIMPLE_SUBMENU(title, icon, lines_count) \
if (!check_submenu_simple(event, lines_count)) return false; \ if (!check_submenu_simple(event, lines_count)) return false; \
drawScreenTemplate(title, icon) drawMenuTemplate(title, icon, NULL)
#define SIMPLE_SUBMENU_WITH_OPTIONS(title, icon, lines_count, options) \ #define SIMPLE_SUBMENU_WITH_OPTIONS(title, icon, lines_count, options) \
if (!check_submenu_simple(event, lines_count)) return false; \ if (!check_submenu_simple(event, lines_count)) return false; \
drawScreenTemplate(title, icon, options) drawMenuTemplate(title, icon, NULL, options)
typedef int select_menu_value_t; typedef int select_menu_value_t;

View file

@ -20,14 +20,15 @@
#include "opentx.h" #include "opentx.h"
const uint8_t * LBM_SCREENS_SETUP_ICONS[] = { uint8_t THEME_ICONS[] = {
LBM_MAINVIEWS_ICON, ICON_THEME,
LBM_MAINVIEWS_TOPBAR_ICON, ICON_THEME_SETUP,
LBM_MAINVIEWS_ICONS[0], ICON_THEME_VIEW1,
LBM_MAINVIEWS_ICONS[1], ICON_THEME_VIEW2,
LBM_MAINVIEWS_ICONS[2], ICON_THEME_VIEW3,
LBM_MAINVIEWS_ICONS[3], ICON_THEME_VIEW4,
LBM_MAINVIEWS_ICONS[4] ICON_THEME_VIEW5,
ICON_THEME_ADD_VIEW,
}; };
Layout * currentScreen; Layout * currentScreen;
@ -178,7 +179,7 @@ bool menuSettings(const char * title, const T * object, uint32_t i_flags, evt_t
mstate_tab[i] = getZoneOptionColumns(&options[i]); mstate_tab[i] = getZoneOptionColumns(&options[i]);
} }
CUSTOM_SUBMENU_WITH_OPTIONS(title, LBM_MAINVIEWS_ICON, linesCount, OPTION_MENU_TITLE_BAR); CUSTOM_SUBMENU_WITH_OPTIONS(title, ICON_THEME, linesCount, OPTION_MENU_TITLE_BAR);
for (int i=0; i<NUM_BODY_LINES+1; i++) { for (int i=0; i<NUM_BODY_LINES+1; i++) {
coord_t y = MENU_CONTENT_TOP + i * FH; coord_t y = MENU_CONTENT_TOP + i * FH;
@ -423,7 +424,7 @@ bool menuScreensTheme(evt_t event)
mstate_tab[2+i] = getZoneOptionColumns(&options[i]); mstate_tab[2+i] = getZoneOptionColumns(&options[i]);
} }
mstate_tab[2+optionsCount] = 0; // The button for the Topbar setup mstate_tab[2+optionsCount] = 0; // The button for the Topbar setup
CUSTOM_MENU_WITH_OPTIONS("User interface", LBM_SCREENS_SETUP_ICONS, menuTabScreensSetup, menuPageCount, 0, linesCount); CUSTOM_MENU_WITH_OPTIONS("User interface", THEME_ICONS, menuTabScreensSetup, menuPageCount, 0, linesCount);
for (int i=0; i<NUM_BODY_LINES; i++) { for (int i=0; i<NUM_BODY_LINES; i++) {
coord_t y = MENU_CONTENT_TOP + i * FH; coord_t y = MENU_CONTENT_TOP + i * FH;
@ -506,7 +507,7 @@ bool menuScreenSetup(int index, evt_t event)
} }
mstate_tab[3+optionsCount] = 0; // The remove button mstate_tab[3+optionsCount] = 0; // The remove button
CUSTOM_MENU_WITH_OPTIONS(title, LBM_SCREENS_SETUP_ICONS, menuTabScreensSetup, menuPageCount, index+1, linesCount); CUSTOM_MENU_WITH_OPTIONS(title, THEME_ICONS, menuTabScreensSetup, menuPageCount, index+1, linesCount);
for (int i=0; i<NUM_BODY_LINES; i++) { for (int i=0; i<NUM_BODY_LINES; i++) {
coord_t y = MENU_CONTENT_TOP + i * FH; coord_t y = MENU_CONTENT_TOP + i * FH;
@ -590,10 +591,10 @@ int updateMainviewsMenu()
{ {
for (int index=1; index<MAX_CUSTOM_SCREENS; index++) { for (int index=1; index<MAX_CUSTOM_SCREENS; index++) {
if (customScreens[index]) { if (customScreens[index]) {
LBM_SCREENS_SETUP_ICONS[2+index] = LBM_MAINVIEWS_ICONS[index]; THEME_ICONS[2+index] = ICON_THEME_VIEW1+index;
} }
else { else {
LBM_SCREENS_SETUP_ICONS[2+index] = LBM_MAINVIEWS_ADD_ICON; THEME_ICONS[2+index] = ICON_THEME_ADD_VIEW;
return 2+index; return 2+index;
} }
} }
@ -614,6 +615,6 @@ bool menuScreenAdd(evt_t event)
return false; return false;
} }
SIMPLE_MENU_WITH_OPTIONS("Add main view", LBM_SCREENS_SETUP_ICONS, menuTabScreensSetup, menuPageCount, menuPageCount-1, 0); SIMPLE_MENU_WITH_OPTIONS("Add main view", THEME_ICONS, menuTabScreensSetup, menuPageCount, menuPageCount-1, 0);
return true; return true;
} }

View file

@ -76,11 +76,6 @@ void Theme::drawBackground() const
lcdDrawSolidFilledRect(0, 0, LCD_W, LCD_H, TEXT_BGCOLOR); lcdDrawSolidFilledRect(0, 0, LCD_W, LCD_H, TEXT_BGCOLOR);
} }
void Theme::drawAboutBackground() const
{
drawBackground();
}
void Theme::drawMessageBox(const char * title, const char * text, const char * action, uint32_t type) const void Theme::drawMessageBox(const char * title, const char * text, const char * action, uint32_t type) const
{ {
//if (flags & MESSAGEBOX_TYPE_ALERT) { //if (flags & MESSAGEBOX_TYPE_ALERT) {

View file

@ -69,9 +69,9 @@ class Theme
virtual void drawBackground() const; virtual void drawBackground() const;
virtual void drawAboutBackground() const; virtual void drawTopbarBackground(uint8_t icon) const = 0;
virtual void drawTopbarBackground(const uint8_t * icon) const = 0; virtual void drawMenuIcon(uint8_t index, uint8_t position, bool selected) const { }
virtual void drawMessageBox(const char * title, const char * text, const char * action, uint32_t flags) const; virtual void drawMessageBox(const char * title, const char * text, const char * action, uint32_t flags) const;

View file

@ -28,7 +28,7 @@ class DarkblueTheme: public Theme
{ {
} }
virtual void load() const void loadColors() const
{ {
lcdColorTable[TEXT_COLOR_INDEX] = WHITE; lcdColorTable[TEXT_COLOR_INDEX] = WHITE;
lcdColorTable[TEXT_BGCOLOR_INDEX] = RGB(10, 78, 121); lcdColorTable[TEXT_BGCOLOR_INDEX] = RGB(10, 78, 121);
@ -51,27 +51,96 @@ class DarkblueTheme: public Theme
lcdColorTable[TRIM_SHADOW_COLOR_INDEX] = RGB(100, 100, 100); lcdColorTable[TRIM_SHADOW_COLOR_INDEX] = RGB(100, 100, 100);
lcdColorTable[MAINVIEW_PANES_COLOR_INDEX] = GREY; lcdColorTable[MAINVIEW_PANES_COLOR_INDEX] = GREY;
lcdColorTable[MAINVIEW_GRAPHICS_COLOR_INDEX] = WHITE; lcdColorTable[MAINVIEW_GRAPHICS_COLOR_INDEX] = WHITE;
lcdColorTable[HEADER_BGCOLOR_INDEX] = RGB(32, 34, 42); lcdColorTable[HEADER_BGCOLOR_INDEX] = BLACK;
lcdColorTable[HEADER_ICON_BGCOLOR_INDEX] = BLACK; lcdColorTable[HEADER_ICON_BGCOLOR_INDEX] = BLACK;
lcdColorTable[HEADER_CURRENT_BGCOLOR_INDEX] = RGB(10, 78, 121); lcdColorTable[HEADER_CURRENT_BGCOLOR_INDEX] = RGB(10, 78, 121);
lcdColorTable[OVERLAY_COLOR_INDEX] = BLACK; lcdColorTable[OVERLAY_COLOR_INDEX] = BLACK;
} }
void drawTopbarBackground(const uint8_t * icon) const void loadMenuIcon(uint8_t index, const char * filename) const
{
BitmapBuffer * mask = BitmapBuffer::loadMask(getThemePath(filename));
if (mask) {
menuIconNormal[index] = new BitmapBuffer(BMP_RGB565, mask->getWidth(), mask->getHeight());
menuIconNormal[index]->clear(HEADER_BGCOLOR);
menuIconNormal[index]->drawMask(0, 0, mask, HEADER_CURRENT_BGCOLOR);
menuIconSelected[index] = new BitmapBuffer(BMP_RGB565, mask->getWidth(), mask->getHeight());
menuIconSelected[index]->clear(HEADER_BGCOLOR);
menuIconSelected[index]->drawMask(0, 0, mask, MENU_TITLE_COLOR);
}
}
void loadMenusIcons() const
{
loadMenuIcon(ICON_OPENTX, "mask_opentx.png");
loadMenuIcon(ICON_RADIO, "mask_menu_radio.png");
loadMenuIcon(ICON_RADIO_SETUP, "mask_radio_setup.png");
loadMenuIcon(ICON_RADIO_SD_BROWSER, "mask_radio_sd_browser.png");
loadMenuIcon(ICON_RADIO_GLOBAL_FUNCTIONS, "mask_radio_global_functions.png");
loadMenuIcon(ICON_RADIO_TRAINER, "mask_radio_trainer.png");
loadMenuIcon(ICON_RADIO_HARDWARE, "mask_radio_hardware.png");
loadMenuIcon(ICON_RADIO_VERSION, "mask_radio_version.png");
loadMenuIcon(ICON_MODEL, "mask_menu_model.png");
loadMenuIcon(ICON_MODEL_SETUP, "mask_model_setup.png");
loadMenuIcon(ICON_MODEL_HELI, "mask_model_heli.png");
loadMenuIcon(ICON_MODEL_FLIGHT_MODES, "mask_model_flight_modes.png");
loadMenuIcon(ICON_MODEL_INPUTS, "mask_model_inputs.png");
loadMenuIcon(ICON_MODEL_MIXER, "mask_model_mixer.png");
loadMenuIcon(ICON_MODEL_OUTPUTS, "mask_model_outputs.png");
loadMenuIcon(ICON_MODEL_CURVES, "mask_model_curves.png");
loadMenuIcon(ICON_MODEL_GVARS, "mask_model_gvars.png");
loadMenuIcon(ICON_MODEL_LOGICAL_SWITCHES, "mask_model_logical_switches.png");
loadMenuIcon(ICON_MODEL_SPECIAL_FUNCTIONS, "mask_model_special_functions.png");
loadMenuIcon(ICON_MODEL_LUA_SCRIPTS, "mask_model_lua_scripts.png");
loadMenuIcon(ICON_MODEL_TELEMETRY, "mask_model_telemetry.png");
loadMenuIcon(ICON_STATS, "mask_menu_stats.png");
loadMenuIcon(ICON_STATS_THROTTLE_GRAPH, "mask_stats_throttle_graph.png");
loadMenuIcon(ICON_STATS_TIMERS, "mask_stats_timers.png");
loadMenuIcon(ICON_STATS_ANALOGS, "mask_stats_analogs.png");
loadMenuIcon(ICON_STATS_DEBUG, "mask_stats_debug.png");
loadMenuIcon(ICON_THEME, "mask_menu_theme.png");
loadMenuIcon(ICON_THEME_SETUP, "mask_theme_setup.png");
loadMenuIcon(ICON_THEME_VIEW1, "mask_theme_view1.png");
loadMenuIcon(ICON_THEME_VIEW2, "mask_theme_view2.png");
loadMenuIcon(ICON_THEME_VIEW3, "mask_theme_view3.png");
loadMenuIcon(ICON_THEME_VIEW4, "mask_theme_view4.png");
loadMenuIcon(ICON_THEME_VIEW5, "mask_theme_view5.png");
loadMenuIcon(ICON_THEME_ADD_VIEW, "mask_theme_add_view.png");
}
virtual void load() const
{
loadColors();
loadMenusIcons();
}
void drawTopbarBackground(uint8_t icon) const
{ {
lcdDrawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR); lcdDrawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
lcdDrawSolidFilledRect(0, 0, 41, MENU_HEADER_HEIGHT, HEADER_ICON_BGCOLOR); lcdDrawSolidFilledRect(0, 0, 41, MENU_HEADER_HEIGHT, HEADER_ICON_BGCOLOR);
if (icon) { if (icon == ICON_OPENTX) {
lcdDrawBitmapPattern(5, 7, icon, MENU_TITLE_COLOR);
}
else {
static BitmapBuffer * thumb = BitmapBuffer::load(getFilePath("topmenu_opentx.bmp")); static BitmapBuffer * thumb = BitmapBuffer::load(getFilePath("topmenu_opentx.bmp"));
lcd->drawBitmap(5, 7, thumb); lcd->drawBitmap(5, 7, thumb);
} }
else {
lcd->drawBitmap(5, 7, menuIconSelected[icon]);
}
drawTopbarDatetime(); drawTopbarDatetime();
} }
virtual void drawMenuIcon(uint8_t index, uint8_t position, bool selected) const
{
lcd->drawBitmap(50+position*MENU_ICONS_SPACING, 7, selected ? menuIconSelected[index] : menuIconNormal[index]);
}
protected:
static BitmapBuffer * menuIconNormal[MENUS_ICONS_COUNT];
static BitmapBuffer * menuIconSelected[MENUS_ICONS_COUNT];
}; };
BitmapBuffer * DarkblueTheme::menuIconNormal[MENUS_ICONS_COUNT] = { NULL };
BitmapBuffer * DarkblueTheme::menuIconSelected[MENUS_ICONS_COUNT] = { NULL };
const DarkblueTheme darkblueTheme; const DarkblueTheme darkblueTheme;

View file

@ -20,10 +20,6 @@
#include "opentx.h" #include "opentx.h"
const uint8_t LBM_TOPMENU_MASK_OPENTX[] = {
#include "mask_topmenu_opentx.lbm"
};
const ZoneOption OPTIONS_THEME_DEFAULT[] = { const ZoneOption OPTIONS_THEME_DEFAULT[] = {
{ "Background color", ZoneOption::Color, OPTION_DEFAULT_VALUE_UNSIGNED(WHITE) }, { "Background color", ZoneOption::Color, OPTION_DEFAULT_VALUE_UNSIGNED(WHITE) },
{ "Main color", ZoneOption::Color, OPTION_DEFAULT_VALUE_UNSIGNED(RED) }, { "Main color", ZoneOption::Color, OPTION_DEFAULT_VALUE_UNSIGNED(RED) },
@ -68,12 +64,79 @@ class DefaultTheme: public Theme
lcdColorTable[OVERLAY_COLOR_INDEX] = BLACK; lcdColorTable[OVERLAY_COLOR_INDEX] = BLACK;
} }
void loadMenuIcon(uint8_t index, const char * filename) const
{
BitmapBuffer * mask = BitmapBuffer::loadMask(getThemePath(filename));
if (mask) {
menuIconNormal[index] = new BitmapBuffer(BMP_RGB565, mask->getWidth(), mask->getHeight());
menuIconNormal[index]->clear(HEADER_BGCOLOR);
menuIconNormal[index]->drawMask(0, 0, mask, MENU_TITLE_COLOR);
menuIconSelected[index] = new BitmapBuffer(BMP_RGB565, mask->getWidth(), mask->getHeight());
menuIconSelected[index]->clear(HEADER_CURRENT_BGCOLOR);
menuIconSelected[index]->drawMask(0, 0, mask, MENU_TITLE_COLOR);
}
}
void loadMenusIcons() const
{
loadMenuIcon(ICON_OPENTX, "mask_opentx.png");
loadMenuIcon(ICON_RADIO, "mask_menu_radio.png");
loadMenuIcon(ICON_RADIO_SETUP, "mask_radio_setup.png");
loadMenuIcon(ICON_RADIO_SD_BROWSER, "mask_radio_sd_browser.png");
loadMenuIcon(ICON_RADIO_GLOBAL_FUNCTIONS, "mask_radio_global_functions.png");
loadMenuIcon(ICON_RADIO_TRAINER, "mask_radio_trainer.png");
loadMenuIcon(ICON_RADIO_HARDWARE, "mask_radio_hardware.png");
loadMenuIcon(ICON_RADIO_VERSION, "mask_radio_version.png");
loadMenuIcon(ICON_MODEL, "mask_menu_model.png");
loadMenuIcon(ICON_MODEL_SETUP, "mask_model_setup.png");
loadMenuIcon(ICON_MODEL_HELI, "mask_model_heli.png");
loadMenuIcon(ICON_MODEL_FLIGHT_MODES, "mask_model_flight_modes.png");
loadMenuIcon(ICON_MODEL_INPUTS, "mask_model_inputs.png");
loadMenuIcon(ICON_MODEL_MIXER, "mask_model_mixer.png");
loadMenuIcon(ICON_MODEL_OUTPUTS, "mask_model_outputs.png");
loadMenuIcon(ICON_MODEL_CURVES, "mask_model_curves.png");
loadMenuIcon(ICON_MODEL_GVARS, "mask_model_gvars.png");
loadMenuIcon(ICON_MODEL_LOGICAL_SWITCHES, "mask_model_logical_switches.png");
loadMenuIcon(ICON_MODEL_SPECIAL_FUNCTIONS, "mask_model_special_functions.png");
loadMenuIcon(ICON_MODEL_LUA_SCRIPTS, "mask_model_lua_scripts.png");
loadMenuIcon(ICON_MODEL_TELEMETRY, "mask_model_telemetry.png");
loadMenuIcon(ICON_STATS, "mask_menu_stats.png");
loadMenuIcon(ICON_STATS_THROTTLE_GRAPH, "mask_stats_throttle_graph.png");
loadMenuIcon(ICON_STATS_TIMERS, "mask_stats_timers.png");
loadMenuIcon(ICON_STATS_ANALOGS, "mask_stats_analogs.png");
loadMenuIcon(ICON_STATS_DEBUG, "mask_stats_debug.png");
loadMenuIcon(ICON_THEME, "mask_menu_theme.png");
loadMenuIcon(ICON_THEME_SETUP, "mask_theme_setup.png");
loadMenuIcon(ICON_THEME_VIEW1, "mask_theme_view1.png");
loadMenuIcon(ICON_THEME_VIEW2, "mask_theme_view2.png");
loadMenuIcon(ICON_THEME_VIEW3, "mask_theme_view3.png");
loadMenuIcon(ICON_THEME_VIEW4, "mask_theme_view4.png");
loadMenuIcon(ICON_THEME_VIEW5, "mask_theme_view5.png");
loadMenuIcon(ICON_THEME_ADD_VIEW, "mask_theme_add_view.png");
BitmapBuffer * background = BitmapBuffer::loadMask(getThemePath("mask_currentmenu_bg.png"));
BitmapBuffer * shadow = BitmapBuffer::loadMask(getThemePath("mask_currentmenu_shadow.png"));
BitmapBuffer * dot = BitmapBuffer::loadMask(getThemePath("mask_currentmenu_dot.png"));
if (!currentMenuBackground) currentMenuBackground = new BitmapBuffer(BMP_RGB565, 36, 53);
currentMenuBackground->drawSolidFilledRect(0, 0, currentMenuBackground->getWidth(), MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
currentMenuBackground->drawSolidFilledRect(0, MENU_HEADER_HEIGHT, currentMenuBackground->getWidth(), MENU_TITLE_TOP - MENU_HEADER_HEIGHT, TEXT_BGCOLOR);
currentMenuBackground->drawSolidFilledRect(0, MENU_TITLE_TOP, currentMenuBackground->getWidth(), currentMenuBackground->getHeight() - MENU_TITLE_TOP, TITLE_BGCOLOR);
currentMenuBackground->drawMask(0, 0, background, HEADER_CURRENT_BGCOLOR);
currentMenuBackground->drawMask(0, 0, shadow, TRIM_SHADOW_COLOR);
currentMenuBackground->drawMask(10, 39, dot, MENU_TITLE_COLOR);
delete background;
delete shadow;
delete dot;
}
virtual void load() const virtual void load() const
{ {
loadColors(); loadColors();
loadMenusIcons();
Theme::load(); Theme::load();
if (!backgroundBitmap) backgroundBitmap = BitmapBuffer::load(getThemePath("mainbg.bmp")); if (!backgroundBitmap) backgroundBitmap = BitmapBuffer::load(getThemePath("mainbg.bmp"));
if (!aboutBackgroundBitmap) aboutBackgroundBitmap = BitmapBuffer::load(getThemePath("aboutbg.bmp"));
update(); update();
} }
@ -103,33 +166,41 @@ class DefaultTheme: public Theme
} }
} }
virtual void drawAboutBackground() const virtual void drawTopbarBackground(uint8_t icon) const
{
lcd->drawBitmap(0, 0, aboutBackgroundBitmap);
}
virtual void drawTopbarBackground(const uint8_t * icon) const
{ {
lcdDrawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR); lcdDrawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
lcdDrawBitmapPattern(0, 0, LBM_TOPMENU_POLYGON, TITLE_BGCOLOR); lcdDrawBitmapPattern(0, 0, LBM_TOPMENU_POLYGON, TITLE_BGCOLOR);
if (icon) { if (icon == ICON_OPENTX)
lcdDrawBitmapPattern(5, 7, icon, MENU_TITLE_COLOR); lcd->drawBitmap(4, 10, menuIconSelected[ICON_OPENTX]);
} else
else { lcd->drawBitmap(5, 7, menuIconSelected[icon]);
lcdDrawBitmapPattern(4, 10, LBM_TOPMENU_MASK_OPENTX, MENU_TITLE_COLOR);
}
drawTopbarDatetime(); drawTopbarDatetime();
} }
virtual void drawMenuIcon(uint8_t index, uint8_t position, bool selected) const
{
if (selected) {
lcd->drawBitmap(58+position*MENU_ICONS_SPACING-10, 0, currentMenuBackground);
lcd->drawBitmap(50+position*MENU_ICONS_SPACING, 7, menuIconSelected[index], MENU_TITLE_COLOR);
}
else {
lcd->drawBitmap(50+position*MENU_ICONS_SPACING, 7, menuIconNormal[index], MENU_TITLE_COLOR);
}
}
protected: protected:
static const BitmapBuffer * backgroundBitmap; static const BitmapBuffer * backgroundBitmap;
static const BitmapBuffer * aboutBackgroundBitmap; static BitmapBuffer * menuIconNormal[MENUS_ICONS_COUNT];
static BitmapBuffer * menuIconSelected[MENUS_ICONS_COUNT];
static BitmapBuffer * currentMenuBackground;
}; };
const BitmapBuffer * DefaultTheme::backgroundBitmap = NULL; const BitmapBuffer * DefaultTheme::backgroundBitmap = NULL;
const BitmapBuffer * DefaultTheme::aboutBackgroundBitmap = NULL; BitmapBuffer * DefaultTheme::menuIconNormal[MENUS_ICONS_COUNT] = { NULL };
BitmapBuffer * DefaultTheme::menuIconSelected[MENUS_ICONS_COUNT] = { NULL };
BitmapBuffer * DefaultTheme::currentMenuBackground = NULL;
DefaultTheme defaultTheme; DefaultTheme defaultTheme;
Theme * theme = &defaultTheme; Theme * theme = &defaultTheme;

View file

@ -53,7 +53,7 @@ void drawTopbarDatetime()
void drawTopBar() void drawTopBar()
{ {
theme->drawTopbarBackground(NULL); theme->drawTopbarBackground(0);
// USB icon // USB icon
if (usbPlugged()) { if (usbPlugged()) {

View file

@ -62,8 +62,8 @@ bool menuAboutView(evt_t event)
break; break;
} }
theme->drawAboutBackground(); theme->drawBackground();
theme->drawTopbarBackground(NULL); theme->drawTopbarBackground(0);
uint8_t screenDuration = 150; uint8_t screenDuration = 150;

View file

@ -39,7 +39,7 @@ bool menuStatsGraph(evt_t event)
break; break;
} }
MENU("Statistics", LBM_STATS_ICONS, menuTabStats, e_StatsGraph, 0, { 0 }); MENU("Statistics", STATS_ICONS, menuTabStats, e_StatsGraph, 0, { 0 });
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP, "Session"); lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP, "Session");
putsTimer(MENU_STATS_COLUMN1, MENU_CONTENT_TOP, sessionTimer, TIMEHOUR); putsTimer(MENU_STATS_COLUMN1, MENU_CONTENT_TOP, sessionTimer, TIMEHOUR);
@ -111,7 +111,7 @@ bool menuStatsDebug(evt_t event)
break; break;
} }
MENU("Debug", LBM_STATS_ICONS, menuTabStats, e_StatsDebug, 0, { 0 }); MENU("Debug", STATS_ICONS, menuTabStats, e_StatsDebug, 0, { 0 });
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP, "Free Mem"); lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP, "Free Mem");
lcdDrawNumber(MENU_STATS_COLUMN1, MENU_CONTENT_TOP, availableMemory(), LEFT, 0, NULL, "b"); lcdDrawNumber(MENU_STATS_COLUMN1, MENU_CONTENT_TOP, availableMemory(), LEFT, 0, NULL, "b");
@ -142,7 +142,7 @@ bool menuStatsDebug(evt_t event)
bool menuStatsAnalogs(evt_t event) bool menuStatsAnalogs(evt_t event)
{ {
MENU("Analogs", LBM_STATS_ICONS, menuTabStats, e_StatsAnalogs, 0, { 0 }); MENU("Analogs", STATS_ICONS, menuTabStats, e_StatsAnalogs, 0, { 0 });
for (int i=0; i<NUM_STICKS+NUM_POTS; i++) { for (int i=0; i<NUM_STICKS+NUM_POTS; i++) {
coord_t y = MENU_CONTENT_TOP + (i/2)*FH; coord_t y = MENU_CONTENT_TOP + (i/2)*FH;
@ -178,7 +178,7 @@ bool menuStatsTraces(evt_t event)
break; break;
} }
SIMPLE_MENU("", LBM_STATS_ICONS, menuTabStats, e_StatsTraces, TRACE_BUFFER_LEN); SIMPLE_MENU("", STATS_ICONS, menuTabStats, e_StatsTraces, TRACE_BUFFER_LEN);
uint8_t k = 0; uint8_t k = 0;
int8_t sub = menuVerticalPosition; int8_t sub = menuVerticalPosition;

View file

@ -18,7 +18,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include "../../opentx.h" #include "opentx.h"
#define TEXT_FILE_MAXSIZE 2048 #define TEXT_FILE_MAXSIZE 2048
@ -91,7 +91,7 @@ bool menuTextView(evt_t event)
{ {
static int lines_count; static int lines_count;
drawScreenTemplate("TEXT VIEWER", NULL); drawMenuTemplate("TEXT VIEWER", ICON_OPENTX);
switch (event) { switch (event) {
case EVT_ENTRY: case EVT_ENTRY:

View file

@ -129,11 +129,11 @@ void drawShadow(coord_t x, coord_t y, coord_t w, coord_t h)
uint8_t linesDisplayed; uint8_t linesDisplayed;
void drawScreenTemplate(const char * title, const uint8_t * icon, uint32_t options) void drawMenuTemplate(const char * title, uint8_t icon, const uint8_t * icons, uint32_t options)
{ {
coord_t bodyTop, bodyBottom; coord_t bodyTop, bodyBottom;
theme->drawTopbarBackground(icon); theme->drawTopbarBackground(icons ? icons[0] : icon);
// Menu title bar // Menu title bar
if (options & OPTION_MENU_TITLE_BAR) { if (options & OPTION_MENU_TITLE_BAR) {
@ -144,6 +144,14 @@ void drawScreenTemplate(const char * title, const uint8_t * icon, uint32_t optio
if (title) { if (title) {
lcdDrawText(MENUS_MARGIN_LEFT, MENU_TITLE_TOP+2, title, MENU_TITLE_COLOR); lcdDrawText(MENUS_MARGIN_LEFT, MENU_TITLE_TOP+2, title, MENU_TITLE_COLOR);
} }
if (icons) {
for (int i=0; i<menuPageCount; i++) {
if (menuPageIndex != i) {
theme->drawMenuIcon(icons[i+1], i, false);
}
}
theme->drawMenuIcon(icons[menuPageIndex+1], menuPageIndex, true);
}
} }
else { else {
linesDisplayed = NUM_BODY_LINES + 1; linesDisplayed = NUM_BODY_LINES + 1;
@ -171,19 +179,6 @@ void drawScreenTemplate(const char * title, const uint8_t * icon, uint32_t optio
} }
} }
void drawMenuTemplate(const char * title, const uint8_t * const * icons, uint32_t options)
{
drawScreenTemplate(title, icons[0], OPTION_MENU_TITLE_BAR);
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);
for (int i=0; i<menuPageCount; i++) {
lcdDrawBitmapPattern(50+i*MENU_ICONS_SPACING, 7, icons[i+1], MENU_TITLE_COLOR);
}
}
select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char * values, select_menu_value_t value, select_menu_value_t min, select_menu_value_t max, LcdFlags attr, evt_t event) select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char * values, select_menu_value_t value, select_menu_value_t min, select_menu_value_t max, LcdFlags attr, evt_t event)
{ {
if (attr) value = checkIncDec(event, value, min, max, (menuVerticalPositions[0] == 0) ? EE_MODEL : EE_GENERAL); if (attr) value = checkIncDec(event, value, min, max, (menuVerticalPositions[0] == 0) ? EE_MODEL : EE_GENERAL);

View file

@ -71,8 +71,7 @@ int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int
#endif #endif
// Screen templates // Screen templates
void drawScreenTemplate(const char * title, const uint8_t * icon, uint32_t options=0); void drawMenuTemplate(const char * title, uint8_t icon, const uint8_t * icons=NULL, uint32_t options=0);
void drawMenuTemplate(const char * title, const uint8_t * const * icons, uint32_t options=0);
void drawSplash(); void drawSplash();
void drawSleepBitmap(); void drawSleepBitmap();
void drawShutdownBitmap(uint32_t index); void drawShutdownBitmap(uint32_t index);

View file

@ -35,20 +35,19 @@ class ModelBitmapWidget: public Widget
delete buffer; delete buffer;
} }
#define DRAW_SCALED_BITMAP_FIT_WIDTH 1
#define DRAW_SCALED_BITMAP_FIT_HEIGHT 2
void refreshBuffer() void refreshBuffer()
{ {
delete buffer; delete buffer;
buffer = new BitmapBuffer(BMP_RGB565, zone.w, zone.h); buffer = new BitmapBuffer(BMP_RGB565, zone.w, zone.h);
if (buffer) { if (buffer) {
buffer->drawBitmap(0, 0, lcd, zone.x, zone.y, zone.w, zone.h); buffer->drawBitmap(0, 0, lcd, zone.x, zone.y, zone.w, zone.h);
GET_FILENAME(filename, BITMAPS_PATH, g_model.header.bitmap, BITMAPS_EXT); GET_FILENAME(filename, BITMAPS_PATH, g_model.header.bitmap, BITMAPS_EXT);
BitmapBuffer * bitmap = BitmapBuffer::load(filename); BitmapBuffer * bitmap = BitmapBuffer::load(filename);
if (zone.h >= 96 && zone.w >= 120) { if (zone.h >= 96 && zone.w >= 120) {
buffer->drawFilledRect(0, 0, zone.w, zone.h, SOLID, MAINVIEW_PANES_COLOR | OPACITY(5)); buffer->drawFilledRect(0, 0, zone.w, zone.h, SOLID, MAINVIEW_PANES_COLOR | OPACITY(5));
buffer->drawBitmapPattern(6, 4, LBM_MODEL_ICON, MAINVIEW_GRAPHICS_COLOR); static BitmapBuffer * icon = BitmapBuffer::loadMask(getThemePath("mask_menu_model.png"));
buffer->drawMask(6, 4, icon, MAINVIEW_GRAPHICS_COLOR);
buffer->drawSizedText(45, 10, g_model.header.name, LEN_MODEL_NAME, ZCHAR | SMLSIZE); buffer->drawSizedText(45, 10, g_model.header.name, LEN_MODEL_NAME, ZCHAR | SMLSIZE);
buffer->drawSolidFilledRect(39, 27, zone.w - 48, 2, MAINVIEW_GRAPHICS_COLOR); buffer->drawSolidFilledRect(39, 27, zone.w - 48, 2, MAINVIEW_GRAPHICS_COLOR);
if (bitmap) { if (bitmap) {