summaryrefslogtreecommitdiff
path: root/apps/tree.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2003-04-16 00:12:31 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2003-04-16 00:12:31 +0000
commite43b78ac466588d8a0bc95efd7b476495739c47a (patch)
treeea59fab446209d3ccd9cae6834d39f0b03edb6d0 /apps/tree.c
parent55be5868f2bf2bc8b27fc0339c2ffc93a0a68006 (diff)
downloadrockbox-e43b78ac466588d8a0bc95efd7b476495739c47a.tar.gz
rockbox-e43b78ac466588d8a0bc95efd7b476495739c47a.zip
Magnus Öman's long awaited inverted cursor patch
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3565 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/tree.c')
-rw-r--r--apps/tree.c42
1 files changed, 34 insertions, 8 deletions
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 }