[gimp] Make all vectors PDB manipulation undoable
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Make all vectors PDB manipulation undoable
- Date: Fri, 21 Aug 2009 16:23:02 +0000 (UTC)
commit 45aa584b3e518b45f63d3678d310f7ffb482a016
Author: Michael Natterer <mitch gimp org>
Date: Fri Aug 21 17:57:56 2009 +0200
Make all vectors PDB manipulation undoable
app/pdb/vectors-cmds.c | 99 +++++++++++++++++++++++++++++++++++++++---
tools/pdbgen/pdb/vectors.pdb | 99 +++++++++++++++++++++++++++++++++++++++---
2 files changed, 184 insertions(+), 14 deletions(-)
---
diff --git a/app/pdb/vectors-cmds.c b/app/pdb/vectors-cmds.c
index c62ac10..9d24976 100644
--- a/app/pdb/vectors-cmds.c
+++ b/app/pdb/vectors-cmds.c
@@ -26,6 +26,7 @@
#include "pdb-types.h"
#include "core/gimpchannel-select.h"
+#include "core/gimpimage-undo-push.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
#include "core/gimplist.h"
@@ -634,7 +635,14 @@ vectors_remove_stroke_invoker (GimpProcedure *procedure,
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
- gimp_vectors_stroke_remove (vectors, stroke);
+ {
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Remove path stroke"),
+ vectors);
+
+ gimp_vectors_stroke_remove (vectors, stroke);
+ }
else
success = FALSE;
}
@@ -663,7 +671,14 @@ vectors_stroke_close_invoker (GimpProcedure *procedure,
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
- gimp_stroke_close (stroke);
+ {
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Close path stroke"),
+ vectors);
+
+ gimp_stroke_close (stroke);
+ }
else
success = FALSE;
}
@@ -696,7 +711,14 @@ vectors_stroke_translate_invoker (GimpProcedure *procedure,
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
- gimp_stroke_translate (stroke, off_x, off_y);
+ {
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Translate path stroke"),
+ vectors);
+
+ gimp_stroke_translate (stroke, off_x, off_y);
+ }
else
success = FALSE;
}
@@ -729,7 +751,14 @@ vectors_stroke_scale_invoker (GimpProcedure *procedure,
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
- gimp_stroke_scale (stroke, scale_x, scale_y);
+ {
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Scale path stroke"),
+ vectors);
+
+ gimp_stroke_scale (stroke, scale_x, scale_y);
+ }
else
success = FALSE;
}
@@ -764,7 +793,14 @@ vectors_stroke_rotate_invoker (GimpProcedure *procedure,
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
- gimp_stroke_rotate (stroke, center_x, center_y, angle);
+ {
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Rotate path stroke"),
+ vectors);
+
+ gimp_stroke_rotate (stroke, center_x, center_y, angle);
+ }
else
success = FALSE;
}
@@ -797,7 +833,14 @@ vectors_stroke_flip_invoker (GimpProcedure *procedure,
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
- gimp_stroke_flip (stroke, flip_type, axis);
+ {
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Flip path stroke"),
+ vectors);
+
+ gimp_stroke_flip (stroke, flip_type, axis);
+ }
else
success = FALSE;
}
@@ -834,7 +877,14 @@ vectors_stroke_flip_free_invoker (GimpProcedure *procedure,
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
- gimp_stroke_flip_free (stroke, x1, y1, x2, y2);
+ {
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Flip path stroke"),
+ vectors);
+
+ gimp_stroke_flip_free (stroke, x1, y1, x2, y2);
+ }
else
success = FALSE;
}
@@ -957,7 +1007,13 @@ vectors_stroke_new_from_points_invoker (GimpProcedure *procedure,
stroke = gimp_stroke_new_from_coords (type, coords, num_points/2, closed);
if (stroke)
{
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Add path stroke"),
+ vectors);
+
gimp_vectors_stroke_add (vectors, stroke);
+
stroke_id = gimp_stroke_get_ID (stroke);
success = TRUE;
@@ -1069,7 +1125,14 @@ vectors_bezier_stroke_new_moveto_invoker (GimpProcedure *procedure,
coord0.y = y0;
stroke = gimp_bezier_stroke_new_moveto (&coord0);
+
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Add path stroke"),
+ vectors);
+
gimp_vectors_stroke_add (vectors, stroke);
+
stroke_id = gimp_stroke_get_ID (stroke);
}
@@ -1112,6 +1175,11 @@ vectors_bezier_stroke_lineto_invoker (GimpProcedure *procedure,
coord0.x = x0;
coord0.y = y0;
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Extend path stroke"),
+ vectors);
+
gimp_bezier_stroke_lineto (stroke, &coord0);
}
else
@@ -1160,6 +1228,11 @@ vectors_bezier_stroke_conicto_invoker (GimpProcedure *procedure,
coord1.x = x1;
coord1.y = y1;
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Extend path stroke"),
+ vectors);
+
gimp_bezier_stroke_conicto (stroke, &coord0, &coord1);
}
else
@@ -1216,6 +1289,11 @@ vectors_bezier_stroke_cubicto_invoker (GimpProcedure *procedure,
coord2.x = x2;
coord2.y = y2;
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Extend path stroke"),
+ vectors);
+
gimp_bezier_stroke_cubicto (stroke, &coord0, &coord1, &coord2);
}
else
@@ -1260,7 +1338,14 @@ vectors_bezier_stroke_new_ellipse_invoker (GimpProcedure *procedure,
coord0.y = y0;
stroke = gimp_bezier_stroke_new_ellipse (&coord0, radius_x, radius_y, angle);
+
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Add path stroke"),
+ vectors);
+
gimp_vectors_stroke_add (vectors, stroke);
+
stroke_id = gimp_stroke_get_ID (stroke);
}
diff --git a/tools/pdbgen/pdb/vectors.pdb b/tools/pdbgen/pdb/vectors.pdb
index 1bf8459..9572b1e 100644
--- a/tools/pdbgen/pdb/vectors.pdb
+++ b/tools/pdbgen/pdb/vectors.pdb
@@ -574,7 +574,14 @@ HELP
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
- gimp_vectors_stroke_remove (vectors, stroke);
+ {
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Remove path stroke"),
+ vectors);
+
+ gimp_vectors_stroke_remove (vectors, stroke);
+ }
else
success = FALSE;
}
@@ -604,7 +611,14 @@ HELP
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
- gimp_stroke_close (stroke);
+ {
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Close path stroke"),
+ vectors);
+
+ gimp_stroke_close (stroke);
+ }
else
success = FALSE;
}
@@ -639,7 +653,14 @@ HELP
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
- gimp_stroke_translate (stroke, off_x, off_y);
+ {
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Translate path stroke"),
+ vectors);
+
+ gimp_stroke_translate (stroke, off_x, off_y);
+ }
else
success = FALSE;
}
@@ -673,7 +694,14 @@ HELP
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
- gimp_stroke_scale (stroke, scale_x, scale_y);
+ {
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Scale path stroke"),
+ vectors);
+
+ gimp_stroke_scale (stroke, scale_x, scale_y);
+ }
else
success = FALSE;
}
@@ -708,7 +736,14 @@ HELP
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
- gimp_stroke_rotate (stroke, center_x, center_y, angle);
+ {
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Rotate path stroke"),
+ vectors);
+
+ gimp_stroke_rotate (stroke, center_x, center_y, angle);
+ }
else
success = FALSE;
}
@@ -742,7 +777,14 @@ HELP
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
- gimp_stroke_flip (stroke, flip_type, axis);
+ {
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Flip path stroke"),
+ vectors);
+
+ gimp_stroke_flip (stroke, flip_type, axis);
+ }
else
success = FALSE;
}
@@ -781,7 +823,14 @@ HELP
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
- gimp_stroke_flip_free (stroke, x1, y1, x2, y2);
+ {
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Flip path stroke"),
+ vectors);
+
+ gimp_stroke_flip_free (stroke, x1, y1, x2, y2);
+ }
else
success = FALSE;
}
@@ -980,7 +1029,13 @@ HELP
stroke = gimp_stroke_new_from_coords (type, coords, num_points/2, closed);
if (stroke)
{
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Add path stroke"),
+ vectors);
+
gimp_vectors_stroke_add (vectors, stroke);
+
stroke_id = gimp_stroke_get_ID (stroke);
success = TRUE;
@@ -1026,7 +1081,14 @@ HELP
coord0.y = y0;
stroke = gimp_bezier_stroke_new_moveto (&coord0);
+
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Add path stroke"),
+ vectors);
+
gimp_vectors_stroke_add (vectors, stroke);
+
stroke_id = gimp_stroke_get_ID (stroke);
}
CODE
@@ -1065,6 +1127,11 @@ HELP
coord0.x = x0;
coord0.y = y0;
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Extend path stroke"),
+ vectors);
+
gimp_bezier_stroke_lineto (stroke, &coord0);
}
else
@@ -1116,6 +1183,11 @@ HELP
coord1.x = x1;
coord1.y = y1;
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Extend path stroke"),
+ vectors);
+
gimp_bezier_stroke_conicto (stroke, &coord0, &coord1);
}
else
@@ -1173,6 +1245,11 @@ HELP
coord2.x = x2;
coord2.y = y2;
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Extend path stroke"),
+ vectors);
+
gimp_bezier_stroke_cubicto (stroke, &coord0, &coord1, &coord2);
}
else
@@ -1222,7 +1299,14 @@ HELP
coord0.y = y0;
stroke = gimp_bezier_stroke_new_ellipse (&coord0, radius_x, radius_y, angle);
+
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Add path stroke"),
+ vectors);
+
gimp_vectors_stroke_add (vectors, stroke);
+
stroke_id = gimp_stroke_get_ID (stroke);
}
CODE
@@ -1476,6 +1560,7 @@ CODE
@headers = qw(<string.h>
"core/gimplist.h"
"core/gimpimage.h"
+ "core/gimpimage-undo-push.h"
"core/gimpchannel-select.h"
"text/gimptext-vectors.h"
"text/gimptextlayer.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]