From e56e3720b2fb59bfd4795bf84f9850d563a7fff0 Mon Sep 17 00:00:00 2001
From: Mark <mr.mark.sweeney@gmail.com>
Date: Tue, 17 Oct 2023 18:56:02 +0100
Subject: [PATCH 1/2] bigger canvas handles

---
 app/display/gimpcanvashandle.h | 10 +++++-----
 app/tools/gimpdrawtool.h       | 10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/app/display/gimpcanvashandle.h b/app/display/gimpcanvashandle.h
index 0dea9572de4..b67136eb323 100644
--- a/app/display/gimpcanvashandle.h
+++ b/app/display/gimpcanvashandle.h
@@ -25,11 +25,11 @@
 #include "gimpcanvasitem.h"
 
 
-#define GIMP_CANVAS_HANDLE_SIZE_CIRCLE    13
-#define GIMP_CANVAS_HANDLE_SIZE_CROSS     15
-#define GIMP_CANVAS_HANDLE_SIZE_CROSSHAIR 43
-#define GIMP_CANVAS_HANDLE_SIZE_LARGE     25
-#define GIMP_CANVAS_HANDLE_SIZE_SMALL     7
+#define GIMP_CANVAS_HANDLE_SIZE_CIRCLE    23
+#define GIMP_CANVAS_HANDLE_SIZE_CROSS     26
+#define GIMP_CANVAS_HANDLE_SIZE_CROSSHAIR 75
+#define GIMP_CANVAS_HANDLE_SIZE_LARGE     44
+#define GIMP_CANVAS_HANDLE_SIZE_SMALL     12
 
 
 #define GIMP_TYPE_CANVAS_HANDLE            (gimp_canvas_handle_get_type ())
diff --git a/app/tools/gimpdrawtool.h b/app/tools/gimpdrawtool.h
index 489fb74ff79..ac7a09241b9 100644
--- a/app/tools/gimpdrawtool.h
+++ b/app/tools/gimpdrawtool.h
@@ -22,11 +22,11 @@
 #include "gimptool.h"
 
 
-#define GIMP_TOOL_HANDLE_SIZE_CIRCLE    13
-#define GIMP_TOOL_HANDLE_SIZE_CROSS     15
-#define GIMP_TOOL_HANDLE_SIZE_CROSSHAIR 43
-#define GIMP_TOOL_HANDLE_SIZE_LARGE     25
-#define GIMP_TOOL_HANDLE_SIZE_SMALL     7
+#define GIMP_TOOL_HANDLE_SIZE_CIRCLE    23
+#define GIMP_TOOL_HANDLE_SIZE_CROSS     26
+#define GIMP_TOOL_HANDLE_SIZE_CROSSHAIR 75
+#define GIMP_TOOL_HANDLE_SIZE_LARGE     44
+#define GIMP_TOOL_HANDLE_SIZE_SMALL     12
 
 
 #define GIMP_TYPE_DRAW_TOOL            (gimp_draw_tool_get_type ())
-- 
GitLab


From 0c2149d8a8aa89338a577ada4adeb28c196ea4d0 Mon Sep 17 00:00:00 2001
From: Mark <mr.mark.sweeney@gmail.com>
Date: Fri, 27 Oct 2023 20:37:47 +0100
Subject: [PATCH 2/2] handle preference

---
 app/config/gimpdisplayconfig.c   | 30 ++++++++++++++++++++++++++
 app/config/gimpdisplayconfig.h   |  2 ++
 app/config/gimprc-blurbs.h       |  6 ++++++
 app/dialogs/preferences-dialog.c | 12 +++++++++++
 app/display/gimptoolpath.c       | 36 +++++++++++++++++++-------------
 app/widgets/gimpcurveview.c      | 20 +++++++++++++-----
 6 files changed, 87 insertions(+), 19 deletions(-)

diff --git a/app/config/gimpdisplayconfig.c b/app/config/gimpdisplayconfig.c
index 1037b81924b..8f0bd401636 100644
--- a/app/config/gimpdisplayconfig.c
+++ b/app/config/gimpdisplayconfig.c
@@ -40,6 +40,8 @@
 #define DEFAULT_ACTIVATE_ON_FOCUS    TRUE
 #define DEFAULT_MONITOR_RESOLUTION   96.0
 #define DEFAULT_MARCHING_ANTS_SPEED  200
