summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Smith <john.smith7545@yahoo.com>2012-09-02 23:44:27 +0000
committerJohn Smith <john.smith7545@yahoo.com>2012-09-02 23:44:27 +0000
commitbd9e980c59453168a9d55a093564421b593e186e (patch)
tree6e577b37f7eb020878b2aa7a0cee482c685c4835 /src
parentconverted some c-string usage to c++ string class usage: should fix some memo... (diff)
downloadinkscape-bd9e980c59453168a9d55a093564421b593e186e.tar.gz
inkscape-bd9e980c59453168a9d55a093564421b593e186e.zip
Fix for 406044 : Esc with no selection, activates selection tool
(bzr r11647)
Diffstat (limited to 'src')
-rw-r--r--src/gradient-context.cpp3
-rw-r--r--src/selection-chemistry.cpp11
-rw-r--r--src/ui/tool/node-tool.cpp3
-rw-r--r--src/zoom-context.cpp4
4 files changed, 17 insertions, 4 deletions
diff --git a/src/gradient-context.cpp b/src/gradient-context.cpp
index cf7d6a26f..05bea14b9 100644
--- a/src/gradient-context.cpp
+++ b/src/gradient-context.cpp
@@ -47,6 +47,7 @@
#include "rubberband.h"
#include "document-undo.h"
#include "verbs.h"
+#include "selection-chemistry.h"
using Inkscape::DocumentUndo;
@@ -759,7 +760,7 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event)
if (drag->selected) {
drag->deselectAll();
} else {
- selection->clear();
+ Inkscape::SelectionHelper::selectNone(desktop);
}
ret = TRUE;
//TODO: make dragging escapable by Esc
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index 041bc4b2d..068928d8f 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -150,11 +150,18 @@ void SelectionHelper::selectAllInAll(SPDesktop *dt)
void SelectionHelper::selectNone(SPDesktop *dt)
{
+ InkNodeTool *nt = NULL;
if (tools_isactive(dt, TOOLS_NODES)) {
- InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
+ nt = static_cast<InkNodeTool*>(dt->event_context);
+ }
+
+ if (nt && !nt->_selected_nodes->empty()) {
nt->_selected_nodes->clear();
- } else {
+ } else if (!sp_desktop_selection(dt)->isEmpty()) {
sp_desktop_selection(dt)->clear();
+ } else {
+ // If nothing selected switch to selection tool
+ tools_switch(dt, TOOLS_SELECT);
}
}
diff --git a/src/ui/tool/node-tool.cpp b/src/ui/tool/node-tool.cpp
index 71c0d3b26..b532c8b65 100644
--- a/src/ui/tool/node-tool.cpp
+++ b/src/ui/tool/node-tool.cpp
@@ -41,6 +41,7 @@
#include "pixmaps/cursor-node.xpm"
#include "pixmaps/cursor-node-d.xpm"
+#include "selection-chemistry.h"
#include <gdk/gdkkeysyms.h>
@@ -517,7 +518,7 @@ gint ink_node_tool_root_handler(SPEventContext *event_context, GdkEvent *event)
{
case GDK_KEY_Escape: // deselect everything
if (nt->_selected_nodes->empty()) {
- selection->clear();
+ Inkscape::SelectionHelper::selectNone(desktop);
} else {
nt->_selected_nodes->clear();
}
diff --git a/src/zoom-context.cpp b/src/zoom-context.cpp
index 90a091440..58eefe97a 100644
--- a/src/zoom-context.cpp
+++ b/src/zoom-context.cpp
@@ -22,6 +22,7 @@
#include "pixmaps/cursor-zoom.xpm"
#include "pixmaps/cursor-zoom-out.xpm"
#include "preferences.h"
+#include "selection-chemistry.h"
#include "zoom-context.h"
@@ -216,6 +217,9 @@ static gint sp_zoom_context_root_handler(SPEventContext *event_context, GdkEvent
case GDK_KEY_PRESS:
switch (get_group0_keyval (&event->key)) {
case GDK_KEY_Escape:
+ if (!Inkscape::Rubberband::get(desktop)->is_started()) {
+ Inkscape::SelectionHelper::selectNone(desktop);
+ }
Inkscape::Rubberband::get(desktop)->stop();
xp = yp = 0;
escaped = true;