diff options
author | Thomas Martitz <kugel@rockbox.org> | 2009-10-15 21:30:19 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2009-10-15 21:30:19 +0000 |
commit | 4004c75fee1e0f7cb7397ac88dce5209b57b8d96 (patch) | |
tree | f9562c9a2df2f35d74e441427a8b1ee31f4ea5b5 | |
parent | 9c45cf2f468ec80d6dcb5c695f72061e7e34d7d7 (diff) | |
download | rockbox-4004c75fee1e0f7cb7397ac88dce5209b57b8d96.tar.gz rockbox-4004c75fee1e0f7cb7397ac88dce5209b57b8d96.zip |
Use the center align viewport flag to draw top and bottom text centered.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23197 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/gui/pitchscreen.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/apps/gui/pitchscreen.c b/apps/gui/pitchscreen.c index 7de65bc36e..33c92e845b 100644 --- a/apps/gui/pitchscreen.c +++ b/apps/gui/pitchscreen.c | |||
@@ -154,6 +154,9 @@ static void pitchscreen_fix_viewports(struct viewport *parent, | |||
154 | { | 154 | { |
155 | pitch_viewports[i] = *parent; | 155 | pitch_viewports[i] = *parent; |
156 | pitch_viewports[i].height = font_height; | 156 | pitch_viewports[i].height = font_height; |
157 | |||
158 | if (i == PITCH_TOP || i == PITCH_BOTTOM) | ||
159 | pitch_viewports[i].flags |= VP_FLAG_ALIGN_CENTER; | ||
157 | } | 160 | } |
158 | pitch_viewports[PITCH_TOP].y += ICON_BORDER; | 161 | pitch_viewports[PITCH_TOP].y += ICON_BORDER; |
159 | 162 | ||
@@ -204,7 +207,8 @@ static void pitchscreen_draw(struct screen *display, int max_lines, | |||
204 | int w, h; | 207 | int w, h; |
205 | bool show_lang_pitch; | 208 | bool show_lang_pitch; |
206 | 209 | ||
207 | /* "Pitch up/Pitch down" - hide for a small screen */ | 210 | /* "Pitch up/Pitch down" - hide for a small screen, |
211 | * the text is drawn centered automatically */ | ||
208 | if (max_lines >= 5) | 212 | if (max_lines >= 5) |
209 | { | 213 | { |
210 | /* UP: Pitch Up */ | 214 | /* UP: Pitch Up */ |
@@ -213,11 +217,9 @@ static void pitchscreen_draw(struct screen *display, int max_lines, | |||
213 | ptr = str(LANG_PITCH_UP_SEMITONE); | 217 | ptr = str(LANG_PITCH_UP_SEMITONE); |
214 | else | 218 | else |
215 | ptr = str(LANG_PITCH_UP); | 219 | ptr = str(LANG_PITCH_UP); |
216 | display->getstringsize(ptr, &w, &h); | ||
217 | display->clear_viewport(); | 220 | display->clear_viewport(); |
218 | /* draw text */ | 221 | /* draw text */ |
219 | display->putsxy((pitch_viewports[PITCH_TOP].width / 2) - | 222 | display->putsxy(0, 0, ptr); |
220 | (w / 2), 0, ptr); | ||
221 | display->update_viewport(); | 223 | display->update_viewport(); |
222 | 224 | ||
223 | /* DOWN: Pitch Down */ | 225 | /* DOWN: Pitch Down */ |
@@ -226,11 +228,9 @@ static void pitchscreen_draw(struct screen *display, int max_lines, | |||
226 | ptr = str(LANG_PITCH_DOWN_SEMITONE); | 228 | ptr = str(LANG_PITCH_DOWN_SEMITONE); |
227 | else | 229 | else |
228 | ptr = str(LANG_PITCH_DOWN); | 230 | ptr = str(LANG_PITCH_DOWN); |
229 | display->getstringsize(ptr, &w, &h); | ||
230 | display->clear_viewport(); | 231 | display->clear_viewport(); |
231 | /* draw text */ | 232 | /* draw text */ |
232 | display->putsxy((pitch_viewports[PITCH_BOTTOM].width / 2) - | 233 | display->putsxy(0, 0, ptr); |
233 | (w / 2), 0, ptr); | ||
234 | display->update_viewport(); | 234 | display->update_viewport(); |
235 | } | 235 | } |
236 | 236 | ||