[stock] Flash saving

[X9D] Navigation continued
This commit is contained in:
bsongis
2012-11-22 11:20:15 +00:00
parent 47fc05c25e
commit b6debf27ec
2 changed files with 52 additions and 50 deletions
+48 -46
View File
@@ -1895,21 +1895,16 @@ static uint8_t s_copySrcCh;
#define EXPO_LINE_SELECT_POS 18
#endif
#if defined(PCBX9D)
#define KEY_MIX_MOVE_UP KEY_MINUS
#define KEY_MIX_MOVE_DOWN KEY_PLUS
#else
#define KEY_MIX_MOVE_UP KEY_UP
#define KEY_MIX_MOVE_DOWN KEY_DOWN
#endif
void menuModelExpoMix(uint8_t expo, uint8_t event)
{
uint8_t key = (event & 0x1f);
if (s_copyMode && key==KEY_EXIT)
event -= KEY_EXIT;
TITLE(expo ? STR_MENUDREXPO : STR_MIXER);
lcd_outdezAtt(lcdLastPos+2*FW+FW/2, 0, getExpoMixCount(expo));
lcd_puts(lcdLastPos, 0, expo ? STR_MAX(MAX_EXPOS) : STR_MAX(MAX_MIXERS));
SIMPLE_MENU_NOTITLE(menuTabModel, expo ? e_ExposAll : e_MixAll, s_maxLines);
if (s_copyMode && key==KEY_EXIT)
event += KEY_EXIT;
#if defined(ROTARY_ENCODERS)
int8_t sub = m_posVert;
#else
@@ -1919,6 +1914,8 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
if (s_editMode > 0)
s_editMode = 0;
uint8_t chn = (expo ? expoaddress(s_currIdx)->chn+1 : mixaddress(s_currIdx)->destCh+1);
switch(event)
{
case EVT_ENTRY:
@@ -1929,36 +1926,36 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
case EVT_KEY_LONG(KEY_EXIT):
if (s_copyMode && s_copyTgtOfs == 0) {
deleteExpoMix(expo, s_currIdx);
killEvents(event);
event = 0;
}
killEvents(event);
// no break
case EVT_KEY_BREAK(KEY_EXIT):
if (s_copyTgtOfs) {
// cancel the current copy / move operation
if (s_copyMode == COPY_MODE) {
deleteExpoMix(expo, s_currIdx);
if (s_copyMode) {
if (s_copyTgtOfs) {
// cancel the current copy / move operation
if (s_copyMode == COPY_MODE) {
deleteExpoMix(expo, s_currIdx);
}
else {
do {
swapExpoMix(expo, s_currIdx, s_copyTgtOfs > 0);
s_copyTgtOfs += (s_copyTgtOfs < 0 ? +1 : -1);
} while (s_copyTgtOfs != 0);
STORE_MODELVARS;
}
m_posVert = s_copySrcRow;
s_copyTgtOfs = 0;
}
else {
do {
swapExpoMix(expo, s_currIdx, s_copyTgtOfs > 0);
if (s_copyTgtOfs < 0)
s_copyTgtOfs++;
else
s_copyTgtOfs--;
} while (s_copyTgtOfs != 0);
STORE_MODELVARS;
}
sub = m_posVert = s_copySrcRow;
s_copyMode = 0;
event = 0;
}
s_copyMode = 0;
s_copyTgtOfs = 0;
break;
case EVT_KEY_BREAK(KEY_ENTER):
if (sub == 0) break;
if (!s_currCh || (s_copyMode && !s_copyTgtOfs)) {
if (sub != 0 && (!s_currCh || (s_copyMode && !s_copyTgtOfs))) {
s_copyMode = (s_copyMode == COPY_MODE ? MOVE_MODE : COPY_MODE);
s_copySrcIdx = s_currIdx;
s_copySrcCh = expo ? expoaddress(s_currIdx)->chn+1 : mixaddress(s_currIdx)->destCh+1;
s_copySrcCh = chn;
s_copySrcRow = sub;
break;
}
@@ -1971,14 +1968,12 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
// no break
#endif
case EVT_KEY_LONG(KEY_ENTER):
if (sub == 0)
break;
killEvents(event);
if (s_copyTgtOfs) {
s_copyMode = 0;
s_copyTgtOfs = 0;
}
else {
else if (sub != 0) {
if (s_copyMode) s_currCh = 0;
if (s_currCh) {
if (reachExpoMixCountLimit(expo)) break;
@@ -1993,7 +1988,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
case EVT_KEY_LONG(KEY_RIGHT):
if (s_copyMode && !s_copyTgtOfs) {
if (reachExpoMixCountLimit(expo)) break;
s_currCh = (expo ? expoaddress(s_currIdx)->chn+1 : mixaddress(s_currIdx)->destCh+1);
s_currCh = chn;
if (event == EVT_KEY_LONG(KEY_RIGHT)) s_currIdx++;
insertExpoMix(expo, s_currIdx);
pushMenu(expo ? menuModelExpoOne : menuModelMixOne);
@@ -2002,28 +1997,29 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
return;
}
break;
case EVT_KEY_REPT(KEY_UP):
case EVT_KEY_FIRST(KEY_UP):
case EVT_KEY_REPT(KEY_DOWN):
case EVT_KEY_FIRST(KEY_DOWN):
case EVT_KEY_FIRST(KEY_MIX_MOVE_UP):
case EVT_KEY_REPT(KEY_MIX_MOVE_UP):
case EVT_KEY_FIRST(KEY_MIX_MOVE_DOWN):
case EVT_KEY_REPT(KEY_MIX_MOVE_DOWN):
if (s_copyMode) {
uint8_t next_ofs = (key == KEY_UP ? s_copyTgtOfs - 1 : s_copyTgtOfs + 1);
uint8_t key = (event & 0x1f);
uint8_t next_ofs = (key == KEY_MIX_MOVE_UP ? s_copyTgtOfs - 1 : s_copyTgtOfs + 1);
if (s_copyTgtOfs==0 && s_copyMode==COPY_MODE) {
// insert a mix on the same channel (just above / just below)
if (reachExpoMixCountLimit(expo)) break;
copyExpoMix(expo, s_currIdx);
if (key==KEY_DOWN) s_currIdx++;
if (key==KEY_MIX_MOVE_DOWN) s_currIdx++;
else if (sub-s_pgOfs >= 6) s_pgOfs++;
}
else if (next_ofs==0 && s_copyMode==COPY_MODE) {
// delete the mix
deleteExpoMix(expo, s_currIdx);
if (key==KEY_UP) s_currIdx--;
if (key==KEY_MIX_MOVE_UP) s_currIdx--;
}
else {
// only swap the mix with its neighbor
if (!swapExpoMix(expo, s_currIdx, key==KEY_UP)) break;
if (!swapExpoMix(expo, s_currIdx, key==KEY_MIX_MOVE_UP)) break;
STORE_MODELVARS;
}
@@ -2032,6 +2028,12 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
break;
}
TITLE(expo ? STR_MENUDREXPO : STR_MIXER);
lcd_outdezAtt(lcdLastPos+2*FW+FW/2, 0, getExpoMixCount(expo));
lcd_puts(lcdLastPos, 0, expo ? STR_MAX(MAX_EXPOS) : STR_MAX(MAX_MIXERS));
SIMPLE_MENU_NOTITLE(menuTabModel, expo ? e_ExposAll : e_MixAll, s_maxLines);
sub = m_posVert;
s_currCh = 0;
uint8_t cur = 1;
uint8_t i = 0;