From cca66b9ec4e494c1d919bff0f71a820d8afab1fa Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:24:48 +0200 Subject: Adding upstream version 1.2.2. Signed-off-by: Daniel Baumann --- src/actions/actions-view-window.cpp | 80 +++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 src/actions/actions-view-window.cpp (limited to 'src/actions/actions-view-window.cpp') diff --git a/src/actions/actions-view-window.cpp b/src/actions/actions-view-window.cpp new file mode 100644 index 0000000..c7492ca --- /dev/null +++ b/src/actions/actions-view-window.cpp @@ -0,0 +1,80 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/** \file + * + * Gio::Actions for window handling that are not useful from the command line (thus tied to window map). + * Found under the "View" menu. + * + * Authors: + * Sushant A A + * + * Copyright (C) 2021 Authors + * + * Released under GNU GPL v2+, read the file 'COPYING' for more information. + */ + +#include "actions-view-window.h" + +#include +#include + +#include "inkscape-application.h" +#include "inkscape-window.h" +#include "inkscape.h" // previous/next window +#include "actions/actions-extra-data.h" +#include "ui/interface.h" // sp_ui_new_view() + +void +window_previous(InkscapeWindow* win) +{ + INKSCAPE.switch_desktops_prev(); +} + +void +window_next(InkscapeWindow* win) +{ + INKSCAPE.switch_desktops_next(); +} + +void +window_new(InkscapeWindow* win) +{ + sp_ui_new_view(); +} + +std::vector> raw_data_view_window = +{ + // clang-format off + {"win.window-new", N_("Duplicate Window"), "View", N_("Open a new window with the same document")}, + {"win.window-previous", N_("Previous Window"), "View", N_("Switch to the previous document window")}, + {"win.window-next", N_("Next Window"), "View", N_("Switch to the next document window")}, + // clang-format on +}; + +void +add_actions_view_window(InkscapeWindow* win) +{ + // clang-format off + win->add_action( "window-new", sigc::bind(sigc::ptr_fun(&window_new), win)); + win->add_action( "window-previous", sigc::bind(sigc::ptr_fun(&window_previous), win)); + win->add_action( "window-next", sigc::bind(sigc::ptr_fun(&window_next), win)); + // clang-format on + + // Check if there is already an application instance (GUI or non-GUI). + auto app = InkscapeApplication::instance(); + if (!app) { + std::cerr << "add_actions_view_window: no app!" << std::endl; + return; + } + app->get_action_extra_data().add_data(raw_data_view_window); +} + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : -- cgit v1.2.3