X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fui%2Ftool%2Fmulti-path-manipulator.cpp;h=5f60f117a3d0ceb32aa4dfb5e03d58799613e9dc;hb=6aba22359627ef015ee03b85e4b7b5b98684b834;hp=2025a12d7b4826cc54f7de1d9306792eec78dabc;hpb=76ed722031d5028acba4392554558ad9df9e26ce;p=inkscape.git diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index 2025a12d7..5f60f117a 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -3,6 +3,7 @@ */ /* Authors: * Krzysztof Kosiński + * Abhishek Sharma * * Copyright (C) 2009 Authors * Released under GNU GPL, read the file 'COPYING' for more information @@ -220,11 +221,29 @@ void MultiPathManipulator::invertSelectionInSubpaths() void MultiPathManipulator::setNodeType(NodeType type) { if (_selection.empty()) return; + + // When all selected nodes are already cusp, retract their handles + bool retract_handles = (type == NODE_CUSP); + for (ControlPointSelection::iterator i = _selection.begin(); i != _selection.end(); ++i) { Node *node = dynamic_cast(*i); - if (node) node->setType(type); + if (node) { + retract_handles &= (node->type() == NODE_CUSP); + node->setType(type); + } } - _done(_("Change node type")); + + if (retract_handles) { + for (ControlPointSelection::iterator i = _selection.begin(); i != _selection.end(); ++i) { + Node *node = dynamic_cast(*i); + if (node) { + node->front()->retract(); + node->back()->retract(); + } + } + } + + _done(retract_handles ? _("Retract handles") : _("Change node type")); } void MultiPathManipulator::setSegmentType(SegmentType type) @@ -244,6 +263,12 @@ void MultiPathManipulator::insertNodes() _done(_("Add nodes")); } +void MultiPathManipulator::duplicateNodes() +{ + invokeForAll(&PathManipulator::duplicateNodes); + _done(_("Duplicate nodes")); +} + void MultiPathManipulator::joinNodes() { invokeForAll(&PathManipulator::hideDragPoint); @@ -513,6 +538,12 @@ bool MultiPathManipulator::event(GdkEvent *event) return true; } break; + case GDK_d: + case GDK_D: + if (held_only_shift(event->key)) { + duplicateNodes(); + return true; + } case GDK_j: case GDK_J: if (held_only_shift(event->key)) { @@ -591,6 +622,20 @@ bool MultiPathManipulator::event(GdkEvent *event) return true; } break; + case GDK_l: + case GDK_L: + if (held_only_shift(event->key)) { + // Shift+L - make segments linear + setSegmentType(SEGMENT_STRAIGHT); + return true; + } + case GDK_u: + case GDK_U: + if (held_only_shift(event->key)) { + // Shift+L - make segments curves + setSegmentType(SEGMENT_CUBIC_BEZIER); + return true; + } default: break; } @@ -650,6 +695,14 @@ void MultiPathManipulator::_commit(CommitEvent cps) reason = _("Scale nodes vertically"); key = "node:scale:y"; break; + case COMMIT_MOUSE_SKEW_X: + reason = _("Skew nodes horizontally"); + key = "node:skew:x"; + break; + case COMMIT_MOUSE_SKEW_Y: + reason = _("Skew nodes vertically"); + key = "node:skew:y"; + break; case COMMIT_FLIP_X: reason = _("Flip nodes horizontally"); break; @@ -662,9 +715,9 @@ void MultiPathManipulator::_commit(CommitEvent cps) _selection.signal_update.emit(); invokeForAll(&PathManipulator::writeXML); if (key) { - sp_document_maybe_done(sp_desktop_document(_desktop), key, SP_VERB_CONTEXT_NODE, reason); + DocumentUndo::maybeDone(sp_desktop_document(_desktop), key, SP_VERB_CONTEXT_NODE, reason); } else { - sp_document_done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_NODE, reason); + DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_NODE, reason); } signal_coords_changed.emit(); } @@ -673,7 +726,7 @@ void MultiPathManipulator::_commit(CommitEvent cps) void MultiPathManipulator::_done(gchar const *reason) { invokeForAll(&PathManipulator::update); invokeForAll(&PathManipulator::writeXML); - sp_document_done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_NODE, reason); + DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_NODE, reason); signal_coords_changed.emit(); } @@ -714,4 +767,4 @@ guint32 MultiPathManipulator::_getOutlineColor(ShapeRole role) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :