Skip to content

Commit b6b5566

Browse files
author
philmoz
committed
Fix rebase.
1 parent 341ae7b commit b6b5566

File tree

5 files changed

+56
-56
lines changed

5 files changed

+56
-56
lines changed

radio/src/gui/colorlcd/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ set(GUI_SRC
6969
curveedit.cpp
7070
fm_matrix.cpp
7171
gvar_numberedit.cpp
72-
input_edit_adv.cpp
7372
input_edit.cpp
7473
input_source.cpp
7574
mixer_edit_adv.cpp

radio/src/gui/colorlcd/fm_matrix.cpp

+4-8
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@ template<class T>
2828
FMMatrix<T>::FMMatrix(Window* parent, const rect_t& r, T* input, uint8_t columns) :
2929
ButtonMatrix(parent, r), input(input)
3030
{
31-
#if LCD_W > LCD_H
32-
if (columns == 0) columns = 5;
33-
#else
34-
if (columns == 0) columns = 3;
35-
#endif
31+
if (columns == 0) columns = DEF_COLS;
3632

3733
initBtnMap(columns, MAX_FLIGHT_MODES);
3834

@@ -42,10 +38,10 @@ FMMatrix<T>::FMMatrix(Window* parent, const rect_t& r, T* input, uint8_t columns
4238

4339
update();
4440

45-
lv_obj_set_width(lvobj, columns * 51 + 3);
46-
lv_obj_set_height(lvobj, ((MAX_FLIGHT_MODES + columns- 1) / columns) * 35 + 3);
41+
lv_obj_set_width(lvobj, columns * (FM_BTN_W + 3) + 3);
42+
lv_obj_set_height(lvobj, ((MAX_FLIGHT_MODES + columns- 1) / columns) * (EdgeTxStyles::UI_ELEMENT_HEIGHT + 3) + 3);
4743

48-
padAll(PAD_SMALL);
44+
padAll(PAD_TINY);
4945
}
5046

5147
template <class T>

radio/src/gui/colorlcd/fm_matrix.h

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ struct FMMatrix : public ButtonMatrix {
3535
void setTextAndState(uint8_t btn_id);
3636

3737
static LAYOUT_VAL(FM_BTN_W, 48, 48)
38+
static LAYOUT_VAL(DEF_COLS, 5, 3)
3839
};
3940

4041
extern template struct FMMatrix<ExpoData>;

radio/src/gui/colorlcd/input_edit.cpp

+50-46
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
#include "opentx.h"
3131
#include "switches.h"
32+
#include "switchchoice.h"
3233

3334
#define SET_DIRTY() storageDirty(EE_MODEL)
3435

@@ -43,8 +44,10 @@ InputEditWindow::InputEditWindow(int8_t input, uint8_t index) :
4344
{
4445
ExpoData* inputData = expoAddress(index);
4546

46-
header.setTitle(STR_MENUINPUTS);
47-
headerSwitchName = header.setTitle2("");
47+
body->padAll(PAD_ZERO);
48+
49+
header->setTitle(STR_MENUINPUTS);
50+
headerSwitchName = header->setTitle2("");
4851

4952
lv_obj_set_style_text_color(headerSwitchName->getLvObj(), makeLvColor(COLOR_THEME_ACTIVE), LV_STATE_USER_1);
5053
lv_obj_set_style_text_font(headerSwitchName->getLvObj(), getFont(FONT(BOLD)), LV_STATE_USER_1);
@@ -54,14 +57,14 @@ InputEditWindow::InputEditWindow(int8_t input, uint8_t index) :
5457
setTitle();
5558

5659
// Outer grid form
57-
auto form = new FormWindow(&body, rect_t{});
58-
form->padAll(0);
60+
auto form = new Window(body, rect_t{});
61+
form->padAll(PAD_ZERO);
5962
form->setFlexLayout();
6063

6164
FlexGridLayout grid(col_dsc, row_dsc);
6265

63-
auto line = form->newLine(&grid);
64-
line->padAll(0);
66+
auto line = form->newLine(grid);
67+
line->padAll(PAD_ZERO);
6568

6669
#if LCD_H > LCD_W // portrait
6770
lv_obj_set_flex_flow(line->getLvObj(), LV_FLEX_FLOW_COLUMN);
@@ -71,28 +74,29 @@ InputEditWindow::InputEditWindow(int8_t input, uint8_t index) :
7174

7275
#if LCD_W > LCD_H // landscape (preview on left)
7376
// Preview grid box - force width and height
74-
auto box = new Window(line, rect_t{0, 0, INPUT_EDIT_CURVE_WIDTH + 8, body.height()});
75-
box->padAll(0);
77+
auto box = new Window(line, rect_t{0, 0, INPUT_EDIT_CURVE_WIDTH + 8, body->height()});
78+
box->padAll(PAD_ZERO);
7679

7780
// Add preview and buttons
7881
buildPreview(box, inputData);
7982
#endif
8083

8184
// Inner box for main controls - force width and height
8285
#if LCD_H > LCD_W // portrait
83-
auto box = new Window(line, rect_t{0, 0, body.width(), body.height() - INPUT_EDIT_CURVE_HEIGHT - 68});
86+
auto box = new Window(line, rect_t{0, 0, body->width(), body->height() - INPUT_EDIT_CURVE_HEIGHT - 68});
8487
#else
85-
box = new Window(line, rect_t{0, 0, body.width() - INPUT_EDIT_CURVE_WIDTH - 12, body.height()});
88+
box = new Window(line, rect_t{0, 0, body->width() - INPUT_EDIT_CURVE_WIDTH - 12, body->height()});
8689
#endif
87-
box->padAll(0);
90+
box->padAll(PAD_ZERO);
91+
etx_scrollbar(box->getLvObj());
8892

8993
// Add main controls
9094
buildBody(box, inputData);
9195

9296
#if LCD_H > LCD_W // portrait (preview below)
9397
// Preview grid box - force width and height
94-
box = new Window(line, rect_t{0, 0, body.width(), INPUT_EDIT_CURVE_HEIGHT + 62});
95-
box->padAll(0);
98+
box = new Window(line, rect_t{0, 0, body->width(), INPUT_EDIT_CURVE_HEIGHT + 62});
99+
box->padAll(PAD_ZERO);
96100

97101
// Add preview and buttons
98102
buildPreview(box, inputData);
@@ -129,7 +133,7 @@ void InputEditWindow::checkEvents()
129133
if ((ed->srcRaw == inputData->srcRaw) && getSwitch(ed->swtch)) {
130134
if (lastActiveIdx != i) {
131135
lastActiveIdx = i;
132-
preview->invalidate();
136+
preview->update();
133137
break;
134138
}
135139
}
@@ -170,74 +174,74 @@ static const lv_coord_t b_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(2), LV_GRID_TEM
170174
void InputEditWindow::buildBody(Window* box, ExpoData* inputData)
171175
{
172176
lv_obj_set_scrollbar_mode(box->getLvObj(), LV_SCROLLBAR_MODE_AUTO);
173-
auto form = new FormWindow(box, rect_t{});
174-
form->padAll(0);
177+
auto form = new Window(box, rect_t{});
178+
form->padAll(PAD_ZERO);
175179
form->setFlexLayout();
176180

177-
FlexGridLayout grid(b_col_dsc, row_dsc, 4);
181+
FlexGridLayout grid(b_col_dsc, row_dsc, PAD_SMALL);
178182

179183
// Input Name
180-
auto line = form->newLine(&grid);
184+
auto line = form->newLine(grid);
181185
auto inputName = g_model.inputNames[inputData->chn];
182-
new StaticText(line, rect_t{}, STR_INPUTNAME, 0, COLOR_THEME_PRIMARY1);
186+
new StaticText(line, rect_t{}, STR_INPUTNAME);
183187
auto nameFld = new ModelTextEdit(line, rect_t{0, 0, LCD_W*3/10-8, 0}, inputName, LEN_INPUT_NAME);
184188
nameFld->setChangeHandler([=]() {
185189
setTitle();
186190
SET_DIRTY();
187191
});
188192

189193
// Line Name
190-
line = form->newLine(&grid);
191-
new StaticText(line, rect_t{}, STR_EXPONAME, 0, COLOR_THEME_PRIMARY1);
194+
line = form->newLine(grid);
195+
new StaticText(line, rect_t{}, STR_EXPONAME);
192196
new ModelTextEdit(line, rect_t{0, 0, LCD_W*3/10-8, 0}, inputData->name, LEN_EXPOMIX_NAME);
193197

194198
// Source
195-
line = form->newLine(&grid);
196-
new StaticText(line, rect_t{}, STR_SOURCE, 0, COLOR_THEME_PRIMARY1);
199+
line = form->newLine(grid);
200+
new StaticText(line, rect_t{}, STR_SOURCE);
197201
new InputSource(line, inputData);
198202

199203
// Switch
200-
line = form->newLine(&grid);
201-
new StaticText(line, rect_t{}, STR_SWITCH, 0, COLOR_THEME_PRIMARY1);
204+
line = form->newLine(grid);
205+
new StaticText(line, rect_t{}, STR_SWITCH);
202206
new SwitchChoice(line, rect_t{}, SWSRC_FIRST_IN_MIXES, SWSRC_LAST_IN_MIXES, GET_SET_DEFAULT(inputData->swtch));
203207

204208
// Weight
205-
line = form->newLine(&grid);
206-
new StaticText(line, rect_t{}, STR_WEIGHT, 0, COLOR_THEME_PRIMARY1);
207-
auto gvar = new GVarNumberEdit(line, rect_t{}, -100, 100,
209+
line = form->newLine(grid);
210+
new StaticText(line, rect_t{}, STR_WEIGHT);
211+
auto gvar = new GVarNumberEdit(line, -100, 100,
208212
GET_DEFAULT(inputData->weight),
209213
[=](int32_t newValue) {
210214
inputData->weight = newValue;
211-
preview->invalidate();
215+
preview->update();
212216
SET_DIRTY();
213217
});
214218
gvar->setSuffix("%");
215219

216220
// Offset
217-
line = form->newLine(&grid);
218-
new StaticText(line, rect_t{}, STR_OFFSET, 0, COLOR_THEME_PRIMARY1);
219-
gvar = new GVarNumberEdit(line, rect_t{}, -100, 100,
221+
line = form->newLine(grid);
222+
new StaticText(line, rect_t{}, STR_OFFSET);
223+
gvar = new GVarNumberEdit(line, -100, 100,
220224
GET_DEFAULT(inputData->offset),
221225
[=](int32_t newValue) {
222226
inputData->offset = newValue;
223-
preview->invalidate();
227+
preview->update();
224228
SET_DIRTY();
225229
});
226230
gvar->setSuffix("%");
227231

228232
// Curve
229-
line = form->newLine(&grid);
230-
new StaticText(line, rect_t{}, STR_CURVE, 0, COLOR_THEME_PRIMARY1);
233+
line = form->newLine(grid);
234+
new StaticText(line, rect_t{}, STR_CURVE);
231235
new CurveParam(line, rect_t{}, &inputData->curve,
232236
[=](int32_t newValue) {
233237
inputData->curve.value = newValue;
234-
preview->invalidate();
238+
preview->update();
235239
SET_DIRTY();
236240
});
237241

238242
// Trim
239-
line = form->newLine(&grid);
240-
new StaticText(line, rect_t{}, STR_TRIM, 0, COLOR_THEME_PRIMARY1);
243+
line = form->newLine(grid);
244+
new StaticText(line, rect_t{}, STR_TRIM);
241245
const auto trimLast = TRIM_OFF + keysGetMaxTrims() - 1;
242246
auto c = new Choice(line, rect_t{}, -TRIM_OFF, trimLast,
243247
GET_VALUE(-inputData->trimSource),
@@ -250,8 +254,8 @@ void InputEditWindow::buildBody(Window* box, ExpoData* inputData)
250254
});
251255

252256
// Flight modes
253-
line = form->newLine(&grid);
254-
new StaticText(line, rect_t{}, STR_FLMODE, 0, COLOR_THEME_PRIMARY1);
257+
line = form->newLine(grid);
258+
new StaticText(line, rect_t{}, STR_FLMODE);
255259
new FMMatrix<ExpoData>(line, rect_t{}, inputData, 3);
256260

257261
#if LCD_W > LCD_H
@@ -266,11 +270,11 @@ void InputEditWindow::buildPreview(Window* box, ExpoData* inputData)
266270

267271
static bool showActive = true;
268272
auto aBtn = new TextButton(box, rect_t{xo, yo, INPUT_EDIT_CURVE_WIDTH, 24}, STR_SHOW_ACTIVE);
269-
aBtn->padAll(0);
273+
aBtn->padAll(PAD_ZERO);
270274
aBtn->check(showActive);
271275
aBtn->setPressHandler([=]() {
272276
showActive = !showActive;
273-
preview->invalidate();
277+
preview->update();
274278
return showActive;
275279
});
276280

@@ -287,10 +291,10 @@ void InputEditWindow::buildPreview(Window* box, ExpoData* inputData)
287291
[=]() -> int { return getValue(expoAddress(index)->srcRaw); });
288292

289293
auto sBtn1 = new TextButton(box, rect_t{xo, yo + INPUT_EDIT_CURVE_HEIGHT + 4 + 28, INPUT_EDIT_CURVE_WIDTH/2 - 4, 24}, STR_VCURVEFUNC[2]);
290-
sBtn1->padAll(0);
294+
sBtn1->padAll(PAD_ZERO);
291295

292296
auto sBtn2 = new TextButton(box, rect_t{xo + INPUT_EDIT_CURVE_WIDTH / 2 + 4, yo + INPUT_EDIT_CURVE_HEIGHT + 4 + 28, INPUT_EDIT_CURVE_WIDTH/2 -4, 24}, STR_VCURVEFUNC[1]);
293-
sBtn2->padAll(0);
297+
sBtn2->padAll(PAD_ZERO);
294298

295299
sBtn1->setPressHandler([=]() {
296300
if (sBtn1->checked()) {
@@ -301,7 +305,7 @@ void InputEditWindow::buildPreview(Window* box, ExpoData* inputData)
301305
inputData->mode = inputData->mode | 1;
302306
}
303307
SET_DIRTY();
304-
preview->invalidate();
308+
preview->update();
305309
sBtn2->check(inputData->mode & 2);
306310
return (inputData->mode & 1) != 0;
307311
});
@@ -315,7 +319,7 @@ void InputEditWindow::buildPreview(Window* box, ExpoData* inputData)
315319
inputData->mode = inputData->mode | 2;
316320
}
317321
SET_DIRTY();
318-
preview->invalidate();
322+
preview->update();
319323
sBtn1->check(inputData->mode & 1);
320324
return (inputData->mode & 2) != 0;
321325
});

radio/src/gui/colorlcd/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),

0 commit comments

Comments
 (0)