From bad0504958a10f1b99db3ae2557305541f388a52 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Mon, 24 Nov 2014 20:56:53 +0100 Subject: Units: make it absolutely clear that Document properties unit dropdown is for UI Display Units. Upon document load, calculate the units used for SVG values, if a viewbox is available. If not, default to "px" SVG units. Change all code to use either Display units OR svg units. (bzr r13751) --- src/document.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/document.cpp') diff --git a/src/document.cpp b/src/document.cpp index f5269eab3..3715d8e6e 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -599,6 +599,14 @@ Inkscape::Util::Unit const* SPDocument::getDefaultUnit() const return nv ? nv->getDefaultUnit() : unit_table.getUnit("pt"); } +/// guaranteed not to return nullptr +// returns 'px' units as default, like legacy Inkscape +Inkscape::Util::Unit const& SPDocument::getSVGUnit() const +{ + SPNamedView const* nv = sp_document_namedview(this, NULL); + return nv ? nv->getSVGUnit() : *unit_table.getUnit("px"); +} + Inkscape::Util::Quantity SPDocument::getWidth() const { g_return_val_if_fail(this->priv != NULL, Inkscape::Util::Quantity(0.0, unit_table.getUnit(""))); -- cgit v1.2.3