gimp r27676 - in trunk: . app/core
- From: mitch svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r27676 - in trunk: . app/core
- Date: Mon, 17 Nov 2008 00:02:15 +0000 (UTC)
Author: mitch
Date: Mon Nov 17 00:02:15 2008
New Revision: 27676
URL: http://svn.gnome.org/viewvc/gimp?rev=27676&view=rev
Log:
2008-11-17 Michael Natterer <mitch gimp org>
* app/core/gimplayer.[ch]: add boolean property
"floating-selection" which indicates if the layer is a floating
selection. Add new API gimp_layer_set_floating_sel_drawable()
which sets layer->fs.drawable and emits notify on the property.
Did some minor cleanup in the existing property code.
* app/core/gimpfloatingselundo.c: use the new function instead of
setting layer->fs.drawable manually.
* app/core/gimplayer-floating-sel.c: same here. Remove some
includes and local variables that are obsolete.
Modified:
trunk/ChangeLog
trunk/app/core/gimpfloatingselundo.c
trunk/app/core/gimplayer-floating-sel.c
trunk/app/core/gimplayer.c
trunk/app/core/gimplayer.h
Modified: trunk/app/core/gimpfloatingselundo.c
==============================================================================
--- trunk/app/core/gimpfloatingselundo.c (original)
+++ trunk/app/core/gimpfloatingselundo.c Mon Nov 17 00:02:15 2008
@@ -108,7 +108,8 @@
/* Update the preview for the floating sel */
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (floating_layer));
- floating_layer->fs.drawable = floating_sel_undo->drawable;
+ gimp_layer_set_floating_sel_drawable (floating_layer,
+ floating_sel_undo->drawable);
gimp_image_set_active_layer (undo->image, floating_layer);
gimp_image_set_floating_selection (undo->image, floating_layer);
@@ -124,7 +125,7 @@
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (floating_layer));
/* update the pointers */
- floating_layer->fs.drawable = NULL;
+ gimp_layer_set_floating_sel_drawable (floating_layer, NULL);
gimp_image_set_floating_selection (undo->image, NULL);
}
Modified: trunk/app/core/gimplayer-floating-sel.c
==============================================================================
--- trunk/app/core/gimplayer-floating-sel.c (original)
+++ trunk/app/core/gimplayer-floating-sel.c Mon Nov 17 00:02:15 2008
@@ -21,16 +21,12 @@
#include <gegl.h>
#include "libgimpbase/gimpbase.h"
-#include "libgimpmath/gimpmath.h"
#include "core-types.h"
#include "base/boundary.h"
#include "base/pixel-region.h"
-#include "paint-funcs/paint-funcs.h"
-
-#include "gimp.h"
#include "gimperror.h"
#include "gimpimage.h"
#include "gimpimage-undo.h"
@@ -79,9 +75,10 @@
drawable = gimp_image_get_active_drawable (image);
}
- /* set the drawable and allocate a backing store */
+ /* set the drawable */
gimp_layer_set_lock_alpha (layer, TRUE, FALSE);
- layer->fs.drawable = drawable;
+
+ gimp_layer_set_floating_sel_drawable (layer, drawable);
/* add the layer to the image */
gimp_image_add_layer (image, layer, 0, TRUE);
@@ -90,8 +87,7 @@
void
floating_sel_anchor (GimpLayer *layer)
{
- GimpImage *image;
- GimpDrawable *drawable;
+ GimpImage *image;
g_return_if_fail (GIMP_IS_LAYER (layer));
g_return_if_fail (gimp_layer_is_floating_sel (layer));
@@ -105,8 +101,6 @@
/* Composite the floating selection contents */
floating_sel_composite (layer);
- drawable = layer->fs.drawable;
-
/* remove the floating selection */
gimp_image_remove_layer (image, layer, TRUE, NULL);
@@ -150,7 +144,7 @@
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (layer));
/* Set pointers */
- layer->fs.drawable = NULL;
+ gimp_layer_set_floating_sel_drawable (layer, NULL);
gimp_image_set_floating_selection (image, NULL);
gimp_item_set_visible (item, TRUE, TRUE);
Modified: trunk/app/core/gimplayer.c
==============================================================================
--- trunk/app/core/gimplayer.c (original)
+++ trunk/app/core/gimplayer.c Mon Nov 17 00:02:15 2008
@@ -69,7 +69,8 @@
PROP_0,
PROP_OPACITY,
PROP_MODE,
- PROP_LOCK_ALPHA
+ PROP_LOCK_ALPHA,
+ PROP_FLOATING_SELECTION
};
@@ -295,6 +296,12 @@
NULL, NULL,
FALSE,
GIMP_PARAM_READABLE));
+
+ g_object_class_install_property (object_class, PROP_FLOATING_SELECTION,
+ g_param_spec_boolean ("floating-selection",
+ NULL, NULL,
+ FALSE,
+ GIMP_PARAM_READABLE));
}
static void
@@ -327,11 +334,6 @@
{
switch (property_id)
{
- case PROP_OPACITY:
- case PROP_MODE:
- case PROP_LOCK_ALPHA:
- g_assert_not_reached ();
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -349,14 +351,18 @@
switch (property_id)
{
case PROP_OPACITY:
- g_value_set_double (value, layer->opacity);
+ g_value_set_double (value, gimp_layer_get_opacity (layer));
break;
case PROP_MODE:
- g_value_set_enum (value, layer->mode);
+ g_value_set_enum (value, gimp_layer_get_mode (layer));
break;
case PROP_LOCK_ALPHA:
- g_value_set_boolean (value, layer->lock_alpha);
+ g_value_set_boolean (value, gimp_layer_get_lock_alpha (layer));
+ break;
+ case PROP_FLOATING_SELECTION:
+ g_value_set_boolean (value, gimp_layer_is_floating_sel (layer));
break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -1874,6 +1880,28 @@
return layer->mask;
}
+void
+gimp_layer_set_floating_sel_drawable (GimpLayer *layer,
+ GimpDrawable *drawable)
+{
+ g_return_if_fail (GIMP_IS_LAYER (layer));
+ g_return_if_fail (drawable == NULL || GIMP_IS_DRAWABLE (drawable));
+
+ if (layer->fs.drawable != drawable)
+ {
+ if (layer->fs.segs)
+ {
+ g_free (layer->fs.segs);
+ layer->fs.segs = NULL;
+ layer->fs.num_segs = 0;
+ }
+
+ layer->fs.drawable = drawable;
+
+ g_object_notify (G_OBJECT (layer), "floating-selection");
+ }
+}
+
gboolean
gimp_layer_is_floating_sel (const GimpLayer *layer)
{
Modified: trunk/app/core/gimplayer.h
==============================================================================
--- trunk/app/core/gimplayer.h (original)
+++ trunk/app/core/gimplayer.h Mon Nov 17 00:02:15 2008
@@ -118,6 +118,8 @@
GimpLayerMask * gimp_layer_get_mask (const GimpLayer *layer);
+void gimp_layer_set_floating_sel_drawable (GimpLayer *layer,
+ GimpDrawable *drawable);
gboolean gimp_layer_is_floating_sel (const GimpLayer *layer);
void gimp_layer_set_opacity (GimpLayer *layer,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]