From 23eacbbc876cdef12857ca48725cee350ed4696f Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Thu, 14 Jan 2010 22:45:34 -0800 Subject: Restore encapsulation of selection implementation. (bzr r8983) --- src/verbs.cpp | 71 ++++++++--------------------------------------------------- 1 file changed, 9 insertions(+), 62 deletions(-) (limited to 'src/verbs.cpp') diff --git a/src/verbs.cpp b/src/verbs.cpp index 37f4da4d6..7c3652b36 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -16,6 +16,7 @@ * MenTaLguY * David Turner * bulia byak + * Jon A. Cruz * * Copyright (C) 2006 Johan Engelen * Copyright (C) (date unspecified) Authors @@ -49,7 +50,6 @@ #include "draw-context.h" #include "extension/effect.h" #include "file.h" -#include "gradient-context.h" #include "gradient-drag.h" #include "helper/action.h" #include "help.h" @@ -79,8 +79,6 @@ #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" //#ifdef WITH_INKBOARD @@ -835,7 +833,6 @@ EditVerb::perform(SPAction *action, void *data, void */*pdata*/) SPDesktop *dt = static_cast(sp_action_get_view(action)); if (!dt) return; - SPEventContext *ec = dt->event_context; switch (reinterpret_cast(data)) { case SP_VERB_EDIT_UNDO: @@ -920,70 +917,26 @@ EditVerb::perform(SPAction *action, void *data, void */*pdata*/) sp_edit_clear_all(dt); break; case SP_VERB_EDIT_SELECT_ALL: - if (tools_isactive(dt, TOOLS_NODES)) { - InkNodeTool *nt = static_cast(dt->event_context); - nt->_multipath->selectSubpaths(); - } else { - sp_edit_select_all(dt); - } + SelectionHelper::selectAll(dt); break; case SP_VERB_EDIT_INVERT: - if (tools_isactive(dt, TOOLS_NODES)) { - InkNodeTool *nt = static_cast(dt->event_context); - nt->_multipath->invertSelectionInSubpaths(); - } else { - sp_edit_invert(dt); - } + SelectionHelper::invert(dt); break; case SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS: - if (tools_isactive(dt, TOOLS_NODES)) { - InkNodeTool *nt = static_cast(dt->event_context); - nt->_selected_nodes->selectAll(); - } else { - sp_edit_select_all_in_all_layers(dt); - } + SelectionHelper::selectAllInAll(dt); break; case SP_VERB_EDIT_INVERT_IN_ALL_LAYERS: - if (tools_isactive(dt, TOOLS_NODES)) { - InkNodeTool *nt = static_cast(dt->event_context); - nt->_selected_nodes->invertSelection(); - } else { - sp_edit_invert_in_all_layers(dt); - } + SelectionHelper::invertAllInAll(dt); break; - case SP_VERB_EDIT_SELECT_NEXT: - if (tools_isactive(dt, TOOLS_NODES)) { - 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); - } else { - sp_selection_item_next(dt); - } + SelectionHelper::selectNext(dt); break; case SP_VERB_EDIT_SELECT_PREV: - if (tools_isactive(dt, TOOLS_NODES)) { - 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); - } else { - sp_selection_item_prev(dt); - } + SelectionHelper::selectPrev(dt); break; - case SP_VERB_EDIT_DESELECT: - if (tools_isactive(dt, TOOLS_NODES)) { - InkNodeTool *nt = static_cast(dt->event_context); - nt->_selected_nodes->clear(); - } else { - sp_desktop_selection(dt)->clear(); - } + SelectionHelper::selectNone(dt); break; - case SP_VERB_EDIT_GUIDES_AROUND_PAGE: sp_guide_create_guides_around_page(dt); break; @@ -1095,13 +1048,7 @@ SelectionVerb::perform(SPAction *action, void *data, void */*pdata*/) sp_selected_path_simplify(dt); break; case SP_VERB_SELECTION_REVERSE: - // 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); - } + SelectionHelper::reverse(dt); break; case SP_VERB_SELECTION_TRACE: inkscape_dialogs_unhide(); -- cgit v1.2.3