fix(color): Limit label lengths, improve lbl display, prevent inv. char (#2287)

* (cpn) Add bullets & length warning

* (fw) Show labels with bullet separators

* (fw) Check all running twice. Remove from here

* (fw) Correct buffer overflow when labels too long

* (fw) Rem bullets in model label string

* (fw, cpn) Labels length

cpn,fw Limit label length
cpn Check correct model on rename length
cpn Focus issues
cpn Add rename,  move up/down.. still has an issue with selection. TODO...
cpn Switch to utf8 encoding
cpn Rename button ;)

* (cpn) Move up down working

re-Fix Checkbox, partially isn't what I thought (not greyed)

* (fw) Add CSV string funcs

Limit length of model edit shorter in portrait mode

* (cpn) Correct Label option showing on B&W

* (fw) Radio filename set but no file exists don't create

* (cpn) Simplify wording

* (fw) Correct debug values

* (fw) Reduce truncation length

* (both) Don't allow special chars in label name

(cpn) Prevent move when at top and bottom
(fw) Remove multiple label length defines
(fw) Shorten truncate length even more

* (fw) Close model_select on new model
This commit is contained in:
Cliff
2022-09-18 10:47:21 +10:00
committed by GitHub
parent c3660ab931
commit 333c2828ea
16 changed files with 405 additions and 248 deletions
+11 -3
View File
@@ -48,6 +48,12 @@
#define DEFAULT_MODEL_SORT NAME_ASC
#if LCD_W > LCD_H // Landscape
#define LABEL_TRUNCATE_LENGTH 21
#else
#define LABEL_TRUNCATE_LENGTH 16
#endif
struct ModelData;
struct ModuleData;
@@ -134,8 +140,7 @@ class ModelMap : protected std::multimap<uint16_t, ModelCell *>
const std::string &,
std::function<void(const char *file, int progress)> progress = nullptr);
bool moveLabelTo(unsigned current, unsigned newind);
bool renameLabel(
const std::string &from, const std::string &to,
bool renameLabel(const std::string &from, std::string to,
std::function<void(const char *file, int progress)> progress = nullptr);
std::string getCurrentLabel() { return currentlabel; };
void setCurrentLabel(const std::string &lbl)
@@ -143,7 +148,7 @@ class ModelMap : protected std::multimap<uint16_t, ModelCell *>
currentlabel = lbl;
setDirty();
}
std::string getLabelString(ModelCell *, const char *noresults = "");
std::string getBulletLabelString(ModelCell *, const char *noresults = "");
void setDirty(bool save = false);
bool isDirty() { return _isDirty; }
@@ -161,6 +166,9 @@ class ModelMap : protected std::multimap<uint16_t, ModelCell *>
static std::string toCSV(const LabelsVector &labels);
static LabelsVector fromCSV(const char *str);
static void escapeCSV(std::string &str);
static void unEscapeCSV(std::string &str);
static void removeYAMLChars(std::string &str);
static void replace_all(std::string &str,
const std::string &from,
const std::string &to);