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-effect.cpp | 83 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 src/actions/actions-effect.cpp (limited to 'src/actions/actions-effect.cpp') diff --git a/src/actions/actions-effect.cpp b/src/actions/actions-effect.cpp new file mode 100644 index 0000000..2956967 --- /dev/null +++ b/src/actions/actions-effect.cpp @@ -0,0 +1,83 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/** \file + * + * Actions for Filters and Extension menu items + * + * Authors: + * Sushant A A + * + * Copyright (C) 2021 Authors + * + * Released under GNU GPL v2+, read the file 'COPYING' for more information. + */ + +#include +#include + +#include "actions-effect.h" +#include "actions-helper.h" +#include "inkscape-application.h" + +#include "extension/effect.h" + +void +edit_remove_filter(InkscapeApplication *app) +{ + auto selection = app->get_active_selection(); + + // Remove Filter + selection->removeFilter(); +} + +void +last_effect(InkscapeApplication *app) +{ + Inkscape::Extension::Effect *effect = Inkscape::Extension::Effect::get_last_effect(); + + if (effect == nullptr) { + return; + } + + // Last Effect + effect->effect(InkscapeApplication::instance()->get_active_view()); +} + +void +last_effect_pref(InkscapeApplication *app) +{ + Inkscape::Extension::Effect *effect = Inkscape::Extension::Effect::get_last_effect(); + + if (effect == nullptr) { + return; + } + + // Last Effect Pref + effect->prefs(InkscapeApplication::instance()->get_active_view()); +} + +std::vector> raw_data_effect = +{ + // clang-format off + {"app.edit-remove-filter", N_("Remove Filters"), "Filter", N_("Remove any filters from selected objects")}, + {"app.last-effect", N_("Previous Extension"), "Extension", N_("Repeat the last extension with the same settings")}, + {"app.last-effect-pref", N_("Previous Extension Settings"), "Extension", N_("Repeat the last extension with new settings")} + // clang-format on +}; + +void +add_actions_effect(InkscapeApplication* app) +{ + auto *gapp = app->gio_app(); + + // clang-format off + gapp->add_action( "edit-remove-filter", sigc::bind(sigc::ptr_fun(&edit_remove_filter), app)); + gapp->add_action( "last-effect", sigc::bind(sigc::ptr_fun(&last_effect), app)); + gapp->add_action( "last-effect-pref", sigc::bind(sigc::ptr_fun(&last_effect_pref), app)); + // clang-format on + + if (!app) { + std::cerr << "add_actions_edit: no app!" << std::endl; + return; + } + app->get_action_extra_data().add_data(raw_data_effect); +} -- cgit v1.2.3