From 6c2af7c2aa8afde380b5a5f7c606c49dd38bef18 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Thu, 1 Sep 2005 08:04:37 +0000 Subject: On popular demand, the arrow cursor is reintroduced git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7438 a1c6a512-1295-4272-9138-f99709370657 --- apps/lang/english.lang | 18 +++++++++--------- apps/lang/italiano.lang | 24 ++++++++++++------------ apps/menu.c | 45 +++++++++++++++++++++++++++++++++++---------- apps/menu.h | 4 ---- apps/playlist_viewer.c | 34 +++++++++++++++++++++------------- apps/recorder/icons.c | 1 + apps/recorder/icons.h | 1 + apps/recorder/recording.c | 15 +++++++++------ apps/settings.c | 3 ++- apps/settings.h | 2 ++ apps/tree.c | 12 +++++++----- 11 files changed, 99 insertions(+), 60 deletions(-) diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 8699fa502e..6feac25ee8 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -1334,9 +1334,9 @@ voice: "" new: id: LANG_INVERT_CURSOR -desc: DEPRECATED -eng: "" -voice: "" +desc: in settings_menu +eng: "Line Selector" +voice: "Line Selector" new: id: LANG_RECORDING_EDITABLE @@ -1364,15 +1364,15 @@ voice: "Caption backlight" new: id: LANG_INVERT_CURSOR_POINTER -desc: DEPRECATED -eng: "" -voice: "" +desc: in settings_menu +eng: "Pointer" +voice: "Pointer" new: id: LANG_INVERT_CURSOR_BAR -desc: DEPRECATED -eng: "" -voice: "" +desc: in settings_menu +eng: "Bar(Inverse)" +voice: "Inverse Bar" new: id: LANG_INVERT_LCD_NORMAL diff --git a/apps/lang/italiano.lang b/apps/lang/italiano.lang index 22e28df5c1..b7fb712ddb 100644 --- a/apps/lang/italiano.lang +++ b/apps/lang/italiano.lang @@ -1320,10 +1320,10 @@ voice: new: "" id: LANG_INVERT_CURSOR -desc: DEPRECATED -eng: "" -voice: -new: +desc: In settings_menu +eng: "Line Selector" +voice: "Selettore Di Linea" +new: "Selettore Di Linea" id: LANG_RECORDING_EDITABLE desc: Editable recordings setting @@ -1350,16 +1350,16 @@ voice: "Retroilluminazione al cambio traccia" new: "Retroilluminazione al cambio traccia" id: LANG_INVERT_CURSOR_POINTER -desc: DEPRECATED -eng: "" -voice: -new: +desc: in settings_menu +eng: "Pointer" +voice: "Puntatore" +new: "Puntatore" id: LANG_INVERT_CURSOR_BAR -desc: DEPRECATED -eng: "" -voice: -new: +desc: in settings_menu +eng: "Bar(Inverse)" +voice: "Barra Invertita" +new: "Barra (Invertita)" id: LANG_INVERT_LCD_NORMAL desc: in settings_menu diff --git a/apps/menu.c b/apps/menu.c index 3b0ee4ddd6..ad22047b9d 100644 --- a/apps/menu.c +++ b/apps/menu.c @@ -59,7 +59,8 @@ struct menu { /* pixel margins */ #define MARGIN_X (global_settings.scrollbar && \ - menu_lines < menus[m].itemcount ? SCROLLBAR_WIDTH : 0) + menu_lines < menus[m].itemcount ? SCROLLBAR_WIDTH : 0) +\ + CURSOR_WIDTH #define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0) /* position the entry-list starts at */ @@ -72,6 +73,7 @@ struct menu { the margins, so this is the amount of lines we add to the cursor Y position to position it on a line */ +#define CURSOR_WIDTH (global_settings.invert_cursor ? 0 : 4) #define SCROLLBAR_X 0 #define SCROLLBAR_Y lcd_getymargin() @@ -93,19 +95,44 @@ struct menu { static struct menu menus[MAX_MENUS]; static bool inuse[MAX_MENUS] = { false }; -#ifdef HAVE_LCD_CHARCELLS /* count in letter positions, NOT pixels */ 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(); + if ( fh > 8 ) + ypos += (fh - 8) / 2; +#endif + /* place the cursor */ if(on) { +#ifdef HAVE_LCD_BITMAP + lcd_mono_bitmap(bitmap_icons_6x8[Icon_Cursor], xpos, ypos, 4, 8); +#else lcd_putc(x, y, CURSOR_CHAR); +#endif } else { +#if defined(HAVE_LCD_BITMAP) + /* I use xy here since it needs to disregard the margins */ + lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); + lcd_fillrect (xpos, ypos, 4, 8); + lcd_set_drawmode(DRMODE_SOLID); +#else lcd_putc(x, y, ' '); +#endif } } -#endif + void menu_draw(int m) { int i = 0; @@ -153,20 +180,18 @@ void menu_draw(int m) /* We want to scroll the line where the cursor is */ if((menus[m].cursor - menus[m].top)==(i-menus[m].top)) #ifdef HAVE_LCD_BITMAP - lcd_puts_scroll_style(LINE_X, i-menus[m].top, - P2STR(menus[m].items[i].desc), STYLE_INVERT); -#else - lcd_puts_scroll(LINE_X, i-menus[m].top, - P2STR(menus[m].items[i].desc)); + if (global_settings.invert_cursor) + lcd_puts_scroll_style(LINE_X, i-menus[m].top, + P2STR(menus[m].items[i].desc), STYLE_INVERT); + else #endif + lcd_puts_scroll(LINE_X, i-menus[m].top, P2STR(menus[m].items[i].desc)); else lcd_puts(LINE_X, i-menus[m].top, P2STR(menus[m].items[i].desc)); } -#ifdef HAVE_LCD_CHARCELLS /* place the cursor */ put_cursorxy(CURSOR_X, menus[m].cursor - menus[m].top, true); -#endif #ifdef HAVE_LCD_BITMAP if (global_settings.scrollbar && menus[m].itemcount > menu_lines) diff --git a/apps/menu.h b/apps/menu.h index d8d9386236..a378bd8402 100644 --- a/apps/menu.h +++ b/apps/menu.h @@ -91,11 +91,7 @@ int menu_init(const struct menu_item* mitems, int count, int (*callback)(int, in const char *button1, const char *button2, const char *button3); void menu_exit(int menu); -#ifdef HAVE_LCD_CHARCELLS void put_cursorxy(int x, int y, bool on); -#else -#define put_cursorxy(...) -#endif /* Returns below define, or number of selected menu item*/ int menu_show(int m); diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index 33e00981da..b7a042733e 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c @@ -48,12 +48,13 @@ #define CURSOR_X (global_settings.scrollbar && \ viewer.num_tracks>viewer.num_display_lines?1:0) #define CURSOR_Y 0 + #define CURSOR_WIDTH (global_settings.invert_cursor ? 0 : 4) #define ICON_WIDTH ((viewer.char_width > 6) ? viewer.char_width : 6) #define MARGIN_X ((global_settings.scrollbar && \ viewer.num_tracks > viewer.num_display_lines ? \ - SCROLLBAR_WIDTH : 0) + \ + SCROLLBAR_WIDTH : 0) + CURSOR_WIDTH + \ (global_settings.playlist_viewer_icons ? \ ICON_WIDTH : 0)) #define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0) @@ -461,7 +462,7 @@ static void display_playlist(void) if ( viewer.line_height > 8 ) offset = (viewer.line_height - 8) / 2; lcd_mono_bitmap(bitmap_icons_6x8[Icon_Audio], - CURSOR_X * 6, + CURSOR_X * 6 + CURSOR_WIDTH, MARGIN_Y+(i*viewer.line_height) + offset, 6, 8); #else lcd_putc(LINE_X-1, i, Icon_Audio); @@ -471,7 +472,7 @@ static void display_playlist(void) { /* Track we are moving */ #ifdef HAVE_LCD_BITMAP - lcd_putsxy(CURSOR_X * 6, + lcd_putsxy(CURSOR_X * 6 + CURSOR_WIDTH, MARGIN_Y+(i*viewer.line_height), "M"); #else lcd_putc(LINE_X-1, i, 'M'); @@ -481,7 +482,7 @@ static void display_playlist(void) { /* Queued track */ #ifdef HAVE_LCD_BITMAP - lcd_putsxy(CURSOR_X * 6, + lcd_putsxy(CURSOR_X * 6 + CURSOR_WIDTH, MARGIN_Y+(i*viewer.line_height), "Q"); #else lcd_putc(LINE_X-1, i, 'Q'); @@ -602,10 +603,11 @@ static void update_display_line(int line, bool scroll) if (scroll) { #ifdef HAVE_LCD_BITMAP - lcd_puts_scroll_style(LINE_X, line, str, STYLE_INVERT); -#else - lcd_puts_scroll(LINE_X, line, str); + if (global_settings.invert_cursor) + lcd_puts_scroll_style(LINE_X, line, str, STYLE_INVERT); + else #endif + lcd_puts_scroll(LINE_X, line, str); } else lcd_puts(LINE_X, line, str); @@ -849,12 +851,18 @@ bool playlist_viewer_ex(char* filename) /* Flash cursor to identify that we are moving a track */ cursor_on = !cursor_on; #ifdef HAVE_LCD_BITMAP - lcd_set_drawmode(DRMODE_COMPLEMENT); - lcd_fillrect( - MARGIN_X, MARGIN_Y+(viewer.cursor_pos*viewer.line_height), - LCD_WIDTH, viewer.line_height); - lcd_set_drawmode(DRMODE_SOLID); - lcd_invertscroll(LINE_X, viewer.cursor_pos); + if (global_settings.invert_cursor) + { + lcd_set_drawmode(DRMODE_COMPLEMENT); + lcd_fillrect( + MARGIN_X, MARGIN_Y+(viewer.cursor_pos*viewer.line_height), + LCD_WIDTH, viewer.line_height); + lcd_set_drawmode(DRMODE_SOLID); + lcd_invertscroll(LINE_X, viewer.cursor_pos); + } + else + put_cursorxy(CURSOR_X, CURSOR_Y + viewer.cursor_pos, + cursor_on); lcd_update_rect( 0, MARGIN_Y + (viewer.cursor_pos * viewer.line_height), diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c index 4d1d2908c4..148235f040 100644 --- a/apps/recorder/icons.c +++ b/apps/recorder/icons.c @@ -39,6 +39,7 @@ const unsigned char bitmap_icons_6x8[LastIcon][6] = { 0x60, 0x7f, 0x03, 0x33, 0x3f, 0x00 }, /* Musical note */ { 0x7e, 0x41, 0x41, 0x42, 0x7e, 0x00 }, /* Folder */ { 0x55, 0x00, 0x55, 0x55, 0x55, 0x55 }, /* Playlist */ + { 0x3e, 0x1c, 0x08, 0x00, 0x00, 0x00 }, /* Cursor / Marker */ { 0x58, 0x5f, 0x42, 0x50, 0x55, 0x55 }, /* WPS file */ { 0x63, 0x7f, 0x3a, 0x7f, 0x63, 0x00 }, /* Mod or ajz file */ { 0x60, 0x70, 0x38, 0x2c, 0x7e, 0x7e }, /* Font file */ diff --git a/apps/recorder/icons.h b/apps/recorder/icons.h index 5c442ea371..17605ef490 100644 --- a/apps/recorder/icons.h +++ b/apps/recorder/icons.h @@ -36,6 +36,7 @@ enum icons_6x8 { Icon_Audio, Icon_Folder, Icon_Playlist, + Icon_Cursor, Icon_Wps, Icon_Firmware, Icon_Font, diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 72d752ec55..ea71538322 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c @@ -348,7 +348,7 @@ bool recording_screen(void) lcd_setfont(FONT_SYSFIXED); lcd_getstringsize("M", &w, &h); - lcd_setmargins(0, 8); + lcd_setmargins(global_settings.invert_cursor ? 0 : w, 8); if(rec_create_directory() > 0) have_recorded = true; @@ -598,7 +598,7 @@ bool recording_screen(void) update_countdown = 1; /* Update immediately */ lcd_setfont(FONT_SYSFIXED); - lcd_setmargins(0, 8); + lcd_setmargins(global_settings.invert_cursor ? 0 : w, 8); } break; #endif @@ -739,7 +739,7 @@ bool recording_screen(void) fmt_gain(SOUND_MIC_GAIN, global_settings.rec_mic_gain, buf2, sizeof(buf2))); - if (pos++ == cursor) + if (global_settings.invert_cursor && (pos++ == cursor)) lcd_puts_style(0, 4, buf, STYLE_INVERT); else lcd_puts(0, 4, buf); @@ -754,7 +754,7 @@ bool recording_screen(void) snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_GAIN), fmt_gain(SOUND_LEFT_GAIN, gain, buf2, sizeof(buf2))); - if (pos++ == cursor) + if (global_settings.invert_cursor && (pos++ == cursor)) lcd_puts_style(0, 4, buf, STYLE_INVERT); else lcd_puts(0, 4, buf); @@ -763,7 +763,7 @@ bool recording_screen(void) fmt_gain(SOUND_LEFT_GAIN, global_settings.rec_left_gain, buf2, sizeof(buf2))); - if (pos++ == cursor) + if (global_settings.invert_cursor && (pos++ == cursor)) lcd_puts_style(0, 5, buf, STYLE_INVERT); else lcd_puts(0, 5, buf); @@ -772,13 +772,16 @@ bool recording_screen(void) fmt_gain(SOUND_RIGHT_GAIN, global_settings.rec_right_gain, buf2, sizeof(buf2))); - if (pos++ == cursor) + if (global_settings.invert_cursor && (pos++ == cursor)) lcd_puts_style(0, 6, buf, STYLE_INVERT); else lcd_puts(0, 6, buf); } } + if(global_settings.rec_source != SOURCE_SPDIF) + put_cursorxy(0, 4 + cursor, true); + if (global_settings.rec_source != SOURCE_LINE) { snprintf(buf, 32, "%s %s [%d]", freq_str[global_settings.rec_frequency], diff --git a/apps/settings.c b/apps/settings.c index f6c9d4f929..6649ce3f89 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -78,7 +78,7 @@ const char rec_base_directory[] = REC_BASE_DIR; #include "pcm_playback.h" #endif -#define CONFIG_BLOCK_VERSION 27 +#define CONFIG_BLOCK_VERSION 26 #define CONFIG_BLOCK_SIZE 512 #define RTC_BLOCK_SIZE 44 @@ -220,6 +220,7 @@ static const struct bit_entry rtc_bits[] = {1, S_O(invert), false, "invert", off_on }, {1, S_O(flip_display), false, "flip display", off_on }, /* display */ + {1, S_O(invert_cursor), false, "invert cursor", off_on }, {1, S_O(statusbar), true, "statusbar", off_on }, {1, S_O(scrollbar), true, "scrollbar", off_on }, #if CONFIG_KEYPAD == RECORDER_PAD diff --git a/apps/settings.h b/apps/settings.h index 0df93c9cf1..8387fe02a8 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -195,6 +195,8 @@ struct user_settings int contrast; /* lcd contrast: 0-63 0=low 63=high */ bool invert; /* invert display */ + bool invert_cursor; /* invert the current file in dir browser and menu + instead of using the default cursor */ bool flip_display; /* turn display (and button layout) by 180 degrees */ bool bidi_support; /* reverse hebrew/arabic chars: 0=off, 1=on */ int poweroff; /* power off timer */ diff --git a/apps/tree.c b/apps/tree.c index e9ee881c01..e56c7a76de 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -162,7 +162,7 @@ struct tree_context* tree_get_context(void) /* pixel margins */ #define MARGIN_X (global_settings.scrollbar && \ tc.filesindir > tree_max_on_screen ? SCROLLBAR_WIDTH : 0) + \ - (global_settings.show_icons && ICON_WIDTH > 0 ? ICON_WIDTH :0) + 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 */ @@ -175,6 +175,7 @@ struct tree_context* tree_get_context(void) the margins, so this is the amount of lines we add to the cursor Y position to position it on a line */ +#define CURSOR_WIDTH (global_settings.invert_cursor ? 0 : 4) #define ICON_WIDTH 6 @@ -221,10 +222,11 @@ static void showfileline(int line, char* name, int attr, bool scroll) if(scroll) { #ifdef HAVE_LCD_BITMAP lcd_setfont(FONT_UI); - lcd_puts_scroll_style(xpos, line, name, STYLE_INVERT); -#else - lcd_puts_scroll(xpos, line, name); + if (global_settings.invert_cursor) + lcd_puts_scroll_style(xpos, line, name, STYLE_INVERT); + else #endif + lcd_puts_scroll(xpos, line, name); } else lcd_puts(xpos, line, name); @@ -394,7 +396,7 @@ static int showdir(void) if ( line_height > 8 ) offset = (line_height - 8) / 2; lcd_mono_bitmap(icon, - CURSOR_X * 6, + CURSOR_X * 6 + CURSOR_WIDTH, MARGIN_Y+(i-start)*line_height + offset, 6, 8); #else if (icon < 0 ) -- cgit v1.2.3