[gimp] app: put the lines and the angle arc into a stroke group
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: put the lines and the angle arc into a stroke group
- Date: Sun, 26 Sep 2010 13:50:01 +0000 (UTC)
commit e0f35d89792d720a59d4eaee522f676a37e058ec
Author: Michael Natterer <mitch gimp org>
Date: Sun Sep 26 15:49:10 2010 +0200
app: put the lines and the angle arc into a stroke group
This looks much better, and makes the lines appear under the handles
as a nice side effect.
app/tools/gimpmeasuretool.c | 44 +++++++++++++++++++++++++++++-------------
1 files changed, 30 insertions(+), 14 deletions(-)
---
diff --git a/app/tools/gimpmeasuretool.c b/app/tools/gimpmeasuretool.c
index 0279e29..4cd2288 100644
--- a/app/tools/gimpmeasuretool.c
+++ b/app/tools/gimpmeasuretool.c
@@ -42,6 +42,7 @@
#include "widgets/gimptooldialog.h"
#include "widgets/gimpwidgets-utils.h"
+#include "display/gimpcanvasgroup.h"
#include "display/gimpcanvashandle.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
@@ -663,9 +664,17 @@ gimp_measure_tool_draw (GimpDrawTool *draw_tool)
{
GimpMeasureTool *measure = GIMP_MEASURE_TOOL (draw_tool);
GimpTool *tool = GIMP_TOOL (draw_tool);
+ GimpCanvasItem *stroke_group;
+ GimpCanvasItem *item;
gint i;
gint draw_arc = 0;
+ stroke_group = gimp_canvas_group_new ();
+ 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);
+
for (i = 0; i < measure->num_points; i++)
{
if (i == 0 && measure->num_points == 3)
@@ -691,11 +700,14 @@ gimp_measure_tool_draw (GimpDrawTool *draw_tool)
if (i > 0)
{
- gimp_draw_tool_add_line (draw_tool,
- measure->x[0],
- measure->y[0],
- measure->x[i],
- measure->y[i]);
+ item = gimp_draw_tool_add_line (draw_tool,
+ measure->x[0],
+ measure->y[0],
+ measure->x[i],
+ measure->y[i]);
+
+ gimp_canvas_group_add_item (GIMP_CANVAS_GROUP (stroke_group), item);
+ gimp_draw_tool_remove_item (draw_tool, item);
/* only draw the arc if the lines are long enough */
if (gimp_draw_tool_calc_distance (draw_tool, tool->display,
@@ -722,8 +734,6 @@ gimp_measure_tool_draw (GimpDrawTool *draw_tool)
if (angle2 != 0.0)
{
- GimpCanvasItem *item;
-
item = gimp_draw_tool_add_handle (draw_tool,
GIMP_HANDLE_CIRCLE,
measure->x[0],
@@ -735,6 +745,9 @@ gimp_measure_tool_draw (GimpDrawTool *draw_tool)
gimp_canvas_handle_set_angles (GIMP_CANVAS_HANDLE (item),
angle1, angle2);
+ gimp_canvas_group_add_item (GIMP_CANVAS_GROUP (stroke_group), item);
+ gimp_draw_tool_remove_item (draw_tool, item);
+
if (measure->num_points == 2)
{
GimpDisplayShell *shell;
@@ -746,13 +759,16 @@ gimp_measure_tool_draw (GimpDrawTool *draw_tool)
target = FUNSCALEX (shell, (TARGET >> 1));
arc_radius = FUNSCALEX (shell, ARC_RADIUS);
- gimp_draw_tool_add_line (draw_tool,
- measure->x[0],
- measure->y[0],
- (measure->x[1] >= measure->x[0] ?
- measure->x[0] + arc_radius + target :
- measure->x[0] - arc_radius - target),
- measure->y[0]);
+ item = gimp_draw_tool_add_line (draw_tool,
+ measure->x[0],
+ measure->y[0],
+ (measure->x[1] >= measure->x[0] ?
+ measure->x[0] + arc_radius + target :
+ measure->x[0] - arc_radius - target),
+ measure->y[0]);
+
+ gimp_canvas_group_add_item (GIMP_CANVAS_GROUP (stroke_group), item);
+ gimp_draw_tool_remove_item (draw_tool, item);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]