Mark the center of rectangles/bounding rectangles so that it is easier to

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.

svn path=/trunk/; revision=26065
This commit is contained in:
Martin Nordholts
2008-07-05 09:47:39 +00:00
committed by Martin Nordholts
parent 161c5e9131
commit 995a944ca8
3 changed files with 41 additions and 2 deletions

View File

@ -1,3 +1,10 @@
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.
2008-07-05 Martin Nordholts <martinn@svn.gnome.org>
* app/tools/gimpeditselectiontool.[ch]: Don't expose the icky

View File

@ -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 @@ typedef struct _GimpEditSelectionTool
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 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool,
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 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool)
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);
}

View File

@ -64,6 +64,7 @@ enum
#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 @@ gimp_rectangle_tool_draw (GimpDrawTool *draw_tool)
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: