summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/extension/internal/svg.cpp7
-rw-r--r--src/live_effects/lpe-fillet-chamfer.cpp9
-rw-r--r--src/live_effects/lpe-measure-segments.cpp6
-rw-r--r--src/live_effects/lpe-ruler.cpp18
4 files changed, 9 insertions, 31 deletions
diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp
index d392d6bf0..8a5db2005 100644
--- a/src/extension/internal/svg.cpp
+++ b/src/extension/internal/svg.cpp
@@ -39,7 +39,6 @@
#include "xml/attribute-record.h"
#include "xml/simple-document.h"
-#include "object/sp-namedview.h"
#include "object/sp-image.h"
#include "object/sp-root.h"
#include "util/units.h"
@@ -225,11 +224,7 @@ Svg::open (Inkscape::Extension::Input *mod, const gchar *uri)
if (prefs->getBool("/options/onimport", false) && import_mode_svg.compare("include") != 0) {
bool embed = ( import_mode_svg.compare( "embed" ) == 0 );
SPDocument * ret = SPDocument::createNewDoc(uri, TRUE);
- SPNamedView *nv = sp_document_namedview(doc, nullptr);
- Glib::ustring display_unit = nv->display_units->abbr;
- if (display_unit.empty()) {
- display_unit = "px";
- }
+ Glib::ustring display_unit = doc->getDisplayUnit()->abbr.c_str();
double width = ret->getWidth().value(display_unit);
double height = ret->getHeight().value(display_unit);
// Create image node
diff --git a/src/live_effects/lpe-fillet-chamfer.cpp b/src/live_effects/lpe-fillet-chamfer.cpp
index 1981c6983..8e07388f5 100644
--- a/src/live_effects/lpe-fillet-chamfer.cpp
+++ b/src/live_effects/lpe-fillet-chamfer.cpp
@@ -102,8 +102,7 @@ void LPEFilletChamfer::doOnApply(SPLPEItem const *lpeItem)
double power = radius;
if (!flexible) {
SPDocument * document = SP_ACTIVE_DOCUMENT;
- SPNamedView *nv = sp_document_namedview(document, nullptr);
- Glib::ustring display_unit = nv->display_units->abbr;
+ Glib::ustring display_unit = document->getDisplayUnit()->abbr.c_str();
power = Inkscape::Util::Quantity::convert(power, unit.get_abbreviation(), display_unit.c_str());
}
SatelliteType satellite_type = FILLET;
@@ -257,8 +256,7 @@ void LPEFilletChamfer::updateAmount()
double power = radius;
if (!flexible) {
SPDocument * document = SP_ACTIVE_DOCUMENT;
- SPNamedView *nv = sp_document_namedview(document, nullptr);
- Glib::ustring display_unit = nv->display_units->abbr;
+ Glib::ustring display_unit = document->getDisplayUnit()->abbr.c_str();
power = Inkscape::Util::Quantity::convert(power, unit.get_abbreviation(), display_unit.c_str());
}
_pathvector_satellites->updateAmount(power, apply_no_radius, apply_with_radius, only_selected,
@@ -323,8 +321,7 @@ void LPEFilletChamfer::doBeforeEffect(SPLPEItem const *lpeItem)
double power = radius;
if (!flexible) {
SPDocument * document = SP_ACTIVE_DOCUMENT;
- SPNamedView *nv = sp_document_namedview(document, nullptr);
- Glib::ustring display_unit = nv->display_units->abbr;
+ Glib::ustring display_unit = document->getDisplayUnit()->abbr.c_str();
power = Inkscape::Util::Quantity::convert(power, unit.get_abbreviation(), display_unit.c_str());
}
SatelliteType satellite_type = FILLET;
diff --git a/src/live_effects/lpe-measure-segments.cpp b/src/live_effects/lpe-measure-segments.cpp
index cad9bb417..f008f0ad0 100644
--- a/src/live_effects/lpe-measure-segments.cpp
+++ b/src/live_effects/lpe-measure-segments.cpp
@@ -914,11 +914,7 @@ LPEMeasureSegments::doBeforeEffect (SPLPEItem const* lpeitem)
if (shape) {
//only check constrain viewbox on X
Geom::Scale scaledoc = document->getDocumentScale();
- SPNamedView *nv = sp_document_namedview(document, nullptr);
- display_unit = nv->display_units->abbr;
- if (display_unit.empty()) {
- display_unit = "px";
- }
+ display_unit = document->getDisplayUnit()->abbr.c_str();
doc_scale = Inkscape::Util::Quantity::convert( scaledoc[Geom::X], "px", display_unit.c_str() );
if (doc_scale > 0) {
doc_scale= 1.0/doc_scale;
diff --git a/src/live_effects/lpe-ruler.cpp b/src/live_effects/lpe-ruler.cpp
index c3fc973c2..929bb0a70 100644
--- a/src/live_effects/lpe-ruler.cpp
+++ b/src/live_effects/lpe-ruler.cpp
@@ -77,14 +77,9 @@ LPERuler::ruler_mark(Geom::Point const &A, Geom::Point const &n, MarkType const
double real_mark_length = mark_length;
SPDocument * document = SP_ACTIVE_DOCUMENT;
- SPNamedView *nv = sp_document_namedview(document, NULL);
- Glib::ustring display_unit = "mm";
- if (nv && nv->display_units) {
- display_unit = nv->display_units->abbr;
- real_mark_length = Inkscape::Util::Quantity::convert(real_mark_length, unit.get_abbreviation(), display_unit.c_str());
- }
+ real_mark_length = Inkscape::Util::Quantity::convert(real_mark_length, unit.get_abbreviation(), document->getDisplayUnit()->abbr.c_str());
double real_minor_mark_length = minor_mark_length;
- real_minor_mark_length = Inkscape::Util::Quantity::convert(real_minor_mark_length, unit.get_abbreviation(), display_unit.c_str());
+ real_minor_mark_length = Inkscape::Util::Quantity::convert(real_minor_mark_length, unit.get_abbreviation(), document->getDisplayUnit()->abbr.c_str());
n_major = real_mark_length * n;
n_minor = real_minor_mark_length * n;
@@ -135,15 +130,10 @@ LPERuler::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_i
double real_mark_distance = mark_distance;
SPDocument * document = SP_ACTIVE_DOCUMENT;
- SPNamedView *nv = sp_document_namedview(document, NULL);
- Glib::ustring display_unit = "mm";
- if (nv && nv->display_units) {
- display_unit = nv->display_units->abbr;
- real_mark_distance = Inkscape::Util::Quantity::convert(real_mark_distance, unit.get_abbreviation(), display_unit.c_str());
- }
+ real_mark_distance = Inkscape::Util::Quantity::convert(real_mark_distance, unit.get_abbreviation(), document->getDisplayUnit()->abbr.c_str());
double real_offset = offset;
- real_offset = Inkscape::Util::Quantity::convert(real_offset, unit.get_abbreviation(), display_unit.c_str());
+ real_offset = Inkscape::Util::Quantity::convert(real_offset, unit.get_abbreviation(), document->getDisplayUnit()->abbr.c_str());
for (double s = real_offset; s<totlength; s+=real_mark_distance){
s_cuts.push_back(s);
}