2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1997-11-25 06:05:25 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
1998-04-13 13:44:11 +08:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2000-01-14 20:41:00 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
2000-12-17 05:37:03 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2002-05-03 20:45:22 +08:00
|
|
|
#include "tools-types.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2003-09-03 23:13:19 +08:00
|
|
|
#include "core/gimpchannel.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpimage.h"
|
2005-07-12 03:21:52 +08:00
|
|
|
#include "core/gimppickable.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
|
2006-09-04 07:11:35 +08:00
|
|
|
#include "paint/gimpsourcecore.h"
|
|
|
|
#include "paint/gimpsourceoptions.h"
|
2002-02-15 03:31:16 +08:00
|
|
|
|
2004-10-12 20:06:50 +08:00
|
|
|
#include "widgets/gimpwidgets-utils.h"
|
2002-03-20 03:17:31 +08:00
|
|
|
|
2003-08-22 09:42:57 +08:00
|
|
|
#include "display/gimpdisplay.h"
|
|
|
|
|
2006-09-04 07:11:35 +08:00
|
|
|
#include "gimpsourcetool.h"
|
2003-04-16 00:05:52 +08:00
|
|
|
#include "gimptoolcontrol.h"
|
2001-04-19 21:01:44 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
|
2006-11-07 19:09:51 +08:00
|
|
|
#define TARGET_SIZE 15
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-14 20:41:00 +08:00
|
|
|
|
2006-09-04 07:11:35 +08:00
|
|
|
static gboolean gimp_source_tool_has_display (GimpTool *tool,
|
|
|
|
GimpDisplay *display);
|
|
|
|
static GimpDisplay * gimp_source_tool_has_image (GimpTool *tool,
|
|
|
|
GimpImage *image);
|
|
|
|
static void gimp_source_tool_control (GimpTool *tool,
|
|
|
|
GimpToolAction action,
|
|
|
|
GimpDisplay *display);
|
|
|
|
static void gimp_source_tool_button_press (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display);
|
|
|
|
static void gimp_source_tool_motion (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display);
|
|
|
|
static void gimp_source_tool_cursor_update (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display);
|
|
|
|
static void gimp_source_tool_modifier_key (GimpTool *tool,
|
|
|
|
GdkModifierType key,
|
|
|
|
gboolean press,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display);
|
|
|
|
static void gimp_source_tool_oper_update (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
gboolean proximity,
|
|
|
|
GimpDisplay *display);
|
|
|
|
|
|
|
|
static void gimp_source_tool_draw (GimpDrawTool *draw_tool);
|
|
|
|
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (GimpSourceTool, gimp_source_tool, GIMP_TYPE_BRUSH_TOOL)
|
|
|
|
|
|
|
|
#define parent_class gimp_source_tool_parent_class
|
|
|
|
|
1999-04-09 06:25:54 +08:00
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
static void
|
2006-09-04 07:11:35 +08:00
|
|
|
gimp_source_tool_class_init (GimpSourceToolClass *klass)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-05-28 17:34:13 +08:00
|
|
|
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
|
|
|
|
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-09-04 07:11:35 +08:00
|
|
|
tool_class->has_display = gimp_source_tool_has_display;
|
|
|
|
tool_class->has_image = gimp_source_tool_has_image;
|
|
|
|
tool_class->control = gimp_source_tool_control;
|
|
|
|
tool_class->button_press = gimp_source_tool_button_press;
|
|
|
|
tool_class->motion = gimp_source_tool_motion;
|
|
|
|
tool_class->modifier_key = gimp_source_tool_modifier_key;
|
|
|
|
tool_class->oper_update = gimp_source_tool_oper_update;
|
|
|
|
tool_class->cursor_update = gimp_source_tool_cursor_update;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-09-04 07:11:35 +08:00
|
|
|
draw_tool_class->draw = gimp_source_tool_draw;
|
2001-04-19 21:01:44 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
static void
|
2006-09-04 07:11:35 +08:00
|
|
|
gimp_source_tool_init (GimpSourceTool *source)
|
2001-04-19 21:01:44 +08:00
|
|
|
{
|
2007-10-22 18:24:41 +08:00
|
|
|
source->show_source_outline = TRUE;
|
2003-08-31 00:41:35 +08:00
|
|
|
}
|
|
|
|
|
2006-06-19 03:58:49 +08:00
|
|
|
static gboolean
|
2006-09-04 07:11:35 +08:00
|
|
|
gimp_source_tool_has_display (GimpTool *tool,
|
|
|
|
GimpDisplay *display)
|
2006-06-19 03:58:49 +08:00
|
|
|
{
|
2006-09-04 07:11:35 +08:00
|
|
|
GimpSourceTool *source_tool = GIMP_SOURCE_TOOL (tool);
|
2006-06-19 03:58:49 +08:00
|
|
|
|
2006-09-04 07:11:35 +08:00
|
|
|
return (display == source_tool->src_display ||
|
2006-06-19 03:58:49 +08:00
|
|
|
GIMP_TOOL_CLASS (parent_class)->has_display (tool, display));
|
|
|
|
}
|
|
|
|
|
|
|
|
static GimpDisplay *
|
2006-09-04 07:11:35 +08:00
|
|
|
gimp_source_tool_has_image (GimpTool *tool,
|
|
|
|
GimpImage *image)
|
2006-06-19 03:58:49 +08:00
|
|
|
{
|
2006-09-04 07:11:35 +08:00
|
|
|
GimpSourceTool *source_tool = GIMP_SOURCE_TOOL (tool);
|
|
|
|
GimpDisplay *display;
|
2006-06-19 03:58:49 +08:00
|
|
|
|
|
|
|
display = GIMP_TOOL_CLASS (parent_class)->has_image (tool, image);
|
|
|
|
|
2006-09-04 07:11:35 +08:00
|
|
|
if (! display && source_tool->src_display)
|
2006-06-19 03:58:49 +08:00
|
|
|
{
|
2006-09-04 07:11:35 +08:00
|
|
|
if (image && source_tool->src_display->image == image)
|
|
|
|
display = source_tool->src_display;
|
2006-06-19 03:58:49 +08:00
|
|
|
|
|
|
|
/* NULL image means any display */
|
|
|
|
if (! image)
|
2006-09-04 07:11:35 +08:00
|
|
|
display = source_tool->src_display;
|
2006-06-19 03:58:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return display;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-09-04 07:11:35 +08:00
|
|
|
gimp_source_tool_control (GimpTool *tool,
|
|
|
|
GimpToolAction action,
|
|
|
|
GimpDisplay *display)
|
2006-06-19 03:58:49 +08:00
|
|
|
{
|
2006-09-04 07:11:35 +08:00
|
|
|
GimpSourceTool *source_tool = GIMP_SOURCE_TOOL (tool);
|
2006-06-19 03:58:49 +08:00
|
|
|
|
2006-09-13 18:56:24 +08:00
|
|
|
/* chain up early so the draw tool can undraw the source marker
|
|
|
|
* while we still know about source drawable and display
|
|
|
|
*/
|
|
|
|
GIMP_TOOL_CLASS (parent_class)->control (tool, action, display);
|
|
|
|
|
2006-06-19 03:58:49 +08:00
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case GIMP_TOOL_ACTION_PAUSE:
|
|
|
|
case GIMP_TOOL_ACTION_RESUME:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_TOOL_ACTION_HALT:
|
2006-09-04 07:11:35 +08:00
|
|
|
source_tool->src_display = NULL;
|
2006-06-19 03:58:49 +08:00
|
|
|
g_object_set (GIMP_PAINT_TOOL (tool)->core,
|
|
|
|
"src-drawable", NULL,
|
|
|
|
NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-02-05 17:55:44 +08:00
|
|
|
static void
|
2006-09-04 07:11:35 +08:00
|
|
|
gimp_source_tool_button_press (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display)
|
1999-02-05 17:55:44 +08:00
|
|
|
{
|
2006-09-20 07:14:50 +08:00
|
|
|
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
|
|
|
|
GimpSourceTool *source_tool = GIMP_SOURCE_TOOL (tool);
|
|
|
|
GimpSourceCore *source = GIMP_SOURCE_CORE (paint_tool->core);
|
2005-08-29 03:17:44 +08:00
|
|
|
|
2006-05-23 02:35:58 +08:00
|
|
|
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
|
|
|
|
2003-09-04 00:41:30 +08:00
|
|
|
if ((state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) == GDK_CONTROL_MASK)
|
2005-02-17 03:12:08 +08:00
|
|
|
{
|
2006-09-03 06:39:26 +08:00
|
|
|
source->set_source = TRUE;
|
2005-02-17 03:12:08 +08:00
|
|
|
|
2006-09-04 07:11:35 +08:00
|
|
|
source_tool->src_display = display;
|
2005-02-17 03:12:08 +08:00
|
|
|
}
|
2002-02-15 03:31:16 +08:00
|
|
|
else
|
2005-04-05 05:03:21 +08:00
|
|
|
{
|
2006-09-03 06:39:26 +08:00
|
|
|
source->set_source = FALSE;
|
2005-04-05 05:03:21 +08:00
|
|
|
}
|
2002-02-15 03:31:16 +08:00
|
|
|
|
2003-08-31 00:41:35 +08:00
|
|
|
GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords, time, state,
|
2006-03-29 01:55:52 +08:00
|
|
|
display);
|
2006-05-23 02:35:58 +08:00
|
|
|
|
2006-09-04 07:11:35 +08:00
|
|
|
source_tool->src_x = source->src_x;
|
|
|
|
source_tool->src_y = source->src_y;
|
2006-05-23 02:35:58 +08:00
|
|
|
|
|
|
|
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
1999-02-05 17:55:44 +08:00
|
|
|
}
|
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
static void
|
2006-09-04 07:11:35 +08:00
|
|
|
gimp_source_tool_motion (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-09-04 07:11:35 +08:00
|
|
|
GimpSourceTool *source_tool = GIMP_SOURCE_TOOL (tool);
|
|
|
|
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
|
|
|
|
GimpSourceCore *source = GIMP_SOURCE_CORE (paint_tool->core);
|
2006-05-23 02:35:58 +08:00
|
|
|
|
|
|
|
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
GIMP_TOOL_CLASS (parent_class)->motion (tool, coords, time, state, display);
|
2006-05-23 02:35:58 +08:00
|
|
|
|
2006-09-04 07:11:35 +08:00
|
|
|
source_tool->src_x = source->src_x;
|
|
|
|
source_tool->src_y = source->src_y;
|
2006-05-23 02:35:58 +08:00
|
|
|
|
|
|
|
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2006-08-02 07:42:12 +08:00
|
|
|
static void
|
2006-09-04 07:11:35 +08:00
|
|
|
gimp_source_tool_modifier_key (GimpTool *tool,
|
|
|
|
GdkModifierType key,
|
|
|
|
gboolean press,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display)
|
2006-08-02 07:42:12 +08:00
|
|
|
{
|
2006-09-04 07:11:35 +08:00
|
|
|
GimpSourceTool *source_tool = GIMP_SOURCE_TOOL (tool);
|
|
|
|
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
|
2006-09-06 02:25:31 +08:00
|
|
|
GimpSourceOptions *options = GIMP_SOURCE_TOOL_GET_OPTIONS (tool);
|
2006-08-02 07:42:12 +08:00
|
|
|
|
2006-09-12 16:33:30 +08:00
|
|
|
if (options->use_source && key == GDK_CONTROL_MASK)
|
2006-08-02 07:42:12 +08:00
|
|
|
{
|
2007-10-22 18:24:41 +08:00
|
|
|
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
|
|
|
|
2006-09-12 16:33:30 +08:00
|
|
|
if (press)
|
2007-10-22 18:24:41 +08:00
|
|
|
{
|
|
|
|
paint_tool->status = source_tool->status_set_source;
|
|
|
|
|
|
|
|
source_tool->show_source_outline = FALSE;
|
|
|
|
}
|
2006-09-12 16:33:30 +08:00
|
|
|
else
|
2007-10-22 18:24:41 +08:00
|
|
|
{
|
|
|
|
paint_tool->status = source_tool->status_paint;
|
|
|
|
|
|
|
|
source_tool->show_source_outline = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
2006-08-02 07:42:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
GIMP_TOOL_CLASS (parent_class)->modifier_key (tool, key, press, state,
|
|
|
|
display);
|
|
|
|
}
|
|
|
|
|
2005-04-05 05:03:21 +08:00
|
|
|
static void
|
2006-09-04 07:11:35 +08:00
|
|
|
gimp_source_tool_cursor_update (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display)
|
1999-05-15 20:13:43 +08:00
|
|
|
{
|
2006-09-06 02:25:31 +08:00
|
|
|
GimpSourceOptions *options = GIMP_SOURCE_TOOL_GET_OPTIONS (tool);
|
2006-06-02 04:30:52 +08:00
|
|
|
GimpCursorType cursor = GIMP_CURSOR_MOUSE;
|
|
|
|
GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_NONE;
|
2001-11-01 05:20:09 +08:00
|
|
|
|
2006-09-04 07:11:35 +08:00
|
|
|
if (options->use_source)
|
2000-01-14 20:41:00 +08:00
|
|
|
{
|
2003-09-04 00:41:30 +08:00
|
|
|
if ((state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) == GDK_CONTROL_MASK)
|
2006-06-02 04:30:52 +08:00
|
|
|
{
|
|
|
|
cursor = GIMP_CURSOR_CROSSHAIR_SMALL;
|
|
|
|
}
|
2006-09-03 06:39:26 +08:00
|
|
|
else if (! GIMP_SOURCE_CORE (GIMP_PAINT_TOOL (tool)->core)->src_drawable)
|
2006-06-02 04:30:52 +08:00
|
|
|
{
|
|
|
|
modifier = GIMP_CURSOR_MODIFIER_BAD;
|
|
|
|
}
|
2000-01-14 20:41:00 +08:00
|
|
|
}
|
1999-07-27 16:47:31 +08:00
|
|
|
|
2006-06-02 04:30:52 +08:00
|
|
|
gimp_tool_control_set_cursor (tool->control, cursor);
|
|
|
|
gimp_tool_control_set_cursor_modifier (tool->control, modifier);
|
2002-02-05 01:43:01 +08:00
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, display);
|
1999-05-15 20:13:43 +08:00
|
|
|
}
|
|
|
|
|
2005-04-05 05:03:21 +08:00
|
|
|
static void
|
2006-09-04 07:11:35 +08:00
|
|
|
gimp_source_tool_oper_update (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
gboolean proximity,
|
|
|
|
GimpDisplay *display)
|
2005-04-05 05:03:21 +08:00
|
|
|
{
|
2006-09-04 07:11:35 +08:00
|
|
|
GimpSourceTool *source_tool = GIMP_SOURCE_TOOL (tool);
|
2006-09-06 02:25:31 +08:00
|
|
|
GimpSourceOptions *options = GIMP_SOURCE_TOOL_GET_OPTIONS (tool);
|
2005-04-05 05:20:13 +08:00
|
|
|
|
2006-08-03 17:06:36 +08:00
|
|
|
if (proximity)
|
|
|
|
{
|
|
|
|
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
|
|
|
|
|
2006-09-04 07:11:35 +08:00
|
|
|
if (options->use_source)
|
|
|
|
paint_tool->status_ctrl = source_tool->status_set_source_ctrl;
|
2006-08-03 17:06:36 +08:00
|
|
|
else
|
|
|
|
paint_tool->status_ctrl = NULL;
|
|
|
|
}
|
|
|
|
|
2006-03-25 22:23:09 +08:00
|
|
|
GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state, proximity,
|
2006-03-29 01:55:52 +08:00
|
|
|
display);
|
2005-04-05 05:03:21 +08:00
|
|
|
|
2006-09-04 07:11:35 +08:00
|
|
|
if (options->use_source)
|
2005-04-05 05:20:13 +08:00
|
|
|
{
|
2006-09-03 06:39:26 +08:00
|
|
|
GimpSourceCore *source = GIMP_SOURCE_CORE (GIMP_PAINT_TOOL (tool)->core);
|
2006-05-23 02:35:58 +08:00
|
|
|
|
2006-09-03 06:39:26 +08:00
|
|
|
if (source->src_drawable == NULL)
|
2006-05-23 02:35:58 +08:00
|
|
|
{
|
2006-08-02 07:42:12 +08:00
|
|
|
if (state & GDK_CONTROL_MASK)
|
|
|
|
gimp_tool_replace_status (tool, display,
|
2006-09-04 07:11:35 +08:00
|
|
|
source_tool->status_set_source);
|
2006-08-02 07:42:12 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
gchar *status;
|
2006-09-03 06:39:26 +08:00
|
|
|
|
2006-09-04 07:11:35 +08:00
|
|
|
status = g_strconcat (gimp_get_mod_name_control (),
|
|
|
|
gimp_get_mod_separator (),
|
|
|
|
source_tool->status_set_source,
|
|
|
|
NULL);
|
2006-08-02 07:42:12 +08:00
|
|
|
gimp_tool_replace_status (tool, display, status);
|
|
|
|
g_free (status);
|
|
|
|
}
|
2006-05-23 02:35:58 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
|
|
|
|
2006-09-04 07:11:35 +08:00
|
|
|
source_tool->src_x = source->src_x;
|
|
|
|
source_tool->src_y = source->src_y;
|
2006-05-23 02:35:58 +08:00
|
|
|
|
2006-09-03 06:39:26 +08:00
|
|
|
if (! source->first_stroke)
|
2006-05-23 02:35:58 +08:00
|
|
|
{
|
2006-09-04 07:11:35 +08:00
|
|
|
switch (options->align_mode)
|
2006-05-23 02:35:58 +08:00
|
|
|
{
|
2006-09-03 06:39:26 +08:00
|
|
|
case GIMP_SOURCE_ALIGN_YES:
|
2006-09-04 07:11:35 +08:00
|
|
|
source_tool->src_x = coords->x + source->offset_x;
|
|
|
|
source_tool->src_y = coords->y + source->offset_y;
|
2006-09-03 06:39:26 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_SOURCE_ALIGN_REGISTERED:
|
2006-09-04 07:11:35 +08:00
|
|
|
source_tool->src_x = coords->x;
|
|
|
|
source_tool->src_y = coords->y;
|
2006-09-03 06:39:26 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2006-05-23 02:35:58 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
|
|
|
}
|
2005-04-05 05:20:13 +08:00
|
|
|
}
|
2005-04-05 05:03:21 +08:00
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
static void
|
2006-09-04 07:11:35 +08:00
|
|
|
gimp_source_tool_draw (GimpDrawTool *draw_tool)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-09-04 07:11:35 +08:00
|
|
|
GimpSourceTool *source_tool = GIMP_SOURCE_TOOL (draw_tool);
|
2006-09-06 02:25:31 +08:00
|
|
|
GimpSourceOptions *options = GIMP_SOURCE_TOOL_GET_OPTIONS (draw_tool);
|
2007-05-07 18:19:04 +08:00
|
|
|
GimpSourceCore *source;
|
|
|
|
|
|
|
|
source = GIMP_SOURCE_CORE (GIMP_PAINT_TOOL (draw_tool)->core);
|
2006-05-23 02:35:58 +08:00
|
|
|
|
2006-09-04 07:11:35 +08:00
|
|
|
if (options->use_source && source->src_drawable && source_tool->src_display)
|
2006-05-22 07:40:59 +08:00
|
|
|
{
|
2007-05-07 18:19:04 +08:00
|
|
|
GimpDisplay *tmp_display = draw_tool->display;
|
|
|
|
gint off_x;
|
|
|
|
gint off_y;
|
|
|
|
|
|
|
|
draw_tool->display = source_tool->src_display;
|
2006-05-22 15:11:15 +08:00
|
|
|
|
2006-09-03 06:39:26 +08:00
|
|
|
gimp_item_offsets (GIMP_ITEM (source->src_drawable), &off_x, &off_y);
|
2006-05-22 15:11:15 +08:00
|
|
|
|
2007-10-22 18:24:41 +08:00
|
|
|
if (source_tool->show_source_outline)
|
|
|
|
gimp_brush_tool_draw_brush (GIMP_BRUSH_TOOL (source_tool),
|
|
|
|
source_tool->src_x + off_x,
|
2007-10-30 01:17:14 +08:00
|
|
|
source_tool->src_y + off_y,
|
|
|
|
FALSE);
|
2006-05-23 02:35:58 +08:00
|
|
|
|
|
|
|
gimp_draw_tool_draw_handle (draw_tool,
|
|
|
|
GIMP_HANDLE_CROSS,
|
2006-09-04 07:11:35 +08:00
|
|
|
source_tool->src_x + off_x,
|
|
|
|
source_tool->src_y + off_y,
|
2006-11-07 19:09:51 +08:00
|
|
|
TARGET_SIZE, TARGET_SIZE,
|
2006-05-23 02:35:58 +08:00
|
|
|
GTK_ANCHOR_CENTER,
|
|
|
|
FALSE);
|
|
|
|
|
|
|
|
draw_tool->display = tmp_display;
|
2002-02-07 19:33:01 +08:00
|
|
|
}
|
2004-06-22 23:31:14 +08:00
|
|
|
|
|
|
|
GIMP_DRAW_TOOL_CLASS (parent_class)->draw (draw_tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|