mirror of https://github.com/GNOME/gimp.git
replaced GIMP_UNDO_LAYER_MOD and GIMP_UNDO_CHANNEL_MOD by
2004-03-15 Michael Natterer <mitch@gimp.org> * app/core/core-enums.[ch] (enum GimpUndoType): replaced GIMP_UNDO_LAYER_MOD and GIMP_UNDO_CHANNEL_MOD by GIMP_UNDO_DRAWABLE_MOD. * app/core/gimpimage-undo-push.[ch]: ditto: replaced gimp_image_undo_push_layer_mod() and gimp_image_undo_push_channel_mod() by gimp_image_undo_push_drawable_mod(). * app/core/gimpdrawable.[ch]: added undo_desc strings for "resize" and "scale" to the GimpDrawableClass struct. (gimp_drawable_scale) (gimp_drawable_resize): pass push_undo = TRUE to gimp_drawable_set_tiles_full() and use the undo_desc from the class. (gimp_drawable_real_set_tiles): push a GIMP_UNDO_DRAWABLE_MOD here... * app/core/gimpchannel.c * app/core/gimplayer.c: ...and don't push undos in GimpItem::scale(), GimpItem::resize(), GimpDrawable::set_tiles(). * app/core/gimpchannel.c: Removed even more bounds_known = FALSE assignments from functions which already call gimp_drawable_set_tiles().
This commit is contained in:
parent
59b77c35c2
commit
5ef7c7746d
29
ChangeLog
29
ChangeLog
|
@ -1,3 +1,32 @@
|
||||||
|
2004-03-15 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
|
* app/core/core-enums.[ch] (enum GimpUndoType): replaced
|
||||||
|
GIMP_UNDO_LAYER_MOD and GIMP_UNDO_CHANNEL_MOD by
|
||||||
|
GIMP_UNDO_DRAWABLE_MOD.
|
||||||
|
|
||||||
|
* app/core/gimpimage-undo-push.[ch]: ditto: replaced
|
||||||
|
gimp_image_undo_push_layer_mod() and
|
||||||
|
gimp_image_undo_push_channel_mod() by
|
||||||
|
gimp_image_undo_push_drawable_mod().
|
||||||
|
|
||||||
|
* app/core/gimpdrawable.[ch]: added undo_desc strings for "resize"
|
||||||
|
and "scale" to the GimpDrawableClass struct.
|
||||||
|
|
||||||
|
(gimp_drawable_scale)
|
||||||
|
(gimp_drawable_resize): pass push_undo = TRUE to
|
||||||
|
gimp_drawable_set_tiles_full() and use the undo_desc from the
|
||||||
|
class.
|
||||||
|
|
||||||
|
(gimp_drawable_real_set_tiles): push a GIMP_UNDO_DRAWABLE_MOD here...
|
||||||
|
|
||||||
|
* app/core/gimpchannel.c
|
||||||
|
* app/core/gimplayer.c: ...and don't push undos in
|
||||||
|
GimpItem::scale(), GimpItem::resize(), GimpDrawable::set_tiles().
|
||||||
|
|
||||||
|
* app/core/gimpchannel.c: Removed even more bounds_known = FALSE
|
||||||
|
assignments from functions which already call
|
||||||
|
gimp_drawable_set_tiles().
|
||||||
|
|
||||||
2004-03-15 Michael Natterer <mitch@gimp.org>
|
2004-03-15 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
* app/core/gimpdrawable.c (gimp_drawable_set_tiles_full): emit
|
* app/core/gimpdrawable.c (gimp_drawable_set_tiles_full): emit
|
||||||
|
|
|
@ -618,7 +618,8 @@ static const GEnumValue gimp_undo_type_enum_values[] =
|
||||||
{ GIMP_UNDO_IMAGE_GRID, N_("Grid"), "image-grid" },
|
{ GIMP_UNDO_IMAGE_GRID, N_("Grid"), "image-grid" },
|
||||||
{ GIMP_UNDO_IMAGE_GUIDE, N_("Guide"), "image-guide" },
|
{ GIMP_UNDO_IMAGE_GUIDE, N_("Guide"), "image-guide" },
|
||||||
{ GIMP_UNDO_IMAGE_COLORMAP, N_("Change Indexed Palette"), "image-colormap" },
|
{ GIMP_UNDO_IMAGE_COLORMAP, N_("Change Indexed Palette"), "image-colormap" },
|
||||||
{ GIMP_UNDO_DRAWABLE, N_("Drawable Mod"), "drawable" },
|
{ GIMP_UNDO_DRAWABLE, N_("Drawable"), "drawable" },
|
||||||
|
{ GIMP_UNDO_DRAWABLE_MOD, N_("Drawable Mod"), "drawable-mod" },
|
||||||
{ GIMP_UNDO_MASK, N_("Selection Mask"), "mask" },
|
{ GIMP_UNDO_MASK, N_("Selection Mask"), "mask" },
|
||||||
{ GIMP_UNDO_ITEM_RENAME, N_("Rename Item"), "item-rename" },
|
{ GIMP_UNDO_ITEM_RENAME, N_("Rename Item"), "item-rename" },
|
||||||
{ GIMP_UNDO_ITEM_DISPLACE, N_("Move Item"), "item-displace" },
|
{ GIMP_UNDO_ITEM_DISPLACE, N_("Move Item"), "item-displace" },
|
||||||
|
@ -626,7 +627,6 @@ static const GEnumValue gimp_undo_type_enum_values[] =
|
||||||
{ GIMP_UNDO_ITEM_LINKED, N_("Set Item Linked"), "item-linked" },
|
{ GIMP_UNDO_ITEM_LINKED, N_("Set Item Linked"), "item-linked" },
|
||||||
{ GIMP_UNDO_LAYER_ADD, N_("New Layer"), "layer-add" },
|
{ GIMP_UNDO_LAYER_ADD, N_("New Layer"), "layer-add" },
|
||||||
{ GIMP_UNDO_LAYER_REMOVE, N_("Delete Layer"), "layer-remove" },
|
{ GIMP_UNDO_LAYER_REMOVE, N_("Delete Layer"), "layer-remove" },
|
||||||
{ GIMP_UNDO_LAYER_MOD, N_("Layer Mod"), "layer-mod" },
|
|
||||||
{ GIMP_UNDO_LAYER_MASK_ADD, N_("Add Layer Mask"), "layer-mask-add" },
|
{ GIMP_UNDO_LAYER_MASK_ADD, N_("Add Layer Mask"), "layer-mask-add" },
|
||||||
{ GIMP_UNDO_LAYER_MASK_REMOVE, N_("Delete Layer Mask"), "layer-mask-remove" },
|
{ GIMP_UNDO_LAYER_MASK_REMOVE, N_("Delete Layer Mask"), "layer-mask-remove" },
|
||||||
{ GIMP_UNDO_LAYER_REPOSITION, N_("Reposition Layer"), "layer-reposition" },
|
{ GIMP_UNDO_LAYER_REPOSITION, N_("Reposition Layer"), "layer-reposition" },
|
||||||
|
@ -636,7 +636,6 @@ static const GEnumValue gimp_undo_type_enum_values[] =
|
||||||
{ GIMP_UNDO_TEXT_LAYER, N_("Text"), "text-layer" },
|
{ GIMP_UNDO_TEXT_LAYER, N_("Text"), "text-layer" },
|
||||||
{ GIMP_UNDO_CHANNEL_ADD, N_("New Channel"), "channel-add" },
|
{ GIMP_UNDO_CHANNEL_ADD, N_("New Channel"), "channel-add" },
|
||||||
{ GIMP_UNDO_CHANNEL_REMOVE, N_("Delete Channel"), "channel-remove" },
|
{ GIMP_UNDO_CHANNEL_REMOVE, N_("Delete Channel"), "channel-remove" },
|
||||||
{ GIMP_UNDO_CHANNEL_MOD, N_("Channel Mod"), "channel-mod" },
|
|
||||||
{ GIMP_UNDO_CHANNEL_REPOSITION, N_("Reposition Channel"), "channel-reposition" },
|
{ GIMP_UNDO_CHANNEL_REPOSITION, N_("Reposition Channel"), "channel-reposition" },
|
||||||
{ GIMP_UNDO_CHANNEL_COLOR, N_("Channel Color"), "channel-color" },
|
{ GIMP_UNDO_CHANNEL_COLOR, N_("Channel Color"), "channel-color" },
|
||||||
{ GIMP_UNDO_VECTORS_ADD, N_("New Vectors"), "vectors-add" },
|
{ GIMP_UNDO_VECTORS_ADD, N_("New Vectors"), "vectors-add" },
|
||||||
|
|
|
@ -453,7 +453,8 @@ typedef enum /*< pdb-skip >*/
|
||||||
GIMP_UNDO_IMAGE_GRID, /*< desc="Grid" >*/
|
GIMP_UNDO_IMAGE_GRID, /*< desc="Grid" >*/
|
||||||
GIMP_UNDO_IMAGE_GUIDE, /*< desc="Guide" >*/
|
GIMP_UNDO_IMAGE_GUIDE, /*< desc="Guide" >*/
|
||||||
GIMP_UNDO_IMAGE_COLORMAP, /*< desc="Change Indexed Palette" >*/
|
GIMP_UNDO_IMAGE_COLORMAP, /*< desc="Change Indexed Palette" >*/
|
||||||
GIMP_UNDO_DRAWABLE, /*< desc="Drawable Mod" >*/
|
GIMP_UNDO_DRAWABLE, /*< desc="Drawable" >*/
|
||||||
|
GIMP_UNDO_DRAWABLE_MOD, /*< desc="Drawable Mod" >*/
|
||||||
GIMP_UNDO_MASK, /*< desc="Selection Mask" >*/
|
GIMP_UNDO_MASK, /*< desc="Selection Mask" >*/
|
||||||
GIMP_UNDO_ITEM_RENAME, /*< desc="Rename Item" >*/
|
GIMP_UNDO_ITEM_RENAME, /*< desc="Rename Item" >*/
|
||||||
GIMP_UNDO_ITEM_DISPLACE, /*< desc="Move Item" >*/
|
GIMP_UNDO_ITEM_DISPLACE, /*< desc="Move Item" >*/
|
||||||
|
@ -461,7 +462,6 @@ typedef enum /*< pdb-skip >*/
|
||||||
GIMP_UNDO_ITEM_LINKED, /*< desc="Set Item Linked" >*/
|
GIMP_UNDO_ITEM_LINKED, /*< desc="Set Item Linked" >*/
|
||||||
GIMP_UNDO_LAYER_ADD, /*< desc="New Layer" >*/
|
GIMP_UNDO_LAYER_ADD, /*< desc="New Layer" >*/
|
||||||
GIMP_UNDO_LAYER_REMOVE, /*< desc="Delete Layer" >*/
|
GIMP_UNDO_LAYER_REMOVE, /*< desc="Delete Layer" >*/
|
||||||
GIMP_UNDO_LAYER_MOD, /*< desc="Layer Mod" >*/
|
|
||||||
GIMP_UNDO_LAYER_MASK_ADD, /*< desc="Add Layer Mask" >*/
|
GIMP_UNDO_LAYER_MASK_ADD, /*< desc="Add Layer Mask" >*/
|
||||||
GIMP_UNDO_LAYER_MASK_REMOVE, /*< desc="Delete Layer Mask" >*/
|
GIMP_UNDO_LAYER_MASK_REMOVE, /*< desc="Delete Layer Mask" >*/
|
||||||
GIMP_UNDO_LAYER_REPOSITION, /*< desc="Reposition Layer" >*/
|
GIMP_UNDO_LAYER_REPOSITION, /*< desc="Reposition Layer" >*/
|
||||||
|
@ -471,7 +471,6 @@ typedef enum /*< pdb-skip >*/
|
||||||
GIMP_UNDO_TEXT_LAYER, /*< desc="Text" >*/
|
GIMP_UNDO_TEXT_LAYER, /*< desc="Text" >*/
|
||||||
GIMP_UNDO_CHANNEL_ADD, /*< desc="New Channel" >*/
|
GIMP_UNDO_CHANNEL_ADD, /*< desc="New Channel" >*/
|
||||||
GIMP_UNDO_CHANNEL_REMOVE, /*< desc="Delete Channel" >*/
|
GIMP_UNDO_CHANNEL_REMOVE, /*< desc="Delete Channel" >*/
|
||||||
GIMP_UNDO_CHANNEL_MOD, /*< desc="Channel Mod" >*/
|
|
||||||
GIMP_UNDO_CHANNEL_REPOSITION, /*< desc="Reposition Channel" >*/
|
GIMP_UNDO_CHANNEL_REPOSITION, /*< desc="Reposition Channel" >*/
|
||||||
GIMP_UNDO_CHANNEL_COLOR, /*< desc="Channel Color" >*/
|
GIMP_UNDO_CHANNEL_COLOR, /*< desc="Channel Color" >*/
|
||||||
GIMP_UNDO_VECTORS_ADD, /*< desc="New Vectors" >*/
|
GIMP_UNDO_VECTORS_ADD, /*< desc="New Vectors" >*/
|
||||||
|
|
|
@ -265,6 +265,8 @@ gimp_channel_class_init (GimpChannelClass *klass)
|
||||||
drawable_class->replace_region = gimp_channel_replace_region;
|
drawable_class->replace_region = gimp_channel_replace_region;
|
||||||
drawable_class->set_tiles = gimp_channel_set_tiles;
|
drawable_class->set_tiles = gimp_channel_set_tiles;
|
||||||
drawable_class->swap_pixels = gimp_channel_swap_pixels;
|
drawable_class->swap_pixels = gimp_channel_swap_pixels;
|
||||||
|
drawable_class->scale_desc = _("Scale Channel");
|
||||||
|
drawable_class->resize_desc = _("Resize Channel");
|
||||||
|
|
||||||
klass->boundary = gimp_channel_real_boundary;
|
klass->boundary = gimp_channel_real_boundary;
|
||||||
klass->bounds = gimp_channel_real_bounds;
|
klass->bounds = gimp_channel_real_bounds;
|
||||||
|
@ -495,12 +497,6 @@ gimp_channel_scale (GimpItem *item,
|
||||||
GimpProgressFunc progress_callback,
|
GimpProgressFunc progress_callback,
|
||||||
gpointer progress_data)
|
gpointer progress_data)
|
||||||
{
|
{
|
||||||
GimpChannel *channel = GIMP_CHANNEL (item);
|
|
||||||
|
|
||||||
gimp_image_undo_push_channel_mod (gimp_item_get_image (item),
|
|
||||||
_("Scale Channel"),
|
|
||||||
channel);
|
|
||||||
|
|
||||||
if (G_TYPE_FROM_INSTANCE (item) == GIMP_TYPE_CHANNEL)
|
if (G_TYPE_FROM_INSTANCE (item) == GIMP_TYPE_CHANNEL)
|
||||||
{
|
{
|
||||||
new_offset_x = 0;
|
new_offset_x = 0;
|
||||||
|
@ -511,9 +507,6 @@ gimp_channel_scale (GimpItem *item,
|
||||||
new_offset_x, new_offset_y,
|
new_offset_x, new_offset_y,
|
||||||
interpolation_type,
|
interpolation_type,
|
||||||
progress_callback, progress_data);
|
progress_callback, progress_data);
|
||||||
|
|
||||||
/* bounds are now unknown */
|
|
||||||
channel->bounds_known = FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -523,12 +516,6 @@ gimp_channel_resize (GimpItem *item,
|
||||||
gint offset_x,
|
gint offset_x,
|
||||||
gint offset_y)
|
gint offset_y)
|
||||||
{
|
{
|
||||||
GimpChannel *channel = GIMP_CHANNEL (item);
|
|
||||||
|
|
||||||
gimp_image_undo_push_channel_mod (gimp_item_get_image (item),
|
|
||||||
_("Resize Channel"),
|
|
||||||
channel);
|
|
||||||
|
|
||||||
GIMP_ITEM_CLASS (parent_class)->resize (item, new_width, new_height,
|
GIMP_ITEM_CLASS (parent_class)->resize (item, new_width, new_height,
|
||||||
offset_x, offset_y);
|
offset_x, offset_y);
|
||||||
|
|
||||||
|
@ -537,9 +524,6 @@ gimp_channel_resize (GimpItem *item,
|
||||||
item->offset_x = 0;
|
item->offset_x = 0;
|
||||||
item->offset_y = 0;
|
item->offset_y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* bounds are now unknown */
|
|
||||||
channel->bounds_known = FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -775,11 +759,6 @@ gimp_channel_set_tiles (GimpDrawable *drawable,
|
||||||
gint offset_x,
|
gint offset_x,
|
||||||
gint offset_y)
|
gint offset_y)
|
||||||
{
|
{
|
||||||
if (push_undo)
|
|
||||||
gimp_image_undo_push_channel_mod (gimp_item_get_image (GIMP_ITEM (drawable)),
|
|
||||||
undo_desc,
|
|
||||||
GIMP_CHANNEL (drawable));
|
|
||||||
|
|
||||||
GIMP_DRAWABLE_CLASS (parent_class)->set_tiles (drawable,
|
GIMP_DRAWABLE_CLASS (parent_class)->set_tiles (drawable,
|
||||||
push_undo, undo_desc,
|
push_undo, undo_desc,
|
||||||
tiles, type,
|
tiles, type,
|
||||||
|
|
|
@ -219,6 +219,9 @@ gimp_drawable_class_init (GimpDrawableClass *klass)
|
||||||
klass->replace_region = gimp_drawable_real_replace_region;
|
klass->replace_region = gimp_drawable_real_replace_region;
|
||||||
klass->set_tiles = gimp_drawable_real_set_tiles;
|
klass->set_tiles = gimp_drawable_real_set_tiles;
|
||||||
klass->swap_pixels = gimp_drawable_real_swap_pixels;
|
klass->swap_pixels = gimp_drawable_real_swap_pixels;
|
||||||
|
|
||||||
|
klass->scale_desc = NULL;
|
||||||
|
klass->resize_desc = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -373,7 +376,8 @@ gimp_drawable_scale (GimpItem *item,
|
||||||
GIMP_INTERPOLATION_NONE : interpolation_type,
|
GIMP_INTERPOLATION_NONE : interpolation_type,
|
||||||
progress_callback, progress_data);
|
progress_callback, progress_data);
|
||||||
|
|
||||||
gimp_drawable_set_tiles_full (drawable, FALSE, NULL,
|
gimp_drawable_set_tiles_full (drawable, TRUE,
|
||||||
|
GIMP_DRAWABLE_GET_CLASS (drawable)->scale_desc,
|
||||||
new_tiles, gimp_drawable_type (drawable),
|
new_tiles, gimp_drawable_type (drawable),
|
||||||
new_offset_x, new_offset_y);
|
new_offset_x, new_offset_y);
|
||||||
tile_manager_unref (new_tiles);
|
tile_manager_unref (new_tiles);
|
||||||
|
@ -394,8 +398,6 @@ gimp_drawable_resize (GimpItem *item,
|
||||||
gint copy_x, copy_y;
|
gint copy_x, copy_y;
|
||||||
gint copy_width, copy_height;
|
gint copy_width, copy_height;
|
||||||
|
|
||||||
drawable = GIMP_DRAWABLE (item);
|
|
||||||
|
|
||||||
new_offset_x = item->offset_x - offset_x;
|
new_offset_x = item->offset_x - offset_x;
|
||||||
new_offset_y = item->offset_y - offset_y;
|
new_offset_y = item->offset_y - offset_y;
|
||||||
|
|
||||||
|
@ -441,7 +443,8 @@ gimp_drawable_resize (GimpItem *item,
|
||||||
copy_region (&srcPR, &destPR);
|
copy_region (&srcPR, &destPR);
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_drawable_set_tiles_full (drawable, FALSE, NULL,
|
gimp_drawable_set_tiles_full (drawable, TRUE,
|
||||||
|
GIMP_DRAWABLE_GET_CLASS (drawable)->resize_desc,
|
||||||
new_tiles, gimp_drawable_type (drawable),
|
new_tiles, gimp_drawable_type (drawable),
|
||||||
new_offset_x, new_offset_y);
|
new_offset_x, new_offset_y);
|
||||||
tile_manager_unref (new_tiles);
|
tile_manager_unref (new_tiles);
|
||||||
|
@ -583,6 +586,10 @@ gimp_drawable_real_set_tiles (GimpDrawable *drawable,
|
||||||
|
|
||||||
gimp_drawable_invalidate_boundary (drawable);
|
gimp_drawable_invalidate_boundary (drawable);
|
||||||
|
|
||||||
|
if (push_undo)
|
||||||
|
gimp_image_undo_push_drawable_mod (gimp_item_get_image (item), undo_desc,
|
||||||
|
drawable);
|
||||||
|
|
||||||
if (drawable->tiles)
|
if (drawable->tiles)
|
||||||
tile_manager_unref (drawable->tiles);
|
tile_manager_unref (drawable->tiles);
|
||||||
|
|
||||||
|
@ -822,6 +829,7 @@ gimp_drawable_set_tiles_full (GimpDrawable *drawable,
|
||||||
|
|
||||||
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
|
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
|
||||||
g_return_if_fail (tiles != NULL);
|
g_return_if_fail (tiles != NULL);
|
||||||
|
g_return_if_fail (tile_manager_bpp (tiles) == GIMP_IMAGE_TYPE_BYTES (type));
|
||||||
|
|
||||||
item = GIMP_ITEM (drawable);
|
item = GIMP_ITEM (drawable);
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,9 @@ struct _GimpDrawableClass
|
||||||
gint y,
|
gint y,
|
||||||
gint width,
|
gint width,
|
||||||
gint height);
|
gint height);
|
||||||
|
|
||||||
|
const gchar *scale_desc;
|
||||||
|
const gchar *resize_desc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -669,6 +669,98 @@ undo_free_drawable (GimpUndo *undo,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************/
|
||||||
|
/* Drawable Mod Undo */
|
||||||
|
/***********************/
|
||||||
|
|
||||||
|
typedef struct _DrawableModUndo DrawableModUndo;
|
||||||
|
|
||||||
|
struct _DrawableModUndo
|
||||||
|
{
|
||||||
|
TileManager *tiles;
|
||||||
|
GimpImageType type;
|
||||||
|
gint offset_x;
|
||||||
|
gint offset_y;
|
||||||
|
};
|
||||||
|
|
||||||
|
static gboolean undo_pop_drawable_mod (GimpUndo *undo,
|
||||||
|
GimpUndoMode undo_mode,
|
||||||
|
GimpUndoAccumulator *accum);
|
||||||
|
static void undo_free_drawable_mod (GimpUndo *undo,
|
||||||
|
GimpUndoMode undo_mode);
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gimp_image_undo_push_drawable_mod (GimpImage *gimage,
|
||||||
|
const gchar *undo_desc,
|
||||||
|
GimpDrawable *drawable)
|
||||||
|
{
|
||||||
|
GimpUndo *new;
|
||||||
|
gint64 size;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
|
||||||
|
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
|
||||||
|
|
||||||
|
size = sizeof (DrawableModUndo) + tile_manager_get_memsize (drawable->tiles);
|
||||||
|
|
||||||
|
if ((new = gimp_image_undo_push_item (gimage, GIMP_ITEM (drawable),
|
||||||
|
size, sizeof (DrawableModUndo),
|
||||||
|
GIMP_UNDO_DRAWABLE_MOD, undo_desc,
|
||||||
|
TRUE,
|
||||||
|
undo_pop_drawable_mod,
|
||||||
|
undo_free_drawable_mod)))
|
||||||
|
{
|
||||||
|
DrawableModUndo *drawable_undo = new->data;
|
||||||
|
|
||||||
|
drawable_undo->tiles = tile_manager_ref (drawable->tiles);
|
||||||
|
drawable_undo->type = drawable->type;
|
||||||
|
drawable_undo->offset_x = GIMP_ITEM (drawable)->offset_x;
|
||||||
|
drawable_undo->offset_y = GIMP_ITEM (drawable)->offset_y;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
undo_pop_drawable_mod (GimpUndo *undo,
|
||||||
|
GimpUndoMode undo_mode,
|
||||||
|
GimpUndoAccumulator *accum)
|
||||||
|
{
|
||||||
|
DrawableModUndo *drawable_undo = undo->data;
|
||||||
|
GimpDrawable *drawable = GIMP_DRAWABLE (GIMP_ITEM_UNDO (undo)->item);
|
||||||
|
TileManager *tiles;
|
||||||
|
GimpImageType drawable_type;
|
||||||
|
gint offset_x, offset_y;
|
||||||
|
|
||||||
|
tiles = drawable_undo->tiles;
|
||||||
|
drawable_type = drawable_undo->type;
|
||||||
|
offset_x = drawable_undo->offset_x;
|
||||||
|
offset_y = drawable_undo->offset_y;
|
||||||
|
|
||||||
|
drawable_undo->tiles = tile_manager_ref (drawable->tiles);
|
||||||
|
drawable_undo->type = drawable->type;
|
||||||
|
drawable_undo->offset_x = GIMP_ITEM (drawable)->offset_x;
|
||||||
|
drawable_undo->offset_y = GIMP_ITEM (drawable)->offset_y;
|
||||||
|
|
||||||
|
gimp_drawable_set_tiles_full (drawable, FALSE, NULL,
|
||||||
|
tiles, drawable_type, offset_x, offset_y);
|
||||||
|
tile_manager_unref (tiles);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
undo_free_drawable_mod (GimpUndo *undo,
|
||||||
|
GimpUndoMode undo_mode)
|
||||||
|
{
|
||||||
|
DrawableModUndo *drawable_undo = undo->data;
|
||||||
|
|
||||||
|
tile_manager_unref (drawable_undo->tiles);
|
||||||
|
g_free (drawable_undo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************/
|
/***************/
|
||||||
/* Mask Undo */
|
/* Mask Undo */
|
||||||
/***************/
|
/***************/
|
||||||
|
@ -1324,101 +1416,6 @@ undo_free_layer (GimpUndo *undo,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************/
|
|
||||||
/* Layer Mod Undo */
|
|
||||||
/********************/
|
|
||||||
|
|
||||||
typedef struct _LayerModUndo LayerModUndo;
|
|
||||||
|
|
||||||
struct _LayerModUndo
|
|
||||||
{
|
|
||||||
TileManager *tiles;
|
|
||||||
GimpImageType type;
|
|
||||||
gint offset_x;
|
|
||||||
gint offset_y;
|
|
||||||
};
|
|
||||||
|
|
||||||
static gboolean undo_pop_layer_mod (GimpUndo *undo,
|
|
||||||
GimpUndoMode undo_mode,
|
|
||||||
GimpUndoAccumulator *accum);
|
|
||||||
static void undo_free_layer_mod (GimpUndo *undo,
|
|
||||||
GimpUndoMode undo_mode);
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
gimp_image_undo_push_layer_mod (GimpImage *gimage,
|
|
||||||
const gchar *undo_desc,
|
|
||||||
GimpLayer *layer)
|
|
||||||
{
|
|
||||||
GimpUndo *new;
|
|
||||||
TileManager *tiles;
|
|
||||||
gint64 size;
|
|
||||||
|
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
|
|
||||||
g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
|
|
||||||
|
|
||||||
tiles = GIMP_DRAWABLE (layer)->tiles;
|
|
||||||
|
|
||||||
size = sizeof (LayerModUndo) + tile_manager_get_memsize (tiles);
|
|
||||||
|
|
||||||
if ((new = gimp_image_undo_push_item (gimage, GIMP_ITEM (layer),
|
|
||||||
size, sizeof (LayerModUndo),
|
|
||||||
GIMP_UNDO_LAYER_MOD, undo_desc,
|
|
||||||
TRUE,
|
|
||||||
undo_pop_layer_mod,
|
|
||||||
undo_free_layer_mod)))
|
|
||||||
{
|
|
||||||
LayerModUndo *lmu = new->data;
|
|
||||||
|
|
||||||
lmu->tiles = tile_manager_ref (tiles);
|
|
||||||
lmu->type = GIMP_DRAWABLE (layer)->type;
|
|
||||||
lmu->offset_x = GIMP_ITEM (layer)->offset_x;
|
|
||||||
lmu->offset_y = GIMP_ITEM (layer)->offset_y;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
undo_pop_layer_mod (GimpUndo *undo,
|
|
||||||
GimpUndoMode undo_mode,
|
|
||||||
GimpUndoAccumulator *accum)
|
|
||||||
{
|
|
||||||
LayerModUndo *lmu = undo->data;
|
|
||||||
GimpLayer *layer = GIMP_LAYER (GIMP_ITEM_UNDO (undo)->item);
|
|
||||||
GimpImageType layer_type;
|
|
||||||
gint offset_x, offset_y;
|
|
||||||
TileManager *tiles;
|
|
||||||
|
|
||||||
tiles = lmu->tiles;
|
|
||||||
layer_type = lmu->type;
|
|
||||||
offset_x = lmu->offset_x;
|
|
||||||
offset_y = lmu->offset_y;
|
|
||||||
|
|
||||||
lmu->tiles = tile_manager_ref (GIMP_DRAWABLE (layer)->tiles);
|
|
||||||
lmu->type = GIMP_DRAWABLE (layer)->type;
|
|
||||||
lmu->offset_x = GIMP_ITEM (layer)->offset_x;
|
|
||||||
lmu->offset_y = GIMP_ITEM (layer)->offset_y;
|
|
||||||
|
|
||||||
gimp_drawable_set_tiles_full (GIMP_DRAWABLE (layer), FALSE, NULL,
|
|
||||||
tiles, layer_type, offset_x, offset_y);
|
|
||||||
tile_manager_unref (tiles);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
undo_free_layer_mod (GimpUndo *undo,
|
|
||||||
GimpUndoMode undo_mode)
|
|
||||||
{
|
|
||||||
LayerModUndo *lmu = undo->data;
|
|
||||||
|
|
||||||
tile_manager_unref (lmu->tiles);
|
|
||||||
g_free (lmu);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/********************************/
|
/********************************/
|
||||||
/* Layer Mask Add/Remove Undo */
|
/* Layer Mask Add/Remove Undo */
|
||||||
/********************************/
|
/********************************/
|
||||||
|
@ -1973,87 +1970,6 @@ undo_free_channel (GimpUndo *undo,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************/
|
|
||||||
/* Channel Mod Undo */
|
|
||||||
/**********************/
|
|
||||||
|
|
||||||
typedef struct _ChannelModUndo ChannelModUndo;
|
|
||||||
|
|
||||||
struct _ChannelModUndo
|
|
||||||
{
|
|
||||||
TileManager *tiles;
|
|
||||||
};
|
|
||||||
|
|
||||||
static gboolean undo_pop_channel_mod (GimpUndo *undo,
|
|
||||||
GimpUndoMode undo_mode,
|
|
||||||
GimpUndoAccumulator *accum);
|
|
||||||
static void undo_free_channel_mod (GimpUndo *undo,
|
|
||||||
GimpUndoMode undo_mode);
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
gimp_image_undo_push_channel_mod (GimpImage *gimage,
|
|
||||||
const gchar *undo_desc,
|
|
||||||
GimpChannel *channel)
|
|
||||||
{
|
|
||||||
TileManager *tiles;
|
|
||||||
GimpUndo *new;
|
|
||||||
gint64 size;
|
|
||||||
|
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
|
|
||||||
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
|
|
||||||
|
|
||||||
tiles = GIMP_DRAWABLE (channel)->tiles;
|
|
||||||
|
|
||||||
size = sizeof (ChannelModUndo) + tile_manager_get_memsize (tiles);
|
|
||||||
|
|
||||||
if ((new = gimp_image_undo_push_item (gimage, GIMP_ITEM (channel),
|
|
||||||
size,
|
|
||||||
sizeof (ChannelModUndo),
|
|
||||||
GIMP_UNDO_CHANNEL_MOD, undo_desc,
|
|
||||||
TRUE,
|
|
||||||
undo_pop_channel_mod,
|
|
||||||
undo_free_channel_mod)))
|
|
||||||
{
|
|
||||||
ChannelModUndo *cmu = new->data;
|
|
||||||
|
|
||||||
cmu->tiles = tile_manager_ref (tiles);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
undo_pop_channel_mod (GimpUndo *undo,
|
|
||||||
GimpUndoMode undo_mode,
|
|
||||||
GimpUndoAccumulator *accum)
|
|
||||||
{
|
|
||||||
ChannelModUndo *cmu = undo->data;
|
|
||||||
GimpChannel *channel = GIMP_CHANNEL (GIMP_ITEM_UNDO (undo)->item);
|
|
||||||
TileManager *tiles;
|
|
||||||
|
|
||||||
tiles = cmu->tiles;
|
|
||||||
|
|
||||||
cmu->tiles = tile_manager_ref (GIMP_DRAWABLE (channel)->tiles);
|
|
||||||
|
|
||||||
gimp_drawable_set_tiles (GIMP_DRAWABLE (channel), FALSE, NULL, tiles);
|
|
||||||
tile_manager_unref (tiles);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
undo_free_channel_mod (GimpUndo *undo,
|
|
||||||
GimpUndoMode undo_mode)
|
|
||||||
{
|
|
||||||
ChannelModUndo *cmu = undo->data;
|
|
||||||
|
|
||||||
tile_manager_unref (cmu->tiles);
|
|
||||||
g_free (cmu);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/******************************/
|
/******************************/
|
||||||
/* Channel re-position Undo */
|
/* Channel re-position Undo */
|
||||||
/******************************/
|
/******************************/
|
||||||
|
|
|
@ -49,6 +49,9 @@ gboolean gimp_image_undo_push_drawable (GimpImage *gimage,
|
||||||
gint y,
|
gint y,
|
||||||
gint width,
|
gint width,
|
||||||
gint height);
|
gint height);
|
||||||
|
gboolean gimp_image_undo_push_drawable_mod (GimpImage *gimage,
|
||||||
|
const gchar *undo_desc,
|
||||||
|
GimpDrawable *drawable);
|
||||||
|
|
||||||
|
|
||||||
/* mask undo */
|
/* mask undo */
|
||||||
|
@ -86,9 +89,6 @@ gboolean gimp_image_undo_push_layer_remove (GimpImage *gimage,
|
||||||
GimpLayer *layer,
|
GimpLayer *layer,
|
||||||
gint prev_position,
|
gint prev_position,
|
||||||
GimpLayer *prev_layer);
|
GimpLayer *prev_layer);
|
||||||
gboolean gimp_image_undo_push_layer_mod (GimpImage *gimage,
|
|
||||||
const gchar *undo_desc,
|
|
||||||
GimpLayer *layer);
|
|
||||||
gboolean gimp_image_undo_push_layer_mask_add (GimpImage *gimage,
|
gboolean gimp_image_undo_push_layer_mask_add (GimpImage *gimage,
|
||||||
const gchar *undo_desc,
|
const gchar *undo_desc,
|
||||||
GimpLayer *layer,
|
GimpLayer *layer,
|
||||||
|
@ -127,9 +127,6 @@ gboolean gimp_image_undo_push_channel_remove (GimpImage *gimage,
|
||||||
GimpChannel *channel,
|
GimpChannel *channel,
|
||||||
gint prev_position,
|
gint prev_position,
|
||||||
GimpChannel *prev_channel);
|
GimpChannel *prev_channel);
|
||||||
gboolean gimp_image_undo_push_channel_mod (GimpImage *gimage,
|
|
||||||
const gchar *undo_desc,
|
|
||||||
GimpChannel *channel);
|
|
||||||
gboolean gimp_image_undo_push_channel_reposition (GimpImage *gimage,
|
gboolean gimp_image_undo_push_channel_reposition (GimpImage *gimage,
|
||||||
const gchar *undo_desc,
|
const gchar *undo_desc,
|
||||||
GimpChannel *channel);
|
GimpChannel *channel);
|
||||||
|
|
|
@ -256,6 +256,8 @@ gimp_layer_class_init (GimpLayerClass *klass)
|
||||||
drawable_class->invalidate_boundary = gimp_layer_invalidate_boundary;
|
drawable_class->invalidate_boundary = gimp_layer_invalidate_boundary;
|
||||||
drawable_class->get_active_components = gimp_layer_get_active_components;
|
drawable_class->get_active_components = gimp_layer_get_active_components;
|
||||||
drawable_class->set_tiles = gimp_layer_set_tiles;
|
drawable_class->set_tiles = gimp_layer_set_tiles;
|
||||||
|
drawable_class->scale_desc = _("Scale Layer");
|
||||||
|
drawable_class->resize_desc = _("Resize Layer");
|
||||||
|
|
||||||
klass->opacity_changed = NULL;
|
klass->opacity_changed = NULL;
|
||||||
klass->mode_changed = NULL;
|
klass->mode_changed = NULL;
|
||||||
|
@ -397,11 +399,6 @@ gimp_layer_set_tiles (GimpDrawable *drawable,
|
||||||
{
|
{
|
||||||
GimpLayer *layer = GIMP_LAYER (drawable);
|
GimpLayer *layer = GIMP_LAYER (drawable);
|
||||||
|
|
||||||
if (push_undo)
|
|
||||||
gimp_image_undo_push_layer_mod (gimp_item_get_image (GIMP_ITEM (drawable)),
|
|
||||||
undo_desc,
|
|
||||||
GIMP_LAYER (drawable));
|
|
||||||
|
|
||||||
GIMP_DRAWABLE_CLASS (parent_class)->set_tiles (drawable,
|
GIMP_DRAWABLE_CLASS (parent_class)->set_tiles (drawable,
|
||||||
push_undo, undo_desc,
|
push_undo, undo_desc,
|
||||||
tiles, type,
|
tiles, type,
|
||||||
|
@ -658,8 +655,6 @@ gimp_layer_scale (GimpItem *item,
|
||||||
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_LAYER_SCALE,
|
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_LAYER_SCALE,
|
||||||
_("Scale Layer"));
|
_("Scale Layer"));
|
||||||
|
|
||||||
gimp_image_undo_push_layer_mod (gimage, _("Scale Layer"), layer);
|
|
||||||
|
|
||||||
GIMP_ITEM_CLASS (parent_class)->scale (item, new_width, new_height,
|
GIMP_ITEM_CLASS (parent_class)->scale (item, new_width, new_height,
|
||||||
new_offset_x, new_offset_y,
|
new_offset_x, new_offset_y,
|
||||||
interpolation_type,
|
interpolation_type,
|
||||||
|
@ -693,8 +688,6 @@ gimp_layer_resize (GimpItem *item,
|
||||||
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_LAYER_RESIZE,
|
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_LAYER_RESIZE,
|
||||||
_("Resize Layer"));
|
_("Resize Layer"));
|
||||||
|
|
||||||
gimp_image_undo_push_layer_mod (gimage, _("Resize Layer"), layer);
|
|
||||||
|
|
||||||
GIMP_ITEM_CLASS (parent_class)->resize (item, new_width, new_height,
|
GIMP_ITEM_CLASS (parent_class)->resize (item, new_width, new_height,
|
||||||
offset_x, offset_y);
|
offset_x, offset_y);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue