diff options
-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 | ||||
-rw-r--r-- | firmware/drivers/lcd-recorder.c | 27 | ||||
-rw-r--r-- | firmware/export/lcd.h | 6 |
8 files changed, 111 insertions, 23 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 | } |
diff --git a/firmware/drivers/lcd-recorder.c b/firmware/drivers/lcd-recorder.c index 6665ea88dc..fcb7d306b8 100644 --- a/firmware/drivers/lcd-recorder.c +++ b/firmware/drivers/lcd-recorder.c | |||
@@ -81,6 +81,7 @@ struct scrollinfo { | |||
81 | int starty; | 81 | int starty; |
82 | bool backward; /* scroll presently forward or backward? */ | 82 | bool backward; /* scroll presently forward or backward? */ |
83 | bool bidir; | 83 | bool bidir; |
84 | bool invert; /* invert the scrolled text */ | ||
84 | long start_tick; | 85 | long start_tick; |
85 | }; | 86 | }; |
86 | 87 | ||
@@ -270,6 +271,11 @@ int lcd_getstringsize(unsigned char *str, int *w, int *h) | |||
270 | /* put a string at a given char position */ | 271 | /* put a string at a given char position */ |
271 | void lcd_puts(int x, int y, unsigned char *str) | 272 | void lcd_puts(int x, int y, unsigned char *str) |
272 | { | 273 | { |
274 | lcd_puts_style(x, y, str, STYLE_DEFAULT); | ||
275 | } | ||
276 | |||
277 | void lcd_puts_style(int x, int y, unsigned char *str, int style) | ||
278 | { | ||
273 | int xpos,ypos,w,h; | 279 | int xpos,ypos,w,h; |
274 | 280 | ||
275 | #if defined(SIMULATOR) && defined(HAVE_LCD_CHARCELLS) | 281 | #if defined(SIMULATOR) && defined(HAVE_LCD_CHARCELLS) |
@@ -294,6 +300,8 @@ void lcd_puts(int x, int y, unsigned char *str) | |||
294 | ypos = ymargin + y*h; | 300 | ypos = ymargin + y*h; |
295 | lcd_putsxy(xpos, ypos, str); | 301 | lcd_putsxy(xpos, ypos, str); |
296 | lcd_clearrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h); | 302 | lcd_clearrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h); |
303 | if (style & STYLE_INVERT) | ||
304 | lcd_invertrect(xpos, ypos, LCD_WIDTH - xpos, h); | ||
297 | 305 | ||
298 | #if defined(SIMULATOR) && defined(HAVE_LCD_CHARCELLS) | 306 | #if defined(SIMULATOR) && defined(HAVE_LCD_CHARCELLS) |
299 | lcd_update(); | 307 | lcd_update(); |
@@ -670,14 +678,19 @@ void lcd_invertpixel(int x, int y) | |||
670 | INVERT_PIXEL(x,y); | 678 | INVERT_PIXEL(x,y); |
671 | } | 679 | } |
672 | 680 | ||
673 | void lcd_puts_scroll(int x, int y, unsigned char* string) | 681 | void lcd_puts_scroll(int x, int y, unsigned char *string) |
682 | { | ||
683 | lcd_puts_scroll_style(x, y, string, STYLE_DEFAULT); | ||
684 | } | ||
685 | |||
686 | void lcd_puts_scroll_style(int x, int y, unsigned char *string, int style) | ||
674 | { | 687 | { |
675 | struct scrollinfo* s; | 688 | struct scrollinfo* s; |
676 | int w, h; | 689 | int w, h; |
677 | int index; | 690 | int index; |
678 | int free_index=0; | 691 | int free_index=0; |
679 | 692 | ||
680 | DEBUGF("puts_scroll: %s\n", string); | 693 | DEBUGF("puts_scroll_style: %s\n", string); |
681 | 694 | ||
682 | for (index = 0; index < SCROLLABLE_LINES; index++) { | 695 | for (index = 0; index < SCROLLABLE_LINES; index++) { |
683 | s = &scroll[index]; | 696 | s = &scroll[index]; |
@@ -698,8 +711,14 @@ void lcd_puts_scroll(int x, int y, unsigned char* string) | |||
698 | index=free_index; | 711 | index=free_index; |
699 | s = &scroll[index]; /* get the proper 's' */ | 712 | s = &scroll[index]; /* get the proper 's' */ |
700 | s->start_tick = current_tick + scroll_delay; | 713 | s->start_tick = current_tick + scroll_delay; |
714 | s->invert = false; | ||
715 | if (style & STYLE_INVERT) { | ||
716 | s->invert = true; | ||
717 | lcd_puts_style(x,y,string,STYLE_INVERT); | ||
718 | } | ||
719 | else | ||
720 | lcd_puts(x,y,string); | ||
701 | 721 | ||
702 | lcd_puts(x,y,string); | ||
703 | lcd_getstringsize(string, &w, &h); | 722 | lcd_getstringsize(string, &w, &h); |
704 | 723 | ||
705 | if (LCD_WIDTH - x * 8 - xmargin < w) { | 724 | if (LCD_WIDTH - x * 8 - xmargin < w) { |
@@ -819,6 +838,8 @@ static void scroll_thread(void) | |||
819 | 838 | ||
820 | lcd_clearrect(xpos, ypos, LCD_WIDTH - xmargin, h); | 839 | lcd_clearrect(xpos, ypos, LCD_WIDTH - xmargin, h); |
821 | lcd_putsxyofs(xpos, ypos, s->offset, s->line); | 840 | lcd_putsxyofs(xpos, ypos, s->offset, s->line); |
841 | if (s->invert) | ||
842 | lcd_invertrect(xpos, ypos, LCD_WIDTH - xmargin, h); | ||
822 | lcd_update_rect(xpos, ypos, LCD_WIDTH - xmargin, h); | 843 | lcd_update_rect(xpos, ypos, LCD_WIDTH - xmargin, h); |
823 | } | 844 | } |
824 | 845 | ||
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index 74bbcc304e..45d9296555 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h | |||
@@ -24,14 +24,20 @@ | |||
24 | #include "sh7034.h" | 24 | #include "sh7034.h" |
25 | #include "config.h" | 25 | #include "config.h" |
26 | 26 | ||
27 | #define STYLE_DEFAULT 0 | ||
28 | #define STYLE_INVERT 1 | ||
29 | |||
27 | /* common functions */ | 30 | /* common functions */ |
28 | extern void lcd_init(void); | 31 | extern void lcd_init(void); |
29 | extern void lcd_clear_display(void); | 32 | extern void lcd_clear_display(void); |
30 | extern void lcd_backlight(bool on); | 33 | extern void lcd_backlight(bool on); |
31 | extern void lcd_puts(int x, int y, unsigned char *string); | 34 | extern void lcd_puts(int x, int y, unsigned char *string); |
35 | extern void lcd_puts_style(int x, int y, unsigned char *string, int style); | ||
32 | extern void lcd_putc(int x, int y, unsigned short ch); | 36 | extern void lcd_putc(int x, int y, unsigned short ch); |
33 | 37 | ||
34 | extern void lcd_puts_scroll(int x, int y, unsigned char* string ); | 38 | extern void lcd_puts_scroll(int x, int y, unsigned char* string ); |
39 | extern void lcd_puts_scroll_style(int x, int y, unsigned char* string, | ||
40 | int style); | ||
35 | extern void lcd_icon(int icon, bool enable); | 41 | extern void lcd_icon(int icon, bool enable); |
36 | extern void lcd_stop_scroll(void); | 42 | extern void lcd_stop_scroll(void); |
37 | extern void lcd_scroll_speed( int speed ); | 43 | extern void lcd_scroll_speed( int speed ); |