Fix #290: Mouse-only image viewing
authorColin Clark <cclark@mcb.net>
Fri, 14 Apr 2017 15:03:13 +0000 (16:03 +0100)
committerColin Clark <cclark@mcb.net>
Fri, 14 Apr 2017 15:03:13 +0000 (16:03 +0100)
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.

doc/docbook/GuideMainWindowImagePane.xml
doc/docbook/GuideReferenceKeyboardShortcuts.xml
src/image.c
src/img-view.c
src/layout_image.c
src/typedefs.h

index 6d24cea..c91526d 100644 (file)
@@ -48,7 +48,6 @@
     </para>\r
     <para />\r
   </section>\r
-\r
   <section id="Imagepanningandmanipulation">\r
     <title>Image panning and manipulation</title>\r
     <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>\r
         <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>\r
         <para />\r
       </section>\r
+      <section id="MouseWheelMode">\r
+        <title>Mouse Wheel Mode</title>\r
+        <para>A single click on the mouse middle button will toggle the function of the mouse wheel between "change image" and "change zoom".</para>\r
+        <note>\r
+          <para>\r
+            This option cannot be used if either the Preference\r
+            <emphasis>Mouse wheel scrolls image</emphasis>\r
+            or\r
+            <emphasis>Navigation by left or middle click on image</emphasis>\r
+            are selected.\r
+          </para>\r
+        </note>\r
+        <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>\r
+      </section>\r
     </section>\r
   </section>\r
   <section id="Navigation">\r
index d36c197..3a21048 100644 (file)
           <row>\r
             <entry colsep="0">\r
               <emphasis role="strong">Image viewing</emphasis>\r
-              (image has keyboard focus)\r
+              (image has keyboard focus. Refer also to\r
+              <link linkend="MouseWheelMode">Mouse Wheel Mode</link>\r
+              )\r
             </entry>\r
             <entry colsep="0" />\r
             <entry colsep="0" />\r
index 2adb4f1..7fad282 100644 (file)
@@ -56,6 +56,10 @@ static void image_cache_set(ImageWindow *imd, FileData *fd);
 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)
                {
index 35b0ca3..d31853c 100644 (file)
@@ -600,7 +600,8 @@ static void scroll_cb(ImageWindow *imd, GdkEventScroll *event, gpointer data)
 {
        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)
                        {
index 63da73b..3dd2183 100644 (file)
@@ -1007,12 +1007,12 @@ void layout_image_zoom_adjust_at_point(LayoutWindow *lw, gdouble increment, gint
                {
                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 @@ static void layout_image_scroll_cb(ImageWindow *imd, GdkEventScroll *event, gpoi
                }
 
 
-       if (event->state & GDK_CONTROL_MASK)
+       if ((event->state & GDK_CONTROL_MASK) ||
+                               (imd->mouse_wheel_mode && !options->image_lm_click_nav))
                {
                switch (event->direction)
                        {
index ed553e1..26f594f 100644 (file)
@@ -517,6 +517,8 @@ struct _ImageWindow
        gint orientation;
        gboolean desaturate;
        gint user_stereo;
+
+       gboolean mouse_wheel_mode;
 };
 
 #define FILEDATA_MARKS_SIZE 6