[Taranis] Possibility to rename a directory in SD Manager
This commit is contained in:
@@ -165,8 +165,9 @@ void onSdManagerMenu(const char *result)
|
||||
strcpy_P(statusLineMsg+min((uint8_t)strlen(statusLineMsg), (uint8_t)13), STR_REMOVED);
|
||||
showStatusLine();
|
||||
REFRESH_FILES();
|
||||
if (m_posVert == reusableBuffer.sdmanager.count-1)
|
||||
if (m_posVert == reusableBuffer.sdmanager.count-1) {
|
||||
m_posVert--;
|
||||
}
|
||||
}
|
||||
/* TODO else if (result == STR_LOAD_FILE) {
|
||||
f_getcwd(lfn, _MAX_LFN);
|
||||
@@ -276,8 +277,8 @@ void menuGeneralSdManager(uint8_t _event)
|
||||
// no break
|
||||
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
killEvents(_event);
|
||||
if (s_editMode == 0) {
|
||||
killEvents(_event);
|
||||
char *line = reusableBuffer.sdmanager.lines[index];
|
||||
char *ext = getFileExtension(line, SD_SCREEN_FILE_LENGTH+1);
|
||||
if (ext) {
|
||||
@@ -309,8 +310,8 @@ void menuGeneralSdManager(uint8_t _event)
|
||||
MENU_ADD_ITEM(STR_RENAME_FILE);
|
||||
MENU_ADD_ITEM(STR_DELETE_FILE);
|
||||
}
|
||||
menuHandler = onSdManagerMenu;
|
||||
}
|
||||
menuHandler = onSdManagerMenu;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -401,7 +402,7 @@ void menuGeneralSdManager(uint8_t _event)
|
||||
lcdNextPos = 0;
|
||||
LcdFlags attr = (index == i ? BSS|INVERS : BSS);
|
||||
if (reusableBuffer.sdmanager.lines[i][0]) {
|
||||
if (!reusableBuffer.sdmanager.lines[i][SD_SCREEN_FILE_LENGTH+1]) { lcd_putcAtt(0, y, '[', attr); }
|
||||
if (!reusableBuffer.sdmanager.lines[i][SD_SCREEN_FILE_LENGTH+1]) { lcd_putcAtt(0, y, '[', s_editMode == EDIT_MODIFY_STRING ? 0 : attr); }
|
||||
if (s_editMode == EDIT_MODIFY_STRING && attr) {
|
||||
editName(lcdNextPos, y, reusableBuffer.sdmanager.lines[i], SD_SCREEN_FILE_LENGTH-4, _event, attr, 0);
|
||||
if (s_editMode == 0) {
|
||||
@@ -414,7 +415,7 @@ void menuGeneralSdManager(uint8_t _event)
|
||||
else {
|
||||
lcd_putsAtt(lcdNextPos, y, reusableBuffer.sdmanager.lines[i], attr);
|
||||
}
|
||||
if (!reusableBuffer.sdmanager.lines[i][SD_SCREEN_FILE_LENGTH+1]) { lcd_putcAtt(lcdNextPos, y, ']', attr); }
|
||||
if (!reusableBuffer.sdmanager.lines[i][SD_SCREEN_FILE_LENGTH+1]) { lcd_putcAtt(lcdNextPos, y, ']', s_editMode == EDIT_MODIFY_STRING ? 0 : attr); }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -149,6 +149,7 @@ void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uin
|
||||
}
|
||||
|
||||
lcd_putsnAtt(x, y, name, size, attr | mode);
|
||||
coord_t backupNextPos = lcdNextPos;
|
||||
|
||||
if (active) {
|
||||
uint8_t cur = editNameCursorPos;
|
||||
@@ -181,15 +182,27 @@ void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uin
|
||||
break;
|
||||
|
||||
case EVT_ROTARY_LONG:
|
||||
if ((attr == ZCHAR && v==0) || (attr == 0 && v==' ')) {
|
||||
s_editMode = 0;
|
||||
killEvents(event);
|
||||
break;
|
||||
if (attr & ZCHAR) {
|
||||
if (v == 0) {
|
||||
s_editMode = 0;
|
||||
killEvents(event);
|
||||
}
|
||||
else if (v>=-26 && v<=26) {
|
||||
v = -v; // toggle case
|
||||
}
|
||||
}
|
||||
if (v>=-26 && v<=26) {
|
||||
v = -v; // toggle case
|
||||
if (event==EVT_KEY_LONG(KEY_LEFT))
|
||||
killEvents(KEY_LEFT);
|
||||
else {
|
||||
if (v == ' ') {
|
||||
s_editMode = 0;
|
||||
killEvents(event);
|
||||
break;
|
||||
}
|
||||
else if (v>='A' && v<='Z') {
|
||||
v = 'a'+v-'A'; // toggle case
|
||||
}
|
||||
else if (v>='a' && v<='z') {
|
||||
v = 'A'+v-'a'; // toggle case
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -210,6 +223,7 @@ void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uin
|
||||
cur = 0;
|
||||
}
|
||||
editNameCursorPos = cur;
|
||||
lcdNextPos = backupNextPos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -504,7 +504,7 @@ void menuModelTelemetry(uint8_t event)
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_NEWSENSOR:
|
||||
lcd_putsAtt(INDENT_WIDTH, y, STR_TELEMETRY_NEWSENSOR, attr);
|
||||
lcd_putsAtt(0, y, STR_TELEMETRY_NEWSENSOR, attr);
|
||||
if (attr && event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
s_editMode = 0;
|
||||
int res = availableTelemetryIndex();
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
|
||||
#if defined(TRANSLATIONS_FR)
|
||||
#define MENU_COLUMNS 1
|
||||
#define COLUMN_X 0
|
||||
#else
|
||||
#define MENU_COLUMNS 2
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user