From 3e73d1709d69ca64bec789e88699dd32dbee7119 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Mon, 3 Oct 2022 05:13:12 +0200 Subject: [PATCH] fix(color): various menu toolbar fixes (#2445) * fix: various toolbar fixes * chore: Bump `libopenui` Also pulls in #2446 fix --- radio/src/gui/colorlcd/sourcechoice.cpp | 10 +++++----- radio/src/gui/colorlcd/switchchoice.cpp | 10 ++++++---- radio/src/thirdparty/libopenui | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/radio/src/gui/colorlcd/sourcechoice.cpp b/radio/src/gui/colorlcd/sourcechoice.cpp index e82d61b64..f3ce07f1d 100644 --- a/radio/src/gui/colorlcd/sourcechoice.cpp +++ b/radio/src/gui/colorlcd/sourcechoice.cpp @@ -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 } } } diff --git a/radio/src/gui/colorlcd/switchchoice.cpp b/radio/src/gui/colorlcd/switchchoice.cpp index bff752614..4baba4c0f 100644 --- a/radio/src/gui/colorlcd/switchchoice.cpp +++ b/radio/src/gui/colorlcd/switchchoice.cpp @@ -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 } } }); diff --git a/radio/src/thirdparty/libopenui b/radio/src/thirdparty/libopenui index f88024a00..47441631c 160000 --- a/radio/src/thirdparty/libopenui +++ b/radio/src/thirdparty/libopenui @@ -1 +1 @@ -Subproject commit f88024a00a184d720dfc99be2d87d80a533d3580 +Subproject commit 47441631c874af06eda1f4749cb6fa1631fc67ac