1
0
Fork 0
mirror of https://github.com/EdgeTX/edgetx.git synced 2025-07-25 17:25:10 +03:00

Fixed pasting logical switch

This commit is contained in:
Raphael Coeffic 2021-05-27 07:13:17 +02:00
parent dee7a3ea6b
commit a7aefb7788

View file

@ -352,10 +352,21 @@ void ModelLogicalSwitchesPage::build(FormWindow * window, int8_t focusIndex)
for (uint8_t i = 0; i < MAX_LOGICAL_SWITCHES; i++) {
LogicalSwitchData * ls = lswAddress(i);
if (ls->func == LS_FUNC_NONE) {
auto button = new TextButton(window, grid.getLabelSlot(), getSwitchPositionName(SWSRC_SW1+i));
button->setPressHandler([=]() {
editLogicalSwitch(window, i);
if (clipboard.type == CLIPBOARD_TYPE_CUSTOM_SWITCH) {
Menu* menu = new Menu(window);
menu->addLine(STR_EDIT, [=]() { editLogicalSwitch(window, i); });
menu->addLine(STR_PASTE, [=]() {
*ls = clipboard.data.csw;
storageDirty(EE_MODEL);
rebuild(window, i);
});
} else {
editLogicalSwitch(window, i);
}
return 0;
});
grid.spacer(button->height() + 5);
@ -366,7 +377,6 @@ void ModelLogicalSwitchesPage::build(FormWindow * window, int8_t focusIndex)
auto button = new LogicalSwitchButton(window, grid.getFieldSlot(), i);
button->setPressHandler([=]() {
Menu * menu = new Menu(window);
LogicalSwitchData * ls = lswAddress(i);
menu->addLine(STR_EDIT, [=]() {
editLogicalSwitch(window, i);
});