[gthumb/ext] [file tools] added rotate, mirro and flip commands
- From: Paolo Bacchilega <paobac src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gthumb/ext] [file tools] added rotate, mirro and flip commands
- Date: Sun, 20 Sep 2009 18:29:31 +0000 (UTC)
commit 01e7e933642ca1f26a90eca7c61f107e0553d782
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sun Sep 20 20:29:04 2009 +0200
[file tools] added rotate, mirro and flip commands
extensions/file_tools/Makefile.am | 8 ++
extensions/file_tools/gth-file-tool-flip.c | 106 ++++++++++++++++++++
extensions/file_tools/gth-file-tool-flip.h | 52 ++++++++++
extensions/file_tools/gth-file-tool-mirror.c | 106 ++++++++++++++++++++
extensions/file_tools/gth-file-tool-mirror.h | 52 ++++++++++
extensions/file_tools/gth-file-tool-rotate-left.c | 106 ++++++++++++++++++++
extensions/file_tools/gth-file-tool-rotate-left.h | 52 ++++++++++
extensions/file_tools/gth-file-tool-rotate-right.c | 106 ++++++++++++++++++++
extensions/file_tools/gth-file-tool-rotate-right.h | 52 ++++++++++
extensions/file_tools/gth-file-tool-save-as.c | 6 +-
extensions/file_tools/main.c | 11 ++
gthumb/gth-viewer-page.c | 7 +-
12 files changed, 662 insertions(+), 2 deletions(-)
---
diff --git a/extensions/file_tools/Makefile.am b/extensions/file_tools/Makefile.am
index 376ef2e..0c9c28b 100644
--- a/extensions/file_tools/Makefile.am
+++ b/extensions/file_tools/Makefile.am
@@ -14,10 +14,18 @@ libfile_tools_la_SOURCES = \
gth-file-tool-enhance.h \
gth-file-tool-equalize.c \
gth-file-tool-equalize.h \
+ gth-file-tool-flip.c \
+ gth-file-tool-flip.h \
+ gth-file-tool-mirror.c \
+ gth-file-tool-mirror.h \
gth-file-tool-negative.c \
gth-file-tool-negative.h \
gth-file-tool-redo.c \
gth-file-tool-redo.h \
+ gth-file-tool-rotate-left.c \
+ gth-file-tool-rotate-left.h \
+ gth-file-tool-rotate-right.c \
+ gth-file-tool-rotate-right.h \
gth-file-tool-save.c \
gth-file-tool-save.h \
gth-file-tool-save-as.c \
diff --git a/extensions/file_tools/gth-file-tool-flip.c b/extensions/file_tools/gth-file-tool-flip.c
new file mode 100644
index 0000000..19f5e18
--- /dev/null
+++ b/extensions/file_tools/gth-file-tool-flip.c
@@ -0,0 +1,106 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2009 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <math.h>
+#include <gthumb.h>
+#include <extensions/image_viewer/gth-image-viewer-page.h>
+#include "gth-file-tool-flip.h"
+
+
+static void
+gth_file_tool_flip_activate (GthFileTool *base)
+{
+ GtkWidget *window;
+ GtkWidget *viewer_page;
+ GtkWidget *viewer;
+ GdkPixbuf *src_pixbuf;
+ GdkPixbuf *dest_pixbuf;
+
+ window = gth_file_tool_get_window (base);
+ viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
+ if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
+ return;
+
+ viewer = gth_image_viewer_page_get_image_viewer (GTH_IMAGE_VIEWER_PAGE (viewer_page));
+ src_pixbuf = gth_image_viewer_get_current_pixbuf (GTH_IMAGE_VIEWER (viewer));
+ if (src_pixbuf == NULL)
+ return;
+
+ dest_pixbuf = _gdk_pixbuf_transform (src_pixbuf, GTH_TRANSFORM_FLIP_V);
+ gth_image_viewer_page_set_pixbuf (GTH_IMAGE_VIEWER_PAGE (viewer_page), dest_pixbuf, TRUE);
+
+ g_object_unref (dest_pixbuf);
+}
+
+
+static void
+gth_file_tool_flip_update_sensitivity (GthFileTool *base)
+{
+ GtkWidget *window;
+ GtkWidget *viewer_page;
+
+ window = gth_file_tool_get_window (base);
+ viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
+ if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
+ gtk_widget_set_sensitive (GTK_WIDGET (base), FALSE);
+ else
+ gtk_widget_set_sensitive (GTK_WIDGET (base), TRUE);
+}
+
+
+static void
+gth_file_tool_flip_instance_init (GthFileToolFlip *self)
+{
+ gth_file_tool_construct (GTH_FILE_TOOL (self), GTK_STOCK_EDIT /* FIXME GTH_STOCK_FLIP */, _("Flip"), NULL, FALSE);
+ /*gtk_widget_set_tooltip_text (GTK_WIDGET (self), _("Automatic white balance correction"));*/
+}
+
+
+static void
+gth_file_tool_flip_class_init (GthFileToolClass *klass)
+{
+ klass->update_sensitivity = gth_file_tool_flip_update_sensitivity;
+ klass->activate = gth_file_tool_flip_activate;
+}
+
+
+GType
+gth_file_tool_flip_get_type (void) {
+ static GType type_id = 0;
+ if (type_id == 0) {
+ static const GTypeInfo g_define_type_info = {
+ sizeof (GthFileToolFlipClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) gth_file_tool_flip_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL,
+ sizeof (GthFileToolFlip),
+ 0,
+ (GInstanceInitFunc) gth_file_tool_flip_instance_init,
+ NULL
+ };
+ type_id = g_type_register_static (GTH_TYPE_FILE_TOOL, "GthFileToolFlip", &g_define_type_info, 0);
+ }
+ return type_id;
+}
diff --git a/extensions/file_tools/gth-file-tool-flip.h b/extensions/file_tools/gth-file-tool-flip.h
new file mode 100644
index 0000000..2fb92f4
--- /dev/null
+++ b/extensions/file_tools/gth-file-tool-flip.h
@@ -0,0 +1,52 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2009 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef GTH_FILE_TOOL_FLIP_H
+#define GTH_FILE_TOOL_FLIP_H
+
+#include <gthumb.h>
+
+G_BEGIN_DECLS
+
+#define GTH_TYPE_FILE_TOOL_FLIP (gth_file_tool_flip_get_type ())
+#define GTH_FILE_TOOL_FLIP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTH_TYPE_FILE_TOOL_FLIP, GthFileToolFlip))
+#define GTH_FILE_TOOL_FLIP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTH_TYPE_FILE_TOOL_FLIP, GthFileToolFlipClass))
+#define GTH_IS_FILE_TOOL_FLIP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTH_TYPE_FILE_TOOL_FLIP))
+#define GTH_IS_FILE_TOOL_FLIP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTH_TYPE_FILE_TOOL_FLIP))
+#define GTH_FILE_TOOL_FLIP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTH_TYPE_FILE_TOOL_FLIP, GthFileToolFlipClass))
+
+typedef struct _GthFileToolFlip GthFileToolFlip;
+typedef struct _GthFileToolFlipClass GthFileToolFlipClass;
+
+struct _GthFileToolFlip {
+ GthFileTool parent_instance;
+};
+
+struct _GthFileToolFlipClass {
+ GthFileToolClass parent_class;
+};
+
+GType gth_file_tool_flip_get_type (void);
+
+G_END_DECLS
+
+#endif /* GTH_FILE_TOOL_FLIP_H */
diff --git a/extensions/file_tools/gth-file-tool-mirror.c b/extensions/file_tools/gth-file-tool-mirror.c
new file mode 100644
index 0000000..633965c
--- /dev/null
+++ b/extensions/file_tools/gth-file-tool-mirror.c
@@ -0,0 +1,106 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2009 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <math.h>
+#include <gthumb.h>
+#include <extensions/image_viewer/gth-image-viewer-page.h>
+#include "gth-file-tool-mirror.h"
+
+
+static void
+gth_file_tool_mirror_activate (GthFileTool *base)
+{
+ GtkWidget *window;
+ GtkWidget *viewer_page;
+ GtkWidget *viewer;
+ GdkPixbuf *src_pixbuf;
+ GdkPixbuf *dest_pixbuf;
+
+ window = gth_file_tool_get_window (base);
+ viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
+ if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
+ return;
+
+ viewer = gth_image_viewer_page_get_image_viewer (GTH_IMAGE_VIEWER_PAGE (viewer_page));
+ src_pixbuf = gth_image_viewer_get_current_pixbuf (GTH_IMAGE_VIEWER (viewer));
+ if (src_pixbuf == NULL)
+ return;
+
+ dest_pixbuf = _gdk_pixbuf_transform (src_pixbuf, GTH_TRANSFORM_FLIP_H);
+ gth_image_viewer_page_set_pixbuf (GTH_IMAGE_VIEWER_PAGE (viewer_page), dest_pixbuf, TRUE);
+
+ g_object_unref (dest_pixbuf);
+}
+
+
+static void
+gth_file_tool_mirror_update_sensitivity (GthFileTool *base)
+{
+ GtkWidget *window;
+ GtkWidget *viewer_page;
+
+ window = gth_file_tool_get_window (base);
+ viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
+ if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
+ gtk_widget_set_sensitive (GTK_WIDGET (base), FALSE);
+ else
+ gtk_widget_set_sensitive (GTK_WIDGET (base), TRUE);
+}
+
+
+static void
+gth_file_tool_mirror_instance_init (GthFileToolMirror *self)
+{
+ gth_file_tool_construct (GTH_FILE_TOOL (self), GTK_STOCK_EDIT /* FIXME GTH_STOCK_MIRROR */, _("Mirror"), NULL, TRUE);
+ /*gtk_widget_set_tooltip_text (GTK_WIDGET (self), _("Automatic white balance correction"));*/
+}
+
+
+static void
+gth_file_tool_mirror_class_init (GthFileToolClass *klass)
+{
+ klass->update_sensitivity = gth_file_tool_mirror_update_sensitivity;
+ klass->activate = gth_file_tool_mirror_activate;
+}
+
+
+GType
+gth_file_tool_mirror_get_type (void) {
+ static GType type_id = 0;
+ if (type_id == 0) {
+ static const GTypeInfo g_define_type_info = {
+ sizeof (GthFileToolMirrorClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) gth_file_tool_mirror_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL,
+ sizeof (GthFileToolMirror),
+ 0,
+ (GInstanceInitFunc) gth_file_tool_mirror_instance_init,
+ NULL
+ };
+ type_id = g_type_register_static (GTH_TYPE_FILE_TOOL, "GthFileToolMirror", &g_define_type_info, 0);
+ }
+ return type_id;
+}
diff --git a/extensions/file_tools/gth-file-tool-mirror.h b/extensions/file_tools/gth-file-tool-mirror.h
new file mode 100644
index 0000000..23d6d91
--- /dev/null
+++ b/extensions/file_tools/gth-file-tool-mirror.h
@@ -0,0 +1,52 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2009 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef GTH_FILE_TOOL_MIRROR_H
+#define GTH_FILE_TOOL_MIRROR_H
+
+#include <gthumb.h>
+
+G_BEGIN_DECLS
+
+#define GTH_TYPE_FILE_TOOL_MIRROR (gth_file_tool_mirror_get_type ())
+#define GTH_FILE_TOOL_MIRROR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTH_TYPE_FILE_TOOL_MIRROR, GthFileToolMirror))
+#define GTH_FILE_TOOL_MIRROR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTH_TYPE_FILE_TOOL_MIRROR, GthFileToolMirrorClass))
+#define GTH_IS_FILE_TOOL_MIRROR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTH_TYPE_FILE_TOOL_MIRROR))
+#define GTH_IS_FILE_TOOL_MIRROR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTH_TYPE_FILE_TOOL_MIRROR))
+#define GTH_FILE_TOOL_MIRROR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTH_TYPE_FILE_TOOL_MIRROR, GthFileToolMirrorClass))
+
+typedef struct _GthFileToolMirror GthFileToolMirror;
+typedef struct _GthFileToolMirrorClass GthFileToolMirrorClass;
+
+struct _GthFileToolMirror {
+ GthFileTool parent_instance;
+};
+
+struct _GthFileToolMirrorClass {
+ GthFileToolClass parent_class;
+};
+
+GType gth_file_tool_mirror_get_type (void);
+
+G_END_DECLS
+
+#endif /* GTH_FILE_TOOL_MIRROR_H */
diff --git a/extensions/file_tools/gth-file-tool-rotate-left.c b/extensions/file_tools/gth-file-tool-rotate-left.c
new file mode 100644
index 0000000..30146de
--- /dev/null
+++ b/extensions/file_tools/gth-file-tool-rotate-left.c
@@ -0,0 +1,106 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyleft (C) 2009 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <math.h>
+#include <gthumb.h>
+#include <extensions/image_viewer/gth-image-viewer-page.h>
+#include "gth-file-tool-rotate-left.h"
+
+
+static void
+gth_file_tool_rotate_left_activate (GthFileTool *base)
+{
+ GtkWidget *window;
+ GtkWidget *viewer_page;
+ GtkWidget *viewer;
+ GdkPixbuf *src_pixbuf;
+ GdkPixbuf *dest_pixbuf;
+
+ window = gth_file_tool_get_window (base);
+ viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
+ if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
+ return;
+
+ viewer = gth_image_viewer_page_get_image_viewer (GTH_IMAGE_VIEWER_PAGE (viewer_page));
+ src_pixbuf = gth_image_viewer_get_current_pixbuf (GTH_IMAGE_VIEWER (viewer));
+ if (src_pixbuf == NULL)
+ return;
+
+ dest_pixbuf = _gdk_pixbuf_transform (src_pixbuf, GTH_TRANSFORM_ROTATE_270);
+ gth_image_viewer_page_set_pixbuf (GTH_IMAGE_VIEWER_PAGE (viewer_page), dest_pixbuf, TRUE);
+
+ g_object_unref (dest_pixbuf);
+}
+
+
+static void
+gth_file_tool_rotate_left_update_sensitivity (GthFileTool *base)
+{
+ GtkWidget *window;
+ GtkWidget *viewer_page;
+
+ window = gth_file_tool_get_window (base);
+ viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
+ if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
+ gtk_widget_set_sensitive (GTK_WIDGET (base), FALSE);
+ else
+ gtk_widget_set_sensitive (GTK_WIDGET (base), TRUE);
+}
+
+
+static void
+gth_file_tool_rotate_left_instance_init (GthFileToolRotateLeft *self)
+{
+ gth_file_tool_construct (GTH_FILE_TOOL (self), GTK_STOCK_EDIT /* FIXME GTH_STOCK_ROTATE_LEFT */, _("Rotate Left"), NULL, FALSE);
+ /*gtk_widget_set_tooltip_text (GTK_WIDGET (self), _("Automatic white balance correction"));*/
+}
+
+
+static void
+gth_file_tool_rotate_left_class_init (GthFileToolClass *klass)
+{
+ klass->update_sensitivity = gth_file_tool_rotate_left_update_sensitivity;
+ klass->activate = gth_file_tool_rotate_left_activate;
+}
+
+
+GType
+gth_file_tool_rotate_left_get_type (void) {
+ static GType type_id = 0;
+ if (type_id == 0) {
+ static const GTypeInfo g_define_type_info = {
+ sizeof (GthFileToolRotateLeftClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) gth_file_tool_rotate_left_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL,
+ sizeof (GthFileToolRotateLeft),
+ 0,
+ (GInstanceInitFunc) gth_file_tool_rotate_left_instance_init,
+ NULL
+ };
+ type_id = g_type_register_static (GTH_TYPE_FILE_TOOL, "GthFileToolRotateLeft", &g_define_type_info, 0);
+ }
+ return type_id;
+}
diff --git a/extensions/file_tools/gth-file-tool-rotate-left.h b/extensions/file_tools/gth-file-tool-rotate-left.h
new file mode 100644
index 0000000..7e1ff01
--- /dev/null
+++ b/extensions/file_tools/gth-file-tool-rotate-left.h
@@ -0,0 +1,52 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyleft (C) 2009 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef GTH_FILE_TOOL_ROTATE_LEFT_H
+#define GTH_FILE_TOOL_ROTATE_LEFT_H
+
+#include <gthumb.h>
+
+G_BEGIN_DECLS
+
+#define GTH_TYPE_FILE_TOOL_ROTATE_LEFT (gth_file_tool_rotate_left_get_type ())
+#define GTH_FILE_TOOL_ROTATE_LEFT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTH_TYPE_FILE_TOOL_ROTATE_LEFT, GthFileToolRotateLeft))
+#define GTH_FILE_TOOL_ROTATE_LEFT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTH_TYPE_FILE_TOOL_ROTATE_LEFT, GthFileToolRotateLeftClass))
+#define GTH_IS_FILE_TOOL_ROTATE_LEFT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTH_TYPE_FILE_TOOL_ROTATE_LEFT))
+#define GTH_IS_FILE_TOOL_ROTATE_LEFT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTH_TYPE_FILE_TOOL_ROTATE_LEFT))
+#define GTH_FILE_TOOL_ROTATE_LEFT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTH_TYPE_FILE_TOOL_ROTATE_LEFT, GthFileToolRotateLeftClass))
+
+typedef struct _GthFileToolRotateLeft GthFileToolRotateLeft;
+typedef struct _GthFileToolRotateLeftClass GthFileToolRotateLeftClass;
+
+struct _GthFileToolRotateLeft {
+ GthFileTool parent_instance;
+};
+
+struct _GthFileToolRotateLeftClass {
+ GthFileToolClass parent_class;
+};
+
+GType gth_file_tool_rotate_left_get_type (void);
+
+G_END_DECLS
+
+#endif /* GTH_FILE_TOOL_ROTATE_LEFT_H */
diff --git a/extensions/file_tools/gth-file-tool-rotate-right.c b/extensions/file_tools/gth-file-tool-rotate-right.c
new file mode 100644
index 0000000..45e6cd6
--- /dev/null
+++ b/extensions/file_tools/gth-file-tool-rotate-right.c
@@ -0,0 +1,106 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2009 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <math.h>
+#include <gthumb.h>
+#include <extensions/image_viewer/gth-image-viewer-page.h>
+#include "gth-file-tool-rotate-right.h"
+
+
+static void
+gth_file_tool_rotate_right_activate (GthFileTool *base)
+{
+ GtkWidget *window;
+ GtkWidget *viewer_page;
+ GtkWidget *viewer;
+ GdkPixbuf *src_pixbuf;
+ GdkPixbuf *dest_pixbuf;
+
+ window = gth_file_tool_get_window (base);
+ viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
+ if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
+ return;
+
+ viewer = gth_image_viewer_page_get_image_viewer (GTH_IMAGE_VIEWER_PAGE (viewer_page));
+ src_pixbuf = gth_image_viewer_get_current_pixbuf (GTH_IMAGE_VIEWER (viewer));
+ if (src_pixbuf == NULL)
+ return;
+
+ dest_pixbuf = _gdk_pixbuf_transform (src_pixbuf, GTH_TRANSFORM_ROTATE_90);
+ gth_image_viewer_page_set_pixbuf (GTH_IMAGE_VIEWER_PAGE (viewer_page), dest_pixbuf, TRUE);
+
+ g_object_unref (dest_pixbuf);
+}
+
+
+static void
+gth_file_tool_rotate_right_update_sensitivity (GthFileTool *base)
+{
+ GtkWidget *window;
+ GtkWidget *viewer_page;
+
+ window = gth_file_tool_get_window (base);
+ viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
+ if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
+ gtk_widget_set_sensitive (GTK_WIDGET (base), FALSE);
+ else
+ gtk_widget_set_sensitive (GTK_WIDGET (base), TRUE);
+}
+
+
+static void
+gth_file_tool_rotate_right_instance_init (GthFileToolRotateRight *self)
+{
+ gth_file_tool_construct (GTH_FILE_TOOL (self), GTK_STOCK_EDIT /* FIXME GTH_STOCK_ROTATE_RIGHT */, _("Rotate Right"), NULL, FALSE);
+ /*gtk_widget_set_tooltip_text (GTK_WIDGET (self), _("Automatic white balance correction"));*/
+}
+
+
+static void
+gth_file_tool_rotate_right_class_init (GthFileToolClass *klass)
+{
+ klass->update_sensitivity = gth_file_tool_rotate_right_update_sensitivity;
+ klass->activate = gth_file_tool_rotate_right_activate;
+}
+
+
+GType
+gth_file_tool_rotate_right_get_type (void) {
+ static GType type_id = 0;
+ if (type_id == 0) {
+ static const GTypeInfo g_define_type_info = {
+ sizeof (GthFileToolRotateRightClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) gth_file_tool_rotate_right_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL,
+ sizeof (GthFileToolRotateRight),
+ 0,
+ (GInstanceInitFunc) gth_file_tool_rotate_right_instance_init,
+ NULL
+ };
+ type_id = g_type_register_static (GTH_TYPE_FILE_TOOL, "GthFileToolRotateRight", &g_define_type_info, 0);
+ }
+ return type_id;
+}
diff --git a/extensions/file_tools/gth-file-tool-rotate-right.h b/extensions/file_tools/gth-file-tool-rotate-right.h
new file mode 100644
index 0000000..9f45431
--- /dev/null
+++ b/extensions/file_tools/gth-file-tool-rotate-right.h
@@ -0,0 +1,52 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2009 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef GTH_FILE_TOOL_ROTATE_RIGHT_H
+#define GTH_FILE_TOOL_ROTATE_RIGHT_H
+
+#include <gthumb.h>
+
+G_BEGIN_DECLS
+
+#define GTH_TYPE_FILE_TOOL_ROTATE_RIGHT (gth_file_tool_rotate_right_get_type ())
+#define GTH_FILE_TOOL_ROTATE_RIGHT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTH_TYPE_FILE_TOOL_ROTATE_RIGHT, GthFileToolRotateRight))
+#define GTH_FILE_TOOL_ROTATE_RIGHT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTH_TYPE_FILE_TOOL_ROTATE_RIGHT, GthFileToolRotateRightClass))
+#define GTH_IS_FILE_TOOL_ROTATE_RIGHT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTH_TYPE_FILE_TOOL_ROTATE_RIGHT))
+#define GTH_IS_FILE_TOOL_ROTATE_RIGHT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTH_TYPE_FILE_TOOL_ROTATE_RIGHT))
+#define GTH_FILE_TOOL_ROTATE_RIGHT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTH_TYPE_FILE_TOOL_ROTATE_RIGHT, GthFileToolRotateRightClass))
+
+typedef struct _GthFileToolRotateRight GthFileToolRotateRight;
+typedef struct _GthFileToolRotateRightClass GthFileToolRotateRightClass;
+
+struct _GthFileToolRotateRight {
+ GthFileTool parent_instance;
+};
+
+struct _GthFileToolRotateRightClass {
+ GthFileToolClass parent_class;
+};
+
+GType gth_file_tool_rotate_right_get_type (void);
+
+G_END_DECLS
+
+#endif /* GTH_FILE_TOOL_ROTATE_RIGHT_H */
diff --git a/extensions/file_tools/gth-file-tool-save-as.c b/extensions/file_tools/gth-file-tool-save-as.c
index 7413a8c..92d17d5 100644
--- a/extensions/file_tools/gth-file-tool-save-as.c
+++ b/extensions/file_tools/gth-file-tool-save-as.c
@@ -29,9 +29,13 @@ static void
gth_file_tool_save_as_update_sensitivity (GthFileTool *base)
{
GtkWidget *window;
+ gboolean can_save;
window = gth_file_tool_get_window (base);
- gtk_widget_set_sensitive (GTK_WIDGET (base), gth_browser_get_current_file (GTH_BROWSER (window)) != NULL);
+
+ can_save = gth_viewer_page_can_save (gth_browser_get_viewer_page (GTH_BROWSER (window)));
+ can_save = can_save && (gth_browser_get_current_file (GTH_BROWSER (window)) != NULL);
+ gtk_widget_set_sensitive (GTK_WIDGET (base), can_save);
}
diff --git a/extensions/file_tools/main.c b/extensions/file_tools/main.c
index 351b6eb..e32dd25 100644
--- a/extensions/file_tools/main.c
+++ b/extensions/file_tools/main.c
@@ -29,8 +29,12 @@
#include "gth-file-tool-desaturate.h"
#include "gth-file-tool-enhance.h"
#include "gth-file-tool-equalize.h"
+#include "gth-file-tool-flip.h"
+#include "gth-file-tool-mirror.h"
#include "gth-file-tool-negative.h"
#include "gth-file-tool-redo.h"
+#include "gth-file-tool-rotate-left.h"
+#include "gth-file-tool-rotate-right.h"
#include "gth-file-tool-save.h"
#include "gth-file-tool-save-as.h"
#include "gth-file-tool-undo.h"
@@ -43,11 +47,18 @@ gthumb_extension_activate (void)
gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_SAVE_AS);
gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_UNDO);
gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_REDO);
+
gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_ENHANCE);
gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_ADJUST_COLORS);
gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_EQUALIZE);
gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_DESATURATE);
gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_NEGATIVE);
+
+ gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_MIRROR);
+ gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_FLIP);
+ gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_ROTATE_RIGHT);
+ gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_ROTATE_LEFT);
+
gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_CROP);
}
diff --git a/gthumb/gth-viewer-page.c b/gthumb/gth-viewer-page.c
index 5176d39..1e738e8 100644
--- a/gthumb/gth-viewer-page.c
+++ b/gthumb/gth-viewer-page.c
@@ -118,7 +118,12 @@ gth_viewer_page_update_sensitivity (GthViewerPage *self)
gboolean
gth_viewer_page_can_save (GthViewerPage *self)
{
- return GTH_VIEWER_PAGE_GET_INTERFACE (self)->can_save (self);
+ if (self == NULL)
+ return FALSE;
+ if (GTH_VIEWER_PAGE_GET_INTERFACE (self)->can_save != NULL)
+ return GTH_VIEWER_PAGE_GET_INTERFACE (self)->can_save (self);
+ else
+ return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]