2006-12-09 13:33:38 -08:00
|
|
|
# GIMP - The GNU Image Manipulation Program
|
1999-04-22 23:55:37 -07:00
|
|
|
# Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
|
|
2009-01-17 14:28:01 -08:00
|
|
|
# This program is free software: you can redistribute it and/or modify
|
1999-04-22 23:55:37 -07:00
|
|
|
# it under the terms of the GNU General Public License as published by
|
2009-01-17 14:28:01 -08:00
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
1999-04-22 23:55:37 -07: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-11 14:27:07 -07:00
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
1999-04-22 23:55:37 -07:00
|
|
|
|
|
|
|
|
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
|
|
|
|
|
|
|
|
|
|
sub patterns_popup {
|
|
|
|
|
$blurb = 'Invokes the Gimp pattern selection.';
|
2022-10-15 12:11:05 -07:00
|
|
|
$help = 'Opens the pattern selection dialog.';
|
1999-04-22 23:55:37 -07:00
|
|
|
|
2006-03-14 13:35:50 -08:00
|
|
|
&andy_pdb_misc('1998');
|
1999-04-22 23:55:37 -07:00
|
|
|
|
|
|
|
|
@inargs = (
|
2022-10-15 12:11:05 -07:00
|
|
|
{ name => 'pattern_callback', type => 'string', non_empty => 1,
|
|
|
|
|
desc => 'The callback PDB proc to call when the user chooses a pattern' },
|
|
|
|
|
{ name => 'popup_title', type => 'string',
|
|
|
|
|
desc => 'Title of the pattern selection dialog' },
|
2025-01-20 11:11:14 -08:00
|
|
|
{ name => 'initial_pattern', type => 'pattern', none_ok => 1,
|
2023-08-16 16:30:59 -07:00
|
|
|
desc => 'The pattern to set as the initial choice' },
|
2025-01-20 11:11:14 -08:00
|
|
|
{ name => 'parent_window', type => 'bytes', none_ok => 1,
|
app, libgimp, pdb: add a parent_window parameter to gimp_*_popup() PDB calls.
Brush, font, gradient, palette and pattern choices are currently chosen through
a dialog created by the core, which then returns the user choice to the calling
plug-in. This has the unfortunate consequence of having a pile of likely at
least 3 windows (main GIMP window by core process, plug-in window by plug-in
process, then the choice popup by the core process) shared in 2 processes, which
often end up under each other and that's messy. Even more as the choice popup is
kinda expected to be like a sub-part of the plug-in dialog.
So anyway, now the plug-in can send its window handle to the core so that the
resource choice dialog ends up always above the plug-in dialog.
Of course, it will always work only on platforms where we have working
inter-process transient support.
2023-08-14 15:12:16 -07:00
|
|
|
desc => 'An optional parent window handle for the popup to be set transient to' }
|
1999-04-22 23:55:37 -07:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
%invoke = (
|
|
|
|
|
code => <<'CODE'
|
|
|
|
|
{
|
2023-08-26 16:02:37 -07:00
|
|
|
GimpContainer *container = gimp_data_factory_get_container (gimp->pattern_factory);
|
|
|
|
|
|
2004-07-09 12:14:59 -07:00
|
|
|
if (gimp->no_interface ||
|
2006-04-26 02:13:47 -07:00
|
|
|
! gimp_pdb_lookup_procedure (gimp->pdb, pattern_callback) ||
|
2006-09-22 02:24:41 -07:00
|
|
|
! gimp_pdb_dialog_new (gimp, context, progress,
|
2025-07-17 00:44:09 -07:00
|
|
|
gimp_container_get_child_type (container),
|
2023-08-16 16:30:59 -07:00
|
|
|
parent_window, popup_title, pattern_callback,
|
|
|
|
|
GIMP_OBJECT (initial_pattern), NULL))
|
2003-12-08 03:58:45 -08:00
|
|
|
success = FALSE;
|
1999-04-22 23:55:37 -07:00
|
|
|
}
|
|
|
|
|
CODE
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub patterns_close_popup {
|
2007-01-09 02:52:47 -08:00
|
|
|
$blurb = 'Close the pattern selection dialog.';
|
2022-10-15 12:11:05 -07:00
|
|
|
$help = 'Closes an open pattern selection dialog.';
|
1999-04-22 23:55:37 -07:00
|
|
|
|
2006-03-14 13:35:50 -08:00
|
|
|
&andy_pdb_misc('1998');
|
1999-04-22 23:55:37 -07:00
|
|
|
|
|
|
|
|
@inargs = (
|
2022-10-15 12:11:05 -07:00
|
|
|
{ name => 'pattern_callback', type => 'string', non_empty => 1,
|
|
|
|
|
desc => 'The name of the callback registered for this pop-up' }
|
1999-04-22 23:55:37 -07:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
%invoke = (
|
|
|
|
|
code => <<'CODE'
|
|
|
|
|
{
|
2023-08-26 16:02:37 -07:00
|
|
|
GimpContainer *container = gimp_data_factory_get_container (gimp->pattern_factory);
|
|
|
|
|
|
2004-07-09 12:14:59 -07:00
|
|
|
if (gimp->no_interface ||
|
2006-04-26 02:13:47 -07:00
|
|
|
! gimp_pdb_lookup_procedure (gimp->pdb, pattern_callback) ||
|
2023-08-26 16:02:37 -07:00
|
|
|
! gimp_pdb_dialog_close (gimp,
|
2025-07-17 00:44:09 -07:00
|
|
|
gimp_container_get_child_type (container),
|
2004-07-09 12:14:59 -07:00
|
|
|
pattern_callback))
|
2003-12-08 03:58:45 -08:00
|
|
|
success = FALSE;
|
1999-04-22 23:55:37 -07:00
|
|
|
}
|
|
|
|
|
CODE
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub patterns_set_popup {
|
2007-01-09 02:52:47 -08:00
|
|
|
$blurb = 'Sets the current pattern in a pattern selection dialog.';
|
2006-03-14 13:35:50 -08:00
|
|
|
$help = $blurb;
|
1999-04-22 23:55:37 -07:00
|
|
|
|
2006-03-14 13:35:50 -08:00
|
|
|
&andy_pdb_misc('1998');
|
1999-04-22 23:55:37 -07:00
|
|
|
|
|
|
|
|
@inargs = (
|
2022-10-15 12:11:05 -07:00
|
|
|
{ name => 'pattern_callback', type => 'string', non_empty => 1,
|
|
|
|
|
desc => 'The name of the callback registered for this pop-up' },
|
2023-08-16 11:17:53 -07:00
|
|
|
{ name => 'pattern', type => 'pattern',
|
|
|
|
|
desc => 'The pattern to set as selected' }
|
1999-04-22 23:55:37 -07:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
%invoke = (
|
|
|
|
|
code => <<'CODE'
|
|
|
|
|
{
|
2023-08-26 16:02:37 -07:00
|
|
|
GimpContainer *container = gimp_data_factory_get_container (gimp->pattern_factory);
|
|
|
|
|
|
2004-07-09 12:14:59 -07:00
|
|
|
if (gimp->no_interface ||
|
2006-04-26 02:13:47 -07:00
|
|
|
! gimp_pdb_lookup_procedure (gimp->pdb, pattern_callback) ||
|
2023-08-26 16:02:37 -07:00
|
|
|
! gimp_pdb_dialog_set (gimp,
|
2025-07-17 00:44:09 -07:00
|
|
|
gimp_container_get_child_type (container),
|
2023-08-16 11:17:53 -07:00
|
|
|
pattern_callback, GIMP_OBJECT (pattern), NULL))
|
1999-04-22 23:55:37 -07:00
|
|
|
success = FALSE;
|
|
|
|
|
}
|
|
|
|
|
CODE
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-23 13:17:16 -08:00
|
|
|
|
2008-02-07 09:08:54 -08:00
|
|
|
@headers = qw("core/gimp.h"
|
2023-08-26 16:02:37 -07:00
|
|
|
"core/gimpcontainer.h"
|
2008-02-07 09:08:54 -08:00
|
|
|
"core/gimpdatafactory.h");
|
1999-04-22 23:55:37 -07:00
|
|
|
|
2008-02-07 09:08:54 -08:00
|
|
|
@procs = qw(patterns_popup
|
|
|
|
|
patterns_close_popup
|
|
|
|
|
patterns_set_popup);
|
2006-03-23 13:17:16 -08:00
|
|
|
|
2000-05-31 14:16:11 -07:00
|
|
|
%exports = (app => [@procs], lib => [@procs]);
|
1999-04-22 23:55:37 -07:00
|
|
|
|
|
|
|
|
$desc = 'Pattern UI';
|
2010-07-07 02:43:10 -07:00
|
|
|
$doc_title = 'gimppatternselect';
|
2022-10-15 12:11:05 -07:00
|
|
|
$doc_short_desc = 'Methods of a pattern chooser dialog';
|
|
|
|
|
$doc_long_desc = 'A dialog letting a user choose a pattern. Read more at gimpfontselect.';
|
1999-04-22 23:55:37 -07:00
|
|
|
|
|
|
|
|
1;
|