summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorMartin Owens <doctormo@gmail.com>2014-04-05 06:15:20 +0000
committerMartin Owens <doctormo@gmail.com>2014-04-05 06:15:20 +0000
commita303321365bf5ae640715eb9e033f6f01cb085c8 (patch)
tree1c2155bbd2ddd745de1a5e236deed30305d71ab3 /src/main.cpp
parentfix cmake build errors for changes in 2geom (diff)
downloadinkscape-a303321365bf5ae640715eb9e033f6f01cb085c8.tar.gz
inkscape-a303321365bf5ae640715eb9e033f6f01cb085c8.zip
Allow command line options -i and -j to effect plain-svg output, this involves cropping and reducing.
(bzr r13268)
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index c2377b42c..6f4add4b1 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1177,6 +1177,22 @@ static int sp_process_file_list(GSList *fl)
g_slist_free (selected);
g_slist_free (to_select);
}
+ if(sp_export_id) {
+ doc->ensureUpToDate();
+
+ // "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);