Aligned the protocol selector in multiline for narrow screen.

This commit is contained in:
Richard Li
2021-08-17 20:17:06 +08:00
parent d536bcd84a
commit 8fddcab05c
+14 -3
View File
@@ -640,10 +640,12 @@ class ModuleWindow : public FormGroup {
// Multi type (CUSTOM, brand A, brand B,...)
int multiRfProto = g_model.moduleData[moduleIdx].getMultiProtocol();
// Grid count for narrow/wide screen
int count = LCD_W < LCD_H ? 1 : (g_model.moduleData[moduleIdx].multi.customProto ? 3 : 2);
rfChoice = new Choice(
this,
grid.getFieldSlot(
g_model.moduleData[moduleIdx].multi.customProto ? 3 : 2, 0),
grid.getFieldSlot(count, 0),
STR_MULTI_PROTOCOLS, MODULE_SUBTYPE_MULTI_FIRST,
MODULE_SUBTYPE_MULTI_LAST, GET_DEFAULT(multiRfProto),
[=](int32_t newValue) {
@@ -658,11 +660,20 @@ class ModuleWindow : public FormGroup {
if (MULTIMODULE_HAS_SUBTYPE(moduleIdx)) {
// Subtype (D16, DSMX,...)
// Grid count for narrow/wide screen
count = LCD_W < LCD_H ? 1 : 2;
int index = 1;
if (count == 1)
{
grid.nextLine();
index = 0;
}
const mm_protocol_definition *pdef = getMultiProtocolDefinition(
g_model.moduleData[moduleIdx].getMultiProtocol());
if (pdef->maxSubtype > 0) {
mmSubProtocol = new Choice(
this, grid.getFieldSlot(2, 1), pdef->subTypeString, 0,
this, grid.getFieldSlot(count, index), pdef->subTypeString, 0,
pdef->maxSubtype,
[=]() { return g_model.moduleData[moduleIdx].subType; },
[=](int16_t newValue) {