From 15f6bfc0e5b63287353df9186b62598adfed7ce2 Mon Sep 17 00:00:00 2001 From: Teruaki Kawashima Date: Thu, 25 Feb 2010 11:11:41 +0000 Subject: [PATCH] imageviewer: add button to quit plugin immediately if there is enough key for it. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24904 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/imageviewer/imageviewer.c | 20 +++++++++++++++----- apps/plugins/imageviewer/imageviewer.h | 10 +++++++++- manual/plugins/bmpviewer.tex | 7 +++++++ manual/plugins/jpegviewer.tex | 7 +++++++ manual/plugins/pngviewer.tex | 7 +++++++ 5 files changed, 45 insertions(+), 6 deletions(-) diff --git a/apps/plugins/imageviewer/imageviewer.c b/apps/plugins/imageviewer/imageviewer.c index 5c6bcc918f..f82ba771a9 100644 --- a/apps/plugins/imageviewer/imageviewer.c +++ b/apps/plugins/imageviewer/imageviewer.c @@ -351,6 +351,9 @@ static int ask_and_get_audio_buffer(const char *filename) return PLUGIN_OTHER; #ifdef IMGVIEW_RC_MENU case IMGVIEW_RC_MENU: +#endif +#ifdef IMGVIEW_QUIT + case IMGVIEW_QUIT: #endif case IMGVIEW_MENU: return PLUGIN_OK; @@ -374,7 +377,6 @@ static int ask_and_get_audio_buffer(const char *filename) if(rb->default_event_handler_ex(button, cleanup, NULL) == SYS_USB_CONNECTED) return PLUGIN_USB_CONNECTED; - } } } @@ -594,6 +596,10 @@ static int scroll_bmp(struct image_info *info) case IMGVIEW_RC_MENU: #endif case IMGVIEW_MENU: +#ifdef IMGVIEW_MENU_PRE + if (lastbutton != IMGVIEW_MENU_PRE) + break; +#endif #ifdef USEGSLIB grey_show(false); /* switch off greyscale overlay */ #endif @@ -609,6 +615,12 @@ static int scroll_bmp(struct image_info *info) #endif break; +#ifdef IMGVIEW_QUIT + case IMGVIEW_QUIT: + return PLUGIN_OK; + break; +#endif + default: if (rb->default_event_handler_ex(button, cleanup, NULL) == SYS_USB_CONNECTED) @@ -835,8 +847,7 @@ static int load_and_show(char* filename, struct image_info *info) #endif rb->lcd_clear_display(); } - while (status != PLUGIN_OK && status != PLUGIN_USB_CONNECTED - && status != PLUGIN_OTHER); + while (status > PLUGIN_OTHER); #ifdef USEGSLIB rb->lcd_update(); #endif @@ -902,8 +913,7 @@ enum plugin_status plugin_start(const void* parameter) do { condition = load_and_show(np_file, &image_info); - } while (condition != PLUGIN_OK && condition != PLUGIN_USB_CONNECTED - && condition != PLUGIN_ERROR); + } while (condition >= PLUGIN_OTHER); if (rb->memcmp(&settings, &old_settings, sizeof (settings))) { diff --git a/apps/plugins/imageviewer/imageviewer.h b/apps/plugins/imageviewer/imageviewer.h index 694056ed8a..2f63792726 100644 --- a/apps/plugins/imageviewer/imageviewer.h +++ b/apps/plugins/imageviewer/imageviewer.h @@ -88,6 +88,7 @@ #define IMGVIEW_NEXT (BUTTON_SELECT | BUTTON_RIGHT) #define IMGVIEW_PREVIOUS (BUTTON_SELECT | BUTTON_LEFT) #define IMGVIEW_MENU (BUTTON_SELECT | BUTTON_MENU) +#define IMGVIEW_QUIT (BUTTON_SELECT | BUTTON_PLAY) #elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD #define IMGVIEW_ZOOM_PRE BUTTON_SELECT @@ -111,6 +112,7 @@ #define IMGVIEW_NEXT (BUTTON_A | BUTTON_RIGHT) #define IMGVIEW_PREVIOUS (BUTTON_A | BUTTON_LEFT) #define IMGVIEW_MENU BUTTON_MENU +#define IMGVIEW_QUIT BUTTON_POWER #elif CONFIG_KEYPAD == SANSA_E200_PAD #define IMGVIEW_ZOOM_PRE BUTTON_SELECT @@ -211,6 +213,7 @@ #define IMGVIEW_NEXT BUTTON_NEXT #define IMGVIEW_PREVIOUS BUTTON_PREV #define IMGVIEW_MENU BUTTON_MENU +#define IMGVIEW_QUIT BUTTON_BACK #elif CONFIG_KEYPAD == MROBE100_PAD #define IMGVIEW_ZOOM_IN BUTTON_SELECT @@ -222,6 +225,7 @@ #define IMGVIEW_NEXT (BUTTON_DISPLAY | BUTTON_RIGHT) #define IMGVIEW_PREVIOUS (BUTTON_DISPLAY | BUTTON_LEFT) #define IMGVIEW_MENU BUTTON_MENU +#define IMGVIEW_QUIT BUTTON_POWER #elif CONFIG_KEYPAD == IAUDIO_M3_PAD #define IMGVIEW_ZOOM_PRE BUTTON_RC_PLAY @@ -270,6 +274,7 @@ #define IMGVIEW_NEXT BUTTON_VIEW #define IMGVIEW_PREVIOUS BUTTON_PLAYLIST #define IMGVIEW_MENU BUTTON_MENU +#define IMGVIEW_QUIT BUTTON_POWER #elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD #define IMGVIEW_ZOOM_IN BUTTON_VOL_UP @@ -281,6 +286,7 @@ #define IMGVIEW_NEXT BUTTON_RIGHT #define IMGVIEW_PREVIOUS BUTTON_LEFT #define IMGVIEW_MENU BUTTON_MENU +#define IMGVIEW_QUIT BUTTON_POWER #elif CONFIG_KEYPAD == ONDAVX747_PAD #elif CONFIG_KEYPAD == ONDAVX777_PAD @@ -294,7 +300,9 @@ #define IMGVIEW_RIGHT BUTTON_RIGHT #define IMGVIEW_NEXT BUTTON_FFWD #define IMGVIEW_PREVIOUS BUTTON_REW -#define IMGVIEW_MENU BUTTON_PLAY +#define IMGVIEW_MENU_PRE BUTTON_PLAY +#define IMGVIEW_MENU (BUTTON_PLAY|BUTTON_REL) +#define IMGVIEW_QUIT BUTTON_REC #elif CONFIG_KEYPAD == PBELL_VIBE500_PAD #define IMGVIEW_ZOOM_IN (BUTTON_REC | BUTTON_UP) diff --git a/manual/plugins/bmpviewer.tex b/manual/plugins/bmpviewer.tex index 38745a9703..3d423529ad 100755 --- a/manual/plugins/bmpviewer.tex +++ b/manual/plugins/bmpviewer.tex @@ -88,6 +88,13 @@ view a bigger file you may need to stop playback.} \opt{IRIVER_RC_H100_PAD}{\ButtonRCStop} } & Show menu / Abort \\ + \opt{IPOD_4G_PAD,IPOD_3G_PAD,GIGABEAT_PAD,GIGABEAT_S_PAD,MROBE100_PAD}{ + \opt{IPOD_4G_PAD,IPOD_3G_PAD}{\ButtonSelect+\ButtonPlay} + \opt{GIGABEAT_PAD,MROBE100_PAD}{\ButtonPower} + \opt{GIGABEAT_S_PAD}{\ButtonBack} + \opt{HAVEREMOTEKEYMAP}{& } + & Quit the viewer \\ + } \end{btnmap} \end{table} diff --git a/manual/plugins/jpegviewer.tex b/manual/plugins/jpegviewer.tex index 9a582386e0..fd66c917e8 100644 --- a/manual/plugins/jpegviewer.tex +++ b/manual/plugins/jpegviewer.tex @@ -88,6 +88,13 @@ view a bigger file you may need to stop playback.} \opt{IRIVER_RC_H100_PAD}{\ButtonRCStop} } & Show menu / Abort \\ + \opt{IPOD_4G_PAD,IPOD_3G_PAD,GIGABEAT_PAD,GIGABEAT_S_PAD,MROBE100_PAD}{ + \opt{IPOD_4G_PAD,IPOD_3G_PAD}{\ButtonSelect+\ButtonPlay} + \opt{GIGABEAT_PAD,MROBE100_PAD}{\ButtonPower} + \opt{GIGABEAT_S_PAD}{\ButtonBack} + \opt{HAVEREMOTEKEYMAP}{& } + & Quit the viewer \\ + } \end{btnmap} \end{table} diff --git a/manual/plugins/pngviewer.tex b/manual/plugins/pngviewer.tex index 56ca86af29..33160129ab 100644 --- a/manual/plugins/pngviewer.tex +++ b/manual/plugins/pngviewer.tex @@ -85,6 +85,13 @@ display them. \opt{IRIVER_RC_H100_PAD}{\ButtonRCStop} } & Show menu / Abort while decoding \\ + \opt{IPOD_4G_PAD,IPOD_3G_PAD,GIGABEAT_PAD,GIGABEAT_S_PAD,MROBE100_PAD}{ + \opt{IPOD_4G_PAD,IPOD_3G_PAD}{\ButtonSelect+\ButtonPlay} + \opt{GIGABEAT_PAD,MROBE100_PAD}{\ButtonPower} + \opt{GIGABEAT_S_PAD}{\ButtonBack} + \opt{HAVEREMOTEKEYMAP}{& } + & Quit the viewer \\ + } \end{btnmap} \end{table}