From 5ed2574fb8ccf6974597e804ca7b6b3d2b46c84f Mon Sep 17 00:00:00 2001 From: Colin Clark Date: Fri, 8 Sep 2017 17:11:02 +0100 Subject: [PATCH] Fix #278: Shortcut to change time between images in slideshow https://github.com/BestImageViewer/geeqie/issues/278 Keypad plus and minus to change the interval in 0.5 sec units. --- doc/docbook/GuideMainWindowMenus.xml | 16 +++++++++++ .../GuideReferenceKeyboardShortcuts.xml | 27 +++++++++++++++++++ src/layout_util.c | 24 +++++++++++++++++ src/slideshow.c | 5 ++++ 4 files changed, 72 insertions(+) diff --git a/doc/docbook/GuideMainWindowMenus.xml b/doc/docbook/GuideMainWindowMenus.xml index a0ee5858..608f60cf 100644 --- a/doc/docbook/GuideMainWindowMenus.xml +++ b/doc/docbook/GuideMainWindowMenus.xml @@ -1376,6 +1376,22 @@ Pauses a slide show, the slide show status is displayed in the status bar. + + + Faster + + + Decreases slide show interval in units of 0.5 seconds. + + + + + Slower + + + Increases slide show interval in units of 0.5 seconds. + + Refresh diff --git a/doc/docbook/GuideReferenceKeyboardShortcuts.xml b/doc/docbook/GuideReferenceKeyboardShortcuts.xml index c6cd6c22..de3736c8 100644 --- a/doc/docbook/GuideReferenceKeyboardShortcuts.xml +++ b/doc/docbook/GuideReferenceKeyboardShortcuts.xml @@ -667,6 +667,33 @@ Toggle slideshow. + + + P + + + Pause slideshow. + + + + + Ctrl + + Keypad + + + + + Slideshow faster. + + + + + Ctrl + + Keypad - + + + + Slideshow slower. + E diff --git a/src/layout_util.c b/src/layout_util.c index ffa91c2e..c8a83f9a 100644 --- a/src/layout_util.c +++ b/src/layout_util.c @@ -45,6 +45,7 @@ #include "preferences.h" #include "print.h" #include "search.h" +#include "slideshow.h" #include "ui_fileops.h" #include "ui_menu.h" #include "ui_misc.h" @@ -1017,6 +1018,24 @@ static void layout_menu_slideshow_pause_cb(GtkAction *action, gpointer data) layout_image_slideshow_pause_toggle(lw); } +static void layout_menu_slideshow_slower_cb(GtkAction *action, gpointer data) +{ + LayoutWindow *lw = data; + + options->slideshow.delay = options->slideshow.delay + 5; + if (options->slideshow.delay > SLIDESHOW_MAX_SECONDS) + options->slideshow.delay = SLIDESHOW_MAX_SECONDS; +} + +static void layout_menu_slideshow_faster_cb(GtkAction *action, gpointer data) +{ + LayoutWindow *lw = data; + + options->slideshow.delay = options->slideshow.delay - 5; + if (options->slideshow.delay < SLIDESHOW_MIN_SECONDS * 10) + options->slideshow.delay = SLIDESHOW_MIN_SECONDS * 10; +} + static void layout_menu_stereo_mode_next_cb(GtkAction *action, gpointer data) { @@ -1812,6 +1831,8 @@ static GtkActionEntry menu_entries[] = { { "HistogramModeCycle",NULL, N_("Cycle through histogram mo_des"), "J", N_("Cycle through histogram modes"), CB(layout_menu_histogram_toggle_mode_cb) }, { "HideTools", NULL, N_("_Hide file list"), "H", N_("Hide file list"), CB(layout_menu_hide_cb) }, { "SlideShowPause", GTK_STOCK_MEDIA_PAUSE, N_("_Pause slideshow"), "P", N_("Pause slideshow"), CB(layout_menu_slideshow_pause_cb) }, + { "SlideShowFaster", NULL, N_("Faster"), "KP_Add", N_("Faster"), CB(layout_menu_slideshow_faster_cb) }, + { "SlideShowSlower", NULL, N_("Slower"), "KP_Subtract", N_("Slower"), CB(layout_menu_slideshow_slower_cb) }, { "Refresh", GTK_STOCK_REFRESH, N_("_Refresh"), "R", N_("Refresh"), CB(layout_menu_refresh_cb) }, { "HelpContents", GTK_STOCK_HELP, N_("_Contents"), "F1", N_("Contents"), CB(layout_menu_help_cb) }, { "HelpShortcuts", NULL, N_("_Keyboard shortcuts"), NULL, N_("Keyboard shortcuts"), CB(layout_menu_help_keys_cb) }, @@ -2106,6 +2127,9 @@ static const gchar *menu_ui_description = " " " " " " +" " +" " +" " " " " " " " diff --git a/src/slideshow.c b/src/slideshow.c index 089e5a17..515a24fc 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -304,6 +304,8 @@ static gboolean slideshow_step(SlideShowData *ss, gboolean forward) return TRUE; } +static void slideshow_timer_reset(SlideShowData *ss); + static gboolean slideshow_loop_cb(gpointer data) { SlideShowData *ss = data; @@ -317,6 +319,9 @@ static gboolean slideshow_loop_cb(gpointer data) return FALSE; } + /* Check if the user has changed the timer interval */ + slideshow_timer_reset(ss); + return TRUE; } -- 2.20.1