~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to app/widgets/gimpcoloreditor.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* The GIMP -- an image manipulation program
 
1
/* GIMP - The GNU Image Manipulation Program
2
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
3
 *
4
4
 * gimpcoloreditor.c
31
31
 
32
32
#include "widgets-types.h"
33
33
 
 
34
#include "config/gimpcoreconfig.h"
 
35
 
 
36
#include "core/gimp.h"
34
37
#include "core/gimpcontext.h"
35
38
 
36
39
#include "gimpcoloreditor.h"
37
40
#include "gimpdocked.h"
38
41
#include "gimpfgbgeditor.h"
 
42
#include "gimpfgbgview.h"
39
43
#include "gimpsessioninfo.h"
40
44
 
41
45
#include "gimp-intl.h"
42
46
 
43
47
 
44
 
static void   gimp_color_editor_class_init        (GimpColorEditorClass *klass);
45
 
static void   gimp_color_editor_init              (GimpColorEditor      *editor);
46
 
static void   gimp_color_editor_docked_iface_init (GimpDockedInterface  *docked_iface);
 
48
enum
 
49
{
 
50
  PROP_0,
 
51
  PROP_CONTEXT
 
52
};
 
53
 
 
54
 
 
55
static void   gimp_color_editor_docked_iface_init (GimpDockedInterface  *iface);
 
56
 
 
57
static void   gimp_color_editor_set_property    (GObject           *object,
 
58
                                                 guint              property_id,
 
59
                                                 const GValue      *value,
 
60
                                                 GParamSpec        *pspec);
 
61
static void   gimp_color_editor_get_property    (GObject           *object,
 
62
                                                 guint              property_id,
 
63
                                                 GValue            *value,
 
64
                                                 GParamSpec        *pspec);
47
65
 
48
66
static void   gimp_color_editor_destroy         (GtkObject         *object);
 
67
 
49
68
static void   gimp_color_editor_style_set       (GtkWidget         *widget,
50
69
                                                 GtkStyle          *prev_style);
51
70
 
52
71
static void   gimp_color_editor_set_aux_info    (GimpDocked        *docked,
53
72
                                                 GList             *aux_info);
54
73
static GList *gimp_color_editor_get_aux_info     (GimpDocked       *docked);
 
74
static GtkWidget *gimp_color_editor_get_preview (GimpDocked        *docked,
 
75
                                                 GimpContext       *context,
 
76
                                                 GtkIconSize        size);
55
77
static void   gimp_color_editor_set_context     (GimpDocked        *docked,
56
78
                                                 GimpContext       *context);
57
79
 
58
 
static void   gimp_color_editor_destroy         (GtkObject         *object);
59
 
 
60
80
static void   gimp_color_editor_fg_changed      (GimpContext       *context,
61
81
                                                 const GimpRGB     *rgb,
62
82
                                                 GimpColorEditor   *editor);
75
95
static void   gimp_color_editor_color_picked    (GtkWidget         *widget,
76
96
                                                 const GimpRGB     *rgb,
77
97
                                                 GimpColorEditor   *editor);
78
 
 
79
 
 
80
 
static GimpEditorClass *parent_class = NULL;
81
 
 
82
 
 
83
 
GType
84
 
gimp_color_editor_get_type (void)
85
 
{
86
 
  static GType type = 0;
87
 
 
88
 
  if (! type)
89
 
    {
90
 
      static const GTypeInfo editor_info =
91
 
      {
92
 
        sizeof (GimpColorEditorClass),
93
 
        (GBaseInitFunc) NULL,
94
 
        (GBaseFinalizeFunc) NULL,
95
 
        (GClassInitFunc) gimp_color_editor_class_init,
96
 
        NULL,           /* class_finalize */
97
 
        NULL,           /* class_data     */
98
 
        sizeof (GimpColorEditor),
99
 
        0,              /* n_preallocs    */
100
 
        (GInstanceInitFunc) gimp_color_editor_init,
101
 
      };
102
 
      static const GInterfaceInfo docked_iface_info =
103
 
      {
104
 
        (GInterfaceInitFunc) gimp_color_editor_docked_iface_init,
105
 
        NULL,           /* iface_finalize */
106
 
        NULL            /* iface_data     */
107
 
      };
108
 
 
109
 
      type = g_type_register_static (GIMP_TYPE_EDITOR,
110
 
                                     "GimpColorEditor",
111
 
                                     &editor_info, 0);
112
 
 
113
 
      g_type_add_interface_static (type, GIMP_TYPE_DOCKED,
114
 
                                   &docked_iface_info);
115
 
    }
116
 
 
117
 
  return type;
118
 
}
 
98
static void   gimp_color_editor_entry_changed   (GimpColorHexEntry *entry,
 
99
                                                 GimpColorEditor   *editor);
 
100
 
 
101
 
 
102
G_DEFINE_TYPE_WITH_CODE (GimpColorEditor, gimp_color_editor, GIMP_TYPE_EDITOR,
 
103
                         G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED,
 
104
                                                gimp_color_editor_docked_iface_init))
 
105
 
 
106
#define parent_class gimp_color_editor_parent_class
 
107
 
 
108
static GimpDockedInterface *parent_docked_iface = NULL;
 
109
 
119
110
 
120
111
static void
121
112
gimp_color_editor_class_init (GimpColorEditorClass* klass)
122
113
{
123
 
  GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
124
 
  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
125
 
 
126
 
  parent_class = g_type_class_peek_parent (klass);
127
 
 
128
 
  object_class->destroy = gimp_color_editor_destroy;
129
 
 
130
 
  widget_class->style_set = gimp_color_editor_style_set;
 
114
  GObjectClass   *object_class     = G_OBJECT_CLASS (klass);
 
115
  GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
 
116
  GtkWidgetClass *widget_class     = GTK_WIDGET_CLASS (klass);
 
117
 
 
118
  object_class->set_property = gimp_color_editor_set_property;
 
119
  object_class->get_property = gimp_color_editor_get_property;
 
120
 
 
121
  gtk_object_class->destroy  = gimp_color_editor_destroy;
 
122
 
 
123
  widget_class->style_set    = gimp_color_editor_style_set;
 
124
 
 
125
  g_object_class_install_property (object_class, PROP_CONTEXT,
 
126
                                   g_param_spec_object ("context",
 
127
                                                        NULL, NULL,
 
128
                                                        GIMP_TYPE_CONTEXT,
 
129
                                                        GIMP_PARAM_READWRITE));
 
130
}
 
131
 
 
132
static void
 
133
gimp_color_editor_docked_iface_init (GimpDockedInterface *iface)
 
134
{
 
135
  parent_docked_iface = g_type_interface_peek_parent (iface);
 
136
 
 
137
  if (! parent_docked_iface)
 
138
    parent_docked_iface = g_type_default_interface_peek (GIMP_TYPE_DOCKED);
 
139
 
 
140
  iface->get_preview  = gimp_color_editor_get_preview;
 
141
  iface->set_aux_info = gimp_color_editor_set_aux_info;
 
142
  iface->get_aux_info = gimp_color_editor_get_aux_info;
 
143
  iface->set_context  = gimp_color_editor_set_context;
131
144
}
132
145
 
133
146
static void
134
147
gimp_color_editor_init (GimpColorEditor *editor)
135
148
{
136
149
  GtkWidget   *notebook;
 
150
  GtkWidget   *hbox;
 
151
  GtkWidget   *vbox;
 
152
  GtkWidget   *button;
137
153
  gint         content_spacing;
138
154
  gint         button_spacing;
139
155
  GtkIconSize  button_icon_size;
149
165
  gimp_rgb_to_hsv (&rgb, &hsv);
150
166
 
151
167
  gtk_widget_style_get (GTK_WIDGET (editor),
152
 
                        "content_spacing",  &content_spacing,
153
 
                        "button_spacing",   &button_spacing,
154
 
                        "button_icon_size", &button_icon_size,
155
 
                        NULL);
 
168
                        "content-spacing",  &content_spacing,
 
169
                        "button-spacing",   &button_spacing,
 
170
                        "button-icon-size", &button_icon_size,
 
171
                        NULL);
156
172
 
157
173
  editor->hbox = gtk_hbox_new (TRUE, button_spacing);
158
174
  gtk_box_pack_start (GTK_BOX (editor), editor->hbox, FALSE, FALSE, 0);
167
183
                      TRUE, TRUE, content_spacing);
168
184
  gtk_widget_show (editor->notebook);
169
185
 
170
 
  g_signal_connect (editor->notebook, "color_changed",
 
186
  g_signal_connect (editor->notebook, "color-changed",
171
187
                    G_CALLBACK (gimp_color_editor_color_changed),
172
188
                    editor);
173
189
 
205
221
      gtk_widget_show (image);
206
222
 
207
223
      gimp_help_set_help_data (button,
208
 
                               selector_class->name, selector_class->help_id);
 
224
                               selector_class->name, selector_class->help_id);
209
225
 
210
226
      g_object_set_data (G_OBJECT (button),   "selector", selector);
211
227
      g_object_set_data (G_OBJECT (selector), "button",   button);
215
231
                        editor);
216
232
    }
217
233
 
218
 
  /*  The color picker  */
219
 
  {
220
 
    GtkWidget *button;
221
 
 
222
 
    button = gimp_pick_button_new ();
223
 
    gtk_box_pack_start (GTK_BOX (editor->hbox), button, TRUE, TRUE, 0);
224
 
    gtk_widget_show (button);
225
 
 
226
 
    g_signal_connect (button, "color_picked",
227
 
                      G_CALLBACK (gimp_color_editor_color_picked),
228
 
                      editor);
229
 
  }
 
234
  hbox = gtk_hbox_new (TRUE, 6);
 
235
  gtk_box_pack_start (GTK_BOX (editor), hbox, FALSE, FALSE, 0);
 
236
  gtk_widget_show (hbox);
230
237
 
231
238
  /*  FG/BG editor  */
232
239
  editor->fg_bg = gimp_fg_bg_editor_new (NULL);
233
 
  gtk_widget_set_size_request (editor->fg_bg, -1, 48);
234
 
  gtk_box_pack_start (GTK_BOX (editor), editor->fg_bg, FALSE, FALSE, 0);
 
240
  gtk_box_pack_start (GTK_BOX (hbox), editor->fg_bg, TRUE, TRUE, 0);
235
241
  gtk_widget_show (editor->fg_bg);
236
242
 
237
243
  g_signal_connect (editor->fg_bg, "notify::active-color",
238
244
                    G_CALLBACK (gimp_color_editor_fg_bg_notify),
239
245
                    editor);
240
 
}
241
 
 
242
 
static void
243
 
gimp_color_editor_docked_iface_init (GimpDockedInterface *docked_iface)
244
 
{
245
 
  docked_iface->set_aux_info = gimp_color_editor_set_aux_info;
246
 
  docked_iface->get_aux_info = gimp_color_editor_get_aux_info;
247
 
  docked_iface->set_context  = gimp_color_editor_set_context;
 
246
 
 
247
  vbox = gtk_vbox_new (FALSE, 3);
 
248
  gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
 
249
  gtk_widget_show (vbox);
 
250
 
 
251
  /*  The color picker  */
 
252
  button = gimp_pick_button_new ();
 
253
  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
 
254
  gtk_widget_show (button);
 
255
 
 
256
  g_signal_connect (button, "color-picked",
 
257
                    G_CALLBACK (gimp_color_editor_color_picked),
 
258
                    editor);
 
259
 
 
260
  /*  The hex triplet entry  */
 
261
  editor->hex_entry = gimp_color_hex_entry_new ();
 
262
  gimp_help_set_help_data (editor->hex_entry,
 
263
                           _("Hexadecimal color notation as used in HTML and "
 
264
                             "CSS.  This entry also accepts CSS color names."),
 
265
                           NULL);
 
266
  gtk_box_pack_end (GTK_BOX (vbox), editor->hex_entry, FALSE, FALSE, 0);
 
267
  gtk_widget_show (editor->hex_entry);
 
268
 
 
269
  g_signal_connect (editor->hex_entry, "color-changed",
 
270
                    G_CALLBACK (gimp_color_editor_entry_changed),
 
271
                    editor);
 
272
}
 
273
 
 
274
static void
 
275
gimp_color_editor_set_property (GObject      *object,
 
276
                                guint         property_id,
 
277
                                const GValue *value,
 
278
                                GParamSpec   *pspec)
 
279
{
 
280
  switch (property_id)
 
281
    {
 
282
    case PROP_CONTEXT:
 
283
      gimp_docked_set_context (GIMP_DOCKED (object),
 
284
                               g_value_get_object (value));
 
285
      break;
 
286
    default:
 
287
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
288
      break;
 
289
    }
 
290
}
 
291
 
 
292
static void
 
293
gimp_color_editor_get_property (GObject    *object,
 
294
                                guint       property_id,
 
295
                                GValue     *value,
 
296
                                GParamSpec *pspec)
 
297
{
 
298
  GimpColorEditor *editor = GIMP_COLOR_EDITOR (object);
 
299
 
 
300
  switch (property_id)
 
301
    {
 
302
    case PROP_CONTEXT:
 
303
      g_value_set_object (value, editor->context);
 
304
      break;
 
305
    default:
 
306
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
307
      break;
 
308
    }
 
309
}
 
310
 
 
311
static void
 
312
gimp_color_editor_destroy (GtkObject *object)
 
313
{
 
314
  GimpColorEditor *editor = GIMP_COLOR_EDITOR (object);
 
315
 
 
316
  if (editor->context)
 
317
    gimp_docked_set_context (GIMP_DOCKED (editor), NULL);
 
318
 
 
319
  GTK_OBJECT_CLASS (parent_class)->destroy (object);
 
320
}
 
321
 
 
322
static GtkWidget *
 
323
gimp_color_editor_get_preview (GimpDocked  *docked,
 
324
                               GimpContext *context,
 
325
                               GtkIconSize  size)
 
326
{
 
327
  GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (docked));
 
328
  GtkWidget   *preview;
 
329
  gint         width;
 
330
  gint         height;
 
331
 
 
332
  preview = gimp_fg_bg_view_new (context);
 
333
 
 
334
  if (gtk_icon_size_lookup_for_settings (settings, size, &width, &height))
 
335
    gtk_widget_set_size_request (preview, width, height);
 
336
 
 
337
  return preview;
248
338
}
249
339
 
250
340
#define AUX_INFO_CURRENT_PAGE "current-page"
257
347
  GtkWidget       *notebook = GIMP_COLOR_NOTEBOOK (editor->notebook)->notebook;
258
348
  GList           *list;
259
349
 
 
350
  parent_docked_iface->set_aux_info (docked, aux_info);
 
351
 
260
352
  for (list = aux_info; list; list = g_list_next (list))
261
353
    {
262
354
      GimpSessionInfoAux *aux = list->data;
294
386
{
295
387
  GimpColorEditor    *editor   = GIMP_COLOR_EDITOR (docked);
296
388
  GimpColorNotebook  *notebook = GIMP_COLOR_NOTEBOOK (editor->notebook);
297
 
  GList              *aux_info = NULL;
 
389
  GList              *aux_info;
 
390
 
 
391
  aux_info = parent_docked_iface->get_aux_info (docked);
298
392
 
299
393
  if (notebook->cur_page)
300
394
    {
320
414
  if (editor->context)
321
415
    {
322
416
      g_signal_handlers_disconnect_by_func (editor->context,
323
 
                                            gimp_color_editor_fg_changed,
324
 
                                            editor);
 
417
                                            gimp_color_editor_fg_changed,
 
418
                                            editor);
325
419
      g_signal_handlers_disconnect_by_func (editor->context,
326
 
                                            gimp_color_editor_bg_changed,
327
 
                                            editor);
 
420
                                            gimp_color_editor_bg_changed,
 
421
                                            editor);
328
422
 
329
423
      g_object_unref (editor->context);
330
 
      editor->context = NULL;
331
424
    }
332
425
 
333
 
  if (context)
 
426
  editor->context = context;
 
427
 
 
428
  if (editor->context)
334
429
    {
335
430
      GimpRGB rgb;
336
431
 
337
 
      editor->context = g_object_ref (context);
 
432
      g_object_ref (editor->context);
338
433
 
339
 
      g_signal_connect (editor->context, "foreground_changed",
340
 
                        G_CALLBACK (gimp_color_editor_fg_changed),
341
 
                        editor);
342
 
      g_signal_connect (editor->context, "background_changed",
343
 
                        G_CALLBACK (gimp_color_editor_bg_changed),
344
 
                        editor);
 
434
      g_signal_connect (editor->context, "foreground-changed",
 
435
                        G_CALLBACK (gimp_color_editor_fg_changed),
 
436
                        editor);
 
437
      g_signal_connect (editor->context, "background-changed",
 
438
                        G_CALLBACK (gimp_color_editor_bg_changed),
 
439
                        editor);
345
440
 
346
441
      if (editor->edit_bg)
347
442
        {
353
448
          gimp_context_get_foreground (editor->context, &rgb);
354
449
          gimp_color_editor_fg_changed (editor->context, &rgb, editor);
355
450
        }
 
451
 
 
452
      g_object_set_data (G_OBJECT (context->gimp->config->color_management),
 
453
                         "gimp-context", editor->context);
 
454
 
 
455
      gimp_color_selector_set_config (GIMP_COLOR_SELECTOR (editor->notebook),
 
456
                                      context->gimp->config->color_management);
 
457
 
 
458
      g_object_set_data (G_OBJECT (context->gimp->config->color_management),
 
459
                         "gimp-context", NULL);
356
460
    }
357
461
 
358
462
  gimp_fg_bg_editor_set_context (GIMP_FG_BG_EDITOR (editor->fg_bg), context);
359
463
}
360
464
 
361
 
static void
362
 
gimp_color_editor_destroy (GtkObject *object)
363
 
{
364
 
  GimpColorEditor *editor = GIMP_COLOR_EDITOR (object);
365
 
 
366
 
  if (editor->context)
367
 
    gimp_docked_set_context (GIMP_DOCKED (editor), NULL);
368
 
 
369
 
  GTK_OBJECT_CLASS (parent_class)->destroy (object);
370
 
}
371
 
 
372
 
 
373
 
/*  public functions  */
374
 
 
375
465
GtkWidget *
376
466
gimp_color_editor_new (GimpContext *context)
377
467
{
378
 
  GimpColorEditor *editor;
379
 
 
380
 
  g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL);
381
 
 
382
 
  editor = g_object_new (GIMP_TYPE_COLOR_EDITOR, NULL);
383
 
 
384
 
  if (context)
385
 
    gimp_docked_set_context (GIMP_DOCKED (editor), context);
386
 
 
387
 
  return GTK_WIDGET (editor);
 
468
  return g_object_new (GIMP_TYPE_COLOR_EDITOR,
 
469
                       "context", context,
 
470
                       NULL);
388
471
}
389
472
 
390
473
static void
401
484
}
402
485
 
403
486
 
404
 
/*  public functions  */
 
487
static void
 
488
gimp_color_editor_set_color (GimpColorEditor *editor,
 
489
                             const GimpRGB   *rgb)
 
490
{
 
491
  GimpHSV hsv;
 
492
 
 
493
  gimp_rgb_to_hsv (rgb, &hsv);
 
494
 
 
495
  g_signal_handlers_block_by_func (editor->notebook,
 
496
                                   gimp_color_editor_color_changed,
 
497
                                   editor);
 
498
 
 
499
  gimp_color_selector_set_color (GIMP_COLOR_SELECTOR (editor->notebook),
 
500
                                 rgb, &hsv);
 
501
 
 
502
  g_signal_handlers_unblock_by_func (editor->notebook,
 
503
                                     gimp_color_editor_color_changed,
 
504
                                     editor);
 
505
 
 
506
  g_signal_handlers_block_by_func (editor->hex_entry,
 
507
                                   gimp_color_editor_entry_changed,
 
508
                                   editor);
 
509
 
 
510
  gimp_color_hex_entry_set_color (GIMP_COLOR_HEX_ENTRY (editor->hex_entry),
 
511
                                  rgb);
 
512
 
 
513
  g_signal_handlers_unblock_by_func (editor->hex_entry,
 
514
                                     gimp_color_editor_entry_changed,
 
515
                                     editor);
 
516
}
405
517
 
406
518
static void
407
519
gimp_color_editor_fg_changed (GimpContext     *context,
409
521
                              GimpColorEditor *editor)
410
522
{
411
523
  if (! editor->edit_bg)
412
 
    {
413
 
      GimpHSV hsv;
414
 
 
415
 
      gimp_rgb_to_hsv (rgb, &hsv);
416
 
 
417
 
      g_signal_handlers_block_by_func (editor->notebook,
418
 
                                       gimp_color_editor_color_changed,
419
 
                                       editor);
420
 
 
421
 
      gimp_color_selector_set_color (GIMP_COLOR_SELECTOR (editor->notebook),
422
 
                                     rgb, &hsv);
423
 
 
424
 
      g_signal_handlers_unblock_by_func (editor->notebook,
425
 
                                         gimp_color_editor_color_changed,
426
 
                                         editor);
427
 
    }
 
524
    gimp_color_editor_set_color (editor, rgb);
428
525
}
429
526
 
430
527
static void
433
530
                              GimpColorEditor *editor)
434
531
{
435
532
  if (editor->edit_bg)
436
 
    {
437
 
      GimpHSV hsv;
438
 
 
439
 
      gimp_rgb_to_hsv (rgb, &hsv);
440
 
 
441
 
      g_signal_handlers_block_by_func (editor->notebook,
442
 
                                       gimp_color_editor_color_changed,
443
 
                                       editor);
444
 
 
445
 
      gimp_color_selector_set_color (GIMP_COLOR_SELECTOR (editor->notebook),
446
 
                                     rgb, &hsv);
447
 
 
448
 
      g_signal_handlers_unblock_by_func (editor->notebook,
449
 
                                         gimp_color_editor_color_changed,
450
 
                                         editor);
451
 
    }
 
533
    gimp_color_editor_set_color (editor, rgb);
452
534
}
453
535
 
454
536
static void
484
566
                                             editor);
485
567
        }
486
568
    }
 
569
 
 
570
  g_signal_handlers_block_by_func (editor->hex_entry,
 
571
                                   gimp_color_editor_entry_changed,
 
572
                                   editor);
 
573
 
 
574
  gimp_color_hex_entry_set_color (GIMP_COLOR_HEX_ENTRY (editor->hex_entry),
 
575
                                  rgb);
 
576
 
 
577
  g_signal_handlers_unblock_by_func (editor->hex_entry,
 
578
                                     gimp_color_editor_entry_changed,
 
579
                                     editor);
487
580
}
488
581
 
489
582
static void
556
649
        gimp_context_set_foreground (editor->context, rgb);
557
650
    }
558
651
}
 
652
 
 
653
static void
 
654
gimp_color_editor_entry_changed (GimpColorHexEntry *entry,
 
655
                                 GimpColorEditor   *editor)
 
656
{
 
657
  GimpRGB  rgb;
 
658
 
 
659
  gimp_color_hex_entry_get_color (entry, &rgb);
 
660
 
 
661
  if (editor->context)
 
662
    {
 
663
      if (editor->edit_bg)
 
664
        gimp_context_set_background (editor->context, &rgb);
 
665
      else
 
666
        gimp_context_set_foreground (editor->context, &rgb);
 
667
    }
 
668
}