[gimp] app: avoid to do things twice when double or triple clicks arrive



commit fa6e9e6653c0d8f08fe5c55015e40ae31bd79442
Author: Michael Natterer <mitch gimp org>
Date:   Thu Feb 18 19:44:52 2010 +0100

    app: avoid to do things twice when double or triple clicks arrive
    
    In button_press(), don't frame the item again and switch to selecting
    mode on double and triple click events, we already did that when
    receiving the normal button-press. Also clarify a comment.

 app/tools/gimptexttool.c |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c
index 3bea9c2..a3ba415 100644
--- a/app/tools/gimptexttool.c
+++ b/app/tools/gimptexttool.c
@@ -403,8 +403,8 @@ gimp_text_tool_button_press (GimpTool            *tool,
           gimp_rectangle_tool_button_press (tool, coords, time, state, display);
         }
 
-      /* bail out now if the rectangle is narrow and the button press is
-       * outside the layer
+      /*  bail out now if the user user clicked on a handle of an
+       *  existing rectangle
        */
       if (text_tool->layer &&
           gimp_rectangle_tool_get_function (rect_tool) !=
@@ -434,23 +434,23 @@ gimp_text_tool_button_press (GimpTool            *tool,
       /*  did the user click on a text layer?  */
       if (gimp_text_tool_set_drawable (text_tool, drawable, TRUE))
         {
-          /*  if we clicked on a text layer while the tool was idle
-           *  (didn't show a rectangle), frame the layer and switch to
-           *  selecting instead of drawing a new rectangle
-           */
-          if (gimp_rectangle_tool_get_function (rect_tool) ==
-              GIMP_RECTANGLE_TOOL_CREATING)
+          if (press_type == GIMP_BUTTON_PRESS_NORMAL)
             {
-              text_tool->selecting = TRUE;
+              /*  if we clicked on a text layer while the tool was idle
+               *  (didn't show a rectangle), frame the layer and switch to
+               *  selecting instead of drawing a new rectangle
+               */
+              if (gimp_rectangle_tool_get_function (rect_tool) ==
+                  GIMP_RECTANGLE_TOOL_CREATING)
+                {
+                  text_tool->selecting = TRUE;
 
-              gimp_rectangle_tool_set_function (rect_tool,
-                                                GIMP_RECTANGLE_TOOL_DEAD);
+                  gimp_rectangle_tool_set_function (rect_tool,
+                                                    GIMP_RECTANGLE_TOOL_DEAD);
 
-              gimp_text_tool_frame_item (text_tool);
-            }
+                  gimp_text_tool_frame_item (text_tool);
+                }
 
-          if (press_type == GIMP_BUTTON_PRESS_NORMAL)
-            {
               if (text_tool->text && text_tool->text != text)
                 {
                   gimp_text_tool_editor_start (text_tool);



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