index 5c8f8d57f26614cfc2ef30abd6032696330c8085..b4599dbd06e67b64dd611ade8275d0980854054c 100644 (file)
--- a/src/extension/input.cpp
+++ b/src/extension/input.cpp
@@ -46,18 +46,19 @@ Input::Input (Inkscape::XML::Node * in_repr, Implementation::Implementation * in
filetypetooltip = NULL;
output_extension = NULL;
- printf("Input::Input\n");
-
if (repr != NULL) {
Inkscape::XML::Node * child_repr;
child_repr = sp_repr_children(repr);
while (child_repr != NULL) {
- if (!strcmp(child_repr->name(), "input")) {
+ if (!strcmp(child_repr->name(), INKSCAPE_EXTENSION_NS "input")) {
child_repr = sp_repr_children(child_repr);
while (child_repr != NULL) {
char const * chname = child_repr->name();
+ if (!strncmp(chname, INKSCAPE_EXTENSION_NS_NC, strlen(INKSCAPE_EXTENSION_NS_NC))) {
+ chname += strlen(INKSCAPE_EXTENSION_NS);
+ }
if (chname[0] == '_') /* Allow _ for translation of tags */
chname++;
if (!strcmp(chname, "extension")) {
}
/**
- \return None
- \brief Destroys an Input extension
+ \return None
+ \brief Destroys an Input extension
*/
Input::~Input (void)
{
g_free(extension);
g_free(filetypename);
g_free(filetypetooltip);
- g_free(output_extension);
+ g_free(output_extension);
return;
}
/**
\return Whether this extension checks out
- \brief Validate this extension
+ \brief Validate this extension
- This function checks to make sure that the input extension has
- a filename extension and a MIME type. Then it calls the parent
- class' check function which also checks out the implmentation.
+ This function checks to make sure that the input extension has
+ a filename extension and a MIME type. Then it calls the parent
+ class' check function which also checks out the implmentation.
*/
bool
Input::check (void)
{
- if (extension == NULL)
- return FALSE;
- if (mimetype == NULL)
- return FALSE;
+ if (extension == NULL)
+ return FALSE;
+ if (mimetype == NULL)
+ return FALSE;
- return Extension::check();
+ return Extension::check();
}
/**
\return A new document
- \brief This function creates a document from a file
- \param uri The filename to create the document from
-
- This function acts as the first step in creating a new document
- from a file. The first thing that this does is make sure that the
- file actually exists. If it doesn't, a NULL is returned. If the
- file exits, then it is opened using the implmentation of this extension.
-
- After opening the document the output_extension is set. What this
- accomplishes is that save can try to use an extension that supports
- the same fileformat. So something like opening and saveing an
- Adobe Illustrator file can be transparent (not recommended, but
- transparent). This is all done with undo being turned off.
+ \brief This function creates a document from a file
+ \param uri The filename to create the document from
+
+ This function acts as the first step in creating a new document
+ from a file. The first thing that this does is make sure that the
+ file actually exists. If it doesn't, a NULL is returned. If the
+ file exits, then it is opened using the implmentation of this extension.
*/
SPDocument *
Input::open (const gchar *uri)
{
- printf("Input::open\n");
-
if (!loaded()) {
set_state(Extension::STATE_LOADED);
}
timer->touch();
SPDocument *const doc = imp->open(this, uri);
- if (doc != NULL) {
- Inkscape::XML::Node * repr = sp_document_repr_root(doc);
- bool saved = sp_document_get_undo_sensitive(doc);
- sp_document_set_undo_sensitive (doc, false);
- repr->setAttribute("inkscape:output_extension", output_extension);
- sp_document_set_undo_sensitive (doc, saved);
- }
return doc;
}
/**
\return IETF mime-type for the extension
- \brief Get the mime-type that describes this extension
+ \brief Get the mime-type that describes this extension
*/
gchar *
Input::get_mimetype(void)
/**
\return Filename extension for the extension
- \brief Get the filename extension for this extension
+ \brief Get the filename extension for this extension
*/
gchar *
Input::get_extension(void)
/**
\return The name of the filetype supported
- \brief Get the name of the filetype supported
+ \brief Get the name of the filetype supported
*/
gchar *
Input::get_filetypename(void)
/**
\return Tooltip giving more information on the filetype
- \brief Get the tooltip for more information on the filetype
+ \brief Get the tooltip for more information on the filetype
*/
gchar *
Input::get_filetypetooltip(void)
/**
\return A dialog to get settings for this extension
- \brief Create a dialog for preference for this extension
+ \brief Create a dialog for preference for this extension
- Calls the implementation to get the preferences.
+ Calls the implementation to get the preferences.
*/
bool
Input::prefs (const gchar *uri)
{
- if (!loaded())
+ if (!loaded()) {
set_state(Extension::STATE_LOADED);
- if (!loaded()) return false;
+ }
+ if (!loaded()) {
+ return false;
+ }
Gtk::Widget * controls;
controls = imp->prefs_input(this, uri);