summaryrefslogtreecommitdiffstats
path: root/src/lpe-tool-context.cpp
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2013-10-12 22:24:05 +0000
committerJohan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl>2013-10-12 22:24:05 +0000
commita970dc423d59ea844bdb1af48d5d9419a5e2a287 (patch)
tree8f6a51df0574fe048ae7e791f276e72716aa090c /src/lpe-tool-context.cpp
parentFix crash with experimental lpe tool. (diff)
downloadinkscape-a970dc423d59ea844bdb1af48d5d9419a5e2a287.tar.gz
inkscape-a970dc423d59ea844bdb1af48d5d9419a5e2a287.zip
Units: stop newing Unit objects. pass around pointers to "undeletable" Unit objects in the UnitTable. I think we should move to using indexed units, and pass around the index of the unit in the unittable, or smth like that... ?
(bzr r12679)
Diffstat (limited to 'src/lpe-tool-context.cpp')
-rw-r--r--src/lpe-tool-context.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lpe-tool-context.cpp b/src/lpe-tool-context.cpp
index 0b71a892c..bf912746e 100644
--- a/src/lpe-tool-context.cpp
+++ b/src/lpe-tool-context.cpp
@@ -415,7 +415,7 @@ lpetool_create_measuring_items(SPLPEToolContext *lc, Inkscape::Selection *select
if (!show)
sp_canvas_item_hide(SP_CANVAS_ITEM(canvas_text));
- Inkscape::Util::Unit unit;
+ Inkscape::Util::Unit const * unit = NULL;
if (prefs->getString("/tools/lpetool/unit").compare("")) {
unit = unit_table.getUnit(prefs->getString("/tools/lpetool/unit"));
} else {
@@ -424,7 +424,7 @@ lpetool_create_measuring_items(SPLPEToolContext *lc, Inkscape::Selection *select
lengthval = Geom::length(pwd2);
lengthval = Inkscape::Util::Quantity::convert(lengthval, "px", unit);
- arc_length = g_strdup_printf("%.2f %s", lengthval, unit.abbr.c_str());
+ arc_length = g_strdup_printf("%.2f %s", lengthval, unit->abbr.c_str());
sp_canvastext_set_text (canvas_text, arc_length);
set_pos_and_anchor(canvas_text, pwd2, 0.5, 10);
// TODO: must we free arc_length?
@@ -454,7 +454,7 @@ lpetool_update_measuring_items(SPLPEToolContext *lc)
SPPath *path = i->first;
SPCurve *curve = path->getCurve();
Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2 = Geom::paths_to_pw(curve->get_pathvector());
- Inkscape::Util::Unit unit;
+ Inkscape::Util::Unit const * unit = NULL;
if (prefs->getString("/tools/lpetool/unit").compare("")) {
unit = unit_table.getUnit(prefs->getString("/tools/lpetool/unit"));
} else {
@@ -462,7 +462,7 @@ lpetool_update_measuring_items(SPLPEToolContext *lc)
}
double lengthval = Geom::length(pwd2);
lengthval = Inkscape::Util::Quantity::convert(lengthval, "px", unit);
- gchar *arc_length = g_strdup_printf("%.2f %s", lengthval, unit.abbr.c_str());
+ gchar *arc_length = g_strdup_printf("%.2f %s", lengthval, unit->abbr.c_str());
sp_canvastext_set_text (SP_CANVASTEXT(i->second), arc_length);
set_pos_and_anchor(SP_CANVASTEXT(i->second), pwd2, 0.5, 10);
// TODO: must we free arc_length?