Removed gimp_rectangle_tool_get_press_coords() as it doesn't make sense

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

	* app/tools/gimprectangletool.[ch]: Removed
	gimp_rectangle_tool_get_press_coords() as it doesn't make sense
	for a rectangle tool interface to provide this functionality.
	Clients should take care of that themselves. Also adjusted
	internal code accordingly.

	* app/tools/gimprectangleselecttool.c: Remember the pressed
	coordinates on _button_press instead of asking GimpRectangleTool
	about it.

svn path=/trunk/; revision=24119
This commit is contained in:
Martin Nordholts 2007-11-11 14:00:48 +00:00 committed by Martin Nordholts
parent 222d3349e6
commit 49e2670eb6
4 changed files with 37 additions and 33 deletions

View File

@ -1,3 +1,15 @@
2007-11-11 Martin Nordholts <martinn@svn.gnome.org>
* app/tools/gimprectangletool.[ch]: Removed
gimp_rectangle_tool_get_press_coords() as it doesn't make sense
for a rectangle tool interface to provide this functionality.
Clients should take care of that themselves. Also adjusted
internal code accordingly.
* app/tools/gimprectangleselecttool.c: Remember the pressed
coordinates on _button_press instead of asking GimpRectangleTool
about it.
2007-11-11 Michael Natterer <mitch@gimp.org>
* configure.in: depend on pango 1.18

View File

@ -20,6 +20,7 @@
#include <gtk/gtk.h>
#include "libgimpmath/gimpmath.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "tools-types.h"
@ -67,6 +68,9 @@ typedef struct GimpRectSelectToolPrivate
gboolean round_corners;
gdouble corner_radius;
gdouble press_x;
gdouble press_y;
} GimpRectSelectToolPrivate;
@ -221,6 +225,9 @@ gimp_rect_select_tool_init (GimpRectSelectTool *rect_select)
priv->undo = NULL;
priv->redo = NULL;
priv->press_x = 0.0;
priv->press_y = 0.0;
}
static GObject *
@ -374,6 +381,9 @@ gimp_rect_select_tool_button_press (GimpTool *tool,
gimp_rectangle_tool_button_press (tool, coords, time, state, display);
priv->press_x = coords->x;
priv->press_y = coords->y;
/* if we have an existing rectangle in the current display, then
* we have already "executed", and need to undo at this point,
* unless the user has done something in the meantime
@ -703,6 +713,12 @@ gimp_rect_select_tool_execute (GimpRectangleTool *rectangle,
gint w,
gint h)
{
GimpRectSelectTool *rect_sel_tool;
GimpRectSelectToolPrivate *priv;
rect_sel_tool = GIMP_RECT_SELECT_TOOL (rectangle);
priv = GIMP_RECT_SELECT_TOOL_GET_PRIVATE(rect_sel_tool);
if (w == 0 && h == 0)
{
GimpImage *image = GIMP_TOOL (rectangle)->display->image;
@ -717,7 +733,8 @@ gimp_rect_select_tool_execute (GimpRectangleTool *rectangle,
return TRUE;
}
gimp_rectangle_tool_get_press_coords (rectangle, &pressx, &pressy);
pressx = ROUND (priv->press_x);
pressy = ROUND (priv->press_y);
/* if the click was inside the marching ants */
if (gimp_pickable_get_opacity_at (GIMP_PICKABLE (selection),
@ -754,7 +771,7 @@ gimp_rect_select_tool_execute (GimpRectangleTool *rectangle,
}
}
gimp_rect_select_tool_update_option_defaults (GIMP_RECT_SELECT_TOOL (rectangle),
gimp_rect_select_tool_update_option_defaults (rect_sel_tool,
FALSE);
return TRUE;

View File

@ -100,12 +100,6 @@ struct _GimpRectangleToolPrivate
* during gimp_rectangle_tool_button_press and then only read.
*/
/* Holds coordinate where button was pressed when rectangle adjustment was
* initiated.
*/
gint pressx;
gint pressy;
/* Holds the coordinate that should be used as the "other side" when
* fixed-center is turned off.
*/
@ -474,19 +468,6 @@ gimp_rectangle_tool_get_constraint (GimpRectangleTool *tool)
return private->constraint;
}
void
gimp_rectangle_tool_get_press_coords (GimpRectangleTool *rect_tool,
gint *pressx_ptr,
gint *pressy_ptr)
{
GimpRectangleToolPrivate *private;
private = GIMP_RECTANGLE_TOOL_GET_PRIVATE (rect_tool);
*pressx_ptr = private->pressx;
*pressy_ptr = private->pressy;
}
/**
* gimp_rectangle_tool_pending_size_set:
* @width_property: Option property to set to pending rectangle width.
@ -852,9 +833,6 @@ gimp_rectangle_tool_button_press (GimpTool *tool,
x += snap_x;
y += snap_y;
private->pressx = x;
private->pressy = y;
private->lastx = x;
private->lasty = y;
@ -864,8 +842,8 @@ gimp_rectangle_tool_button_press (GimpTool *tool,
*/
if (private->function == RECT_CREATING)
{
private->center_x_on_fixed_center = private->pressx;
private->center_y_on_fixed_center = private->pressy;
private->center_x_on_fixed_center = x;
private->center_y_on_fixed_center = y;
}
else
{
@ -880,8 +858,8 @@ gimp_rectangle_tool_button_press (GimpTool *tool,
*/
if (private->function == RECT_CREATING)
{
private->other_side_x = private->pressx;
private->other_side_y = private->pressy;
private->other_side_x = x;
private->other_side_y = y;
}
else
{

View File

@ -129,9 +129,6 @@ GimpRectangleConstraint gimp_rectangle_tool_get_constraint
GimpRectangleFunction gimp_rectangle_tool_get_function (GimpRectangleTool *rectangle);
void gimp_rectangle_tool_set_function (GimpRectangleTool *rectangle,
GimpRectangleFunction function);
void gimp_rectangle_tool_get_press_coords (GimpRectangleTool *rectangle,
gint *pressx_ptr,
gint *pressy_ptr);
void gimp_rectangle_tool_pending_size_set (GimpRectangleTool *rectangle,
GObject *object,
const gchar *width_property,