chore(color): Add 'title2' to Page class to manage 2nd header title line (#3238)
This commit is contained in:
@@ -374,10 +374,7 @@ void CurveEditWindow::buildHeader(Window * window)
|
|||||||
header.setTitle(STR_MENUCURVE);
|
header.setTitle(STR_MENUCURVE);
|
||||||
char s[16];
|
char s[16];
|
||||||
strAppendStringWithIndex(s, STR_CV, index + 1);
|
strAppendStringWithIndex(s, STR_CV, index + 1);
|
||||||
new StaticText(window,
|
header.setTitle2(s);
|
||||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
|
|
||||||
LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT},
|
|
||||||
s, 0, COLOR_THEME_PRIMARY2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CurveEditWindow::buildBody(FormWindow * window)
|
void CurveEditWindow::buildBody(FormWindow * window)
|
||||||
|
|||||||
@@ -194,11 +194,7 @@ class GVarEditWindow : public Page
|
|||||||
void buildHeader(Window* window)
|
void buildHeader(Window* window)
|
||||||
{
|
{
|
||||||
header.setTitle(STR_GLOBAL_VAR);
|
header.setTitle(STR_GLOBAL_VAR);
|
||||||
gVarInHeader =
|
gVarInHeader = header.setTitle2("");
|
||||||
new StaticText(window,
|
|
||||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
|
|
||||||
LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT},
|
|
||||||
"", 0, COLOR_THEME_PRIMARY2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkEvents()
|
void checkEvents()
|
||||||
|
|||||||
@@ -72,11 +72,7 @@ class LogicalSwitchEditPage : public Page
|
|||||||
void buildHeader(Window* window)
|
void buildHeader(Window* window)
|
||||||
{
|
{
|
||||||
header.setTitle(STR_MENULOGICALSWITCHES);
|
header.setTitle(STR_MENULOGICALSWITCHES);
|
||||||
headerSwitchName = new StaticText(
|
headerSwitchName = header.setTitle2(getSwitchPositionName(SWSRC_SW1 + index));
|
||||||
window,
|
|
||||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
|
|
||||||
LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT},
|
|
||||||
getSwitchPositionName(SWSRC_SW1 + index), 0, COLOR_THEME_PRIMARY2);
|
|
||||||
|
|
||||||
lv_obj_set_style_text_color(headerSwitchName->getLvObj(),
|
lv_obj_set_style_text_color(headerSwitchName->getLvObj(),
|
||||||
makeLvColor(COLOR_THEME_ACTIVE),
|
makeLvColor(COLOR_THEME_ACTIVE),
|
||||||
|
|||||||
@@ -81,10 +81,7 @@ class ScriptEditWindow : public Page {
|
|||||||
void buildHeader(Window * window)
|
void buildHeader(Window * window)
|
||||||
{
|
{
|
||||||
header.setTitle(STR_MENUCUSTOMSCRIPTS);
|
header.setTitle(STR_MENUCUSTOMSCRIPTS);
|
||||||
new StaticText(window,
|
header.setTitle2(std::string("LUA") + std::to_string(idx + 1));
|
||||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
|
|
||||||
LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT},
|
|
||||||
std::string("LUA") + std::to_string(idx + 1), 0, COLOR_THEME_PRIMARY2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void buildBody(FormWindow * window, bool focusScript = false)
|
void buildBody(FormWindow * window, bool focusScript = false)
|
||||||
|
|||||||
@@ -261,11 +261,7 @@ class SensorEditWindow : public Page {
|
|||||||
{
|
{
|
||||||
header.setTitle(STR_SENSOR + std::to_string(index + 1));
|
header.setTitle(STR_SENSOR + std::to_string(index + 1));
|
||||||
|
|
||||||
headerValue = new StaticText(
|
headerValue = header.setTitle2("");
|
||||||
window,
|
|
||||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
|
|
||||||
LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT},
|
|
||||||
"", 0, COLOR_THEME_PRIMARY2);
|
|
||||||
|
|
||||||
lv_obj_set_style_text_color(headerValue->getLvObj(), makeLvColor(COLOR_THEME_WARNING), LV_STATE_USER_1);
|
lv_obj_set_style_text_color(headerValue->getLvObj(), makeLvColor(COLOR_THEME_WARNING), LV_STATE_USER_1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,9 +35,22 @@ PageHeader::PageHeader(Page * parent, uint8_t icon):
|
|||||||
return 0;
|
return 0;
|
||||||
}, NO_FOCUS | FORM_NO_BORDER);
|
}, NO_FOCUS | FORM_NO_BORDER);
|
||||||
#endif
|
#endif
|
||||||
title = new StaticText(this, rect_t{}, "", 0, COLOR_THEME_PRIMARY2);
|
title = new StaticText(this,
|
||||||
title->setTop(PAGE_TITLE_TOP);
|
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP,
|
||||||
title->setLeft(PAGE_TITLE_LEFT);
|
LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT},
|
||||||
|
"", 0, COLOR_THEME_PRIMARY2);
|
||||||
|
}
|
||||||
|
|
||||||
|
StaticText* PageHeader::setTitle2(std::string txt)
|
||||||
|
{
|
||||||
|
if (title2 == nullptr) {
|
||||||
|
title2 = new StaticText(this,
|
||||||
|
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
|
||||||
|
LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT},
|
||||||
|
"", 0, COLOR_THEME_PRIMARY2);
|
||||||
|
}
|
||||||
|
title2->setText(std::move(txt));
|
||||||
|
return title2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PageHeader::paint(BitmapBuffer * dc)
|
void PageHeader::paint(BitmapBuffer * dc)
|
||||||
|
|||||||
@@ -35,12 +35,14 @@ class PageHeader : public FormGroup
|
|||||||
|
|
||||||
uint8_t getIcon() const { return icon; }
|
uint8_t getIcon() const { return icon; }
|
||||||
void setTitle(std::string txt) { title->setText(std::move(txt)); }
|
void setTitle(std::string txt) { title->setText(std::move(txt)); }
|
||||||
|
StaticText* setTitle2(std::string txt);
|
||||||
|
|
||||||
void paint(BitmapBuffer* dc) override;
|
void paint(BitmapBuffer* dc) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint8_t icon;
|
uint8_t icon;
|
||||||
StaticText* title;
|
StaticText* title;
|
||||||
|
StaticText* title2 = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Page : public Window
|
class Page : public Window
|
||||||
|
|||||||
@@ -68,11 +68,7 @@ RadioCalibrationPage::RadioCalibrationPage(bool initial):
|
|||||||
void RadioCalibrationPage::buildHeader(Window * window)
|
void RadioCalibrationPage::buildHeader(Window * window)
|
||||||
{
|
{
|
||||||
header.setTitle(STR_MENUCALIBRATION);
|
header.setTitle(STR_MENUCALIBRATION);
|
||||||
|
text = header.setTitle2(STR_MENUTOSTART);
|
||||||
text = new StaticText(window,
|
|
||||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
|
|
||||||
LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT},
|
|
||||||
STR_MENUTOSTART, 0, COLOR_THEME_PRIMARY2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadioCalibrationPage::buildBody(FormWindow * window)
|
void RadioCalibrationPage::buildBody(FormWindow * window)
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ class RadioKeyDiagsWindow : public Window
|
|||||||
|
|
||||||
void RadioKeyDiagsPage::buildHeader(Window * window)
|
void RadioKeyDiagsPage::buildHeader(Window * window)
|
||||||
{
|
{
|
||||||
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + 10, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_MENU_RADIO_SWITCHES, 0, COLOR_THEME_PRIMARY2);
|
header.setTitle(STR_MENU_RADIO_SWITCHES);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadioKeyDiagsPage::buildBody(Window * window)
|
void RadioKeyDiagsPage::buildBody(Window * window)
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ RadioGhostModuleConfig::RadioGhostModuleConfig(uint8_t moduleIdx) :
|
|||||||
|
|
||||||
void RadioGhostModuleConfig::buildHeader(Window * window)
|
void RadioGhostModuleConfig::buildHeader(Window * window)
|
||||||
{
|
{
|
||||||
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + 10, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, "GHOST MODULE", 0, COLOR_THEME_SECONDARY1);
|
header.setTitle("GHOST MODULE");
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadioGhostModuleConfig::buildBody(FormWindow * window)
|
void RadioGhostModuleConfig::buildBody(FormWindow * window)
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ class FileNameEditWindow : public Page
|
|||||||
|
|
||||||
void buildHeader(Window *window)
|
void buildHeader(Window *window)
|
||||||
{
|
{
|
||||||
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + 10, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_RENAME_FILE, 0, COLOR_THEME_PRIMARY2);
|
header.setTitle(STR_RENAME_FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void buildBody(Window *window)
|
void buildBody(Window *window)
|
||||||
|
|||||||
@@ -252,10 +252,7 @@ class SoundPage : public Page {
|
|||||||
|
|
||||||
void build()
|
void build()
|
||||||
{
|
{
|
||||||
new StaticText(&header,
|
header.setTitle(STR_SOUND_LABEL);
|
||||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
|
|
||||||
PAGE_LINE_HEIGHT},
|
|
||||||
STR_SOUND_LABEL, 0, COLOR_THEME_PRIMARY2);
|
|
||||||
|
|
||||||
body.setFlexLayout();
|
body.setFlexLayout();
|
||||||
FlexGridLayout grid(col_two_dsc, row_dsc, 2);
|
FlexGridLayout grid(col_two_dsc, row_dsc, 2);
|
||||||
@@ -321,10 +318,7 @@ class VarioPage : public Page {
|
|||||||
|
|
||||||
void build()
|
void build()
|
||||||
{
|
{
|
||||||
new StaticText(&header,
|
header.setTitle(STR_VARIO);
|
||||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
|
|
||||||
PAGE_LINE_HEIGHT},
|
|
||||||
STR_VARIO, 0, COLOR_THEME_PRIMARY2);
|
|
||||||
|
|
||||||
body.setFlexLayout();
|
body.setFlexLayout();
|
||||||
FlexGridLayout grid(col_two_dsc, row_dsc, 2);
|
FlexGridLayout grid(col_two_dsc, row_dsc, 2);
|
||||||
@@ -376,10 +370,7 @@ class HapticPage : public Page {
|
|||||||
|
|
||||||
void build()
|
void build()
|
||||||
{
|
{
|
||||||
new StaticText(&header,
|
header.setTitle(STR_HAPTIC_LABEL);
|
||||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
|
|
||||||
PAGE_LINE_HEIGHT},
|
|
||||||
STR_HAPTIC_LABEL, 0, COLOR_THEME_PRIMARY2);
|
|
||||||
|
|
||||||
body.setFlexLayout();
|
body.setFlexLayout();
|
||||||
FlexGridLayout grid(col_two_dsc, row_dsc, 2);
|
FlexGridLayout grid(col_two_dsc, row_dsc, 2);
|
||||||
@@ -416,10 +407,7 @@ class AlarmsPage : public Page {
|
|||||||
|
|
||||||
void build()
|
void build()
|
||||||
{
|
{
|
||||||
new StaticText(&header,
|
header.setTitle(STR_ALARMS_LABEL);
|
||||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
|
|
||||||
PAGE_LINE_HEIGHT},
|
|
||||||
STR_ALARMS_LABEL, 0, COLOR_THEME_PRIMARY2);
|
|
||||||
|
|
||||||
body.setFlexLayout();
|
body.setFlexLayout();
|
||||||
FlexGridLayout grid(col_two_dsc, row_dsc, 2);
|
FlexGridLayout grid(col_two_dsc, row_dsc, 2);
|
||||||
@@ -491,10 +479,7 @@ class BacklightPage : public Page {
|
|||||||
|
|
||||||
void build()
|
void build()
|
||||||
{
|
{
|
||||||
new StaticText(&header,
|
header.setTitle(STR_BACKLIGHT_LABEL);
|
||||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
|
|
||||||
PAGE_LINE_HEIGHT},
|
|
||||||
STR_BACKLIGHT_LABEL, 0, COLOR_THEME_PRIMARY2);
|
|
||||||
|
|
||||||
body.setFlexLayout();
|
body.setFlexLayout();
|
||||||
FlexGridLayout grid(col_three_dsc, row_dsc, 2);
|
FlexGridLayout grid(col_three_dsc, row_dsc, 2);
|
||||||
@@ -614,10 +599,7 @@ class GpsPage : public Page {
|
|||||||
|
|
||||||
void build()
|
void build()
|
||||||
{
|
{
|
||||||
new StaticText(&header,
|
header.setTitle(STR_GPS);
|
||||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
|
|
||||||
PAGE_LINE_HEIGHT},
|
|
||||||
STR_GPS, 0, COLOR_THEME_PRIMARY2);
|
|
||||||
|
|
||||||
body.setFlexLayout();
|
body.setFlexLayout();
|
||||||
FlexGridLayout grid(col_two_dsc, row_dsc, 2);
|
FlexGridLayout grid(col_two_dsc, row_dsc, 2);
|
||||||
|
|||||||
@@ -327,10 +327,10 @@ class ColorEditPage : public Page
|
|||||||
{
|
{
|
||||||
// page title
|
// page title
|
||||||
header.setTitle(STR_EDIT_COLOR);
|
header.setTitle(STR_EDIT_COLOR);
|
||||||
new StaticText(window,
|
auto t2 = header.setTitle2(ThemePersistance::getColorNames()[(int)_indexOfColor]);
|
||||||
{ PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
|
#if LCD_H > LCD_W
|
||||||
LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT },
|
t2->setFont(FONT(XS));
|
||||||
ThemePersistance::getColorNames()[(int)_indexOfColor], 0, COLOR_THEME_PRIMARY2);
|
#endif
|
||||||
|
|
||||||
// page tabs
|
// page tabs
|
||||||
rect_t r = { LCD_W - 2*(BUTTON_WIDTH + 5), 6, BUTTON_WIDTH, BUTTON_HEIGHT };
|
rect_t r = { LCD_W - 2*(BUTTON_WIDTH + 5), 6, BUTTON_WIDTH, BUTTON_HEIGHT };
|
||||||
@@ -404,19 +404,12 @@ class ThemeEditPage : public Page
|
|||||||
|
|
||||||
void buildHeader(FormGroup *window)
|
void buildHeader(FormGroup *window)
|
||||||
{
|
{
|
||||||
#if LCD_W > LCD_H
|
|
||||||
LcdFlags flags = 0;
|
|
||||||
#else
|
|
||||||
LcdFlags flags = FONT(XS);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// page title
|
// page title
|
||||||
header.setTitle(STR_EDIT_THEME);
|
header.setTitle(STR_EDIT_THEME);
|
||||||
_themeName = new StaticText(window,
|
_themeName = header.setTitle2(_theme.getName());
|
||||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
|
#if LCD_H > LCD_W
|
||||||
LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT},
|
_themeName->setFont(FONT(XS));
|
||||||
"", 0, COLOR_THEME_PRIMARY2 | flags);
|
#endif
|
||||||
lv_label_set_long_mode(_themeName->getLvObj(), LV_LABEL_LONG_DOT);
|
|
||||||
|
|
||||||
// save and cancel
|
// save and cancel
|
||||||
rect_t r = {LCD_W - (BUTTON_WIDTH + 5), 6, BUTTON_WIDTH, BUTTON_HEIGHT };
|
rect_t r = {LCD_W - (BUTTON_WIDTH + 5), 6, BUTTON_WIDTH, BUTTON_HEIGHT };
|
||||||
|
|||||||
@@ -81,12 +81,7 @@ class SpecialFunctionEditPage : public Page
|
|||||||
void buildHeader(Window *window)
|
void buildHeader(Window *window)
|
||||||
{
|
{
|
||||||
header.setTitle(functions == g_model.customFn ? STR_MENUCUSTOMFUNC : STR_MENUSPECIALFUNCS);
|
header.setTitle(functions == g_model.customFn ? STR_MENUCUSTOMFUNC : STR_MENUSPECIALFUNCS);
|
||||||
headerSF = new StaticText(
|
headerSF = header.setTitle2((functions == g_model.customFn ? "SF" : "GF") + std::to_string(index+1));
|
||||||
window,
|
|
||||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
|
|
||||||
LCD_W - PAGE_TITLE_LEFT, 20},
|
|
||||||
(functions == g_model.customFn ? "SF" : "GF") + std::to_string(index+1),
|
|
||||||
0, COLOR_THEME_PRIMARY2);
|
|
||||||
|
|
||||||
lv_obj_set_style_text_color(headerSF->getLvObj(), makeLvColor(COLOR_THEME_ACTIVE), LV_STATE_USER_1);
|
lv_obj_set_style_text_color(headerSF->getLvObj(), makeLvColor(COLOR_THEME_ACTIVE), LV_STATE_USER_1);
|
||||||
lv_obj_set_style_text_font(headerSF->getLvObj(), getFont(FONT(BOLD)), LV_STATE_USER_1);
|
lv_obj_set_style_text_font(headerSF->getLvObj(), getFont(FONT(BOLD)), LV_STATE_USER_1);
|
||||||
|
|||||||
@@ -55,10 +55,7 @@ static void setThrottleTrimSource(int16_t src)
|
|||||||
|
|
||||||
ThrottleParams::ThrottleParams() : Page(ICON_MODEL_SETUP)
|
ThrottleParams::ThrottleParams() : Page(ICON_MODEL_SETUP)
|
||||||
{
|
{
|
||||||
new StaticText(&header,
|
header.setTitle(STR_THROTTLE_LABEL);
|
||||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
|
|
||||||
PAGE_LINE_HEIGHT},
|
|
||||||
STR_THROTTLE_LABEL, 0, COLOR_THEME_PRIMARY2);
|
|
||||||
|
|
||||||
body.setFlexLayout();
|
body.setFlexLayout();
|
||||||
FlexGridLayout grid(line_col_dsc, line_row_dsc, 2);
|
FlexGridLayout grid(line_col_dsc, line_row_dsc, 2);
|
||||||
|
|||||||
@@ -38,10 +38,7 @@ static void resetTrims()
|
|||||||
|
|
||||||
TrimsSetup::TrimsSetup() : Page(ICON_MODEL_SETUP)
|
TrimsSetup::TrimsSetup() : Page(ICON_MODEL_SETUP)
|
||||||
{
|
{
|
||||||
new StaticText(&header,
|
header.setTitle(STR_TRIMS);
|
||||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
|
|
||||||
PAGE_LINE_HEIGHT},
|
|
||||||
STR_TRIMS, 0, COLOR_THEME_PRIMARY2);
|
|
||||||
|
|
||||||
body.setFlexLayout();
|
body.setFlexLayout();
|
||||||
FlexGridLayout grid(line_col_dsc, line_row_dsc, 2);
|
FlexGridLayout grid(line_col_dsc, line_row_dsc, 2);
|
||||||
|
|||||||
Reference in New Issue
Block a user