Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
execution-env.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Authors:
4 * Ted Gould <ted@gould.cx>
5 *
6 * Copyright (C) 2007 Authors
7 *
8 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
9 */
10
11#ifndef INKSCAPE_EXTENSION_EXECUTION_ENV_H__
12#define INKSCAPE_EXTENSION_EXECUTION_ENV_H__
13
14#include <glibmm/main.h>
15#include <glibmm/ustring.h>
16#include <gtkmm/dialog.h>
17#include <memory>
18
19#include "selection.h"
20
21class SPDesktop;
22class SPDocument;
23
24namespace Inkscape {
25namespace Extension {
26
27class Effect;
28
33
35private:
36 enum state_t {
37 INIT, //< The context has been initialized
38 COMPLETE, //< We've completed atleast once
39 RUNNING //< The effect is currently running
40 };
43
46 Gtk::Dialog * _visibleDialog = nullptr;
48 sigc::signal<void ()> _runComplete;
51 Glib::RefPtr<Glib::MainLoop> _mainloop;
53 SPDesktop * _desktop = nullptr;
56
58 std::unique_ptr<Inkscape::SelectionState> _selectionState;
59
62
65public:
66
77 ExecutionEnv (Effect * effect,
80 bool show_working = true,
81 bool show_errors = true);
82 virtual ~ExecutionEnv ();
83
86 void run ();
88 void cancel ();
90 void commit ();
92 void undo ();
94 bool wait ();
95 void reselect ();
96
98 Gtk::Dialog *get_working_dialog () { return _visibleDialog; };
99
100 // Public according to Core Guideline C.131
102private:
103 void runComplete ();
104 void createWorkingDialog ();
105 void workingCanceled (const int resp);
106 void genDocCache ();
107 void killDocCache ();
108};
109
110} } /* namespace Inkscape, Extension */
111#endif /* INKSCAPE_EXTENSION_EXECUTION_ENV_H__ */
112
113/*
114 Local Variables:
115 mode:c++
116 c-file-style:"stroustrup"
117 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
118 indent-tabs-mode:nil
119 fill-column:99
120 End:
121*/
122// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
Effects are extensions that take a document and do something to it in place.
Definition effect.h:39
void undo()
Undoes what the effect completed.
Gtk::Dialog * get_working_dialog()
Return reference to working dialog (if any)
void createWorkingDialog()
Create the working dialog.
bool wait()
Wait for the effect to complete if it hasn't.
Gtk::Dialog * _visibleDialog
If there is a working dialog it'll be referenced right here.
state_t _state
What state the execution engine is in.
bool _show_working
Show the working dialog when the effect is executing.
virtual ~ExecutionEnv()
Destroy an execution environment.
Implementation::ImplementationDocumentCache * _docCache
A document cache if we were passed one.
Glib::RefPtr< Glib::MainLoop > _mainloop
In some cases we need a mainLoop, when we do, this is a pointer to it.
void commit()
Commit the changes to the document.
std::unique_ptr< Inkscape::SelectionState > _selectionState
Saved selection state before running the effect.
sigc::signal< void()> _runComplete
Signal that the run is complete.
void killDocCache()
Destroy a document cache.
void cancel()
Cancel the execution of the effect.
SPDesktop * _desktop
The desktop containing the document that we're working on.
void run()
Starts the execution of the effect.
void genDocCache()
Generate a document cache if needed.
Effect * _effect
The effect that we're executing in this context.
A cache for the document and this implementation.
Base class for all implementations of modules.
To do: update description of desktop.
Definition desktop.h:149
Typed SVG document implementation.
Definition document.h:103
Helper class to stream background task notifications as a series of messages.
SPDesktop * desktop