From 31bb8269c26a781036448ed8f8cd93cc84fb2118 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Sun, 29 Nov 2009 16:33:18 +0100 Subject: First GSoC node tool commit to Bazaar (bzr r8846.1.1) --- src/verbs.cpp | 65 +++++++++++++++++++++++------------------------------------ 1 file changed, 25 insertions(+), 40 deletions(-) (limited to 'src/verbs.cpp') 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(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(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(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(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(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(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(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(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; -- cgit v1.2.3 From b52865a71a9f83da9719a3ec5f50a4a2cd7cdace Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Sun, 10 Jan 2010 01:46:28 +0100 Subject: * Implement node snapping. * Fix minor bug in linear grow. * Add --fixes. * Move some node selection-related functions to ControlPointSelection. Fixed bugs: - https://launchpad.net/bugs/170561 - https://launchpad.net/bugs/171893 - https://launchpad.net/bugs/182585 - https://launchpad.net/bugs/446773 (bzr r8846.2.9) --- src/verbs.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/verbs.cpp') diff --git a/src/verbs.cpp b/src/verbs.cpp index d26a4e6d5..f03be681a 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -79,6 +79,7 @@ #include "ui/dialog/layers.h" #include "ui/dialog/swatches.h" #include "ui/icon-names.h" +#include "ui/tool/control-point-selection.h" #include "ui/tool/multi-path-manipulator.h" #include "ui/tool/node-tool.h" @@ -937,7 +938,7 @@ EditVerb::perform(SPAction *action, void *data, void */*pdata*/) case SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS: if (tools_isactive(dt, TOOLS_NODES)) { InkNodeTool *nt = static_cast(dt->event_context); - nt->_multipath->selectAll(); + nt->_selected_nodes->selectAll(); } else { sp_edit_select_all_in_all_layers(dt); } @@ -945,7 +946,7 @@ EditVerb::perform(SPAction *action, void *data, void */*pdata*/) case SP_VERB_EDIT_INVERT_IN_ALL_LAYERS: if (tools_isactive(dt, TOOLS_NODES)) { InkNodeTool *nt = static_cast(dt->event_context); - nt->_multipath->invertSelection(); + nt->_selected_nodes->invertSelection(); } else { sp_edit_invert_in_all_layers(dt); } @@ -977,7 +978,7 @@ EditVerb::perform(SPAction *action, void *data, void */*pdata*/) case SP_VERB_EDIT_DESELECT: if (tools_isactive(dt, TOOLS_NODES)) { InkNodeTool *nt = static_cast(dt->event_context); - nt->_multipath->deselect(); + nt->_selected_nodes->clear(); } else { sp_desktop_selection(dt)->clear(); } -- cgit v1.2.3