diff options
Diffstat (limited to 'src/display/canvas-axonomgrid.cpp')
| -rw-r--r-- | src/display/canvas-axonomgrid.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp index f7a7cb39a..d66b97bbc 100644 --- a/src/display/canvas-axonomgrid.cpp +++ b/src/display/canvas-axonomgrid.cpp @@ -161,15 +161,16 @@ CanvasAxonomGrid::CanvasAxonomGrid (SPNamedView * nv, Inkscape::XML::Node * in_r : CanvasGrid(nv, in_repr, in_doc, GRID_AXONOMETRIC) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - gridunit = new Inkscape::Util::Unit(unit_table.getUnit(prefs->getString("/options/grids/axonom/units"))); - if (!gridunit) - gridunit = new Inkscape::Util::Unit(unit_table.getUnit("px")); - origin[Geom::X] = Inkscape::Util::Quantity::convert(prefs->getDouble("/options/grids/axonom/origin_x", 0.0), *gridunit, "px"); - origin[Geom::Y] = Inkscape::Util::Quantity::convert(prefs->getDouble("/options/grids/axonom/origin_y", 0.0), *gridunit, "px"); + gridunit = unit_table.getUnit(prefs->getString("/options/grids/axonom/units")); + if (!gridunit) { + gridunit = unit_table.getUnit("px"); + } + origin[Geom::X] = Inkscape::Util::Quantity::convert(prefs->getDouble("/options/grids/axonom/origin_x", 0.0), gridunit, "px"); + origin[Geom::Y] = Inkscape::Util::Quantity::convert(prefs->getDouble("/options/grids/axonom/origin_y", 0.0), gridunit, "px"); color = prefs->getInt("/options/grids/axonom/color", 0x0000ff20); empcolor = prefs->getInt("/options/grids/axonom/empcolor", 0x0000ff40); empspacing = prefs->getInt("/options/grids/axonom/empspacing", 5); - lengthy = Inkscape::Util::Quantity::convert(prefs->getDouble("/options/grids/axonom/spacing_y", 1.0), *gridunit, "px"); + lengthy = Inkscape::Util::Quantity::convert(prefs->getDouble("/options/grids/axonom/spacing_y", 1.0), gridunit, "px"); angle_deg[X] = prefs->getDouble("/options/grids/axonom/angle_x", 30.0); angle_deg[Z] = prefs->getDouble("/options/grids/axonom/angle_z", 30.0); angle_deg[Y] = 0; @@ -214,18 +215,18 @@ CanvasAxonomGrid::readRepr() { gchar const *value; if ( (value = repr->attribute("originx")) ) { - Inkscape::Util::Quantity q = unit_table.getQuantity(value); + Inkscape::Util::Quantity q = unit_table.parseQuantity(value); gridunit = q.unit; - origin[Geom::X] = unit_table.getQuantity(value).value("px"); + origin[Geom::X] = q.value("px"); } if ( (value = repr->attribute("originy")) ) { - Inkscape::Util::Quantity q = unit_table.getQuantity(value); + Inkscape::Util::Quantity q = unit_table.parseQuantity(value); gridunit = q.unit; - origin[Geom::Y] = unit_table.getQuantity(value).value("px"); + origin[Geom::Y] = q.value("px"); } if ( (value = repr->attribute("spacingy")) ) { - Inkscape::Util::Quantity q = unit_table.getQuantity(value); + Inkscape::Util::Quantity q = unit_table.parseQuantity(value); gridunit = q.unit; lengthy = q.value("px"); if (lengthy < 0.0500) lengthy = 0.0500; @@ -370,13 +371,13 @@ _wr.setUpdating (false); gdouble val; val = origin[Geom::X]; - val = Inkscape::Util::Quantity::convert(val, "px", *gridunit); + val = Inkscape::Util::Quantity::convert(val, "px", gridunit); _rsu_ox->setValue (val); val = origin[Geom::Y]; - val = Inkscape::Util::Quantity::convert(val, "px", *gridunit); + val = Inkscape::Util::Quantity::convert(val, "px", gridunit); _rsu_oy->setValue (val); val = lengthy; - double gridy = Inkscape::Util::Quantity::convert(val, "px", *gridunit); + double gridy = Inkscape::Util::Quantity::convert(val, "px", gridunit); _rsu_sy->setValue (gridy); _rsu_ax->setValue(angle_deg[X]); |
