Code

revert interface change
[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                                      gchar const *filename);
71     /**
72      *
73      */
74     virtual SPDocument *open(Inkscape::Extension::Input *module,
75                              gchar const *filename);
77     /**
78      *
79      */
80     virtual Gtk::Widget *prefs_output(Inkscape::Extension::Output *module);
82     /**
83      *
84      */
85     virtual void save(Inkscape::Extension::Output *module,
86                       SPDocument *doc,
87                       gchar const *filename);
88     /**
89      *
90      */
91     virtual Gtk::Widget *prefs_effect(Inkscape::Extension::Effect *module,
92                                       Inkscape::UI::View::View * view);
94     /**
95      *
96      */
97     virtual void effect(Inkscape::Extension::Effect *module,
98                         Inkscape::UI::View::View *doc);
102 private:
104     /**
105      * The command that has been dirived from
106      * the configuration file with appropriate directories
107      */
108     Glib::ustring command;
110      /**
111       * This is the extension that will be used
112       * as the helper to read in or write out the
113       * data
114       */
115     Glib::ustring helper_extension;
117     /**
118      * This function actually does the work, everything else is preparing
119      * for this function.  It is the core here
120      */
121     int execute (const Glib::ustring &command,
122                  const Glib::ustring &filein,
123                  const Glib::ustring &fileout);
125     /**
126      * Just a quick function to find and resolve relative paths for
127      * the incoming scripts
128      */
129     Glib::ustring solve_reldir (Inkscape::XML::Node *reprin);
131     /**
132      *
133      */
134     bool check_existance (const Glib::ustring &command);
136     /**
137      *
138      */
139     void copy_doc (Inkscape::XML::Node * olddoc,
140                    Inkscape::XML::Node * newdoc);
142     /**
143      *
144      */
145     void checkStderr (const Glib::ustring &filename, 
146                       Gtk::MessageType type,
147                       const Glib::ustring &message);
150 }; // class Script
156 }  // namespace Implementation
157 }  // namespace Extension
158 }  // namespace Inkscape
160 #endif /* __INKSCAPE_EXTENSION_IMPEMENTATION_SCRIPT_H__ */
162 /*
163   Local Variables:
164   mode:c++
165   c-file-style:"stroustrup"
166   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
167   indent-tabs-mode:nil
168   fill-column:99
169   End:
170 */
171 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :