1
/* LIBGIMP - The GIMP Library
2
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
* GimpColorConfig class
5
* Copyright (C) 2004 Stefan Döhla <stefan@doehla.de>
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 2 of the License, or (at your option) any later version.
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.
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with this library; if not, write to the
19
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20
* Boston, MA 02111-1307, USA.
25
#include <glib-object.h>
27
#include "gimpconfigtypes.h"
29
#include "gimpcolorconfig-enums.h"
31
#include "gimpcolorconfig.h"
32
#include "gimpconfig-iface.h"
33
#include "gimpconfig-params.h"
34
#include "gimpconfig-path.h"
36
#include "libgimp/libgimp-intl.h"
39
#define COLOR_MANAGEMENT_MODE_BLURB \
40
N_("Mode of operation for color management.")
41
#define DISPLAY_PROFILE_BLURB \
42
N_("The color profile of your (primary) monitor.")
43
#define DISPLAY_PROFILE_FROM_GDK_BLURB \
44
N_("When enabled, GIMP will try to use the display color profile from " \
45
"the windowing system. The configured monitor profile is then only " \
46
"used as a fallback.")
47
#define RGB_PROFILE_BLURB \
48
N_("The default RGB working space color profile.")
49
#define CMYK_PROFILE_BLURB \
50
N_("The CMYK color profile used to convert between RGB and CMYK.")
51
#define PRINTER_PROFILE_BLURB \
52
N_("The color profile used for simulating a printed version (softproof).")
53
#define DISPLAY_RENDERING_INTENT_BLURB \
54
N_("Sets how colors are mapped for your display.")
55
#define SIMULATION_RENDERING_INTENT_BLURB \
56
N_("Sets how colors are converted from RGB working space to the " \
57
"print simulation device.")
67
PROP_DISPLAY_PROFILE_FROM_GDK,
69
PROP_DISPLAY_RENDERING_INTENT,
70
PROP_SIMULATION_RENDERING_INTENT,
75
static void gimp_color_config_finalize (GObject *object);
76
static void gimp_color_config_set_property (GObject *object,
80
static void gimp_color_config_get_property (GObject *object,
86
G_DEFINE_TYPE_WITH_CODE (GimpColorConfig, gimp_color_config, G_TYPE_OBJECT,
87
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL)
88
gimp_type_set_translation_domain (g_define_type_id,
89
GETTEXT_PACKAGE "-libgimp"))
91
#define parent_class gimp_color_config_parent_class
95
gimp_color_config_class_init (GimpColorConfigClass *klass)
97
GObjectClass *object_class = G_OBJECT_CLASS (klass);
99
object_class->finalize = gimp_color_config_finalize;
100
object_class->set_property = gimp_color_config_set_property;
101
object_class->get_property = gimp_color_config_get_property;
103
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_MODE,
104
"mode", COLOR_MANAGEMENT_MODE_BLURB,
105
GIMP_TYPE_COLOR_MANAGEMENT_MODE,
106
GIMP_COLOR_MANAGEMENT_DISPLAY,
107
GIMP_PARAM_STATIC_STRINGS);
108
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_RGB_PROFILE,
109
"rgb-profile", RGB_PROFILE_BLURB,
110
GIMP_CONFIG_PATH_FILE, NULL,
111
GIMP_PARAM_STATIC_STRINGS);
112
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_CMYK_PROFILE,
113
"cmyk-profile", CMYK_PROFILE_BLURB,
114
GIMP_CONFIG_PATH_FILE, NULL,
115
GIMP_PARAM_STATIC_STRINGS);
116
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_DISPLAY_PROFILE,
117
"display-profile", DISPLAY_PROFILE_BLURB,
118
GIMP_CONFIG_PATH_FILE, NULL,
119
GIMP_PARAM_STATIC_STRINGS);
120
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_DISPLAY_PROFILE_FROM_GDK,
121
"display-profile-from-gdk",
122
DISPLAY_PROFILE_FROM_GDK_BLURB,
124
GIMP_PARAM_STATIC_STRINGS);
125
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_PRINTER_PROFILE,
126
"printer-profile", PRINTER_PROFILE_BLURB,
127
GIMP_CONFIG_PATH_FILE, NULL,
128
GIMP_PARAM_STATIC_STRINGS);
129
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_DISPLAY_RENDERING_INTENT,
130
"display-rendering-intent",
131
DISPLAY_RENDERING_INTENT_BLURB,
132
GIMP_TYPE_COLOR_RENDERING_INTENT,
133
GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL,
134
GIMP_PARAM_STATIC_STRINGS);
135
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_SIMULATION_RENDERING_INTENT,
136
"simulation-rendering-intent",
137
SIMULATION_RENDERING_INTENT_BLURB,
138
GIMP_TYPE_COLOR_RENDERING_INTENT,
139
GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL,
140
GIMP_PARAM_STATIC_STRINGS);
141
GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_DISPLAY_MODULE,
142
"display-module", NULL,
144
GIMP_PARAM_STATIC_STRINGS);
148
gimp_color_config_init (GimpColorConfig *config)
153
gimp_color_config_finalize (GObject *object)
155
GimpColorConfig *color_config = GIMP_COLOR_CONFIG (object);
157
if (color_config->rgb_profile)
158
g_free (color_config->rgb_profile);
160
if (color_config->cmyk_profile)
161
g_free (color_config->cmyk_profile);
163
if (color_config->display_profile)
164
g_free (color_config->display_profile);
166
if (color_config->printer_profile)
167
g_free (color_config->printer_profile);
169
if (color_config->display_module)
170
g_free (color_config->display_module);
172
G_OBJECT_CLASS (parent_class)->finalize (object);
176
gimp_color_config_set_property (GObject *object,
181
GimpColorConfig *color_config = GIMP_COLOR_CONFIG (object);
186
color_config->mode = g_value_get_enum (value);
188
case PROP_RGB_PROFILE:
189
g_free (color_config->rgb_profile);
190
color_config->rgb_profile = g_value_dup_string (value);
192
case PROP_CMYK_PROFILE:
193
g_free (color_config->cmyk_profile);
194
color_config->cmyk_profile = g_value_dup_string (value);
196
case PROP_DISPLAY_PROFILE:
197
g_free (color_config->display_profile);
198
color_config->display_profile = g_value_dup_string (value);
200
case PROP_DISPLAY_PROFILE_FROM_GDK:
201
color_config->display_profile_from_gdk = g_value_get_boolean (value);
203
case PROP_PRINTER_PROFILE:
204
g_free (color_config->printer_profile);
205
color_config->printer_profile = g_value_dup_string (value);
207
case PROP_DISPLAY_RENDERING_INTENT:
208
color_config->display_intent = g_value_get_enum (value);
210
case PROP_SIMULATION_RENDERING_INTENT:
211
color_config->simulation_intent = g_value_get_enum (value);
213
case PROP_DISPLAY_MODULE:
214
g_free (color_config->display_module);
215
color_config->display_module = g_value_dup_string (value);
219
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
225
gimp_color_config_get_property (GObject *object,
230
GimpColorConfig *color_config = GIMP_COLOR_CONFIG (object);
235
g_value_set_enum (value, color_config->mode);
237
case PROP_RGB_PROFILE:
238
g_value_set_string (value, color_config->rgb_profile);
240
case PROP_CMYK_PROFILE:
241
g_value_set_string (value, color_config->cmyk_profile);
243
case PROP_DISPLAY_PROFILE:
244
g_value_set_string (value, color_config->display_profile);
246
case PROP_DISPLAY_PROFILE_FROM_GDK:
247
g_value_set_boolean (value, color_config->display_profile_from_gdk);
249
case PROP_PRINTER_PROFILE:
250
g_value_set_string (value, color_config->printer_profile);
252
case PROP_DISPLAY_RENDERING_INTENT:
253
g_value_set_enum (value, color_config->display_intent);
255
case PROP_SIMULATION_RENDERING_INTENT:
256
g_value_set_enum (value, color_config->simulation_intent);
258
case PROP_DISPLAY_MODULE:
259
g_value_set_string (value, color_config->display_module);
263
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);