diff options
Diffstat (limited to 'apps/menu.c')
-rw-r--r-- | apps/menu.c | 61 |
1 files changed, 10 insertions, 51 deletions
diff --git a/apps/menu.c b/apps/menu.c index a0317e4a84..b5309a047e 100644 --- a/apps/menu.c +++ b/apps/menu.c | |||
@@ -283,29 +283,6 @@ static int talk_menu_item(int selected_item, void *data) | |||
283 | } | 283 | } |
284 | return 0; | 284 | return 0; |
285 | } | 285 | } |
286 | /* this is used to reload the default menu viewports when the | ||
287 | theme changes. nothing happens if the menu is using a supplied parent vp */ | ||
288 | static void init_default_menu_viewports(struct viewport parent[NB_SCREENS], bool hide_bars) | ||
289 | { | ||
290 | int i; | ||
291 | FOR_NB_SCREENS(i) | ||
292 | { | ||
293 | viewport_set_defaults(&parent[i], i); | ||
294 | /* viewport_set_defaults() fixes the vp for the bars, so resize */ | ||
295 | if (hide_bars) | ||
296 | { | ||
297 | if (global_settings.statusbar) | ||
298 | { | ||
299 | parent[i].y -= STATUSBAR_HEIGHT; | ||
300 | parent[i].height += STATUSBAR_HEIGHT; | ||
301 | } | ||
302 | } | ||
303 | } | ||
304 | #ifdef HAVE_BUTTONBAR | ||
305 | if (!hide_bars && global_settings.buttonbar) | ||
306 | parent[0].height -= BUTTONBAR_HEIGHT; | ||
307 | #endif | ||
308 | } | ||
309 | 286 | ||
310 | bool do_setting_from_menu(const struct menu_item_ex *temp, | 287 | bool do_setting_from_menu(const struct menu_item_ex *temp, |
311 | struct viewport parent[NB_SCREENS]) | 288 | struct viewport parent[NB_SCREENS]) |
@@ -383,8 +360,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
383 | int menu_stack_selected_item[MAX_MENUS]; | 360 | int menu_stack_selected_item[MAX_MENUS]; |
384 | int stack_top = 0; | 361 | int stack_top = 0; |
385 | bool in_stringlist, done = false; | 362 | bool in_stringlist, done = false; |
386 | 363 | struct viewport *vps = NULL; | |
387 | struct viewport *vps, menu_vp[NB_SCREENS]; /* menu_vp will hopefully be phased out */ | ||
388 | #ifdef HAVE_BUTTONBAR | 364 | #ifdef HAVE_BUTTONBAR |
389 | struct gui_buttonbar buttonbar; | 365 | struct gui_buttonbar buttonbar; |
390 | gui_buttonbar_init(&buttonbar); | 366 | gui_buttonbar_init(&buttonbar); |
@@ -396,27 +372,12 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
396 | if (start_menu == NULL) | 372 | if (start_menu == NULL) |
397 | menu = &main_menu_; | 373 | menu = &main_menu_; |
398 | else menu = start_menu; | 374 | else menu = start_menu; |
399 | 375 | ||
400 | init_default_menu_viewports(menu_vp, hide_bars); | 376 | /* if hide_bars is true, assume parent has been fixed before passed into |
401 | 377 | * this function, e.g. with viewport_set_defaults(parent, screen, true) */ | |
402 | if (parent) | 378 | init_menu_lists(menu, &lists, selected, true, parent); |
403 | { | 379 | vps = *(lists.parent); |
404 | vps = parent; | ||
405 | /* if hide_bars == true we assume the viewport is correctly sized */ | ||
406 | } | ||
407 | else | ||
408 | { | ||
409 | vps = menu_vp; | ||
410 | } | ||
411 | FOR_NB_SCREENS(i) | ||
412 | { | ||
413 | screens[i].set_viewport(&vps[i]); | ||
414 | screens[i].clear_viewport(); | ||
415 | screens[i].set_viewport(NULL); | ||
416 | } | ||
417 | init_menu_lists(menu, &lists, selected, true, vps); | ||
418 | in_stringlist = ((menu->flags&MENU_TYPE_MASK) == MT_RETURN_ID); | 380 | in_stringlist = ((menu->flags&MENU_TYPE_MASK) == MT_RETURN_ID); |
419 | |||
420 | /* load the callback, and only reload it if menu changes */ | 381 | /* load the callback, and only reload it if menu changes */ |
421 | get_menu_callback(menu, &menu_callback); | 382 | get_menu_callback(menu, &menu_callback); |
422 | 383 | ||
@@ -436,7 +397,6 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
436 | #ifdef HAVE_BUTTONBAR | 397 | #ifdef HAVE_BUTTONBAR |
437 | gui_buttonbar_draw(&buttonbar); | 398 | gui_buttonbar_draw(&buttonbar); |
438 | #endif | 399 | #endif |
439 | gui_syncstatusbar_draw(&statusbars, true); | ||
440 | } | 400 | } |
441 | action = get_action(CONTEXT_MAINMENU, | 401 | action = get_action(CONTEXT_MAINMENU, |
442 | list_do_action_timeout(&lists, HZ)); | 402 | list_do_action_timeout(&lists, HZ)); |
@@ -496,7 +456,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
496 | else if (!in_stringlist) | 456 | else if (!in_stringlist) |
497 | { | 457 | { |
498 | int type; | 458 | int type; |
499 | selected = get_menu_selection(gui_synclist_get_sel_pos(&lists), menu); | 459 | selected = get_menu_selection(gui_synclist_get_sel_pos(&lists),menu); |
500 | temp = menu->submenus[selected]; | 460 | temp = menu->submenus[selected]; |
501 | type = (temp->flags&MENU_TYPE_MASK); | 461 | type = (temp->flags&MENU_TYPE_MASK); |
502 | if ((type == MT_SETTING_W_TEXT || type == MT_SETTING)) | 462 | if ((type == MT_SETTING_W_TEXT || type == MT_SETTING)) |
@@ -640,9 +600,9 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
640 | temp->function->param); | 600 | temp->function->param); |
641 | else | 601 | else |
642 | return_value = temp->function->function(); | 602 | return_value = temp->function->function(); |
643 | if (!(menu->flags&MENU_EXITAFTERTHISMENU) || (temp->flags&MENU_EXITAFTERTHISMENU)) | 603 | if (!(menu->flags&MENU_EXITAFTERTHISMENU) || |
604 | (temp->flags&MENU_EXITAFTERTHISMENU)) | ||
644 | { | 605 | { |
645 | init_default_menu_viewports(menu_vp, hide_bars); | ||
646 | init_menu_lists(menu, &lists, selected, true, vps); | 606 | init_menu_lists(menu, &lists, selected, true, vps); |
647 | } | 607 | } |
648 | if (temp->flags&MENU_FUNC_CHECK_RETVAL) | 608 | if (temp->flags&MENU_FUNC_CHECK_RETVAL) |
@@ -658,9 +618,8 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
658 | case MT_SETTING: | 618 | case MT_SETTING: |
659 | case MT_SETTING_W_TEXT: | 619 | case MT_SETTING_W_TEXT: |
660 | { | 620 | { |
661 | if (do_setting_from_menu(temp, menu_vp)) | 621 | if (do_setting_from_menu(temp, vps)) |
662 | { | 622 | { |
663 | init_default_menu_viewports(menu_vp, hide_bars); | ||
664 | init_menu_lists(menu, &lists, selected, true,vps); | 623 | init_menu_lists(menu, &lists, selected, true,vps); |
665 | redraw_lists = false; /* above does the redraw */ | 624 | redraw_lists = false; /* above does the redraw */ |
666 | } | 625 | } |