changeset 2438:e133f99b6331

Move exif auto-rotate option to a menu Move the exif auto-rotate option from preferences to the edit/orientation menu. The shortcut key is Alt-X. There is also a button on the status bar. The intention is to make it easy for the user to make a comparison beteen the actual and auto-rotated view as an aid to detecting orientations made erroneously e.g. scanned images which have been mirrored by mistake. Expanded documentation on rotation commands. Preserve the setting of the rectangular select option.
author Colin Clark <cclark@mcb.net>
date Sat, 28 Jan 2017 19:58:06 +0000
parents f703774799a5
children f48a3335c672
files doc/docbook/GuideFaq.xml doc/docbook/GuideMainWindowMenus.xml doc/docbook/GuideMainWindowStatusBar.xml doc/docbook/GuideOptionsImage.xml doc/docbook/GuideOptionsMetadata.xml src/layout_image.c src/layout_image.h src/layout_util.c src/preferences.c
diffstat 9 files changed, 127 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/doc/docbook/GuideFaq.xml	Thu Jan 26 10:28:21 2017 +0000
+++ b/doc/docbook/GuideFaq.xml	Sat Jan 28 19:58:06 2017 +0000
@@ -47,4 +47,45 @@
       <para />
     </section>
   </section>
-</chapter>
+  <section id="ExifRotation">
+    <title>Exif Auto Rotation</title>
+    <para />
+    <section id="HowdotheExifauto-rotationcommandswork">
+      <title>How do the Exif auto-rotation commands work?</title>
+      <para>
+        Image auto-rotation works in either of two modes, set by
+        <link linkend="MetadataMiscellaneous">Write altered image orientation to the metadata</link>
+        option.
+      </para>
+      <para>
+        <guilabel>Write altered image orientation to the metadata not set</guilabel>
+        <para />
+        If you change the orientation of an image using any of the available commands, the image will always be displayed in the modified orientation. This new orientation is stored in temporary data structures associated with each image file. When Geeqie closes, these changes will be lost.
+      </para>
+      <warning>
+        <para>It is not possible to determine if the image as displayed is the original image or one which has been temporarily rotated.</para>
+      </warning>
+      <para>
+        If the option
+        <link linkend="Editmenu">Auto rotate image using EXIF information</link>
+        is selected, any images which have Exif orientation data will also be shown rotated. However, any rotation you have selected manually will always over-ride the embedded Exif rotation value.
+      </para>
+      <para>
+        <guilabel>Write altered image orientation to the metadata set</guilabel>
+        <para />
+        <para>If you change the orientation of an image using any of the available commands, this new orientation is stored in a metadata write queue.</para>
+        <para>
+          If the option
+          <link linkend="Editmenu">Auto rotate image using EXIF information</link>
+          is selected, any images which have Exif orientation data will be shown rotated, including any in the metadata write queue.
+        </para>
+        <para>
+          However if the option
+          <link linkend="Editmenu">Auto rotate image using EXIF information</link>
+          is not selected, no images will be auto-rotated. If you have manually rotated any images, the metadata write icon on the status bar will alert you to that fact. Clicking the icon will give a list of the modified files.
+        </para>
+      </para>
+      <para />
+    </section>
+  </section>
+</chapter>
--- a/doc/docbook/GuideMainWindowMenus.xml	Thu Jan 26 10:28:21 2017 +0000
+++ b/doc/docbook/GuideMainWindowMenus.xml	Sat Jan 28 19:58:06 2017 +0000
@@ -651,6 +651,11 @@
               <link linkend="MetadataMiscellaneous">Metadata tab of the Preferences Dialog</link>
               if you wish these changes to be written to metadata.
             </para>
+            <para>
+              Refer also to the
+              <link linkend="HowdotheExifauto-rotationcommandswork">FAQ</link>
+              .
+            </para>
           </warning>
         </listitem>
       </varlistentry>
@@ -673,6 +678,18 @@
       </varlistentry>
       <varlistentry>
         <term>
+          <guilabel>Auto rotate image using EXIF information</guilabel>
+        </term>
+        <listitem>
+          <para>
+            Auto rotates images based on metadata stored in images that have Exif data. Refer also to the
+            <link linkend="HowdotheExifauto-rotationcommandswork">FAQ</link>
+            .
+          </para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term>
           <menuchoice>
             <guimenu>Orientation</guimenu>
             <guimenuitem>Apply the orientation to image content</guimenuitem>
--- a/doc/docbook/GuideMainWindowStatusBar.xml	Thu Jan 26 10:28:21 2017 +0000
+++ b/doc/docbook/GuideMainWindowStatusBar.xml	Sat Jan 28 19:58:06 2017 +0000
@@ -92,6 +92,19 @@
     <title>Buttons</title>
     <para>Statusbar buttons corresponds to selected menu action.</para>
     <para />
+    <section id="ExifRotate">
+      <title>Exif rotate</title>
+      <para>
+        <guiicon>
+          <inlinegraphic fileref="gtk-color-picker.png" />
+        </guiicon>
+        Toggles the auto-rotation of images if they have Exif orientation data. 
+        Refer also to the
+        <link linkend="HowdotheExifauto-rotationcommandswork">FAQ</link>
+        .
+      </para>
+      <para />
+    </section>
     <section id="ShowPixelInfo">
       <title>Show Pixel Info</title>
       <para>
@@ -123,4 +136,4 @@
       <para />
     </section>
   </section>
-</section>
+</section>
--- a/doc/docbook/GuideOptionsImage.xml	Thu Jan 26 10:28:21 2017 +0000
+++ b/doc/docbook/GuideOptionsImage.xml	Sat Jan 28 19:58:06 2017 +0000
@@ -194,20 +194,12 @@
   <section id="Convenience">
     <title>Convenience</title>
     <variablelist>
-      <varlistentry>
-        <term>
-          <guilabel>Auto rotate image using EXIF information</guilabel>
-        </term>
-        <listitem>
-          <para>Auto rotates images based on metadata stored in images that have Exif data.</para>
-        </listitem>
-      </varlistentry>
-      <varlistentry>
+       <varlistentry>
         <term>
           <guilabel>Auto rotate proofs using EXIF information</guilabel>
         </term>
         <listitem>
-          <para>TBD</para>
+          <para>Auto rotate images on print proof sheet.</para>
         </listitem>
       </varlistentry>
     </variablelist>
--- a/doc/docbook/GuideOptionsMetadata.xml	Thu Jan 26 10:28:21 2017 +0000
+++ b/doc/docbook/GuideOptionsMetadata.xml	Sat Jan 28 19:58:06 2017 +0000
@@ -112,10 +112,13 @@
         <para>
           <guilabel>Write altered image orientation to the metadata</guilabel>
           <para />
-          If checked, the results of orientation commands (Rotate, Mirror and Flip) issued on an image will be written to metadata either automatically as specified below or when manually initiated.
+          If checked, the results of orientation commands (Rotate, Mirror and Flip) issued on an image will be written to metadata either automatically as specified below or when manually initiated. This option also affects the
+          <link linkend="Editmenu">Auto rotate image using EXIF information</link>
+          menu item.
         </para>
         <warning>
           <para>If this option is not checked, the results of orientation commands will be lost when Geeqie closes.</para>
+          <para>Do not change this option while you have temporary rotations applied to images.</para>
         </warning>
       </listitem>
     </itemizedlist>
--- a/src/layout_image.c	Thu Jan 26 10:28:21 2017 +0000
+++ b/src/layout_image.c	Sat Jan 28 19:58:06 2017 +0000
@@ -26,6 +26,7 @@
 #include "color-man.h"
 #include "dnd.h"
 #include "editors.h"
+#include "exif.h"
 #include "filedata.h"
 #include "fullscreen.h"
 #include "image.h"
@@ -34,6 +35,7 @@
 #include "layout.h"
 #include "layout_util.h"
 #include "menu.h"
+#include "metadata.h"
 #include "misc.h"
 #include "pixbuf_util.h"
 #include "pixbuf-renderer.h"
@@ -1063,6 +1065,32 @@
 	image_alter_orientation(lw->image, type);
 }
 
+void layout_image_reset_orientation(LayoutWindow *lw)
+{
+	ImageWindow *imd= lw->image;
+
+	if (!layout_valid(&lw)) return;
+	if (!imd || !imd->pr || !imd->image_fd) return;
+
+	if (imd->orientation < 1 || imd->orientation > 8) imd->orientation = 1;
+
+	if (options->image.exif_rotate_enable)
+		{
+		imd->orientation = metadata_read_int(imd->image_fd, ORIENTATION_KEY, EXIF_ORIENTATION_TOP_LEFT);
+		}
+	else
+		{
+		imd->orientation = 1;
+		}
+
+	if (imd->image_fd->user_orientation != 0)
+		{
+		 imd->orientation = imd->image_fd->user_orientation;
+		}
+
+	pixbuf_renderer_set_orientation((PixbufRenderer *)imd->pr, imd->orientation);
+}
+
 void layout_image_set_desaturate(LayoutWindow *lw, gboolean desaturate)
 {
 	if (!layout_valid(&lw)) return;
--- a/src/layout_image.h	Thu Jan 26 10:28:21 2017 +0000
+++ b/src/layout_image.h	Sat Jan 28 19:58:06 2017 +0000
@@ -100,6 +100,6 @@
 void layout_image_overlay_toggle(LayoutWindow *lw);
 
 void layout_image_notify_cb(FileData *fd, NotifyType type, gpointer data);
-
+void layout_image_reset_orientation(LayoutWindow *lw);
 #endif
 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
--- a/src/layout_util.c	Thu Jan 26 10:28:21 2017 +0000
+++ b/src/layout_util.c	Sat Jan 28 19:58:06 2017 +0000
@@ -394,6 +394,14 @@
 	layout_image_alter_orientation(lw, ALTER_NONE);
 }
 
+static void layout_menu_exif_rotate_cb(GtkToggleAction *action, gpointer data)
+{
+	LayoutWindow *lw = data;
+
+	options->image.exif_rotate_enable = gtk_toggle_action_get_active(action);
+	layout_image_reset_orientation(lw);
+}
+
 static void layout_menu_config_cb(GtkAction *action, gpointer data)
 {
 	LayoutWindow *lw = data;
@@ -1598,6 +1606,7 @@
   { "ImageHistogram",	NULL,			N_("_Show Histogram"),			NULL,			N_("Show Histogram"),			CB(layout_menu_histogram_cb),	 FALSE },
   { "RectangularSelection",	NULL,			N_("Rectangular Selection"),			"<alt>R",			N_("Rectangular Selection"),			CB(layout_menu_rectangular_selection_cb),	 FALSE },
   { "Animate",	NULL,	N_("GIF _animation"),		"A",			N_("Toggle GIF animation"),			CB(layout_menu_animate_cb),	 FALSE  },
+  { "ExifRotate",	GTK_STOCK_ORIENTATION_PORTRAIT,			N_("_Exif rotate"),  		"<alt>X",		N_("Exif rotate"),			CB(layout_menu_exif_rotate_cb), FALSE },
 };
 
 static GtkRadioActionEntry menu_radio_entries[] = {
@@ -1715,6 +1724,9 @@
 "        <menuitem action='Mirror'/>"
 "        <menuitem action='Flip'/>"
 "        <menuitem action='AlterNone'/>"
+"        <separator/>"
+"        <menuitem action='ExifRotate'/>"
+"        <separator/>"
 "      </menu>"
 "      <menuitem action='SaveMetadata'/>"
 "      <placeholder name='PropertiesSection'/>"
@@ -1865,6 +1877,7 @@
 "    <toolitem action='FloatTools'/>"
 "  </toolbar>"
 "  <toolbar name='StatusBar'>"
+"    <toolitem action='ExifRotate'/>"
 "    <toolitem action='ShowInfoPixel'/>"
 "    <toolitem action='UseColorProfiles'/>"
 "    <toolitem action='SaveMetadata'/>"
@@ -2478,6 +2491,12 @@
 	action = gtk_action_group_get_action(lw->action_group, "ImageHistogram");
 	gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), osd_flags & OSD_SHOW_HISTOGRAM);
 
+	action = gtk_action_group_get_action(lw->action_group, "ExifRotate");
+	gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), options->image.exif_rotate_enable);
+
+	action = gtk_action_group_get_action(lw->action_group, "RectangularSelection");
+	gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), options->collections.rectangular_selection);
+
 	if (osd_flags & OSD_SHOW_HISTOGRAM)
 		{
 		action = gtk_action_group_get_action(lw->action_group, "HistogramChanR");
--- a/src/preferences.c	Thu Jan 26 10:28:21 2017 +0000
+++ b/src/preferences.c	Sat Jan 28 19:58:06 2017 +0000
@@ -316,7 +316,6 @@
 	options->image_overlay.background_blue = c_options->image_overlay.background_blue;
 	options->image_overlay.background_alpha = c_options->image_overlay.background_alpha;
 	options->update_on_time_change = c_options->update_on_time_change;
-	options->image.exif_rotate_enable = c_options->image.exif_rotate_enable;
 	options->image.exif_proof_rotate_enable = c_options->image.exif_proof_rotate_enable;
 
 	options->duplicates_similarity_threshold = c_options->duplicates_similarity_threshold;
@@ -1550,9 +1549,6 @@
 
 	group = pref_group_new(vbox, FALSE, _("Convenience"), GTK_ORIENTATION_VERTICAL);
 
-	pref_checkbox_new_int(group, _("Auto rotate image using Exif information"),
-			      options->image.exif_rotate_enable, &c_options->image.exif_rotate_enable);
-
 	pref_checkbox_new_int(group, _("Auto rotate proofs using Exif information"),
 			      options->image.exif_proof_rotate_enable, &c_options->image.exif_proof_rotate_enable);
 }