Add a way to restore original state in Adjust menu.
authorLaurent Monin <geeqie@norz.org>
Sun, 20 Apr 2008 09:47:51 +0000 (09:47 +0000)
committerLaurent Monin <geeqie@norz.org>
Sun, 20 Apr 2008 09:47:51 +0000 (09:47 +0000)
src/image.c
src/layout_util.c
src/menu.c
src/typedefs.h

index bb0740c..a99268b 100644 (file)
@@ -583,6 +583,9 @@ void image_alter(ImageWindow *imd, AlterType type)
                        imd->desaturate = !imd->desaturate;
                        break;
                case ALTER_NONE:
+                       imd->orientation = imd->image_fd->exif_orientation ? imd->image_fd->exif_orientation : 1;
+                       imd->desaturate = FALSE;
+                       break;
                default:
                        return;
                        break;
@@ -1316,10 +1319,11 @@ void image_change_pixbuf(ImageWindow *imd, GdkPixbuf *pixbuf, gdouble zoom)
                
                if (exif && read_exif_for_orientation)
                        {
-                       if (exif_get_integer(exif, "Exif.Image.Orientation", &orientation)) 
+                       if (exif_get_integer(exif, "Exif.Image.Orientation", &orientation))
                                imd->orientation = orientation;
                        else
                                imd->orientation = 1;
+                       imd->image_fd->exif_orientation = imd->orientation;
                        }
                }
 
index ff1f813..1587039 100644 (file)
@@ -336,6 +336,13 @@ static void layout_menu_alter_desaturate_cb(GtkAction *action, gpointer data)
        layout_image_alter(lw, ALTER_DESATURATE);
 }
 
+static void layout_menu_alter_none_cb(GtkAction *action, gpointer data)
+{
+       LayoutWindow *lw = data;
+
+       layout_image_alter(lw, ALTER_NONE);
+}
+
 static void layout_menu_info_cb(GtkAction *action, gpointer data)
 {
        LayoutWindow *lw = data;
@@ -1048,12 +1055,15 @@ static GtkActionEntry menu_entries[] = {
   { "Editor7",         NULL,           "editor7",              NULL,           NULL,   CB(layout_menu_edit_cb) },
   { "Editor8",         NULL,           "editor8",              NULL,           NULL,   CB(layout_menu_edit_cb) },
   { "Editor9",         NULL,           "editor9",              NULL,           NULL,   CB(layout_menu_edit_cb) },
+  
   { "RotateCW",                NULL,   N_("_Rotate clockwise"),        "bracketright", NULL,   CB(layout_menu_alter_90_cb) },
   { "RotateCCW",       NULL,   N_("Rotate _counterclockwise"), "bracketleft",  NULL,   CB(layout_menu_alter_90cc_cb) },
   { "Rotate180",       NULL,           N_("Rotate 1_80"),      "<shift>R",     NULL,   CB(layout_menu_alter_180_cb) },
   { "Mirror",          NULL,           N_("_Mirror"),          "<shift>M",     NULL,   CB(layout_menu_alter_mirror_cb) },
   { "Flip",            NULL,           N_("_Flip"),            "<shift>F",     NULL,   CB(layout_menu_alter_flip_cb) },
   { "Grayscale",       NULL,           N_("Toggle _grayscale"),"<shift>G",     NULL,   CB(layout_menu_alter_desaturate_cb) },
+  { "AlterNone",       NULL,           N_("_Original state"),  "<shift>O",     NULL,   CB(layout_menu_alter_none_cb) },
+
   { "Properties",GTK_STOCK_PROPERTIES, N_("_Properties"),      "<control>P",   NULL,   CB(layout_menu_info_cb) },
   { "SelectAll",       NULL,           N_("Select _all"),      "<control>A",   NULL,   CB(layout_menu_select_all_cb) },
   { "SelectNone",      NULL,           N_("Select _none"), "<control><shift>A",NULL,   CB(layout_menu_unselect_all_cb) },
@@ -1184,6 +1194,7 @@ static const char *menu_ui_description =
 "        <menuitem action='Mirror'/>"
 "        <menuitem action='Flip'/>"
 "        <menuitem action='Grayscale'/>"
+"        <menuitem action='AlterNone'/>"
 "      </menu>"
 "      <menuitem action='Properties'/>"
 "      <separator/>"
index c03d532..4fdebac 100644 (file)
@@ -215,6 +215,9 @@ gchar *alter_type_get_text(AlterType type)
                case ALTER_DESATURATE:
                        return _("Toggle _grayscale");
                        break;
+               case ALTER_NONE:
+                       return _("_Original state");
+                       break;
                default:
                        break;
                }
@@ -251,6 +254,7 @@ static GtkWidget *real_submenu_add_alter(GtkWidget *menu, GCallback func, gpoint
        submenu_add_alter_item(submenu, func, ALTER_MIRROR, accel_group, 'M', GDK_SHIFT_MASK);
        submenu_add_alter_item(submenu, func, ALTER_FLIP, accel_group, 'F', GDK_SHIFT_MASK);
        submenu_add_alter_item(submenu, func, ALTER_DESATURATE, accel_group, 'G', GDK_SHIFT_MASK);
+       submenu_add_alter_item(submenu, func, ALTER_NONE, accel_group, 'O', GDK_SHIFT_MASK);
 
        if (menu)
                {
index 5bec0dd..833b57b 100644 (file)
@@ -412,6 +412,7 @@ struct _FileData {
        GdkPixbuf *pixbuf;
        gint ref;
        gint user_orientation;
+       gint exif_orientation;
 };
 
 struct _LayoutWindow