Make SYS Tools Lua entries larger for easier touch (#1265)
fixed 376 by making each line 10 pixels higher.
This commit is contained in:
@@ -84,12 +84,47 @@ inline bool LuaScript_compare_nocase(LuaScript first, LuaScript second)
|
|||||||
return strcasecmp(first.label.c_str(), second.label.c_str()) < 0;
|
return strcasecmp(first.label.c_str(), second.label.c_str()) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void buildLuaUi(std::vector<LuaScript> luaScripts, FormWindow *window, FormGridLayout &grid)
|
class FormGridLayoutEx : public FormGridLayout
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using FormGridLayout::FormGridLayout;
|
||||||
|
|
||||||
|
void setLineHeight(uint8_t lineHeight)
|
||||||
|
{
|
||||||
|
_lineHeight = lineHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
rect_t getFieldSlot(uint8_t count = 1, uint8_t index = 0) const
|
||||||
|
{
|
||||||
|
auto rect = FormGridLayout::getFieldSlot(count, index);
|
||||||
|
rect.h = _lineHeight;
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
rect_t getLabelSlot(bool indent = false) const
|
||||||
|
{
|
||||||
|
auto rect = FormGridLayout::getLabelSlot(indent);
|
||||||
|
rect.h = _lineHeight;
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nextLine(coord_t height=PAGE_LINE_HEIGHT)
|
||||||
|
{
|
||||||
|
if (height == PAGE_LINE_HEIGHT)
|
||||||
|
height = _lineHeight;
|
||||||
|
spacer(height + PAGE_LINE_SPACING);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
uint8_t _lineHeight = PAGE_LINE_HEIGHT;
|
||||||
|
};
|
||||||
|
|
||||||
|
void buildLuaUi(std::vector<LuaScript> luaScripts, FormWindow *window, FormGridLayoutEx &grid)
|
||||||
{
|
{
|
||||||
for (auto luaScript : luaScripts) {
|
for (auto luaScript : luaScripts) {
|
||||||
auto txt = new StaticText(window, grid.getLabelSlot(), "lua",
|
auto txt =
|
||||||
BUTTON_BACKGROUND, COLOR_THEME_PRIMARY1 | CENTERED);
|
new StaticText(window, grid.getLabelSlot(), "lua", BUTTON_BACKGROUND,
|
||||||
|
COLOR_THEME_PRIMARY1 | CENTERED | VCENTERED);
|
||||||
auto b = new TextButton(
|
auto b = new TextButton(
|
||||||
window, grid.getFieldSlot(1), luaScript.label,
|
window, grid.getFieldSlot(1), luaScript.label,
|
||||||
[window, luaScript]() -> uint8_t {
|
[window, luaScript]() -> uint8_t {
|
||||||
@@ -111,10 +146,10 @@ void buildLuaUi(std::vector<LuaScript> luaScripts, FormWindow *window, FormGridL
|
|||||||
b->setFocusHandler([=](bool focus) {
|
b->setFocusHandler([=](bool focus) {
|
||||||
if (focus) {
|
if (focus) {
|
||||||
txt->setBackgroundColor(COLOR_THEME_FOCUS);
|
txt->setBackgroundColor(COLOR_THEME_FOCUS);
|
||||||
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
|
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED | VCENTERED);
|
||||||
} else {
|
} else {
|
||||||
txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
|
txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
|
||||||
txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED);
|
txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED | VCENTERED);
|
||||||
}
|
}
|
||||||
txt->invalidate();
|
txt->invalidate();
|
||||||
});
|
});
|
||||||
@@ -122,9 +157,11 @@ void buildLuaUi(std::vector<LuaScript> luaScripts, FormWindow *window, FormGridL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RadioToolsPage::rebuild(FormWindow * window)
|
void RadioToolsPage::rebuild(FormWindow * window)
|
||||||
{
|
{
|
||||||
FormGridLayout grid;
|
FormGridLayoutEx grid;
|
||||||
|
grid.setLineHeight(PAGE_LINE_HEIGHT + 10);
|
||||||
grid.spacer(PAGE_PADDING);
|
grid.spacer(PAGE_PADDING);
|
||||||
grid.setLabelWidth(100);
|
grid.setLabelWidth(100);
|
||||||
|
|
||||||
@@ -181,8 +218,9 @@ void RadioToolsPage::rebuild(FormWindow * window)
|
|||||||
reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE]
|
reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE]
|
||||||
.information.modelID,
|
.information.modelID,
|
||||||
MODULE_OPTION_SPECTRUM_ANALYSER)) {
|
MODULE_OPTION_SPECTRUM_ANALYSER)) {
|
||||||
auto txt = new StaticText(window, grid.getLabelSlot(), "access", BUTTON_BACKGROUND,
|
auto txt =
|
||||||
COLOR_THEME_PRIMARY1 | CENTERED);
|
new StaticText(window, grid.getLabelSlot(), "access", BUTTON_BACKGROUND,
|
||||||
|
COLOR_THEME_PRIMARY1 | CENTERED | VCENTERED);
|
||||||
auto b = new TextButton(
|
auto b = new TextButton(
|
||||||
window, grid.getFieldSlot(1), STR_SPECTRUM_ANALYSER_INT,
|
window, grid.getFieldSlot(1), STR_SPECTRUM_ANALYSER_INT,
|
||||||
[=]() -> uint8_t {
|
[=]() -> uint8_t {
|
||||||
@@ -194,10 +232,10 @@ void RadioToolsPage::rebuild(FormWindow * window)
|
|||||||
b->setFocusHandler([=](bool focus) {
|
b->setFocusHandler([=](bool focus) {
|
||||||
if (focus) {
|
if (focus) {
|
||||||
txt->setBackgroundColor(COLOR_THEME_FOCUS);
|
txt->setBackgroundColor(COLOR_THEME_FOCUS);
|
||||||
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
|
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED | VCENTERED);
|
||||||
} else {
|
} else {
|
||||||
txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
|
txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
|
||||||
txt->setTextFlags(CENTERED);
|
txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED | VCENTERED);
|
||||||
}
|
}
|
||||||
txt->invalidate();
|
txt->invalidate();
|
||||||
});
|
});
|
||||||
@@ -208,8 +246,9 @@ void RadioToolsPage::rebuild(FormWindow * window)
|
|||||||
reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE]
|
reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE]
|
||||||
.information.modelID,
|
.information.modelID,
|
||||||
MODULE_OPTION_POWER_METER)) {
|
MODULE_OPTION_POWER_METER)) {
|
||||||
auto txt = new StaticText(window, grid.getLabelSlot(), "access",
|
auto txt =
|
||||||
BUTTON_BACKGROUND, COLOR_THEME_PRIMARY1 | CENTERED);
|
new StaticText(window, grid.getLabelSlot(), "access", BUTTON_BACKGROUND,
|
||||||
|
COLOR_THEME_PRIMARY1 | CENTERED | VCENTERED);
|
||||||
auto b = new TextButton(
|
auto b = new TextButton(
|
||||||
window, grid.getFieldSlot(1), STR_POWER_METER_INT,
|
window, grid.getFieldSlot(1), STR_POWER_METER_INT,
|
||||||
[=]() -> uint8_t {
|
[=]() -> uint8_t {
|
||||||
@@ -221,10 +260,10 @@ void RadioToolsPage::rebuild(FormWindow * window)
|
|||||||
b->setFocusHandler([=](bool focus) {
|
b->setFocusHandler([=](bool focus) {
|
||||||
if (focus) {
|
if (focus) {
|
||||||
txt->setBackgroundColor(COLOR_THEME_FOCUS);
|
txt->setBackgroundColor(COLOR_THEME_FOCUS);
|
||||||
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
|
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED | VCENTERED);
|
||||||
} else {
|
} else {
|
||||||
txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
|
txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
|
||||||
txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED);
|
txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED | VCENTERED);
|
||||||
}
|
}
|
||||||
txt->invalidate();
|
txt->invalidate();
|
||||||
});
|
});
|
||||||
@@ -233,8 +272,9 @@ void RadioToolsPage::rebuild(FormWindow * window)
|
|||||||
#endif
|
#endif
|
||||||
#if defined(INTERNAL_MODULE_MULTI)
|
#if defined(INTERNAL_MODULE_MULTI)
|
||||||
{
|
{
|
||||||
auto txt = new StaticText(window, grid.getLabelSlot(), "multi",
|
auto txt =
|
||||||
BUTTON_BACKGROUND, COLOR_THEME_PRIMARY1 | CENTERED);
|
new StaticText(window, grid.getLabelSlot(), "multi", BUTTON_BACKGROUND,
|
||||||
|
COLOR_THEME_PRIMARY1 | CENTERED | VCENTERED);
|
||||||
auto b = new TextButton(
|
auto b = new TextButton(
|
||||||
window, grid.getFieldSlot(1), STR_SPECTRUM_ANALYSER_INT,
|
window, grid.getFieldSlot(1), STR_SPECTRUM_ANALYSER_INT,
|
||||||
[=]() -> uint8_t {
|
[=]() -> uint8_t {
|
||||||
@@ -246,10 +286,10 @@ void RadioToolsPage::rebuild(FormWindow * window)
|
|||||||
b->setFocusHandler([=](bool focus) {
|
b->setFocusHandler([=](bool focus) {
|
||||||
if (focus) {
|
if (focus) {
|
||||||
txt->setBackgroundColor(COLOR_THEME_FOCUS);
|
txt->setBackgroundColor(COLOR_THEME_FOCUS);
|
||||||
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
|
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED | VCENTERED);
|
||||||
} else {
|
} else {
|
||||||
txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
|
txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
|
||||||
txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED);
|
txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED | VCENTERED);
|
||||||
}
|
}
|
||||||
txt->invalidate();
|
txt->invalidate();
|
||||||
});
|
});
|
||||||
@@ -262,9 +302,10 @@ void RadioToolsPage::rebuild(FormWindow * window)
|
|||||||
.information.modelID,
|
.information.modelID,
|
||||||
MODULE_OPTION_SPECTRUM_ANALYSER) ||
|
MODULE_OPTION_SPECTRUM_ANALYSER) ||
|
||||||
isModuleMultimodule(EXTERNAL_MODULE)) {
|
isModuleMultimodule(EXTERNAL_MODULE)) {
|
||||||
auto txt = new StaticText(window, grid.getLabelSlot(),
|
auto txt = new StaticText(
|
||||||
isModuleMultimodule(EXTERNAL_MODULE) ? "multi" : "access",
|
window, grid.getLabelSlot(),
|
||||||
BUTTON_BACKGROUND, COLOR_THEME_PRIMARY1 | CENTERED);
|
isModuleMultimodule(EXTERNAL_MODULE) ? "multi" : "access",
|
||||||
|
BUTTON_BACKGROUND, COLOR_THEME_PRIMARY1 | CENTERED | VCENTERED);
|
||||||
auto b = new TextButton(
|
auto b = new TextButton(
|
||||||
window, grid.getFieldSlot(1), STR_SPECTRUM_ANALYSER_EXT,
|
window, grid.getFieldSlot(1), STR_SPECTRUM_ANALYSER_EXT,
|
||||||
[=]() -> uint8_t {
|
[=]() -> uint8_t {
|
||||||
@@ -276,10 +317,10 @@ void RadioToolsPage::rebuild(FormWindow * window)
|
|||||||
b->setFocusHandler([=](bool focus) {
|
b->setFocusHandler([=](bool focus) {
|
||||||
if (focus) {
|
if (focus) {
|
||||||
txt->setBackgroundColor(COLOR_THEME_FOCUS);
|
txt->setBackgroundColor(COLOR_THEME_FOCUS);
|
||||||
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
|
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED | VCENTERED);
|
||||||
} else {
|
} else {
|
||||||
txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
|
txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
|
||||||
txt->setTextFlags(CENTERED);
|
txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED | VCENTERED);
|
||||||
}
|
}
|
||||||
txt->invalidate();
|
txt->invalidate();
|
||||||
});
|
});
|
||||||
@@ -292,8 +333,9 @@ void RadioToolsPage::rebuild(FormWindow * window)
|
|||||||
reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE]
|
reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE]
|
||||||
.information.modelID,
|
.information.modelID,
|
||||||
MODULE_OPTION_POWER_METER)) {
|
MODULE_OPTION_POWER_METER)) {
|
||||||
auto txt = new StaticText(window, grid.getLabelSlot(), "access",
|
auto txt =
|
||||||
BUTTON_BACKGROUND, COLOR_THEME_PRIMARY1 | CENTERED);
|
new StaticText(window, grid.getLabelSlot(), "access", BUTTON_BACKGROUND,
|
||||||
|
COLOR_THEME_PRIMARY1 | CENTERED | VCENTERED);
|
||||||
auto b = new TextButton(
|
auto b = new TextButton(
|
||||||
window, grid.getFieldSlot(1), STR_POWER_METER_EXT,
|
window, grid.getFieldSlot(1), STR_POWER_METER_EXT,
|
||||||
[=]() -> uint8_t {
|
[=]() -> uint8_t {
|
||||||
@@ -305,10 +347,10 @@ void RadioToolsPage::rebuild(FormWindow * window)
|
|||||||
b->setFocusHandler([=](bool focus) {
|
b->setFocusHandler([=](bool focus) {
|
||||||
if (focus) {
|
if (focus) {
|
||||||
txt->setBackgroundColor(COLOR_THEME_FOCUS);
|
txt->setBackgroundColor(COLOR_THEME_FOCUS);
|
||||||
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
|
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED | VCENTERED);
|
||||||
} else {
|
} else {
|
||||||
txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
|
txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
|
||||||
txt->setTextFlags(CENTERED);
|
txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED | VCENTERED);
|
||||||
}
|
}
|
||||||
txt->invalidate();
|
txt->invalidate();
|
||||||
});
|
});
|
||||||
@@ -320,7 +362,7 @@ void RadioToolsPage::rebuild(FormWindow * window)
|
|||||||
#if defined(GHOST)
|
#if defined(GHOST)
|
||||||
if (isModuleGhost(EXTERNAL_MODULE)) {
|
if (isModuleGhost(EXTERNAL_MODULE)) {
|
||||||
auto txt = new StaticText(window, grid.getLabelSlot(), "ghost",
|
auto txt = new StaticText(window, grid.getLabelSlot(), "ghost",
|
||||||
BUTTON_BACKGROUND, CENTERED);
|
BUTTON_BACKGROUND, CENTERED | VCENTERED);
|
||||||
auto b = new TextButton(
|
auto b = new TextButton(
|
||||||
window, grid.getFieldSlot(1), "Ghost module config",
|
window, grid.getFieldSlot(1), "Ghost module config",
|
||||||
[=]() -> uint8_t {
|
[=]() -> uint8_t {
|
||||||
@@ -332,10 +374,10 @@ void RadioToolsPage::rebuild(FormWindow * window)
|
|||||||
b->setFocusHandler([=](bool focus) {
|
b->setFocusHandler([=](bool focus) {
|
||||||
if (focus) {
|
if (focus) {
|
||||||
txt->setBackgroundColor(COLOR_THEME_FOCUS);
|
txt->setBackgroundColor(COLOR_THEME_FOCUS);
|
||||||
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
|
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED | VCENTERED);
|
||||||
} else {
|
} else {
|
||||||
txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
|
txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
|
||||||
txt->setTextFlags(CENTERED);
|
txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED | VCENTERED);
|
||||||
}
|
}
|
||||||
txt->invalidate();
|
txt->invalidate();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user