From 26a50afc8a5f25c5fd9aef85d153a4227359f508 Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Sat, 24 Aug 2002 11:13:35 +0000 Subject: global_settings are not for runtime state variables! git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1967 a1c6a512-1295-4272-9138-f99709370657 --- apps/settings.h | 4 ---- apps/settings_menu.c | 1 - apps/wps.c | 24 +++++++++++++++--------- 3 files changed, 15 insertions(+), 14 deletions(-) (limited to 'apps') diff --git a/apps/settings.h b/apps/settings.h index d211dcdf1a..36cf4930e1 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -63,10 +63,6 @@ struct user_settings bool sort_case; /* dir sort order: 0=case insensitive, 1=sensitive */ int scroll_speed; /* long texts scrolling speed: 1-20 */ bool playlist_shuffle; -#ifdef CUSTOM_WPS - char custom_wps[64]; /* custom WPS string */ - bool wps_changed; /* to reload Custom WPS if changed to it */ -#endif /* while playing screen settings */ int wps_display; /* 0=id3, 1=file, 2=parse */ diff --git a/apps/settings_menu.c b/apps/settings_menu.c index d950bf3b63..2bb4ef4481 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c @@ -103,7 +103,6 @@ static Menu wps_set(void) char* names[] = { "1 Line ID3", "2 Line ID3", "File ", "Parse ", "Custom WPS " }; set_option("[WPS display]", &global_settings.wps_display, names, 5 ); - global_settings.wps_changed = true; #else char* names[] = { "1 Line ID3", "2 Line ID3", "File ", "Parse " }; diff --git a/apps/wps.c b/apps/wps.c index 32bbd0de9d..bdad325434 100644 --- a/apps/wps.c +++ b/apps/wps.c @@ -67,8 +67,13 @@ bool device_muted = false; static bool ff_rewind = false; static bool paused = false; +#ifdef CUSTOM_WPS +static char custom_wps[64]; +#endif + static void draw_screen(struct mp3entry* id3) { + int font_height; #ifdef LOADABLE_FONTS unsigned char *font = lcd_getcurrentldfont(); @@ -91,10 +96,11 @@ static void draw_screen(struct mp3entry* id3) else { #ifdef CUSTOM_WPS - if(global_settings.wps_changed) { - if(global_settings.wps_display == PLAY_DISPLAY_CUSTOM_WPS) - load_custom_wps(); - global_settings.wps_changed = false; + static int last_wps = -1; + if ( last_wps != global_settings.wps_display && + global_settings.wps_display == PLAY_DISPLAY_CUSTOM_WPS ) { + load_custom_wps(); + last_wps = global_settings.wps_display; } #endif switch ( global_settings.wps_display ) { @@ -225,10 +231,10 @@ static void draw_screen(struct mp3entry* id3) #ifdef CUSTOM_WPS case PLAY_DISPLAY_CUSTOM_WPS: { - if(global_settings.custom_wps[0] == 0) - snprintf(global_settings.custom_wps, sizeof(global_settings.custom_wps), + if(custom_wps[0] == 0) + snprintf(custom_wps, sizeof(custom_wps), "Couldn't Load Custom WPS"); - display_custom_wps(0, 0, true, global_settings.custom_wps); + display_custom_wps(0, 0, true, custom_wps); break; } #endif @@ -247,11 +253,11 @@ bool load_custom_wps(void) fd = open("/wps.config", O_RDONLY); if(-1 == fd) { - global_settings.custom_wps[0] = 0; + custom_wps[0] = 0; close(fd); return(false); } - read(fd, global_settings.custom_wps, sizeof(global_settings.custom_wps)); + read(fd, custom_wps, sizeof(custom_wps)); close(fd); return(true); } -- cgit v1.2.3