[gimp] app: enable GimpCurvesTool on construction.



commit 011c6db39ec182771bf7c96992e52ac388c79259
Author: Jehan <jehan girinstud io>
Date:   Thu Nov 5 18:31:06 2015 +0100

    app: enable GimpCurvesTool on construction.
    
    The Curves tool is to be considered "enabled" as soon as it is selected,
    not when it is initialized (usually at the first click on the image).
    One of the main consequence of not being "enabled" was that the tool
    cursor was wrong at selection.

 app/tools/gimpcurvestool.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/app/tools/gimpcurvestool.c b/app/tools/gimpcurvestool.c
index b42e033..aa29d5e 100644
--- a/app/tools/gimpcurvestool.c
+++ b/app/tools/gimpcurvestool.c
@@ -62,6 +62,8 @@
 
 /*  local function prototypes  */
 
+static void       gimp_curves_tool_constructed    (GObject              *object);
+
 static gboolean   gimp_curves_tool_initialize     (GimpTool             *tool,
                                                    GimpDisplay          *display,
                                                    GError              **error);
@@ -152,10 +154,13 @@ gimp_curves_tool_register (GimpToolRegisterCallback  callback,
 static void
 gimp_curves_tool_class_init (GimpCurvesToolClass *klass)
 {
+  GObjectClass          *object_class     = G_OBJECT_CLASS (klass);
   GimpToolClass         *tool_class       = GIMP_TOOL_CLASS (klass);
   GimpColorToolClass    *color_tool_class = GIMP_COLOR_TOOL_CLASS (klass);
   GimpImageMapToolClass *im_tool_class    = GIMP_IMAGE_MAP_TOOL_CLASS (klass);
 
+  object_class->constructed          = gimp_curves_tool_constructed;
+
   tool_class->initialize             = gimp_curves_tool_initialize;
   tool_class->button_release         = gimp_curves_tool_button_release;
   tool_class->key_press              = gimp_curves_tool_key_press;
@@ -184,6 +189,17 @@ gimp_curves_tool_init (GimpCurvesTool *tool)
     tool->picked_color[i] = -1.0;
 }
 
+static void
+gimp_curves_tool_constructed (GObject *object)
+{
+  G_OBJECT_CLASS (parent_class)->constructed (object);
+
+  /*  always pick colors  */
+  gimp_color_tool_enable (GIMP_COLOR_TOOL (object),
+                          GIMP_COLOR_TOOL_GET_OPTIONS (object));
+
+}
+
 static gboolean
 gimp_curves_tool_initialize (GimpTool     *tool,
                              GimpDisplay  *display,
@@ -199,10 +215,6 @@ gimp_curves_tool_initialize (GimpTool     *tool,
       return FALSE;
     }
 
-  /*  always pick colors  */
-  gimp_color_tool_enable (GIMP_COLOR_TOOL (tool),
-                          GIMP_COLOR_TOOL_GET_OPTIONS (tool));
-
   gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (c_tool->channel_menu),
                                       curves_menu_sensitivity, drawable, NULL);
 


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