changeset 2590:95606e2192d1

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.
author Colin Clark <colin.clark@cclark.uk>
date Fri, 08 Sep 2017 17:11:02 +0100
parents df15eef16238
children c09f7eb80341
files doc/docbook/GuideMainWindowMenus.xml doc/docbook/GuideReferenceKeyboardShortcuts.xml src/layout_util.c src/slideshow.c
diffstat 4 files changed, 72 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/doc/docbook/GuideMainWindowMenus.xml	Fri Sep 08 11:25:06 2017 +0100
+++ b/doc/docbook/GuideMainWindowMenus.xml	Fri Sep 08 17:11:02 2017 +0100
@@ -1378,6 +1378,22 @@
       </varlistentry>
       <varlistentry>
         <term>
+          <guimenu>Faster</guimenu>
+        </term>
+        <listitem>
+          <para>Decreases slide show interval in units of 0.5 seconds.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term>
+          <guimenu>Slower</guimenu>
+        </term>
+        <listitem>
+          <para>Increases slide show interval in units of 0.5 seconds.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term>
           <guimenu>Refresh</guimenu>
         </term>
         <listitem>
--- a/doc/docbook/GuideReferenceKeyboardShortcuts.xml	Fri Sep 08 11:25:06 2017 +0100
+++ b/doc/docbook/GuideReferenceKeyboardShortcuts.xml	Fri Sep 08 17:11:02 2017 +0100
@@ -669,6 +669,33 @@
           </row>
           <row>
             <entry>
+              <keycap>P</keycap>
+            </entry>
+            <entry />
+            <entry>Pause slideshow.</entry>
+          </row>
+          <row>
+            <entry>
+              <code>
+                Ctrl +
+                <keycap>Keypad +</keycap>
+              </code>
+            </entry>
+            <entry />
+            <entry>Slideshow faster.</entry>
+          </row>
+          <row>
+            <entry>
+              <code>
+                Ctrl +
+                <keycap>Keypad -</keycap>
+              </code>
+            </entry>
+            <entry />
+            <entry>Slideshow slower.</entry>
+          </row>
+          <row>
+            <entry>
               <keycap>E</keycap>
             </entry>
             <entry />
--- a/src/layout_util.c	Fri Sep 08 11:25:06 2017 +0100
+++ b/src/layout_util.c	Fri Sep 08 17:11:02 2017 +0100
@@ -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 @@
 	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 @@
   { "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"),			"<control>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"), 		"<control>KP_Add",			N_("Faster"), 			CB(layout_menu_slideshow_faster_cb) },
+  { "SlideShowSlower",	NULL,	N_("Slower"), 		"<control>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 @@
 "      <menuitem action='Animate'/>"
 "      <menuitem action='SlideShow'/>"
 "      <menuitem action='SlideShowPause'/>"
+"      <menuitem action='SlideShowFaster'/>"
+"      <menuitem action='SlideShowSlower'/>"
+"      <separator/>"
 "      <menuitem action='Refresh'/>"
 "      <placeholder name='SlideShowSection'/>"
 "      <separator/>"
--- a/src/slideshow.c	Fri Sep 08 11:25:06 2017 +0100
+++ b/src/slideshow.c	Fri Sep 08 17:11:02 2017 +0100
@@ -304,6 +304,8 @@
 	return TRUE;
 }
 
+static void slideshow_timer_reset(SlideShowData *ss);
+
 static gboolean slideshow_loop_cb(gpointer data)
 {
 	SlideShowData *ss = data;
@@ -317,6 +319,9 @@
 		return FALSE;
 		}
 
+	/* Check if the user has changed the timer interval */
+	slideshow_timer_reset(ss);
+
 	return TRUE;
 }