gimp r27048 - in trunk: . app/tools



Author: martinn
Date: Wed Sep 24 21:15:54 2008
New Revision: 27048
URL: http://svn.gnome.org/viewvc/gimp?rev=27048&view=rev

Log:
Bug 549925 â incorrect math: adding/substracting empty selection
deselects selection

* app/tools/gimprectangleselecttool.c
(gimp_rectangle_select_tool_execute): Be more intuitive when
clicking outside the current selection for the selection modes Add
and Subtract. More specifically, don't alter the selection mask at
all.


Modified:
   trunk/ChangeLog
   trunk/app/tools/gimprectangleselecttool.c

Modified: trunk/app/tools/gimprectangleselecttool.c
==============================================================================
--- trunk/app/tools/gimprectangleselecttool.c	(original)
+++ trunk/app/tools/gimprectangleselecttool.c	Wed Sep 24 21:15:54 2008
@@ -792,14 +792,31 @@
         }
       else
         {
-          GimpTool *tool = GIMP_TOOL (rectangle);
+          GimpTool       *tool = GIMP_TOOL (rectangle);
+          GimpChannelOps  operation;
 
           /* prevent this change from halting the tool */
           gimp_tool_control_set_preserve (tool->control, TRUE);
 
-          /* otherwise clear the selection */
-          gimp_channel_clear (selection, NULL, TRUE);
-          gimp_image_flush (image);
+          /* We can conceptually think of a click outside of the
+           * selection as adding a 0px selection. Behave intuitivly
+           * for the current selection mode
+           */
+          operation = gimp_rectangle_select_tool_get_operation (rect_sel_tool);
+          switch (operation)
+            {
+            case GIMP_CHANNEL_OP_REPLACE:
+            case GIMP_CHANNEL_OP_INTERSECT:
+              gimp_channel_clear (selection, NULL, TRUE);
+              gimp_image_flush (image);
+              break;
+
+            case GIMP_CHANNEL_OP_ADD:
+            case GIMP_CHANNEL_OP_SUBTRACT:
+            default:
+              /* Do nothing */
+              break;
+            }
 
           gimp_tool_control_set_preserve (tool->control, FALSE);
         }



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