added "const gchar *stroke_desc" to the GimpItemClass struct and always

2004-04-15  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpitem.[ch]: added "const gchar *stroke_desc" to
	the GimpItemClass struct and always push an undo group
	around GimpItem::stroke().

	* app/core/gimpchannel.c
	* app/core/gimpselection.c
	* app/vectors/gimpvectors.c: set the stroke_desc accordingly
	and don't push undo groups.

	* app/text/gimptextlayer.c (gimp_text_layer_class_init): set
	all of GimpItemClass' undo_descs.

	* app/text/gimptextlayer-transform.c: don't push undo groups here.
This commit is contained in:
Michael Natterer 2004-04-15 14:41:36 +00:00 committed by Michael Natterer
parent 70a9a84017
commit f41e1ff5d0
8 changed files with 46 additions and 30 deletions

View File

@ -1,3 +1,19 @@
2004-04-15 Michael Natterer <mitch@gimp.org>
* app/core/gimpitem.[ch]: added "const gchar *stroke_desc" to
the GimpItemClass struct and always push an undo group
around GimpItem::stroke().
* app/core/gimpchannel.c
* app/core/gimpselection.c
* app/vectors/gimpvectors.c: set the stroke_desc accordingly
and don't push undo groups.
* app/text/gimptextlayer.c (gimp_text_layer_class_init): set
all of GimpItemClass' undo_descs.
* app/text/gimptextlayer-transform.c: don't push undo groups here.
2004-04-15 Sven Neumann <sven@gimp.org>
* libgimpcolor/gimpcolorspace.c (gimp_rgb_to_hsv): applied patch

View File

@ -262,6 +262,7 @@ gimp_channel_class_init (GimpChannelClass *klass)
item_class->flip_desc = _("Flip Channel");
item_class->rotate_desc = _("Rotate Channel");
item_class->transform_desc = _("Transform Channel");
item_class->stroke_desc = _("Stroke Channel");
drawable_class->invalidate_boundary = gimp_channel_invalidate_boundary;
drawable_class->get_active_components = gimp_channel_get_active_components;

View File

@ -904,6 +904,7 @@ gimp_item_stroke (GimpItem *item,
gboolean use_default_values)
{
GimpItemClass *item_class;
gboolean retval = FALSE;
g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
@ -914,10 +915,19 @@ gimp_item_stroke (GimpItem *item,
item_class = GIMP_ITEM_GET_CLASS (item);
if (item_class->stroke)
return item_class->stroke (item, drawable, context,
stroke_desc, use_default_values);
{
GimpImage *gimage = gimp_item_get_image (item);
return FALSE;
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_PAINT,
item_class->stroke_desc);
retval = item_class->stroke (item, drawable, context,
stroke_desc, use_default_values);
gimp_image_undo_group_end (gimage);
}
return retval;
}
gint

View File

@ -128,6 +128,7 @@ struct _GimpItemClass
const gchar *flip_desc;
const gchar *rotate_desc;
const gchar *transform_desc;
const gchar *stroke_desc;
};

View File

@ -183,6 +183,7 @@ gimp_selection_class_init (GimpSelectionClass *klass)
item_class->rotate = gimp_selection_rotate;
item_class->stroke = gimp_selection_stroke;
item_class->translate_desc = _("Move Selection");
item_class->stroke_desc = _("Stroke Selection");
drawable_class->invalidate_boundary = gimp_selection_invalidate_boundary;
@ -297,7 +298,6 @@ gimp_selection_stroke (GimpItem *item,
gboolean use_default_values)
{
GimpSelection *selection = GIMP_SELECTION (item);
GimpImage *gimage;
const BoundSeg *dummy_in;
const BoundSeg *dummy_out;
gint num_dummy_in;
@ -313,19 +313,12 @@ gimp_selection_stroke (GimpItem *item,
return FALSE;
}
gimage = gimp_item_get_image (item);
selection->stroking = TRUE;
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_PAINT,
_("Stroke Selection"));
retval = GIMP_ITEM_CLASS (parent_class)->stroke (item, drawable, context,
stroke_desc,
use_default_values);
gimp_image_undo_group_end (gimage);
selection->stroking = FALSE;
return retval;

View File

@ -53,11 +53,7 @@ gimp_text_layer_flip (GimpItem *item,
gdouble axis,
gboolean clip_result)
{
GimpLayer *layer = GIMP_LAYER (item);
GimpImage *gimage = gimp_item_get_image (item);
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM,
_("Flip Text Layer"));
GimpLayer *layer = GIMP_LAYER (item);
{
GimpText *text = GIMP_TEXT_LAYER (item)->text;
@ -81,13 +77,10 @@ gimp_text_layer_flip (GimpItem *item,
g_object_notify (G_OBJECT (text), "transformation");
}
/* If there is a layer mask, make sure it gets flipped as well */
if (layer->mask)
gimp_item_flip (GIMP_ITEM (layer->mask), context,
flip_type, axis, clip_result);
gimp_image_undo_group_end (gimage);
/* Make sure we're not caching any old selection info */
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (layer));
}
@ -100,13 +93,9 @@ gimp_text_layer_rotate (GimpItem *item,
gdouble center_y,
gboolean clip_result)
{
GimpLayer *layer = GIMP_LAYER (item);
GimpImage *gimage = gimp_item_get_image (item);
gdouble cos = 1.0;
gdouble sin = 0.0;
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM,
_("Rotate Text Layer"));
GimpLayer *layer = GIMP_LAYER (item);
gdouble cos = 1.0;
gdouble sin = 0.0;
switch (rotate_type)
{
@ -137,13 +126,10 @@ gimp_text_layer_rotate (GimpItem *item,
g_object_notify (G_OBJECT (text), "transformation");
}
/* If there is a layer mask, make sure it gets rotates as well */
if (layer->mask)
gimp_item_rotate (GIMP_ITEM (layer->mask), context,
rotate_type, center_x, center_y, clip_result);
gimp_image_undo_group_end (gimage);
/* Make sure we're not caching any old selection info */
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (layer));
}

View File

@ -157,7 +157,6 @@ gimp_text_layer_class_init (GimpTextLayerClass *klass)
viewable_class->default_stock_id = "gimp-text-layer";
item_class->default_name = _("Text Layer");
item_class->duplicate = gimp_text_layer_duplicate;
item_class->rename = gimp_text_layer_rename;
@ -168,6 +167,15 @@ gimp_text_layer_class_init (GimpTextLayerClass *klass)
item_class->transform = gimp_text_layer_transform;
#endif
item_class->default_name = _("Text Layer");
item_class->rename_desc = _("Rename Text Layer");
item_class->translate_desc = _("Move Text Layer");
item_class->scale_desc = _("Scale Text Layer");
item_class->resize_desc = _("Resize Text Layer");
item_class->flip_desc = _("Flip Text Layer");
item_class->rotate_desc = _("Rotate Text Layer");
item_class->transform_desc = _("Transform Text Layer");
drawable_class->set_tiles = gimp_text_layer_set_tiles;
drawable_class->push_undo = gimp_text_layer_push_undo;

View File

@ -241,6 +241,7 @@ gimp_vectors_class_init (GimpVectorsClass *klass)
item_class->flip_desc = _("Flip Path");
item_class->rotate_desc = _("Rotate Path");
item_class->transform_desc = _("Transform Path");
item_class->stroke_desc = _("Stroke Path");
klass->freeze = NULL;
klass->thaw = gimp_vectors_real_thaw;