~ubuntu-branches/debian/experimental/inkscape/experimental

« back to all changes in this revision

Viewing changes to src/extension/execution-env.h

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-09-09 23:29:02 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20080909232902-c50iujhk1w79u8e7
Tags: 0.46-2.1
* Non-maintainer upload.
* Add upstream patch fixing a crash in the open dialog
  in the zh_CN.utf8 locale. Closes: #487623.
  Thanks to Luca Bruno for the patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Authors:
 
3
 *   Ted Gould <ted@gould.cx>
 
4
 *
 
5
 * Copyright (C) 2007 Authors
 
6
 *
 
7
 * Released under GNU GPL, read the file 'COPYING' for more information
 
8
 */
 
9
 
 
10
#ifndef INKSCAPE_EXTENSION_EXECUTION_ENV_H__
 
11
#define INKSCAPE_EXTENSION_EXECUTION_ENV_H__
 
12
 
 
13
#include <config.h>
 
14
 
 
15
#include <glibmm/main.h>
 
16
#include <glibmm/ustring.h>
 
17
 
 
18
#include <gtkmm/dialog.h>
 
19
 
 
20
#include "forward.h"
 
21
#include "extension-forward.h"
 
22
#include "extension.h"
 
23
 
 
24
namespace Inkscape {
 
25
namespace Extension {
 
26
 
 
27
class ExecutionEnv {
 
28
private:
 
29
    enum state_t {
 
30
        INIT,     //< The context has been initialized
 
31
        COMPLETE, //< We've completed atleast once
 
32
        RUNNING   //< The effect is currently running
 
33
    };
 
34
    /** \brief  What state the execution engine is in. */
 
35
    state_t _state;
 
36
 
 
37
    /** \brief If there is a working dialog it'll be referenced
 
38
               right here. */
 
39
    Gtk::Dialog * _visibleDialog;
 
40
    /** \brief Signal that the run is complete. */
 
41
    sigc::signal<void> _runComplete;
 
42
    /** \brief  In some cases we need a mainLoop, when we do, this is
 
43
                a pointer to it. */
 
44
    Glib::RefPtr<Glib::MainLoop> _mainloop;
 
45
    /** \brief  The document that we're working on. */
 
46
    Inkscape::UI::View::View * _doc;
 
47
    /** \brief  A list of the IDs of all the selected objects before
 
48
                we started to work on this document. */
 
49
    std::list<Glib::ustring> _selected;
 
50
    /** \brief  A document cache if we were passed one. */
 
51
    Implementation::ImplementationDocumentCache * _docCache;
 
52
 
 
53
    /** \brief  The effect that we're executing in this context. */
 
54
    Effect * _effect;
 
55
 
 
56
    /** \brief  Show the working dialog when the effect is executing. */
 
57
    bool _show_working;
 
58
    /** \brief  Display errors if they occur. */
 
59
    bool _show_errors;
 
60
public:
 
61
 
 
62
    /** \brief  Create a new context for exection of an effect
 
63
        \param effect  The effect to execute
 
64
        \param doc     The document to execute the effect on
 
65
        \param docCache  The implementation cache of the document.  May be
 
66
                         NULL in which case it'll be created by the execution
 
67
                         environment.
 
68
        \prarm show_working  Show a small dialog signaling the effect
 
69
                             is working.  Allows for user canceling.
 
70
        \param show_errors   If the effect has an error, show it or not.
 
71
    */
 
72
    ExecutionEnv (Effect * effect,
 
73
                  Inkscape::UI::View::View * doc,
 
74
                  Implementation::ImplementationDocumentCache * docCache = NULL,
 
75
                  bool show_working = true,
 
76
                  bool show_errors = true);
 
77
    virtual ~ExecutionEnv (void);
 
78
 
 
79
    /** \brief Starts the execution of the effect
 
80
        \return Returns whether the effect was executed to completion */
 
81
    void run (void);
 
82
    /** \brief Cancel the execution of the effect */
 
83
    void cancel (void);
 
84
    /** \brief Commit the changes to the document */
 
85
    void commit (void);
 
86
    /** \brief Undoes what the effect completed. */
 
87
    void undo (void);
 
88
    /** \brief Wait for the effect to complete if it hasn't. */
 
89
    bool wait (void);
 
90
 
 
91
private:
 
92
    void runComplete (void);
 
93
    void createPrefsDialog (Gtk::Widget * controls);
 
94
    void createWorkingDialog (void);
 
95
    void workingCanceled (const int resp);
 
96
    void processingCancel (void);
 
97
    void processingComplete(void);
 
98
    void documentCancel (void);
 
99
    void documentCommit (void);
 
100
    void reselect (void);
 
101
    void genDocCache (void);
 
102
    void killDocCache (void);
 
103
};
 
104
 
 
105
} }  /* namespace Inkscape, Extension */
 
106
#endif /* INKSCAPE_EXTENSION_EXECUTION_ENV_H__ */
 
107
 
 
108
/*
 
109
  Local Variables:
 
110
  mode:c++
 
111
  c-file-style:"stroustrup"
 
112
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
 
113
  indent-tabs-mode:nil
 
114
  fill-column:99
 
115
  End:
 
116
*/
 
117
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :