changeset 2466:d286a43ba3b5

Fix #290: Mouse-only image viewing https://github.com/BestImageViewer/geeqie/issues/290 The mouse can now be used to change image, and zoom and pan image. Single middle-click toggles the mouse wheel function between "change image" and "change zoom". In split-view quad mode each pane can be clicked, allowing Connected Zoom to made on any combination of panes. This function cannot be used with "Mouse wheel scrolls image" or "Navigation by left or middle click on image" options.
author Colin Clark <cclark@mcb.net>
date Fri, 14 Apr 2017 16:03:13 +0100
parents 58073aea8bc0
children 5e92b54ecfa1 faf8f7e202f5
files doc/docbook/GuideMainWindowImagePane.xml doc/docbook/GuideReferenceKeyboardShortcuts.xml src/image.c src/img-view.c src/layout_image.c src/typedefs.h
diffstat 6 files changed, 30 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/doc/docbook/GuideMainWindowImagePane.xml	Tue Mar 28 19:27:16 2017 +0100
+++ b/doc/docbook/GuideMainWindowImagePane.xml	Fri Apr 14 16:03:13 2017 +0100
@@ -48,7 +48,6 @@
     </para>
     <para />
   </section>
-
   <section id="Imagepanningandmanipulation">
     <title>Image panning and manipulation</title>
     <para>When the image size is larger than the image pane, the visible region can be changed with the keyboard or mouse. The keyboard can also be used to adjust the orientation of the image.</para>
@@ -93,6 +92,20 @@
         <para>To start the smooth scroll function hold down the Shift key and click the primary mouse button. An icon will appear at the location of the mouse pointer, the mouse can then be positioned to pan the image. The image will pan in the direction of the mouse pointer relative to the icon. The pan speed will increase in proportion to the distance that the pointer is from the center of the icon. To end the smooth scroll function click the primary mouse button within the image pane.</para>
         <para />
       </section>
+      <section id="MouseWheelMode">
+        <title>Mouse Wheel Mode</title>
+        <para>A single click on the mouse middle button will toggle the function of the mouse wheel between "change image" and "change zoom".</para>
+        <note>
+          <para>
+            This option cannot be used if either the Preference
+            <emphasis>Mouse wheel scrolls image</emphasis>
+            or
+            <emphasis>Navigation by left or middle click on image</emphasis>
+            are selected.
+          </para>
+        </note>
+        <para>In Split View mode, each window can be clicked individually so that, in Quad View for example, Connected Zoom can be on 2, 3 or all 4 windows.</para>
+      </section>
     </section>
   </section>
   <section id="Navigation">
--- a/doc/docbook/GuideReferenceKeyboardShortcuts.xml	Tue Mar 28 19:27:16 2017 +0100
+++ b/doc/docbook/GuideReferenceKeyboardShortcuts.xml	Fri Apr 14 16:03:13 2017 +0100
@@ -135,7 +135,9 @@
           <row>
             <entry colsep="0">
               <emphasis role="strong">Image viewing</emphasis>
-              (image has keyboard focus)
+              (image has keyboard focus. Refer also to
+              <link linkend="MouseWheelMode">Mouse Wheel Mode</link>
+              )
             </entry>
             <entry colsep="0" />
             <entry colsep="0" />
--- a/src/image.c	Tue Mar 28 19:27:16 2017 +0100
+++ b/src/image.c	Fri Apr 14 16:03:13 2017 +0100
@@ -56,6 +56,10 @@
 static void image_click_cb(PixbufRenderer *pr, GdkEventButton *event, gpointer data)
 {
 	ImageWindow *imd = data;
+	if (!options->image_lm_click_nav && event->button == MOUSE_BUTTON_MIDDLE)
+		{
+		imd->mouse_wheel_mode = !imd->mouse_wheel_mode;
+		}
 
 	if (imd->func_button)
 		{
--- a/src/img-view.c	Tue Mar 28 19:27:16 2017 +0100
+++ b/src/img-view.c	Fri Apr 14 16:03:13 2017 +0100
@@ -600,7 +600,8 @@
 {
 	ViewWindow *vw = data;
 
-	if (event->state & GDK_CONTROL_MASK)
+	if ((event->state & GDK_CONTROL_MASK) ||
+				(imd->mouse_wheel_mode && !options->image_lm_click_nav))
 		{
 		switch (event->direction)
 			{
--- a/src/layout_image.c	Tue Mar 28 19:27:16 2017 +0100
+++ b/src/layout_image.c	Fri Apr 14 16:03:13 2017 +0100
@@ -1007,12 +1007,12 @@
 		{
 		image_zoom_adjust_at_point(lw->full_screen->imd, increment, x, y);
 		}
-
-	if (!connect_zoom) return;
+	if (!connect_zoom && !lw->split_mode) return;
 
 	for (i = 0; i < MAX_SPLIT_IMAGES; i++)
 		{
-		if (lw->split_images[i] && lw->split_images[i] != lw->image)
+		if (lw->split_images[i] && lw->split_images[i] != lw->image &&
+						lw->split_images[i]->mouse_wheel_mode)
 			image_zoom_adjust_at_point(lw->split_images[i], increment, x, y);
 		}
 }
@@ -1672,7 +1672,8 @@
 		}
 
 
-	if (event->state & GDK_CONTROL_MASK)
+	if ((event->state & GDK_CONTROL_MASK) ||
+				(imd->mouse_wheel_mode && !options->image_lm_click_nav))
 		{
 		switch (event->direction)
 			{
--- a/src/typedefs.h	Tue Mar 28 19:27:16 2017 +0100
+++ b/src/typedefs.h	Fri Apr 14 16:03:13 2017 +0100
@@ -517,6 +517,8 @@
 	gint orientation;
 	gboolean desaturate;
 	gint user_stereo;
+
+	gboolean mouse_wheel_mode;
 };
 
 #define FILEDATA_MARKS_SIZE 6