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"
|
|
|
|
|
2001-05-10 06:34:59 +08:00
|
|
|
#include "tools-types.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpdrawable.h"
|
|
|
|
#include "core/gimpimage.h"
|
|
|
|
#include "core/gimpimage-mask.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"
|
|
|
|
|
2001-09-26 07:23:09 +08:00
|
|
|
#include "display/gimpdisplay.h"
|
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
#include "gimpclonetool.h"
|
|
|
|
#include "paint_options.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
|
|
|
#include "libgimp/gimpintl.h"
|
|
|
|
|
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
|
|
|
|
1999-12-23 07:30:43 +08:00
|
|
|
#define CLONE_DEFAULT_TYPE IMAGE_CLONE
|
|
|
|
#define CLONE_DEFAULT_ALIGNED ALIGN_NO
|
1999-07-20 06:42:49 +08:00
|
|
|
|
2000-01-14 20:41:00 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
static void gimp_clone_tool_class_init (GimpCloneToolClass *klass);
|
|
|
|
static void gimp_clone_tool_init (GimpCloneTool *tool);
|
|
|
|
|
|
|
|
static void gimp_clone_tool_button_press (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp);
|
|
|
|
static void gimp_clone_tool_motion (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp);
|
|
|
|
|
|
|
|
static void gimp_clone_tool_cursor_update (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp);
|
|
|
|
|
|
|
|
static void gimp_clone_tool_draw (GimpDrawTool *draw_tool);
|
|
|
|
|
|
|
|
static void gimp_clone_init_callback (GimpClone *clone,
|
|
|
|
gpointer data);
|
|
|
|
static void gimp_clone_finish_callback (GimpClone *clone,
|
|
|
|
gpointer data);
|
|
|
|
static void gimp_clone_pretrace_callback (GimpClone *clone,
|
|
|
|
gpointer data);
|
|
|
|
static void gimp_clone_posttrace_callback (GimpClone *clone,
|
|
|
|
gpointer data);
|
2001-04-19 21:01:44 +08:00
|
|
|
|
2001-11-21 07:00:47 +08:00
|
|
|
static GimpToolOptions * clone_options_new (GimpToolInfo *tool_info);
|
|
|
|
static void clone_options_reset (GimpToolOptions *options);
|
2001-04-19 21:01:44 +08:00
|
|
|
|
|
|
|
|
2001-11-21 07:00:47 +08:00
|
|
|
static GimpPaintToolClass *parent_class;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-11-21 07:00:47 +08:00
|
|
|
/* public functions */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
void
|
2001-11-21 07:00:47 +08:00
|
|
|
gimp_clone_tool_register (Gimp *gimp,
|
|
|
|
GimpToolRegisterCallback callback)
|
1999-04-09 06:25:54 +08:00
|
|
|
{
|
2001-11-21 07:00:47 +08:00
|
|
|
(* callback) (gimp,
|
|
|
|
GIMP_TYPE_CLONE_TOOL,
|
|
|
|
clone_options_new,
|
|
|
|
TRUE,
|
|
|
|
"gimp:clone_tool",
|
|
|
|
_("Clone"),
|
|
|
|
_("Paint using Patterns or Image Regions"),
|
|
|
|
N_("/Tools/Paint Tools/Clone"), "C",
|
|
|
|
NULL, "tools/clone.html",
|
|
|
|
GIMP_STOCK_TOOL_CLONE);
|
2001-04-19 21:01:44 +08:00
|
|
|
}
|
1999-04-09 06:25:54 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
GType
|
2001-04-19 21:01:44 +08:00
|
|
|
gimp_clone_tool_get_type (void)
|
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
static GType tool_type = 0;
|
1999-04-22 22:34:00 +08:00
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
if (! tool_type)
|
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
static const GTypeInfo tool_info =
|
2001-04-19 21:01:44 +08:00
|
|
|
{
|
|
|
|
sizeof (GimpCloneToolClass),
|
2001-08-14 22:53:55 +08:00
|
|
|
(GBaseInitFunc) NULL,
|
|
|
|
(GBaseFinalizeFunc) NULL,
|
|
|
|
(GClassInitFunc) gimp_clone_tool_class_init,
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
|
|
|
sizeof (GimpCloneTool),
|
|
|
|
0, /* n_preallocs */
|
|
|
|
(GInstanceInitFunc) gimp_clone_tool_init,
|
2001-04-19 21:01:44 +08:00
|
|
|
};
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
tool_type = g_type_register_static (GIMP_TYPE_PAINT_TOOL,
|
|
|
|
"GimpCloneTool",
|
|
|
|
&tool_info, 0);
|
2001-04-19 21:01:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return tool_type;
|
1999-04-09 06:25:54 +08:00
|
|
|
}
|
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
/* static functions */
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_clone_tool_class_init (GimpCloneToolClass *klass)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-02-15 03:31:16 +08:00
|
|
|
GimpToolClass *tool_class;
|
|
|
|
GimpDrawToolClass *draw_tool_class;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
tool_class = GIMP_TOOL_CLASS (klass);
|
|
|
|
draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
parent_class = g_type_class_peek_parent (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;
|
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)
|
|
|
|
{
|
|
|
|
GimpTool *tool;
|
|
|
|
GimpPaintTool *paint_tool;
|
2002-02-15 03:31:16 +08:00
|
|
|
GimpClone *clone_core;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
tool = GIMP_TOOL (clone);
|
|
|
|
paint_tool = GIMP_PAINT_TOOL (clone);
|
1999-02-05 17:55:44 +08:00
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
tool->tool_cursor = GIMP_CLONE_TOOL_CURSOR;
|
2000-01-14 20:41:00 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
clone_core = g_object_new (GIMP_TYPE_CLONE, NULL);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
clone_core->init_callback = gimp_clone_init_callback;
|
|
|
|
clone_core->finish_callback = gimp_clone_finish_callback;
|
|
|
|
clone_core->pretrace_callback = gimp_clone_pretrace_callback;
|
|
|
|
clone_core->posttrace_callback = gimp_clone_posttrace_callback;
|
|
|
|
clone_core->callback_data = clone;
|
|
|
|
|
|
|
|
paint_tool->core = GIMP_PAINT_CORE (clone_core);
|
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,
|
|
|
|
GimpDisplay *gdisp)
|
1999-02-05 17:55:44 +08:00
|
|
|
{
|
2002-02-15 03:31:16 +08:00
|
|
|
GimpPaintTool *paint_tool;
|
2001-07-25 08:27:41 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
paint_tool = GIMP_PAINT_TOOL (tool);
|
2002-02-07 19:33:01 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
if (state & GDK_CONTROL_MASK)
|
|
|
|
{
|
|
|
|
GIMP_CLONE (paint_tool->core)->set_source = TRUE;
|
|
|
|
}
|
|
|
|
else
|
2000-01-14 20:41:00 +08:00
|
|
|
{
|
2002-02-15 03:31:16 +08:00
|
|
|
GIMP_CLONE (paint_tool->core)->set_source = FALSE;
|
2000-01-14 20:41:00 +08:00
|
|
|
}
|
2002-02-15 03:31:16 +08:00
|
|
|
|
|
|
|
GIMP_TOOL_CLASS (parent_class)->button_press (tool,
|
|
|
|
coords,
|
|
|
|
time,
|
|
|
|
state,
|
|
|
|
gdisp);
|
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,
|
|
|
|
GimpDisplay *gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-02-15 03:31:16 +08:00
|
|
|
GimpPaintTool *paint_tool;
|
2001-11-20 21:53:21 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
paint_tool = GIMP_PAINT_TOOL (tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
if (state & GDK_CONTROL_MASK)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-02-15 03:31:16 +08:00
|
|
|
GIMP_CLONE (paint_tool->core)->set_source = TRUE;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2002-02-15 03:31:16 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
GIMP_CLONE (paint_tool->core)->set_source = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
GIMP_TOOL_CLASS (parent_class)->motion (tool,
|
|
|
|
coords,
|
|
|
|
time,
|
|
|
|
state,
|
|
|
|
gdisp);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
1999-05-15 20:13:43 +08:00
|
|
|
void
|
2001-11-09 03:14:51 +08:00
|
|
|
gimp_clone_tool_cursor_update (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
1999-05-15 20:13:43 +08:00
|
|
|
{
|
2002-02-05 01:43:01 +08:00
|
|
|
CloneOptions *options;
|
|
|
|
GimpLayer *layer;
|
|
|
|
GdkCursorType ctype = GIMP_MOUSE_CURSOR;
|
2001-11-01 05:20:09 +08:00
|
|
|
|
2001-11-20 21:53:21 +08:00
|
|
|
options = (CloneOptions *) tool->tool_info->tool_options;
|
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
if ((layer = gimp_image_get_active_layer (gdisp->gimage)))
|
1999-05-15 20:13:43 +08:00
|
|
|
{
|
2002-02-15 03:31:16 +08:00
|
|
|
gint off_x, off_y;
|
2001-01-15 05:11:52 +08:00
|
|
|
|
|
|
|
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
|
1999-05-15 20:13:43 +08:00
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
if (coords->x >= off_x &&
|
|
|
|
coords->y >= off_y &&
|
|
|
|
coords->x < (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer))) &&
|
|
|
|
coords->y < (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer))))
|
1999-05-15 20:13:43 +08:00
|
|
|
{
|
|
|
|
/* One more test--is there a selected region?
|
|
|
|
* if so, is cursor inside?
|
|
|
|
*/
|
2001-11-29 06:42:19 +08:00
|
|
|
if (gimp_image_mask_is_empty (gdisp->gimage))
|
2000-06-14 18:59:16 +08:00
|
|
|
ctype = GIMP_MOUSE_CURSOR;
|
2001-11-29 06:42:19 +08:00
|
|
|
else if (gimp_image_mask_value (gdisp->gimage, coords->x, coords->y))
|
2000-06-14 18:59:16 +08:00
|
|
|
ctype = GIMP_MOUSE_CURSOR;
|
1999-05-15 20:13:43 +08:00
|
|
|
}
|
|
|
|
}
|
2002-02-07 19:33:01 +08:00
|
|
|
|
2001-11-20 21:53:21 +08:00
|
|
|
if (options->type == IMAGE_CLONE)
|
2000-01-14 20:41:00 +08:00
|
|
|
{
|
2001-11-09 03:14:51 +08:00
|
|
|
if (state & GDK_CONTROL_MASK)
|
2000-06-14 18:59:16 +08:00
|
|
|
ctype = GIMP_CROSSHAIR_SMALL_CURSOR;
|
2002-02-15 03:31:16 +08:00
|
|
|
else if (! GIMP_CLONE (GIMP_PAINT_TOOL (tool)->core)->src_drawable)
|
2000-01-14 20:41:00 +08:00
|
|
|
ctype = GIMP_BAD_CURSOR;
|
|
|
|
}
|
1999-07-27 16:47:31 +08:00
|
|
|
|
2002-02-05 01:43:01 +08:00
|
|
|
tool->cursor = ctype;
|
|
|
|
|
|
|
|
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, gdisp);
|
1999-05-15 20:13:43 +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
|
|
|
{
|
2002-02-07 19:33:01 +08:00
|
|
|
GimpTool *tool;
|
2001-11-20 21:53:21 +08:00
|
|
|
|
2002-02-07 19:33:01 +08:00
|
|
|
tool = GIMP_TOOL (draw_tool);
|
2001-11-20 21:53:21 +08:00
|
|
|
|
2002-02-07 19:33:01 +08:00
|
|
|
if (tool->state == ACTIVE)
|
|
|
|
{
|
|
|
|
CloneOptions *options;
|
|
|
|
|
|
|
|
options = (CloneOptions *) tool->tool_info->tool_options;
|
|
|
|
|
|
|
|
if (draw_tool->gdisp && options->type == IMAGE_CLONE)
|
|
|
|
{
|
2002-02-15 03:31:16 +08:00
|
|
|
GimpClone *clone;
|
|
|
|
|
|
|
|
clone = GIMP_CLONE (GIMP_PAINT_TOOL (draw_tool)->core);
|
|
|
|
|
2002-02-07 19:33:01 +08:00
|
|
|
gimp_draw_tool_draw_handle (draw_tool,
|
|
|
|
GIMP_HANDLE_CROSS,
|
2002-02-15 03:31:16 +08:00
|
|
|
clone->src_x,
|
|
|
|
clone->src_y,
|
2002-02-07 19:33:01 +08:00
|
|
|
TARGET_WIDTH, TARGET_WIDTH,
|
|
|
|
GTK_ANCHOR_CENTER,
|
|
|
|
TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-02-07 19:33:01 +08:00
|
|
|
GIMP_DRAW_TOOL_CLASS (parent_class)->draw (draw_tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-02-15 03:31:16 +08:00
|
|
|
gimp_clone_init_callback (GimpClone *clone,
|
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-02-15 03:31:16 +08:00
|
|
|
GimpCloneTool *clone_tool;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
clone_tool = GIMP_CLONE_TOOL (data);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
gimp_draw_tool_start (GIMP_DRAW_TOOL (clone_tool),
|
|
|
|
GIMP_TOOL (clone_tool)->gdisp);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-02-15 03:31:16 +08:00
|
|
|
gimp_clone_finish_callback (GimpClone *clone,
|
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-02-15 03:31:16 +08:00
|
|
|
GimpCloneTool *clone_tool;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
clone_tool = GIMP_CLONE_TOOL (data);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
gimp_draw_tool_stop (GIMP_DRAW_TOOL (clone_tool));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-02-15 03:31:16 +08:00
|
|
|
gimp_clone_pretrace_callback (GimpClone *clone,
|
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-02-15 03:31:16 +08:00
|
|
|
GimpCloneTool *clone_tool;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
clone_tool = GIMP_CLONE_TOOL (data);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
gimp_draw_tool_pause (GIMP_DRAW_TOOL (clone_tool));
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
static void
|
|
|
|
gimp_clone_posttrace_callback (GimpClone *clone,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpCloneTool *clone_tool;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
clone_tool = GIMP_CLONE_TOOL (data);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
gimp_draw_tool_resume (GIMP_DRAW_TOOL (clone_tool));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
|
|
|
|
#if 0
|
2001-04-19 21:01:44 +08:00
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
static gpointer
|
2001-04-19 21:01:44 +08:00
|
|
|
gimp_clone_tool_non_gui_paint_func (GimpPaintTool *paint_tool,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
PaintState state)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-04-19 21:01:44 +08:00
|
|
|
gimp_clone_tool_motion (paint_tool, drawable, non_gui_src_drawable,
|
|
|
|
&non_gui_pressure_options,
|
|
|
|
non_gui_type, non_gui_offset_x, non_gui_offset_y);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1999-07-20 06:42:49 +08:00
|
|
|
gboolean
|
2001-04-19 21:01:44 +08:00
|
|
|
gimp_clone_tool_non_gui_default (GimpDrawable *drawable,
|
|
|
|
gint num_strokes,
|
|
|
|
gdouble *stroke_array)
|
1999-07-20 06:42:49 +08:00
|
|
|
{
|
|
|
|
GimpDrawable *src_drawable = NULL;
|
|
|
|
CloneType clone_type = CLONE_DEFAULT_TYPE;
|
2000-12-31 12:07:42 +08:00
|
|
|
gdouble local_src_x = 0.0;
|
|
|
|
gdouble local_src_y = 0.0;
|
1999-07-20 06:42:49 +08:00
|
|
|
CloneOptions *options = clone_options;
|
2000-12-31 12:07:42 +08:00
|
|
|
|
|
|
|
if (options)
|
1999-07-20 06:42:49 +08:00
|
|
|
{
|
2002-02-07 19:33:01 +08:00
|
|
|
clone_type = options->type;
|
|
|
|
src_drawable = the_src_drawable;
|
|
|
|
local_src_x = src_x;
|
|
|
|
local_src_y = src_y;
|
1999-07-20 06:42:49 +08:00
|
|
|
}
|
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
return gimp_clone_tool_non_gui (drawable,
|
|
|
|
src_drawable,
|
|
|
|
clone_type,
|
|
|
|
local_src_x,local_src_y,
|
|
|
|
num_strokes, stroke_array);
|
1999-07-20 06:42:49 +08:00
|
|
|
}
|
|
|
|
|
1999-04-19 05:22:41 +08:00
|
|
|
gboolean
|
2001-04-19 21:01:44 +08:00
|
|
|
gimp_clone_tool_non_gui (GimpDrawable *drawable,
|
|
|
|
GimpDrawable *src_drawable,
|
|
|
|
CloneType clone_type,
|
|
|
|
gdouble src_x,
|
|
|
|
gdouble src_y,
|
|
|
|
gint num_strokes,
|
|
|
|
gdouble *stroke_array)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-12-31 12:07:42 +08:00
|
|
|
gint i;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
if (gimp_paint_tool_start (&non_gui_paint_tool, drawable,
|
|
|
|
stroke_array[0], stroke_array[1]))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
1999-04-19 05:22:41 +08:00
|
|
|
/* Set the paint core's paint func */
|
1997-11-25 06:05:25 +08:00
|
|
|
non_gui_paint_core.paint_func = clone_non_gui_paint_func;
|
1999-07-20 06:42:49 +08:00
|
|
|
|
|
|
|
non_gui_type = clone_type;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-04-19 05:22:41 +08:00
|
|
|
non_gui_src_drawable = src_drawable;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
non_gui_paint_core.startx = non_gui_paint_core.lastx = stroke_array[0];
|
|
|
|
non_gui_paint_core.starty = non_gui_paint_core.lasty = stroke_array[1];
|
|
|
|
|
2001-11-14 00:21:34 +08:00
|
|
|
non_gui_offset_x = (int) (src_x - non_gui_paint_core.start_coords.x);
|
|
|
|
non_gui_offset_y = (int) (src_y - non_gui_paint_core.start_coords.y);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-07-23 07:11:46 +08:00
|
|
|
clone_non_gui_paint_func (&non_gui_paint_core, drawable, 0);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
for (i = 1; i < num_strokes; i++)
|
|
|
|
{
|
2001-11-14 00:21:34 +08:00
|
|
|
non_gui_paint_core.cur_coords.x = stroke_array[i * 2 + 0];
|
|
|
|
non_gui_paint_core.cur_coords.y = stroke_array[i * 2 + 1];
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-01-22 15:02:57 +08:00
|
|
|
paint_core_interpolate (&non_gui_paint_core, drawable);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-11-14 00:21:34 +08:00
|
|
|
non_gui_paint_core.last_coords.x = non_gui_paint_core.cur_coords.x;
|
|
|
|
non_gui_paint_core.last_coords.y = non_gui_paint_core.cur_coords.y;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
1999-04-19 05:22:41 +08:00
|
|
|
/* Finish the painting */
|
1998-01-22 15:02:57 +08:00
|
|
|
paint_core_finish (&non_gui_paint_core, drawable, -1);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-04-19 05:22:41 +08:00
|
|
|
/* Cleanup */
|
1997-11-25 06:05:25 +08:00
|
|
|
paint_core_cleanup ();
|
1999-04-19 05:22:41 +08:00
|
|
|
return TRUE;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
1999-04-19 05:22:41 +08:00
|
|
|
else
|
|
|
|
return FALSE;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2001-04-19 21:01:44 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* too options stuff */
|
2001-04-19 21:01:44 +08:00
|
|
|
|
2001-11-21 07:00:47 +08:00
|
|
|
static GimpToolOptions *
|
|
|
|
clone_options_new (GimpToolInfo *tool_info)
|
2001-04-19 21:01:44 +08:00
|
|
|
{
|
|
|
|
CloneOptions *options;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *frame;
|
|
|
|
|
2001-11-21 07:00:47 +08:00
|
|
|
options = g_new0 (CloneOptions, 1);
|
|
|
|
|
|
|
|
paint_options_init ((PaintOptions *) options, tool_info);
|
|
|
|
|
|
|
|
((GimpToolOptions *) options)->reset_func = clone_options_reset;
|
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
options->type = options->type_d = CLONE_DEFAULT_TYPE;
|
|
|
|
options->aligned = options->aligned_d = CLONE_DEFAULT_ALIGNED;
|
|
|
|
|
|
|
|
/* the main vbox */
|
2001-07-18 04:50:01 +08:00
|
|
|
vbox = ((GimpToolOptions *) options)->main_vbox;
|
2001-04-19 21:01:44 +08:00
|
|
|
|
|
|
|
frame = gimp_radio_group_new2 (TRUE, _("Source"),
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
G_CALLBACK (gimp_radio_button_update),
|
2001-11-23 01:11:52 +08:00
|
|
|
&options->type,
|
|
|
|
GINT_TO_POINTER (options->type),
|
2001-04-19 21:01:44 +08:00
|
|
|
|
2001-11-23 01:11:52 +08:00
|
|
|
_("Image Source"),
|
|
|
|
GINT_TO_POINTER (IMAGE_CLONE),
|
2001-04-19 21:01:44 +08:00
|
|
|
&options->type_w[0],
|
2001-11-23 01:11:52 +08:00
|
|
|
|
|
|
|
_("Pattern Source"),
|
|
|
|
GINT_TO_POINTER (PATTERN_CLONE),
|
2001-04-19 21:01:44 +08:00
|
|
|
&options->type_w[1],
|
|
|
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
frame = gimp_radio_group_new2 (TRUE, _("Alignment"),
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
G_CALLBACK (gimp_radio_button_update),
|
2001-11-23 01:11:52 +08:00
|
|
|
&options->aligned,
|
|
|
|
GINT_TO_POINTER (options->aligned),
|
2001-04-19 21:01:44 +08:00
|
|
|
|
2001-11-23 01:11:52 +08:00
|
|
|
_("Non Aligned"),
|
|
|
|
GINT_TO_POINTER (ALIGN_NO),
|
2001-04-19 21:01:44 +08:00
|
|
|
&options->aligned_w[0],
|
2001-11-23 01:11:52 +08:00
|
|
|
|
|
|
|
_("Aligned"),
|
|
|
|
GINT_TO_POINTER (ALIGN_YES),
|
2001-04-19 21:01:44 +08:00
|
|
|
&options->aligned_w[1],
|
2001-11-23 01:11:52 +08:00
|
|
|
|
|
|
|
_("Registered"),
|
|
|
|
GINT_TO_POINTER (ALIGN_REGISTERED),
|
2001-04-19 21:01:44 +08:00
|
|
|
&options->aligned_w[2],
|
|
|
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2001-11-21 07:00:47 +08:00
|
|
|
return (GimpToolOptions *) options;
|
2001-04-19 21:01:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-07-18 04:50:01 +08:00
|
|
|
clone_options_reset (GimpToolOptions *tool_options)
|
2001-04-19 21:01:44 +08:00
|
|
|
{
|
|
|
|
CloneOptions *options;
|
|
|
|
|
|
|
|
options = (CloneOptions *) tool_options;
|
|
|
|
|
|
|
|
paint_options_reset (tool_options);
|
|
|
|
|
2001-11-23 01:11:52 +08:00
|
|
|
gimp_radio_group_set_active (GTK_RADIO_BUTTON (options->type_w[0]),
|
|
|
|
GINT_TO_POINTER (options->type_d));
|
|
|
|
gimp_radio_group_set_active (GTK_RADIO_BUTTON (options->aligned_w[0]),
|
|
|
|
GINT_TO_POINTER (options->aligned_d));
|
2001-04-19 21:01:44 +08:00
|
|
|
}
|