+#define DEFAULT_CANVAS_HANDLE_SIZE   16
+#define DEFAULT_CURVE_HANDLE_SIZE    9
 #define DEFAULT_USE_EVENT_HISTORY    FALSE
 
 enum
@@ -51,6 +53,8 @@ enum
   PROP_TRANSPARENCY_CUSTOM_COLOR2,
   PROP_SNAP_DISTANCE,
   PROP_MARCHING_ANTS_SPEED,
+  PROP_CANVAS_HANDLE_SIZE,
+  PROP_CURVE_HANDLE_SIZE,
   PROP_RESIZE_WINDOWS_ON_ZOOM,
   PROP_RESIZE_WINDOWS_ON_RESIZE,
   PROP_DEFAULT_SHOW_ALL,
@@ -165,6 +169,20 @@ gimp_display_config_class_init (GimpDisplayConfigClass *klass)
                         10, 10000, DEFAULT_MARCHING_ANTS_SPEED,
                         GIMP_PARAM_STATIC_STRINGS);
 
+  GIMP_CONFIG_PROP_INT (object_class, PROP_CANVAS_HANDLE_SIZE,
+                      "canvas-handle-size",
+                      "Canvas handle size",
+                      CANVAS_HANDLE_SIZE_BLURB,
+                      4, 40, DEFAULT_CANVAS_HANDLE_SIZE,
+                      GIMP_PARAM_STATIC_STRINGS);
+
+  GIMP_CONFIG_PROP_INT (object_class, PROP_CURVE_HANDLE_SIZE,
+                      "curves-handle-size",
+                      "Curve editing handle size",
+                      CURVE_HANDLE_SIZE_BLURB,
+                      4, 20, DEFAULT_CURVE_HANDLE_SIZE,
+                      GIMP_PARAM_STATIC_STRINGS);
+
   GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_RESIZE_WINDOWS_ON_ZOOM,
                             "resize-windows-on-zoom",
                             "Resize windows on zoom",
