diff --git a/radio/src/gui/colorlcd/model_setup.cpp b/radio/src/gui/colorlcd/model_setup.cpp index a7ed4bf6f..7927ba503 100644 --- a/radio/src/gui/colorlcd/model_setup.cpp +++ b/radio/src/gui/colorlcd/model_setup.cpp @@ -254,11 +254,17 @@ void ModelSetupPage::build(FormWindow * window) // Modules auto form = new FormGroup(window, rect_t{}); form->setFlexLayout(LV_FLEX_FLOW_ROW_WRAP, lv_dpx(8)); - lv_obj_set_style_pad_all(form->getLvObj(), lv_dpx(8), 0); + lv_obj_set_style_flex_main_place(form->getLvObj(), LV_FLEX_ALIGN_SPACE_EVENLY, 0); + form->padAll(lv_dpx(8)); - new IntmoduleButton(form); - new ExtmoduleButton(form); - new TrainerModuleButton(form); + Window* btn = new IntmoduleButton(form); + lv_obj_set_style_min_width(btn->getLvObj(), LV_DPI_DEF, 0); + + btn = new ExtmoduleButton(form); + lv_obj_set_style_min_width(btn->getLvObj(), LV_DPI_DEF, 0); + + btn = new TrainerModuleButton(form); + lv_obj_set_style_min_width(btn->getLvObj(), LV_DPI_DEF, 0); // Timer buttons form = new FormGroup(window, rect_t{}); @@ -266,24 +272,35 @@ void ModelSetupPage::build(FormWindow * window) lv_obj_set_style_flex_main_place(form->getLvObj(), LV_FLEX_ALIGN_SPACE_EVENLY, 0); form->padAll(lv_dpx(8)); - new SubScreenButton(form, TR_TIMER "1", - []() { new TimerWindow(0); }); - new SubScreenButton(form, TR_TIMER "2", - []() { new TimerWindow(1); }); - new SubScreenButton(form, TR_TIMER "3", - []() { new TimerWindow(2); }); + btn = new SubScreenButton(form, TR_TIMER "1", + []() { new TimerWindow(0); }); + lv_obj_set_style_min_width(btn->getLvObj(), LV_DPI_DEF, 0); + + btn = new SubScreenButton(form, TR_TIMER "2", + []() { new TimerWindow(1); }); + lv_obj_set_style_min_width(btn->getLvObj(), LV_DPI_DEF, 0); + + btn = new SubScreenButton(form, TR_TIMER "3", + []() { new TimerWindow(2); }); + lv_obj_set_style_min_width(btn->getLvObj(), LV_DPI_DEF, 0); + form = new FormGroup(window, rect_t{}); form->setFlexLayout(LV_FLEX_FLOW_ROW_WRAP, lv_dpx(8)); lv_obj_set_style_flex_main_place(form->getLvObj(), LV_FLEX_ALIGN_SPACE_EVENLY, 0); form->padAll(lv_dpx(8)); - new SubScreenButton(form, STR_PREFLIGHT, - []() { new PreflightChecks(); }); - new SubScreenButton(form, STR_TRIMS, - []() { new TrimsSetup(); }); - new SubScreenButton(form, STR_THROTTLE_LABEL, - []() { new ThrottleParams(); }); + btn = new SubScreenButton(form, STR_PREFLIGHT, + []() { new PreflightChecks(); }); + lv_obj_set_style_min_width(btn->getLvObj(), LV_DPI_DEF, 0); + + btn = new SubScreenButton(form, STR_TRIMS, + []() { new TrimsSetup(); }); + lv_obj_set_style_min_width(btn->getLvObj(), LV_DPI_DEF, 0); + + btn = new SubScreenButton(form, STR_THROTTLE_LABEL, + []() { new ThrottleParams(); }); + lv_obj_set_style_min_width(btn->getLvObj(), LV_DPI_DEF, 0); } #define MAX_SUBSCREEN_BTNS 9 diff --git a/radio/src/gui/colorlcd/preflight_checks.cpp b/radio/src/gui/colorlcd/preflight_checks.cpp index 6649dd557..e5b9c619f 100644 --- a/radio/src/gui/colorlcd/preflight_checks.cpp +++ b/radio/src/gui/colorlcd/preflight_checks.cpp @@ -99,13 +99,9 @@ private: PreflightChecks::PreflightChecks() : Page(ICON_MODEL_SETUP) { - new StaticText(&header, - {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, - PAGE_LINE_HEIGHT}, - STR_PREFLIGHT, 0, COLOR_THEME_PRIMARY2); + header.setTitle(STR_PREFLIGHT); - auto form = new FormWindow(&body, rect_t{0, 0, body.width(), body.height()}, - NO_FOCUS | FORM_FORWARD_FOCUS); + auto form = new FormWindow(&body, rect_t{}); form->setFlexLayout(); FlexGridLayout grid(line_col_dsc, line_row_dsc, 2); diff --git a/radio/src/gui/colorlcd/timer_setup.cpp b/radio/src/gui/colorlcd/timer_setup.cpp index 2d6200eb0..4427cb38c 100644 --- a/radio/src/gui/colorlcd/timer_setup.cpp +++ b/radio/src/gui/colorlcd/timer_setup.cpp @@ -46,61 +46,58 @@ static std::function timerValueUpdater(uint8_t timer) TimerWindow::TimerWindow(uint8_t timer) : Page(ICON_STATS_TIMERS) { std::string title = std::string(STR_TIMER) + std::to_string(timer + 1); - new StaticText(&header, - {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, - PAGE_LINE_HEIGHT}, - title, 0, COLOR_THEME_PRIMARY2); + header.setTitle(title); - body.setFlexLayout(); + auto form = new FormGroup(&body, rect_t{}); + form->setFlexLayout(); FlexGridLayout grid(line_col_dsc, line_row_dsc, 2); TimerData* p_timer = &g_model.timers[timer]; // Timer name - auto line = body.newLine(&grid); + auto line = form->newLine(&grid); new StaticText(line, rect_t{}, STR_NAME, 0, COLOR_THEME_PRIMARY1); new ModelTextEdit(line, rect_t{}, p_timer->name, LEN_TIMER_NAME); // Timer mode - line = body.newLine(&grid); + line = form->newLine(&grid); new StaticText(line, rect_t{}, STR_MODE, 0, COLOR_THEME_PRIMARY1); new Choice(line, rect_t{}, STR_TIMER_MODES, 0, TMRMODE_MAX, GET_SET_DEFAULT(p_timer->mode)); // Timer switch - line = body.newLine(&grid); + line = form->newLine(&grid); new StaticText(line, rect_t{}, STR_SWITCH, 0, COLOR_THEME_PRIMARY1); new SwitchChoice(line, rect_t{}, SWSRC_FIRST, SWSRC_LAST, GET_SET_DEFAULT(p_timer->swtch)); // Timer start value - line = body.newLine(&grid); + line = form->newLine(&grid); new StaticText(line, rect_t{}, STR_START, 0, COLOR_THEME_PRIMARY1); new TimeEdit(line, rect_t{}, 0, TIMER_MAX, GET_DEFAULT(p_timer->start), timerValueUpdater(timer)); // Timer minute beep - line = body.newLine(&grid); + line = form->newLine(&grid); new StaticText(line, rect_t{}, STR_MINUTEBEEP, 0, COLOR_THEME_PRIMARY1); new CheckBox(line, rect_t{}, GET_SET_DEFAULT(p_timer->minuteBeep)); // Timer countdown - line = body.newLine(&grid); + line = form->newLine(&grid); new StaticText(line, rect_t{}, STR_BEEPCOUNTDOWN, 0, COLOR_THEME_PRIMARY1); - auto box = new FormGroup::Line(line, window_create(line->getLvObj())); - lv_obj_set_layout(box->getLvObj(), LV_LAYOUT_FLEX); + auto box = new FormGroup(line, rect_t{}); + box->setFlexLayout(LV_FLEX_FLOW_ROW); + new Choice(box, rect_t{}, STR_VBEEPCOUNTDOWN, COUNTDOWN_SILENT, COUNTDOWN_COUNT - 1, GET_SET_DEFAULT(p_timer->countdownBeep)); new Choice(box, rect_t{}, STR_COUNTDOWNVALUES, 0, 3, GET_SET_WITH_OFFSET(p_timer->countdownStart, 2)); // Timer persistent - line = body.newLine(&grid); + line = form->newLine(&grid); new StaticText(line, rect_t{}, STR_PERSISTENT, 0, COLOR_THEME_PRIMARY1); new Choice(line, rect_t{}, STR_VPERSISTENT, 0, 2, GET_SET_DEFAULT(p_timer->persistent)); - - body.updateSize(); }