fix(color): various menu toolbar fixes (#2445)
* fix: various toolbar fixes * chore: Bump `libopenui` Also pulls in #2446 fix
This commit is contained in:
@@ -66,14 +66,15 @@ SourceChoice::SourceChoice(Window* parent, const rect_t &rect, int16_t vmin,
|
|||||||
ChoiceEx(parent, rect, vmin, vmax, getValue, setValue)
|
ChoiceEx(parent, rect, vmin, vmax, getValue, setValue)
|
||||||
{
|
{
|
||||||
setBeforeDisplayMenuHandler([=](Menu *menu) {
|
setBeforeDisplayMenuHandler([=](Menu *menu) {
|
||||||
menu->setToolbar(new SourceChoiceMenuToolbar(this, menu));
|
auto tb = new SourceChoiceMenuToolbar(this, menu);
|
||||||
|
menu->setToolbar(tb);
|
||||||
|
|
||||||
#if defined(AUTOSOURCE)
|
#if defined(AUTOSOURCE)
|
||||||
menu->setWaitHandler([=]() {
|
menu->setWaitHandler([=]() {
|
||||||
int16_t val = getMovedSource(vmin);
|
int16_t val = getMovedSource(vmin);
|
||||||
if (val) {
|
if (val) {
|
||||||
fillMenu(menu);
|
tb->resetFilter();
|
||||||
menu->select(getIndexFromValue(val));
|
menu->select(getIndexFromValue(val));
|
||||||
// TODO: reset toolbar
|
|
||||||
}
|
}
|
||||||
#if defined(AUTOSWITCH)
|
#if defined(AUTOSWITCH)
|
||||||
else {
|
else {
|
||||||
@@ -81,9 +82,8 @@ SourceChoice::SourceChoice(Window* parent, const rect_t &rect, int16_t vmin,
|
|||||||
if (swtch && !IS_SWITCH_MULTIPOS(swtch)) {
|
if (swtch && !IS_SWITCH_MULTIPOS(swtch)) {
|
||||||
val = switchToMix(swtch);
|
val = switchToMix(swtch);
|
||||||
if (val && (val >= vmin) && (val <= vmax)) {
|
if (val && (val >= vmin) && (val <= vmax)) {
|
||||||
fillMenu(menu);
|
tb->resetFilter();
|
||||||
menu->select(getIndexFromValue(val));
|
menu->select(getIndexFromValue(val));
|
||||||
// TODO: reset toolbar
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,9 +58,11 @@ SwitchChoice::SwitchChoice(Window* parent, const rect_t& rect, int vmin,
|
|||||||
ChoiceEx(parent, rect, vmin, vmax, getValue, setValue)
|
ChoiceEx(parent, rect, vmin, vmax, getValue, setValue)
|
||||||
{
|
{
|
||||||
setBeforeDisplayMenuHandler([=](Menu* menu) {
|
setBeforeDisplayMenuHandler([=](Menu* menu) {
|
||||||
menu->setToolbar(new SwitchChoiceMenuToolbar(this, menu));
|
auto tb = new SwitchChoiceMenuToolbar(this, menu);
|
||||||
|
menu->setToolbar(tb);
|
||||||
|
|
||||||
#if defined(AUTOSWITCH)
|
#if defined(AUTOSWITCH)
|
||||||
menu->setWaitHandler([menu, this, setValue]() {
|
menu->setWaitHandler([menu, this, setValue, tb]() {
|
||||||
swsrc_t val = 0;
|
swsrc_t val = 0;
|
||||||
swsrc_t swtch = getMovedSwitch();
|
swsrc_t swtch = getMovedSwitch();
|
||||||
if (swtch) {
|
if (swtch) {
|
||||||
@@ -73,9 +75,9 @@ SwitchChoice::SwitchChoice(Window* parent, const rect_t& rect, int vmin,
|
|||||||
val = swtch;
|
val = swtch;
|
||||||
}
|
}
|
||||||
if (val && (!isValueAvailable || isValueAvailable(val))) {
|
if (val && (!isValueAvailable || isValueAvailable(val))) {
|
||||||
fillMenu(menu);
|
// if (filtered) fillMenu(menu);
|
||||||
|
tb->resetFilter();
|
||||||
menu->select(getIndexFromValue(val));
|
menu->select(getIndexFromValue(val));
|
||||||
// TODO: reset toolbar
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Vendored
+1
-1
Submodule radio/src/thirdparty/libopenui updated: f88024a00a...47441631c8
Reference in New Issue
Block a user