[gimp] Bug 740939 - No shortcut actions for changing tool's spacing, hardness and force



commit 2229d0aed89d772c5ba1972c302ce348590f6878
Author: Michael Natterer <mitch gimp org>
Date:   Tue Mar 22 23:51:32 2016 +0100

    Bug 740939 - No shortcut actions for changing tool's spacing, hardness and force
    
    Add generic tool actions for spacing, hardness and force, and the
    GimpToolControl infrasctructure to redirect them to tool-specific
    actions. Add tool-specific actions for GimpBrushTool, GimpMybrushTool
    and GimpWarpTool as redirect targets. Also fix some existing tool
    action callbacks to use the right increase/decrease steps.

 app/actions/tools-actions.c  |  219 ++++++++++++++++++++++++++++++++++++++++--
 app/actions/tools-commands.c |  182 ++++++++++++++++++++++++++++++++++-
 app/actions/tools-commands.h |   24 +++++
 app/tools/gimpbrushtool.c    |    6 +
 app/tools/gimpmybrushtool.c  |    8 +-
 app/tools/gimptoolcontrol.c  |   74 +++++++++++++--
 app/tools/gimptoolcontrol.h  |   15 +++
 app/tools/gimpwarptool.c     |   26 +++---
 app/widgets/gimpaction.c     |    7 +-
 9 files changed, 526 insertions(+), 35 deletions(-)
---
diff --git a/app/actions/tools-actions.c b/app/actions/tools-actions.c
index 98236d0..efdad1b 100644
--- a/app/actions/tools-actions.c
+++ b/app/actions/tools-actions.c
@@ -81,6 +81,14 @@ static const GimpEnumActionEntry tools_paintbrush_size_actions[] =
     NULL }
 };
 
+static const GimpEnumActionEntry tools_paintbrush_aspect_ratio_actions[] =
+{
+  { "tools-paintbrush-aspect-ratio-set", GIMP_STOCK_TOOL_PAINTBRUSH,
+    "Set Brush Aspect Ratio", NULL, NULL,
+    GIMP_ACTION_SELECT_SET, TRUE,
+    NULL }
+};
+
 static const GimpEnumActionEntry tools_paintbrush_angle_actions[] =
 {
   { "tools-paintbrush-angle-set", GIMP_STOCK_TOOL_PAINTBRUSH,
@@ -89,10 +97,26 @@ static const GimpEnumActionEntry tools_paintbrush_angle_actions[] =
     NULL }
 };
 
-static const GimpEnumActionEntry tools_paintbrush_aspect_ratio_actions[] =
+static const GimpEnumActionEntry tools_paintbrush_spacing_actions[] =
 {
-  { "tools-paintbrush-aspect-ratio-set", GIMP_STOCK_TOOL_PAINTBRUSH,
-    "Set Brush Aspect Ratio", NULL, NULL,
+  { "tools-paintbrush-spacing-set", GIMP_STOCK_TOOL_PAINTBRUSH,
+    "Set Brush Spacing", NULL, NULL,
+    GIMP_ACTION_SELECT_SET, TRUE,
+    NULL }
+};
+
+static const GimpEnumActionEntry tools_paintbrush_hardness_actions[] =
+{
+  { "tools-paintbrush-hardness-set", GIMP_STOCK_TOOL_PAINTBRUSH,
+    "Set Brush Hardness", NULL, NULL,
+    GIMP_ACTION_SELECT_SET, TRUE,
+    NULL }
+};
+
+static const GimpEnumActionEntry tools_paintbrush_force_actions[] =
+{
+  { "tools-paintbrush-force-set", GIMP_STOCK_TOOL_PAINTBRUSH,
+    "Set Brush Force", NULL, NULL,
     GIMP_ACTION_SELECT_SET, TRUE,
     NULL }
 };
@@ -193,6 +217,14 @@ static const GimpEnumActionEntry tools_mybrush_radius_actions[] =
     NULL }
 };
 
+static const GimpEnumActionEntry tools_mybrush_hardness_actions[] =
+{
+  { "tools-mypaint-brush-hardness-set", GIMP_STOCK_TOOL_MYPAINT_BRUSH,
+    "Set MyPaint Brush Hardness", NULL, NULL,
+    GIMP_ACTION_SELECT_SET, TRUE,
+    NULL }
+};
+
 static const GimpEnumActionEntry tools_foreground_select_brush_size_actions[] =
 {
   { "tools-foreground-select-brush-size-set",
@@ -219,6 +251,15 @@ static const GimpEnumActionEntry tools_warp_effect_size_actions[] =
     NULL }
 };
 
