Added color for text files

This commit is contained in:
Mateusz Faderewski 2024-01-19 04:21:05 +01:00
parent 14e45c0230
commit b283f48de2
5 changed files with 28 additions and 22 deletions

View File

@ -37,7 +37,7 @@ void component_file_list_draw (entry_t *list, int entries, int selected) {
component_main_text_draw(
ALIGN_LEFT, VALIGN_TOP,
"^%02X** empty directory **",
STL_UNKNOWN
STL_GRAY
);
} else {
rdpq_paragraph_t *file_list_layout;
@ -80,12 +80,16 @@ void component_file_list_draw (entry_t *list, int entries, int selected) {
menu_font_style_t style;
switch (entry->type) {
case ENTRY_TYPE_DIR: style = STL_DIRECTORY; break;
case ENTRY_TYPE_SAVE: style = STL_SAVE; break;
case ENTRY_TYPE_OTHER: style = STL_UNKNOWN; break;
case ENTRY_TYPE_IMAGE: style = STL_MEDIA; break;
case ENTRY_TYPE_MUSIC: style = STL_MEDIA; break;
default: style = STL_DEFAULT; break;
case ENTRY_TYPE_DIR: style = STL_YELLOW; break;
case ENTRY_TYPE_ROM: style = STL_DEFAULT; break;
case ENTRY_TYPE_DISK: style = STL_DEFAULT; break;
case ENTRY_TYPE_EMULATOR: style = STL_DEFAULT; break;
case ENTRY_TYPE_SAVE: style = STL_GREEN; break;
case ENTRY_TYPE_IMAGE: style = STL_BLUE; break;
case ENTRY_TYPE_MUSIC: style = STL_BLUE; break;
case ENTRY_TYPE_TEXT: style = STL_ORANGE; break;
case ENTRY_TYPE_OTHER: style = STL_GRAY; break;
default: style = STL_GRAY; break;
}
rdpq_paragraph_builder_style(style);

View File

@ -7,10 +7,11 @@ static void load_default_font (void) {
rdpq_font_t *default_font = rdpq_font_load("rom:/FiraMonoBold.font64");
rdpq_font_style(default_font, STL_DEFAULT, &((rdpq_fontstyle_t) { .color = RGBA32(0xFF, 0xFF, 0xFF, 0xFF) }));
rdpq_font_style(default_font, STL_DIRECTORY, &((rdpq_fontstyle_t) { .color = RGBA32(0xFF, 0xFF, 0x70, 0xFF) }));
rdpq_font_style(default_font, STL_SAVE, &((rdpq_fontstyle_t) { .color = RGBA32(0x70, 0xFF, 0x70, 0xFF) }));
rdpq_font_style(default_font, STL_MEDIA, &((rdpq_fontstyle_t) { .color = RGBA32(0x70, 0xBC, 0xFF, 0xFF) }));
rdpq_font_style(default_font, STL_UNKNOWN, &((rdpq_fontstyle_t) { .color = RGBA32(0xA0, 0xA0, 0xA0, 0xFF) }));
rdpq_font_style(default_font, STL_GREEN, &((rdpq_fontstyle_t) { .color = RGBA32(0x70, 0xFF, 0x70, 0xFF) }));
rdpq_font_style(default_font, STL_BLUE, &((rdpq_fontstyle_t) { .color = RGBA32(0x70, 0xBC, 0xFF, 0xFF) }));
rdpq_font_style(default_font, STL_YELLOW, &((rdpq_fontstyle_t) { .color = RGBA32(0xFF, 0xFF, 0x70, 0xFF) }));
rdpq_font_style(default_font, STL_ORANGE, &((rdpq_fontstyle_t) { .color = RGBA32(0xFF, 0x99, 0x00, 0xFF) }));
rdpq_font_style(default_font, STL_GRAY, &((rdpq_fontstyle_t) { .color = RGBA32(0xA0, 0xA0, 0xA0, 0xFF) }));
rdpq_text_register_font(FNT_DEFAULT, default_font);
}

View File

@ -15,10 +15,11 @@ typedef enum {
/** @brief Font style enumeration. */
typedef enum {
STL_DEFAULT = 0,
STL_DIRECTORY,
STL_SAVE,
STL_MEDIA,
STL_UNKNOWN,
STL_GREEN,
STL_BLUE,
STL_YELLOW,
STL_ORANGE,
STL_GRAY,
} menu_font_style_t;

View File

@ -51,8 +51,8 @@ typedef enum {
ENTRY_TYPE_EMULATOR,
ENTRY_TYPE_SAVE,
ENTRY_TYPE_IMAGE,
ENTRY_TYPE_TEXT,
ENTRY_TYPE_MUSIC,
ENTRY_TYPE_TEXT,
ENTRY_TYPE_OTHER,
} entry_type_t;

View File

@ -47,14 +47,14 @@ static int compare_entry (const void *pa, const void *pb) {
return -1;
} else if (b->type == ENTRY_TYPE_IMAGE) {
return 1;
} else if (a->type == ENTRY_TYPE_TEXT) {
return -1;
} else if (b->type == ENTRY_TYPE_TEXT) {
return 1;
} else if (a->type == ENTRY_TYPE_MUSIC) {
return -1;
} else if (b->type == ENTRY_TYPE_MUSIC) {
return 1;
} else if (a->type == ENTRY_TYPE_TEXT) {
return -1;
} else if (b->type == ENTRY_TYPE_TEXT) {
return 1;
}
}
@ -355,14 +355,14 @@ static void draw (menu_t *menu, surface_t *d) {
"%s\n"
"^%02XB: Back^00",
menu->browser.entries == 0 ? "" : action,
path_is_root(menu->browser.directory) ? STL_UNKNOWN : STL_DEFAULT
path_is_root(menu->browser.directory) ? STL_GRAY : STL_DEFAULT
);
component_actions_bar_text_draw(
ALIGN_RIGHT, VALIGN_TOP,
"Start: Settings\n"
"^%02XR: Options^00",
menu->browser.entries == 0 ? STL_UNKNOWN : STL_DEFAULT
menu->browser.entries == 0 ? STL_GRAY : STL_DEFAULT
);
if (menu->current_time >= 0) {