From 180ceec5375eefb8eb1ea2fd3257f7294697fd7f Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Tue, 7 Jun 2022 07:13:22 +0200 Subject: [PATCH] Input & Mixer edit advanced: more compact screens --- radio/src/gui/colorlcd/fm_matrix.cpp | 20 +++++++++++++++----- radio/src/gui/colorlcd/input_edit_adv.cpp | 2 +- radio/src/gui/colorlcd/mixer_edit_adv.cpp | 13 +++++++++---- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/radio/src/gui/colorlcd/fm_matrix.cpp b/radio/src/gui/colorlcd/fm_matrix.cpp index a952a285e..150878c9d 100644 --- a/radio/src/gui/colorlcd/fm_matrix.cpp +++ b/radio/src/gui/colorlcd/fm_matrix.cpp @@ -26,22 +26,32 @@ template FMMatrix::FMMatrix(Window* parent, const rect_t& r, T* input) : ButtonMatrix(parent, r), input(input) { +#if LCD_W > LCD_H + initBtnMap(5, MAX_FLIGHT_MODES + 1); +#else initBtnMap(3, MAX_FLIGHT_MODES); +#endif + for (int i = 0; i < MAX_FLIGHT_MODES; i++) { setText(i, std::to_string(i).c_str()); } update(); +#if LCD_W > LCD_H + // hide last element + lv_btnmatrix_set_btn_ctrl(lvobj, MAX_FLIGHT_MODES, LV_BTNMATRIX_CTRL_HIDDEN); lv_obj_set_width(lvobj, LV_DPI_DEF * 2); + lv_obj_set_height(lvobj, LV_DPI_DEF / 2); +#else lv_obj_set_width(lvobj, LV_DPI_DEF); + lv_obj_set_height(lvobj, LV_DPI_DEF); +#endif lv_obj_set_style_bg_opa(lvobj, LV_OPA_0, LV_PART_MAIN); - lv_obj_set_style_pad_all(lvobj, 4, LV_PART_MAIN); - // lv_obj_set_style_pad_left(lvobj, LV_DPI_DEF / 10, LV_PART_MAIN); - - lv_obj_set_style_pad_row(lvobj, 4, LV_PART_MAIN); - lv_obj_set_style_pad_column(lvobj, 4, LV_PART_MAIN); + lv_obj_set_style_pad_all(lvobj, lv_dpx(4), LV_PART_MAIN); + lv_obj_set_style_pad_row(lvobj, lv_dpx(4), LV_PART_MAIN); + lv_obj_set_style_pad_column(lvobj, lv_dpx(4), LV_PART_MAIN); lv_obj_remove_style(lvobj, nullptr, LV_PART_MAIN | LV_STATE_FOCUSED); lv_obj_remove_style(lvobj, nullptr, LV_PART_MAIN | LV_STATE_EDITED); diff --git a/radio/src/gui/colorlcd/input_edit_adv.cpp b/radio/src/gui/colorlcd/input_edit_adv.cpp index 93ffb2319..fd8786a98 100644 --- a/radio/src/gui/colorlcd/input_edit_adv.cpp +++ b/radio/src/gui/colorlcd/input_edit_adv.cpp @@ -26,7 +26,7 @@ #define SET_DIRTY() storageDirty(EE_MODEL) -static const lv_coord_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), +static const lv_coord_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(2), LV_GRID_TEMPLATE_LAST}; static const lv_coord_t row_dsc[] = {LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST}; diff --git a/radio/src/gui/colorlcd/mixer_edit_adv.cpp b/radio/src/gui/colorlcd/mixer_edit_adv.cpp index 02c2b3cef..e248d6550 100644 --- a/radio/src/gui/colorlcd/mixer_edit_adv.cpp +++ b/radio/src/gui/colorlcd/mixer_edit_adv.cpp @@ -41,9 +41,17 @@ MixEditAdvanced::MixEditAdvanced(int8_t channel, uint8_t index) : buildBody(form); } -static const lv_coord_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(2), +#if LCD_W > LCD_H +static const lv_coord_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), + LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST}; static const lv_coord_t row_dsc[] = {LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST}; +#else +static const lv_coord_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), + LV_GRID_TEMPLATE_LAST}; +static const lv_coord_t row_dsc[] = {LV_GRID_CONTENT, LV_GRID_CONTENT, + LV_GRID_TEMPLATE_LAST}; +#endif void MixEditAdvanced::buildBody(FormWindow* form) { @@ -70,7 +78,6 @@ void MixEditAdvanced::buildBody(FormWindow* form) new CheckBox(line, rect_t{}, GET_SET_INVERTED(mix->carryTrim)); // Warning - line = form->newLine(&grid); new StaticText(line, rect_t{}, STR_MIXWARNING, 0, COLOR_THEME_PRIMARY1); auto edit = new NumberEdit(line, rect_t{}, 0, 3, GET_SET_DEFAULT(mix->mixWarn)); edit->setZeroText(STR_OFF); @@ -83,7 +90,6 @@ void MixEditAdvanced::buildBody(FormWindow* form) edit->setSuffix("s"); // Delay down - line = form->newLine(&grid); new StaticText(line, rect_t{}, STR_DELAYDOWN, 0, COLOR_THEME_PRIMARY1); edit = new NumberEdit(line, rect_t{}, 0, DELAY_MAX, GET_DEFAULT(mix->delayDown), @@ -98,7 +104,6 @@ void MixEditAdvanced::buildBody(FormWindow* form) edit->setSuffix("s"); // Slow down - line = form->newLine(&grid); new StaticText(line, rect_t{}, STR_SLOWDOWN, 0, COLOR_THEME_PRIMARY1); edit = new NumberEdit(line, rect_t{}, 0, DELAY_MAX, GET_DEFAULT(mix->speedDown),