2006-12-10 05:33:38 +08:00
|
|
|
# GIMP - The GNU Image Manipulation Program
|
1999-04-04 13:59:43 +08:00
|
|
|
# Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
|
2009-01-18 06:28:01 +08:00
|
|
|
# This program is free software: you can redistribute it and/or modify
|
1999-04-04 13:59:43 +08:00
|
|
|
# it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
1999-04-04 13:59:43 +08:00
|
|
|
# (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
|
2018-07-12 05:27:07 +08:00
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
1999-04-04 13:59:43 +08:00
|
|
|
|
|
|
|
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
|
|
|
|
|
|
|
|
sub brushes_popup {
|
|
|
|
$blurb = 'Invokes the Gimp brush selection.';
|
2007-01-09 18:52:47 +08:00
|
|
|
$help = 'This procedure opens the brush selection dialog.';
|
1999-04-04 13:59:43 +08:00
|
|
|
|
2006-03-15 05:35:50 +08:00
|
|
|
&andy_pdb_misc('1998');
|
1999-04-04 13:59:43 +08:00
|
|
|
|
|
|
|
@inargs = (
|
2007-04-25 22:23:05 +08:00
|
|
|
{ name => 'brush_callback', type => 'string', non_empty => 1,
|
2003-08-20 03:08:11 +08:00
|
|
|
desc => 'The callback PDB proc to call when brush 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 brush selection dialog' },
|
2007-04-27 01:43:18 +08:00
|
|
|
{ name => 'initial_brush', type => 'string', null_ok => 1,
|
|
|
|
desc => 'The name of the brush to set as the first selected' },
|
2006-03-22 17:58:08 +08:00
|
|
|
{ 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)' },
|
2017-01-09 06:00:19 +08:00
|
|
|
{ name => 'paint_mode', type => 'enum GimpLayerMode',
|
2017-08-20 02:33:47 +08:00
|
|
|
default => 'GIMP_LAYER_MODE_NORMAL',
|
2006-05-19 01:25:15 +08:00
|
|
|
desc => 'The initial paint mode' }
|
1999-04-04 13:59:43 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
%invoke = (
|
|
|
|
code => <<'CODE'
|
|
|
|
{
|
2017-01-09 08:27:20 +08:00
|
|
|
if (paint_mode == GIMP_LAYER_MODE_OVERLAY_LEGACY)
|
|
|
|
paint_mode = GIMP_LAYER_MODE_SOFTLIGHT_LEGACY;
|
2015-04-28 05:48:00 +08:00
|
|
|
|
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, brush_callback) ||
|
2006-09-22 17:24:41 +08:00
|
|
|
! gimp_pdb_dialog_new (gimp, context, progress,
|
2008-12-20 05:58:17 +08:00
|
|
|
gimp_data_factory_get_container (gimp->brush_factory),
|
2004-07-10 03:14:59 +08:00
|
|
|
popup_title, brush_callback, initial_brush,
|
|
|
|
"opacity", opacity / 100.0,
|
|
|
|
"paint-mode", paint_mode,
|
|
|
|
"spacing", spacing,
|
|
|
|
NULL))
|
2003-12-08 19:58:45 +08:00
|
|
|
success = FALSE;
|
1999-04-04 13:59:43 +08:00
|
|
|
}
|
|
|
|
CODE
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
1999-04-10 12:52:07 +08:00
|
|
|
sub brushes_close_popup {
|
2007-01-09 18:52:47 +08:00
|
|
|
$blurb = 'Close the brush selection dialog.';
|
2006-03-15 05:35:50 +08:00
|
|
|
$help = 'This procedure closes an opened brush selection dialog.';
|
1999-04-04 13:59:43 +08:00
|
|
|
|
2006-03-15 05:35:50 +08:00
|
|
|
&andy_pdb_misc('1998');
|
1999-04-04 13:59:43 +08:00
|
|
|
|
|
|
|
@inargs = (
|
2007-04-25 22:23:05 +08:00
|
|
|
{ name => 'brush_callback', type => 'string', non_empty => 1,
|
2007-01-09 18:52:47 +08:00
|
|
|
desc => 'The name of the callback registered for this pop-up' }
|
1999-04-04 13:59:43 +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, brush_callback) ||
|
2008-12-20 05:58:17 +08:00
|
|
|
! gimp_pdb_dialog_close (gimp, gimp_data_factory_get_container (gimp->brush_factory),
|
2004-07-10 03:14:59 +08:00
|
|
|
brush_callback))
|
2003-12-08 19:58:45 +08:00
|
|
|
success = FALSE;
|
1999-04-04 13:59:43 +08:00
|
|
|
}
|
|
|
|
CODE
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
1999-04-10 12:52:07 +08:00
|
|
|
sub brushes_set_popup {
|
2007-01-09 18:52:47 +08:00
|
|
|
$blurb = 'Sets the current brush in a brush selection dialog.';
|
2006-03-15 05:35:50 +08:00
|
|
|
$help = $blurb;
|
1999-04-04 13:59:43 +08:00
|
|
|
|
2006-03-15 05:35:50 +08:00
|
|
|
&andy_pdb_misc('1998');
|
1999-04-04 13:59:43 +08:00
|
|
|
|
|
|
|
@inargs = (
|
2007-04-25 22:23:05 +08:00
|
|
|
{ name => 'brush_callback', type => 'string', non_empty => 1,
|
2007-01-09 18:52:47 +08:00
|
|
|
desc => 'The name of the callback registered for this pop-up' },
|
1999-04-04 13:59:43 +08:00
|
|
|
{ name => 'brush_name', type => 'string',
|
2003-08-20 03:08:11 +08:00
|
|
|
desc => 'The name of the brush to set as selected' },
|
2006-03-22 17:58:08 +08:00
|
|
|
{ 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)' },
|
2017-01-09 06:00:19 +08:00
|
|
|
{ name => 'paint_mode', type => 'enum GimpLayerMode',
|
2017-08-20 02:33:47 +08:00
|
|
|
default => 'GIMP_LAYER_MODE_NORMAL',
|
2006-05-19 01:25:15 +08:00
|
|
|
desc => 'The initial paint mode' }
|
1999-04-04 13:59:43 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
%invoke = (
|
|
|
|
code => <<'CODE'
|
|
|
|
{
|
2017-01-09 08:27:20 +08:00
|
|
|
if (paint_mode == GIMP_LAYER_MODE_OVERLAY_LEGACY)
|
|
|
|
paint_mode = GIMP_LAYER_MODE_SOFTLIGHT_LEGACY;
|
2015-04-28 05:48:00 +08:00
|
|
|
|
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, brush_callback) ||
|
2008-12-20 05:58:17 +08:00
|
|
|
! gimp_pdb_dialog_set (gimp, gimp_data_factory_get_container (gimp->brush_factory),
|
2004-07-10 03:14:59 +08:00
|
|
|
brush_callback, brush_name,
|
|
|
|
"opacity", opacity / 100.0,
|
|
|
|
"paint-mode", paint_mode,
|
|
|
|
"spacing", spacing,
|
|
|
|
NULL))
|
1999-04-04 13:59:43 +08:00
|
|
|
success = FALSE;
|
|
|
|
}
|
|
|
|
CODE
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2006-03-24 05:17:16 +08:00
|
|
|
|
2008-02-08 01:08:54 +08:00
|
|
|
@headers = qw("core/gimp.h"
|
|
|
|
"core/gimpdatafactory.h");
|
1999-04-04 13:59:43 +08:00
|
|
|
|
2008-02-08 01:08:54 +08:00
|
|
|
@procs = qw(brushes_popup
|
|
|
|
brushes_close_popup
|
|
|
|
brushes_set_popup);
|
2006-03-24 05:17:16 +08:00
|
|
|
|
1999-12-26 15:54:39 +08:00
|
|
|
%exports = (app => [@procs], lib => [@procs]);
|
1999-04-04 13:59:43 +08:00
|
|
|
|
|
|
|
$desc = 'Brush UI';
|
2010-07-07 17:43:10 +08:00
|
|
|
$doc_title = 'gimpbrushselect';
|
|
|
|
$doc_short_desc = 'Functions providing a brush selection dialog.';
|
|
|
|
$doc_long_desc = 'Functions providing a brush selection dialog.';
|
1999-04-04 13:59:43 +08:00
|
|
|
|
|
|
|
1;
|