+static const GimpEnumActionEntry tools_warp_effect_hardness_actions[] =
+{
+  { "tools-warp-effect-hardness-set",
+    GIMP_STOCK_TOOL_WARP,
+    "Set Warp Effect Hardness", NULL, NULL,
+    GIMP_ACTION_SELECT_SET, TRUE,
+    NULL }
+};
+
 static const GimpEnumActionEntry tools_opacity_actions[] =
 {
   { "tools-opacity-set", GIMP_STOCK_TOOL_OPTIONS,
@@ -395,6 +436,138 @@ static const GimpEnumActionEntry tools_angle_actions[] =
     NULL },
 };
 
+static const GimpEnumActionEntry tools_spacing_actions[] =
+{
+  { "tools-spacing-set", GIMP_STOCK_TOOL_OPTIONS,
+    "Set Spacing", NULL, NULL,
+    GIMP_ACTION_SELECT_SET, TRUE,
+    NULL },
+  { "tools-spacing-set-to-default", GIMP_STOCK_TOOL_OPTIONS,
+    "Set Spacing To Default Value", NULL, NULL,
+    GIMP_ACTION_SELECT_SET_TO_DEFAULT, FALSE,
+    NULL },
+  { "tools-spacing-minimum", GIMP_STOCK_TOOL_OPTIONS,
+    "Minimize Spacing", NULL, NULL,
+    GIMP_ACTION_SELECT_FIRST, FALSE,
+    NULL },
+  { "tools-spacing-maximum", GIMP_STOCK_TOOL_OPTIONS,
+    "Maximize Spacing", NULL, NULL,
+    GIMP_ACTION_SELECT_LAST, FALSE,
+    NULL },
+  { "tools-spacing-decrease", GIMP_STOCK_TOOL_OPTIONS,
+    "Decrease Spacing", NULL, NULL,
+    GIMP_ACTION_SELECT_PREVIOUS, FALSE,
+    NULL },
+  { "tools-spacing-increase", GIMP_STOCK_TOOL_OPTIONS,
+    "Increase Spacing", NULL, NULL,
+    GIMP_ACTION_SELECT_NEXT, FALSE,
+    NULL },
+  { "tools-spacing-decrease-skip", GIMP_STOCK_TOOL_OPTIONS,
+    "Decrease Spacing More", NULL, NULL,
+    GIMP_ACTION_SELECT_SKIP_PREVIOUS, FALSE,
+    NULL },
+  { "tools-spacing-increase-skip", GIMP_STOCK_TOOL_OPTIONS,
+    "Increase Spacing More", NULL, NULL,
+    GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
+    NULL },
+  { "tools-spacing-decrease-percent", GIMP_STOCK_TOOL_OPTIONS,
+    "Decrease Spacing Relative", NULL, NULL,
+    GIMP_ACTION_SELECT_PERCENT_PREVIOUS, FALSE,
+    NULL },
+  { "tools-spacing-increase-percent", GIMP_STOCK_TOOL_OPTIONS,
+    "Increase Spacing Relative", NULL, NULL,
+    GIMP_ACTION_SELECT_PERCENT_NEXT, FALSE,
+    NULL },
+};
+
+static const GimpEnumActionEntry tools_hardness_actions[] =
+{
+  { "tools-hardness-set", GIMP_STOCK_TOOL_OPTIONS,
+    "Set Hardness", NULL, NULL,
+    GIMP_ACTION_SELECT_SET, TRUE,
+    NULL },
+  { "tools-hardness-set-to-default", GIMP_STOCK_TOOL_OPTIONS,
+    "Set Hardness To Default Value", NULL, NULL,
+    GIMP_ACTION_SELECT_SET_TO_DEFAULT, FALSE,
+    NULL },
+  { "tools-hardness-minimum", GIMP_STOCK_TOOL_OPTIONS,
+    "Minimize Hardness", NULL, NULL,
+    GIMP_ACTION_SELECT_FIRST, FALSE,
+    NULL },
+  { "tools-hardness-maximum", GIMP_STOCK_TOOL_OPTIONS,
+    "Maximize Hardness", NULL, NULL,
+    GIMP_ACTION_SELECT_LAST, FALSE,
+    NULL },
+  { "tools-hardness-decrease", GIMP_STOCK_TOOL_OPTIONS,
+    "Decrease Hardness", NULL, NULL,
+    GIMP_ACTION_SELECT_PREVIOUS, FALSE,
+    NULL },
+  { "tools-hardness-increase", GIMP_STOCK_TOOL_OPTIONS,
+    "Increase Hardness", NULL, NULL,
+    GIMP_ACTION_SELECT_NEXT, FALSE,
+    NULL },
+  { "tools-hardness-decrease-skip", GIMP_STOCK_TOOL_OPTIONS,
+    "Decrease Hardness More", NULL, NULL,
+    GIMP_ACTION_SELECT_SKIP_PREVIOUS, FALSE,
+    NULL },
+  { "tools-hardness-increase-skip", GIMP_STOCK_TOOL_OPTIONS,
+    "Increase Hardness More", NULL, NULL,
+    GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
+    NULL },
+  { "tools-hardness-decrease-percent", GIMP_STOCK_TOOL_OPTIONS,
+    "Decrease Hardness Relative", NULL, NULL,
+    GIMP_ACTION_SELECT_PERCENT_PREVIOUS, FALSE,
+    NULL },
+  { "tools-hardness-increase-percent", GIMP_STOCK_TOOL_OPTIONS,
+    "Increase Hardness Relative", NULL, NULL,
+    GIMP_ACTION_SELECT_PERCENT_NEXT, FALSE,
+    NULL },
+};
+
+static const GimpEnumActionEntry tools_force_actions[] =
+{
+  { "tools-force-set", GIMP_STOCK_TOOL_OPTIONS,
+    "Set Force", NULL, NULL,
+    GIMP_ACTION_SELECT_SET, TRUE,
+    NULL },
+  { "tools-force-set-to-default", GIMP_STOCK_TOOL_OPTIONS,
+    "Set Force To Default Value", NULL, NULL,
+    GIMP_ACTION_SELECT_SET_TO_DEFAULT, FALSE,
+    NULL },
+  { "tools-force-minimum", GIMP_STOCK_TOOL_OPTIONS,
+    "Minimize Force", NULL, NULL,
+    GIMP_ACTION_SELECT_FIRST, FALSE,
+    NULL },
+  { "tools-force-maximum", GIMP_STOCK_TOOL_OPTIONS,
+    "Maximize Force", NULL, NULL,
+    GIMP_ACTION_SELECT_LAST, FALSE,
+    NULL },
+  { "tools-force-decrease", GIMP_STOCK_TOOL_OPTIONS,
+    "Decrease Force", NULL, NULL,
+    GIMP_ACTION_SELECT_PREVIOUS, FALSE,
+    NULL },
+  { "tools-force-increase", GIMP_STOCK_TOOL_OPTIONS,
+    "Increase Force", NULL, NULL,
+    GIMP_ACTION_SELECT_NEXT, FALSE,
+    NULL },
+  { "tools-force-decrease-skip", GIMP_STOCK_TOOL_OPTIONS,
+    "Decrease Force More", NULL, NULL,
+    GIMP_ACTION_SELECT_SKIP_PREVIOUS, FALSE,
+    NULL },
+  { "tools-force-increase-skip", GIMP_STOCK_TOOL_OPTIONS,
+    "Increase Force More", NULL, NULL,
+    GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
+    NULL },
+  { "tools-force-decrease-percent", GIMP_STOCK_TOOL_OPTIONS,
+    "Decrease Force Relative", NULL, NULL,
+    GIMP_ACTION_SELECT_PERCENT_PREVIOUS, FALSE,
+    NULL },
+  { "tools-force-increase-percent", GIMP_STOCK_TOOL_OPTIONS,
+    "Increase Force Relative", NULL, NULL,
+    GIMP_ACTION_SELECT_PERCENT_NEXT, FALSE,
+    NULL },
+};
+
 static const GimpEnumActionEntry tools_object_1_actions[] =
 {
   { "tools-object-1-set", GIMP_STOCK_TOOL_OPTIONS,
@@ -472,16 +645,26 @@ tools_actions_setup (GimpActionGroup *group)
                                       tools_paintbrush_size_actions,
                                       G_N_ELEMENTS (tools_paintbrush_size_actions),
                                       G_CALLBACK (tools_paintbrush_size_cmd_callback));
-
+  gimp_action_group_add_enum_actions (group, NULL,
+                                      tools_paintbrush_aspect_ratio_actions,
+                                      G_N_ELEMENTS (tools_paintbrush_aspect_ratio_actions),
+                                      G_CALLBACK (tools_paintbrush_aspect_ratio_cmd_callback));
   gimp_action_group_add_enum_actions (group, NULL,
                                       tools_paintbrush_angle_actions,
                                       G_N_ELEMENTS (tools_paintbrush_angle_actions),
                                       G_CALLBACK (tools_paintbrush_angle_cmd_callback));
-
   gimp_action_group_add_enum_actions (group, NULL,
-                                      tools_paintbrush_aspect_ratio_actions,
-                                      G_N_ELEMENTS (tools_paintbrush_aspect_ratio_actions),
-                                      G_CALLBACK (tools_paintbrush_aspect_ratio_cmd_callback));
+                                      tools_paintbrush_spacing_actions,
+                                      G_N_ELEMENTS (tools_paintbrush_spacing_actions),
+                                      G_CALLBACK (tools_paintbrush_spacing_cmd_callback));
+  gimp_action_group_add_enum_actions (group, NULL,
+                                      tools_paintbrush_hardness_actions,
+                                      G_N_ELEMENTS (tools_paintbrush_hardness_actions),
+                                      G_CALLBACK (tools_paintbrush_hardness_cmd_callback));
+  gimp_action_group_add_enum_actions (group, NULL,
+                                      tools_paintbrush_force_actions,
+                                      G_N_ELEMENTS (tools_paintbrush_force_actions),
+                                      G_CALLBACK (tools_paintbrush_force_cmd_callback));
 
   gimp_action_group_add_enum_actions (group, NULL,
                                       tools_ink_blob_size_actions,
@@ -509,6 +692,10 @@ tools_actions_setup (GimpActionGroup *group)
                                       tools_mybrush_radius_actions,
                                       G_N_ELEMENTS (tools_mybrush_radius_actions),
                                       G_CALLBACK (tools_mybrush_radius_cmd_callback));
+  gimp_action_group_add_enum_actions (group, NULL,
+                                      tools_mybrush_hardness_actions,
+                                      G_N_ELEMENTS (tools_mybrush_hardness_actions),
+                                      G_CALLBACK (tools_mybrush_hardness_cmd_callback));
 
   gimp_action_group_add_enum_actions (group, NULL,
                                       tools_foreground_select_brush_size_actions,
@@ -524,6 +711,10 @@ tools_actions_setup (GimpActionGroup *group)
                                       tools_warp_effect_size_actions,
                                       G_N_ELEMENTS (tools_warp_effect_size_actions),
                                       G_CALLBACK (tools_warp_effect_size_cmd_callback));
+  gimp_action_group_add_enum_actions (group, NULL,
+                                      tools_warp_effect_hardness_actions,
+                                      G_N_ELEMENTS (tools_warp_effect_hardness_actions),
+                                      G_CALLBACK (tools_warp_effect_hardness_cmd_callback));
 
   gimp_action_group_add_enum_actions (group, NULL,
                                       tools_opacity_actions,
@@ -541,6 +732,18 @@ tools_actions_setup (GimpActionGroup *group)
                                       tools_angle_actions,
                                       G_N_ELEMENTS (tools_angle_actions),
                                       G_CALLBACK (tools_angle_cmd_callback));
+  gimp_action_group_add_enum_actions (group, NULL,
+                                      tools_spacing_actions,
+                                      G_N_ELEMENTS (tools_spacing_actions),
+                                      G_CALLBACK (tools_spacing_cmd_callback));
+  gimp_action_group_add_enum_actions (group, NULL,
+                                      tools_hardness_actions,
+                                      G_N_ELEMENTS (tools_hardness_actions),
+                                      G_CALLBACK (tools_hardness_cmd_callback));
+  gimp_action_group_add_enum_actions (group, NULL,
+                                      tools_force_actions,
+                                      G_N_ELEMENTS (tools_force_actions),
+                                      G_CALLBACK (tools_force_cmd_callback));
 
   gimp_action_group_add_enum_actions (group, NULL,
                                       tools_object_1_actions,
diff --git a/app/actions/tools-commands.c b/app/actions/tools-commands.c
index 1232c5c..7e32704 100644
--- a/app/actions/tools-commands.c
+++ b/app/actions/tools-commands.c
@@ -22,6 +22,8 @@
 #include <gegl.h>
 #include <gtk/gtk.h>
 
+#include "libgimpmath/gimpmath.h"
+
 #include "actions-types.h"
 
 #include "core/gimp.h"
@@ -190,6 +192,69 @@ tools_paintbrush_aspect_ratio_cmd_callback (GtkAction *action,
 }
 
 void
+tools_paintbrush_spacing_cmd_callback (GtkAction *action,
+                                       gint       value,
+                                       gpointer   data)
+{
+  GimpContext  *context;
+  GimpToolInfo *tool_info;
+  return_if_no_context (context, data);
+
+  tool_info = gimp_context_get_tool (context);
+
+  if (tool_info && GIMP_IS_PAINT_OPTIONS (tool_info->tool_options))
+    {
+      action_select_property ((GimpActionSelectType) value,
+                              action_data_get_display (data),
+                              G_OBJECT (tool_info->tool_options),
+                              "brush-spacing",
+                              0.001, 0.01, 0.1, 0.1, FALSE);
+    }
+}
+
+void
+tools_paintbrush_hardness_cmd_callback (GtkAction *action,
+                                        gint       value,
+                                        gpointer   data)
+{
+  GimpContext  *context;
+  GimpToolInfo *tool_info;
+  return_if_no_context (context, data);
+
+  tool_info = gimp_context_get_tool (context);
+
+  if (tool_info && GIMP_IS_PAINT_OPTIONS (tool_info->tool_options))
+    {
+      action_select_property ((GimpActionSelectType) value,
+                              action_data_get_display (data),
+                              G_OBJECT (tool_info->tool_options),
+                              "brush-hardness",
+                              0.001, 0.01, 0.1, 0.1, FALSE);
+    }
+}
+
+void
+tools_paintbrush_force_cmd_callback (GtkAction *action,
+                                     gint       value,
+                                     gpointer   data)
+{
+  GimpContext  *context;
+  GimpToolInfo *tool_info;
+  return_if_no_context (context, data);
+
+  tool_info = gimp_context_get_tool (context);
+
+  if (tool_info && GIMP_IS_PAINT_OPTIONS (tool_info->tool_options))
+    {
+      action_select_property ((GimpActionSelectType) value,
+                              action_data_get_display (data),
+                              G_OBJECT (tool_info->tool_options),
+                              "brush-force",
+                              0.001, 0.01, 0.1, 0.1, FALSE);
+    }
+}
+
+void
 tools_ink_blob_size_cmd_callback (GtkAction *action,
                                   gint       value,
                                   gpointer   data)
@@ -206,7 +271,7 @@ tools_ink_blob_size_cmd_callback (GtkAction *action,
                               action_data_get_display (data),
                               G_OBJECT (tool_info->tool_options),
                               "size",
-                              1.0, 1.0, 10.0, 0.1, FALSE);
+                              0.1, 1.0, 10.0, 0.1, FALSE);
     }
 }
 
@@ -248,7 +313,10 @@ tools_ink_blob_angle_cmd_callback (GtkAction *action,
                               action_data_get_display (data),
                               G_OBJECT (tool_info->tool_options),
                               "blob-angle",
-                              1.0, 1.0, 15.0, 0.1, TRUE);
+                              gimp_deg_to_rad (0.1),
+                              gimp_deg_to_rad (1.0),
+                              gimp_deg_to_rad (15.0),
+                              0.1, TRUE);
     }
 }
 
@@ -269,7 +337,7 @@ tools_airbrush_rate_cmd_callback (GtkAction *action,
                               action_data_get_display (data),
                               G_OBJECT (tool_info->tool_options),
                               "rate",
-                              0.1, 1.0, 15.0, 0.1, FALSE);
+                              0.1, 1.0, 10.0, 0.1, FALSE);
     }
 }
 
@@ -316,6 +384,27 @@ tools_mybrush_radius_cmd_callback (GtkAction *action,
 }
 
 void
+tools_mybrush_hardness_cmd_callback (GtkAction *action,
+                                   gint       value,
+                                   gpointer   data)
+{
+  GimpContext  *context;
+  GimpToolInfo *tool_info;
+  return_if_no_context (context, data);
+
+  tool_info = gimp_context_get_tool (context);
+
+  if (tool_info && GIMP_IS_MYBRUSH_OPTIONS (tool_info->tool_options))
+    {
+      action_select_property ((GimpActionSelectType) value,
+                              action_data_get_display (data),
+                              G_OBJECT (tool_info->tool_options),
+                              "hardness",
+                              0.001, 0.01, 0.1, 1.0, FALSE);
+    }
+}
+
+void
 tools_fg_select_brush_size_cmd_callback (GtkAction *action,
                                          gint       value,
                                          gpointer   data)
@@ -379,6 +468,27 @@ tools_warp_effect_size_cmd_callback (GtkAction *action,
 }
 
 void
+tools_warp_effect_hardness_cmd_callback (GtkAction *action,
+                                         gint       value,
+                                         gpointer   data)
+{
+  GimpContext  *context;
+  GimpToolInfo *tool_info;
+  return_if_no_context (context, data);
+
+  tool_info = gimp_context_get_tool (context);
+
+  if (tool_info && GIMP_IS_WARP_OPTIONS (tool_info->tool_options))
+    {
+      action_select_property ((GimpActionSelectType) value,
+                              action_data_get_display (data),
+                              G_OBJECT (tool_info->tool_options),
+                              "effect-hardness",
+                              0.001, 0.01, 0.1, 0.1, FALSE);
+    }
+}
+
+void
 tools_opacity_cmd_callback (GtkAction *action,
                             gint       value,
                             gpointer   data)
@@ -467,6 +577,72 @@ tools_angle_cmd_callback (GtkAction *action,
 }
 
 void
