index b0f254a9c07afbacd205bcb2f99f8c1fa5a8a4dc..e1481d0002e7cdce122b6ed81f4d5a69a58139b0 100644 (file)
--- a/src/extension/output.cpp
+++ b/src/extension/output.cpp
* Authors:
* Ted Gould <ted@gould.cx>
*
* Authors:
* Ted Gould <ted@gould.cx>
*
+ * Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
* Copyright (C) 2002-2004 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
* Copyright (C) 2002-2004 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
child_repr = sp_repr_children(repr);
while (child_repr != NULL) {
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();
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")) {
if (chname[0] == '_') /* Allow _ for translation of tags */
chname++;
if (!strcmp(chname, "extension")) {
filetypetooltip = g_strdup(sp_repr_children(child_repr)->content());
}
if (!strcmp(chname, "dataloss")) {
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;
}
}
dataloss = FALSE;
}
}
\return None
\brief Save a document as a file
\param doc Document to save
\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.
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.
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
*/
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 {
try {
- imp->save(this, doc, uri);
+ imp->save(this, doc, filename);
}
catch (...) {
}
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;
}
return;
}