Code

r15377@tres: ted | 2007-05-08 22:03:14 -0700
[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     std::list<std::string> 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      * Just a quick function to find and resolve relative paths for
119      * the incoming scripts
120      */
121     Glib::ustring solve_reldir (Inkscape::XML::Node *reprin);
123     /**
124      *
125      */
126     bool check_existance (const Glib::ustring &command);
128     /**
129      *
130      */
131     void copy_doc (Inkscape::XML::Node * olddoc,
132                    Inkscape::XML::Node * newdoc);
134     /**
135      *
136      */
137     void checkStderr (const Glib::ustring &filename, 
138                       Gtk::MessageType type,
139                       const Glib::ustring &message);
142 }; // class Script
148 }  // namespace Implementation
149 }  // namespace Extension
150 }  // namespace Inkscape
152 #endif /* __INKSCAPE_EXTENSION_IMPEMENTATION_SCRIPT_H__ */
154 /*
155   Local Variables:
156   mode:c++
157   c-file-style:"stroustrup"
158   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
159   indent-tabs-mode:nil
160   fill-column:99
161   End:
162 */
163 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :