1999-03-10 10:56:56 -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
|
|
|
|
|
# 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 = 'Andy Thomas';
|
|
|
|
|
$date = '1998';
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-03 21:59:08 -08:00
|
|
|
sub sample_size_arg {{
|
|
|
|
|
name => 'sample_size',
|
|
|
|
|
type => '0 < int32 <= 10000',
|
|
|
|
|
desc => 'Size of the sample to return when the gradient is changed
|
|
|
|
|
(%%desc%%)',
|
2001-10-25 14:59:52 -07:00
|
|
|
on_fail => 'sample_size = GIMP_GRADIENT_DEFAULT_SAMPLE_SIZE;',
|
1999-04-03 21:59:08 -08:00
|
|
|
no_success => 1
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
|
|
sub gradients_popup {
|
|
|
|
|
$blurb = 'Invokes the Gimp gradients selection.';
|
|
|
|
|
|
|
|
|
|
$help = 'This procedure popups the gradients selection dialog.';
|
|
|
|
|
|
|
|
|
|
&pdb_misc;
|
|
|
|
|
|
|
|
|
|
@inargs = (
|
2002-03-12 13:02:10 -08:00
|
|
|
{ name => 'gradient_callback', type => 'string',
|
2003-08-19 12:08:11 -07:00
|
|
|
desc => 'The callback PDB proc to call when gradient selection is
|
|
|
|
|
made' },
|
2002-03-12 13:02:10 -08:00
|
|
|
{ name => 'popup_title', type => 'string',
|
2003-08-19 12:08:11 -07:00
|
|
|
desc => 'Title to give the gradient popup window' },
|
1999-04-03 21:59:08 -08:00
|
|
|
{ name => 'initial_gradient', type => 'string',
|
|
|
|
|
desc => 'The name of the pattern to set as the first selected',
|
2003-08-19 12:08:11 -07:00
|
|
|
null_ok => 1 },
|
1999-04-03 21:59:08 -08:00
|
|
|
&sample_size_arg
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
%invoke = (
|
2002-03-13 07:29:59 -08:00
|
|
|
vars => [ 'ProcRecord *proc' ],
|
1999-04-03 21:59:08 -08:00
|
|
|
code => <<'CODE'
|
|
|
|
|
{
|
2002-03-13 07:29:59 -08:00
|
|
|
if (! gimp->no_interface &&
|
|
|
|
|
(proc = procedural_db_lookup (gimp, gradient_callback)))
|
1999-04-03 21:59:08 -08:00
|
|
|
{
|
2002-11-17 16:04:16 -08:00
|
|
|
gradient_select_new (gimp, popup_title,
|
|
|
|
|
initial_gradient,
|
|
|
|
|
gradient_callback,
|
|
|
|
|
sample_size);
|
1999-04-03 21:59:08 -08:00
|
|
|
}
|
|
|
|
|
else
|
2001-10-25 06:30:01 -07:00
|
|
|
{
|
|
|
|
|
success = FALSE;
|
|
|
|
|
}
|
1999-04-03 21:59:08 -08:00
|
|
|
}
|
|
|
|
|
CODE
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub gradients_close_popup {
|
|
|
|
|
$blurb = 'Popdown the Gimp gradient selection.';
|
|
|
|
|
|
|
|
|
|
$help = 'This procedure closes an opened gradient selection dialog.';
|
|
|
|
|
|
|
|
|
|
&pdb_misc;
|
|
|
|
|
|
|
|
|
|
@inargs = (
|
2002-03-12 13:02:10 -08:00
|
|
|
{ name => 'gradient_callback', type => 'string',
|
2003-08-19 12:08:11 -07:00
|
|
|
desc => 'The name of the callback registered for this popup' }
|
1999-04-03 21:59:08 -08:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
%invoke = (
|
2003-06-16 10:22:31 -07:00
|
|
|
vars => [ 'ProcRecord *prec', 'GradientSelect *gradient_select' ],
|
1999-04-03 21:59:08 -08:00
|
|
|
code => <<'CODE'
|
|
|
|
|
{
|
2002-03-13 07:29:59 -08:00
|
|
|
if (! gimp->no_interface &&
|
|
|
|
|
(prec = procedural_db_lookup (gimp, gradient_callback)) &&
|
2003-06-16 10:22:31 -07:00
|
|
|
(gradient_select = gradient_select_get_by_callback (gradient_callback)))
|
1999-04-03 21:59:08 -08:00
|
|
|
{
|
2003-06-16 10:22:31 -07:00
|
|
|
gradient_select_free (gradient_select);
|
1999-04-03 21:59:08 -08:00
|
|
|
}
|
|
|
|
|
else
|
2001-10-25 06:30:01 -07:00
|
|
|
{
|
|
|
|
|
success = FALSE;
|
|
|
|
|
}
|
1999-04-03 21:59:08 -08:00
|
|
|
}
|
|
|
|
|
CODE
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub gradients_set_popup {
|
|
|
|
|
$blurb = 'Sets the current gradient selection in a popup.';
|
|
|
|
|
|
|
|
|
|
$help = $blurb;
|
|
|
|
|
|
|
|
|
|
&pdb_misc;
|
|
|
|
|
|
|
|
|
|
@inargs = (
|
2002-03-12 13:02:10 -08:00
|
|
|
{ name => 'gradient_callback', type => 'string',
|
2003-08-19 12:08:11 -07:00
|
|
|
desc => 'The name of the callback registered for this popup' },
|
1999-04-03 21:59:08 -08:00
|
|
|
{ name => 'gradient_name', type => 'string',
|
2003-08-19 12:08:11 -07:00
|
|
|
desc => 'The name of the gradient to set as selected' }
|
1999-04-03 21:59:08 -08:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
%invoke = (
|
2003-06-16 10:22:31 -07:00
|
|
|
vars => [ 'ProcRecord *prec', 'GradientSelect *gradient_select' ],
|
1999-04-03 21:59:08 -08:00
|
|
|
code => <<'CODE'
|
|
|
|
|
{
|
2002-03-13 07:29:59 -08:00
|
|
|
if (! gimp->no_interface &&
|
|
|
|
|
(prec = procedural_db_lookup (gimp, gradient_callback)) &&
|
2003-06-16 10:22:31 -07:00
|
|
|
(gradient_select = gradient_select_get_by_callback (gradient_callback)))
|
1999-04-03 21:59:08 -08:00
|
|
|
{
|
2002-12-03 15:00:42 -08:00
|
|
|
GimpGradient *active = (GimpGradient *)
|
2001-07-04 12:31:35 -07:00
|
|
|
gimp_container_get_child_by_name (gimp->gradient_factory->container,
|
2001-02-10 11:35:29 -08:00
|
|
|
gradient_name);
|
1999-04-03 21:59:08 -08:00
|
|
|
|
2003-06-16 10:22:31 -07:00
|
|
|
if (active)
|
|
|
|
|
{
|
|
|
|
|
gimp_context_set_gradient (gradient_select->context, active);
|
2002-12-03 15:00:42 -08:00
|
|
|
|
2003-06-16 10:22:31 -07:00
|
|
|
gtk_window_present (GTK_WINDOW (gradient_select->shell));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
success = FALSE;
|
1999-04-03 21:59:08 -08:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
success = FALSE;
|
|
|
|
|
}
|
|
|
|
|
CODE
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2002-12-03 15:00:42 -08:00
|
|
|
@headers = qw("core/gimp.h" "core/gimpcontext.h"
|
2001-05-08 19:32:03 -07:00
|
|
|
"core/gimpcontainer.h" "core/gimpdatafactory.h"
|
2001-08-17 07:27:31 -07:00
|
|
|
"core/gimpgradient.h"
|
|
|
|
|
"gui/gui-types.h" "gui/gradient-select.h");
|
1999-04-03 21:59:08 -08:00
|
|
|
|
2001-10-25 14:59:52 -07:00
|
|
|
@procs = qw(gradients_popup gradients_close_popup gradients_set_popup);
|
1999-12-25 23:54:39 -08:00
|
|
|
%exports = (app => [@procs], lib => [@procs]);
|
1999-03-10 10:56:56 -08:00
|
|
|
|
|
|
|
|
$desc = 'Gradient UI';
|
|
|
|
|
|
|
|
|
|
1;
|