[gimp] app: connect the warp tool's effect size to the standard tool size action



commit 7d398da360d1d08d9cac0d9fd4cfe38e6c364b61
Author: Michael Natterer <mitch gimp org>
Date:   Sat May 3 20:24:09 2014 +0200

    app: connect the warp tool's effect size to the standard tool size action

 app/actions/tools-actions.c  |   14 ++++++++++++++
 app/actions/tools-commands.c |   22 ++++++++++++++++++++++
 app/actions/tools-commands.h |    5 +++++
 app/tools/gimpwarptool.c     |    2 ++
 4 files changed, 43 insertions(+), 0 deletions(-)
---
diff --git a/app/actions/tools-actions.c b/app/actions/tools-actions.c
index f2d5d6c..0dfac56 100644
--- a/app/actions/tools-actions.c
+++ b/app/actions/tools-actions.c
@@ -138,6 +138,15 @@ static const GimpEnumActionEntry tools_transform_preview_opacity_actions[] =
     NULL }
 };
 
+static const GimpEnumActionEntry tools_warp_effect_size_actions[] =
+{
+  { "tools-warp-effect-size-set",
+    GIMP_STOCK_TOOL_WARP,
+    "Set Warp Effect Size", NULL, NULL,
+    GIMP_ACTION_SELECT_SET, TRUE,
+    NULL }
+};
+
 static const GimpEnumActionEntry tools_opacity_actions[] =
 {
   { "tools-opacity-set", GIMP_STOCK_TOOL_OPTIONS,
@@ -426,6 +435,11 @@ tools_actions_setup (GimpActionGroup *group)
                                       G_CALLBACK (tools_transform_preview_opacity_cmd_callback));
 
   gimp_action_group_add_enum_actions (group, NULL,
+                                      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_opacity_actions,
                                       G_N_ELEMENTS (tools_opacity_actions),
                                       G_CALLBACK (tools_opacity_cmd_callback));
diff --git a/app/actions/tools-commands.c b/app/actions/tools-commands.c
index fcb4143..a21dc95 100644
--- a/app/actions/tools-commands.c
+++ b/app/actions/tools-commands.c
@@ -43,6 +43,7 @@
 #include "tools/gimpimagemaptool.h"
 #include "tools/gimptoolcontrol.h"
 #include "tools/gimptransformoptions.h"
+#include "tools/gimpwarpoptions.h"
 #include "tools/tool_manager.h"
 
 #include "actions.h"
@@ -292,6 +293,27 @@ tools_transform_preview_opacity_cmd_callback (GtkAction *action,
 }
 
 void
+tools_warp_effect_size_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-size",
+                              1.0, 4.0, 16.0, 0.1, FALSE);
+    }
+}
+
+void
 tools_opacity_cmd_callback (GtkAction *action,
                             gint       value,
                             gpointer   data)
diff --git a/app/actions/tools-commands.h b/app/actions/tools-commands.h
index c923e62..4ad5760 100644
--- a/app/actions/tools-commands.h
+++ b/app/actions/tools-commands.h
@@ -52,10 +52,15 @@ void   tools_ink_blob_angle_cmd_callback            (GtkAction   *action,
 void   tools_fg_select_brush_size_cmd_callback      (GtkAction   *action,
                                                      gint         value,
                                                      gpointer     data);
+
 void   tools_transform_preview_opacity_cmd_callback (GtkAction   *action,
                                                      gint         value,
                                                      gpointer     data);
 
+void   tools_warp_effect_size_cmd_callback          (GtkAction   *action,
+                                                     gint         value,
+                                                     gpointer     data);
+
 void   tools_opacity_cmd_callback                   (GtkAction   *action,
                                                      gint         value,
                                                      gpointer     data);
diff --git a/app/tools/gimpwarptool.c b/app/tools/gimpwarptool.c
index ff6d555..0fe19a5 100644
--- a/app/tools/gimpwarptool.c
+++ b/app/tools/gimpwarptool.c
@@ -171,6 +171,8 @@ gimp_warp_tool_init (GimpWarpTool *self)
   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");
 }
 
 static void


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