summaryrefslogtreecommitdiffstats
path: root/src/extension
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2013-10-05 21:24:43 +0000
committerJabiertxof <jtx@jtx.marker.es>2013-10-05 21:24:43 +0000
commit9d62f4c3bdf4656d4fe7652430230fea32fa5872 (patch)
tree960c9b872377a015900ddb2cd2f654ffc8e05e95 /src/extension
parentFix moving handles (diff)
parentFix EMF/WMF import scale (Bug #1229120). (diff)
downloadinkscape-9d62f4c3bdf4656d4fe7652430230fea32fa5872.tar.gz
inkscape-9d62f4c3bdf4656d4fe7652430230fea32fa5872.zip
update to trunk
(bzr r11950.1.161)
Diffstat (limited to 'src/extension')
-rw-r--r--src/extension/internal/emf-inout.cpp26
-rw-r--r--src/extension/internal/wmf-inout.cpp26
2 files changed, 52 insertions, 0 deletions
diff --git a/src/extension/internal/emf-inout.cpp b/src/extension/internal/emf-inout.cpp
index d9489af31..4bca9dfd9 100644
--- a/src/extension/internal/emf-inout.cpp
+++ b/src/extension/internal/emf-inout.cpp
@@ -46,6 +46,10 @@
#include "clear-n_.h"
#include "document.h"
#include "util/units.h"
+#include "shape-editor.h"
+#include "sp-namedview.h"
+#include "document-undo.h"
+#include "inkscape.h"
#include "emf-print.h"
#include "emf-inout.h"
@@ -3485,7 +3489,29 @@ Emf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri )
// Set viewBox if it doesn't exist
if (!doc->getRoot()->viewBox_set) {
+ bool saved = Inkscape::DocumentUndo::getUndoSensitive(doc);
+ Inkscape::DocumentUndo::setUndoSensitive(doc, false);
+
+ doc->ensureUpToDate();
+
+ // Set document unit
+ Inkscape::XML::Node *repr = sp_document_namedview(doc, 0)->getRepr();
+ Inkscape::SVGOStringStream os;
+ os << doc->getWidth().unit->abbr;
+ repr->setAttribute("inkscape:document-units", os.str().c_str());
+
+ // Set viewBox
doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().quantity, doc->getHeight().quantity));
+
+ // Scale and translate objects
+ double scale = Inkscape::Util::Quantity::convert(1, "px", doc->getWidth().unit->abbr);
+ ShapeEditor::blockSetItem(true);
+ doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(0, SP_ACTIVE_DOCUMENT->getHeight().value("px")));
+ ShapeEditor::blockSetItem(false);
+
+ doc->ensureUpToDate();
+
+ Inkscape::DocumentUndo::setUndoSensitive(doc, saved);
}
return doc;
diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp
index e7dfa46d7..78fcdb66d 100644
--- a/src/extension/internal/wmf-inout.cpp
+++ b/src/extension/internal/wmf-inout.cpp
@@ -46,6 +46,10 @@
#include "util/units.h"
#include "clear-n_.h"
#include "document.h"
+#include "shape-editor.h"
+#include "sp-namedview.h"
+#include "document-undo.h"
+#include "inkscape.h"
#include "wmf-inout.h"
@@ -3173,7 +3177,29 @@ Wmf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri )
// Set viewBox if it doesn't exist
if (!doc->getRoot()->viewBox_set) {
+ bool saved = Inkscape::DocumentUndo::getUndoSensitive(doc);
+ Inkscape::DocumentUndo::setUndoSensitive(doc, false);
+
+ doc->ensureUpToDate();
+
+ // Set document unit
+ Inkscape::XML::Node *repr = sp_document_namedview(doc, 0)->getRepr();
+ Inkscape::SVGOStringStream os;
+ os << doc->getWidth().unit->abbr;
+ repr->setAttribute("inkscape:document-units", os.str().c_str());
+
+ // Set viewBox
doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().quantity, doc->getHeight().quantity));
+
+ // Scale and translate objects
+ double scale = Inkscape::Util::Quantity::convert(1, "px", doc->getWidth().unit->abbr);
+ ShapeEditor::blockSetItem(true);
+ doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(0, SP_ACTIVE_DOCUMENT->getHeight().value("px")));
+ ShapeEditor::blockSetItem(false);
+
+ doc->ensureUpToDate();
+
+ Inkscape::DocumentUndo::setUndoSensitive(doc, saved);
}
return doc;