mirror of https://github.com/GNOME/gimp.git
app: add gimp_draw_tool_add_stroke_group() and add_fill_group()
and use it in all tools which have groups.
This commit is contained in:
parent
201bfe3e25
commit
33ab94517f
|
@ -362,6 +362,38 @@ gimp_draw_tool_remove_item (GimpDrawTool *draw_tool,
|
|||
gimp_canvas_group_remove_item (GIMP_CANVAS_GROUP (draw_tool->item), item);
|
||||
}
|
||||
|
||||
GimpCanvasItem *
|
||||
gimp_draw_tool_add_stroke_group (GimpDrawTool *draw_tool)
|
||||
{
|
||||
GimpCanvasItem *item;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_DRAW_TOOL (draw_tool), NULL);
|
||||
|
||||
item = gimp_canvas_group_new (gimp_display_get_shell (draw_tool->display));
|
||||
gimp_canvas_group_set_group_stroking (GIMP_CANVAS_GROUP (item), TRUE);
|
||||
|
||||
gimp_draw_tool_add_item (draw_tool, item);
|
||||
g_object_unref (item);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
GimpCanvasItem *
|
||||
gimp_draw_tool_add_fill_group (GimpDrawTool *draw_tool)
|
||||
{
|
||||
GimpCanvasItem *item;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_DRAW_TOOL (draw_tool), NULL);
|
||||
|
||||
item = gimp_canvas_group_new (gimp_display_get_shell (draw_tool->display));
|
||||
gimp_canvas_group_set_group_filling (GIMP_CANVAS_GROUP (item), TRUE);
|
||||
|
||||
gimp_draw_tool_add_item (draw_tool, item);
|
||||
g_object_unref (item);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_draw_tool_add_line:
|
||||
* @draw_tool: the #GimpDrawTool
|
||||
|
|
|
@ -84,6 +84,9 @@ void gimp_draw_tool_add_item (GimpDrawTool *draw_too
|
|||
void gimp_draw_tool_remove_item (GimpDrawTool *draw_tool,
|
||||
GimpCanvasItem *item);
|
||||
|
||||
GimpCanvasItem * gimp_draw_tool_add_stroke_group (GimpDrawTool *draw_tool);
|
||||
GimpCanvasItem * gimp_draw_tool_add_fill_group (GimpDrawTool *draw_tool);
|
||||
|
||||
GimpCanvasItem * gimp_draw_tool_add_line (GimpDrawTool *draw_tool,
|
||||
gdouble x1,
|
||||
gdouble y1,
|
||||
|
|
|
@ -1545,11 +1545,7 @@ gimp_free_select_tool_draw (GimpDrawTool *draw_tool)
|
|||
NO_CLICK_TIME_AVAILABLE,
|
||||
&coords);
|
||||
|
||||
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);
|
||||
g_object_unref (stroke_group);
|
||||
stroke_group = gimp_draw_tool_add_stroke_group (draw_tool);
|
||||
|
||||
item = gimp_draw_tool_add_lines (draw_tool,
|
||||
priv->points, priv->n_points,
|
||||
|
|
|
@ -660,11 +660,7 @@ gimp_measure_tool_draw (GimpDrawTool *draw_tool)
|
|||
gint i;
|
||||
gint draw_arc = 0;
|
||||
|
||||
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);
|
||||
g_object_unref (stroke_group);
|
||||
stroke_group = gimp_draw_tool_add_stroke_group (draw_tool);
|
||||
|
||||
for (i = 0; i < measure->num_points; i++)
|
||||
{
|
||||
|
|
|
@ -750,11 +750,7 @@ gimp_perspective_clone_tool_draw (GimpDrawTool *draw_tool)
|
|||
GimpCanvasItem *stroke_group;
|
||||
GimpCanvasItem *item;
|
||||
|
||||
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);
|
||||
g_object_unref (stroke_group);
|
||||
stroke_group = gimp_draw_tool_add_stroke_group (draw_tool);
|
||||
|
||||
/* draw the bounding box */
|
||||
item = gimp_draw_tool_add_line (draw_tool,
|
||||
|
|
|
@ -1738,11 +1738,7 @@ gimp_rectangle_tool_draw (GimpDrawTool *draw_tool)
|
|||
if (private->function == GIMP_RECTANGLE_TOOL_INACTIVE)
|
||||
return;
|
||||
|
||||
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);
|
||||
g_object_unref (stroke_group);
|
||||
stroke_group = gimp_draw_tool_add_stroke_group (draw_tool);
|
||||
|
||||
gimp_rectangle_tool_draw_guides (draw_tool, GIMP_CANVAS_GROUP (stroke_group));
|
||||
|
||||
|
|
|
@ -833,10 +833,7 @@ gimp_text_tool_draw_selection (GimpDrawTool *draw_tool)
|
|||
gint min, max;
|
||||
gint i;
|
||||
|
||||
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);
|
||||
fill_group = gimp_draw_tool_add_fill_group (draw_tool);
|
||||
|
||||
gtk_text_buffer_get_selection_bounds (buffer, &sel_start, &sel_end);
|
||||
|
||||
|
|
|
@ -785,11 +785,7 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool)
|
|||
GimpCanvasItem *item;
|
||||
gdouble z1, z2, z3, z4;
|
||||
|
||||
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);
|
||||
g_object_unref (stroke_group);
|
||||
stroke_group = gimp_draw_tool_add_stroke_group (draw_tool);
|
||||
|
||||
if (tr_tool->use_grid)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue