app: make sure the size circle is also displayed for the ink tool.

Note that the other paint tool which is not as common as others is the
MyPaint brush tool. At first I thought the circle outline didn't work.
It does actually work, but the radius concept is simply very weird in
this tool so we have to move a lot. To be investigated.
This commit is contained in:
Jehan 2022-03-14 22:54:26 +01:00
parent 5be997fbdf
commit 8e9abd5e85
1 changed files with 31 additions and 6 deletions

View File

@ -37,12 +37,16 @@
#include "gimp-intl.h"
static GimpCanvasItem * gimp_ink_tool_get_outline (GimpPaintTool *paint_tool,
GimpDisplay *display,
gdouble x,
gdouble y);
static gboolean gimp_ink_tool_is_alpha_only (GimpPaintTool *paint_tool,
GimpDrawable *drawable);
static GimpCanvasItem * gimp_ink_tool_get_outline (GimpPaintTool *paint_tool,
GimpDisplay *display,
gdouble x,
gdouble y);
static gboolean gimp_ink_tool_is_alpha_only (GimpPaintTool *paint_tool,
GimpDrawable *drawable);
static void gimp_ink_tool_options_notify (GimpTool *tool,
GimpToolOptions *options,
const GParamSpec *pspec);
G_DEFINE_TYPE (GimpInkTool, gimp_ink_tool, GIMP_TYPE_PAINT_TOOL)
@ -73,8 +77,11 @@ gimp_ink_tool_register (GimpToolRegisterCallback callback,
static void
gimp_ink_tool_class_init (GimpInkToolClass *klass)
{
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
GimpPaintToolClass *paint_tool_class = GIMP_PAINT_TOOL_CLASS (klass);
tool_class->options_notify = gimp_ink_tool_options_notify;
paint_tool_class->get_outline = gimp_ink_tool_get_outline;
paint_tool_class->is_alpha_only = gimp_ink_tool_is_alpha_only;
}
@ -96,6 +103,24 @@ gimp_ink_tool_init (GimpInkTool *ink_tool)
GIMP_COLOR_PICK_TARGET_FOREGROUND);
}
static void
gimp_ink_tool_options_notify (GimpTool *tool,
GimpToolOptions *options,
const GParamSpec *pspec)
{
GIMP_TOOL_CLASS (parent_class)->options_notify (tool, options, pspec);
if (g_strcmp0 (pspec->name, "size") == 0 &&
GIMP_PAINT_TOOL (tool)->draw_brush)
{
/* This triggers a redraw of the tool pointer, especially useful
* here when we change the pen size with on-canvas interaction.
*/
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
}
}
static GimpCanvasItem *
gimp_ink_tool_get_outline (GimpPaintTool *paint_tool,
GimpDisplay *display,