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