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
This commit is contained in:
Björn Stenberg 2003-06-05 09:38:26 +00:00
parent ffefc5d5e1
commit d1a6fa113d
7 changed files with 67 additions and 18 deletions

View File

@ -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"

View File

@ -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:

View File

@ -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();

View File

@ -85,7 +85,7 @@ offset abs
0x07 0x1b <treble byte>
0x08 0x1c <loudness byte>
0x09 0x1d <bass boost byte>
0x0a 0x1e <contrast (bit 0-5), invert bit (bit 6)>
0x0a 0x1e <contrast (bit 0-5), invert bit (bit 6), show_icons (bit 7)>
0x0b 0x1f <backlight_on_when_charging, invert_cursor, backlight_timeout>
0x0c 0x20 <poweroff timer byte>
0x0d 0x21 <resume settings byte>
@ -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 )

View File

@ -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 */

View File

@ -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 },
};

View File

@ -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);