[gimp/mypaint-brush: 10/10] app: move the MyPaint brush into the playground.



commit 68b8d544434ad87a2e34fdcf552dda8b97421d78
Author: Jehan <jehan girinstud io>
Date:   Sun Mar 22 22:36:00 2015 +0100

    app: move the MyPaint brush into the playground.

 app/actions/tools-actions.c      |   11 +++++++----
 app/config/gimpguiconfig.c       |   14 ++++++++++++++
 app/config/gimpguiconfig.h       |    1 +
 app/config/gimprc-blurbs.h       |    3 +++
 app/dialogs/preferences-dialog.c |    3 +++
 app/paint/gimpmybrush.c          |   16 ++++++++++------
 app/tools/gimpmybrushtool.c      |   36 ++++++++++++++++++++++--------------
 menus/image-menu.xml.in          |    2 ++
 8 files changed, 62 insertions(+), 24 deletions(-)
---
diff --git a/app/actions/tools-actions.c b/app/actions/tools-actions.c
index e94bec1..b5284c2 100644
--- a/app/actions/tools-actions.c
+++ b/app/actions/tools-actions.c
@@ -26,6 +26,8 @@
 
 #include "actions-types.h"
 
+#include "config/gimpguiconfig.h" /* playground */
+
 #include "core/gimp.h"
 #include "core/gimpcontainer.h"
 #include "core/gimpcontext.h"
@@ -505,10 +507,11 @@ tools_actions_setup (GimpActionGroup *group)
                                       G_N_ELEMENTS (tools_airbrush_flow_actions),
                                       G_CALLBACK (tools_airbrush_flow_cmd_callback));
 
-  gimp_action_group_add_enum_actions (group, NULL,
-                                      tools_mybrush_radius_actions,
-                                      G_N_ELEMENTS (tools_mybrush_radius_actions),
-                                      G_CALLBACK (tools_mybrush_radius_cmd_callback));
+  if (GIMP_GUI_CONFIG (group->gimp->config)->playground_mybrush_tool)
+    gimp_action_group_add_enum_actions (group, NULL,
+                                        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_foreground_select_brush_size_actions,
diff --git a/app/config/gimpguiconfig.c b/app/config/gimpguiconfig.c
index 7bd3012..4233402 100644
--- a/app/config/gimpguiconfig.c
+++ b/app/config/gimpguiconfig.c
@@ -82,6 +82,7 @@ enum
 
   PROP_PLAYGROUND_NPD_TOOL,
   PROP_PLAYGROUND_HANDLE_TRANSFORM_TOOL,
+  PROP_PLAYGROUND_MYBRUSH_TOOL,
 
   PROP_HIDE_DOCKS,
   PROP_SINGLE_WINDOW_MODE,
@@ -288,6 +289,13 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
                                     FALSE,
                                     GIMP_PARAM_STATIC_STRINGS |
                                     GIMP_CONFIG_PARAM_RESTART);
+  GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class,
+                                    PROP_PLAYGROUND_MYBRUSH_TOOL,
+                                    "playground-mybrush-tool",
+                                    PLAYGROUND_MYBRUSH_TOOL_BLURB,
+                                    FALSE,
+                                    GIMP_PARAM_STATIC_STRINGS |
+                                    GIMP_CONFIG_PARAM_RESTART);
 
   g_object_class_install_property (object_class, PROP_HIDE_DOCKS,
                                    g_param_spec_boolean ("hide-docks",
@@ -499,6 +507,9 @@ gimp_gui_config_set_property (GObject      *object,
     case PROP_PLAYGROUND_HANDLE_TRANSFORM_TOOL:
       gui_config->playground_handle_transform_tool = g_value_get_boolean (value);
       break;
+    case PROP_PLAYGROUND_MYBRUSH_TOOL:
+      gui_config->playground_mybrush_tool = g_value_get_boolean (value);
+      break;
 
     case PROP_HIDE_DOCKS:
       gui_config->hide_docks = g_value_get_boolean (value);
@@ -640,6 +651,9 @@ gimp_gui_config_get_property (GObject    *object,
     case PROP_PLAYGROUND_HANDLE_TRANSFORM_TOOL:
       g_value_set_boolean (value, gui_config->playground_handle_transform_tool);
       break;
+    case PROP_PLAYGROUND_MYBRUSH_TOOL:
+      g_value_set_boolean (value, gui_config->playground_mybrush_tool);
+      break;
 
     case PROP_HIDE_DOCKS:
       g_value_set_boolean (value, gui_config->hide_docks);
diff --git a/app/config/gimpguiconfig.h b/app/config/gimpguiconfig.h
index 878f700..105aaa8 100644
--- a/app/config/gimpguiconfig.h
+++ b/app/config/gimpguiconfig.h
@@ -76,6 +76,7 @@ struct _GimpGuiConfig
   /* experimental playground */
   gboolean             playground_npd_tool;
   gboolean             playground_handle_transform_tool;
+  gboolean             playground_mybrush_tool;
 
   /* saved in sessionrc */
   gboolean             hide_docks;
diff --git a/app/config/gimprc-blurbs.h b/app/config/gimprc-blurbs.h
index 89383d0..43afcef 100644
--- a/app/config/gimprc-blurbs.h
+++ b/app/config/gimprc-blurbs.h
@@ -380,6 +380,9 @@ _("Enable the N-Point Deformation tool.")
 #define PLAYGROUND_HANDLE_TRANSFORM_TOOL_BLURB \
 _("Enable the Handle Transform tool.")
 
+#define PLAYGROUND_MYBRUSH_TOOL_BLURB \
+_("Enable the MyPaint Brush tool.")
+
 #define SPACE_BAR_ACTION_BLURB \
 _("What to do when the space bar is pressed in the image window.")
 
diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c
index e6169fa..24117b3 100644
--- a/app/dialogs/preferences-dialog.c
+++ b/app/dialogs/preferences-dialog.c
@@ -1475,6 +1475,9 @@ prefs_dialog_new (Gimp       *gimp,
       button = prefs_check_button_add (object, "playground-handle-transform-tool",
                                        _("_Handle Transform tool"),
                                        GTK_BOX (vbox2));
+      button = prefs_check_button_add (object, "playground-mybrush-tool",
+                                       _("_MyPaint Brush tool"),
+                                       GTK_BOX (vbox2));
     }
 
 
diff --git a/app/paint/gimpmybrush.c b/app/paint/gimpmybrush.c
index d7c9d4b..5f84440 100644
--- a/app/paint/gimpmybrush.c
+++ b/app/paint/gimpmybrush.c
@@ -34,6 +34,9 @@
 
 #include "gegl/gimp-gegl-utils.h"
 
+#include "config/gimpguiconfig.h" /* playground */
+
+#include "core/gimp.h"
 #include "core/gimpdrawable.h"
 #include "core/gimpimage.h"
 #include "core/gimpimage-undo.h"
@@ -76,12 +79,13 @@ void
 gimp_mybrush_register (Gimp                      *gimp,
                        GimpPaintRegisterCallback  callback)
 {
-  (* callback) (gimp,
-                GIMP_TYPE_MYBRUSH,
-                GIMP_TYPE_MYBRUSH_OPTIONS,
-                "gimp-mybrush",
-                _("Mybrush"),
-                "gimp-tool-mybrush");
+  if (GIMP_GUI_CONFIG (gimp->config)->playground_mybrush_tool)
+    (* callback) (gimp,
+                  GIMP_TYPE_MYBRUSH,
+                  GIMP_TYPE_MYBRUSH_OPTIONS,
+                  "gimp-mybrush",
+                  _("Mybrush"),
+                  "gimp-tool-mybrush");
 }
 
 static void
diff --git a/app/tools/gimpmybrushtool.c b/app/tools/gimpmybrushtool.c
index b6d5d5c..8a952b2 100644
--- a/app/tools/gimpmybrushtool.c
+++ b/app/tools/gimpmybrushtool.c
@@ -25,8 +25,12 @@
 
 #include "tools-types.h"
 
+#include "config/gimpguiconfig.h" /* playground */
+
 #include "paint/gimpmybrushoptions.h"
 
+#include "core/gimp.h"
+
 #include "widgets/gimphelp-ids.h"
 
 #include "gimpmybrushoptions-gui.h"
@@ -55,20 +59,24 @@ void
 gimp_mybrush_tool_register (GimpToolRegisterCallback  callback,
                             gpointer                  data)
 {
-  (* callback) (GIMP_TYPE_MYBRUSH_TOOL,
-                GIMP_TYPE_MYBRUSH_OPTIONS,
-                gimp_mybrush_options_gui,
-                GIMP_CONTEXT_FOREGROUND_MASK |
-                GIMP_CONTEXT_BACKGROUND_MASK |
-                GIMP_CONTEXT_OPACITY_MASK    |
-                GIMP_CONTEXT_PAINT_MODE_MASK,
-                "gimp-mybrush-tool",
-                _("MyPaint Brush"),
-                _("MyPaint Brush Tool: Use MyPaint brushes in GIMP"),
-                N_("M_yPaint Brush"), "Y",
-                NULL, GIMP_HELP_TOOL_MYBRUSH,
-                GIMP_STOCK_TOOL_MYBRUSH,
-                data);
+  /* we should not know that "data" is a Gimp*, but what the heck this
+   * is experimental playground stuff
+   */
+  if (GIMP_GUI_CONFIG (GIMP (data)->config)->playground_mybrush_tool)
+    (* callback) (GIMP_TYPE_MYBRUSH_TOOL,
+                  GIMP_TYPE_MYBRUSH_OPTIONS,
+                  gimp_mybrush_options_gui,
+                  GIMP_CONTEXT_FOREGROUND_MASK |
+                  GIMP_CONTEXT_BACKGROUND_MASK |
+                  GIMP_CONTEXT_OPACITY_MASK    |
+                  GIMP_CONTEXT_PAINT_MODE_MASK,
+                  "gimp-mybrush-tool",
+                  _("MyPaint Brush"),
+                  _("MyPaint Brush Tool: Use MyPaint brushes in GIMP"),
+                  N_("M_yPaint Brush"), "Y",
+                  NULL, GIMP_HELP_TOOL_MYBRUSH,
+                  GIMP_STOCK_TOOL_MYBRUSH,
+                  data);
 }
 
 static void
diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in
index 633e051..3721f8a 100644
--- a/menus/image-menu.xml.in
+++ b/menus/image-menu.xml.in
@@ -584,7 +584,9 @@
         <menuitem action="tools-eraser" />
         <menuitem action="tools-airbrush" />
         <menuitem action="tools-ink" />
+        <!-- Enable when the tool leaves the playground
         <menuitem action="tools-mybrush" />
+        -->
         <menuitem action="tools-clone" />
         <menuitem action="tools-heal" />
         <menuitem action="tools-perspective-clone" />


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