* app/tools/gimprectangleselecttool.c
	* app/tools/gimprectangletool.c: fix three issues identified by
	jimmac: (1) when shift or ctrl are pressed, should start a new
	rect regardless of pointer loc; (2) zoom was incorrectly affecting
	width of sensitive areas; (3) must emit "rectangle-changed" after
	keyboard-driven rectangle movement.
This commit is contained in:
William Skaggs
2006-06-12 21:15:22 +00:00
parent 612705daa5
commit 131aad120c
3 changed files with 31 additions and 8 deletions

View File

@ -1,3 +1,12 @@
2006-06-11 Bill Skaggs <weskaggs@primate.ucdavis.edu>
* app/tools/gimprectangleselecttool.c
* app/tools/gimprectangletool.c: fix three issues identified by
jimmac: (1) when shift or ctrl are pressed, should start a new
rect regardless of pointer loc; (2) zoom was incorrectly affecting
width of sensitive areas; (3) must emit "rectangle-changed" after
keyboard-driven rectangle movement.
2006-06-12 Sven Neumann <sven@gimp.org> 2006-06-12 Sven Neumann <sven@gimp.org>
* plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Dialogs.c

View File

@ -284,6 +284,11 @@ gimp_rect_select_tool_button_press (GimpTool *tool,
return; return;
} }
/* if the shift or ctrl keys are down, we don't want to adjust, we
* want to create a new rectangle, regardless of pointer loc */
if (state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK))
g_object_set (tool, "function", RECT_CREATING, NULL);
gimp_rectangle_tool_button_press (tool, coords, time, state, display); gimp_rectangle_tool_button_press (tool, coords, time, state, display);
/* if we have an existing rectangle in the current display, then /* if we have an existing rectangle in the current display, then

View File

@ -1592,6 +1592,8 @@ gimp_rectangle_tool_key_press (GimpTool *tool,
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool)); gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
g_signal_emit_by_name (rectangle, "rectangle-changed", NULL);
return TRUE; return TRUE;
} }
@ -1608,6 +1610,8 @@ gimp_rectangle_tool_oper_update (GimpTool *tool,
gint x1, y1, x2, y2; gint x1, y1, x2, y2;
gboolean inside_x; gboolean inside_x;
gboolean inside_y; gboolean inside_y;
gdouble handle_w, handle_h;
GimpDisplayShell *shell;
g_return_if_fail (GIMP_IS_RECTANGLE_TOOL (tool)); g_return_if_fail (GIMP_IS_RECTANGLE_TOOL (tool));
@ -1616,6 +1620,8 @@ gimp_rectangle_tool_oper_update (GimpTool *tool,
if (tool->display != display) if (tool->display != display)
return; return;
shell = GIMP_DISPLAY_SHELL (tool->display->shell);
g_object_get (rectangle, g_object_get (rectangle,
"x1", &x1, "x1", &x1,
"y1", &y1, "y1", &y1,
@ -1623,6 +1629,9 @@ gimp_rectangle_tool_oper_update (GimpTool *tool,
"y2", &y2, "y2", &y2,
NULL); NULL);
handle_w = private->dcw / SCALEFACTOR_X (shell);
handle_h = private->dch / SCALEFACTOR_Y (shell);
inside_x = coords->x > x1 && coords->x < x2; inside_x = coords->x > x1 && coords->x < x2;
inside_y = coords->y > y1 && coords->y < y2; inside_y = coords->y > y1 && coords->y < y2;
@ -1630,7 +1639,7 @@ gimp_rectangle_tool_oper_update (GimpTool *tool,
coords->x, coords->y, coords->x, coords->y,
GIMP_HANDLE_SQUARE, GIMP_HANDLE_SQUARE,
x1, y1, x1, y1,
private->dcw, private->dch, handle_w, handle_h,
GTK_ANCHOR_NORTH_WEST, GTK_ANCHOR_NORTH_WEST,
FALSE)) FALSE))
{ {
@ -1645,7 +1654,7 @@ gimp_rectangle_tool_oper_update (GimpTool *tool,
coords->x, coords->y, coords->x, coords->y,
GIMP_HANDLE_SQUARE, GIMP_HANDLE_SQUARE,
x2, y2, x2, y2,
private->dcw, private->dch, handle_w, handle_h,
GTK_ANCHOR_SOUTH_EAST, GTK_ANCHOR_SOUTH_EAST,
FALSE)) FALSE))
{ {
@ -1660,7 +1669,7 @@ gimp_rectangle_tool_oper_update (GimpTool *tool,
coords->x, coords->y, coords->x, coords->y,
GIMP_HANDLE_SQUARE, GIMP_HANDLE_SQUARE,
x2, y1, x2, y1,
private->dcw, private->dch, handle_w, handle_h,
GTK_ANCHOR_NORTH_EAST, GTK_ANCHOR_NORTH_EAST,
FALSE)) FALSE))
{ {
@ -1675,7 +1684,7 @@ gimp_rectangle_tool_oper_update (GimpTool *tool,
coords->x, coords->y, coords->x, coords->y,
GIMP_HANDLE_SQUARE, GIMP_HANDLE_SQUARE,
x1, y2, x1, y2,
private->dcw, private->dch, handle_w, handle_h,
GTK_ANCHOR_SOUTH_WEST, GTK_ANCHOR_SOUTH_WEST,
FALSE)) FALSE))
{ {
@ -1686,7 +1695,7 @@ gimp_rectangle_tool_oper_update (GimpTool *tool,
y2 - coords->y, y2 - coords->y,
0, 0); 0, 0);
} }
else if ( (fabs (coords->x - x1) < private->dcw) && inside_y) else if ( (fabs (coords->x - x1) < handle_w) && inside_y)
{ {
g_object_set (rectangle, "function", RECT_RESIZING_LEFT, NULL); g_object_set (rectangle, "function", RECT_RESIZING_LEFT, NULL);
@ -1694,7 +1703,7 @@ gimp_rectangle_tool_oper_update (GimpTool *tool,
x1 - coords->x, 0, 0, 0); x1 - coords->x, 0, 0, 0);
} }
else if ( (fabs (coords->x - x2) < private->dcw) && inside_y) else if ( (fabs (coords->x - x2) < handle_w) && inside_y)
{ {
g_object_set (rectangle, "function", RECT_RESIZING_RIGHT, NULL); g_object_set (rectangle, "function", RECT_RESIZING_RIGHT, NULL);
@ -1702,7 +1711,7 @@ gimp_rectangle_tool_oper_update (GimpTool *tool,
x2 - coords->x, 0, 0, 0); x2 - coords->x, 0, 0, 0);
} }
else if ( (fabs (coords->y - y1) < private->dch) && inside_x) else if ( (fabs (coords->y - y1) < handle_h) && inside_x)
{ {
g_object_set (rectangle, "function", RECT_RESIZING_TOP, NULL); g_object_set (rectangle, "function", RECT_RESIZING_TOP, NULL);
@ -1710,7 +1719,7 @@ gimp_rectangle_tool_oper_update (GimpTool *tool,
0, y1 - coords->y, 0, 0); 0, y1 - coords->y, 0, 0);
} }
else if ( (fabs (coords->y - y2) < private->dch) && inside_x) else if ( (fabs (coords->y - y2) < handle_h) && inside_x)
{ {
g_object_set (rectangle, "function", RECT_RESIZING_BOTTOM, NULL); g_object_set (rectangle, "function", RECT_RESIZING_BOTTOM, NULL);