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

« back to all changes in this revision

Viewing changes to app/display/gimpdisplayshell-appearance.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
 * This program is free software; you can redistribute it and/or modify
30
30
#include "core/gimpimage.h"
31
31
 
32
32
#include "widgets/gimpactiongroup.h"
 
33
#include "widgets/gimprender.h"
33
34
#include "widgets/gimpuimanager.h"
34
35
#include "widgets/gimpwidgets-utils.h"
35
36
 
40
41
#include "gimpdisplayshell-appearance.h"
41
42
#include "gimpdisplayshell-callbacks.h"
42
43
#include "gimpdisplayshell-selection.h"
43
 
#include "gimpdisplayshell-render.h"
44
44
 
45
45
 
46
46
#define GET_OPTIONS(shell) \
58
58
    gimp_action_group_set_action_color (group, action_name, color, FALSE); }
59
59
 
60
60
#define IS_ACTIVE_DISPLAY(shell) \
61
 
  ((shell)->gdisp == \
 
61
  ((shell)->display == \
62
62
   gimp_context_get_display (gimp_get_user_context \
63
 
                             ((shell)->gdisp->gimage->gimp)))
 
63
                             ((shell)->display->image->gimp)))
64
64
 
65
65
 
66
66
void
91
91
                                     gboolean          show)
92
92
{
93
93
  GimpDisplayOptions *options;
94
 
  GtkContainer       *vbox;
95
94
 
96
95
  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
97
96
 
99
98
 
100
99
  g_object_set (options, "show-menubar", show, NULL);
101
100
 
102
 
  vbox = GTK_CONTAINER (shell->qmask_button->parent->parent);
103
 
 
104
101
  if (shell->menubar)
105
102
    {
106
103
      if (show)
109
106
        gtk_widget_hide (shell->menubar);
110
107
    }
111
108
 
112
 
  if (options->show_menubar || options->show_statusbar)
113
 
    gtk_container_set_border_width (vbox, 2);
114
 
  else
115
 
    gtk_container_set_border_width (vbox, 0);
116
 
 
117
109
  SET_ACTIVE (shell->menubar_manager, "view-show-menubar", show);
118
110
 
119
111
  if (IS_ACTIVE_DISPLAY (shell))
145
137
 
146
138
  if (show)
147
139
    {
148
 
      gtk_widget_show (shell->origin_button);
 
140
      gtk_widget_show (shell->origin);
149
141
      gtk_widget_show (shell->hrule);
150
142
      gtk_widget_show (shell->vrule);
151
143
 
154
146
    }
155
147
  else
156
148
    {
157
 
      gtk_widget_hide (shell->origin_button);
 
149
      gtk_widget_hide (shell->origin);
158
150
      gtk_widget_hide (shell->hrule);
159
151
      gtk_widget_hide (shell->vrule);
160
152
 
198
190
      gtk_widget_show (shell->nav_ebox);
199
191
      gtk_widget_show (shell->hsb);
200
192
      gtk_widget_show (shell->vsb);
201
 
      gtk_widget_show (shell->qmask_button);
 
193
      gtk_widget_show (shell->quick_mask_button);
202
194
      gtk_widget_show (shell->zoom_button);
203
195
 
204
196
      gtk_box_set_spacing (hbox, 1);
209
201
      gtk_widget_hide (shell->nav_ebox);
210
202
      gtk_widget_hide (shell->hsb);
211
203
      gtk_widget_hide (shell->vsb);
212
 
      gtk_widget_hide (shell->qmask_button);
 
204
      gtk_widget_hide (shell->quick_mask_button);
213
205
      gtk_widget_hide (shell->zoom_button);
214
206
 
215
207
      gtk_box_set_spacing (hbox, 0);
235
227
                                       gboolean          show)
236
228
{
237
229
  GimpDisplayOptions *options;
238
 
  GtkContainer       *vbox;
239
230
 
240
231
  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
241
232
 
243
234
 
244
235
  g_object_set (options, "show-statusbar", show, NULL);
245
236
 
246
 
  vbox = GTK_CONTAINER (shell->qmask_button->parent->parent);
247
 
 
248
237
  if (show)
249
238
    gtk_widget_show (shell->statusbar);
250
239
  else
251
240
    gtk_widget_hide (shell->statusbar);
252
241
 
253
 
  if (options->show_menubar || options->show_statusbar)
254
 
    gtk_container_set_border_width (vbox, 2);
255
 
  else
256
 
    gtk_container_set_border_width (vbox, 0);
257
 
 
258
242
  SET_ACTIVE (shell->menubar_manager, "view-show-statusbar", show);
259
243
 
260
244
  if (IS_ACTIVE_DISPLAY (shell))
281
265
 
282
266
  g_object_set (options, "show-selection", show, NULL);
283
267
 
284
 
  if (shell->select)
285
 
    gimp_display_shell_selection_set_hidden (shell->select, ! show);
 
268
  gimp_display_shell_selection_set_hidden (shell, ! show);
286
269
 
287
270
  SET_ACTIVE (shell->menubar_manager, "view-show-selection", show);
288
271
 
310
293
 
311
294
  g_object_set (options, "show-layer-boundary", show, NULL);
312
295
 
313
 
  if (shell->select)
314
 
    gimp_display_shell_selection_layer_set_hidden (shell->select, ! show);
 
296
  gimp_display_shell_selection_layer_set_hidden (shell, ! show);
315
297
 
316
298
  SET_ACTIVE (shell->menubar_manager, "view-show-layer-boundary", show);
317
299
 
345
327
}
346
328
 
347
329
void
 
330
gimp_display_shell_set_show_guides (GimpDisplayShell *shell,
 
331
                                    gboolean          show)
 
332
{
 
333
  GimpDisplayOptions *options;
 
334
 
 
335
  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
 
336
 
 
337
  options = GET_OPTIONS (shell);
 
338
 
 
339
  g_object_set (options, "show-guides", show, NULL);
 
340
 
 
341
  if (shell->display->image->guides)
 
342
    gimp_display_shell_expose_full (shell);
 
343
 
 
344
  SET_ACTIVE (shell->menubar_manager, "view-show-guides", show);
 
345
 
 
346
  if (IS_ACTIVE_DISPLAY (shell))
 
347
    SET_ACTIVE (shell->popup_manager, "view-show-guides", show);
 
348
}
 
349
 
 
350
gboolean
 
351
gimp_display_shell_get_show_guides (GimpDisplayShell *shell)
 
352
{
 
353
  g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
 
354
 
 
355
  return GET_OPTIONS (shell)->show_guides;
 
356
}
 
357
 
 
358
void
348
359
gimp_display_shell_set_show_grid (GimpDisplayShell *shell,
349
360
                                  gboolean          show)
350
361
{
356
367
 
357
368
  g_object_set (options, "show-grid", show, NULL);
358
369
 
359
 
  if (shell->gdisp->gimage->grid)
 
370
  if (shell->display->image->grid)
360
371
    gimp_display_shell_expose_full (shell);
361
372
 
362
373
  SET_ACTIVE (shell->menubar_manager, "view-show-grid", show);
374
385
}
375
386
 
376
387
void
 
388
gimp_display_shell_set_show_sample_points (GimpDisplayShell *shell,
 
389
                                           gboolean          show)
 
390
{
 
391
  GimpDisplayOptions *options;
 
392
 
 
393
  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
 
394
 
 
395
  options = GET_OPTIONS (shell);
 
396
 
 
397
  g_object_set (options, "show-sample-points", show, NULL);
 
398
 
 
399
  if (shell->display->image->sample_points)
 
400
    gimp_display_shell_expose_full (shell);
 
401
 
 
402
  SET_ACTIVE (shell->menubar_manager, "view-show-sample-points", show);
 
403
 
 
404
  if (IS_ACTIVE_DISPLAY (shell))
 
405
    SET_ACTIVE (shell->popup_manager, "view-show-sample-points", show);
 
406
}
 
407
 
 
408
gboolean
 
409
gimp_display_shell_get_show_sample_points (GimpDisplayShell *shell)
 
410
{
 
411
  g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
 
412
 
 
413
  return GET_OPTIONS (shell)->show_sample_points;
 
414
}
 
415
 
 
416
void
377
417
gimp_display_shell_set_snap_to_grid (GimpDisplayShell *shell,
378
418
                                     gboolean          snap)
379
419
{
399
439
}
400
440
 
401
441
void
402
 
gimp_display_shell_set_show_guides (GimpDisplayShell *shell,
403
 
                                    gboolean          show)
404
 
{
405
 
  GimpDisplayOptions *options;
406
 
 
407
 
  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
408
 
 
409
 
  options = GET_OPTIONS (shell);
410
 
 
411
 
  g_object_set (options, "show-guides", show, NULL);
412
 
 
413
 
  if (shell->gdisp->gimage->guides)
414
 
    gimp_display_shell_expose_full (shell);
415
 
 
416
 
  SET_ACTIVE (shell->menubar_manager, "view-show-guides", show);
417
 
 
418
 
  if (IS_ACTIVE_DISPLAY (shell))
419
 
    SET_ACTIVE (shell->popup_manager, "view-show-guides", show);
420
 
}
421
 
 
422
 
gboolean
423
 
gimp_display_shell_get_show_guides (GimpDisplayShell *shell)
424
 
{
425
 
  g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
426
 
 
427
 
  return GET_OPTIONS (shell)->show_guides;
428
 
}
429
 
 
430
 
void
431
442
gimp_display_shell_set_snap_to_guides (GimpDisplayShell *shell,
432
443
                                       gboolean          snap)
433
444
{
453
464
}
454
465
 
455
466
void
 
467
gimp_display_shell_set_snap_to_canvas (GimpDisplayShell *shell,
 
468
                                       gboolean          snap)
 
469
{
 
470
  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
 
471
 
 
472
  if (snap != shell->snap_to_canvas)
 
473
    {
 
474
      shell->snap_to_canvas = snap ? TRUE : FALSE;
 
475
 
 
476
      SET_ACTIVE (shell->menubar_manager, "view-snap-to-canvas", snap);
 
477
 
 
478
      if (IS_ACTIVE_DISPLAY (shell))
 
479
        SET_ACTIVE (shell->popup_manager, "view-snap-to-canvas", snap);
 
480
    }
 
481
}
 
482
 
 
483
gboolean
 
484
gimp_display_shell_get_snap_to_canvas (GimpDisplayShell *shell)
 
485
{
 
486
  g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
 
487
 
 
488
  return shell->snap_to_canvas;
 
489
}
 
490
 
 
491
void
 
492
gimp_display_shell_set_snap_to_vectors (GimpDisplayShell *shell,
 
493
                                        gboolean          snap)
 
494
{
 
495
  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
 
496
 
 
497
  if (snap != shell->snap_to_vectors)
 
498
    {
 
499
      shell->snap_to_vectors = snap ? TRUE : FALSE;
 
500
 
 
501
      SET_ACTIVE (shell->menubar_manager, "view-snap-to-vectors", snap);
 
502
 
 
503
      if (IS_ACTIVE_DISPLAY (shell))
 
504
        SET_ACTIVE (shell->popup_manager, "view-snap-to-vectors", snap);
 
505
    }
 
506
}
 
507
 
 
508
gboolean
 
509
gimp_display_shell_get_snap_to_vectors (GimpDisplayShell *shell)
 
510
{
 
511
  g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
 
512
 
 
513
  return shell->snap_to_vectors;
 
514
}
 
515
 
 
516
void
456
517
gimp_display_shell_set_padding (GimpDisplayShell      *shell,
457
518
                                GimpCanvasPaddingMode  padding_mode,
458
519
                                const GimpRGB         *padding_color)
479
540
 
480
541
    case GIMP_CANVAS_PADDING_MODE_LIGHT_CHECK:
481
542
      gimp_rgb_set_uchar (&color,
482
 
                          render_blend_light_check[0],
483
 
                          render_blend_light_check[1],
484
 
                          render_blend_light_check[2]);
 
543
                          gimp_render_blend_light_check[0],
 
544
                          gimp_render_blend_light_check[1],
 
545
                          gimp_render_blend_light_check[2]);
485
546
      break;
486
547
 
487
548
    case GIMP_CANVAS_PADDING_MODE_DARK_CHECK:
488
549
      gimp_rgb_set_uchar (&color,
489
 
                          render_blend_dark_check[0],
490
 
                          render_blend_dark_check[1],
491
 
                          render_blend_dark_check[2]);
 
550
                          gimp_render_blend_dark_check[0],
 
551
                          gimp_render_blend_dark_check[1],
 
552
                          gimp_render_blend_dark_check[2]);
492
553
      break;
493
554
 
494
555
    case GIMP_CANVAS_PADDING_MODE_CUSTOM: