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.
This commit is contained in:
Michael Natterer 2010-10-01 14:13:45 +02:00
parent 26d0035be0
commit 201bfe3e25
34 changed files with 232 additions and 124 deletions

View File

@ -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,

View File

@ -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__ */

View File

@ -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);

View File

@ -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__ */

View File

@ -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,

View File

@ -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__ */

View File

@ -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

View File

@ -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__ */

View File

@ -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);

View File

@ -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);

View File

@ -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,

View File

@ -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,

View File

@ -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,12 +132,24 @@ 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;
private->suspend_filling = 0;
}
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,
@ -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;

View File

@ -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);
}

View File

@ -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__ */

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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,

View File

@ -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,

View File

@ -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__ */

View File

@ -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,

View File

@ -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__ */

View File

@ -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,

View File

@ -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__ */

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);