From 227253cfe4ab16c9758473194271ed48bf2e28b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Stenberg?= Date: Wed, 9 Oct 2002 23:13:25 +0000 Subject: [PATCH] 'Reset settings' now also resets wps, font and language (although you have to reboot to get back to the old language). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2552 a1c6a512-1295-4272-9138-f99709370657 --- apps/settings.c | 9 +++++++++ apps/wps-display.c | 6 ++++++ apps/wps-display.h | 1 + firmware/font.c | 7 ++++++- firmware/font.h | 1 + 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/apps/settings.c b/apps/settings.c index eb4409c805..0a3cd67d67 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -383,6 +383,9 @@ void settings_apply(void) global_settings.wps_file); wps_load(buf, false); } + else + wps_reset(); + #ifdef HAVE_LCD_BITMAP if ( global_settings.font_file[0] && global_settings.font_file[0] != 0xff ) { @@ -390,7 +393,10 @@ void settings_apply(void) global_settings.font_file); font_load(buf); } + else + font_reset(); #endif + if ( global_settings.lang_file[0] && global_settings.lang_file[0] != 0xff ) { snprintf(buf, sizeof buf, ROCKBOX_DIR "/%s.lng", @@ -673,6 +679,9 @@ void settings_reset(void) { global_settings.peak_meter_release = 8; global_settings.peak_meter_hold = 1; global_settings.peak_meter_clip_hold = 16; + global_settings.wps_file[0] = 0; + global_settings.font_file[0] = 0; + global_settings.lang_file[0] = 0; } diff --git a/apps/wps-display.c b/apps/wps-display.c index 3dda50842f..0e31be3ffa 100644 --- a/apps/wps-display.c +++ b/apps/wps-display.c @@ -111,6 +111,12 @@ static void wps_format(char* fmt) } } +void wps_reset(void) +{ + wps_loaded = false; + memset(&format_buffer, 0, sizeof format_buffer); +} + bool wps_load(char* file, bool display) { char buffer[FORMAT_BUFFER_SIZE]; diff --git a/apps/wps-display.h b/apps/wps-display.h index 970bca1842..fc40e19136 100644 --- a/apps/wps-display.h +++ b/apps/wps-display.h @@ -25,6 +25,7 @@ bool wps_refresh(struct mp3entry* id3, int ffwd_offset, bool refresh_scroll); bool wps_display(struct mp3entry* id3); bool wps_load(char* file, bool display); +void wps_reset(void); #ifdef HAVE_LCD_CHARCELLS bool draw_player_progress(struct mp3entry* id3, int ff_rewind_count); diff --git a/firmware/font.c b/firmware/font.c index 6f5156cc73..2fe43b5fd3 100644 --- a/firmware/font.c +++ b/firmware/font.c @@ -114,6 +114,11 @@ static int readstrpad(char *buf, int totlen) return totlen; } +void font_reset(void) +{ + memset(&font_ui, 0, sizeof(struct font)); +} + /* read and load font into incore font structure*/ struct font* font_load(char *path) { @@ -132,7 +137,7 @@ struct font* font_load(char *path) return NULL; } - memset(pf, 0, sizeof(struct font)); + font_reset(); /* currently, font loading replaces earlier font allocation*/ freeptr = (unsigned char *)(((int)mbuf + 3) & ~3); diff --git a/firmware/font.h b/firmware/font.h index 44b975bb78..8e0bb9ce90 100644 --- a/firmware/font.h +++ b/firmware/font.h @@ -102,6 +102,7 @@ struct font { void font_init(void); struct font* font_load(char *path); struct font* font_get(int font); +void font_reset(void); #else /* HAVE_LCD_BITMAP */