view-actions.c 41.6 KB
Newer Older
1
/* GIMP - The GNU Image Manipulation Program
2 3
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 *
4
 * This program is free software: you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; either version 3 of the License, or
7 8 9 10 11 12 13 14
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 17 18 19
 */

#include "config.h"

20
#include <gegl.h>
21 22
#include <gtk/gtk.h>

23
#include "libgimpmath/gimpmath.h"
24
#include "libgimpconfig/gimpconfig.h"
25 26 27 28
#include "libgimpwidgets/gimpwidgets.h"

#include "actions-types.h"

29
#include "config/gimpdisplayoptions.h"
30 31 32 33 34 35 36
#include "config/gimpguiconfig.h"

#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"

#include "widgets/gimpactiongroup.h"
37
#include "widgets/gimprender.h"
38
#include "widgets/gimphelp-ids.h"
39
#include "widgets/gimpwidgets-utils.h"
40 41 42 43

#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "display/gimpdisplayshell-appearance.h"
44
#include "display/gimpdisplayshell-scale.h"
45
#include "display/gimpimagewindow.h"
46

47
#include "actions.h"
48
#include "view-actions.h"
Michael Natterer's avatar
Michael Natterer committed
49
#include "view-commands.h"
50
#include "window-actions.h"
51
#include "window-commands.h"
52 53 54 55 56 57

#include "gimp-intl.h"


/*  local function prototypes  */

58 59
static void   view_actions_set_zoom          (GimpActionGroup   *group,
                                              GimpDisplayShell  *shell);
60 61
static void   view_actions_set_rotate        (GimpActionGroup   *group,
                                              GimpDisplayShell  *shell);
62 63 64
static void   view_actions_check_type_notify (GimpDisplayConfig *config,
                                              GParamSpec        *pspec,
                                              GimpActionGroup   *group);
65 66


67
static const GimpActionEntry view_actions[] =
68
{
69 70
  { "view-menu",                NULL, NC_("view-action", "_View")          },
  { "view-zoom-menu",           NULL, NC_("view-action", "_Zoom")          },
71
  { "view-rotate-menu",         NULL, NC_("view-action", "_Flip & Rotate") },
72
  { "view-padding-color-menu",  NULL, NC_("view-action", "_Padding Color") },
73 74 75 76

  { "view-color-management-menu", NULL,
    NC_("view-action", "_Color Management") },

77 78 79 80
  { "view-display-intent-menu", NULL,
    NC_("view-action", "Display _Rendering Intent") },

  { "view-softproof-intent-menu", NULL,
81
    NC_("view-action", "Soft-Proofing Re_ndering Intent") },
82

83
  { "view-move-to-screen-menu", GIMP_ICON_WINDOW_MOVE_TO_SCREEN,
84
    NC_("view-action", "Move to Screen"), NULL, NULL, NULL,
85
    GIMP_HELP_VIEW_CHANGE_SCREEN },
86

87
  { "view-new", GIMP_ICON_WINDOW_NEW,
88
    NC_("view-action", "_New View"), NULL,
89
    NC_("view-action", "Create another view on this image"),
90
    G_CALLBACK (view_new_cmd_callback),
91 92
    GIMP_HELP_VIEW_NEW },

93
  { "view-close", GIMP_ICON_WINDOW_CLOSE,
94 95 96
    NC_("view-action",  "_Close View"), "<primary>W",
    NC_("view-action", "Close the active image view"),
    G_CALLBACK (view_close_cmd_callback),
97 98
    GIMP_HELP_FILE_CLOSE },

99 100 101 102 103 104
  { "view-scroll-center", GIMP_ICON_CENTER,
    NC_("view-action", "Center Image in Window"), "<shift>J",
    NC_("view-action", "Scroll the image so that it is centered in the window"),
    G_CALLBACK (view_scroll_center_cmd_callback),
    GIMP_HELP_VIEW_SCROLL_CENTER },

105
  { "view-zoom-fit-in", GIMP_ICON_ZOOM_FIT_BEST,
106
    NC_("view-action", "_Fit Image in Window"), "<primary><shift>J",
107
    NC_("view-action", "Adjust the zoom ratio so that the image becomes fully visible"),
108 109 110
    G_CALLBACK (view_zoom_fit_in_cmd_callback),
    GIMP_HELP_VIEW_ZOOM_FIT_IN },

111
  { "view-zoom-fill", GIMP_ICON_ZOOM_FIT_BEST,
112
    NC_("view-action", "Fi_ll Window"), NULL,
113
    NC_("view-action", "Adjust the zoom ratio so that the entire window is used"),
114 115
    G_CALLBACK (view_zoom_fill_cmd_callback),
    GIMP_HELP_VIEW_ZOOM_FILL },
116

117
  { "view-zoom-selection", GIMP_ICON_SELECTION,
118 119 120 121 122
    NC_("view-action", "Zoom to _Selection"), NULL,
    NC_("view-action", "Adjust the zoom ratio so that the selection fills the window"),
    G_CALLBACK (view_zoom_selection_cmd_callback),
    GIMP_HELP_VIEW_ZOOM_SELECTION },

123
  { "view-zoom-revert", NULL,
124
    NC_("view-action", "Re_vert Zoom"), "grave",
125
    NC_("view-action", "Restore the previous zoom level"),
126 127 128
    G_CALLBACK (view_zoom_revert_cmd_callback),
    GIMP_HELP_VIEW_ZOOM_REVERT },

129
  { "view-rotate-other", NULL,
130
    NC_("view-action", "Othe_r rotation angle..."), NULL,
131
    NC_("view-action", "Set a custom rotation angle"),
132
    G_CALLBACK (view_rotate_other_cmd_callback),
133 134
    GIMP_HELP_VIEW_ROTATE_OTHER },

135
  { "view-navigation-window", GIMP_ICON_DIALOG_NAVIGATION,
136
    NC_("view-action", "Na_vigation Window"), NULL,
137
    NC_("view-action", "Show an overview window for this image"),
138 139 140
    G_CALLBACK (view_navigation_window_cmd_callback),
    GIMP_HELP_NAVIGATION_DIALOG },

141
  { "view-display-filters", GIMP_ICON_DISPLAY_FILTER,
142
    NC_("view-action", "Display _Filters..."), NULL,
143
    NC_("view-action", "Configure filters applied to this view"),
144 145 146
    G_CALLBACK (view_display_filters_cmd_callback),
    GIMP_HELP_DISPLAY_FILTER_DIALOG },

147
  { "view-color-management-reset", GIMP_ICON_RESET,
148 149 150 151 152 153
    NC_("view-action", "As in _Preferences"), NULL,
    NC_("view-action",
        "Reset color management to what's configured in preferences"),
    G_CALLBACK (view_color_management_reset_cmd_callback),
    GIMP_HELP_VIEW_COLOR_MANAGEMENT },

154 155 156 157 158 159
  { "view-softproof-profile", NULL,
    NC_("view-action", "Soft-_Proofing Profile..."), NULL,
    NC_("view-action", "Set the soft-proofing profile"),
    G_CALLBACK (view_softproof_profile_cmd_callback),
    GIMP_HELP_VIEW_COLOR_MANAGEMENT },

160
  { "view-shrink-wrap", GIMP_ICON_ZOOM_FIT_BEST,
161
    NC_("view-action", "Shrink _Wrap"), "<primary>J",
162
    NC_("view-action", "Reduce the image window to the size of the image display"),
163
    G_CALLBACK (view_shrink_wrap_cmd_callback),
164 165 166
    GIMP_HELP_VIEW_SHRINK_WRAP },

  { "view-open-display", NULL,
167
    NC_("view-action", "_Open Display..."), NULL,
168
    NC_("view-action", "Connect to another display"),
169 170
    G_CALLBACK (window_open_display_cmd_callback),
    NULL }
171 172
};

173
static const GimpToggleActionEntry view_toggle_actions[] =
174 175
{
  { "view-dot-for-dot", NULL,
176
    NC_("view-action", "_Dot for Dot"), NULL,
177
    NC_("view-action", "A pixel on the screen represents an image pixel"),
178 179 180 181
    G_CALLBACK (view_dot_for_dot_cmd_callback),
    TRUE,
    GIMP_HELP_VIEW_DOT_FOR_DOT },

182
  { "view-color-management-enable", NULL,
183 184
    NC_("view-action", "_Color-Manage this View"), NULL,
    NC_("view-action", "Use color management for this view"),
185 186 187 188 189
    G_CALLBACK (view_color_management_enable_cmd_callback),
    TRUE,
    GIMP_HELP_VIEW_COLOR_MANAGEMENT },

  { "view-color-management-softproof", NULL,
190 191
    NC_("view-action", "_Proof Colors"), NULL,
    NC_("view-action", "Use this view for soft-proofing"),
192 193 194 195 196
    G_CALLBACK (view_color_management_softproof_cmd_callback),
    FALSE,
    GIMP_HELP_VIEW_COLOR_MANAGEMENT },

  { "view-display-black-point-compensation", NULL,
197
    NC_("view-action", "_Black Point Compensation"), NULL,
198 199
    NC_("view-action", "Use black point compensation for image display"),
    G_CALLBACK (view_display_bpc_cmd_callback),
200 201 202
    TRUE,
    GIMP_HELP_VIEW_COLOR_MANAGEMENT },

203 204
  { "view-softproof-black-point-compensation", NULL,
    NC_("view-action", "_Black Point Compensation"), NULL,
205
    NC_("view-action", "Use black point compensation for soft-proofing"),
206 207 208 209 210
    G_CALLBACK (view_softproof_bpc_cmd_callback),
    TRUE,
    GIMP_HELP_VIEW_COLOR_MANAGEMENT },

  { "view-softproof-gamut-check", NULL,
211
    NC_("view-action", "_Mark Out Of Gamut Colors"), NULL,
212
    NC_("view-action", "When soft-proofing, mark colors which cannot "
213
        "be represented in the target color space"),
214
    G_CALLBACK (view_softproof_gamut_check_cmd_callback),
215 216 217
    FALSE,
    GIMP_HELP_VIEW_COLOR_MANAGEMENT },

218
  { "view-show-selection", NULL,
219
    NC_("view-action", "Show _Selection"), "<primary>T",
220
    NC_("view-action", "Display the selection outline"),
221 222 223 224 225
    G_CALLBACK (view_toggle_selection_cmd_callback),
    TRUE,
    GIMP_HELP_VIEW_SHOW_SELECTION },

  { "view-show-layer-boundary", NULL,
226
    NC_("view-action", "Show _Layer Boundary"), NULL,
227
    NC_("view-action", "Draw a border around the active layer"),
228 229 230 231 232
    G_CALLBACK (view_toggle_layer_boundary_cmd_callback),
    TRUE,
    GIMP_HELP_VIEW_SHOW_LAYER_BOUNDARY },

  { "view-show-guides", NULL,
233
    NC_("view-action", "Show _Guides"), "<primary><shift>T",
234
    NC_("view-action", "Display the image's guides"),
235 236 237 238 239
    G_CALLBACK (view_toggle_guides_cmd_callback),
    TRUE,
    GIMP_HELP_VIEW_SHOW_GUIDES },

  { "view-show-grid", NULL,
240
    NC_("view-action", "S_how Grid"), NULL,
241
    NC_("view-action", "Display the image's grid"),
242 243 244 245
    G_CALLBACK (view_toggle_grid_cmd_callback),
    FALSE,
    GIMP_HELP_VIEW_SHOW_GRID },

246
  { "view-show-sample-points", NULL,
247
    NC_("view-action", "Show Sample Points"), NULL,
248
    NC_("view-action", "Display the image's color sample points"),
249 250 251 252
    G_CALLBACK (view_toggle_sample_points_cmd_callback),
    TRUE,
    GIMP_HELP_VIEW_SHOW_SAMPLE_POINTS },

253
  { "view-snap-to-guides", NULL,
254
    NC_("view-action", "Sn_ap to Guides"), NULL,
255
    NC_("view-action", "Tool operations snap to guides"),
256 257 258 259
    G_CALLBACK (view_snap_to_guides_cmd_callback),
    TRUE,
    GIMP_HELP_VIEW_SNAP_TO_GUIDES },

260
  { "view-snap-to-grid", NULL,
261
    NC_("view-action", "Sna_p to Grid"), NULL,
262
    NC_("view-action", "Tool operations snap to the grid"),
263 264 265 266
    G_CALLBACK (view_snap_to_grid_cmd_callback),
    FALSE,
    GIMP_HELP_VIEW_SNAP_TO_GRID },

267
  { "view-snap-to-canvas", NULL,
268
    NC_("view-action", "Snap to _Canvas Edges"), NULL,
269
    NC_("view-action", "Tool operations snap to the canvas edges"),
270 271 272 273 274
    G_CALLBACK (view_snap_to_canvas_cmd_callback),
    FALSE,
    GIMP_HELP_VIEW_SNAP_TO_CANVAS },

  { "view-snap-to-vectors", NULL,
275
    NC_("view-action", "Snap t_o Active Path"), NULL,
276
    NC_("view-action", "Tool operations snap to the active path"),
277 278 279 280
    G_CALLBACK (view_snap_to_vectors_cmd_callback),
    FALSE,
    GIMP_HELP_VIEW_SNAP_TO_VECTORS },

281
  { "view-show-menubar", NULL,
282
    NC_("view-action", "Show _Menubar"), NULL,
283
    NC_("view-action", "Show this window's menubar"),
284 285 286 287 288
    G_CALLBACK (view_toggle_menubar_cmd_callback),
    TRUE,
    GIMP_HELP_VIEW_SHOW_MENUBAR },

  { "view-show-rulers", NULL,
289
    NC_("view-action", "Show R_ulers"), "<primary><shift>R",
290
    NC_("view-action", "Show this window's rulers"),
291 292 293 294 295
    G_CALLBACK (view_toggle_rulers_cmd_callback),
    TRUE,
    GIMP_HELP_VIEW_SHOW_RULERS },

  { "view-show-scrollbars", NULL,
296
    NC_("view-action", "Show Scroll_bars"), NULL,
297
    NC_("view-action", "Show this window's scrollbars"),
298 299 300 301 302
    G_CALLBACK (view_toggle_scrollbars_cmd_callback),
    TRUE,
    GIMP_HELP_VIEW_SHOW_SCROLLBARS },

  { "view-show-statusbar", NULL,
303
    NC_("view-action", "Show S_tatusbar"), NULL,
304
    NC_("view-action", "Show this window's statusbar"),
305 306 307 308
    G_CALLBACK (view_toggle_statusbar_cmd_callback),
    TRUE,
    GIMP_HELP_VIEW_SHOW_STATUSBAR },

309
  { "view-fullscreen", GIMP_ICON_VIEW_FULLSCREEN,
310
    NC_("view-action", "Fullscr_een"), "F11",
311
    NC_("view-action", "Toggle fullscreen view"),
312 313
    G_CALLBACK (view_fullscreen_cmd_callback),
    FALSE,
314
    GIMP_HELP_VIEW_FULLSCREEN }
315 316
};

