changeset 1581:cef502852c4f

resolved conflict
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Fri, 01 May 2009 15:48:11 +0900
parents 855d58cba862 (current diff) 24ef7b610ed6 (diff)
children c1e22cba4003
files src/image.c
diffstat 9 files changed, 37 insertions(+), 62 deletions(-) [+]
line wrap: on
line diff
--- a/src/image.c	Tue Apr 28 21:40:00 2009 +0000
+++ b/src/image.c	Fri May 01 15:48:11 2009 +0900
@@ -363,7 +363,7 @@
 
 }
 
-void image_alter_orientation(ImageWindow *imd, AlterType type)
+void image_alter(ImageWindow *imd, AlterType type)
 {
 	static const gint rotate_90[]    = {1,   6, 7, 8, 5, 2, 3, 4, 1};
 	static const gint rotate_90_cc[] = {1,   8, 5, 6, 7, 4, 1, 2, 3};
@@ -393,8 +393,12 @@
 		case ALTER_FLIP:
 			imd->orientation = flip[imd->orientation];
 			break;
+		case ALTER_DESATURATE:
+			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;
@@ -433,22 +437,12 @@
 		}
 
 	pixbuf_renderer_set_orientation((PixbufRenderer *)imd->pr, imd->orientation);
-}
-
-void image_set_desaturate(ImageWindow *imd, gboolean desaturate)
-{
-	imd->desaturate = desaturate;
 	if (imd->cm || imd->desaturate)
 		pixbuf_renderer_set_post_process_func((PixbufRenderer *)imd->pr, image_post_process_tile_color_cb, (gpointer) imd, (imd->cm != NULL) );
 	else
 		pixbuf_renderer_set_post_process_func((PixbufRenderer *)imd->pr, NULL, NULL, TRUE);
-	pixbuf_renderer_set_orientation((PixbufRenderer *)imd->pr, imd->orientation);
 }
 
-gboolean image_get_desaturate(ImageWindow *imd)
-{
-	return imd->desaturate;
-}
 
 /*
  *-------------------------------------------------------------------
--- a/src/image.h	Tue Apr 28 21:40:00 2009 +0000
+++ b/src/image.h	Fri May 01 15:48:11 2009 +0900
@@ -76,9 +76,7 @@
 			   gdouble x_align, gdouble y_align);
 void image_get_scroll_center(ImageWindow *imd, gdouble *x, gdouble *y);
 void image_set_scroll_center(ImageWindow *imd, gdouble x, gdouble y);
-void image_alter_orientation(ImageWindow *imd, AlterType type);
-void image_set_desaturate(ImageWindow *imd, gboolean desaturate);
-gboolean image_get_desaturate(ImageWindow *imd);
+void image_alter(ImageWindow *imd, AlterType type);
 
 /* zoom */
 void image_zoom_adjust(ImageWindow *imd, gdouble increment);
--- a/src/img-view.c	Tue Apr 28 21:40:00 2009 +0000
+++ b/src/img-view.c	Fri May 01 15:48:11 2009 +0900
@@ -448,16 +448,16 @@
 		switch (event->keyval)
 			{
 			case 'R': case 'r':
-				image_alter_orientation(imd, ALTER_ROTATE_180);
+				image_alter(imd, ALTER_ROTATE_180);
 				break;
 			case 'M': case 'm':
-				image_alter_orientation(imd, ALTER_MIRROR);
+				image_alter(imd, ALTER_MIRROR);
 				break;
 			case 'F': case 'f':
-				image_alter_orientation(imd, ALTER_FLIP);
+				image_alter(imd, ALTER_FLIP);
 				break;
 			case 'G': case 'g':
-				image_set_desaturate(imd, !image_get_desaturate(imd));
+				image_alter(imd, ALTER_DESATURATE);
 				break;
 			case 'P': case 'p':
 				{
@@ -558,10 +558,10 @@
 				view_overlay_toggle(vw);
 				break;
 			case ']':
-				image_alter_orientation(imd, ALTER_ROTATE_90);
+				image_alter(imd, ALTER_ROTATE_90);
 				break;
 			case '[':
-				image_alter_orientation(imd, ALTER_ROTATE_90_CC);
+				image_alter(imd, ALTER_ROTATE_90_CC);
 				break;
 			case GDK_Delete: case GDK_KP_Delete:
 				if (options->file_ops.enable_delete_key)
@@ -1094,7 +1094,7 @@
 	type = GPOINTER_TO_INT(data);
 
 	if (!vw) return;
-	image_alter_orientation(vw->imd, type);
+	image_alter(vw->imd, type);
 }
 
 static void view_wallpaper_cb(GtkWidget *widget, gpointer data)
--- a/src/layout_image.c	Tue Apr 28 21:40:00 2009 +0000
+++ b/src/layout_image.c	Fri May 01 15:48:11 2009 +0900
@@ -331,7 +331,7 @@
 	lw = submenu_item_get_data(widget);
 	type = (AlterType)GPOINTER_TO_INT(data);
 
-	image_alter_orientation(lw->image, type);
+	image_alter(lw->image, type);
 }
 
 static void li_pop_menu_new_cb(GtkWidget *widget, gpointer data)
