From 5ca15399690a686646d4739b3f4c51c62cc88b68 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Wed, 26 Mar 2008 03:35:24 +0000 Subject: the menu and list now accepts a parent viewport to draw in (and the menu can be told to not show status/button bars). This lays the groundwork to fix colour problems with plugin menus (see star.c for an example.) This hopefully fixes some button bar issues as well as theme problems. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16812 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/chessbox/chessbox.c | 4 ++-- apps/plugins/chessbox/chessbox_pgn.c | 2 +- apps/plugins/chopper.c | 2 +- apps/plugins/clock/clock_menu.c | 10 +++++----- apps/plugins/dice.c | 2 +- apps/plugins/disktidy.c | 2 +- apps/plugins/lib/oldmenuapi.c | 2 +- apps/plugins/lib/playback_control.c | 2 +- apps/plugins/minesweeper.c | 2 +- apps/plugins/pictureflow.c | 4 ++-- apps/plugins/properties.c | 2 +- apps/plugins/random_folder_advance_config.c | 2 +- apps/plugins/shortcuts/shortcuts_view.c | 2 +- apps/plugins/snake.c | 2 +- apps/plugins/sokoban.c | 2 +- apps/plugins/star.c | 18 +++++++++++++++--- apps/plugins/superdom.c | 18 +++++++++--------- apps/plugins/test_codec.c | 2 +- apps/plugins/text_editor.c | 8 ++++---- apps/plugins/vu_meter.c | 2 +- apps/plugins/wavrecord.c | 2 +- apps/plugins/wormlet.c | 2 +- apps/plugins/xobox.c | 2 +- 23 files changed, 54 insertions(+), 42 deletions(-) (limited to 'apps/plugins') diff --git a/apps/plugins/chessbox/chessbox.c b/apps/plugins/chessbox/chessbox.c index 920def8..4129a3c 100644 --- a/apps/plugins/chessbox/chessbox.c +++ b/apps/plugins/chessbox/chessbox.c @@ -393,7 +393,7 @@ static int cb_menu_viewer(void) while(!menu_quit) { - switch(rb->do_menu(&menu, &selection)) + switch(rb->do_menu(&menu, &selection, NULL, false)) { case 0: menu_quit = true; @@ -595,7 +595,7 @@ static int cb_menu(void) while(!menu_quit) { - switch(rb->do_menu(&menu, &selection)) + switch(rb->do_menu(&menu, &selection, NULL, false)) { case 0: menu_quit = true; diff --git a/apps/plugins/chessbox/chessbox_pgn.c b/apps/plugins/chessbox/chessbox_pgn.c index b3e71de..6d18986 100644 --- a/apps/plugins/chessbox/chessbox_pgn.c +++ b/apps/plugins/chessbox/chessbox_pgn.c @@ -628,7 +628,7 @@ struct pgn_game_node* pgn_show_game_list(struct plugin_api* api, } - rb->gui_synclist_init(&games_list, &get_game_text, first_game, false, 1); + rb->gui_synclist_init(&games_list, &get_game_text, first_game, false, 1, NULL); rb->gui_synclist_set_title(&games_list, "Games", NOICON); rb->gui_synclist_set_icon_callback(&games_list, NULL); rb->gui_synclist_set_nb_items(&games_list, i); diff --git a/apps/plugins/chopper.c b/apps/plugins/chopper.c index f359023..71f62f4 100644 --- a/apps/plugins/chopper.c +++ b/apps/plugins/chopper.c @@ -684,7 +684,7 @@ static int chopMenu(int menunum) rb->lcd_clear_display(); while (!menu_quit) { - switch(rb->do_menu(&menu, &result)) + switch(rb->do_menu(&menu, &result, NULL, false)) { case 0: /* Start New Game */ menu_quit=true; diff --git a/apps/plugins/clock/clock_menu.c b/apps/plugins/clock/clock_menu.c index 4cbf46a..a515e87 100644 --- a/apps/plugins/clock/clock_menu.c +++ b/apps/plugins/clock/clock_menu.c @@ -57,7 +57,7 @@ static const struct opt_items hour_format_text[] = { bool menu_mode_selector(void){ MENUITEM_STRINGLIST(menu,"Mode Selector",NULL, "Analog", "Digital", "Binary"); - if(rb->do_menu(&menu, &clock_settings.mode) >=0) + if(rb->do_menu(&menu, &clock_settings.mode, NULL, false) >=0) return(true); return(false); } @@ -73,7 +73,7 @@ void menu_analog_settings(void) "Show Second Hand","Show Border"); while(result>=0){ - result=rb->do_menu(&menu, &selection); + result=rb->do_menu(&menu, &selection, NULL, false); switch(result){ case 0: rb->set_option("Show Date", &clock_settings.analog.show_date, @@ -103,7 +103,7 @@ void menu_digital_settings(void){ "Blinking Colon"); while(result>=0){ - result=rb->do_menu(&menu, &selection); + result=rb->do_menu(&menu, &selection, NULL, false); switch(result){ case 0: rb->set_option("Show Seconds", @@ -148,7 +148,7 @@ void menu_general_settings(void){ "Idle Poweroff (temporary)"); while(result>=0){ - result=rb->do_menu(&menu, &selection); + result=rb->do_menu(&menu, &selection, NULL, false); switch(result){ case 0: rb->set_option("Hour format", @@ -211,7 +211,7 @@ bool main_menu(void){ "Mode Settings","General Settings","Quit"); while(!done){ - switch(rb->do_menu(&menu, &selection)){ + switch(rb->do_menu(&menu, &selection, NULL, false)){ case 0: done = true; break; diff --git a/apps/plugins/dice.c b/apps/plugins/dice.c index 84bd310..7688d91 100644 --- a/apps/plugins/dice.c +++ b/apps/plugins/dice.c @@ -177,7 +177,7 @@ bool dice_menu(struct dices * dice) { while (!menu_quit) { - switch(rb->do_menu(&menu, &selection)){ + switch(rb->do_menu(&menu, &selection, NULL, false)){ case 0: menu_quit = true; result = true; diff --git a/apps/plugins/disktidy.c b/apps/plugins/disktidy.c index b32dce2..c06afea 100644 --- a/apps/plugins/disktidy.c +++ b/apps/plugins/disktidy.c @@ -369,7 +369,7 @@ int tidy_lcd_menu(void) while (!menu_quit) { - switch(rb->do_menu(&menu, &selection)) + switch(rb->do_menu(&menu, &selection, NULL, false)) { case 0: diff --git a/apps/plugins/lib/oldmenuapi.c b/apps/plugins/lib/oldmenuapi.c index 07681a0..c21e55f 100644 --- a/apps/plugins/lib/oldmenuapi.c +++ b/apps/plugins/lib/oldmenuapi.c @@ -74,7 +74,7 @@ int menu_init(struct plugin_api *api, const struct menu_item* mitems, return -1; menus[menu].items = (struct menu_item*)mitems; /* de-const */ rb->gui_synclist_init(&(menus[menu].synclist), - &menu_get_itemname, &menus[menu], false, 1); + &menu_get_itemname, &menus[menu], false, 1, NULL); rb->gui_synclist_set_icon_callback(&(menus[menu].synclist), NULL); rb->gui_synclist_set_nb_items(&(menus[menu].synclist), count); menus[menu].callback = callback; diff --git a/apps/plugins/lib/playback_control.c b/apps/plugins/lib/playback_control.c index bc8f1c7..2bed02e 100644 --- a/apps/plugins/lib/playback_control.c +++ b/apps/plugins/lib/playback_control.c @@ -111,5 +111,5 @@ void playback_control_init(struct plugin_api* newapi) bool playback_control(struct plugin_api* newapi) { api = newapi; - return api->do_menu(&playback_control_menu, NULL) == MENU_ATTACHED_USB; + return api->do_menu(&playback_control_menu, NULL, NULL, false) == MENU_ATTACHED_USB; } diff --git a/apps/plugins/minesweeper.c b/apps/plugins/minesweeper.c index 0f3de2f..5066844 100644 --- a/apps/plugins/minesweeper.c +++ b/apps/plugins/minesweeper.c @@ -498,7 +498,7 @@ enum minesweeper_status menu( void ) while( !menu_quit ) { - switch( rb->do_menu( &menu, &selection ) ) + switch( rb->do_menu( &menu, &selection, NULL, false ) ) { case 0: result = MINESWEEPER_WIN; /* start playing */ diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow.c index 6e88138..02f0522 100644 --- a/apps/plugins/pictureflow.c +++ b/apps/plugins/pictureflow.c @@ -1541,7 +1541,7 @@ int settings_menu(void) { "Rebuild cache"); do { - selection=rb->do_menu(&settings_menu,&selection); + selection=rb->do_menu(&settings_menu,&selection, NULL, false); switch(selection) { case 0: rb->set_bool("Show FPS", &show_fps); @@ -1604,7 +1604,7 @@ int main_menu(void) "Settings", "Return", "Quit"); while (1) { - switch (rb->do_menu(&main_menu,&selection)) { + switch (rb->do_menu(&main_menu,&selection, NULL, false)) { case 0: result = settings_menu(); if ( result != 0 ) return result; diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c index 0811b00..8b1f6ee 100644 --- a/apps/plugins/properties.c +++ b/apps/plugins/properties.c @@ -305,7 +305,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file) prev_show_statusbar = rb->global_settings->statusbar; rb->global_settings->statusbar = false; - rb->gui_synclist_init(&properties_lists, &get_props, file, false, 1); + rb->gui_synclist_init(&properties_lists, &get_props, file, false, 1, NULL); rb->gui_synclist_set_title(&properties_lists, its_a_dir ? "Directory properties" : "File properties", NOICON); diff --git a/apps/plugins/random_folder_advance_config.c b/apps/plugins/random_folder_advance_config.c index 656daea..af41507 100644 --- a/apps/plugins/random_folder_advance_config.c +++ b/apps/plugins/random_folder_advance_config.c @@ -278,7 +278,7 @@ void edit_list(void) list = (struct file_format *)buffer; dirs_count = list->count; - rb->gui_synclist_init(&lists,list_get_name_cb,0, false, 1); + rb->gui_synclist_init(&lists,list_get_name_cb,0, false, 1, NULL); rb->gui_synclist_set_icon_callback(&lists,NULL); rb->gui_synclist_set_nb_items(&lists,list->count); rb->gui_synclist_limit_scroll(&lists,true); diff --git a/apps/plugins/shortcuts/shortcuts_view.c b/apps/plugins/shortcuts/shortcuts_view.c index 4ef1bbc..503db56 100644 --- a/apps/plugins/shortcuts/shortcuts_view.c +++ b/apps/plugins/shortcuts/shortcuts_view.c @@ -117,7 +117,7 @@ bool list_sc(bool is_editable) /* Setup the GUI list object, draw it to the screen, * and then handle the user input to it */ - rb->gui_synclist_init(&gui_sc, &build_sc_list, &sc_file, false, 1); + rb->gui_synclist_init(&gui_sc, &build_sc_list, &sc_file, false, 1, NULL); rb->gui_synclist_set_title(&gui_sc, (is_editable?"Shortcuts (editable)":"Shortcuts (sealed)"), NOICON); rb->gui_synclist_set_nb_items(&gui_sc, sc_file.entry_cnt); diff --git a/apps/plugins/snake.c b/apps/plugins/snake.c index 51d5f5a..fffb70c 100644 --- a/apps/plugins/snake.c +++ b/apps/plugins/snake.c @@ -396,7 +396,7 @@ void game_init(void) { "Quit"); while (!menu_quit) { - switch(rb->do_menu(&menu, &selection)) + switch(rb->do_menu(&menu, &selection, NULL, false)) { case 0: menu_quit = true; /* start playing */ diff --git a/apps/plugins/sokoban.c b/apps/plugins/sokoban.c index d4e33f1..8b1fe50 100644 --- a/apps/plugins/sokoban.c +++ b/apps/plugins/sokoban.c @@ -1173,7 +1173,7 @@ static int sokoban_menu(void) do { menu_quit = true; - selection = rb->do_menu(&menu, &start_selected); + selection = rb->do_menu(&menu, &start_selected, NULL, false); switch (selection) { case 0: /* Resume */ diff --git a/apps/plugins/star.c b/apps/plugins/star.c index efa8d4e..c2546d2 100644 --- a/apps/plugins/star.c +++ b/apps/plugins/star.c @@ -951,16 +951,28 @@ static int star_menu(void) { int selection, level=1; bool menu_quit = false; - + struct viewport vp[NB_SCREENS]; /* get the size of char */ rb->lcd_getstringsize("a", &char_width, &char_height); MENUITEM_STRINGLIST(menu,"Star Menu",NULL,"Play","Choose Level", "Information","Keys","Quit"); - + FOR_NB_SCREENS(selection) + { + rb->viewport_set_defaults(&vp[selection], selection); + /* we are hiding the statusbar so fix the height also */ + vp->y = 0; vp->height = rb->screens[selection]->height; +#if LCD_DEPTH > 1 + if (rb->screens[selection]->depth > 1) + { + vp->bg_pattern = LCD_BLACK; + vp->fg_pattern = LCD_WHITE; + } +#endif + } while(!menu_quit) { - switch(rb->do_menu(&menu, &selection)) + switch(rb->do_menu(&menu, &selection, vp, true)) { case 0: menu_quit = true; diff --git a/apps/plugins/superdom.c b/apps/plugins/superdom.c index e3f35f9..c047ed4 100644 --- a/apps/plugins/superdom.c +++ b/apps/plugins/superdom.c @@ -493,7 +493,7 @@ int settings_menu_function(void) { "Human starting farms","Human starting factories", "Starting cash","Starting food","Moves per turn"); settings_menu: - selection=rb->do_menu(&settings_menu,&selection); + selection=rb->do_menu(&settings_menu,&selection, NULL, false); switch(selection) { case 0: rb->set_int("Computer starting farms", "", UNIT_INT, @@ -557,7 +557,7 @@ int do_help(void) { "Each tile has a strength, calculated by the ownership", "of adjacent tiles, and the type and number of troops", "on them."); - rb->do_menu(&help_menu,&selection); + rb->do_menu(&help_menu,&selection, NULL, false); switch(selection) { case MENU_ATTACHED_USB: return PLUGIN_USB_CONNECTED; @@ -573,7 +573,7 @@ int menu(void) { "Play Super Domination","Settings","Help","Quit"); while(1) { - selection=rb->do_menu(&main_menu,&selection); + selection=rb->do_menu(&main_menu,&selection, NULL, false); switch(selection) { case 0: return 0; /* start playing */ @@ -651,7 +651,7 @@ int ingame_menu(void) { MENUITEM_STRINGLIST(ingame_menu,"Super Domination Menu",NULL, "Return to game","Save Game", "Quit"); - selection=rb->do_menu(&ingame_menu,&selection); + selection=rb->do_menu(&ingame_menu,&selection, NULL, false); switch(selection) { case 0: return 0; @@ -864,7 +864,7 @@ int buy_resources_menu(void) { "Finish buying", "Game menu"); resources_menu: - selection=rb->do_menu(&res_menu,&selection); + selection=rb->do_menu(&res_menu,&selection, NULL, false); switch(selection) { case 0: nummen = 0; @@ -1059,7 +1059,7 @@ int move_unit(void) { MENUITEM_STRINGLIST(move_unit_menu, "Move unit", NULL, "Move men", "Move tank", "Move plane"); - selection=rb->do_menu(&move_unit_menu,&selection); + selection=rb->do_menu(&move_unit_menu,&selection, NULL, false); switch(selection) { case 0: rb->splash(HZ, "Select where to move troops from"); @@ -1173,7 +1173,7 @@ int movement_menu(void) { "Check map", "Finish moving", "Game menu"); while(!menu_quit) { - selection=rb->do_menu(&move_menu,&selection); + selection=rb->do_menu(&move_menu,&selection, NULL, false); switch(selection) { case 0: if(humanres.moves) { @@ -1281,7 +1281,7 @@ int production_menu(void) { "Withdraw money", "Finish turn", "Game menu"); while(1) { - selection=rb->do_menu(&prod_menu,&selection); + selection=rb->do_menu(&prod_menu,&selection, NULL, false); switch(selection) { case 0: tempmenu = buy_resources_menu(); @@ -1523,7 +1523,7 @@ int war_menu(void) { humanres.moves = superdom_settings.movesperturn; while(humanres.moves) { - selection=rb->do_menu(&wartime_menu,&selection); + selection=rb->do_menu(&wartime_menu,&selection, NULL, false); switch(selection) { case 0: if(select_square() == PLUGIN_USB_CONNECTED) diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c index 28e3d18..642c1c3 100644 --- a/apps/plugins/test_codec.c +++ b/apps/plugins/test_codec.c @@ -715,7 +715,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) rb->lcd_clear_display(); - result=rb->do_menu(&menu,&selection); + result=rb->do_menu(&menu,&selection, NULL, false); scandir = 0; diff --git a/apps/plugins/text_editor.c b/apps/plugins/text_editor.c index 780516e..75bbccf 100644 --- a/apps/plugins/text_editor.c +++ b/apps/plugins/text_editor.c @@ -202,7 +202,7 @@ void save_changes(int overwrite) void setup_lists(struct gui_synclist *lists, int sel) { - rb->gui_synclist_init(lists,list_get_name_cb,0, false, 1); + rb->gui_synclist_init(lists,list_get_name_cb,0, false, 1, NULL); rb->gui_synclist_set_icon_callback(lists,NULL); rb->gui_synclist_set_nb_items(lists,line_count); rb->gui_synclist_limit_scroll(lists,true); @@ -222,7 +222,7 @@ int do_item_menu(int cur_sel, char* copy_buffer) "Insert Above", "Insert Below", "Concat To Above", "Save"); - switch (rb->do_menu(&menu, NULL)) + switch (rb->do_menu(&menu, NULL, NULL, false)) { case 0: /* cut */ rb->strcpy(copy_buffer,&buffer[do_action(ACTION_GET,0,cur_sel)]); @@ -400,7 +400,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { MENUITEM_STRINGLIST(menu, "Edit What?", NULL, "Extension", "Color",); - switch (rb->do_menu(&menu, NULL)) + switch (rb->do_menu(&menu, NULL, NULL, false)) { case 0: edit_text = true; @@ -468,7 +468,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) "Show Playback Menu", "Save Changes", "Save As...", "Save and Exit", "Ignore Changes and Exit"); - switch (rb->do_menu(&menu, NULL)) + switch (rb->do_menu(&menu, NULL, NULL, false)) { case 0: break; diff --git a/apps/plugins/vu_meter.c b/apps/plugins/vu_meter.c index 97ad12d..f711182 100644 --- a/apps/plugins/vu_meter.c +++ b/apps/plugins/vu_meter.c @@ -401,7 +401,7 @@ static bool vu_meter_menu(void) }; while (!menu_quit) { - switch(rb->do_menu(&menu, &selection)) + switch(rb->do_menu(&menu, &selection, NULL, false)) { case 0: rb->set_option("Meter Type", &vumeter_settings.meter_type, INT, diff --git a/apps/plugins/wavrecord.c b/apps/plugins/wavrecord.c index b509212..f6969ff 100644 --- a/apps/plugins/wavrecord.c +++ b/apps/plugins/wavrecord.c @@ -3716,7 +3716,7 @@ static int recording_menu(void) while (!done) { - switch (rb->do_menu(&menu, &menupos)) + switch (rb->do_menu(&menu, &menupos, NULL, false)) { case 0: /* Set sample rate */ rb->set_option("Sample rate", &reccfg.samplerate, INT, freqs, 9, NULL); diff --git a/apps/plugins/wormlet.c b/apps/plugins/wormlet.c index 68b31a1..8b752bf 100644 --- a/apps/plugins/wormlet.c +++ b/apps/plugins/wormlet.c @@ -2599,7 +2599,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) rb->button_clear_queue(); while (!menu_quit) { - switch(rb->do_menu(&menu, &result)) + switch(rb->do_menu(&menu, &result, NULL, false)) { case 0: rb->lcd_setfont(FONT_SYSFIXED); diff --git a/apps/plugins/xobox.c b/apps/plugins/xobox.c index 743dd41..879d0e6 100644 --- a/apps/plugins/xobox.c +++ b/apps/plugins/xobox.c @@ -851,7 +851,7 @@ static int game_menu (void) rb->lcd_set_background(LCD_WHITE); #endif for (;;) { - rb->do_menu(&menu,&selection); + rb->do_menu(&menu,&selection, NULL, false); if (selection==1) rb->set_int ("Speed", "", UNIT_INT, &speed, NULL, 1, 1, 10, NULL); else if (selection==2) -- cgit v1.1