Commit 3b639b1d authored by Michael Natterer's avatar Michael Natterer 😴

pdb: move PDB generation and sources to toplevel/pdb

It never belonged inside "tools". Also rename its "pdb" subdirectory
to "groups". This had to happen before 2.10 so cherry-picking between
branches doesn't become a nightmare in the future.
parent 89a9d0e9
......@@ -116,7 +116,7 @@ sources. All those files have a short notice about being generated
somewhere at the top. Among them are the files ending in pdb.[ch] in
the libgimp directory and the files ending in cmds.c in the app/pdb
subdirectory. Those are generated from the respective .pdb files in
tools/pdbgen/pdb.
pdb/groups.
Hackordnung
......
......@@ -2,6 +2,10 @@
ACLOCAL_AMFLAGS = -I m4macros ${ACLOCAL_FLAGS}
if WITH_PDBGEN
PDB = pdb
endif
SUBDIRS = \
m4macros \
cursors \
......@@ -17,6 +21,7 @@ SUBDIRS = \
menus \
libgimpbase \
tools \
$(PDB) \
icons \
libgimpcolor \
libgimpmath \
......
......@@ -118,7 +118,7 @@ app_libs_init (GOptionContext *context,
}
#endif
/* keep compat enum code in sync with tools/pdbgen/enumcode.pl */
/* keep compat enum code in sync with pdb/enumcode.pl */
quark = g_quark_from_static_string ("gimp-compat-enum");
g_type_set_qdata (GIMP_TYPE_CONVERT_DITHER_TYPE, quark,
......
......@@ -20,7 +20,7 @@
#if 0
This file is parsed by two scripts, enumgen.pl in tools/pdbgen,
This file is parsed by two scripts, enumgen.pl in pdb,
and gimp-mkenums. All enums that are not marked with
/*< pdb-skip >*/ are exported to libgimp and the PDB. Enums that are
not marked with /*< skip >*/ are registered with the GType system.
......
......@@ -19,7 +19,7 @@
#define __PAINT_ENUMS_H__
#if 0
This file is parsed by two scripts, enumgen.pl in tools/pdbgen,
This file is parsed by two scripts, enumgen.pl in pdb,
and gimp-mkenums. All enums that are not marked with
/*< pdb-skip >*/ are exported to libgimp and the PDB. Enums that are
not marked with /*< skip >*/ are registered with the GType system.
......
......@@ -3,5 +3,5 @@ Gimp functions.
THESE FILES ARE AUTOGENERATED AND CHANGES HERE ARE USELESS!
If you need to change the code please have a look in ../../tools/pdbgen/pdb.
If you need to change the code please have a look in ../../pdb/groups.
......@@ -2480,7 +2480,7 @@ _______EOF
AC_CONFIG_FILES([
INSTALL
tools/Makefile
tools/pdbgen/Makefile
pdb/Makefile
libgimp/Makefile
libgimpbase/Makefile
libgimpconfig/Makefile
......
PDBGEN_BACKUP = 0
PDBGEN_GROUPS =
pdb_sources = \
pdb/brush.pdb \
pdb/brush_select.pdb \
pdb/brushes.pdb \
pdb/buffer.pdb \
pdb/channel.pdb \
pdb/color.pdb \
pdb/context.pdb \
pdb/debug.pdb \
pdb/display.pdb \
pdb/drawable.pdb \
pdb/drawable_color.pdb \
pdb/drawable_transform.pdb \
pdb/dynamics.pdb \
pdb/edit.pdb \
pdb/fileops.pdb \
pdb/floating_sel.pdb \
pdb/font_select.pdb \
pdb/fonts.pdb \
pdb/gimp.pdb \
pdb/gimprc.pdb \
pdb/gradient.pdb \
pdb/gradient_select.pdb \
pdb/gradients.pdb \
pdb/help.pdb \
pdb/image.pdb \
pdb/image_color_profile.pdb \
pdb/image_convert.pdb \
pdb/image_grid.pdb \
pdb/image_guides.pdb \
pdb/image_sample_points.pdb \
pdb/image_select.pdb \
pdb/image_transform.pdb \
pdb/image_undo.pdb \
pdb/item.pdb \
pdb/item_transform.pdb \
pdb/layer.pdb \
pdb/message.pdb \
pdb/paint_tools.pdb \
pdb/palette.pdb \
pdb/palette_select.pdb \
pdb/palettes.pdb \
pdb/paths.pdb \
pdb/pattern.pdb \
pdb/pattern_select.pdb \
pdb/patterns.pdb \
pdb/plug_in.pdb \
pdb/plug_in_compat.pdb \
pdb/procedural_db.pdb \
pdb/progress.pdb \
pdb/selection.pdb \
pdb/selection_tools.pdb \
pdb/text_layer.pdb \
pdb/text_tool.pdb \
pdb/transform_tools.pdb \
pdb/unit.pdb \
pdb/vectors.pdb
pdb_groups = \
groups/brush.pdb \
groups/brush_select.pdb \
groups/brushes.pdb \
groups/buffer.pdb \
groups/channel.pdb \
groups/color.pdb \
groups/context.pdb \
groups/debug.pdb \
groups/display.pdb \
groups/drawable.pdb \
groups/drawable_color.pdb \
groups/drawable_transform.pdb \
groups/dynamics.pdb \
groups/edit.pdb \
groups/fileops.pdb \
groups/floating_sel.pdb \
groups/font_select.pdb \
groups/fonts.pdb \
groups/gimp.pdb \
groups/gimprc.pdb \
groups/gradient.pdb \
groups/gradient_select.pdb \
groups/gradients.pdb \
groups/help.pdb \
groups/image.pdb \
groups/image_color_profile.pdb \
groups/image_convert.pdb \
groups/image_grid.pdb \
groups/image_guides.pdb \
groups/image_sample_points.pdb \
groups/image_select.pdb \
groups/image_transform.pdb \
groups/image_undo.pdb \
groups/item.pdb \
groups/item_transform.pdb \
groups/layer.pdb \
groups/message.pdb \
groups/paint_tools.pdb \
groups/palette.pdb \
groups/palette_select.pdb \
groups/palettes.pdb \
groups/paths.pdb \
groups/pattern.pdb \
groups/pattern_select.pdb \
groups/patterns.pdb \
groups/plug_in.pdb \
groups/plug_in_compat.pdb \
groups/procedural_db.pdb \
groups/progress.pdb \
groups/selection.pdb \
groups/selection_tools.pdb \
groups/text_layer.pdb \
groups/text_tool.pdb \
groups/transform_tools.pdb \
groups/unit.pdb \
groups/vectors.pdb
EXTRA_DIST = \
README \
......@@ -72,14 +72,14 @@ EXTRA_DIST = \
pdbgen.pl \
stddefs.pdb \
util.pl \
$(pdb_sources)
$(pdb_groups)
enum_headers = \
../../libgimpbase/gimpbaseenums.h \
../../libgimpconfig/gimpconfigenums.h \
../../app/operations/operations-enums.h \
../../app/core/core-enums.h \
../../app/paint/paint-enums.h
../libgimpbase/gimpbaseenums.h \
../libgimpconfig/gimpconfigenums.h \
../app/operations/operations-enums.h \
../app/core/core-enums.h \
../app/paint/paint-enums.h
pdb_scripts = \
pdbgen.pl \
......@@ -125,8 +125,8 @@ stamp-groups: Makefile.am
rootme=`pwd`; cd $(srcdir) \
&& echo "# This file is autogenerated" > $$rootme/groups.pl.tmp \
&& echo "@groups = qw(" >> $$rootme/groups.pl.tmp \
&& (for pdb in $(pdb_sources); do \
group=`echo $$pdb | sed -e 's%pdb/\([^.]*\)\..*%\1%'`; \
&& (for pdb in $(pdb_groups); do \
group=`echo $$pdb | sed -e 's%groups/\([^.]*\)\..*%\1%'`; \
echo " $$group" >> $$rootme/groups.pl.tmp; \
done) \
&& echo ");" >> $$rootme/groups.pl.tmp \
......@@ -135,7 +135,7 @@ stamp-groups: Makefile.am
&& rm $$rootme/groups.pl.tmp \
&& echo timestamp > $$rootme/stamp-groups
stamp-pdbgen: $(pdbgen_deps) $(pdb_scripts) $(pdb_sources) Makefile.am
stamp-pdbgen: $(pdbgen_deps) $(pdb_scripts) $(pdb_groups) Makefile.am
rootme=`pwd`; \
destdir=`cd $(top_srcdir) && pwd`; export destdir; \
builddir=`cd $(top_builddir) && pwd`; export builddir; \
......
......@@ -63,7 +63,7 @@ http://git.gnome.org/browse/gimp/tree/tools/pdbgen/pdb[tools/pdbgen/pdb].
You can see many files with the .pdb suffix - these are special template
files which include the actual source of the PDB functions. Let's take a
quick look at one of these - text_layer_get_text in
http://git.gnome.org/browse/gimp/tree/tools/pdbgen/pdb/text_layer.pdb[tools/pdbgen/pdb/text_layer.pdb].
http://git.gnome.org/browse/gimp/tree/pdb/groups/text_layer.pdb[pdb/groups/text_layer.pdb].
[source,perl]
----
......@@ -337,7 +337,7 @@ this can be done automatically for you if the desired enum is one of the
enums which are already used by GIMP.
To make it clearer, let's take a look at +layer_get_mode+ in
http://git.gnome.org/browse/gimp/tree/tools/pdbgen/pdb/layer.pdb[tools/pdbgen/pdb/layer.pdb]:
http://git.gnome.org/browse/gimp/tree/pdb/groups/layer.pdb[pdb/groups/layer.pdb]:
[source,perl]
----
......@@ -388,7 +388,7 @@ function, and by that we can make sure it won't be called with values
out of range (GIMP will make sure the values are inside the specified
range before it calls our function). To see an example, let's take look
at the procedure image_new from
http://git.gnome.org/browse/gimp/tree/tools/pdbgen/pdb/image.pdb[tools/pdbgen/pdb/image.pdb]:
http://git.gnome.org/browse/gimp/tree/pdb/groups/image.pdb[pdb/groups/image.pdb]:
[source,perl]
----
......@@ -435,7 +435,7 @@ function which receives an array. Array arguments are specified in a
special way which is a bit different than the other arguments. To see
how array arguments are specified, let's take a look at the +@outargs+
of +vectors_stroke_get_points+ from
http://git.gnome.org/browse/gimp/tree/tools/pdbgen/pdb/vectors.pdb[tools/pdbgen/pdb/vectors.pdb]:
http://git.gnome.org/browse/gimp/tree/pdb/groups/vectors.pdb[pdb/groups/vectors.pdb]:
[source,perl]
----
......
......@@ -89,7 +89,7 @@ $evalcode = <<'CODE';
foreach (@groupvars) { eval "undef $_" }
# Load the file in and get the group info
&$safeeval("require '$main::srcdir/pdb/$file.pdb'");
&$safeeval("require '$main::srcdir/groups/$file.pdb'");
# Save these for later
&$copyvars(\$grp{$file}, @groupvars);
......@@ -120,7 +120,7 @@ CODE
# Slurp in the PDB defs
foreach $file (@groups) {
print "Processing $srcdir/pdb/$file.pdb...\n";
print "Processing $srcdir/groups/$file.pdb...\n";
eval "package Gimp::CodeGen::Safe::$file; $evalcode;";
die $@ if $@;
}
......
#!/usr/bin/perl -w
use lib '../../tools/pdbgen';
use lib '../../pdb';
require 'util.pl';
......
......@@ -2,12 +2,6 @@
libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
if WITH_PDBGEN
PDBGEN = pdbgen
endif
SUBDIRS = $(PDBGEN)
if OS_WIN32
bin_PROGRAMS = \
......@@ -94,4 +88,3 @@ EXTRA_DIST = \
gimp-mkenums \
gimppath2svg.py \
invert-svg.c
This diff is collapsed.
# GIMP - The GNU 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 3 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, see <http://www.gnu.org/licenses/>.
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
sub brushes_popup {
$blurb = 'Invokes the Gimp brush selection.';
$help = 'This procedure opens the brush selection dialog.';
&andy_pdb_misc('1998');
@inargs = (
{ name => 'brush_callback', type => 'string', non_empty => 1,
desc => 'The callback PDB proc to call when brush selection is
made' },
{ name => 'popup_title', type => 'string',
desc => 'Title of the brush selection dialog' },
{ name => 'initial_brush', type => 'string', null_ok => 1,
desc => 'The name of the brush to set as the first selected' },
{ name => 'opacity', type => '0 <= float <= 100',
desc => 'The initial opacity of the brush' },
{ name => 'spacing', type => 'int32 <= 1000',
desc => 'The initial spacing of the brush (if < 0 then use brush
default spacing)' },
{ name => 'paint_mode', type => 'enum GimpLayerMode',
default => 'GIMP_LAYER_MODE_NORMAL',
desc => 'The initial paint mode' }
);
%invoke = (
code => <<'CODE'
{
if (paint_mode == GIMP_LAYER_MODE_OVERLAY_LEGACY)
paint_mode = GIMP_LAYER_MODE_SOFTLIGHT_LEGACY;
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, brush_callback) ||
! gimp_pdb_dialog_new (gimp, context, progress,
gimp_data_factory_get_container (gimp->brush_factory),
popup_title, brush_callback, initial_brush,
"opacity", opacity / 100.0,
"paint-mode", paint_mode,
"spacing", spacing,
NULL))
success = FALSE;
}
CODE
);
}
sub brushes_close_popup {
$blurb = 'Close the brush selection dialog.';
$help = 'This procedure closes an opened brush selection dialog.';
&andy_pdb_misc('1998');
@inargs = (
{ name => 'brush_callback', type => 'string', non_empty => 1,
desc => 'The name of the callback registered for this pop-up' }
);
%invoke = (
code => <<'CODE'
{
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, brush_callback) ||
! gimp_pdb_dialog_close (gimp, gimp_data_factory_get_container (gimp->brush_factory),
brush_callback))
success = FALSE;
}
CODE
);
}
sub brushes_set_popup {
$blurb = 'Sets the current brush in a brush selection dialog.';
$help = $blurb;
&andy_pdb_misc('1998');
@inargs = (
{ name => 'brush_callback', type => 'string', non_empty => 1,
desc => 'The name of the callback registered for this pop-up' },
{ name => 'brush_name', type => 'string',
desc => 'The name of the brush to set as selected' },
{ name => 'opacity', type => '0 <= float <= 100',
desc => 'The initial opacity of the brush' },
{ name => 'spacing', type => 'int32 <= 1000',
desc => 'The initial spacing of the brush (if < 0 then use brush
default spacing)' },
{ name => 'paint_mode', type => 'enum GimpLayerMode',
default => 'GIMP_LAYER_MODE_NORMAL',
desc => 'The initial paint mode' }
);
%invoke = (
code => <<'CODE'
{
if (paint_mode == GIMP_LAYER_MODE_OVERLAY_LEGACY)
paint_mode = GIMP_LAYER_MODE_SOFTLIGHT_LEGACY;
if (gimp->no_interface ||
! gimp_pdb_lookup_procedure (gimp->pdb, brush_callback) ||
! gimp_pdb_dialog_set (gimp, gimp_data_factory_get_container (gimp->brush_factory),
brush_callback, brush_name,
"opacity", opacity / 100.0,
"paint-mode", paint_mode,
"spacing", spacing,
NULL))
success = FALSE;
}
CODE
);
}
@headers = qw("core/gimp.h"
"core/gimpdatafactory.h");
@procs = qw(brushes_popup
brushes_close_popup
brushes_set_popup);
%exports = (app => [@procs], lib => [@procs]);
$desc = 'Brush UI';
$doc_title = 'gimpbrushselect';
$doc_short_desc = 'Functions providing a brush selection dialog.';
$doc_long_desc = 'Functions providing a brush selection dialog.';
1;
# GIMP - The GNU 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 3 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, see <http://www.gnu.org/licenses/>.
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
sub brushes_refresh {
$blurb = 'Refresh current brushes. This function always succeeds.';
$help = <<'HELP';
This procedure retrieves all brushes currently in the user's brush path
and updates the brush dialogs accordingly.
HELP
&seth_pdb_misc('1997');
%invoke = (
code => <<'CODE'
{
gimp_data_factory_data_refresh (gimp->brush_factory, context);
}
CODE
);
}
sub brushes_get_list {
$blurb = 'Retrieve a complete listing of the available brushes.';
$help = <<'HELP';
This procedure returns a complete listing of available GIMP
brushes. Each name returned can be used as input to the
gimp_context_set_brush() procedure.
HELP
&std_pdb_misc;
@inargs = (
{ name => 'filter', type => 'string', null_ok => 1,
desc => 'An optional regular expression used to filter the list' }
);
@outargs = (
{ name => 'brush_list', type => 'stringarray',
desc => 'The list of brush names',
array => { name => 'num_brushes',
desc => 'The number of brushes in the brush list' } }
);
%invoke = (
headers => [ qw("core/gimpcontainer-filter.h") ],
code => <<'CODE'
{
brush_list = gimp_container_get_filtered_name_array (gimp_data_factory_get_container (gimp->brush_factory),
filter, &num_brushes);
}
CODE
);
}
sub brushes_get_brush {
&std_pdb_deprecated ('gimp-context-get-brush');
@outargs = (
{ name => 'name', type => 'string',
desc => 'The brush name' },
{ name => 'width', type => 'int32',
desc => 'The brush width' },
{ name => 'height', type => 'int32',
desc => 'The brush height' },
{ name => 'spacing', type => '0 <= int32 <= 1000',
desc => 'The brush spacing' }
);
%invoke = (
code => <<'CODE'
{
GimpBrush *brush = gimp_context_get_brush (context);
if (brush)
{
name = g_strdup (gimp_object_get_name (brush));
width = gimp_brush_get_width (brush);
height = gimp_brush_get_height (brush);
spacing = gimp_brush_get_spacing (brush);
}
else
success = FALSE;
}
CODE
);
}
sub brushes_get_spacing {
&std_pdb_deprecated ('gimp-brush-get-spacing');
@outargs = (
{ name => 'spacing', type => '0 <= int32 <= 1000',
desc => 'The brush spacing' }
);
%invoke = (
code =><<'CODE'
{
GimpBrush *brush = gimp_context_get_brush (context);
if (brush)
spacing = gimp_brush_get_spacing (brush);
else
success = FALSE;
}
CODE
);
}
sub brushes_set_spacing {
&std_pdb_deprecated ('gimp-brush-set-spacing');
@inargs = (
{ name => 'spacing', type => '0 <= int32 <= 1000',
desc => 'The brush spacing' }
);
%invoke = (
code => <<'CODE'
{
gimp_brush_set_spacing (gimp_context_get_brush (context), spacing);
}
CODE
);
}
sub brushes_get_brush_data {
&std_pdb_deprecated ('gimp-brush-get-pixels');
@inargs = (
{ name => 'name', type => 'string', null_ok => 1,
desc => 'The brush name ("" means current active brush)' }
);
@outargs = (
{ name => 'actual_name', type => 'string',
desc => 'The brush name' },
{ name => 'opacity', type => '0 <= float <= 100',
desc => 'The brush opacity' },
{ name => 'spacing', type => '0 <= int32 <= 1000',
desc => 'The brush spacing' },
{ name => 'paint_mode', type => 'enum GimpLayerMode',
default => 'GIMP_LAYER_MODE_NORMAL',
desc => 'The paint mode' },
{ name => 'width', type => 'int32',
desc => 'The brush width' },
{ name => 'height', type => 'int32',
desc => 'The brush height' },
{ name => 'mask_data', type => 'int8array',
desc => 'The brush mask data',
array => { name => 'length',
desc => 'Length of brush mask data' } }
);
%invoke = (
code => <<'CODE'
{
GimpBrush *brush;
if (paint_mode == GIMP_LAYER_MODE_OVERLAY_LEGACY)
paint_mode = GIMP_LAYER_MODE_SOFTLIGHT_LEGACY;
if (name && strlen (name))
brush = gimp_pdb_get_brush (gimp, name, FALSE, error);
else
brush = gimp_context_get_brush (context);
if (brush)
{
GimpTempBuf *mask = gimp_brush_get_mask (brush);
actual_name = g_strdup (gimp_object_get_name (brush));
opacity = 1.0;
spacing = gimp_brush_get_spacing (brush);
paint_mode = 0;
width = gimp_brush_get_width (brush);
height = gimp_brush_get_height (brush);
length = gimp_temp_buf_get_data_size (mask);
mask_data = g_memdup (gimp_temp_buf_get_data (mask), length);
}
else
success = FALSE;
}
CODE
);
}
@headers = qw(<string.h>
"core/gimp.h"
"core/gimpbrush.h"
"core/gimpcontext.h"
"core/gimpdatafactory.h"
"core/gimptempbuf.h"
"gimppdb-utils.h");
@procs = qw(brushes_refresh
brushes_get_list
brushes_get_brush
brushes_get_spacing brushes_set_spacing
brushes_get_brush_data);
%exports = (app => [@procs], lib => [@procs]);
$desc = 'Brushes';
$doc_title = 'gimpbrushes';
$doc_short_desc = 'Functions for manipulating brushes.';
$doc_long_desc = 'Functions related to getting and setting brushes.';
1;
# GIMP - The GNU 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 3 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, see <http://www.gnu.org/licenses/>.
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
sub buffers_get_list {
$blurb = 'Retrieve a complete listing of the available buffers.';
$help = <<'HELP';
This procedure returns a complete listing of available named buffers.
HELP
&mitch_pdb_misc('2005', '2.4');
@inargs = (
{ name => 'filter', type => 'string', null_ok => 1,
desc => 'An optional regular expression used to filter the list' }
);
@outargs = (
{ name => 'buffer_list', type => 'stringarray',
desc => 'The list of buffer names',