summaryrefslogtreecommitdiffstats
path: root/src/document.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2014-11-25 14:20:24 +0000
committertavmjong-free <tavmjong@free.fr>2014-11-25 14:20:24 +0000
commit9827a6723d62935725b67b1bf55eea08bbbab527 (patch)
treea3f91e846fc26a5c9e1525405a710ea1422ca7e7 /src/document.cpp
parentAllow marker orientation to have units ('deg', 'rad', 'grad', 'turn'). (diff)
downloadinkscape-9827a6723d62935725b67b1bf55eea08bbbab527.tar.gz
inkscape-9827a6723d62935725b67b1bf55eea08bbbab527.zip
Move 'm' handling code from document.cpp to svg-length.cpp and units.cpp to match handling of 'ft'.
(bzr r13758)
Diffstat (limited to 'src/document.cpp')
-rw-r--r--src/document.cpp26
1 files changed, 6 insertions, 20 deletions
diff --git a/src/document.cpp b/src/document.cpp
index f69e830ff..e24af8fa8 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -630,17 +630,10 @@ void SPDocument::setWidth(const Inkscape::Util::Quantity &width)
if (root->width.unit)
old_units = unit_table.getUnit(root->width.unit);
gdouble old_converted = Inkscape::Util::Quantity::convert(root->width.value, old_units, width.unit);
+
root->width.computed = width.value("px");
- /* SVG does not support meters as a unit, so we must translate meters to
- * cm when writing */
- if (*width.unit == *unit_table.getUnit("m")) {
- root->width.value = width.value("cm");
- root->width.unit = SVGLength::CM;
- old_converted = Inkscape::Util::Quantity::convert(old_converted, "m", "cm");
- } else {
- root->width.value = width.quantity;
- root->width.unit = (SVGLength::Unit) width.unit->svgUnit();
- }
+ root->width.value = width.quantity;
+ root->width.unit = (SVGLength::Unit) width.unit->svgUnit();
if (root->viewBox_set)
root->viewBox.setMax(Geom::Point(root->viewBox.left() + (root->width.value / old_converted) * root->viewBox.width(), root->viewBox.bottom()));
@@ -672,17 +665,10 @@ void SPDocument::setHeight(const Inkscape::Util::Quantity &height)
if (root->height.unit)
old_units = unit_table.getUnit(root->height.unit);
gdouble old_converted = Inkscape::Util::Quantity::convert(root->height.value, old_units, height.unit);
+
root->height.computed = height.value("px");
- /* SVG does not support meters as a unit, so we must translate meters to
- * cm when writing */
- if (*height.unit == *unit_table.getUnit("m")) {
- root->height.value = height.value("cm");
- root->height.unit = SVGLength::CM;
- old_converted = Inkscape::Util::Quantity::convert(old_converted, "m", "cm");
- } else {
- root->height.value = height.quantity;
- root->height.unit = (SVGLength::Unit) height.unit->svgUnit();
- }
+ root->height.value = height.quantity;
+ root->height.unit = (SVGLength::Unit) height.unit->svgUnit();
if (root->viewBox_set)
root->viewBox.setMax(Geom::Point(root->viewBox.right(), root->viewBox.top() + (root->height.value / old_converted) * root->viewBox.height()));