1.1.4
by Daniel Holbach
Import upstream version 2.3.16 |
1 |
/* GIMP - The GNU Image Manipulation Program
|
1
by Daniel Holbach
Import upstream version 2.2.9 |
2 |
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
3 |
*
|
|
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.
|
|
8 |
*
|
|
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.
|
|
13 |
*
|
|
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.
|
|
17 |
*/
|
|
18 |
||
19 |
#include "config.h" |
|
20 |
||
21 |
#include <glib-object.h> |
|
22 |
||
23 |
#include "libgimpbase/gimpbase.h" |
|
24 |
#include "libgimpbase/gimpbase-private.h" |
|
25 |
||
26 |
#include "core/core-types.h" |
|
27 |
||
28 |
#include "core/gimp.h" |
|
29 |
#include "core/gimpunit.h" |
|
30 |
||
31 |
#include "units.h" |
|
32 |
||
33 |
||
34 |
static Gimp *the_unit_gimp = NULL; |
|
35 |
||
36 |
||
37 |
static gint |
|
38 |
units_get_number_of_units (void) |
|
39 |
{
|
|
40 |
return _gimp_unit_get_number_of_units (the_unit_gimp); |
|
41 |
}
|
|
42 |
||
43 |
static gint |
|
44 |
units_get_number_of_built_in_units (void) |
|
45 |
{
|
|
46 |
return GIMP_UNIT_END; |
|
47 |
}
|
|
48 |
||
49 |
static GimpUnit |
|
50 |
units_unit_new (gchar *identifier, |
|
1.1.4
by Daniel Holbach
Import upstream version 2.3.16 |
51 |
gdouble factor, |
52 |
gint digits, |
|
53 |
gchar *symbol, |
|
54 |
gchar *abbreviation, |
|
55 |
gchar *singular, |
|
56 |
gchar *plural) |
|
1
by Daniel Holbach
Import upstream version 2.2.9 |
57 |
{
|
58 |
return _gimp_unit_new (the_unit_gimp, |
|
1.1.4
by Daniel Holbach
Import upstream version 2.3.16 |
59 |
identifier, |
60 |
factor, |
|
61 |
digits, |
|
62 |
symbol, |
|
63 |
abbreviation, |
|
64 |
singular, |
|
65 |
plural); |
|
1
by Daniel Holbach
Import upstream version 2.2.9 |
66 |
}
|
67 |
||
68 |
static gboolean |
|
69 |
units_unit_get_deletion_flag (GimpUnit unit) |
|
70 |
{
|
|
71 |
return _gimp_unit_get_deletion_flag (the_unit_gimp, unit); |
|
72 |
}
|
|
73 |
||
74 |
static void |
|
75 |
units_unit_set_deletion_flag (GimpUnit unit, |
|
1.1.4
by Daniel Holbach
Import upstream version 2.3.16 |
76 |
gboolean deletion_flag) |
1
by Daniel Holbach
Import upstream version 2.2.9 |
77 |
{
|
78 |
_gimp_unit_set_deletion_flag (the_unit_gimp, unit, deletion_flag); |
|
79 |
}
|
|
80 |
||
81 |
static gdouble |
|
82 |
units_unit_get_factor (GimpUnit unit) |
|
83 |
{
|
|
84 |
return _gimp_unit_get_factor (the_unit_gimp, unit); |
|
85 |
}
|
|
86 |
||
87 |
static gint |
|
88 |
units_unit_get_digits (GimpUnit unit) |
|
89 |
{
|
|
90 |
return _gimp_unit_get_digits (the_unit_gimp, unit); |
|
91 |
}
|
|
92 |
||
93 |
static const gchar * |
|
94 |
units_unit_get_identifier (GimpUnit unit) |
|
95 |
{
|
|
96 |
return _gimp_unit_get_identifier (the_unit_gimp, unit); |
|
97 |
}
|
|
98 |
||
99 |
static const gchar * |
|
100 |
units_unit_get_symbol (GimpUnit unit) |
|
101 |
{
|
|
102 |
return _gimp_unit_get_symbol (the_unit_gimp, unit); |
|
103 |
}
|
|
104 |
||
105 |
static const gchar * |
|
106 |
units_unit_get_abbreviation (GimpUnit unit) |
|
107 |
{
|
|
108 |
return _gimp_unit_get_abbreviation (the_unit_gimp, unit); |
|
109 |
}
|
|
110 |
||
111 |
static const gchar * |
|
112 |
units_unit_get_singular (GimpUnit unit) |
|
113 |
{
|
|
114 |
return _gimp_unit_get_singular (the_unit_gimp, unit); |
|
115 |
}
|
|
116 |
||
117 |
static const gchar * |
|
118 |
units_unit_get_plural (GimpUnit unit) |
|
119 |
{
|
|
120 |
return _gimp_unit_get_plural (the_unit_gimp, unit); |
|
121 |
}
|
|
122 |
||
123 |
void
|
|
124 |
units_init (Gimp *gimp) |
|
125 |
{
|
|
1.1.4
by Daniel Holbach
Import upstream version 2.3.16 |
126 |
GimpUnitVtable vtable; |
1
by Daniel Holbach
Import upstream version 2.2.9 |
127 |
|
128 |
g_return_if_fail (GIMP_IS_GIMP (gimp)); |
|
129 |
g_return_if_fail (the_unit_gimp == NULL); |
|
130 |
||
131 |
the_unit_gimp = gimp; |
|
132 |
||
133 |
vtable.unit_get_number_of_units = units_get_number_of_units; |
|
134 |
vtable.unit_get_number_of_built_in_units = units_get_number_of_built_in_units; |
|
1.1.4
by Daniel Holbach
Import upstream version 2.3.16 |
135 |
vtable.unit_new = units_unit_new; |
136 |
vtable.unit_get_deletion_flag = units_unit_get_deletion_flag; |
|
137 |
vtable.unit_set_deletion_flag = units_unit_set_deletion_flag; |
|
138 |
vtable.unit_get_factor = units_unit_get_factor; |
|
139 |
vtable.unit_get_digits = units_unit_get_digits; |
|
140 |
vtable.unit_get_identifier = units_unit_get_identifier; |
|
141 |
vtable.unit_get_symbol = units_unit_get_symbol; |
|
142 |
vtable.unit_get_abbreviation = units_unit_get_abbreviation; |
|
143 |
vtable.unit_get_singular = units_unit_get_singular; |
|
144 |
vtable.unit_get_plural = units_unit_get_plural; |
|
1
by Daniel Holbach
Import upstream version 2.2.9 |
145 |
|
146 |
gimp_base_init (&vtable); |
|
147 |
}
|