Inkscape
Vector Graphics Editor
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
23
24namespace Inkscape {
25namespace Extension {
26namespace Implementation {
27
28Gtk::Widget *Implementation::prefs_effect(Inkscape::Extension::Effect *module, SPDesktop *desktop, sigc::signal<void ()> * changeSignal, ImplementationDocumentCache * /*docCache*/)
29{
30 if (module->widget_visible_count() == 0) {
31 return nullptr;
32 }
33
34 SPDocument * current_document = desktop->doc();
35
36 auto selected = desktop->getSelection()->items();
37 Inkscape::XML::Node const* first_select = nullptr;
38 if (!selected.empty()) {
39 const SPItem * item = selected.front();
40 first_select = item->getRepr();
41 }
42
43 // TODO deal with this broken const correctness:
44 return module->autogui(current_document, const_cast<Inkscape::XML::Node *>(first_select), changeSignal);
45
46} // Implementation::prefs_effect
47
48void Implementation::effect(Inkscape::Extension::Effect *mod,
49 SPDesktop *desktop,
50 ImplementationDocumentCache * /*docCache*/)
51{
52 effect(mod, desktop->getDocument());
53}
54
55} /* namespace Implementation */
56} /* namespace Extension */
57} /* namespace Inkscape */
58
59/*
60 Local Variables:
61 mode:c++
62 c-file-style:"stroustrup"
63 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
64 indent-tabs-mode:nil
65 fill-column:99
66 End:
67*/
68// 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.
Definition: extension.cpp:1044
Gtk::Widget * autogui(SPDocument *doc, Inkscape::XML::Node *node, sigc::signal< void()> *changeSignal=nullptr)
A function to automatically generate a GUI from the extensions' widgets.
Definition: extension.cpp:975
A cache for the document and this implementation.
virtual void effect(Inkscape::Extension::Effect *, SPDesktop *, ImplementationDocumentCache *)
SPItemRange items()
Returns a range of selected SPItems.
Definition: object-set.h:267
Interface for refcounted XML nodes.
Definition: node.h:80
To do: update description of desktop.
Definition: desktop.h:150
SPDocument * getDocument() const
Definition: desktop.h:187
Inkscape::Selection * getSelection() const
Definition: desktop.h:186
SPDocument * doc() const
Definition: desktop.h:163
Typed SVG document implementation.
Definition: document.h:106
Base class for visual SVG elements.
Definition: sp-item.h:107
Inkscape::XML::Node * getRepr()
Returns the XML representation of tree.
Definition: sp-object.cpp:232
Editable view implementation.
SPItem * item
Definition: imagemagick.cpp:43
int mod(int i, int l)
CMYK to sRGB conversion routines.