[gimp] app: move the "is-last-node" property and API from drawable to filter
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: move the "is-last-node" property and API from drawable to filter
- Date: Thu, 11 Apr 2013 11:05:25 +0000 (UTC)
commit 4ca746eab7da113ec2f2c748660746f0096100cd
Author: Michael Natterer <mitch gimp org>
Date: Thu Apr 11 03:14:33 2013 +0200
app: move the "is-last-node" property and API from drawable to filter
app/core/gimpdrawable-private.h | 2 -
app/core/gimpdrawable.c | 43 +----------------
app/core/gimpdrawable.h | 4 --
app/core/gimpdrawablestack.c | 18 ++++----
app/core/gimpfilter.c | 100 +++++++++++++++++++++++++++++++++++++--
app/core/gimpfilter.h | 10 +++-
app/core/gimplayer.c | 2 +-
7 files changed, 113 insertions(+), 66 deletions(-)
---
diff --git a/app/core/gimpdrawable-private.h b/app/core/gimpdrawable-private.h
index b7b8754..bfe9d38 100644
--- a/app/core/gimpdrawable-private.h
+++ b/app/core/gimpdrawable-private.h
@@ -32,8 +32,6 @@ struct _GimpDrawablePrivate
GeglNode *fs_mode_node;
GeglNode *mode_node;
-
- gboolean is_last_node;
};
#endif /* __GIMP_DRAWABLE_PRIVATE_H__ */
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index 88e40ba..3e12212 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -63,8 +63,7 @@ enum
enum
{
- PROP_0,
- PROP_IS_LAST_NODE
+ PROP_0
};
@@ -261,12 +260,6 @@ gimp_drawable_class_init (GimpDrawableClass *klass)
klass->push_undo = gimp_drawable_real_push_undo;
klass->swap_pixels = gimp_drawable_real_swap_pixels;
- g_object_class_install_property (object_class, PROP_IS_LAST_NODE,
- g_param_spec_boolean ("is-last-node",
- NULL, NULL,
- FALSE,
- GIMP_PARAM_READWRITE));
-
g_type_class_add_private (klass, sizeof (GimpDrawablePrivate));
}
@@ -329,14 +322,8 @@ gimp_drawable_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- GimpDrawable *drawable = GIMP_DRAWABLE (object);
-
switch (property_id)
{
- case PROP_IS_LAST_NODE:
- drawable->private->is_last_node = g_value_get_boolean (value);
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -349,14 +336,8 @@ gimp_drawable_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- GimpDrawable *drawable = GIMP_DRAWABLE (object);
-
switch (property_id)
{
- case PROP_IS_LAST_NODE:
- g_value_set_boolean (value, drawable->private->is_last_node);
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -1384,28 +1365,6 @@ gimp_drawable_get_mode_node (GimpDrawable *drawable)
}
void
-gimp_drawable_set_is_last_node (GimpDrawable *drawable,
- gboolean last_node)
-{
- g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
-
- if (last_node != drawable->private->is_last_node)
- {
- g_object_set (drawable,
- "is-last-node", last_node ? TRUE : FALSE,
- NULL);
- }
-}
-
-gboolean
-gimp_drawable_get_is_last_node (GimpDrawable *drawable)
-{
- g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
-
- return drawable->private->is_last_node;
-}
-
-void
gimp_drawable_swap_pixels (GimpDrawable *drawable,
GeglBuffer *buffer,
gint x,
diff --git a/app/core/gimpdrawable.h b/app/core/gimpdrawable.h
index 339a6b8..06485cb 100644
--- a/app/core/gimpdrawable.h
+++ b/app/core/gimpdrawable.h
@@ -180,10 +180,6 @@ void gimp_drawable_set_buffer_full (GimpDrawable *drawable,
GeglNode * gimp_drawable_get_source_node (GimpDrawable *drawable);
GeglNode * gimp_drawable_get_mode_node (GimpDrawable *drawable);
-void gimp_drawable_set_is_last_node (GimpDrawable *drawable,
- gboolean last_node);
-gboolean gimp_drawable_get_is_last_node (GimpDrawable *drawable);
-
void gimp_drawable_swap_pixels (GimpDrawable *drawable,
GeglBuffer *buffer,
gint x,
diff --git a/app/core/gimpdrawablestack.c b/app/core/gimpdrawablestack.c
index 1b547f4..6bb7aca 100644
--- a/app/core/gimpdrawablestack.c
+++ b/app/core/gimpdrawablestack.c
@@ -231,20 +231,20 @@ gimp_drawable_stack_get_graph (GimpDrawableStack *stack)
list;
list = g_list_next (list))
{
- GimpDrawable *drawable = list->data;
+ GimpFilter *filter = list->data;
- reverse_list = g_list_prepend (reverse_list, drawable);
+ reverse_list = g_list_prepend (reverse_list, filter);
if (! g_list_next (list))
- gimp_drawable_set_is_last_node (drawable, TRUE);
+ gimp_filter_set_is_last_node (filter, TRUE);
}
stack->graph = gegl_node_new ();
for (list = reverse_list; list; list = g_list_next (list))
{
- GimpDrawable *drawable = list->data;
- GeglNode *node = gimp_filter_get_node (GIMP_FILTER (drawable));
+ GimpFilter *filter = list->data;
+ GeglNode *node = gimp_filter_get_node (filter);
gegl_node_add_child (stack->graph, node);
@@ -312,9 +312,9 @@ gimp_drawable_stack_add_node (GimpDrawableStack *stack,
else
{
if (drawable_above)
- gimp_drawable_set_is_last_node (drawable_above, FALSE);
+ gimp_filter_set_is_last_node (GIMP_FILTER (drawable_above), FALSE);
- gimp_drawable_set_is_last_node (drawable, TRUE);
+ gimp_filter_set_is_last_node (GIMP_FILTER (drawable), TRUE);
}
}
@@ -360,10 +360,10 @@ gimp_drawable_stack_remove_node (GimpDrawableStack *stack,
{
gegl_node_disconnect (node_above, "input");
- gimp_drawable_set_is_last_node (drawable, FALSE);
+ gimp_filter_set_is_last_node (GIMP_FILTER (drawable), FALSE);
if (drawable_above)
- gimp_drawable_set_is_last_node (drawable_above, TRUE);
+ gimp_filter_set_is_last_node (GIMP_FILTER (drawable_above), TRUE);
}
}
diff --git a/app/core/gimpfilter.c b/app/core/gimpfilter.c
index b588d9c..340dd89 100644
--- a/app/core/gimpfilter.c
+++ b/app/core/gimpfilter.c
@@ -24,14 +24,23 @@
#include "core-types.h"
#include "gimp.h"
+#include "gimp-utils.h"
#include "gimpfilter.h"
+enum
+{
+ PROP_0,
+ PROP_IS_LAST_NODE
+};
+
+
typedef struct _GimpFilterPrivate GimpFilterPrivate;
struct _GimpFilterPrivate
{
GeglNode *node;
+ gboolean is_last_node;
};
#define GET_PRIVATE(filter) G_TYPE_INSTANCE_GET_PRIVATE (filter, \
@@ -41,10 +50,18 @@ struct _GimpFilterPrivate
/* local function prototypes */
-static void gimp_filter_finalize (GObject *object);
+static void gimp_filter_finalize (GObject *object);
+static void gimp_filter_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_filter_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
-static gint64 gimp_filter_get_memsize (GimpObject *object,
- gint64 *gui_size);
+static gint64 gimp_filter_get_memsize (GimpObject *object,
+ gint64 *gui_size);
static GeglNode * gimp_filter_real_get_node (GimpFilter *filter);
@@ -61,11 +78,19 @@ gimp_filter_class_init (GimpFilterClass *klass)
GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass);
object_class->finalize = gimp_filter_finalize;
+ object_class->set_property = gimp_filter_set_property;
+ object_class->get_property = gimp_filter_get_property;
gimp_object_class->get_memsize = gimp_filter_get_memsize;
klass->get_node = gimp_filter_real_get_node;
+ g_object_class_install_property (object_class, PROP_IS_LAST_NODE,
+ g_param_spec_boolean ("is-last-node",
+ NULL, NULL,
+ FALSE,
+ GIMP_PARAM_READWRITE));
+
g_type_class_add_private (klass, sizeof (GimpFilterPrivate));
}
@@ -88,6 +113,46 @@ gimp_filter_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
+static void
+gimp_filter_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GimpFilterPrivate *private = GET_PRIVATE (object);
+
+ switch (property_id)
+ {
+ case PROP_IS_LAST_NODE:
+ private->is_last_node = g_value_get_boolean (value);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_filter_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GimpFilterPrivate *private = GET_PRIVATE (object);
+
+ switch (property_id)
+ {
+ case PROP_IS_LAST_NODE:
+ g_value_set_boolean (value, private->is_last_node);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
static gint64
gimp_filter_get_memsize (GimpObject *object,
gint64 *gui_size)
@@ -95,8 +160,7 @@ gimp_filter_get_memsize (GimpObject *object,
GimpFilterPrivate *private = GET_PRIVATE (object);
gint64 memsize = 0;
- memsize += gimp_g_object_get_memsize (G_OBJECT (private->node),
- gui_size);
+ memsize += gimp_g_object_get_memsize (G_OBJECT (private->node));
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
gui_size);
@@ -134,3 +198,29 @@ gimp_filter_peek_node (GimpFilter *filter)
return GET_PRIVATE (filter)->node;
}
+
+void
+gimp_filter_set_is_last_node (GimpFilter *filter,
+ gboolean is_last_node)
+{
+ GimpFilterPrivate *private;
+
+ g_return_if_fail (GIMP_IS_FILTER (filter));
+
+ private = GET_PRIVATE (filter);
+
+ if (is_last_node != private->is_last_node)
+ {
+ g_object_set (filter,
+ "is-last-node", is_last_node ? TRUE : FALSE,
+ NULL);
+ }
+}
+
+gboolean
+gimp_filter_get_is_last_node (GimpFilter *filter)
+{
+ g_return_val_if_fail (GIMP_IS_FILTER (filter), FALSE);
+
+ return GET_PRIVATE (filter)->is_last_node;
+}
diff --git a/app/core/gimpfilter.h b/app/core/gimpfilter.h
index 987da29..21e7a31 100644
--- a/app/core/gimpfilter.h
+++ b/app/core/gimpfilter.h
@@ -47,10 +47,14 @@ struct _GimpFilterClass
};
-GType gimp_filter_get_type (void) G_GNUC_CONST;
+GType gimp_filter_get_type (void) G_GNUC_CONST;
-GeglNode * gimp_filter_get_node (GimpFilter *filter);
-GeglNode * gimp_filter_peek_node (GimpFilter *filter);
+GeglNode * gimp_filter_get_node (GimpFilter *filter);
+GeglNode * gimp_filter_peek_node (GimpFilter *filter);
+
+void gimp_filter_set_is_last_node (GimpFilter *filter,
+ gboolean is_last_node);
+gboolean gimp_filter_get_is_last_node (GimpFilter *filter);
#endif /* __GIMP_FILTER_H__ */
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index 3581638..4fdc4bb 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -476,7 +476,7 @@ static GimpLayerModeEffects
gimp_layer_get_visible_mode (GimpLayer *layer)
{
if (layer->mode != GIMP_DISSOLVE_MODE &&
- gimp_drawable_get_is_last_node (GIMP_DRAWABLE (layer)))
+ gimp_filter_get_is_last_node (GIMP_FILTER (layer)))
return GIMP_NORMAL_MODE;
return layer->mode;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]