103
103
g_free(extension);
104
104
g_free(filetypename);
105
105
g_free(filetypetooltip);
106
g_free(output_extension);
106
g_free(output_extension);
111
111
\return Whether this extension checks out
112
\brief Validate this extension
112
\brief Validate this extension
114
This function checks to make sure that the input extension has
115
a filename extension and a MIME type. Then it calls the parent
116
class' check function which also checks out the implmentation.
114
This function checks to make sure that the input extension has
115
a filename extension and a MIME type. Then it calls the parent
116
class' check function which also checks out the implmentation.
119
119
Input::check (void)
121
if (extension == NULL)
123
if (mimetype == NULL)
121
if (extension == NULL)
123
if (mimetype == NULL)
126
return Extension::check();
126
return Extension::check();
130
130
\return A new document
131
\brief This function creates a document from a file
132
\param uri The filename to create the document from
134
This function acts as the first step in creating a new document
135
from a file. The first thing that this does is make sure that the
136
file actually exists. If it doesn't, a NULL is returned. If the
137
file exits, then it is opened using the implmentation of this extension.
139
After opening the document the output_extension is set. What this
140
accomplishes is that save can try to use an extension that supports
141
the same fileformat. So something like opening and saveing an
142
Adobe Illustrator file can be transparent (not recommended, but
143
transparent). This is all done with undo being turned off.
131
\brief This function creates a document from a file
132
\param uri The filename to create the document from
134
This function acts as the first step in creating a new document
135
from a file. The first thing that this does is make sure that the
136
file actually exists. If it doesn't, a NULL is returned. If the
137
file exits, then it is opened using the implmentation of this extension.
139
After opening the document the output_extension is set. What this
140
accomplishes is that save can try to use an extension that supports
141
the same fileformat. So something like opening and saveing an
142
Adobe Illustrator file can be transparent (not recommended, but
143
transparent). This is all done with undo being turned off.
146
146
Input::open (const gchar *uri)
156
SPDocument * doc = NULL;
158
#ifdef WITH_GNOME_VFS
159
doc = imp->open(this, uri);
161
if (Inkscape::IO::file_test(uri, G_FILE_TEST_EXISTS)) {
162
doc = imp->open(this, uri);
156
SPDocument *const doc = imp->open(this, uri);
166
157
if (doc != NULL) {
167
158
Inkscape::XML::Node * repr = sp_document_repr_root(doc);
168
gboolean saved = sp_document_get_undo_sensitive(doc);
169
sp_document_set_undo_sensitive (doc, FALSE);
159
bool saved = sp_document_get_undo_sensitive(doc);
160
sp_document_set_undo_sensitive (doc, false);
170
161
repr->setAttribute("inkscape:output_extension", output_extension);
171
162
sp_document_set_undo_sensitive (doc, saved);
221
212
\return A dialog to get settings for this extension
222
\brief Create a dialog for preference for this extension
213
\brief Create a dialog for preference for this extension
224
Calls the implementation to get the preferences.
215
Calls the implementation to get the preferences.
227
218
Input::prefs (const gchar *uri)
230
221
set_state(Extension::STATE_LOADED);
231
if (!loaded()) return false;
233
227
Gtk::Widget * controls;
234
228
controls = imp->prefs_input(this, uri);