On popular demand, the arrow cursor is reintroduced

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7438 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2005-09-01 08:04:37 +00:00
parent 977aa614ba
commit 6c2af7c2aa
11 changed files with 99 additions and 60 deletions

View file

@ -1334,9 +1334,9 @@ voice: ""
new: new:
id: LANG_INVERT_CURSOR id: LANG_INVERT_CURSOR
desc: DEPRECATED desc: in settings_menu
eng: "" eng: "Line Selector"
voice: "" voice: "Line Selector"
new: new:
id: LANG_RECORDING_EDITABLE id: LANG_RECORDING_EDITABLE
@ -1364,15 +1364,15 @@ voice: "Caption backlight"
new: new:
id: LANG_INVERT_CURSOR_POINTER id: LANG_INVERT_CURSOR_POINTER
desc: DEPRECATED desc: in settings_menu
eng: "" eng: "Pointer"
voice: "" voice: "Pointer"
new: new:
id: LANG_INVERT_CURSOR_BAR id: LANG_INVERT_CURSOR_BAR
desc: DEPRECATED desc: in settings_menu
eng: "" eng: "Bar(Inverse)"
voice: "" voice: "Inverse Bar"
new: new:
id: LANG_INVERT_LCD_NORMAL id: LANG_INVERT_LCD_NORMAL

View file

@ -1320,10 +1320,10 @@ voice:
new: "" new: ""
id: LANG_INVERT_CURSOR id: LANG_INVERT_CURSOR
desc: DEPRECATED desc: In settings_menu
eng: "" eng: "Line Selector"
voice: voice: "Selettore Di Linea"
new: new: "Selettore Di Linea"
id: LANG_RECORDING_EDITABLE id: LANG_RECORDING_EDITABLE
desc: Editable recordings setting desc: Editable recordings setting
@ -1350,16 +1350,16 @@ voice: "Retroilluminazione al cambio traccia"
new: "Retroilluminazione al cambio traccia" new: "Retroilluminazione al cambio traccia"
id: LANG_INVERT_CURSOR_POINTER id: LANG_INVERT_CURSOR_POINTER
desc: DEPRECATED desc: in settings_menu
eng: "" eng: "Pointer"
voice: voice: "Puntatore"
new: new: "Puntatore"
id: LANG_INVERT_CURSOR_BAR id: LANG_INVERT_CURSOR_BAR
desc: DEPRECATED desc: in settings_menu
eng: "" eng: "Bar(Inverse)"
voice: voice: "Barra Invertita"
new: new: "Barra (Invertita)"
id: LANG_INVERT_LCD_NORMAL id: LANG_INVERT_LCD_NORMAL
desc: in settings_menu desc: in settings_menu

View file

@ -59,7 +59,8 @@ struct menu {
/* pixel margins */ /* pixel margins */
#define MARGIN_X (global_settings.scrollbar && \ #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) #define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0)
/* position the entry-list starts at */ /* position the entry-list starts at */
@ -72,6 +73,7 @@ struct menu {
the margins, so this is the amount of lines the margins, so this is the amount of lines
we add to the cursor Y position to position we add to the cursor Y position to position
it on a line */ it on a line */
#define CURSOR_WIDTH (global_settings.invert_cursor ? 0 : 4)
#define SCROLLBAR_X 0 #define SCROLLBAR_X 0
#define SCROLLBAR_Y lcd_getymargin() #define SCROLLBAR_Y lcd_getymargin()
@ -93,19 +95,44 @@ struct menu {
static struct menu menus[MAX_MENUS]; static struct menu menus[MAX_MENUS];
static bool inuse[MAX_MENUS] = { false }; static bool inuse[MAX_MENUS] = { false };
#ifdef HAVE_LCD_CHARCELLS
/* count in letter positions, NOT pixels */ /* count in letter positions, NOT pixels */
void put_cursorxy(int x, int y, bool on) 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 */ /* place the cursor */
if(on) { 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); lcd_putc(x, y, CURSOR_CHAR);
#endif
} }
else { 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, ' '); lcd_putc(x, y, ' ');
#endif
} }
} }
#endif
void menu_draw(int m) void menu_draw(int m)
{ {
int i = 0; int i = 0;
@ -153,20 +180,18 @@ void menu_draw(int m)
/* We want to scroll the line where the cursor is */ /* We want to scroll the line where the cursor is */
if((menus[m].cursor - menus[m].top)==(i-menus[m].top)) if((menus[m].cursor - menus[m].top)==(i-menus[m].top))
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
lcd_puts_scroll_style(LINE_X, i-menus[m].top, if (global_settings.invert_cursor)
P2STR(menus[m].items[i].desc), STYLE_INVERT); lcd_puts_scroll_style(LINE_X, i-menus[m].top,
#else P2STR(menus[m].items[i].desc), STYLE_INVERT);
lcd_puts_scroll(LINE_X, i-menus[m].top, else
P2STR(menus[m].items[i].desc));
#endif #endif
lcd_puts_scroll(LINE_X, i-menus[m].top, P2STR(menus[m].items[i].desc));
else else
lcd_puts(LINE_X, i-menus[m].top, P2STR(menus[m].items[i].desc)); lcd_puts(LINE_X, i-menus[m].top, P2STR(menus[m].items[i].desc));
} }
#ifdef HAVE_LCD_CHARCELLS
/* place the cursor */ /* place the cursor */
put_cursorxy(CURSOR_X, menus[m].cursor - menus[m].top, true); put_cursorxy(CURSOR_X, menus[m].cursor - menus[m].top, true);
#endif
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
if (global_settings.scrollbar && menus[m].itemcount > menu_lines) if (global_settings.scrollbar && menus[m].itemcount > menu_lines)

View file

@ -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); const char *button1, const char *button2, const char *button3);
void menu_exit(int menu); void menu_exit(int menu);
#ifdef HAVE_LCD_CHARCELLS
void put_cursorxy(int x, int y, bool on); void put_cursorxy(int x, int y, bool on);
#else
#define put_cursorxy(...)
#endif
/* Returns below define, or number of selected menu item*/ /* Returns below define, or number of selected menu item*/
int menu_show(int m); int menu_show(int m);

View file

@ -48,12 +48,13 @@
#define CURSOR_X (global_settings.scrollbar && \ #define CURSOR_X (global_settings.scrollbar && \
viewer.num_tracks>viewer.num_display_lines?1:0) viewer.num_tracks>viewer.num_display_lines?1:0)
#define CURSOR_Y 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 ICON_WIDTH ((viewer.char_width > 6) ? viewer.char_width : 6)
#define MARGIN_X ((global_settings.scrollbar && \ #define MARGIN_X ((global_settings.scrollbar && \
viewer.num_tracks > viewer.num_display_lines ? \ viewer.num_tracks > viewer.num_display_lines ? \
SCROLLBAR_WIDTH : 0) + \ SCROLLBAR_WIDTH : 0) + CURSOR_WIDTH + \
(global_settings.playlist_viewer_icons ? \ (global_settings.playlist_viewer_icons ? \
ICON_WIDTH : 0)) ICON_WIDTH : 0))
#define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0) #define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0)
@ -461,7 +462,7 @@ static void display_playlist(void)
if ( viewer.line_height > 8 ) if ( viewer.line_height > 8 )
offset = (viewer.line_height - 8) / 2; offset = (viewer.line_height - 8) / 2;
lcd_mono_bitmap(bitmap_icons_6x8[Icon_Audio], 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); MARGIN_Y+(i*viewer.line_height) + offset, 6, 8);
#else #else
lcd_putc(LINE_X-1, i, Icon_Audio); lcd_putc(LINE_X-1, i, Icon_Audio);
@ -471,7 +472,7 @@ static void display_playlist(void)
{ {
/* Track we are moving */ /* Track we are moving */
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
lcd_putsxy(CURSOR_X * 6, lcd_putsxy(CURSOR_X * 6 + CURSOR_WIDTH,
MARGIN_Y+(i*viewer.line_height), "M"); MARGIN_Y+(i*viewer.line_height), "M");
#else #else
lcd_putc(LINE_X-1, i, 'M'); lcd_putc(LINE_X-1, i, 'M');
@ -481,7 +482,7 @@ static void display_playlist(void)
{ {
/* Queued track */ /* Queued track */
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
lcd_putsxy(CURSOR_X * 6, lcd_putsxy(CURSOR_X * 6 + CURSOR_WIDTH,
MARGIN_Y+(i*viewer.line_height), "Q"); MARGIN_Y+(i*viewer.line_height), "Q");
#else #else
lcd_putc(LINE_X-1, i, 'Q'); lcd_putc(LINE_X-1, i, 'Q');
@ -602,10 +603,11 @@ static void update_display_line(int line, bool scroll)
if (scroll) if (scroll)
{ {
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
lcd_puts_scroll_style(LINE_X, line, str, STYLE_INVERT); if (global_settings.invert_cursor)
#else lcd_puts_scroll_style(LINE_X, line, str, STYLE_INVERT);
lcd_puts_scroll(LINE_X, line, str); else
#endif #endif
lcd_puts_scroll(LINE_X, line, str);
} }
else else
lcd_puts(LINE_X, line, str); 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 */ /* Flash cursor to identify that we are moving a track */
cursor_on = !cursor_on; cursor_on = !cursor_on;
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
lcd_set_drawmode(DRMODE_COMPLEMENT); if (global_settings.invert_cursor)
lcd_fillrect( {
MARGIN_X, MARGIN_Y+(viewer.cursor_pos*viewer.line_height), lcd_set_drawmode(DRMODE_COMPLEMENT);
LCD_WIDTH, viewer.line_height); lcd_fillrect(
lcd_set_drawmode(DRMODE_SOLID); MARGIN_X, MARGIN_Y+(viewer.cursor_pos*viewer.line_height),
lcd_invertscroll(LINE_X, viewer.cursor_pos); 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( lcd_update_rect(
0, MARGIN_Y + (viewer.cursor_pos * viewer.line_height), 0, MARGIN_Y + (viewer.cursor_pos * viewer.line_height),

View file

@ -39,6 +39,7 @@ const unsigned char bitmap_icons_6x8[LastIcon][6] =
{ 0x60, 0x7f, 0x03, 0x33, 0x3f, 0x00 }, /* Musical note */ { 0x60, 0x7f, 0x03, 0x33, 0x3f, 0x00 }, /* Musical note */
{ 0x7e, 0x41, 0x41, 0x42, 0x7e, 0x00 }, /* Folder */ { 0x7e, 0x41, 0x41, 0x42, 0x7e, 0x00 }, /* Folder */
{ 0x55, 0x00, 0x55, 0x55, 0x55, 0x55 }, /* Playlist */ { 0x55, 0x00, 0x55, 0x55, 0x55, 0x55 }, /* Playlist */
{ 0x3e, 0x1c, 0x08, 0x00, 0x00, 0x00 }, /* Cursor / Marker */
{ 0x58, 0x5f, 0x42, 0x50, 0x55, 0x55 }, /* WPS file */ { 0x58, 0x5f, 0x42, 0x50, 0x55, 0x55 }, /* WPS file */
{ 0x63, 0x7f, 0x3a, 0x7f, 0x63, 0x00 }, /* Mod or ajz file */ { 0x63, 0x7f, 0x3a, 0x7f, 0x63, 0x00 }, /* Mod or ajz file */
{ 0x60, 0x70, 0x38, 0x2c, 0x7e, 0x7e }, /* Font file */ { 0x60, 0x70, 0x38, 0x2c, 0x7e, 0x7e }, /* Font file */

View file

@ -36,6 +36,7 @@ enum icons_6x8 {
Icon_Audio, Icon_Audio,
Icon_Folder, Icon_Folder,
Icon_Playlist, Icon_Playlist,
Icon_Cursor,
Icon_Wps, Icon_Wps,
Icon_Firmware, Icon_Firmware,
Icon_Font, Icon_Font,

View file

@ -348,7 +348,7 @@ bool recording_screen(void)
lcd_setfont(FONT_SYSFIXED); lcd_setfont(FONT_SYSFIXED);
lcd_getstringsize("M", &w, &h); lcd_getstringsize("M", &w, &h);
lcd_setmargins(0, 8); lcd_setmargins(global_settings.invert_cursor ? 0 : w, 8);
if(rec_create_directory() > 0) if(rec_create_directory() > 0)
have_recorded = true; have_recorded = true;
@ -598,7 +598,7 @@ bool recording_screen(void)
update_countdown = 1; /* Update immediately */ update_countdown = 1; /* Update immediately */
lcd_setfont(FONT_SYSFIXED); lcd_setfont(FONT_SYSFIXED);
lcd_setmargins(0, 8); lcd_setmargins(global_settings.invert_cursor ? 0 : w, 8);
} }
break; break;
#endif #endif
@ -739,7 +739,7 @@ bool recording_screen(void)
fmt_gain(SOUND_MIC_GAIN, fmt_gain(SOUND_MIC_GAIN,
global_settings.rec_mic_gain, global_settings.rec_mic_gain,
buf2, sizeof(buf2))); buf2, sizeof(buf2)));
if (pos++ == cursor) if (global_settings.invert_cursor && (pos++ == cursor))
lcd_puts_style(0, 4, buf, STYLE_INVERT); lcd_puts_style(0, 4, buf, STYLE_INVERT);
else else
lcd_puts(0, 4, buf); lcd_puts(0, 4, buf);
@ -754,7 +754,7 @@ bool recording_screen(void)
snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_GAIN), snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_GAIN),
fmt_gain(SOUND_LEFT_GAIN, gain, fmt_gain(SOUND_LEFT_GAIN, gain,
buf2, sizeof(buf2))); buf2, sizeof(buf2)));
if (pos++ == cursor) if (global_settings.invert_cursor && (pos++ == cursor))
lcd_puts_style(0, 4, buf, STYLE_INVERT); lcd_puts_style(0, 4, buf, STYLE_INVERT);
else else
lcd_puts(0, 4, buf); lcd_puts(0, 4, buf);
@ -763,7 +763,7 @@ bool recording_screen(void)
fmt_gain(SOUND_LEFT_GAIN, fmt_gain(SOUND_LEFT_GAIN,
global_settings.rec_left_gain, global_settings.rec_left_gain,
buf2, sizeof(buf2))); buf2, sizeof(buf2)));
if (pos++ == cursor) if (global_settings.invert_cursor && (pos++ == cursor))
lcd_puts_style(0, 5, buf, STYLE_INVERT); lcd_puts_style(0, 5, buf, STYLE_INVERT);
else else
lcd_puts(0, 5, buf); lcd_puts(0, 5, buf);
@ -772,13 +772,16 @@ bool recording_screen(void)
fmt_gain(SOUND_RIGHT_GAIN, fmt_gain(SOUND_RIGHT_GAIN,
global_settings.rec_right_gain, global_settings.rec_right_gain,
buf2, sizeof(buf2))); buf2, sizeof(buf2)));
if (pos++ == cursor) if (global_settings.invert_cursor && (pos++ == cursor))
lcd_puts_style(0, 6, buf, STYLE_INVERT); lcd_puts_style(0, 6, buf, STYLE_INVERT);
else else
lcd_puts(0, 6, buf); 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) { if (global_settings.rec_source != SOURCE_LINE) {
snprintf(buf, 32, "%s %s [%d]", snprintf(buf, 32, "%s %s [%d]",
freq_str[global_settings.rec_frequency], freq_str[global_settings.rec_frequency],

View file

@ -78,7 +78,7 @@ const char rec_base_directory[] = REC_BASE_DIR;
#include "pcm_playback.h" #include "pcm_playback.h"
#endif #endif
#define CONFIG_BLOCK_VERSION 27 #define CONFIG_BLOCK_VERSION 26
#define CONFIG_BLOCK_SIZE 512 #define CONFIG_BLOCK_SIZE 512
#define RTC_BLOCK_SIZE 44 #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(invert), false, "invert", off_on },
{1, S_O(flip_display), false, "flip display", off_on }, {1, S_O(flip_display), false, "flip display", off_on },
/* display */ /* display */
{1, S_O(invert_cursor), false, "invert cursor", off_on },
{1, S_O(statusbar), true, "statusbar", off_on }, {1, S_O(statusbar), true, "statusbar", off_on },
{1, S_O(scrollbar), true, "scrollbar", off_on }, {1, S_O(scrollbar), true, "scrollbar", off_on },
#if CONFIG_KEYPAD == RECORDER_PAD #if CONFIG_KEYPAD == RECORDER_PAD

View file

@ -195,6 +195,8 @@ struct user_settings
int contrast; /* lcd contrast: 0-63 0=low 63=high */ int contrast; /* lcd contrast: 0-63 0=low 63=high */
bool invert; /* invert display */ 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 flip_display; /* turn display (and button layout) by 180 degrees */
bool bidi_support; /* reverse hebrew/arabic chars: 0=off, 1=on */ bool bidi_support; /* reverse hebrew/arabic chars: 0=off, 1=on */
int poweroff; /* power off timer */ int poweroff; /* power off timer */

View file

@ -162,7 +162,7 @@ struct tree_context* tree_get_context(void)
/* pixel margins */ /* pixel margins */
#define MARGIN_X (global_settings.scrollbar && \ #define MARGIN_X (global_settings.scrollbar && \
tc.filesindir > tree_max_on_screen ? SCROLLBAR_WIDTH : 0) + \ 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) #define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0)
/* position the entry-list starts at */ /* 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 the margins, so this is the amount of lines
we add to the cursor Y position to position we add to the cursor Y position to position
it on a line */ it on a line */
#define CURSOR_WIDTH (global_settings.invert_cursor ? 0 : 4)
#define ICON_WIDTH 6 #define ICON_WIDTH 6
@ -221,10 +222,11 @@ static void showfileline(int line, char* name, int attr, bool scroll)
if(scroll) { if(scroll) {
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
lcd_setfont(FONT_UI); lcd_setfont(FONT_UI);
lcd_puts_scroll_style(xpos, line, name, STYLE_INVERT); if (global_settings.invert_cursor)
#else lcd_puts_scroll_style(xpos, line, name, STYLE_INVERT);
lcd_puts_scroll(xpos, line, name); else
#endif #endif
lcd_puts_scroll(xpos, line, name);
} else } else
lcd_puts(xpos, line, name); lcd_puts(xpos, line, name);
@ -394,7 +396,7 @@ static int showdir(void)
if ( line_height > 8 ) if ( line_height > 8 )
offset = (line_height - 8) / 2; offset = (line_height - 8) / 2;
lcd_mono_bitmap(icon, lcd_mono_bitmap(icon,
CURSOR_X * 6, CURSOR_X * 6 + CURSOR_WIDTH,
MARGIN_Y+(i-start)*line_height + offset, 6, 8); MARGIN_Y+(i-start)*line_height + offset, 6, 8);
#else #else
if (icon < 0 ) if (icon < 0 )