From 77f61343ff18f29f05331131c2fe2bd810a64498 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Sun, 25 Aug 2013 19:42:22 -0400 Subject: Use real world units for page sizes. (bzr r12475.1.1) --- src/ui/dialog/document-properties.cpp | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 77fb182e5..430f28474 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -1433,9 +1433,33 @@ void DocumentProperties::update() if (nv->doc_units) _rum_deflt.setUnit (nv->doc_units->abbr); - double const doc_w_px = sp_desktop_document(dt)->getWidth(); - double const doc_h_px = sp_desktop_document(dt)->getHeight(); - _page_sizer.setDim (doc_w_px, doc_h_px); + double const doc_w = sp_desktop_document(dt)->getRoot()->width.value; + Glib::ustring doc_w_unit = unit_table.getUnit(sp_desktop_document(dt)->getRoot()->width.unit).abbr; + if (doc_w_unit == "") { + if (nv->units) { + doc_w_unit = nv->units->abbr; + } else { + if (nv->doc_units) { + doc_w_unit = nv->doc_units->abbr; + } else { + doc_w_unit = "px"; + } + } + } + double const doc_h = sp_desktop_document(dt)->getRoot()->height.value; + Glib::ustring doc_h_unit = unit_table.getUnit(sp_desktop_document(dt)->getRoot()->height.unit).abbr; + if (doc_h_unit == "") { + if (nv->units) { + doc_h_unit = nv->units->abbr; + } else { + if (nv->doc_units) { + doc_h_unit = nv->doc_units->abbr; + } else { + doc_h_unit = "px"; + } + } + } + _page_sizer.setDim(Inkscape::Util::Quantity(doc_w, doc_w_unit), Inkscape::Util::Quantity(doc_h, doc_h_unit)); _page_sizer.updateFitMarginsUI(nv->getRepr()); //-----------------------------------------------------------guide page -- cgit v1.2.3