From 0942a24aac99458eb59ba849067e03f8d192d8db Mon Sep 17 00:00:00 2001 From: jdgordon Date: Wed, 23 Apr 2008 10:28:34 +0000 Subject: [PATCH] allow the plugin playback control menu to be put in a viewport. fix text editor so it is actually possible to get to the control menu if the file hasnt been changed (its in the regular menu now) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17221 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/jewels.c | 2 +- apps/plugins/jpeg.c | 2 +- apps/plugins/lib/playback_control.c | 5 +++-- apps/plugins/lib/playback_control.h | 3 ++- apps/plugins/mazezam.c | 2 +- apps/plugins/sokoban.c | 2 +- apps/plugins/solitaire.c | 2 +- apps/plugins/sudoku/sudoku.c | 2 +- apps/plugins/text_editor.c | 9 +++++++-- apps/plugins/viewer.c | 2 +- 10 files changed, 19 insertions(+), 12 deletions(-) diff --git a/apps/plugins/jewels.c b/apps/plugins/jewels.c index eb8e70072..7d8147639 100644 --- a/apps/plugins/jewels.c +++ b/apps/plugins/jewels.c @@ -1698,7 +1698,7 @@ static int jewels_main(struct game_context* bj) { continue; case MRES_PLAYBACK: - playback_control(rb); + playback_control(rb, NULL); rb->lcd_setfont(FONT_SYSFIXED); inmenu = false; selected = false; diff --git a/apps/plugins/jpeg.c b/apps/plugins/jpeg.c index 710772f27..596d4d73e 100644 --- a/apps/plugins/jpeg.c +++ b/apps/plugins/jpeg.c @@ -2580,7 +2580,7 @@ int show_menu(void) /* return 1 to quit */ #if PLUGIN_BUFFER_SIZE >= MIN_MEM case MIID_SHOW_PLAYBACK_MENU: - playback_control(rb); + playback_control(rb, NULL); break; #endif #ifdef HAVE_LCD_COLOR diff --git a/apps/plugins/lib/playback_control.c b/apps/plugins/lib/playback_control.c index 2bed02e7b..cba4f5a0e 100644 --- a/apps/plugins/lib/playback_control.c +++ b/apps/plugins/lib/playback_control.c @@ -108,8 +108,9 @@ void playback_control_init(struct plugin_api* newapi) api = newapi; } -bool playback_control(struct plugin_api* newapi) +bool playback_control(struct plugin_api* newapi, + struct viewport parent[NB_SCREENS]) { api = newapi; - return api->do_menu(&playback_control_menu, NULL, NULL, false) == MENU_ATTACHED_USB; + return api->do_menu(&playback_control_menu, NULL, parent, false) == MENU_ATTACHED_USB; } diff --git a/apps/plugins/lib/playback_control.h b/apps/plugins/lib/playback_control.h index 83f07644a..6029152dc 100644 --- a/apps/plugins/lib/playback_control.h +++ b/apps/plugins/lib/playback_control.h @@ -25,6 +25,7 @@ extern const struct menu_item_ex playback_control_menu; void playback_control_init(struct plugin_api* newapi); /* Use this if your menu still uses the old menu api */ -bool playback_control(struct plugin_api* api); +bool playback_control(struct plugin_api* api, + struct viewport parent[NB_SCREENS]); #endif /* __PLAYBACK_CONTROL_H__ */ diff --git a/apps/plugins/mazezam.c b/apps/plugins/mazezam.c index f898fc603..2ee6e2005 100644 --- a/apps/plugins/mazezam.c +++ b/apps/plugins/mazezam.c @@ -641,7 +641,7 @@ static void in_game_menu(void) break; case 2: /* Audio playback */ - playback_control(rb); + playback_control(rb, NULL); state = STATE_IN_LEVEL; break; diff --git a/apps/plugins/sokoban.c b/apps/plugins/sokoban.c index 8b1fe508c..c8a6ba7c9 100644 --- a/apps/plugins/sokoban.c +++ b/apps/plugins/sokoban.c @@ -1193,7 +1193,7 @@ static int sokoban_menu(void) break; case 2: /* Audio playback control */ - playback_control(rb); + playback_control(rb, NULL); menu_quit = false; break; diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c index 6cb995ffb..40f9a241e 100644 --- a/apps/plugins/solitaire.c +++ b/apps/plugins/solitaire.c @@ -747,7 +747,7 @@ int solitaire_menu(bool in_game) break; case 4: - playback_control(rb); + playback_control(rb, NULL); break; case 5: diff --git a/apps/plugins/sudoku/sudoku.c b/apps/plugins/sudoku/sudoku.c index 553357fc5..d76b68ef2 100644 --- a/apps/plugins/sudoku/sudoku.c +++ b/apps/plugins/sudoku/sudoku.c @@ -1078,7 +1078,7 @@ bool sudoku_menu(struct sudoku_state_t* state) switch (result) { case SM_AUDIO_PLAYBACK: - playback_control(rb); + playback_control(rb, NULL); break; #ifdef HAVE_LCD_COLOR diff --git a/apps/plugins/text_editor.c b/apps/plugins/text_editor.c index 5397260c0..617155fb2 100644 --- a/apps/plugins/text_editor.c +++ b/apps/plugins/text_editor.c @@ -221,7 +221,8 @@ int do_item_menu(int cur_sel, char* copy_buffer) MENUITEM_STRINGLIST(menu, "Line Options", NULL, "Cut/Delete", "Copy", "Insert Above", "Insert Below", - "Concat To Above", "Save"); + "Concat To Above", "Save", + "Show Playback Menu",); switch (rb->do_menu(&menu, NULL, NULL, false)) { @@ -260,6 +261,10 @@ int do_item_menu(int cur_sel, char* copy_buffer) case 5: /* save */ ret = MENU_RET_SAVE; break; + case 6: /* playback menu */ + playback_control(rb, NULL); + ret = MENU_RET_UPDATE; + break; default: ret = MENU_RET_NO_UPDATE; break; @@ -474,7 +479,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) case 0: break; case 1: - playback_control(rb); + playback_control(rb, NULL); break; case 2: //save to disk save_changes(1); diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c index a4619269e..a2afbc064 100644 --- a/apps/plugins/viewer.c +++ b/apps/plugins/viewer.c @@ -1426,7 +1426,7 @@ static void viewer_menu(void) done = viewer_options_menu(); break; case 2: /* playback control */ - playback_control(rb); + playback_control(rb, NULL); break; case 3: /* return */ break; -- 2.11.4.GIT