317
static const GimpEnumActionEntry view_zoom_actions[] =
318 319
{
  { "view-zoom", NULL,
320
    NC_("view-action", "Set zoom factor"), NULL, NULL,
321
    GIMP_ACTION_SELECT_SET, TRUE,
322
    NULL },
323

324
  { "view-zoom-minimum", GIMP_ICON_ZOOM_OUT,
325
    NC_("view-action", "Zoom out as far as possible"), NULL, NULL,
326
    GIMP_ACTION_SELECT_FIRST, FALSE,
327 328
    GIMP_HELP_VIEW_ZOOM_OUT },

329
  { "view-zoom-maximum", GIMP_ICON_ZOOM_IN,
330
    NC_("view-action", "Zoom in as far as possible"), NULL, NULL,
331
    GIMP_ACTION_SELECT_LAST, FALSE,
332 333
    GIMP_HELP_VIEW_ZOOM_IN },

334
  { "view-zoom-out", GIMP_ICON_ZOOM_OUT,
335
    NC_("view-zoom-action", "Zoom _Out"), "minus",
336
    NC_("view-zoom-action", "Zoom out"),
337
    GIMP_ACTION_SELECT_PREVIOUS, FALSE,
338
    GIMP_HELP_VIEW_ZOOM_OUT },
339

340
  { "view-zoom-in", GIMP_ICON_ZOOM_IN,
341
    NC_("view-zoom-action", "Zoom _In"), "plus",
342
    NC_("view-zoom-action", "Zoom in"),
343
    GIMP_ACTION_SELECT_NEXT, FALSE,
344
    GIMP_HELP_VIEW_ZOOM_IN },
345

346
  { "view-zoom-out-accel", GIMP_ICON_CHAR_PICKER,
347
    NC_("view-zoom-action", "Zoom Out"), "KP_Subtract",
348
    NC_("view-zoom-action", "Zoom out"),
349
    GIMP_ACTION_SELECT_PREVIOUS, FALSE,
350
    GIMP_HELP_VIEW_ZOOM_OUT },
351

352
  { "view-zoom-in-accel", GIMP_ICON_CHAR_PICKER,
353
    NC_("view-zoom-action", "Zoom In"), "KP_Add",
354
    NC_("view-zoom-action", "Zoom in"),
355
    GIMP_ACTION_SELECT_NEXT, FALSE,
356
    GIMP_HELP_VIEW_ZOOM_IN },
357

358
  { "view-zoom-out-skip", GIMP_ICON_ZOOM_OUT,
359
    NC_("view-action", "Zoom out a lot"), NULL, NULL,
360
    GIMP_ACTION_SELECT_SKIP_PREVIOUS, FALSE,
361 362
    GIMP_HELP_VIEW_ZOOM_OUT },

363
  { "view-zoom-in-skip", GIMP_ICON_ZOOM_IN,
364
    NC_("view-action", "Zoom in a lot"), NULL, NULL,
365
    GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
366
    GIMP_HELP_VIEW_ZOOM_IN }
367 368
};

