diff options
Diffstat (limited to 'src/document.cpp')
| -rw-r--r-- | src/document.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/document.cpp b/src/document.cpp index 78d7018bb..a024cc790 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -549,17 +549,15 @@ gdouble SPDocument::getWidth() const void SPDocument::setWidth(const Inkscape::Util::Quantity &width) { - Inkscape::Util::Unit px = unit_table.getUnit("px"); if (root->width.unit == SVGLength::PERCENT && root->viewBox_set) { // set to viewBox= - root->viewBox.setMax(Geom::Point(root->viewBox.left() + width.value(&px), root->viewBox.bottom())); + root->viewBox.setMax(Geom::Point(root->viewBox.left() + width.value("px"), root->viewBox.bottom())); } else { // set to width= gdouble old_computed = root->width.computed; - root->width.computed = width.value(&px); + 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")) { - Inkscape::Util::Unit cm = unit_table.getUnit("cm"); - root->width.value = width.value(&cm); + root->width.value = width.value("cm"); root->width.unit = SVGLength::CM; } else { root->width.value = width.quantity; @@ -587,17 +585,15 @@ gdouble SPDocument::getHeight() const void SPDocument::setHeight(const Inkscape::Util::Quantity &height) { - Inkscape::Util::Unit px = unit_table.getUnit("px"); if (root->height.unit == SVGLength::PERCENT && root->viewBox_set) { // set to viewBox= - root->viewBox.setMax(Geom::Point(root->viewBox.right(), root->viewBox.top() + height.value(&px))); + root->viewBox.setMax(Geom::Point(root->viewBox.right(), root->viewBox.top() + height.value("px"))); } else { // set to height= gdouble old_computed = root->height.computed; - root->height.computed = height.value(&px); + 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")) { - Inkscape::Util::Unit cm = unit_table.getUnit("cm"); - root->height.value = height.value(&cm); + root->height.value = height.value("cm"); root->height.unit = SVGLength::CM; } else { root->height.value = height.quantity; @@ -669,8 +665,8 @@ void SPDocument::fitToRect(Geom::Rect const &rect, bool with_margins) rect.max() + Geom::Point(margin_right, margin_top)); - setWidth(Inkscape::Util::Quantity(rect_with_margins.width(), &px)); - setHeight(Inkscape::Util::Quantity(rect_with_margins.height(), &px)); + setWidth(Inkscape::Util::Quantity(rect_with_margins.width(), "px")); + setHeight(Inkscape::Util::Quantity(rect_with_margins.height(), "px")); Geom::Translate const tr( Geom::Point(0, old_height - rect_with_margins.height()) |
