Fix #278: Shortcut to change time between images in slideshow
authorColin Clark <colin.clark@cclark.uk>
Fri, 8 Sep 2017 16:11:02 +0000 (17:11 +0100)
committerColin Clark <colin.clark@cclark.uk>
Fri, 8 Sep 2017 16:11:02 +0000 (17:11 +0100)
https://github.com/BestImageViewer/geeqie/issues/278

Keypad plus and minus to change the interval in 0.5 sec units.

doc/docbook/GuideMainWindowMenus.xml
doc/docbook/GuideReferenceKeyboardShortcuts.xml
src/layout_util.c
src/slideshow.c

index a0ee585..608f60c 100644 (file)
           <para>Pauses a slide show, the slide show status is displayed in the status bar.</para>\r
         </listitem>\r
       </varlistentry>\r
+      <varlistentry>\r
+        <term>\r
+          <guimenu>Faster</guimenu>\r
+        </term>\r
+        <listitem>\r
+          <para>Decreases slide show interval in units of 0.5 seconds.</para>\r
+        </listitem>\r
+      </varlistentry>\r
+      <varlistentry>\r
+        <term>\r
+          <guimenu>Slower</guimenu>\r
+        </term>\r
+        <listitem>\r
+          <para>Increases slide show interval in units of 0.5 seconds.</para>\r
+        </listitem>\r
+      </varlistentry>\r
       <varlistentry>\r
         <term>\r
           <guimenu>Refresh</guimenu>\r
index c6cd6c2..de3736c 100644 (file)
             <entry />\r
             <entry>Toggle slideshow.</entry>\r
           </row>\r
+          <row>\r
+            <entry>\r
+              <keycap>P</keycap>\r
+            </entry>\r
+            <entry />\r
+            <entry>Pause slideshow.</entry>\r
+          </row>\r
+          <row>\r
+            <entry>\r
+              <code>\r
+                Ctrl +\r
+                <keycap>Keypad +</keycap>\r
+              </code>\r
+            </entry>\r
+            <entry />\r
+            <entry>Slideshow faster.</entry>\r
+          </row>\r
+          <row>\r
+            <entry>\r
+              <code>\r
+                Ctrl +\r
+                <keycap>Keypad -</keycap>\r
+              </code>\r
+            </entry>\r
+            <entry />\r
+            <entry>Slideshow slower.</entry>\r
+          </row>\r
           <row>\r
             <entry>\r
               <keycap>E</keycap>\r
index ffa91c2..c8a83f9 100644 (file)
@@ -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"),                  "<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 @@ static const gchar *menu_ui_description =
 "      <menuitem action='Animate'/>"
 "      <menuitem action='SlideShow'/>"
 "      <menuitem action='SlideShowPause'/>"
+"      <menuitem action='SlideShowFaster'/>"
+"      <menuitem action='SlideShowSlower'/>"
+"      <separator/>"
 "      <menuitem action='Refresh'/>"
 "      <placeholder name='SlideShowSection'/>"
 "      <separator/>"
index 089e5a1..515a24f 100644 (file)
@@ -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;
 }