1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-24 00:35:18 +03:00

Bugs in model copy

This commit is contained in:
bsongis 2011-10-14 19:45:53 +00:00
parent 54d6634a8b
commit c3bb6ac2b5

View file

@ -229,14 +229,14 @@ void menuProcModelSelect(uint8_t event)
killEvents(_event); killEvents(_event);
break; break;
case EVT_KEY_BREAK(KEY_MENU): case EVT_KEY_BREAK(KEY_MENU):
if (s_copyTgtOfs) { if (s_copyTgtOfs || s_copySrcRow >= 0) {
s_copyTgtOfs = 0;
s_copyMode = 0; s_copyMode = 0;
} }
else if (EFile::exists(FILE_MODEL(sub))) { else if (EFile::exists(FILE_MODEL(sub))) {
s_copyMode = (s_copyMode == COPY_MODE ? MOVE_MODE : COPY_MODE); s_copyMode = (s_copyMode == COPY_MODE ? MOVE_MODE : COPY_MODE);
s_copySrcRow = -1;
} }
s_copySrcRow = -1;
s_copyTgtOfs = 0;
break; break;
case EVT_KEY_LONG(KEY_MENU): case EVT_KEY_LONG(KEY_MENU):
if (s_copyTgtOfs) { if (s_copyTgtOfs) {
@ -267,11 +267,16 @@ void menuProcModelSelect(uint8_t event)
eeCheck(true); eeCheck(true);
int8_t next_ofs = (_event == EVT_KEY_FIRST(KEY_UP) ? s_copyTgtOfs+1 : s_copyTgtOfs-1); int8_t next_ofs = (_event == EVT_KEY_FIRST(KEY_UP) ? s_copyTgtOfs+1 : s_copyTgtOfs-1);
if (s_copySrcRow < 0 && s_copyMode==COPY_MODE) { if (s_copySrcRow < 0 && s_copyMode==COPY_MODE) {
s_copySrcRow = sub+next_ofs; s_copySrcRow = oldSub;
// insert a model (in the first empty slot above / below) // insert a model (in the first empty slot above / below)
m_posVert = eeDuplicateModel(s_copySrcRow, _event==EVT_KEY_FIRST(KEY_DOWN)); m_posVert = eeDuplicateModel(s_copySrcRow, _event==EVT_KEY_FIRST(KEY_DOWN));
if (m_posVert == (uint8_t)-1) { if (m_posVert == (uint8_t)-1) {
m_posVert = sub; // no free room for duplicating the model
beepWarn();
m_posVert = oldSub;
s_copyMode = 0;
s_copyTgtOfs = 0;
s_copySrcRow = -1;
} }
next_ofs = 0; next_ofs = 0;
sub = m_posVert; sub = m_posVert;