1
# The GIMP -- an image manipulation program
2
# Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
21
$author = $copyright = 'Michael Natterer';
28
desc => "The unit's integer ID",
34
my ($prop, $type, $desc) = @_;
35
$desc = $prop unless $desc;
37
$blurb = "Returns the $desc of the unit.";
41
@inargs = ( &unit_arg );
44
{ name => $prop, type => $type,
45
desc => "The unit's $desc",
46
alias => "_gimp_unit_get_$prop (gimp, unit)",
50
if ($type eq 'string') {
51
$outargs[0]->{alias} = "g_strdup ($outargs[0]->{alias})";
55
sub unit_get_number_of_units {
56
$blurb = 'Returns the number of units.';
58
$help = 'This procedure returns the number of defined units.';
63
{ name => 'num_units', type => 'int32', libdef => 'GIMP_UNIT_END',
64
desc => 'The number of units', wrap => 1,
65
alias => '_gimp_unit_get_number_of_units (gimp)', no_declare => 1 }
69
sub unit_get_number_of_built_in_units {
70
$blurb = 'Returns the number of built-in units.';
73
This procedure returns the number of defined units built-in to the GIMP.
79
{ name => 'num_units', type => 'int32', libdef => 'GIMP_UNIT_END',
80
desc => 'The number of built-in units', wrap => 1,
81
alias => '_gimp_unit_get_number_of_units (gimp)', no_declare => 1 }
87
$blurb = "Creates a new unit and returns it's integer ID.";
90
This procedure creates a new unit and returns it's integer ID. Note that the
91
new unit will have it's deletion flag set to TRUE, so you will have to set it
92
to FALSE with gimp_unit_set_deletion_flag to make it persistent.
98
{ name => 'identifier', type => 'string', wrap => 1,
99
desc => "The new unit's identifier" },
100
{ name => 'factor', type => 'float',
101
desc => "The new unit's factor" },
102
{ name => 'digits', type => 'int32',
103
desc => "The new unit's digits" },
104
{ name => 'symbol', type => 'string',
105
desc => "The new unit's symbol" },
106
{ name => 'abbreviation', type => 'string',
107
desc => "The new unit's abbreviation" },
108
{ name => 'singular', type => 'string',
109
desc => "The new unit's singular form" },
110
{ name => 'plural', type => 'string',
111
desc => "The new unit's plural form" }
114
@outargs = ( &unit_arg );
115
$outargs[0]->{desc} = "The new unit's ID";
116
$outargs[0]->{init} = 1;
117
$outargs[0]->{libdef} = 'GIMP_UNIT_INCH';
121
unit = _gimp_unit_new (gimp, identifier, factor, digits, symbol, abbreviation,
127
sub unit_get_deletion_flag {
129
This procedure returns the deletion flag of the unit. If this value is TRUE the
130
unit's definition will not be saved in the user's unitrc file on gimp exit.
133
&unit_prop_proc('deletion_flag', 'boolean', 'deletion flag');
136
sub unit_set_deletion_flag {
137
$blurb = 'Sets the deletion flag of a unit.';
140
This procedure sets the unit's deletion flag. If the deletion flag of a unit is
141
TRUE on gimp exit, this unit's definition will not be saved in the user's
149
{ name => 'deletion_flag', type => 'boolean',
150
desc => 'The new deletion flag of the unit' }
153
%invoke = ( code => '_gimp_unit_set_deletion_flag (gimp, unit, deletion_flag);' );
156
sub unit_get_identifier {
158
This procedure returns the textual identifier of the unit. For built-in units
159
it will be the english singular form of the unit's name. For user-defined units
160
this should equal to the singular form.
163
&unit_prop_proc('identifier', 'string', 'textual identifier');
166
sub unit_get_factor {
168
This procedure returns the unit's factor which indicates how many units make up
169
an inch. Note that asking for the factor of "pixels" will produce an error.
172
&unit_prop_proc('factor', 'float');
175
sub unit_get_digits {
177
This procedure returns the number of digits you should provide in input or
178
output functions to get approximately the same accuracy as with two digits and
179
inches. Note that asking for the digits of "pixels" will produce an error.
182
&unit_prop_proc('digits', 'int32', 'number of digits');
185
sub unit_get_symbol {
187
This procedure returns the symbol of the unit ("''" for inches).
190
&unit_prop_proc('symbol', 'string');
193
sub unit_get_abbreviation {
195
This procedure returns the abbreviation of the unit ("in" for inches).
198
&unit_prop_proc('abbreviation', 'string');
201
sub unit_get_singular {
203
This procedure returns the singular form of the unit.
206
&unit_prop_proc('singular', 'string', 'singular form');
209
sub unit_get_plural {
211
This procedure returns the plural form of the unit.
214
&unit_prop_proc('plural', 'string', 'plural form');
217
@headers = qw("libgimpbase/gimpbase.h" "core/gimpunit.h");
219
@procs = qw(unit_get_number_of_units unit_get_number_of_built_in_units
220
unit_new unit_get_deletion_flag unit_set_deletion_flag
221
unit_get_identifier unit_get_factor unit_get_digits
222
unit_get_symbol unit_get_abbreviation unit_get_singular
224
%exports = (app => [@procs], lib => [@procs]);