1
/* The GIMP -- an image manipulation program
1
/* GIMP - The GNU Image Manipulation Program
2
2
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
4
* This program is free software; you can redistribute it and/or modify
30
30
#include "core/gimpimage.h"
32
32
#include "widgets/gimpactiongroup.h"
33
#include "widgets/gimprender.h"
33
34
#include "widgets/gimpuimanager.h"
34
35
#include "widgets/gimpwidgets-utils.h"
40
41
#include "gimpdisplayshell-appearance.h"
41
42
#include "gimpdisplayshell-callbacks.h"
42
43
#include "gimpdisplayshell-selection.h"
43
#include "gimpdisplayshell-render.h"
46
46
#define GET_OPTIONS(shell) \
58
58
gimp_action_group_set_action_color (group, action_name, color, FALSE); }
60
60
#define IS_ACTIVE_DISPLAY(shell) \
61
((shell)->display == \
62
62
gimp_context_get_display (gimp_get_user_context \
63
((shell)->gdisp->gimage->gimp)))
63
((shell)->display->image->gimp)))
109
106
gtk_widget_hide (shell->menubar);
112
if (options->show_menubar || options->show_statusbar)
113
gtk_container_set_border_width (vbox, 2);
115
gtk_container_set_border_width (vbox, 0);
117
109
SET_ACTIVE (shell->menubar_manager, "view-show-menubar", show);
119
111
if (IS_ACTIVE_DISPLAY (shell))
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);
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);
215
207
gtk_box_set_spacing (hbox, 0);
244
235
g_object_set (options, "show-statusbar", show, NULL);
246
vbox = GTK_CONTAINER (shell->qmask_button->parent->parent);
249
238
gtk_widget_show (shell->statusbar);
251
240
gtk_widget_hide (shell->statusbar);
253
if (options->show_menubar || options->show_statusbar)
254
gtk_container_set_border_width (vbox, 2);
256
gtk_container_set_border_width (vbox, 0);
258
242
SET_ACTIVE (shell->menubar_manager, "view-show-statusbar", show);
260
244
if (IS_ACTIVE_DISPLAY (shell))
282
266
g_object_set (options, "show-selection", show, NULL);
285
gimp_display_shell_selection_set_hidden (shell->select, ! show);
268
gimp_display_shell_selection_set_hidden (shell, ! show);
287
270
SET_ACTIVE (shell->menubar_manager, "view-show-selection", show);
311
294
g_object_set (options, "show-layer-boundary", show, NULL);
314
gimp_display_shell_selection_layer_set_hidden (shell->select, ! show);
296
gimp_display_shell_selection_layer_set_hidden (shell, ! show);
316
298
SET_ACTIVE (shell->menubar_manager, "view-show-layer-boundary", show);
330
gimp_display_shell_set_show_guides (GimpDisplayShell *shell,
333
GimpDisplayOptions *options;
335
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
337
options = GET_OPTIONS (shell);
339
g_object_set (options, "show-guides", show, NULL);
341
if (shell->display->image->guides)
342
gimp_display_shell_expose_full (shell);
344
SET_ACTIVE (shell->menubar_manager, "view-show-guides", show);
346
if (IS_ACTIVE_DISPLAY (shell))
347
SET_ACTIVE (shell->popup_manager, "view-show-guides", show);
351
gimp_display_shell_get_show_guides (GimpDisplayShell *shell)
353
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
355
return GET_OPTIONS (shell)->show_guides;
348
359
gimp_display_shell_set_show_grid (GimpDisplayShell *shell,
357
368
g_object_set (options, "show-grid", show, NULL);
359
if (shell->gdisp->gimage->grid)
370
if (shell->display->image->grid)
360
371
gimp_display_shell_expose_full (shell);
362
373
SET_ACTIVE (shell->menubar_manager, "view-show-grid", show);
388
gimp_display_shell_set_show_sample_points (GimpDisplayShell *shell,
391
GimpDisplayOptions *options;
393
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
395
options = GET_OPTIONS (shell);
397
g_object_set (options, "show-sample-points", show, NULL);
399
if (shell->display->image->sample_points)
400
gimp_display_shell_expose_full (shell);
402
SET_ACTIVE (shell->menubar_manager, "view-show-sample-points", show);
404
if (IS_ACTIVE_DISPLAY (shell))
405
SET_ACTIVE (shell->popup_manager, "view-show-sample-points", show);
409
gimp_display_shell_get_show_sample_points (GimpDisplayShell *shell)
411
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
413
return GET_OPTIONS (shell)->show_sample_points;
377
417
gimp_display_shell_set_snap_to_grid (GimpDisplayShell *shell,
402
gimp_display_shell_set_show_guides (GimpDisplayShell *shell,
405
GimpDisplayOptions *options;
407
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
409
options = GET_OPTIONS (shell);
411
g_object_set (options, "show-guides", show, NULL);
413
if (shell->gdisp->gimage->guides)
414
gimp_display_shell_expose_full (shell);
416
SET_ACTIVE (shell->menubar_manager, "view-show-guides", show);
418
if (IS_ACTIVE_DISPLAY (shell))
419
SET_ACTIVE (shell->popup_manager, "view-show-guides", show);
423
gimp_display_shell_get_show_guides (GimpDisplayShell *shell)
425
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
427
return GET_OPTIONS (shell)->show_guides;
431
442
gimp_display_shell_set_snap_to_guides (GimpDisplayShell *shell,
467
gimp_display_shell_set_snap_to_canvas (GimpDisplayShell *shell,
470
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
472
if (snap != shell->snap_to_canvas)
474
shell->snap_to_canvas = snap ? TRUE : FALSE;
476
SET_ACTIVE (shell->menubar_manager, "view-snap-to-canvas", snap);
478
if (IS_ACTIVE_DISPLAY (shell))
479
SET_ACTIVE (shell->popup_manager, "view-snap-to-canvas", snap);
484
gimp_display_shell_get_snap_to_canvas (GimpDisplayShell *shell)
486
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
488
return shell->snap_to_canvas;
492
gimp_display_shell_set_snap_to_vectors (GimpDisplayShell *shell,
495
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
497
if (snap != shell->snap_to_vectors)
499
shell->snap_to_vectors = snap ? TRUE : FALSE;
501
SET_ACTIVE (shell->menubar_manager, "view-snap-to-vectors", snap);
503
if (IS_ACTIVE_DISPLAY (shell))
504
SET_ACTIVE (shell->popup_manager, "view-snap-to-vectors", snap);
509
gimp_display_shell_get_snap_to_vectors (GimpDisplayShell *shell)
511
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
513
return shell->snap_to_vectors;
456
517
gimp_display_shell_set_padding (GimpDisplayShell *shell,
457
518
GimpCanvasPaddingMode padding_mode,
458
519
const GimpRGB *padding_color)
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]);
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]);
494
555
case GIMP_CANVAS_PADDING_MODE_CUSTOM: