diff --git a/radio/src/gui/colorlcd/controls/channel_range.cpp b/radio/src/gui/colorlcd/controls/channel_range.cpp index 4c083b425..12bd64a10 100644 --- a/radio/src/gui/colorlcd/controls/channel_range.cpp +++ b/radio/src/gui/colorlcd/controls/channel_range.cpp @@ -45,13 +45,13 @@ ChannelRange::ChannelRange(Window* parent) : Window(parent, rect_t{}) void ChannelRange::build() { - chStart = new NumberEdit(this, rect_t{0, 0, 80, 0}, 1, 1, + chStart = new NumberEdit(this, rect_t{0, 0, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, 1, 1, GET_DEFAULT(1 + getChannelsStart())); chStart->setSetValueHandler([=](int newValue) { setStart(newValue); }); chStart->setPrefix(STR_CH); chEnd = - new NumberEdit(this, rect_t{0, 0, 80, 0}, 8, 8, + new NumberEdit(this, rect_t{0, 0, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, 8, 8, GET_DEFAULT(getChannelsStart() + 8 + getChannelsCount())); chEnd->setPrefix(STR_CH); diff --git a/radio/src/gui/colorlcd/controls/color_picker.cpp b/radio/src/gui/colorlcd/controls/color_picker.cpp index ec0f1b802..aba3cbfd0 100644 --- a/radio/src/gui/colorlcd/controls/color_picker.cpp +++ b/radio/src/gui/colorlcd/controls/color_picker.cpp @@ -103,10 +103,10 @@ class ColorEditorPopup : public BaseDialog lv_obj_set_flex_align(hbox_obj, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_SPACE_AROUND); - colorPad = new ColorSwatch(hbox, {0, 0, COLOR_PAD_WIDTH, COLOR_PAD_HEIGHT}, + colorPad = new ColorSwatch(hbox, {0, 0, COLOR_PAD_WIDTH, EdgeTxStyles::STD_FONT_HEIGHT}, COLOR_THEME_PRIMARY1); - hexStr = new StaticText(hbox, {0, 0, CVAL_W, 0}, "", COLOR_THEME_PRIMARY1_INDEX, FONT(L)); + hexStr = new StaticText(hbox, {0, 0, EdgeTxStyles::EDIT_FLD_WIDTH, 0}, "", COLOR_THEME_PRIMARY1_INDEX, FONT(L)); updateColor(color); @@ -149,7 +149,7 @@ class ColorEditorPopup : public BaseDialog hbox = new Window(vbox, rect_t{}); hbox->padTop(BTN_PAD_TOP); - hbox->setFlexLayout(LV_FLEX_FLOW_ROW, BTN_PAD_ROW); + hbox->setFlexLayout(LV_FLEX_FLOW_ROW, EdgeTxStyles::STD_FONT_HEIGHT); lv_obj_set_flex_align(hbox->getLvObj(), LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_END, LV_FLEX_ALIGN_SPACE_BETWEEN); lv_obj_set_flex_grow(hbox->getLvObj(), 1); @@ -169,11 +169,8 @@ class ColorEditorPopup : public BaseDialog static LAYOUT_VAL(CE_SZ, 182, 182, LS(182)) static LAYOUT_VAL2(COLOR_EDIT_WIDTH, LCD_W * 0.8, LCD_W * 0.7) static LAYOUT_VAL(COLOR_PAD_WIDTH, 52, 52, LS(52)) - static LAYOUT_VAL(COLOR_PAD_HEIGHT, 32, 32, LS(32)) - static LAYOUT_VAL(CVAL_W, 100, 100, LS(100)) static LAYOUT_VAL(BTN_W, 80, 80, LS(80)) static LAYOUT_VAL(BTN_PAD_TOP, 60, 60, LS(60)) - static LAYOUT_VAL(BTN_PAD_ROW, 20, 20, LS(20)) }; ColorPicker::ColorPicker(Window* parent, const rect_t& rect, @@ -181,7 +178,7 @@ ColorPicker::ColorPicker(Window* parent, const rect_t& rect, std::function setValue, std::function preview, COLOR_EDITOR_FMT fmt) : - Button(parent, {rect.x, rect.y, rect.w == 0 ? ColorEditorPopup::COLOR_PAD_WIDTH : rect.w, ColorEditorPopup::COLOR_PAD_HEIGHT}), + Button(parent, {rect.x, rect.y, rect.w == 0 ? ColorEditorPopup::COLOR_PAD_WIDTH : rect.w, EdgeTxStyles::UI_ELEMENT_HEIGHT}), setValue(std::move(setValue)), preview(std::move(preview)), format(fmt) { updateColor(getValue()); diff --git a/radio/src/gui/colorlcd/controls/gvar_numberedit.cpp b/radio/src/gui/colorlcd/controls/gvar_numberedit.cpp index d9d8c7924..395d0e4ea 100644 --- a/radio/src/gui/colorlcd/controls/gvar_numberedit.cpp +++ b/radio/src/gui/colorlcd/controls/gvar_numberedit.cpp @@ -26,7 +26,7 @@ GVarNumberEdit::GVarNumberEdit(Window* parent, int32_t vmin, int32_t vmax, std::function getValue, std::function setValue, LcdFlags textFlags, int32_t voffset, int32_t vdefault) : - Window(parent, {0, 0, NUM_EDIT_W + GV_BTN_W + PAD_TINY * 3, EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_TINY * 2}), + Window(parent, {0, 0, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW + GV_BTN_W + PAD_TINY * 3, EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_TINY * 2}), vmin(vmin), vmax(vmax), getValue(getValue), @@ -38,7 +38,7 @@ GVarNumberEdit::GVarNumberEdit(Window* parent, int32_t vmin, // GVAR field gvar_field = new Choice( - this, {0, 0, NUM_EDIT_W, 0}, -MAX_GVARS, MAX_GVARS - 1, + this, {0, 0, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, -MAX_GVARS, MAX_GVARS - 1, [=]() { uint16_t gvar1 = GV_GET_GV1_VALUE(vmin, vmax); return GV_INDEX_CALC_DELTA(getValue(), gvar1); @@ -54,14 +54,14 @@ GVarNumberEdit::GVarNumberEdit(Window* parent, int32_t vmin, [=](int32_t value) { return getGVarString(value); }); num_field = new NumberEdit( - this, {0, 0, NUM_EDIT_W, 0}, vmin, vmax, [=]() { return getValue() + voffset; }, + this, {0, 0, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, vmin, vmax, [=]() { return getValue() + voffset; }, nullptr, textFlags); num_field->setDefault(vdefault); #if defined(GVARS) // The GVAR button if (modelGVEnabled()) { - m_gvBtn = new TextButton(this, {NUM_EDIT_W + PAD_TINY, 0, GV_BTN_W, 0}, STR_GV, [=]() { + m_gvBtn = new TextButton(this, {EdgeTxStyles::EDIT_FLD_WIDTH_NARROW + PAD_TINY, 0, GV_BTN_W, 0}, STR_GV, [=]() { switchGVarMode(); return GV_IS_GV_VALUE(getValue(), vmin, vmax); }); diff --git a/radio/src/gui/colorlcd/controls/gvar_numberedit.h b/radio/src/gui/colorlcd/controls/gvar_numberedit.h index 40c080ff4..91455d8c7 100644 --- a/radio/src/gui/colorlcd/controls/gvar_numberedit.h +++ b/radio/src/gui/colorlcd/controls/gvar_numberedit.h @@ -43,7 +43,6 @@ class GVarNumberEdit : public Window void setAccelFactor(int value) { num_field->setAccelFactor(value); } void setDisplayHandler(std::function function); - static LAYOUT_VAL(NUM_EDIT_W, 70, 70, LS(70)) static LAYOUT_VAL(GV_BTN_W, 40, 40, LS(40)) protected: diff --git a/radio/src/gui/colorlcd/controls/input_source.cpp b/radio/src/gui/colorlcd/controls/input_source.cpp index c296839e7..39cfceb1a 100644 --- a/radio/src/gui/colorlcd/controls/input_source.cpp +++ b/radio/src/gui/colorlcd/controls/input_source.cpp @@ -110,7 +110,7 @@ InputSource::InputSource(Window *parent, ExpoData *input) : line = sensor_form->newLine(grid); line->padAll(PAD_TINY); new StaticText(line, rect_t{}, STR_SCALE); - new NumberEdit(line, rect_t{0, 0, 60, 0}, 0, + new NumberEdit(line, rect_t{0, 0, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, 0, maxTelemValue(input->srcRaw - MIXSRC_FIRST_TELEM + 1), GET_SET_DEFAULT(input->scale), sensor->getSensorPrec()); diff --git a/radio/src/gui/colorlcd/controls/source_numberedit.cpp b/radio/src/gui/colorlcd/controls/source_numberedit.cpp index 3a862fb02..ccc440a0e 100644 --- a/radio/src/gui/colorlcd/controls/source_numberedit.cpp +++ b/radio/src/gui/colorlcd/controls/source_numberedit.cpp @@ -31,7 +31,7 @@ SourceNumberEdit::SourceNumberEdit(Window* parent, int16_t sourceMin, LcdFlags textFlags, int32_t voffset, int32_t vdefault) : - Window(parent, {0, 0, NUM_EDIT_W + SRC_BTN_W + PAD_TINY * 3, EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_TINY * 2}), + Window(parent, {0, 0, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW + SRC_BTN_W + PAD_TINY * 3, EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_TINY * 2}), vmin(vmin), vmax(vmax), sourceMin(sourceMin), @@ -47,7 +47,7 @@ SourceNumberEdit::SourceNumberEdit(Window* parent, // Source field source_field = new SourceChoice( - this, {0, 0, NUM_EDIT_W, 0}, sourceMin, INPUTSRC_LAST, + this, {0, 0, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, sourceMin, INPUTSRC_LAST, [=]() { SourceNumVal v; v.rawValue = getValue(); @@ -59,7 +59,7 @@ SourceNumberEdit::SourceNumberEdit(Window* parent, }, true); num_field = new NumberEdit( - this, {0, 0, NUM_EDIT_W, 0}, vmin, vmax, + this, {0, 0, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, vmin, vmax, [=]() { SourceNumVal v; v.rawValue = getValue(); @@ -73,7 +73,7 @@ SourceNumberEdit::SourceNumberEdit(Window* parent, num_field->setDefault(vdefault); // The Source button - m_srcBtn = new TextButton(this, {NUM_EDIT_W + PAD_TINY, 0, SRC_BTN_W, 0}, "SRC", [=]() { + m_srcBtn = new TextButton(this, {EdgeTxStyles::EDIT_FLD_WIDTH_NARROW + PAD_TINY, 0, SRC_BTN_W, 0}, "SRC", [=]() { switchSourceMode(); return isSource(); }); diff --git a/radio/src/gui/colorlcd/controls/source_numberedit.h b/radio/src/gui/colorlcd/controls/source_numberedit.h index 3620fa63a..96a4f8985 100644 --- a/radio/src/gui/colorlcd/controls/source_numberedit.h +++ b/radio/src/gui/colorlcd/controls/source_numberedit.h @@ -45,7 +45,6 @@ class SourceNumberEdit : public Window void update(); - static LAYOUT_VAL(NUM_EDIT_W, 84, 84, LS(84)) static LAYOUT_VAL(SRC_BTN_W, 38, 38, LS(38)) protected: diff --git a/radio/src/gui/colorlcd/libui/bitmapbuffer_draw_extra.cpp b/radio/src/gui/colorlcd/libui/bitmapbuffer_draw_extra.cpp index 9b7616785..fe0df7438 100644 --- a/radio/src/gui/colorlcd/libui/bitmapbuffer_draw_extra.cpp +++ b/radio/src/gui/colorlcd/libui/bitmapbuffer_draw_extra.cpp @@ -167,7 +167,7 @@ void BitmapBuffer::drawGPSPosition(coord_t x, coord_t y, int32_t longitude, { if (flags & PREC1) { drawGPSCoord(x, y, latitude, "NS", flags, true); - drawGPSCoord(x, y + EdgeTxStyles::PAGE_LINE_HEIGHT, longitude, "EW", flags, true); + drawGPSCoord(x, y + EdgeTxStyles::STD_FONT_HEIGHT, longitude, "EW", flags, true); } else { if (flags & RIGHT) { x = drawGPSCoord(x, y, longitude, "EW", flags, true); @@ -194,7 +194,7 @@ void BitmapBuffer::drawDate(coord_t x, coord_t y, TelemetryItem &telemetryItem, x = drawText(x, y, s.c_str(), att); if (doTwoLines) { - y += EdgeTxStyles::PAGE_LINE_HEIGHT; + y += EdgeTxStyles::STD_FONT_HEIGHT; x = ox; } else { x += 11; diff --git a/radio/src/gui/colorlcd/libui/dialog.h b/radio/src/gui/colorlcd/libui/dialog.h index bcb00765e..46b2fc5f2 100644 --- a/radio/src/gui/colorlcd/libui/dialog.h +++ b/radio/src/gui/colorlcd/libui/dialog.h @@ -97,7 +97,7 @@ class DynamicMessageDialog : public BaseDialog DynamicMessageDialog(const char* title, std::function textHandler, const char* message = "", - const int lineHeight = EdgeTxStyles::PAGE_LINE_HEIGHT, + const int lineHeight = EdgeTxStyles::STD_FONT_HEIGHT, LcdColorIndex color = COLOR_THEME_PRIMARY1_INDEX, LcdFlags textFlags = CENTERED); // Attn.: FONT(XXL) is not supported by DynamicMessageDialog diff --git a/radio/src/gui/colorlcd/libui/etx_lv_theme.cpp b/radio/src/gui/colorlcd/libui/etx_lv_theme.cpp index 66b686861..429d90f08 100644 --- a/radio/src/gui/colorlcd/libui/etx_lv_theme.cpp +++ b/radio/src/gui/colorlcd/libui/etx_lv_theme.cpp @@ -129,12 +129,12 @@ const lv_style_const_prop_t pad_large_props[] = { LV_STYLE_CONST_MULTI_INIT(EdgeTxStyles::pad_large, pad_large_props); const lv_style_const_prop_t pad_button_props[] = { - LV_STYLE_CONST_PAD_TOP(2), - LV_STYLE_CONST_PAD_BOTTOM(2), + LV_STYLE_CONST_PAD_TOP(PAD_TINY), + LV_STYLE_CONST_PAD_BOTTOM(PAD_TINY), LV_STYLE_CONST_PAD_LEFT(PAD_MEDIUM), LV_STYLE_CONST_PAD_RIGHT(PAD_MEDIUM), - LV_STYLE_CONST_PAD_ROW(2), - LV_STYLE_CONST_PAD_COLUMN(2), + LV_STYLE_CONST_PAD_ROW(PAD_TINY), + LV_STYLE_CONST_PAD_COLUMN(PAD_TINY), LV_STYLE_PROP_INV, }; LV_STYLE_CONST_MULTI_INIT(EdgeTxStyles::pad_button, pad_button_props); @@ -142,7 +142,7 @@ LV_STYLE_CONST_MULTI_INIT(EdgeTxStyles::pad_button, pad_button_props); const lv_style_const_prop_t pad_textarea_props[] = { LV_STYLE_CONST_PAD_TOP(PAD_SMALL), LV_STYLE_CONST_PAD_BOTTOM(PAD_SMALL - 1), - LV_STYLE_CONST_PAD_LEFT(PAD_SMALL), + LV_STYLE_CONST_PAD_LEFT(PAD_MEDIUM), LV_STYLE_CONST_PAD_RIGHT(PAD_SMALL), LV_STYLE_PROP_INV, }; diff --git a/radio/src/gui/colorlcd/libui/etx_lv_theme.h b/radio/src/gui/colorlcd/libui/etx_lv_theme.h index a2d19b62b..67a60c603 100644 --- a/radio/src/gui/colorlcd/libui/etx_lv_theme.h +++ b/radio/src/gui/colorlcd/libui/etx_lv_theme.h @@ -277,9 +277,11 @@ class EdgeTxStyles void init(); void applyColors(); - static LAYOUT_VAL(PAGE_LINE_HEIGHT, 20, 20, LS(20)) + static LAYOUT_VAL(STD_FONT_HEIGHT, 21, 21, 14) static LAYOUT_VAL(UI_ELEMENT_HEIGHT, 32, 32, 24) static LAYOUT_VAL(MENU_HEADER_HEIGHT, 45, 45, LS(45)) + static LAYOUT_VAL(EDIT_FLD_WIDTH_NARROW, 70, 70, LS(70)) + static LAYOUT_VAL(EDIT_FLD_WIDTH, 100, 100, LS(100)) protected: bool initDone = false; diff --git a/radio/src/gui/colorlcd/libui/file_carosell.cpp b/radio/src/gui/colorlcd/libui/file_carosell.cpp index 6bd0ec2fb..f72fdc948 100644 --- a/radio/src/gui/colorlcd/libui/file_carosell.cpp +++ b/radio/src/gui/colorlcd/libui/file_carosell.cpp @@ -35,7 +35,7 @@ FileCarosell::FileCarosell(Window *parent, const rect_t &rect, { setWindowFlag(NO_FOCUS); - message = new StaticText(this, {0, rect.h/2, rect.w, EdgeTxStyles::PAGE_LINE_HEIGHT * 2}, "", COLOR_THEME_PRIMARY1_INDEX, CENTERED | FONT(L)); + message = new StaticText(this, {0, rect.h/2, rect.w, EdgeTxStyles::STD_FONT_HEIGHT * 2}, "", COLOR_THEME_PRIMARY1_INDEX, CENTERED | FONT(L)); setFileNames(fileNames); } diff --git a/radio/src/gui/colorlcd/libui/list_line_button.h b/radio/src/gui/colorlcd/libui/list_line_button.h index 7f9f0e725..bbb3e0dee 100644 --- a/radio/src/gui/colorlcd/libui/list_line_button.h +++ b/radio/src/gui/colorlcd/libui/list_line_button.h @@ -37,7 +37,7 @@ class ListLineButton : public ButtonBase virtual void refresh() = 0; - static LAYOUT_VAL(BTN_H, 29, 29, LS(29)) + static constexpr coord_t BTN_H = EdgeTxStyles::STD_FONT_HEIGHT + PAD_BORDER * 2 + PAD_TINY * 2; static constexpr coord_t GRP_W = LCD_W - PAD_SMALL * 2; protected: diff --git a/radio/src/gui/colorlcd/libui/numberedit.cpp b/radio/src/gui/colorlcd/libui/numberedit.cpp index 1d1b9ea2f..2b094e6a3 100644 --- a/radio/src/gui/colorlcd/libui/numberedit.cpp +++ b/radio/src/gui/colorlcd/libui/numberedit.cpp @@ -214,7 +214,7 @@ NumberEdit::NumberEdit(Window* parent, const rect_t& rect, int vmin, int vmax, vmin(vmin), vmax(vmax) { - if (rect.w == 0) setWidth(DEF_W); + if (rect.w == 0) setWidth(EdgeTxStyles::EDIT_FLD_WIDTH); setTextFlag(textFlags); diff --git a/radio/src/gui/colorlcd/libui/numberedit.h b/radio/src/gui/colorlcd/libui/numberedit.h index 03b973ce5..95b1e34b2 100644 --- a/radio/src/gui/colorlcd/libui/numberedit.h +++ b/radio/src/gui/colorlcd/libui/numberedit.h @@ -91,8 +91,6 @@ class NumberEdit : public TextButton int32_t getValue() const { return _getValue != nullptr ? _getValue() : 0; } - static LAYOUT_VAL(DEF_W, 100, 100, LS(100)) - protected: friend class NumberArea; diff --git a/radio/src/gui/colorlcd/libui/page.cpp b/radio/src/gui/colorlcd/libui/page.cpp index 5dd410446..24075bfa9 100644 --- a/radio/src/gui/colorlcd/libui/page.cpp +++ b/radio/src/gui/colorlcd/libui/page.cpp @@ -36,7 +36,7 @@ PageHeader::PageHeader(Window* parent, EdgeTxIcon icon) : title = new StaticText(this, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, - LCD_W - PAGE_TITLE_LEFT, EdgeTxStyles::PAGE_LINE_HEIGHT}, + LCD_W - PAGE_TITLE_LEFT, EdgeTxStyles::STD_FONT_HEIGHT}, "", COLOR_THEME_PRIMARY2_INDEX); } @@ -51,7 +51,7 @@ PageHeader::PageHeader(Window* parent, const char* iconFile) : title = new StaticText(this, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, - LCD_W - PAGE_TITLE_LEFT, EdgeTxStyles::PAGE_LINE_HEIGHT}, + LCD_W - PAGE_TITLE_LEFT, EdgeTxStyles::STD_FONT_HEIGHT}, "", COLOR_THEME_PRIMARY2_INDEX); } @@ -59,8 +59,8 @@ StaticText* PageHeader::setTitle2(std::string txt) { if (title2 == nullptr) { title2 = new StaticText(this, - {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + EdgeTxStyles::PAGE_LINE_HEIGHT, - LCD_W - PAGE_TITLE_LEFT, EdgeTxStyles::PAGE_LINE_HEIGHT}, + {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + EdgeTxStyles::STD_FONT_HEIGHT, + LCD_W - PAGE_TITLE_LEFT, EdgeTxStyles::STD_FONT_HEIGHT}, "", COLOR_THEME_PRIMARY2_INDEX); } title2->setText(std::move(txt)); diff --git a/radio/src/gui/colorlcd/libui/textedit.cpp b/radio/src/gui/colorlcd/libui/textedit.cpp index 562785c83..6c1f6b613 100644 --- a/radio/src/gui/colorlcd/libui/textedit.cpp +++ b/radio/src/gui/colorlcd/libui/textedit.cpp @@ -123,7 +123,7 @@ TextEdit::TextEdit(Window* parent, const rect_t& rect, char* text, }), updateHandler(updateHandler), text(text), length(length) { - if (rect.w == 0) setWidth(DEF_W); + if (rect.w == 0) setWidth(EdgeTxStyles::EDIT_FLD_WIDTH); update(); lv_obj_align(label, LV_ALIGN_OUT_LEFT_MID, 0, PAD_TINY); diff --git a/radio/src/gui/colorlcd/libui/textedit.h b/radio/src/gui/colorlcd/libui/textedit.h index 11dee1689..3133d2e69 100644 --- a/radio/src/gui/colorlcd/libui/textedit.h +++ b/radio/src/gui/colorlcd/libui/textedit.h @@ -36,8 +36,6 @@ class TextEdit : public TextButton void preview(bool edited, char* text, uint8_t length); void update(); - static LAYOUT_VAL(DEF_W, 100, 100, 70) - protected: std::function updateHandler = nullptr; TextArea* edit = nullptr; diff --git a/radio/src/gui/colorlcd/libui/window.cpp b/radio/src/gui/colorlcd/libui/window.cpp index 816c6eeb8..22e8b2484 100644 --- a/radio/src/gui/colorlcd/libui/window.cpp +++ b/radio/src/gui/colorlcd/libui/window.cpp @@ -474,7 +474,7 @@ SetupButtonGroup::SetupButtonGroup(Window* parent, const rect_t& rect, const cha int rows = (pages.size() + cols - 1) / cols; int height = rows * btnHeight + (rows - 1) * PAD_MEDIUM + PAD_TINY * 2; if (title) { - height += EdgeTxStyles::PAGE_LINE_HEIGHT + PAD_TINY; + height += EdgeTxStyles::STD_FONT_HEIGHT + PAD_TINY; } setHeight(height); @@ -483,7 +483,7 @@ SetupButtonGroup::SetupButtonGroup(Window* parent, const rect_t& rect, const cha int n = 0; int remaining = pages.size(); - coord_t yo = title ? EdgeTxStyles::PAGE_LINE_HEIGHT + PAD_TINY : 0; + coord_t yo = title ? EdgeTxStyles::STD_FONT_HEIGHT + PAD_TINY : 0; coord_t xw = buttonWidth + PAD_SMALL; coord_t xo = (width() - (cols * xw - PAD_SMALL)) / 2; coord_t x, y; @@ -520,7 +520,7 @@ SetupLine::SetupLine(Window* parent, coord_t y, coord_t col2, PaddingSize paddin { padAll(PAD_ZERO); coord_t titleY = PAD_LARGE + lblYOffset; - coord_t titleH = EdgeTxStyles::PAGE_LINE_HEIGHT; + coord_t titleH = EdgeTxStyles::STD_FONT_HEIGHT; coord_t h = EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_TINY * 2 + lblYOffset * 2; if (createEdit) { coord_t editY = PAD_TINY; diff --git a/radio/src/gui/colorlcd/mainview/widget_settings.cpp b/radio/src/gui/colorlcd/mainview/widget_settings.cpp index 4ba469cf3..cb2474707 100644 --- a/radio/src/gui/colorlcd/mainview/widget_settings.cpp +++ b/radio/src/gui/colorlcd/mainview/widget_settings.cpp @@ -64,7 +64,7 @@ WidgetSettings::WidgetSettings(Widget* w) : switch (opt->type) { case ZoneOption::Integer: (new NumberEdit( - line, rect_t{0, 0, 96, 0}, opt->min.signedValue, + line, rect_t{}, opt->min.signedValue, opt->max.signedValue, [=]() -> int { return optVal->signedValue; @@ -102,7 +102,7 @@ WidgetSettings::WidgetSettings(Widget* w) : break; case ZoneOption::String: - new ModelTextEdit(line, rect_t{0, 0, 96, 0}, + new ModelTextEdit(line, rect_t{}, optVal->stringValue, sizeof(optVal->stringValue)); break; diff --git a/radio/src/gui/colorlcd/model/curveedit.cpp b/radio/src/gui/colorlcd/model/curveedit.cpp index d6f9c8928..2b7b21de0 100644 --- a/radio/src/gui/colorlcd/model/curveedit.cpp +++ b/radio/src/gui/colorlcd/model/curveedit.cpp @@ -305,7 +305,7 @@ void CurveEditWindow::buildBody(Window* window) // Smooth auto smooth = - new TextButton(iLine, rect_t{0, 0, NUMEDT_W, 0}, STR_SMOOTH, [=]() { + new TextButton(iLine, rect_t{0, 0, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, STR_SMOOTH, [=]() { g_model.curves[index].smooth = !g_model.curves[index].smooth; curveEdit->updatePreview(); return g_model.curves[index].smooth; @@ -320,7 +320,7 @@ void CurveEditWindow::buildBody(Window* window) // Type new StaticText(iLine, rect_t{}, STR_TYPE); new Choice( - iLine, {0, 0, TextEdit::DEF_W, 0}, STR_CURVE_TYPES, 0, 1, + iLine, {0, 0, EdgeTxStyles::EDIT_FLD_WIDTH, 0}, STR_CURVE_TYPES, 0, 1, GET_DEFAULT(g_model.curves[index].type), [=](int32_t newValue) { CurveHeader& curve = g_model.curves[index]; if (newValue != curve.type) { @@ -346,7 +346,7 @@ void CurveEditWindow::buildBody(Window* window) // Points count auto edit = new Choice( - iLine, {0, 0, NUMEDT_W, 0}, 2, 17, + iLine, {0, 0, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, 2, 17, GET_DEFAULT(g_model.curves[index].points + 5), [=](int32_t newValue) { newValue -= 5; CurveHeader& curve = g_model.curves[index]; diff --git a/radio/src/gui/colorlcd/model/curveedit.h b/radio/src/gui/colorlcd/model/curveedit.h index 5a4c7e2c8..7ad04d42b 100644 --- a/radio/src/gui/colorlcd/model/curveedit.h +++ b/radio/src/gui/colorlcd/model/curveedit.h @@ -37,7 +37,6 @@ class CurveEditWindow : public Page void setCurrentSource(mixsrc_t source); - static LAYOUT_VAL(NUMEDT_W, 70, 70, LS(70)) static LAYOUT_VAL(CURVE_WIDTH, 215, 232, LS(215)) protected: diff --git a/radio/src/gui/colorlcd/model/function_switches.cpp b/radio/src/gui/colorlcd/model/function_switches.cpp index fe2aa3b45..f230b4ad0 100644 --- a/radio/src/gui/colorlcd/model/function_switches.cpp +++ b/radio/src/gui/colorlcd/model/function_switches.cpp @@ -64,7 +64,7 @@ class FunctionSwitch : public Window std::string s(STR_CHAR_SWITCH); s += switchGetName(switchIndex + switchGetMaxSwitches()); - new StaticText(this, {PAD_LARGE, PAD_MEDIUM, SW_W, EdgeTxStyles::PAGE_LINE_HEIGHT}, s); + new StaticText(this, {PAD_LARGE, PAD_MEDIUM, SW_W, EdgeTxStyles::STD_FONT_HEIGHT}, s); new ModelTextEdit(this, {NM_X, 0, NM_W, 0}, g_model.switchNames[switchIndex], LEN_SWITCH_NAME); @@ -169,30 +169,29 @@ class FunctionSwitch : public Window } #if defined(FUNCTION_SWITCHES_RGB_LEDS) - static constexpr coord_t SW_X = PAD_SMALL; - static constexpr coord_t SW_W = 70; - static constexpr coord_t NM_X = SW_X + SW_W; - static constexpr coord_t NM_W = 60; + static LAYOUT_VAL(SW_W, 70, 70, LS(70)) + static constexpr coord_t NM_X = SW_W + PAD_SMALL; + static LAYOUT_VAL(NM_W, 60, 60, LS(60)) static constexpr coord_t TP_X = NM_X + NM_W + PAD_SMALL; - static constexpr coord_t TP_W = 78; + static LAYOUT_VAL(TP_W, 78, 78, LS(78)) static constexpr coord_t GR_X = TP_X + TP_W + PAD_SMALL; - static constexpr coord_t GR_W = 84; + static LAYOUT_VAL(GR_W, 84, 84, LS(84)) static constexpr coord_t ST_X = GR_X + GR_W + PAD_SMALL; - static constexpr coord_t ST_W = 60; + static LAYOUT_VAL(ST_W, 60, 60, LS(60)) static constexpr coord_t C1_X = ST_X + ST_W + PAD_SMALL; - static constexpr coord_t C1_W = 40; + static LAYOUT_VAL(C1_W, 40, 40, LS(40)) static constexpr coord_t C2_X = C1_X + C1_W + PAD_SMALL; - static constexpr coord_t C2_W = 40; + static LAYOUT_VAL(C2_W, 40, 40, LS(40)) #else static constexpr coord_t SW_W = (LCD_W - PAD_SMALL * 2 - PAD_TINY * 4) / 5; static constexpr coord_t NM_X = SW_W + PAD_TINY; - static constexpr coord_t NM_W = 80; + static LAYOUT_VAL(NM_W, 80, 80, LS(80)) static constexpr coord_t TP_X = NM_X + SW_W + PAD_TINY; - static constexpr coord_t TP_W = 86; + static LAYOUT_VAL(TP_W, 86, 86, LS(86)) static constexpr coord_t GR_X = TP_X + SW_W + PAD_TINY; - static constexpr coord_t GR_W = 94; - static constexpr coord_t ST_X = GR_X + SW_W + 20; - static constexpr coord_t ST_W = 70; + static LAYOUT_VAL(GR_W, 94, 94, LS(94)) + static constexpr coord_t ST_X = GR_X + SW_W + PAD_LARGE * 2 + PAD_SMALL; + static LAYOUT_VAL(ST_W, 70, 70, LS(70)) #endif protected: @@ -250,7 +249,7 @@ class SwitchGroup : public Window { padAll(PAD_TINY); - new StaticText(this, {0, PAD_MEDIUM, NM_W, EdgeTxStyles::PAGE_LINE_HEIGHT}, + new StaticText(this, {0, PAD_MEDIUM, NM_W, EdgeTxStyles::STD_FONT_HEIGHT}, STR_FUNCTION_SWITCH_GROUPS[groupIndex]); auto btn = new TextButton( @@ -265,7 +264,7 @@ class SwitchGroup : public Window }); btn->check(IS_FSWITCH_GROUP_ON(groupIndex)); - new StaticText(this, {SL_X, PAD_MEDIUM, SL_W, EdgeTxStyles::PAGE_LINE_HEIGHT}, STR_SWITCH_STARTUP); + new StaticText(this, {SL_X, PAD_MEDIUM, SL_W, EdgeTxStyles::STD_FONT_HEIGHT}, STR_SWITCH_STARTUP); startChoice = new Choice( this, {ST_X, 0, ST_W, 0}, STR_FSSWITCHES, 0, @@ -295,13 +294,13 @@ class SwitchGroup : public Window startChoice->setValue(groupDefaultSwitch(groupIndex) + 1); } - static constexpr coord_t NM_W = 100; - static constexpr coord_t AO_X = NM_W + 2; - static constexpr coord_t AO_W = 100; - static constexpr coord_t SL_X = AO_X + AO_W + 30; - static constexpr coord_t SL_W = 100; - static constexpr coord_t ST_X = SL_X + SL_W + 2; - static constexpr coord_t ST_W = 80; + static LAYOUT_VAL(NM_W, 100, 100, LS(100)) + static constexpr coord_t AO_X = NM_W + PAD_TINY; + static LAYOUT_VAL(AO_W, 100, 100, LS(100)) + static constexpr coord_t SL_X = AO_X + AO_W + PAD_LARGE * 3 + PAD_MEDIUM; + static LAYOUT_VAL(SL_W, 100, 100, LS(100)) + static constexpr coord_t ST_X = SL_X + SL_W + PAD_TINY; + static LAYOUT_VAL(ST_W, 80, 80, LS(80)) protected: uint8_t groupIndex; diff --git a/radio/src/gui/colorlcd/model/mixer_edit_adv.cpp b/radio/src/gui/colorlcd/model/mixer_edit_adv.cpp index 80e108eea..6e7feb312 100644 --- a/radio/src/gui/colorlcd/model/mixer_edit_adv.cpp +++ b/radio/src/gui/colorlcd/model/mixer_edit_adv.cpp @@ -83,7 +83,7 @@ void MixEditAdvanced::buildBody(Window* form) // Warning new StaticText(line, rect_t{}, STR_MIXWARNING); - auto edit = new NumberEdit(line, rect_t{0, 0, NUM_EDIT_W, 0}, 0, 3, + auto edit = new NumberEdit(line, rect_t{}, 0, 3, GET_SET_DEFAULT(mix->mixWarn)); edit->setZeroText(STR_OFF); @@ -112,14 +112,14 @@ void MixEditAdvanced::buildBody(Window* form) // Delay up line = form->newLine(grid); new StaticText(line, rect_t{}, STR_DELAYUP); - delayUp = new NumberEdit(line, rect_t{0, 0, NUM_EDIT_W, 0}, 0, DELAY_MAX, + delayUp = new NumberEdit(line, rect_t{}, 0, DELAY_MAX, GET_DEFAULT(mix->delayUp), SET_VALUE(mix->delayUp, newValue), mix->delayPrec ? PREC2 : PREC1); delayUp->setSuffix("s"); // Delay down new StaticText(line, rect_t{}, STR_DELAYDOWN); - delayDn = new NumberEdit(line, rect_t{0, 0, NUM_EDIT_W, 0}, 0, DELAY_MAX, + delayDn = new NumberEdit(line, rect_t{}, 0, DELAY_MAX, GET_DEFAULT(mix->delayDown), SET_VALUE(mix->delayDown, newValue), mix->delayPrec ? PREC2 : PREC1); delayDn->setSuffix("s"); @@ -149,13 +149,13 @@ void MixEditAdvanced::buildBody(Window* form) // Slow up line = form->newLine(grid); new StaticText(line, rect_t{}, STR_SLOWUP); - slowUp = new NumberEdit(line, rect_t{0, 0, NUM_EDIT_W, 0}, 0, DELAY_MAX, GET_DEFAULT(mix->speedUp), + slowUp = new NumberEdit(line, rect_t{}, 0, DELAY_MAX, GET_DEFAULT(mix->speedUp), SET_VALUE(mix->speedUp, newValue), mix->speedPrec ? PREC2 : PREC1); slowUp->setSuffix("s"); // Slow down new StaticText(line, rect_t{}, STR_SLOWDOWN); - slowDn = new NumberEdit(line, rect_t{0, 0, NUM_EDIT_W, 0}, 0, DELAY_MAX, GET_DEFAULT(mix->speedDown), + slowDn = new NumberEdit(line, rect_t{}, 0, DELAY_MAX, GET_DEFAULT(mix->speedDown), SET_VALUE(mix->speedDown, newValue), mix->speedPrec ? PREC2 : PREC1); slowDn->setSuffix("s"); } diff --git a/radio/src/gui/colorlcd/model/mixer_edit_adv.h b/radio/src/gui/colorlcd/model/mixer_edit_adv.h index 99fd60b8f..a321af6e6 100644 --- a/radio/src/gui/colorlcd/model/mixer_edit_adv.h +++ b/radio/src/gui/colorlcd/model/mixer_edit_adv.h @@ -33,8 +33,6 @@ class MixEditAdvanced : public Page public: MixEditAdvanced(int8_t channel, uint8_t index); - static LAYOUT_VAL(NUM_EDIT_W, 100, 100, LS(100)) - protected: uint8_t channel; uint8_t index; diff --git a/radio/src/gui/colorlcd/model/model_curves.cpp b/radio/src/gui/colorlcd/model/model_curves.cpp index 71f2c407b..9f55e628e 100644 --- a/radio/src/gui/colorlcd/model/model_curves.cpp +++ b/radio/src/gui/colorlcd/model/model_curves.cpp @@ -42,7 +42,7 @@ class CurveButton : public Button s = strAppend(s, ":"); strAppend(s, g_model.curves[index].name, LEN_CURVE_NAME); } - title = new StaticText(this, {4, -1, width() - 12, TITLE_H + 1}, buf, + title = new StaticText(this, {4, -1, width() - PAD_MEDIUM * 2, EdgeTxStyles::STD_FONT_HEIGHT}, buf, COLOR_THEME_SECONDARY1_INDEX, CENTERED | FONT(BOLD)); etx_txt_color(title->getLvObj(), COLOR_THEME_PRIMARY2_INDEX, LV_PART_MAIN | LV_STATE_USER_1); @@ -59,7 +59,7 @@ class CurveButton : public Button // Preview preview = new CurveRenderer( this, - {PAD_MEDIUM, PAD_MEDIUM + TITLE_H, width() - PAD_MEDIUM * 2 - 4, + {PAD_MEDIUM, PAD_MEDIUM + EdgeTxStyles::STD_FONT_HEIGHT, width() - PAD_MEDIUM * 2 - 4, width() - PAD_MEDIUM * 2 - 4}, [=](int x) -> int { return applyCustomCurve(x, index); }); @@ -67,16 +67,15 @@ class CurveButton : public Button CurveHeader &curve = g_model.curves[index]; snprintf(buf, 32, "%s %d %s", STR_CURVE_TYPES[curve.type], 5 + curve.points, STR_PTS); - new StaticText(this, {0, height() - INFO_H, LV_PCT(100), 0}, buf, + new StaticText(this, {0, height() - EdgeTxStyles::STD_FONT_HEIGHT - PAD_MEDIUM, LV_PCT(100), EdgeTxStyles::STD_FONT_HEIGHT}, buf, COLOR_THEME_SECONDARY1_INDEX, CENTERED | FONT(BOLD)); } void update() { preview->update(); } - static LAYOUT_VAL(TITLE_H, 20, 20, LS(20)) static LAYOUT_VAL(INFO_H, 27, 27, 19) static LAYOUT_VAL(CURVE_BTN_W, 142, 142, LS(142)) - static constexpr coord_t CURVE_BTH_H = CURVE_BTN_W + TITLE_H + INFO_H - PAD_MEDIUM; + static constexpr coord_t CURVE_BTH_H = CURVE_BTN_W + EdgeTxStyles::STD_FONT_HEIGHT * 2; protected: uint8_t index; diff --git a/radio/src/gui/colorlcd/model/model_flightmodes.cpp b/radio/src/gui/colorlcd/model/model_flightmodes.cpp index f44b46d24..981625fd8 100644 --- a/radio/src/gui/colorlcd/model/model_flightmodes.cpp +++ b/radio/src/gui/colorlcd/model/model_flightmodes.cpp @@ -84,7 +84,7 @@ class TrimEdit : public Window if (tr->mode != TRIM_MODE_NONE) tr_btn->check(); - tr_mode = new Choice(this, rect_t{0, 0, TR_MODE_W, 0}, 0, 2 * MAX_FLIGHT_MODES, + tr_mode = new Choice(this, rect_t{0, 0, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, 0, 2 * MAX_FLIGHT_MODES, GET_DEFAULT(tr->mode), [=](int val) { tr->mode = val; showControls(); @@ -100,14 +100,13 @@ class TrimEdit : public Window }); tr_value = new NumberEdit( - this, rect_t{0, 0, TR_MODE_W, 0}, g_model.extendedTrims ? -512 : -128, + this, rect_t{0, 0, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, g_model.extendedTrims ? -512 : -128, g_model.extendedTrims ? 512 : 128, GET_SET_DEFAULT(tr->value)); showControls(); } static LAYOUT_VAL(TR_BTN_W, 65, 65, 44) - static LAYOUT_VAL(TR_MODE_W, 70, 70, LS(70)) protected: int trimId; @@ -377,7 +376,7 @@ const lv_obj_class_t FlightModeBtn::fm_id_class = { .user_data = nullptr, .event_cb = nullptr, .width_def = FlightModeBtn::FMID_W, - .height_def = EdgeTxStyles::PAGE_LINE_HEIGHT, + .height_def = EdgeTxStyles::STD_FONT_HEIGHT, .editable = LV_OBJ_CLASS_EDITABLE_INHERIT, .group_def = LV_OBJ_CLASS_GROUP_DEF_INHERIT, .instance_size = sizeof(lv_label_t), @@ -396,7 +395,7 @@ const lv_obj_class_t FlightModeBtn::fm_name_class = { .user_data = nullptr, .event_cb = nullptr, .width_def = FlightModeBtn::NAME_W, - .height_def = EdgeTxStyles::PAGE_LINE_HEIGHT, + .height_def = EdgeTxStyles::STD_FONT_HEIGHT, .editable = LV_OBJ_CLASS_EDITABLE_INHERIT, .group_def = LV_OBJ_CLASS_GROUP_DEF_INHERIT, .instance_size = sizeof(lv_label_t), @@ -414,7 +413,7 @@ const lv_obj_class_t FlightModeBtn::fm_switch_class = { .user_data = nullptr, .event_cb = nullptr, .width_def = FlightModeBtn::SWTCH_W, - .height_def = EdgeTxStyles::PAGE_LINE_HEIGHT, + .height_def = EdgeTxStyles::STD_FONT_HEIGHT, .editable = LV_OBJ_CLASS_EDITABLE_INHERIT, .group_def = LV_OBJ_CLASS_GROUP_DEF_INHERIT, .instance_size = sizeof(lv_label_t), @@ -432,7 +431,7 @@ const lv_obj_class_t FlightModeBtn::fm_fade_class = { .user_data = nullptr, .event_cb = nullptr, .width_def = FlightModeBtn::FADE_W, - .height_def = EdgeTxStyles::PAGE_LINE_HEIGHT, + .height_def = EdgeTxStyles::STD_FONT_HEIGHT, .editable = LV_OBJ_CLASS_EDITABLE_INHERIT, .group_def = LV_OBJ_CLASS_GROUP_DEF_INHERIT, .instance_size = sizeof(lv_label_t), diff --git a/radio/src/gui/colorlcd/model/model_gvars.cpp b/radio/src/gui/colorlcd/model/model_gvars.cpp index 4e59bf549..94ad826f5 100644 --- a/radio/src/gui/colorlcd/model/model_gvars.cpp +++ b/radio/src/gui/colorlcd/model/model_gvars.cpp @@ -67,13 +67,13 @@ class GVarButton : public ListLineButton } static LAYOUT_VAL3(GVAR_NAME_SIZE, 44, 44, LS(44), 74) - static constexpr coord_t GVAR_VAL_H = EdgeTxStyles::PAGE_LINE_HEIGHT + 2; + static constexpr coord_t GVAR_VAL_H = EdgeTxStyles::STD_FONT_HEIGHT + 2; static LAYOUT_VAL3(GVAR_VAL_W, 45, 50, LS(45), 75) static LAYOUT_VAL2(GVAR_COLS, MAX_FLIGHT_MODES, 5) static LAYOUT_VAL2(BTN_H, EdgeTxStyles::UI_ELEMENT_HEIGHT, 50) static LAYOUT_VAL(GVAR_NM_Y, 4, 13, LS(4)) static LAYOUT_VAL(GVAR_YO, 4, 2, LS(4)) - static LAYOUT_VAL2(HDR_H, EdgeTxStyles::PAGE_LINE_HEIGHT + PAD_TINY, EdgeTxStyles::PAGE_LINE_HEIGHT * 2 + PAD_TINY) + static LAYOUT_VAL2(HDR_H, EdgeTxStyles::STD_FONT_HEIGHT + PAD_TINY, EdgeTxStyles::STD_FONT_HEIGHT * 2 + PAD_TINY) static const lv_obj_class_t gv_label_class; static const lv_obj_class_t gv_value_class; @@ -122,7 +122,7 @@ class GVarButton : public ListLineButton auto nm = lv_label_create(lvobj); lv_label_set_text(nm, getGVarString(index)); lv_obj_set_pos(nm, PAD_TINY, GVAR_NM_Y); - lv_obj_set_size(nm, GVAR_NAME_SIZE, EdgeTxStyles::PAGE_LINE_HEIGHT); + lv_obj_set_size(nm, GVAR_NAME_SIZE, EdgeTxStyles::STD_FONT_HEIGHT); if (modelFMEnabled()) { for (int flightMode = 0; flightMode < MAX_FLIGHT_MODES; flightMode++) { @@ -138,7 +138,7 @@ class GVarButton : public ListLineButton } } else { valueTexts[0] = lv_label_create(lvobj); - lv_obj_set_pos(valueTexts[0], GVAR_NAME_SIZE + PAD_MEDIUM, (BTN_H - EdgeTxStyles::PAGE_LINE_HEIGHT - PAD_SMALL) / 2); + lv_obj_set_pos(valueTexts[0], GVAR_NAME_SIZE + PAD_MEDIUM, (BTN_H - EdgeTxStyles::STD_FONT_HEIGHT - PAD_SMALL) / 2); updateValueText(0); } @@ -199,7 +199,7 @@ const lv_obj_class_t GVarButton::gv_label_class = { .user_data = nullptr, .event_cb = nullptr, .width_def = GVarButton::GVAR_VAL_W, - .height_def = EdgeTxStyles::PAGE_LINE_HEIGHT - PAD_MEDIUM, + .height_def = EdgeTxStyles::STD_FONT_HEIGHT - PAD_MEDIUM, .editable = LV_OBJ_CLASS_EDITABLE_INHERIT, .group_def = LV_OBJ_CLASS_GROUP_DEF_INHERIT, .instance_size = sizeof(lv_label_t), @@ -219,7 +219,7 @@ const lv_obj_class_t GVarButton::gv_value_class = { .user_data = nullptr, .event_cb = nullptr, .width_def = GVarButton::GVAR_VAL_W, - .height_def = EdgeTxStyles::PAGE_LINE_HEIGHT, + .height_def = EdgeTxStyles::STD_FONT_HEIGHT, .editable = LV_OBJ_CLASS_EDITABLE_INHERIT, .group_def = LV_OBJ_CLASS_GROUP_DEF_INHERIT, .instance_size = sizeof(lv_label_t), @@ -282,7 +282,7 @@ class GVarHeader : public Window labelTexts[flightMode] = etx_create(&GVarButton::gv_value_class, lvobj); lv_label_set_text(labelTexts[flightMode], label); lv_obj_set_pos(labelTexts[flightMode], (flightMode % GVarButton::GVAR_COLS) * GVarButton::GVAR_VAL_W + GVarButton::GVAR_NAME_SIZE + HDR_XO, - (flightMode / GVarButton::GVAR_COLS) * EdgeTxStyles::PAGE_LINE_HEIGHT + 1); + (flightMode / GVarButton::GVAR_COLS) * EdgeTxStyles::STD_FONT_HEIGHT + 1); if (flightMode == currentFlightMode) { lv_obj_add_state(labelTexts[flightMode], LV_STATE_CHECKED); diff --git a/radio/src/gui/colorlcd/model/model_logical_switches.cpp b/radio/src/gui/colorlcd/model/model_logical_switches.cpp index 2e23c773c..0ed8bcb93 100644 --- a/radio/src/gui/colorlcd/model/model_logical_switches.cpp +++ b/radio/src/gui/colorlcd/model/model_logical_switches.cpp @@ -336,42 +336,42 @@ class LogicalSwitchButton : public ListLineButton lsName = lv_label_create(lvobj); etx_obj_add_style(lsName, styles->text_align_left, LV_PART_MAIN); lv_obj_set_pos(lsName, NM_X, NM_Y); - lv_obj_set_size(lsName, NM_W, NM_H); + lv_obj_set_size(lsName, NM_W, EdgeTxStyles::STD_FONT_HEIGHT); lsFunc = lv_label_create(lvobj); etx_obj_add_style(lsFunc, styles->text_align_left, LV_PART_MAIN); lv_obj_set_pos(lsFunc, FN_X, FN_Y); - lv_obj_set_size(lsFunc, FN_W, FN_H); + lv_obj_set_size(lsFunc, FN_W, EdgeTxStyles::STD_FONT_HEIGHT); lv_obj_set_style_text_font(lsFunc, getFont(FONT(BOLD)), LV_STATE_USER_1); lsV1 = lv_label_create(lvobj); etx_obj_add_style(lsV1, styles->text_align_center, LV_PART_MAIN); etx_font(lsV1, FONT_XS_INDEX, ETX_STATE_V1_SMALL_FONT); lv_obj_set_pos(lsV1, V1_X, V1_Y); - lv_obj_set_size(lsV1, V1_W, V1_H); + lv_obj_set_size(lsV1, V1_W, EdgeTxStyles::STD_FONT_HEIGHT); lv_obj_set_style_text_font(lsV1, getFont(FONT(BOLD)), LV_STATE_USER_1); lsV2 = lv_label_create(lvobj); etx_obj_add_style(lsV2, styles->text_align_center, LV_PART_MAIN); lv_obj_set_pos(lsV2, V2_X, V2_Y); - lv_obj_set_size(lsV2, V2_W, V2_H); + lv_obj_set_size(lsV2, V2_W, EdgeTxStyles::STD_FONT_HEIGHT); lv_obj_set_style_text_font(lsV2, getFont(FONT(BOLD)), LV_STATE_USER_1); lsAnd = lv_label_create(lvobj); etx_obj_add_style(lsAnd, styles->text_align_center, LV_PART_MAIN); lv_obj_set_pos(lsAnd, AND_X, AND_Y); - lv_obj_set_size(lsAnd, AND_W, AND_H); + lv_obj_set_size(lsAnd, AND_W, EdgeTxStyles::STD_FONT_HEIGHT); lv_obj_set_style_text_font(lsAnd, getFont(FONT(BOLD)), LV_STATE_USER_1); lsDuration = lv_label_create(lvobj); etx_obj_add_style(lsDuration, styles->text_align_center, LV_PART_MAIN); lv_obj_set_pos(lsDuration, DUR_X, DUR_Y); - lv_obj_set_size(lsDuration, DUR_W, DUR_H); + lv_obj_set_size(lsDuration, DUR_W, EdgeTxStyles::STD_FONT_HEIGHT); lsDelay = lv_label_create(lvobj); etx_obj_add_style(lsDelay, styles->text_align_center, LV_PART_MAIN); lv_obj_set_pos(lsDelay, DEL_X, DEL_Y); - lv_obj_set_size(lsDelay, DEL_W, DEL_H); + lv_obj_set_size(lsDelay, DEL_W, EdgeTxStyles::STD_FONT_HEIGHT); lv_obj_update_layout(lvobj); @@ -506,31 +506,24 @@ class LogicalSwitchButton : public ListLineButton static constexpr coord_t NM_X = PAD_TINY; static LAYOUT_VAL(NM_Y, 4, 10, 1) static LAYOUT_VAL(NM_W, 30, 36, LS(30)) - static LAYOUT_VAL(NM_H, 20, 20, 14) static constexpr coord_t FN_X = NM_X + NM_W + PAD_TINY; static constexpr coord_t FN_Y = NM_Y; static LAYOUT_VAL(FN_W, 50, 58, LS(50)) - static constexpr coord_t FN_H = NM_H; static constexpr coord_t V1_X = FN_X + FN_W + PAD_TINY; static LAYOUT_VAL2(V1_Y, NM_Y, 0) static LAYOUT_VAL(V1_W, 88, 88, LS(88)) - static constexpr coord_t V1_H = NM_H; static constexpr coord_t V2_X = V1_X + V1_W + PAD_TINY; static constexpr coord_t V2_Y = V1_Y; - static constexpr coord_t V2_H = NM_H; static constexpr coord_t AND_W = V1_W; static LAYOUT_VAL(DUR_W, 40, 54, LS(40)) static constexpr coord_t DEL_W = DUR_W; static constexpr coord_t AND_X = ListLineButton::GRP_W - PAD_BORDER * 2 - AND_W - DUR_W - DEL_W - PAD_TINY * 3; static LAYOUT_VAL2(AND_Y, NM_Y, 20) static constexpr coord_t V2_W = AND_X - V2_X - PAD_TINY; - static constexpr coord_t AND_H = NM_H; static constexpr coord_t DUR_X = ListLineButton::GRP_W - PAD_BORDER * 2 - DUR_W - DEL_W - PAD_TINY * 2; static constexpr coord_t DUR_Y = AND_Y; - static constexpr coord_t DUR_H = NM_H; static constexpr coord_t DEL_X = ListLineButton::GRP_W - PAD_BORDER * 2 - DEL_W - PAD_TINY; static constexpr coord_t DEL_Y = AND_Y; - static constexpr coord_t DEL_H = NM_H; protected: bool init = false; diff --git a/radio/src/gui/colorlcd/model/model_outputs.cpp b/radio/src/gui/colorlcd/model/model_outputs.cpp index c2615b171..5417c859b 100644 --- a/radio/src/gui/colorlcd/model/model_outputs.cpp +++ b/radio/src/gui/colorlcd/model/model_outputs.cpp @@ -75,23 +75,23 @@ class OutputLineButton : public ListLineButton etx_obj_add_style(min, styles->text_align_right, LV_PART_MAIN); etx_font(min, FONT_BOLD_INDEX, ETX_STATE_MINMAX_BOLD); lv_obj_set_pos(min, MIN_X, MIN_Y); - lv_obj_set_size(min, MIN_W, MIN_H); + lv_obj_set_size(min, MIN_W, EdgeTxStyles::STD_FONT_HEIGHT); max = lv_label_create(lvobj); etx_obj_add_style(max, styles->text_align_right, LV_PART_MAIN); etx_font(max, FONT_BOLD_INDEX, ETX_STATE_MINMAX_BOLD); lv_obj_set_pos(max, MAX_X, MAX_Y); - lv_obj_set_size(max, MAX_W, MAX_H); + lv_obj_set_size(max, MAX_W, EdgeTxStyles::STD_FONT_HEIGHT); offset = lv_label_create(lvobj); etx_obj_add_style(offset, styles->text_align_right, LV_PART_MAIN); lv_obj_set_pos(offset, OFF_X, OFF_Y); - lv_obj_set_size(offset, OFF_W, OFF_H); + lv_obj_set_size(offset, OFF_W, EdgeTxStyles::STD_FONT_HEIGHT); center = lv_label_create(lvobj); etx_obj_add_style(center, styles->text_align_right, LV_PART_MAIN); lv_obj_set_pos(center, CTR_X, CTR_Y); - lv_obj_set_size(center, CTR_W, CTR_H); + lv_obj_set_size(center, CTR_W, EdgeTxStyles::STD_FONT_HEIGHT); revert = lv_img_create(lvobj); lv_img_set_src(revert, LV_SYMBOL_SHUFFLE); @@ -178,19 +178,15 @@ class OutputLineButton : public ListLineButton static constexpr coord_t MIN_X = SRC_X + SRC_W + PAD_TINY; static LAYOUT_VAL(MIN_Y, 4, 2, 2) static LAYOUT_VAL(MIN_W, 52, 52, LS(52)) - static LAYOUT_VAL(MIN_H, 20, 20, LS(20)) static constexpr coord_t MAX_X = MIN_X + MIN_W + PAD_TINY; static constexpr coord_t MAX_Y = MIN_Y; static LAYOUT_VAL(MAX_W, 52, 60, LS(52)) - static constexpr coord_t MAX_H = MIN_H; static LAYOUT_VAL(OFF_X, MAX_X + MAX_W + PAD_TINY, SRC_X + SRC_W + PAD_TINY, MAX_X + MAX_W + PAD_TINY) static LAYOUT_VAL(OFF_Y, MIN_Y, 24, MIN_Y) static LAYOUT_VAL(OFF_W, 44, 52, LS(44)) - static constexpr coord_t OFF_H = MIN_H; static constexpr coord_t CTR_X = OFF_X + OFF_W + PAD_TINY; static constexpr coord_t CTR_Y = OFF_Y; static LAYOUT_VAL(CTR_W, 60, 60, LS(60)) - static constexpr coord_t CTR_H = MIN_H; static constexpr coord_t REV_X = CTR_X + CTR_W + PAD_TINY; static constexpr coord_t REV_Y = CTR_Y; static LAYOUT_VAL(REV_W, 16, 16, LS(16)) @@ -247,7 +243,7 @@ void ModelOutputsPage::build(Window* window) return 0; }); - new StaticText(window, {EXLIM_X, EXLIM_Y, EXLIM_W, EXLIM_H}, STR_ELIMITS, COLOR_THEME_PRIMARY1_INDEX, RIGHT); + new StaticText(window, {EXLIM_X, EXLIM_Y, EXLIM_W, EdgeTxStyles::STD_FONT_HEIGHT}, STR_ELIMITS, COLOR_THEME_PRIMARY1_INDEX, RIGHT); new ToggleSwitch(window, {EXLIMCB_X, EXLIMCB_Y, EXLIMCB_W, EXLIMCB_H}, GET_SET_DEFAULT(g_model.extendedLimits)); for (uint8_t ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++) { diff --git a/radio/src/gui/colorlcd/model/model_outputs.h b/radio/src/gui/colorlcd/model/model_outputs.h index 442733185..f20f03078 100644 --- a/radio/src/gui/colorlcd/model/model_outputs.h +++ b/radio/src/gui/colorlcd/model/model_outputs.h @@ -43,7 +43,6 @@ class ModelOutputsPage : public PageTab static LAYOUT_VAL2(EXLIM_X, ADD_TRIMS_X + ADD_TRIMS_W + PAD_SMALL, 6) static LAYOUT_VAL(EXLIM_Y, 10, ADD_TRIMS_X + ADD_TRIMS_H + 8, LS(10)) static constexpr coord_t EXLIM_W = EXLIMCB_X - EXLIM_X - PAD_SMALL; - static LAYOUT_VAL(EXLIM_H, 20, 20, LS(20)) static constexpr coord_t TRIMB_X = PAD_SMALL; static constexpr coord_t TRIMB_Y = EXLIMCB_Y + EXLIMCB_H + PAD_MEDIUM / 2; static constexpr coord_t TRIMB_W = LCD_W - PAD_SMALL * 2; diff --git a/radio/src/gui/colorlcd/model/model_select.cpp b/radio/src/gui/colorlcd/model/model_select.cpp index c49ec7194..179a6b291 100644 --- a/radio/src/gui/colorlcd/model/model_select.cpp +++ b/radio/src/gui/colorlcd/model/model_select.cpp @@ -94,7 +94,7 @@ class ModelButton : public Button etx_obj_add_style(modelName->getLvObj(), styles->bg_opacity_75, LV_PART_MAIN); modelName->padTop(fo); } else { - modelName = new StaticText(this, {PAD_TINY, PAD_SMALL, w, EdgeTxStyles::PAGE_LINE_HEIGHT}, modelCell->modelName, + modelName = new StaticText(this, {PAD_TINY, PAD_SMALL, w, EdgeTxStyles::STD_FONT_HEIGHT}, modelCell->modelName, COLOR_THEME_SECONDARY1_INDEX, font); } lv_label_set_long_mode(modelName->getLvObj(), LV_LABEL_LONG_DOT); diff --git a/radio/src/gui/colorlcd/model/model_telemetry.cpp b/radio/src/gui/colorlcd/model/model_telemetry.cpp index 11331299e..93e8c83a0 100644 --- a/radio/src/gui/colorlcd/model/model_telemetry.cpp +++ b/radio/src/gui/colorlcd/model/model_telemetry.cpp @@ -85,7 +85,6 @@ class TSStyle lv_style_t tsFreshStyle; static LAYOUT_VAL(NUM_W, 36, 36, LS(36)) - static LAYOUT_VAL(NUM_H, 20, 20, LS(20)) static LAYOUT_VAL(NAME_W, 56, 56, LS(56)) static LAYOUT_VAL(ID_Y, 17, 17, LS(17)) static LAYOUT_VAL(ID_H, 11, 11, LS(11)) @@ -110,7 +109,7 @@ static const lv_obj_class_t ts_num_class = { .user_data = nullptr, .event_cb = nullptr, .width_def = TSStyle::NUM_W, - .height_def = TSStyle::NUM_H, + .height_def = EdgeTxStyles::STD_FONT_HEIGHT, .editable = LV_OBJ_CLASS_EDITABLE_INHERIT, .group_def = LV_OBJ_CLASS_GROUP_DEF_INHERIT, .instance_size = sizeof(lv_label_t), @@ -163,7 +162,7 @@ static const lv_obj_class_t ts_name_class = { .user_data = nullptr, .event_cb = nullptr, .width_def = TSStyle::NAME_W, - .height_def = TSStyle::NUM_H, + .height_def = EdgeTxStyles::STD_FONT_HEIGHT, .editable = LV_OBJ_CLASS_EDITABLE_INHERIT, .group_def = LV_OBJ_CLASS_GROUP_DEF_INHERIT, .instance_size = sizeof(lv_label_t), @@ -190,7 +189,7 @@ static const lv_obj_class_t ts_value_class = { .user_data = nullptr, .event_cb = nullptr, .width_def = LV_SIZE_CONTENT, - .height_def = TSStyle::NUM_H, + .height_def = EdgeTxStyles::STD_FONT_HEIGHT, .editable = LV_OBJ_CLASS_EDITABLE_INHERIT, .group_def = LV_OBJ_CLASS_GROUP_DEF_INHERIT, .instance_size = sizeof(lv_label_t), @@ -816,7 +815,7 @@ class SensorEditWindow : public SubPage updateSensorParameters(); } - static LAYOUT_VAL(NUM_EDIT_W, 100, 80, LS(100)) + static LAYOUT_VAL2(NUM_EDIT_W, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 80) }; ModelTelemetryPage::ModelTelemetryPage() : diff --git a/radio/src/gui/colorlcd/model/model_templates.cpp b/radio/src/gui/colorlcd/model/model_templates.cpp index 40a1d1523..c097abf96 100644 --- a/radio/src/gui/colorlcd/model/model_templates.cpp +++ b/radio/src/gui/colorlcd/model/model_templates.cpp @@ -125,7 +125,7 @@ class SelectTemplate : public TemplatePage for (auto name : files) { auto tb = new TextButton( - listWindow, rect_t{0, 0, lv_pct(100), EdgeTxStyles::PAGE_LINE_HEIGHT * 2}, name, + listWindow, rect_t{0, 0, lv_pct(100), EdgeTxStyles::STD_FONT_HEIGHT * 2}, name, [=]() -> uint8_t { deleteLater(); templateFolderPage->doUpdate(folder, name); @@ -166,7 +166,7 @@ SelectTemplateFolder::SelectTemplateFolder( header->setTitle2(STR_NEW_MODEL); auto tfb = new TextButton(listWindow, - rect_t{0, 0, lv_pct(100), EdgeTxStyles::PAGE_LINE_HEIGHT * 2}, + rect_t{0, 0, lv_pct(100), EdgeTxStyles::STD_FONT_HEIGHT * 2}, STR_BLANK_MODEL, [=]() -> uint8_t { doUpdate("", ""); return 0; @@ -205,7 +205,7 @@ SelectTemplateFolder::SelectTemplateFolder( if (!strcasecmp(name.c_str(), "WIZARD") == 0) { #endif auto tfb = new TextButton( - listWindow, rect_t{0, 0, lv_pct(100), EdgeTxStyles::PAGE_LINE_HEIGHT * 2}, name, + listWindow, rect_t{0, 0, lv_pct(100), EdgeTxStyles::STD_FONT_HEIGHT * 2}, name, [=]() -> uint8_t { new SelectTemplate(this, name); return 0; diff --git a/radio/src/gui/colorlcd/model/special_functions.cpp b/radio/src/gui/colorlcd/model/special_functions.cpp index 0a67a82d4..4d22be075 100644 --- a/radio/src/gui/colorlcd/model/special_functions.cpp +++ b/radio/src/gui/colorlcd/model/special_functions.cpp @@ -107,19 +107,19 @@ void FunctionLineButton::delayed_init() sfName = lv_label_create(lvobj); lv_obj_set_pos(sfName, NM_X, NM_Y); - lv_obj_set_size(sfName, NM_W, NM_H); + lv_obj_set_size(sfName, NM_W, EdgeTxStyles::STD_FONT_HEIGHT); sfSwitch = lv_label_create(lvobj); lv_obj_set_pos(sfSwitch, SW_X, SW_Y); - lv_obj_set_size(sfSwitch, SW_W, SW_H); + lv_obj_set_size(sfSwitch, SW_W, EdgeTxStyles::STD_FONT_HEIGHT); sfFunc = lv_label_create(lvobj); lv_obj_set_pos(sfFunc, FN_X, FN_Y); - lv_obj_set_size(sfFunc, FN_W, FN_H); + lv_obj_set_size(sfFunc, FN_W, EdgeTxStyles::STD_FONT_HEIGHT); sfRepeat = lv_label_create(lvobj); lv_obj_set_pos(sfRepeat, RP_X, RP_Y); - lv_obj_set_size(sfRepeat, RP_W, RP_H); + lv_obj_set_size(sfRepeat, RP_W, EdgeTxStyles::STD_FONT_HEIGHT); sfEnable = sf_enable_state_create(lvobj); lv_obj_clear_flag(sfEnable, LV_OBJ_FLAG_CLICKABLE); diff --git a/radio/src/gui/colorlcd/model/special_functions.h b/radio/src/gui/colorlcd/model/special_functions.h index 49465f335..3c245c456 100644 --- a/radio/src/gui/colorlcd/model/special_functions.h +++ b/radio/src/gui/colorlcd/model/special_functions.h @@ -53,19 +53,15 @@ class FunctionLineButton : public ListLineButton static constexpr coord_t NM_X = PAD_TINY; static LAYOUT_VAL(NM_Y, 4, 10, 1) static LAYOUT_VAL(NM_W, 43, 40, LS(43)) - static LAYOUT_VAL(NM_H, 20, 20, 14) static constexpr coord_t SW_X = NM_X + NM_W + PAD_TINY; static LAYOUT_VAL2(SW_Y, NM_Y, 0) static LAYOUT_VAL(SW_W, 70, 198, LS(70)) - static constexpr coord_t SW_H = NM_H; static LAYOUT_VAL2(FN_X, SW_X + SW_W + PAD_TINY, NM_X + NM_W + PAD_TINY) static LAYOUT_VAL2(FN_Y, NM_Y, 20) static LAYOUT_VAL(RP_W, 40, 34, LS(40)) static LAYOUT_VAL(EN_SZ, 16, 16, 12) - static constexpr coord_t FN_H = NM_H; static constexpr coord_t RP_X = ListLineButton::GRP_W - PAD_BORDER * 2 - RP_W - EN_SZ - PAD_TINY * 2; static constexpr coord_t RP_Y = NM_Y; - static constexpr coord_t RP_H = NM_H; static constexpr coord_t FN_W = RP_X - FN_X - PAD_TINY; static constexpr coord_t EN_X = ListLineButton::GRP_W - PAD_BORDER * 2 - EN_SZ - PAD_TINY; static constexpr coord_t EN_Y = NM_Y + PAD_TINY; diff --git a/radio/src/gui/colorlcd/module/afhds3_options.cpp b/radio/src/gui/colorlcd/module/afhds3_options.cpp index ad077e076..73f5bdc14 100644 --- a/radio/src/gui/colorlcd/module/afhds3_options.cpp +++ b/radio/src/gui/colorlcd/module/afhds3_options.cpp @@ -44,8 +44,6 @@ struct PWMfrequencyChoice : public Window { PWMfrequencyChoice(Window* parent, uint8_t moduleIdx, uint8_t channelIdx); PWMfrequencyChoice(Window* parent, uint8_t moduleIdx); - static LAYOUT_VAL(NUM_W, 60, 60, LS(60)) - private: NumberEdit* num_edit = nullptr; }; @@ -77,7 +75,7 @@ PWMfrequencyChoice::PWMfrequencyChoice(Window* parent, uint8_t moduleIdx, uint8_ if (num_edit) num_edit->show(pwmvalue_type == 4); }); - num_edit = new NumberEdit(this, {0, 0, NUM_W, 0}, 50, 400, + num_edit = new NumberEdit(this, {0, 0, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, 50, 400, [=,&pwmvalue_type] { return (pwmvalue_type==4?vCfg->PWMFrequenciesV1.PWMFrequencies[channelIdx]:50); }, [=](int16_t newVal) { vCfg->PWMFrequenciesV1.PWMFrequencies[channelIdx] = newVal; @@ -111,7 +109,7 @@ PWMfrequencyChoice::PWMfrequencyChoice(Window* parent, uint8_t moduleIdx ) : if (num_edit) num_edit->show(pwmvalue_type == 2); }); - num_edit = new NumberEdit(this, {0, 0, NUM_W, 0}, 50, 400, + num_edit = new NumberEdit(this, {0, 0, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, 50, 400, [=,&pwmvalue_type] { return (pwmvalue_type==2?vCfg->PWMFrequency.Frequency&0x7fff:50); }, [=](int16_t newVal) { vCfg->PWMFrequency.Frequency = newVal; diff --git a/radio/src/gui/colorlcd/module/custom_failsafe.cpp b/radio/src/gui/colorlcd/module/custom_failsafe.cpp index 6c3b4b510..fc2b0208a 100644 --- a/radio/src/gui/colorlcd/module/custom_failsafe.cpp +++ b/radio/src/gui/colorlcd/module/custom_failsafe.cpp @@ -94,7 +94,7 @@ class ChannelFailsafeEdit : public NumberEdit public: ChannelFailsafeEdit(Window* parent, uint8_t ch, int vmin, int vmax) : - NumberEdit(parent, rect_t{0, 0, NUM_W, 0}, vmin, vmax, nullptr), channel(ch) + NumberEdit(parent, rect_t{0, 0, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, vmin, vmax, nullptr), channel(ch) { setGetValueHandler( [=]() { return calcRESXto1000(g_model.failsafeChannels[ch]); }); @@ -150,8 +150,6 @@ class ChannelFailsafeEdit : public NumberEdit g_model.failsafeChannels[channel] = channelOutputs[channel]; update(); } - - static LAYOUT_VAL(NUM_W, 70, 70, LS(70)) }; class ChannelFSCombo : public Window diff --git a/radio/src/gui/colorlcd/module/module_setup.cpp b/radio/src/gui/colorlcd/module/module_setup.cpp index 28e8c9e63..d648fa3a0 100644 --- a/radio/src/gui/colorlcd/module/module_setup.cpp +++ b/radio/src/gui/colorlcd/module/module_setup.cpp @@ -208,7 +208,7 @@ class ModuleWindow : public Window // Model index auto modelId = &g_model.header.modelId[moduleIdx]; - rxID = new NumberEdit(box, {0, 0, NUM_W, 0}, 0, getMaxRxNum(moduleIdx), + rxID = new NumberEdit(box, {0, 0, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, 0, getMaxRxNum(moduleIdx), GET_DEFAULT(*modelId), [=](int32_t newValue) { if (newValue != *modelId) { *modelId = newValue; @@ -487,8 +487,6 @@ class ModuleWindow : public Window uint8_t getModuleIdx() const { return moduleIdx; } - static LAYOUT_VAL(NUM_W, 60, 60, LS(60)) - protected: uint8_t moduleIdx; diff --git a/radio/src/gui/colorlcd/module/ppm_settings.cpp b/radio/src/gui/colorlcd/module/ppm_settings.cpp index 4551ab483..e8b701f74 100644 --- a/radio/src/gui/colorlcd/module/ppm_settings.cpp +++ b/radio/src/gui/colorlcd/module/ppm_settings.cpp @@ -34,7 +34,7 @@ PpmFrameSettings::PpmFrameSettings(Window* parent, T* ppm) : // PPM frame length auto edit = new NumberEdit( - this, rect_t{0, 0, 80, 0}, 125, 35 * PPM_STEP_SIZE + PPM_DEF_PERIOD, + this, rect_t{0, 0, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, 125, 35 * PPM_STEP_SIZE + PPM_DEF_PERIOD, GET_DEFAULT(ppm->frameLength * PPM_STEP_SIZE + PPM_DEF_PERIOD), SET_VALUE(ppm->frameLength, (newValue - PPM_DEF_PERIOD) / PPM_STEP_SIZE), PREC1); @@ -45,7 +45,7 @@ PpmFrameSettings::PpmFrameSettings(Window* parent, T* ppm) : this->ppmFrameLenEditObject = edit; // PPM frame delay - edit = new NumberEdit(this, rect_t{0, 0, 80, 0}, 100, 800, + edit = new NumberEdit(this, rect_t{0, 0, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, 100, 800, GET_DEFAULT(ppm->delay * 50 + 300), SET_VALUE(ppm->delay, (newValue - 300) / 50)); edit->setStep(50); diff --git a/radio/src/gui/colorlcd/radio/hw_inputs.cpp b/radio/src/gui/colorlcd/radio/hw_inputs.cpp index fc93a2667..1d53df792 100644 --- a/radio/src/gui/colorlcd/radio/hw_inputs.cpp +++ b/radio/src/gui/colorlcd/radio/hw_inputs.cpp @@ -100,7 +100,7 @@ HWPots::HWPots(Window* parent) : new StaticText(this, {P_TYP_X, -PAD_TINY, 0, 0}, STR_TYPE, COLOR_THEME_PRIMARY1_INDEX, FONT(XS)); new StaticText(this, {P_INV_X, -PAD_TINY, 0, 0}, STR_MENU_INVERT, COLOR_THEME_PRIMARY1_INDEX, FONT(XS)); - coord_t yo = EdgeTxStyles::PAGE_LINE_HEIGHT - 2; + coord_t yo = EdgeTxStyles::STD_FONT_HEIGHT - 2; auto max_pots = adcGetMaxInputs(ADC_INPUT_FLEX); for (int i = 0; i < max_pots; i++) { diff --git a/radio/src/gui/colorlcd/radio/hw_serial.cpp b/radio/src/gui/colorlcd/radio/hw_serial.cpp index 73dc45dc8..e93ee72cc 100644 --- a/radio/src/gui/colorlcd/radio/hw_serial.cpp +++ b/radio/src/gui/colorlcd/radio/hw_serial.cpp @@ -63,7 +63,7 @@ SerialConfigWindow::SerialConfigWindow(Window *parent, FlexGridLayout& grid) if (port_nr != SP_VCP) { grid.setColSpan(2); auto line = parent->newLine(grid); - line->padLeft(WARN_PADL); + line->padLeft(PAD_LARGE * 2); line->padBottom(PAD_MEDIUM); new StaticText(line, rect_t{}, STR_TTL_WARNING, COLOR_THEME_WARNING_INDEX); grid.setColSpan(1); diff --git a/radio/src/gui/colorlcd/radio/hw_serial.h b/radio/src/gui/colorlcd/radio/hw_serial.h index c54c3289f..e29dd772c 100644 --- a/radio/src/gui/colorlcd/radio/hw_serial.h +++ b/radio/src/gui/colorlcd/radio/hw_serial.h @@ -27,6 +27,4 @@ class SerialConfigWindow { public: SerialConfigWindow(Window *parent, FlexGridLayout& grid); - - static LAYOUT_VAL(WARN_PADL, 20, 20, LS(20)); }; diff --git a/radio/src/gui/colorlcd/radio/preview_window.cpp b/radio/src/gui/colorlcd/radio/preview_window.cpp index efeb242bd..c21a599c3 100644 --- a/radio/src/gui/colorlcd/radio/preview_window.cpp +++ b/radio/src/gui/colorlcd/radio/preview_window.cpp @@ -157,17 +157,17 @@ PreviewWindow::PreviewWindow(Window *window, rect_t rect, new StaticIcon(topbar, ICON_X3, ICON_Y, ICON_RADIO_SETUP, COLOR_THEME_PRIMARY2_INDEX); - new StaticText(this, {ICON_X1, CBT_Y, CBT_W, EdgeTxStyles::PAGE_LINE_HEIGHT}, STR_THEME_CHECKBOX); + new StaticText(this, {ICON_X1, CBT_Y, CBT_W, EdgeTxStyles::STD_FONT_HEIGHT}, STR_THEME_CHECKBOX); new ThemedCheckBox(this, {CB1_X, CB_Y, CB_W, 0}, true); new ThemedCheckBox(this, {CB2_X, CB_Y, CB_W, 0}, false); (new ThemedButton(this, {BTN_X, BTN1_Y, BTN_W, 0}, STR_THEME_ACTIVE, true)) ->check(true); new ThemedButton(this, {BTN_X, BTN2_Y, BTN_W, 0}, STR_THEME_REGULAR, false); - new MainViewTrim(this, {ICON_X1, TRIM_Y, MainViewSlider::HORIZONTAL_SLIDERS_WIDTH, TRIM_H}, 0, false); - new MainViewSlider(this, {ICON_X1, SLIDER_Y, MainViewSlider::HORIZONTAL_SLIDERS_WIDTH, TRIM_H}, 0, false); - new StaticText(this, {ICON_X1, TXT1_Y, TXT_W, EdgeTxStyles::PAGE_LINE_HEIGHT}, STR_THEME_WARNING, + new MainViewTrim(this, {ICON_X1, TRIM_Y, MainViewSlider::HORIZONTAL_SLIDERS_WIDTH, EdgeTxStyles::STD_FONT_HEIGHT}, 0, false); + new MainViewSlider(this, {ICON_X1, SLIDER_Y, MainViewSlider::HORIZONTAL_SLIDERS_WIDTH, EdgeTxStyles::STD_FONT_HEIGHT}, 0, false); + new StaticText(this, {ICON_X1, TXT1_Y, TXT_W, EdgeTxStyles::STD_FONT_HEIGHT}, STR_THEME_WARNING, COLOR_THEME_WARNING_INDEX); - new StaticText(this, {ICON_X1, TXT2_Y, TXT_W, EdgeTxStyles::PAGE_LINE_HEIGHT}, STR_THEME_DISABLED, + new StaticText(this, {ICON_X1, TXT2_Y, TXT_W, EdgeTxStyles::STD_FONT_HEIGHT}, STR_THEME_DISABLED, COLOR_THEME_DISABLED_INDEX); new ThemedTextEdit(this, {ICON_X1, EDT_Y, TXT_W, 0}, STR_THEME_EDIT, true); diff --git a/radio/src/gui/colorlcd/radio/preview_window.h b/radio/src/gui/colorlcd/radio/preview_window.h index 35db2fc2c..e462e84f4 100644 --- a/radio/src/gui/colorlcd/radio/preview_window.h +++ b/radio/src/gui/colorlcd/radio/preview_window.h @@ -50,7 +50,6 @@ class PreviewWindow : public Window static LAYOUT_VAL(BTN2_Y, 79, 79, LS(79)) static LAYOUT_VAL(BTN_W, 100, 100, LS(100)) static LAYOUT_VAL(TRIM_Y, 79, 79, LS(79)) - static LAYOUT_VAL(TRIM_H, 20, 20, LS(20)) static LAYOUT_VAL(SLIDER_Y, 101, 101, LS(101)) static LAYOUT_VAL(TXT1_Y, 122, 122, LS(122)) static LAYOUT_VAL(TXT2_Y, 144, 144, LS(144)) diff --git a/radio/src/gui/colorlcd/radio/radio_diaganas.cpp b/radio/src/gui/colorlcd/radio/radio_diaganas.cpp index 837d0f3aa..faf9072a2 100644 --- a/radio/src/gui/colorlcd/radio/radio_diaganas.cpp +++ b/radio/src/gui/colorlcd/radio/radio_diaganas.cpp @@ -35,9 +35,10 @@ #if !PORTRAIT_LCD static const lv_coord_t col_dsc[] = { - LV_GRID_FR(30), LV_GRID_FR(30), LV_GRID_FR(40), LV_GRID_FR(40), - LV_GRID_FR(40), LV_GRID_FR(30), LV_GRID_FR(30), LV_GRID_FR(40), - LV_GRID_FR(40), LV_GRID_FR(40), LV_GRID_TEMPLATE_LAST}; + LV_GRID_FR(32), LV_GRID_FR(40), LV_GRID_FR(40), LV_GRID_FR(40), LV_GRID_FR(40), + LV_GRID_FR(32), LV_GRID_FR(40), LV_GRID_FR(40), LV_GRID_FR(40), LV_GRID_FR(40), + LV_GRID_TEMPLATE_LAST +}; #else diff --git a/radio/src/gui/colorlcd/radio/radio_diagcustswitches.cpp b/radio/src/gui/colorlcd/radio/radio_diagcustswitches.cpp index e4932ee00..7c0518914 100644 --- a/radio/src/gui/colorlcd/radio/radio_diagcustswitches.cpp +++ b/radio/src/gui/colorlcd/radio/radio_diagcustswitches.cpp @@ -45,8 +45,8 @@ class RadioCustSwitchesDiagsWindow : public Window new StaticText(this, {FS_3RD_COLUMN, PAD_SMALL, 60, LV_SIZE_CONTENT}, "Led"); for (uint8_t i = 0; i < NUM_FUNCTIONS_SWITCHES; i += 1) { - coord_t y = 2 * EdgeTxStyles::PAGE_LINE_HEIGHT + - i * EdgeTxStyles::PAGE_LINE_HEIGHT; + coord_t y = 2 * EdgeTxStyles::STD_FONT_HEIGHT + + i * EdgeTxStyles::STD_FONT_HEIGHT; new StaticText(this, {10, y, LV_SIZE_CONTENT, LV_SIZE_CONTENT}, STR_CHAR_SWITCH); new StaticText(this, {25, y, LV_SIZE_CONTENT, LV_SIZE_CONTENT}, diff --git a/radio/src/gui/colorlcd/radio/radio_diagkeys.cpp b/radio/src/gui/colorlcd/radio/radio_diagkeys.cpp index 343ea4602..be303f771 100644 --- a/radio/src/gui/colorlcd/radio/radio_diagkeys.cpp +++ b/radio/src/gui/colorlcd/radio/radio_diagkeys.cpp @@ -101,22 +101,22 @@ class RadioKeyDiagsWindow : public Window auto lbl = lv_label_create(obj); lv_label_set_text(lbl, keysGetLabel(k)); - lv_obj_set_pos(lbl, 0, i * EdgeTxStyles::PAGE_LINE_HEIGHT); + lv_obj_set_pos(lbl, 0, i * EdgeTxStyles::STD_FONT_HEIGHT); lbl = lv_label_create(obj); lv_label_set_text(lbl, ""); - lv_obj_set_pos(lbl, 70, i * EdgeTxStyles::PAGE_LINE_HEIGHT); + lv_obj_set_pos(lbl, 70, i * EdgeTxStyles::STD_FONT_HEIGHT); keyValues[i] = lbl; } #if defined(ROTARY_ENCODER_NAVIGATION) && !defined(USE_HATS_AS_KEYS) auto lbl = lv_label_create(obj); lv_label_set_text(lbl, STR_ROTARY_ENCODER); - lv_obj_set_pos(lbl, 0, (i + 1) * EdgeTxStyles::PAGE_LINE_HEIGHT); + lv_obj_set_pos(lbl, 0, (i + 1) * EdgeTxStyles::STD_FONT_HEIGHT); reValue = lv_label_create(obj); lv_label_set_text(reValue, ""); - lv_obj_set_pos(reValue, 70, (i + 1) * EdgeTxStyles::PAGE_LINE_HEIGHT); + lv_obj_set_pos(reValue, 70, (i + 1) * EdgeTxStyles::STD_FONT_HEIGHT); #endif } @@ -132,7 +132,7 @@ class RadioKeyDiagsWindow : public Window if (SWITCH_EXISTS(i)) { auto lbl = lv_label_create(obj); lv_label_set_text(lbl, ""); - lv_obj_set_pos(lbl, 0, row * EdgeTxStyles::PAGE_LINE_HEIGHT); + lv_obj_set_pos(lbl, 0, row * EdgeTxStyles::STD_FONT_HEIGHT); switchValues[i] = lbl; row += 1; } @@ -160,16 +160,16 @@ class RadioKeyDiagsWindow : public Window lbl = lv_label_create(obj); formatNumberAsString(s, 10, i + 1, 0, 10, "T"); lv_label_set_text(lbl, s); - lv_obj_set_pos(lbl, 4, i * EdgeTxStyles::PAGE_LINE_HEIGHT + EdgeTxStyles::PAGE_LINE_HEIGHT); + lv_obj_set_pos(lbl, 4, i * EdgeTxStyles::STD_FONT_HEIGHT + EdgeTxStyles::STD_FONT_HEIGHT); lbl = lv_label_create(obj); lv_label_set_text(lbl, ""); - lv_obj_set_pos(lbl, 60, i * EdgeTxStyles::PAGE_LINE_HEIGHT + EdgeTxStyles::PAGE_LINE_HEIGHT); + lv_obj_set_pos(lbl, 60, i * EdgeTxStyles::STD_FONT_HEIGHT + EdgeTxStyles::STD_FONT_HEIGHT); trimValues[i * 2] = lbl; lbl = lv_label_create(obj); lv_label_set_text(lbl, ""); - lv_obj_set_pos(lbl, 75, i * EdgeTxStyles::PAGE_LINE_HEIGHT + EdgeTxStyles::PAGE_LINE_HEIGHT); + lv_obj_set_pos(lbl, 75, i * EdgeTxStyles::STD_FONT_HEIGHT + EdgeTxStyles::STD_FONT_HEIGHT); trimValues[i * 2 + 1] = lbl; } } diff --git a/radio/src/gui/colorlcd/radio/radio_hardware.cpp b/radio/src/gui/colorlcd/radio/radio_hardware.cpp index e92e1a4e4..8681390f1 100644 --- a/radio/src/gui/colorlcd/radio/radio_hardware.cpp +++ b/radio/src/gui/colorlcd/radio/radio_hardware.cpp @@ -99,12 +99,12 @@ static SetupLineDef setupLines[] = { STR_BATTERY_RANGE, [](Window* parent, coord_t x, coord_t y) { auto batMin = new NumberEdit( - parent, {x, y, RadioHardwarePage::NUM_EDIT_W, 0}, -60 + 90, g_eeGeneral.vBatMax + 29 + 90, + parent, {x, y, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, -60 + 90, g_eeGeneral.vBatMax + 29 + 90, GET_SET_WITH_OFFSET(g_eeGeneral.vBatMin, 90), PREC1); batMin->setSuffix("V"); - new StaticText(parent, {x + RadioHardwarePage::NUM_EDIT_W + PAD_SMALL, y + PAD_SMALL + 1, PAD_LARGE, EdgeTxStyles::PAGE_LINE_HEIGHT}, "-"); + new StaticText(parent, {x + EdgeTxStyles::EDIT_FLD_WIDTH_NARROW + PAD_SMALL, y + PAD_SMALL + 1, PAD_LARGE, EdgeTxStyles::STD_FONT_HEIGHT}, "-"); auto batMax = new NumberEdit( - parent, {x + RadioHardwarePage::NUM_EDIT_W + PAD_LARGE + PAD_SMALL, y, RadioHardwarePage::NUM_EDIT_W, 0}, g_eeGeneral.vBatMin - 29 + 120, 40 + 120, + parent, {x + EdgeTxStyles::EDIT_FLD_WIDTH_NARROW + PAD_LARGE + PAD_SMALL, y, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, g_eeGeneral.vBatMin - 29 + 120, 40 + 120, GET_SET_WITH_OFFSET(g_eeGeneral.vBatMax, 120), PREC1); batMax->setSuffix("V"); @@ -125,7 +125,7 @@ static SetupLineDef setupLines[] = { // Bat calibration STR_BATT_CALIB, [](Window* parent, coord_t x, coord_t y) { - new BatCalEdit(parent, {x, y, RadioHardwarePage::NUM_EDIT_W, 0}); + new BatCalEdit(parent, {x, y, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}); } }, { diff --git a/radio/src/gui/colorlcd/radio/radio_hardware.h b/radio/src/gui/colorlcd/radio/radio_hardware.h index a2bcce6aa..20dc0728b 100644 --- a/radio/src/gui/colorlcd/radio/radio_hardware.h +++ b/radio/src/gui/colorlcd/radio/radio_hardware.h @@ -32,7 +32,6 @@ class RadioHardwarePage : public PageTab void build(Window* window) override; - static LAYOUT_VAL(NUM_EDIT_W, 80, 74, LS(80)) static LAYOUT_VAL2(BTN_COLS, 4, 3) static LAYOUT_VAL2(FS_BTN_COLS, 2, 2) diff --git a/radio/src/gui/colorlcd/radio/radio_setup.cpp b/radio/src/gui/colorlcd/radio/radio_setup.cpp index 6aa7c68f3..dcf756452 100644 --- a/radio/src/gui/colorlcd/radio/radio_setup.cpp +++ b/radio/src/gui/colorlcd/radio/radio_setup.cpp @@ -76,7 +76,7 @@ class DateTimeWindow : public Window // Absolute layout for date/time setion due to slow performance // of lv_textarea in a flex layout. - static LAYOUT_VAL(DT_EDT_W, 80, 52, LS(80)) + static LAYOUT_VAL2(DT_EDT_W, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 52) static LAYOUT_VAL2(DT_Y2, PAD_TINY + EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_MEDIUM, PAD_TINY + EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_MEDIUM) protected: @@ -122,7 +122,7 @@ class DateTimeWindow : public Window m_last_tm = m_tm; // Date - new StaticText(this, rect_t{PAD_TINY, PAD_TINY + PAD_MEDIUM, SubPage::EDT_X - PAD_TINY - PAD_SMALL, EdgeTxStyles::PAGE_LINE_HEIGHT}, STR_DATE); + new StaticText(this, rect_t{PAD_TINY, PAD_TINY + PAD_MEDIUM, SubPage::EDT_X - PAD_TINY - PAD_SMALL, EdgeTxStyles::STD_FONT_HEIGHT}, STR_DATE); year = new NumberEdit( this, rect_t{SubPage::EDT_X, PAD_TINY, DT_EDT_W, 0}, 2023, 2037, [=]() -> int32_t { return TM_YEAR_BASE + m_tm.tm_year; }, @@ -154,7 +154,7 @@ class DateTimeWindow : public Window [](int32_t value) { return formatNumberAsString(value, LEADING0, 2); }); // Time - new StaticText(this, rect_t{PAD_TINY, DT_Y2 + PAD_MEDIUM, SubPage::EDT_X - PAD_TINY - PAD_SMALL, EdgeTxStyles::PAGE_LINE_HEIGHT}, STR_TIME); + new StaticText(this, rect_t{PAD_TINY, DT_Y2 + PAD_MEDIUM, SubPage::EDT_X - PAD_TINY - PAD_SMALL, EdgeTxStyles::STD_FONT_HEIGHT}, STR_TIME); hour = new NumberEdit( this, rect_t{SubPage::EDT_X, DT_Y2, DT_EDT_W, 0}, 0, 23, [=]() -> int32_t { return m_tm.tm_hour; }, @@ -226,7 +226,7 @@ static SetupLineDef soundPageSetupLines[] = { // Beeps pitch STR_BEEP_PITCH, [](Window* parent, coord_t x, coord_t y) { - auto edit = new NumberEdit(parent, rect_t{x, y, RadioSetupPage::NUM_W, 0}, 0, 300, + auto edit = new NumberEdit(parent, rect_t{x, y, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, 0, 300, GET_DEFAULT(15 * g_eeGeneral.speakerPitch), [=](int32_t newValue) { g_eeGeneral.speakerPitch = newValue / 15; @@ -270,7 +270,7 @@ static SetupLineDef varioPageSetupLines[] = { STR_PITCH_AT_ZERO, [](Window* parent, coord_t x, coord_t y) { auto edit = new NumberEdit( - parent, {x, y, RadioSetupPage::NUM_W, 0}, VARIO_FREQUENCY_ZERO - 400, VARIO_FREQUENCY_ZERO + 400, + parent, {x, y, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, VARIO_FREQUENCY_ZERO - 400, VARIO_FREQUENCY_ZERO + 400, GET_DEFAULT(VARIO_FREQUENCY_ZERO + (g_eeGeneral.varioPitch * 10)), SET_VALUE(g_eeGeneral.varioPitch, (newValue - VARIO_FREQUENCY_ZERO) / 10)); @@ -282,7 +282,7 @@ static SetupLineDef varioPageSetupLines[] = { STR_PITCH_AT_MAX, [](Window* parent, coord_t x, coord_t y) { auto edit = new NumberEdit( - parent, {x, y, RadioSetupPage::NUM_W, 0}, 900, 2500, + parent, {x, y, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, 900, 2500, GET_DEFAULT(VARIO_FREQUENCY_ZERO + (g_eeGeneral.varioPitch * 10) + VARIO_FREQUENCY_RANGE + (g_eeGeneral.varioRange * 10)), SET_VALUE( @@ -297,7 +297,7 @@ static SetupLineDef varioPageSetupLines[] = { STR_REPEAT_AT_ZERO, [](Window* parent, coord_t x, coord_t y) { auto edit = new NumberEdit( - parent, {x, y, RadioSetupPage::NUM_W, 0}, 200, 1000, + parent, {x, y, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, 200, 1000, GET_DEFAULT(VARIO_REPEAT_ZERO + (g_eeGeneral.varioRepeat * 10)), SET_VALUE(g_eeGeneral.varioRepeat, (newValue - VARIO_REPEAT_ZERO) / 10)); @@ -342,7 +342,7 @@ static SetupLineDef alarmsPageSetupLines[] = { // Battery warning STR_BATTERYWARNING, [](Window* parent, coord_t x, coord_t y) { - auto edit = new NumberEdit(parent, {x, y, RadioSetupPage::NUM_W, 0}, 30, 120, + auto edit = new NumberEdit(parent, {x, y, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, 30, 120, GET_SET_DEFAULT(g_eeGeneral.vBatWarn), PREC1); edit->setSuffix("V"); } @@ -351,7 +351,7 @@ static SetupLineDef alarmsPageSetupLines[] = { // Inactivity alarm STR_INACTIVITYALARM, [](Window* parent, coord_t x, coord_t y) { - auto edit = new NumberEdit(parent, {x, y, RadioSetupPage::NUM_W * 3 / 2, 0}, 0, 250, + auto edit = new NumberEdit(parent, {x, y, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW * 3 / 2, 0}, 0, 250, GET_SET_DEFAULT(g_eeGeneral.inactivityTimer)); edit->setDisplayHandler([=](int value) -> std::string { @@ -428,7 +428,7 @@ class BacklightPage : public SubPage // Delay backlightTimeout = setupLine(STR_BACKLIGHT_TIMER, [=](Window* parent, coord_t x, coord_t y) { auto edit = - new NumberEdit(parent, {x, y, RadioSetupPage::NUM_W, 0}, 5, 600, + new NumberEdit(parent, {x, y, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, 5, 600, GET_DEFAULT(g_eeGeneral.lightAutoOff * 5), SET_VALUE(g_eeGeneral.lightAutoOff, newValue / 5)); edit->setStep(5); @@ -536,7 +536,7 @@ static SetupLineDef gpsPageSetupLines[] = { // Timezone STR_TIMEZONE, [](Window* parent, coord_t x, coord_t y) { - auto tz = new NumberEdit(parent, {x, y, RadioSetupPage::NUM_W, 0}, minTimezone(), maxTimezone(), + auto tz = new NumberEdit(parent, {x, y, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, minTimezone(), maxTimezone(), []() { return timezoneIndex(g_eeGeneral.timezone, g_eeGeneral.timezoneMinutes); }, @@ -776,7 +776,7 @@ static SetupLineDef setupLines[] = { { STR_PWR_AUTO_OFF, [](Window* parent, coord_t x, coord_t y) { - auto edit = new NumberEdit(parent,{x, y, RadioSetupPage::NUM_W, EdgeTxStyles::UI_ELEMENT_HEIGHT}, 0, + auto edit = new NumberEdit(parent,{x, y, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, EdgeTxStyles::UI_ELEMENT_HEIGHT}, 0, 255, GET_SET_DEFAULT(g_eeGeneral.pwrOffIfInactive)); edit->setSuffix(" min"); } @@ -846,7 +846,7 @@ static SetupLineDef setupLines[] = { STR_SWITCHES_DELAY, [](Window* parent, coord_t x, coord_t y) { auto edit = - new NumberEdit(parent, {x, y, RadioSetupPage::NUM_W, 0}, 0, 100, + new NumberEdit(parent, {x, y, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, 0, 100, GET_SET_VALUE_WITH_OFFSET(g_eeGeneral.switchesDelay, 15)); edit->setDisplayHandler([](int32_t value) { return formatNumberAsString(value * 10, 0, 0, nullptr, STR_MS); diff --git a/radio/src/gui/colorlcd/radio/radio_setup.h b/radio/src/gui/colorlcd/radio/radio_setup.h index 51078756f..b8c9097f9 100644 --- a/radio/src/gui/colorlcd/radio/radio_setup.h +++ b/radio/src/gui/colorlcd/radio/radio_setup.h @@ -29,7 +29,6 @@ class RadioSetupPage: public PageTab { void build(Window * window) override; - static LAYOUT_VAL(NUM_W, 80, 80, LS(80)) static LAYOUT_VAL2(BTN_COLS, 3, 2) static LAYOUT_VAL(BTN_H, 62, 62, LS(62)) }; diff --git a/radio/src/gui/colorlcd/radio/radio_spectrum_analyser.cpp b/radio/src/gui/colorlcd/radio/radio_spectrum_analyser.cpp index f1634e2f8..5abfde52a 100644 --- a/radio/src/gui/colorlcd/radio/radio_spectrum_analyser.cpp +++ b/radio/src/gui/colorlcd/radio/radio_spectrum_analyser.cpp @@ -26,9 +26,9 @@ #define SET_DIRTY() storageDirty(EE_GENERAL) -constexpr coord_t SCALE_HEIGHT = 15; -constexpr coord_t FOOTER_HEIGHT = 32; -constexpr coord_t SPECTRUM_HEIGHT = LCD_H - EdgeTxStyles::MENU_HEADER_HEIGHT - SCALE_HEIGHT - FOOTER_HEIGHT; +LAYOUT_VAL3(VERT_SCALE, 1, 1, 1, 2) +LAYOUT_VAL(SCALE_HEIGHT, 15, 15, LS(15)) +constexpr coord_t SPECTRUM_HEIGHT = LCD_H - EdgeTxStyles::MENU_HEADER_HEIGHT - SCALE_HEIGHT - EdgeTxStyles::UI_ELEMENT_HEIGHT; coord_t getAverage(uint8_t number, const uint8_t* value) { @@ -36,7 +36,7 @@ coord_t getAverage(uint8_t number, const uint8_t* value) for (uint8_t i = 0; i < number; i++) { sum += value[i]; } - return sum / number; + return sum * VERT_SCALE / number; } class SpectrumFooterWindow : public Window @@ -53,13 +53,13 @@ class SpectrumFooterWindow : public Window // Frequency sprintf(label, "T: %dMHz", int(reusableBuffer.spectrumAnalyser.freq / 1000000)); - (new StaticText(this, rect_t{PAD_TINY, 0, FLD_W, FOOTER_HEIGHT}, label)) + (new StaticText(this, rect_t{PAD_TINY, 0, FLD_W, EdgeTxStyles::UI_ELEMENT_HEIGHT}, label)) ->padTop(PAD_MEDIUM); // Span sprintf(label, "S: %dMHz", int(reusableBuffer.spectrumAnalyser.span / 1000000)); - (new StaticText(this, rect_t{PAD_TINY + FLD_W, 0, FLD_W, FOOTER_HEIGHT}, label)) + (new StaticText(this, rect_t{PAD_TINY + FLD_W, 0, FLD_W, EdgeTxStyles::UI_ELEMENT_HEIGHT}, label)) ->padTop(PAD_MEDIUM); } else { // Frequency @@ -84,7 +84,7 @@ class SpectrumFooterWindow : public Window // Tracker auto tracker = new NumberEdit( - this, rect_t{(PAD_TINY + FLD_W) * 2, 0, FLD_W, FOOTER_HEIGHT}, + this, rect_t{(PAD_TINY + FLD_W) * 2, 0, FLD_W, EdgeTxStyles::UI_ELEMENT_HEIGHT}, (reusableBuffer.spectrumAnalyser.freq - reusableBuffer.spectrumAnalyser.span / 2) / 1000000, @@ -307,7 +307,7 @@ void RadioSpectrumAnalyser::buildBody(Window* window) new SpectrumWindow(window, {0, 0, LCD_W, SPECTRUM_HEIGHT}); new SpectrumScaleWindow(window, {0, SPECTRUM_HEIGHT, LCD_W, SCALE_HEIGHT}); new SpectrumFooterWindow( - window, {0, SPECTRUM_HEIGHT + SCALE_HEIGHT, LCD_W, FOOTER_HEIGHT}, + window, {0, SPECTRUM_HEIGHT + SCALE_HEIGHT, LCD_W, EdgeTxStyles::UI_ELEMENT_HEIGHT}, moduleIdx); } @@ -322,7 +322,7 @@ void RadioSpectrumAnalyser::checkEvents() if (x != trackX) { trackX = x; trackPts[0] = {(lv_coord_t)x, EdgeTxStyles::MENU_HEADER_HEIGHT}; - trackPts[1] = {(lv_coord_t)x, (lv_coord_t)(height() - FOOTER_HEIGHT)}; + trackPts[1] = {(lv_coord_t)x, (lv_coord_t)(height() - EdgeTxStyles::UI_ELEMENT_HEIGHT)}; lv_line_set_points(trackLine, trackPts, 2); } Page::checkEvents(); diff --git a/radio/src/gui/colorlcd/radio/radio_trainer.cpp b/radio/src/gui/colorlcd/radio/radio_trainer.cpp index 66cd83029..8f2c3e313 100644 --- a/radio/src/gui/colorlcd/radio/radio_trainer.cpp +++ b/radio/src/gui/colorlcd/radio/radio_trainer.cpp @@ -68,7 +68,7 @@ void RadioTrainerPage::build(Window* form) new Choice(line, rect_t{}, STR_TRNMODE, 0, 2, GET_SET_DEFAULT(td->mode)); new Choice(line, rect_t{}, STR_TRNCHN, 0, 3, GET_SET_DEFAULT(td->srcChn)); - auto weight = new NumberEdit(line, rect_t{0, 0, NUM_EDIT_W, 0}, -125, 125, + auto weight = new NumberEdit(line, rect_t{0, 0, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, -125, 125, GET_SET_DEFAULT(td->studWeight)); weight->setSuffix("%"); @@ -104,7 +104,7 @@ void RadioTrainerPage::build(Window* form) LV_GRID_ALIGN_CENTER, 0, 1); auto multiplier = - new NumberEdit(line, rect_t{0, 0, NUM_EDIT_W, 0}, -10, 40, + new NumberEdit(line, rect_t{0, 0, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, -10, 40, GET_SET_DEFAULT(g_eeGeneral.PPM_Multiplier)); multiplier->setDisplayHandler( [](int32_t value) { return formatNumberAsString(value + 10, PREC1); }); diff --git a/radio/src/gui/colorlcd/radio/radio_trainer.h b/radio/src/gui/colorlcd/radio/radio_trainer.h index 3328f51b0..0b7305251 100644 --- a/radio/src/gui/colorlcd/radio/radio_trainer.h +++ b/radio/src/gui/colorlcd/radio/radio_trainer.h @@ -32,6 +32,4 @@ class RadioTrainerPage : public PageTab bool isVisible() const override { return radioTrainerEnabled(); } void build(Window* window) override; - - static LAYOUT_VAL(NUM_EDIT_W, 80, 65, LS(80)) }; diff --git a/radio/src/gui/colorlcd/standalone_lua.cpp b/radio/src/gui/colorlcd/standalone_lua.cpp index 036007a6b..bec5d1023 100644 --- a/radio/src/gui/colorlcd/standalone_lua.cpp +++ b/radio/src/gui/colorlcd/standalone_lua.cpp @@ -146,7 +146,7 @@ StandaloneLuaWindow::StandaloneLuaWindow(bool useLvgl, int initFn, int runFn) : etx_txt_color(lbl, COLOR_THEME_PRIMARY2_INDEX); etx_font(lbl, FONT_XL_INDEX); lv_obj_set_style_text_align(lbl, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN); - lv_obj_set_style_pad_top(lbl, (LCD_H - EdgeTxStyles::PAGE_LINE_HEIGHT) / 2, LV_PART_MAIN); + lv_obj_set_style_pad_top(lbl, (LCD_H - EdgeTxStyles::STD_FONT_HEIGHT) / 2, LV_PART_MAIN); lv_label_set_text(lbl, STR_LOADING); } else { lcdBuffer = new BitmapBuffer(BMP_RGB565, LCD_W, LCD_H); @@ -343,7 +343,7 @@ void StandaloneLuaWindow::popupPaint(BitmapBuffer* dc, coord_t x, coord_t y, coo dc->drawSolidFilledRect(x, y + POPUP_HEADER_HEIGHT, w, h - POPUP_HEADER_HEIGHT, COLOR_THEME_SECONDARY3); - dc->drawText(x + PAD_SMALL, y + POPUP_HEADER_HEIGHT + EdgeTxStyles::PAGE_LINE_HEIGHT, info, + dc->drawText(x + PAD_SMALL, y + POPUP_HEADER_HEIGHT + EdgeTxStyles::STD_FONT_HEIGHT, info, COLOR_THEME_SECONDARY1); } diff --git a/radio/src/gui/colorlcd/widgets/radio_info.cpp b/radio/src/gui/colorlcd/widgets/radio_info.cpp index 9758f891f..5c86712f5 100644 --- a/radio/src/gui/colorlcd/widgets/radio_info.cpp +++ b/radio/src/gui/colorlcd/widgets/radio_info.cpp @@ -195,7 +195,7 @@ class RadioInfoWidget : public TopBarWidget static LAYOUT_VAL(W_AUDIO_SCALE_X, 15, 15, LS(15)) static LAYOUT_VAL(W_USB_X, 32, 32, LS(32)) static LAYOUT_VAL(W_USB_Y, 5, 5, 4) - static LAYOUT_VAL(W_LOG_X, 32, 32, LS(32)) + static constexpr coord_t W_LOG_X = W_USB_X; static LAYOUT_VAL(W_RSSI_X, 40, 40, LS(40)) static LAYOUT_VAL(W_RSSI_BAR_W, 4, 4, LS(4)) static LAYOUT_VAL(W_RSSI_BAR_H, 35, 35, LS(35)) diff --git a/radio/src/targets/horus/bootloader/boot_menu.cpp b/radio/src/targets/horus/bootloader/boot_menu.cpp index 0ff787ad2..d6abac891 100644 --- a/radio/src/targets/horus/bootloader/boot_menu.cpp +++ b/radio/src/targets/horus/bootloader/boot_menu.cpp @@ -96,7 +96,6 @@ LAYOUT_VAL(PROGRESS_H, 31, 31, LS(31)) LAYOUT_VAL(VERCHK_X, 168, 168, LS(168)) LAYOUT_VAL(VERCHK_Y, 138, 138, LS(138)) -LAYOUT_VAL(VERCHK_H, 20, 20, LS(20)) LAYOUT_VAL(VERCHK_ICN_X, 78, 78, LS(78)) extern BitmapBuffer * lcd; @@ -237,13 +236,13 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char* str) lcd->drawText(VERCHK_X, VERCHK_Y, TR_BL_FORK, RIGHT | BL_FOREGROUND); lcd->drawSizedText(VERCHK_X + PAD_MEDIUM, VERCHK_Y, tag.fork, 6, BL_FOREGROUND); - lcd->drawText(VERCHK_X, VERCHK_Y + VERCHK_H, TR_BL_VERSION, RIGHT | BL_FOREGROUND); - lcd->drawText(VERCHK_X + PAD_MEDIUM, VERCHK_Y + VERCHK_H, tag.version, BL_FOREGROUND); + lcd->drawText(VERCHK_X, VERCHK_Y + EdgeTxStyles::STD_FONT_HEIGHT, TR_BL_VERSION, RIGHT | BL_FOREGROUND); + lcd->drawText(VERCHK_X + PAD_MEDIUM, VERCHK_Y + EdgeTxStyles::STD_FONT_HEIGHT, tag.version, BL_FOREGROUND); - lcd->drawText(VERCHK_X, VERCHK_Y + VERCHK_H * 2, TR_BL_RADIO, RIGHT | BL_FOREGROUND); - lcd->drawText(VERCHK_X + PAD_MEDIUM, VERCHK_Y + VERCHK_H * 2, tag.flavour, BL_FOREGROUND); + lcd->drawText(VERCHK_X, VERCHK_Y + EdgeTxStyles::STD_FONT_HEIGHT * 2, TR_BL_RADIO, RIGHT | BL_FOREGROUND); + lcd->drawText(VERCHK_X + PAD_MEDIUM, VERCHK_Y + EdgeTxStyles::STD_FONT_HEIGHT * 2, tag.flavour, BL_FOREGROUND); - lcd->drawText(VERCHK_ICN_X, VERCHK_Y + VERCHK_H, LV_SYMBOL_OK, BL_GREEN); + lcd->drawText(VERCHK_ICN_X, VERCHK_Y + EdgeTxStyles::STD_FONT_HEIGHT, LV_SYMBOL_OK, BL_GREEN); } } }