+tools_spacing_cmd_callback (GtkAction *action,
+                            gint       value,
+                            gpointer   data)
+{
+  GimpContext *context;
+  GimpTool    *tool;
+  return_if_no_context (context, data);
+
+  tool = tool_manager_get_active (context->gimp);
+
+  if (tool)
+    {
+      const gchar *action_desc;
+
+      action_desc = gimp_tool_control_get_action_spacing (tool->control);
+
+      if (action_desc)
+        tools_activate_enum_action (action_desc, value);
+    }
+}
+
+void
+tools_hardness_cmd_callback (GtkAction *action,
+                             gint       value,
+                             gpointer   data)
+{
+  GimpContext *context;
+  GimpTool    *tool;
+  return_if_no_context (context, data);
+
+  tool = tool_manager_get_active (context->gimp);
+
+  if (tool)
+    {
+      const gchar *action_desc;
+
+      action_desc = gimp_tool_control_get_action_hardness (tool->control);
+
+      if (action_desc)
+        tools_activate_enum_action (action_desc, value);
+    }
+}
+
+void
+tools_force_cmd_callback (GtkAction *action,
+                          gint       value,
+                          gpointer   data)
+{
+  GimpContext *context;
+  GimpTool    *tool;
+  return_if_no_context (context, data);
+
+  tool = tool_manager_get_active (context->gimp);
+
+  if (tool)
+    {
+      const gchar *action_desc;
+
+      action_desc = gimp_tool_control_get_action_force (tool->control);
+
+      if (action_desc)
+        tools_activate_enum_action (action_desc, value);
+    }
+}
+
+void
 tools_object_1_cmd_callback (GtkAction *action,
                              gint       value,
                              gpointer   data)
