Skip to content

Commit

Permalink
Revised input edit page for color LCD radios.
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Mitchell committed Aug 9, 2024
1 parent eea9b85 commit 6c7967c
Show file tree
Hide file tree
Showing 27 changed files with 279 additions and 199 deletions.
1 change: 0 additions & 1 deletion radio/src/gui/colorlcd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ set(GUI_SRC
startup_shutdown.cpp

model/curveedit.cpp
model/input_edit_adv.cpp
model/input_edit.cpp
model/menu_model.cpp
model/mixer_edit_adv.cpp
Expand Down
14 changes: 8 additions & 6 deletions radio/src/gui/colorlcd/controls/fm_matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,24 @@
#include "opentx.h"
#include "etx_lv_theme.h"

template <class T>
FMMatrix<T>::FMMatrix(Window* parent, const rect_t& r, T* input) :
template<class T>
FMMatrix<T>::FMMatrix(Window* parent, const rect_t& r, T* input, uint8_t columns) :
ButtonMatrix(parent, r), input(input)
{
initBtnMap(FM_COLS, MAX_FLIGHT_MODES);
if (columns == 0) columns = DEF_COLS;

initBtnMap(columns, MAX_FLIGHT_MODES);

for (int i = 0; i < MAX_FLIGHT_MODES; i++) {
setTextAndState(i);
}

update();

lv_obj_set_width(lvobj, FM_COLS * (FM_BTN_W + PAD_TINY) + PAD_TINY);
lv_obj_set_height(lvobj, FM_ROWS * (EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_TINY) + PAD_TINY);
lv_obj_set_width(lvobj, columns * (FM_BTN_W + PAD_TINY) + PAD_TINY);
lv_obj_set_height(lvobj, ((MAX_FLIGHT_MODES + columns - 1) / columns) * (EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_TINY) + PAD_TINY);

padAll(PAD_SMALL);
padAll(PAD_TINY);
}

template <class T>
Expand Down
5 changes: 2 additions & 3 deletions radio/src/gui/colorlcd/controls/fm_matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@ struct MixData;
template<class T>
struct FMMatrix : public ButtonMatrix {
T* input;
FMMatrix(Window* parent, const rect_t& rect, T* input);
FMMatrix(Window* parent, const rect_t& rect, T* input, uint8_t columns = 0);
void onPress(uint8_t btn_id);
bool isActive(uint8_t btn_id);
void setTextAndState(uint8_t btn_id);

static LAYOUT_VAL(FM_BTN_W, 48, 48)
static LAYOUT_VAL(FM_COLS, 5, 3)
static LAYOUT_VAL(FM_ROWS, 2, 3)
static LAYOUT_VAL(DEF_COLS, 5, 3)
};

extern template struct FMMatrix<ExpoData>;
Expand Down
2 changes: 1 addition & 1 deletion radio/src/gui/colorlcd/controls/input_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ InputSource::InputSource(Window *parent, ExpoData *input) :
{
padAll(PAD_TINY);
lv_obj_set_flex_flow(lvobj, LV_FLEX_FLOW_COLUMN);
lv_obj_set_size(lvobj, lv_pct(100), LV_SIZE_CONTENT);
lv_obj_set_size(lvobj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);

new SourceChoice(
this, rect_t{}, INPUTSRC_FIRST, INPUTSRC_LAST, GET_DEFAULT(input->srcRaw),
Expand Down
2 changes: 1 addition & 1 deletion radio/src/gui/colorlcd/libui/button_matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static void btnmatrix_constructor(const lv_obj_class_t* class_p, lv_obj_t* obj)

etx_bg_color(obj, COLOR_THEME_FOCUS_INDEX, LV_PART_MAIN | LV_STATE_FOCUSED);

etx_std_style(obj, LV_PART_ITEMS, PAD_LARGE);
etx_std_style(obj, LV_PART_ITEMS, PAD_ZERO);

etx_obj_add_style(obj, styles->border_color[COLOR_THEME_FOCUS_INDEX],
LV_PART_ITEMS | LV_STATE_EDITED);
Expand Down
Loading

0 comments on commit 6c7967c

Please sign in to comment.