index 2025a12d7b4826cc54f7de1d9306792eec78dabc..5f60f117a3d0ceb32aa4dfb5e03d58799613e9dc 100644 (file)
*/
/* Authors:
* Krzysztof KosiĆski <tweenk.pl@gmail.com>
+ * Abhishek Sharma
*
* Copyright (C) 2009 Authors
* Released under GNU GPL, read the file 'COPYING' for more information
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<Node*>(*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<Node*>(*i);
+ if (node) {
+ node->front()->retract();
+ node->back()->retract();
+ }
+ }
+ }
+
+ _done(retract_handles ? _("Retract handles") : _("Change node type"));
}
void MultiPathManipulator::setSegmentType(SegmentType type)
_done(_("Add nodes"));
}
+void MultiPathManipulator::duplicateNodes()
+{
+ invokeForAll(&PathManipulator::duplicateNodes);
+ _done(_("Duplicate nodes"));
+}
+
void MultiPathManipulator::joinNodes()
{
invokeForAll(&PathManipulator::hideDragPoint);
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)) {
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;
}
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;
_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();
}
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();
}
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 :