Code

Allow Inkscape to use its own python in preference to something in the path on win32...
[inkscape.git] / src / extension / implementation / script.h
1 /*
2  * Code for handling extensions (i.e., scripts)
3  *
4  * Authors:
5  *   Bryce Harrington <bryce@osdl.org>
6  *   Ted Gould <ted@gould.cx>
7  *
8  * Copyright (C) 2002-2005 Authors
9  *
10  * Released under GNU GPL, read the file 'COPYING' for more information
11  */
13 #ifndef __INKSCAPE_EXTENSION_IMPEMENTATION_SCRIPT_H__
14 #define __INKSCAPE_EXTENSION_IMPEMENTATION_SCRIPT_H__
16 #include "implementation.h"
17 #include <gtkmm/messagedialog.h>
19 namespace Inkscape {
20 namespace XML {
21 class Node;
22 }
23 }
26 namespace Inkscape {
27 namespace Extension {
28 namespace Implementation {
32 /**
33  * Utility class used for loading and launching script extensions
34  */
35 class Script : public Implementation {
37 public:
39     /**
40      *
41      */
42     Script(void);
44     /**
45      *
46      */
47     virtual ~Script();
50     /**
51      *
52      */
53     virtual bool load(Inkscape::Extension::Extension *module);
55     /**
56      *
57      */
58     virtual void unload(Inkscape::Extension::Extension *module);
60     /**
61      *
62      */
63     virtual bool check(Inkscape::Extension::Extension *module);
65     /**
66      *
67      */
68     virtual Gtk::Widget *prefs_input(Inkscape::Extension::Input *module,
69                                      const Glib::ustring &filename);
72     /**
73      *
74      */
75     virtual SPDocument *open(Inkscape::Extension::Input *module,
76                              const Glib::ustring &filename);
78     /**
79      *
80      */
81     virtual Gtk::Widget *prefs_output(Inkscape::Extension::Output *module);
83     /**
84      *
85      */
86     virtual void save(Inkscape::Extension::Output *module,
87                       SPDocument *doc,
88                       const Glib::ustring &filename);
89     /**
90      *
91      */
92     virtual Gtk::Widget *prefs_effect(Inkscape::Extension::Effect *module,
93                                       Inkscape::UI::View::View * view);
95     /**
96      *
97      */
98     virtual void effect(Inkscape::Extension::Effect *module,
99                         Inkscape::UI::View::View *doc);
103 private:
105     /**
106      * The command that has been dirived from
107      * the configuration file with appropriate directories
108      */
109     Glib::ustring command;
111      /**
112       * This is the extension that will be used
113       * as the helper to read in or write out the
114       * data
115       */
116     Glib::ustring helper_extension;
118     /**
119      * This function actually does the work, everything else is preparing
120      * for this function.  It is the core here
121      */
122     int execute (const Glib::ustring &command,
123                  const Glib::ustring &filein,
124                  const Glib::ustring &fileout);
126     /**
127      * Just a quick function to find and resolve relative paths for
128      * the incoming scripts
129      */
130     Glib::ustring solve_reldir (Inkscape::XML::Node *reprin);
132     /**
133      *
134      */
135     bool check_existance (const Glib::ustring &command);
137     /**
138      *
139      */
140     void copy_doc (Inkscape::XML::Node * olddoc,
141                    Inkscape::XML::Node * newdoc);
143     /**
144      *
145      */
146     void checkStderr (const Glib::ustring &filename, 
147                       Gtk::MessageType type,
148                       const Glib::ustring &message);
151 }; // class Script
157 }  // namespace Implementation
158 }  // namespace Extension
159 }  // namespace Inkscape
161 #endif /* __INKSCAPE_EXTENSION_IMPEMENTATION_SCRIPT_H__ */
163 /*
164   Local Variables:
165   mode:c++
166   c-file-style:"stroustrup"
167   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
168   indent-tabs-mode:nil
169   fill-column:99
170   End:
171 */
172 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :