gimp r24623 - in trunk: . app/tools



Author: martinn
Date: Tue Jan 15 21:05:57 2008
New Revision: 24623
URL: http://svn.gnome.org/viewvc/gimp?rev=24623&view=rev

Log:
2008-01-15  Martin Nordholts  <martinn svn gnome org>

	* app/tools/tools-utils.h: Added symbolic constants for common
	values to the n_snap_lines parameter of
	gimp_tool_motion_constrain.

	* app/tools/gimpblendtool.c:
	* app/tools/gimpeditselectiontool.c:
	* app/tools/gimpmeasuretool.c:
	* app/tools/gimppainttool.c: Use these new symbolic constants.


Modified:
   trunk/ChangeLog
   trunk/app/tools/gimpblendtool.c
   trunk/app/tools/gimpeditselectiontool.c
   trunk/app/tools/gimpmeasuretool.c
   trunk/app/tools/gimppainttool.c
   trunk/app/tools/tools-utils.h

Modified: trunk/app/tools/gimpblendtool.c
==============================================================================
--- trunk/app/tools/gimpblendtool.c	(original)
+++ trunk/app/tools/gimpblendtool.c	Tue Jan 15 21:05:57 2008
@@ -47,7 +47,6 @@
 
 
 #define TARGET_SIZE  15
-#define N_SNAP_LINES 12
 
 
 /*  local function prototypes  */
@@ -284,12 +283,11 @@
       blend_tool->end_y = coords->y;
     }
 
-  /* Restrict to multiples of 15 degrees if ctrl is pressed */
   if (state & GDK_CONTROL_MASK)
     {
       gimp_tool_motion_constrain (blend_tool->start_x, blend_tool->start_y,
                                   &blend_tool->end_x, &blend_tool->end_y,
-                                  N_SNAP_LINES);
+                                  GIMP_TOOL_CONSTRAIN_15_DEGREES);
     }
 
   gimp_tool_pop_status (tool, display);
@@ -322,7 +320,7 @@
         {
           gimp_tool_motion_constrain (blend_tool->start_x, blend_tool->start_y,
                                       &blend_tool->end_x, &blend_tool->end_y,
-                                      N_SNAP_LINES);
+                                      GIMP_TOOL_CONSTRAIN_15_DEGREES);
         }
 
       gimp_tool_pop_status (tool, display);

Modified: trunk/app/tools/gimpeditselectiontool.c
==============================================================================
--- trunk/app/tools/gimpeditselectiontool.c	(original)
+++ trunk/app/tools/gimpeditselectiontool.c	Tue Jan 15 21:05:57 2008
@@ -63,12 +63,6 @@
 #define EDIT_SELECT_SCROLL_LOCK FALSE
 #define ARROW_VELOCITY          25
 
-/**
- * The number of evenly distributed lines onto which moving will be
- * constrained when movement constraint is active.
- */
-#define N_SNAP_LINES            4
-
 
 static void    gimp_edit_selection_tool_button_release      (GimpTool              *tool,
                                                              GimpCoords            *coords,
@@ -566,7 +560,7 @@
     {
       gimp_tool_motion_constrain (edit_select->start_x, edit_select->start_y,
                                   &coords->x, &coords->y,
-                                  N_SNAP_LINES);
+                                  GIMP_TOOL_CONSTRAIN_45_DEGREES);
     }
 
   motion_x = coords->x - off_x;

Modified: trunk/app/tools/gimpmeasuretool.c
==============================================================================
--- trunk/app/tools/gimpmeasuretool.c	(original)
+++ trunk/app/tools/gimpmeasuretool.c	Tue Jan 15 21:05:57 2008
@@ -52,9 +52,8 @@
 #include "gimp-intl.h"
 
 
-#define  TARGET       12
-#define  ARC_RADIUS   30
-#define  N_SNAP_LINES 12
+#define  TARGET      12
+#define  ARC_RADIUS  30
 
 
 /*  local function prototypes  */
@@ -437,7 +436,7 @@
 
           gimp_tool_motion_constrain (measure->x[0], measure->y[0],
                                       &x, &y,
-                                      N_SNAP_LINES);
+                                      GIMP_TOOL_CONSTRAIN_15_DEGREES);
 
           measure->x[i] = ROUND (x);
           measure->y[i] = ROUND (y);
@@ -510,7 +509,7 @@
       if (press)
         gimp_tool_motion_constrain (measure->x[0], measure->y[0],
                                     &x, &y,
-                                    N_SNAP_LINES);
+                                    GIMP_TOOL_CONSTRAIN_15_DEGREES);
 
       measure->x[measure->point] = ROUND (x);
       measure->y[measure->point] = ROUND (y);

Modified: trunk/app/tools/gimppainttool.c
==============================================================================
--- trunk/app/tools/gimppainttool.c	(original)
+++ trunk/app/tools/gimppainttool.c	Tue Jan 15 21:05:57 2008
@@ -51,7 +51,6 @@
 
 #define HANDLE_SIZE    15
 #define STATUSBAR_SIZE 200
-#define N_SNAP_LINES   12
 
 
 static GObject * gimp_paint_tool_constructor (GType                  type,
@@ -254,11 +253,10 @@
       core->cur_coords.y  = floor (core->cur_coords.y ) + 0.5;
     }
 
-  /* Restrict to multiples of 15 degrees if ctrl is pressed */
   if (state & GDK_CONTROL_MASK)
     gimp_tool_motion_constrain (core->last_coords.x, core->last_coords.y,
                                 &core->cur_coords.x, &core->cur_coords.y,
-                                N_SNAP_LINES);
+                                GIMP_TOOL_CONSTRAIN_15_DEGREES);
 }
 
 static void

Modified: trunk/app/tools/tools-utils.h
==============================================================================
--- trunk/app/tools/tools-utils.h	(original)
+++ trunk/app/tools/tools-utils.h	Tue Jan 15 21:05:57 2008
@@ -20,6 +20,15 @@
 #define __TOOLS_UTILS_H__
 
 
+/*
+ * Common values for the n_snap_lines parameter of
+ * gimp_tool_motion_constrain.
+ */
+#define GIMP_TOOL_CONSTRAIN_90_DEGREES 2
+#define GIMP_TOOL_CONSTRAIN_45_DEGREES 4
+#define GIMP_TOOL_CONSTRAIN_15_DEGREES 12
+
+
 void  gimp_tool_motion_constrain (gdouble   start_x,
                                   gdouble   start_y,
                                   gdouble  *end_x,



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