diff --git a/app/actions/tools-commands.h b/app/actions/tools-commands.h
index 24c2de5..834aa8b 100644
--- a/app/actions/tools-commands.h
+++ b/app/actions/tools-commands.h
@@ -36,6 +36,15 @@ void   tools_paintbrush_angle_cmd_callback          (GtkAction   *action,
 void   tools_paintbrush_aspect_ratio_cmd_callback   (GtkAction   *action,
                                                      gint         value,
                                                      gpointer     data);
+void   tools_paintbrush_spacing_cmd_callback        (GtkAction   *action,
+                                                     gint         value,
+                                                     gpointer     data);
+void   tools_paintbrush_hardness_cmd_callback       (GtkAction   *action,
+                                                     gint         value,
+                                                     gpointer     data);
+void   tools_paintbrush_force_cmd_callback          (GtkAction   *action,
+                                                     gint         value,
+                                                     gpointer     data);
 
 void   tools_ink_blob_size_cmd_callback             (GtkAction   *action,
                                                      gint         value,
@@ -57,6 +66,9 @@ void   tools_airbrush_flow_cmd_callback             (GtkAction   *action,
 void   tools_mybrush_radius_cmd_callback            (GtkAction   *action,
                                                      gint         value,
                                                      gpointer     data);
+void   tools_mybrush_hardness_cmd_callback          (GtkAction   *action,
+                                                     gint         value,
+                                                     gpointer     data);
 
 void   tools_fg_select_brush_size_cmd_callback      (GtkAction   *action,
                                                      gint         value,
@@ -69,6 +81,9 @@ void   tools_transform_preview_opacity_cmd_callback (GtkAction   *action,
 void   tools_warp_effect_size_cmd_callback          (GtkAction   *action,
                                                      gint         value,
                                                      gpointer     data);
+void   tools_warp_effect_hardness_cmd_callback      (GtkAction   *action,
+                                                     gint         value,
+                                                     gpointer     data);
 
 void   tools_opacity_cmd_callback                   (GtkAction   *action,
                                                      gint         value,
@@ -82,6 +97,15 @@ void   tools_aspect_cmd_callback                    (GtkAction   *action,
 void   tools_angle_cmd_callback                     (GtkAction   *action,
                                                      gint         value,
                                                      gpointer     data);
+void   tools_spacing_cmd_callback                   (GtkAction   *action,
+                                                     gint         value,
+                                                     gpointer     data);
+void   tools_hardness_cmd_callback                  (GtkAction   *action,
+                                                     gint         value,
+                                                     gpointer     data);
+void   tools_force_cmd_callback                     (GtkAction   *action,
+                                                     gint         value,
+                                                     gpointer     data);
 
 void   tools_object_1_cmd_callback                  (GtkAction   *action,
                                                      gint         value,
diff --git a/app/tools/gimpbrushtool.c b/app/tools/gimpbrushtool.c
index 2fe8810..7f93a98 100644
--- a/app/tools/gimpbrushtool.c
+++ b/app/tools/gimpbrushtool.c
@@ -107,6 +107,12 @@ gimp_brush_tool_init (GimpBrushTool *brush_tool)
                                          "tools/tools-paintbrush-aspect-ratio-set");
   gimp_tool_control_set_action_angle    (tool->control,
                                          "tools/tools-paintbrush-angle-set");
+  gimp_tool_control_set_action_spacing  (tool->control,
+                                         "tools/tools-paintbrush-spacing-set");
+  gimp_tool_control_set_action_hardness (tool->control,
+                                         "tools/tools-paintbrush-hardness-set");
+  gimp_tool_control_set_action_force    (tool->control,
+                                         "tools/tools-paintbrush-force-set");
   gimp_tool_control_set_action_object_1 (tool->control,
                                          "context/context-brush-select-set");
 }
diff --git a/app/tools/gimpmybrushtool.c b/app/tools/gimpmybrushtool.c
index 5d1b816..78bbad5 100644
--- a/app/tools/gimpmybrushtool.c
+++ b/app/tools/gimpmybrushtool.c
@@ -94,9 +94,11 @@ gimp_mybrush_tool_init (GimpMybrushTool *mybrush_tool)
 {
   GimpTool *tool = GIMP_TOOL (mybrush_tool);
 
-  gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_INK);
-  gimp_tool_control_set_action_size (tool->control,
-                                     "tools/tools-mypaint-brush-radius-set");
+  gimp_tool_control_set_tool_cursor     (tool->control, GIMP_TOOL_CURSOR_INK);
+  gimp_tool_control_set_action_size     (tool->control,
+                                         "tools/tools-mypaint-brush-radius-set");
+  gimp_tool_control_set_action_hardness (tool->control,
+                                         "tools/tools-mypaint-brush-hardness-set");
 
   gimp_paint_tool_enable_color_picker (GIMP_PAINT_TOOL (mybrush_tool),
                                        GIMP_COLOR_PICK_MODE_FOREGROUND);
diff --git a/app/tools/gimptoolcontrol.c b/app/tools/gimptoolcontrol.c
index e4731bc..8a3cdb6 100644
--- a/app/tools/gimptoolcontrol.c
+++ b/app/tools/gimptoolcontrol.c
@@ -75,14 +75,6 @@ gimp_tool_control_init (GimpToolControl *control)
   control->toggle_cursor          = -1;
   control->toggle_tool_cursor     = -1;
   control->toggle_cursor_modifier = -1;
-
-  control->action_opacity         = NULL;
-  control->action_size            = NULL;
-  control->action_aspect          = NULL;
-  control->action_angle           = NULL;
-
-  control->action_object_1        = NULL;
-  control->action_object_2        = NULL;
 }
 
 static void
@@ -96,6 +88,9 @@ gimp_tool_control_finalize (GObject *object)
   g_free (control->action_size);
   g_free (control->action_aspect);
   g_free (control->action_angle);
+  g_free (control->action_spacing);
+  g_free (control->action_hardness);
+  g_free (control->action_force);
   g_free (control->action_object_1);
   g_free (control->action_object_2);
 
@@ -588,6 +583,69 @@ gimp_tool_control_get_action_angle (GimpToolControl *control)
 }
 
 void
+gimp_tool_control_set_action_spacing (GimpToolControl *control,
+                                      const gchar     *action)
+{
+  g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
+
+  if (action != control->action_spacing)
+    {
+      g_free (control->action_spacing);
+      control->action_spacing = g_strdup (action);
+    }
+}
+
+const gchar *
+gimp_tool_control_get_action_spacing (GimpToolControl *control)
+{
+  g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), NULL);
+
+  return control->action_spacing;
+}
+
+void
+gimp_tool_control_set_action_hardness (GimpToolControl *control,
+                                       const gchar     *action)
+{
+  g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
+
+  if (action != control->action_hardness)
+    {
+      g_free (control->action_hardness);
+      control->action_hardness = g_strdup (action);
+    }
+}
+
+const gchar *
+gimp_tool_control_get_action_hardness (GimpToolControl *control)
+{
+  g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), NULL);
+
+  return control->action_hardness;
+}
+
+void
+gimp_tool_control_set_action_force (GimpToolControl *control,
+                                      const gchar     *action)
+{
+  g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
+
+  if (action != control->action_force)
+    {
+      g_free (control->action_force);
+      control->action_force = g_strdup (action);
+    }
+}
+
+const gchar *
+gimp_tool_control_get_action_force (GimpToolControl *control)
+{
+  g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), NULL);
+
+  return control->action_force;
+}
+
+void
 gimp_tool_control_set_action_object_1 (GimpToolControl *control,
                                        const gchar     *action)
 {
diff --git a/app/tools/gimptoolcontrol.h b/app/tools/gimptoolcontrol.h
index d850cc6..c308511 100644
--- a/app/tools/gimptoolcontrol.h
+++ b/app/tools/gimptoolcontrol.h
@@ -78,6 +78,9 @@ struct _GimpToolControl
   gchar               *action_size;
   gchar               *action_aspect;
   gchar               *action_angle;
+  gchar               *action_spacing;
+  gchar               *action_hardness;
+  gchar               *action_force;
   gchar               *action_object_1;
   gchar               *action_object_2;
 };
