summaryrefslogtreecommitdiffstats
path: root/src/ui/tools/measure-tool.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2016-02-07 15:49:01 +0000
committerJabiertxof <jtx@jtx.marker.es>2016-02-07 15:49:01 +0000
commit6dd9c76e7f80d1ff7bad7be293272802bb7c1ac7 (patch)
treefd94e14eccd5772264c022a25920d35ba274a5ed /src/ui/tools/measure-tool.cpp
parentFix for bug 1540518. Improved performance based on previous meassure code com... (diff)
downloadinkscape-6dd9c76e7f80d1ff7bad7be293272802bb7c1ac7.tar.gz
inkscape-6dd9c76e7f80d1ff7bad7be293272802bb7c1ac7.zip
Add knot position dialog to meassure with Shift+Click
(bzr r14636)
Diffstat (limited to 'src/ui/tools/measure-tool.cpp')
-rw-r--r--src/ui/tools/measure-tool.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/ui/tools/measure-tool.cpp b/src/ui/tools/measure-tool.cpp
index c40d2581e..e6e926d92 100644
--- a/src/ui/tools/measure-tool.cpp
+++ b/src/ui/tools/measure-tool.cpp
@@ -10,8 +10,11 @@
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
-
+#include <gtkmm.h>
#include <gdk/gdkkeysyms.h>
#include <boost/none_t.hpp>
#include "util/units.h"
@@ -32,6 +35,7 @@
#include <2geom/crossing.h>
#include <2geom/angle.h>
#include <2geom/transforms.h>
+#include "ui/dialog/knot-properties.h"
#include "sp-namedview.h"
#include "sp-shape.h"
#include "sp-text.h"
@@ -48,11 +52,11 @@
#include "document-undo.h"
#include "viewbox.h"
#include "snap.h"
+#include "knot.h"
#include "text-editing.h"
#include "pixmaps/cursor-measure.xpm"
#include "preferences.h"
#include "inkscape.h"
-#include "knot.h"
#include "enums.h"
#include "knot-enums.h"
#include "desktop-style.h"
@@ -338,13 +342,13 @@ MeasureTool::MeasureTool()
end_p = readMeasurePoint(false);
dimension_offset = 35;
// create the knots
- this->knot_start = new SPKnot(desktop, N_("Measure start"));
+ this->knot_start = new SPKnot(desktop, N_("Measure start, <b>Shift+Click</b> for position dialog"));
this->knot_start->setMode(SP_KNOT_MODE_XOR);
this->knot_start->setFill(MT_KNOT_COLOR_NORMAL, MT_KNOT_COLOR_MOUSEOVER, MT_KNOT_COLOR_MOUSEOVER);
this->knot_start->setStroke(0x0000007f, 0x0000007f, 0x0000007f);
this->knot_start->setShape(SP_KNOT_SHAPE_CIRCLE);
this->knot_start->updateCtrl();
- this->knot_end = new SPKnot(desktop, N_("Measure end"));
+ this->knot_end = new SPKnot(desktop, N_("Measure end, <b>Shift+Click</b> for position dialog"));
this->knot_end->setMode(SP_KNOT_MODE_XOR);
this->knot_end->setFill(MT_KNOT_COLOR_NORMAL, MT_KNOT_COLOR_MOUSEOVER, MT_KNOT_COLOR_MOUSEOVER);
this->knot_end->setStroke(0x0000007f, 0x0000007f, 0x0000007f);
@@ -365,8 +369,10 @@ MeasureTool::MeasureTool()
}
this->_knot_start_moved_connection = this->knot_start->moved_signal.connect(sigc::mem_fun(*this, &MeasureTool::knotStartMovedHandler));
+ this->_knot_start_click_connection = this->knot_start->click_signal.connect(sigc::mem_fun(*this, &MeasureTool::knotClickHandler));
this->_knot_start_ungrabbed_connection = this->knot_start->ungrabbed_signal.connect(sigc::mem_fun(*this, &MeasureTool::knotUngrabbedHandler));
this->_knot_end_moved_connection = this->knot_end->moved_signal.connect(sigc::mem_fun(*this, &MeasureTool::knotEndMovedHandler));
+ this->_knot_end_click_connection = this->knot_end->click_signal.connect(sigc::mem_fun(*this, &MeasureTool::knotClickHandler));
this->_knot_end_ungrabbed_connection = this->knot_end->ungrabbed_signal.connect(sigc::mem_fun(*this, &MeasureTool::knotUngrabbedHandler));
}
@@ -444,6 +450,16 @@ void MeasureTool::reverseKnots()
this->showCanvasItems();
}
+void MeasureTool::knotClickHandler(SPKnot *knot, guint state)
+{
+ if (state & GDK_SHIFT_MASK) {
+ SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ Glib::ustring const unit_name = prefs->getString("/tools/measure/unit");
+ Inkscape::UI::Dialogs::KnotPropertiesDialog::showDialog(desktop, knot, unit_name);
+ }
+}
+
void MeasureTool::knotStartMovedHandler(SPKnot */*knot*/, Geom::Point const &ppointer, guint state)
{
Geom::Point point = this->knot_start->position();