diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2013-08-03 21:30:12 +0000 |
|---|---|---|
| committer | Johan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl> | 2013-08-03 21:30:12 +0000 |
| commit | 013e92537296f6ba2434e29a96d18eeb353d9560 (patch) | |
| tree | 9d818c704a01cc7158ab3d59f1a741f27420a032 /src/lpe-tool-context.cpp | |
| parent | rename variable for clarity (diff) | |
| download | inkscape-013e92537296f6ba2434e29a96d18eeb353d9560.tar.gz inkscape-013e92537296f6ba2434e29a96d18eeb353d9560.zip | |
reduce scope of variables
(bzr r12463)
Diffstat (limited to 'src/lpe-tool-context.cpp')
| -rw-r--r-- | src/lpe-tool-context.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/lpe-tool-context.cpp b/src/lpe-tool-context.cpp index feabfa02d..e7393b97b 100644 --- a/src/lpe-tool-context.cpp +++ b/src/lpe-tool-context.cpp @@ -482,21 +482,19 @@ void lpetool_update_measuring_items(SPLPEToolContext *lc) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - SPPath *path; - SPCurve *curve; - double lengthval; - gchar *arc_length; - std::map<SPPath *, SPCanvasItem*>::iterator i; - for (i = lc->measuring_items->begin(); i != lc->measuring_items->end(); ++i) { - path = i->first; - curve = SP_SHAPE(path)->getCurve(); + for ( std::map<SPPath *, SPCanvasItem*>::iterator i = lc->measuring_items->begin(); + i != lc->measuring_items->end(); + ++i ) + { + SPPath *path = i->first; + SPCurve *curve = SP_SHAPE(path)->getCurve(); Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2 = Geom::paths_to_pw(curve->get_pathvector()); SPUnitId unitid = static_cast<SPUnitId>(prefs->getInt("/tools/lpetool/unitid", SP_UNIT_PX)); SPUnit unit = sp_unit_get_by_id(unitid); - lengthval = Geom::length(pwd2); + double lengthval = Geom::length(pwd2); gboolean success; success = sp_convert_distance(&lengthval, &sp_unit_get_by_id(SP_UNIT_PX), &unit); - arc_length = g_strdup_printf("%.2f %s", lengthval, success ? sp_unit_get_abbreviation(&unit) : "px"); + gchar *arc_length = g_strdup_printf("%.2f %s", lengthval, success ? sp_unit_get_abbreviation(&unit) : "px"); 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? |
