X7-improvement (#4208)

* Allow autoswitch for LS AND

* Add POPUPMENU base edit/clear/copy/paste to LS screen

* Add long menu to OUTPUTS screen

* Compil fix

* Compil fix

* Translations for outputs POPMENU 128x64
This commit is contained in:
3djc
2017-01-08 19:54:57 +01:00
committed by Bertrand Songis
parent 1642732e8f
commit 651f7b3f93
13 changed files with 94 additions and 38 deletions
+37 -14
View File
@@ -195,7 +195,7 @@ void menuModelLogicalSwitchOne(event_t event)
case LS_FIELD_ANDSW:
lcdDrawTextAlignedLeft(y, STR_AND_SWITCH);
drawSwitch(CSWONE_2ND_COLUMN, y, cs->andsw, attr);
if (attr) CHECK_INCDEC_MODELVAR_CHECK(event, cs->andsw, -MAX_LS_ANDSW, MAX_LS_ANDSW, isSwitchAvailableInLogicalSwitches);
if (attr) CHECK_INCDEC_MODELSWITCH(event, cs->andsw, -MAX_LS_ANDSW, MAX_LS_ANDSW, isSwitchAvailableInLogicalSwitches);
break;
case LS_FIELD_DURATION:
@@ -219,6 +219,29 @@ void menuModelLogicalSwitchOne(event_t event)
}
}
void onLogicalSwitchesMenu(const char *result)
{
int8_t sub = menuVerticalPosition;
LogicalSwitchData * cs = lswAddress(sub);
if (result == STR_EDIT) {
pushMenu(menuModelLogicalSwitchOne);
}
if (result == STR_COPY) {
clipboard.type = CLIPBOARD_TYPE_CUSTOM_SWITCH;
clipboard.data.csw = *cs;
}
else if (result == STR_PASTE) {
*cs = clipboard.data.csw;
storageDirty(EE_MODEL);
}
else if (result == STR_CLEAR) {
memset(cs, 0, sizeof(LogicalSwitchData));
storageDirty(EE_MODEL);
}
}
void menuModelLogicalSwitches(event_t event)
{
SIMPLE_MENU(STR_MENULOGICALSWITCHES, menuTabModel, MENU_MODEL_LOGICAL_SWITCHES, HEADER_LINE+MAX_LOGICAL_SWITCHES);
@@ -227,19 +250,19 @@ void menuModelLogicalSwitches(event_t event)
uint8_t k = 0;
int8_t sub = menuVerticalPosition - HEADER_LINE;
switch (event) {
#if defined(ROTARY_ENCODER_NAVIGATION)
case EVT_ROTARY_BREAK:
#endif
#if !defined(PCBX7)
case EVT_KEY_FIRST(KEY_RIGHT):
#endif
case EVT_KEY_FIRST(KEY_ENTER):
if (sub >= 0) {
s_currIdx = sub;
pushMenu(menuModelLogicalSwitchOne);
}
break;
if (event==EVT_KEY_FIRST(KEY_ENTER)) {
killEvents(event);
LogicalSwitchData * cs = lswAddress(sub);
if (cs->func)
s_currIdx = sub;
POPUP_MENU_ADD_ITEM(STR_EDIT);
if (cs->func || cs->v1 || cs->v2 || cs->delay || cs->duration || cs->andsw)
POPUP_MENU_ADD_ITEM(STR_COPY);
if (clipboard.type == CLIPBOARD_TYPE_CUSTOM_SWITCH)
POPUP_MENU_ADD_ITEM(STR_PASTE);
if (cs->func || cs->v1 || cs->v2 || cs->delay || cs->duration || cs->andsw)
POPUP_MENU_ADD_ITEM(STR_CLEAR);
POPUP_MENU_START(onLogicalSwitchesMenu);
}
for (uint8_t i=0; i<LCD_LINES-1; i++) {