From a86919ae2966af11c6b484a81caf5dc9c95d3e09 Mon Sep 17 00:00:00 2001 From: Marcoen Hirschberg Date: Mon, 22 May 2006 16:40:41 +0000 Subject: [PATCH] add seperate scroll options for remote. Patch by Alexander Spyridakis which fixes bug #5348. Changes CONFIG_BLOCK_VERSION so save your settings.. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9974 a1c6a512-1295-4272-9138-f99709370657 --- apps/lang/english.lang | 16 +++++++++++- apps/screen_access.c | 27 ++------------------ apps/screen_access.h | 9 ------- apps/settings.c | 15 ++++++++--- apps/settings.h | 12 ++++++--- apps/settings_menu.c | 57 ++++++++++++++++++++++++++++++++++++++---- 6 files changed, 89 insertions(+), 47 deletions(-) diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 2a54a6d79f..8c551b443d 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -8514,4 +8514,18 @@ *: "Invalid Filename" - \ No newline at end of file + + + id: LANG_REMOTE_SCROLL_SETS + desc: "Remote Scrolling Options" Submenu in "Scrolling Options" menu + user: + + *: "Remote Scrolling Options" + + + *: "Remote Scrolling Options" + + + *: "Remote Scrolling Options" + + diff --git a/apps/screen_access.c b/apps/screen_access.c index 1dc8734462..5e3dfd8505 100644 --- a/apps/screen_access.c +++ b/apps/screen_access.c @@ -147,6 +147,8 @@ void screen_init(struct screen * screen, enum screen_type screen_type) screen->drawline=&lcd_drawline; screen->vline=&lcd_vline; screen->hline=&lcd_hline; + screen->scroll_speed=&lcd_scroll_speed; + screen->scroll_delay=&lcd_scroll_delay; screen->scroll_step=&lcd_scroll_step; screen->invertscroll=&lcd_invertscroll; screen->puts_offset=&lcd_puts_offset; @@ -173,8 +175,6 @@ void screen_init(struct screen * screen, enum screen_type screen_type) screen->init=&lcd_init; screen->puts_scroll=&lcd_puts_scroll; screen->stop_scroll=&lcd_stop_scroll; - screen->scroll_speed=&lcd_scroll_speed; - screen->scroll_delay=&lcd_scroll_delay; screen->clear_display=&lcd_clear_display; #if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR) screen->update=&lcd_update; @@ -207,26 +207,3 @@ void screen_access_init(void) FOR_NB_SCREENS(i) screen_init(&screens[i], i); } - -void screen_lcd_scroll_speed(int speed) -{ - int i; - FOR_NB_SCREENS(i) - screens[i].scroll_speed(speed); -} - -void screen_lcd_scroll_delay(int ms) -{ - int i; - FOR_NB_SCREENS(i) - screens[i].scroll_delay(ms); -} - -#ifdef HAVE_LCD_BITMAP -void screen_lcd_scroll_step(int pixels) -{ - int i; - FOR_NB_SCREENS(i) - screens[i].scroll_step(pixels); -} -#endif diff --git a/apps/screen_access.h b/apps/screen_access.h index c739c6cb1f..ae0a962015 100644 --- a/apps/screen_access.h +++ b/apps/screen_access.h @@ -185,13 +185,4 @@ extern void screen_access_init(void); */ extern struct screen screens[NB_SCREENS]; - -/* - * Functions to apply LCD settings across all screens - */ -void screen_lcd_scroll_speed(int speed); -void screen_lcd_scroll_delay(int ms); -void screen_lcd_scroll_step(int pixels); - - #endif /*_SCREEN_ACCESS_H_*/ diff --git a/apps/settings.c b/apps/settings.c index 1a6b4c3199..8122c58aa8 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -94,7 +94,7 @@ const char rec_base_directory[] = REC_BASE_DIR; #include "dsp.h" #endif -#define CONFIG_BLOCK_VERSION 43 +#define CONFIG_BLOCK_VERSION 44 #define CONFIG_BLOCK_SIZE 512 #define RTC_BLOCK_SIZE 44 @@ -359,6 +359,13 @@ static const struct bit_entry hd_bits[] = {4, S_O(scroll_speed), 9, "scroll speed", NULL }, /* 0...15 */ {8, S_O(scroll_delay), 100, "scroll delay", NULL }, /* 0...250 */ {8, S_O(bidir_limit), 50, "bidir limit", NULL }, /* 0...200 */ + +#ifdef HAVE_REMOTE_LCD + {4, S_O(remote_scroll_speed), 9, "remote scroll speed", NULL }, /* 0...15 */ + {8, S_O(remote_scroll_step), 6, "remote scroll step", NULL }, /* 1...160 */ + {8, S_O(remote_scroll_delay), 100, "remote scroll delay", NULL }, /* 0...250 */ +#endif + #ifdef HAVE_LCD_BITMAP {1, S_O(offset_out_of_view), false, "Screen Scrolls Out Of View", off_on }, #if LCD_WIDTH > 255 @@ -1004,9 +1011,9 @@ void settings_apply(void) lcd_remote_set_contrast(global_settings.remote_contrast); lcd_remote_set_invert_display(global_settings.remote_invert); lcd_remote_set_flip(global_settings.remote_flip_display); - lcd_remote_scroll_speed(global_settings.scroll_speed); - lcd_remote_scroll_step(global_settings.scroll_step); - lcd_remote_scroll_delay(global_settings.scroll_delay * (HZ/10)); + lcd_remote_scroll_speed(global_settings.remote_scroll_speed); + lcd_remote_scroll_step(global_settings.remote_scroll_step); + lcd_remote_scroll_delay(global_settings.remote_scroll_delay * (HZ/10)); #ifdef HAVE_REMOTE_LCD_TICKING lcd_remote_emireduce(global_settings.remote_reduce_ticking); #endif diff --git a/apps/settings.h b/apps/settings.h index fd03d93f43..ca8e88a75b 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -301,7 +301,6 @@ struct user_settings int volume_type; /* how volume is displayed: 0=graphic, 1=percent */ int battery_display; /* how battery is displayed: 0=graphic, 1=percent */ int timeformat; /* time format: 0=24 hour clock, 1=12 hour clock */ - int scroll_speed; /* long texts scrolling speed: 1-30 */ bool playlist_shuffle; bool play_selected; /* Plays selected file even in shuffle mode */ int ff_rewind_min_step; /* FF/Rewind minimum step size */ @@ -333,11 +332,18 @@ struct user_settings int runtime; /* current runtime since last charge */ int topruntime; /* top known runtime */ - + + int scroll_speed; /* long texts scrolling speed: 1-30 */ int bidir_limit; /* bidir scroll length limit */ int scroll_delay; /* delay (in 1/10s) before starting scroll */ int scroll_step; /* pixels to advance per update */ -#ifdef HAVE_LCD_BITMAP +#ifdef HAVE_REMOTE_LCD + int remote_scroll_speed; /* long texts scrolling speed: 1-30 */ + int remote_scroll_delay; /* delay (in 1/10s) before starting scroll */ + int remote_scroll_step; /* pixels to advance per update */ +#endif + +#ifdef HAVE_LCD_BITMAP bool offset_out_of_view; int screen_scroll_step; #endif diff --git a/apps/settings_menu.c b/apps/settings_menu.c index c15eb6cf91..5aa861a88e 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c @@ -55,7 +55,6 @@ #include "yesno.h" #include "list.h" #include "color_picker.h" -#include "screen_access.h" #ifdef HAVE_LCD_BITMAP #include "peakmeter.h" @@ -840,10 +839,10 @@ static bool sleep_timer(void) } static bool scroll_speed(void) -{ +{ return set_int(str(LANG_SCROLL), "", UNIT_INT, &global_settings.scroll_speed, - &screen_lcd_scroll_speed, 1, 0, 15, NULL ); + &lcd_scroll_speed, 1, 0, 15, NULL ); } static bool scroll_delay(void) @@ -851,11 +850,37 @@ static bool scroll_delay(void) int dummy = global_settings.scroll_delay * (HZ/10); int rc = set_int(str(LANG_SCROLL_DELAY), "ms", UNIT_MS, &dummy, - &screen_lcd_scroll_delay, 100, 0, 2500, NULL ); + &lcd_scroll_delay, 100, 0, 2500, NULL ); global_settings.scroll_delay = dummy / (HZ/10); return rc; } +#ifdef HAVE_REMOTE_LCD +static bool remote_scroll_speed(void) +{ + return set_int(str(LANG_SCROLL), "", UNIT_INT, + &global_settings.remote_scroll_speed, + &lcd_remote_scroll_speed, 1, 0, 15, NULL ); +} + +static bool remote_scroll_step(void) +{ + return set_int(str(LANG_SCROLL_STEP_EXAMPLE), str(LANG_PIXELS), UNIT_PIXEL, + &global_settings.remote_scroll_step, + &lcd_remote_scroll_step, 1, 1, LCD_WIDTH, NULL ); +} + +static bool remote_scroll_delay(void) +{ + int dummy = global_settings.remote_scroll_delay * (HZ/10); + int rc = set_int(str(LANG_SCROLL_DELAY), "ms", UNIT_MS, + &dummy, + &lcd_remote_scroll_delay, 100, 0, 2500, NULL ); + global_settings.remote_scroll_delay = dummy / (HZ/10); + return rc; +} +#endif + #ifdef HAVE_LCD_BITMAP static bool screen_scroll(void) { @@ -875,7 +900,7 @@ static bool scroll_step(void) { return set_int(str(LANG_SCROLL_STEP_EXAMPLE), str(LANG_PIXELS), UNIT_PIXEL, &global_settings.scroll_step, - &screen_lcd_scroll_step, 1, 1, LCD_WIDTH, NULL ); + &lcd_scroll_step, 1, 1, LCD_WIDTH, NULL ); } #endif @@ -1645,6 +1670,25 @@ static bool fileview_settings_menu(void) return result; } +#ifdef HAVE_REMOTE_LCD +static bool remote_scroll_sets(void) +{ + int m; + bool result; + + static const struct menu_item items[] = { + { ID2P(LANG_SCROLL_SPEED), remote_scroll_speed }, + { ID2P(LANG_SCROLL_DELAY), remote_scroll_delay }, + { ID2P(LANG_SCROLL_STEP), remote_scroll_step }, + }; + + m=menu_init( items, sizeof(items) / sizeof(*items), NULL, + NULL, NULL, NULL); + result = menu_run(m); + menu_exit(m); + return result; +} +#endif static bool scroll_settings_menu(void) { @@ -1656,6 +1700,9 @@ static bool scroll_settings_menu(void) { ID2P(LANG_SCROLL_DELAY), scroll_delay }, #ifdef HAVE_LCD_BITMAP { ID2P(LANG_SCROLL_STEP), scroll_step }, +#endif +#ifdef HAVE_REMOTE_LCD + { ID2P(LANG_REMOTE_SCROLL_SETS), remote_scroll_sets }, #endif { ID2P(LANG_BIDIR_SCROLL), bidir_limit }, #ifdef HAVE_LCD_CHARCELLS