fix(color): various menu toolbar fixes (#2445)

* fix: various toolbar fixes

* chore: Bump `libopenui`
Also pulls in #2446 fix
This commit is contained in:
Raphael Coeffic
2022-10-03 13:13:12 +10:00
committed by GitHub
parent 8c2b3c0bff
commit 3e73d1709d
3 changed files with 12 additions and 10 deletions
+5 -5
View File
@@ -66,14 +66,15 @@ SourceChoice::SourceChoice(Window* parent, const rect_t &rect, int16_t vmin,
ChoiceEx(parent, rect, vmin, vmax, getValue, setValue)
{
setBeforeDisplayMenuHandler([=](Menu *menu) {
menu->setToolbar(new SourceChoiceMenuToolbar(this, menu));
auto tb = new SourceChoiceMenuToolbar(this, menu);
menu->setToolbar(tb);
#if defined(AUTOSOURCE)
menu->setWaitHandler([=]() {
int16_t val = getMovedSource(vmin);
if (val) {
fillMenu(menu);
tb->resetFilter();
menu->select(getIndexFromValue(val));
// TODO: reset toolbar
}
#if defined(AUTOSWITCH)
else {
@@ -81,9 +82,8 @@ SourceChoice::SourceChoice(Window* parent, const rect_t &rect, int16_t vmin,
if (swtch && !IS_SWITCH_MULTIPOS(swtch)) {
val = switchToMix(swtch);
if (val && (val >= vmin) && (val <= vmax)) {
fillMenu(menu);
tb->resetFilter();
menu->select(getIndexFromValue(val));
// TODO: reset toolbar
}
}
}
+6 -4
View File
@@ -58,9 +58,11 @@ SwitchChoice::SwitchChoice(Window* parent, const rect_t& rect, int vmin,
ChoiceEx(parent, rect, vmin, vmax, getValue, setValue)
{
setBeforeDisplayMenuHandler([=](Menu* menu) {
menu->setToolbar(new SwitchChoiceMenuToolbar(this, menu));
auto tb = new SwitchChoiceMenuToolbar(this, menu);
menu->setToolbar(tb);
#if defined(AUTOSWITCH)
menu->setWaitHandler([menu, this, setValue]() {
menu->setWaitHandler([menu, this, setValue, tb]() {
swsrc_t val = 0;
swsrc_t swtch = getMovedSwitch();
if (swtch) {
@@ -73,9 +75,9 @@ SwitchChoice::SwitchChoice(Window* parent, const rect_t& rect, int vmin,
val = swtch;
}
if (val && (!isValueAvailable || isValueAvailable(val))) {
fillMenu(menu);
// if (filtered) fillMenu(menu);
tb->resetFilter();
menu->select(getIndexFromValue(val));
// TODO: reset toolbar
}
}
});