Skip to content

Commit 6c7967c

Browse files
author
Phil Mitchell
committed
Revised input edit page for color LCD radios.
1 parent eea9b85 commit 6c7967c

27 files changed

+279
-199
lines changed

radio/src/gui/colorlcd/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ set(GUI_SRC
5252
startup_shutdown.cpp
5353

5454
model/curveedit.cpp
55-
model/input_edit_adv.cpp
5655
model/input_edit.cpp
5756
model/menu_model.cpp
5857
model/mixer_edit_adv.cpp

radio/src/gui/colorlcd/controls/fm_matrix.cpp

+8-6
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,24 @@
2424
#include "opentx.h"
2525
#include "etx_lv_theme.h"
2626

27-
template <class T>
28-
FMMatrix<T>::FMMatrix(Window* parent, const rect_t& r, T* input) :
27+
template<class T>
28+
FMMatrix<T>::FMMatrix(Window* parent, const rect_t& r, T* input, uint8_t columns) :
2929
ButtonMatrix(parent, r), input(input)
3030
{
31-
initBtnMap(FM_COLS, MAX_FLIGHT_MODES);
31+
if (columns == 0) columns = DEF_COLS;
32+
33+
initBtnMap(columns, MAX_FLIGHT_MODES);
3234

3335
for (int i = 0; i < MAX_FLIGHT_MODES; i++) {
3436
setTextAndState(i);
3537
}
3638

3739
update();
3840

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

42-
padAll(PAD_SMALL);
44+
padAll(PAD_TINY);
4345
}
4446

4547
template <class T>

radio/src/gui/colorlcd/controls/fm_matrix.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,13 @@ struct MixData;
2929
template<class T>
3030
struct FMMatrix : public ButtonMatrix {
3131
T* input;
32-
FMMatrix(Window* parent, const rect_t& rect, T* input);
32+
FMMatrix(Window* parent, const rect_t& rect, T* input, uint8_t columns = 0);
3333
void onPress(uint8_t btn_id);
3434
bool isActive(uint8_t btn_id);
3535
void setTextAndState(uint8_t btn_id);
3636

3737
static LAYOUT_VAL(FM_BTN_W, 48, 48)
38-
static LAYOUT_VAL(FM_COLS, 5, 3)
39-
static LAYOUT_VAL(FM_ROWS, 2, 3)
38+
static LAYOUT_VAL(DEF_COLS, 5, 3)
4039
};
4140

4241
extern template struct FMMatrix<ExpoData>;

radio/src/gui/colorlcd/controls/input_source.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ InputSource::InputSource(Window *parent, ExpoData *input) :
9393
{
9494
padAll(PAD_TINY);
9595
lv_obj_set_flex_flow(lvobj, LV_FLEX_FLOW_COLUMN);
96-
lv_obj_set_size(lvobj, lv_pct(100), LV_SIZE_CONTENT);
96+
lv_obj_set_size(lvobj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
9797

9898
new SourceChoice(
9999
this, rect_t{}, INPUTSRC_FIRST, INPUTSRC_LAST, GET_DEFAULT(input->srcRaw),

radio/src/gui/colorlcd/libui/button_matrix.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ static void btnmatrix_constructor(const lv_obj_class_t* class_p, lv_obj_t* obj)
3030

3131
etx_bg_color(obj, COLOR_THEME_FOCUS_INDEX, LV_PART_MAIN | LV_STATE_FOCUSED);
3232

33-
etx_std_style(obj, LV_PART_ITEMS, PAD_LARGE);
33+
etx_std_style(obj, LV_PART_ITEMS, PAD_ZERO);
3434

3535
etx_obj_add_style(obj, styles->border_color[COLOR_THEME_FOCUS_INDEX],
3636
LV_PART_ITEMS | LV_STATE_EDITED);

0 commit comments

Comments
 (0)