gimp r27650 - in trunk: . app/core
- From: mitch svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r27650 - in trunk: . app/core
- Date: Fri, 14 Nov 2008 15:18:29 +0000 (UTC)
Author: mitch
Date: Fri Nov 14 15:18:29 2008
New Revision: 27650
URL: http://svn.gnome.org/viewvc/gimp?rev=27650&view=rev
Log:
2008-11-14 Michael Natterer <mitch gimp org>
* app/core/gimpimage.[ch] (struct GimpImageFlushAccumulator):
add member "gboolean floating_selection_changed".
(gimp_image_set_floating_selection): new function which sets
the image's floating_sel pointer and sets the flag in the
accumulator to TRUE for later signal emission on flush.
(gimp_image_projectable_flush): emit "floating-selection-changed"
if the flag in the accumulator is TRUE.
* app/core/gimpimage.c (gimp_image_add,remove_layer)
* app/core/gimpfloatingselundo.c (gimp_floating_sel_undo_pop)
* app/core/gimplayer-floating-sel.c (floating_sel_to_layer): use
gimp_image_set_floating_selection() instead of setting
image->floating_sel menually and remove all calls to
gimp_image_floating_selection_changed().
Modified:
trunk/ChangeLog
trunk/app/core/gimpfloatingselundo.c
trunk/app/core/gimpimage.c
trunk/app/core/gimpimage.h
trunk/app/core/gimplayer-floating-sel.c
Modified: trunk/app/core/gimpfloatingselundo.c
==============================================================================
--- trunk/app/core/gimpfloatingselundo.c (original)
+++ trunk/app/core/gimpfloatingselundo.c Fri Nov 14 15:18:29 2008
@@ -110,7 +110,7 @@
floating_layer->fs.drawable = floating_sel_undo->drawable;
gimp_image_set_active_layer (undo->image, floating_layer);
- undo->image->floating_sel = floating_layer;
+ gimp_image_set_floating_selection (undo->image, floating_layer);
/* clear the selection */
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (floating_layer));
@@ -125,7 +125,7 @@
/* update the pointers */
floating_layer->fs.drawable = NULL;
- undo->image->floating_sel = NULL;
+ gimp_image_set_floating_selection (undo->image, NULL);
}
gimp_object_name_changed (GIMP_OBJECT (floating_layer));
@@ -134,8 +134,6 @@
0, 0,
gimp_item_get_width (GIMP_ITEM (floating_layer)),
gimp_item_get_height (GIMP_ITEM (floating_layer)));
-
- gimp_image_floating_selection_changed (undo->image);
break;
default:
Modified: trunk/app/core/gimpimage.c
==============================================================================
--- trunk/app/core/gimpimage.c (original)
+++ trunk/app/core/gimpimage.c Fri Nov 14 15:18:29 2008
@@ -667,9 +667,10 @@
image->preview = NULL;
- image->flush_accum.alpha_changed = FALSE;
- image->flush_accum.mask_changed = FALSE;
- image->flush_accum.preview_invalidated = FALSE;
+ image->flush_accum.alpha_changed = FALSE;
+ image->flush_accum.mask_changed = FALSE;
+ image->flush_accum.floating_selection_changed = FALSE;
+ image->flush_accum.preview_invalidated = FALSE;
}
static GObject *
@@ -1185,6 +1186,12 @@
image->flush_accum.mask_changed = FALSE;
}
+ if (image->flush_accum.floating_selection_changed)
+ {
+ gimp_image_floating_selection_changed (image);
+ image->flush_accum.floating_selection_changed = FALSE;
+ }
+
if (image->flush_accum.preview_invalidated)
{
/* don't invalidate the preview here, the projection does this when
@@ -1615,6 +1622,21 @@
return gimp_container_is_empty (image->layers);
}
+void
+gimp_image_set_floating_selection (GimpImage *image,
+ GimpLayer *floating_sel)
+{
+ g_return_if_fail (GIMP_IS_IMAGE (image));
+ g_return_if_fail (floating_sel == NULL || GIMP_IS_LAYER (floating_sel));
+
+ if (image->floating_sel != floating_sel)
+ {
+ image->floating_sel = floating_sel;
+
+ image->flush_accum.floating_selection_changed = TRUE;
+ }
+}
+
GimpLayer *
gimp_image_get_floating_selection (const GimpImage *image)
{
@@ -2929,10 +2951,6 @@
gimp_image_undo_push_layer_add (image, _("Add Layer"),
layer, active_layer);
- /* If the layer is a floating selection, set the fs pointer */
- if (gimp_layer_is_floating_sel (layer))
- image->floating_sel = layer;
-
/* add the layer to the list at the specified position */
if (position == -1)
{
@@ -2957,12 +2975,13 @@
/* notify the layers dialog of the currently active layer */
gimp_image_set_active_layer (image, layer);
+ /* If the layer is a floating selection, set the fs pointer */
+ if (gimp_layer_is_floating_sel (layer))
+ gimp_image_set_floating_selection (image, layer);
+
if (old_has_alpha != gimp_image_has_alpha (image))
image->flush_accum.alpha_changed = TRUE;
- if (gimp_layer_is_floating_sel (layer))
- gimp_image_floating_selection_changed (image);
-
return TRUE;
}
@@ -3042,11 +3061,9 @@
/* If this was the floating selection, reset the fs pointer
* and activate the underlying drawable
*/
- image->floating_sel = NULL;
+ gimp_image_set_floating_selection (image, NULL);
floating_sel_activate_drawable (layer);
-
- gimp_image_floating_selection_changed (image);
}
else if (layer == active_layer)
{
Modified: trunk/app/core/gimpimage.h
==============================================================================
--- trunk/app/core/gimpimage.h (original)
+++ trunk/app/core/gimpimage.h Fri Nov 14 15:18:29 2008
@@ -82,6 +82,7 @@
{
gboolean alpha_changed;
gboolean mask_changed;
+ gboolean floating_selection_changed;
gboolean preview_invalidated;
};
@@ -280,6 +281,8 @@
gboolean gimp_image_has_alpha (const GimpImage *image);
gboolean gimp_image_is_empty (const GimpImage *image);
+void gimp_image_set_floating_selection (GimpImage *image,
+ GimpLayer *floating_sel);
GimpLayer * gimp_image_get_floating_selection (const GimpImage *image);
void gimp_image_floating_selection_changed (GimpImage *image);
Modified: trunk/app/core/gimplayer-floating-sel.c
==============================================================================
--- trunk/app/core/gimplayer-floating-sel.c (original)
+++ trunk/app/core/gimplayer-floating-sel.c Fri Nov 14 15:18:29 2008
@@ -151,7 +151,7 @@
/* Set pointers */
layer->fs.drawable = NULL;
- image->floating_sel = NULL;
+ gimp_image_set_floating_selection (image, NULL);
gimp_item_set_visible (item, TRUE, TRUE);
gimp_layer_set_lock_alpha (layer, FALSE, TRUE);
@@ -165,8 +165,6 @@
gimp_item_get_width (item),
gimp_item_get_height (item));
- gimp_image_floating_selection_changed (image);
-
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]