diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2014-11-24 19:56:53 +0000 |
|---|---|---|
| committer | Johan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl> | 2014-11-24 19:56:53 +0000 |
| commit | bad0504958a10f1b99db3ae2557305541f388a52 (patch) | |
| tree | 2fdec1e71db3d37d097e07cdd5b210eaaa844bcf /src/document.cpp | |
| parent | Extensions: try to calculate the SVG unit (diff) | |
| download | inkscape-bad0504958a10f1b99db3ae2557305541f388a52.tar.gz inkscape-bad0504958a10f1b99db3ae2557305541f388a52.zip | |
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)
Diffstat (limited to 'src/document.cpp')
| -rw-r--r-- | src/document.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
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(""))); |
