summaryrefslogtreecommitdiff
path: root/apps/gui/list.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/list.c')
-rw-r--r--apps/gui/list.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 1f0f0ff01c..07ef578d29 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -63,15 +63,26 @@ void list_draw(struct screen *display, struct viewport *parent, struct gui_syncl
63 63
64#ifdef HAVE_LCD_BITMAP 64#ifdef HAVE_LCD_BITMAP
65static struct viewport parent[NB_SCREENS]; 65static struct viewport parent[NB_SCREENS];
66void list_init_viewports(void) 66void list_init_viewports(struct gui_synclist *list)
67{ 67{
68 int i; 68 int i;
69 struct viewport *vp; 69 struct viewport *vp;
70 FOR_NB_SCREENS(i) 70 FOR_NB_SCREENS(i)
71 { 71 {
72 vp = &parent[i]; 72 vp = &parent[i];
73 viewport_set_defaults(vp, i); 73 if (!list)
74 viewport_set_defaults(vp, i);
75 else if (list->parent[i] == vp)
76 {
77 viewport_set_defaults(vp, i);
78 list->parent[i]->y = global_settings.statusbar?STATUSBAR_HEIGHT:0;
79 list->parent[i]->height = screens[i].height - list->parent[i]->y;
80 }
74 } 81 }
82#ifdef HAS_BUTTONBAR
83 if (list && (list->parent[0] == &parent[0]) && global_settings.buttonbar)
84 list->parent[0]->height -= BUTTONBAR_HEIGHT;
85#endif
75 force_list_reinit = false; 86 force_list_reinit = false;
76} 87}
77#else 88#else
@@ -85,8 +96,9 @@ static struct viewport parent[NB_SCREENS] =
85 .height = LCD_HEIGHT 96 .height = LCD_HEIGHT
86 }, 97 },
87}; 98};
88void list_init_viewports(void) 99void list_init_viewports(struct gui_synclist *list)
89{ 100{
101 (void)list;
90} 102}
91#endif 103#endif
92 104
@@ -135,14 +147,9 @@ void gui_synclist_init(struct gui_synclist * gui_list,
135 else 147 else
136 { 148 {
137 gui_list->parent[i] = &parent[i]; 149 gui_list->parent[i] = &parent[i];
138 gui_list->parent[i]->y = global_settings.statusbar?STATUSBAR_HEIGHT:0;
139 gui_list->parent[i]->height = screens[i].height - gui_list->parent[i]->y;
140#ifdef HAS_BUTTONBAR
141 if (screens[i].has_buttonbar)
142 gui_list->parent[i]->height -= BUTTONBAR_HEIGHT;
143#endif
144 } 150 }
145 } 151 }
152 list_init_viewports(gui_list);
146 gui_list->limit_scroll = false; 153 gui_list->limit_scroll = false;
147 gui_list->data=data; 154 gui_list->data=data;
148 gui_list->scroll_all=scroll_all; 155 gui_list->scroll_all=scroll_all;
@@ -214,7 +221,6 @@ void gui_synclist_draw(struct gui_synclist *gui_list)
214#ifdef HAS_BUTTONBAR 221#ifdef HAS_BUTTONBAR
215 static bool last_buttonbar = false; 222 static bool last_buttonbar = false;
216#endif 223#endif
217
218 if (force_list_reinit || 224 if (force_list_reinit ||
219#ifdef HAS_BUTTONBAR 225#ifdef HAS_BUTTONBAR
220 last_buttonbar != screens[SCREEN_MAIN].has_buttonbar || 226 last_buttonbar != screens[SCREEN_MAIN].has_buttonbar ||
@@ -222,7 +228,7 @@ void gui_synclist_draw(struct gui_synclist *gui_list)
222 last_list != gui_list || 228 last_list != gui_list ||
223 gui_list->nb_items != last_count) 229 gui_list->nb_items != last_count)
224 { 230 {
225 list_init_viewports(); 231 list_init_viewports(gui_list);
226 force_list_reinit = false; 232 force_list_reinit = false;
227 } 233 }
228#ifdef HAS_BUTTONBAR 234#ifdef HAS_BUTTONBAR
@@ -817,14 +823,20 @@ static char* simplelist_static_getname(int item, void * data, char *buffer)
817bool simplelist_show_list(struct simplelist_info *info) 823bool simplelist_show_list(struct simplelist_info *info)
818{ 824{
819 struct gui_synclist lists; 825 struct gui_synclist lists;
820 int action, old_line_count = simplelist_line_count; 826 struct viewport vp[NB_SCREENS];
827 int action, old_line_count = simplelist_line_count,i;
821 char* (*getname)(int item, void * data, char *buffer); 828 char* (*getname)(int item, void * data, char *buffer);
822 if (info->get_name) 829 if (info->get_name)
823 getname = info->get_name; 830 getname = info->get_name;
824 else 831 else
825 getname = simplelist_static_getname; 832 getname = simplelist_static_getname;
833 FOR_NB_SCREENS(i)
834 {
835 viewport_set_defaults(&vp[i], i);
836 }
826 gui_synclist_init(&lists, getname, info->callback_data, 837 gui_synclist_init(&lists, getname, info->callback_data,
827 info->scroll_all, info->selection_size, NULL); 838 info->scroll_all, info->selection_size, vp);
839
828 if (info->title) 840 if (info->title)
829 gui_synclist_set_title(&lists, info->title, NOICON); 841 gui_synclist_set_title(&lists, info->title, NOICON);
830 if (info->get_icon) 842 if (info->get_icon)