From 4d6374c9236b93e0bd457f99944164fc493d1120 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Fri, 16 Mar 2007 21:56:08 +0000 Subject: Get rid of the 'center' parameter for splashes. There were only 2 of almost 500 splashes which were not centered. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12807 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/color_picker.c | 2 +- apps/gui/gwps-common.c | 10 ++++---- apps/gui/splash.c | 64 ++++++++++++++++++++----------------------------- apps/gui/splash.h | 13 ++++------ 4 files changed, 36 insertions(+), 53 deletions(-) (limited to 'apps/gui') diff --git a/apps/gui/color_picker.c b/apps/gui/color_picker.c index 08c05d958f..2d0dba1221 100644 --- a/apps/gui/color_picker.c +++ b/apps/gui/color_picker.c @@ -392,7 +392,7 @@ bool set_color(struct screen *display, char *title, unsigned *color, if (banned_color != (unsigned)-1 && banned_color == rgb.color) { - gui_syncsplash(HZ*2, true, str(LANG_COLOR_UNACCEPTABLE)); + gui_syncsplash(HZ*2, str(LANG_COLOR_UNACCEPTABLE)); break; } *color = rgb.color; diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index 2f86c9dedb..24ecd8b051 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c @@ -2336,8 +2336,8 @@ 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, false, "Vol: %d dB ", - sound_val2phys(SOUND_VOLUME, global_settings.volume)); + gui_splash(gwps->display, 0, "Vol: %3d dB", + sound_val2phys(SOUND_VOLUME, global_settings.volume)); return true; #endif return false; @@ -2494,10 +2494,10 @@ bool gui_wps_display(void) { global_status.resume_index = -1; #ifdef HAVE_LCD_CHARCELLS - gui_syncsplash(HZ, true, str(LANG_END_PLAYLIST_PLAYER)); + gui_syncsplash(HZ, str(LANG_END_PLAYLIST_PLAYER)); #else gui_syncstatusbar_draw(&statusbars, true); - gui_syncsplash(HZ, true, str(LANG_END_PLAYLIST_RECORDER)); + gui_syncsplash(HZ, str(LANG_END_PLAYLIST_RECORDER)); #endif return true; } @@ -2651,6 +2651,6 @@ void display_keylock_text(bool locked) else s = str(LANG_KEYLOCK_OFF_RECORDER); #endif - gui_syncsplash(HZ, true, s); + gui_syncsplash(HZ, s); } diff --git a/apps/gui/splash.c b/apps/gui/splash.c index 30909217b2..4234171207 100644 --- a/apps/gui/splash.c +++ b/apps/gui/splash.c @@ -39,8 +39,7 @@ #endif -static void splash(struct screen * screen, bool center, - const char *fmt, va_list ap) +static void splash(struct screen * screen, const char *fmt, va_list ap) { char splash_buf[MAXBUFFER]; short widths[MAXLINES]; @@ -127,43 +126,33 @@ static void splash(struct screen * screen, bool center, #ifdef HAVE_LCD_BITMAP /* If we center the display, then just clear the box we need and put a nice little frame and put the text in there! */ - if (center) - { - y = (screen->height - y) / 2; /* height => y start position */ - x = (screen->width - maxw) / 2 - 2; + y = (screen->height - y) / 2; /* height => y start position */ + x = (screen->width - maxw) / 2 - 2; #if LCD_DEPTH > 1 - if (screen->depth > 1) - { - prevfg = screen->get_foreground(); - screen->set_drawmode(DRMODE_FG); - screen->set_foreground( - SCREEN_COLOR_TO_NATIVE(screen, LCD_LIGHTGRAY)); - } - else + if (screen->depth > 1) + { + prevfg = screen->get_foreground(); + screen->set_drawmode(DRMODE_FG); + screen->set_foreground( + SCREEN_COLOR_TO_NATIVE(screen, LCD_LIGHTGRAY)); + } + else #endif - screen->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); + screen->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); - screen->fillrect(x, y-2, maxw+4, screen->height-y*2+4); + screen->fillrect(x, y-2, maxw+4, screen->height-y*2+4); #if LCD_DEPTH > 1 - if (screen->depth > 1) - screen->set_foreground( - SCREEN_COLOR_TO_NATIVE(screen, LCD_BLACK)); - else + if (screen->depth > 1) + screen->set_foreground(SCREEN_COLOR_TO_NATIVE(screen, LCD_BLACK)); + else #endif - screen->set_drawmode(DRMODE_SOLID); + screen->set_drawmode(DRMODE_SOLID); - screen->drawrect(x, y-2, maxw+4, screen->height-y*2+4); - } - else - { - y = 0; - x = 0; - screen->clear_display(); - } + screen->drawrect(x, y-2, maxw+4, screen->height-y*2+4); #else /* HAVE_LCD_CHARCELLS */ - y = 0; /* vertical center on 2 lines would be silly */ + y = 0; /* vertical centering on 2 lines would be silly */ x = 0; screen->clear_display(); #endif @@ -172,8 +161,7 @@ static void splash(struct screen * screen, bool center, for (i = 0; i <= line; i++) { - if (center) - x = MAX((screen->width - widths[i]) / 2, 0); + x = MAX((screen->width - widths[i]) / 2, 0); #ifdef HAVE_LCD_BITMAP screen->putsxy(x, y, lines[i]); @@ -184,7 +172,7 @@ static void splash(struct screen * screen, bool center, } #if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH > 1) - if (center && screen->depth > 1) + if (screen->depth > 1) { screen->set_foreground(prevfg); screen->set_drawmode(DRMODE_SOLID); @@ -195,25 +183,25 @@ static void splash(struct screen * screen, bool center, #endif } -void gui_splash(struct screen * screen, int ticks, - bool center, const unsigned char *fmt, ...) +void gui_splash(struct screen * screen, int ticks, + const unsigned char *fmt, ...) { va_list ap; va_start( ap, fmt ); - splash(screen, center, fmt, ap); + splash(screen, fmt, ap); va_end( ap ); if(ticks) sleep(ticks); } -void gui_syncsplash(int ticks, bool center, const unsigned char *fmt, ...) +void gui_syncsplash(int ticks, const unsigned char *fmt, ...) { va_list ap; int i; va_start( ap, fmt ); FOR_NB_SCREENS(i) - splash(&(screens[i]), center, fmt, ap); + splash(&(screens[i]), fmt, ap); va_end( ap ); if(ticks) diff --git a/apps/gui/splash.h b/apps/gui/splash.h index b1ac15c537..589be95033 100644 --- a/apps/gui/splash.h +++ b/apps/gui/splash.h @@ -22,24 +22,19 @@ #include "screen_access.h" /* - * Puts a splash message on the given screen for a given period + * Puts a splash message centered on the given screen for a given period * - screen : the screen to put the splash on * - ticks : how long the splash is displayed (in rb ticks) - * - center : FALSE means left-justified, TRUE means - * horizontal and vertical center * - fmt : what to say *printf style */ extern void gui_splash(struct screen * screen, int ticks, - bool center, const char *fmt, ...); + const char *fmt, ...); /* - * Puts a splash message on all the screens for a given period + * Puts a splash message centered on all the screens for a given period * - ticks : how long the splash is displayed (in rb ticks) - * - center : FALSE means left-justified, TRUE means - * horizontal and vertical center * - fmt : what to say *printf style */ -extern void gui_syncsplash(int ticks, bool center, - const unsigned char *fmt, ...); +extern void gui_syncsplash(int ticks, const unsigned char *fmt, ...); #endif /* _GUI_ICON_H_ */ -- cgit v1.2.3