diff options
-rw-r--r-- | apps/filetypes.c | 27 | ||||
-rw-r--r-- | apps/filetypes.h | 2 | ||||
-rw-r--r-- | apps/tree.c | 2 | ||||
-rw-r--r-- | docs/sample.colors | 11 |
4 files changed, 31 insertions, 11 deletions
diff --git a/apps/filetypes.c b/apps/filetypes.c index a6ccff32ba..89933c8774 100644 --- a/apps/filetypes.c +++ b/apps/filetypes.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include "splash.h" | 39 | #include "splash.h" |
40 | #include "buffer.h" | 40 | #include "buffer.h" |
41 | #include "icons.h" | 41 | #include "icons.h" |
42 | #include "logf.h" | ||
42 | 43 | ||
43 | /* max filetypes (plugins & icons stored here) */ | 44 | /* max filetypes (plugins & icons stored here) */ |
44 | #if CONFIG_CODEC == SWCODEC | 45 | #if CONFIG_CODEC == SWCODEC |
@@ -160,7 +161,12 @@ void read_color_theme_file(void) { | |||
160 | { | 161 | { |
161 | if (!settings_parseline(buffer, &ext, &color)) | 162 | if (!settings_parseline(buffer, &ext, &color)) |
162 | continue; | 163 | continue; |
163 | for (i=0; i<filetype_count; i++) | 164 | if (!strcasecmp(ext, "folder")) |
165 | { | ||
166 | custom_colors[0] = hex_to_rgb(color); | ||
167 | continue; | ||
168 | } | ||
169 | for (i=1; i<filetype_count; i++) | ||
164 | { | 170 | { |
165 | if (filetypes[i].extension && | 171 | if (filetypes[i].extension && |
166 | !strcasecmp(ext, filetypes[i].extension)) | 172 | !strcasecmp(ext, filetypes[i].extension)) |
@@ -369,12 +375,23 @@ static int find_attr(int attr) | |||
369 | } | 375 | } |
370 | 376 | ||
371 | #ifdef HAVE_LCD_COLOR | 377 | #ifdef HAVE_LCD_COLOR |
372 | int filetype_get_color(int attr) | 378 | int filetype_get_color(const char * name, int attr) |
373 | { | 379 | { |
374 | int index = find_attr(attr); | 380 | char *extension; |
375 | if (index < 0) | 381 | int i; |
382 | if ((attr & ATTR_DIRECTORY)==ATTR_DIRECTORY) | ||
383 | return custom_colors[0]; | ||
384 | extension = strrchr(name, '.'); | ||
385 | if (!extension) | ||
376 | return -1; | 386 | return -1; |
377 | return custom_colors[index]; | 387 | extension++; |
388 | logf("%s %s",name,extension); | ||
389 | for (i=1; i<filetype_count; i++) | ||
390 | { | ||
391 | if (filetypes[i].extension && | ||
392 | !strcasecmp(extension, filetypes[i].extension)) | ||
393 | return custom_colors[i]; | ||
394 | } | ||
378 | return -1; | 395 | return -1; |
379 | } | 396 | } |
380 | #endif | 397 | #endif |
diff --git a/apps/filetypes.h b/apps/filetypes.h index 13f4e56161..52e60eab1f 100644 --- a/apps/filetypes.h +++ b/apps/filetypes.h | |||
@@ -60,7 +60,7 @@ void read_color_theme_file(void); | |||
60 | /* Return the attribute (FILE_ATTR_*) of the file */ | 60 | /* Return the attribute (FILE_ATTR_*) of the file */ |
61 | int filetype_get_attr(const char* file); | 61 | int filetype_get_attr(const char* file); |
62 | #ifdef HAVE_LCD_COLOR | 62 | #ifdef HAVE_LCD_COLOR |
63 | int filetype_get_color(int attr); | 63 | int filetype_get_color(const char * name, int attr); |
64 | #endif | 64 | #endif |
65 | int filetype_get_icon(int attr); | 65 | int filetype_get_icon(int attr); |
66 | /* return the plugin filename associated with the file */ | 66 | /* return the plugin filename associated with the file */ |
diff --git a/apps/tree.c b/apps/tree.c index a790400754..d0fe47fa2c 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -171,7 +171,7 @@ static int tree_get_filecolor(int selected_item, void * data) | |||
171 | struct tree_context * local_tc=(struct tree_context *)data; | 171 | struct tree_context * local_tc=(struct tree_context *)data; |
172 | struct entry* dc = local_tc->dircache; | 172 | struct entry* dc = local_tc->dircache; |
173 | struct entry* e = &dc[selected_item]; | 173 | struct entry* e = &dc[selected_item]; |
174 | return filetype_get_color(e->attr); | 174 | return filetype_get_color(e->name, e->attr); |
175 | } | 175 | } |
176 | #endif | 176 | #endif |
177 | 177 | ||
diff --git a/docs/sample.colors b/docs/sample.colors index 2f90dee125..930a34e8dd 100644 --- a/docs/sample.colors +++ b/docs/sample.colors | |||
@@ -1,4 +1,7 @@ | |||
1 | mp3:904010 | 1 | folder:808080 |
2 | ogg:D04040 | 2 | ipod:00B0B0 |
3 | txt:FF0000 | 3 | mp3:00FF00 |
4 | cfg:00FF00 | 4 | flac:00FF00 |
5 | ogg:00FF00 | ||
6 | txt:FF0000 | ||
7 | cfg:D00000 | ||