chore(color): Cleanup header title display logic (#3059)
Use 'Page' class 'header' property to display title where possible, instead of creating a new object.
This commit is contained in:
@@ -374,10 +374,7 @@ CurveEditWindow::CurveEditWindow(uint8_t index):
|
||||
|
||||
void CurveEditWindow::buildHeader(Window * window)
|
||||
{
|
||||
new StaticText(window,
|
||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
|
||||
PAGE_LINE_HEIGHT},
|
||||
STR_MENUCURVE, 0, COLOR_THEME_PRIMARY2);
|
||||
header.setTitle(STR_MENUCURVE);
|
||||
char s[16];
|
||||
strAppendStringWithIndex(s, STR_CV, index + 1);
|
||||
new StaticText(window,
|
||||
|
||||
@@ -201,10 +201,7 @@ bool GVarRenderer::isUpdated()
|
||||
|
||||
void GVarEditWindow::buildHeader(Window * window)
|
||||
{
|
||||
new StaticText(window,
|
||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
|
||||
PAGE_LINE_HEIGHT},
|
||||
STR_GLOBAL_VAR, 0, COLOR_THEME_PRIMARY2);
|
||||
header.setTitle(STR_GLOBAL_VAR);
|
||||
gVarInHeader =
|
||||
new GVarRenderer(window,
|
||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
|
||||
|
||||
@@ -80,10 +80,7 @@ class LogicalSwitchEditPage: public Page
|
||||
|
||||
void buildHeader(Window * window)
|
||||
{
|
||||
new StaticText(window,
|
||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
|
||||
PAGE_LINE_HEIGHT},
|
||||
STR_MENULOGICALSWITCHES, 0, COLOR_THEME_PRIMARY2);
|
||||
header.setTitle(STR_MENULOGICALSWITCHES);
|
||||
headerSwitchName = new StaticText(
|
||||
window,
|
||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
|
||||
|
||||
@@ -60,10 +60,7 @@ class ScriptEditWindow : public Page {
|
||||
|
||||
void buildHeader(Window * window)
|
||||
{
|
||||
new StaticText(window,
|
||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
|
||||
PAGE_LINE_HEIGHT},
|
||||
STR_MENUCUSTOMSCRIPTS, 0, COLOR_THEME_PRIMARY2);
|
||||
header.setTitle(STR_MENUCUSTOMSCRIPTS);
|
||||
new StaticText(window,
|
||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
|
||||
LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT},
|
||||
|
||||
@@ -181,11 +181,7 @@ class SensorEditWindow : public Page {
|
||||
|
||||
void buildHeader(Window * window)
|
||||
{
|
||||
new StaticText(window,
|
||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
|
||||
PAGE_LINE_HEIGHT},
|
||||
STR_SENSOR + std::to_string(index + 1), 0,
|
||||
COLOR_THEME_PRIMARY2);
|
||||
header.setTitle(STR_SENSOR + std::to_string(index + 1));
|
||||
|
||||
new SensorLiveValue(window,
|
||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
|
||||
|
||||
@@ -67,10 +67,7 @@ RadioCalibrationPage::RadioCalibrationPage(bool initial):
|
||||
|
||||
void RadioCalibrationPage::buildHeader(Window * window)
|
||||
{
|
||||
new StaticText(window,
|
||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
|
||||
PAGE_LINE_HEIGHT},
|
||||
STR_MENUCALIBRATION, 0, COLOR_THEME_PRIMARY2);
|
||||
header.setTitle(STR_MENUCALIBRATION);
|
||||
|
||||
text = new StaticText(window,
|
||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
|
||||
|
||||
@@ -79,11 +79,7 @@ class SpecialFunctionEditPage : public Page
|
||||
|
||||
void buildHeader(Window *window)
|
||||
{
|
||||
new StaticText(
|
||||
window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, 20},
|
||||
functions == g_model.customFn ? STR_MENUCUSTOMFUNC
|
||||
: STR_MENUSPECIALFUNCS,
|
||||
0, COLOR_THEME_PRIMARY2);
|
||||
header.setTitle(functions == g_model.customFn ? STR_MENUCUSTOMFUNC : STR_MENUSPECIALFUNCS);
|
||||
headerSF = new StaticText(
|
||||
window,
|
||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
|
||||
|
||||
Reference in New Issue
Block a user