added gimp_pdb_compat_procs_register().

2006-08-05  Michael Natterer  <mitch@gimp.org>

	* app/pdb/gimp-pdb-compat.[ch]: added
	gimp_pdb_compat_procs_register().

	* app/pdb/gimp-pdb.[ch]: removed these files.

	* app/pdb/gimppdb.c
	* app/core/gimp.c: changed accordingly.

	* app/pdb/Makefile.am: build a separate libappinternal-procs.a

	* app/Makefile.am: link it.
This commit is contained in:
Michael Natterer 2006-08-05 18:27:56 +00:00 committed by Michael Natterer
parent 3f5c71cd97
commit ad019d6093
9 changed files with 128 additions and 200 deletions

View File

@ -1,3 +1,17 @@
2006-08-05 Michael Natterer <mitch@gimp.org>
* app/pdb/gimp-pdb-compat.[ch]: added
gimp_pdb_compat_procs_register().
* app/pdb/gimp-pdb.[ch]: removed these files.
* app/pdb/gimppdb.c
* app/core/gimp.c: changed accordingly.
* app/pdb/Makefile.am: build a separate libappinternal-procs.a
* app/Makefile.am: link it.
2006-08-05 Michael Natterer <mitch@gimp.org> 2006-08-05 Michael Natterer <mitch@gimp.org>
* app/plug-in/gimppluginmanager-file.c: don't #include * app/plug-in/gimppluginmanager-file.c: don't #include

View File

@ -90,7 +90,7 @@ INCLUDES = \
$(PANGOFT2_CFLAGS) \ $(PANGOFT2_CFLAGS) \
-I$(includedir) -I$(includedir)
gimp_2_3_LDFLAGS = $(mwindows) $(munix) gimp_2_3_LDFLAGS = $(mwindows) $(munix) -u internal_procs_init
gimp_2_3_LDADD = \ gimp_2_3_LDADD = \
gui/libappgui.a \ gui/libappgui.a \
@ -100,6 +100,7 @@ gimp_2_3_LDADD = \
display/libappdisplay.a \ display/libappdisplay.a \
tools/libapptools.a \ tools/libapptools.a \
widgets/libappwidgets.a \ widgets/libappwidgets.a \
pdb/libappinternal-procs.a \
pdb/libapppdb.a \ pdb/libapppdb.a \
vectors/libappvectors.a \ vectors/libappvectors.a \
plug-in/libappplug-in.a \ plug-in/libappplug-in.a \
@ -139,10 +140,13 @@ gimp_console_2_3_CPPFLAGS = \
$(AM_CPPFLAGS) \ $(AM_CPPFLAGS) \
-DGIMP_CONSOLE_COMPILATION -DGIMP_CONSOLE_COMPILATION
gimp_console_2_3_LDFLAGS = $(mwindows) $(munix) -u internal_procs_init
gimp_console_2_3_LDADD = \ gimp_console_2_3_LDADD = \
widgets/widgets-enums.o \ widgets/widgets-enums.o \
display/display-enums.o \ display/display-enums.o \
display/gimpdisplayoptions.o \ display/gimpdisplayoptions.o \
pdb/libappinternal-procs.a \
pdb/libapppdb.a \ pdb/libapppdb.a \
vectors/libappvectors.a \ vectors/libappvectors.a \
plug-in/libappplug-in.a \ plug-in/libappplug-in.a \

View File

@ -29,7 +29,9 @@
#include "config/gimprc.h" #include "config/gimprc.h"
#include "pdb/gimp-pdb.h" #include "pdb/gimppdb.h"
#include "pdb/gimp-pdb-compat.h"
#include "pdb/internal_procs.h"
#include "plug-in/gimppluginmanager.h" #include "plug-in/gimppluginmanager.h"
@ -221,7 +223,7 @@ gimp_init (Gimp *gimp)
gimp->gradient_factory = NULL; gimp->gradient_factory = NULL;
gimp->palette_factory = NULL; gimp->palette_factory = NULL;
gimp_pdb_initialize (gimp); gimp->pdb = gimp_pdb_new (gimp);
xcf_init (gimp); xcf_init (gimp);
@ -304,7 +306,11 @@ gimp_finalize (GObject *object)
xcf_exit (gimp); xcf_exit (gimp);
gimp_pdb_exit (gimp); if (gimp->pdb)
{
g_object_unref (gimp->pdb);
gimp->pdb = NULL;
}
if (gimp->brush_factory) if (gimp->brush_factory)
{ {
@ -585,7 +591,8 @@ gimp_real_initialize (Gimp *gimp,
/* register all internal procedures */ /* register all internal procedures */
status_callback (NULL, _("Internal Procedures"), 0.2); status_callback (NULL, _("Internal Procedures"), 0.2);
gimp_pdb_init_procs (gimp); internal_procs_init (gimp->pdb);
gimp_pdb_compat_procs_register (gimp->pdb, gimp->pdb_compat_mode);
gimp_plug_in_manager_initialize (gimp->plug_in_manager, status_callback); gimp_plug_in_manager_initialize (gimp->plug_in_manager, status_callback);

View File

@ -1,12 +1,10 @@
## Process this file with automake to produce Makefile.in ## Process this file with automake to produce Makefile.in
noinst_LIBRARIES = libapppdb.a noinst_LIBRARIES = libapppdb.a libappinternal-procs.a
libapppdb_a_SOURCES = \ libapppdb_a_SOURCES = \
pdb-types.h \ pdb-types.h \
\ \
gimp-pdb.c \
gimp-pdb.h \
gimp-pdb-compat.c \ gimp-pdb-compat.c \
gimp-pdb-compat.h \ gimp-pdb-compat.h \
gimppdb.c \ gimppdb.c \
@ -18,8 +16,9 @@ libapppdb_a_SOURCES = \
gimppluginprocedure.c \ gimppluginprocedure.c \
gimppluginprocedure.h \ gimppluginprocedure.h \
gimptemporaryprocedure.c \ gimptemporaryprocedure.c \
gimptemporaryprocedure.h \ gimptemporaryprocedure.h
\
libappinternal_procs_a_SOURCES = \
internal_procs.c \ internal_procs.c \
internal_procs.h \ internal_procs.h \
brush_cmds.c \ brush_cmds.c \

View File

@ -28,6 +28,7 @@
#include "core/gimp.h" #include "core/gimp.h"
#include "core/gimpparamspecs.h" #include "core/gimpparamspecs.h"
#include "gimppdb.h"
#include "gimp-pdb-compat.h" #include "gimp-pdb-compat.h"
@ -342,3 +343,91 @@ gimp_pdb_compat_arg_type_to_string (GimpPDBArgType type)
return g_strdup (name); return g_strdup (name);
} }
void
gimp_pdb_compat_procs_register (GimpPDB *pdb,
GimpPDBCompatMode compat_mode)
{
static const struct
{
const gchar *old_name;
const gchar *new_name;
}
compat_procs[] =
{
{ "gimp-blend", "gimp-edit-blend" },
{ "gimp-brushes-list", "gimp-brushes-get-list" },
{ "gimp-bucket-fill", "gimp-edit-bucket-fill" },
{ "gimp-channel-delete", "gimp-drawable-delete" },
{ "gimp-channel-get-name", "gimp-drawable-get-name" },
{ "gimp-channel-get-tattoo", "gimp-drawable-get-tattoo" },
{ "gimp-channel-get-visible", "gimp-drawable-get-visible" },
{ "gimp-channel-set-name", "gimp-drawable-set-name" },
{ "gimp-channel-set-tattoo", "gimp-drawable-set-tattoo" },
{ "gimp-channel-set-visible", "gimp-drawable-set-visible" },
{ "gimp-color-picker", "gimp-image-pick-color" },
{ "gimp-convert-grayscale", "gimp-image-convert-grayscale" },
{ "gimp-convert-indexed", "gimp-image-convert-indexed" },
{ "gimp-convert-rgb", "gimp-image-convert-rgb" },
{ "gimp-crop", "gimp-image-crop" },
{ "gimp-drawable-bytes", "gimp-drawable-bpp" },
{ "gimp-drawable-image", "gimp-drawable-get-image" },
{ "gimp-image-active-drawable", "gimp-image-get-active-drawable" },
{ "gimp-image-floating-selection", "gimp-image-get-floating-sel" },
{ "gimp-layer-delete", "gimp-drawable-delete" },
{ "gimp-layer-get-linked", "gimp-drawable-get-linked" },
{ "gimp-layer-get-name", "gimp-drawable-get-name" },
{ "gimp-layer-get-tattoo", "gimp-drawable-get-tattoo" },
{ "gimp-layer-get-visible", "gimp-drawable-get-visible" },
{ "gimp-layer-mask", "gimp-layer-get-mask" },
{ "gimp-layer-set-linked", "gimp-drawable-set-linked" },
{ "gimp-layer-set-name", "gimp-drawable-set-name" },
{ "gimp-layer-set-tattoo", "gimp-drawable-set-tattoo" },
{ "gimp-layer-set-visible", "gimp-drawable-set-visible" },
{ "gimp-palette-refresh", "gimp-palettes-refresh" },
{ "gimp-patterns-list", "gimp-patterns-get-list" },
{ "gimp-temp-PDB-name", "gimp-procedural-db-temp-name" },
{ "gimp-undo-push-group-end", "gimp-image-undo-group-end" },
{ "gimp-undo-push-group-start", "gimp-image-undo-group-start" },
/* deprecations since 2.0 */
{ "gimp-brushes-get-opacity", "gimp-context-get-opacity" },
{ "gimp-brushes-get-paint-mode", "gimp-context-get-paint-mode" },
{ "gimp-brushes-set-brush", "gimp-context-set-brush" },
{ "gimp-brushes-set-opacity", "gimp-context-set-opacity" },
{ "gimp-brushes-set-paint-mode", "gimp-context-set-paint-mode" },
{ "gimp-channel-ops-duplicate", "gimp-image-duplicate" },
{ "gimp-channel-ops-offset", "gimp-drawable-offset" },
{ "gimp-gradients-get-active", "gimp-context-get-gradient" },
{ "gimp-gradients-get-gradient", "gimp-context-get-gradient" },
{ "gimp-gradients-set-active", "gimp-context-set-gradient" },
{ "gimp-gradients-set-gradient", "gimp-context-set-gradient" },
{ "gimp-image-get-cmap", "gimp-image-get-colormap" },
{ "gimp-image-set-cmap", "gimp-image-set-colormap" },
{ "gimp-palette-get-background", "gimp-context-get-background" },
{ "gimp-palette-get-foreground", "gimp-context-get-foreground" },
{ "gimp-palette-set-background", "gimp-context-set-background" },
{ "gimp-palette-set-default-colors", "gimp-context-set-default-colors" },
{ "gimp-palette-set-foreground", "gimp-context-set-foreground" },
{ "gimp-palette-swap-colors", "gimp-context-swap-colors" },
{ "gimp-palettes-set-palette", "gimp-context-set-palette" },
{ "gimp-patterns-set-pattern", "gimp-context-set-pattern" },
{ "gimp-selection-clear", "gimp-selection-none" },
/* deprecations since 2.2 */
{ "gimp-layer-get-preserve-trans", "gimp-drawable-get-lock-alpha" },
{ "gimp-layer-set-preserve-trans", "gimp-drawable-set-lock-alpha" }
};
g_return_if_fail (GIMP_IS_PDB (pdb));
if (compat_mode != GIMP_PDB_COMPAT_OFF)
{
gint i;
for (i = 0; i < G_N_ELEMENTS (compat_procs); i++)
gimp_pdb_register_compat_proc_name (pdb,
compat_procs[i].old_name,
compat_procs[i].new_name);
}
}

View File

@ -29,5 +29,8 @@ GType gimp_pdb_compat_arg_type_to_gtype (GimpPDBArgType type);
GimpPDBArgType gimp_pdb_compat_arg_type_from_gtype (GType type); GimpPDBArgType gimp_pdb_compat_arg_type_from_gtype (GType type);
gchar * gimp_pdb_compat_arg_type_to_string (GimpPDBArgType type); gchar * gimp_pdb_compat_arg_type_to_string (GimpPDBArgType type);
void gimp_pdb_compat_procs_register (GimpPDB *pdb,
GimpPDBCompatMode compat_mode);
#endif /* __GIMP_PDB_COMPAT_H__ */ #endif /* __GIMP_PDB_COMPAT_H__ */

View File

@ -1,159 +0,0 @@
/* 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 <stdarg.h>
#include <string.h>
#include <sys/types.h>
#include <glib-object.h>
#include <gobject/gvaluecollector.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpcolor/gimpcolor.h"
#include "pdb-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpchannel.h"
#include "core/gimplayer.h"
#include "core/gimpparamspecs.h"
#include "core/gimpprogress.h"
#include "vectors/gimpvectors.h"
#include "gimp-pdb.h"
#include "gimppdb.h"
#include "gimpprocedure.h"
#include "internal_procs.h"
#include "gimp-intl.h"
/* public functions */
void
gimp_pdb_initialize (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
gimp->pdb = gimp_pdb_new (gimp);
}
void
gimp_pdb_exit (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
if (gimp->pdb)
{
g_object_unref (gimp->pdb);
gimp->pdb = NULL;
}
}
void
gimp_pdb_init_procs (Gimp *gimp)
{
static const struct
{
const gchar *old_name;
const gchar *new_name;
}
compat_procs[] =
{
{ "gimp-blend", "gimp-edit-blend" },
{ "gimp-brushes-list", "gimp-brushes-get-list" },
{ "gimp-bucket-fill", "gimp-edit-bucket-fill" },
{ "gimp-channel-delete", "gimp-drawable-delete" },
{ "gimp-channel-get-name", "gimp-drawable-get-name" },
{ "gimp-channel-get-tattoo", "gimp-drawable-get-tattoo" },
{ "gimp-channel-get-visible", "gimp-drawable-get-visible" },
{ "gimp-channel-set-name", "gimp-drawable-set-name" },
{ "gimp-channel-set-tattoo", "gimp-drawable-set-tattoo" },
{ "gimp-channel-set-visible", "gimp-drawable-set-visible" },
{ "gimp-color-picker", "gimp-image-pick-color" },
{ "gimp-convert-grayscale", "gimp-image-convert-grayscale" },
{ "gimp-convert-indexed", "gimp-image-convert-indexed" },
{ "gimp-convert-rgb", "gimp-image-convert-rgb" },
{ "gimp-crop", "gimp-image-crop" },
{ "gimp-drawable-bytes", "gimp-drawable-bpp" },
{ "gimp-drawable-image", "gimp-drawable-get-image" },
{ "gimp-image-active-drawable", "gimp-image-get-active-drawable" },
{ "gimp-image-floating-selection", "gimp-image-get-floating-sel" },
{ "gimp-layer-delete", "gimp-drawable-delete" },
{ "gimp-layer-get-linked", "gimp-drawable-get-linked" },
{ "gimp-layer-get-name", "gimp-drawable-get-name" },
{ "gimp-layer-get-tattoo", "gimp-drawable-get-tattoo" },
{ "gimp-layer-get-visible", "gimp-drawable-get-visible" },
{ "gimp-layer-mask", "gimp-layer-get-mask" },
{ "gimp-layer-set-linked", "gimp-drawable-set-linked" },
{ "gimp-layer-set-name", "gimp-drawable-set-name" },
{ "gimp-layer-set-tattoo", "gimp-drawable-set-tattoo" },
{ "gimp-layer-set-visible", "gimp-drawable-set-visible" },
{ "gimp-palette-refresh", "gimp-palettes-refresh" },
{ "gimp-patterns-list", "gimp-patterns-get-list" },
{ "gimp-temp-PDB-name", "gimp-procedural-db-temp-name" },
{ "gimp-undo-push-group-end", "gimp-image-undo-group-end" },
{ "gimp-undo-push-group-start", "gimp-image-undo-group-start" },
/* deprecations since 2.0 */
{ "gimp-brushes-get-opacity", "gimp-context-get-opacity" },
{ "gimp-brushes-get-paint-mode", "gimp-context-get-paint-mode" },
{ "gimp-brushes-set-brush", "gimp-context-set-brush" },
{ "gimp-brushes-set-opacity", "gimp-context-set-opacity" },
{ "gimp-brushes-set-paint-mode", "gimp-context-set-paint-mode" },
{ "gimp-channel-ops-duplicate", "gimp-image-duplicate" },
{ "gimp-channel-ops-offset", "gimp-drawable-offset" },
{ "gimp-gradients-get-active", "gimp-context-get-gradient" },
{ "gimp-gradients-get-gradient", "gimp-context-get-gradient" },
{ "gimp-gradients-set-active", "gimp-context-set-gradient" },
{ "gimp-gradients-set-gradient", "gimp-context-set-gradient" },
{ "gimp-image-get-cmap", "gimp-image-get-colormap" },
{ "gimp-image-set-cmap", "gimp-image-set-colormap" },
{ "gimp-palette-get-background", "gimp-context-get-background" },
{ "gimp-palette-get-foreground", "gimp-context-get-foreground" },
{ "gimp-palette-set-background", "gimp-context-set-background" },
{ "gimp-palette-set-default-colors", "gimp-context-set-default-colors" },
{ "gimp-palette-set-foreground", "gimp-context-set-foreground" },
{ "gimp-palette-swap-colors", "gimp-context-swap-colors" },
{ "gimp-palettes-set-palette", "gimp-context-set-palette" },
{ "gimp-patterns-set-pattern", "gimp-context-set-pattern" },
{ "gimp-selection-clear", "gimp-selection-none" },
/* deprecations since 2.2 */
{ "gimp-layer-get-preserve-trans", "gimp-drawable-get-lock-alpha" },
{ "gimp-layer-set-preserve-trans", "gimp-drawable-set-lock-alpha" }
};
g_return_if_fail (GIMP_IS_GIMP (gimp));
internal_procs_init (gimp->pdb);
if (gimp->pdb_compat_mode != GIMP_PDB_COMPAT_OFF)
{
gint i;
for (i = 0; i < G_N_ELEMENTS (compat_procs); i++)
gimp_pdb_register_compat_proc_name (gimp->pdb,
compat_procs[i].old_name,
compat_procs[i].new_name);
}
}

View File

@ -1,29 +0,0 @@
/* 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__PDB_H__
#define __GIMP__PDB_H__
void gimp_pdb_initialize (Gimp *gimp);
void gimp_pdb_exit (Gimp *gimp);
void gimp_pdb_init_procs (Gimp *gimp);
#endif /* __GIMP__PDB_H__ */

View File

@ -40,7 +40,7 @@
#include "gimpprocedure.h" #include "gimpprocedure.h"
#include "gimptemporaryprocedure.h" /* eek */ #include "gimptemporaryprocedure.h" /* eek */
#include "gimp-pdb.h" /* eek */ #include "gimp-pdb-compat.h" /* eek */
#include "gimp-intl.h" #include "gimp-intl.h"
@ -51,7 +51,7 @@ gimp_pdb_eek (void)
volatile GType eek; volatile GType eek;
eek = gimp_temporary_procedure_get_type (); eek = gimp_temporary_procedure_get_type ();
gimp_pdb_exit (NULL); gimp_pdb_compat_procs_register (NULL, 0);
} }