2000-01-14 20:41:00 +08:00
|
|
|
/* The GIMP -- an 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>
|
|
|
|
|
2001-01-25 06:36:18 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.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-11-20 21:53:21 +08:00
|
|
|
#include "core/gimptoolinfo.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
#include "paint/gimpclone.h"
|
2003-02-05 22:39:40 +08:00
|
|
|
#include "paint/gimpcloneoptions.h"
|
2002-02-15 03:31:16 +08:00
|
|
|
|
2003-08-22 09:42:57 +08:00
|
|
|
#include "widgets/gimphelp-ids.h"
|
2004-10-12 20:06:50 +08:00
|
|
|
#include "widgets/gimpviewablebox.h"
|
|
|
|
#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"
|
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
#include "gimpclonetool.h"
|
2003-06-30 04:40:45 +08:00
|
|
|
#include "gimppaintoptions-gui.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
|
|
|
|
2001-11-12 22:45:58 +08:00
|
|
|
#define TARGET_WIDTH 15
|
|
|
|
#define TARGET_HEIGHT 15
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-14 20:41:00 +08:00
|
|
|
|
2005-12-13 17:13:50 +08:00
|
|
|
static void gimp_clone_tool_button_press (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display);
|
2005-12-13 17:13:50 +08:00
|
|
|
static void gimp_clone_tool_motion (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display);
|
2002-02-15 03:31:16 +08:00
|
|
|
|
2005-12-13 17:13:50 +08:00
|
|
|
static void gimp_clone_tool_cursor_update (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display);
|
2005-12-13 17:13:50 +08:00
|
|
|
static void gimp_clone_tool_oper_update (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
2006-03-25 22:23:09 +08:00
|
|
|
gboolean proximity,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display);
|
2002-02-15 03:31:16 +08:00
|
|
|
|
2005-12-13 17:13:50 +08:00
|
|
|
static void gimp_clone_tool_draw (GimpDrawTool *draw_tool);
|
2002-02-15 03:31:16 +08:00
|
|
|
|
2005-12-13 17:13:50 +08:00
|
|
|
static GtkWidget * gimp_clone_options_gui (GimpToolOptions *tool_options);
|
2002-02-15 03:31:16 +08:00
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
|
2006-05-15 17:46:31 +08:00
|
|
|
G_DEFINE_TYPE (GimpCloneTool, gimp_clone_tool, GIMP_TYPE_PAINT_TOOL)
|
2001-04-19 21:01:44 +08:00
|
|
|
|
2005-12-13 17:13:50 +08:00
|
|
|
#define parent_class gimp_clone_tool_parent_class
|
2001-11-21 07:00:47 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
void
|
2002-03-29 11:50:29 +08:00
|
|
|
gimp_clone_tool_register (GimpToolRegisterCallback callback,
|
2002-05-03 19:31:08 +08:00
|
|
|
gpointer data)
|
1999-04-09 06:25:54 +08:00
|
|
|
{
|
2002-03-29 11:50:29 +08:00
|
|
|
(* callback) (GIMP_TYPE_CLONE_TOOL,
|
2003-02-05 22:39:40 +08:00
|
|
|
GIMP_TYPE_CLONE_OPTIONS,
|
|
|
|
gimp_clone_options_gui,
|
2003-06-30 04:40:45 +08:00
|
|
|
GIMP_PAINT_OPTIONS_CONTEXT_MASK |
|
2003-06-28 19:20:37 +08:00
|
|
|
GIMP_CONTEXT_PATTERN_MASK,
|
2002-03-21 20:17:17 +08:00
|
|
|
"gimp-clone-tool",
|
2001-11-21 07:00:47 +08:00
|
|
|
_("Clone"),
|
|
|
|
_("Paint using Patterns or Image Regions"),
|
2004-04-29 21:19:28 +08:00
|
|
|
N_("_Clone"), "C",
|
2003-08-22 09:42:57 +08:00
|
|
|
NULL, GIMP_HELP_TOOL_CLONE,
|
2002-03-29 11:50:29 +08:00
|
|
|
GIMP_STOCK_TOOL_CLONE,
|
2002-05-03 19:31:08 +08:00
|
|
|
data);
|
2001-04-19 21:01:44 +08:00
|
|
|
}
|
1999-04-09 06:25:54 +08:00
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
static void
|
|
|
|
gimp_clone_tool_class_init (GimpCloneToolClass *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
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
tool_class->button_press = gimp_clone_tool_button_press;
|
|
|
|
tool_class->motion = gimp_clone_tool_motion;
|
2001-04-19 21:01:44 +08:00
|
|
|
tool_class->cursor_update = gimp_clone_tool_cursor_update;
|
2005-04-05 05:03:21 +08:00
|
|
|
tool_class->oper_update = gimp_clone_tool_oper_update;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
draw_tool_class->draw = gimp_clone_tool_draw;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
static void
|
|
|
|
gimp_clone_tool_init (GimpCloneTool *clone)
|
|
|
|
{
|
2004-05-28 17:34:13 +08:00
|
|
|
GimpTool *tool = GIMP_TOOL (clone);
|
1999-02-05 17:55:44 +08:00
|
|
|
|
2005-03-05 03:05:40 +08:00
|
|
|
gimp_tool_control_set_tool_cursor (tool->control,
|
|
|
|
GIMP_TOOL_CURSOR_CLONE);
|
|
|
|
gimp_tool_control_set_action_object_2 (tool->control,
|
|
|
|
"context/context-pattern-select-set");
|
2003-08-31 00:41:35 +08:00
|
|
|
}
|
|
|
|
|
1999-02-05 17:55:44 +08:00
|
|
|
static void
|
2002-02-15 03:31:16 +08:00
|
|
|
gimp_clone_tool_button_press (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display)
|
1999-02-05 17:55:44 +08:00
|
|
|
{
|
2005-08-29 03:17:44 +08:00
|
|
|
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
|
|
|
|
GimpCloneTool *clone_tool = GIMP_CLONE_TOOL (tool);
|
2006-05-23 02:35:58 +08:00
|
|
|
GimpClone *clone = GIMP_CLONE (paint_tool->core);
|
2005-08-29 03:17:44 +08:00
|
|
|
GimpCloneOptions *options;
|
|
|
|
|
|
|
|
options = GIMP_CLONE_OPTIONS (tool->tool_info->tool_options);
|
|
|
|
|
2006-05-23 02:35:58 +08:00
|
|
|
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
|
|
|
|
2005-08-29 03:17:44 +08:00
|
|
|
paint_tool->core->use_saved_proj = FALSE;
|
2002-02-07 19:33:01 +08:00
|
|
|
|
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-05-23 02:35:58 +08:00
|
|
|
clone->set_source = TRUE;
|
2005-02-17 03:12:08 +08:00
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
if (display != clone_tool->src_display)
|
2005-02-17 03:12:08 +08:00
|
|
|
{
|
2006-03-29 01:55:52 +08:00
|
|
|
if (clone_tool->src_display)
|
|
|
|
g_object_remove_weak_pointer (G_OBJECT (clone_tool->src_display),
|
|
|
|
(gpointer *) &clone_tool->src_display);
|
2005-02-17 03:12:08 +08:00
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
clone_tool->src_display = display;
|
|
|
|
g_object_add_weak_pointer (G_OBJECT (display),
|
|
|
|
(gpointer *) &clone_tool->src_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-05-23 02:35:58 +08:00
|
|
|
clone->set_source = FALSE;
|
2005-08-29 03:17:44 +08:00
|
|
|
|
|
|
|
if (options->clone_type == GIMP_IMAGE_CLONE &&
|
|
|
|
options->sample_merged &&
|
2006-03-29 01:55:52 +08:00
|
|
|
display == clone_tool->src_display)
|
2005-08-29 03:17:44 +08:00
|
|
|
{
|
|
|
|
paint_tool->core->use_saved_proj = TRUE;
|
|
|
|
}
|
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
|
|
|
|
|
|
|
clone_tool->src_x = clone->src_x;
|
|
|
|
clone_tool->src_y = clone->src_y;
|
|
|
|
|
|
|
|
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
|
2002-02-15 03:31:16 +08:00
|
|
|
gimp_clone_tool_motion (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-05-23 02:35:58 +08:00
|
|
|
GimpCloneTool *clone_tool = GIMP_CLONE_TOOL (tool);
|
2004-05-28 17:34:13 +08:00
|
|
|
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
|
2006-05-23 02:35:58 +08:00
|
|
|
GimpClone *clone = GIMP_CLONE (paint_tool->core);
|
|
|
|
|
|
|
|
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-09-04 00:41:30 +08:00
|
|
|
if ((state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) == GDK_CONTROL_MASK)
|
2006-05-23 02:35:58 +08:00
|
|
|
clone->set_source = TRUE;
|
2002-02-15 03:31:16 +08:00
|
|
|
else
|
2006-05-23 02:35:58 +08:00
|
|
|
clone->set_source = FALSE;
|
2002-02-15 03:31:16 +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
|
|
|
|
|
|
|
clone_tool->src_x = clone->src_x;
|
|
|
|
clone_tool->src_y = clone->src_y;
|
|
|
|
|
|
|
|
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2005-04-05 05:03:21 +08:00
|
|
|
static void
|
2001-11-09 03:14:51 +08:00
|
|
|
gimp_clone_tool_cursor_update (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
2004-06-27 07:45:13 +08:00
|
|
|
GdkModifierType state,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display)
|
1999-05-15 20:13:43 +08:00
|
|
|
{
|
2002-02-22 00:02:30 +08:00
|
|
|
GimpCloneOptions *options;
|
2004-06-14 18:19:39 +08:00
|
|
|
GimpCursorType ctype = GIMP_CURSOR_MOUSE;
|
2001-11-01 05:20:09 +08:00
|
|
|
|
2006-05-23 02:35:58 +08:00
|
|
|
options = GIMP_CLONE_OPTIONS (tool->tool_info->tool_options);
|
2001-11-20 21:53:21 +08:00
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
if (gimp_image_coords_in_active_drawable (display->image, coords))
|
1999-05-15 20:13:43 +08:00
|
|
|
{
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpChannel *selection = gimp_image_get_mask (display->image);
|
2003-09-03 23:13:19 +08:00
|
|
|
|
2003-05-08 22:06:03 +08:00
|
|
|
/* One more test--is there a selected region?
|
|
|
|
* if so, is cursor inside?
|
|
|
|
*/
|
2005-07-12 01:59:08 +08:00
|
|
|
if (gimp_channel_is_empty (selection) ||
|
2005-07-12 03:21:52 +08:00
|
|
|
gimp_pickable_get_opacity_at (GIMP_PICKABLE (selection),
|
|
|
|
coords->x, coords->y))
|
2004-06-05 07:08:29 +08:00
|
|
|
ctype = GIMP_CURSOR_MOUSE;
|
1999-05-15 20:13:43 +08:00
|
|
|
}
|
2002-02-07 19:33:01 +08:00
|
|
|
|
2003-02-08 01:12:21 +08:00
|
|
|
if (options->clone_type == GIMP_IMAGE_CLONE)
|
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)
|
2004-06-27 07:45:13 +08:00
|
|
|
ctype = GIMP_CURSOR_CROSSHAIR_SMALL;
|
2005-08-30 04:48:26 +08:00
|
|
|
else if (! GIMP_CLONE (GIMP_PAINT_TOOL (tool)->core)->src_drawable)
|
2004-06-27 07:45:13 +08:00
|
|
|
ctype = GIMP_CURSOR_BAD;
|
2000-01-14 20:41:00 +08:00
|
|
|
}
|
1999-07-27 16:47:31 +08:00
|
|
|
|
2002-05-03 19:31:08 +08:00
|
|
|
gimp_tool_control_set_cursor (tool->control, ctype);
|
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
|
|
|
|
gimp_clone_tool_oper_update (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
2006-03-25 22:23:09 +08:00
|
|
|
gboolean proximity,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display)
|
2005-04-05 05:03:21 +08:00
|
|
|
{
|
2006-05-23 02:35:58 +08:00
|
|
|
GimpCloneTool *clone_tool = GIMP_CLONE_TOOL (tool);
|
|
|
|
GimpCloneOptions *options;
|
|
|
|
|
|
|
|
options = GIMP_CLONE_OPTIONS (tool->tool_info->tool_options);
|
2005-04-05 05:20:13 +08:00
|
|
|
|
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-05-23 02:35:58 +08:00
|
|
|
if (options->clone_type == GIMP_IMAGE_CLONE && proximity)
|
2005-04-05 05:20:13 +08:00
|
|
|
{
|
2006-05-23 02:35:58 +08:00
|
|
|
GimpClone *clone = GIMP_CLONE (GIMP_PAINT_TOOL (tool)->core);
|
|
|
|
|
|
|
|
if (clone->src_drawable == NULL)
|
|
|
|
{
|
|
|
|
gimp_tool_replace_status (tool, display,
|
|
|
|
_("Ctrl-Click to set a clone source."));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
|
|
|
|
|
|
|
clone_tool->src_x = clone->src_x;
|
|
|
|
clone_tool->src_y = clone->src_y;
|
|
|
|
|
|
|
|
if (! clone->first_stroke)
|
|
|
|
{
|
|
|
|
if (options->align_mode == GIMP_CLONE_ALIGN_YES)
|
|
|
|
{
|
|
|
|
clone_tool->src_x = coords->x + clone->offset_x;
|
|
|
|
clone_tool->src_y = coords->y + clone->offset_y;
|
|
|
|
}
|
|
|
|
else if (options->align_mode == GIMP_CLONE_ALIGN_REGISTERED)
|
|
|
|
{
|
|
|
|
clone_tool->src_x = coords->x;
|
|
|
|
clone_tool->src_y = coords->y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2001-04-19 21:01:44 +08:00
|
|
|
gimp_clone_tool_draw (GimpDrawTool *draw_tool)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-05-23 02:35:58 +08:00
|
|
|
GimpTool *tool = GIMP_TOOL (draw_tool);
|
|
|
|
GimpCloneTool *clone_tool = GIMP_CLONE_TOOL (draw_tool);
|
|
|
|
GimpClone *clone = GIMP_CLONE (GIMP_PAINT_TOOL (tool)->core);
|
|
|
|
GimpCloneOptions *options;
|
2002-02-07 19:33:01 +08:00
|
|
|
|
2006-05-23 02:35:58 +08:00
|
|
|
options = GIMP_CLONE_OPTIONS (tool->tool_info->tool_options);
|
|
|
|
|
|
|
|
if (options->clone_type == GIMP_IMAGE_CLONE &&
|
|
|
|
clone->src_drawable && clone_tool->src_display)
|
2006-05-22 07:40:59 +08:00
|
|
|
{
|
2006-05-23 02:35:58 +08:00
|
|
|
GimpDisplay *tmp_display;
|
|
|
|
gint off_x;
|
|
|
|
gint off_y;
|
2006-05-22 15:11:15 +08:00
|
|
|
|
2006-05-23 02:35:58 +08:00
|
|
|
gimp_item_offsets (GIMP_ITEM (clone->src_drawable), &off_x, &off_y);
|
2006-05-22 15:11:15 +08:00
|
|
|
|
2006-05-23 02:35:58 +08:00
|
|
|
tmp_display = draw_tool->display;
|
|
|
|
draw_tool->display = clone_tool->src_display;
|
|
|
|
|
|
|
|
gimp_draw_tool_draw_handle (draw_tool,
|
|
|
|
GIMP_HANDLE_CROSS,
|
|
|
|
clone_tool->src_x + off_x,
|
|
|
|
clone_tool->src_y + off_y,
|
|
|
|
TARGET_WIDTH, TARGET_WIDTH,
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
|
2002-02-22 00:02:30 +08:00
|
|
|
/* tool options stuff */
|
2001-04-19 21:01:44 +08:00
|
|
|
|
2003-02-10 01:32:52 +08:00
|
|
|
static GtkWidget *
|
2003-02-05 22:39:40 +08:00
|
|
|
gimp_clone_options_gui (GimpToolOptions *tool_options)
|
2001-04-19 21:01:44 +08:00
|
|
|
{
|
2004-06-22 23:31:14 +08:00
|
|
|
GObject *config = G_OBJECT (tool_options);
|
2003-02-08 01:12:21 +08:00
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *frame;
|
2005-08-29 03:17:44 +08:00
|
|
|
GtkWidget *button;
|
2005-12-16 22:44:25 +08:00
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *combo;
|
2001-04-19 21:01:44 +08:00
|
|
|
|
2003-02-10 01:32:52 +08:00
|
|
|
vbox = gimp_paint_options_gui (tool_options);
|
2001-04-19 21:01:44 +08:00
|
|
|
|
2003-02-08 01:12:21 +08:00
|
|
|
frame = gimp_prop_enum_radio_frame_new (config, "clone-type",
|
2005-12-16 22:44:25 +08:00
|
|
|
_("Source"), 0, 0);
|
2001-04-19 21:01:44 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2005-09-10 20:05:04 +08:00
|
|
|
button = gimp_prop_check_button_new (config, "sample-merged",
|
2005-09-10 20:11:24 +08:00
|
|
|
_("Sample merged"));
|
2005-09-10 20:05:04 +08:00
|
|
|
gimp_enum_radio_frame_add (GTK_FRAME (frame), button, GIMP_IMAGE_CLONE);
|
|
|
|
|
2006-01-14 08:09:22 +08:00
|
|
|
hbox = gimp_prop_pattern_box_new (NULL, GIMP_CONTEXT (tool_options), 2,
|
|
|
|
"pattern-view-type", "pattern-view-size");
|
2004-10-12 20:06:50 +08:00
|
|
|
gimp_enum_radio_frame_add (GTK_FRAME (frame), hbox, GIMP_PATTERN_CLONE);
|
|
|
|
|
2005-12-16 22:44:25 +08:00
|
|
|
table = gtk_table_new (1, 2, FALSE);
|
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (table);
|
|
|
|
|
|
|
|
combo = gimp_prop_enum_combo_box_new (config, "align-mode", 0, 0);
|
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
|
|
|
_("Alignment:"), 0.0, 0.5,
|
|
|
|
combo, 1, FALSE);
|
2003-02-10 01:32:52 +08:00
|
|
|
|
|
|
|
return vbox;
|
2001-04-19 21:01:44 +08:00
|
|
|
}
|