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';
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);
auto b = new TextButton(
@@ -126,6 +127,16 @@ void RadioToolsPage::rebuild(FormWindow * window)
},
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();
}
}
@@ -134,61 +145,166 @@ void RadioToolsPage::rebuild(FormWindow * window)
#if defined(INTERNAL_MODULE_PXX2)
// PXX2 modules tools
if (isPXX2ModuleOptionAvailable(reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE].information.modelID, MODULE_OPTION_SPECTRUM_ANALYSER)) {
new StaticText(window, grid.getLabelSlot(), "access", BUTTON_BACKGROUND, CENTERED);
new TextButton(window, grid.getFieldSlot(1), STR_SPECTRUM_ANALYSER_INT, [=]() -> uint8_t {
new RadioSpectrumAnalyser(INTERNAL_MODULE);
return 0;
}, 0);
if (isPXX2ModuleOptionAvailable(
reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE]
.information.modelID,
MODULE_OPTION_SPECTRUM_ANALYSER)) {
auto txt = new StaticText(window, grid.getLabelSlot(), "access", BUTTON_BACKGROUND,
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();
}
if (isPXX2ModuleOptionAvailable(reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE].information.modelID, MODULE_OPTION_POWER_METER)) {
new StaticText(window, grid.getLabelSlot(), "access", BUTTON_BACKGROUND, CENTERED);
new TextButton(window, grid.getFieldSlot(1), STR_POWER_METER_INT, [=]() -> uint8_t {
// new RadioPowerMeter(INTERNAL_MODULE);
return 0;
}, 0);
if (isPXX2ModuleOptionAvailable(
reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE]
.information.modelID,
MODULE_OPTION_POWER_METER)) {
auto txt = new StaticText(window, grid.getLabelSlot(), "access",
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();
}
#endif
#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 {
new RadioSpectrumAnalyser(INTERNAL_MODULE);
return 0;
}, 0);
grid.nextLine();
{
auto txt = new StaticText(window, grid.getLabelSlot(), "multi",
BUTTON_BACKGROUND, 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();
}
#endif
#if defined(PXX2)|| defined(MULTIMODULE)
if (isPXX2ModuleOptionAvailable(reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE].information.modelID, MODULE_OPTION_SPECTRUM_ANALYSER) || isModuleMultimodule(EXTERNAL_MODULE)) {
new StaticText(window, grid.getLabelSlot(), isModuleMultimodule(EXTERNAL_MODULE) ? "multi" : "access", BUTTON_BACKGROUND, CENTERED);
new TextButton(window, grid.getFieldSlot(1), STR_SPECTRUM_ANALYSER_EXT, [=]() -> uint8_t {
new RadioSpectrumAnalyser(EXTERNAL_MODULE);
return 0;
}, 0);
if (isPXX2ModuleOptionAvailable(
reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE]
.information.modelID,
MODULE_OPTION_SPECTRUM_ANALYSER) ||
isModuleMultimodule(EXTERNAL_MODULE)) {
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();
}
#endif
#if defined(PXX2)
if (isPXX2ModuleOptionAvailable(reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE].information.modelID, MODULE_OPTION_POWER_METER)) {
new StaticText(window, grid.getLabelSlot(), "access", BUTTON_BACKGROUND, CENTERED);
new TextButton(window, grid.getFieldSlot(1), STR_POWER_METER_EXT, [=]() -> uint8_t {
// new RadioPowerMeter(EXTERNAL_MODULE);
return 0;
}, 0);
if (isPXX2ModuleOptionAvailable(
reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE]
.information.modelID,
MODULE_OPTION_POWER_METER)) {
auto txt = new StaticText(window, grid.getLabelSlot(), "access",
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();
}
#endif
#if defined(GHOST)
if (isModuleGhost(EXTERNAL_MODULE)) {
new StaticText(window, grid.getLabelSlot(), "ghost", BUTTON_BACKGROUND, CENTERED);
new TextButton(window, grid.getFieldSlot(1), "Ghost module config", [=]() -> uint8_t {
new RadioGhostModuleConfig(EXTERNAL_MODULE);
return 0;
}, 0);
auto txt = new StaticText(window, grid.getLabelSlot(), "ghost",
BUTTON_BACKGROUND, CENTERED);
auto b = new TextButton(
window, grid.getFieldSlot(1), "Ghost module config",
[=]() -> 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();
}
#endif