@@ -884,29 +884,13 @@
 		}
 }
 
-void layout_image_alter_orientation(LayoutWindow *lw, AlterType type)
-{
-	if (!layout_valid(&lw)) return;
-
-	image_alter_orientation(lw->image, type);
-}
-
-void layout_image_set_desaturate(LayoutWindow *lw, gboolean desaturate)
+void layout_image_alter(LayoutWindow *lw, AlterType type)
 {
 	if (!layout_valid(&lw)) return;
 
-	image_set_desaturate(lw->image, desaturate);
+	image_alter(lw->image, type);
 }
 
-gboolean layout_image_get_desaturate(LayoutWindow *lw)
-{
-	if (!layout_valid(&lw)) return FALSE;
-
-	return image_get_desaturate(lw->image);
-}
-
-
-
 const gchar *layout_image_get_path(LayoutWindow *lw)
 {
 	if (!layout_valid(&lw)) return NULL;
--- a/src/layout_image.h	Tue Apr 28 21:40:00 2009 +0000
+++ b/src/layout_image.h	Fri May 01 15:48:11 2009 +0900
@@ -51,9 +51,7 @@
 void layout_image_zoom_adjust_at_point(LayoutWindow *lw, gdouble increment, gint x, gint y, gboolean connect_zoom);
 void layout_image_zoom_set(LayoutWindow *lw, gdouble zoom, gboolean connect_zoom);
 void layout_image_zoom_set_fill_geometry(LayoutWindow *lw, gboolean vertical, gboolean connect_zoom);
-void layout_image_alter_orientation(LayoutWindow *lw, AlterType type);
-void layout_image_set_desaturate(LayoutWindow *lw, gboolean desaturate);
-gboolean layout_image_get_desaturate(LayoutWindow *lw);
+void layout_image_alter(LayoutWindow *lw, AlterType type);
 
 void layout_image_next(LayoutWindow *lw);
 void layout_image_prev(LayoutWindow *lw);
--- a/src/layout_util.c	Tue Apr 28 21:40:00 2009 +0000
+++ b/src/layout_util.c	Fri May 01 15:48:11 2009 +0900
@@ -319,49 +319,49 @@
 {
 	LayoutWindow *lw = data;
 
-	layout_image_alter_orientation(lw, ALTER_ROTATE_90);
+	layout_image_alter(lw, ALTER_ROTATE_90);
 }
 
 static void layout_menu_alter_90cc_cb(GtkAction *action, gpointer data)
 {
 	LayoutWindow *lw = data;
 
-	layout_image_alter_orientation(lw, ALTER_ROTATE_90_CC);
+	layout_image_alter(lw, ALTER_ROTATE_90_CC);
 }
 
 static void layout_menu_alter_180_cb(GtkAction *action, gpointer data)
 {
 	LayoutWindow *lw = data;
 
-	layout_image_alter_orientation(lw, ALTER_ROTATE_180);
+	layout_image_alter(lw, ALTER_ROTATE_180);
 }
 
 static void layout_menu_alter_mirror_cb(GtkAction *action, gpointer data)
 {
 	LayoutWindow *lw = data;
 
-	layout_image_alter_orientation(lw, ALTER_MIRROR);
+	layout_image_alter(lw, ALTER_MIRROR);
 }
 
 static void layout_menu_alter_flip_cb(GtkAction *action, gpointer data)
 {
 	LayoutWindow *lw = data;
 
-	layout_image_alter_orientation(lw, ALTER_FLIP);
+	layout_image_alter(lw, ALTER_FLIP);
 }
 
-static void layout_menu_alter_desaturate_cb(GtkToggleAction *action, gpointer data)
+static void layout_menu_alter_desaturate_cb(GtkAction *action, gpointer data)
 {
 	LayoutWindow *lw = data;
 
-	layout_image_set_desaturate(lw, gtk_toggle_action_get_active(action));
+	layout_image_alter(lw, ALTER_DESATURATE);
 }
 
 static void layout_menu_alter_none_cb(GtkAction *action, gpointer data)
 {
 	LayoutWindow *lw = data;
 
-	layout_image_alter_orientation(lw, ALTER_NONE);
+	layout_image_alter(lw, ALTER_NONE);
 }
 
 static void layout_menu_config_cb(GtkAction *action, gpointer data)
@@ -1301,7 +1301,7 @@
   { "GoMenu",		NULL,		N_("_Go"),			NULL, 		NULL, 	NULL },
   { "EditMenu",		NULL,		N_("_Edit"),			NULL, 		NULL, 	NULL },
   { "SelectMenu",	NULL,		N_("_Select"),			NULL, 		NULL, 	NULL },
-  { "OrientationMenu",	NULL,		N_("_Orientation"),			NULL, 		NULL, 	NULL },
+  { "AdjustMenu",	NULL,		N_("_Adjust"),			NULL, 		NULL, 	NULL },
   { "ExternalMenu",	NULL,		N_("E_xternal Editors"),	NULL, 		NULL, 	NULL },
   { "ViewMenu",		NULL,		N_("_View"),			NULL, 		NULL, 	NULL },
   { "DirMenu",          NULL,           N_("_View Directory as"),	NULL, 		NULL, 	NULL },
@@ -1347,6 +1347,7 @@
   { "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) },
 
   { "SelectAll",	NULL,		N_("Select _all"),	"<control>A",	NULL,	CB(layout_menu_select_all_cb) },
@@ -1429,7 +1430,6 @@
   { "SlideShow",	NULL,		N_("Toggle _slideshow"),"S",		NULL,	CB(layout_menu_slideshow_cb),	 FALSE  },
   { "UseColorProfiles",	NULL,		N_("Use _color profiles"), NULL,	NULL,	CB(layout_color_menu_enable_cb), FALSE},
   { "UseImageProfile",	NULL,		N_("Use profile from _image"), NULL,	NULL,	CB(layout_color_menu_use_image_cb), FALSE},
-  { "Grayscale",	NULL,		N_("Toggle _grayscale"),"<shift>G",	NULL,	CB(layout_menu_alter_desaturate_cb), FALSE},
 };
 
 static GtkRadioActionEntry menu_radio_entries[] = {
@@ -1512,12 +1512,13 @@
 "      </menu>"
 "      <placeholder name='EditSection'/>"
 "      <separator/>"
-"      <menu action='OrientationMenu'>"
+"      <menu action='AdjustMenu'>"
 "        <menuitem action='RotateCW'/>"
 "        <menuitem action='RotateCCW'/>"
 "        <menuitem action='Rotate180'/>"
 "        <menuitem action='Mirror'/>"
 "        <menuitem action='Flip'/>"
+"        <menuitem action='Grayscale'/>"
 "        <menuitem action='AlterNone'/>"
 "      </menu>"
 "      <placeholder name='PropertiesSection'/>"
@@ -1545,8 +1546,6 @@
 "        <menuitem action='ColorProfile3'/>"
 "        <menuitem action='ColorProfile4'/>"
 "        <menuitem action='ColorProfile5'/>"
-"        <separator/>"
-"        <menuitem action='Grayscale'/>"
 "      </menu>"
 "      <menu action='ZoomMenu'>"
 "        <menuitem action='ZoomIn'/>"
@@ -2116,9 +2115,6 @@
 		gtk_action_set_sensitive(action, !use_image);
 		gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), (i == input));
 		}
-
-	action = gtk_action_group_get_action(lw->action_group, "Grayscale");
-	gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), layout_image_get_desaturate(lw));
 }
 
 static void layout_util_sync_views(LayoutWindow *lw)
--- a/src/lirc.c	Tue Apr 28 21:40:00 2009 +0000
+++ b/src/lirc.c	Fri May 01 15:48:11 2009 +0900
@@ -164,11 +164,11 @@
 				}
 			else if (g_ascii_strcasecmp("ROTATE_90", cmd) == 0)
 				{
-				layout_image_alter_orientation(lw, ALTER_ROTATE_90);
+				layout_image_alter(lw, ALTER_ROTATE_90);
 				}
 			else if (g_ascii_strcasecmp("ROTATE_90_CC", cmd) == 0)
 				{
-				layout_image_alter_orientation(lw, ALTER_ROTATE_90_CC);
+				layout_image_alter(lw, ALTER_ROTATE_90_CC);
 				}
 			else if (g_ascii_strcasecmp("INFO", cmd) == 0)
 				{
--- a/src/menu.c	Tue Apr 28 21:40:00 2009 +0000
+++ b/src/menu.c	Fri May 01 15:48:11 2009 +0900
@@ -230,6 +230,9 @@
 		case ALTER_FLIP:
 			return _("_Flip");
 			break;
+		case ALTER_DESATURATE:
+			return _("Toggle _grayscale");
+			break;
 		case ALTER_NONE:
 			return _("_Original state");
 			break;
@@ -268,13 +271,14 @@
 	submenu_add_alter_item(submenu, func, ALTER_ROTATE_180, accel_group, 'R', GDK_SHIFT_MASK);
 	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)
 		{
 		GtkWidget *item;
 
-		item = menu_item_add(menu, _("_Orientation"), NULL, NULL);
+		item = menu_item_add(menu, _("_Adjust"), NULL, NULL);
 		gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
 		return item;
 		}
--- a/src/typedefs.h	Tue Apr 28 21:40:00 2009 +0000
+++ b/src/typedefs.h	Fri May 01 15:48:11 2009 +0900
@@ -60,6 +60,7 @@
 	ALTER_ROTATE_180,
 	ALTER_MIRROR,
 	ALTER_FLIP,
+	ALTER_DESATURATE
 } AlterType;
 
 typedef enum {