mirror of https://github.com/GNOME/gimp.git
Bill Skaggs <weskaggs@primate.ucdavis.edu>
* app/tools/gimprectangletool.c: handle fixed_width, fixed_height, and fixed_aspect in a reasonable way. Also don't crash when user modifies aspect of a nonexistent rectangle, and disconnect notify handler in dispose.
This commit is contained in:
parent
fbf0871fa7
commit
72a3574bba
|
@ -1,3 +1,11 @@
|
|||
2005-11-28 Bill Skaggs <weskaggs@primate.ucdavis.edu>
|
||||
|
||||
* app/tools/gimprectangletool.c: handle fixed_width,
|
||||
fixed_height, and fixed_aspect in a reasonable way.
|
||||
Also don't crash when user modifies aspect of a
|
||||
nonexistent rectangle, and disconnect notify
|
||||
handler in dispose.
|
||||
|
||||
2005-11-30 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/widgets/gimpeditor.c (gimp_editor_add_button)
|
||||
|
|
|
@ -1240,6 +1240,9 @@ gimp_rectangle_tool_dispose (GObject *object)
|
|||
g_signal_handlers_disconnect_by_func (options,
|
||||
G_CALLBACK (gimp_rectangle_tool_notify_height),
|
||||
rectangle);
|
||||
g_signal_handlers_disconnect_by_func (options,
|
||||
G_CALLBACK (gimp_rectangle_tool_notify_aspect),
|
||||
rectangle);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -1662,6 +1665,7 @@ gimp_rectangle_tool_motion (GimpTool *tool,
|
|||
break;
|
||||
|
||||
case RECT_RESIZING_UPPER_RIGHT:
|
||||
case RECT_RESIZING_TOP:
|
||||
if (inc_x == 0 || inc_y / inc_x > aspect)
|
||||
x2 = rx1 + (ry2 - y1) / aspect + .5;
|
||||
else
|
||||
|
@ -1669,6 +1673,7 @@ gimp_rectangle_tool_motion (GimpTool *tool,
|
|||
break;
|
||||
|
||||
case RECT_RESIZING_LOWER_LEFT:
|
||||
case RECT_RESIZING_LEFT:
|
||||
if (inc_x == 0 || inc_y / inc_x > aspect)
|
||||
x1 = rx2 - (y2 - ry1) / aspect + .5;
|
||||
else
|
||||
|
@ -1676,6 +1681,8 @@ gimp_rectangle_tool_motion (GimpTool *tool,
|
|||
break;
|
||||
|
||||
case RECT_RESIZING_LOWER_RIGHT:
|
||||
case RECT_RESIZING_RIGHT:
|
||||
case RECT_RESIZING_BOTTOM:
|
||||
if (inc_x == 0 || inc_y / inc_x > aspect)
|
||||
x2 = rx1 + (y2 - ry1) / aspect + .5;
|
||||
else
|
||||
|
@ -2485,6 +2492,9 @@ gimp_rectangle_tool_update_options (GimpRectangleTool *rectangle,
|
|||
GimpSizeEntry *entry;
|
||||
gint x1, y1, x2, y2;
|
||||
GimpRectangleOptions *options;
|
||||
gboolean fixed_width;
|
||||
gboolean fixed_height;
|
||||
gboolean fixed_aspect;
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
|
@ -2497,6 +2507,11 @@ gimp_rectangle_tool_update_options (GimpRectangleTool *rectangle,
|
|||
NULL);
|
||||
|
||||
options = GIMP_RECTANGLE_OPTIONS (GIMP_TOOL (rectangle)->tool_info->tool_options);
|
||||
g_object_get (options,
|
||||
"new-fixed-width", &fixed_width,
|
||||
"new-fixed-height", &fixed_height,
|
||||
"fixed-aspect", &fixed_aspect,
|
||||
NULL);
|
||||
|
||||
width = x2 - x1;
|
||||
height = y2 - y1;
|
||||
|
@ -2528,9 +2543,18 @@ gimp_rectangle_tool_update_options (GimpRectangleTool *rectangle,
|
|||
gimp_rectangle_tool_notify_aspect,
|
||||
rectangle);
|
||||
|
||||
if (! fixed_width)
|
||||
g_object_set (options,
|
||||
"width", width,
|
||||
NULL);
|
||||
|
||||
if (! fixed_height)
|
||||
g_object_set (options,
|
||||
"height", height,
|
||||
NULL);
|
||||
|
||||
if (! fixed_aspect)
|
||||
g_object_set (options,
|
||||
"aspect", aspect,
|
||||
NULL);
|
||||
|
||||
|
@ -2702,6 +2726,9 @@ gimp_rectangle_tool_notify_aspect (GimpRectangleOptions *options,
|
|||
GimpCoords coords;
|
||||
gdouble aspect = gimp_rectangle_options_get_aspect (options);
|
||||
|
||||
if (! GIMP_TOOL (rectangle)->gdisp)
|
||||
return;
|
||||
|
||||
g_object_get (rectangle,
|
||||
"x1", &rx1,
|
||||
"y1", &ry1,
|
||||
|
|
Loading…
Reference in New Issue