369
static const GimpRadioActionEntry view_zoom_explicit_actions[] =
370 371
{
  { "view-zoom-16-1", NULL,
372
    NC_("view-zoom-action", "1_6:1  (1600%)"), "5",
373
    NC_("view-zoom-action", "Zoom 16:1"),
374 375 376
    160000,
    GIMP_HELP_VIEW_ZOOM_IN },

377 378 379 380 381 382
  { "view-zoom-16-1-accel", NULL,
    NC_("view-zoom-action", "1_6:1  (1600%)"), "KP_5",
    NC_("view-zoom-action", "Zoom 16:1"),
    160000,
    GIMP_HELP_VIEW_ZOOM_IN },

383
  { "view-zoom-8-1", NULL,
384
    NC_("view-zoom-action", "_8:1  (800%)"), "4",
385
    NC_("view-zoom-action", "Zoom 8:1"),
386 387 388
    80000,
    GIMP_HELP_VIEW_ZOOM_IN },

389 390 391 392 393 394
  { "view-zoom-8-1-accel", NULL,
    NC_("view-zoom-action", "_8:1  (800%)"), "KP_4",
    NC_("view-zoom-action", "Zoom 8:1"),
    80000,
    GIMP_HELP_VIEW_ZOOM_IN },

395
  { "view-zoom-4-1", NULL,
396
    NC_("view-zoom-action", "_4:1  (400%)"), "3",
397
    NC_("view-zoom-action", "Zoom 4:1"),
398 399 400
    40000,
    GIMP_HELP_VIEW_ZOOM_IN },

401 402 403 404 405 406
  { "view-zoom-4-1-accel", NULL,
    NC_("view-zoom-action", "_4:1  (400%)"), "KP_3",
    NC_("view-zoom-action", "Zoom 4:1"),
    40000,
    GIMP_HELP_VIEW_ZOOM_IN },

407
  { "view-zoom-2-1", NULL,
408
    NC_("view-zoom-action", "_2:1  (200%)"), "2",
409
    NC_("view-zoom-action", "Zoom 2:1"),
410 411 412
    20000,
    GIMP_HELP_VIEW_ZOOM_IN },

413 414 415 416 417 418
  { "view-zoom-2-1-accel", NULL,
    NC_("view-zoom-action", "_2:1  (200%)"), "KP_2",
    NC_("view-zoom-action", "Zoom 2:1"),
    20000,
    GIMP_HELP_VIEW_ZOOM_IN },

419
  { "view-zoom-1-1", GIMP_ICON_ZOOM_ORIGINAL,
420
    NC_("view-zoom-action", "_1:1  (100%)"), "1",
421
    NC_("view-zoom-action", "Zoom 1:1"),
422 423 424
    10000,
    GIMP_HELP_VIEW_ZOOM_100 },

425
  { "view-zoom-1-1-accel", GIMP_ICON_ZOOM_ORIGINAL,
426 427 428 429 430
    NC_("view-zoom-action", "_1:1  (100%)"), "KP_1",
    NC_("view-zoom-action", "Zoom 1:1"),
    10000,
    GIMP_HELP_VIEW_ZOOM_100 },

431
  { "view-zoom-1-2", NULL,
432
    NC_("view-zoom-action", "1:_2  (50%)"), "<shift>2",
433
    NC_("view-zoom-action", "Zoom 1:2"),
434 435 436 437
    5000,
    GIMP_HELP_VIEW_ZOOM_OUT },

  { "view-zoom-1-4", NULL,
438
    NC_("view-zoom-action", "1:_4  (25%)"), "<shift>3",
439
    NC_("view-zoom-action", "Zoom 1:4"),
440 441 442 443
    2500,
    GIMP_HELP_VIEW_ZOOM_OUT },

  { "view-zoom-1-8", NULL,
444
    NC_("view-zoom-action", "1:_8  (12.5%)"), "<shift>4",
445
    NC_("view-zoom-action", "Zoom 1:8"),
446 447 448 449
    1250,
    GIMP_HELP_VIEW_ZOOM_OUT },

  { "view-zoom-1-16", NULL,
450
    NC_("view-zoom-action", "1:1_6  (6.25%)"), "<shift>5",
451
    NC_("view-zoom-action", "Zoom 1:16"),
452 453 454 455
    625,
    GIMP_HELP_VIEW_ZOOM_OUT },

  { "view-zoom-other", NULL,
456
    NC_("view-zoom-action", "Othe_r zoom factor..."), NULL,
457
    NC_("view-zoom-action", "Set a custom zoom factor"),
458 459 460 461
    0,
    GIMP_HELP_VIEW_ZOOM_OTHER }
};

462 463
static const GimpToggleActionEntry view_flip_actions[] =
{
464
  { "view-flip-horizontally", GIMP_ICON_OBJECT_FLIP_HORIZONTAL,
465
    NC_("view-action", "Flip Horizontally"), NULL,
466
    NC_("view-action", "Flip the view horizontally"),
467 468 469 470
    G_CALLBACK (view_flip_horizontally_cmd_callback),
    FALSE,
    GIMP_HELP_VIEW_FLIP },

471
  { "view-flip-vertically", GIMP_ICON_OBJECT_FLIP_VERTICAL,
472
    NC_("view-action", "Flip Vertically"), NULL,
473
    NC_("view-action", "Flip the view vertically"),
474 475 476 477 478
    G_CALLBACK (view_flip_vertically_cmd_callback),
    FALSE,
    GIMP_HELP_VIEW_FLIP }
};

479 480 481 482 483 484 485
static const GimpEnumActionEntry view_rotate_absolute_actions[] =
{
  { "view-rotate-set-absolute", NULL,
    "Display Rotation Absolute Angle Set", NULL, NULL,
    GIMP_ACTION_SELECT_SET, TRUE,
    NULL },

486
  { "view-rotate-reset", GIMP_ICON_RESET,
487 488 489
    NC_("view-action", "_Reset Flip & Rotate"), "exclam",
    NC_("view-action",
        "Reset flipping to unflipped and the angle of rotation to 0°"),
490 491 492 493
    GIMP_ACTION_SELECT_SET_TO_DEFAULT, FALSE,
    GIMP_HELP_VIEW_ROTATE_RESET },
};

494
static const GimpEnumActionEntry view_rotate_relative_actions[] =
495
{
496
  { "view-rotate-15", GIMP_ICON_OBJECT_ROTATE_90,
497
    NC_("view-action", "Rotate 15° _clockwise"), NULL,
498
    NC_("view-action", "Rotate the view 15 degrees to the right"),
499 500 501
    GIMP_ACTION_SELECT_NEXT, FALSE,
    GIMP_HELP_VIEW_ROTATE_15 },

502
  { "view-rotate-90", GIMP_ICON_OBJECT_ROTATE_90,
503
    NC_("view-action", "Rotate 90° _clockwise"), NULL,
504
    NC_("view-action", "Rotate the view 90 degrees to the right"),
505
    GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
506 507
    GIMP_HELP_VIEW_ROTATE_90 },

508
  { "view-rotate-180", GIMP_ICON_OBJECT_ROTATE_180,
509
    NC_("view-action", "Rotate _180°"), NULL,
510
    NC_("view-action", "Turn the view upside-down"),
511
    GIMP_ACTION_SELECT_LAST, FALSE,
512 513
    GIMP_HELP_VIEW_ROTATE_180 },

514
  { "view-rotate-270", GIMP_ICON_OBJECT_ROTATE_270,
515
    NC_("view-action", "Rotate 90° counter-clock_wise"), NULL,
516
    NC_("view-action", "Rotate the view 90 degrees to the left"),
517 518 519
    GIMP_ACTION_SELECT_SKIP_PREVIOUS, FALSE,
    GIMP_HELP_VIEW_ROTATE_270 },

520
  { "view-rotate-345", GIMP_ICON_OBJECT_ROTATE_270,
521
    NC_("view-action", "Rotate 15° counter-clock_wise"), NULL,
522
    NC_("view-action", "Rotate the view 15 degrees to the left"),
523 524
    GIMP_ACTION_SELECT_PREVIOUS, FALSE,
    GIMP_HELP_VIEW_ROTATE_345 }
525 526
};

527
static const GimpRadioActionEntry view_display_intent_actions[] =
528
{
529 530 531 532
  { "view-display-intent-perceptual", NULL,
    NC_("view-action", "_Perceptual"), NULL,
    NC_("view-action", "Display rendering intent is perceptual"),
    GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL,
533 534
    GIMP_HELP_VIEW_COLOR_MANAGEMENT },

535 536 537 538
  { "view-display-intent-relative-colorimetric", NULL,
    NC_("view-action", "_Relative Colorimetric"), NULL,
    NC_("view-action", "Display rendering intent is relative colorimetric"),
    GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC,
539 540
    GIMP_HELP_VIEW_COLOR_MANAGEMENT },

541 542 543 544 545 546 547 548 549 550
  { "view-display-intent-saturation", NULL,
    NC_("view-action", "_Saturation"), NULL,
    NC_("view-action", "Display rendering intent is saturation"),
    GIMP_COLOR_RENDERING_INTENT_SATURATION,
    GIMP_HELP_VIEW_COLOR_MANAGEMENT },

  { "view-display-intent-absolute-colorimetric", NULL,
    NC_("view-action", "_Absolute Colorimetric"), NULL,
    NC_("view-action", "Display rendering intent is absolute colorimetric"),
    GIMP_COLOR_RENDERING_INTENT_ABSOLUTE_COLORIMETRIC,
551 552 553
    GIMP_HELP_VIEW_COLOR_MANAGEMENT }
};

554
static const GimpRadioActionEntry view_softproof_intent_actions[] =
555
{
556
  { "view-softproof-intent-perceptual", NULL,
557
    NC_("view-action", "_Perceptual"), NULL,
558
    NC_("view-action", "Soft-proofing rendering intent is perceptual"),
559 560 561
    GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL,
    GIMP_HELP_VIEW_COLOR_MANAGEMENT },

562
  { "view-softproof-intent-relative-colorimetric", NULL,
563
    NC_("view-action", "_Relative Colorimetric"), NULL,
564
    NC_("view-action", "Soft-proofing rendering intent is relative colorimetric"),
565 566 567
    GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC,
    GIMP_HELP_VIEW_COLOR_MANAGEMENT },

568
  { "view-softproof-intent-saturation", NULL,
569
    NC_("view-action", "_Saturation"), NULL,
570
    NC_("view-action", "Soft-proofing rendering intent is saturation"),
571 572 573
    GIMP_COLOR_RENDERING_INTENT_SATURATION,
    GIMP_HELP_VIEW_COLOR_MANAGEMENT },

574
  { "view-softproof-intent-absolute-colorimetric", NULL,
575
    NC_("view-action", "_Absolute Colorimetric"), NULL,
576
    NC_("view-action", "Soft-proofing rendering intent is absolute colorimetric"),
577 578 579 580
    GIMP_COLOR_RENDERING_INTENT_ABSOLUTE_COLORIMETRIC,
    GIMP_HELP_VIEW_COLOR_MANAGEMENT }
};

581
static const GimpEnumActionEntry view_padding_color_actions[] =
582 583
{
  { "view-padding-color-theme", NULL,
584
    NC_("view-padding-color", "From _Theme"), NULL,
585
    NC_("view-padding-color", "Use the current theme's background color"),
586
    GIMP_CANVAS_PADDING_MODE_DEFAULT, FALSE,
587 588 589
    GIMP_HELP_VIEW_PADDING_COLOR },

  { "view-padding-color-light-check", NULL,
590
    NC_("view-padding-color", "_Light Check Color"), NULL,
591
    NC_("view-padding-color", "Use the light check color"),
592
    GIMP_CANVAS_PADDING_MODE_LIGHT_CHECK, FALSE,
593 594 595
    GIMP_HELP_VIEW_PADDING_COLOR },

  { "view-padding-color-dark-check", NULL,
596
    NC_("view-padding-color", "_Dark Check Color"), NULL,
597
    NC_("view-padding-color", "Use the dark check color"),
598
    GIMP_CANVAS_PADDING_MODE_DARK_CHECK, FALSE,
599 600
    GIMP_HELP_VIEW_PADDING_COLOR },

601
  { "view-padding-color-custom", GIMP_ICON_PALETTE,
602
    NC_("view-padding-color", "_Custom Color..."), NULL,
603
    NC_("view-padding-color", "Use an arbitrary color"),
604
    GIMP_CANVAS_PADDING_MODE_CUSTOM, FALSE,
605 606
    GIMP_HELP_VIEW_PADDING_COLOR },

607
  { "view-padding-color-prefs", GIMP_ICON_RESET,
608
    NC_("view-padding-color", "As in _Preferences"), NULL,
609 610
    NC_("view-padding-color",
        "Reset padding color to what's configured in preferences"),
611
    GIMP_CANVAS_PADDING_MODE_RESET, FALSE,
612 613 614
    GIMP_HELP_VIEW_PADDING_COLOR }
};

615
static const GimpEnumActionEntry view_scroll_horizontal_actions[] =
616 617
{
  { "view-scroll-horizontal", NULL,
618
    NC_("view-action", "Set horizontal scroll offset"), NULL, NULL,
619
    GIMP_ACTION_SELECT_SET, TRUE,
620
    NULL },
621

622
  { "view-scroll-left-border", NULL,
623
    NC_("view-action", "Scroll to left border"), NULL, NULL,
624
    GIMP_ACTION_SELECT_FIRST, FALSE,
625
    NULL },
626

627
  { "view-scroll-right-border", NULL,
628
    NC_("view-action", "Scroll to right border"), NULL, NULL,
629
    GIMP_ACTION_SELECT_LAST, FALSE,
630
    NULL },
631

632
  { "view-scroll-left", NULL,
633
    NC_("view-action", "Scroll left"), NULL, NULL,
634
    GIMP_ACTION_SELECT_PREVIOUS, FALSE,
635
    NULL },
636

637
  { "view-scroll-right", NULL,
638
    NC_("view-action", "Scroll right"), NULL, NULL,
639
    GIMP_ACTION_SELECT_NEXT, FALSE,
640
    NULL },
641

642
  { "view-scroll-page-left", NULL,
643
    NC_("view-action", "Scroll page left"), NULL, NULL,
644
    GIMP_ACTION_SELECT_SKIP_PREVIOUS, FALSE,
645
    NULL },
646

647
  { "view-scroll-page-right", NULL,
648
    NC_("view-action", "Scroll page right"), NULL, NULL,
649
    GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
650 651 652
    NULL }
};

653
static const GimpEnumActionEntry view_scroll_vertical_actions[] =
654 655
{
  { "view-scroll-vertical", NULL,
656
    NC_("view-action", "Set vertical scroll offset"), NULL, NULL,
657
    GIMP_ACTION_SELECT_SET, TRUE,
658
    NULL },
659

660
  { "view-scroll-top-border", NULL,
661
    NC_("view-action", "Scroll to top border"), NULL, NULL,
662
    GIMP_ACTION_SELECT_FIRST, FALSE,
663
    NULL },
664

665
  { "view-scroll-bottom-border", NULL,
666
    NC_("view-action", "Scroll to bottom border"), NULL, NULL,
667
    GIMP_ACTION_SELECT_LAST, FALSE,
668
    NULL },
669

670
  { "view-scroll-up", NULL,
671
    NC_("view-action", "Scroll up"), NULL, NULL,
672
    GIMP_ACTION_SELECT_PREVIOUS, FALSE,
673
    NULL },
674

675
  { "view-scroll-down", NULL,
676
    NC_("view-action", "Scroll down"), NULL, NULL,
677
    GIMP_ACTION_SELECT_NEXT, FALSE,
678
    NULL },
679

680
  { "view-scroll-page-up", NULL,
681
    NC_("view-action", "Scroll page up"), NULL, NULL,
682
    GIMP_ACTION_SELECT_SKIP_PREVIOUS, FALSE,
683
    NULL },
684

685
  { "view-scroll-page-down", NULL,
686
    NC_("view-action", "Scroll page down"), NULL, NULL,
687
    GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
688 689 690
    NULL }
};

691 692

void
693
view_actions_setup (GimpActionGroup *group)
694
{
695 696
  GtkAction *action;

697
  gimp_action_group_add_actions (group, "view-action",
698
                                 view_actions,
699
                                 G_N_ELEMENTS (view_actions));
700

701
  gimp_action_group_add_toggle_actions (group, "view-action",
702
                                        view_toggle_actions,
703
                                        G_N_ELEMENTS (view_toggle_actions));
704

705
  gimp_action_group_add_enum_actions (group, "view-zoom-action",
706 707 708 709
                                      view_zoom_actions,
                                      G_N_ELEMENTS (view_zoom_actions),
                                      G_CALLBACK (view_zoom_cmd_callback));

710
  gimp_action_group_add_radio_actions (group, "view-zoom-action",
711 712
                                       view_zoom_explicit_actions,
                                       G_N_ELEMENTS (view_zoom_explicit_actions),
713
                                       NULL,
714
                                       10000,
715
                                       G_CALLBACK (view_zoom_explicit_cmd_callback));
716

717 718 719 720
  gimp_action_group_add_toggle_actions (group, "view-action",
                                        view_flip_actions,
                                        G_N_ELEMENTS (view_flip_actions));

721 722 723 724 725
  gimp_action_group_add_enum_actions (group, "view-action",
                                      view_rotate_absolute_actions,
                                      G_N_ELEMENTS (view_rotate_absolute_actions),
                                      G_CALLBACK (view_rotate_absolute_cmd_callback));

726
  gimp_action_group_add_enum_actions (group, "view-action",
727 728 729
                                      view_rotate_relative_actions,
                                      G_N_ELEMENTS (view_rotate_relative_actions),
                                      G_CALLBACK (view_rotate_relative_cmd_callback));
730

731
  gimp_action_group_add_radio_actions (group, "view-action",
732 733
                                       view_display_intent_actions,
                                       G_N_ELEMENTS (view_display_intent_actions),
734 735
                                       NULL,
                                       GIMP_COLOR_MANAGEMENT_DISPLAY,
736
                                       G_CALLBACK (view_display_intent_cmd_callback));
737

738
  gimp_action_group_add_radio_actions (group, "view-action",
739 740
                                       view_softproof_intent_actions,
                                       G_N_ELEMENTS (view_softproof_intent_actions),
741 742
                                       NULL,
                                       GIMP_COLOR_MANAGEMENT_DISPLAY,
743
                                       G_CALLBACK (view_softproof_intent_cmd_callback));
744

745
  gimp_action_group_add_enum_actions (group, "view-padding-color",
746 747 748 749
                                      view_padding_color_actions,
                                      G_N_ELEMENTS (view_padding_color_actions),
                                      G_CALLBACK (view_padding_color_cmd_callback));

750
  gimp_action_group_add_enum_actions (group, NULL,
751 752 753 754
                                      view_scroll_horizontal_actions,
                                      G_N_ELEMENTS (view_scroll_horizontal_actions),
                                      G_CALLBACK (view_scroll_horizontal_cmd_callback));

755
  gimp_action_group_add_enum_actions (group, NULL,
756 757 758 759
                                      view_scroll_vertical_actions,
                                      G_N_ELEMENTS (view_scroll_vertical_actions),
                                      G_CALLBACK (view_scroll_vertical_cmd_callback));

760 761 762 763 764 765 766 767
  /*  connect "activate" of view-zoom-other manually so it can be
   *  selected even if it's the active item of the radio group
   */
  action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
                                        "view-zoom-other");
  g_signal_connect (action, "activate",
                    G_CALLBACK (view_zoom_other_cmd_callback),
                    group->user_data);
768 769 770 771 772 773

  g_signal_connect_object (group->gimp->config, "notify::check-type",
                           G_CALLBACK (view_actions_check_type_notify),
                           group, 0);
  view_actions_check_type_notify (GIMP_DISPLAY_CONFIG (group->gimp->config),
                                  NULL, group);
774

775
  if (GIMP_IS_IMAGE_WINDOW (group->user_data) ||
776 777 778 779 780 781 782 783 784
      GIMP_IS_GIMP (group->user_data))
    {
      /*  add window actions only if the context of the group is
       *  the display itself or the global popup (not if the context
       *  is a dock)
       *  (see dock-actions.c)
       */
      window_actions_setup (group, GIMP_HELP_VIEW_CHANGE_SCREEN);
    }
785 786 787 788 789 790
}

void
view_actions_update (GimpActionGroup *group,
                     gpointer         data)
{
791 792 793 794
  GimpDisplay        *display           = action_data_get_display (data);
  GimpImage          *image             = NULL;
  GimpDisplayShell   *shell             = NULL;
  GimpDisplayOptions *options           = NULL;
795
  GimpColorConfig    *color_config      = NULL;
796 797 798 799 800
  gchar              *label             = NULL;
  gboolean            fullscreen        = FALSE;
  gboolean            revert_enabled    = FALSE;   /* able to revert zoom? */
  gboolean            flip_horizontally = FALSE;
  gboolean            flip_vertically   = FALSE;
801 802
  gboolean            cm                = FALSE;
  gboolean            sp                = FALSE;
803 804 805
  gboolean            d_bpc             = FALSE;
  gboolean            s_bpc             = FALSE;
  gboolean            gammut            = FALSE;
806

807
  if (display)
808
    {
809 810
      GimpImageWindow *window;
      const gchar     *action = NULL;
811

812
      image  = gimp_display_get_image (display);
813
      shell  = gimp_display_get_shell (display);
814
      window = gimp_display_shell_get_window (shell);
815

816 817
      if (window)
        fullscreen = gimp_image_window_get_fullscreen (window);
818

819 820 821
      options = (image ?
                 (fullscreen ? shell->fullscreen_options : shell->options) :
                 shell->no_image_options);
822 823

      revert_enabled = gimp_display_shell_scale_can_revert (shell);
824 825 826

      flip_horizontally = shell->flip_horizontally;
      flip_vertically   = shell->flip_vertically;
827 828 829

      color_config = gimp_display_shell_get_color_config (shell);

830
      switch (gimp_color_config_get_mode (color_config))
831 832 833 834 835
        {
        case GIMP_COLOR_MANAGEMENT_OFF:
          break;

        case GIMP_COLOR_MANAGEMENT_DISPLAY:
836
          cm = (image != NULL);
837
          break;
838

839
        case GIMP_COLOR_MANAGEMENT_SOFTPROOF:
840 841 842 843
          cm = (image != NULL);
          sp = (image != NULL);
          break;
        }
844

845
      switch (gimp_color_config_get_display_intent (color_config))
846 847 848 849 850 851 852 853 854 855 856 857 858 859 860
        {
        case GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL:
          action = "view-display-intent-perceptual";
          break;

        case GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC:
          action = "view-display-intent-relative-colorimetric";
          break;

        case GIMP_COLOR_RENDERING_INTENT_SATURATION:
          action = "view-display-intent-saturation";
          break;

        case GIMP_COLOR_RENDERING_INTENT_ABSOLUTE_COLORIMETRIC:
          action = "view-display-intent-absolute-colorimetric";
861 862 863 864 865
          break;
        }

      gimp_action_group_set_action_active (group, action, TRUE);

866
      switch (gimp_color_config_get_simulation_intent (color_config))
867 868
        {
        case GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL:
869
          action = "view-softproof-intent-perceptual";
870 871 872
          break;

        case GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC:
873
          action = "view-softproof-intent-relative-colorimetric";
874 875 876
          break;

        case GIMP_COLOR_RENDERING_INTENT_SATURATION:
877
          action = "view-softproof-intent-saturation";