diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2010-03-14 17:38:50 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2010-03-14 17:38:50 +0000 |
| commit | 90e813701a7865bc36755fb0f35ab74c4b6963a2 (patch) | |
| tree | 460a5260664b3e83e736918f5d2594445c3761c7 /src/ui/tool/multi-path-manipulator.cpp | |
| parent | disable console output on windows per default, as this probably annoys many b... (diff) | |
| download | inkscape-90e813701a7865bc36755fb0f35ab74c4b6963a2.tar.gz inkscape-90e813701a7865bc36755fb0f35ab74c4b6963a2.zip | |
Implement keyboard shortcuts for single handle adjustments.
Minor disambiguating cleanup in node.h.
(bzr r9190)
Diffstat (limited to 'src/ui/tool/multi-path-manipulator.cpp')
| -rw-r--r-- | src/ui/tool/multi-path-manipulator.cpp | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index 9accbd0ae..fe97058c4 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -440,9 +440,60 @@ void MultiPathManipulator::updateOutlineColors() bool MultiPathManipulator::event(GdkEvent *event) { + _tracker.event(event); + guint key = 0; + if (event->type == GDK_KEY_PRESS) { + key = shortcut_key(event->key); + } + + // Single handle adjustments go here. + if (_selection.size() == 1 && event->type == GDK_KEY_PRESS) { + do { + Node *n = dynamic_cast<Node *>(*_selection.begin()); + if (!n) break; + + PathManipulator &pm = n->nodeList().subpathList().pm(); + + int which = 0; + if (_tracker.rightAlt() || _tracker.rightControl()) { + which = 1; + } + if (_tracker.leftAlt() || _tracker.leftControl()) { + if (which != 0) break; // ambiguous + which = -1; + } + if (which == 0) break; // no handle chosen + bool one_pixel = _tracker.leftAlt() || _tracker.rightAlt(); + + switch (key) { + // single handle functions + // rotation + case GDK_bracketleft: + case GDK_braceleft: + pm.rotateHandle(n, which, 1, one_pixel); + break; + case GDK_bracketright: + case GDK_braceright: + pm.rotateHandle(n, which, -1, one_pixel); + break; + // adjust length + case GDK_period: + case GDK_greater: + pm.scaleHandle(n, which, 1, one_pixel); + break; + case GDK_comma: + case GDK_less: + pm.scaleHandle(n, which, -1, one_pixel); + break; + } + return true; + } while(0); + } + + switch (event->type) { case GDK_KEY_PRESS: - switch (shortcut_key(event->key)) { + switch (key) { case GDK_Insert: case GDK_KP_Insert: // Insert - insert nodes in the middle of selected segments |
