summaryrefslogtreecommitdiff
path: root/apps/gui/list.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-08-16 22:20:11 +0000
committerThomas Martitz <kugel@rockbox.org>2009-08-16 22:20:11 +0000
commit4c48b59be8ba41b80350d5329d0f13240229da0a (patch)
treee8cb9547c4d8d5faff39de2aef5626a5cabc689d /apps/gui/list.c
parentc0897a8002d493244efd69fca5c433dbafe8d5be (diff)
downloadrockbox-4c48b59be8ba41b80350d5329d0f13240229da0a.tar.gz
rockbox-4c48b59be8ba41b80350d5329d0f13240229da0a.zip
User definable UI viewport, to be able to restrict the UI into a viewport for all bitmap displays.
Flyspray: FS#8799 This will allow for pretty themes, for example those with nice glass effects on their backdrops (some might argue they're wasting screen space but it's upto them), as well as allowing for future background WPS updates in the main UI. Plugins are not converted yet, they simply use the full screen. Ideally, any plugin that does *not* want the UI viewport, should take care of that itself (i.e. plugins should normally use the UI viewport). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22365 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/list.c')
-rw-r--r--apps/gui/list.c55
1 files changed, 25 insertions, 30 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 8a65d3f298..3627f12221 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -55,29 +55,37 @@ static int offset_step = 16; /* pixels per screen scroll step */
55/* should lines scroll out of the screen */ 55/* should lines scroll out of the screen */
56static bool offset_out_of_view = false; 56static bool offset_out_of_view = false;
57#endif 57#endif
58static int force_list_reinit = false;
59 58
60static void gui_list_select_at_offset(struct gui_synclist * gui_list, 59static void gui_list_select_at_offset(struct gui_synclist * gui_list,
61 int offset); 60 int offset);
62void list_draw(struct screen *display, struct gui_synclist *list); 61void list_draw(struct screen *display, struct gui_synclist *list);
63 62
64#ifdef HAVE_LCD_BITMAP 63#ifdef HAVE_LCD_BITMAP
65static struct viewport parent[NB_SCREENS]; 64static void list_init_viewports(struct gui_synclist *list)
66void list_init_viewports(struct gui_synclist *list)
67{ 65{
66 struct viewport* vp;
68 int i; 67 int i;
69 struct viewport *vp; 68 bool parent_used = (*list->parent != NULL);
70 FOR_NB_SCREENS(i) 69 if (!parent_used)
71 { 70 {
72 vp = &parent[i]; 71 vp = viewport_get_current_vp();
73 if (!list || list->parent[i] == vp) 72 FOR_NB_SCREENS(i)
74 viewport_set_defaults(vp, i); 73 list->parent[i] = &vp[i];
75 } 74 }
76#ifdef HAVE_BUTTONBAR 75#ifdef HAVE_BUTTONBAR
77 if (list && (list->parent[0] == &parent[0]) && global_settings.buttonbar) 76 if (list && !parent_used[SCREEN_MAIN] && global_settings.buttonbar)
78 list->parent[0]->height -= BUTTONBAR_HEIGHT; 77 list->parent[0]->height -= BUTTONBAR_HEIGHT;
79#endif 78#endif
80 force_list_reinit = false; 79}
80#else
81#define list_init_viewports(a)
82#endif
83
84#ifdef HAVE_LCD_BITMAP
85bool list_display_title(struct gui_synclist *list, enum screen_type screen)
86{
87 return list->title != NULL &&
88 viewport_get_nb_lines(list->parent[screen])>2;
81} 89}
82#else 90#else
83static struct viewport parent[NB_SCREENS] = 91static struct viewport parent[NB_SCREENS] =
@@ -90,20 +98,6 @@ static struct viewport parent[NB_SCREENS] =
90 .height = LCD_HEIGHT 98 .height = LCD_HEIGHT
91 }, 99 },
92}; 100};
93void list_init_viewports(struct gui_synclist *list)
94{
95 (void)list;
96 force_list_reinit = false;
97}
98#endif
99
100#ifdef HAVE_LCD_BITMAP
101bool list_display_title(struct gui_synclist *list, enum screen_type screen)
102{
103 return list->title != NULL &&
104 viewport_get_nb_lines(list->parent[screen])>2;
105}
106#else
107#define list_display_title(l, i) false 101#define list_display_title(l, i) false
108#endif 102#endif
109 103
@@ -141,9 +135,12 @@ void gui_synclist_init(struct gui_synclist * gui_list,
141 if (list_parent) 135 if (list_parent)
142 gui_list->parent[i] = &list_parent[i]; 136 gui_list->parent[i] = &list_parent[i];
143 else 137 else
144 { 138 gui_list->parent[i] =
145 gui_list->parent[i] = &parent[i]; 139#ifdef HAVE_LCD_BITMAP
146 } 140 NULL;
141#else
142 &parent[i];
143#endif
147 } 144 }
148 list_init_viewports(gui_list); 145 list_init_viewports(gui_list);
149 gui_list->limit_scroll = false; 146 gui_list->limit_scroll = false;
@@ -162,7 +159,6 @@ void gui_synclist_init(struct gui_synclist * gui_list,
162 gui_list->title_color = -1; 159 gui_list->title_color = -1;
163 gui_list->callback_get_item_color = NULL; 160 gui_list->callback_get_item_color = NULL;
164#endif 161#endif
165 force_list_reinit = true;
166} 162}
167 163
168/* this toggles the selection bar or cursor */ 164/* this toggles the selection bar or cursor */
@@ -218,7 +214,7 @@ void gui_synclist_draw(struct gui_synclist *gui_list)
218#ifdef HAVE_BUTTONBAR 214#ifdef HAVE_BUTTONBAR
219 static bool last_buttonbar = false; 215 static bool last_buttonbar = false;
220#endif 216#endif
221 if (force_list_reinit || 217 if (
222#ifdef HAVE_BUTTONBAR 218#ifdef HAVE_BUTTONBAR
223 last_buttonbar != screens[SCREEN_MAIN].has_buttonbar || 219 last_buttonbar != screens[SCREEN_MAIN].has_buttonbar ||
224#endif 220#endif
@@ -436,7 +432,6 @@ void gui_synclist_set_title(struct gui_synclist * gui_list,
436 } else { 432 } else {
437 gui_list->title_width = 0; 433 gui_list->title_width = 0;
438 } 434 }
439 force_list_reinit = true;
440} 435}
441 436
442 437