X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fextension%2Foutput.cpp;h=e1481d0002e7cdce122b6ed81f4d5a69a58139b0;hb=8ebe4cd501af68581f40982b54f463546c59943a;hp=b0f254a9c07afbacd205bcb2f99f8c1fa5a8a4dc;hpb=305941d63be322f6f571a29b5845485fe6de4219;p=inkscape.git diff --git a/src/extension/output.cpp b/src/extension/output.cpp index b0f254a9c..e1481d000 100644 --- a/src/extension/output.cpp +++ b/src/extension/output.cpp @@ -2,6 +2,7 @@ * Authors: * Ted Gould * + * Copyright (C) 2006 Johan Engelen * Copyright (C) 2002-2004 Authors * * Released under GNU GPL, read the file 'COPYING' for more information @@ -48,10 +49,13 @@ Output::Output (Inkscape::XML::Node * in_repr, Implementation::Implementation * child_repr = sp_repr_children(repr); while (child_repr != NULL) { - if (!strcmp(child_repr->name(), "output")) { + if (!strcmp(child_repr->name(), INKSCAPE_EXTENSION_NS "output")) { 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")) { @@ -71,7 +75,7 @@ Output::Output (Inkscape::XML::Node * in_repr, Implementation::Implementation * filetypetooltip = g_strdup(sp_repr_children(child_repr)->content()); } if (!strcmp(chname, "dataloss")) { - if (!strcmp(sp_repr_children(child_repr)->content(), "FALSE")) { + if (!strcmp(sp_repr_children(child_repr)->content(), "false")) { dataloss = FALSE; } } @@ -196,55 +200,27 @@ Output::prefs (void) \return None \brief Save a document as a file \param doc Document to save - \param uri File to save the document as + \param filename File to save the document as This function does a little of the dirty work involved in saving a document so that the implementation only has to worry about geting bits on the disk. - The big thing that it does is remove and readd the fields that are + The big thing that it does is remove and read the fields that are only used at runtime and shouldn't be saved. One that may surprise people is the output extension. This is not saved so that the IDs could be changed, and old files will still work properly. - - After the file is saved by the implmentation the output_extension - and dataloss variables are recreated. The output_extension is set - to this extension so that future saves use this extension. Dataloss - is set so that a warning will occur on closing the document that - there may be some dataloss from this extension. */ void -Output::save (SPDocument * doc, const gchar * uri) +Output::save(SPDocument *doc, gchar const *filename) { - bool modified = false; - Inkscape::XML::Node * repr = sp_document_repr_root(doc); - - gboolean saved = sp_document_get_undo_sensitive(doc); - sp_document_set_undo_sensitive (doc, FALSE); - //repr->setAttribute("inkscape:output_extension", NULL); - repr->setAttribute("inkscape:dataloss", NULL); - if (repr->attribute("sodipodi:modified") != NULL) - modified = true; - repr->setAttribute("sodipodi:modified", NULL); - sp_document_set_undo_sensitive (doc, saved); - try { - imp->save(this, doc, uri); + imp->save(this, doc, filename); } catch (...) { - if (modified) - repr->setAttribute("sodipodi:modified", "true"); - throw; + g_warning("There was an error saving the file."); } - saved = sp_document_get_undo_sensitive(doc); - sp_document_set_undo_sensitive (doc, FALSE); - //repr->setAttribute("inkscape:output_extension", get_id()); - if (dataloss) { - repr->setAttribute("inkscape:dataloss", "true"); - } - sp_document_set_undo_sensitive (doc, saved); - return; }