Fixed TOOLS according to style guidelines

This commit is contained in:
Raphael Coeffic
2021-06-14 11:15:25 +02:00
parent 7bb8254197
commit a535bfea18
+153 -37
View File
@@ -112,7 +112,8 @@ void RadioToolsPage::rebuild(FormWindow * window)
*ext = '\0'; *ext = '\0';
label = getBasename(path); label = getBasename(path);
} }
new StaticText(window, grid.getLabelSlot(), "lua", BUTTON_BACKGROUND, CENTERED); auto txt = new StaticText(window, grid.getLabelSlot(), "lua",
BUTTON_BACKGROUND, CENTERED);
std::string path_str(path); std::string path_str(path);
auto b = new TextButton( auto b = new TextButton(
@@ -126,6 +127,16 @@ void RadioToolsPage::rebuild(FormWindow * window)
}, },
OPAQUE); OPAQUE);
b->setBgColorHandler([=]() -> LcdFlags { return FIELD_BGCOLOR; }); b->setBgColorHandler([=]() -> LcdFlags { return FIELD_BGCOLOR; });
b->setFocusHandler([=](bool focus) {
if (focus) {
txt->setBackgroundColor(FOCUS_BGCOLOR);
txt->setTextFlags(FOCUS_COLOR | CENTERED);
} else {
txt->setBackgroundColor(FIELD_FRAME_COLOR);
txt->setTextFlags(CENTERED);
}
txt->invalidate();
});
grid.nextLine(); grid.nextLine();
} }
} }
@@ -134,61 +145,166 @@ void RadioToolsPage::rebuild(FormWindow * window)
#if defined(INTERNAL_MODULE_PXX2) #if defined(INTERNAL_MODULE_PXX2)
// PXX2 modules tools // PXX2 modules tools
if (isPXX2ModuleOptionAvailable(reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE].information.modelID, MODULE_OPTION_SPECTRUM_ANALYSER)) { if (isPXX2ModuleOptionAvailable(
new StaticText(window, grid.getLabelSlot(), "access", BUTTON_BACKGROUND, CENTERED); reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE]
new TextButton(window, grid.getFieldSlot(1), STR_SPECTRUM_ANALYSER_INT, [=]() -> uint8_t { .information.modelID,
new RadioSpectrumAnalyser(INTERNAL_MODULE); MODULE_OPTION_SPECTRUM_ANALYSER)) {
return 0; auto txt = new StaticText(window, grid.getLabelSlot(), "access", BUTTON_BACKGROUND,
}, 0); CENTERED);
auto b = new TextButton(
window, grid.getFieldSlot(1), STR_SPECTRUM_ANALYSER_INT,
[=]() -> uint8_t {
new RadioSpectrumAnalyser(INTERNAL_MODULE);
return 0;
},
OPAQUE);
b->setBgColorHandler([=]() -> LcdFlags { return FIELD_BGCOLOR; });
b->setFocusHandler([=](bool focus) {
if (focus) {
txt->setBackgroundColor(FOCUS_BGCOLOR);
txt->setTextFlags(FOCUS_COLOR | CENTERED);
} else {
txt->setBackgroundColor(FIELD_FRAME_COLOR);
txt->setTextFlags(CENTERED);
}
txt->invalidate();
});
grid.nextLine(); grid.nextLine();
} }
if (isPXX2ModuleOptionAvailable(reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE].information.modelID, MODULE_OPTION_POWER_METER)) { if (isPXX2ModuleOptionAvailable(
new StaticText(window, grid.getLabelSlot(), "access", BUTTON_BACKGROUND, CENTERED); reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE]
new TextButton(window, grid.getFieldSlot(1), STR_POWER_METER_INT, [=]() -> uint8_t { .information.modelID,
// new RadioPowerMeter(INTERNAL_MODULE); MODULE_OPTION_POWER_METER)) {
return 0; auto txt = new StaticText(window, grid.getLabelSlot(), "access",
}, 0); BUTTON_BACKGROUND, CENTERED);
auto b = new TextButton(
window, grid.getFieldSlot(1), STR_POWER_METER_INT,
[=]() -> uint8_t {
// new RadioPowerMeter(INTERNAL_MODULE);
return 0;
},
OPAQUE);
b->setBgColorHandler([=]() -> LcdFlags { return FIELD_BGCOLOR; });
b->setFocusHandler([=](bool focus) {
if (focus) {
txt->setBackgroundColor(FOCUS_BGCOLOR);
txt->setTextFlags(FOCUS_COLOR | CENTERED);
} else {
txt->setBackgroundColor(FIELD_FRAME_COLOR);
txt->setTextFlags(CENTERED);
}
txt->invalidate();
});
grid.nextLine(); grid.nextLine();
} }
#endif #endif
#if defined(INTERNAL_MODULE_MULTI) #if defined(INTERNAL_MODULE_MULTI)
new StaticText(window, grid.getLabelSlot(), "multi", BUTTON_BACKGROUND, CENTERED); {
new TextButton(window, grid.getFieldSlot(1), STR_SPECTRUM_ANALYSER_INT, [=]() -> uint8_t { auto txt = new StaticText(window, grid.getLabelSlot(), "multi",
new RadioSpectrumAnalyser(INTERNAL_MODULE); BUTTON_BACKGROUND, CENTERED);
return 0; auto b = new TextButton(
}, 0); window, grid.getFieldSlot(1), STR_SPECTRUM_ANALYSER_INT,
grid.nextLine(); [=]() -> uint8_t {
new RadioSpectrumAnalyser(INTERNAL_MODULE);
return 0;
},
OPAQUE);
b->setBgColorHandler([=]() -> LcdFlags { return FIELD_BGCOLOR; });
b->setFocusHandler([=](bool focus) {
if (focus) {
txt->setBackgroundColor(FOCUS_BGCOLOR);
txt->setTextFlags(FOCUS_COLOR | CENTERED);
} else {
txt->setBackgroundColor(FIELD_FRAME_COLOR);
txt->setTextFlags(CENTERED);
}
txt->invalidate();
});
grid.nextLine();
}
#endif #endif
#if defined(PXX2)|| defined(MULTIMODULE) #if defined(PXX2)|| defined(MULTIMODULE)
if (isPXX2ModuleOptionAvailable(reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE].information.modelID, MODULE_OPTION_SPECTRUM_ANALYSER) || isModuleMultimodule(EXTERNAL_MODULE)) { if (isPXX2ModuleOptionAvailable(
new StaticText(window, grid.getLabelSlot(), isModuleMultimodule(EXTERNAL_MODULE) ? "multi" : "access", BUTTON_BACKGROUND, CENTERED); reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE]
new TextButton(window, grid.getFieldSlot(1), STR_SPECTRUM_ANALYSER_EXT, [=]() -> uint8_t { .information.modelID,
new RadioSpectrumAnalyser(EXTERNAL_MODULE); MODULE_OPTION_SPECTRUM_ANALYSER) ||
return 0; isModuleMultimodule(EXTERNAL_MODULE)) {
}, 0); auto txt = new StaticText(window, grid.getLabelSlot(),
isModuleMultimodule(EXTERNAL_MODULE) ? "multi" : "access",
BUTTON_BACKGROUND, CENTERED);
auto b = new TextButton(
window, grid.getFieldSlot(1), STR_SPECTRUM_ANALYSER_EXT,
[=]() -> uint8_t {
new RadioSpectrumAnalyser(EXTERNAL_MODULE);
return 0;
},
OPAQUE);
b->setBgColorHandler([=]() -> LcdFlags { return FIELD_BGCOLOR; });
b->setFocusHandler([=](bool focus) {
if (focus) {
txt->setBackgroundColor(FOCUS_BGCOLOR);
txt->setTextFlags(FOCUS_COLOR | CENTERED);
} else {
txt->setBackgroundColor(FIELD_FRAME_COLOR);
txt->setTextFlags(CENTERED);
}
txt->invalidate();
});
grid.nextLine(); grid.nextLine();
} }
#endif #endif
#if defined(PXX2) #if defined(PXX2)
if (isPXX2ModuleOptionAvailable(reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE].information.modelID, MODULE_OPTION_POWER_METER)) { if (isPXX2ModuleOptionAvailable(
new StaticText(window, grid.getLabelSlot(), "access", BUTTON_BACKGROUND, CENTERED); reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE]
new TextButton(window, grid.getFieldSlot(1), STR_POWER_METER_EXT, [=]() -> uint8_t { .information.modelID,
// new RadioPowerMeter(EXTERNAL_MODULE); MODULE_OPTION_POWER_METER)) {
return 0; auto txt = new StaticText(window, grid.getLabelSlot(), "access",
}, 0); BUTTON_BACKGROUND, CENTERED);
auto b = new TextButton(
window, grid.getFieldSlot(1), STR_POWER_METER_EXT,
[=]() -> uint8_t {
// new RadioPowerMeter(EXTERNAL_MODULE);
return 0;
},
OPAQUE);
b->setBgColorHandler([=]() -> LcdFlags { return FIELD_BGCOLOR; });
b->setFocusHandler([=](bool focus) {
if (focus) {
txt->setBackgroundColor(FOCUS_BGCOLOR);
txt->setTextFlags(FOCUS_COLOR | CENTERED);
} else {
txt->setBackgroundColor(FIELD_FRAME_COLOR);
txt->setTextFlags(CENTERED);
}
txt->invalidate();
});
grid.nextLine(); grid.nextLine();
} }
#endif #endif
#if defined(GHOST) #if defined(GHOST)
if (isModuleGhost(EXTERNAL_MODULE)) { if (isModuleGhost(EXTERNAL_MODULE)) {
new StaticText(window, grid.getLabelSlot(), "ghost", BUTTON_BACKGROUND, CENTERED); auto txt = new StaticText(window, grid.getLabelSlot(), "ghost",
new TextButton(window, grid.getFieldSlot(1), "Ghost module config", [=]() -> uint8_t { BUTTON_BACKGROUND, CENTERED);
new RadioGhostModuleConfig(EXTERNAL_MODULE); auto b = new TextButton(
return 0; window, grid.getFieldSlot(1), "Ghost module config",
}, 0); [=]() -> uint8_t {
new RadioGhostModuleConfig(EXTERNAL_MODULE);
return 0;
},
OPAQUE);
b->setBgColorHandler([=]() -> LcdFlags { return FIELD_BGCOLOR; });
b->setFocusHandler([=](bool focus) {
if (focus) {
txt->setBackgroundColor(FOCUS_BGCOLOR);
txt->setTextFlags(FOCUS_COLOR | CENTERED);
} else {
txt->setBackgroundColor(FIELD_FRAME_COLOR);
txt->setTextFlags(CENTERED);
}
txt->invalidate();
});
grid.nextLine(); grid.nextLine();
} }
#endif #endif