[gimp] Bug 677914 - Allow keyboard shortcuts for Rate and Flow on airbrush tool



commit 2fe1a0f5c1904476f5e19900f0b9735199d60e75
Author: E.S. Quinn <onetruequinn hotmail com>
Date:   Sun Nov 30 16:28:46 2014 +0100

    Bug 677914 - Allow keyboard shortcuts for Rate and Flow on airbrush tool
    
    Implement actions to control airbrush rate and flow.

 app/actions/tools-actions.c  |   73 ++++++++++++++++++++++++++++++++++++++++++
 app/actions/tools-commands.c |   43 ++++++++++++++++++++++++
 app/actions/tools-commands.h |    7 ++++
 3 files changed, 123 insertions(+), 0 deletions(-)
---
diff --git a/app/actions/tools-actions.c b/app/actions/tools-actions.c
index e9657f3..26fb26e 100644
--- a/app/actions/tools-actions.c
+++ b/app/actions/tools-actions.c
@@ -121,6 +121,70 @@ static const GimpEnumActionEntry tools_ink_blob_angle_actions[] =
     NULL }
 };
 
+static const GimpEnumActionEntry tools_airbrush_rate_actions[] =
+{
+  { "tools-airbrush-rate-set", GIMP_STOCK_TOOL_AIRBRUSH,
+    "Set Airrush Rate", NULL, NULL,
+    GIMP_ACTION_SELECT_SET, TRUE,
+    NULL },
+  { "tools-airbrush-rate-minimum", GIMP_STOCK_TOOL_AIRBRUSH,
+    "Minimum Rate", NULL, NULL,
+    GIMP_ACTION_SELECT_FIRST, FALSE,
+    NULL },
+  { "tools-airbrush-rate-maximum", GIMP_STOCK_TOOL_AIRBRUSH,
+    "Maximum Rate", NULL, NULL,
+    GIMP_ACTION_SELECT_LAST, FALSE,
+    NULL },
+  { "tools-airbrush-rate-decrease", GIMP_STOCK_TOOL_AIRBRUSH,
+    "Decrease Rate", NULL, NULL,
+    GIMP_ACTION_SELECT_PREVIOUS, FALSE,
+    NULL },
+  { "tools-airbrush-rate-increase", GIMP_STOCK_TOOL_AIRBRUSH,
+    "Increase Rate", NULL, NULL,
+    GIMP_ACTION_SELECT_NEXT, FALSE,
+    NULL },
+  { "tools-airbrush-rate-decrease-skip", GIMP_STOCK_TOOL_AIRBRUSH,
+    "Decrease Rate More", NULL, NULL,
+    GIMP_ACTION_SELECT_SKIP_PREVIOUS, FALSE,
+    NULL },
+  { "tools-airbrush-rate-increase-skip", GIMP_STOCK_TOOL_AIRBRUSH,
+    "Increase Rate More", NULL, NULL,
+    GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
+    NULL }
+};
+
+static const GimpEnumActionEntry tools_airbrush_flow_actions[] =
+{
+  { "tools-airbrush-flow-set", GIMP_STOCK_TOOL_AIRBRUSH,
+    "Set Airrush Flow", NULL, NULL,
+    GIMP_ACTION_SELECT_SET, TRUE,
+    NULL },
+  { "tools-airbrush-flow-minimum", GIMP_STOCK_TOOL_AIRBRUSH,
+    "Minimum Flow", NULL, NULL,
+    GIMP_ACTION_SELECT_FIRST, FALSE,
+    NULL },
+  { "tools-airbrush-flow-maximum", GIMP_STOCK_TOOL_AIRBRUSH,
+    "Maximum Flow", NULL, NULL,
+    GIMP_ACTION_SELECT_LAST, FALSE,
+    NULL },
+  { "tools-airbrush-flow-decrease", GIMP_STOCK_TOOL_AIRBRUSH,
+    "Decrease Flow", NULL, NULL,
+    GIMP_ACTION_SELECT_PREVIOUS, FALSE,
+    NULL },
+  { "tools-airbrush-flow-increase", GIMP_STOCK_TOOL_AIRBRUSH,
+    "Increase Flow", NULL, NULL,
+    GIMP_ACTION_SELECT_NEXT, FALSE,
+    NULL },
+  { "tools-airbrush-flow-decrease-skip", GIMP_STOCK_TOOL_AIRBRUSH,
+    "Decrease Flow More", NULL, NULL,
+    GIMP_ACTION_SELECT_SKIP_PREVIOUS, FALSE,
+    NULL },
+  { "tools-airbrush-flow-increase-skip", GIMP_STOCK_TOOL_AIRBRUSH,
+    "Increase Flow More", NULL, NULL,
+    GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
+    NULL }
+};
+
 static const GimpEnumActionEntry tools_foreground_select_brush_size_actions[] =
 {
   { "tools-foreground-select-brush-size-set",
@@ -425,6 +489,15 @@ tools_actions_setup (GimpActionGroup *group)
                                       G_CALLBACK (tools_ink_blob_angle_cmd_callback));
 
   gimp_action_group_add_enum_actions (group, NULL,
+                                      tools_airbrush_rate_actions,
+                                      G_N_ELEMENTS (tools_airbrush_rate_actions),
+                                      G_CALLBACK (tools_airbrush_rate_cmd_callback));
+  gimp_action_group_add_enum_actions (group, NULL,
+                                      tools_airbrush_flow_actions,
+                                      G_N_ELEMENTS (tools_airbrush_flow_actions),
+                                      G_CALLBACK (tools_airbrush_flow_cmd_callback));
+
+  gimp_action_group_add_enum_actions (group, NULL,
                                       tools_foreground_select_brush_size_actions,
                                       G_N_ELEMENTS (tools_foreground_select_brush_size_actions),
                                       G_CALLBACK (tools_fg_select_brush_size_cmd_callback));
diff --git a/app/actions/tools-commands.c b/app/actions/tools-commands.c
index 6fc6cf6..93a7071 100644
--- a/app/actions/tools-commands.c
+++ b/app/actions/tools-commands.c
@@ -30,6 +30,7 @@
 #include "core/gimptoolinfo.h"
 
 #include "paint/gimpinkoptions.h"
+#include "paint/gimpairbrushoptions.h"
 
 #include "widgets/gimpenumaction.h"
 #include "widgets/gimpuimanager.h"
@@ -251,6 +252,48 @@ tools_ink_blob_angle_cmd_callback (GtkAction *action,
 }
 
 void
+tools_airbrush_rate_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_AIRBRUSH_OPTIONS (tool_info->tool_options))
+    {
+      action_select_property ((GimpActionSelectType) value,
+                              action_data_get_display (data),
+                              G_OBJECT (tool_info->tool_options),
+                              "rate",
+                              0.1, 1.0, 15.0, 0.1, FALSE);
+    }
+}
+
+void
+tools_airbrush_flow_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_AIRBRUSH_OPTIONS (tool_info->tool_options))
+    {
+      action_select_property ((GimpActionSelectType) value,
+                              action_data_get_display (data),
+                              G_OBJECT (tool_info->tool_options),
+                              "flow",
+                              0.1, 1.0, 10.0, 0.1, FALSE);
+    }
+}
+
+void
 tools_fg_select_brush_size_cmd_callback (GtkAction *action,
                                          gint       value,
                                          gpointer   data)
diff --git a/app/actions/tools-commands.h b/app/actions/tools-commands.h
index cfeca2e..ddabf76 100644
--- a/app/actions/tools-commands.h
+++ b/app/actions/tools-commands.h
@@ -47,6 +47,13 @@ void   tools_ink_blob_angle_cmd_callback            (GtkAction   *action,
                                                      gint         value,
                                                      gpointer     data);
 
+void   tools_airbrush_rate_cmd_callback             (GtkAction   *action,
+                                                     gint         value,
+                                                     gpointer     data);
+void   tools_airbrush_flow_cmd_callback             (GtkAction   *action,
+                                                     gint         value,
+                                                     gpointer     data);
+
 void   tools_fg_select_brush_size_cmd_callback      (GtkAction   *action,
                                                      gint         value,
                                                      gpointer     data);


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