summaryrefslogtreecommitdiff
path: root/apps/plugins/imageviewer/imageviewer.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/imageviewer/imageviewer.c')
-rw-r--r--apps/plugins/imageviewer/imageviewer.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/apps/plugins/imageviewer/imageviewer.c b/apps/plugins/imageviewer/imageviewer.c
index 91c0950035..c77b22fdae 100644
--- a/apps/plugins/imageviewer/imageviewer.c
+++ b/apps/plugins/imageviewer/imageviewer.c
@@ -353,7 +353,7 @@ static int show_menu(void) /* return 1 to quit */
353static int ask_and_get_audio_buffer(const char *filename) 353static int ask_and_get_audio_buffer(const char *filename)
354{ 354{
355 int button; 355 int button;
356#if defined(IMGVIEW_ZOOM_PRE) 356#if defined(IMGVIEW_ZOOM_PRE) || defined(IMGVIEW_QUIT_PRE)
357 int lastbutton = BUTTON_NONE; 357 int lastbutton = BUTTON_NONE;
358#endif 358#endif
359 rb->lcd_setfont(FONT_SYSFIXED); 359 rb->lcd_setfont(FONT_SYSFIXED);
@@ -392,6 +392,10 @@ static int ask_and_get_audio_buffer(const char *filename)
392#endif 392#endif
393#ifdef IMGVIEW_QUIT 393#ifdef IMGVIEW_QUIT
394 case IMGVIEW_QUIT: 394 case IMGVIEW_QUIT:
395#ifdef IMGVIEW_QUIT_PRE
396 if (lastbutton != IMGVIEW_QUIT_PRE)
397 break;
398#endif
395#endif 399#endif
396 case IMGVIEW_MENU: 400 case IMGVIEW_MENU:
397 return PLUGIN_OK; 401 return PLUGIN_OK;
@@ -424,7 +428,7 @@ static int ask_and_get_audio_buffer(const char *filename)
424 == SYS_USB_CONNECTED) 428 == SYS_USB_CONNECTED)
425 return PLUGIN_USB_CONNECTED; 429 return PLUGIN_USB_CONNECTED;
426 } 430 }
427#if defined(IMGVIEW_ZOOM_PRE) 431#if defined(IMGVIEW_ZOOM_PRE) || defined(IMGVIEW_QUIT_PRE)
428 if (button != BUTTON_NONE) 432 if (button != BUTTON_NONE)
429 lastbutton = button; 433 lastbutton = button;
430#endif 434#endif
@@ -572,14 +576,19 @@ static void pan_view_down(struct image_info *info)
572} 576}
573 577
574/* interactively scroll around the image */ 578/* interactively scroll around the image */
575static int scroll_bmp(struct image_info *info) 579static int scroll_bmp(struct image_info *info, bool initial_frame)
576{ 580{
577 static long ss_timeout = 0; 581 static long ss_timeout = 0;
578 582
579 int button; 583 int button;
580#if defined(IMGVIEW_ZOOM_PRE) || defined(IMGVIEW_MENU_PRE) \ 584#if defined(IMGVIEW_ZOOM_PRE) || defined(IMGVIEW_MENU_PRE) \
581 || defined(IMGVIEW_SLIDE_SHOW_PRE) 585 || defined(IMGVIEW_SLIDE_SHOW_PRE) || defined(IMGVIEW_QUIT_PRE)
582 int lastbutton = BUTTON_NONE; 586 static int lastbutton;
587 if (initial_frame)
588 lastbutton = BUTTON_NONE;
589
590#else
591 (void) initial_frame;
583#endif 592#endif
584 593
585 if (!ss_timeout && iv_api.slideshow_enabled) 594 if (!ss_timeout && iv_api.slideshow_enabled)
@@ -745,6 +754,10 @@ static int scroll_bmp(struct image_info *info)
745 754
746#ifdef IMGVIEW_QUIT 755#ifdef IMGVIEW_QUIT
747 case IMGVIEW_QUIT: 756 case IMGVIEW_QUIT:
757#ifdef IMGVIEW_QUIT_PRE
758 if (lastbutton != IMGVIEW_QUIT_PRE)
759 break;
760#endif
748 return PLUGIN_OK; 761 return PLUGIN_OK;
749 break; 762 break;
750#endif 763#endif
@@ -756,7 +769,8 @@ static int scroll_bmp(struct image_info *info)
756 break; 769 break;
757 770
758 } /* switch */ 771 } /* switch */
759#if defined(IMGVIEW_ZOOM_PRE) || defined(IMGVIEW_MENU_PRE) || defined(IMGVIEW_SLIDE_SHOW_PRE) 772#if defined(IMGVIEW_ZOOM_PRE) || defined(IMGVIEW_MENU_PRE) ||\
773 defined(IMGVIEW_SLIDE_SHOW_PRE) || defined(IMGVIEW_QUIT_PRE)
760 if (button != BUTTON_NONE) 774 if (button != BUTTON_NONE)
761 lastbutton = button; 775 lastbutton = button;
762#endif 776#endif
@@ -922,6 +936,7 @@ static int load_and_show(char* filename, struct image_info *info)
922 936
923 /* used to loop through subimages in animated gifs */ 937 /* used to loop through subimages in animated gifs */
924 int frame = 0; 938 int frame = 0;
939 bool initial_frame = true;
925 do /* loop the image prepare and decoding when zoomed */ 940 do /* loop the image prepare and decoding when zoomed */
926 { 941 {
927 status = imgdec->get_image(info, frame, ds); /* decode or fetch from cache */ 942 status = imgdec->get_image(info, frame, ds); /* decode or fetch from cache */
@@ -954,7 +969,8 @@ static int load_and_show(char* filename, struct image_info *info)
954 */ 969 */
955 while (1) 970 while (1)
956 { 971 {
957 status = scroll_bmp(info); 972 status = scroll_bmp(info, initial_frame);
973 initial_frame = false;
958 974
959 if (status == ZOOM_IN) 975 if (status == ZOOM_IN)
960 { 976 {