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 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 From d76e5c04397e2e7b24d19e1e586be0c0711f65b3 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Sun, 24 Jan 2010 18:28:26 +0100 Subject: Adding the Interpolate tutorial in Help>Tutorials (bzr r9019) --- src/verbs.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/verbs.cpp') diff --git a/src/verbs.cpp b/src/verbs.cpp index 7c3652b36..421736b7f 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -1855,8 +1855,8 @@ TutorialVerb::perform(SPAction */*action*/, void *data, void */*pdata*/) { switch (reinterpret_cast(data)) { case SP_VERB_TUTORIAL_BASIC: - /* TRANSLATORS: If you have translated the tutorial-basic.svg file to your language, - then translate this string as "tutorial-basic.LANG.svg" (where LANG is your language + /* TRANSLATORS: If you have translated the tutorial-basic.en.svgz file to your language, + then translate this string as "tutorial-basic.LANG.svgz" (where LANG is your language code); otherwise leave as "tutorial-basic.svg". */ sp_help_open_tutorial(NULL, (gpointer)_("tutorial-basic.svg")); break; @@ -1876,6 +1876,10 @@ TutorialVerb::perform(SPAction */*action*/, void *data, void */*pdata*/) // TRANSLATORS: See "tutorial-basic.svg" comment. sp_help_open_tutorial(NULL, (gpointer)_("tutorial-calligraphy.svg")); break; + case SP_VERB_TUTORIAL_INTERPOLATE: + // TRANSLATORS: See "tutorial-basic.svg" comment. + sp_help_open_tutorial(NULL, (gpointer)_("tutorial-interpolate.svg")); + break; case SP_VERB_TUTORIAL_DESIGN: // TRANSLATORS: See "tutorial-basic.svg" comment. sp_help_open_tutorial(NULL, (gpointer)_("tutorial-elements.svg")); @@ -2667,6 +2671,8 @@ Verb *Verb::_base_verbs[] = { N_("Using bitmap tracing"), NULL/*"tutorial_tracing"*/), new TutorialVerb(SP_VERB_TUTORIAL_CALLIGRAPHY, "TutorialsCalligraphy", N_("Inkscape: _Calligraphy"), N_("Using the Calligraphy pen tool"), NULL), + new TutorialVerb(SP_VERB_TUTORIAL_INTERPOLATE, "TutorialsInterpolate", N_("Inkscape: _Interpolate"), + N_("Using the interpolate extension"), NULL/*"tutorial_interpolate"*/), new TutorialVerb(SP_VERB_TUTORIAL_DESIGN, "TutorialsDesign", N_("_Elements of Design"), N_("Principles of design in the tutorial form"), NULL/*"tutorial_design"*/), new TutorialVerb(SP_VERB_TUTORIAL_TIPS, "TutorialsTips", N_("_Tips and Tricks"), -- cgit v1.2.3 From 0dff587c9dd7ac0b02fc93f58883e24cd2d4e92e Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Sun, 28 Feb 2010 18:38:28 +0100 Subject: Compilation fixes for Windows 64-bit by Fridrich (bzr r9118) --- src/verbs.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/verbs.cpp') diff --git a/src/verbs.cpp b/src/verbs.cpp index 421736b7f..f9a544186 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -767,7 +767,7 @@ FileVerb::perform(SPAction *action, void *data, void */*pdata*/) Gtk::Window *parent = desktop->getToplevel(); g_assert(parent != NULL); - switch ((long) data) { + switch (reinterpret_cast(data)) { case SP_VERB_FILE_NEW: sp_file_new_default(); break; @@ -1079,7 +1079,7 @@ void LayerVerb::perform(SPAction *action, void *data, void */*pdata*/) { SPDesktop *dt = static_cast(sp_action_get_view(action)); - unsigned int verb = reinterpret_cast(data); + size_t verb = reinterpret_cast(data); if ( !dt || !dt->currentLayer() ) { return; @@ -1568,7 +1568,7 @@ ZoomVerb::perform(SPAction *action, void *data, void */*pdata*/) gdouble zoom_inc = prefs->getDoubleLimited( "/options/zoomincrement/value", 1.414213562, 1.01, 10 ); - switch (GPOINTER_TO_INT(data)) { + switch (reinterpret_cast(data)) { case SP_VERB_ZOOM_IN: { gint mul = 1 + gobble_key_events( @@ -2025,7 +2025,7 @@ EffectLastVerb::perform(SPAction *action, void *data, void */*pdata*/) if (effect == NULL) return; if (current_view == NULL) return; - switch ((long) data) { + switch (reinterpret_cast(data)) { case SP_VERB_EFFECT_LAST_PREF: effect->prefs(current_view); break; @@ -2090,7 +2090,7 @@ FitCanvasVerb::perform(SPAction *action, void *data, void */*pdata*/) SPDocument *doc = sp_desktop_document(dt); if (!doc) return; - switch ((long) data) { + switch (reinterpret_cast(data)) { case SP_VERB_FIT_CANVAS_TO_SELECTION: verb_fit_canvas_to_selection(dt); break; @@ -2159,7 +2159,7 @@ LockAndHideVerb::perform(SPAction *action, void *data, void */*pdata*/) SPDocument *doc = sp_desktop_document(dt); if (!doc) return; - switch ((long) data) { + switch (reinterpret_cast(data)) { case SP_VERB_UNLOCK_ALL: unlock_all(dt); sp_document_done(doc, SP_VERB_UNLOCK_ALL, _("Unlock all objects in the current layer")); -- cgit v1.2.3 From 847b4f57816ba691e471cf891beca6d263438f03 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Thu, 18 Mar 2010 23:21:16 -0700 Subject: Cleanup of SP_ACTIVE_DESKTOP to prepare clipboard code for reuse. (bzr r9209) --- src/verbs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/verbs.cpp') diff --git a/src/verbs.cpp b/src/verbs.cpp index f9a544186..dc1116953 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -845,7 +845,7 @@ EditVerb::perform(SPAction *action, void *data, void */*pdata*/) sp_selection_cut(dt); break; case SP_VERB_EDIT_COPY: - sp_selection_copy(); + sp_selection_copy(dt); break; case SP_VERB_EDIT_PASTE: sp_selection_paste(dt, false); -- cgit v1.2.3