summaryrefslogtreecommitdiffstats
path: root/src/live_effects/lpe-ruler.cpp
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2018-09-30 23:49:43 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2018-09-30 23:49:43 +0000
commitdfe4295847a74b7bbded4bca6693b862c002e7e5 (patch)
tree7b7c37fa4d286eb837ccc04593f4c133943e2f23 /src/live_effects/lpe-ruler.cpp
parentRevert "c++11 refactor: std::auto_ptr -> std::unique_ptr" (diff)
downloadinkscape-dfe4295847a74b7bbded4bca6693b862c002e7e5.tar.gz
inkscape-dfe4295847a74b7bbded4bca6693b862c002e7e5.zip
Improve calls to document_units
Diffstat (limited to 'src/live_effects/lpe-ruler.cpp')
-rw-r--r--src/live_effects/lpe-ruler.cpp18
1 files changed, 4 insertions, 14 deletions
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);
}