index a455567e834ca2378f587ab7c1fc6966115bfd15..ef1c764bbb35c0f35161a42093fa59e2c0c1dad8 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);
+ }
+ }
+
+ 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(_("Change node type"));
+
+ _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;
}
_selection.signal_update.emit();
invokeForAll(&PathManipulator::writeXML);
if (key) {
- SPDocumentUndo::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 {
- SPDocumentUndo::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);
- SPDocumentUndo::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 :