mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 13:42:47 +00:00
Display full filename in file info (for long filenames)
This commit is contained in:
parent
4e00b8b7b6
commit
294890057f
@ -309,6 +309,26 @@ u32 GetFontHeight(void) {
|
|||||||
return font_height;
|
return font_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MultiLineString(char* dest, const char* orig, int llen, int maxl) {
|
||||||
|
char* ptr_o = (char*) orig;
|
||||||
|
char* ptr_d = (char*) dest;
|
||||||
|
for (int l = 0; l < maxl; l++) {
|
||||||
|
int len = strnlen(ptr_o, llen+1);
|
||||||
|
snprintf(ptr_d, llen+1, "%.*s", llen, ptr_o);
|
||||||
|
ptr_o += min(len, llen);
|
||||||
|
ptr_d += min(len, llen);
|
||||||
|
if (len <= llen) break;
|
||||||
|
*(ptr_d++) = '\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
// string too long?
|
||||||
|
if (!maxl) *dest = '\0';
|
||||||
|
else if (*ptr_o) {
|
||||||
|
if (llen >= 3) snprintf(ptr_d - 4, 4, "...");
|
||||||
|
else *(ptr_d-1) = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void WordWrapString(char* str, int llen) {
|
void WordWrapString(char* str, int llen) {
|
||||||
char* last_brk = str - 1;
|
char* last_brk = str - 1;
|
||||||
char* last_spc = str - 1;
|
char* last_spc = str - 1;
|
||||||
|
@ -67,6 +67,7 @@ u32 GetDrawStringWidth(const char* str);
|
|||||||
u32 GetFontWidth(void);
|
u32 GetFontWidth(void);
|
||||||
u32 GetFontHeight(void);
|
u32 GetFontHeight(void);
|
||||||
|
|
||||||
|
void MultiLineString(char* dest, const char* orig, int llen, int maxl);
|
||||||
void WordWrapString(char* str, int llen);
|
void WordWrapString(char* str, int llen);
|
||||||
void ResizeString(char* dest, const char* orig, int nsize, int tpos, bool align_right);
|
void ResizeString(char* dest, const char* orig, int nsize, int tpos, bool align_right);
|
||||||
void TruncateString(char* dest, const char* orig, int nsize, int tpos);
|
void TruncateString(char* dest, const char* orig, int nsize, int tpos);
|
||||||
|
@ -952,12 +952,12 @@ u32 StandardCopy(u32* cursor, u32* scroll) {
|
|||||||
u32 DirFileAttrMenu(const char* path, const char *name) {
|
u32 DirFileAttrMenu(const char* path, const char *name) {
|
||||||
bool drv = (path[2] == '\0');
|
bool drv = (path[2] == '\0');
|
||||||
bool vrt = (!drv); // will be checked below
|
bool vrt = (!drv); // will be checked below
|
||||||
char namestr[32], datestr[32], attrstr[128], sizestr[192];
|
char namestr[128], datestr[32], attrstr[128], sizestr[192];
|
||||||
FILINFO fno;
|
FILINFO fno;
|
||||||
u8 new_attrib;
|
u8 new_attrib;
|
||||||
|
|
||||||
// create truncated name string
|
// create mutiline name string
|
||||||
TruncateString(namestr, name, 31, 8);
|
MultiLineString(namestr, name, 31, 4);
|
||||||
|
|
||||||
// preparations: create file info, date string
|
// preparations: create file info, date string
|
||||||
if (!drv) {
|
if (!drv) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user