@@ -200,6 +203,18 @@ void          gimp_tool_control_set_action_angle    (GimpToolControl *control,
                                                      const gchar     *action);
 const gchar * gimp_tool_control_get_action_angle    (GimpToolControl *control);
 
+void          gimp_tool_control_set_action_spacing  (GimpToolControl *control,
+                                                     const gchar     *action);
+const gchar * gimp_tool_control_get_action_spacing  (GimpToolControl *control);
+
+void          gimp_tool_control_set_action_hardness (GimpToolControl *control,
+                                                     const gchar     *action);
+const gchar * gimp_tool_control_get_action_hardness (GimpToolControl *control);
+
+void          gimp_tool_control_set_action_force    (GimpToolControl *control,
+                                                     const gchar     *action);
+const gchar * gimp_tool_control_get_action_force    (GimpToolControl *control);
+
 void          gimp_tool_control_set_action_object_1 (GimpToolControl *control,
                                                      const gchar     *action);
 const gchar * gimp_tool_control_get_action_object_1 (GimpToolControl *control);
diff --git a/app/tools/gimpwarptool.c b/app/tools/gimpwarptool.c
index 576b8d8..560ffe7 100644
--- a/app/tools/gimpwarptool.c
+++ b/app/tools/gimpwarptool.c
@@ -174,18 +174,20 @@ gimp_warp_tool_init (GimpWarpTool *self)
 {
   GimpTool *tool = GIMP_TOOL (self);
 
-  gimp_tool_control_set_preserve    (tool->control, FALSE);
-  gimp_tool_control_set_motion_mode (tool->control, GIMP_MOTION_MODE_EXACT);
-  gimp_tool_control_set_dirty_mask  (tool->control,
-                                     GIMP_DIRTY_IMAGE           |
-                                     GIMP_DIRTY_DRAWABLE        |
-                                     GIMP_DIRTY_SELECTION       |
-                                     GIMP_DIRTY_ACTIVE_DRAWABLE);
-  gimp_tool_control_set_wants_click (tool->control, TRUE);
-  gimp_tool_control_set_tool_cursor (tool->control,
-                                     GIMP_TOOL_CURSOR_PERSPECTIVE);
-  gimp_tool_control_set_action_size (tool->control,
-                                     "tools/tools-warp-effect-size-set");
+  gimp_tool_control_set_preserve        (tool->control, FALSE);
+  gimp_tool_control_set_motion_mode     (tool->control, GIMP_MOTION_MODE_EXACT);
+  gimp_tool_control_set_dirty_mask      (tool->control,
+                                         GIMP_DIRTY_IMAGE           |
+                                         GIMP_DIRTY_DRAWABLE        |
+                                         GIMP_DIRTY_SELECTION       |
+                                         GIMP_DIRTY_ACTIVE_DRAWABLE);
+  gimp_tool_control_set_wants_click     (tool->control, TRUE);
+  gimp_tool_control_set_tool_cursor     (tool->control,
+                                         GIMP_TOOL_CURSOR_PERSPECTIVE);
+  gimp_tool_control_set_action_size     (tool->control,
+                                         "tools/tools-warp-effect-size-set");
+  gimp_tool_control_set_action_hardness (tool->control,
+                                         "tools/tools-warp-effect-hardness-set");
 }
 
 static void
diff --git a/app/widgets/gimpaction.c b/app/widgets/gimpaction.c
index e3a30ab..7e0f325 100644
--- a/app/widgets/gimpaction.c
+++ b/app/widgets/gimpaction.c
@@ -325,15 +325,20 @@ gimp_action_is_gui_blacklisted (const gchar *action_name)
       "<",
       "tools-color-average-radius-",
       "tools-paintbrush-size-",
-      "tools-paintbrush-angle-",
       "tools-paintbrush-aspect-ratio-",
+      "tools-paintbrush-angle-",
+      "tools-paintbrush-spacing-",
+      "tools-paintbrush-hardness-",
+      "tools-paintbrush-force-",
       "tools-ink-blob-size-",
       "tools-ink-blob-aspect-",
       "tools-ink-blob-angle-",
       "tools-mypaint-brush-radius-",
+      "tools-mypaint-brush-hardness-",
       "tools-foreground-select-brush-size-",
       "tools-transform-preview-opacity-",
       "tools-warp-effect-size-"
+      "tools-warp-effect-hardness-"
     };
 
   gint i;


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