added properties "gimp", "id", "width", "height" and "base-type". Moved

2004-07-14  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpimage.c: added properties "gimp", "id", "width",
	"height" and "base-type". Moved all code from gimp_image_new()
	to GObject::constructor().

	* app/core/gimpimage-convert.c
	* app/core/gimpimage-crop.c
	* app/core/gimpimage-resize.c
	* app/core/gimpimage-rotate.c
	* app/core/gimpimage-scale.c
	* app/core/gimpimage-undo-push.c: set "width", "height" and
	"base-type" with g_object_set() so "notify" is emitted on the
	properties.

	* app/core/gimpimage-undo.c (gimp_image_undo_pop_stack):
	freeze/thaw property notifications around undoing/redoing so they
	are not emitted in the middle of the undo operation.
This commit is contained in:
Michael Natterer 2004-07-14 12:12:50 +00:00 committed by Michael Natterer
parent 8e2e464f67
commit 87b5322fdb
9 changed files with 605 additions and 427 deletions

View File

@ -1,3 +1,22 @@
2004-07-14 Michael Natterer <mitch@gimp.org>
* app/core/gimpimage.c: added properties "gimp", "id", "width",
"height" and "base-type". Moved all code from gimp_image_new()
to GObject::constructor().
* app/core/gimpimage-convert.c
* app/core/gimpimage-crop.c
* app/core/gimpimage-resize.c
* app/core/gimpimage-rotate.c
* app/core/gimpimage-scale.c
* app/core/gimpimage-undo-push.c: set "width", "height" and
"base-type" with g_object_set() so "notify" is emitted on the
properties.
* app/core/gimpimage-undo.c (gimp_image_undo_pop_stack):
freeze/thaw property notifications around undoing/redoing so they
are not emitted in the middle of the undo operation.
2004-07-14 Michael Natterer <mitch@gimp.org>
* app/core/gimpitem.c: converted tabs to spaces, cleanup,

View File

@ -776,6 +776,8 @@ gimp_image_convert (GimpImage *gimage,
break;
}
g_object_freeze_notify (G_OBJECT (gimage));
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_IMAGE_CONVERT,
undo_desc);
@ -784,7 +786,8 @@ gimp_image_convert (GimpImage *gimage,
/* Set the new base type */
old_type = gimage->base_type;
gimage->base_type = new_type;
g_object_set (gimage, "base-type", new_type, NULL);
/* initialize the colour conversion routines */
cpercep_init_conversions ();
@ -1023,6 +1026,7 @@ gimp_image_convert (GimpImage *gimage,
gimp_image_invalidate_layer_previews (gimage);
gimp_image_mode_changed (gimage);
g_object_thaw_notify (G_OBJECT (gimage));
gimp_unset_busy (gimage->gimp);
}

View File

@ -116,6 +116,8 @@ gimp_image_crop (GimpImage *gimage,
GimpItem *item;
GList *list;
g_object_freeze_notify (G_OBJECT (gimage));
if (crop_layers)
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_IMAGE_CROP,
_("Crop Image"));
@ -127,8 +129,10 @@ gimp_image_crop (GimpImage *gimage,
gimp_image_undo_push_image_size (gimage, NULL);
/* Set the new width and height */
gimage->width = width;
gimage->height = height;
g_object_set (gimage,
"width", width,
"height", height,
NULL);
/* Resize all channels */
for (list = GIMP_LIST (gimage->channels)->list;
@ -230,6 +234,7 @@ gimp_image_crop (GimpImage *gimage,
gimp_image_update (gimage, 0, 0, gimage->width, gimage->height);
gimp_viewable_size_changed (GIMP_VIEWABLE (gimage));
g_object_thaw_notify (G_OBJECT (gimage));
}
gimp_unset_busy (gimage->gimp);

View File

@ -60,6 +60,8 @@ gimp_image_resize (GimpImage *gimage,
gimage->vectors->num_children +
1 /* selection */);
g_object_freeze_notify (G_OBJECT (gimage));
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_IMAGE_RESIZE,
_("Resize Image"));
@ -67,8 +69,10 @@ gimp_image_resize (GimpImage *gimage,
gimp_image_undo_push_image_size (gimage, NULL);
/* Set the new width and height */
gimage->width = new_width;
gimage->height = new_height;
g_object_set (gimage,
"width", new_width,
"height", new_height,
NULL);
/* Resize all channels */
for (list = GIMP_LIST (gimage->channels)->list;
@ -155,6 +159,7 @@ gimp_image_resize (GimpImage *gimage,
gimp_image_undo_group_end (gimage);
gimp_viewable_size_changed (GIMP_VIEWABLE (gimage));
g_object_thaw_notify (G_OBJECT (gimage));
gimp_unset_busy (gimage->gimp);
}

View File

@ -72,6 +72,8 @@ gimp_image_rotate (GimpImage *gimage,
gimage->vectors->num_children +
1 /* selection */);
g_object_freeze_notify (G_OBJECT (gimage));
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_IMAGE_ROTATE, NULL);
/* Resize the image (if needed) */
@ -171,8 +173,10 @@ gimp_image_rotate (GimpImage *gimage,
{
gimp_image_undo_push_image_size (gimage, NULL);
gimage->width = new_image_width;
gimage->height = new_image_height;
g_object_set (gimage,
"width", new_image_width,
"height", new_image_height,
NULL);
if (gimage->xresolution != gimage->yresolution)
{
@ -191,6 +195,8 @@ gimp_image_rotate (GimpImage *gimage,
if (size_changed)
gimp_viewable_size_changed (GIMP_VIEWABLE (gimage));
g_object_thaw_notify (G_OBJECT (gimage));
gimp_unset_busy (gimage->gimp);
}

View File

@ -64,21 +64,25 @@ gimp_image_scale (GimpImage *gimage,
gimage->vectors->num_children +
1 /* selection */);
g_object_freeze_notify (G_OBJECT (gimage));
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_IMAGE_SCALE,
_("Scale Image"));
/* Push the image size to the stack */
gimp_image_undo_push_image_size (gimage, NULL);
/* Set the new width and height */
old_width = gimage->width;
old_height = gimage->height;
gimage->width = new_width;
gimage->height = new_height;
img_scale_w = (gdouble) new_width / (gdouble) old_width;
img_scale_h = (gdouble) new_height / (gdouble) old_height;
/* Set the new width and height */
g_object_set (gimage,
"width", new_width,
"height", new_height,
NULL);
/* Scale all channels */
for (list = GIMP_LIST (gimage->channels)->list;
list;
@ -179,6 +183,7 @@ gimp_image_scale (GimpImage *gimage,
gimp_image_undo_group_end (gimage);
gimp_viewable_size_changed (GIMP_VIEWABLE (gimage));
g_object_thaw_notify (G_OBJECT (gimage));
gimp_unset_busy (gimage->gimp);
}

View File

@ -111,7 +111,7 @@ undo_pop_image_type (GimpUndo *undo,
tmp = itu->base_type;
itu->base_type = undo->gimage->base_type;
undo->gimage->base_type = tmp;
g_object_set (undo->gimage, "base-type", tmp, NULL);
gimp_image_colormap_changed (undo->gimage, -1);
@ -190,8 +190,10 @@ undo_pop_image_size (GimpUndo *undo,
isu->width = undo->gimage->width;
isu->height = undo->gimage->height;
undo->gimage->width = width;
undo->gimage->height = height;
g_object_set (undo->gimage,
"width", width,
"height", height,
NULL);
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (gimp_image_get_mask (undo->gimage)));

View File

@ -288,39 +288,43 @@ gimp_image_undo_pop_stack (GimpImage *gimage,
GimpUndo *undo;
GimpUndoAccumulator accum = { 0, };
g_object_freeze_notify (G_OBJECT (gimage));
undo = gimp_undo_stack_pop_undo (undo_stack, undo_mode, &accum);
if (! undo)
return;
if (undo)
{
if (GIMP_IS_UNDO_STACK (undo))
gimp_list_reverse (GIMP_LIST (GIMP_UNDO_STACK (undo)->undos));
if (GIMP_IS_UNDO_STACK (undo))
gimp_list_reverse (GIMP_LIST (GIMP_UNDO_STACK (undo)->undos));
gimp_undo_stack_push_undo (redo_stack, undo);
gimp_undo_stack_push_undo (redo_stack, undo);
if (accum.mode_changed)
gimp_image_mode_changed (gimage);
if (accum.mode_changed)
gimp_image_mode_changed (gimage);
if (accum.size_changed)
gimp_viewable_size_changed (GIMP_VIEWABLE (gimage));
if (accum.size_changed)
gimp_viewable_size_changed (GIMP_VIEWABLE (gimage));
if (accum.resolution_changed)
gimp_image_resolution_changed (gimage);
if (accum.resolution_changed)
gimp_image_resolution_changed (gimage);
if (accum.unit_changed)
gimp_image_unit_changed (gimage);
if (accum.unit_changed)
gimp_image_unit_changed (gimage);
if (accum.qmask_changed)
gimp_image_qmask_changed (gimage);
if (accum.qmask_changed)
gimp_image_qmask_changed (gimage);
if (accum.alpha_changed)
gimp_image_alpha_changed (gimage);
if (accum.alpha_changed)
gimp_image_alpha_changed (gimage);
/* let others know that we just popped an action */
gimp_image_undo_event (gimage,
(undo_mode == GIMP_UNDO_MODE_UNDO) ?
GIMP_UNDO_EVENT_UNDO : GIMP_UNDO_EVENT_REDO,
undo);
}
/* let others know that we just popped an action */
gimp_image_undo_event (gimage,
(undo_mode == GIMP_UNDO_MODE_UNDO) ?
GIMP_UNDO_EVENT_UNDO : GIMP_UNDO_EVENT_REDO,
undo);
g_object_thaw_notify (G_OBJECT (gimage));
}
static void

File diff suppressed because it is too large Load Diff