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-helper.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-helper.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/actions/actions-helper.cpp b/src/actions/actions-helper.cpp new file mode 100644 index 0000000..7dab91a --- /dev/null +++ b/src/actions/actions-helper.cpp @@ -0,0 +1,45 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Gio::Actions for selection tied to the application and without GUI. + * + * Copyright (C) 2018 Tavmjong Bah + * + * The contents of this file may be used under the GNU General Public License Version 2 or later. + * + * TODO: REMOVE THIS FILE It's really not necessary. + */ + +#include "inkscape-application.h" +#include "inkscape.h" +#include "selection.h" + +// Helper function: returns true if both document and selection found. Maybe this should +// work on current view. Or better, application could return the selection of the current view. +bool +get_document_and_selection(InkscapeApplication* app, SPDocument** document, Inkscape::Selection** selection) +{ + *document = app->get_active_document(); + if (!(*document)) { + std::cerr << "get_document_and_selection: No document!" << std::endl; + return false; + } + + *selection = app->get_active_selection(); + if (!*selection) { + std::cerr << "get_document_and_selection: No selection!" << std::endl; + return false; + } + + return true; +} + +/* + 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 : |