@@ -463,6 +481,12 @@ gimp_display_config_set_property (GObject      *object,
     case PROP_MARCHING_ANTS_SPEED:
       display_config->marching_ants_speed = g_value_get_int (value);
       break;
+    case PROP_CANVAS_HANDLE_SIZE:
+      display_config->canvas_handle_size = g_value_get_int (value);
+      break;
+    case PROP_CURVE_HANDLE_SIZE:
+      display_config->curve_handle_size = g_value_get_int (value);
+      break;
     case PROP_RESIZE_WINDOWS_ON_ZOOM:
       display_config->resize_windows_on_zoom = g_value_get_boolean (value);
       break;
@@ -590,6 +614,12 @@ gimp_display_config_get_property (GObject    *object,
     case PROP_MARCHING_ANTS_SPEED:
       g_value_set_int (value, display_config->marching_ants_speed);
       break;
+    case PROP_CANVAS_HANDLE_SIZE:
+      g_value_set_int (value, display_config->canvas_handle_size);
+      break;
+    case PROP_CURVE_HANDLE_SIZE:
+      g_value_set_int (value, display_config->curve_handle_size);
+      break;
     case PROP_RESIZE_WINDOWS_ON_ZOOM:
       g_value_set_boolean (value, display_config->resize_windows_on_zoom);
       break;
diff --git a/app/config/gimpdisplayconfig.h b/app/config/gimpdisplayconfig.h
index 5fb3d15bb5a..bfd8367efae 100644
--- a/app/config/gimpdisplayconfig.h
+++ b/app/config/gimpdisplayconfig.h
@@ -47,6 +47,8 @@ struct _GimpDisplayConfig
   GimpRGB             transparency_custom_color2;
   gint                snap_distance;
   gint                marching_ants_speed;
+  gint                canvas_handle_size;
+  gint                curve_handle_size;
   gboolean            resize_windows_on_zoom;
   gboolean            resize_windows_on_resize;
   gboolean            default_show_all;
diff --git a/app/config/gimprc-blurbs.h b/app/config/gimprc-blurbs.h
index dc7445c8887..062df8487e8 100644
--- a/app/config/gimprc-blurbs.h
+++ b/app/config/gimprc-blurbs.h
@@ -29,6 +29,12 @@ _("Sets the dynamics search path.")
 
 #define TOOL_PRESET_PATH_WRITABLE_BLURB ""
 
+#define CANVAS_HANDLE_SIZE_BLURB \
+_("Sets the canvas handle size used for paths.")
+
+#define CURVE_HANDLE_SIZE_BLURB \
+_("Not yet functioning, curve handles size hardcoded")
+
 #define CANVAS_PADDING_COLOR_BLURB \
 _("Sets the canvas padding color used if the padding mode is set to " \
   "custom color.")
diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c
index 0ac7eabed26..3d471de32b8 100644
--- a/app/dialogs/preferences-dialog.c
+++ b/app/dialogs/preferences-dialog.c
@@ -3202,6 +3202,18 @@ prefs_dialog_new (Gimp       *gimp,
                          _("Marching ants s_peed:"),
                          GTK_GRID (grid), 0, size_group);
 
+  grid = prefs_grid_new (GTK_CONTAINER (vbox2));
+
+  prefs_spin_button_add (object, "canvas-handle-size", 1.0, 10.0, 0,
+                        _("Path _handle size:"),
+                        GTK_GRID (grid), 0, size_group);
+
+  grid = prefs_grid_new (GTK_CONTAINER (vbox2));
+
+  prefs_spin_button_add (object, "curves-handle-size", 1.0, 10.0, 0,
+                        _("_Curve editing handle size:"),
+                        GTK_GRID (grid), 0, size_group);
+
   /*  Zoom & Resize Behavior  */
   vbox2 = prefs_frame_new (_("Zoom & Resize Behavior"),
                            GTK_CONTAINER (vbox), FALSE);
diff --git a/app/display/gimptoolpath.c b/app/display/gimptoolpath.c
index e328e6251fb..6335a03c3ec 100644
--- a/app/display/gimptoolpath.c
+++ b/app/display/gimptoolpath.c
@@ -31,6 +31,7 @@
 #include "libgimpmath/gimpmath.h"
 
 #include "display-types.h"
+#include "config/gimpdisplayconfig.h"
 
 #include "core/gimpcontext.h"
 
@@ -390,6 +391,8 @@ gimp_tool_path_changed (GimpToolWidget *widget)
   GimpToolPath        *path    = GIMP_TOOL_PATH (widget);
   GimpToolPathPrivate *private = path->private;
   GimpVectors         *vectors = private->vectors;
+  GimpDisplayShell    *shell   = gimp_tool_widget_get_shell (widget);
+  GimpDisplayConfig   *config  = GIMP_DISPLAY_CONFIG (shell->display->config);
 
   if (private->items)
     {
@@ -433,8 +436,8 @@ gimp_tool_path_changed (GimpToolWidget *widget)
                                                  GIMP_HANDLE_FILLED_CIRCLE,
                                                  cur_anchor->position.x,
                                                  cur_anchor->position.y,
-                                                 GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
-                                                 GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
+                                                 config->canvas_handle_size,
+                                                 config->canvas_handle_size,
                                                  GIMP_HANDLE_ANCHOR_CENTER);
 
                   if (first)
@@ -517,8 +520,8 @@ gimp_tool_path_changed (GimpToolWidget *widget)
                                                  GIMP_HANDLE_SQUARE,
                                                  cur_anchor->position.x,
                                                  cur_anchor->position.y,
-                                                 GIMP_CANVAS_HANDLE_SIZE_CIRCLE - 3,
-                                                 GIMP_CANVAS_HANDLE_SIZE_CIRCLE - 3,
+                                                 (gint) (config->canvas_handle_size * 0.66),
+                                                 (gint) (config->canvas_handle_size * 0.66),
                                                  GIMP_HANDLE_ANCHOR_CENTER);
 
                   private->items = g_list_prepend (private->items, item);
@@ -571,6 +574,8 @@ gimp_tool_path_button_press (GimpToolWidget      *widget,
 {
   GimpToolPath        *path    = GIMP_TOOL_PATH (widget);
   GimpToolPathPrivate *private = path->private;
+  GimpDisplayShell    *shell   = gimp_tool_widget_get_shell (widget);
+  GimpDisplayConfig   *config  = GIMP_DISPLAY_CONFIG (shell->display->config);
 
   /* do nothing if we are in a FINISHED state */
   if (private->function == VECTORS_FINISHED)
@@ -595,8 +600,8 @@ gimp_tool_path_button_press (GimpToolWidget      *widget,
 
       if (gimp_canvas_item_on_vectors (private->path,
                                        coords,
-                                       GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
-                                       GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
+                                       config->canvas_handle_size,
+                                       config->canvas_handle_size,
                                        NULL, NULL, NULL, NULL, NULL, &vectors))
         {
           gimp_tool_path_set_vectors (path, vectors);
@@ -728,8 +733,8 @@ gimp_tool_path_button_press (GimpToolWidget      *widget,
 
           gimp_canvas_item_on_vectors_handle (private->path,
                                               private->vectors, coords,
-                                              GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
-                                              GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
+                                              config->canvas_handle_size,
+                                              config->canvas_handle_size,
                                               GIMP_ANCHOR_CONTROL, TRUE,
                                               &private->cur_anchor,
                                               &private->cur_stroke);
@@ -1339,6 +1344,9 @@ gimp_tool_path_get_function (GimpToolPath     *path,
   gboolean             on_curve   = FALSE;
   gboolean             on_vectors = FALSE;
   GimpVectorFunction   function   = VECTORS_FINISHED;
+  GimpToolWidget       widget     = path->parent_instance;
+  GimpDisplayShell    *shell      = gimp_tool_widget_get_shell (&widget);
+  GimpDisplayConfig   *config     = GIMP_DISPLAY_CONFIG (shell->display->config);
 
   private->modifier_lock = FALSE;
 
@@ -1348,8 +1356,8 @@ gimp_tool_path_get_function (GimpToolPath     *path,
       on_handle = gimp_canvas_item_on_vectors_handle (private->path,
                                                       private->vectors,
                                                       coords,
-                                                      GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
-                                                      GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
+                                                      config->canvas_handle_size,
+                                                      config->canvas_handle_size,
                                                       GIMP_ANCHOR_ANCHOR,
                                                       private->sel_count > 2,
                                                       &anchor, &stroke);
@@ -1358,8 +1366,8 @@ gimp_tool_path_get_function (GimpToolPath     *path,
         on_curve = gimp_canvas_item_on_vectors_curve (private->path,
                                                       private->vectors,
                                                       coords,
-                                                      GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
-                                                      GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
+                                                      config->canvas_handle_size,
+                                                      config->canvas_handle_size,
                                                       NULL,
                                                       &position, &anchor,
                                                       &anchor2, &stroke);
@@ -1369,8 +1377,8 @@ gimp_tool_path_get_function (GimpToolPath     *path,
     {
       on_vectors = gimp_canvas_item_on_vectors (private->path,
                                                 coords,
-                                                GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
-                                                GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
+                                                config->canvas_handle_size,
+                                                config->canvas_handle_size,
                                                 NULL, NULL, NULL, NULL, NULL,
                                                 NULL);
     }
diff --git a/app/widgets/gimpcurveview.c b/app/widgets/gimpcurveview.c
index 2b3f54a5b88..a9030e4a519 100644
--- a/app/widgets/gimpcurveview.c
+++ b/app/widgets/gimpcurveview.c
@@ -31,6 +31,8 @@
 
 #include "widgets-types.h"
 
+#include "config/gimpdisplayconfig.h"
+
 #include "core/gimp.h"
 #include "core/gimpcurve.h"
 #include "core/gimpcurve-map.h"
@@ -430,25 +432,33 @@ gimp_curve_view_draw_point (GimpCurveView *view,
                             gint           height,
                             gint           border)
 {
-  gdouble x, y;
+  gdouble            x, y;
+  GimpDisplayConfig *config;
+  Gimp              *gimp          = NULL;
+  gint               circle_radius = 9;
 
   gimp_curve_get_point (view->curve, i, &x, &y);
 
   y = 1.0 - y;
 
-#define CIRCLE_RADIUS  3
-#define DIAMOND_RADIUS (G_SQRT2 * CIRCLE_RADIUS)
+  if (gimp)
+    {
+      config = GIMP_DISPLAY_CONFIG (gimp->config);
+      circle_radius = config->curve_handle_size;
+    }
+
+#define DIAMOND_RADIUS (G_SQRT2 * circle_radius)
 
   switch (gimp_curve_get_point_type (view->curve, i))
     {
     case GIMP_CURVE_POINT_SMOOTH:
       cairo_move_to (cr,
-                     border + (gdouble) (width  - 1) * x + CIRCLE_RADIUS,
+                     border + (gdouble) (width  - 1) * x + circle_radius,
                      border + (gdouble) (height - 1) * y);
       cairo_arc     (cr,
                      border + (gdouble) (width  - 1) * x,
                      border + (gdouble) (height - 1) * y,
-                     CIRCLE_RADIUS,
+                     circle_radius,
                      0, 2 * G_PI);
       break;
 
-- 
GitLab