gimp r25632 - in branches/gimp-2-4: . app/tools



Author: martinn
Date: Sat May 10 19:55:21 2008
New Revision: 25632
URL: http://svn.gnome.org/viewvc/gimp?rev=25632&view=rev

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

	* app/tools/gimprectangletool.c: Fix emission of rectangle-changed
	signal.

	* app/tools/gimpcroptool.c
	* app/tools/gimprectangleselecttool.c: Use the rectangle-changed
	signal to update the default aspect ratio. Fixes bug #530519.


Modified:
   branches/gimp-2-4/ChangeLog
   branches/gimp-2-4/app/tools/gimpcroptool.c
   branches/gimp-2-4/app/tools/gimprectangleselecttool.c
   branches/gimp-2-4/app/tools/gimprectangletool.c

Modified: branches/gimp-2-4/app/tools/gimpcroptool.c
==============================================================================
--- branches/gimp-2-4/app/tools/gimpcroptool.c	(original)
+++ branches/gimp-2-4/app/tools/gimpcroptool.c	Sat May 10 19:55:21 2008
@@ -77,6 +77,7 @@
                                                   gint                   y,
                                                   gint                   w,
                                                   gint                   h);
+static gboolean gimp_crop_tool_rectangle_changed (GimpRectangleTool     *rectangle);
 
 static void   gimp_crop_tool_update_option_defaults
                                                  (GimpCropTool          *crop_tool,
@@ -151,8 +152,9 @@
 static void
 gimp_crop_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface)
 {
-  iface->execute = gimp_crop_tool_execute;
-  iface->cancel  = gimp_crop_tool_cancel;
+  iface->execute           = gimp_crop_tool_execute;
+  iface->cancel            = gimp_crop_tool_cancel;
+  iface->rectangle_changed = gimp_crop_tool_rectangle_changed;
 }
 
 static void
@@ -325,6 +327,20 @@
 }
 
 /**
+ * gimp_crop_tool_rectangle_changed:
+ * @rectangle:
+ *
+ * Returns: 
+ **/
+static gboolean
+gimp_crop_tool_rectangle_changed (GimpRectangleTool *rectangle)
+{
+  gimp_crop_tool_update_option_defaults (GIMP_CROP_TOOL (rectangle), FALSE);
+
+  return TRUE;
+}
+
+/**
  * gimp_crop_tool_update_option_defaults:
  * @crop_tool:
  * @ignore_pending: %TRUE to ignore any pending crop rectangle.

Modified: branches/gimp-2-4/app/tools/gimprectangleselecttool.c
==============================================================================
--- branches/gimp-2-4/app/tools/gimprectangleselecttool.c	(original)
+++ branches/gimp-2-4/app/tools/gimprectangleselecttool.c	Sat May 10 19:55:21 2008
@@ -755,14 +755,14 @@
 static gboolean
 gimp_rect_select_tool_rectangle_changed (GimpRectangleTool *rectangle)
 {
-  GimpTool *tool = GIMP_TOOL (rectangle);
+  GimpTool           *tool        = GIMP_TOOL (rectangle);
+  GimpRectSelectTool *rect_select = GIMP_RECT_SELECT_TOOL (tool);
 
   /* prevent change in selection from halting the tool */
   gimp_tool_control_set_preserve (tool->control, TRUE);
 
   if (tool->display && ! gimp_tool_control_is_active (tool->control))
     {
-      GimpRectSelectTool *rect_select = GIMP_RECT_SELECT_TOOL (tool);
       GimpImage          *image       = tool->display->image;
       GimpUndo           *undo;
       gint                x1, y1, x2, y2;
@@ -811,6 +811,8 @@
 
   gimp_tool_control_set_preserve (tool->control, FALSE);
 
+  gimp_rect_select_tool_update_option_defaults (rect_select, FALSE);
+
   return TRUE;
 }
 

Modified: branches/gimp-2-4/app/tools/gimprectangletool.c
==============================================================================
--- branches/gimp-2-4/app/tools/gimprectangletool.c	(original)
+++ branches/gimp-2-4/app/tools/gimprectangletool.c	Sat May 10 19:55:21 2008
@@ -1159,8 +1159,6 @@
                                                  private->lasty);
 
           gimp_rectangle_tool_update_highlight (rectangle);
-
-          gimp_rectangle_tool_rectangle_changed (rectangle);
         }
     }
 
@@ -1184,8 +1182,14 @@
 
           gimp_rectangle_tool_update_highlight (rectangle);
 
-          gimp_rectangle_tool_rectangle_changed (rectangle);
-
+          /* Only emit the rectangle-changed signal if the button is
+           * not down. If it is down, the signal will and shall be
+           * emited on _button_release instead.
+           */
+          if (! (state & GDK_BUTTON1_MASK))
+            {
+              gimp_rectangle_tool_rectangle_changed (rectangle);
+            }
         }
       else if (state & GDK_BUTTON1_MASK)
         {
@@ -1200,8 +1204,6 @@
                                                     private->other_side_y);
 
           gimp_rectangle_tool_update_highlight (rectangle);
-
-          gimp_rectangle_tool_rectangle_changed (rectangle);
         }
     }
 



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