From b27c5b09856676243f3c3752db3d6bcf3c5fe147 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Tue, 3 Mar 2015 20:26:58 +0100 Subject: [PATCH] app: move the N-Point Deformation tool to the playground It has to be enabled via Prefs -> Playground. The menu entry is always disabled until it leaves the playground, for reasons worth fixing. --- app/config/gimpguiconfig.c | 17 +++++++++++++++ app/config/gimpguiconfig.h | 5 ++++- app/config/gimprc-blurbs.h | 3 +++ app/dialogs/preferences-dialog.c | 8 +++---- app/tools/gimpnpointdeformationtool.c | 30 ++++++++++++++++----------- menus/image-menu.xml.in | 4 +++- 6 files changed, 48 insertions(+), 19 deletions(-) diff --git a/app/config/gimpguiconfig.c b/app/config/gimpguiconfig.c index dbd16c936e..770a6941ee 100644 --- a/app/config/gimpguiconfig.c +++ b/app/config/gimpguiconfig.c @@ -80,6 +80,8 @@ enum PROP_DOCK_WINDOW_HINT, PROP_CURSOR_HANDEDNESS, + PROP_PLAYGROUND_NPD_TOOL, + PROP_HIDE_DOCKS, PROP_SINGLE_WINDOW_MODE, PROP_TABS_POSITION, @@ -272,6 +274,13 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass) GIMP_HANDEDNESS_RIGHT, GIMP_PARAM_STATIC_STRINGS); + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PLAYGROUND_NPD_TOOL, + "playground-npd-tool", + PLAYGROUND_NPD_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", NULL, @@ -476,6 +485,10 @@ gimp_gui_config_set_property (GObject *object, gui_config->cursor_handedness = g_value_get_enum (value); break; + case PROP_PLAYGROUND_NPD_TOOL: + gui_config->playground_npd_tool = g_value_get_boolean (value); + break; + case PROP_HIDE_DOCKS: gui_config->hide_docks = g_value_get_boolean (value); break; @@ -610,6 +623,10 @@ gimp_gui_config_get_property (GObject *object, g_value_set_enum (value, gui_config->cursor_handedness); break; + case PROP_PLAYGROUND_NPD_TOOL: + g_value_set_boolean (value, gui_config->playground_npd_tool); + break; + case PROP_HIDE_DOCKS: g_value_set_boolean (value, gui_config->hide_docks); break; diff --git a/app/config/gimpguiconfig.h b/app/config/gimpguiconfig.h index 4b98f84f54..03c2981f60 100644 --- a/app/config/gimpguiconfig.h +++ b/app/config/gimpguiconfig.h @@ -63,7 +63,7 @@ struct _GimpGuiConfig gchar *help_locales; GimpHelpBrowserType help_browser; - /* Action Search preferences. */ + /* action search preferences */ gboolean search_show_unavailable; gint action_history_size; @@ -73,6 +73,9 @@ struct _GimpGuiConfig GimpWindowHint dock_window_hint; GimpHandedness cursor_handedness; + /* experimental playground */ + gboolean playground_npd_tool; + /* saved in sessionrc */ gboolean hide_docks; gboolean single_window_mode; diff --git a/app/config/gimprc-blurbs.h b/app/config/gimprc-blurbs.h index 1ac437f7c5..810dca431a 100644 --- a/app/config/gimprc-blurbs.h +++ b/app/config/gimprc-blurbs.h @@ -374,6 +374,9 @@ _("Use GIMP in a single-window mode.") #define HIDE_DOCKS_BLURB \ _("Hide docks and other windows, leaving only image windows.") +#define PLAYGROUND_NPD_TOOL_BLURB \ +_("Enable the N-Point Deformation 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 6b0d739581..7310b2b13d 100644 --- a/app/dialogs/preferences-dialog.c +++ b/app/dialogs/preferences-dialog.c @@ -1456,8 +1456,6 @@ prefs_dialog_new (Gimp *gimp, /****************/ if (gimp->show_playground) { - GtkWidget *label; - pixbuf = prefs_get_pixbufs (dialog, "playground", &small_pixbuf); vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box), _("Experimental Playground"), @@ -1471,9 +1469,9 @@ prefs_dialog_new (Gimp *gimp, vbox2 = prefs_frame_new (_("Insane Options"), GTK_CONTAINER (vbox), TRUE); - label = gtk_label_new ("Fuck Yeah!"); - gtk_box_pack_start (GTK_BOX (vbox2), label, TRUE, TRUE, 0); - gtk_widget_show (label); + button = prefs_check_button_add (object, "playground-npd-tool", + _("_N-Point Deformation tool"), + GTK_BOX (vbox2)); } diff --git a/app/tools/gimpnpointdeformationtool.c b/app/tools/gimpnpointdeformationtool.c index 6560c36d0e..039d3a2c05 100644 --- a/app/tools/gimpnpointdeformationtool.c +++ b/app/tools/gimpnpointdeformationtool.c @@ -31,6 +31,8 @@ #include "tools-types.h" +#include "config/gimpguiconfig.h" /* playground */ + #include "gegl/gimp-gegl-utils.h" #include "gegl/gimp-gegl-apply-operation.h" @@ -144,18 +146,22 @@ void gimp_n_point_deformation_tool_register (GimpToolRegisterCallback callback, gpointer data) { - (* callback) (GIMP_TYPE_N_POINT_DEFORMATION_TOOL, - GIMP_TYPE_N_POINT_DEFORMATION_OPTIONS, - gimp_n_point_deformation_options_gui, - 0, - "gimp-n-point-deformation-tool", - _("N-Point Deformation"), - _("N-Point Deformation Tool: Rubber-like deformation of " - "image using points"), - N_("_N-Point Deformation"), "N", - NULL, GIMP_HELP_TOOL_N_POINT_DEFORMATION, - GIMP_STOCK_TOOL_N_POINT_DEFORMATION, - 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_npd_tool) + (* callback) (GIMP_TYPE_N_POINT_DEFORMATION_TOOL, + GIMP_TYPE_N_POINT_DEFORMATION_OPTIONS, + gimp_n_point_deformation_options_gui, + 0, + "gimp-n-point-deformation-tool", + _("N-Point Deformation"), + _("N-Point Deformation Tool: Rubber-like deformation of " + "image using points"), + N_("_N-Point Deformation"), "N", + NULL, GIMP_HELP_TOOL_N_POINT_DEFORMATION, + GIMP_STOCK_TOOL_N_POINT_DEFORMATION, + data); } static void diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in index 2b716818eb..a3380d319f 100644 --- a/menus/image-menu.xml.in +++ b/menus/image-menu.xml.in @@ -605,7 +605,9 @@ - +