gimp r26065 - in trunk: . app/tools



Author: martinn
Date: Sat Jul  5 09:47:39 2008
New Revision: 26065
URL: http://svn.gnome.org/viewvc/gimp?rev=26065&view=rev

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

	* app/tools/gimprectangletool.c:
	* app/tools/gimpeditselectiontool.c: Mark the center of
	rectangles/bounding rectangles so that it is easier to predict and
	see where snapping occurs. Completes the fix for bug #527659.


Modified:
   trunk/ChangeLog
   trunk/app/tools/gimpeditselectiontool.c
   trunk/app/tools/gimprectangletool.c

Modified: trunk/app/tools/gimpeditselectiontool.c
==============================================================================
--- trunk/app/tools/gimpeditselectiontool.c	(original)
+++ trunk/app/tools/gimpeditselectiontool.c	Sat Jul  5 09:47:39 2008
@@ -62,6 +62,7 @@
 
 #define EDIT_SELECT_SCROLL_LOCK FALSE
 #define ARROW_VELOCITY          25
+#define CENTER_CROSS_SIZE       6
 
 
 typedef struct _GimpEditSelectionTool
@@ -79,6 +80,9 @@
   gint                x1, y1;          /*  Bounding box of selection mask    */
   gint                x2, y2;
 
+  gdouble             center_x;        /*  Where to draw the mark of center  */
+  gdouble             center_y;
+
   GimpTranslateMode   edit_mode;       /*  Translate the mask or layer?      */
 
   gboolean            first_move;      /*  Don't push undos after the first  */
@@ -430,6 +434,10 @@
                                         y1 - coords->y,
                                         x2 - x1,
                                         y2 - y1);
+
+    /* Save where to draw the mark of the center */
+    edit_select->center_x = x1 + (x2 - x1) / 2.0;
+    edit_select->center_y = y1 + (y2 - y1) / 2.0;
   }
 
   gimp_tool_control_activate (GIMP_TOOL (edit_select)->control);
@@ -951,6 +959,15 @@
       break;
     }
 
+  /* Mark the center because we snap to it */
+  gimp_draw_tool_draw_cross_by_anchor (draw_tool,
+                                       edit_select->center_x + edit_select->cumlx,
+                                       edit_select->center_y + edit_select->cumly,
+                                       CENTER_CROSS_SIZE,
+                                       CENTER_CROSS_SIZE,
+                                       GTK_ANCHOR_CENTER,
+                                       FALSE);
+
   GIMP_DRAW_TOOL_CLASS (parent_class)->draw (draw_tool);
 }
 

Modified: trunk/app/tools/gimprectangletool.c
==============================================================================
--- trunk/app/tools/gimprectangletool.c	(original)
+++ trunk/app/tools/gimprectangletool.c	Sat Jul  5 09:47:39 2008
@@ -64,6 +64,7 @@
 #define MIN_HANDLE_SIZE         15
 #define NARROW_MODE_HANDLE_SIZE 15
 #define NARROW_MODE_THRESHOLD   45
+#define CENTER_CROSS_SIZE       6
 
 
 #define SQRT5   2.236067977
@@ -1666,9 +1667,23 @@
   switch (private->function)
     {
     case GIMP_RECTANGLE_TOOL_MOVING:
+
       if (gimp_tool_control_is_active (tool->control))
-        break;
-      /* else fallthrough */
+        {
+          /* Mark the center because we snap to it */
+          gimp_draw_tool_draw_cross_by_anchor (draw_tool,
+                                               pub_x1 + (pub_x2 - pub_x1) / 2.0,
+                                               pub_y1 + (pub_y2 - pub_y1) / 2.0,
+                                               CENTER_CROSS_SIZE,
+                                               CENTER_CROSS_SIZE,
+                                               GTK_ANCHOR_CENTER,
+                                               FALSE);
+          break;
+        }
+      else
+        {
+          /* Fallthrough */
+        }
 
     case GIMP_RECTANGLE_TOOL_DEAD:
     case GIMP_RECTANGLE_TOOL_CREATING:



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