diff options
author | Thomas Martitz <kugel@rockbox.org> | 2011-10-22 10:09:23 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2011-10-22 10:09:23 +0000 |
commit | 5c509d17db86e889560e7d938b5a7acf083948e2 (patch) | |
tree | af7cfcd615d2b48cda55ffecf975a384ed3e5610 | |
parent | 09d0b6fec4988677b3bb4f73a13dd4fa961c3f5a (diff) | |
download | rockbox-5c509d17db86e889560e7d938b5a7acf083948e2.tar.gz rockbox-5c509d17db86e889560e7d938b5a7acf083948e2.zip |
Fix buttonbar and line padding in time&date screen.
The time&date screen uses a custom parent for do_menu(), and doesn't
account for the buttonbar and list line height. Introduce
gui_synclist_set_viewport_defaults() to set those for viewports that are
going to be list parents and use that so that time&date screen doesn't need
to know about buttonbar/line padding.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30824 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/gui/list.c | 23 | ||||
-rw-r--r-- | apps/gui/list.h | 1 | ||||
-rw-r--r-- | apps/menus/time_menu.c | 4 |
3 files changed, 17 insertions, 11 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c index e05e44008b..f875a6559e 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c | |||
@@ -101,15 +101,7 @@ static void list_init_viewports(struct gui_synclist *list) | |||
101 | { | 101 | { |
102 | FOR_NB_SCREENS(i) | 102 | FOR_NB_SCREENS(i) |
103 | { | 103 | { |
104 | list->parent[i] = &parent[i]; | 104 | gui_synclist_set_viewport_defaults(list->parent[i], i); |
105 | viewport_set_defaults(&parent[i], i); | ||
106 | #ifdef HAVE_TOUCHSCREEN | ||
107 | parent[i].line_height = list_line_height(list->parent[i]); | ||
108 | #endif | ||
109 | #ifdef HAVE_BUTTONBAR | ||
110 | if (screens[i].has_buttonbar) | ||
111 | list->parent[i]->height -= BUTTONBAR_HEIGHT; | ||
112 | #endif | ||
113 | } | 105 | } |
114 | } | 106 | } |
115 | list->dirty_tick = current_tick; | 107 | list->dirty_tick = current_tick; |
@@ -502,6 +494,19 @@ void gui_synclist_set_voice_callback(struct gui_synclist * lists, | |||
502 | lists->callback_speak_item = voice_callback; | 494 | lists->callback_speak_item = voice_callback; |
503 | } | 495 | } |
504 | 496 | ||
497 | void gui_synclist_set_viewport_defaults(struct viewport *vp, | ||
498 | enum screen_type screen) | ||
499 | { | ||
500 | viewport_set_defaults(vp, screen); | ||
501 | #ifdef HAVE_TOUCHSCREEN | ||
502 | vp->line_height = list_line_height(vp); | ||
503 | #endif | ||
504 | #ifdef HAVE_BUTTONBAR | ||
505 | if (screens[screen].has_buttonbar) | ||
506 | vp->height -= BUTTONBAR_HEIGHT; | ||
507 | #endif | ||
508 | } | ||
509 | |||
505 | #ifdef HAVE_LCD_COLOR | 510 | #ifdef HAVE_LCD_COLOR |
506 | void gui_synclist_set_color_callback(struct gui_synclist * lists, | 511 | void gui_synclist_set_color_callback(struct gui_synclist * lists, |
507 | list_get_color color_callback) | 512 | list_get_color color_callback) |
diff --git a/apps/gui/list.h b/apps/gui/list.h index 636d36c318..1a713daa36 100644 --- a/apps/gui/list.h +++ b/apps/gui/list.h | |||
@@ -145,6 +145,7 @@ extern void gui_synclist_init( | |||
145 | extern void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items); | 145 | extern void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items); |
146 | extern void gui_synclist_set_icon_callback(struct gui_synclist * lists, list_get_icon icon_callback); | 146 | extern void gui_synclist_set_icon_callback(struct gui_synclist * lists, list_get_icon icon_callback); |
147 | extern void gui_synclist_set_voice_callback(struct gui_synclist * lists, list_speak_item voice_callback); | 147 | extern void gui_synclist_set_voice_callback(struct gui_synclist * lists, list_speak_item voice_callback); |
148 | extern void gui_synclist_set_viewport_defaults(struct viewport *vp, enum screen_type screen); | ||
148 | #ifdef HAVE_LCD_COLOR | 149 | #ifdef HAVE_LCD_COLOR |
149 | extern void gui_synclist_set_color_callback(struct gui_synclist * lists, list_get_color color_callback); | 150 | extern void gui_synclist_set_color_callback(struct gui_synclist * lists, list_get_color color_callback); |
150 | #endif | 151 | #endif |
diff --git a/apps/menus/time_menu.c b/apps/menus/time_menu.c index 7059c5d92c..c4fe49aa49 100644 --- a/apps/menus/time_menu.c +++ b/apps/menus/time_menu.c | |||
@@ -265,11 +265,11 @@ int time_screen(void* ignored) | |||
265 | #endif | 265 | #endif |
266 | nb_lines = viewport_get_nb_lines(&clock_vps[i]); | 266 | nb_lines = viewport_get_nb_lines(&clock_vps[i]); |
267 | 267 | ||
268 | menu[i] = clock_vps[i]; | 268 | gui_synclist_set_viewport_defaults(&menu[i], i); |
269 | /* force time to be drawn centered */ | 269 | /* force time to be drawn centered */ |
270 | clock_vps[i].flags |= VP_FLAG_ALIGN_CENTER; | 270 | clock_vps[i].flags |= VP_FLAG_ALIGN_CENTER; |
271 | 271 | ||
272 | font_h = font_get(clock_vps[i].font)->height; | 272 | font_h = clock_vps[i].line_height; |
273 | nb_lines -= 2; /* at least 2 lines for menu */ | 273 | nb_lines -= 2; /* at least 2 lines for menu */ |
274 | if (nb_lines > 4) | 274 | if (nb_lines > 4) |
275 | nb_lines = 4; | 275 | nb_lines = 4; |