Don't use any dead areas in narrow-mode, and adjust constants a bit.

2007-11-06  Martin Nordholts  <martinn@svn.gnome.org>

	* app/tools/gimprectangletool.c
	(gimp_rectangle_tool_update_handle_sizes): Don't use any dead
	areas in narrow-mode, and adjust constants a bit.

	* app/tools/gimpdrawtool.c (gimp_draw_tool_draw_corner): Adjusted
	to always draw side handles in narrow mode without dead areas.

svn path=/trunk/; revision=24077
This commit is contained in:
Martin Nordholts 2007-11-06 22:04:18 +00:00 committed by Martin Nordholts
parent fb1ec39812
commit 2ce790a8a5
3 changed files with 26 additions and 95 deletions

View File

@ -1,3 +1,12 @@
2007-11-06 Martin Nordholts <martinn@svn.gnome.org>
* app/tools/gimprectangletool.c
(gimp_rectangle_tool_update_handle_sizes): don't use any dead
areas in narrow-mode, and enter narrow-mode earlier.
* app/tools/gimpdrawtool.c (gimp_draw_tool_draw_corner): adjusted
to always draw side handles in narrow mode without dead areas.
2007-11-06 Michael Natterer <mitch@gimp.org>
* configure.in: remove check for putenv().

View File

@ -895,7 +895,7 @@ gimp_draw_tool_draw_corner (GimpDrawTool *draw_tool,
tw = tx2 - tx1;
th = ty2 - ty1;
if (! put_outside && (tw <= width || th <= height) ||
if ((! put_outside && (tw <= width || th <= height)) ||
width <= 2 || height <= 2)
return;
@ -1169,26 +1169,9 @@ gimp_draw_tool_draw_corner (GimpDrawTool *draw_tool,
if (put_outside)
{
gimp_canvas_draw_rectangle (canvas, GIMP_CANVAS_STYLE_XOR, FALSE,
tx1 + top_and_bottom_handle_x_offset,
tx1 + top_and_bottom_handle_x_offset + 1,
ty1 - height + 2,
width - 1, height - 3);
/* Don't draw the extra inside-lines if the side handle fills
* the side completely by itself.
*/
if (top_and_bottom_handle_x_offset > 1)
{
gimp_canvas_draw_line (canvas, GIMP_CANVAS_STYLE_XOR,
tx1 + top_and_bottom_handle_x_offset + 1,
ty1 - height + 3,
tx1 + top_and_bottom_handle_x_offset + 1,
ty1 - 1);
gimp_canvas_draw_line (canvas, GIMP_CANVAS_STYLE_XOR,
tx1 + top_and_bottom_handle_x_offset + width - 2,
ty1 - height + 3,
tx1 + top_and_bottom_handle_x_offset + width - 2,
ty1 - 1);
}
width - 3, height - 3);
}
else
{
@ -1213,22 +1196,9 @@ gimp_draw_tool_draw_corner (GimpDrawTool *draw_tool,
if (put_outside)
{
gimp_canvas_draw_rectangle (canvas, GIMP_CANVAS_STYLE_XOR, FALSE,
tx1 + top_and_bottom_handle_x_offset,
tx1 + top_and_bottom_handle_x_offset + 1,
ty2,
width - 1, height - 3);
if (top_and_bottom_handle_x_offset > 1)
{
gimp_canvas_draw_line (canvas, GIMP_CANVAS_STYLE_XOR,
tx1 + top_and_bottom_handle_x_offset + 1,
ty2 + 1,
tx1 + top_and_bottom_handle_x_offset + 1,
ty2 + height - 3);
gimp_canvas_draw_line (canvas, GIMP_CANVAS_STYLE_XOR,
tx1 + top_and_bottom_handle_x_offset + width - 2,
ty2 + 1,
tx1 + top_and_bottom_handle_x_offset + width - 2,
ty2 + height - 3);
}
width - 3, height - 3);
}
else
{
@ -1254,22 +1224,8 @@ gimp_draw_tool_draw_corner (GimpDrawTool *draw_tool,
{
gimp_canvas_draw_rectangle (canvas, GIMP_CANVAS_STYLE_XOR, FALSE,
tx1 - width + 2,
ty1 + left_and_right_handle_y_offset,
width - 3, height - 1);
if (left_and_right_handle_y_offset > 1)
{
gimp_canvas_draw_line (canvas, GIMP_CANVAS_STYLE_XOR,
tx1 - width + 3,
ty1 + left_and_right_handle_y_offset + 1,
tx1 - 1,
ty1 + left_and_right_handle_y_offset + 1);
gimp_canvas_draw_line (canvas, GIMP_CANVAS_STYLE_XOR,
tx1 - width + 3,
ty1 + left_and_right_handle_y_offset + height - 2,
tx1 - 1,
ty1 + left_and_right_handle_y_offset + height - 2);
}
ty1 + left_and_right_handle_y_offset + 1,
width - 3, height - 3);
}
else
{
@ -1295,22 +1251,8 @@ gimp_draw_tool_draw_corner (GimpDrawTool *draw_tool,
{
gimp_canvas_draw_rectangle (canvas, GIMP_CANVAS_STYLE_XOR, FALSE,
tx2,
ty1 + left_and_right_handle_y_offset,
width - 3, height - 1);
if (left_and_right_handle_y_offset > 1)
{
gimp_canvas_draw_line (canvas, GIMP_CANVAS_STYLE_XOR,
tx2 + 1,
ty1 + left_and_right_handle_y_offset + 1,
tx2 + width - 3,
ty1 + left_and_right_handle_y_offset + 1);
gimp_canvas_draw_line (canvas, GIMP_CANVAS_STYLE_XOR,
tx2 + 1,
ty1 + left_and_right_handle_y_offset + height - 2,
tx2 + width - 3,
ty1 + left_and_right_handle_y_offset + height - 2);
}
ty1 + left_and_right_handle_y_offset + 1,
width - 3, height - 3);
}
else
{

View File

@ -59,14 +59,10 @@ enum
/* speed of key movement */
#define ARROW_VELOCITY 25
/* When visible rectangle width/height goes below this, use
* narrow-mode.
*/
#define NARROW_MODE_THRESHOLD 18
#define MAX_HANDLE_SIZE 50
#define MIN_HANDLE_SIZE 6
#define MIN_HANDLE_SIZE 15
#define NARROW_MODE_HANDLE_SIZE 15
#define NARROW_MODE_THRESHOLD 45
#define SQRT5 2.236067977
@ -1847,29 +1843,13 @@ gimp_rectangle_tool_update_handle_sizes (GimpRectangleTool *rect_tool)
private->corner_handle_w = NARROW_MODE_HANDLE_SIZE;
private->corner_handle_h = NARROW_MODE_HANDLE_SIZE;
if (rectangle_width < NARROW_MODE_THRESHOLD)
{
private->top_and_bottom_handle_w = rectangle_width - 2;
}
else
{
private->top_and_bottom_handle_w = rectangle_width - 2 * NARROW_MODE_HANDLE_SIZE;
}
if (rectangle_height < NARROW_MODE_THRESHOLD)
{
private->left_and_right_handle_h = rectangle_height - 2;
}
else
{
private->left_and_right_handle_h = rectangle_height - 2 * NARROW_MODE_HANDLE_SIZE;
}
private->top_and_bottom_handle_w = CLAMP (private->top_and_bottom_handle_w,
MIN (rectangle_width - 2, NARROW_MODE_HANDLE_SIZE),
private->top_and_bottom_handle_w = CLAMP (rectangle_width,
MIN (rectangle_width - 2,
NARROW_MODE_HANDLE_SIZE),
G_MAXINT);
private->left_and_right_handle_h = CLAMP (private->left_and_right_handle_h,
MIN (rectangle_height - 2, NARROW_MODE_HANDLE_SIZE),
private->left_and_right_handle_h = CLAMP (rectangle_height,
MIN (rectangle_height - 2,
NARROW_MODE_HANDLE_SIZE),
G_MAXINT);
}
else