From d1a6fa113d30fc133e9401b3cce2bfcd0e76e7d3 Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Thu, 5 Jun 2003 09:38:26 +0000 Subject: 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 --- apps/lang/deutsch.lang | 14 ++++++++++++-- apps/lang/english.lang | 5 +++++ apps/menu.c | 3 +++ apps/settings.c | 13 +++++++++++-- apps/settings.h | 1 + apps/settings_menu.c | 15 +++++++++++++++ apps/tree.c | 34 ++++++++++++++++++++-------------- 7 files changed, 67 insertions(+), 18 deletions(-) (limited to 'apps') diff --git a/apps/lang/deutsch.lang b/apps/lang/deutsch.lang index c1e30365cf..a50e9bf96c 100644 --- a/apps/lang/deutsch.lang +++ b/apps/lang/deutsch.lang @@ -1461,10 +1461,20 @@ new: "normal" id: LANG_RECORDING_EDITABLE desc: Editable recordings setting -eng: "Editable files" -new: "Editierbare Dateien" +eng: "Independent frames" +new: "unabhängige mp3-Frames" id: LANG_VBRFIX desc: The context menu entry eng: "Update VBR file" new: "VBR Datei aktualisieren" + +id: LANG_SHOW_ICONS +desc: in settings_menu +eng: "Show Icons" +new: "Icons anzeigen" + +id: LANG_CAPTION_BACKLIGHT +desc: in settings_menu +eng: "Caption backlight" +new: "Beleuchtung an bei Titelwechsel" diff --git a/apps/lang/english.lang b/apps/lang/english.lang index f36c2f7990..78d2b5d710 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -1547,3 +1547,8 @@ id: LANG_RECORD_TIMESPLIT_REC decs: Display of record timer interval setting, on the record screen eng: "Split time:" new: + +id: LANG_SHOW_ICONS +desc: in settings_menu +eng: "Show Icons" +new: diff --git a/apps/menu.c b/apps/menu.c index 023f6fbbfb..b7bc542bb0 100644 --- a/apps/menu.c +++ b/apps/menu.c @@ -92,8 +92,11 @@ void put_cursorxy(int x, int y, bool on) #ifdef HAVE_LCD_BITMAP int fh, fw; int xpos, ypos; + + /* check here instead of at every call (ugly, but cheap) */ if (global_settings.invert_cursor) return; + lcd_getstringsize("A", &fw, &fh); xpos = x*6; ypos = y*fh + lcd_getymargin(); diff --git a/apps/settings.c b/apps/settings.c index 7805518872..a538543960 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -85,7 +85,7 @@ offset abs 0x07 0x1b 0x08 0x1c 0x09 0x1d -0x0a 0x1e +0x0a 0x1e 0x0b 0x1f 0x0c 0x20 0x0d 0x21 @@ -307,7 +307,8 @@ int settings_save( void ) config_block[0xa] = (unsigned char) ((global_settings.contrast & 0x3f) | - (global_settings.invert ? 0x40 : 0)); + (global_settings.invert ? 0x40 : 0) | + (global_settings.show_icons ? 0x80 : 0) ); config_block[0xb] = (unsigned char) ((global_settings.backlight_on_when_charging?0x40:0) | @@ -581,6 +582,8 @@ void settings_load(void) config_block[0xa] & 0x40 ? true : false; if ( global_settings.contrast < MIN_CONTRAST_SETTING ) global_settings.contrast = DEFAULT_CONTRAST_SETTING; + global_settings.show_icons = + config_block[0xa] & 0x80 ? true : false; } if (config_block[0xb] != 0xFF) { @@ -959,6 +962,8 @@ bool settings_load_config(char* file) set_cfg_bool(&global_settings.invert, value); else if (!strcasecmp(name, "invert cursor")) set_cfg_bool(&global_settings.invert_cursor, value); + else if (!strcasecmp(name, "show icons")) + set_cfg_bool(&global_settings.show_icons, value); #endif else if (!strcasecmp(name, "caption backlight")) set_cfg_bool(&global_settings.caption_backlight, value); @@ -1265,6 +1270,9 @@ bool settings_save_config(void) fprintf(fd, "invert cursor: %s\r\n", boolopt[global_settings.invert_cursor]); + fprintf(fd, "show icons: %s\r\n", + boolopt[global_settings.show_icons]); + fprintf(fd, "peak meter release: %d\r\n", global_settings.peak_meter_release); @@ -1450,6 +1458,7 @@ void settings_reset(void) { global_settings.caption_backlight = false; global_settings.max_files_in_dir = 400; global_settings.max_files_in_playlist = 10000; + global_settings.show_icons = true; } bool set_bool(char* string, bool* variable ) diff --git a/apps/settings.h b/apps/settings.h index 49f4d588f2..96c83b0879 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -177,6 +177,7 @@ struct user_settings int max_files_in_dir; /* Max entries in directory (file browser) */ int max_files_in_playlist; /* Max entries in playlist */ + bool show_icons; /* 0=hide 1=show */ }; /* prototypes */ diff --git a/apps/settings_menu.c b/apps/settings_menu.c index 1f318036f1..cc3a1b9307 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c @@ -57,8 +57,19 @@ static bool caption_backlight(void) return rc; } +/** + * Menu to set icon visibility + */ +static bool show_icons(void) +{ + return set_bool( str(LANG_SHOW_ICONS), &global_settings.show_icons ); +} + #ifdef HAVE_LCD_BITMAP + /** + * Menu to set LCD Mode (normal/inverse) + */ static bool invert(void) { bool rc = set_bool_options(str(LANG_INVERT), @@ -70,6 +81,9 @@ static bool invert(void) return rc; } +/** + * Menu to set Line Selector Type (Pointer/Bar) + */ static bool invert_cursor(void) { return set_bool_options(str(LANG_INVERT_CURSOR), @@ -829,6 +843,7 @@ static bool display_settings_menu(void) { str(LANG_VOLUME_DISPLAY), volume_type }, { str(LANG_BATTERY_DISPLAY), battery_type }, #endif + { str(LANG_SHOW_ICONS), show_icons }, { str(LANG_CAPTION_BACKLIGHT), caption_backlight }, }; 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 @@ #include "widgets.h" #endif -/* Mirror of global_settings.max_files_in_dir */ -int max_files_in_dir; +/* Boot value of global_settings.max_files_in_dir */ +static int max_files_in_dir; static char *name_buffer; static int name_buffer_size; /* Size of allocated buffer */ @@ -98,7 +98,7 @@ void browse_root(void) /* pixel margins */ #define MARGIN_X (global_settings.scrollbar && \ filesindir > tree_max_on_screen ? SCROLLBAR_WIDTH : 0) + \ - CURSOR_WIDTH + ICON_WIDTH + CURSOR_WIDTH + (global_settings.show_icons && ICON_WIDTH > 0 ? ICON_WIDTH :0) #define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0) /* position the entry-list starts at */ @@ -188,11 +188,19 @@ static int compare(const void* p1, const void* p2) static void showfileline(int line, int direntry, bool scroll) { + char* name = dircache[direntry].name; + int xpos = LINE_X; + +#ifdef HAVE_LCD_CHARCELLS + if (!global_settings.show_icons) + xpos--; +#endif + /* if any file filter is on, strip the extension */ if (global_settings.dirfilter != SHOW_ALL && !(dircache[direntry].attr & ATTR_DIRECTORY)) { - char* dotpos = strrchr(dircache[direntry].name, '.'); + char* dotpos = strrchr(name, '.'); char temp=0; if (dotpos) { temp = *dotpos; @@ -201,13 +209,12 @@ static void showfileline(int line, int direntry, bool scroll) if(scroll) #ifdef HAVE_LCD_BITMAP if (global_settings.invert_cursor) - lcd_puts_scroll_style(LINE_X, line, dircache[direntry].name, - STYLE_INVERT); + lcd_puts_scroll_style(xpos, line, name, STYLE_INVERT); else #endif - lcd_puts_scroll(LINE_X, line, dircache[direntry].name); + lcd_puts_scroll(xpos, line, name); else - lcd_puts(LINE_X, line, dircache[direntry].name); + lcd_puts(xpos, line, name); if (temp) *dotpos = temp; } @@ -215,13 +222,12 @@ static void showfileline(int line, int direntry, bool scroll) if(scroll) #ifdef HAVE_LCD_BITMAP if (global_settings.invert_cursor) - lcd_puts_scroll_style(LINE_X, line, dircache[direntry].name, - STYLE_INVERT); + lcd_puts_scroll_style(xpos, line, name, STYLE_INVERT); else #endif - lcd_puts_scroll(LINE_X, line, dircache[direntry].name); + lcd_puts_scroll(xpos, line, name); else - lcd_puts(LINE_X, line, dircache[direntry].name); + lcd_puts(xpos, line, name); } } @@ -475,7 +481,7 @@ static int showdir(char *path, int start) #endif } - if (icon_type) { + if (icon_type && global_settings.show_icons) { #ifdef HAVE_LCD_BITMAP int offset=0; if ( line_height > 8 ) @@ -493,7 +499,7 @@ static int showdir(char *path, int start) } #ifdef HAVE_LCD_BITMAP - if (global_settings.scrollbar && filesindir > tree_max_on_screen) + if (global_settings.scrollbar && (filesindir > tree_max_on_screen)) scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1, LCD_HEIGHT - SCROLLBAR_Y, filesindir, start, start + tree_max_on_screen, VERTICAL); -- cgit v1.2.3