Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
implementation.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 Author: Ted Gould <ted@gould.cx>
4 Copyright (c) 2003-2005,2007
5
6 Released under GNU GPL v2+, read the file 'COPYING' for more information.
7
8 This file is the backend to the extensions system. These are
9 the parts of the system that most users will never see, but are
10 important for implementing the extensions themselves. This file
11 contains the base class for all of that.
12*/
13
14#include "implementation.h"
15
16#include <extension/output.h>
17#include <extension/input.h>
18#include <extension/effect.h>
19
20#include "selection.h"
21#include "desktop.h"
22#include "document.h"
23
24namespace Inkscape {
25namespace Extension {
26namespace Implementation {
27
28std::unique_ptr<SPDocument> Implementation::new_from_template(Template *)
29{
30 return {};
31}
32
33std::unique_ptr<SPDocument> Implementation::open(Input *module, char const *filename, bool is_importing)
34{
35 return {};
36}
37
38Gtk::Widget *Implementation::prefs_effect(Inkscape::Extension::Effect *module, SPDesktop *desktop, sigc::signal<void ()> * changeSignal, ImplementationDocumentCache * /*docCache*/)
39{
40 if (module->widget_visible_count() == 0) {
41 return nullptr;
42 }
43
44 SPDocument * current_document = desktop->doc();
45
46 auto selected = desktop->getSelection()->items();
47 Inkscape::XML::Node const* first_select = nullptr;
48 if (!selected.empty()) {
49 const SPItem * item = selected.front();
50 first_select = item->getRepr();
51 }
52
53 // TODO deal with this broken const correctness:
54 return module->autogui(current_document, const_cast<Inkscape::XML::Node *>(first_select), changeSignal);
55
56} // Implementation::prefs_effect
57
59 ImplementationDocumentCache * /*docCache*/)
60{
61 effect(mod, executionEnv, desktop->getDocument());
62}
63
64} /* namespace Implementation */
65} /* namespace Extension */
66} /* namespace Inkscape */
67
68/*
69 Local Variables:
70 mode:c++
71 c-file-style:"stroustrup"
72 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
73 indent-tabs-mode:nil
74 fill-column:99
75 End:
76*/
77// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
Effects are extensions that take a document and do something to it in place.
Definition effect.h:39
unsigned int widget_visible_count() const
A function to get the number of visible parameters of the extension.
A cache for the document and this implementation.
virtual std::unique_ptr< SPDocument > new_from_template(Inkscape::Extension::Template *)
virtual Gtk::Widget * prefs_effect(Inkscape::Extension::Effect *module, SPDesktop *desktop, sigc::signal< void()> *changeSignal, ImplementationDocumentCache *docCache)
Find out information about the file.
virtual std::unique_ptr< SPDocument > open(Inkscape::Extension::Input *module, char const *filename, bool is_importing)
Open a file.
virtual void effect(Inkscape::Extension::Effect *, ExecutionEnv *, SPDesktop *, ImplementationDocumentCache *)
SPItemRange items()
Returns a range of selected SPItems.
Definition object-set.h:255
Interface for refcounted XML nodes.
Definition node.h:80
To do: update description of desktop.
Definition desktop.h:149
SPDocument * getDocument() const
Definition desktop.h:189
Inkscape::Selection * getSelection() const
Definition desktop.h:188
SPDocument * doc() const
Definition desktop.h:159
Typed SVG document implementation.
Definition document.h:103
Base class for visual SVG elements.
Definition sp-item.h:109
Inkscape::XML::Node * getRepr()
Returns the XML representation of tree.
Editable view implementation.
SPItem * item
Helper class to stream background task notifications as a series of messages.
SPDesktop * desktop