Added symbolic constants for common values to the n_snap_lines parameter

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.

svn path=/trunk/; revision=24623
This commit is contained in:
Martin Nordholts 2008-01-15 21:05:57 +00:00 committed by Martin Nordholts
parent 9934221a07
commit 8772b0a150
6 changed files with 28 additions and 19 deletions

View File

@ -1,3 +1,14 @@
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.
2008-01-15 Martin Nordholts <martinn@svn.gnome.org>
* app/tools/gimpeditselectiontool.[ch]: Made it possible to

View File

@ -47,7 +47,6 @@
#define TARGET_SIZE 15
#define N_SNAP_LINES 12
/* local function prototypes */
@ -284,12 +283,11 @@ gimp_blend_tool_motion (GimpTool *tool,
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_blend_tool_active_modifier_key (GimpTool *tool,
{
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);

View File

@ -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_edit_selection_tool_motion (GimpTool *tool,
{
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;

View File

@ -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_measure_tool_motion (GimpTool *tool,
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 @@ gimp_measure_tool_active_modifier_key (GimpTool *tool,
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);

View File

@ -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 @@ gimp_paint_tool_round_line (GimpPaintCore *core,
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

View File

@ -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,