2006-12-10 05:33:38 +08:00
|
|
|
# GIMP - The GNU Image Manipulation Program
|
1999-03-11 02:56:56 +08:00
|
|
|
# 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>
|
|
|
|
|
1999-04-04 13:59:08 +08:00
|
|
|
sub gradients_popup {
|
|
|
|
$blurb = 'Invokes the Gimp gradients selection.';
|
2007-01-09 18:52:47 +08:00
|
|
|
$help = 'This procedure opens the gradient selection dialog.';
|
1999-04-04 13:59:08 +08:00
|
|
|
|
2006-03-15 05:35:50 +08:00
|
|
|
&andy_pdb_misc('1998');
|
1999-04-04 13:59:08 +08:00
|
|
|
|
|
|
|
@inargs = (
|
2002-03-13 05:02:10 +08:00
|
|
|
{ name => 'gradient_callback', type => 'string',
|
2003-08-20 03:08:11 +08:00
|
|
|
desc => 'The callback PDB proc to call when gradient selection is
|
|
|
|
made' },
|
2002-03-13 05:02:10 +08:00
|
|
|
{ name => 'popup_title', type => 'string',
|
2007-01-09 18:52:47 +08:00
|
|
|
desc => 'Title of the gradient selection dialog' },
|
1999-04-04 13:59:08 +08:00
|
|
|
{ name => 'initial_gradient', type => 'string',
|
2007-01-09 18:52:47 +08:00
|
|
|
desc => 'The name of the gradient to set as the first selected',
|
2003-08-20 03:08:11 +08:00
|
|
|
null_ok => 1 },
|
2006-03-18 18:28:39 +08:00
|
|
|
{ name => 'sample_size', type => '1 <= int32 <= 10000',
|
2006-05-19 01:25:15 +08:00
|
|
|
desc => 'Size of the sample to return when the gradient is changed',
|
2006-03-15 05:35:50 +08:00
|
|
|
no_success => 1 }
|
1999-04-04 13:59:08 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
%invoke = (
|
|
|
|
code => <<'CODE'
|
|
|
|
{
|
2006-03-18 18:28:39 +08:00
|
|
|
if (sample_size < 1 || sample_size > 10000)
|
|
|
|
sample_size = GIMP_GRADIENT_DEFAULT_SAMPLE_SIZE;
|
|
|
|
|
2004-07-10 03:14:59 +08:00
|
|
|
if (gimp->no_interface ||
|
2006-04-26 17:13:47 +08:00
|
|
|
! gimp_pdb_lookup_procedure (gimp->pdb, gradient_callback) ||
|
2006-09-22 17:24:41 +08:00
|
|
|
! gimp_pdb_dialog_new (gimp, context, progress,
|
|
|
|
gimp->gradient_factory->container,
|
2004-07-10 03:14:59 +08:00
|
|
|
popup_title, gradient_callback, initial_gradient,
|
|
|
|
"sample-size", sample_size,
|
|
|
|
NULL))
|
2003-12-08 19:58:45 +08:00
|
|
|
success = FALSE;
|
1999-04-04 13:59:08 +08:00
|
|
|
}
|
|
|
|
CODE
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
sub gradients_close_popup {
|
2007-01-09 18:52:47 +08:00
|
|
|
$blurb = 'Close the gradient selection dialog.';
|
2006-03-15 05:35:50 +08:00
|
|
|
$help = 'This procedure closes an opened gradient selection dialog.';
|
1999-04-04 13:59:08 +08:00
|
|
|
|
2006-03-15 05:35:50 +08:00
|
|
|
&andy_pdb_misc('1998');
|
1999-04-04 13:59:08 +08:00
|
|
|
|
|
|
|
@inargs = (
|
2002-03-13 05:02:10 +08:00
|
|
|
{ name => 'gradient_callback', type => 'string',
|
2007-01-09 18:52:47 +08:00
|
|
|
desc => 'The name of the callback registered for this pop-up' }
|
1999-04-04 13:59:08 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
%invoke = (
|
|
|
|
code => <<'CODE'
|
|
|
|
{
|
2004-07-10 03:14:59 +08:00
|
|
|
if (gimp->no_interface ||
|
2006-04-26 17:13:47 +08:00
|
|
|
! gimp_pdb_lookup_procedure (gimp->pdb, gradient_callback) ||
|
2004-07-10 03:14:59 +08:00
|
|
|
! gimp_pdb_dialog_close (gimp, gimp->gradient_factory->container,
|
|
|
|
gradient_callback))
|
2003-12-08 19:58:45 +08:00
|
|
|
success = FALSE;
|
1999-04-04 13:59:08 +08:00
|
|
|
}
|
|
|
|
CODE
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
sub gradients_set_popup {
|
2007-01-09 18:52:47 +08:00
|
|
|
$blurb = 'Sets the current gradient in a gradient selection dialog.';
|
2006-03-15 05:35:50 +08:00
|
|
|
$help = $blurb;
|
1999-04-04 13:59:08 +08:00
|
|
|
|
2006-03-15 05:35:50 +08:00
|
|
|
&andy_pdb_misc('1998');
|
1999-04-04 13:59:08 +08:00
|
|
|
|
|
|
|
@inargs = (
|
2002-03-13 05:02:10 +08:00
|
|
|
{ name => 'gradient_callback', type => 'string',
|
2007-01-09 18:52:47 +08:00
|
|
|
desc => 'The name of the callback registered for this pop-up' },
|
1999-04-04 13:59:08 +08:00
|
|
|
{ name => 'gradient_name', type => 'string',
|
2003-08-20 03:08:11 +08:00
|
|
|
desc => 'The name of the gradient to set as selected' }
|
1999-04-04 13:59:08 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
%invoke = (
|
|
|
|
code => <<'CODE'
|
|
|
|
{
|
2004-07-10 03:14:59 +08:00
|
|
|
if (gimp->no_interface ||
|
2006-04-26 17:13:47 +08:00
|
|
|
! gimp_pdb_lookup_procedure (gimp->pdb, gradient_callback) ||
|
2004-07-10 03:14:59 +08:00
|
|
|
! gimp_pdb_dialog_set (gimp, gimp->gradient_factory->container,
|
|
|
|
gradient_callback, gradient_name,
|
|
|
|
NULL))
|
1999-04-04 13:59:08 +08:00
|
|
|
success = FALSE;
|
|
|
|
}
|
|
|
|
CODE
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2006-03-24 05:17:16 +08:00
|
|
|
|
2004-07-10 03:14:59 +08:00
|
|
|
@headers = qw("core/gimp.h" "core/gimpdatafactory.h" "core/gimpgradient.h");
|
1999-04-04 13:59:08 +08:00
|
|
|
|
2001-10-26 05:59:52 +08:00
|
|
|
@procs = qw(gradients_popup gradients_close_popup gradients_set_popup);
|
2006-03-24 05:17:16 +08:00
|
|
|
|
1999-12-26 15:54:39 +08:00
|
|
|
%exports = (app => [@procs], lib => [@procs]);
|
1999-03-11 02:56:56 +08:00
|
|
|
|
|
|
|
$desc = 'Gradient UI';
|
|
|
|
|
|
|
|
1;
|