[gimp] app: don't call control_activate()/control_halt() in GimpRectangleTool



commit 0db785c36aaf8c694c6dd9f2d3b57e7a0b79beab
Author: Michael Natterer <mitch gimp org>
Date:   Wed Mar 30 22:13:31 2011 +0200

    app: don't call control_activate()/control_halt() in GimpRectangleTool
    
    Instead, call it in all implementors.

 app/tools/gimpcroptool.c            |    4 ++++
 app/tools/gimprectangleselecttool.c |   19 ++++++++-----------
 app/tools/gimprectangletool.c       |    4 ----
 app/tools/gimptexttool.c            |    5 ++++-
 4 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/app/tools/gimpcroptool.c b/app/tools/gimpcroptool.c
index bccf864..3665e62 100644
--- a/app/tools/gimpcroptool.c
+++ b/app/tools/gimpcroptool.c
@@ -252,6 +252,8 @@ gimp_crop_tool_button_press (GimpTool            *tool,
   if (tool->display && display != tool->display)
     gimp_rectangle_tool_cancel (GIMP_RECTANGLE_TOOL (tool));
 
+  gimp_tool_control_activate (tool->control);
+
   gimp_rectangle_tool_button_press (tool, coords, time, state, display);
 }
 
@@ -271,6 +273,8 @@ gimp_crop_tool_button_release (GimpTool              *tool,
                                       state,
                                       release_type,
                                       display);
+
+  gimp_tool_control_halt (tool->control);
 }
 
 static void
diff --git a/app/tools/gimprectangleselecttool.c b/app/tools/gimprectangleselecttool.c
index 73fba97..c6e7841 100644
--- a/app/tools/gimprectangleselecttool.c
+++ b/app/tools/gimprectangleselecttool.c
@@ -353,19 +353,12 @@ gimp_rectangle_select_tool_delegate_button_press (GimpRectangleSelectTool *rect_
   GimpDisplay *old_display            = tool->display;
 
   tool->display = display;
-  if (! gimp_tool_control_is_active (tool->control))
-    {
-      gimp_tool_control_activate (tool->control);
-    }
+  gimp_tool_control_activate (tool->control);
 
-  button_press_delegated
-    = gimp_selection_tool_start_edit (GIMP_SELECTION_TOOL (tool),
-                                      coords);
+  button_press_delegated =
+    gimp_selection_tool_start_edit (GIMP_SELECTION_TOOL (tool), coords);
 
-  if (gimp_tool_control_is_active (tool->control))
-    {
-      gimp_tool_control_halt (tool->control);
-    }
+  gimp_tool_control_halt (tool->control);
   tool->display = old_display;
 
   return button_press_delegated;
@@ -409,6 +402,8 @@ gimp_rectangle_select_tool_button_press (GimpTool            *tool,
       return;
     }
 
+  gimp_tool_control_activate (tool->control);
+
   function = gimp_rectangle_tool_get_function (rectangle);
 
   priv->saved_show_selection = gimp_display_shell_get_show_selection (shell);
@@ -484,6 +479,8 @@ gimp_rectangle_select_tool_button_release (GimpTool              *tool,
 
   image = gimp_display_get_image (tool->display);
 
+  gimp_tool_control_halt (tool->control);
+
   gimp_tool_pop_status (tool, display);
   gimp_display_shell_set_show_selection (gimp_display_get_shell (display),
                                          priv->saved_show_selection);
diff --git a/app/tools/gimprectangletool.c b/app/tools/gimprectangletool.c
index ba976ed..a32ca53 100644
--- a/app/tools/gimprectangletool.c
+++ b/app/tools/gimprectangletool.c
@@ -915,8 +915,6 @@ gimp_rectangle_tool_button_press (GimpTool         *tool,
 
   gimp_draw_tool_pause (draw_tool);
 
-  gimp_tool_control_activate (tool->control);
-
   GIMP_LOG (RECTANGLE_TOOL, "coords->x = %f, coords->y = %f",
             coords->x, coords->y);
 
@@ -1031,8 +1029,6 @@ gimp_rectangle_tool_button_release (GimpTool              *tool,
 
   gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
 
-  gimp_tool_control_halt (tool->control);
-
   GIMP_LOG (RECTANGLE_TOOL, "coords->x = %f, coords->y = %f",
             coords->x, coords->y);
 
diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c
index 1c73c46..a687819 100644
--- a/app/tools/gimptexttool.c
+++ b/app/tools/gimptexttool.c
@@ -372,6 +372,8 @@ gimp_text_tool_button_press (GimpTool            *tool,
 
   if (press_type == GIMP_BUTTON_PRESS_NORMAL)
     {
+      gimp_tool_control_activate (tool->control);
+
       gimp_text_tool_reset_im_context (text_tool);
 
       text_tool->selecting = FALSE;
@@ -382,7 +384,6 @@ gimp_text_tool_button_press (GimpTool            *tool,
           ! text_tool->moving)
         {
           gimp_rectangle_tool_set_function (rect_tool, GIMP_RECTANGLE_TOOL_DEAD);
-          gimp_tool_control_activate (tool->control);
         }
       else
         {
@@ -514,6 +515,8 @@ gimp_text_tool_button_release (GimpTool              *tool,
   GimpRectangleTool *rect_tool = GIMP_RECTANGLE_TOOL (tool);
   GimpTextTool      *text_tool = GIMP_TEXT_TOOL (tool);
 
+  gimp_tool_control_halt (tool->control);
+
   if (text_tool->selecting)
     {
       /*  we are in a selection process (user has initially clicked on



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