1 /* LIBGIMP - The GIMP Library 2 * Copyright (C) 1995 Spencer Kimball and Peter Mattis 3 * 4 * ParamSpecs for config objects 5 * Copyright (C) 2001 Sven Neumann <sven@gimp.org> 6 * 7 * This library is free software: you can redistribute it and/or 8 * modify it under the terms of the GNU Lesser General Public 9 * License as published by the Free Software Foundation; either 10 * version 3 of the License, or (at your option) any later version. 11 * 12 * This library 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 GNU 15 * Library General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this library. If not, see 19 * <https://www.gnu.org/licenses/>. 20 */ 21 22 #if !defined (__GIMP_CONFIG_H_INSIDE__) && !defined (GIMP_CONFIG_COMPILATION) 23 #error "Only <libgimpconfig/gimpconfig.h> can be included directly." 24 #endif 25 26 #ifndef __GIMP_CONFIG_PARAMS_H__ 27 #define __GIMP_CONFIG_PARAMS_H__ 28 29 G_BEGIN_DECLS 30 31 /* For information look into the C source or the html documentation */ 32 33 34 /** 35 * SECTION: gimpconfig-params 36 * @title: GimpConfig-params 37 * @short_description: Macros and defines to install config properties. 38 * 39 * Macros and defines to install config properties. 40 **/ 41 42 43 /* 44 * GIMP_CONFIG_PARAM_SERIALIZE - A property that can and should be 45 * serialized and deserialized. 46 * GIMP_CONFIG_PARAM_AGGREGATE - The object property is to be treated as 47 * part of the parent object. 48 * GIMP_CONFIG_PARAM_RESTART - Changes to this property take effect only 49 * after a restart. 50 * GIMP_CONFIG_PARAM_CONFIRM - Changes to this property should be 51 * confirmed by the user before being applied. 52 * GIMP_CONFIG_PARAM_DEFAULTS - Don't serialize this property if it has the 53 * default value. 54 * GIMP_CONFIG_PARAM_IGNORE - This property exists for obscure reasons 55 * or is needed for backward compatibility. 56 * Ignore the value read and don't serialize it. 57 */ 58 59 #define GIMP_CONFIG_PARAM_SERIALIZE (1 << (0 + G_PARAM_USER_SHIFT)) 60 #define GIMP_CONFIG_PARAM_AGGREGATE (1 << (1 + G_PARAM_USER_SHIFT)) 61 #define GIMP_CONFIG_PARAM_RESTART (1 << (2 + G_PARAM_USER_SHIFT)) 62 #define GIMP_CONFIG_PARAM_CONFIRM (1 << (3 + G_PARAM_USER_SHIFT)) 63 #define GIMP_CONFIG_PARAM_DEFAULTS (1 << (4 + G_PARAM_USER_SHIFT)) 64 #define GIMP_CONFIG_PARAM_IGNORE (1 << (5 + G_PARAM_USER_SHIFT)) 65 66 #define GIMP_CONFIG_PARAM_FLAGS (G_PARAM_READWRITE | \ 67 G_PARAM_CONSTRUCT | \ 68 GIMP_CONFIG_PARAM_SERIALIZE) 69 70 71 72 /* some convenience macros to install object properties */ 73 74 #define GIMP_CONFIG_PROP_BOOLEAN(class, id, name, nick, blurb, default, flags) \ 75 g_object_class_install_property (class, id,\ 76 g_param_spec_boolean (name, nick, blurb,\ 77 default,\ 78 flags | GIMP_CONFIG_PARAM_FLAGS)) 79 80 #define GIMP_CONFIG_PROP_INT(class, id, name, nick, blurb, min, max, default, flags) \ 81 g_object_class_install_property (class, id,\ 82 g_param_spec_int (name, nick, blurb,\ 83 min, max, default,\ 84 flags | GIMP_CONFIG_PARAM_FLAGS)) 85 86 #define GIMP_CONFIG_PROP_UINT(class, id, name, nick, blurb, min, max, default, flags) \ 87 g_object_class_install_property (class, id,\ 88 g_param_spec_uint (name, nick, blurb,\ 89 min, max, default,\ 90 flags | GIMP_CONFIG_PARAM_FLAGS)) 91 92 #define GIMP_CONFIG_PROP_INT64(class, id, name, nick, blurb, min, max, default, flags) \ 93 g_object_class_install_property (class, id,\ 94 g_param_spec_int64 (name, nick, blurb,\ 95 min, max, default,\ 96 flags | GIMP_CONFIG_PARAM_FLAGS)) 97 98 #define GIMP_CONFIG_PROP_UINT64(class, id, name, nick, blurb, min, max, default, flags) \ 99 g_object_class_install_property (class, id,\ 100 g_param_spec_uint64 (name, nick, blurb,\ 101 min, max, default,\ 102 flags | GIMP_CONFIG_PARAM_FLAGS)) 103 104 #define GIMP_CONFIG_PROP_UNIT(class, id, name, nick, blurb, pixels, percent, default, flags) \ 105 g_object_class_install_property (class, id,\ 106 gimp_param_spec_unit (name, nick, blurb,\ 107 pixels, percent, default,\ 108 flags | GIMP_CONFIG_PARAM_FLAGS)) 109 110 #define GIMP_CONFIG_PROP_MEMSIZE(class, id, name, nick, blurb, min, max, default, flags) \ 111 g_object_class_install_property (class, id,\ 112 gimp_param_spec_memsize (name, nick, blurb,\ 113 min, max, default,\ 114 flags | GIMP_CONFIG_PARAM_FLAGS)) 115 116 #define GIMP_CONFIG_PROP_DOUBLE(class, id, name, nick, blurb, min, max, default, flags) \ 117 g_object_class_install_property (class, id,\ 118 g_param_spec_double (name, nick, blurb,\ 119 min, max, default,\ 120 flags | GIMP_CONFIG_PARAM_FLAGS)) 121 122 #define GIMP_CONFIG_PROP_RESOLUTION(class, id, name, nick, blurb, default, flags) \ 123 g_object_class_install_property (class, id,\ 124 g_param_spec_double (name, nick, blurb,\ 125 GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION, \ 126 default,\ 127 flags | GIMP_CONFIG_PARAM_FLAGS)) 128 129 #define GIMP_CONFIG_PROP_ENUM(class, id, name, nick, blurb, enum_type, default, flags) \ 130 g_object_class_install_property (class, id,\ 131 g_param_spec_enum (name, nick, blurb,\ 132 enum_type, default,\ 133 flags | GIMP_CONFIG_PARAM_FLAGS)) 134 135 #define GIMP_CONFIG_PROP_STRING(class, id, name, nick, blurb, default, flags) \ 136 g_object_class_install_property (class, id,\ 137 g_param_spec_string (name, nick, blurb,\ 138 default,\ 139 flags | GIMP_CONFIG_PARAM_FLAGS)) 140 141 #define GIMP_CONFIG_PROP_PATH(class, id, name, nick, blurb, path_type, default, flags) \ 142 g_object_class_install_property (class, id,\ 143 gimp_param_spec_config_path (name, nick, blurb,\ 144 path_type, default,\ 145 flags | GIMP_CONFIG_PARAM_FLAGS)) 146 147 #define GIMP_CONFIG_PROP_RGB(class, id, name, nick, blurb, has_alpha, default, flags) \ 148 g_object_class_install_property (class, id,\ 149 gimp_param_spec_rgb (name, nick, blurb,\ 150 has_alpha, default, \ 151 flags | GIMP_CONFIG_PARAM_FLAGS)) 152 153 #define GIMP_CONFIG_PROP_MATRIX2(class, id, name, nick, blurb, default, flags) \ 154 g_object_class_install_property (class, id,\ 155 gimp_param_spec_matrix2 (name, nick, blurb,\ 156 default,\ 157 flags | GIMP_CONFIG_PARAM_FLAGS)) 158 159 160 /* object, boxed and pointer properties are _not_ G_PARAM_CONSTRUCT */ 161 162 #define GIMP_CONFIG_PROP_OBJECT(class, id, name, nick, blurb, object_type, flags) \ 163 g_object_class_install_property (class, id,\ 164 g_param_spec_object (name, nick, blurb,\ 165 object_type,\ 166 flags |\ 167 G_PARAM_READWRITE |\ 168 GIMP_CONFIG_PARAM_SERIALIZE)) 169 170 #define GIMP_CONFIG_PROP_BOXED(class, id, name, nick, blurb, boxed_type, flags) \ 171 g_object_class_install_property (class, id,\ 172 g_param_spec_boxed (name, nick, blurb,\ 173 boxed_type,\ 174 flags |\ 175 G_PARAM_READWRITE |\ 176 GIMP_CONFIG_PARAM_SERIALIZE)) 177 178 #define GIMP_CONFIG_PROP_POINTER(class, id, name, nick, blurb, flags) \ 179 g_object_class_install_property (class, id,\ 180 g_param_spec_pointer (name, nick, blurb,\ 181 flags |\ 182 G_PARAM_READWRITE |\ 183 GIMP_CONFIG_PARAM_SERIALIZE)) 184 185 186 /* deprecated macros, they all lack the "nick" parameter */ 187 188 #ifndef GIMP_DISABLE_DEPRECATED 189 190 #define GIMP_CONFIG_INSTALL_PROP_BOOLEAN(class, id, name, blurb, default, flags) \ 191 GIMP_CONFIG_PROP_BOOLEAN(class, id, name, NULL, blurb, default, flags); 192 193 #define GIMP_CONFIG_INSTALL_PROP_INT(class, id, name, blurb, min, max, default, flags) \ 194 GIMP_CONFIG_PROP_INT(class, id, name, NULL, blurb, min, max, default, flags) 195 196 #define GIMP_CONFIG_INSTALL_PROP_UINT(class, id, name, blurb, min, max, default, flags) \ 197 GIMP_CONFIG_PROP_UINT(class, id, name, NULL, blurb, min, max, default, flags) 198 199 #define GIMP_CONFIG_INSTALL_PROP_UNIT(class, id, name, blurb, pixels, percent, default, flags) \ 200 GIMP_CONFIG_PROP_UNIT(class, id, name, NULL, blurb, pixels, percent, default, flags) 201 202 #define GIMP_CONFIG_INSTALL_PROP_MEMSIZE(class, id, name, blurb, min, max, default, flags) \ 203 GIMP_CONFIG_PROP_MEMSIZE(class, id, name, NULL, blurb, min, max, default, flags) 204 205 #define GIMP_CONFIG_INSTALL_PROP_DOUBLE(class, id, name, blurb, min, max, default, flags) \ 206 GIMP_CONFIG_PROP_DOUBLE(class, id, name, NULL, blurb, min, max, default, flags) 207 208 #define GIMP_CONFIG_INSTALL_PROP_RESOLUTION(class, id, name, blurb, default, flags) \ 209 GIMP_CONFIG_PROP_RESOLUTION(class, id, name, NULL, blurb, default, flags) 210 211 #define GIMP_CONFIG_INSTALL_PROP_ENUM(class, id, name, blurb, enum_type, default, flags) \ 212 GIMP_CONFIG_PROP_ENUM(class, id, name, NULL, blurb, enum_type, default, flags) 213 214 #define GIMP_CONFIG_INSTALL_PROP_STRING(class, id, name, blurb, default, flags) \ 215 GIMP_CONFIG_PROP_STRING(class, id, name, NULL, blurb, default, flags) 216 217 #define GIMP_CONFIG_INSTALL_PROP_PATH(class, id, name, blurb, path_type, default, flags) \ 218 GIMP_CONFIG_PROP_PATH(class, id, name, NULL, blurb, path_type, default, flags) 219 220 #define GIMP_CONFIG_INSTALL_PROP_RGB(class, id, name, blurb, has_alpha, default, flags) \ 221 GIMP_CONFIG_PROP_RGB(class, id, name, NULL, blurb, has_alpha, default, flags) 222 223 #define GIMP_CONFIG_INSTALL_PROP_MATRIX2(class, id, name, blurb, default, flags) \ 224 GIMP_CONFIG_PROP_MATRIX2(class, id, name, NULL, blurb, default, flags) 225 226 #define GIMP_CONFIG_INSTALL_PROP_OBJECT(class, id, name, blurb, object_type, flags) \ 227 GIMP_CONFIG_PROP_OBJECT(class, id, name, NULL, blurb, object_type, flags) 228 229 #define GIMP_CONFIG_INSTALL_PROP_BOXED(class, id, name, blurb, boxed_type, flags) \ 230 GIMP_CONFIG_PROP_BOXED(class, id, name, NULL, blurb, boxed_type, flags) 231 232 #define GIMP_CONFIG_INSTALL_PROP_POINTER(class, id, name, blurb, flags) \ 233 GIMP_CONFIG_PROP_POINTER(class, id, name, NULL, blurb, flags) 234 235 #endif /* GIMP_DISABLE_DEPRECATED */ 236 237 238 G_END_DECLS 239 240 #endif /* __GIMP_CONFIG_PARAMS_H__ */ 241