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

« back to all changes in this revision

Viewing changes to app/actions/view-actions.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
20
20
 
21
21
#include <gtk/gtk.h>
22
22
 
 
23
#include "libgimpmath/gimpmath.h"
23
24
#include "libgimpcolor/gimpcolor.h"
24
25
#include "libgimpwidgets/gimpwidgets.h"
25
26
 
32
33
#include "core/gimpimage.h"
33
34
 
34
35
#include "widgets/gimpactiongroup.h"
 
36
#include "widgets/gimprender.h"
35
37
#include "widgets/gimphelp-ids.h"
36
38
#include "widgets/gimpwidgets-utils.h"
37
39
 
39
41
#include "display/gimpdisplayoptions.h"
40
42
#include "display/gimpdisplayshell.h"
41
43
#include "display/gimpdisplayshell-appearance.h"
42
 
#include "display/gimpdisplayshell-render.h"
 
44
#include "display/gimpdisplayshell-scale.h"
43
45
#include "display/gimpdisplayshell-selection.h"
44
46
 
45
47
#include "actions.h"
46
48
#include "view-actions.h"
47
49
#include "view-commands.h"
 
50
#include "window-actions.h"
 
51
#include "window-commands.h"
48
52
 
49
53
#include "gimp-intl.h"
50
54
 
58
62
                                              GimpActionGroup   *group);
59
63
 
60
64
 
61
 
static GimpActionEntry view_actions[] =
 
65
static const GimpActionEntry view_actions[] =
62
66
{
63
 
  { "view-menu",               NULL, N_("_View")          },
64
 
  { "view-zoom-menu",          NULL, N_("_Zoom")          },
65
 
  { "view-padding-color-menu", NULL, N_("_Padding Color") },
 
67
  { "view-menu",                NULL, N_("_View")          },
 
68
  { "view-zoom-menu",           NULL, N_("_Zoom")          },
 
69
  { "view-padding-color-menu",  NULL, N_("_Padding Color") },
 
70
  { "view-move-to-screen-menu", GIMP_STOCK_MOVE_TO_SCREEN,
 
71
    N_("Move to Screen"), NULL, NULL, NULL,
 
72
    GIMP_HELP_VIEW_CHANGE_SCREEN },
66
73
 
67
74
  { "view-new", GTK_STOCK_NEW,
68
 
    N_("_New View"), "", NULL,
69
 
    G_CALLBACK (view_new_view_cmd_callback),
 
75
    N_("_New View"), "",
 
76
    N_("Create another view on this image"),
 
77
    G_CALLBACK (view_new_cmd_callback),
70
78
    GIMP_HELP_VIEW_NEW },
71
79
 
72
80
  { "view-close", GTK_STOCK_CLOSE,
73
 
    N_( "_Close"), "<control>W", NULL,
74
 
    G_CALLBACK (view_close_view_cmd_callback),
 
81
    N_( "_Close"), "<control>W",
 
82
    N_("Close this image window"),
 
83
    G_CALLBACK (window_close_cmd_callback),
75
84
    GIMP_HELP_FILE_CLOSE },
76
85
 
77
86
  { "view-zoom-fit-in", GTK_STOCK_ZOOM_FIT,
78
87
    N_("_Fit Image in Window"), "<control><shift>E",
79
 
    N_("Fit image in window"),
 
88
    N_("Adjust the zoom ratio so that the image becomes fully visible"),
80
89
    G_CALLBACK (view_zoom_fit_in_cmd_callback),
81
90
    GIMP_HELP_VIEW_ZOOM_FIT_IN },
82
91
 
83
92
  { "view-zoom-fit-to", GTK_STOCK_ZOOM_FIT,
84
 
    N_("Fit Image to Window"), NULL,
85
 
    N_("Fit image to window"),
 
93
    N_("Fit Image _to Window"), NULL,
 
94
    N_("Adjust the zoom ratio so that the window is used optimally"),
86
95
    G_CALLBACK (view_zoom_fit_to_cmd_callback),
87
96
    GIMP_HELP_VIEW_ZOOM_FIT_TO },
88
97
 
89
 
  { "view-info-window", GIMP_STOCK_INFO,
90
 
    N_("_Info Window"), "<control><shift>I", NULL,
91
 
    G_CALLBACK (view_info_window_cmd_callback),
92
 
    GIMP_HELP_INFO_DIALOG },
 
98
  { "view-zoom-revert", NULL,
 
99
    N_("Re_vert Zoom"), "grave",
 
100
    N_("Restore the previous zoom level"),
 
101
    G_CALLBACK (view_zoom_revert_cmd_callback),
 
102
    GIMP_HELP_VIEW_ZOOM_REVERT },
93
103
 
94
104
  { "view-navigation-window", GIMP_STOCK_NAVIGATION,
95
 
    N_("Na_vigation Window"), "<control><shift>N", NULL,
 
105
    N_("Na_vigation Window"), NULL,
 
106
    N_("Show an overview window for this image"),
96
107
    G_CALLBACK (view_navigation_window_cmd_callback),
97
108
    GIMP_HELP_NAVIGATION_DIALOG },
98
109
 
99
110
  { "view-display-filters", GIMP_STOCK_DISPLAY_FILTER,
100
 
    N_("Display _Filters..."), NULL, NULL,
 
111
    N_("Display _Filters..."), NULL,
 
112
    N_("Configure filters applied to this view"),
101
113
    G_CALLBACK (view_display_filters_cmd_callback),
102
114
    GIMP_HELP_DISPLAY_FILTER_DIALOG },
103
115
 
104
116
  { "view-shrink-wrap", GTK_STOCK_ZOOM_FIT,
105
117
    N_("Shrink _Wrap"), "<control>E",
106
 
    N_("Shrink wrap"),
 
118
    N_("Reduce the image window to the size of the image display"),
107
119
    G_CALLBACK (view_shrink_wrap_cmd_callback),
108
120
    GIMP_HELP_VIEW_SHRINK_WRAP },
109
121
 
110
 
  { "view-move-to-screen", GIMP_STOCK_MOVE_TO_SCREEN,
111
 
    N_("Move to Screen..."), NULL, NULL,
112
 
    G_CALLBACK (view_change_screen_cmd_callback),
113
 
    GIMP_HELP_VIEW_CHANGE_SCREEN }
 
122
  { "view-open-display", NULL,
 
123
    N_("_Open Display..."), NULL,
 
124
    N_("Connect to another display"),
 
125
    G_CALLBACK (window_open_display_cmd_callback),
 
126
    NULL }
114
127
};
115
128
 
116
 
static GimpToggleActionEntry view_toggle_actions[] =
 
129
static const GimpToggleActionEntry view_toggle_actions[] =
117
130
{
118
131
  { "view-dot-for-dot", NULL,
119
 
    N_("_Dot for Dot"), NULL, NULL,
 
132
    N_("_Dot for Dot"), NULL,
 
133
    N_("A pixel on the screen represents an image pixel"),
120
134
    G_CALLBACK (view_dot_for_dot_cmd_callback),
121
135
    TRUE,
122
136
    GIMP_HELP_VIEW_DOT_FOR_DOT },
123
137
 
124
138
  { "view-show-selection", NULL,
125
 
    N_("Show _Selection"), "<control>T", NULL,
 
139
    N_("Show _Selection"), "<control>T",
 
140
    N_("Display the selection outline"),
126
141
    G_CALLBACK (view_toggle_selection_cmd_callback),
127
142
    TRUE,
128
143
    GIMP_HELP_VIEW_SHOW_SELECTION },
129
144
 
130
145
  { "view-show-layer-boundary", NULL,
131
 
    N_("Show _Layer Boundary"), NULL, NULL,
 
146
    N_("Show _Layer Boundary"), NULL,
 
147
    N_("Draw a border around the active layer"),
132
148
    G_CALLBACK (view_toggle_layer_boundary_cmd_callback),
133
149
    TRUE,
134
150
    GIMP_HELP_VIEW_SHOW_LAYER_BOUNDARY },
135
151
 
136
152
  { "view-show-guides", NULL,
137
 
    N_("Show _Guides"), "<control><shift>T", NULL,
 
153
    N_("Show _Guides"), "<control><shift>T",
 
154
    N_("Display the image's guides"),
138
155
    G_CALLBACK (view_toggle_guides_cmd_callback),
139
156
    TRUE,
140
157
    GIMP_HELP_VIEW_SHOW_GUIDES },
141
158
 
 
159
  { "view-show-grid", NULL,
 
160
    N_("S_how Grid"), NULL,
 
161
    N_("Display the image's grid"),
 
162
    G_CALLBACK (view_toggle_grid_cmd_callback),
 
163
    FALSE,
 
164
    GIMP_HELP_VIEW_SHOW_GRID },
 
165
 
 
166
  { "view-show-sample-points", NULL,
 
167
    N_("Show Sample Points"), NULL,
 
168
    N_("Display the image's color sample points"),
 
169
    G_CALLBACK (view_toggle_sample_points_cmd_callback),
 
170
    TRUE,
 
171
    GIMP_HELP_VIEW_SHOW_SAMPLE_POINTS },
 
172
 
142
173
  { "view-snap-to-guides", NULL,
143
 
    N_("Sn_ap to Guides"), NULL, NULL,
 
174
    N_("Sn_ap to Guides"), NULL,
 
175
    N_("Tool operations snap to guides"),
144
176
    G_CALLBACK (view_snap_to_guides_cmd_callback),
145
177
    TRUE,
146
178
    GIMP_HELP_VIEW_SNAP_TO_GUIDES },
147
179
 
148
 
  { "view-show-grid", NULL,
149
 
    N_("S_how Grid"), NULL, NULL,
150
 
    G_CALLBACK (view_toggle_grid_cmd_callback),
151
 
    FALSE,
152
 
    GIMP_HELP_VIEW_SHOW_GRID },
153
 
 
154
180
  { "view-snap-to-grid", NULL,
155
 
    N_("Sna_p to Grid"), NULL, NULL,
 
181
    N_("Sna_p to Grid"), NULL,
 
182
    N_("Tool operations snap to the grid"),
156
183
    G_CALLBACK (view_snap_to_grid_cmd_callback),
157
184
    FALSE,
158
185
    GIMP_HELP_VIEW_SNAP_TO_GRID },
159
186
 
 
187
  { "view-snap-to-canvas", NULL,
 
188
    N_("Snap to _Canvas Edges"), NULL,
 
189
    N_("Tool operations snap to the canvas edges"),
 
190
    G_CALLBACK (view_snap_to_canvas_cmd_callback),
 
191
    FALSE,
 
192
    GIMP_HELP_VIEW_SNAP_TO_CANVAS },
 
193
 
 
194
  { "view-snap-to-vectors", NULL,
 
195
    N_("Snap t_o Active Path"), NULL,
 
196
    N_("Tool operations snap to the active path"),
 
197
    G_CALLBACK (view_snap_to_vectors_cmd_callback),
 
198
    FALSE,
 
199
    GIMP_HELP_VIEW_SNAP_TO_VECTORS },
 
200
 
160
201
  { "view-show-menubar", NULL,
161
 
    N_("Show _Menubar"), NULL, NULL,
 
202
    N_("Show _Menubar"), NULL,
 
203
    N_("Show this window's menubar"),
162
204
    G_CALLBACK (view_toggle_menubar_cmd_callback),
163
205
    TRUE,
164
206
    GIMP_HELP_VIEW_SHOW_MENUBAR },
165
207
 
166
208
  { "view-show-rulers", NULL,
167
 
    N_("Show R_ulers"), "<control><shift>R", NULL,
 
209
    N_("Show R_ulers"), "<control><shift>R",
 
210
    N_("Show this window's rulers"),
168
211
    G_CALLBACK (view_toggle_rulers_cmd_callback),
169
212
    TRUE,
170
213
    GIMP_HELP_VIEW_SHOW_RULERS },
171
214
 
172
215
  { "view-show-scrollbars", NULL,
173
 
    N_("Show Scroll_bars"), NULL, NULL,
 
216
    N_("Show Scroll_bars"), NULL,
 
217
    N_("Show this window's scrollbars"),
174
218
    G_CALLBACK (view_toggle_scrollbars_cmd_callback),
175
219
    TRUE,
176
220
    GIMP_HELP_VIEW_SHOW_SCROLLBARS },
177
221
 
178
222
  { "view-show-statusbar", NULL,
179
 
    N_("Show S_tatusbar"), NULL, NULL,
 
223
    N_("Show S_tatusbar"), NULL,
 
224
    N_("Show this window's statusbar"),
180
225
    G_CALLBACK (view_toggle_statusbar_cmd_callback),
181
226
    TRUE,
182
227
    GIMP_HELP_VIEW_SHOW_STATUSBAR },
183
228
 
184
 
  { "view-fullscreen", NULL,
185
 
    N_("Fullscr_een"), "F11", NULL,
 
229
  { "view-fullscreen", GTK_STOCK_FULLSCREEN,
 
230
    N_("Fullscr_een"), "F11",
 
231
    N_("Toggle fullscreen view"),
186
232
    G_CALLBACK (view_fullscreen_cmd_callback),
187
233
    FALSE,
188
234
    GIMP_HELP_VIEW_FULLSCREEN }
189
235
};
190
236
 
191
 
static GimpEnumActionEntry view_zoom_actions[] =
 
237
static const GimpEnumActionEntry view_zoom_actions[] =
192
238
{
193
239
  { "view-zoom", NULL,
194
240
    "Set zoom factor", NULL, NULL,
217
263
    GIMP_ACTION_SELECT_NEXT, FALSE,
218
264
    GIMP_HELP_VIEW_ZOOM_IN },
219
265
 
 
266
  { "view-zoom-out-accel", GIMP_STOCK_CHAR_PICKER,
 
267
    N_("Zoom Out"), "KP_Subtract",
 
268
    N_("Zoom out"),
 
269
    GIMP_ACTION_SELECT_PREVIOUS, FALSE,
 
270
    GIMP_HELP_VIEW_ZOOM_OUT },
 
271
 
 
272
  { "view-zoom-in-accel", GIMP_STOCK_CHAR_PICKER,
 
273
    N_("Zoom In"), "KP_Add",
 
274
    N_("Zoom in"),
 
275
    GIMP_ACTION_SELECT_NEXT, FALSE,
 
276
    GIMP_HELP_VIEW_ZOOM_IN },
 
277
 
220
278
  { "view-zoom-out-skip", GTK_STOCK_ZOOM_OUT,
221
279
    "Zoom out a lot", NULL, NULL,
222
280
    GIMP_ACTION_SELECT_SKIP_PREVIOUS, FALSE,
228
286
    GIMP_HELP_VIEW_ZOOM_IN }
229
287
};
230
288
 
231
 
static GimpRadioActionEntry view_zoom_explicit_actions[] =
 
289
static const GimpRadioActionEntry view_zoom_explicit_actions[] =
232
290
{
233
291
  { "view-zoom-16-1", NULL,
234
 
    N_("16:1  (1600%)"), NULL, NULL,
 
292
    N_("1_6:1  (1600%)"), NULL,
 
293
    N_("Zoom 16:1"),
235
294
    160000,
236
295
    GIMP_HELP_VIEW_ZOOM_IN },
237
296
 
238
297
  { "view-zoom-8-1", NULL,
239
 
    N_("8:1  (800%)"), NULL, NULL,
 
298
    N_("_8:1  (800%)"), NULL,
 
299
    N_("Zoom 8:1"),
240
300
    80000,
241
301
    GIMP_HELP_VIEW_ZOOM_IN },
242
302
 
243
303
  { "view-zoom-4-1", NULL,
244
 
    N_("4:1  (400%)"), NULL, NULL,
 
304
    N_("_4:1  (400%)"), NULL,
 
305
    N_("Zoom 4:1"),
245
306
    40000,
246
307
    GIMP_HELP_VIEW_ZOOM_IN },
247
308
 
248
309
  { "view-zoom-2-1", NULL,
249
 
    N_("2:1  (200%)"), NULL, NULL,
 
310
    N_("_2:1  (200%)"), NULL,
 
311
    N_("Zoom 1:1"),
250
312
    20000,
251
313
    GIMP_HELP_VIEW_ZOOM_IN },
252
314
 
253
315
  { "view-zoom-1-1", GTK_STOCK_ZOOM_100,
254
 
    N_("1:1  (100%)"), "1",
 
316
    N_("_1:1  (100%)"), "1",
255
317
    N_("Zoom 1:1"),
256
318
    10000,
257
319
    GIMP_HELP_VIEW_ZOOM_100 },
258
320
 
259
321
  { "view-zoom-1-2", NULL,
260
 
    N_("1:2  (50%)"), NULL, NULL,
 
322
    N_("1:_2  (50%)"), NULL,
 
323
    N_("Zoom 1:2"),
261
324
    5000,
262
325
    GIMP_HELP_VIEW_ZOOM_OUT },
263
326
 
264
327
  { "view-zoom-1-4", NULL,
265
 
    N_("1:4  (25%)"), NULL, NULL,
 
328
    N_("1:_4  (25%)"), NULL,
 
329
    N_("Zoom 1:4"),
266
330
    2500,
267
331
    GIMP_HELP_VIEW_ZOOM_OUT },
268
332
 
269
333
  { "view-zoom-1-8", NULL,
270
 
    N_("1:8  (12.5%)"), NULL, NULL,
 
334
    N_("1:_8  (12.5%)"), NULL,
 
335
    N_("Zoom 1:8"),
271
336
    1250,
272
337
    GIMP_HELP_VIEW_ZOOM_OUT },
273
338
 
274
339
  { "view-zoom-1-16", NULL,
275
 
    N_("1:16  (6.25%)"), NULL, NULL,
 
340
    N_("1:1_6  (6.25%)"), NULL,
 
341
    N_("Zoom 1:16"),
276
342
    625,
277
343
    GIMP_HELP_VIEW_ZOOM_OUT },
278
344
 
279
345
  { "view-zoom-other", NULL,
280
 
    N_("O_ther..."), NULL, NULL,
 
346
    N_("Othe_r..."), NULL,
 
347
    N_("Set a custom zoom factor"),
281
348
    0,
282
349
    GIMP_HELP_VIEW_ZOOM_OTHER }
283
350
};
284
351
 
285
 
static GimpEnumActionEntry view_padding_color_actions[] =
 
352
static const GimpEnumActionEntry view_padding_color_actions[] =
286
353
{
287
354
  { "view-padding-color-theme", NULL,
288
 
    N_("From _Theme"), NULL, NULL,
 
355
    N_("From _Theme"), NULL,
 
356
    N_("Use the current theme's background color"),
289
357
    GIMP_CANVAS_PADDING_MODE_DEFAULT, FALSE,
290
358
    GIMP_HELP_VIEW_PADDING_COLOR },
291
359
 
292
360
  { "view-padding-color-light-check", NULL,
293
 
    N_("_Light Check Color"), NULL, NULL,
 
361
    N_("_Light Check Color"), NULL,
 
362
    N_("Use the light check color"),
294
363
    GIMP_CANVAS_PADDING_MODE_LIGHT_CHECK, FALSE,
295
364
    GIMP_HELP_VIEW_PADDING_COLOR },
296
365
 
297
366
  { "view-padding-color-dark-check", NULL,
298
 
    N_("_Dark Check Color"), NULL, NULL,
 
367
    N_("_Dark Check Color"), NULL,
 
368
    N_("Use the dark check color"),
299
369
    GIMP_CANVAS_PADDING_MODE_DARK_CHECK, FALSE,
300
370
    GIMP_HELP_VIEW_PADDING_COLOR },
301
371
 
302
372
  { "view-padding-color-custom", GTK_STOCK_SELECT_COLOR,
303
 
    N_("Select _Custom Color..."), NULL, NULL,
 
373
    N_("Select _Custom Color..."), NULL,
 
374
    N_("Use an arbitrary color"),
304
375
    GIMP_CANVAS_PADDING_MODE_CUSTOM, FALSE,
305
376
    GIMP_HELP_VIEW_PADDING_COLOR },
306
377
 
307
378
  { "view-padding-color-prefs", GIMP_STOCK_RESET,
308
 
    N_("As in _Preferences"), NULL, NULL,
 
379
    N_("As in _Preferences"), NULL,
 
380
    N_("Reset padding color to what's configured in preferences"),
309
381
    GIMP_CANVAS_PADDING_MODE_RESET, FALSE,
310
382
    GIMP_HELP_VIEW_PADDING_COLOR }
311
383
};
312
384
 
313
 
static GimpEnumActionEntry view_scroll_horizontal_actions[] =
 
385
static const GimpEnumActionEntry view_scroll_horizontal_actions[] =
314
386
{
315
387
  { "view-scroll-horizontal", NULL,
316
388
    "Set horizontal scroll offset", NULL, NULL,
348
420
    NULL }
349
421
};
350
422
 
351
 
static GimpEnumActionEntry view_scroll_vertical_actions[] =
 
423
static const GimpEnumActionEntry view_scroll_vertical_actions[] =
352
424
{
353
425
  { "view-scroll-vertical", NULL,
354
426
    "Set vertical scroll offset", NULL, NULL,
408
480
  gimp_action_group_add_radio_actions (group,
409
481
                                       view_zoom_explicit_actions,
410
482
                                       G_N_ELEMENTS (view_zoom_explicit_actions),
 
483
                                       NULL,
411
484
                                       10000,
412
485
                                       G_CALLBACK (view_zoom_explicit_cmd_callback));
413
486
 
440
513
                           group, 0);
441
514
  view_actions_check_type_notify (GIMP_DISPLAY_CONFIG (group->gimp->config),
442
515
                                  NULL, group);
 
516
 
 
517
  if (GIMP_IS_DISPLAY (group->user_data) ||
 
518
      GIMP_IS_GIMP (group->user_data))
 
519
    {
 
520
      /*  add window actions only if the context of the group is
 
521
       *  the display itself or the global popup (not if the context
 
522
       *  is a dock)
 
523
       *  (see dock-actions.c)
 
524
       */
 
525
      window_actions_setup (group, GIMP_HELP_VIEW_CHANGE_SCREEN);
 
526
    }
443
527
}
444
528
 
445
529
void
446
530
view_actions_update (GimpActionGroup *group,
447
531
                     gpointer         data)
448
532
{
449
 
  GimpDisplay        *gdisp      = action_data_get_display (data);
450
 
  GimpDisplayShell   *shell      = NULL;
451
 
  GimpDisplayOptions *options    = NULL;
452
 
  GimpImage          *gimage     = NULL;
453
 
  gboolean            fullscreen = FALSE;
454
 
  gint                n_screens  = 1;
 
533
  GimpDisplay        *display        = action_data_get_display (data);
 
534
  GimpDisplayShell   *shell          = NULL;
 
535
  GimpDisplayOptions *options        = NULL;
 
536
  gchar              *label          = NULL;
 
537
  gboolean            fullscreen     = FALSE;
 
538
  gboolean            revert_enabled = FALSE;   /* able to revert zoom? */
455
539
 
456
 
  if (gdisp)
 
540
  if (display)
457
541
    {
458
 
      shell  = GIMP_DISPLAY_SHELL (gdisp->shell);
459
 
      gimage = gdisp->gimage;
 
542
      shell = GIMP_DISPLAY_SHELL (display->shell);
460
543
 
461
544
      fullscreen = gimp_display_shell_get_fullscreen (shell);
462
545
 
463
546
      options = fullscreen ? shell->fullscreen_options : shell->options;
464
547
 
465
 
      n_screens =
466
 
        gdk_display_get_n_screens (gtk_widget_get_display (GTK_WIDGET (shell)));
 
548
      revert_enabled = gimp_display_shell_scale_can_revert (shell);
467
549
    }
468
550
 
469
551
#define SET_ACTIVE(action,condition) \
470
552
        gimp_action_group_set_action_active (group, action, (condition) != 0)
471
 
#define SET_VISIBLE(action,condition) \
472
 
        gimp_action_group_set_action_visible (group, action, (condition) != 0)
473
 
#define SET_LABEL(action,label) \
474
 
        gimp_action_group_set_action_label (group, action, (label))
475
553
#define SET_SENSITIVE(action,condition) \
476
554
        gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
477
555
#define SET_COLOR(action,color) \
478
556
        gimp_action_group_set_action_color (group, action, color, FALSE)
479
557
 
480
 
  SET_SENSITIVE ("view-new",   gdisp);
481
 
  SET_SENSITIVE ("view-close", gdisp);
482
 
 
483
 
  SET_SENSITIVE ("view-dot-for-dot", gdisp);
484
 
  SET_ACTIVE    ("view-dot-for-dot", gdisp && shell->dot_for_dot);
485
 
 
486
 
  SET_SENSITIVE ("view-zoom-out",    gdisp);
487
 
  SET_SENSITIVE ("view-zoom-in",     gdisp);
488
 
  SET_SENSITIVE ("view-zoom-fit-in", gdisp);
489
 
  SET_SENSITIVE ("view-zoom-fit-to", gdisp);
490
 
 
491
 
  SET_SENSITIVE ("view-zoom-16-1",  gdisp);
492
 
  SET_SENSITIVE ("view-zoom-8-1",   gdisp);
493
 
  SET_SENSITIVE ("view-zoom-4-1",   gdisp);
494
 
  SET_SENSITIVE ("view-zoom-2-1",   gdisp);
495
 
  SET_SENSITIVE ("view-zoom-1-1",   gdisp);
496
 
  SET_SENSITIVE ("view-zoom-1-2",   gdisp);
497
 
  SET_SENSITIVE ("view-zoom-1-4",   gdisp);
498
 
  SET_SENSITIVE ("view-zoom-1-8",   gdisp);
499
 
  SET_SENSITIVE ("view-zoom-1-16",  gdisp);
500
 
  SET_SENSITIVE ("view-zoom-other", gdisp);
501
 
 
502
 
  if (gdisp)
 
558
  SET_SENSITIVE ("view-new",   display);
 
559
  SET_SENSITIVE ("view-close", display);
 
560
 
 
561
  SET_SENSITIVE ("view-dot-for-dot", display);
 
562
  SET_ACTIVE    ("view-dot-for-dot", display && shell->dot_for_dot);
 
563
 
 
564
  SET_SENSITIVE ("view-zoom-revert", revert_enabled);
 
565
  if (revert_enabled)
 
566
    {
 
567
      label = g_strdup_printf (_("Re_vert Zoom (%d%%)"),
 
568
                               ROUND (shell->last_scale * 100));
 
569
      gimp_action_group_set_action_label (group, "view-zoom-revert", label);
 
570
      g_free (label);
 
571
    }
 
572
  else
 
573
    {
 
574
      gimp_action_group_set_action_label (group, "view-zoom-revert",
 
575
                                          N_("Re_vert Zoom"));
 
576
    }
 
577
 
 
578
  SET_SENSITIVE ("view-zoom-out",    display);
 
579
  SET_SENSITIVE ("view-zoom-in",     display);
 
580
  SET_SENSITIVE ("view-zoom-fit-in", display);
 
581
  SET_SENSITIVE ("view-zoom-fit-to", display);
 
582
 
 
583
  SET_SENSITIVE ("view-zoom-16-1",  display);
 
584
  SET_SENSITIVE ("view-zoom-8-1",   display);
 
585
  SET_SENSITIVE ("view-zoom-4-1",   display);
 
586
  SET_SENSITIVE ("view-zoom-2-1",   display);
 
587
  SET_SENSITIVE ("view-zoom-1-1",   display);
 
588
  SET_SENSITIVE ("view-zoom-1-2",   display);
 
589
  SET_SENSITIVE ("view-zoom-1-4",   display);
 
590
  SET_SENSITIVE ("view-zoom-1-8",   display);
 
591
  SET_SENSITIVE ("view-zoom-1-16",  display);
 
592
  SET_SENSITIVE ("view-zoom-other", display);
 
593
 
 
594
  if (display)
503
595
    view_actions_set_zoom (group, shell);
504
596
 
505
 
  SET_SENSITIVE ("view-info-window",       gdisp);
506
 
  SET_SENSITIVE ("view-navigation-window", gdisp);
507
 
  SET_SENSITIVE ("view-display-filters",   gdisp);
508
 
 
509
 
  SET_SENSITIVE ("view-show-selection",      gdisp);
510
 
  SET_ACTIVE    ("view-show-selection",      gdisp && options->show_selection);
511
 
  SET_SENSITIVE ("view-show-layer-boundary", gdisp);
512
 
  SET_ACTIVE    ("view-show-layer-boundary", gdisp && options->show_layer_boundary);
513
 
  SET_ACTIVE    ("view-show-guides",         gdisp && options->show_guides);
514
 
  SET_ACTIVE    ("view-snap-to-guides",      gdisp && shell->snap_to_guides);
515
 
  SET_ACTIVE    ("view-show-grid",           gdisp && options->show_grid);
516
 
  SET_ACTIVE    ("view-snap-to-grid",        gdisp && shell->snap_to_grid);
517
 
 
518
 
  if (gdisp)
 
597
  SET_SENSITIVE ("view-navigation-window", display);
 
598
  SET_SENSITIVE ("view-display-filters",   display);
 
599
 
 
600
  SET_SENSITIVE ("view-show-selection",      display);
 
601
  SET_ACTIVE    ("view-show-selection",      display && options->show_selection);
 
602
  SET_SENSITIVE ("view-show-layer-boundary", display);
 
603
  SET_ACTIVE    ("view-show-layer-boundary", display && options->show_layer_boundary);
 
604
  SET_ACTIVE    ("view-show-guides",         display && options->show_guides);
 
605
  SET_ACTIVE    ("view-show-grid",           display && options->show_grid);
 
606
  SET_ACTIVE    ("view-show-sample-points",  display && options->show_sample_points);
 
607
  SET_ACTIVE    ("view-snap-to-guides",      display && shell->snap_to_guides);
 
608
  SET_ACTIVE    ("view-snap-to-grid",        display && shell->snap_to_grid);
 
609
  SET_ACTIVE    ("view-snap-to-canvas",      display && shell->snap_to_canvas);
 
610
  SET_ACTIVE    ("view-snap-to-vectors",     display && shell->snap_to_vectors);
 
611
 
 
612
  if (display)
519
613
    {
520
614
      SET_COLOR ("view-padding-color-menu", &options->padding_color);
521
615
 
532
626
        }
533
627
    }
534
628
 
535
 
  SET_SENSITIVE ("view-show-menubar",    gdisp);
536
 
  SET_ACTIVE    ("view-show-menubar",    gdisp && options->show_menubar);
537
 
  SET_SENSITIVE ("view-show-rulers",     gdisp);
538
 
  SET_ACTIVE    ("view-show-rulers",     gdisp && options->show_rulers);
539
 
  SET_SENSITIVE ("view-show-scrollbars", gdisp);
540
 
  SET_ACTIVE    ("view-show-scrollbars", gdisp && options->show_scrollbars);
541
 
  SET_SENSITIVE ("view-show-statusbar",  gdisp);
542
 
  SET_ACTIVE    ("view-show-statusbar",  gdisp && options->show_statusbar);
543
 
 
544
 
  SET_SENSITIVE ("view-shrink-wrap",    gdisp);
545
 
  SET_SENSITIVE ("view-fullscreen",     gdisp);
546
 
  SET_ACTIVE    ("view-fullscreen",     gdisp && fullscreen);
547
 
  SET_VISIBLE   ("view-move-to-screen", gdisp && n_screens > 1);
 
629
  SET_SENSITIVE ("view-show-menubar",    display);
 
630
  SET_ACTIVE    ("view-show-menubar",    display && options->show_menubar);
 
631
  SET_SENSITIVE ("view-show-rulers",     display);
 
632
  SET_ACTIVE    ("view-show-rulers",     display && options->show_rulers);
 
633
  SET_SENSITIVE ("view-show-scrollbars", display);
 
634
  SET_ACTIVE    ("view-show-scrollbars", display && options->show_scrollbars);
 
635
  SET_SENSITIVE ("view-show-statusbar",  display);
 
636
  SET_ACTIVE    ("view-show-statusbar",  display && options->show_statusbar);
 
637
 
 
638
  SET_SENSITIVE ("view-shrink-wrap", display);
 
639
  SET_SENSITIVE ("view-fullscreen",  display);
 
640
  SET_ACTIVE    ("view-fullscreen",  display && fullscreen);
 
641
 
 
642
  if (GIMP_IS_DISPLAY (group->user_data) ||
 
643
      GIMP_IS_GIMP (group->user_data))
 
644
    {
 
645
      /*  see view_actions_setup()  */
 
646
      window_actions_update (group, display ? display->shell : NULL);
 
647
    }
548
648
 
549
649
#undef SET_ACTIVE
550
 
#undef SET_VISIBLE
551
 
#undef SET_LABEL
552
650
#undef SET_SENSITIVE
553
651
#undef SET_COLOR
554
652
}
561
659
                       GimpDisplayShell *shell)
562
660
{
563
661
  const gchar *action = NULL;
 
662
  gchar       *str;
 
663
  gchar       *label;
564
664
  guint        scale;
565
 
  gchar        buf[16];
566
 
  gchar       *label;
567
 
 
568
 
  scale = ROUND (shell->scale * 1000);
 
665
 
 
666
  g_object_get (shell->zoom,
 
667
                "percentage", &str,
 
668
                NULL);
 
669
 
 
670
  scale = ROUND (gimp_zoom_model_get_factor (shell->zoom) * 1000);
569
671
 
570
672
  switch (scale)
571
673
    {
581
683
    case    62:  action = "view-zoom-1-16";  break;
582
684
    }
583
685
 
584
 
  g_snprintf (buf, sizeof (buf),
585
 
              shell->scale >= 0.15 ? "%.0f%%" : "%.2f%%",
586
 
              shell->scale * 100.0);
587
 
 
588
 
  if (!action)
 
686
  if (! action)
589
687
    {
590
688
      action = "view-zoom-other";
591
689
 
592
 
      label = g_strdup_printf (_("Other (%s) ..."), buf);
 
690
      label = g_strdup_printf (_("Othe_r (%s)..."), str);
593
691
      gimp_action_group_set_action_label (group, action, label);
594
692
      g_free (label);
595
693
 
596
 
      shell->other_scale = shell->scale;
 
694
      shell->other_scale = gimp_zoom_model_get_factor (shell->zoom);
597
695
    }
598
696
 
599
697
  gimp_action_group_set_action_active (group, action, TRUE);
600
698
 
601
 
  label = g_strdup_printf (_("_Zoom (%s)"), buf);
 
699
  label = g_strdup_printf (_("_Zoom (%s)"), str);
602
700
  gimp_action_group_set_action_label (group, "view-zoom-menu", label);
603
701
  g_free (label);
604
702
 
605
703
  /* flag as dirty */
606
704
  shell->other_scale = - fabs (shell->other_scale);
 
705
 
 
706
  g_free (str);
607
707
}
608
708
 
609
709
static void
614
714
  GimpRGB color;
615
715
 
616
716
  gimp_rgba_set_uchar (&color,
617
 
                       render_blend_light_check[0],
618
 
                       render_blend_light_check[1],
619
 
                       render_blend_light_check[2],
 
717
                       gimp_render_blend_light_check[0],
 
718
                       gimp_render_blend_light_check[1],
 
719
                       gimp_render_blend_light_check[2],
620
720
                       255);
621
721
  gimp_action_group_set_action_color (group, "view-padding-color-light-check",
622
722
                                      &color, FALSE);
623
723
 
624
724
  gimp_rgba_set_uchar (&color,
625
 
                       render_blend_dark_check[0],
626
 
                       render_blend_dark_check[1],
627
 
                       render_blend_dark_check[2],
 
725
                       gimp_render_blend_dark_check[0],
 
726
                       gimp_render_blend_dark_check[1],
 
727
                       gimp_render_blend_dark_check[2],
628
728
                       255);
629
729
  gimp_action_group_set_action_color (group, "view-padding-color-dark-check",
630
730
                                      &color, FALSE);