Move exif auto-rotate option to a menu
authorColin Clark <cclark@mcb.net>
Sat, 28 Jan 2017 19:58:06 +0000 (19:58 +0000)
committerColin Clark <cclark@mcb.net>
Sat, 28 Jan 2017 19:58:06 +0000 (19:58 +0000)
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.

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

index 55f9bb8..592988f 100644 (file)
       <para />\r
     </section>\r
   </section>\r
-</chapter>
+  <section id="ExifRotation">\r
+    <title>Exif Auto Rotation</title>\r
+    <para />\r
+    <section id="HowdotheExifauto-rotationcommandswork">\r
+      <title>How do the Exif auto-rotation commands work?</title>\r
+      <para>\r
+        Image auto-rotation works in either of two modes, set by\r
+        <link linkend="MetadataMiscellaneous">Write altered image orientation to the metadata</link>\r
+        option.\r
+      </para>\r
+      <para>\r
+        <guilabel>Write altered image orientation to the metadata not set</guilabel>\r
+        <para />\r
+        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.\r
+      </para>\r
+      <warning>\r
+        <para>It is not possible to determine if the image as displayed is the original image or one which has been temporarily rotated.</para>\r
+      </warning>\r
+      <para>\r
+        If the option\r
+        <link linkend="Editmenu">Auto rotate image using EXIF information</link>\r
+        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.\r
+      </para>\r
+      <para>\r
+        <guilabel>Write altered image orientation to the metadata set</guilabel>\r
+        <para />\r
+        <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>\r
+        <para>\r
+          If the option\r
+          <link linkend="Editmenu">Auto rotate image using EXIF information</link>\r
+          is selected, any images which have Exif orientation data will be shown rotated, including any in the metadata write queue.\r
+        </para>\r
+        <para>\r
+          However if the option\r
+          <link linkend="Editmenu">Auto rotate image using EXIF information</link>\r
+          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.\r
+        </para>\r
+      </para>\r
+      <para />\r
+    </section>\r
+  </section>\r
+</chapter>\r
index c2a27a1..fd4df7b 100644 (file)
               <link linkend="MetadataMiscellaneous">Metadata tab of the Preferences Dialog</link>\r
               if you wish these changes to be written to metadata.\r
             </para>\r
+            <para>\r
+              Refer also to the\r
+              <link linkend="HowdotheExifauto-rotationcommandswork">FAQ</link>\r
+              .\r
+            </para>\r
           </warning>\r
         </listitem>\r
       </varlistentry>\r
           <para>Removes all temporary effects applied through the above commands, reverting the image according to its Exif Orientation tag.</para>\r
         </listitem>\r
       </varlistentry>\r
+      <varlistentry>\r
+        <term>\r
+          <guilabel>Auto rotate image using EXIF information</guilabel>\r
+        </term>\r
+        <listitem>\r
+          <para>\r
+            Auto rotates images based on metadata stored in images that have Exif data. Refer also to the\r
+            <link linkend="HowdotheExifauto-rotationcommandswork">FAQ</link>\r
+            .\r
+          </para>\r
+        </listitem>\r
+      </varlistentry>\r
       <varlistentry>\r
         <term>\r
           <menuchoice>\r
index e4a5159..255fc60 100644 (file)
     <title>Buttons</title>\r
     <para>Statusbar buttons corresponds to selected menu action.</para>\r
     <para />\r
+    <section id="ExifRotate">\r
+      <title>Exif rotate</title>\r
+      <para>\r
+        <guiicon>\r
+          <inlinegraphic fileref="gtk-color-picker.png" />\r
+        </guiicon>\r
+        Toggles the auto-rotation of images if they have Exif orientation data. \r
+        Refer also to the\r
+        <link linkend="HowdotheExifauto-rotationcommandswork">FAQ</link>\r
+        .\r
+      </para>\r
+      <para />\r
+    </section>\r
     <section id="ShowPixelInfo">\r
       <title>Show Pixel Info</title>\r
       <para>\r
       <para />\r
     </section>\r
   </section>\r
-</section>
+</section>\r
index a9286d0..076b8f2 100644 (file)
   <section id="Convenience">\r
     <title>Convenience</title>\r
     <variablelist>\r
-      <varlistentry>\r
-        <term>\r
-          <guilabel>Auto rotate image using EXIF information</guilabel>\r
-        </term>\r
-        <listitem>\r
-          <para>Auto rotates images based on metadata stored in images that have Exif data.</para>\r
-        </listitem>\r
-      </varlistentry>\r
-      <varlistentry>\r
+       <varlistentry>\r
         <term>\r
           <guilabel>Auto rotate proofs using EXIF information</guilabel>\r
         </term>\r
         <listitem>\r
-          <para>TBD</para>\r
+          <para>Auto rotate images on print proof sheet.</para>\r
         </listitem>\r
       </varlistentry>\r
     </variablelist>\r
index 9f72095..2a315a6 100644 (file)
         <para>\r
           <guilabel>Write altered image orientation to the metadata</guilabel>\r
           <para />\r
-          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.\r
+          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\r
+          <link linkend="Editmenu">Auto rotate image using EXIF information</link>\r
+          menu item.\r
         </para>\r
         <warning>\r
           <para>If this option is not checked, the results of orientation commands will be lost when Geeqie closes.</para>\r
+          <para>Do not change this option while you have temporary rotations applied to images.</para>\r
         </warning>\r
       </listitem>\r
     </itemizedlist>\r
index 12eb2cf..966808f 100644 (file)
@@ -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 @@ void layout_image_alter_orientation(LayoutWindow *lw, AlterType type)
        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;
index 9f926fd..54c2822 100644 (file)
@@ -100,6 +100,6 @@ void layout_image_animate_toggle(LayoutWindow *lw);
 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: */
index 413294f..ba55d48 100644 (file)
@@ -394,6 +394,14 @@ static void layout_menu_alter_none_cb(GtkAction *action, gpointer data)
        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 @@ static GtkToggleActionEntry menu_toggle_entries[] = {
   { "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 @@ static const gchar *menu_ui_description =
 "        <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 @@ static const gchar *menu_ui_description =
 "    <toolitem action='FloatTools'/>"
 "  </toolbar>"
 "  <toolbar name='StatusBar'>"
+"    <toolitem action='ExifRotate'/>"
 "    <toolitem action='ShowInfoPixel'/>"
 "    <toolitem action='UseColorProfiles'/>"
 "    <toolitem action='SaveMetadata'/>"
@@ -2478,6 +2491,12 @@ static void layout_util_sync_views(LayoutWindow *lw)
        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");
index 4b4c43d..47304bb 100644 (file)
@@ -316,7 +316,6 @@ static void config_window_apply(void)
        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 @@ static void config_tab_image(GtkWidget *notebook)
 
        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);
 }