diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/lang/english.lang | 5 | ||||
-rw-r--r-- | apps/menu.c | 16 | ||||
-rw-r--r-- | apps/settings.c | 26 | ||||
-rw-r--r-- | apps/settings.h | 3 | ||||
-rw-r--r-- | apps/settings_menu.c | 9 | ||||
-rw-r--r-- | apps/tree.c | 42 |
6 files changed, 81 insertions, 20 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 529000bec9..e080491e2c 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -1462,3 +1462,8 @@ id: LANG_VBRFIX | |||
1462 | desc: The context menu entry | 1462 | desc: The context menu entry |
1463 | eng: "Update VBR file" | 1463 | eng: "Update VBR file" |
1464 | new: | 1464 | new: |
1465 | |||
1466 | id: LANG_INVERT_CURSOR | ||
1467 | desc: in settings_menu | ||
1468 | eng: "Invert cursor" | ||
1469 | new: | ||
diff --git a/apps/menu.c b/apps/menu.c index bdf6f45e54..1c6be6f58a 100644 --- a/apps/menu.c +++ b/apps/menu.c | |||
@@ -64,7 +64,7 @@ struct menu { | |||
64 | the margins, so this is the amount of lines | 64 | the margins, so this is the amount of lines |
65 | we add to the cursor Y position to position | 65 | we add to the cursor Y position to position |
66 | it on a line */ | 66 | it on a line */ |
67 | #define CURSOR_WIDTH 4 | 67 | #define CURSOR_WIDTH (global_settings.invert_cursor ? 0 : 4) |
68 | 68 | ||
69 | #define SCROLLBAR_X 0 | 69 | #define SCROLLBAR_X 0 |
70 | #define SCROLLBAR_Y lcd_getymargin() | 70 | #define SCROLLBAR_Y lcd_getymargin() |
@@ -92,6 +92,8 @@ void put_cursorxy(int x, int y, bool on) | |||
92 | #ifdef HAVE_LCD_BITMAP | 92 | #ifdef HAVE_LCD_BITMAP |
93 | int fh, fw; | 93 | int fh, fw; |
94 | int xpos, ypos; | 94 | int xpos, ypos; |
95 | if (global_settings.invert_cursor) | ||
96 | return; | ||
95 | lcd_getstringsize("A", &fw, &fh); | 97 | lcd_getstringsize("A", &fw, &fh); |
96 | xpos = x*6; | 98 | xpos = x*6; |
97 | ypos = y*fh + lcd_getymargin(); | 99 | ypos = y*fh + lcd_getymargin(); |
@@ -146,7 +148,13 @@ static void menu_draw(int m) | |||
146 | (i < menus[m].itemcount) && (i<menus[m].top+menu_lines); | 148 | (i < menus[m].itemcount) && (i<menus[m].top+menu_lines); |
147 | i++) { | 149 | i++) { |
148 | if((menus[m].cursor - menus[m].top)==(i-menus[m].top)) | 150 | if((menus[m].cursor - menus[m].top)==(i-menus[m].top)) |
149 | lcd_puts_scroll(LINE_X, i-menus[m].top, menus[m].items[i].desc); | 151 | #ifdef HAVE_LCD_BITMAP |
152 | if (global_settings.invert_cursor) | ||
153 | lcd_puts_scroll_style(LINE_X, i-menus[m].top, | ||
154 | menus[m].items[i].desc, STYLE_INVERT); | ||
155 | else | ||
156 | #endif | ||
157 | lcd_puts_scroll(LINE_X, i-menus[m].top, menus[m].items[i].desc); | ||
150 | else | 158 | else |
151 | lcd_puts(LINE_X, i-menus[m].top, menus[m].items[i].desc); | 159 | lcd_puts(LINE_X, i-menus[m].top, menus[m].items[i].desc); |
152 | } | 160 | } |
@@ -197,8 +205,8 @@ static void put_cursor(int m, int target) | |||
197 | do_update = false; | 205 | do_update = false; |
198 | } | 206 | } |
199 | 207 | ||
200 | if (do_update) { | 208 | if (do_update && !global_settings.invert_cursor) { |
201 | put_cursorxy(CURSOR_X, menus[m].cursor - menus[m].top, true); | 209 | put_cursorxy(CURSOR_X, menus[m].cursor - menus[m].top, true); |
202 | lcd_update(); | 210 | lcd_update(); |
203 | } | 211 | } |
204 | 212 | ||
diff --git a/apps/settings.c b/apps/settings.c index 18a9e86fab..8c132c5f9b 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -84,7 +84,7 @@ offset abs | |||
84 | 0x08 0x1c <loudness byte> | 84 | 0x08 0x1c <loudness byte> |
85 | 0x09 0x1d <bass boost byte> | 85 | 0x09 0x1d <bass boost byte> |
86 | 0x0a 0x1e <contrast (bit 0-5), invert bit (bit 6)> | 86 | 0x0a 0x1e <contrast (bit 0-5), invert bit (bit 6)> |
87 | 0x0b 0x1f <backlight_on_when_charging, backlight_timeout> | 87 | 0x0b 0x1f <backlight_on_when_charging, invert_cursor, backlight_timeout> |
88 | 0x0c 0x20 <poweroff timer byte> | 88 | 0x0c 0x20 <poweroff timer byte> |
89 | 0x0d 0x21 <resume settings byte> | 89 | 0x0d 0x21 <resume settings byte> |
90 | 0x0e 0x22 <shuffle,dirfilter,sort_case,discharge,statusbar,show_hidden, | 90 | 0x0e 0x22 <shuffle,dirfilter,sort_case,discharge,statusbar,show_hidden, |
@@ -304,7 +304,8 @@ int settings_save( void ) | |||
304 | 304 | ||
305 | config_block[0xb] = (unsigned char) | 305 | config_block[0xb] = (unsigned char) |
306 | ((global_settings.backlight_on_when_charging?0x40:0) | | 306 | ((global_settings.backlight_on_when_charging?0x40:0) | |
307 | (global_settings.backlight_timeout & 0x3f)); | 307 | (global_settings.invert_cursor ? 0x20 : 0) | |
308 | (global_settings.backlight_timeout & 0x1f)); | ||
308 | config_block[0xc] = (unsigned char)global_settings.poweroff; | 309 | config_block[0xc] = (unsigned char)global_settings.poweroff; |
309 | config_block[0xd] = (unsigned char)global_settings.resume; | 310 | config_block[0xd] = (unsigned char)global_settings.resume; |
310 | 311 | ||
@@ -560,7 +561,9 @@ void settings_load(void) | |||
560 | 561 | ||
561 | if (config_block[0xb] != 0xFF) { | 562 | if (config_block[0xb] != 0xFF) { |
562 | /* Bit 7 is unused to be able to detect uninitialized entry */ | 563 | /* Bit 7 is unused to be able to detect uninitialized entry */ |
563 | global_settings.backlight_timeout = config_block[0xb] & 0x3f; | 564 | global_settings.backlight_timeout = config_block[0xb] & 0x1f; |
565 | global_settings.invert_cursor = | ||
566 | config_block[0xb] & 0x20 ? true : false; | ||
564 | global_settings.backlight_on_when_charging = | 567 | global_settings.backlight_on_when_charging = |
565 | config_block[0xb] & 0x40 ? true : false; | 568 | config_block[0xb] & 0x40 ? true : false; |
566 | } | 569 | } |
@@ -657,7 +660,7 @@ void settings_load(void) | |||
657 | config_block[0x28] | (config_block[0x29] << 8); | 660 | config_block[0x28] | (config_block[0x29] << 8); |
658 | 661 | ||
659 | global_settings.fade_on_stop=config_block[0xae]; | 662 | global_settings.fade_on_stop=config_block[0xae]; |
660 | 663 | ||
661 | global_settings.peak_meter_clip_hold = (config_block[0xb0]) & 0x1f; | 664 | global_settings.peak_meter_clip_hold = (config_block[0xb0]) & 0x1f; |
662 | global_settings.peak_meter_performance = | 665 | global_settings.peak_meter_performance = |
663 | (config_block[0xb0] & 0x80) != 0; | 666 | (config_block[0xb0] & 0x80) != 0; |
@@ -679,9 +682,9 @@ void settings_load(void) | |||
679 | if (config_block[0xb7] != 0xff) | 682 | if (config_block[0xb7] != 0xff) |
680 | global_settings.bidir_limit = config_block[0xb7]; | 683 | global_settings.bidir_limit = config_block[0xb7]; |
681 | 684 | ||
682 | if (config_block[0xae] != 0xff) | 685 | if (config_block[0xae] != 0xff) |
683 | global_settings.fade_on_stop = config_block[0xae]; | 686 | global_settings.fade_on_stop = config_block[0xae]; |
684 | 687 | ||
685 | memcpy(&global_settings.resume_first_index, &config_block[0xF4], 4); | 688 | memcpy(&global_settings.resume_first_index, &config_block[0xF4], 4); |
686 | memcpy(&global_settings.resume_seed, &config_block[0xF8], 4); | 689 | memcpy(&global_settings.resume_seed, &config_block[0xF8], 4); |
687 | 690 | ||
@@ -941,6 +944,8 @@ bool settings_load_config(char* file) | |||
941 | set_cfg_bool(&global_settings.scrollbar, value); | 944 | set_cfg_bool(&global_settings.scrollbar, value); |
942 | else if (!strcasecmp(name, "invert")) | 945 | else if (!strcasecmp(name, "invert")) |
943 | set_cfg_bool(&global_settings.invert, value); | 946 | set_cfg_bool(&global_settings.invert, value); |
947 | else if (!strcasecmp(name, "invert cursor")) | ||
948 | set_cfg_bool(&global_settings.invert_cursor, value); | ||
944 | #endif | 949 | #endif |
945 | else if (!strcasecmp(name, "shuffle")) | 950 | else if (!strcasecmp(name, "shuffle")) |
946 | set_cfg_bool(&global_settings.playlist_shuffle, value); | 951 | set_cfg_bool(&global_settings.playlist_shuffle, value); |
@@ -1305,6 +1310,10 @@ bool settings_save_config(void) | |||
1305 | snprintf(buf, sizeof(buf), "invert: %s\r\n", | 1310 | snprintf(buf, sizeof(buf), "invert: %s\r\n", |
1306 | options[global_settings.invert]); | 1311 | options[global_settings.invert]); |
1307 | write(fd, buf, strlen(buf)); | 1312 | write(fd, buf, strlen(buf)); |
1313 | |||
1314 | snprintf(buf, sizeof(buf), "invert cursor: %s\r\n", | ||
1315 | options[global_settings.invert_cursor]); | ||
1316 | write(fd, buf, strlen(buf)); | ||
1308 | } | 1317 | } |
1309 | 1318 | ||
1310 | snprintf(buf, sizeof(buf), "peak meter release: %d\r\n", | 1319 | snprintf(buf, sizeof(buf), "peak meter release: %d\r\n", |
@@ -1463,6 +1472,7 @@ void settings_reset(void) { | |||
1463 | global_settings.invert = DEFAULT_INVERT_SETTING; | 1472 | global_settings.invert = DEFAULT_INVERT_SETTING; |
1464 | global_settings.poweroff = DEFAULT_POWEROFF_SETTING; | 1473 | global_settings.poweroff = DEFAULT_POWEROFF_SETTING; |
1465 | global_settings.backlight_timeout = DEFAULT_BACKLIGHT_TIMEOUT_SETTING; | 1474 | global_settings.backlight_timeout = DEFAULT_BACKLIGHT_TIMEOUT_SETTING; |
1475 | global_settings.invert_cursor = DEFAULT_INVERT_CURSOR_SETTING; | ||
1466 | global_settings.backlight_on_when_charging = | 1476 | global_settings.backlight_on_when_charging = |
1467 | DEFAULT_BACKLIGHT_ON_WHEN_CHARGING_SETTING; | 1477 | DEFAULT_BACKLIGHT_ON_WHEN_CHARGING_SETTING; |
1468 | global_settings.battery_capacity = 1500; /* mAh */ | 1478 | global_settings.battery_capacity = 1500; /* mAh */ |
@@ -1684,7 +1694,7 @@ bool set_option(char* string, int* variable, char* options[], | |||
1684 | #endif | 1694 | #endif |
1685 | if ( *variable < (numoptions-1) ) | 1695 | if ( *variable < (numoptions-1) ) |
1686 | (*variable)++; | 1696 | (*variable)++; |
1687 | else | 1697 | else |
1688 | (*variable) -= (numoptions-1); | 1698 | (*variable) -= (numoptions-1); |
1689 | break; | 1699 | break; |
1690 | 1700 | ||
diff --git a/apps/settings.h b/apps/settings.h index 9f5f233a90..7876a18afa 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -79,6 +79,8 @@ struct user_settings | |||
79 | 79 | ||
80 | int contrast; /* lcd contrast: 0-63 0=low 63=high */ | 80 | int contrast; /* lcd contrast: 0-63 0=low 63=high */ |
81 | bool invert; /* invert display */ | 81 | bool invert; /* invert display */ |
82 | bool invert_cursor; /* invert the current file in dir browser and menu | ||
83 | instead of using the default cursor */ | ||
82 | int poweroff; /* power off timer */ | 84 | int poweroff; /* power off timer */ |
83 | int backlight_timeout; /* backlight off timeout: 0-18 0=never, | 85 | int backlight_timeout; /* backlight off timeout: 0-18 0=never, |
84 | 1=always, | 86 | 1=always, |
@@ -191,6 +193,7 @@ extern char rockboxdir[]; | |||
191 | #endif | 193 | #endif |
192 | #define MIN_CONTRAST_SETTING 5 | 194 | #define MIN_CONTRAST_SETTING 5 |
193 | #define DEFAULT_INVERT_SETTING false | 195 | #define DEFAULT_INVERT_SETTING false |
196 | #define DEFAULT_INVERT_CURSOR_SETTING false | ||
194 | #define DEFAULT_POWEROFF_SETTING 0 | 197 | #define DEFAULT_POWEROFF_SETTING 0 |
195 | #define DEFAULT_BACKLIGHT_TIMEOUT_SETTING 5 | 198 | #define DEFAULT_BACKLIGHT_TIMEOUT_SETTING 5 |
196 | #define DEFAULT_BACKLIGHT_ON_WHEN_CHARGING_SETTING 0 | 199 | #define DEFAULT_BACKLIGHT_ON_WHEN_CHARGING_SETTING 0 |
diff --git a/apps/settings_menu.c b/apps/settings_menu.c index c4d8c02c91..6f2fe28b91 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c | |||
@@ -59,6 +59,14 @@ static bool invert(void) | |||
59 | return rc; | 59 | return rc; |
60 | } | 60 | } |
61 | 61 | ||
62 | static bool invert_cursor(void) | ||
63 | { | ||
64 | bool rc = set_bool( str(LANG_INVERT_CURSOR), | ||
65 | &global_settings.invert_cursor); | ||
66 | |||
67 | return rc; | ||
68 | } | ||
69 | |||
62 | /** | 70 | /** |
63 | * Menu to configure the battery display on status bar | 71 | * Menu to configure the battery display on status bar |
64 | */ | 72 | */ |
@@ -726,6 +734,7 @@ static bool display_settings_menu(void) | |||
726 | { str(LANG_CONTRAST), contrast }, | 734 | { str(LANG_CONTRAST), contrast }, |
727 | #ifdef HAVE_LCD_BITMAP | 735 | #ifdef HAVE_LCD_BITMAP |
728 | { str(LANG_INVERT), invert }, | 736 | { str(LANG_INVERT), invert }, |
737 | { str(LANG_INVERT_CURSOR), invert_cursor }, | ||
729 | { str(LANG_PM_MENU), peak_meter_menu }, | 738 | { str(LANG_PM_MENU), peak_meter_menu }, |
730 | { str(LANG_VOLUME_DISPLAY), volume_type }, | 739 | { str(LANG_VOLUME_DISPLAY), volume_type }, |
731 | { str(LANG_BATTERY_DISPLAY), battery_type }, | 740 | { str(LANG_BATTERY_DISPLAY), battery_type }, |
diff --git a/apps/tree.c b/apps/tree.c index 5a8618babb..a29cc5e420 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -107,7 +107,7 @@ void browse_root(void) | |||
107 | the margins, so this is the amount of lines | 107 | the margins, so this is the amount of lines |
108 | we add to the cursor Y position to position | 108 | we add to the cursor Y position to position |
109 | it on a line */ | 109 | it on a line */ |
110 | #define CURSOR_WIDTH 4 | 110 | #define CURSOR_WIDTH (global_settings.invert_cursor ? 0 : 4) |
111 | 111 | ||
112 | #define ICON_WIDTH 6 | 112 | #define ICON_WIDTH 6 |
113 | 113 | ||
@@ -195,7 +195,13 @@ static void showfileline(int line, int direntry, bool scroll) | |||
195 | *dotpos = 0; | 195 | *dotpos = 0; |
196 | } | 196 | } |
197 | if(scroll) | 197 | if(scroll) |
198 | lcd_puts_scroll(LINE_X, line, dircache[direntry].name); | 198 | #ifdef HAVE_LCD_BITMAP |
199 | if (global_settings.invert_cursor) | ||
200 | lcd_puts_scroll_style(LINE_X, line, dircache[direntry].name, | ||
201 | STYLE_INVERT); | ||
202 | else | ||
203 | #endif | ||
204 | lcd_puts_scroll(LINE_X, line, dircache[direntry].name); | ||
199 | else | 205 | else |
200 | lcd_puts(LINE_X, line, dircache[direntry].name); | 206 | lcd_puts(LINE_X, line, dircache[direntry].name); |
201 | if (temp) | 207 | if (temp) |
@@ -203,7 +209,13 @@ static void showfileline(int line, int direntry, bool scroll) | |||
203 | } | 209 | } |
204 | else { | 210 | else { |
205 | if(scroll) | 211 | if(scroll) |
206 | lcd_puts_scroll(LINE_X, line, dircache[direntry].name); | 212 | #ifdef HAVE_LCD_BITMAP |
213 | if (global_settings.invert_cursor) | ||
214 | lcd_puts_scroll_style(LINE_X, line, dircache[direntry].name, | ||
215 | STYLE_INVERT); | ||
216 | else | ||
217 | #endif | ||
218 | lcd_puts_scroll(LINE_X, line, dircache[direntry].name); | ||
207 | else | 219 | else |
208 | lcd_puts(LINE_X, line, dircache[direntry].name); | 220 | lcd_puts(LINE_X, line, dircache[direntry].name); |
209 | } | 221 | } |
@@ -666,6 +678,11 @@ static bool handle_on(int* ds, int* dc, int numentries, int tree_max_on_screen) | |||
666 | int dircursor = *dc; | 678 | int dircursor = *dc; |
667 | char buf[MAX_PATH]; | 679 | char buf[MAX_PATH]; |
668 | 680 | ||
681 | #ifdef HAVE_LCD_BITMAP | ||
682 | int fw, fh; | ||
683 | lcd_getstringsize("A", &fw, &fh); | ||
684 | #endif | ||
685 | |||
669 | while (!exit) { | 686 | while (!exit) { |
670 | switch (button_get(true)) { | 687 | switch (button_get(true)) { |
671 | case TREE_PREV: | 688 | case TREE_PREV: |
@@ -717,8 +734,19 @@ static bool handle_on(int* ds, int* dc, int numentries, int tree_max_on_screen) | |||
717 | break; | 734 | break; |
718 | } | 735 | } |
719 | if ( used && !exit ) { | 736 | if ( used && !exit ) { |
737 | #ifdef HAVE_LCD_BITMAP | ||
738 | int xpos,ypos; | ||
739 | #endif | ||
720 | showdir(currdir, dirstart); | 740 | showdir(currdir, dirstart); |
721 | put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true); | 741 | #ifdef HAVE_LCD_BITMAP |
742 | if (global_settings.invert_cursor) { | ||
743 | xpos = lcd_getxmargin(); | ||
744 | ypos = (CURSOR_Y + dircursor) * fh + lcd_getymargin(); | ||
745 | lcd_invertrect(xpos, ypos, LCD_WIDTH-xpos, fh); | ||
746 | } | ||
747 | else | ||
748 | #endif | ||
749 | put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true); | ||
722 | lcd_update(); | 750 | lcd_update(); |
723 | } | 751 | } |
724 | } | 752 | } |
@@ -1020,8 +1048,7 @@ bool dirbrowse(char *root) | |||
1020 | { | 1048 | { |
1021 | if (dircursor + dirstart + 1 < numentries ) { | 1049 | if (dircursor + dirstart + 1 < numentries ) { |
1022 | if(dircursor+1 < tree_max_on_screen) { | 1050 | if(dircursor+1 < tree_max_on_screen) { |
1023 | put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, | 1051 | put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, false); |
1024 | false); | ||
1025 | dircursor++; | 1052 | dircursor++; |
1026 | put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true); | 1053 | put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true); |
1027 | } | 1054 | } |
@@ -1034,8 +1061,7 @@ bool dirbrowse(char *root) | |||
1034 | } | 1061 | } |
1035 | else { | 1062 | else { |
1036 | if(numentries < tree_max_on_screen) { | 1063 | if(numentries < tree_max_on_screen) { |
1037 | put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, | 1064 | put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, false); |
1038 | false); | ||
1039 | dirstart = dircursor = 0; | 1065 | dirstart = dircursor = 0; |
1040 | put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true); | 1066 | put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true); |
1041 | } | 1067 | } |