summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/list.c38
-rw-r--r--apps/gui/list.h2
-rw-r--r--apps/menu.c25
-rw-r--r--apps/settings.c2
4 files changed, 49 insertions, 18 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)
diff --git a/apps/gui/list.h b/apps/gui/list.h
index 12f88174d3..30de784687 100644
--- a/apps/gui/list.h
+++ b/apps/gui/list.h
@@ -135,7 +135,7 @@ extern void gui_list_screen_scroll_step(int ofs);
135extern void gui_list_screen_scroll_out_of_view(bool enable); 135extern void gui_list_screen_scroll_out_of_view(bool enable);
136#endif /* HAVE_LCD_BITMAP */ 136#endif /* HAVE_LCD_BITMAP */
137 137
138void list_init_viewports(void); 138void list_init_viewports(struct gui_synclist * lists);
139 139
140extern void gui_synclist_init( 140extern void gui_synclist_init(
141 struct gui_synclist * lists, 141 struct gui_synclist * lists,
diff --git a/apps/menu.c b/apps/menu.c
index d970ac8861..ba772a80fa 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -296,19 +296,30 @@ void init_default_menu_viewports(struct viewport parent[NB_SCREENS], bool hide_b
296 } 296 }
297 } 297 }
298#ifdef HAS_BUTTONBAR 298#ifdef HAS_BUTTONBAR
299 if (!hide_bars) 299 if (!hide_bars && global_settings.buttonbar)
300 parent[0].height -= BUTTONBAR_HEIGHT; 300 parent[0].height -= BUTTONBAR_HEIGHT;
301#endif 301#endif
302} 302}
303 303
304bool do_setting_from_menu(const struct menu_item_ex *temp) 304bool do_setting_from_menu(const struct menu_item_ex *temp)
305{ 305{
306 int setting_id; 306 int setting_id, oldval;
307 const struct settings_list *setting = find_setting( 307 const struct settings_list *setting = find_setting(
308 temp->variable, 308 temp->variable,
309 &setting_id); 309 &setting_id);
310 char *title; 310 char *title;
311 char padded_title[MAX_PATH]; 311 char padded_title[MAX_PATH];
312 int var_type = setting->flags&F_T_MASK;
313 if (var_type == F_T_INT || var_type == F_T_UINT)
314 {
315 oldval = *(int*)setting->setting;
316 }
317 else if (var_type == F_T_BOOL)
318 {
319 oldval = *(bool*)setting->setting;
320 }
321 else
322 oldval = 0;
312 if ((temp->flags&MENU_TYPE_MASK) == MT_SETTING_W_TEXT) 323 if ((temp->flags&MENU_TYPE_MASK) == MT_SETTING_W_TEXT)
313 title = temp->callback_and_desc->desc; 324 title = temp->callback_and_desc->desc;
314 else 325 else
@@ -339,6 +350,14 @@ bool do_setting_from_menu(const struct menu_item_ex *temp)
339 350
340 option_screen((struct settings_list *)setting, 351 option_screen((struct settings_list *)setting,
341 setting->flags&F_TEMPVAR, title); 352 setting->flags&F_TEMPVAR, title);
353 if (var_type == F_T_INT || var_type == F_T_UINT)
354 {
355 return oldval != *(int*)setting->setting;
356 }
357 else if (var_type == F_T_BOOL)
358 {
359 return oldval != *(bool*)setting->setting;
360 }
342 return false; 361 return false;
343} 362}
344 363
@@ -548,9 +567,9 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
548 if (temp->flags&MENU_HAS_DESC && 567 if (temp->flags&MENU_HAS_DESC &&
549 temp->callback_and_desc->desc == ID2P(LANG_LANGUAGE)) 568 temp->callback_and_desc->desc == ID2P(LANG_LANGUAGE))
550 { 569 {
570 init_default_menu_viewports(menu_vp, hide_bars);
551 init_menu_lists(menu, &lists, selected, true, vps); 571 init_menu_lists(menu, &lists, selected, true, vps);
552 } 572 }
553 init_default_menu_viewports(menu_vp, hide_bars);
554 573
555 if (temp->flags&MENU_FUNC_CHECK_RETVAL) 574 if (temp->flags&MENU_FUNC_CHECK_RETVAL)
556 { 575 {
diff --git a/apps/settings.c b/apps/settings.c
index 9374c2e372..d4f14079b1 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -942,7 +942,7 @@ void settings_apply(const bool read_disk)
942#if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC 942#if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
943 enc_global_settings_apply(); 943 enc_global_settings_apply();
944#endif 944#endif
945 list_init_viewports(); 945 list_init_viewports(NULL);
946} 946}
947 947
948 948