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-edit-window.cpp | 74 +++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 src/actions/actions-edit-window.cpp (limited to 'src/actions/actions-edit-window.cpp') diff --git a/src/actions/actions-edit-window.cpp b/src/actions/actions-edit-window.cpp new file mode 100644 index 0000000..7c26736 --- /dev/null +++ b/src/actions/actions-edit-window.cpp @@ -0,0 +1,74 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/** \file + * + * Actions for Editing an object which require desktop + * + * Authors: + * Sushant A A + * + * Copyright (C) 2021 Authors + * + * Released under GNU GPL v2+, read the file 'COPYING' for more information. + */ + +#include +#include + +#include "actions-edit-window.h" +#include "inkscape-application.h" +#include "inkscape-window.h" +#include "desktop.h" +#include "selection-chemistry.h" + +void +paste(InkscapeWindow* win) +{ + SPDesktop* dt = win->get_desktop(); + + // Paste + sp_selection_paste(dt, false); +} + +void +paste_in_place(InkscapeWindow* win) +{ + SPDesktop* dt = win->get_desktop(); + + // Paste In Place + sp_selection_paste(dt, true); +} + +void +path_effect_parameter_next(InkscapeWindow* win) +{ + SPDesktop* dt = win->get_desktop(); + + // Next path effect parameter + sp_selection_next_patheffect_param(dt); +} + +std::vector> raw_data_edit_window = +{ + // clang-format off + {"win.paste", N_("Paste"), "Edit", N_("Paste objects from clipboard to mouse point, or paste text")}, + {"win.paste-in-place", N_("Paste In Place"), "Edit", N_("Paste objects from clipboard to the original position of the copied objects")}, + {"win.path-effect-parameter-next", N_("Next path effect parameter"), "Edit", N_("Show next editable path effect parameter")} + // clang-format on +}; + +void +add_actions_edit_window(InkscapeWindow* win) +{ + // clang-format off + win->add_action( "paste", sigc::bind(sigc::ptr_fun(&paste), win)); + win->add_action( "paste-in-place", sigc::bind(sigc::ptr_fun(&paste_in_place), win)); + win->add_action( "path-effect-parameter-next", sigc::bind(sigc::ptr_fun(&path_effect_parameter_next), win)); + // clang-format on + + auto app = InkscapeApplication::instance(); + if (!app) { + std::cerr << "add_actions_edit_window: no app!" << std::endl; + return; + } + app->get_action_extra_data().add_data(raw_data_edit_window); +} -- cgit v1.2.3