gimp r25792 - in trunk: . app/tools



Author: martinn
Date: Sun May 25 11:48:37 2008
New Revision: 25792
URL: http://svn.gnome.org/viewvc/gimp?rev=25792&view=rev

Log:
2008-05-25  Martin Nordholts  <martinn svn gnome org>

	* app/tools/gimpfreeselecttool.c
	(gimp_free_select_tool_handle_click): A click might have slightly
	adjusted the points, so revert before doing the selection.
	(gimp_free_select_tool_revert_to_saved_state): Move definition up
	a bit.


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

Modified: trunk/app/tools/gimpfreeselecttool.c
==============================================================================
--- trunk/app/tools/gimpfreeselecttool.c	(original)
+++ trunk/app/tools/gimpfreeselecttool.c	Sun May 25 11:48:37 2008
@@ -706,6 +706,40 @@
 }
 
 static void
+gimp_free_select_tool_revert_to_saved_state (GimpFreeSelectTool *fst)
+{
+  Private     *priv = GET_PRIVATE (fst);
+  GimpVector2 *source;
+  gint         n_points;
+
+  if (priv->grabbed_segment_index > 0)
+    {
+      gimp_free_select_tool_get_segment (fst,
+                                         &source,
+                                         &n_points,
+                                         priv->grabbed_segment_index - 1,
+                                         priv->grabbed_segment_index);
+
+      memcpy (source,
+              priv->saved_points_lower_segment,
+              sizeof (GimpVector2) * n_points);
+    }
+
+  if (priv->grabbed_segment_index < priv->n_segment_indices - 1)
+    {
+      gimp_free_select_tool_get_segment (fst,
+                                         &source,
+                                         &n_points,
+                                         priv->grabbed_segment_index,
+                                         priv->grabbed_segment_index + 1);
+
+      memcpy (source,
+              priv->saved_points_higher_segment,
+              sizeof (GimpVector2) * n_points);
+    }
+}
+
+static void
 gimp_free_select_tool_handle_click (GimpFreeSelectTool *fst,
                                     GimpCoords         *coords,
                                     GimpDisplay        *display)
@@ -729,6 +763,12 @@
                                               display,
                                               coords))
         {
+          /* We can get a click notification even though the end point
+           * has been moved a few pixels. Since a move will change the
+           * free selection, revert it before doing the commit.
+           */
+          gimp_free_select_tool_revert_to_saved_state (fst);
+          
           gimp_free_select_tool_commit (fst, display);
         }
     }
@@ -755,40 +795,6 @@
 }
 
 static void
-gimp_free_select_tool_revert_to_saved_state (GimpFreeSelectTool *fst)
-{
-  Private     *priv = GET_PRIVATE (fst);
-  GimpVector2 *source;
-  gint         n_points;
-
-  if (priv->grabbed_segment_index > 0)
-    {
-      gimp_free_select_tool_get_segment (fst,
-                                         &source,
-                                         &n_points,
-                                         priv->grabbed_segment_index - 1,
-                                         priv->grabbed_segment_index);
-
-      memcpy (source,
-              priv->saved_points_lower_segment,
-              sizeof (GimpVector2) * n_points);
-    }
-
-  if (priv->grabbed_segment_index < priv->n_segment_indices - 1)
-    {
-      gimp_free_select_tool_get_segment (fst,
-                                         &source,
-                                         &n_points,
-                                         priv->grabbed_segment_index,
-                                         priv->grabbed_segment_index + 1);
-
-      memcpy (source,
-              priv->saved_points_higher_segment,
-              sizeof (GimpVector2) * n_points);
-    }
-}
-
-static void
 gimp_free_select_tool_handle_cancel (GimpFreeSelectTool *fst)
 {
   if (gimp_free_select_tool_is_point_grabbed (fst))



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