changeset 439:1cca0b614cba

Add a way to restore original state in Adjust menu.
author zas_
date Sun, 20 Apr 2008 09:47:51 +0000
parents eff049b3d308
children 3d16af3b133a
files src/image.c src/layout_util.c src/menu.c src/typedefs.h
diffstat 4 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/image.c	Sun Apr 20 09:29:46 2008 +0000
+++ b/src/image.c	Sun Apr 20 09:47:51 2008 +0000
@@ -583,6 +583,9 @@
 			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 @@
 		
 		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;
 			}
 		}
 
--- a/src/layout_util.c	Sun Apr 20 09:29:46 2008 +0000
+++ b/src/layout_util.c	Sun Apr 20 09:47:51 2008 +0000
@@ -336,6 +336,13 @@
 	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 @@
   { "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 @@
 "        <menuitem action='Mirror'/>"
 "        <menuitem action='Flip'/>"
 "        <menuitem action='Grayscale'/>"
+"        <menuitem action='AlterNone'/>"
 "      </menu>"
 "      <menuitem action='Properties'/>"
 "      <separator/>"
--- a/src/menu.c	Sun Apr 20 09:29:46 2008 +0000
+++ b/src/menu.c	Sun Apr 20 09:47:51 2008 +0000
@@ -215,6 +215,9 @@
 		case ALTER_DESATURATE:
 			return _("Toggle _grayscale");
 			break;
+		case ALTER_NONE:
+			return _("_Original state");
+			break;
 		default:
 			break;
 		}
@@ -251,6 +254,7 @@
 	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)
 		{
--- a/src/typedefs.h	Sun Apr 20 09:29:46 2008 +0000
+++ b/src/typedefs.h	Sun Apr 20 09:47:51 2008 +0000
@@ -412,6 +412,7 @@
 	GdkPixbuf *pixbuf;
 	gint ref;
 	gint user_orientation;
+	gint exif_orientation;
 };
 
 struct _LayoutWindow