summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2007-03-16 21:56:08 +0000
committerJens Arnold <amiconn@rockbox.org>2007-03-16 21:56:08 +0000
commit4d6374c9236b93e0bd457f99944164fc493d1120 (patch)
treeff9630fcef66e63c61cc0a74e97f21220e668f75 /apps/gui
parent2c643b9f3e22ee07f7949a5471f726758dc40841 (diff)
downloadrockbox-4d6374c9236b93e0bd457f99944164fc493d1120.tar.gz
rockbox-4d6374c9236b93e0bd457f99944164fc493d1120.zip
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
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/color_picker.c2
-rw-r--r--apps/gui/gwps-common.c10
-rw-r--r--apps/gui/splash.c64
-rw-r--r--apps/gui/splash.h13
4 files changed, 36 insertions, 53 deletions
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,
392 if (banned_color != (unsigned)-1 && 392 if (banned_color != (unsigned)-1 &&
393 banned_color == rgb.color) 393 banned_color == rgb.color)
394 { 394 {
395 gui_syncsplash(HZ*2, true, str(LANG_COLOR_UNACCEPTABLE)); 395 gui_syncsplash(HZ*2, str(LANG_COLOR_UNACCEPTABLE));
396 break; 396 break;
397 } 397 }
398 *color = rgb.color; 398 *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)
2336 gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC); 2336 gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC);
2337 2337
2338#ifdef HAVE_LCD_CHARCELLS 2338#ifdef HAVE_LCD_CHARCELLS
2339 gui_splash(gwps->display,0, false, "Vol: %d dB ", 2339 gui_splash(gwps->display, 0, "Vol: %3d dB",
2340 sound_val2phys(SOUND_VOLUME, global_settings.volume)); 2340 sound_val2phys(SOUND_VOLUME, global_settings.volume));
2341 return true; 2341 return true;
2342#endif 2342#endif
2343 return false; 2343 return false;
@@ -2494,10 +2494,10 @@ bool gui_wps_display(void)
2494 { 2494 {
2495 global_status.resume_index = -1; 2495 global_status.resume_index = -1;
2496#ifdef HAVE_LCD_CHARCELLS 2496#ifdef HAVE_LCD_CHARCELLS
2497 gui_syncsplash(HZ, true, str(LANG_END_PLAYLIST_PLAYER)); 2497 gui_syncsplash(HZ, str(LANG_END_PLAYLIST_PLAYER));
2498#else 2498#else
2499 gui_syncstatusbar_draw(&statusbars, true); 2499 gui_syncstatusbar_draw(&statusbars, true);
2500 gui_syncsplash(HZ, true, str(LANG_END_PLAYLIST_RECORDER)); 2500 gui_syncsplash(HZ, str(LANG_END_PLAYLIST_RECORDER));
2501#endif 2501#endif
2502 return true; 2502 return true;
2503 } 2503 }
@@ -2651,6 +2651,6 @@ void display_keylock_text(bool locked)
2651 else 2651 else
2652 s = str(LANG_KEYLOCK_OFF_RECORDER); 2652 s = str(LANG_KEYLOCK_OFF_RECORDER);
2653#endif 2653#endif
2654 gui_syncsplash(HZ, true, s); 2654 gui_syncsplash(HZ, s);
2655} 2655}
2656 2656
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 @@
39 39
40#endif 40#endif
41 41
42static void splash(struct screen * screen, bool center, 42static void splash(struct screen * screen, const char *fmt, va_list ap)
43 const char *fmt, va_list ap)
44{ 43{
45 char splash_buf[MAXBUFFER]; 44 char splash_buf[MAXBUFFER];
46 short widths[MAXLINES]; 45 short widths[MAXLINES];
@@ -127,43 +126,33 @@ static void splash(struct screen * screen, bool center,
127#ifdef HAVE_LCD_BITMAP 126#ifdef HAVE_LCD_BITMAP
128 /* If we center the display, then just clear the box we need and put 127 /* If we center the display, then just clear the box we need and put
129 a nice little frame and put the text in there! */ 128 a nice little frame and put the text in there! */
130 if (center) 129 y = (screen->height - y) / 2; /* height => y start position */
131 { 130 x = (screen->width - maxw) / 2 - 2;
132 y = (screen->height - y) / 2; /* height => y start position */
133 x = (screen->width - maxw) / 2 - 2;
134 131
135#if LCD_DEPTH > 1 132#if LCD_DEPTH > 1
136 if (screen->depth > 1) 133 if (screen->depth > 1)
137 { 134 {
138 prevfg = screen->get_foreground(); 135 prevfg = screen->get_foreground();
139 screen->set_drawmode(DRMODE_FG); 136 screen->set_drawmode(DRMODE_FG);
140 screen->set_foreground( 137 screen->set_foreground(
141 SCREEN_COLOR_TO_NATIVE(screen, LCD_LIGHTGRAY)); 138 SCREEN_COLOR_TO_NATIVE(screen, LCD_LIGHTGRAY));
142 } 139 }
143 else 140 else
144#endif 141#endif
145 screen->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); 142 screen->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
146 143
147 screen->fillrect(x, y-2, maxw+4, screen->height-y*2+4); 144 screen->fillrect(x, y-2, maxw+4, screen->height-y*2+4);
148 145
149#if LCD_DEPTH > 1 146#if LCD_DEPTH > 1
150 if (screen->depth > 1) 147 if (screen->depth > 1)
151 screen->set_foreground( 148 screen->set_foreground(SCREEN_COLOR_TO_NATIVE(screen, LCD_BLACK));
152 SCREEN_COLOR_TO_NATIVE(screen, LCD_BLACK)); 149 else
153 else
154#endif 150#endif
155 screen->set_drawmode(DRMODE_SOLID); 151 screen->set_drawmode(DRMODE_SOLID);
156 152
157 screen->drawrect(x, y-2, maxw+4, screen->height-y*2+4); 153 screen->drawrect(x, y-2, maxw+4, screen->height-y*2+4);
158 }
159 else
160 {
161 y = 0;
162 x = 0;
163 screen->clear_display();
164 }
165#else /* HAVE_LCD_CHARCELLS */ 154#else /* HAVE_LCD_CHARCELLS */
166 y = 0; /* vertical center on 2 lines would be silly */ 155 y = 0; /* vertical centering on 2 lines would be silly */
167 x = 0; 156 x = 0;
168 screen->clear_display(); 157 screen->clear_display();
169#endif 158#endif
@@ -172,8 +161,7 @@ static void splash(struct screen * screen, bool center,
172 161
173 for (i = 0; i <= line; i++) 162 for (i = 0; i <= line; i++)
174 { 163 {
175 if (center) 164 x = MAX((screen->width - widths[i]) / 2, 0);
176 x = MAX((screen->width - widths[i]) / 2, 0);
177 165
178#ifdef HAVE_LCD_BITMAP 166#ifdef HAVE_LCD_BITMAP
179 screen->putsxy(x, y, lines[i]); 167 screen->putsxy(x, y, lines[i]);
@@ -184,7 +172,7 @@ static void splash(struct screen * screen, bool center,
184 } 172 }
185 173
186#if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH > 1) 174#if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH > 1)
187 if (center && screen->depth > 1) 175 if (screen->depth > 1)
188 { 176 {
189 screen->set_foreground(prevfg); 177 screen->set_foreground(prevfg);
190 screen->set_drawmode(DRMODE_SOLID); 178 screen->set_drawmode(DRMODE_SOLID);
@@ -195,25 +183,25 @@ static void splash(struct screen * screen, bool center,
195#endif 183#endif
196} 184}
197 185
198void gui_splash(struct screen * screen, int ticks, 186void gui_splash(struct screen * screen, int ticks,
199 bool center, const unsigned char *fmt, ...) 187 const unsigned char *fmt, ...)
200{ 188{
201 va_list ap; 189 va_list ap;
202 va_start( ap, fmt ); 190 va_start( ap, fmt );
203 splash(screen, center, fmt, ap); 191 splash(screen, fmt, ap);
204 va_end( ap ); 192 va_end( ap );
205 193
206 if(ticks) 194 if(ticks)
207 sleep(ticks); 195 sleep(ticks);
208} 196}
209 197
210void gui_syncsplash(int ticks, bool center, const unsigned char *fmt, ...) 198void gui_syncsplash(int ticks, const unsigned char *fmt, ...)
211{ 199{
212 va_list ap; 200 va_list ap;
213 int i; 201 int i;
214 va_start( ap, fmt ); 202 va_start( ap, fmt );
215 FOR_NB_SCREENS(i) 203 FOR_NB_SCREENS(i)
216 splash(&(screens[i]), center, fmt, ap); 204 splash(&(screens[i]), fmt, ap);
217 va_end( ap ); 205 va_end( ap );
218 206
219 if(ticks) 207 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 @@
22#include "screen_access.h" 22#include "screen_access.h"
23 23
24/* 24/*
25 * Puts a splash message on the given screen for a given period 25 * Puts a splash message centered on the given screen for a given period
26 * - screen : the screen to put the splash on 26 * - screen : the screen to put the splash on
27 * - ticks : how long the splash is displayed (in rb ticks) 27 * - ticks : how long the splash is displayed (in rb ticks)
28 * - center : FALSE means left-justified, TRUE means
29 * horizontal and vertical center
30 * - fmt : what to say *printf style 28 * - fmt : what to say *printf style
31 */ 29 */
32extern void gui_splash(struct screen * screen, int ticks, 30extern void gui_splash(struct screen * screen, int ticks,
33 bool center, const char *fmt, ...); 31 const char *fmt, ...);
34 32
35/* 33/*
36 * Puts a splash message on all the screens for a given period 34 * Puts a splash message centered on all the screens for a given period
37 * - ticks : how long the splash is displayed (in rb ticks) 35 * - ticks : how long the splash is displayed (in rb ticks)
38 * - center : FALSE means left-justified, TRUE means
39 * horizontal and vertical center
40 * - fmt : what to say *printf style 36 * - fmt : what to say *printf style
41 */ 37 */
42extern void gui_syncsplash(int ticks, bool center, 38extern void gui_syncsplash(int ticks, const unsigned char *fmt, ...);
43 const unsigned char *fmt, ...);
44 39
45#endif /* _GUI_ICON_H_ */ 40#endif /* _GUI_ICON_H_ */