mirror of
https://github.com/opentx/opentx.git
synced 2025-07-24 00:35:18 +03:00
[Horus] Move models from one category to another
This commit is contained in:
parent
ce63768df3
commit
93f21bc18f
2 changed files with 75 additions and 57 deletions
|
@ -203,6 +203,11 @@ bool menuModelSelect(evt_t event)
|
|||
initModelsList();
|
||||
break;
|
||||
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
if (selectMode == MODE_MOVE_MODEL)
|
||||
selectMode = MODE_SELECT_MODEL;
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
switch (selectMode) {
|
||||
case MODE_MOVE_MODEL:
|
||||
|
@ -215,34 +220,40 @@ bool menuModelSelect(evt_t event)
|
|||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_PGUP):
|
||||
if (categoriesVerticalPosition == 0)
|
||||
categoriesVerticalPosition = modelslist.categories.size() - 1;
|
||||
else
|
||||
if (selectMode == MODE_SELECT_MODEL) {
|
||||
if (categoriesVerticalPosition == 0)
|
||||
categoriesVerticalPosition = modelslist.categories.size() - 1;
|
||||
else
|
||||
categoriesVerticalPosition -= 1;
|
||||
setCurrentCategory(categoriesVerticalPosition);
|
||||
}
|
||||
else if (selectMode == MODE_MOVE_MODEL && categoriesVerticalPosition > 0) {
|
||||
ModelsCategory * previous_category = currentCategory;
|
||||
ModelCell * model = currentModel;
|
||||
categoriesVerticalPosition -= 1;
|
||||
setCurrentCategory(categoriesVerticalPosition);
|
||||
putEvent(EVT_REFRESH);
|
||||
setCurrentCategory(categoriesVerticalPosition);
|
||||
modelslist.moveModel(model, previous_category, currentCategory);
|
||||
setCurrentModel(currentCategory->size()-1);
|
||||
}
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_PGDN):
|
||||
categoriesVerticalPosition += 1;
|
||||
if (categoriesVerticalPosition >= modelslist.categories.size())
|
||||
categoriesVerticalPosition = 0;
|
||||
setCurrentCategory(categoriesVerticalPosition);
|
||||
putEvent(EVT_REFRESH);
|
||||
if (selectMode == MODE_SELECT_MODEL) {
|
||||
categoriesVerticalPosition += 1;
|
||||
if (categoriesVerticalPosition >= modelslist.categories.size())
|
||||
categoriesVerticalPosition = 0;
|
||||
setCurrentCategory(categoriesVerticalPosition);
|
||||
}
|
||||
else if (selectMode == MODE_MOVE_MODEL && categoriesVerticalPosition < modelslist.categories.size()-1) {
|
||||
ModelsCategory * previous_category = currentCategory;
|
||||
ModelCell * model = currentModel;
|
||||
categoriesVerticalPosition += 1;
|
||||
setCurrentCategory(categoriesVerticalPosition);
|
||||
modelslist.moveModel(model, previous_category, currentCategory);
|
||||
setCurrentModel(currentCategory->size()-1);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
/*if (selectMode == MODE_SELECT_CATEGORY) {
|
||||
menuVerticalPosition = categoriesVerticalPosition;
|
||||
menuVerticalOffset = categoriesVerticalOffset;
|
||||
if (navigate(event, modelslist.categories.size(), 10)) {
|
||||
categoriesVerticalPosition = menuVerticalPosition;
|
||||
categoriesVerticalOffset = menuVerticalOffset;
|
||||
putEvent(EVT_REFRESH);
|
||||
setCurrentCategory(categoriesVerticalPosition);
|
||||
}
|
||||
}*/
|
||||
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
if (selectMode == MODE_SELECT_MODEL) {
|
||||
killEvents(event);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue