1999-04-27 04:33:41 +00: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
|
|
|
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
|
|
|
|
|
|
|
|
sub pdb_misc {
|
|
|
|
$author = $copyright = 'Adam D. Moss';
|
|
|
|
$date = '1998';
|
|
|
|
}
|
|
|
|
|
|
|
|
sub image_add_guide {
|
2003-03-28 13:52:01 +00:00
|
|
|
my ($desc, $type, $max, $pos) = @_;
|
1999-04-27 04:33:41 +00:00
|
|
|
|
|
|
|
$blurb = "Add a $desc guide to an image.";
|
|
|
|
|
|
|
|
$help = <<HELP;
|
|
|
|
This procedure adds a $desc guide to an image. It takes the input image and the
|
|
|
|
$type-position of the new guide as parameters. It returns the guide ID of the
|
|
|
|
new guide.
|
|
|
|
HELP
|
|
|
|
|
|
|
|
&pdb_misc;
|
|
|
|
|
|
|
|
@inargs = (
|
|
|
|
&std_image_arg,
|
2003-03-07 16:18:55 +00:00
|
|
|
{ name => "${type}position", type => '0 <= int32',
|
1999-04-27 04:33:41 +00:00
|
|
|
desc => "The guide's ${type}-offset from $pos of image",
|
|
|
|
alias => 'offset' }
|
|
|
|
);
|
|
|
|
|
|
|
|
@outargs = (
|
2000-01-17 20:25:55 +00:00
|
|
|
{ name => 'guide', type => 'guide', init => 1, alias => 'guide_ID',
|
1999-04-27 04:33:41 +00:00
|
|
|
desc => 'The new guide' }
|
|
|
|
);
|
|
|
|
|
|
|
|
my $func = substr($desc, 0, 1);
|
|
|
|
%invoke = (
|
2001-05-15 19:10:57 +00:00
|
|
|
vars => [ 'GimpGuide *guide' ],
|
1999-04-27 04:33:41 +00:00
|
|
|
code => <<CODE
|
|
|
|
{
|
2003-03-30 13:09:57 +00:00
|
|
|
if (offset <= gimage->$max)
|
1999-04-27 04:33:41 +00:00
|
|
|
{
|
2003-03-28 13:52:01 +00:00
|
|
|
guide = gimp_image_add_${func}guide (gimage, offset, TRUE);
|
2000-01-17 20:25:55 +00:00
|
|
|
guide_ID = guide->guide_ID;
|
1999-04-27 04:33:41 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
success = FALSE;
|
|
|
|
}
|
|
|
|
CODE
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
# The defs
|
|
|
|
|
|
|
|
sub image_add_hguide {
|
2003-03-28 13:52:01 +00:00
|
|
|
&image_add_guide('horizontal', 'y', 'height', 'top');
|
1999-04-27 04:33:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sub image_add_vguide {
|
2003-03-28 13:52:01 +00:00
|
|
|
&image_add_guide('vertical', 'x', 'width', 'left');
|
1999-04-27 04:33:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sub image_delete_guide {
|
|
|
|
$blurb = 'Deletes a guide from an image.';
|
|
|
|
|
|
|
|
$help = <<'HELP';
|
|
|
|
This procedure takes an image and a guide ID as input and removes the specified
|
|
|
|
guide from the specified image.
|
|
|
|
HELP
|
|
|
|
|
|
|
|
&pdb_misc;
|
|
|
|
|
|
|
|
@inargs = (
|
|
|
|
&std_image_arg,
|
|
|
|
{ name => 'guide', type => 'guide',
|
|
|
|
desc => 'The ID of the guide to be removed' }
|
|
|
|
);
|
|
|
|
|
|
|
|
%invoke = (
|
|
|
|
vars => [ 'GList *guides' ],
|
|
|
|
code => <<'CODE'
|
|
|
|
{
|
|
|
|
success = FALSE;
|
|
|
|
|
2003-02-14 14:14:29 +00:00
|
|
|
for (guides = gimage->guides; guides; guides = g_list_next (guides))
|
1999-04-27 04:33:41 +00:00
|
|
|
{
|
2003-02-14 14:14:29 +00:00
|
|
|
GimpGuide *g = (GimpGuide *) guides->data;
|
|
|
|
|
|
|
|
if ((g->guide_ID == guide) && (g->position >= 0))
|
1999-04-27 04:33:41 +00:00
|
|
|
{
|
2003-03-28 13:52:01 +00:00
|
|
|
gimp_image_remove_guide (gimage, g, TRUE);
|
1999-04-27 04:33:41 +00:00
|
|
|
success = TRUE;
|
2003-02-14 14:14:29 +00:00
|
|
|
break;
|
1999-04-27 04:33:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CODE
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
sub image_find_next_guide {
|
|
|
|
$blurb = 'Find next guide on an image.';
|
|
|
|
|
|
|
|
$help = <<'HELP';
|
|
|
|
This procedure takes an image and a guide ID as input and finds the guide ID of
|
|
|
|
the successor of the given guide ID in the image's guide list. If the supplied
|
|
|
|
guide ID is 0, the procedure will return the first Guide. The procedure will
|
|
|
|
return 0 if given the final guide ID as an argument or the image has no guides.
|
|
|
|
HELP
|
|
|
|
|
|
|
|
&pdb_misc;
|
|
|
|
|
|
|
|
@inargs = (
|
|
|
|
&std_image_arg,
|
|
|
|
{ name => 'guide', type => 'guide',
|
|
|
|
desc => 'The ID of the current guide (0 if first invocation)' }
|
|
|
|
);
|
|
|
|
|
|
|
|
@outargs = (
|
|
|
|
{ name => 'next_guide', type => 'guide', init => 1,
|
|
|
|
desc => "The next guide's ID" }
|
|
|
|
);
|
|
|
|
|
|
|
|
%invoke = (
|
2003-02-14 14:14:29 +00:00
|
|
|
vars => [ 'GList *guides', 'gboolean guide_found' ],
|
1999-04-27 04:33:41 +00:00
|
|
|
code => <<'CODE'
|
|
|
|
{
|
2003-03-07 02:50:08 +00:00
|
|
|
if (gimage->guides != NULL)
|
1999-04-27 04:33:41 +00:00
|
|
|
{
|
2003-03-07 02:50:08 +00:00
|
|
|
success = FALSE;
|
|
|
|
guide_found = FALSE;
|
1999-04-27 04:33:41 +00:00
|
|
|
|
2003-03-07 02:50:08 +00:00
|
|
|
for (guides = gimage->guides; guides; guides = g_list_next (guides))
|
2003-02-14 14:14:29 +00:00
|
|
|
{
|
2003-03-07 02:50:08 +00:00
|
|
|
GimpGuide *g = (GimpGuide *) guides->data;
|
|
|
|
|
|
|
|
if (g->position < 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (guide == 0) /* init - Return first guide ID in list */
|
|
|
|
{
|
|
|
|
next_guide = g->guide_ID;
|
|
|
|
|
|
|
|
guide_found = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! guide_found)
|
|
|
|
{
|
|
|
|
if (g->guide_ID == guide)
|
|
|
|
guide_found = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
next_guide = g->guide_ID;
|
2003-05-11 13:47:16 +00:00
|
|
|
break;
|
2003-03-07 02:50:08 +00:00
|
|
|
}
|
2003-02-14 14:14:29 +00:00
|
|
|
}
|
1999-04-27 04:33:41 +00:00
|
|
|
|
2003-03-07 02:50:08 +00:00
|
|
|
if (guide_found)
|
|
|
|
success = TRUE;
|
1999-04-27 04:33:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
CODE
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
sub image_get_guide_orientation {
|
|
|
|
$blurb = 'Get orientation of a guide on an image.';
|
|
|
|
|
|
|
|
$help = <<'HELP';
|
|
|
|
This procedure takes an image and a guide ID as input and returns the
|
|
|
|
orientations of the guide.
|
|
|
|
HELP
|
|
|
|
|
|
|
|
&pdb_misc;
|
|
|
|
|
|
|
|
@inargs = (
|
|
|
|
&std_image_arg,
|
|
|
|
{ name => 'guide', type => 'guide',
|
|
|
|
desc => 'The guide' }
|
|
|
|
);
|
|
|
|
|
|
|
|
@outargs = (
|
2000-01-17 20:25:55 +00:00
|
|
|
{ name => 'orientation', type => &std_orientation_enum, init => 1,
|
|
|
|
desc => "The guide's orientation: { %%desc%% }",
|
2003-02-09 21:03:36 +00:00
|
|
|
libdef => 'GIMP_ORIENTATION_UNKNOWN' }
|
1999-04-27 04:33:41 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
%invoke = (
|
|
|
|
vars => [ 'GList *guides' ],
|
|
|
|
code => <<'CODE'
|
|
|
|
{
|
|
|
|
success = FALSE;
|
|
|
|
|
2003-02-14 14:14:29 +00:00
|
|
|
for (guides = gimage->guides; guides; guides = g_list_next (guides))
|
1999-04-27 04:33:41 +00:00
|
|
|
{
|
2003-02-14 14:14:29 +00:00
|
|
|
GimpGuide *g = (GimpGuide *) guides->data;
|
|
|
|
|
|
|
|
if ((g->guide_ID == guide) && (g->position >= 0))
|
1999-04-27 04:33:41 +00:00
|
|
|
{
|
2003-02-14 14:14:29 +00:00
|
|
|
orientation = g->orientation;
|
|
|
|
|
1999-04-27 04:33:41 +00:00
|
|
|
success = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CODE
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
sub image_get_guide_position {
|
|
|
|
$blurb = 'Get position of a guide on an image.';
|
|
|
|
|
|
|
|
$help = <<'HELP';
|
|
|
|
This procedure takes an image and a guide ID as input and returns the position
|
|
|
|
of the guide relative to the top or left of the image.
|
|
|
|
HELP
|
|
|
|
|
|
|
|
&pdb_misc;
|
|
|
|
|
|
|
|
@inargs = (
|
|
|
|
&std_image_arg,
|
|
|
|
{ name => 'guide', type => 'guide',
|
|
|
|
desc => 'The guide' }
|
|
|
|
);
|
|
|
|
|
|
|
|
@outargs = (
|
2000-01-17 20:25:55 +00:00
|
|
|
{ name => 'position', type => 'int32', init => 1, libdef => '-1',
|
1999-04-27 04:33:41 +00:00
|
|
|
desc => "The guide's position relative to top or left of image" }
|
|
|
|
);
|
|
|
|
|
|
|
|
%invoke = (
|
|
|
|
vars => [ 'GList *guides' ],
|
|
|
|
code => <<'CODE'
|
|
|
|
{
|
|
|
|
success = FALSE;
|
|
|
|
|
2003-02-14 14:14:29 +00:00
|
|
|
for (guides = gimage->guides; guides; guides = g_list_next (guides))
|
1999-04-27 04:33:41 +00:00
|
|
|
{
|
2003-02-14 14:14:29 +00:00
|
|
|
GimpGuide *g = (GimpGuide *) guides->data;
|
|
|
|
|
|
|
|
if ((g->guide_ID == guide) && (g->position >= 0))
|
1999-04-27 04:33:41 +00:00
|
|
|
{
|
2003-02-14 14:14:29 +00:00
|
|
|
position = g->position;
|
|
|
|
|
1999-04-27 04:33:41 +00:00
|
|
|
success = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CODE
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2004-07-16 14:43:56 +00:00
|
|
|
@headers = qw("core/gimpimage-guides.h" "core/gimpimage-undo-push.h");
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-28 17:51:06 +00:00
|
|
|
|
1999-04-27 04:33:41 +00:00
|
|
|
@procs = qw(image_add_hguide image_add_vguide image_delete_guide
|
|
|
|
image_find_next_guide image_get_guide_orientation
|
|
|
|
image_get_guide_position);
|
1999-12-26 07:54:39 +00:00
|
|
|
%exports = (app => [@procs], lib => [@procs]);
|
1999-04-27 04:33:41 +00:00
|
|
|
|
|
|
|
$desc = 'Guide procedures';
|
|
|
|
|
|
|
|
1;
|