diff options
author | Björn Stenberg <bjorn@haxx.se> | 2003-06-05 09:38:26 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2003-06-05 09:38:26 +0000 |
commit | d1a6fa113d30fc133e9401b3cce2bfcd0e76e7d3 (patch) | |
tree | bf67047daad332da54f9939efd4ae3ede7185994 /apps/tree.c | |
parent | ffefc5d5e1f8d1e0cc5fa895200b57ac0595300a (diff) | |
download | rockbox-d1a6fa113d30fc133e9401b3cce2bfcd0e76e7d3.tar.gz rockbox-d1a6fa113d30fc133e9401b3cce2bfcd0e76e7d3.zip |
Addded option to hide icons in dir browser. (Patch #728377)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3731 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/tree.c')
-rw-r--r-- | apps/tree.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/apps/tree.c b/apps/tree.c index acfc7ee263..bc9ae7b883 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -57,8 +57,8 @@ | |||
57 | #include "widgets.h" | 57 | #include "widgets.h" |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | /* Mirror of global_settings.max_files_in_dir */ | 60 | /* Boot value of global_settings.max_files_in_dir */ |
61 | int max_files_in_dir; | 61 | static int max_files_in_dir; |
62 | 62 | ||
63 | static char *name_buffer; | 63 | static char *name_buffer; |
64 | static int name_buffer_size; /* Size of allocated buffer */ | 64 | static int name_buffer_size; /* Size of allocated buffer */ |
@@ -98,7 +98,7 @@ void browse_root(void) | |||
98 | /* pixel margins */ | 98 | /* pixel margins */ |
99 | #define MARGIN_X (global_settings.scrollbar && \ | 99 | #define MARGIN_X (global_settings.scrollbar && \ |
100 | filesindir > tree_max_on_screen ? SCROLLBAR_WIDTH : 0) + \ | 100 | filesindir > tree_max_on_screen ? SCROLLBAR_WIDTH : 0) + \ |
101 | CURSOR_WIDTH + ICON_WIDTH | 101 | CURSOR_WIDTH + (global_settings.show_icons && ICON_WIDTH > 0 ? ICON_WIDTH :0) |
102 | #define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0) | 102 | #define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0) |
103 | 103 | ||
104 | /* position the entry-list starts at */ | 104 | /* position the entry-list starts at */ |
@@ -188,11 +188,19 @@ static int compare(const void* p1, const void* p2) | |||
188 | 188 | ||
189 | static void showfileline(int line, int direntry, bool scroll) | 189 | static void showfileline(int line, int direntry, bool scroll) |
190 | { | 190 | { |
191 | char* name = dircache[direntry].name; | ||
192 | int xpos = LINE_X; | ||
193 | |||
194 | #ifdef HAVE_LCD_CHARCELLS | ||
195 | if (!global_settings.show_icons) | ||
196 | xpos--; | ||
197 | #endif | ||
198 | |||
191 | /* if any file filter is on, strip the extension */ | 199 | /* if any file filter is on, strip the extension */ |
192 | if (global_settings.dirfilter != SHOW_ALL && | 200 | if (global_settings.dirfilter != SHOW_ALL && |
193 | !(dircache[direntry].attr & ATTR_DIRECTORY)) | 201 | !(dircache[direntry].attr & ATTR_DIRECTORY)) |
194 | { | 202 | { |
195 | char* dotpos = strrchr(dircache[direntry].name, '.'); | 203 | char* dotpos = strrchr(name, '.'); |
196 | char temp=0; | 204 | char temp=0; |
197 | if (dotpos) { | 205 | if (dotpos) { |
198 | temp = *dotpos; | 206 | temp = *dotpos; |
@@ -201,13 +209,12 @@ static void showfileline(int line, int direntry, bool scroll) | |||
201 | if(scroll) | 209 | if(scroll) |
202 | #ifdef HAVE_LCD_BITMAP | 210 | #ifdef HAVE_LCD_BITMAP |
203 | if (global_settings.invert_cursor) | 211 | if (global_settings.invert_cursor) |
204 | lcd_puts_scroll_style(LINE_X, line, dircache[direntry].name, | 212 | lcd_puts_scroll_style(xpos, line, name, STYLE_INVERT); |
205 | STYLE_INVERT); | ||
206 | else | 213 | else |
207 | #endif | 214 | #endif |
208 | lcd_puts_scroll(LINE_X, line, dircache[direntry].name); | 215 | lcd_puts_scroll(xpos, line, name); |
209 | else | 216 | else |
210 | lcd_puts(LINE_X, line, dircache[direntry].name); | 217 | lcd_puts(xpos, line, name); |
211 | if (temp) | 218 | if (temp) |
212 | *dotpos = temp; | 219 | *dotpos = temp; |
213 | } | 220 | } |
@@ -215,13 +222,12 @@ static void showfileline(int line, int direntry, bool scroll) | |||
215 | if(scroll) | 222 | if(scroll) |
216 | #ifdef HAVE_LCD_BITMAP | 223 | #ifdef HAVE_LCD_BITMAP |
217 | if (global_settings.invert_cursor) | 224 | if (global_settings.invert_cursor) |
218 | lcd_puts_scroll_style(LINE_X, line, dircache[direntry].name, | 225 | lcd_puts_scroll_style(xpos, line, name, STYLE_INVERT); |
219 | STYLE_INVERT); | ||
220 | else | 226 | else |
221 | #endif | 227 | #endif |
222 | lcd_puts_scroll(LINE_X, line, dircache[direntry].name); | 228 | lcd_puts_scroll(xpos, line, name); |
223 | else | 229 | else |
224 | lcd_puts(LINE_X, line, dircache[direntry].name); | 230 | lcd_puts(xpos, line, name); |
225 | } | 231 | } |
226 | } | 232 | } |
227 | 233 | ||
@@ -475,7 +481,7 @@ static int showdir(char *path, int start) | |||
475 | #endif | 481 | #endif |
476 | } | 482 | } |
477 | 483 | ||
478 | if (icon_type) { | 484 | if (icon_type && global_settings.show_icons) { |
479 | #ifdef HAVE_LCD_BITMAP | 485 | #ifdef HAVE_LCD_BITMAP |
480 | int offset=0; | 486 | int offset=0; |
481 | if ( line_height > 8 ) | 487 | if ( line_height > 8 ) |
@@ -493,7 +499,7 @@ static int showdir(char *path, int start) | |||
493 | } | 499 | } |
494 | 500 | ||
495 | #ifdef HAVE_LCD_BITMAP | 501 | #ifdef HAVE_LCD_BITMAP |
496 | if (global_settings.scrollbar && filesindir > tree_max_on_screen) | 502 | if (global_settings.scrollbar && (filesindir > tree_max_on_screen)) |
497 | scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1, | 503 | scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1, |
498 | LCD_HEIGHT - SCROLLBAR_Y, filesindir, start, | 504 | LCD_HEIGHT - SCROLLBAR_Y, filesindir, start, |
499 | start + tree_max_on_screen, VERTICAL); | 505 | start + tree_max_on_screen, VERTICAL); |