chore: Touch and Narrow LCD template tweaks (#1675)
* Make the buttons double height so easier to touch * Add translation strings, add info for blank model * Wrap STR_NO_TEMPLATES text on narrow screen
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
#include "storage/modelslist.h"
|
#include "storage/modelslist.h"
|
||||||
#include "libopenui.h"
|
#include "libopenui.h"
|
||||||
#include "standalone_lua.h"
|
#include "standalone_lua.h"
|
||||||
|
#include "str_functions.h"
|
||||||
|
|
||||||
#if LCD_W > LCD_H
|
#if LCD_W > LCD_H
|
||||||
constexpr int MODEL_CELLS_PER_LINE = 3;
|
constexpr int MODEL_CELLS_PER_LINE = 3;
|
||||||
@@ -183,7 +184,8 @@ class SelectTemplate : public TemplatePage
|
|||||||
updateInfo();
|
updateInfo();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
grid.nextLine();
|
tb->setHeight(PAGE_LINE_HEIGHT * 2);
|
||||||
|
grid.spacer(tb->height() + 5);
|
||||||
}
|
}
|
||||||
body.setInnerHeight(grid.getWindowHeight());
|
body.setInnerHeight(grid.getWindowHeight());
|
||||||
}
|
}
|
||||||
@@ -194,16 +196,24 @@ class SelectTemplate : public TemplatePage
|
|||||||
rect_t rect = body.getRect();
|
rect_t rect = body.getRect();
|
||||||
rect.x = PAGE_PADDING;
|
rect.x = PAGE_PADDING;
|
||||||
rect.y = PAGE_PADDING;
|
rect.y = PAGE_PADDING;
|
||||||
rect.w = rect.w - 2 * PAGE_PADDING;
|
rect.w = rect.w - (2 * PAGE_PADDING);
|
||||||
|
|
||||||
|
#if LCD_W > LCD_H
|
||||||
rect.h = PAGE_LINE_HEIGHT;
|
rect.h = PAGE_LINE_HEIGHT;
|
||||||
new StaticText(&body, rect, STR_NO_TEMPLATES, 0, COLOR_THEME_PRIMARY1);
|
int charBreak = 60;
|
||||||
|
#else
|
||||||
|
rect.h = PAGE_LINE_HEIGHT * 2;
|
||||||
|
int charBreak = 40;
|
||||||
|
#endif
|
||||||
|
new StaticText(&body, rect, wrap(STR_NO_TEMPLATES, charBreak), 0, COLOR_THEME_PRIMARY1);
|
||||||
|
|
||||||
// The following button is needed because the EXIT key does not work without...
|
// The following button is needed because the EXIT key does not work without...
|
||||||
rect = body.getRect();
|
rect = body.getRect();
|
||||||
rect.x = rect.w - PAGE_PADDING - 100;
|
rect.x = rect.w - PAGE_PADDING - 100;
|
||||||
rect.y = rect.h - PAGE_PADDING - PAGE_LINE_HEIGHT;
|
rect.y = rect.h - PAGE_PADDING - (PAGE_LINE_HEIGHT * 2);
|
||||||
rect.w = 100;
|
rect.w = 100;
|
||||||
rect.h = PAGE_LINE_HEIGHT;
|
rect.h = PAGE_LINE_HEIGHT * 2;
|
||||||
new TemplateButton(&body, rect, STR_EXIT, [=]() -> uint8_t { deleteLater(); return 0; });
|
new TextButton(&body, rect, STR_EXIT, [=]() -> uint8_t { deleteLater(); return 0; });
|
||||||
} else {
|
} else {
|
||||||
snprintf(buffer, LEN_BUFFER, "%s%c%s%s", path, '/', files.front().c_str(), TEXT_EXT);
|
snprintf(buffer, LEN_BUFFER, "%s%c%s%s", path, '/', files.front().c_str(), TEXT_EXT);
|
||||||
updateInfo();
|
updateInfo();
|
||||||
@@ -225,17 +235,19 @@ class SelectTemplateFolder : public TemplatePage
|
|||||||
FormGridLayout grid;
|
FormGridLayout grid;
|
||||||
grid.spacer(PAGE_PADDING);
|
grid.spacer(PAGE_PADDING);
|
||||||
|
|
||||||
auto tfb = new TemplateButton(&body, grid.getLabelSlot(), "Blank Model", [=]() -> uint8_t {
|
auto tfb = new TemplateButton(&body, grid.getLabelSlot(), STR_BLANK_MODEL, [=]() -> uint8_t {
|
||||||
deleteLater();
|
deleteLater();
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
|
snprintf(infoText, LEN_INFO_TEXT, "%s", STR_BLANK_MODEL_INFO);
|
||||||
tfb->setFocusHandler([=](bool active) {
|
tfb->setFocusHandler([=](bool active) {
|
||||||
if (active) {
|
if (active) {
|
||||||
snprintf(infoText, LEN_INFO_TEXT, "%c", '\0');
|
snprintf(infoText, LEN_INFO_TEXT, "%s", STR_BLANK_MODEL_INFO);
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
grid.nextLine();
|
tfb->setHeight(PAGE_LINE_HEIGHT * 2);
|
||||||
|
grid.spacer(tfb->height() + 5);
|
||||||
|
|
||||||
std::list<std::string> directories;
|
std::list<std::string> directories;
|
||||||
FILINFO fno;
|
FILINFO fno;
|
||||||
@@ -273,7 +285,8 @@ class SelectTemplateFolder : public TemplatePage
|
|||||||
updateInfo();
|
updateInfo();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
grid.nextLine();
|
tfb->setHeight(PAGE_LINE_HEIGHT * 2);
|
||||||
|
grid.spacer(tfb->height() + 5);
|
||||||
}
|
}
|
||||||
body.setInnerHeight(grid.getWindowHeight());
|
body.setInnerHeight(grid.getWindowHeight());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -931,6 +931,8 @@ const char STR_SELECT_TEMPLATE[] = TR_SELECT_TEMPLATE;
|
|||||||
const char STR_SELECT_TEMPLATE_FOLDER[] = TR_SELECT_TEMPLATE_FOLDER;
|
const char STR_SELECT_TEMPLATE_FOLDER[] = TR_SELECT_TEMPLATE_FOLDER;
|
||||||
const char STR_NO_TEMPLATES[] = TR_NO_TEMPLATES;
|
const char STR_NO_TEMPLATES[] = TR_NO_TEMPLATES;
|
||||||
const char STR_SAVE_TEMPLATE[] = TR_SAVE_TEMPLATE;
|
const char STR_SAVE_TEMPLATE[] = TR_SAVE_TEMPLATE;
|
||||||
|
const char STR_BLANK_MODEL[] = TR_BLANK_MODEL;
|
||||||
|
const char STR_BLANK_MODEL_INFO[] = TR_BLANK_MODEL_INFO;
|
||||||
const char STR_FILE_EXISTS[] = TR_FILE_EXISTS;
|
const char STR_FILE_EXISTS[] = TR_FILE_EXISTS;
|
||||||
const char STR_ASK_OVERWRITE[] = TR_ASK_OVERWRITE;
|
const char STR_ASK_OVERWRITE[] = TR_ASK_OVERWRITE;
|
||||||
|
|
||||||
|
|||||||
@@ -612,6 +612,8 @@ extern const char STR_SELECT_TEMPLATE[];
|
|||||||
extern const char STR_SELECT_TEMPLATE_FOLDER[];
|
extern const char STR_SELECT_TEMPLATE_FOLDER[];
|
||||||
extern const char STR_NO_TEMPLATES[];
|
extern const char STR_NO_TEMPLATES[];
|
||||||
extern const char STR_SAVE_TEMPLATE[];
|
extern const char STR_SAVE_TEMPLATE[];
|
||||||
|
extern const char STR_BLANK_MODEL[];
|
||||||
|
extern const char STR_BLANK_MODEL_INFO[];
|
||||||
extern const char STR_FILE_EXISTS[];
|
extern const char STR_FILE_EXISTS[];
|
||||||
extern const char STR_ASK_OVERWRITE[];
|
extern const char STR_ASK_OVERWRITE[];
|
||||||
#define STR_UPDATE_LIST STR_DELAYDOWN
|
#define STR_UPDATE_LIST STR_DELAYDOWN
|
||||||
|
|||||||
@@ -784,6 +784,8 @@
|
|||||||
#define TR_SELECT_TEMPLATE "SELECT A MODEL TEMPLATE:"
|
#define TR_SELECT_TEMPLATE "SELECT A MODEL TEMPLATE:"
|
||||||
#define TR_NO_TEMPLATES "No model templates were found in this folder"
|
#define TR_NO_TEMPLATES "No model templates were found in this folder"
|
||||||
#define TR_SAVE_TEMPLATE "Save as template"
|
#define TR_SAVE_TEMPLATE "Save as template"
|
||||||
|
#define TR_BLANK_MODEL "Blank Model"
|
||||||
|
#define TR_BLANK_MODEL_INFO "Create a blank model"
|
||||||
#define TR_FILE_EXISTS "FILE ALREADY EXISTS"
|
#define TR_FILE_EXISTS "FILE ALREADY EXISTS"
|
||||||
#define TR_ASK_OVERWRITE "Do you want to overwrite?"
|
#define TR_ASK_OVERWRITE "Do you want to overwrite?"
|
||||||
|
|
||||||
|
|||||||
@@ -818,6 +818,8 @@
|
|||||||
#define TR_SELECT_TEMPLATE "SELECT A MODEL TEMPLATE:"
|
#define TR_SELECT_TEMPLATE "SELECT A MODEL TEMPLATE:"
|
||||||
#define TR_NO_TEMPLATES "No model templates were found in this folder"
|
#define TR_NO_TEMPLATES "No model templates were found in this folder"
|
||||||
#define TR_SAVE_TEMPLATE "Save as template"
|
#define TR_SAVE_TEMPLATE "Save as template"
|
||||||
|
#define TR_BLANK_MODEL "Blank Model"
|
||||||
|
#define TR_BLANK_MODEL_INFO "Create a blank model"
|
||||||
#define TR_FILE_EXISTS "FILE ALREADY EXISTS"
|
#define TR_FILE_EXISTS "FILE ALREADY EXISTS"
|
||||||
#define TR_ASK_OVERWRITE "Do you want to overwrite?"
|
#define TR_ASK_OVERWRITE "Do you want to overwrite?"
|
||||||
|
|
||||||
|
|||||||
@@ -820,6 +820,8 @@
|
|||||||
#define TR_SELECT_TEMPLATE "SELECT A MODEL TEMPLATE:"
|
#define TR_SELECT_TEMPLATE "SELECT A MODEL TEMPLATE:"
|
||||||
#define TR_NO_TEMPLATES "No model templates were found in this folder"
|
#define TR_NO_TEMPLATES "No model templates were found in this folder"
|
||||||
#define TR_SAVE_TEMPLATE "Save as template"
|
#define TR_SAVE_TEMPLATE "Save as template"
|
||||||
|
#define TR_BLANK_MODEL "Blank Model"
|
||||||
|
#define TR_BLANK_MODEL_INFO "Create a blank model"
|
||||||
#define TR_FILE_EXISTS "FILE ALREADY EXISTS"
|
#define TR_FILE_EXISTS "FILE ALREADY EXISTS"
|
||||||
#define TR_ASK_OVERWRITE "Do you want to overwrite?"
|
#define TR_ASK_OVERWRITE "Do you want to overwrite?"
|
||||||
|
|
||||||
|
|||||||
@@ -824,6 +824,8 @@
|
|||||||
#define TR_SELECT_TEMPLATE "SELECT A MODEL TEMPLATE:"
|
#define TR_SELECT_TEMPLATE "SELECT A MODEL TEMPLATE:"
|
||||||
#define TR_NO_TEMPLATES "No model templates were found in this folder"
|
#define TR_NO_TEMPLATES "No model templates were found in this folder"
|
||||||
#define TR_SAVE_TEMPLATE "Save as template"
|
#define TR_SAVE_TEMPLATE "Save as template"
|
||||||
|
#define TR_BLANK_MODEL "Blank Model"
|
||||||
|
#define TR_BLANK_MODEL_INFO "Create a blank model"
|
||||||
#define TR_FILE_EXISTS "FILE ALREADY EXISTS"
|
#define TR_FILE_EXISTS "FILE ALREADY EXISTS"
|
||||||
#define TR_ASK_OVERWRITE "Do you want to overwrite?"
|
#define TR_ASK_OVERWRITE "Do you want to overwrite?"
|
||||||
|
|
||||||
|
|||||||
@@ -822,6 +822,8 @@
|
|||||||
#define TR_SELECT_TEMPLATE "SELECT A MODEL TEMPLATE:"
|
#define TR_SELECT_TEMPLATE "SELECT A MODEL TEMPLATE:"
|
||||||
#define TR_NO_TEMPLATES "No model templates were found in this folder"
|
#define TR_NO_TEMPLATES "No model templates were found in this folder"
|
||||||
#define TR_SAVE_TEMPLATE "Save as template"
|
#define TR_SAVE_TEMPLATE "Save as template"
|
||||||
|
#define TR_BLANK_MODEL "Blank Model"
|
||||||
|
#define TR_BLANK_MODEL_INFO "Create a blank model"
|
||||||
#define TR_FILE_EXISTS "FILE ALREADY EXISTS"
|
#define TR_FILE_EXISTS "FILE ALREADY EXISTS"
|
||||||
#define TR_ASK_OVERWRITE "Do you want to overwrite?"
|
#define TR_ASK_OVERWRITE "Do you want to overwrite?"
|
||||||
|
|
||||||
|
|||||||
@@ -836,6 +836,8 @@
|
|||||||
#define TR_SELECT_TEMPLATE "SELECT A MODEL TEMPLATE:"
|
#define TR_SELECT_TEMPLATE "SELECT A MODEL TEMPLATE:"
|
||||||
#define TR_NO_TEMPLATES "No model templates were found in this folder"
|
#define TR_NO_TEMPLATES "No model templates were found in this folder"
|
||||||
#define TR_SAVE_TEMPLATE "Save as template"
|
#define TR_SAVE_TEMPLATE "Save as template"
|
||||||
|
#define TR_BLANK_MODEL "Blank Model"
|
||||||
|
#define TR_BLANK_MODEL_INFO "Create a blank model"
|
||||||
#define TR_FILE_EXISTS "FILE ALREADY EXISTS"
|
#define TR_FILE_EXISTS "FILE ALREADY EXISTS"
|
||||||
#define TR_ASK_OVERWRITE "Do you want to overwrite?"
|
#define TR_ASK_OVERWRITE "Do you want to overwrite?"
|
||||||
|
|
||||||
|
|||||||
@@ -841,6 +841,8 @@
|
|||||||
#define TR_SELECT_TEMPLATE "SELECT A MODEL TEMPLATE:"
|
#define TR_SELECT_TEMPLATE "SELECT A MODEL TEMPLATE:"
|
||||||
#define TR_NO_TEMPLATES "No model templates were found in this folder"
|
#define TR_NO_TEMPLATES "No model templates were found in this folder"
|
||||||
#define TR_SAVE_TEMPLATE "Save as template"
|
#define TR_SAVE_TEMPLATE "Save as template"
|
||||||
|
#define TR_BLANK_MODEL "Blank Model"
|
||||||
|
#define TR_BLANK_MODEL_INFO "Create a blank model"
|
||||||
#define TR_FILE_EXISTS "FILE ALREADY EXISTS"
|
#define TR_FILE_EXISTS "FILE ALREADY EXISTS"
|
||||||
#define TR_ASK_OVERWRITE "Do you want to overwrite?"
|
#define TR_ASK_OVERWRITE "Do you want to overwrite?"
|
||||||
|
|
||||||
|
|||||||
@@ -842,6 +842,8 @@
|
|||||||
#define TR_SELECT_TEMPLATE "SELECT A MODEL TEMPLATE:"
|
#define TR_SELECT_TEMPLATE "SELECT A MODEL TEMPLATE:"
|
||||||
#define TR_NO_TEMPLATES "No model templates were found in this folder"
|
#define TR_NO_TEMPLATES "No model templates were found in this folder"
|
||||||
#define TR_SAVE_TEMPLATE "Save as template"
|
#define TR_SAVE_TEMPLATE "Save as template"
|
||||||
|
#define TR_BLANK_MODEL "Blank Model"
|
||||||
|
#define TR_BLANK_MODEL_INFO "Create a blank model"
|
||||||
#define TR_FILE_EXISTS "FILE ALREADY EXISTS"
|
#define TR_FILE_EXISTS "FILE ALREADY EXISTS"
|
||||||
#define TR_ASK_OVERWRITE "Do you want to overwrite?"
|
#define TR_ASK_OVERWRITE "Do you want to overwrite?"
|
||||||
|
|
||||||
|
|||||||
@@ -828,6 +828,8 @@
|
|||||||
#define TR_SELECT_TEMPLATE "SELECT A MODEL TEMPLATE:"
|
#define TR_SELECT_TEMPLATE "SELECT A MODEL TEMPLATE:"
|
||||||
#define TR_NO_TEMPLATES "No model templates were found in this folder"
|
#define TR_NO_TEMPLATES "No model templates were found in this folder"
|
||||||
#define TR_SAVE_TEMPLATE "Save as template"
|
#define TR_SAVE_TEMPLATE "Save as template"
|
||||||
|
#define TR_BLANK_MODEL "Blank Model"
|
||||||
|
#define TR_BLANK_MODEL_INFO "Create a blank model"
|
||||||
#define TR_FILE_EXISTS "FILE ALREADY EXISTS"
|
#define TR_FILE_EXISTS "FILE ALREADY EXISTS"
|
||||||
#define TR_ASK_OVERWRITE "Do you want to overwrite?"
|
#define TR_ASK_OVERWRITE "Do you want to overwrite?"
|
||||||
|
|
||||||
|
|||||||
@@ -839,6 +839,8 @@
|
|||||||
#define TR_SELECT_TEMPLATE "SELECT A MODEL TEMPLATE:"
|
#define TR_SELECT_TEMPLATE "SELECT A MODEL TEMPLATE:"
|
||||||
#define TR_NO_TEMPLATES "No model templates were found in this folder"
|
#define TR_NO_TEMPLATES "No model templates were found in this folder"
|
||||||
#define TR_SAVE_TEMPLATE "Save as template"
|
#define TR_SAVE_TEMPLATE "Save as template"
|
||||||
|
#define TR_BLANK_MODEL "Blank Model"
|
||||||
|
#define TR_BLANK_MODEL_INFO "Create a blank model"
|
||||||
#define TR_FILE_EXISTS "FILE ALREADY EXISTS"
|
#define TR_FILE_EXISTS "FILE ALREADY EXISTS"
|
||||||
#define TR_ASK_OVERWRITE "Do you want to overwrite?"
|
#define TR_ASK_OVERWRITE "Do you want to overwrite?"
|
||||||
|
|
||||||
|
|||||||
@@ -847,6 +847,8 @@
|
|||||||
#define TR_SELECT_TEMPLATE "SELECT A MODEL TEMPLATE:"
|
#define TR_SELECT_TEMPLATE "SELECT A MODEL TEMPLATE:"
|
||||||
#define TR_NO_TEMPLATES "No model templates were found in this folder"
|
#define TR_NO_TEMPLATES "No model templates were found in this folder"
|
||||||
#define TR_SAVE_TEMPLATE "Save as template"
|
#define TR_SAVE_TEMPLATE "Save as template"
|
||||||
|
#define TR_BLANK_MODEL "Blank Model"
|
||||||
|
#define TR_BLANK_MODEL_INFO "Create a blank model"
|
||||||
#define TR_FILE_EXISTS "FILE ALREADY EXISTS"
|
#define TR_FILE_EXISTS "FILE ALREADY EXISTS"
|
||||||
#define TR_ASK_OVERWRITE "Do you want to overwrite?"
|
#define TR_ASK_OVERWRITE "Do you want to overwrite?"
|
||||||
|
|
||||||
|
|||||||
@@ -847,6 +847,8 @@
|
|||||||
#define TR_SELECT_TEMPLATE "SELECT A MODEL TEMPLATE:"
|
#define TR_SELECT_TEMPLATE "SELECT A MODEL TEMPLATE:"
|
||||||
#define TR_NO_TEMPLATES "No model templates were found in this folder"
|
#define TR_NO_TEMPLATES "No model templates were found in this folder"
|
||||||
#define TR_SAVE_TEMPLATE "Save as template"
|
#define TR_SAVE_TEMPLATE "Save as template"
|
||||||
|
#define TR_BLANK_MODEL "Blank Model"
|
||||||
|
#define TR_BLANK_MODEL_INFO "Create a blank model"
|
||||||
#define TR_FILE_EXISTS "FILE ALREADY EXISTS"
|
#define TR_FILE_EXISTS "FILE ALREADY EXISTS"
|
||||||
#define TR_ASK_OVERWRITE "Do you want to overwrite?"
|
#define TR_ASK_OVERWRITE "Do you want to overwrite?"
|
||||||
|
|
||||||
|
|||||||
@@ -775,6 +775,8 @@
|
|||||||
#define TR_SELECT_TEMPLATE "SELECT A MODEL TEMPLATE:"
|
#define TR_SELECT_TEMPLATE "SELECT A MODEL TEMPLATE:"
|
||||||
#define TR_NO_TEMPLATES "No model templates were found in this folder"
|
#define TR_NO_TEMPLATES "No model templates were found in this folder"
|
||||||
#define TR_SAVE_TEMPLATE "Save as template"
|
#define TR_SAVE_TEMPLATE "Save as template"
|
||||||
|
#define TR_BLANK_MODEL "Blank Model"
|
||||||
|
#define TR_BLANK_MODEL_INFO "Create a blank model"
|
||||||
#define TR_FILE_EXISTS "FILE ALREADY EXISTS"
|
#define TR_FILE_EXISTS "FILE ALREADY EXISTS"
|
||||||
#define TR_ASK_OVERWRITE "Do you want to overwrite?"
|
#define TR_ASK_OVERWRITE "Do you want to overwrite?"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user