1
/* The GIMP -- an image manipulation program
2
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
* ParamSpecs for config objects
5
* Copyright (C) 2001 Sven Neumann <sven@gimp.org>
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
#ifndef __GIMP_CONFIG_PARAMS_H__
23
#define __GIMP_CONFIG_PARAMS_H__
27
* GIMP_PARAM_SERIALIZE - A property that can and should be
28
* serialized and deserialized.
29
* GIMP_PARAM_AGGREGATE - The object property is to be treated as
30
* part of the parent object.
31
* GIMP_PARAM_RESTART - Changes to this property take effect only
33
* GIMP_PARAM_CONFIRM - Changes to this property should be
34
* confirmed by the user before being applied.
35
* GIMP_PARAM_DEFAULTS - Don't serialize this property if it has the
37
* GIMP_PARAM_IGNORE - This property exists for obscure reasons
38
* and is needed for backward compatibility.
39
* Ignore the value read and don't serialize it.
42
#define GIMP_PARAM_SERIALIZE (1 << (0 + G_PARAM_USER_SHIFT))
43
#define GIMP_PARAM_AGGREGATE (1 << (1 + G_PARAM_USER_SHIFT))
44
#define GIMP_PARAM_RESTART (1 << (2 + G_PARAM_USER_SHIFT))
45
#define GIMP_PARAM_CONFIRM (1 << (3 + G_PARAM_USER_SHIFT))
46
#define GIMP_PARAM_DEFAULTS (1 << (4 + G_PARAM_USER_SHIFT))
47
#define GIMP_PARAM_IGNORE (1 << (5 + G_PARAM_USER_SHIFT))
49
#define GIMP_CONFIG_PARAM_FLAGS (G_PARAM_READWRITE | \
58
#define GIMP_TYPE_PARAM_RGB (gimp_param_rgb_get_type ())
59
#define GIMP_IS_PARAM_SPEC_RGB(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_RGB))
61
GType gimp_param_rgb_get_type (void) G_GNUC_CONST;
63
GParamSpec * gimp_param_spec_rgb (const gchar *name,
66
const GimpRGB *default_value,
71
* GIMP_TYPE_PARAM_MATRIX2
74
#define GIMP_TYPE_PARAM_MATRIX2 (gimp_param_matrix2_get_type ())
75
#define GIMP_IS_PARAM_SPEC_MATRIX2(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_MATRIX2))
77
GType gimp_param_matrix2_get_type (void) G_GNUC_CONST;
79
GParamSpec * gimp_param_spec_matrix2 (const gchar *name,
82
const GimpMatrix2 *default_value,
87
* GIMP_TYPE_PARAM_MEMSIZE
90
#define GIMP_TYPE_PARAM_MEMSIZE (gimp_param_memsize_get_type ())
91
#define GIMP_IS_PARAM_SPEC_MEMSIZE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_MEMSIZE))
93
GType gimp_param_memsize_get_type (void) G_GNUC_CONST;
95
GParamSpec * gimp_param_spec_memsize (const gchar *name,
100
guint64 default_value,
105
* GIMP_TYPE_PARAM_PATH
110
GIMP_PARAM_PATH_FILE,
111
GIMP_PARAM_PATH_FILE_LIST,
113
GIMP_PARAM_PATH_DIR_LIST
116
#define GIMP_TYPE_PARAM_PATH (gimp_param_path_get_type ())
117
#define GIMP_IS_PARAM_SPEC_PATH(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_PATH))
119
GType gimp_param_path_get_type (void) G_GNUC_CONST;
121
GParamSpec * gimp_param_spec_path (const gchar *name,
124
GimpParamPathType type,
125
gchar *default_value,
128
GimpParamPathType gimp_param_spec_path_type (GParamSpec *pspec);
132
* GIMP_TYPE_PARAM_UNIT
135
#define GIMP_TYPE_PARAM_UNIT (gimp_param_unit_get_type ())
136
#define GIMP_IS_PARAM_SPEC_UNIT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_UNIT))
138
GType gimp_param_unit_get_type (void) G_GNUC_CONST;
140
GParamSpec * gimp_param_spec_unit (const gchar *name,
143
gboolean allow_pixels,
144
gboolean allow_percent,
145
GimpUnit default_value,
149
/* some convenience macros to install object properties */
151
#define GIMP_CONFIG_INSTALL_PROP_BOOLEAN(class, id,\
152
name, blurb, default, flags)\
153
g_object_class_install_property (class, id,\
154
g_param_spec_boolean (name, NULL, blurb,\
156
flags | GIMP_CONFIG_PARAM_FLAGS))
157
#define GIMP_CONFIG_INSTALL_PROP_RGB(class, id,\
158
name, blurb, default, flags)\
159
g_object_class_install_property (class, id,\
160
gimp_param_spec_rgb (name, NULL, blurb,\
162
flags | GIMP_CONFIG_PARAM_FLAGS))
163
#define GIMP_CONFIG_INSTALL_PROP_DOUBLE(class, id,\
164
name, blurb, min, max, default, flags)\
165
g_object_class_install_property (class, id,\
166
g_param_spec_double (name, NULL, blurb,\
168
flags | GIMP_CONFIG_PARAM_FLAGS))
169
#define GIMP_CONFIG_INSTALL_PROP_RESOLUTION(class, id,\
170
name, blurb, default, flags)\
171
g_object_class_install_property (class, id,\
172
g_param_spec_double (name, NULL, blurb,\
173
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION, \
175
flags | GIMP_CONFIG_PARAM_FLAGS))
176
#define GIMP_CONFIG_INSTALL_PROP_ENUM(class, id,\
177
name, blurb, enum_type, default, flags)\
178
g_object_class_install_property (class, id,\
179
g_param_spec_enum (name, NULL, blurb,\
181
flags | GIMP_CONFIG_PARAM_FLAGS))
182
#define GIMP_CONFIG_INSTALL_PROP_INT(class, id,\
183
name, blurb, min, max, default, flags)\
184
g_object_class_install_property (class, id,\
185
g_param_spec_int (name, NULL, blurb,\
187
flags | GIMP_CONFIG_PARAM_FLAGS))
188
#define GIMP_CONFIG_INSTALL_PROP_MATRIX2(class, id,\
189
name, blurb, default, flags)\
190
g_object_class_install_property (class, id,\
191
gimp_param_spec_matrix2 (name, NULL, blurb,\
193
flags | GIMP_CONFIG_PARAM_FLAGS))
194
#define GIMP_CONFIG_INSTALL_PROP_MEMSIZE(class, id,\
195
name, blurb, min, max, default, flags)\
196
g_object_class_install_property (class, id,\
197
gimp_param_spec_memsize (name, NULL, blurb,\
199
flags | GIMP_CONFIG_PARAM_FLAGS))
200
#define GIMP_CONFIG_INSTALL_PROP_PATH(class, id,\
201
name, blurb, type, default, flags)\
202
g_object_class_install_property (class, id,\
203
gimp_param_spec_path (name, NULL, blurb,\
205
flags | GIMP_CONFIG_PARAM_FLAGS))
206
#define GIMP_CONFIG_INSTALL_PROP_STRING(class, id,\
207
name, blurb, default, flags)\
208
g_object_class_install_property (class, id,\
209
g_param_spec_string (name, NULL, blurb,\
211
flags | GIMP_CONFIG_PARAM_FLAGS))
212
#define GIMP_CONFIG_INSTALL_PROP_UINT(class, id,\
213
name, blurb, min, max, default, flags)\
214
g_object_class_install_property (class, id,\
215
g_param_spec_uint (name, NULL, blurb,\
217
flags | GIMP_CONFIG_PARAM_FLAGS))
218
#define GIMP_CONFIG_INSTALL_PROP_UNIT(class, id,\
219
name, blurb, pixels, percent, default, flags)\
220
g_object_class_install_property (class, id,\
221
gimp_param_spec_unit (name, NULL, blurb,\
222
pixels, percent, default,\
223
flags | GIMP_CONFIG_PARAM_FLAGS))
226
/* object and pointer properties are _not_ G_PARAM_CONSTRUCT */
228
#define GIMP_CONFIG_INSTALL_PROP_OBJECT(class, id,\
229
name, blurb, object_type, flags)\
230
g_object_class_install_property (class, id,\
231
g_param_spec_object (name, NULL, blurb,\
234
G_PARAM_READWRITE | GIMP_PARAM_SERIALIZE))
236
#define GIMP_CONFIG_INSTALL_PROP_POINTER(class, id,\
238
g_object_class_install_property (class, id,\
239
g_param_spec_pointer (name, NULL, blurb,\
241
G_PARAM_READWRITE | GIMP_PARAM_SERIALIZE))
244
#endif /* __GIMP_CONFIG_PARAMS_H__ */