summaryrefslogtreecommitdiffstats
path: root/src/sp-namedview.cpp
diff options
context:
space:
mode:
authorAlvin Penner <penner@vaxxine.com>2015-03-01 00:19:03 +0000
committerapenner <penner@vaxxine.com>2015-03-01 00:19:03 +0000
commit85c1f61e88a6123b44d52e9d2fd028f1e9b668d0 (patch)
tree8c0a291a06214d30595e18b049e7908247a3e267 /src/sp-namedview.cpp
parentWorkaround for bug #1426090 (more LPE nastiness) (diff)
downloadinkscape-85c1f61e88a6123b44d52e9d2fd028f1e9b668d0.tar.gz
inkscape-85c1f61e88a6123b44d52e9d2fd028f1e9b668d0.zip
if viewbox does not exist in file, set the document-units to be px. (Bug 1239682)
Fixed bugs: - https://launchpad.net/bugs/1239682 (bzr r13955)
Diffstat (limited to 'src/sp-namedview.cpp')
-rw-r--r--src/sp-namedview.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp
index c26eff39f..3154c9e7b 100644
--- a/src/sp-namedview.cpp
+++ b/src/sp-namedview.cpp
@@ -261,6 +261,8 @@ void SPNamedView::build(SPDocument *document, Inkscape::XML::Node *repr) {
Geom::Rect viewbox = document->getRoot()->viewBox;
double factor = svgwidth.value(unit_table.primary(Inkscape::Util::UNIT_TYPE_LINEAR)) / viewbox.width();
svg_units = unit_table.findUnit(factor, Inkscape::Util::UNIT_TYPE_LINEAR);
+ } else { // force the document units to be px
+ repr->setAttribute("inkscape:document-units", "px");
}
}
@@ -551,7 +553,7 @@ void SPNamedView::set(unsigned int key, const gchar* value) {
static Inkscape::Util::Unit const *px = unit_table.getUnit("px");
Inkscape::Util::Unit const *new_unit = px;
- if (value) {
+ if (value && document->getRoot()->viewBox_set) {
Inkscape::Util::Unit const *const req_unit = unit_table.getUnit(value);
if ( !unit_table.hasUnit(value) ) {
g_warning("Unrecognized unit `%s'", value);