Use autoswitch in SourceChoice as well
This commit is contained in:
committed by
Raphael Coeffic
parent
589398a65c
commit
92e8baf916
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
@@ -79,7 +79,6 @@ void SourceChoice::fillMenu(Menu * menu, const std::function<bool(int16_t)> & fi
|
|||||||
int current = 0;
|
int current = 0;
|
||||||
|
|
||||||
menu->removeLines();
|
menu->removeLines();
|
||||||
|
|
||||||
for (int i = vmin; i <= vmax; ++i) {
|
for (int i = vmin; i <= vmax; ++i) {
|
||||||
if (filter && !filter(i)) continue;
|
if (filter && !filter(i)) continue;
|
||||||
if (isValueAvailable && !isValueAvailable(i)) continue;
|
if (isValueAvailable && !isValueAvailable(i)) continue;
|
||||||
@@ -96,7 +95,7 @@ void SourceChoice::fillMenu(Menu * menu, const std::function<bool(int16_t)> & fi
|
|||||||
|
|
||||||
#if defined(AUTOSOURCE)
|
#if defined(AUTOSOURCE)
|
||||||
menu->setWaitHandler([=]() {
|
menu->setWaitHandler([=]() {
|
||||||
int8_t val = getMovedSource(0);
|
int16_t val = getMovedSource(0);
|
||||||
if (val) {
|
if (val) {
|
||||||
if (filter && filter(val)) {
|
if (filter && filter(val)) {
|
||||||
return;
|
return;
|
||||||
@@ -105,7 +104,17 @@ void SourceChoice::fillMenu(Menu * menu, const std::function<bool(int16_t)> & fi
|
|||||||
setValue(val);
|
setValue(val);
|
||||||
}
|
}
|
||||||
this->fillMenu(menu);
|
this->fillMenu(menu);
|
||||||
menu->setFocusBody();
|
}
|
||||||
|
else {
|
||||||
|
swsrc_t swtch = getMovedSwitch();
|
||||||
|
if (swtch) {
|
||||||
|
div_t info = switchInfo(swtch);
|
||||||
|
val = info.quot + MIXSRC_FIRST_SWITCH;
|
||||||
|
if (val && (!filter || !filter(val))) {
|
||||||
|
if (setValue) setValue(val);
|
||||||
|
this->fillMenu(menu);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -77,18 +77,6 @@ void SwitchChoice::fillMenu(Menu * menu, std::function<bool(int16_t)> filter)
|
|||||||
if (current >= 0) {
|
if (current >= 0) {
|
||||||
menu->select(current);
|
menu->select(current);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void SwitchChoice::openMenu()
|
|
||||||
{
|
|
||||||
auto menu = new Menu(this);
|
|
||||||
fillMenu(menu);
|
|
||||||
|
|
||||||
menu->setToolbar(new SwitchChoiceMenuToolbar(this, menu));
|
|
||||||
menu->setCloseHandler([=]() {
|
|
||||||
editMode = false;
|
|
||||||
setFocus(SET_FOCUS_DEFAULT);
|
|
||||||
});
|
|
||||||
|
|
||||||
#if defined(AUTOSWITCH)
|
#if defined(AUTOSWITCH)
|
||||||
menu->setWaitHandler([=]() {
|
menu->setWaitHandler([=]() {
|
||||||
@@ -112,6 +100,18 @@ void SwitchChoice::openMenu()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SwitchChoice::openMenu()
|
||||||
|
{
|
||||||
|
auto menu = new Menu(this);
|
||||||
|
fillMenu(menu);
|
||||||
|
|
||||||
|
menu->setToolbar(new SwitchChoiceMenuToolbar(this, menu));
|
||||||
|
menu->setCloseHandler([=]() {
|
||||||
|
editMode = false;
|
||||||
|
setFocus(SET_FOCUS_DEFAULT);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(HARDWARE_KEYS)
|
#if defined(HARDWARE_KEYS)
|
||||||
void SwitchChoice::onEvent(event_t event)
|
void SwitchChoice::onEvent(event_t event)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user