[gimp/wip/Jehan/issue-498-quick-brush-edit: 509/523] app: make sure the size circle is also displayed for the ink tool.




commit 0f3fd1aa949a3ff75cf89ec302f509f3c53346ab
Author: Jehan <jehan girinstud io>
Date:   Mon Mar 14 22:54:26 2022 +0100

    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.

 app/tools/gimpinktool.c | 37 +++++++++++++++++++++++++++++++------
 1 file changed, 31 insertions(+), 6 deletions(-)
---
diff --git a/app/tools/gimpinktool.c b/app/tools/gimpinktool.c
index 4935f7b7cc..6aacd20013 100644
--- a/app/tools/gimpinktool.c
+++ b/app/tools/gimpinktool.c
@@ -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,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]