1095 lines
40 KiB
C
1095 lines
40 KiB
C
|
/* PIKA - Photo and Image Kooker Application
|
||
|
* a rebranding of The GNU Image Manipulation Program (created with heckimp)
|
||
|
* A derived work which may be trivial. However, any changes may be (C)2023 by Aldercone Studio
|
||
|
*
|
||
|
* Original copyright, applying to most contents (license remains unchanged):
|
||
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU General Public License as published by
|
||
|
* the Free Software Foundation; either version 3 of the License, or
|
||
|
* (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
|
||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||
|
*/
|
||
|
|
||
|
#include "config.h"
|
||
|
|
||
|
#include <gegl.h>
|
||
|
#include <gtk/gtk.h>
|
||
|
|
||
|
#include "libpikamath/pikamath.h"
|
||
|
#include "libpikaconfig/pikaconfig.h"
|
||
|
#include "libpikawidgets/pikawidgets.h"
|
||
|
|
||
|
#include "actions-types.h"
|
||
|
|
||
|
#include "config/pikadisplayoptions.h"
|
||
|
#include "config/pikaguiconfig.h"
|
||
|
|
||
|
#include "core/pika.h"
|
||
|
#include "core/pikacontext.h"
|
||
|
#include "core/pikaimage.h"
|
||
|
|
||
|
#include "widgets/pikaactiongroup.h"
|
||
|
#include "widgets/pikarender.h"
|
||
|
#include "widgets/pikahelp-ids.h"
|
||
|
#include "widgets/pikamenumodel.h"
|
||
|
#include "widgets/pikawidgets-utils.h"
|
||
|
|
||
|
#include "display/pikadisplay.h"
|
||
|
#include "display/pikadisplayshell.h"
|
||
|
#include "display/pikadisplayshell-appearance.h"
|
||
|
#include "display/pikadisplayshell-scale.h"
|
||
|
#include "display/pikaimagewindow.h"
|
||
|
|
||
|
#include "actions.h"
|
||
|
#include "view-actions.h"
|
||
|
#include "view-commands.h"
|
||
|
#include "window-actions.h"
|
||
|
#include "window-commands.h"
|
||
|
|
||
|
#include "pika-intl.h"
|
||
|
|
||
|
|
||
|
/* local function prototypes */
|
||
|
|
||
|
static void view_actions_set_zoom (PikaActionGroup *group,
|
||
|
PikaDisplayShell *shell);
|
||
|
static void view_actions_set_rotate (PikaActionGroup *group,
|
||
|
PikaDisplayShell *shell);
|
||
|
static void view_actions_check_type_notify (PikaDisplayConfig *config,
|
||
|
GParamSpec *pspec,
|
||
|
PikaActionGroup *group);
|
||
|
|
||
|
|
||
|
static const PikaActionEntry view_actions[] =
|
||
|
{
|
||
|
{ "view-new", PIKA_ICON_WINDOW_NEW,
|
||
|
NC_("view-action", "_New View"), NULL, { NULL },
|
||
|
NC_("view-action", "Create another view on this image"),
|
||
|
view_new_cmd_callback,
|
||
|
PIKA_HELP_VIEW_NEW },
|
||
|
|
||
|
{ "view-close", PIKA_ICON_WINDOW_CLOSE,
|
||
|
NC_("view-action", "_Close View"), NULL, { "<primary>W", NULL },
|
||
|
NC_("view-action", "Close the active image view"),
|
||
|
view_close_cmd_callback,
|
||
|
PIKA_HELP_FILE_CLOSE },
|
||
|
|
||
|
{ "view-scroll-center", PIKA_ICON_CENTER,
|
||
|
NC_("view-action", "C_enter Image in Window"), NULL, { "<shift>J", NULL },
|
||
|
NC_("view-action", "Scroll the image so that it is centered in the window"),
|
||
|
view_scroll_center_cmd_callback,
|
||
|
PIKA_HELP_VIEW_SCROLL_CENTER },
|
||
|
|
||
|
{ "view-zoom-fit-in", PIKA_ICON_ZOOM_FIT_BEST,
|
||
|
NC_("view-action", "_Fit Image in Window"), NULL, { "<primary><shift>J", NULL },
|
||
|
NC_("view-action", "Adjust the zoom ratio so that the image becomes fully visible"),
|
||
|
view_zoom_fit_in_cmd_callback,
|
||
|
PIKA_HELP_VIEW_ZOOM_FIT_IN },
|
||
|
|
||
|
{ "view-zoom-fill", PIKA_ICON_ZOOM_FIT_BEST,
|
||
|
NC_("view-action", "Fi_ll Window"), NULL, { NULL },
|
||
|
NC_("view-action", "Adjust the zoom ratio so that the entire window is used"),
|
||
|
view_zoom_fill_cmd_callback,
|
||
|
PIKA_HELP_VIEW_ZOOM_FILL },
|
||
|
|
||
|
{ "view-zoom-selection", PIKA_ICON_SELECTION,
|
||
|
NC_("view-action", "Zoom to _Selection"), NULL, { NULL },
|
||
|
NC_("view-action", "Adjust the zoom ratio so that the selection fills the window"),
|
||
|
view_zoom_selection_cmd_callback,
|
||
|
PIKA_HELP_VIEW_ZOOM_SELECTION },
|
||
|
|
||
|
{ "view-zoom-revert", NULL,
|
||
|
NC_("view-action", "Re_vert Zoom"), NULL, { "grave", NULL },
|
||
|
NC_("view-action", "Restore the previous zoom level"),
|
||
|
view_zoom_revert_cmd_callback,
|
||
|
PIKA_HELP_VIEW_ZOOM_REVERT },
|
||
|
|
||
|
{ "view-rotate-other", NULL,
|
||
|
NC_("view-action", "Othe_r rotation angle..."), NULL, { NULL },
|
||
|
NC_("view-action", "Set a custom rotation angle"),
|
||
|
view_rotate_other_cmd_callback,
|
||
|
PIKA_HELP_VIEW_ROTATE_OTHER },
|
||
|
|
||
|
{ "view-flip-reset", PIKA_ICON_RESET,
|
||
|
NC_("view-action", "_Reset Flipping"), NULL, { NULL },
|
||
|
NC_("view-action",
|
||
|
"Reset flipping to unflipped"),
|
||
|
view_flip_reset_cmd_callback,
|
||
|
PIKA_HELP_VIEW_FLIP_RESET },
|
||
|
|
||
|
{ "view-reset", PIKA_ICON_RESET,
|
||
|
NC_("view-action", "_Reset Flip & Rotate"), NULL, { "exclam", NULL },
|
||
|
NC_("view-action",
|
||
|
"Reset flipping to unflipped and the angle of rotation to 0°"),
|
||
|
view_reset_cmd_callback,
|
||
|
PIKA_HELP_VIEW_RESET },
|
||
|
|
||
|
{ "view-navigation-window", PIKA_ICON_DIALOG_NAVIGATION,
|
||
|
NC_("view-action", "Na_vigation Window"), NULL, { NULL },
|
||
|
NC_("view-action", "Show an overview window for this image"),
|
||
|
view_navigation_window_cmd_callback,
|
||
|
PIKA_HELP_NAVIGATION_DIALOG },
|
||
|
|
||
|
{ "view-display-filters", PIKA_ICON_DISPLAY_FILTER,
|
||
|
NC_("view-action", "Display _Filters..."), NULL, { NULL },
|
||
|
NC_("view-action", "Configure filters applied to this view"),
|
||
|
view_display_filters_cmd_callback,
|
||
|
PIKA_HELP_DISPLAY_FILTER_DIALOG },
|
||
|
|
||
|
{ "view-color-management-reset", PIKA_ICON_RESET,
|
||
|
NC_("view-action", "As in _Preferences"), NULL, { NULL },
|
||
|
NC_("view-action",
|
||
|
"Reset color management to what's configured in preferences"),
|
||
|
view_color_management_reset_cmd_callback,
|
||
|
PIKA_HELP_VIEW_COLOR_MANAGEMENT },
|
||
|
|
||
|
{ "view-shrink-wrap", PIKA_ICON_ZOOM_FIT_BEST,
|
||
|
NC_("view-action", "Shrink _Wrap"), NULL, { "<primary>J", NULL },
|
||
|
NC_("view-action", "Reduce the image window to the size of the image display"),
|
||
|
view_shrink_wrap_cmd_callback,
|
||
|
PIKA_HELP_VIEW_SHRINK_WRAP },
|
||
|
|
||
|
{ "view-open-display", NULL,
|
||
|
NC_("view-action", "_Open Display..."), NULL, { NULL },
|
||
|
NC_("view-action", "Connect to another display"),
|
||
|
window_open_display_cmd_callback,
|
||
|
NULL }
|
||
|
};
|
||
|
|
||
|
static const PikaToggleActionEntry view_toggle_actions[] =
|
||
|
{
|
||
|
|
||
|
{ "view-show-all", NULL,
|
||
|
NC_("view-action", "Show _All"), NULL, { NULL },
|
||
|
NC_("view-action", "Show full image content"),
|
||
|
view_show_all_cmd_callback,
|
||
|
FALSE,
|
||
|
PIKA_HELP_VIEW_SHOW_ALL },
|
||
|
|
||
|
{ "view-dot-for-dot", NULL,
|
||
|
NC_("view-action", "_Dot for Dot"), NULL, { NULL },
|
||
|
NC_("view-action", "A pixel on the screen represents an image pixel"),
|
||
|
view_dot_for_dot_cmd_callback,
|
||
|
TRUE,
|
||
|
PIKA_HELP_VIEW_DOT_FOR_DOT },
|
||
|
|
||
|
{ "view-color-management-enable", NULL,
|
||
|
NC_("view-action", "_Color-Manage this View"), NULL, { NULL },
|
||
|
NC_("view-action", "Use color management for this view"),
|
||
|
view_color_management_enable_cmd_callback,
|
||
|
TRUE,
|
||
|
PIKA_HELP_VIEW_COLOR_MANAGEMENT },
|
||
|
|
||
|
{ "view-color-management-softproof", NULL,
|
||
|
NC_("view-action", "_Proof Colors"), NULL, { NULL },
|
||
|
NC_("view-action", "Use this view for soft-proofing"),
|
||
|
view_color_management_softproof_cmd_callback,
|
||
|
FALSE,
|
||
|
PIKA_HELP_VIEW_COLOR_MANAGEMENT },
|
||
|
|
||
|
{ "view-display-black-point-compensation", NULL,
|
||
|
NC_("view-action", "_Black Point Compensation"), NULL, { NULL },
|
||
|
NC_("view-action", "Use black point compensation for image display"),
|
||
|
view_display_bpc_cmd_callback,
|
||
|
TRUE,
|
||
|
PIKA_HELP_VIEW_COLOR_MANAGEMENT },
|
||
|
|
||
|
{ "view-softproof-gamut-check", NULL,
|
||
|
NC_("view-action", "_Mark Out Of Gamut Colors"), NULL, { NULL },
|
||
|
NC_("view-action", "When soft-proofing, mark colors which cannot "
|
||
|
"be represented in the target color space"),
|
||
|
view_softproof_gamut_check_cmd_callback,
|
||
|
FALSE,
|
||
|
PIKA_HELP_VIEW_COLOR_MANAGEMENT },
|
||
|
|
||
|
{ "view-show-selection", NULL,
|
||
|
NC_("view-action", "Show _Selection"), NULL, { "<primary>T", NULL },
|
||
|
NC_("view-action", "Display the selection outline"),
|
||
|
view_toggle_selection_cmd_callback,
|
||
|
TRUE,
|
||
|
PIKA_HELP_VIEW_SHOW_SELECTION },
|
||
|
|
||
|
{ "view-show-layer-boundary", NULL,
|
||
|
NC_("view-action", "Show _Layer Boundary"), NULL, { NULL },
|
||
|
NC_("view-action", "Draw a border around the active layer"),
|
||
|
view_toggle_layer_boundary_cmd_callback,
|
||
|
TRUE,
|
||
|
PIKA_HELP_VIEW_SHOW_LAYER_BOUNDARY },
|
||
|
|
||
|
{ "view-show-canvas-boundary", NULL,
|
||
|
NC_("view-action", "Show Canvas Bounda_ry"), NULL, { NULL },
|
||
|
NC_("view-action", "Draw a border around the canvas"),
|
||
|
view_toggle_canvas_boundary_cmd_callback,
|
||
|
TRUE,
|
||
|
PIKA_HELP_VIEW_SHOW_CANVAS_BOUNDARY },
|
||
|
|
||
|
{ "view-show-guides", NULL,
|
||
|
NC_("view-action", "Show _Guides"), NULL, { "<primary><shift>T", NULL },
|
||
|
NC_("view-action", "Display the image's guides"),
|
||
|
view_toggle_guides_cmd_callback,
|
||
|
TRUE,
|
||
|
PIKA_HELP_VIEW_SHOW_GUIDES },
|
||
|
|
||
|
{ "view-show-grid", NULL,
|
||
|
NC_("view-action", "S_how Grid"), NULL, { NULL },
|
||
|
NC_("view-action", "Display the image's grid"),
|
||
|
view_toggle_grid_cmd_callback,
|
||
|
FALSE,
|
||
|
PIKA_HELP_VIEW_SHOW_GRID },
|
||
|
|
||
|
{ "view-show-sample-points", NULL,
|
||
|
NC_("view-action", "Sh_ow Sample Points"), NULL, { NULL },
|
||
|
NC_("view-action", "Display the image's color sample points"),
|
||
|
view_toggle_sample_points_cmd_callback,
|
||
|
TRUE,
|
||
|
PIKA_HELP_VIEW_SHOW_SAMPLE_POINTS },
|
||
|
|
||
|
{ "view-snap-to-guides", NULL,
|
||
|
NC_("view-action", "Snap to Gu_ides"), NULL, { NULL },
|
||
|
NC_("view-action", "Tool operations snap to guides"),
|
||
|
view_snap_to_guides_cmd_callback,
|
||
|
TRUE,
|
||
|
PIKA_HELP_VIEW_SNAP_TO_GUIDES },
|
||
|
|
||
|
{ "view-snap-to-grid", NULL,
|
||
|
NC_("view-action", "Sna_p to Grid"), NULL, { NULL },
|
||
|
NC_("view-action", "Tool operations snap to the grid"),
|
||
|
view_snap_to_grid_cmd_callback,
|
||
|
FALSE,
|
||
|
PIKA_HELP_VIEW_SNAP_TO_GRID },
|
||
|
|
||
|
{ "view-snap-to-canvas", NULL,
|
||
|
NC_("view-action", "Snap to _Canvas Edges"), NULL, { NULL },
|
||
|
NC_("view-action", "Tool operations snap to the canvas edges"),
|
||
|
view_snap_to_canvas_cmd_callback,
|
||
|
FALSE,
|
||
|
PIKA_HELP_VIEW_SNAP_TO_CANVAS },
|
||
|
|
||
|
{ "view-snap-to-vectors", NULL,
|
||
|
NC_("view-action", "Snap t_o Active Path"), NULL, { NULL },
|
||
|
NC_("view-action", "Tool operations snap to the active path"),
|
||
|
view_snap_to_vectors_cmd_callback,
|
||
|
FALSE,
|
||
|
PIKA_HELP_VIEW_SNAP_TO_VECTORS },
|
||
|
|
||
|
{ "view-snap-to-bbox", NULL,
|
||
|
NC_("view-action", "Snap to _Bounding Boxes"), NULL, { NULL },
|
||
|
NC_("view-action", "Tool operations snap to the bounding boxes"),
|
||
|
view_snap_to_bbox_cmd_callback,
|
||
|
FALSE,
|
||
|
PIKA_HELP_VIEW_SNAP_TO_BBOX },
|
||
|
|
||
|
{ "view-snap-to-equidistance", NULL,
|
||
|
NC_("view-action", "Snap to _Equidistance"), NULL, { NULL },
|
||
|
NC_("view-action", "Tool operations snap to the equidistance between three bounding boxes"),
|
||
|
view_snap_to_equidistance_cmd_callback,
|
||
|
FALSE,
|
||
|
PIKA_HELP_VIEW_SNAP_TO_EQUIDISTANCE },
|
||
|
|
||
|
{ "view-show-menubar", NULL,
|
||
|
NC_("view-action", "Show _Menubar"), NULL, { NULL },
|
||
|
NC_("view-action", "Show this window's menubar"),
|
||
|
view_toggle_menubar_cmd_callback,
|
||
|
TRUE,
|
||
|
PIKA_HELP_VIEW_SHOW_MENUBAR },
|
||
|
|
||
|
{ "view-show-rulers", NULL,
|
||
|
NC_("view-action", "Show R_ulers"), NULL, { "<primary><shift>R", NULL },
|
||
|
NC_("view-action", "Show this window's rulers"),
|
||
|
view_toggle_rulers_cmd_callback,
|
||
|
TRUE,
|
||
|
PIKA_HELP_VIEW_SHOW_RULERS },
|
||
|
|
||
|
{ "view-show-scrollbars", NULL,
|
||
|
NC_("view-action", "Show Scroll_bars"), NULL, { NULL },
|
||
|
NC_("view-action", "Show this window's scrollbars"),
|
||
|
view_toggle_scrollbars_cmd_callback,
|
||
|
TRUE,
|
||
|
PIKA_HELP_VIEW_SHOW_SCROLLBARS },
|
||
|
|
||
|
{ "view-show-statusbar", NULL,
|
||
|
NC_("view-action", "Show S_tatusbar"), NULL, { NULL },
|
||
|
NC_("view-action", "Show this window's statusbar"),
|
||
|
view_toggle_statusbar_cmd_callback,
|
||
|
TRUE,
|
||
|
PIKA_HELP_VIEW_SHOW_STATUSBAR },
|
||
|
|
||
|
{ "view-fullscreen", PIKA_ICON_VIEW_FULLSCREEN,
|
||
|
NC_("view-action", "Fullscr_een"), NULL, { "F11", NULL },
|
||
|
NC_("view-action", "Toggle fullscreen view"),
|
||
|
view_fullscreen_cmd_callback,
|
||
|
FALSE,
|
||
|
PIKA_HELP_VIEW_FULLSCREEN }
|
||
|
};
|
||
|
|
||
|
static const PikaEnumActionEntry view_zoom_actions[] =
|
||
|
{
|
||
|
{ "view-zoom", NULL,
|
||
|
NC_("view-zoom-action", "Set zoom factor"), NULL, { NULL }, NULL,
|
||
|
PIKA_ACTION_SELECT_SET, TRUE,
|
||
|
NULL },
|
||
|
|
||
|
{ "view-zoom-minimum", PIKA_ICON_ZOOM_OUT,
|
||
|
NC_("view-zoom-action", "Zoom out as far as possible"), NULL, { NULL }, NULL,
|
||
|
PIKA_ACTION_SELECT_FIRST, FALSE,
|
||
|
PIKA_HELP_VIEW_ZOOM_OUT },
|
||
|
|
||
|
{ "view-zoom-maximum", PIKA_ICON_ZOOM_IN,
|
||
|
NC_("view-zoom-action", "Zoom in as far as possible"), NULL, { NULL }, NULL,
|
||
|
PIKA_ACTION_SELECT_LAST, FALSE,
|
||
|
PIKA_HELP_VIEW_ZOOM_IN },
|
||
|
|
||
|
{ "view-zoom-out", PIKA_ICON_ZOOM_OUT,
|
||
|
NC_("view-zoom-action", "Zoom _Out"), NULL, { "minus", "KP_Subtract", "ZoomOut", NULL },
|
||
|
NC_("view-zoom-action", "Zoom out"),
|
||
|
PIKA_ACTION_SELECT_PREVIOUS, FALSE,
|
||
|
PIKA_HELP_VIEW_ZOOM_OUT },
|
||
|
|
||
|
{ "view-zoom-in", PIKA_ICON_ZOOM_IN,
|
||
|
NC_("view-zoom-action", "Zoom _In"), NULL, { "plus", "KP_Add", "ZoomIn", NULL },
|
||
|
NC_("view-zoom-action", "Zoom in"),
|
||
|
PIKA_ACTION_SELECT_NEXT, FALSE,
|
||
|
PIKA_HELP_VIEW_ZOOM_IN },
|
||
|
|
||
|
{ "view-zoom-out-skip", PIKA_ICON_ZOOM_OUT,
|
||
|
NC_("view-zoom-action", "Zoom out a lot"), NULL, { NULL }, NULL,
|
||
|
PIKA_ACTION_SELECT_SKIP_PREVIOUS, FALSE,
|
||
|
PIKA_HELP_VIEW_ZOOM_OUT },
|
||
|
|
||
|
{ "view-zoom-in-skip", PIKA_ICON_ZOOM_IN,
|
||
|
NC_("view-zoom-action", "Zoom in a lot"), NULL, { NULL }, NULL,
|
||
|
PIKA_ACTION_SELECT_SKIP_NEXT, FALSE,
|
||
|
PIKA_HELP_VIEW_ZOOM_IN }
|
||
|
};
|
||
|
|
||
|
static const PikaRadioActionEntry view_zoom_explicit_actions[] =
|
||
|
{
|
||
|
{ "view-zoom-16-1", NULL,
|
||
|
NC_("view-zoom-action", "1_6:1 (1600%)"), NULL, { "5", "KP_5", NULL },
|
||
|
NC_("view-zoom-action", "Zoom 16:1"),
|
||
|
160000,
|
||
|
PIKA_HELP_VIEW_ZOOM_IN },
|
||
|
|
||
|
{ "view-zoom-8-1", NULL,
|
||
|
NC_("view-zoom-action", "_8:1 (800%)"), NULL, { "4", "KP_4", NULL },
|
||
|
NC_("view-zoom-action", "Zoom 8:1"),
|
||
|
80000,
|
||
|
PIKA_HELP_VIEW_ZOOM_IN },
|
||
|
|
||
|
{ "view-zoom-4-1", NULL,
|
||
|
NC_("view-zoom-action", "_4:1 (400%)"), NULL, { "3", "KP_3", NULL },
|
||
|
NC_("view-zoom-action", "Zoom 4:1"),
|
||
|
40000,
|
||
|
PIKA_HELP_VIEW_ZOOM_IN },
|
||
|
|
||
|
{ "view-zoom-2-1", NULL,
|
||
|
NC_("view-zoom-action", "_2:1 (200%)"), NULL, { "2", "KP_2", NULL },
|
||
|
NC_("view-zoom-action", "Zoom 2:1"),
|
||
|
20000,
|
||
|
PIKA_HELP_VIEW_ZOOM_IN },
|
||
|
|
||
|
{ "view-zoom-1-1", PIKA_ICON_ZOOM_ORIGINAL,
|
||
|
NC_("view-zoom-action", "_1:1 (100%)"), NULL, { "1", "KP_1", NULL },
|
||
|
NC_("view-zoom-action", "Zoom 1:1"),
|
||
|
10000,
|
||
|
PIKA_HELP_VIEW_ZOOM_100 },
|
||
|
|
||
|
{ "view-zoom-1-2", NULL,
|
||
|
NC_("view-zoom-action", "1:_2 (50%)"), NULL, { "<shift>2", "<shift>KP_2", NULL },
|
||
|
NC_("view-zoom-action", "Zoom 1:2"),
|
||
|
5000,
|
||
|
PIKA_HELP_VIEW_ZOOM_OUT },
|
||
|
|
||
|
{ "view-zoom-1-4", NULL,
|
||
|
NC_("view-zoom-action", "1:_4 (25%)"), NULL, { "<shift>3", "<shift>KP_3", NULL },
|
||
|
NC_("view-zoom-action", "Zoom 1:4"),
|
||
|
2500,
|
||
|
PIKA_HELP_VIEW_ZOOM_OUT },
|
||
|
|
||
|
{ "view-zoom-1-8", NULL,
|
||
|
NC_("view-zoom-action", "1:_8 (12.5%)"), NULL, { "<shift>4", "<shift>KP_4", NULL },
|
||
|
NC_("view-zoom-action", "Zoom 1:8"),
|
||
|
1250,
|
||
|
PIKA_HELP_VIEW_ZOOM_OUT },
|
||
|
|
||
|
{ "view-zoom-1-16", NULL,
|
||
|
NC_("view-zoom-action", "1:1_6 (6.25%)"), NULL, { "<shift>5", "<shift>KP_5", NULL },
|
||
|
NC_("view-zoom-action", "Zoom 1:16"),
|
||
|
625,
|
||
|
PIKA_HELP_VIEW_ZOOM_OUT },
|
||
|
|
||
|
{ "view-zoom-other", NULL,
|
||
|
NC_("view-zoom-action", "Othe_r zoom factor..."), NULL, { NULL },
|
||
|
NC_("view-zoom-action", "Set a custom zoom factor"),
|
||
|
0,
|
||
|
PIKA_HELP_VIEW_ZOOM_OTHER }
|
||
|
};
|
||
|
|
||
|
static const PikaToggleActionEntry view_flip_actions[] =
|
||
|
{
|
||
|
{ "view-flip-horizontally", PIKA_ICON_OBJECT_FLIP_HORIZONTAL,
|
||
|
NC_("view-action", "Flip _Horizontally"), NULL, { NULL },
|
||
|
NC_("view-action", "Flip the view horizontally"),
|
||
|
view_flip_horizontally_cmd_callback,
|
||
|
FALSE,
|
||
|
PIKA_HELP_VIEW_FLIP },
|
||
|
|
||
|
{ "view-flip-vertically", PIKA_ICON_OBJECT_FLIP_VERTICAL,
|
||
|
NC_("view-action", "Flip _Vertically"), NULL, { NULL },
|
||
|
NC_("view-action", "Flip the view vertically"),
|
||
|
view_flip_vertically_cmd_callback,
|
||
|
FALSE,
|
||
|
PIKA_HELP_VIEW_FLIP }
|
||
|
};
|
||
|
|
||
|
static const PikaEnumActionEntry view_rotate_absolute_actions[] =
|
||
|
{
|
||
|
{ "view-rotate-set-absolute", NULL,
|
||
|
NC_("view-action", "Display Rotation Absolute Angle Set"),
|
||
|
NULL, { NULL }, NULL,
|
||
|
PIKA_ACTION_SELECT_SET, TRUE,
|
||
|
NULL },
|
||
|
|
||
|
{ "view-rotate-reset", PIKA_ICON_RESET,
|
||
|
NC_("view-action", "_Reset Rotate"), NULL, { NULL },
|
||
|
NC_("view-action",
|
||
|
"Reset the angle of rotation to 0°"),
|
||
|
PIKA_ACTION_SELECT_SET_TO_DEFAULT, FALSE,
|
||
|
PIKA_HELP_VIEW_ROTATE_RESET },
|
||
|
};
|
||
|
|
||
|
static const PikaEnumActionEntry view_rotate_relative_actions[] =
|
||
|
{
|
||
|
{ "view-rotate-15", PIKA_ICON_OBJECT_ROTATE_90,
|
||
|
NC_("view-action", "Rotate 15° _clockwise"), NULL, { NULL },
|
||
|
NC_("view-action", "Rotate the view 15 degrees to the right"),
|
||
|
PIKA_ACTION_SELECT_NEXT, FALSE,
|
||
|
PIKA_HELP_VIEW_ROTATE_15 },
|
||
|
|
||
|
{ "view-rotate-90", PIKA_ICON_OBJECT_ROTATE_90,
|
||
|
NC_("view-action", "Rotate 90° _clockwise"), NULL, { NULL },
|
||
|
NC_("view-action", "Rotate the view 90 degrees to the right"),
|
||
|
PIKA_ACTION_SELECT_SKIP_NEXT, FALSE,
|
||
|
PIKA_HELP_VIEW_ROTATE_90 },
|
||
|
|
||
|
{ "view-rotate-180", PIKA_ICON_OBJECT_ROTATE_180,
|
||
|
NC_("view-action", "Rotate _180°"), NULL, { NULL },
|
||
|
NC_("view-action", "Turn the view upside-down"),
|
||
|
PIKA_ACTION_SELECT_LAST, FALSE,
|
||
|
PIKA_HELP_VIEW_ROTATE_180 },
|
||
|
|
||
|
{ "view-rotate-270", PIKA_ICON_OBJECT_ROTATE_270,
|
||
|
NC_("view-action", "Rotate 90° counter-clock_wise"), NULL, { NULL },
|
||
|
NC_("view-action", "Rotate the view 90 degrees to the left"),
|
||
|
PIKA_ACTION_SELECT_SKIP_PREVIOUS, FALSE,
|
||
|
PIKA_HELP_VIEW_ROTATE_270 },
|
||
|
|
||
|
{ "view-rotate-345", PIKA_ICON_OBJECT_ROTATE_270,
|
||
|
NC_("view-action", "Rotate 15° counter-clock_wise"), NULL, { NULL },
|
||
|
NC_("view-action", "Rotate the view 15 degrees to the left"),
|
||
|
PIKA_ACTION_SELECT_PREVIOUS, FALSE,
|
||
|
PIKA_HELP_VIEW_ROTATE_345 }
|
||
|
};
|
||
|
|
||
|
static const PikaRadioActionEntry view_display_intent_actions[] =
|
||
|
{
|
||
|
{ "view-display-intent-perceptual", NULL,
|
||
|
NC_("view-action", "_Perceptual"), NULL, { NULL },
|
||
|
NC_("view-action", "Display rendering intent is perceptual"),
|
||
|
PIKA_COLOR_RENDERING_INTENT_PERCEPTUAL,
|
||
|
PIKA_HELP_VIEW_COLOR_MANAGEMENT },
|
||
|
|
||
|
{ "view-display-intent-relative-colorimetric", NULL,
|
||
|
NC_("view-action", "_Relative Colorimetric"), NULL, { NULL },
|
||
|
NC_("view-action", "Display rendering intent is relative colorimetric"),
|
||
|
PIKA_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC,
|
||
|
PIKA_HELP_VIEW_COLOR_MANAGEMENT },
|
||
|
|
||
|
{ "view-display-intent-saturation", NULL,
|
||
|
NC_("view-action", "_Saturation"), NULL, { NULL },
|
||
|
NC_("view-action", "Display rendering intent is saturation"),
|
||
|
PIKA_COLOR_RENDERING_INTENT_SATURATION,
|
||
|
PIKA_HELP_VIEW_COLOR_MANAGEMENT },
|
||
|
|
||
|
{ "view-display-intent-absolute-colorimetric", NULL,
|
||
|
NC_("view-action", "_Absolute Colorimetric"), NULL, { NULL },
|
||
|
NC_("view-action", "Display rendering intent is absolute colorimetric"),
|
||
|
PIKA_COLOR_RENDERING_INTENT_ABSOLUTE_COLORIMETRIC,
|
||
|
PIKA_HELP_VIEW_COLOR_MANAGEMENT }
|
||
|
};
|
||
|
|
||
|
static const PikaEnumActionEntry view_padding_color_actions[] =
|
||
|
{
|
||
|
{ "view-padding-color-theme", NULL,
|
||
|
NC_("view-padding-color", "From _Theme"), NULL, { NULL },
|
||
|
NC_("view-padding-color", "Use the current theme's background color"),
|
||
|
PIKA_CANVAS_PADDING_MODE_DEFAULT, FALSE,
|
||
|
PIKA_HELP_VIEW_PADDING_COLOR },
|
||
|
|
||
|
{ "view-padding-color-light-check", NULL,
|
||
|
NC_("view-padding-color", "_Light Check Color"), NULL, { NULL },
|
||
|
NC_("view-padding-color", "Use the light check color"),
|
||
|
PIKA_CANVAS_PADDING_MODE_LIGHT_CHECK, FALSE,
|
||
|
PIKA_HELP_VIEW_PADDING_COLOR },
|
||
|
|
||
|
{ "view-padding-color-dark-check", NULL,
|
||
|
NC_("view-padding-color", "_Dark Check Color"), NULL, { NULL },
|
||
|
NC_("view-padding-color", "Use the dark check color"),
|
||
|
PIKA_CANVAS_PADDING_MODE_DARK_CHECK, FALSE,
|
||
|
PIKA_HELP_VIEW_PADDING_COLOR },
|
||
|
|
||
|
{ "view-padding-color-custom", PIKA_ICON_PALETTE,
|
||
|
NC_("view-padding-color", "_Custom Color..."), NULL, { NULL },
|
||
|
NC_("view-padding-color", "Use an arbitrary color"),
|
||
|
PIKA_CANVAS_PADDING_MODE_CUSTOM, FALSE,
|
||
|
PIKA_HELP_VIEW_PADDING_COLOR },
|
||
|
|
||
|
{ "view-padding-color-prefs", PIKA_ICON_RESET,
|
||
|
NC_("view-padding-color", "As in _Preferences"), NULL, { NULL },
|
||
|
NC_("view-padding-color",
|
||
|
"Reset padding color to what's configured in preferences"),
|
||
|
PIKA_CANVAS_PADDING_MODE_RESET, FALSE,
|
||
|
PIKA_HELP_VIEW_PADDING_COLOR }
|
||
|
};
|
||
|
|
||
|
static const PikaToggleActionEntry view_padding_color_toggle_actions[] =
|
||
|
{
|
||
|
{ "view-padding-color-in-show-all", NULL,
|
||
|
NC_("view-padding-color", "Keep Padding in \"Show _All\" Mode"), NULL, { NULL },
|
||
|
NC_("view-padding-color",
|
||
|
"Keep canvas padding when \"View -> Show All\" is enabled"),
|
||
|
view_padding_color_in_show_all_cmd_callback,
|
||
|
FALSE,
|
||
|
PIKA_HELP_VIEW_PADDING_COLOR }
|
||
|
};
|
||
|
|
||
|
static const PikaEnumActionEntry view_scroll_horizontal_actions[] =
|
||
|
{
|
||
|
{ "view-scroll-horizontal", NULL,
|
||
|
NC_("view-action", "Set horizontal scroll offset"), NULL, { NULL }, NULL,
|
||
|
PIKA_ACTION_SELECT_SET, TRUE,
|
||
|
NULL },
|
||
|
|
||
|
{ "view-scroll-left-border", NULL,
|
||
|
NC_("view-action", "Scroll to left border"), NULL, { NULL }, NULL,
|
||
|
PIKA_ACTION_SELECT_FIRST, FALSE,
|
||
|
NULL },
|
||
|
|
||
|
{ "view-scroll-right-border", NULL,
|
||
|
NC_("view-action", "Scroll to right border"), NULL, { NULL }, NULL,
|
||
|
PIKA_ACTION_SELECT_LAST, FALSE,
|
||
|
NULL },
|
||
|
|
||
|
{ "view-scroll-left", NULL,
|
||
|
NC_("view-action", "Scroll left"), NULL, { NULL }, NULL,
|
||
|
PIKA_ACTION_SELECT_PREVIOUS, FALSE,
|
||
|
NULL },
|
||
|
|
||
|
{ "view-scroll-right", NULL,
|
||
|
NC_("view-action", "Scroll right"), NULL, { NULL }, NULL,
|
||
|
PIKA_ACTION_SELECT_NEXT, FALSE,
|
||
|
NULL },
|
||
|
|
||
|
{ "view-scroll-page-left", NULL,
|
||
|
NC_("view-action", "Scroll page left"), NULL, { NULL }, NULL,
|
||
|
PIKA_ACTION_SELECT_SKIP_PREVIOUS, FALSE,
|
||
|
NULL },
|
||
|
|
||
|
{ "view-scroll-page-right", NULL,
|
||
|
NC_("view-action", "Scroll page right"), NULL, { NULL }, NULL,
|
||
|
PIKA_ACTION_SELECT_SKIP_NEXT, FALSE,
|
||
|
NULL }
|
||
|
};
|
||
|
|
||
|
static const PikaEnumActionEntry view_scroll_vertical_actions[] =
|
||
|
{
|
||
|
{ "view-scroll-vertical", NULL,
|
||
|
NC_("view-action", "Set vertical scroll offset"), NULL, { NULL }, NULL,
|
||
|
PIKA_ACTION_SELECT_SET, TRUE,
|
||
|
NULL },
|
||
|
|
||
|
{ "view-scroll-top-border", NULL,
|
||
|
NC_("view-action", "Scroll to top border"), NULL, { NULL }, NULL,
|
||
|
PIKA_ACTION_SELECT_FIRST, FALSE,
|
||
|
NULL },
|
||
|
|
||
|
{ "view-scroll-bottom-border", NULL,
|
||
|
NC_("view-action", "Scroll to bottom border"), NULL, { NULL }, NULL,
|
||
|
PIKA_ACTION_SELECT_LAST, FALSE,
|
||
|
NULL },
|
||
|
|
||
|
{ "view-scroll-up", NULL,
|
||
|
NC_("view-action", "Scroll up"), NULL, { NULL }, NULL,
|
||
|
PIKA_ACTION_SELECT_PREVIOUS, FALSE,
|
||
|
NULL },
|
||
|
|
||
|
{ "view-scroll-down", NULL,
|
||
|
NC_("view-action", "Scroll down"), NULL, { NULL }, NULL,
|
||
|
PIKA_ACTION_SELECT_NEXT, FALSE,
|
||
|
NULL },
|
||
|
|
||
|
{ "view-scroll-page-up", NULL,
|
||
|
NC_("view-action", "Scroll page up"), NULL, { NULL }, NULL,
|
||
|
PIKA_ACTION_SELECT_SKIP_PREVIOUS, FALSE,
|
||
|
NULL },
|
||
|
|
||
|
{ "view-scroll-page-down", NULL,
|
||
|
NC_("view-action", "Scroll page down"), NULL, { NULL }, NULL,
|
||
|
PIKA_ACTION_SELECT_SKIP_NEXT, FALSE,
|
||
|
NULL }
|
||
|
};
|
||
|
|
||
|
|
||
|
void
|
||
|
view_actions_setup (PikaActionGroup *group)
|
||
|
{
|
||
|
PikaAction *action;
|
||
|
|
||
|
pika_action_group_add_actions (group, "view-action",
|
||
|
view_actions,
|
||
|
G_N_ELEMENTS (view_actions));
|
||
|
|
||
|
pika_action_group_add_toggle_actions (group, "view-action",
|
||
|
view_toggle_actions,
|
||
|
G_N_ELEMENTS (view_toggle_actions));
|
||
|
|
||
|
pika_action_group_add_enum_actions (group, "view-zoom-action",
|
||
|
view_zoom_actions,
|
||
|
G_N_ELEMENTS (view_zoom_actions),
|
||
|
view_zoom_cmd_callback);
|
||
|
|
||
|
pika_action_group_add_radio_actions (group, "view-zoom-action",
|
||
|
view_zoom_explicit_actions,
|
||
|
G_N_ELEMENTS (view_zoom_explicit_actions),
|
||
|
NULL,
|
||
|
10000,
|
||
|
view_zoom_explicit_cmd_callback);
|
||
|
|
||
|
pika_action_group_add_toggle_actions (group, "view-action",
|
||
|
view_flip_actions,
|
||
|
G_N_ELEMENTS (view_flip_actions));
|
||
|
|
||
|
pika_action_group_add_enum_actions (group, "view-action",
|
||
|
view_rotate_absolute_actions,
|
||
|
G_N_ELEMENTS (view_rotate_absolute_actions),
|
||
|
view_rotate_absolute_cmd_callback);
|
||
|
|
||
|
pika_action_group_add_enum_actions (group, "view-action",
|
||
|
view_rotate_relative_actions,
|
||
|
G_N_ELEMENTS (view_rotate_relative_actions),
|
||
|
view_rotate_relative_cmd_callback);
|
||
|
|
||
|
pika_action_group_add_radio_actions (group, "view-action",
|
||
|
view_display_intent_actions,
|
||
|
G_N_ELEMENTS (view_display_intent_actions),
|
||
|
NULL,
|
||
|
PIKA_COLOR_MANAGEMENT_DISPLAY,
|
||
|
view_display_intent_cmd_callback);
|
||
|
|
||
|
pika_action_group_add_enum_actions (group, "view-padding-color",
|
||
|
view_padding_color_actions,
|
||
|
G_N_ELEMENTS (view_padding_color_actions),
|
||
|
view_padding_color_cmd_callback);
|
||
|
|
||
|
pika_action_group_add_toggle_actions (group, "view-padding-color",
|
||
|
view_padding_color_toggle_actions,
|
||
|
G_N_ELEMENTS (view_padding_color_toggle_actions));
|
||
|
|
||
|
pika_action_group_add_enum_actions (group, "view-action",
|
||
|
view_scroll_horizontal_actions,
|
||
|
G_N_ELEMENTS (view_scroll_horizontal_actions),
|
||
|
view_scroll_horizontal_cmd_callback);
|
||
|
|
||
|
pika_action_group_add_enum_actions (group, "view-action",
|
||
|
view_scroll_vertical_actions,
|
||
|
G_N_ELEMENTS (view_scroll_vertical_actions),
|
||
|
view_scroll_vertical_cmd_callback);
|
||
|
|
||
|
/* connect "activate" of view-zoom-other manually so it can be
|
||
|
* selected even if it's the active item of the radio group
|
||
|
*/
|
||
|
action = pika_action_group_get_action (group, "view-zoom-other");
|
||
|
|
||
|
g_signal_connect (action, "activate",
|
||
|
G_CALLBACK (view_zoom_other_cmd_callback),
|
||
|
group->user_data);
|
||
|
|
||
|
g_signal_connect_object (group->pika->config, "notify::check-type",
|
||
|
G_CALLBACK (view_actions_check_type_notify),
|
||
|
group, 0);
|
||
|
view_actions_check_type_notify (PIKA_DISPLAY_CONFIG (group->pika->config),
|
||
|
NULL, group);
|
||
|
|
||
|
if (PIKA_IS_IMAGE_WINDOW (group->user_data) ||
|
||
|
PIKA_IS_PIKA (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, PIKA_HELP_VIEW_CHANGE_SCREEN);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void
|
||
|
view_actions_update (PikaActionGroup *group,
|
||
|
gpointer data)
|
||
|
{
|
||
|
PikaDisplay *display = action_data_get_display (data);
|
||
|
PikaImage *image = NULL;
|
||
|
PikaDisplayShell *shell = NULL;
|
||
|
PikaDisplayOptions *options = NULL;
|
||
|
PikaColorConfig *color_config = NULL;
|
||
|
gchar *label = NULL;
|
||
|
gboolean fullscreen = FALSE;
|
||
|
gboolean revert_enabled = FALSE; /* able to revert zoom? */
|
||
|
gboolean flip_horizontally = FALSE;
|
||
|
gboolean flip_vertically = FALSE;
|
||
|
gboolean cm = FALSE;
|
||
|
gboolean sp = FALSE;
|
||
|
gboolean d_bpc = FALSE;
|
||
|
gboolean gamut = FALSE;
|
||
|
|
||
|
if (display)
|
||
|
{
|
||
|
PikaImageWindow *window;
|
||
|
const gchar *action = NULL;
|
||
|
|
||
|
image = pika_display_get_image (display);
|
||
|
shell = pika_display_get_shell (display);
|
||
|
window = pika_display_shell_get_window (shell);
|
||
|
|
||
|
if (window)
|
||
|
fullscreen = pika_image_window_get_fullscreen (window);
|
||
|
|
||
|
options = (image ?
|
||
|
(fullscreen ? shell->fullscreen_options : shell->options) :
|
||
|
shell->no_image_options);
|
||
|
|
||
|
revert_enabled = pika_display_shell_scale_can_revert (shell);
|
||
|
|
||
|
flip_horizontally = shell->flip_horizontally;
|
||
|
flip_vertically = shell->flip_vertically;
|
||
|
|
||
|
color_config = pika_display_shell_get_color_config (shell);
|
||
|
|
||
|
switch (pika_color_config_get_mode (color_config))
|
||
|
{
|
||
|
case PIKA_COLOR_MANAGEMENT_OFF:
|
||
|
break;
|
||
|
|
||
|
case PIKA_COLOR_MANAGEMENT_DISPLAY:
|
||
|
cm = (image != NULL);
|
||
|
break;
|
||
|
|
||
|
case PIKA_COLOR_MANAGEMENT_SOFTPROOF:
|
||
|
cm = (image != NULL);
|
||
|
sp = (image != NULL);
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
switch (pika_color_config_get_display_intent (color_config))
|
||
|
{
|
||
|
case PIKA_COLOR_RENDERING_INTENT_PERCEPTUAL:
|
||
|
action = "view-display-intent-perceptual";
|
||
|
break;
|
||
|
|
||
|
case PIKA_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC:
|
||
|
action = "view-display-intent-relative-colorimetric";
|
||
|
break;
|
||
|
|
||
|
case PIKA_COLOR_RENDERING_INTENT_SATURATION:
|
||
|
action = "view-display-intent-saturation";
|
||
|
break;
|
||
|
|
||
|
case PIKA_COLOR_RENDERING_INTENT_ABSOLUTE_COLORIMETRIC:
|
||
|
action = "view-display-intent-absolute-colorimetric";
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
pika_action_group_set_action_active (group, action, TRUE);
|
||
|
|
||
|
d_bpc = pika_color_config_get_display_bpc (color_config);
|
||
|
gamut = pika_color_config_get_simulation_gamut_check (color_config);
|
||
|
}
|
||
|
|
||
|
#define SET_ACTIVE(action,condition) \
|
||
|
pika_action_group_set_action_active (group, action, (condition) != 0)
|
||
|
#define SET_SENSITIVE(action,condition) \
|
||
|
pika_action_group_set_action_sensitive (group, action, (condition) != 0, NULL)
|
||
|
|
||
|
SET_SENSITIVE ("view-new", image);
|
||
|
SET_SENSITIVE ("view-close", image);
|
||
|
|
||
|
SET_SENSITIVE ("view-show-all", image);
|
||
|
SET_ACTIVE ("view-show-all", display && shell->show_all);
|
||
|
|
||
|
SET_SENSITIVE ("view-dot-for-dot", image);
|
||
|
SET_ACTIVE ("view-dot-for-dot", display && shell->dot_for_dot);
|
||
|
|
||
|
SET_SENSITIVE ("view-scroll-center", image);
|
||
|
|
||
|
SET_SENSITIVE ("view-zoom-revert", revert_enabled);
|
||
|
if (revert_enabled)
|
||
|
{
|
||
|
label = g_strdup_printf (_("Re_vert Zoom (%d%%)"),
|
||
|
ROUND (shell->last_scale * 100));
|
||
|
pika_action_group_set_action_label (group, "view-zoom-revert", label);
|
||
|
g_free (label);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
pika_action_group_set_action_label (group, "view-zoom-revert",
|
||
|
_("Re_vert Zoom"));
|
||
|
}
|
||
|
|
||
|
SET_SENSITIVE ("view-zoom", image);
|
||
|
SET_SENSITIVE ("view-zoom-minimum", image);
|
||
|
SET_SENSITIVE ("view-zoom-maximum", image);
|
||
|
SET_SENSITIVE ("view-zoom-in", image);
|
||
|
SET_SENSITIVE ("view-zoom-in-skip", image);
|
||
|
SET_SENSITIVE ("view-zoom-out", image);
|
||
|
SET_SENSITIVE ("view-zoom-out-skip", image);
|
||
|
|
||
|
SET_SENSITIVE ("view-zoom-fit-in", image);
|
||
|
SET_SENSITIVE ("view-zoom-fill", image);
|
||
|
SET_SENSITIVE ("view-zoom-selection", image);
|
||
|
SET_SENSITIVE ("view-zoom-revert", image);
|
||
|
|
||
|
SET_SENSITIVE ("view-zoom-16-1", image);
|
||
|
SET_SENSITIVE ("view-zoom-8-1", image);
|
||
|
SET_SENSITIVE ("view-zoom-4-1", image);
|
||
|
SET_SENSITIVE ("view-zoom-2-1", image);
|
||
|
SET_SENSITIVE ("view-zoom-1-1", image);
|
||
|
SET_SENSITIVE ("view-zoom-1-2", image);
|
||
|
SET_SENSITIVE ("view-zoom-1-4", image);
|
||
|
SET_SENSITIVE ("view-zoom-1-8", image);
|
||
|
SET_SENSITIVE ("view-zoom-1-16", image);
|
||
|
SET_SENSITIVE ("view-zoom-other", image);
|
||
|
|
||
|
SET_SENSITIVE ("view-flip-horizontally", image);
|
||
|
SET_ACTIVE ("view-flip-horizontally", flip_horizontally);
|
||
|
|
||
|
SET_SENSITIVE ("view-flip-reset", image);
|
||
|
SET_SENSITIVE ("view-flip-vertically", image);
|
||
|
SET_ACTIVE ("view-flip-vertically", flip_vertically);
|
||
|
|
||
|
SET_SENSITIVE ("view-rotate-reset", image);
|
||
|
SET_SENSITIVE ("view-rotate-15", image);
|
||
|
SET_SENSITIVE ("view-rotate-345", image);
|
||
|
SET_SENSITIVE ("view-rotate-90", image);
|
||
|
SET_SENSITIVE ("view-rotate-180", image);
|
||
|
SET_SENSITIVE ("view-rotate-270", image);
|
||
|
SET_SENSITIVE ("view-rotate-other", image);
|
||
|
|
||
|
SET_SENSITIVE ("view-reset", image);
|
||
|
|
||
|
if (image)
|
||
|
{
|
||
|
view_actions_set_zoom (group, shell);
|
||
|
view_actions_set_rotate (group, shell);
|
||
|
}
|
||
|
|
||
|
SET_SENSITIVE ("view-navigation-window", image);
|
||
|
SET_SENSITIVE ("view-display-filters", image);
|
||
|
|
||
|
SET_SENSITIVE ("view-color-management-enable", image);
|
||
|
SET_ACTIVE ("view-color-management-enable", cm);
|
||
|
SET_SENSITIVE ("view-color-management-softproof", image);
|
||
|
SET_ACTIVE ("view-color-management-softproof", sp);
|
||
|
SET_SENSITIVE ("view-display-intent-perceptual", cm);
|
||
|
SET_SENSITIVE ("view-display-intent-relative-colorimetric", cm);
|
||
|
SET_SENSITIVE ("view-display-intent-saturation", cm);
|
||
|
SET_SENSITIVE ("view-display-intent-absolute-colorimetric", cm);
|
||
|
SET_SENSITIVE ("view-display-black-point-compensation", cm);
|
||
|
SET_ACTIVE ("view-display-black-point-compensation", d_bpc);
|
||
|
SET_ACTIVE ("view-softproof-gamut-check", gamut);
|
||
|
SET_SENSITIVE ("view-color-management-reset", image);
|
||
|
|
||
|
SET_SENSITIVE ("view-show-selection", image);
|
||
|
SET_ACTIVE ("view-show-selection", display && options->show_selection);
|
||
|
SET_SENSITIVE ("view-show-layer-boundary", image);
|
||
|
SET_ACTIVE ("view-show-layer-boundary", display && options->show_layer_boundary);
|
||
|
SET_SENSITIVE ("view-show-canvas-boundary", image && shell->show_all);
|
||
|
SET_ACTIVE ("view-show-canvas-boundary", display && options->show_canvas_boundary);
|
||
|
SET_SENSITIVE ("view-show-guides", image);
|
||
|
SET_ACTIVE ("view-show-guides", display && options->show_guides);
|
||
|
SET_SENSITIVE ("view-show-grid", image);
|
||
|
SET_ACTIVE ("view-show-grid", display && options->show_grid);
|
||
|
SET_SENSITIVE ("view-show-sample-points", image);
|
||
|
SET_ACTIVE ("view-show-sample-points", display && options->show_sample_points);
|
||
|
|
||
|
SET_SENSITIVE ("view-snap-to-guides", image);
|
||
|
SET_ACTIVE ("view-snap-to-guides", display && options->snap_to_guides);
|
||
|
SET_SENSITIVE ("view-snap-to-grid", image);
|
||
|
SET_ACTIVE ("view-snap-to-grid", display && options->snap_to_grid);
|
||
|
SET_SENSITIVE ("view-snap-to-canvas", image);
|
||
|
SET_ACTIVE ("view-snap-to-canvas", display && options->snap_to_canvas);
|
||
|
SET_SENSITIVE ("view-snap-to-vectors", image);
|
||
|
SET_ACTIVE ("view-snap-to-vectors", display && options->snap_to_path);
|
||
|
SET_SENSITIVE ("view-snap-to-bbox", image);
|
||
|
SET_ACTIVE ("view-snap-to-bbox", display && options->snap_to_bbox);
|
||
|
SET_SENSITIVE ("view-snap-to-equidistance", image);
|
||
|
SET_ACTIVE ("view-snap-to-equidistance", display && options->snap_to_equidistance);
|
||
|
|
||
|
SET_SENSITIVE ("view-padding-color-theme", image);
|
||
|
SET_SENSITIVE ("view-padding-color-light-check", image);
|
||
|
SET_SENSITIVE ("view-padding-color-dark-check", image);
|
||
|
SET_SENSITIVE ("view-padding-color-custom", image);
|
||
|
SET_SENSITIVE ("view-padding-color-prefs", image);
|
||
|
|
||
|
SET_SENSITIVE ("view-padding-color-in-show-all", image);
|
||
|
SET_ACTIVE ("view-padding-color-in-show-all", display && options->padding_in_show_all);
|
||
|
|
||
|
SET_SENSITIVE ("view-show-menubar", image);
|
||
|
SET_ACTIVE ("view-show-menubar", display && options->show_menubar);
|
||
|
SET_SENSITIVE ("view-show-rulers", image);
|
||
|
SET_ACTIVE ("view-show-rulers", display && options->show_rulers);
|
||
|
SET_SENSITIVE ("view-show-scrollbars", image);
|
||
|
SET_ACTIVE ("view-show-scrollbars", display && options->show_scrollbars);
|
||
|
SET_SENSITIVE ("view-show-statusbar", image);
|
||
|
SET_ACTIVE ("view-show-statusbar", display && options->show_statusbar);
|
||
|
|
||
|
SET_SENSITIVE ("view-shrink-wrap", image);
|
||
|
SET_ACTIVE ("view-fullscreen", display && fullscreen);
|
||
|
|
||
|
if (PIKA_IS_IMAGE_WINDOW (group->user_data) ||
|
||
|
PIKA_IS_PIKA (group->user_data))
|
||
|
{
|
||
|
GtkWidget *window = NULL;
|
||
|
|
||
|
if (shell)
|
||
|
window = gtk_widget_get_toplevel (GTK_WIDGET (shell));
|
||
|
|
||
|
/* see view_actions_setup() */
|
||
|
if (GTK_IS_WINDOW (window))
|
||
|
window_actions_update (group, window);
|
||
|
}
|
||
|
|
||
|
#undef SET_ACTIVE
|
||
|
#undef SET_SENSITIVE
|
||
|
}
|
||
|
|
||
|
|
||
|
/* private functions */
|
||
|
|
||
|
static void
|
||
|
view_actions_set_zoom (PikaActionGroup *group,
|
||
|
PikaDisplayShell *shell)
|
||
|
{
|
||
|
const gchar *action = NULL;
|
||
|
PikaImageWindow *window;
|
||
|
PikaMenuModel *model;
|
||
|
gchar *str;
|
||
|
gchar *label;
|
||
|
guint scale;
|
||
|
|
||
|
g_object_get (shell->zoom,
|
||
|
"percentage", &str,
|
||
|
NULL);
|
||
|
|
||
|
scale = ROUND (pika_zoom_model_get_factor (shell->zoom) * 1000);
|
||
|
|
||
|
switch (scale)
|
||
|
{
|
||
|
case 16000: action = "view-zoom-16-1"; break;
|
||
|
case 8000: action = "view-zoom-8-1"; break;
|
||
|
case 4000: action = "view-zoom-4-1"; break;
|
||
|
case 2000: action = "view-zoom-2-1"; break;
|
||
|
case 1000: action = "view-zoom-1-1"; break;
|
||
|
case 500: action = "view-zoom-1-2"; break;
|
||
|
case 250: action = "view-zoom-1-4"; break;
|
||
|
case 125: action = "view-zoom-1-8"; break;
|
||
|
case 63:
|
||
|
case 62: action = "view-zoom-1-16"; break;
|
||
|
}
|
||
|
|
||
|
if (! action)
|
||
|
{
|
||
|
action = "view-zoom-other";
|
||
|
|
||
|
label = g_strdup_printf (_("Othe_r (%s)..."), str);
|
||
|
pika_action_group_set_action_label (group, action, label);
|
||
|
g_free (label);
|
||
|
|
||
|
shell->other_scale = pika_zoom_model_get_factor (shell->zoom);
|
||
|
}
|
||
|
|
||
|
pika_action_group_set_action_active (group, action, TRUE);
|
||
|
|
||
|
window = pika_display_shell_get_window (shell);
|
||
|
model = pika_image_window_get_menubar_model (window);
|
||
|
label = g_strdup_printf (_("_Zoom (%s)"), str);
|
||
|
pika_menu_model_set_title (model, "/View/Zoom", label);
|
||
|
g_free (label);
|
||
|
|
||
|
/* flag as dirty */
|
||
|
shell->other_scale = - fabs (shell->other_scale);
|
||
|
|
||
|
g_free (str);
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
view_actions_set_rotate (PikaActionGroup *group,
|
||
|
PikaDisplayShell *shell)
|
||
|
{
|
||
|
const gchar *flip;
|
||
|
PikaImageWindow *window;
|
||
|
PikaMenuModel *model;
|
||
|
gchar *label;
|
||
|
|
||
|
if (shell->flip_horizontally &&
|
||
|
shell->flip_vertically)
|
||
|
{
|
||
|
/* please preserve the trailing space */
|
||
|
/* H: Horizontal, V: Vertical */
|
||
|
flip = _("(H+V) ");
|
||
|
}
|
||
|
else if (shell->flip_horizontally)
|
||
|
{
|
||
|
/* please preserve the trailing space */
|
||
|
/* H: Horizontal */
|
||
|
flip = _("(H) ");
|
||
|
}
|
||
|
else if (shell->flip_vertically)
|
||
|
{
|
||
|
/* please preserve the trailing space */
|
||
|
/* V: Vertical */
|
||
|
flip = _("(V) ");
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
flip = "";
|
||
|
}
|
||
|
|
||
|
window = pika_display_shell_get_window (shell);
|
||
|
model = pika_image_window_get_menubar_model (window);
|
||
|
label = g_strdup_printf (_("_Flip %s& Rotate (%d°)"),
|
||
|
flip, (gint) shell->rotate_angle);
|
||
|
pika_menu_model_set_title (model, "/View/Flip & Rotate", label);
|
||
|
g_free (label);
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
view_actions_check_type_notify (PikaDisplayConfig *config,
|
||
|
GParamSpec *pspec,
|
||
|
PikaActionGroup *group)
|
||
|
{
|
||
|
pika_action_group_set_action_color (group, "view-padding-color-light-check",
|
||
|
pika_render_check_color1 (),
|
||
|
FALSE);
|
||
|
pika_action_group_set_action_color (group, "view-padding-color-dark-check",
|
||
|
pika_render_check_color2 (),
|
||
|
FALSE);
|
||
|
}
|