From 85134105b9b1beddf657dd8a096101efdcc8d9e2 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Sun, 3 Sep 2006 11:33:03 +0000 Subject: [PATCH] make the pitch screen use the remote screen also, and fix non-lcd iriver remote for the screen (again) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10865 a1c6a512-1295-4272-9138-f99709370657 --- apps/keymaps/keymap-h1x0_h3x0.c | 36 ++++++------ apps/screens.c | 99 +++++++++++++++++++-------------- 2 files changed, 75 insertions(+), 60 deletions(-) diff --git a/apps/keymaps/keymap-h1x0_h3x0.c b/apps/keymaps/keymap-h1x0_h3x0.c index 1bacbf4bca..93477de903 100644 --- a/apps/keymaps/keymap-h1x0_h3x0.c +++ b/apps/keymaps/keymap-h1x0_h3x0.c @@ -481,7 +481,7 @@ const struct button_mapping button_context_bmark_h300lcdremote[] = { LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS|CONTEXT_REMOTE), }; -const struct button_mapping button_context_quickscreen_h100remote[] = { +const struct button_mapping button_context_quickscreen_nonlcdremote[] = { { ACTION_QS_DOWNINV, BUTTON_RC_SOURCE, BUTTON_NONE }, { ACTION_QS_DOWNINV, BUTTON_RC_SOURCE|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_QS_DOWNINV, BUTTON_RC_VOL_UP, BUTTON_NONE }, @@ -494,7 +494,7 @@ const struct button_mapping button_context_quickscreen_h100remote[] = { { ACTION_QS_LEFT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_QS_RIGHT, BUTTON_RC_FF, BUTTON_NONE }, { ACTION_QS_RIGHT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_STD_CANCEL, BUTTON_RC_MODE, BUTTON_NONE }, + { ACTION_STD_CANCEL, BUTTON_RC_ON, BUTTON_NONE }, LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) }; /* button_context_quickscreen */ @@ -508,7 +508,7 @@ const struct button_mapping button_context_quickscreen_h100lcdremote[] = { { ACTION_QS_LEFT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_QS_RIGHT, BUTTON_RC_BITRATE, BUTTON_NONE }, { ACTION_QS_RIGHT, BUTTON_RC_BITRATE|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_STD_CANCEL, BUTTON_RC_MODE, BUTTON_NONE }, + { ACTION_STD_CANCEL, BUTTON_RC_ON, BUTTON_NONE }, LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) }; /* button_context_quickscreen */ @@ -527,17 +527,17 @@ const struct button_mapping button_context_quickscreen_h300lcdremote[] = { LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) }; /* button_context_quickscreen */ -const struct button_mapping button_context_pitchscreen_h100remote[] = { - { ACTION_PS_INC_SMALL, BUTTON_RC_REW, BUTTON_NONE }, - { ACTION_PS_INC_BIG, BUTTON_RC_REW|BUTTON_REPEAT,BUTTON_NONE }, - { ACTION_PS_DEC_SMALL, BUTTON_RC_FF, BUTTON_NONE }, - { ACTION_PS_DEC_BIG, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_PS_NUDGE_LEFT, BUTTON_RC_SOURCE, BUTTON_NONE }, - { ACTION_PS_NUDGE_LEFTOFF, BUTTON_RC_SOURCE|BUTTON_REL,BUTTON_NONE }, - { ACTION_PS_NUDGE_RIGHT, BUTTON_RC_BITRATE, BUTTON_NONE }, - { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RC_BITRATE|BUTTON_REL, BUTTON_NONE }, - { ACTION_PS_RESET, BUTTON_RC_ON, BUTTON_NONE }, - { ACTION_PS_EXIT, BUTTON_RC_STOP, BUTTON_NONE }, +const struct button_mapping button_context_pitchscreen_nonlcdremote[] = { + { ACTION_PS_INC_SMALL, BUTTON_RC_VOL_UP, BUTTON_NONE }, + { ACTION_PS_INC_BIG, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_PS_DEC_SMALL, BUTTON_RC_VOL_DOWN, BUTTON_NONE }, + { ACTION_PS_DEC_BIG, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_PS_NUDGE_LEFT, BUTTON_RC_REW, BUTTON_NONE }, + { ACTION_PS_NUDGE_LEFTOFF, BUTTON_RC_REW|BUTTON_REL, BUTTON_NONE }, + { ACTION_PS_NUDGE_RIGHT, BUTTON_RC_FF, BUTTON_NONE }, + { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RC_FF|BUTTON_REL, BUTTON_NONE }, + { ACTION_PS_RESET, BUTTON_RC_ON|BUTTON_REL, BUTTON_RC_ON }, + { ACTION_PS_EXIT, BUTTON_RC_ON|BUTTON_REPEAT, BUTTON_NONE }, LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) }; /* button_context_pitchcreen */ @@ -667,9 +667,9 @@ static const struct button_mapping *remote_btn_ctxt_yesno = button_context_yesno_h100remote, *remote_btn_ctxt_bmark = button_context_bmark_h100remote, *remote_btn_ctxt_quickscreen - = button_context_quickscreen_h100remote, + = button_context_quickscreen_nonlcdremote, *remote_btn_ctxt_pitchscreen - = button_context_pitchscreen_h100remote, + = button_context_pitchscreen_nonlcdremote, *remote_btn_ctxt_recscreen = button_context_recscreen_h100remote, *remote_btn_ctxt_keyboard @@ -762,9 +762,9 @@ static void remap_remote(void) remote_btn_ctxt_yesno = button_context_yesno_h300lcdremote, remote_btn_ctxt_bmark = button_context_bmark_h300lcdremote, remote_btn_ctxt_quickscreen - = button_context_quickscreen_h300lcdremote, + = button_context_quickscreen_nonlcdremote, remote_btn_ctxt_pitchscreen - = button_context_pitchscreen_h300lcdremote, + = button_context_pitchscreen_nonlcdremote, remote_btn_ctxt_recscreen = button_context_recscreen_h300lcdremote, remote_btn_ctxt_keyboard diff --git a/apps/screens.c b/apps/screens.c index 86a377ecc5..067c544ea2 100644 --- a/apps/screens.c +++ b/apps/screens.c @@ -356,53 +356,64 @@ int charging_screen(void) 0 if no key was pressed 1 if USB was connected */ -void pitch_screen_draw(int pitch) +void pitch_screen_draw(struct screen *display, int pitch) { unsigned char* ptr; unsigned char buf[32]; int w, h; - lcd_clear_display(); + display->clear_display(); + + if (display->nb_lines < 4) /* very small screen, just show the pitch value */ + { + w = snprintf((char *)buf, sizeof(buf), "%s: %d.%d%%",str(LANG_SYSFONT_PITCH), + pitch / 10, pitch % 10 ); + display->putsxy((display->width-(w*display->char_width))/2, + display->nb_lines/2,buf); + } + else /* bigger screen, show everything... */ + { - /* UP: Pitch Up */ - ptr = str(LANG_SYSFONT_PITCH_UP); - lcd_getstringsize(ptr,&w,&h); - lcd_putsxy((LCD_WIDTH-w)/2, 0, ptr); - lcd_mono_bitmap(bitmap_icons_7x8[Icon_UpArrow], - LCD_WIDTH/2 - 3, h, 7, 8); + /* UP: Pitch Up */ + ptr = str(LANG_SYSFONT_PITCH_UP); + display->getstringsize(ptr,&w,&h); + display->putsxy((display->width-w)/2, 0, ptr); + display->mono_bitmap(bitmap_icons_7x8[Icon_UpArrow], + display->width/2 - 3, h, 7, 8); - /* DOWN: Pitch Down */ - ptr = str(LANG_SYSFONT_PITCH_DOWN); - lcd_getstringsize(ptr,&w,&h); - lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr); - lcd_mono_bitmap(bitmap_icons_7x8[Icon_DownArrow], - LCD_WIDTH/2 - 3, LCD_HEIGHT - h*2, 7, 8); + /* DOWN: Pitch Down */ + ptr = str(LANG_SYSFONT_PITCH_DOWN); + display->getstringsize(ptr,&w,&h); + display->putsxy((display->width-w)/2, display->height - h, ptr); + display->mono_bitmap(bitmap_icons_7x8[Icon_DownArrow], + display->width/2 - 3, display->height - h*2, 7, 8); + + /* RIGHT: +2% */ + ptr = "+2%"; + display->getstringsize(ptr,&w,&h); + display->putsxy(display->width-w, (display->height-h)/2, ptr); + display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward], + display->width-w-8, (display->height-h)/2, 7, 8); + + /* LEFT: -2% */ + ptr = "-2%"; + display->getstringsize(ptr,&w,&h); + display->putsxy(0, (display->height-h)/2, ptr); + display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], + w+1, (display->height-h)/2, 7, 8); + + /* "Pitch" */ + snprintf((char *)buf, sizeof(buf), str(LANG_SYSFONT_PITCH)); + display->getstringsize(buf,&w,&h); + display->putsxy((display->width-w)/2, (display->height/2)-h, buf); + /* "XX.X%" */ + snprintf((char *)buf, sizeof(buf), "%d.%d%%", + pitch / 10, pitch % 10 ); + display->getstringsize(buf,&w,&h); + display->putsxy((display->width-w)/2, display->height/2, buf); + } - /* RIGHT: +2% */ - ptr = "+2%"; - lcd_getstringsize(ptr,&w,&h); - lcd_putsxy(LCD_WIDTH-w, (LCD_HEIGHT-h)/2, ptr); - lcd_mono_bitmap(bitmap_icons_7x8[Icon_FastForward], - LCD_WIDTH-w-8, (LCD_HEIGHT-h)/2, 7, 8); - - /* LEFT: -2% */ - ptr = "-2%"; - lcd_getstringsize(ptr,&w,&h); - lcd_putsxy(0, (LCD_HEIGHT-h)/2, ptr); - lcd_mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], - w+1, (LCD_HEIGHT-h)/2, 7, 8); - - /* "Pitch" */ - snprintf((char *)buf, sizeof(buf), str(LANG_SYSFONT_PITCH)); - lcd_getstringsize(buf,&w,&h); - lcd_putsxy((LCD_WIDTH-w)/2, (LCD_HEIGHT/2)-h, buf); - /* "XX.X%" */ - snprintf((char *)buf, sizeof(buf), "%d.%d%%", - pitch / 10, pitch % 10 ); - lcd_getstringsize(buf,&w,&h); - lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT/2, buf); - - lcd_update(); + display->update(); } bool pitch_screen(void) @@ -410,6 +421,7 @@ bool pitch_screen(void) int button; int pitch = sound_get_pitch(); bool exit = false; + int i; lcd_setfont(FONT_SYSFIXED); #if CONFIG_CODEC == SWCODEC @@ -419,7 +431,8 @@ bool pitch_screen(void) action_signalscreenchange(); while (!exit) { - pitch_screen_draw(pitch); + FOR_NB_SCREENS(i) + pitch_screen_draw(&screens[i],pitch); button = get_action(CONTEXT_PITCHSCREEN,TIMEOUT_BLOCK); switch (button) { @@ -456,7 +469,8 @@ bool pitch_screen(void) { pitch += 20; sound_set_pitch(pitch); - pitch_screen_draw(pitch); + FOR_NB_SCREENS(i) + pitch_screen_draw(&screens[i],pitch); } break; case ACTION_PS_NUDGE_RIGHTOFF: @@ -469,7 +483,8 @@ bool pitch_screen(void) { pitch -= 20; sound_set_pitch(pitch); - pitch_screen_draw(pitch); + FOR_NB_SCREENS(i) + pitch_screen_draw(&screens[i],pitch); } break; case ACTION_PS_NUDGE_LEFTOFF: