Commit 2ced18cc authored by Michael Natterer's avatar Michael Natterer 😴

app: add gimp_draw_tool_add_sample_point()

and use it in the color tool. Also rename
gimp_draw_tool_add_guide_line() to gimp_draw_tool_add_guide().
parent cbd1d8cd
......@@ -43,7 +43,7 @@
#include "widgets/gimppaletteeditor.h"
#include "widgets/gimpsessioninfo.h"
#include "display/gimpcanvassamplepoint.h"
#include "display/gimpcanvasitem.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "display/gimpdisplayshell-appearance.h"
......@@ -533,14 +533,12 @@ gimp_color_tool_draw (GimpDrawTool *draw_tool)
index = g_list_index (gimp_image_get_sample_points (image),
color_tool->sample_point) + 1;
item = gimp_canvas_sample_point_new (color_tool->sample_point->x,
color_tool->sample_point->y,
index);
item = gimp_draw_tool_add_sample_point (draw_tool,
color_tool->sample_point->x,
color_tool->sample_point->y,
index);
g_object_set (item, "sample-point-style", TRUE, NULL);
gimp_canvas_item_set_highlight (item, TRUE);
gimp_draw_tool_add_item (draw_tool, item);
g_object_unref (item);
}
if (color_tool->moving_sample_point)
......
......@@ -42,6 +42,7 @@
#include "display/gimpcanvasline.h"
#include "display/gimpcanvaspolygon.h"
#include "display/gimpcanvasrectangle.h"
#include "display/gimpcanvassamplepoint.h"
#include "display/gimpcanvastextcursor.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
......@@ -401,9 +402,9 @@ gimp_draw_tool_add_line (GimpDrawTool *draw_tool,
* This function draws a guide line across the canvas.
**/
GimpCanvasItem *
gimp_draw_tool_add_guide_line (GimpDrawTool *draw_tool,
GimpOrientationType orientation,
gint position)
gimp_draw_tool_add_guide (GimpDrawTool *draw_tool,
GimpOrientationType orientation,
gint position)
{
GimpCanvasItem *item;
......@@ -417,6 +418,33 @@ gimp_draw_tool_add_guide_line (GimpDrawTool *draw_tool,
return item;
}
/**
* gimp_draw_tool_draw_sample_point:
* @draw_tool: the #GimpDrawTool
* @x: X position of the sample point
* @y: Y position of the sample point
* @index: Index of the sample point
*
* This function draws a sample point
**/
GimpCanvasItem *
gimp_draw_tool_add_sample_point (GimpDrawTool *draw_tool,
gint x,
gint y,
gint index)
{
GimpCanvasItem *item;
g_return_val_if_fail (GIMP_IS_DRAW_TOOL (draw_tool), NULL);
item = gimp_canvas_sample_point_new (x, y, index);
gimp_draw_tool_add_item (draw_tool, item);
g_object_unref (item);
return item;
}
/**
* gimp_draw_tool_add_rectangle:
* @draw_tool: the #GimpDrawTool
......
......@@ -89,9 +89,13 @@ GimpCanvasItem * gimp_draw_tool_add_line (GimpDrawTool *draw_too
gdouble y1,
gdouble x2,
gdouble y2);
GimpCanvasItem * gimp_draw_tool_add_guide_line (GimpDrawTool *draw_tool,
GimpCanvasItem * gimp_draw_tool_add_guide (GimpDrawTool *draw_tool,
GimpOrientationType orientation,
gint position);
GimpCanvasItem * gimp_draw_tool_add_sample_point (GimpDrawTool *draw_tool,
gint x,
gint y,
gint index);
GimpCanvasItem * gimp_draw_tool_add_rectangle (GimpDrawTool *draw_tool,
gboolean filled,
gdouble x,
......
......@@ -755,9 +755,9 @@ gimp_move_tool_draw (GimpDrawTool *draw_tool)
{
GimpCanvasItem *item;
item = gimp_draw_tool_add_guide_line (draw_tool,
gimp_guide_get_orientation (move->guide),
gimp_guide_get_position (move->guide));
item = gimp_draw_tool_add_guide (draw_tool,
gimp_guide_get_orientation (move->guide),
gimp_guide_get_position (move->guide));
g_object_set (item, "guide-style", TRUE, NULL);
gimp_canvas_item_set_highlight (item, TRUE);
......@@ -765,9 +765,9 @@ gimp_move_tool_draw (GimpDrawTool *draw_tool)
if (move->moving_guide && move->guide_position != -1)
{
gimp_draw_tool_add_guide_line (draw_tool,
move->guide_orientation,
move->guide_position);
gimp_draw_tool_add_guide (draw_tool,
move->guide_orientation,
move->guide_position);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment