summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2008-08-15 08:27:39 +0000
committerNils Wallménius <nils@rockbox.org>2008-08-15 08:27:39 +0000
commit01729e7a1841d8aae7be37707dbc7146348c9a64 (patch)
tree5490fd9eccdcaef39bbbb91e8a44d1caad9b2ef7 /apps/gui
parent9464fdde2d780206e1eddba8cafbfbd4bbff83e4 (diff)
downloadrockbox-01729e7a1841d8aae7be37707dbc7146348c9a64.zip
rockbox-01729e7a1841d8aae7be37707dbc7146348c9a64.tar.gz
rockbox-01729e7a1841d8aae7be37707dbc7146348c9a64.tar.bz2
rockbox-01729e7a1841d8aae7be37707dbc7146348c9a64.tar.xz
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.c2
-rw-r--r--apps/gui/gwps-common.c11
-rw-r--r--apps/gui/option_select.c2
-rw-r--r--apps/gui/pitchscreen.c2
-rw-r--r--apps/gui/splash.c40
-rw-r--r--apps/gui/splash.h13
6 files changed, 28 insertions, 42 deletions
diff --git a/apps/gui/color_picker.c b/apps/gui/color_picker.c
index 8db9ba9..87af8ae 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,
if (banned_color != (unsigned)-1 &&
banned_color == rgb.color)
{
- gui_syncsplash(HZ*2, ID2P(LANG_COLOR_UNACCEPTABLE));
+ splash(HZ*2, ID2P(LANG_COLOR_UNACCEPTABLE));
break;
}
*color = rgb.color;
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index 8c349ea..26c5c5d 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)
gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC);
#ifdef HAVE_LCD_CHARCELLS
- gui_splash(gwps->display, 0, "Vol: %3d dB",
+ splashf(0, "Vol: %3d dB",
sound_val2phys(SOUND_VOLUME, global_settings.volume));
return true;
#endif
@@ -329,7 +329,7 @@ bool gui_wps_display(void)
#ifdef HAVE_LCD_BITMAP
gui_syncstatusbar_draw(&statusbars, true);
#endif
- gui_syncsplash(HZ, ID2P(LANG_END_PLAYLIST));
+ splash(HZ, ID2P(LANG_END_PLAYLIST));
return true;
}
else
@@ -485,16 +485,11 @@ bool update(struct gui_wps *gwps)
void display_keylock_text(bool locked)
{
- char* s;
int i;
FOR_NB_SCREENS(i)
gui_wps[i].display->stop_scroll();
- if(locked)
- s = str(LANG_KEYLOCK_ON);
- else
- s = str(LANG_KEYLOCK_OFF);
- gui_syncsplash(HZ, s);
+ splash(HZ, locked ? ID2P(LANG_KEYLOCK_ON) : ID2P(LANG_KEYLOCK_OFF));
}
#ifdef HAVE_LCD_BITMAP
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c
index c68a8b0..bbad56b 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,
*variable = oldvalue;
if (var_type == F_T_BOOL && !use_temp_var)
*(bool*)setting->setting = (oldvalue==1);
- gui_syncsplash(HZ/2, ID2P(LANG_CANCEL));
+ splash(HZ/2, ID2P(LANG_CANCEL));
}
done = true;
}
diff --git a/apps/gui/pitchscreen.c b/apps/gui/pitchscreen.c
index e0a7416..2a568af 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)
w+1, (display->lcdheight-h)/2, 7, 8);
/* "Pitch" */
- snprintf((char *)buf, sizeof(buf), str(LANG_PITCH));
+ snprintf((char *)buf, sizeof(buf), "%s", str(LANG_PITCH));
display->getstringsize(buf,&w,&h);
display->putsxy((display->lcdwidth-w)/2, (display->lcdheight/2)-h, buf);
/* "XX.X%" */
diff --git a/apps/gui/splash.c b/apps/gui/splash.c
index b4b451e..034e4a5 100644
--- a/apps/gui/splash.c
+++ b/apps/gui/splash.c
@@ -45,7 +45,7 @@
#endif
-static void splash(struct screen * screen, const char *fmt, va_list ap)
+static void splash_internal(struct screen * screen, const char *fmt, va_list ap)
{
char splash_buf[MAXBUFFER];
short widths[MAXLINES];
@@ -187,41 +187,35 @@ static void splash(struct screen * screen, const char *fmt, va_list ap)
screen->update();
}
-void gui_splash(struct screen * screen, int ticks,
- const char *fmt, ...)
+void splashf(int ticks, const char *fmt, ...)
{
va_list ap;
- va_start( ap, fmt );
- splash(screen, fmt, ap);
- va_end( ap );
+ int i;
+
+ /* If fmt is a lang ID then get the corresponding string (which
+ still might contain % place holders). */
+ fmt = P2STR((unsigned char *)fmt);
+ FOR_NB_SCREENS(i)
+ {
+ va_start(ap, fmt);
+ screens[i].set_viewport(NULL);
+ splash_internal(&(screens[i]), fmt, ap);
+ va_end(ap);
+ }
if(ticks)
sleep(ticks);
}
-void gui_syncsplash(int ticks, const char *fmt, ...)
+void splash(int ticks, const char *str)
{
- va_list ap;
- int i;
#if !defined(SIMULATOR) || CONFIG_CODEC == SWCODEC
long id;
/* fmt may be a so called virtual pointer. See settings.h. */
- if((id = P2ID((unsigned char *)fmt)) >= 0)
+ if((id = P2ID((const unsigned char*)str)) >= 0)
/* If fmt specifies a voicefont ID, and voice menus are
enabled, then speak it. */
cond_talk_ids_fq(id);
#endif
- /* If fmt is a lang ID then get the corresponding string (which
- still might contain % place holders). */
- fmt = P2STR((unsigned char *)fmt);
- va_start( ap, fmt );
- FOR_NB_SCREENS(i)
- {
- screens[i].set_viewport(NULL);
- splash(&(screens[i]), fmt, ap);
- }
- va_end( ap );
-
- if(ticks)
- sleep(ticks);
+ splashf(ticks, "%s", P2STR((const unsigned char*)str));
}
diff --git a/apps/gui/splash.h b/apps/gui/splash.h
index bb3c872..1bbb9e9 100644
--- a/apps/gui/splash.h
+++ b/apps/gui/splash.h
@@ -25,20 +25,17 @@
#include "screen_access.h"
/*
- * Puts a splash message centered on the given screen for a given period
- * - screen : the screen to put the splash on
+ * Puts a splash message centered on all the screens for a given period
* - ticks : how long the splash is displayed (in rb ticks)
* - fmt : what to say *printf style
*/
-extern void gui_splash(struct screen * screen, int ticks,
- const char *fmt, ...) ATTRIBUTE_PRINTF(3, 4);
+extern void splashf(int ticks, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3);
/*
* Puts a splash message centered on all the screens for a given period
* - ticks : how long the splash is displayed (in rb ticks)
- * - fmt : what to say *printf style
+ * - str : what to say, if this is a LANG_* string (from ID2P)
+ * it will be voiced
*/
-extern void gui_syncsplash(int ticks, const char *fmt, ...)
- ATTRIBUTE_PRINTF(2, 3);
-
+extern void splash(int ticks, const char *str);
#endif /* _GUI_ICON_H_ */