diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:24:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:24:48 +0000 |
commit | cca66b9ec4e494c1d919bff0f71a820d8afab1fa (patch) | |
tree | 146f39ded1c938019e1ed42d30923c2ac9e86789 /src/actions/actions-edit-window.cpp | |
parent | Initial commit. (diff) | |
download | inkscape-cca66b9ec4e494c1d919bff0f71a820d8afab1fa.tar.xz inkscape-cca66b9ec4e494c1d919bff0f71a820d8afab1fa.zip |
Adding upstream version 1.2.2.upstream/1.2.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/actions/actions-edit-window.cpp | 74 |
1 files changed, 74 insertions, 0 deletions
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 <sushant.co19@gmail.com> + * + * Copyright (C) 2021 Authors + * + * Released under GNU GPL v2+, read the file 'COPYING' for more information. + */ + +#include <giomm.h> +#include <glibmm/i18n.h> + +#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<std::vector<Glib::ustring>> 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<InkscapeWindow*>(sigc::ptr_fun(&paste), win)); + win->add_action( "paste-in-place", sigc::bind<InkscapeWindow*>(sigc::ptr_fun(&paste_in_place), win)); + win->add_action( "path-effect-parameter-next", sigc::bind<InkscapeWindow*>(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); +} |