diff options
author | Nils Wallménius <nils@rockbox.org> | 2008-08-15 08:27:39 +0000 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2008-08-15 08:27:39 +0000 |
commit | 01729e7a1841d8aae7be37707dbc7146348c9a64 (patch) | |
tree | 5490fd9eccdcaef39bbbb91e8a44d1caad9b2ef7 /apps/gui | |
parent | 9464fdde2d780206e1eddba8cafbfbd4bbff83e4 (diff) | |
download | rockbox-01729e7a1841d8aae7be37707dbc7146348c9a64.tar.gz rockbox-01729e7a1841d8aae7be37707dbc7146348c9a64.zip |
FS#9281 Rename of splash functions.
* Remove gui_splash()
* Rename gui_syncsplash() to splashf() and remove its voice
capabilities.
* Rename the internal splash() to splash_internal() and introduce an
externally visible splash() that handles simple splashing without
printf functionality e.g. splash(HZ, ID2P(LANG_FOO)); or splash(HZ,
"foo"); if a LANG_* id is passed it will be voiced.
* Adjust all places that called gui_syncsplash() to use the correct
variant from above.
* Export both new functions to plugins and adjust places calling
rb->splash() to use the correct variant so that we now have naming
consistency between the core and plugins.
* Fix one latent bug that would cause my sim to crash with the above
changes and correct P2STR and P2ID macros, thanks to pondlife.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18282 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui')
-rw-r--r-- | apps/gui/color_picker.c | 2 | ||||
-rw-r--r-- | apps/gui/gwps-common.c | 11 | ||||
-rw-r--r-- | apps/gui/option_select.c | 2 | ||||
-rw-r--r-- | apps/gui/pitchscreen.c | 2 | ||||
-rw-r--r-- | apps/gui/splash.c | 40 | ||||
-rw-r--r-- | apps/gui/splash.h | 13 |
6 files changed, 28 insertions, 42 deletions
diff --git a/apps/gui/color_picker.c b/apps/gui/color_picker.c index 8db9ba92f5..87af8ae3ed 100644 --- a/apps/gui/color_picker.c +++ b/apps/gui/color_picker.c | |||
@@ -461,7 +461,7 @@ bool set_color(struct screen *display, char *title, unsigned *color, | |||
461 | if (banned_color != (unsigned)-1 && | 461 | if (banned_color != (unsigned)-1 && |
462 | banned_color == rgb.color) | 462 | banned_color == rgb.color) |
463 | { | 463 | { |
464 | gui_syncsplash(HZ*2, ID2P(LANG_COLOR_UNACCEPTABLE)); | 464 | splash(HZ*2, ID2P(LANG_COLOR_UNACCEPTABLE)); |
465 | break; | 465 | break; |
466 | } | 466 | } |
467 | *color = rgb.color; | 467 | *color = rgb.color; |
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index 8c349ea35c..26c5c5d637 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c | |||
@@ -152,7 +152,7 @@ bool update_onvol_change(struct gui_wps * gwps) | |||
152 | gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC); | 152 | gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC); |
153 | 153 | ||
154 | #ifdef HAVE_LCD_CHARCELLS | 154 | #ifdef HAVE_LCD_CHARCELLS |
155 | gui_splash(gwps->display, 0, "Vol: %3d dB", | 155 | splashf(0, "Vol: %3d dB", |
156 | sound_val2phys(SOUND_VOLUME, global_settings.volume)); | 156 | sound_val2phys(SOUND_VOLUME, global_settings.volume)); |
157 | return true; | 157 | return true; |
158 | #endif | 158 | #endif |
@@ -329,7 +329,7 @@ bool gui_wps_display(void) | |||
329 | #ifdef HAVE_LCD_BITMAP | 329 | #ifdef HAVE_LCD_BITMAP |
330 | gui_syncstatusbar_draw(&statusbars, true); | 330 | gui_syncstatusbar_draw(&statusbars, true); |
331 | #endif | 331 | #endif |
332 | gui_syncsplash(HZ, ID2P(LANG_END_PLAYLIST)); | 332 | splash(HZ, ID2P(LANG_END_PLAYLIST)); |
333 | return true; | 333 | return true; |
334 | } | 334 | } |
335 | else | 335 | else |
@@ -485,16 +485,11 @@ bool update(struct gui_wps *gwps) | |||
485 | 485 | ||
486 | void display_keylock_text(bool locked) | 486 | void display_keylock_text(bool locked) |
487 | { | 487 | { |
488 | char* s; | ||
489 | int i; | 488 | int i; |
490 | FOR_NB_SCREENS(i) | 489 | FOR_NB_SCREENS(i) |
491 | gui_wps[i].display->stop_scroll(); | 490 | gui_wps[i].display->stop_scroll(); |
492 | 491 | ||
493 | if(locked) | 492 | splash(HZ, locked ? ID2P(LANG_KEYLOCK_ON) : ID2P(LANG_KEYLOCK_OFF)); |
494 | s = str(LANG_KEYLOCK_ON); | ||
495 | else | ||
496 | s = str(LANG_KEYLOCK_OFF); | ||
497 | gui_syncsplash(HZ, s); | ||
498 | } | 493 | } |
499 | 494 | ||
500 | #ifdef HAVE_LCD_BITMAP | 495 | #ifdef HAVE_LCD_BITMAP |
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c index c68a8b0f39..bbad56bf47 100644 --- a/apps/gui/option_select.c +++ b/apps/gui/option_select.c | |||
@@ -530,7 +530,7 @@ bool option_screen(const struct settings_list *setting, | |||
530 | *variable = oldvalue; | 530 | *variable = oldvalue; |
531 | if (var_type == F_T_BOOL && !use_temp_var) | 531 | if (var_type == F_T_BOOL && !use_temp_var) |
532 | *(bool*)setting->setting = (oldvalue==1); | 532 | *(bool*)setting->setting = (oldvalue==1); |
533 | gui_syncsplash(HZ/2, ID2P(LANG_CANCEL)); | 533 | splash(HZ/2, ID2P(LANG_CANCEL)); |
534 | } | 534 | } |
535 | done = true; | 535 | done = true; |
536 | } | 536 | } |
diff --git a/apps/gui/pitchscreen.c b/apps/gui/pitchscreen.c index e0a7416ac6..2a568afc0a 100644 --- a/apps/gui/pitchscreen.c +++ b/apps/gui/pitchscreen.c | |||
@@ -109,7 +109,7 @@ static void pitch_screen_draw(struct screen *display, int pitch, int pitch_mode) | |||
109 | w+1, (display->lcdheight-h)/2, 7, 8); | 109 | w+1, (display->lcdheight-h)/2, 7, 8); |
110 | 110 | ||
111 | /* "Pitch" */ | 111 | /* "Pitch" */ |
112 | snprintf((char *)buf, sizeof(buf), str(LANG_PITCH)); | 112 | snprintf((char *)buf, sizeof(buf), "%s", str(LANG_PITCH)); |
113 | display->getstringsize(buf,&w,&h); | 113 | display->getstringsize(buf,&w,&h); |
114 | display->putsxy((display->lcdwidth-w)/2, (display->lcdheight/2)-h, buf); | 114 | display->putsxy((display->lcdwidth-w)/2, (display->lcdheight/2)-h, buf); |
115 | /* "XX.X%" */ | 115 | /* "XX.X%" */ |
diff --git a/apps/gui/splash.c b/apps/gui/splash.c index b4b451eed6..034e4a5912 100644 --- a/apps/gui/splash.c +++ b/apps/gui/splash.c | |||
@@ -45,7 +45,7 @@ | |||
45 | 45 | ||
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | static void splash(struct screen * screen, const char *fmt, va_list ap) | 48 | static void splash_internal(struct screen * screen, const char *fmt, va_list ap) |
49 | { | 49 | { |
50 | char splash_buf[MAXBUFFER]; | 50 | char splash_buf[MAXBUFFER]; |
51 | short widths[MAXLINES]; | 51 | short widths[MAXLINES]; |
@@ -187,41 +187,35 @@ static void splash(struct screen * screen, const char *fmt, va_list ap) | |||
187 | screen->update(); | 187 | screen->update(); |
188 | } | 188 | } |
189 | 189 | ||
190 | void gui_splash(struct screen * screen, int ticks, | 190 | void splashf(int ticks, const char *fmt, ...) |
191 | const char *fmt, ...) | ||
192 | { | 191 | { |
193 | va_list ap; | 192 | va_list ap; |
194 | va_start( ap, fmt ); | 193 | int i; |
195 | splash(screen, fmt, ap); | 194 | |
196 | va_end( ap ); | 195 | /* If fmt is a lang ID then get the corresponding string (which |
196 | still might contain % place holders). */ | ||
197 | fmt = P2STR((unsigned char *)fmt); | ||
198 | FOR_NB_SCREENS(i) | ||
199 | { | ||
200 | va_start(ap, fmt); | ||
201 | screens[i].set_viewport(NULL); | ||
202 | splash_internal(&(screens[i]), fmt, ap); | ||
203 | va_end(ap); | ||
204 | } | ||
197 | 205 | ||
198 | if(ticks) | 206 | if(ticks) |
199 | sleep(ticks); | 207 | sleep(ticks); |
200 | } | 208 | } |
201 | 209 | ||
202 | void gui_syncsplash(int ticks, const char *fmt, ...) | 210 | void splash(int ticks, const char *str) |
203 | { | 211 | { |
204 | va_list ap; | ||
205 | int i; | ||
206 | #if !defined(SIMULATOR) || CONFIG_CODEC == SWCODEC | 212 | #if !defined(SIMULATOR) || CONFIG_CODEC == SWCODEC |
207 | long id; | 213 | long id; |
208 | /* fmt may be a so called virtual pointer. See settings.h. */ | 214 | /* fmt may be a so called virtual pointer. See settings.h. */ |
209 | if((id = P2ID((unsigned char *)fmt)) >= 0) | 215 | if((id = P2ID((const unsigned char*)str)) >= 0) |
210 | /* If fmt specifies a voicefont ID, and voice menus are | 216 | /* If fmt specifies a voicefont ID, and voice menus are |
211 | enabled, then speak it. */ | 217 | enabled, then speak it. */ |
212 | cond_talk_ids_fq(id); | 218 | cond_talk_ids_fq(id); |
213 | #endif | 219 | #endif |
214 | /* If fmt is a lang ID then get the corresponding string (which | 220 | splashf(ticks, "%s", P2STR((const unsigned char*)str)); |
215 | still might contain % place holders). */ | ||
216 | fmt = P2STR((unsigned char *)fmt); | ||
217 | va_start( ap, fmt ); | ||
218 | FOR_NB_SCREENS(i) | ||
219 | { | ||
220 | screens[i].set_viewport(NULL); | ||
221 | splash(&(screens[i]), fmt, ap); | ||
222 | } | ||
223 | va_end( ap ); | ||
224 | |||
225 | if(ticks) | ||
226 | sleep(ticks); | ||
227 | } | 221 | } |
diff --git a/apps/gui/splash.h b/apps/gui/splash.h index bb3c8727d1..1bbb9e9e49 100644 --- a/apps/gui/splash.h +++ b/apps/gui/splash.h | |||
@@ -25,20 +25,17 @@ | |||
25 | #include "screen_access.h" | 25 | #include "screen_access.h" |
26 | 26 | ||
27 | /* | 27 | /* |
28 | * Puts a splash message centered on the given screen for a given period | 28 | * Puts a splash message centered on all the screens for a given period |
29 | * - screen : the screen to put the splash on | ||
30 | * - ticks : how long the splash is displayed (in rb ticks) | 29 | * - ticks : how long the splash is displayed (in rb ticks) |
31 | * - fmt : what to say *printf style | 30 | * - fmt : what to say *printf style |
32 | */ | 31 | */ |
33 | extern void gui_splash(struct screen * screen, int ticks, | 32 | extern void splashf(int ticks, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); |
34 | const char *fmt, ...) ATTRIBUTE_PRINTF(3, 4); | ||
35 | 33 | ||
36 | /* | 34 | /* |
37 | * Puts a splash message centered on all the screens for a given period | 35 | * Puts a splash message centered on all the screens for a given period |
38 | * - ticks : how long the splash is displayed (in rb ticks) | 36 | * - ticks : how long the splash is displayed (in rb ticks) |
39 | * - fmt : what to say *printf style | 37 | * - str : what to say, if this is a LANG_* string (from ID2P) |
38 | * it will be voiced | ||
40 | */ | 39 | */ |
41 | extern void gui_syncsplash(int ticks, const char *fmt, ...) | 40 | extern void splash(int ticks, const char *str); |
42 | ATTRIBUTE_PRINTF(2, 3); | ||
43 | |||
44 | #endif /* _GUI_ICON_H_ */ | 41 | #endif /* _GUI_ICON_H_ */ |