Commit 02fde14c authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

build display/ before tools/.

2001-11-08  Michael Natterer  <mitch@gimp.org>

	* app/Makefile.am: build display/ before tools/.

	* app/devices.c: devices_check_change(): added all events
	which have a GdkDevice pointer.

	* app/gimpprogress.c: include "display-types.h" instead of
	"core-types.h".

	* app/core/Makefile.am
	* app/core/gimpdrawable-bucket-fill.[ch]: new files: the bucket_fill
	stuff taken from tools/gimpbucketfilltool.[ch].

	* app/core/core-types.h: added "BucketFillMode".

	* app/core/gimpimage-mask-select.[ch]: cleanup.

	* app/core/gimpmarshal.list: added more marshallers for GimpTool's
	new signal signatures.

	* app/core/gimpmarshal.[ch]: regenerated.

	* app/display/Makefile.am
	* app/display/gimpdisplayshell-dnd.[ch]
	* app/display/gimpdisplayshell-layer-select.[ch]: new files: the
	canvas drop callbacks from gimpdisplayshell-callbacks.[ch] and
	the stuff formerly knows as gui/layer-select.[ch].

	* app/display/gimpdisplay.h: don't include "gui/gui-types.h".

	* app/display/gximage.c: include "display-types.h".

	* app/display/gimpdisplay-foreach.c
	* app/display/gimpdisplayshell.[ch]: call gdsplay_delete(), don't
	destroy the shell widget.

	* app/gui/Makefile.am
	* app/gui/layer-select.[ch]: removed.

	* app/gui/gradients-commands.c: fixed "Save as POV" fprintf()s.

	* app/gui/preferences-dialog.c: removed the layer_select stuff
	because it is useless with the new preview system.

	* app/gui/tool-options-dialog.c: send the correct data to the
	close_callback.

	* app/gui/tools-commands.c: changed to follow the new
	gimp_tool_initialize() semantics (see below).

	Tool & canvas event handling chainsawing:

	* app/tools/tools-types.h: new struct GimpCoords which contains
	x, y, pressure, tilt etc.

	* app/display/gimpdisplayshell-callbacks.[ch]: added utility
	functions which transparently retreive the current event's
	GimpCoords or take it from the device directly if the event has
	none. Pass GimpCoords _in_image_coordinates_ to all tool
	functions.

	Most important: don't pass GdkEvents and display coordinates to
	tools any more.

	* app/tools/gimptool.[ch]: changed virtual functions to take
	GimpCoords, time and state separately instead of GdkEvents.

	* app/tools/gimpbezierselecttool.c
	* app/tools/gimpblendtool.c
	* app/tools/gimpbucketfilltool.[ch]
	* app/tools/gimpbycolorselecttool.c
	* app/tools/gimpclonetool.c
	* app/tools/gimpcolorpickertool.c
	* app/tools/gimpconvolvetool.c
	* app/tools/gimpcroptool.[ch]
	* app/tools/gimpcurvestool.c
	* app/tools/gimpdodgeburntool.c
	* app/tools/gimpdrawtool.c
	* app/tools/gimpeditselectiontool.[ch]
	* app/tools/gimperasertool.c
	* app/tools/gimpfliptool.c
	* app/tools/gimpfreeselecttool.[ch]
	* app/tools/gimpfuzzyselecttool.c
	* app/tools/gimpinktool.c
	* app/tools/gimpiscissorstool.c
	* app/tools/gimpmagnifytool.c
	* app/tools/gimpmeasuretool.c
	* app/tools/gimpmovetool.c
	* app/tools/gimppainttool.c
	* app/tools/gimppathtool.[ch]
	* app/tools/gimprectselecttool.c
	* app/tools/gimprotatetool.c
	* app/tools/gimpselectiontool.[ch]
	* app/tools/gimpsmudgetool.c
	* app/tools/gimptexttool.c
	* app/tools/gimptransformtool.[ch]
	* app/tools/path_tool.[ch]
	* app/tools/selection_options.c: tons and tons of changes:

	- changed to use the new virtual function parameters.
	- removed zillions of gdisplay_untransform_coords().
	- get the active drawable's offsets manually in many cases.
	  (questionable, but IMHO ok because it's obvious and not simply a
	  "TRUE" passed to some function)
	- reordered some functions to be consistent across tools.
	- some tools had to be changed to work on image coords, not
	  display ones (esp. crop).
	- fixed strange rotate tool behaviour which should be backported
	  to stable.
	- some stuff i came across.
	- indentation and other paranoia.
	- rounding of coordinated may be broken in some tools.
	- new bugs guaranteed.

	* app/tools/tool_manager.[ch]: new semantic of
	tool_manager_initialize_active() (looked at the places where it
	was used from and put common code together). Should be a bit
	better now :)

	* app/tools/gimpblendtool.c
	* app/tools/transform_options.c: use the new GTK+ feature that a
	widget (toggle button) can be a frame's title for this tools' tool
	options.

	* app/widgets/widgets-types.h: stuff.

	* themes/Default/gtkrc: s/GtkDialog/GimpDialog/.

	* tools/pdbgen/Makefile.am: don't scan tools/gimpbucketfilltool.h
	any more.

	* tools/pdbgen/enums.pl: regenerated.

	* tools/pdbgen/pdb/tools.pdb: changed bucket_fill wrapper.

	* app/pdb/tools_cmds.c: regenerated.
parent 6337e6f3
2001-11-08 Michael Natterer <mitch@gimp.org>
* app/Makefile.am: build display/ before tools/.
* app/devices.c: devices_check_change(): added all events
which have a GdkDevice pointer.
* app/gimpprogress.c: include "display-types.h" instead of
"core-types.h".
* app/core/Makefile.am
* app/core/gimpdrawable-bucket-fill.[ch]: new files: the bucket_fill
stuff taken from tools/gimpbucketfilltool.[ch].
* app/core/core-types.h: added "BucketFillMode".
* app/core/gimpimage-mask-select.[ch]: cleanup.
* app/core/gimpmarshal.list: added more marshallers for GimpTool's
new signal signatures.
* app/core/gimpmarshal.[ch]: regenerated.
* app/display/Makefile.am
* app/display/gimpdisplayshell-dnd.[ch]
* app/display/gimpdisplayshell-layer-select.[ch]: new files: the
canvas drop callbacks from gimpdisplayshell-callbacks.[ch] and
the stuff formerly knows as gui/layer-select.[ch].
* app/display/gimpdisplay.h: don't include "gui/gui-types.h".
* app/display/gximage.c: include "display-types.h".
* app/display/gimpdisplay-foreach.c
* app/display/gimpdisplayshell.[ch]: call gdsplay_delete(), don't
destroy the shell widget.
* app/gui/Makefile.am
* app/gui/layer-select.[ch]: removed.
* app/gui/gradients-commands.c: fixed "Save as POV" fprintf()s.
* app/gui/preferences-dialog.c: removed the layer_select stuff
because it is useless with the new preview system.
* app/gui/tool-options-dialog.c: send the correct data to the
close_callback.
* app/gui/tools-commands.c: changed to follow the new
gimp_tool_initialize() semantics (see below).
Tool & canvas event handling chainsawing:
* app/tools/tools-types.h: new struct GimpCoords which contains
x, y, pressure, tilt etc.
* app/display/gimpdisplayshell-callbacks.[ch]: added utility
functions which transparently retreive the current event's
GimpCoords or take it from the device directly if the event has
none. Pass GimpCoords _in_image_coordinates_ to all tool
functions.
Most important: don't pass GdkEvents and display coordinates to
tools any more.
* app/tools/gimptool.[ch]: changed virtual functions to take
GimpCoords, time and state separately instead of GdkEvents.
* app/tools/gimpbezierselecttool.c
* app/tools/gimpblendtool.c
* app/tools/gimpbucketfilltool.[ch]
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpclonetool.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpconvolvetool.c
* app/tools/gimpcroptool.[ch]
* app/tools/gimpcurvestool.c
* app/tools/gimpdodgeburntool.c
* app/tools/gimpdrawtool.c
* app/tools/gimpeditselectiontool.[ch]
* app/tools/gimperasertool.c
* app/tools/gimpfliptool.c
* app/tools/gimpfreeselecttool.[ch]
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimpinktool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpmagnifytool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/tools/gimppainttool.c
* app/tools/gimppathtool.[ch]
* app/tools/gimprectselecttool.c
* app/tools/gimprotatetool.c
* app/tools/gimpselectiontool.[ch]
* app/tools/gimpsmudgetool.c
* app/tools/gimptexttool.c
* app/tools/gimptransformtool.[ch]
* app/tools/path_tool.[ch]
* app/tools/selection_options.c: tons and tons of changes:
- changed to use the new virtual function parameters.
- removed zillions of gdisplay_untransform_coords().
- get the active drawable's offsets manually in many cases.
(questionable, but IMHO ok because it's obvious and not simply a
"TRUE" passed to some function)
- reordered some functions to be consistent across tools.
- some tools had to be changed to work on image coords, not
display ones (esp. crop).
- fixed strange rotate tool behaviour which should be backported
to stable.
- some stuff i came across.
- indentation and other paranoia.
- rounding of coordinated may be broken in some tools.
- new bugs guaranteed.
* app/tools/tool_manager.[ch]: new semantic of
tool_manager_initialize_active() (looked at the places where it
was used from and put common code together). Should be a bit
better now :)
* app/tools/gimpblendtool.c
* app/tools/transform_options.c: use the new GTK+ feature that a
widget (toggle button) can be a frame's title for this tools' tool
options.
* app/widgets/widgets-types.h: stuff.
* themes/Default/gtkrc: s/GtkDialog/GimpDialog/.
* tools/pdbgen/Makefile.am: don't scan tools/gimpbucketfilltool.h
any more.
* tools/pdbgen/enums.pl: regenerated.
* tools/pdbgen/pdb/tools.pdb: changed bucket_fill wrapper.
* app/pdb/tools_cmds.c: regenerated.
2001-11-05 Sven Neumann <sven@gimp.org>
* plug-ins/imagemap/*.c: ported fixes from stable branch (mostly
......
## Process this file with automake to produce Makefile.in
SUBDIRS = paint-funcs base core xcf file pdb plug-in tools display widgets gui
SUBDIRS = paint-funcs base core xcf file pdb plug-in display tools widgets gui
scriptdata =
......
......@@ -203,7 +203,7 @@ gradients_save_as_pov_ok_callback (GtkWidget *widget,
g_ascii_formatd (buf[3], G_ASCII_DTOSTR_BUF_SIZE, "%f",
1.0 - (seg->left_color.a + seg->right_color.a) / 2.0);
fprintf (file, "\t[%f color rgbt <%f, %f, %f, %f>]\n",
fprintf (file, "\t[%f color rgbt <%s, %s, %s, %s>]\n",
seg->middle,
buf[0], buf[1], buf[2], buf[3]);
......@@ -217,7 +217,7 @@ gradients_save_as_pov_ok_callback (GtkWidget *widget,
g_ascii_formatd (buf[3], G_ASCII_DTOSTR_BUF_SIZE, "%f",
1.0 - seg->right_color.a);
fprintf (file, "\t[%f color rgbt <%f, %f, %f, %f>]\n",
fprintf (file, "\t[%f color rgbt <%s, %s, %s, %s>]\n",
seg->right,
buf[0], buf[1], buf[2], buf[3]);
}
......
......@@ -85,38 +85,32 @@ tools_select_cmd_callback (GtkWidget *widget,
guint action)
{
GimpToolInfo *tool_info;
GimpTool *active_tool;
GimpContext *context;
GimpDisplay *gdisp;
tool_info = GIMP_TOOL_INFO (data);
gdisp = gimp_context_get_display (gimp_get_user_context (tool_info->gimp));
context = gimp_get_user_context (tool_info->gimp);
gimp_context_set_tool (gimp_get_user_context (tool_info->gimp), tool_info);
#ifdef __GNUC__
#warning FIXME (let the tool manager to this stuff)
#endif
active_tool = tool_manager_get_active (tool_info->gimp);
/* Paranoia */
active_tool->drawable = NULL;
/* Complete the initialisation by doing the same stuff
* tools_initialize() does after it did what tools_select() does
/* always allocate a new tool when selected from the image menu
*/
if (GIMP_TOOL_GET_CLASS (active_tool)->initialize)
if (gimp_context_get_tool (context) != tool_info)
{
gimp_tool_initialize (active_tool, gdisp);
active_tool->drawable = gimp_image_active_drawable (gdisp->gimage);
gimp_context_set_tool (context, tool_info);
}
else
{
gimp_context_tool_changed (context);
}
gdisp = gimp_context_get_display (context);
tool_manager_initialize_active (tool_info->gimp, gdisp);
/* setting the tool->gdisp here is a HACK to allow the tools'
/* setting active_tool->gdisp here is a HACK to allow the tools'
* dialog windows being hidden if the tool was selected from
* a tear-off-menu and there was no mouse click in the display
* before deleting it
*/
active_tool->gdisp = gdisp;
tool_manager_get_active (tool_info->gimp)->gdisp = gdisp;
}
......@@ -90,30 +90,36 @@ typedef gdouble CRMatrix[4][4];
static void gimp_curves_tool_class_init (GimpCurvesToolClass *klass);
static void gimp_curves_tool_init (GimpCurvesTool *bc_tool);
static void gimp_curves_tool_initialize (GimpTool *tool,
GimpDisplay *gdisp);
static void gimp_curves_tool_control (GimpTool *tool,
ToolAction action,
GimpDisplay *gdisp);
static void gimp_curves_tool_button_press (GimpTool *tool,
GdkEventButton *bevent,
GimpDisplay *gdisp);
static void gimp_curves_tool_button_release (GimpTool *tool,
GdkEventButton *bevent,
GimpDisplay *gdisp);
static void gimp_curves_tool_motion (GimpTool *tool,
GdkEventMotion *mevent,
GimpDisplay *gdisp);
static void curves_colour_update (GimpTool *tool,
GimpDisplay *gdisp,
GimpDrawable *drawable,
gint x,
gint y);
static void curves_add_point (GimpDrawable *drawable,
gint x,
gint y,
gint cchan);
static void gimp_curves_tool_initialize (GimpTool *tool,
GimpDisplay *gdisp);
static void gimp_curves_tool_control (GimpTool *tool,
ToolAction action,
GimpDisplay *gdisp);
static void gimp_curves_tool_button_press (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_curves_tool_button_release (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_curves_tool_motion (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp);
static void curves_color_update (GimpTool *tool,
GimpDisplay *gdisp,
GimpDrawable *drawable,
gint x,
gint y);
static void curves_add_point (GimpDrawable *drawable,
gint x,
gint y,
gint cchan);
static CurvesDialog * curves_dialog_new (void);
......@@ -364,11 +370,12 @@ gimp_curves_tool_control (GimpTool *tool,
}
static void
gimp_curves_tool_button_press (GimpTool *tool,
GdkEventButton *bevent,
GimpDisplay *gdisp)
gimp_curves_tool_button_press (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp)
{
gint x, y;
GimpDrawable *drawable;
drawable = gimp_image_active_drawable (gdisp->gimage);
......@@ -390,41 +397,37 @@ gimp_curves_tool_button_press (GimpTool *tool,
tool->state = ACTIVE;
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, &x, &y,
FALSE, FALSE);
curves_colour_update (tool, gdisp, drawable, x, y);
curves_color_update (tool, gdisp, drawable, coords->x, coords->y);
curves_update (curves_dialog, GRAPH | DRAW);
}
static void
gimp_curves_tool_button_release (GimpTool *tool,
GdkEventButton *bevent,
GimpDisplay *gdisp)
gimp_curves_tool_button_release (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp)
{
gint x, y;
GimpDrawable *drawable;
if (! curves_dialog ||
! gdisp ||
! (drawable = gimp_image_active_drawable (gdisp->gimage)))
return;
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, &x, &y,
FALSE, FALSE);
curves_colour_update (tool, gdisp, drawable, x, y);
curves_color_update (tool, gdisp, drawable, coords->x, coords->y);
if (bevent->state & GDK_SHIFT_MASK)
if (state & GDK_SHIFT_MASK)
{
curves_add_point (drawable, x, y, curves_dialog->channel);
curves_add_point (drawable, coords->x, coords->y, curves_dialog->channel);
curves_calculate_curve (curves_dialog);
}
else if (bevent->state & GDK_CONTROL_MASK)
else if (state & GDK_CONTROL_MASK)
{
curves_add_point (drawable, x, y, GIMP_HISTOGRAM_VALUE);
curves_add_point (drawable, x, y, GIMP_HISTOGRAM_RED);
curves_add_point (drawable, x, y, GIMP_HISTOGRAM_GREEN);
curves_add_point (drawable, x, y, GIMP_HISTOGRAM_BLUE);
curves_add_point (drawable, x, y, GIMP_HISTOGRAM_ALPHA);
curves_add_point (drawable, coords->x, coords->y, GIMP_HISTOGRAM_VALUE);
curves_add_point (drawable, coords->x, coords->y, GIMP_HISTOGRAM_RED);
curves_add_point (drawable, coords->x, coords->y, GIMP_HISTOGRAM_GREEN);
curves_add_point (drawable, coords->x, coords->y, GIMP_HISTOGRAM_BLUE);
curves_add_point (drawable, coords->x, coords->y, GIMP_HISTOGRAM_ALPHA);
curves_calculate_curve (curves_dialog);
}
......@@ -432,21 +435,19 @@ gimp_curves_tool_button_release (GimpTool *tool,
}
static void
gimp_curves_tool_motion (GimpTool *tool,
GdkEventMotion *mevent,
GimpDisplay *gdisp)
gimp_curves_tool_motion (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp)
{
gint x, y;
GimpDrawable *drawable;
if (! curves_dialog ||
! gdisp ||
! (drawable = gimp_image_active_drawable (gdisp->gimage)))
return;
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y, &x, &y,
FALSE, FALSE);
curves_colour_update (tool, gdisp, drawable, x, y);
curves_color_update (tool, gdisp, drawable, coords->x, coords->y);
curves_update (curves_dialog, GRAPH | DRAW);
}
......@@ -498,11 +499,11 @@ curves_lut_func (CurvesDialog *cd,
}
static void
curves_colour_update (GimpTool *tool,
GimpDisplay *gdisp,
GimpDrawable *drawable,
gint x,
gint y)
curves_color_update (GimpTool *tool,
GimpDisplay *gdisp,
GimpDrawable *drawable,
gint x,
gint y)
{
guchar *color;
gint offx;
......@@ -1056,7 +1057,7 @@ curves_update (CurvesDialog *cd,
RADIUS * 2, RADIUS * 2, 0, 23040);
}
/* draw the colour line */
/* draw the color line */
gdk_draw_line (cd->pixmap, cd->graph->style->black_gc,
cd->col_value[sel_channel]+RADIUS,RADIUS,
cd->col_value[sel_channel]+RADIUS,GRAPH_HEIGHT + RADIUS);
......
......@@ -48,6 +48,8 @@ libappcore_a_sources = @STRIP_BEGIN@ \
gimpdocuments.h \
gimpdrawable.c \
gimpdrawable.h \
gimpdrawable-bucket-fill.c \
gimpdrawable-bucket-fill.h \
gimpdrawable-desaturate.c \
gimpdrawable-desaturate.h \
gimpdrawable-equalize.c \
......
......@@ -156,6 +156,13 @@ typedef enum
NODESTRUCT_DITHER = 4 /* NEVER USE NODESTRUCT_DITHER EXPLICITLY */
} ConvertDitherType;
typedef enum
{
FG_BUCKET_FILL,
BG_BUCKET_FILL,
PATTERN_BUCKET_FILL
} BucketFillMode;
/* base objects */
......
......@@ -114,19 +114,26 @@ static void gimp_transform_tool_class_init (GimpTransformToolClass *tool);
static void gimp_transform_tool_finalize (GObject *object);
static void gimp_transform_tool_button_press (GimpTool *tool,
GdkEventButton *bevent,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_transform_tool_button_release (GimpTool *tool,
GdkEventButton *bevent,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_transform_tool_motion (GimpTool *tool,
GdkEventMotion *mevent,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_transform_tool_cursor_update (GimpTool *tool,
GdkEventMotion *mevent,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_transform_tool_control (GimpTool *tool,
......@@ -200,11 +207,11 @@ gimp_transform_tool_class_init (GimpTransformToolClass *klass)
object_class->finalize = gimp_transform_tool_finalize;
tool_class->control = gimp_transform_tool_control;
tool_class->button_press = gimp_transform_tool_button_press;
tool_class->button_release = gimp_transform_tool_button_release;
tool_class->motion = gimp_transform_tool_motion;
tool_class->cursor_update = gimp_transform_tool_cursor_update;
tool_class->control = gimp_transform_tool_control;
draw_class->draw = gimp_transform_tool_draw;
}
......@@ -218,8 +225,6 @@ gimp_transform_tool_init (GimpTransformTool *tr_tool)
tr_tool->function = TRANSFORM_CREATING;
tr_tool->original = NULL;
tr_tool->bpressed = FALSE;
for (i = 0; i < TRAN_INFO_SIZE; i++)
tr_tool->trans_info[i] = 0;
......@@ -352,16 +357,17 @@ gimp_transform_tool_control (GimpTool *tool,
}
static void
gimp_transform_tool_button_press (GimpTool *tool,
GdkEventButton *bevent,
GimpDisplay *gdisp)
gimp_transform_tool_button_press (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp)
{
GimpTransformTool *gt_tool;
GimpDisplayShell *shell;
GimpDrawable *drawable;
gint dist;
gint closest_dist;
gint x, y;
gint i;
gint off_x, off_y;
......@@ -369,8 +375,6 @@ gimp_transform_tool_button_press (GimpTool *tool,
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gt_tool->bpressed = TRUE; /* ALT */
drawable = gimp_image_active_drawable (gdisp->gimage);
if (gt_tool->function == TRANSFORM_CREATING && tool->state == ACTIVE)
......@@ -389,51 +393,45 @@ gimp_transform_tool_button_press (GimpTool *tool,
/* start drawing the bounding box and handles... */
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), shell->canvas->window);
x = bevent->x;
y = bevent->y;
closest_dist = SQR (x - gt_tool->sx1) + SQR (y - gt_tool->sy1);
closest_dist = SQR (coords->x - gt_tool->tx1) + SQR (coords->y - gt_tool->ty1);
gt_tool->function = TRANSFORM_HANDLE_1;
dist = SQR (x - gt_tool->sx2) + SQR (y - gt_tool->sy2);
dist = SQR (coords->x - gt_tool->tx2) + SQR (coords->y - gt_tool->ty2);
if (dist < closest_dist)
{
closest_dist = dist;
gt_tool->function = TRANSFORM_HANDLE_2;
}
dist = SQR (x - gt_tool->sx3) + SQR (y - gt_tool->sy3);
dist = SQR (coords->x - gt_tool->tx3) + SQR (coords->y - gt_tool->ty3);
if (dist < closest_dist)
{
closest_dist = dist;
gt_tool->function = TRANSFORM_HANDLE_3;
}
dist = SQR (x - gt_tool->sx4) + SQR (y - gt_tool->sy4);
dist = SQR (coords->x - gt_tool->tx4) + SQR (coords->y - gt_tool->ty4);
if (dist < closest_dist)
{
closest_dist = dist;
gt_tool->function = TRANSFORM_HANDLE_4;
}
if ((SQR (x - gt_tool->scx) +
SQR (y - gt_tool->scy)) <= 100)
if ((SQR (coords->x - gt_tool->tcx) +
SQR (coords->y - gt_tool->tcy)) <= 100)
{
gt_tool->function = TRANSFORM_HANDLE_CENTER;
}
/* Save the current pointer position */
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y,
&gt_tool->startx,
&gt_tool->starty, TRUE, 0);
gt_tool->lastx = gt_tool->startx;
gt_tool->lasty = gt_tool->starty;
gt_tool->lastx = gt_tool->startx = coords->x;
gt_tool->lasty = gt_tool->starty = coords->y;
gdk_pointer_grab (shell->canvas->window, FALSE,
GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK,
NULL, NULL, bevent->time);
NULL, NULL, time);
tool->state = ACTIVE;
return;
......@@ -443,16 +441,15 @@ gimp_transform_tool_button_press (GimpTool *tool,
/* Initialisation stuff: if the cursor is clicked inside the current
* selection, show the bounding box and handles...
*/
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, &x, &y,
FALSE, FALSE);
gimp_drawable_offsets (drawable, &off_x, &off_y);
if (x >= off_x && y >= off_y &&
x < (off_x + gimp_drawable_width (drawable)) &&
y < (off_y + gimp_drawable_height (drawable)))
if (coords->x >= off_x &&
coords->y >= off_y &&
coords->x < (off_x + gimp_drawable_width (drawable)) &&
coords->y < (off_y + gimp_drawable_height (drawable)))
{
if (gimage_mask_is_empty (gdisp->gimage) ||
gimage_mask_value (gdisp->gimage, x, y))
gimage_mask_value (gdisp->gimage, coords->x, coords->y))
{
if (GIMP_IS_LAYER (drawable) &&
gimp_layer_get_mask (GIMP_LAYER (drawable)))
......@@ -475,12 +472,12 @@ gimp_transform_tool_button_press (GimpTool *tool,
tool->state = ACTIVE;
/* Grab the pointer if we're in non-interactive mode */
if (!gt_tool->interactive)
if (! gt_tool->interactive)