[gimp] app: add a "shell" property to GimpCanvasItem
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add a "shell" property to GimpCanvasItem
- Date: Fri, 1 Oct 2010 12:14:56 +0000 (UTC)
commit 201bfe3e25e939b8a2084d8a73a73756c8e055f8
Author: Michael Natterer <mitch gimp org>
Date: Fri Oct 1 14:13:45 2010 +0200
app: add a "shell" property to GimpCanvasItem
and pass it to all constructors. The GimpDisplayShell is needed
because items are going to become more powerful soon.
app/display/gimpcanvasarc.c | 18 +++++++++------
app/display/gimpcanvasarc.h | 15 ++++++------
app/display/gimpcanvasboundary.c | 12 ++++++---
app/display/gimpcanvasboundary.h | 9 ++++---
app/display/gimpcanvascorner.c | 20 ++++++++++------
app/display/gimpcanvascorner.h | 17 +++++++------
app/display/gimpcanvasgroup.c | 8 +++++-
app/display/gimpcanvasgroup.h | 18 +++++++-------
app/display/gimpcanvasguide.c | 6 ++++-
app/display/gimpcanvasguide.h | 3 +-
app/display/gimpcanvashandle.c | 16 ++++++++-----
app/display/gimpcanvashandle.h | 3 +-
app/display/gimpcanvasitem.c | 37 +++++++++++++++++++++++++++---
app/display/gimpcanvasline.c | 20 ++++++++++------
app/display/gimpcanvasline.h | 9 ++++---
app/display/gimpcanvaspolygon.c | 14 ++++++++++-
app/display/gimpcanvaspolygon.h | 6 +++-
app/display/gimpcanvasproxygroup.c | 8 +++++-
app/display/gimpcanvasproxygroup.h | 2 +-
app/display/gimpcanvasrectangle.c | 14 +++++++----
app/display/gimpcanvasrectangle.h | 11 +++++----
app/display/gimpcanvassamplepoint.c | 10 ++++++--
app/display/gimpcanvassamplepoint.h | 7 +++--
app/display/gimpcanvastextcursor.c | 9 ++++++-
app/display/gimpcanvastextcursor.h | 5 ++-
app/display/gimpdisplayshell-handlers.c | 6 +++-
app/display/gimpdisplayshell.c | 6 ++--
app/tools/gimpdrawtool.c | 35 +++++++++++++++++++----------
app/tools/gimpfreeselecttool.c | 2 +-
app/tools/gimpmeasuretool.c | 2 +-
app/tools/gimpperspectiveclonetool.c | 2 +-
app/tools/gimprectangletool.c | 2 +-
app/tools/gimptexttool.c | 2 +-
app/tools/gimptransformtool.c | 2 +-
34 files changed, 232 insertions(+), 124 deletions(-)
---
diff --git a/app/display/gimpcanvasarc.c b/app/display/gimpcanvasarc.c
index 1554bf4..a0f9035 100644
--- a/app/display/gimpcanvasarc.c
+++ b/app/display/gimpcanvasarc.c
@@ -305,15 +305,19 @@ gimp_canvas_arc_get_extents (GimpCanvasItem *item,
}
GimpCanvasItem *
-gimp_canvas_arc_new (gdouble center_x,
- gdouble center_y,
- gdouble radius_x,
- gdouble radius_y,
- gdouble start_angle,
- gdouble slice_angle,
- gboolean filled)
+gimp_canvas_arc_new (GimpDisplayShell *shell,
+ gdouble center_x,
+ gdouble center_y,
+ gdouble radius_x,
+ gdouble radius_y,
+ gdouble start_angle,
+ gdouble slice_angle,
+ gboolean filled)
{
+ g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
+
return g_object_new (GIMP_TYPE_CANVAS_ARC,
+ "shell", shell,
"center-x", center_x,
"center-y", center_y,
"radius-x", radius_x,
diff --git a/app/display/gimpcanvasarc.h b/app/display/gimpcanvasarc.h
index ef8c283..d42e0bb 100644
--- a/app/display/gimpcanvasarc.h
+++ b/app/display/gimpcanvasarc.h
@@ -49,13 +49,14 @@ struct _GimpCanvasArcClass
GType gimp_canvas_arc_get_type (void) G_GNUC_CONST;
-GimpCanvasItem * gimp_canvas_arc_new (gdouble center_x,
- gdouble center_y,
- gdouble radius_x,
- gdouble radius_y,
- gdouble start_angle,
- gdouble slice_angle,
- gboolean filled);
+GimpCanvasItem * gimp_canvas_arc_new (GimpDisplayShell *shell,
+ gdouble center_x,
+ gdouble center_y,
+ gdouble radius_x,
+ gdouble radius_y,
+ gdouble start_angle,
+ gdouble slice_angle,
+ gboolean filled);
#endif /* __GIMP_CANVAS_ARC_H__ */
diff --git a/app/display/gimpcanvasboundary.c b/app/display/gimpcanvasboundary.c
index dc5de47..7b351c4 100644
--- a/app/display/gimpcanvasboundary.c
+++ b/app/display/gimpcanvasboundary.c
@@ -290,15 +290,19 @@ gimp_canvas_boundary_get_extents (GimpCanvasItem *item,
}
GimpCanvasItem *
-gimp_canvas_boundary_new (const BoundSeg *segs,
- gint n_segs,
- gdouble offset_x,
- gdouble offset_y)
+gimp_canvas_boundary_new (GimpDisplayShell *shell,
+ const BoundSeg *segs,
+ gint n_segs,
+ gdouble offset_x,
+ gdouble offset_y)
{
GimpCanvasItem *item;
GimpCanvasBoundaryPrivate *private;
+ g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
+
item = g_object_new (GIMP_TYPE_CANVAS_BOUNDARY,
+ "shell", shell,
"offset-x", offset_x,
"offset-y", offset_y,
NULL);
diff --git a/app/display/gimpcanvasboundary.h b/app/display/gimpcanvasboundary.h
index e094c62..0dd830a 100644
--- a/app/display/gimpcanvasboundary.h
+++ b/app/display/gimpcanvasboundary.h
@@ -49,10 +49,11 @@ struct _GimpCanvasBoundaryClass
GType gimp_canvas_boundary_get_type (void) G_GNUC_CONST;
-GimpCanvasItem * gimp_canvas_boundary_new (const BoundSeg *segs,
- gint n_segs,
- gdouble offset_x,
- gdouble offset_y);
+GimpCanvasItem * gimp_canvas_boundary_new (GimpDisplayShell *shell,
+ const BoundSeg *segs,
+ gint n_segs,
+ gdouble offset_x,
+ gdouble offset_y);
#endif /* __GIMP_CANVAS_BOUNDARY_H__ */
diff --git a/app/display/gimpcanvascorner.c b/app/display/gimpcanvascorner.c
index 0e8c5e7..e7b6357 100644
--- a/app/display/gimpcanvascorner.c
+++ b/app/display/gimpcanvascorner.c
@@ -427,16 +427,20 @@ gimp_canvas_corner_get_extents (GimpCanvasItem *item,
}
GimpCanvasItem *
-gimp_canvas_corner_new (gdouble x,
- gdouble y,
- gdouble width,
- gdouble height,
- GtkAnchorType anchor,
- gint corner_width,
- gint corner_height,
- gboolean outside)
+gimp_canvas_corner_new (GimpDisplayShell *shell,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height,
+ GtkAnchorType anchor,
+ gint corner_width,
+ gint corner_height,
+ gboolean outside)
{
+ g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
+
return g_object_new (GIMP_TYPE_CANVAS_CORNER,
+ "shell", shell,
"x", x,
"y", y,
"width", width,
diff --git a/app/display/gimpcanvascorner.h b/app/display/gimpcanvascorner.h
index 767e4a0..2967291 100644
--- a/app/display/gimpcanvascorner.h
+++ b/app/display/gimpcanvascorner.h
@@ -49,14 +49,15 @@ struct _GimpCanvasCornerClass
GType gimp_canvas_corner_get_type (void) G_GNUC_CONST;
-GimpCanvasItem * gimp_canvas_corner_new (gdouble x,
- gdouble y,
- gdouble width,
- gdouble height,
- GtkAnchorType anchor,
- gint corner_width,
- gint corner_height,
- gboolean outside);
+GimpCanvasItem * gimp_canvas_corner_new (GimpDisplayShell *shell,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height,
+ GtkAnchorType anchor,
+ gint corner_width,
+ gint corner_height,
+ gboolean outside);
#endif /* __GIMP_CANVAS_CORNER_H__ */
diff --git a/app/display/gimpcanvasgroup.c b/app/display/gimpcanvasgroup.c
index 3079115..7a7775e 100644
--- a/app/display/gimpcanvasgroup.c
+++ b/app/display/gimpcanvasgroup.c
@@ -224,9 +224,13 @@ gimp_canvas_group_get_extents (GimpCanvasItem *item,
}
GimpCanvasItem *
-gimp_canvas_group_new (void)
+gimp_canvas_group_new (GimpDisplayShell *shell)
{
- return g_object_new (GIMP_TYPE_CANVAS_GROUP, NULL);
+ g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
+
+ return g_object_new (GIMP_TYPE_CANVAS_GROUP,
+ "shell", shell,
+ NULL);
}
void
diff --git a/app/display/gimpcanvasgroup.h b/app/display/gimpcanvasgroup.h
index 28c3bc8..453dc54 100644
--- a/app/display/gimpcanvasgroup.h
+++ b/app/display/gimpcanvasgroup.h
@@ -48,17 +48,17 @@ struct _GimpCanvasGroupClass
GType gimp_canvas_group_get_type (void) G_GNUC_CONST;
-GimpCanvasItem * gimp_canvas_group_new (void);
+GimpCanvasItem * gimp_canvas_group_new (GimpDisplayShell *shell);
-void gimp_canvas_group_add_item (GimpCanvasGroup *group,
- GimpCanvasItem *item);
-void gimp_canvas_group_remove_item (GimpCanvasGroup *group,
- GimpCanvasItem *item);
+void gimp_canvas_group_add_item (GimpCanvasGroup *group,
+ GimpCanvasItem *item);
+void gimp_canvas_group_remove_item (GimpCanvasGroup *group,
+ GimpCanvasItem *item);
-void gimp_canvas_group_set_group_stroking (GimpCanvasGroup *group,
- gboolean group_stroking);
-void gimp_canvas_group_set_group_filling (GimpCanvasGroup *group,
- gboolean group_filling);
+void gimp_canvas_group_set_group_stroking (GimpCanvasGroup *group,
+ gboolean group_stroking);
+void gimp_canvas_group_set_group_filling (GimpCanvasGroup *group,
+ gboolean group_filling);
#endif /* __GIMP_CANVAS_GROUP_H__ */
diff --git a/app/display/gimpcanvasguide.c b/app/display/gimpcanvasguide.c
index 56e24c0..ebaa537 100644
--- a/app/display/gimpcanvasguide.c
+++ b/app/display/gimpcanvasguide.c
@@ -264,10 +264,14 @@ gimp_canvas_guide_stroke (GimpCanvasItem *item,
}
GimpCanvasItem *
-gimp_canvas_guide_new (GimpOrientationType orientation,
+gimp_canvas_guide_new (GimpDisplayShell *shell,
+ GimpOrientationType orientation,
gint position)
{
+ g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
+
return g_object_new (GIMP_TYPE_CANVAS_GUIDE,
+ "shell", shell,
"orientation", orientation,
"position", position,
NULL);
diff --git a/app/display/gimpcanvasguide.h b/app/display/gimpcanvasguide.h
index bd4eadb..b25f8ee 100644
--- a/app/display/gimpcanvasguide.h
+++ b/app/display/gimpcanvasguide.h
@@ -49,7 +49,8 @@ struct _GimpCanvasGuideClass
GType gimp_canvas_guide_get_type (void) G_GNUC_CONST;
-GimpCanvasItem * gimp_canvas_guide_new (GimpOrientationType orientation,
+GimpCanvasItem * gimp_canvas_guide_new (GimpDisplayShell *shell,
+ GimpOrientationType orientation,
gint position);
diff --git a/app/display/gimpcanvashandle.c b/app/display/gimpcanvashandle.c
index d13b83b..02634e7 100644
--- a/app/display/gimpcanvashandle.c
+++ b/app/display/gimpcanvashandle.c
@@ -504,14 +504,18 @@ gimp_canvas_handle_get_extents (GimpCanvasItem *item,
}
GimpCanvasItem *
-gimp_canvas_handle_new (GimpHandleType type,
- GtkAnchorType anchor,
- gdouble x,
- gdouble y,
- gint width,
- gint height)
+gimp_canvas_handle_new (GimpDisplayShell *shell,
+ GimpHandleType type,
+ GtkAnchorType anchor,
+ gdouble x,
+ gdouble y,
+ gint width,
+ gint height)
{
+ g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
+
return g_object_new (GIMP_TYPE_CANVAS_HANDLE,
+ "shell", shell,
"type", type,
"anchor", anchor,
"x", x,
diff --git a/app/display/gimpcanvashandle.h b/app/display/gimpcanvashandle.h
index 1691c84..ad0f237 100644
--- a/app/display/gimpcanvashandle.h
+++ b/app/display/gimpcanvashandle.h
@@ -49,7 +49,8 @@ struct _GimpCanvasHandleClass
GType gimp_canvas_handle_get_type (void) G_GNUC_CONST;
-GimpCanvasItem * gimp_canvas_handle_new (GimpHandleType type,
+GimpCanvasItem * gimp_canvas_handle_new (GimpDisplayShell *shell,
+ GimpHandleType type,
GtkAnchorType anchor,
gdouble x,
gdouble y,
diff --git a/app/display/gimpcanvasitem.c b/app/display/gimpcanvasitem.c
index 32aa777..4521a42 100644
--- a/app/display/gimpcanvasitem.c
+++ b/app/display/gimpcanvasitem.c
@@ -35,6 +35,7 @@
enum
{
PROP_0,
+ PROP_SHELL,
PROP_LINE_CAP,
PROP_HIGHLIGHT
};
@@ -44,10 +45,11 @@ typedef struct _GimpCanvasItemPrivate GimpCanvasItemPrivate;
struct _GimpCanvasItemPrivate
{
- cairo_line_cap_t line_cap;
- gboolean highlight;
- gint suspend_stroking;
- gint suspend_filling;
+ GimpDisplayShell *shell;
+ cairo_line_cap_t line_cap;
+ gboolean highlight;
+ gint suspend_stroking;
+ gint suspend_filling;
};
#define GET_PRIVATE(item) \
@@ -58,6 +60,7 @@ struct _GimpCanvasItemPrivate
/* local function prototypes */
+static void gimp_canvas_item_constructed (GObject *object);
static void gimp_canvas_item_set_property (GObject *object,
guint property_id,
const GValue *value,
@@ -91,6 +94,7 @@ gimp_canvas_item_class_init (GimpCanvasItemClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ object_class->constructed = gimp_canvas_item_constructed;
object_class->set_property = gimp_canvas_item_set_property;
object_class->get_property = gimp_canvas_item_get_property;
@@ -99,6 +103,13 @@ gimp_canvas_item_class_init (GimpCanvasItemClass *klass)
klass->stroke = gimp_canvas_item_real_stroke;
klass->fill = gimp_canvas_item_real_fill;
+ g_object_class_install_property (object_class, PROP_SHELL,
+ g_param_spec_object ("shell",
+ NULL, NULL,
+ GIMP_TYPE_DISPLAY_SHELL,
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
g_object_class_install_property (object_class, PROP_LINE_CAP,
g_param_spec_int ("line-cap",
NULL, NULL,
@@ -121,6 +132,7 @@ gimp_canvas_item_init (GimpCanvasItem *item)
{
GimpCanvasItemPrivate *private = GET_PRIVATE (item);
+ private->shell = NULL;
private->line_cap = CAIRO_LINE_CAP_ROUND;
private->highlight = FALSE;
private->suspend_stroking = 0;
@@ -128,6 +140,17 @@ gimp_canvas_item_init (GimpCanvasItem *item)
}
static void
+gimp_canvas_item_constructed (GObject *object)
+{
+ GimpCanvasItemPrivate *private = GET_PRIVATE (object);
+
+ g_assert (GIMP_IS_DISPLAY_SHELL (private->shell));
+
+ if (G_OBJECT_CLASS (parent_class)->constructed)
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+}
+
+static void
gimp_canvas_item_set_property (GObject *object,
guint property_id,
const GValue *value,
@@ -137,6 +160,9 @@ gimp_canvas_item_set_property (GObject *object,
switch (property_id)
{
+ case PROP_SHELL:
+ private->shell = g_value_get_object (value); /* don't ref */
+ break;
case PROP_LINE_CAP:
private->line_cap = g_value_get_int (value);
break;
@@ -160,6 +186,9 @@ gimp_canvas_item_get_property (GObject *object,
switch (property_id)
{
+ case PROP_SHELL:
+ g_value_set_object (value, private->shell);
+ break;
case PROP_LINE_CAP:
g_value_set_int (value, private->line_cap);
break;
diff --git a/app/display/gimpcanvasline.c b/app/display/gimpcanvasline.c
index 00689e1..8b01b98 100644
--- a/app/display/gimpcanvasline.c
+++ b/app/display/gimpcanvasline.c
@@ -251,15 +251,19 @@ gimp_canvas_line_get_extents (GimpCanvasItem *item,
}
GimpCanvasItem *
-gimp_canvas_line_new (gdouble x1,
- gdouble y1,
- gdouble x2,
- gdouble y2)
+gimp_canvas_line_new (GimpDisplayShell *shell,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2)
{
+ g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
+
return g_object_new (GIMP_TYPE_CANVAS_LINE,
- "x1", x1,
- "y1", y1,
- "x2", x2,
- "y2", y2,
+ "shell", shell,
+ "x1", x1,
+ "y1", y1,
+ "x2", x2,
+ "y2", y2,
NULL);
}
diff --git a/app/display/gimpcanvasline.h b/app/display/gimpcanvasline.h
index d5a5f55..754dbdb 100644
--- a/app/display/gimpcanvasline.h
+++ b/app/display/gimpcanvasline.h
@@ -49,10 +49,11 @@ struct _GimpCanvasLineClass
GType gimp_canvas_line_get_type (void) G_GNUC_CONST;
-GimpCanvasItem * gimp_canvas_line_new (gdouble x1,
- gdouble y1,
- gdouble x2,
- gdouble y2);
+GimpCanvasItem * gimp_canvas_line_new (GimpDisplayShell *shell,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2);
#endif /* __GIMP_CANVAS_LINE_H__ */
diff --git a/app/display/gimpcanvaspolygon.c b/app/display/gimpcanvaspolygon.c
index c4f2059..b0a5fa8 100644
--- a/app/display/gimpcanvaspolygon.c
+++ b/app/display/gimpcanvaspolygon.c
@@ -263,14 +263,19 @@ gimp_canvas_polygon_get_extents (GimpCanvasItem *item,
}
GimpCanvasItem *
-gimp_canvas_polygon_new (const GimpVector2 *points,
+gimp_canvas_polygon_new (GimpDisplayShell *shell,
+ const GimpVector2 *points,
gint n_points,
gboolean filled)
{
GimpCanvasItem *item;
GimpCanvasPolygonPrivate *private;
+ g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
+ g_return_val_if_fail (points != NULL && n_points > 1, NULL);
+
item = g_object_new (GIMP_TYPE_CANVAS_POLYGON,
+ "shell", shell,
"filled", filled,
NULL);
private = GET_PRIVATE (item);
@@ -283,7 +288,8 @@ gimp_canvas_polygon_new (const GimpVector2 *points,
}
GimpCanvasItem *
-gimp_canvas_polygon_new_from_coords (const GimpCoords *points,
+gimp_canvas_polygon_new_from_coords (GimpDisplayShell *shell,
+ const GimpCoords *points,
gint n_points,
gboolean filled)
{
@@ -291,7 +297,11 @@ gimp_canvas_polygon_new_from_coords (const GimpCoords *points,
GimpCanvasPolygonPrivate *private;
gint i;
+ g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
+ g_return_val_if_fail (points != NULL && n_points > 1, NULL);
+
item = g_object_new (GIMP_TYPE_CANVAS_POLYGON,
+ "shell", shell,
"filled", filled,
NULL);
private = GET_PRIVATE (item);
diff --git a/app/display/gimpcanvaspolygon.h b/app/display/gimpcanvaspolygon.h
index c1dfadf..0fb02fb 100644
--- a/app/display/gimpcanvaspolygon.h
+++ b/app/display/gimpcanvaspolygon.h
@@ -49,10 +49,12 @@ struct _GimpCanvasPolygonClass
GType gimp_canvas_polygon_get_type (void) G_GNUC_CONST;
-GimpCanvasItem * gimp_canvas_polygon_new (const GimpVector2 *points,
+GimpCanvasItem * gimp_canvas_polygon_new (GimpDisplayShell *shell,
+ const GimpVector2 *points,
gint n_points,
gboolean filled);
-GimpCanvasItem * gimp_canvas_polygon_new_from_coords (const GimpCoords *points,
+GimpCanvasItem * gimp_canvas_polygon_new_from_coords (GimpDisplayShell *shell,
+ const GimpCoords *points,
gint n_points,
gboolean filled);
diff --git a/app/display/gimpcanvasproxygroup.c b/app/display/gimpcanvasproxygroup.c
index 25e1f2e..f06f134 100644
--- a/app/display/gimpcanvasproxygroup.c
+++ b/app/display/gimpcanvasproxygroup.c
@@ -140,9 +140,13 @@ gimp_canvas_proxy_group_get_property (GObject *object,
}
GimpCanvasItem *
-gimp_canvas_proxy_group_new (void)
+gimp_canvas_proxy_group_new (GimpDisplayShell *shell)
{
- return g_object_new (GIMP_TYPE_CANVAS_PROXY_GROUP, NULL);
+ g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
+
+ return g_object_new (GIMP_TYPE_CANVAS_PROXY_GROUP,
+ "shell", shell,
+ NULL);
}
void
diff --git a/app/display/gimpcanvasproxygroup.h b/app/display/gimpcanvasproxygroup.h
index 9dc29f5..3850433 100644
--- a/app/display/gimpcanvasproxygroup.h
+++ b/app/display/gimpcanvasproxygroup.h
@@ -49,7 +49,7 @@ struct _GimpCanvasProxyGroupClass
GType gimp_canvas_proxy_group_get_type (void) G_GNUC_CONST;
-GimpCanvasItem * gimp_canvas_proxy_group_new (void);
+GimpCanvasItem * gimp_canvas_proxy_group_new (GimpDisplayShell *shell);
void gimp_canvas_proxy_group_add_item (GimpCanvasProxyGroup *group,
gpointer object,
diff --git a/app/display/gimpcanvasrectangle.c b/app/display/gimpcanvasrectangle.c
index 025d283..131ee40 100644
--- a/app/display/gimpcanvasrectangle.c
+++ b/app/display/gimpcanvasrectangle.c
@@ -322,13 +322,17 @@ gimp_canvas_rectangle_get_extents (GimpCanvasItem *item,
}
GimpCanvasItem *
-gimp_canvas_rectangle_new (gdouble x,
- gdouble y,
- gdouble width,
- gdouble height,
- gboolean filled)
+gimp_canvas_rectangle_new (GimpDisplayShell *shell,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height,
+ gboolean filled)
{
+ g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
+
return g_object_new (GIMP_TYPE_CANVAS_RECTANGLE,
+ "shell", shell,
"x", x,
"y", y,
"width", width,
diff --git a/app/display/gimpcanvasrectangle.h b/app/display/gimpcanvasrectangle.h
index 4035904..4eb78c1 100644
--- a/app/display/gimpcanvasrectangle.h
+++ b/app/display/gimpcanvasrectangle.h
@@ -49,11 +49,12 @@ struct _GimpCanvasRectangleClass
GType gimp_canvas_rectangle_get_type (void) G_GNUC_CONST;
-GimpCanvasItem * gimp_canvas_rectangle_new (gdouble x,
- gdouble y,
- gdouble width,
- gdouble height,
- gboolean filled);
+GimpCanvasItem * gimp_canvas_rectangle_new (GimpDisplayShell *shell,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height,
+ gboolean filled);
#endif /* __GIMP_CANVAS_RECTANGLE_H__ */
diff --git a/app/display/gimpcanvassamplepoint.c b/app/display/gimpcanvassamplepoint.c
index 5bf220d..cd60d85 100644
--- a/app/display/gimpcanvassamplepoint.c
+++ b/app/display/gimpcanvassamplepoint.c
@@ -323,11 +323,15 @@ gimp_canvas_sample_point_fill (GimpCanvasItem *item,
}
GimpCanvasItem *
-gimp_canvas_sample_point_new (gint x,
- gint y,
- gint index)
+gimp_canvas_sample_point_new (GimpDisplayShell *shell,
+ gint x,
+ gint y,
+ gint index)
{
+ g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
+
return g_object_new (GIMP_TYPE_CANVAS_SAMPLE_POINT,
+ "shell", shell,
"x", x,
"y", y,
"index", index,
diff --git a/app/display/gimpcanvassamplepoint.h b/app/display/gimpcanvassamplepoint.h
index d233d19..053a14a 100644
--- a/app/display/gimpcanvassamplepoint.h
+++ b/app/display/gimpcanvassamplepoint.h
@@ -49,9 +49,10 @@ struct _GimpCanvasSamplePointClass
GType gimp_canvas_sample_point_get_type (void) G_GNUC_CONST;
-GimpCanvasItem * gimp_canvas_sample_point_new (gint x,
- gint y,
- gint index);
+GimpCanvasItem * gimp_canvas_sample_point_new (GimpDisplayShell *shell,
+ gint x,
+ gint y,
+ gint index);
#endif /* __GIMP_CANVAS_SAMPLE_POINT_H__ */
diff --git a/app/display/gimpcanvastextcursor.c b/app/display/gimpcanvastextcursor.c
index 76c6bec..34d6b59 100644
--- a/app/display/gimpcanvastextcursor.c
+++ b/app/display/gimpcanvastextcursor.c
@@ -294,10 +294,15 @@ gimp_canvas_text_cursor_get_extents (GimpCanvasItem *item,
}
GimpCanvasItem *
-gimp_canvas_text_cursor_new (PangoRectangle *cursor,
- gboolean overwrite)
+gimp_canvas_text_cursor_new (GimpDisplayShell *shell,
+ PangoRectangle *cursor,
+ gboolean overwrite)
{
+ g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
+ g_return_val_if_fail (cursor != NULL, NULL);
+
return g_object_new (GIMP_TYPE_CANVAS_TEXT_CURSOR,
+ "shell", shell,
"x", cursor->x,
"y", cursor->y,
"width", cursor->width,
diff --git a/app/display/gimpcanvastextcursor.h b/app/display/gimpcanvastextcursor.h
index 8b05dcb..34e0c5c 100644
--- a/app/display/gimpcanvastextcursor.h
+++ b/app/display/gimpcanvastextcursor.h
@@ -49,8 +49,9 @@ struct _GimpCanvasTextCursorClass
GType gimp_canvas_text_cursor_get_type (void) G_GNUC_CONST;
-GimpCanvasItem * gimp_canvas_text_cursor_new (PangoRectangle *cursor,
- gboolean overwrite);
+GimpCanvasItem * gimp_canvas_text_cursor_new (GimpDisplayShell *shell,
+ PangoRectangle *cursor,
+ gboolean overwrite);
#endif /* __GIMP_CANVAS_RECTANGLE_H__ */
diff --git a/app/display/gimpdisplayshell-handlers.c b/app/display/gimpdisplayshell-handlers.c
index a504d29..6b53a1f 100644
--- a/app/display/gimpdisplayshell-handlers.c
+++ b/app/display/gimpdisplayshell-handlers.c
@@ -543,7 +543,8 @@ gimp_display_shell_guide_add_handler (GimpImage *image,
GimpCanvasProxyGroup *group = GIMP_CANVAS_PROXY_GROUP (shell->guides);
GimpCanvasItem *item;
- item = gimp_canvas_guide_new (gimp_guide_get_orientation (guide),
+ item = gimp_canvas_guide_new (shell,
+ gimp_guide_get_orientation (guide),
gimp_guide_get_position (guide));
g_object_set (item, "guide-style", TRUE, NULL);
@@ -598,7 +599,8 @@ gimp_display_shell_sample_point_add_handler (GimpImage *image,
GList *list;
gint i;
- item = gimp_canvas_sample_point_new (sample_point->x,
+ item = gimp_canvas_sample_point_new (shell,
+ sample_point->x,
sample_point->y,
0);
g_object_set (item, "sample-point-style", TRUE, NULL);
diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c
index b6eed94..36dd15e 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -291,14 +291,14 @@ gimp_display_shell_init (GimpDisplayShell *shell)
GIMP_DISPLAY_RENDER_BUF_WIDTH,
GIMP_DISPLAY_RENDER_BUF_HEIGHT);
- shell->canvas_item = gimp_canvas_group_new ();
+ shell->canvas_item = gimp_canvas_group_new (shell);
- shell->guides = gimp_canvas_proxy_group_new ();
+ shell->guides = gimp_canvas_proxy_group_new (shell);
gimp_canvas_group_add_item (GIMP_CANVAS_GROUP (shell->canvas_item),
shell->guides);
g_object_unref (shell->guides);
- shell->sample_points = gimp_canvas_proxy_group_new ();
+ shell->sample_points = gimp_canvas_proxy_group_new (shell);
gimp_canvas_group_add_item (GIMP_CANVAS_GROUP (shell->canvas_item),
shell->sample_points);
g_object_unref (shell->sample_points);
diff --git a/app/tools/gimpdrawtool.c b/app/tools/gimpdrawtool.c
index 38540f0..11e2a05 100644
--- a/app/tools/gimpdrawtool.c
+++ b/app/tools/gimpdrawtool.c
@@ -346,7 +346,7 @@ gimp_draw_tool_add_item (GimpDrawTool *draw_tool,
g_return_if_fail (GIMP_IS_CANVAS_ITEM (item));
if (! draw_tool->item)
- draw_tool->item = gimp_canvas_group_new ();
+ draw_tool->item = gimp_canvas_group_new (gimp_display_get_shell (draw_tool->display));
gimp_canvas_group_add_item (GIMP_CANVAS_GROUP (draw_tool->item), item);
}
@@ -385,7 +385,8 @@ gimp_draw_tool_add_line (GimpDrawTool *draw_tool,
g_return_val_if_fail (GIMP_IS_DRAW_TOOL (draw_tool), NULL);
- item = gimp_canvas_line_new (x1, y1, x2, y2);
+ item = gimp_canvas_line_new (gimp_display_get_shell (draw_tool->display),
+ x1, y1, x2, y2);
gimp_draw_tool_add_item (draw_tool, item);
g_object_unref (item);
@@ -410,7 +411,8 @@ gimp_draw_tool_add_guide (GimpDrawTool *draw_tool,
g_return_val_if_fail (GIMP_IS_DRAW_TOOL (draw_tool), NULL);
- item = gimp_canvas_guide_new (orientation, position);
+ item = gimp_canvas_guide_new (gimp_display_get_shell (draw_tool->display),
+ orientation, position);
gimp_draw_tool_add_item (draw_tool, item);
g_object_unref (item);
@@ -437,7 +439,8 @@ gimp_draw_tool_add_sample_point (GimpDrawTool *draw_tool,
g_return_val_if_fail (GIMP_IS_DRAW_TOOL (draw_tool), NULL);
- item = gimp_canvas_sample_point_new (x, y, index);
+ item = gimp_canvas_sample_point_new (gimp_display_get_shell (draw_tool->display),
+ x, y, index);
gimp_draw_tool_add_item (draw_tool, item);
g_object_unref (item);
@@ -469,7 +472,8 @@ gimp_draw_tool_add_rectangle (GimpDrawTool *draw_tool,
g_return_val_if_fail (GIMP_IS_DRAW_TOOL (draw_tool), NULL);
- item = gimp_canvas_rectangle_new (x, y, width, height, filled);
+ item = gimp_canvas_rectangle_new (gimp_display_get_shell (draw_tool->display),
+ x, y, width, height, filled);
gimp_draw_tool_add_item (draw_tool, item);
g_object_unref (item);
@@ -491,7 +495,8 @@ gimp_draw_tool_add_arc (GimpDrawTool *draw_tool,
g_return_val_if_fail (GIMP_IS_DRAW_TOOL (draw_tool), NULL);
- item = gimp_canvas_arc_new (x + width / 2.0,
+ item = gimp_canvas_arc_new (gimp_display_get_shell (draw_tool->display),
+ x + width / 2.0,
y + height / 2.0,
width / 2.0,
height / 2.0,
@@ -518,7 +523,8 @@ gimp_draw_tool_add_handle (GimpDrawTool *draw_tool,
g_return_val_if_fail (GIMP_IS_DRAW_TOOL (draw_tool), NULL);
- item = gimp_canvas_handle_new (type, anchor, x, y, width, height);
+ item = gimp_canvas_handle_new (gimp_display_get_shell (draw_tool->display),
+ type, anchor, x, y, width, height);
gimp_draw_tool_add_item (draw_tool, item);
g_object_unref (item);
@@ -559,7 +565,8 @@ gimp_draw_tool_add_corner (GimpDrawTool *draw_tool,
g_return_val_if_fail (GIMP_IS_DRAW_TOOL (draw_tool), NULL);
- item = gimp_canvas_corner_new (x1, y1, x2 - x1, y2 - y1,
+ item = gimp_canvas_corner_new (gimp_display_get_shell (draw_tool->display),
+ x1, y1, x2 - x1, y2 - y1,
anchor, width, height, put_outside);
gimp_canvas_item_set_highlight (item, highlight);
@@ -582,7 +589,8 @@ gimp_draw_tool_add_lines (GimpDrawTool *draw_tool,
if (points == NULL || n_points < 2)
return NULL;
- item = gimp_canvas_polygon_new (points, n_points, filled);
+ item = gimp_canvas_polygon_new (gimp_display_get_shell (draw_tool->display),
+ points, n_points, filled);
gimp_draw_tool_add_item (draw_tool, item);
g_object_unref (item);
@@ -603,7 +611,8 @@ gimp_draw_tool_add_strokes (GimpDrawTool *draw_tool,
if (points == NULL || n_points < 2)
return NULL;
- item = gimp_canvas_polygon_new_from_coords (points, n_points, filled);
+ item = gimp_canvas_polygon_new_from_coords (gimp_display_get_shell (draw_tool->display),
+ points, n_points, filled);
gimp_draw_tool_add_item (draw_tool, item);
g_object_unref (item);
@@ -637,7 +646,8 @@ gimp_draw_tool_add_boundary (GimpDrawTool *draw_tool,
g_return_val_if_fail (n_bound_segs > 0, NULL);
g_return_val_if_fail (bound_segs != NULL, NULL);
- item = gimp_canvas_boundary_new (bound_segs, n_bound_segs,
+ item = gimp_canvas_boundary_new (gimp_display_get_shell (draw_tool->display),
+ bound_segs, n_bound_segs,
offset_x, offset_y);
gimp_draw_tool_add_item (draw_tool, item);
@@ -655,7 +665,8 @@ gimp_draw_tool_add_text_cursor (GimpDrawTool *draw_tool,
g_return_val_if_fail (GIMP_IS_DRAW_TOOL (draw_tool), NULL);
- item = gimp_canvas_text_cursor_new (cursor, overwrite);
+ item = gimp_canvas_text_cursor_new (gimp_display_get_shell (draw_tool->display),
+ cursor, overwrite);
gimp_draw_tool_add_item (draw_tool, item);
g_object_unref (item);
diff --git a/app/tools/gimpfreeselecttool.c b/app/tools/gimpfreeselecttool.c
index 05d3f55..078225d 100644
--- a/app/tools/gimpfreeselecttool.c
+++ b/app/tools/gimpfreeselecttool.c
@@ -1545,7 +1545,7 @@ gimp_free_select_tool_draw (GimpDrawTool *draw_tool)
NO_CLICK_TIME_AVAILABLE,
&coords);
- stroke_group = gimp_canvas_group_new ();
+ stroke_group = gimp_canvas_group_new (gimp_display_get_shell (draw_tool->display));
gimp_canvas_group_set_group_stroking (GIMP_CANVAS_GROUP (stroke_group),
TRUE);
gimp_draw_tool_add_item (draw_tool, stroke_group);
diff --git a/app/tools/gimpmeasuretool.c b/app/tools/gimpmeasuretool.c
index 8a2c36f..eff18cd 100644
--- a/app/tools/gimpmeasuretool.c
+++ b/app/tools/gimpmeasuretool.c
@@ -660,7 +660,7 @@ gimp_measure_tool_draw (GimpDrawTool *draw_tool)
gint i;
gint draw_arc = 0;
- stroke_group = gimp_canvas_group_new ();
+ stroke_group = gimp_canvas_group_new (gimp_display_get_shell (draw_tool->display));
gimp_canvas_group_set_group_stroking (GIMP_CANVAS_GROUP (stroke_group),
TRUE);
gimp_draw_tool_add_item (draw_tool, stroke_group);
diff --git a/app/tools/gimpperspectiveclonetool.c b/app/tools/gimpperspectiveclonetool.c
index 0d69fe0..e5852ba 100644
--- a/app/tools/gimpperspectiveclonetool.c
+++ b/app/tools/gimpperspectiveclonetool.c
@@ -750,7 +750,7 @@ gimp_perspective_clone_tool_draw (GimpDrawTool *draw_tool)
GimpCanvasItem *stroke_group;
GimpCanvasItem *item;
- stroke_group = gimp_canvas_group_new ();
+ stroke_group = gimp_canvas_group_new (gimp_display_get_shell (draw_tool->display));
gimp_canvas_group_set_group_stroking (GIMP_CANVAS_GROUP (stroke_group),
TRUE);
gimp_draw_tool_add_item (draw_tool, stroke_group);
diff --git a/app/tools/gimprectangletool.c b/app/tools/gimprectangletool.c
index 9996c69..b8c3b3a 100644
--- a/app/tools/gimprectangletool.c
+++ b/app/tools/gimprectangletool.c
@@ -1738,7 +1738,7 @@ gimp_rectangle_tool_draw (GimpDrawTool *draw_tool)
if (private->function == GIMP_RECTANGLE_TOOL_INACTIVE)
return;
- stroke_group = gimp_canvas_group_new ();
+ stroke_group = gimp_canvas_group_new (gimp_display_get_shell (draw_tool->display));
gimp_canvas_group_set_group_stroking (GIMP_CANVAS_GROUP (stroke_group),
TRUE);
gimp_draw_tool_add_item (draw_tool, stroke_group);
diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c
index 4a12771..440c815 100644
--- a/app/tools/gimptexttool.c
+++ b/app/tools/gimptexttool.c
@@ -833,7 +833,7 @@ gimp_text_tool_draw_selection (GimpDrawTool *draw_tool)
gint min, max;
gint i;
- fill_group = gimp_canvas_group_new ();
+ fill_group = gimp_canvas_group_new (gimp_display_get_shell (draw_tool->display));
gimp_canvas_group_set_group_filling (GIMP_CANVAS_GROUP (fill_group), TRUE);
gimp_draw_tool_add_item (draw_tool, fill_group);
g_object_unref (fill_group);
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index d72c8b8..b47ec7d 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -785,7 +785,7 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool)
GimpCanvasItem *item;
gdouble z1, z2, z3, z4;
- stroke_group = gimp_canvas_group_new ();
+ stroke_group = gimp_canvas_group_new (gimp_display_get_shell (draw_tool->display));
gimp_canvas_group_set_group_stroking (GIMP_CANVAS_GROUP (stroke_group),
TRUE);
gimp_draw_tool_add_item (draw_tool, stroke_group);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]