From 070fafb5d1567c04a14f61d3c46bb0e7dfbc8a3d Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Mon, 14 Jul 2003 17:10:09 +0000 Subject: [PATCH] Argh... 2003-07-14 Michael Natterer Argh... * app/paint/Makefile.am * app/paint/gimppencil.[ch]: added it again as GimpPaintbrush subclass and override nothing but the user visible undo name and the paint_options type. * app/paint/paint.c * app/tools/tool_manager.c * app/tools/gimppenciltool.c * tools/pdbgen/pdb/paint_tools.pdb: reverted my last changes. * app/pdb/paint_tools_cmds.c: regenerated. --- ChangeLog | 18 ++++++- app/paint/Makefile.am | 2 + app/paint/gimppencil.c | 85 ++++++++++++++++++++++++++++++++ app/paint/gimppencil.h | 44 +++++++++++++++++ app/paint/paint.c | 12 +++-- app/pdb/paint_tools_cmds.c | 3 +- app/tools/gimppenciltool.c | 4 +- app/tools/tool_manager.c | 2 +- tools/pdbgen/pdb/paint_tools.pdb | 4 +- 9 files changed, 164 insertions(+), 10 deletions(-) create mode 100644 app/paint/gimppencil.c create mode 100644 app/paint/gimppencil.h diff --git a/ChangeLog b/ChangeLog index a7dbca8417..8b7fe03a11 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2003-07-14 Michael Natterer + + Argh... + + * app/paint/Makefile.am + * app/paint/gimppencil.[ch]: added it again as GimpPaintbrush + subclass and override nothing but the user visible undo name and + the paint_options type. + + * app/paint/paint.c + * app/tools/tool_manager.c + * app/tools/gimppenciltool.c + * tools/pdbgen/pdb/paint_tools.pdb: reverted my last changes. + + * app/pdb/paint_tools_cmds.c: regenerated. + 2003-07-14 Michael Natterer * app/paint/Makefile.am @@ -10,7 +26,7 @@ * app/tools/tool_manager.c: changed accordingly. * app/tools/gimppenciltool.c - * tools/pdbgen/pdb/paint_tools.pdb: use the pintbrush core for + * tools/pdbgen/pdb/paint_tools.pdb: use the paintbrush core for pencil drawing. * app/pdb/paint_tools_cmds.c: regenerated. diff --git a/app/paint/Makefile.am b/app/paint/Makefile.am index c728d3a5ce..70a5ededb8 100644 --- a/app/paint/Makefile.am +++ b/app/paint/Makefile.am @@ -49,6 +49,8 @@ libapppaint_a_sources = \ gimppaintcore-undo.h \ gimppaintoptions.c \ gimppaintoptions.h \ + gimppencil.c \ + gimppencil.h \ gimppenciloptions.c \ gimppenciloptions.h \ gimppaintbrush.c \ diff --git a/app/paint/gimppencil.c b/app/paint/gimppencil.c new file mode 100644 index 0000000000..70a0a17a60 --- /dev/null +++ b/app/paint/gimppencil.c @@ -0,0 +1,85 @@ +/* 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 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "paint-types.h" + +#include "gimppencil.h" +#include "gimppenciloptions.h" + +#include "gimp-intl.h" + + +static void gimp_pencil_class_init (GimpPencilClass *klass); +static void gimp_pencil_init (GimpPencil *pencil); + + +static GimpPaintbrushClass *parent_class = NULL; + + +void +gimp_pencil_register (Gimp *gimp, + GimpPaintRegisterCallback callback) +{ + (* callback) (gimp, + GIMP_TYPE_PENCIL, + GIMP_TYPE_PENCIL_OPTIONS, + _("Pencil")); +} + +GType +gimp_pencil_get_type (void) +{ + static GType type = 0; + + if (! type) + { + static const GTypeInfo info = + { + sizeof (GimpPencilClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) gimp_pencil_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GimpPencil), + 0, /* n_preallocs */ + (GInstanceInitFunc) gimp_pencil_init, + }; + + type = g_type_register_static (GIMP_TYPE_PAINTBRUSH, + "GimpPencil", + &info, 0); + } + + return type; +} + +static void +gimp_pencil_class_init (GimpPencilClass *klass) +{ + parent_class = g_type_class_peek_parent (klass); +} + +static void +gimp_pencil_init (GimpPencil *pencil) +{ +} diff --git a/app/paint/gimppencil.h b/app/paint/gimppencil.h new file mode 100644 index 0000000000..b8d1d0b3cd --- /dev/null +++ b/app/paint/gimppencil.h @@ -0,0 +1,44 @@ +/* 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 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __GIMP_PENCIL_H__ +#define __GIMP_PENCIL_H__ + + +#include "gimppaintbrush.h" + + +#define GIMP_TYPE_PENCIL (gimp_pencil_get_type ()) +#define GIMP_PENCIL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PENCIL, GimpPencil)) +#define GIMP_PENCIL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PENCIL, GimpPencilClass)) +#define GIMP_IS_PENCIL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PENCIL)) +#define GIMP_IS_PENCIL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PENCIL)) +#define GIMP_PENCIL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PENCIL, GimpPencilClass)) + + +typedef struct _GimpPaintbrush GimpPencil; +typedef struct _GimpPaintbrushClass GimpPencilClass; + + +void gimp_pencil_register (Gimp *gimp, + GimpPaintRegisterCallback callback); + +GType gimp_pencil_get_type (void) G_GNUC_CONST; + + +#endif /* __GIMP_PENCIL_H__ */ diff --git a/app/paint/paint.c b/app/paint/paint.c index 343fd60641..77100f4cd2 100644 --- a/app/paint/paint.c +++ b/app/paint/paint.c @@ -33,6 +33,7 @@ #include "gimpdodgeburn.h" #include "gimperaser.h" #include "gimppaintbrush.h" +#include "gimppencil.h" #include "gimpsmudge.h" @@ -57,7 +58,8 @@ paint_init (Gimp *gimp) gimp_clone_register, gimp_airbrush_register, gimp_eraser_register, - gimp_paintbrush_register + gimp_paintbrush_register, + gimp_pencil_register, }; gint i; @@ -102,8 +104,12 @@ paint_register (Gimp *gimp, g_return_if_fail (g_type_is_a (paint_type, GIMP_TYPE_PAINT_CORE)); g_return_if_fail (g_type_is_a (paint_options_type, GIMP_TYPE_PAINT_OPTIONS)); g_return_if_fail (blurb != NULL); - - if (paint_type == GIMP_TYPE_PAINTBRUSH) + + if (paint_type == GIMP_TYPE_PENCIL) + { + pdb_string = "gimp_pencil"; + } + else if (paint_type == GIMP_TYPE_PAINTBRUSH) { pdb_string = "gimp_paintbrush_default"; } diff --git a/app/pdb/paint_tools_cmds.c b/app/pdb/paint_tools_cmds.c index f10242923b..5aff57d476 100644 --- a/app/pdb/paint_tools_cmds.c +++ b/app/pdb/paint_tools_cmds.c @@ -42,6 +42,7 @@ #include "paint/gimperaseroptions.h" #include "paint/gimppaintbrush.h" #include "paint/gimppaintcore-stroke.h" +#include "paint/gimppencil.h" #include "paint/gimppenciloptions.h" #include "paint/gimpsmudge.h" #include "paint/gimpsmudgeoptions.h" @@ -1194,7 +1195,7 @@ pencil_invoker (Gimp *gimp, options = gimp_paint_options_new (gimp, GIMP_TYPE_PENCIL_OPTIONS); success = paint_tools_stroke (gimp, - GIMP_TYPE_PAINTBRUSH, + GIMP_TYPE_PENCIL, options, drawable, num_strokes, strokes); diff --git a/app/tools/gimppenciltool.c b/app/tools/gimppenciltool.c index 3baff407a3..356fcc64fe 100644 --- a/app/tools/gimppenciltool.c +++ b/app/tools/gimppenciltool.c @@ -24,7 +24,7 @@ #include "tools-types.h" -#include "paint/gimppaintbrush.h" +#include "paint/gimppencil.h" #include "paint/gimppenciloptions.h" #include "gimppenciltool.h" @@ -111,5 +111,5 @@ gimp_pencil_tool_init (GimpPencilTool *pencil) gimp_tool_control_set_tool_cursor (tool->control, GIMP_PENCIL_TOOL_CURSOR); paint_tool->pick_colors = TRUE; - paint_tool->core = g_object_new (GIMP_TYPE_PAINTBRUSH, NULL); + paint_tool->core = g_object_new (GIMP_TYPE_PENCIL, NULL); } diff --git a/app/tools/tool_manager.c b/app/tools/tool_manager.c index 5ee360f5e0..b013d329fa 100644 --- a/app/tools/tool_manager.c +++ b/app/tools/tool_manager.c @@ -525,7 +525,7 @@ tool_manager_register_tool (GType tool_type, if (tool_type == GIMP_TYPE_PENCIL_TOOL) { - paint_core_name = "GimpPaintbrush"; + paint_core_name = "GimpPencil"; } else if (tool_type == GIMP_TYPE_PAINTBRUSH_TOOL) { diff --git a/tools/pdbgen/pdb/paint_tools.pdb b/tools/pdbgen/pdb/paint_tools.pdb index 08fc0cd075..f240cbfbdf 100644 --- a/tools/pdbgen/pdb/paint_tools.pdb +++ b/tools/pdbgen/pdb/paint_tools.pdb @@ -546,14 +546,14 @@ HELP ); %invoke = ( - headers => [ qw("paint/gimppenciloptions.h") ], + headers => [ qw("paint/gimppencil.h" "paint/gimppenciloptions.h") ], vars => [ "GimpPaintOptions *options" ], code => <<'CODE' { options = gimp_paint_options_new (gimp, GIMP_TYPE_PENCIL_OPTIONS); success = paint_tools_stroke (gimp, - GIMP_TYPE_PAINTBRUSH, + GIMP_TYPE_PENCIL, options, drawable, num_strokes, strokes);