1997-11-25 06:05:25 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* 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
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
#include <gtk/gtk.h>
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2001-08-06 00:08:19 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
2001-01-24 02:49:44 +08:00
|
|
|
|
2002-03-29 11:50:29 +08:00
|
|
|
#include "core/core-types.h"
|
|
|
|
#include "libgimptool/gimptooltypes.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
#include "paint/gimppencil.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
|
2001-03-12 07:28:16 +08:00
|
|
|
#include "gimppenciltool.h"
|
1999-04-22 22:34:00 +08:00
|
|
|
#include "paint_options.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-03-12 07:28:16 +08:00
|
|
|
#include "libgimp/gimpintl.h"
|
2000-04-28 01:27:28 +08:00
|
|
|
|
2001-03-12 12:40:17 +08:00
|
|
|
|
|
|
|
static void gimp_pencil_tool_class_init (GimpPencilToolClass *klass);
|
|
|
|
static void gimp_pencil_tool_init (GimpPencilTool *pancil);
|
2000-12-31 12:07:42 +08:00
|
|
|
|
2001-03-12 12:40:17 +08:00
|
|
|
|
2001-03-12 07:28:16 +08:00
|
|
|
static GimpPaintToolClass *parent_class = NULL;
|
1999-08-14 04:50:30 +08:00
|
|
|
|
1999-04-09 06:25:54 +08:00
|
|
|
|
|
|
|
/* functions */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-03-12 07:28:16 +08:00
|
|
|
void
|
2002-03-29 11:50:29 +08:00
|
|
|
gimp_pencil_tool_register (GimpToolRegisterCallback callback,
|
2002-05-03 19:31:08 +08:00
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-03-29 11:50:29 +08:00
|
|
|
(* callback) (GIMP_TYPE_PENCIL_TOOL,
|
2001-11-21 07:00:47 +08:00
|
|
|
paint_options_new,
|
|
|
|
TRUE,
|
2002-03-21 20:17:17 +08:00
|
|
|
"gimp-pencil-tool",
|
2001-11-21 07:00:47 +08:00
|
|
|
_("Pencil"),
|
|
|
|
_("Paint hard edged pixels"),
|
|
|
|
N_("/Tools/Paint Tools/Pencil"), "P",
|
|
|
|
NULL, "tools/pencil.html",
|
2002-03-29 11:50:29 +08:00
|
|
|
GIMP_STOCK_TOOL_PENCIL,
|
2002-05-03 19:31:08 +08:00
|
|
|
data);
|
2001-03-12 12:40:17 +08:00
|
|
|
}
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
GType
|
2001-03-12 12:40:17 +08:00
|
|
|
gimp_pencil_tool_get_type (void)
|
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
static GType tool_type = 0;
|
2001-03-12 12:40:17 +08:00
|
|
|
|
|
|
|
if (! tool_type)
|
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
static const GTypeInfo tool_info =
|
2001-03-12 12:40:17 +08:00
|
|
|
{
|
|
|
|
sizeof (GimpPencilToolClass),
|
2001-08-14 22:53:55 +08:00
|
|
|
(GBaseInitFunc) NULL,
|
|
|
|
(GBaseFinalizeFunc) NULL,
|
|
|
|
(GClassInitFunc) gimp_pencil_tool_class_init,
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
|
|
|
sizeof (GimpPencilTool),
|
|
|
|
0, /* n_preallocs */
|
|
|
|
(GInstanceInitFunc) gimp_pencil_tool_init,
|
2001-03-12 12:40:17 +08:00
|
|
|
};
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
tool_type = g_type_register_static (GIMP_TYPE_PAINT_TOOL,
|
|
|
|
"GimpPencilTool",
|
|
|
|
&tool_info, 0);
|
2001-03-12 12:40:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return tool_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_pencil_tool_class_init (GimpPencilToolClass *klass)
|
|
|
|
{
|
|
|
|
GimpPaintToolClass *paint_tool_class;
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
paint_tool_class = GIMP_PAINT_TOOL_CLASS (klass);
|
2001-03-12 12:40:17 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2001-03-12 12:40:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_pencil_tool_init (GimpPencilTool *pencil)
|
|
|
|
{
|
|
|
|
GimpTool *tool;
|
|
|
|
GimpPaintTool *paint_tool;
|
|
|
|
|
|
|
|
tool = GIMP_TOOL (pencil);
|
|
|
|
paint_tool = GIMP_PAINT_TOOL (pencil);
|
|
|
|
|
2002-05-03 05:03:27 +08:00
|
|
|
gimp_tool_control_set_motion_mode (tool->control, GIMP_MOTION_MODE_EXACT);
|
|
|
|
gimp_tool_control_set_tool_cursor (tool->control, GIMP_PENCIL_TOOL_CURSOR);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
paint_tool->pick_colors = TRUE;
|
|
|
|
paint_tool->core = g_object_new (GIMP_TYPE_PENCIL, NULL);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|