summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorLiam P. White <inkscapebronyat-signgmaildotcom>2014-04-06 22:22:07 +0000
committerLiam P. White <inkscapebronyat-signgmaildotcom>2014-04-06 22:22:07 +0000
commit15f9682879d6860d8c84a1cb79a4a34e0848a1bc (patch)
tree3b94cd60e7b9add96b85fe3da1d8a3b26c2d9cf1 /src/main.cpp
parentProperly allow effect stacking with knotholders (and add extra LPE functional... (diff)
parentnoop: improve code style in sp-lpe-item.cpp (diff)
downloadinkscape-15f9682879d6860d8c84a1cb79a4a34e0848a1bc.tar.gz
inkscape-15f9682879d6860d8c84a1cb79a4a34e0848a1bc.zip
Updaet to trunk
(bzr r13090.1.49)
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 00d0fcbb6..6f4add4b1 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1145,7 +1145,8 @@ static int sp_process_file_list(GSList *fl)
if (!sp_export_svg && (sp_vacuum_defs || has_performed_actions)) {
// save under the name given in the command line
- sp_repr_save_file(doc->rdoc, filename, SP_SVG_NS_URI);
+ Inkscape::Extension::save(Inkscape::Extension::db.get("org.inkscape.output.svg.inkscape"), doc, filename, false,
+ false, false, Inkscape::Extension::FILE_SAVE_METHOD_INKSCAPE_SVG);
}
if (sp_global_printer) {
sp_print_document_to_file(doc, sp_global_printer);
@@ -1176,14 +1177,25 @@ static int sp_process_file_list(GSList *fl)
g_slist_free (selected);
g_slist_free (to_select);
}
+ if(sp_export_id) {
+ doc->ensureUpToDate();
- Inkscape::XML::Document *rdoc;
- Inkscape::XML::Node *repr;
- rdoc = sp_repr_document_new("svg:svg");
- repr = rdoc->root();
- repr = doc->getRoot()->updateRepr(rdoc, repr, SP_OBJECT_WRITE_BUILD);
- sp_repr_save_rebased_file(repr->document(), sp_export_svg, SP_SVG_NS_URI,
- doc->getBase(), sp_export_svg);
+ // "crop" the document to the specified object, cleaning as we go.
+ SPObject *obj = doc->getObjectById(sp_export_id);
+ Geom::OptRect const bbox(SP_ITEM(obj)->visualBounds());
+
+ if (bbox) {
+ doc->fitToRect(*bbox, false);
+ }
+
+ if (sp_export_id_only) {
+ // If -j then remove all other objects to complete the "crop"
+ doc->getRoot()->cropToObject(obj);
+ }
+ }
+
+ Inkscape::Extension::save(Inkscape::Extension::db.get("org.inkscape.output.svg.plain"), doc, sp_export_svg, false,
+ false, false, Inkscape::Extension::FILE_SAVE_METHOD_SAVE_COPY);
}
if (sp_export_ps) {
retVal |= do_export_ps_pdf(doc, sp_export_ps, "image/x-postscript");