diff options
Diffstat (limited to 'src/ui/tools/measure-tool.cpp')
| -rw-r--r-- | src/ui/tools/measure-tool.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/ui/tools/measure-tool.cpp b/src/ui/tools/measure-tool.cpp index bd2964d94..8037a02a9 100644 --- a/src/ui/tools/measure-tool.cpp +++ b/src/ui/tools/measure-tool.cpp @@ -602,6 +602,12 @@ bool MeasureTool::root_handler(GdkEvent* event) showInfoBox(motion_w, false); } } else { + SPDesktop *desktop = SP_ACTIVE_DESKTOP; + Inkscape::Util::Unit const * unit = desktop->getNamedView()->getDisplayUnit(); + for (size_t idx = 0; idx < measure_item.size(); ++idx) { + sp_canvas_item_destroy(measure_item[idx]); + } + measure_item.clear(); ret = TRUE; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); @@ -1153,6 +1159,7 @@ void MeasureTool::showInfoBox(Geom::Point cursor, bool into_groups) double scale = prefs->getDouble("/tools/measure/scale", 100.0) / 100.0; int precision = prefs->getInt("/tools/measure/precision", 2); Glib::ustring unit_name = prefs->getString("/tools/measure/unit"); + bool only_selected = prefs->getBool("/tools/measure/only_selected", false); if (!unit_name.compare("")) { unit_name = "px"; } @@ -1185,6 +1192,14 @@ void MeasureTool::showInfoBox(Geom::Point cursor, bool into_groups) Geom::Point rel_position = Geom::Point(origin, origin); Geom::Point pos = desktop->w2d(cursor); double gap = Inkscape::Util::Quantity::convert(7 + fontsize, "px", unit->abbr); + if (only_selected) { + if (desktop->getSelection()->includes(over)) { + showItemInfoText(pos + (rel_position * zoom),_("Selected"),fontsize); + } else { + showItemInfoText(pos + (rel_position * zoom),_("Not selected"),fontsize); + } + rel_position = Geom::Point(rel_position[Geom::X], rel_position[Geom::Y] + gap); + } if (SP_IS_SHAPE(over)) { precision_str << _("Length") << ": %." << precision << "f %s"; measure_str = g_strdup_printf(precision_str.str().c_str(), item_length, unit_name.c_str()); @@ -1196,7 +1211,6 @@ void MeasureTool::showInfoBox(Geom::Point cursor, bool into_groups) showItemInfoText(pos + (rel_position * zoom),measure_str,fontsize); rel_position = Geom::Point(rel_position[Geom::X], rel_position[Geom::Y] + gap); } - precision_str << "Y: %." << precision << "f %s"; measure_str = g_strdup_printf(precision_str.str().c_str(), item_y, unit_name.c_str()); precision_str.str(""); @@ -1268,8 +1282,12 @@ void MeasureTool::showCanvasItems(bool to_guides, bool to_item, bool to_phantom, current_layer = desktop->currentLayer(); } std::vector<double> intersection_times; + bool only_selected = prefs->getBool("/tools/measure/only_selected", false); for (std::vector<SPItem*>::const_iterator i=items.begin(); i!=items.end(); ++i) { SPItem *item = *i; + if (!desktop->getSelection()->includes(*i) && only_selected) { + continue; + } if(all_layers || (layer_model && layer_model->layerForObject(item) == current_layer)){ if (SP_IS_SHAPE(item)) { calculate_intersections(desktop, item, lineseg, SP_SHAPE(item)->getCurve(), intersection_times); |
