[gimp/soc-2012-unified-transformation: 12/12] implement flip horiz/vert context funcs
- From: Mikael Magnusson <mikachu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/soc-2012-unified-transformation: 12/12] implement flip horiz/vert context funcs
- Date: Wed, 22 Aug 2012 21:13:14 +0000 (UTC)
commit 9d24970265e5aa5ebfae87f995f5c0e40aa14d62
Author: Mikael Magnusson <mikachu src gnome org>
Date: Tue Aug 21 16:56:53 2012 +0200
implement flip horiz/vert context funcs
app/actions/unified-transform-tool-actions.c | 5 +++++
app/actions/unified-transform-tool-commands.c | 11 ++++++++++-
app/actions/unified-transform-tool-commands.h | 2 ++
app/tools/gimpunifiedtransformtool.c | 13 ++++++++++++-
app/tools/gimpunifiedtransformtool.h | 2 +-
menus/unified-transform-tool-menu.xml | 1 +
6 files changed, 31 insertions(+), 3 deletions(-)
---
diff --git a/app/actions/unified-transform-tool-actions.c b/app/actions/unified-transform-tool-actions.c
index a33bb94..56c9f4e 100644
--- a/app/actions/unified-transform-tool-actions.c
+++ b/app/actions/unified-transform-tool-actions.c
@@ -54,6 +54,11 @@ static const GimpActionEntry unified_transform_tool_actions[] =
G_CALLBACK (unified_transform_tool_flip_horiz_callback),
NULL },
+ { "unified-transform-tool-flip-vert", GTK_STOCK_CUT,
+ NC_("unified-transform-tool-action", "Flip Vertically"), NULL, NULL,
+ G_CALLBACK (unified_transform_tool_flip_vert_callback),
+ NULL },
+
{ "unified-transform-tool-summon-pivot", GTK_STOCK_COPY,
NC_("unified-transform-tool-action", "Put pivot here"), NULL, NULL,
G_CALLBACK (unified_transform_tool_summon_pivot_callback),
diff --git a/app/actions/unified-transform-tool-commands.c b/app/actions/unified-transform-tool-commands.c
index 400e439..dc83574 100644
--- a/app/actions/unified-transform-tool-commands.c
+++ b/app/actions/unified-transform-tool-commands.c
@@ -48,7 +48,16 @@ unified_transform_tool_flip_horiz_callback (GtkAction *action,
{
GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (data);
- gimp_unified_transform_tool_flip_horiz (tr_tool);
+ gimp_unified_transform_tool_flip (tr_tool, FALSE);
+}
+
+void
+unified_transform_tool_flip_vert_callback (GtkAction *action,
+ gpointer data)
+{
+ GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (data);
+
+ gimp_unified_transform_tool_flip (tr_tool, TRUE);
}
void
diff --git a/app/actions/unified-transform-tool-commands.h b/app/actions/unified-transform-tool-commands.h
index 5380795..f73a3bc 100644
--- a/app/actions/unified-transform-tool-commands.h
+++ b/app/actions/unified-transform-tool-commands.h
@@ -20,6 +20,8 @@
void unified_transform_tool_flip_horiz_callback (GtkAction *action,
gpointer data);
+void unified_transform_tool_flip_vert_callback (GtkAction *action,
+ gpointer data);
void unified_transform_tool_summon_pivot_callback (GtkAction *action,
gpointer data);
diff --git a/app/tools/gimpunifiedtransformtool.c b/app/tools/gimpunifiedtransformtool.c
index f42f0a5..d8bde43 100644
--- a/app/tools/gimpunifiedtransformtool.c
+++ b/app/tools/gimpunifiedtransformtool.c
@@ -1185,9 +1185,20 @@ gimp_unified_transform_tool_get_popup (GimpTool *tool,
return ut_tool->ui_manager;
}
-void gimp_unified_transform_tool_flip_horiz (GimpTransformTool *tr_tool)
+void gimp_unified_transform_tool_flip (GimpTransformTool *tr_tool, gboolean vertical)
{
GimpUnifiedTransformTool *ut_tool = GIMP_UNIFIED_TRANSFORM_TOOL (tr_tool);
+ gint i;
+
+ gimp_draw_tool_pause (GIMP_DRAW_TOOL (tr_tool));
+
+ for (i = 0; i < 4; i++)
+ tr_tool->trans_info[X0+i*2+vertical] = 2 * tr_tool->trans_info[PIVOT_X+vertical] - tr_tool->trans_info[X0+i*2+vertical];
+
+ gimp_transform_tool_recalc_matrix (tr_tool);
+ gimp_transform_tool_push_internal_undo (tr_tool);
+
+ gimp_draw_tool_resume (GIMP_DRAW_TOOL (tr_tool));
}
void gimp_unified_transform_tool_summon_pivot (GimpTransformTool *tr_tool)
diff --git a/app/tools/gimpunifiedtransformtool.h b/app/tools/gimpunifiedtransformtool.h
index 6c7c180..c120003 100644
--- a/app/tools/gimpunifiedtransformtool.h
+++ b/app/tools/gimpunifiedtransformtool.h
@@ -54,7 +54,7 @@ void gimp_unified_transform_tool_register (GimpToolRegisterCallback callback
GType gimp_unified_transform_tool_get_type (void) G_GNUC_CONST;
-void gimp_unified_transform_tool_flip_horiz (GimpTransformTool *tr_tool);
+void gimp_unified_transform_tool_flip (GimpTransformTool *tr_tool, gboolean vertical);
void gimp_unified_transform_tool_summon_pivot (GimpTransformTool *tr_tool);
diff --git a/menus/unified-transform-tool-menu.xml b/menus/unified-transform-tool-menu.xml
index 7d57fbf..7b8459f 100644
--- a/menus/unified-transform-tool-menu.xml
+++ b/menus/unified-transform-tool-menu.xml
@@ -4,6 +4,7 @@
<ui>
<popup action="unified-transform-tool-popup">
<menuitem action="unified-transform-tool-flip-horiz" />
+ <menuitem action="unified-transform-tool-flip-vert" />
<separator />
<menuitem action="unified-transform-tool-summon-pivot" />
</popup>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]