summaryrefslogtreecommitdiffstats
path: root/src/verbs.cpp
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2009-11-29 15:33:18 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2009-11-29 15:33:18 +0000
commit31bb8269c26a781036448ed8f8cd93cc84fb2118 (patch)
treec714ce9b38e9b75680b61e7e0992aa2ab40e2584 /src/verbs.cpp
parentDeprecation warning fix on xcf export (diff)
downloadinkscape-31bb8269c26a781036448ed8f8cd93cc84fb2118.tar.gz
inkscape-31bb8269c26a781036448ed8f8cd93cc84fb2118.zip
First GSoC node tool commit to Bazaar
(bzr r8846.1.1)
Diffstat (limited to 'src/verbs.cpp')
-rw-r--r--src/verbs.cpp65
1 files changed, 25 insertions, 40 deletions
diff --git a/src/verbs.cpp b/src/verbs.cpp
index 29d24c101..d26a4e6d5 100644
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
@@ -58,7 +58,6 @@
#include "layer-fns.h"
#include "layer-manager.h"
#include "message-stack.h"
-#include "node-context.h"
#include "path-chemistry.h"
#include "preferences.h"
#include "select-context.h"
@@ -80,6 +79,8 @@
#include "ui/dialog/layers.h"
#include "ui/dialog/swatches.h"
#include "ui/icon-names.h"
+#include "ui/tool/multi-path-manipulator.h"
+#include "ui/tool/node-tool.h"
//#ifdef WITH_INKBOARD
//#include "jabber_whiteboard/session-manager.h"
@@ -919,28 +920,32 @@ EditVerb::perform(SPAction *action, void *data, void */*pdata*/)
break;
case SP_VERB_EDIT_SELECT_ALL:
if (tools_isactive(dt, TOOLS_NODES)) {
- ec->shape_editor->select_all_from_subpath(false);
+ InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
+ nt->_multipath->selectSubpaths();
} else {
sp_edit_select_all(dt);
}
break;
case SP_VERB_EDIT_INVERT:
if (tools_isactive(dt, TOOLS_NODES)) {
- ec->shape_editor->select_all_from_subpath(true);
+ InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
+ nt->_multipath->invertSelectionInSubpaths();
} else {
sp_edit_invert(dt);
}
break;
case SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS:
if (tools_isactive(dt, TOOLS_NODES)) {
- ec->shape_editor->select_all(false);
+ InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
+ nt->_multipath->selectAll();
} else {
sp_edit_select_all_in_all_layers(dt);
}
break;
case SP_VERB_EDIT_INVERT_IN_ALL_LAYERS:
if (tools_isactive(dt, TOOLS_NODES)) {
- ec->shape_editor->select_all(true);
+ InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
+ nt->_multipath->invertSelection();
} else {
sp_edit_invert_in_all_layers(dt);
}
@@ -948,7 +953,8 @@ EditVerb::perform(SPAction *action, void *data, void */*pdata*/)
case SP_VERB_EDIT_SELECT_NEXT:
if (tools_isactive(dt, TOOLS_NODES)) {
- ec->shape_editor->select_next();
+ InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
+ nt->_multipath->shiftSelection(1);
} else if (tools_isactive(dt, TOOLS_GRADIENT)
&& ec->_grdrag->isNonEmpty()) {
sp_gradient_context_select_next (ec);
@@ -958,7 +964,8 @@ EditVerb::perform(SPAction *action, void *data, void */*pdata*/)
break;
case SP_VERB_EDIT_SELECT_PREV:
if (tools_isactive(dt, TOOLS_NODES)) {
- ec->shape_editor->select_prev();
+ InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
+ nt->_multipath->shiftSelection(-1);
} else if (tools_isactive(dt, TOOLS_GRADIENT)
&& ec->_grdrag->isNonEmpty()) {
sp_gradient_context_select_prev (ec);
@@ -969,7 +976,8 @@ EditVerb::perform(SPAction *action, void *data, void */*pdata*/)
case SP_VERB_EDIT_DESELECT:
if (tools_isactive(dt, TOOLS_NODES)) {
- ec->shape_editor->deselect();
+ InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
+ nt->_multipath->deselect();
} else {
sp_desktop_selection(dt)->clear();
}
@@ -1086,7 +1094,13 @@ SelectionVerb::perform(SPAction *action, void *data, void */*pdata*/)
sp_selected_path_simplify(dt);
break;
case SP_VERB_SELECTION_REVERSE:
- sp_selected_path_reverse(dt);
+ // TODO make this a virtual method of event context!
+ if (tools_isactive(dt, TOOLS_NODES)) {
+ InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
+ nt->_multipath->reverseSubpaths();
+ } else {
+ sp_selected_path_reverse(dt);
+ }
break;
case SP_VERB_SELECTION_TRACE:
inkscape_dialogs_unhide();
@@ -1365,41 +1379,12 @@ ObjectVerb::perform( SPAction *action, void *data, void */*pdata*/ )
flowtext_to_text();
break;
case SP_VERB_OBJECT_FLIP_HORIZONTAL:
- // When working with the node tool ...
- if (tools_isactive(dt, TOOLS_NODES)) {
- Inkscape::NodePath::Node *active_node = Inkscape::NodePath::Path::active_node;
-
- // ... and one of the nodes is currently mouseovered ...
- if (active_node) {
-
- // ... flip the selected nodes about that node
- ec->shape_editor->flip(Geom::X, active_node->pos);
- } else {
-
- // ... or else about the center of their bounding box.
- ec->shape_editor->flip(Geom::X);
- }
-
- // When working with the selector tool, flip the selection about its rotation center
- // (if it is visible) or about the center of the bounding box.
- } else {
- sp_selection_scale_relative(sel, center, Geom::Scale(-1.0, 1.0));
- }
+ sp_selection_scale_relative(sel, center, Geom::Scale(-1.0, 1.0));
sp_document_done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_HORIZONTAL,
_("Flip horizontally"));
break;
case SP_VERB_OBJECT_FLIP_VERTICAL:
- // The behaviour is analogous to flipping horizontally
- if (tools_isactive(dt, TOOLS_NODES)) {
- Inkscape::NodePath::Node *active_node = Inkscape::NodePath::Path::active_node;
- if (active_node) {
- ec->shape_editor->flip(Geom::Y, active_node->pos);
- } else {
- ec->shape_editor->flip(Geom::Y);
- }
- } else {
- sp_selection_scale_relative(sel, center, Geom::Scale(1.0, -1.0));
- }
+ sp_selection_scale_relative(sel, center, Geom::Scale(1.0, -1.0));
sp_document_done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_VERTICAL,
_("Flip vertically"));
break;