2006-12-10 05:33:38 +08:00
|
|
|
# GIMP - The GNU Image Manipulation Program
|
1999-03-21 10:14:08 +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-03-21 10:14:08 +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-03-21 10:14:08 +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-03-21 10:14:08 +08:00
|
|
|
|
|
|
|
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
|
|
|
|
|
|
|
|
sub gimprc_query {
|
|
|
|
$blurb = <<'BLURB';
|
|
|
|
Queries the gimprc file parser for information on a specified token.
|
|
|
|
BLURB
|
|
|
|
|
|
|
|
$help = <<'HELP';
|
|
|
|
This procedure is used to locate additional information contained in the gimprc
|
2007-06-06 16:44:52 +08:00
|
|
|
file considered extraneous to the operation of GIMP. Plug-ins that need
|
1999-04-19 04:29:32 +08:00
|
|
|
configuration information can expect it will be stored in the user gimprc
|
1999-03-21 10:14:08 +08:00
|
|
|
file and can use this procedure to retrieve it. This query procedure will
|
|
|
|
return the value associated with the specified token. This corresponds _only_
|
|
|
|
to entries with the format: (<token> <value>). The value must be a string.
|
|
|
|
Entries not corresponding to this format will cause warnings to be issued on
|
2001-09-18 02:11:15 +08:00
|
|
|
gimprc parsing and will not be queryable.
|
1999-03-21 10:14:08 +08:00
|
|
|
HELP
|
|
|
|
|
|
|
|
&std_pdb_misc;
|
|
|
|
$date = '1997';
|
|
|
|
|
|
|
|
@inargs = (
|
|
|
|
{ name => 'token', type => 'string',
|
2003-08-20 03:08:11 +08:00
|
|
|
desc => 'The token to query for' }
|
1999-03-21 10:14:08 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
@outargs = (
|
2006-03-15 23:32:39 +08:00
|
|
|
{ name => 'value', type => 'string',
|
2006-03-15 05:35:50 +08:00
|
|
|
desc => 'The value associated with the queried token' }
|
1999-03-21 10:14:08 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
%invoke = (
|
1999-06-03 08:00:48 +08:00
|
|
|
code => <<'CODE'
|
|
|
|
{
|
2004-10-05 03:30:16 +08:00
|
|
|
if (strlen (token))
|
|
|
|
{
|
|
|
|
/* use edit_config because unknown tokens are set there */
|
|
|
|
value = gimp_rc_query (GIMP_RC (gimp->edit_config), token);
|
2004-01-07 21:13:42 +08:00
|
|
|
|
2006-03-22 17:58:08 +08:00
|
|
|
if (! value)
|
|
|
|
success = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
success = FALSE;
|
1999-06-03 08:00:48 +08:00
|
|
|
}
|
|
|
|
CODE
|
1999-03-21 10:14:08 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
1999-04-19 05:22:41 +08:00
|
|
|
sub gimprc_set {
|
|
|
|
$blurb = 'Sets a gimprc token to a value and saves it in the gimprc.';
|
|
|
|
|
|
|
|
$help = <<'HELP';
|
|
|
|
This procedure is used to add or change additional information in the gimprc
|
2007-06-06 16:44:52 +08:00
|
|
|
file that is considered extraneous to the operation of GIMP. Plug-ins that
|
1999-04-19 05:22:41 +08:00
|
|
|
need configuration information can use this function to store it, and
|
2006-06-14 16:32:08 +08:00
|
|
|
gimp_gimprc_query() to retrieve it. This will accept _only_ string values in
|
2003-09-23 05:20:17 +08:00
|
|
|
UTF-8 encoding.
|
1999-04-19 05:22:41 +08:00
|
|
|
HELP
|
|
|
|
|
2006-03-15 05:35:50 +08:00
|
|
|
&seth_pdb_misc('1999');
|
1999-04-19 05:22:41 +08:00
|
|
|
|
|
|
|
@inargs = (
|
|
|
|
{ name => 'token', type => 'string',
|
2003-09-23 05:20:17 +08:00
|
|
|
desc => 'The token to add or modify' },
|
|
|
|
{ name => 'value', type => 'string',
|
1999-04-19 05:22:41 +08:00
|
|
|
desc => 'The value to set the token to' }
|
|
|
|
);
|
|
|
|
|
|
|
|
%invoke = (
|
2006-03-23 01:19:14 +08:00
|
|
|
code => <<'CODE'
|
2002-11-19 04:50:31 +08:00
|
|
|
{
|
2004-10-05 03:30:16 +08:00
|
|
|
if (strlen (token))
|
|
|
|
{
|
|
|
|
/* use edit_config because that's the one that gets saved */
|
|
|
|
gimp_rc_set_unknown_token (GIMP_RC (gimp->edit_config), token, value);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
success = FALSE;
|
2002-11-19 04:50:31 +08:00
|
|
|
}
|
|
|
|
CODE
|
1999-04-19 05:22:41 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
1999-08-13 00:54:53 +08:00
|
|
|
sub get_monitor_resolution {
|
|
|
|
$blurb = 'Get the monitor resolution as specified in the Preferences.';
|
1999-04-19 05:22:41 +08:00
|
|
|
|
1999-08-13 00:54:53 +08:00
|
|
|
$help = <<'HELP';
|
|
|
|
Returns the resolution of the monitor in pixels/inch. This value
|
2002-11-19 04:50:31 +08:00
|
|
|
is taken from the Preferences (or the windowing system if this is set in
|
|
|
|
the Preferences) and there's no guarantee for the value to be reasonable.
|
1999-08-13 00:54:53 +08:00
|
|
|
HELP
|
|
|
|
|
|
|
|
&std_pdb_misc;
|
|
|
|
|
|
|
|
@outargs = (
|
2000-06-22 11:21:20 +08:00
|
|
|
{ name => 'xres', type => 'float', void_ret => 1,
|
2006-03-15 23:00:01 +08:00
|
|
|
desc => 'X resolution' },
|
1999-08-13 00:54:53 +08:00
|
|
|
{ name => 'yres', type => 'float',
|
2006-03-15 23:00:01 +08:00
|
|
|
desc => 'Y resolution' },
|
1999-08-13 00:54:53 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
%invoke = (
|
|
|
|
code => <<'CODE'
|
|
|
|
{
|
2002-11-19 04:50:31 +08:00
|
|
|
xres = GIMP_DISPLAY_CONFIG (gimp->config)->monitor_xres;
|
|
|
|
yres = GIMP_DISPLAY_CONFIG (gimp->config)->monitor_yres;
|
1999-08-13 00:54:53 +08:00
|
|
|
}
|
|
|
|
CODE
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2001-09-18 02:11:15 +08:00
|
|
|
sub get_default_comment {
|
|
|
|
$blurb = 'Get the default image comment as specified in the Preferences.';
|
2006-03-15 05:35:50 +08:00
|
|
|
$help = 'Returns a copy of the default image comment.';
|
2001-09-18 02:11:15 +08:00
|
|
|
|
|
|
|
&std_pdb_misc;
|
|
|
|
|
|
|
|
@outargs = (
|
|
|
|
{ name => 'comment', type => 'string',
|
2006-12-29 09:35:08 +08:00
|
|
|
desc => 'Default image comment' }
|
2001-09-18 02:11:15 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
%invoke = (
|
2006-03-15 05:35:50 +08:00
|
|
|
headers => [ qw("core/gimptemplate.h") ],
|
2001-09-18 02:11:15 +08:00
|
|
|
code => <<'CODE'
|
|
|
|
{
|
2011-03-02 17:16:43 +08:00
|
|
|
comment = g_strdup (gimp_template_get_comment (gimp->config->default_image));
|
2001-09-18 02:11:15 +08:00
|
|
|
}
|
|
|
|
CODE
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2006-12-29 09:35:08 +08:00
|
|
|
sub get_default_unit {
|
|
|
|
$blurb = 'Get the default unit (taken from the user\'s locale).';
|
|
|
|
$help = 'Returns the default unit\'s integer ID.';
|
|
|
|
|
|
|
|
&std_pdb_misc;
|
|
|
|
$since = '2.4';
|
|
|
|
|
|
|
|
@outargs = (
|
|
|
|
{ name => 'unit_id', type => 'unit',
|
|
|
|
desc => 'Default unit' }
|
|
|
|
);
|
|
|
|
|
|
|
|
%invoke = (
|
|
|
|
headers => [ qw("libgimpbase/gimpbase.h"
|
|
|
|
"core/gimp-utils.h") ],
|
|
|
|
code => <<'CODE'
|
|
|
|
{
|
|
|
|
unit_id = gimp_get_default_unit ();
|
|
|
|
}
|
|
|
|
CODE
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2005-06-26 20:53:31 +08:00
|
|
|
sub get_color_configuration {
|
|
|
|
$blurb = 'Get a serialized version of the color management configuration.';
|
|
|
|
$help = 'Returns a string that can be deserialized into a GimpColorConfig object representing the current color management configuration.';
|
|
|
|
|
2006-03-15 05:35:50 +08:00
|
|
|
&neo_pdb_misc('2005', '2.4');
|
2005-06-26 20:53:31 +08:00
|
|
|
|
2019-08-08 01:09:00 +08:00
|
|
|
$lib_private = 1;
|
|
|
|
|
2005-06-26 20:53:31 +08:00
|
|
|
@outargs = (
|
|
|
|
{ name => 'config', type => 'string',
|
2019-08-08 01:09:00 +08:00
|
|
|
desc => 'Serialized color management configuration' }
|
2005-06-26 20:53:31 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
%invoke = (
|
2006-03-15 05:35:50 +08:00
|
|
|
headers => [ qw("libgimpconfig/gimpconfig.h") ],
|
2005-06-26 20:53:31 +08:00
|
|
|
code => <<'CODE'
|
|
|
|
{
|
|
|
|
config = gimp_config_serialize_to_string (GIMP_CONFIG (gimp->config->color_management), NULL);
|
|
|
|
}
|
|
|
|
CODE
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2003-11-12 01:55:45 +08:00
|
|
|
sub get_module_load_inhibit {
|
|
|
|
$blurb = 'Get the list of modules which should not be loaded.';
|
2006-03-15 05:35:50 +08:00
|
|
|
$help = 'Returns a copy of the list of modules which should not be loaded.';
|
2003-11-12 01:55:45 +08:00
|
|
|
|
|
|
|
&std_pdb_misc;
|
|
|
|
|
|
|
|
@outargs = (
|
|
|
|
{ name => 'load_inhibit', type => 'string',
|
|
|
|
desc => 'The list of modules' }
|
|
|
|
);
|
|
|
|
|
|
|
|
%invoke = (
|
|
|
|
headers => [ qw("libgimpmodule/gimpmodule.h") ],
|
|
|
|
code => <<'CODE'
|
|
|
|
{
|
|
|
|
load_inhibit = g_strdup (gimp_module_db_get_load_inhibit (gimp->module_db));
|
|
|
|
}
|
|
|
|
CODE
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2006-03-24 05:17:16 +08:00
|
|
|
|
2006-06-14 16:32:08 +08:00
|
|
|
@headers = qw(<string.h>
|
|
|
|
"config/gimprc.h"
|
|
|
|
"core/gimp.h");
|
2001-09-18 02:11:15 +08:00
|
|
|
|
2008-02-08 01:08:54 +08:00
|
|
|
@procs = qw(gimprc_query
|
|
|
|
gimprc_set
|
2015-12-10 06:21:11 +08:00
|
|
|
get_default_comment
|
2008-02-08 01:08:54 +08:00
|
|
|
get_default_unit
|
|
|
|
get_monitor_resolution
|
|
|
|
get_color_configuration
|
2010-07-09 08:30:10 +08:00
|
|
|
get_module_load_inhibit);
|
2006-03-24 05:17:16 +08:00
|
|
|
|
2000-06-01 20:20:13 +08:00
|
|
|
%exports = (app => [@procs], lib => [@procs]);
|
1999-03-21 10:14:08 +08:00
|
|
|
|
|
|
|
$desc = 'Gimprc procedures';
|
2010-07-07 17:43:10 +08:00
|
|
|
$doc_title = 'gimpgimprc';
|
|
|
|
$doc_short_desc = 'Interactions with settings from gimprc.';
|
|
|
|
$doc_long_desc = 'Interactions with settings from gimprc.';
|
1999-03-21 10:14:08 +08:00
|
|
|
|
|
|
|
1;
|