238 lines
6.1 KiB
Plaintext
238 lines
6.1 KiB
Plaintext
|
# PIKA - Photo and Image Kooker Application
|
||
|
# 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 3 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, see <https://www.gnu.org/licenses/>.
|
||
|
|
||
|
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
|
||
|
|
||
|
sub pikarc_query {
|
||
|
$blurb = <<'BLURB';
|
||
|
Queries the pikarc file parser for information on a specified token.
|
||
|
BLURB
|
||
|
|
||
|
$help = <<'HELP';
|
||
|
This procedure is used to locate additional information contained in the pikarc
|
||
|
file considered extraneous to the operation of PIKA. Plug-ins that need
|
||
|
configuration information can expect it will be stored in the user pikarc
|
||
|
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
|
||
|
pikarc parsing and will not be queryable.
|
||
|
HELP
|
||
|
|
||
|
&std_pdb_misc;
|
||
|
$date = '1997';
|
||
|
|
||
|
@inargs = (
|
||
|
{ name => 'token', type => 'string',
|
||
|
desc => 'The token to query for' }
|
||
|
);
|
||
|
|
||
|
@outargs = (
|
||
|
{ name => 'value', type => 'string',
|
||
|
desc => 'The value associated with the queried token' }
|
||
|
);
|
||
|
|
||
|
%invoke = (
|
||
|
code => <<'CODE'
|
||
|
{
|
||
|
if (strlen (token))
|
||
|
{
|
||
|
/* use edit_config because unknown tokens are set there */
|
||
|
value = pika_rc_query (PIKA_RC (pika->edit_config), token);
|
||
|
|
||
|
if (! value)
|
||
|
success = FALSE;
|
||
|
}
|
||
|
else
|
||
|
success = FALSE;
|
||
|
}
|
||
|
CODE
|
||
|
);
|
||
|
}
|
||
|
|
||
|
sub pikarc_set {
|
||
|
$blurb = 'Sets a pikarc token to a value and saves it in the pikarc.';
|
||
|
|
||
|
$help = <<'HELP';
|
||
|
This procedure is used to add or change additional information in the pikarc
|
||
|
file that is considered extraneous to the operation of PIKA. Plug-ins that
|
||
|
need configuration information can use this function to store it, and
|
||
|
pika_pikarc_query() to retrieve it. This will accept _only_ string values in
|
||
|
UTF-8 encoding.
|
||
|
HELP
|
||
|
|
||
|
&seth_pdb_misc('1999');
|
||
|
|
||
|
@inargs = (
|
||
|
{ name => 'token', type => 'string',
|
||
|
desc => 'The token to add or modify' },
|
||
|
{ name => 'value', type => 'string',
|
||
|
desc => 'The value to set the token to' }
|
||
|
);
|
||
|
|
||
|
%invoke = (
|
||
|
code => <<'CODE'
|
||
|
{
|
||
|
if (strlen (token))
|
||
|
{
|
||
|
/* use edit_config because that's the one that gets saved */
|
||
|
pika_rc_set_unknown_token (PIKA_RC (pika->edit_config), token, value);
|
||
|
}
|
||
|
else
|
||
|
success = FALSE;
|
||
|
}
|
||
|
CODE
|
||
|
);
|
||
|
}
|
||
|
|
||
|
sub get_monitor_resolution {
|
||
|
$blurb = 'Get the monitor resolution as specified in the Preferences.';
|
||
|
|
||
|
$help = <<'HELP';
|
||
|
Returns the resolution of the monitor in pixels/inch. This value
|
||
|
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.
|
||
|
HELP
|
||
|
|
||
|
&std_pdb_misc;
|
||
|
|
||
|
@outargs = (
|
||
|
{ name => 'xres', type => 'float', void_ret => 1,
|
||
|
desc => 'X resolution' },
|
||
|
{ name => 'yres', type => 'float',
|
||
|
desc => 'Y resolution' },
|
||
|
);
|
||
|
|
||
|
%invoke = (
|
||
|
code => <<'CODE'
|
||
|
{
|
||
|
xres = PIKA_DISPLAY_CONFIG (pika->config)->monitor_xres;
|
||
|
yres = PIKA_DISPLAY_CONFIG (pika->config)->monitor_yres;
|
||
|
}
|
||
|
CODE
|
||
|
);
|
||
|
}
|
||
|
|
||
|
sub get_default_comment {
|
||
|
$blurb = 'Get the default image comment as specified in the Preferences.';
|
||
|
$help = 'Returns a copy of the default image comment.';
|
||
|
|
||
|
&std_pdb_misc;
|
||
|
|
||
|
@outargs = (
|
||
|
{ name => 'comment', type => 'string',
|
||
|
desc => 'Default image comment' }
|
||
|
);
|
||
|
|
||
|
%invoke = (
|
||
|
headers => [ qw("core/pikatemplate.h") ],
|
||
|
code => <<'CODE'
|
||
|
{
|
||
|
comment = g_strdup (pika_template_get_comment (pika->config->default_image));
|
||
|
}
|
||
|
CODE
|
||
|
);
|
||
|
}
|
||
|
|
||
|
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("libpikabase/pikabase.h"
|
||
|
"core/pika-utils.h") ],
|
||
|
code => <<'CODE'
|
||
|
{
|
||
|
unit_id = pika_get_default_unit ();
|
||
|
}
|
||
|
CODE
|
||
|
);
|
||
|
}
|
||
|
|
||
|
sub get_color_configuration {
|
||
|
$blurb = 'Get a serialized version of the color management configuration.';
|
||
|
$help = 'Returns a string that can be deserialized into a PikaColorConfig object representing the current color management configuration.';
|
||
|
|
||
|
&neo_pdb_misc('2005', '2.4');
|
||
|
|
||
|
$lib_private = 1;
|
||
|
|
||
|
@outargs = (
|
||
|
{ name => 'config', type => 'string',
|
||
|
desc => 'Serialized color management configuration' }
|
||
|
);
|
||
|
|
||
|
%invoke = (
|
||
|
headers => [ qw("libpikaconfig/pikaconfig.h") ],
|
||
|
code => <<'CODE'
|
||
|
{
|
||
|
config = pika_config_serialize_to_string (PIKA_CONFIG (pika->config->color_management), NULL);
|
||
|
}
|
||
|
CODE
|
||
|
);
|
||
|
}
|
||
|
|
||
|
sub get_module_load_inhibit {
|
||
|
$blurb = 'Get the list of modules which should not be loaded.';
|
||
|
$help = 'Returns a copy of the list of modules which should not be loaded.';
|
||
|
|
||
|
&std_pdb_misc;
|
||
|
|
||
|
@outargs = (
|
||
|
{ name => 'load_inhibit', type => 'string',
|
||
|
desc => 'The list of modules' }
|
||
|
);
|
||
|
|
||
|
%invoke = (
|
||
|
headers => [ qw("libpikamodule/pikamodule.h") ],
|
||
|
code => <<'CODE'
|
||
|
{
|
||
|
load_inhibit = g_strdup (pika_module_db_get_load_inhibit (pika->module_db));
|
||
|
}
|
||
|
CODE
|
||
|
);
|
||
|
}
|
||
|
|
||
|
|
||
|
@headers = qw(<string.h>
|
||
|
"config/pikarc.h"
|
||
|
"core/pika.h");
|
||
|
|
||
|
@procs = qw(pikarc_query
|
||
|
pikarc_set
|
||
|
get_default_comment
|
||
|
get_default_unit
|
||
|
get_monitor_resolution
|
||
|
get_color_configuration
|
||
|
get_module_load_inhibit);
|
||
|
|
||
|
%exports = (app => [@procs], lib => [@procs]);
|
||
|
|
||
|
$desc = 'Pikarc procedures';
|
||
|
$doc_title = 'pikapikarc';
|
||
|
$doc_short_desc = 'Interactions with settings from pikarc.';
|
||
|
$doc_long_desc = 'Interactions with settings from pikarc.';
|
||
|
|
||
|
1;
|