diff options
author | Neil <nyamatongwe@gmail.com> | 2017-06-12 13:49:46 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2017-06-12 13:49:46 +1000 |
commit | c94124bb05c4386863c160bb44d5592ba4fe989e (patch) | |
tree | 5086197e32cbf91efb8edd7e87f16a7d99cfead7 /src/Editor.cxx | |
parent | e015bc583b10e4f3a9889c9ae296de000d1d4646 (diff) | |
download | scintilla-mirror-c94124bb05c4386863c160bb44d5592ba4fe989e.tar.gz |
Backport: Simplify mouse and keyboard handling by only retaining the 'WithModifiers" form.
All events include a set of keyboard modifier flags.
Older calls that passed individual parameters for each key were removed.
Backport of changeset 6310:af83baede430.
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r-- | src/Editor.cxx | 48 |
1 files changed, 6 insertions, 42 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index 771353654..82c63dfb8 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -2340,10 +2340,6 @@ void Editor::NotifyDoubleClick(Point pt, int modifiers) { NotifyParent(scn); } -void Editor::NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt) { - NotifyDoubleClick(pt, ModifierFlags(shift, ctrl, alt)); -} - void Editor::NotifyHotSpotDoubleClicked(Sci::Position position, int modifiers) { SCNotification scn = {}; scn.nmhdr.code = SCN_HOTSPOTDOUBLECLICK; @@ -2352,10 +2348,6 @@ void Editor::NotifyHotSpotDoubleClicked(Sci::Position position, int modifiers) { NotifyParent(scn); } -void Editor::NotifyHotSpotDoubleClicked(Sci::Position position, bool shift, bool ctrl, bool alt) { - NotifyHotSpotDoubleClicked(position, ModifierFlags(shift, ctrl, alt)); -} - void Editor::NotifyHotSpotClicked(Sci::Position position, int modifiers) { SCNotification scn = {}; scn.nmhdr.code = SCN_HOTSPOTCLICK; @@ -2364,10 +2356,6 @@ void Editor::NotifyHotSpotClicked(Sci::Position position, int modifiers) { NotifyParent(scn); } -void Editor::NotifyHotSpotClicked(Sci::Position position, bool shift, bool ctrl, bool alt) { - NotifyHotSpotClicked(position, ModifierFlags(shift, ctrl, alt)); -} - void Editor::NotifyHotSpotReleaseClick(Sci::Position position, int modifiers) { SCNotification scn = {}; scn.nmhdr.code = SCN_HOTSPOTRELEASECLICK; @@ -2376,10 +2364,6 @@ void Editor::NotifyHotSpotReleaseClick(Sci::Position position, int modifiers) { NotifyParent(scn); } -void Editor::NotifyHotSpotReleaseClick(Sci::Position position, bool shift, bool ctrl, bool alt) { - NotifyHotSpotReleaseClick(position, ModifierFlags(shift, ctrl, alt)); -} - bool Editor::NotifyUpdateUI() { if (needUpdateUI) { SCNotification scn = {}; @@ -2410,10 +2394,6 @@ void Editor::NotifyIndicatorClick(bool click, Sci::Position position, int modifi } } -void Editor::NotifyIndicatorClick(bool click, Sci::Position position, bool shift, bool ctrl, bool alt) { - NotifyIndicatorClick(click, position, ModifierFlags(shift, ctrl, alt)); -} - bool Editor::NotifyMarginClick(Point pt, int modifiers) { const int marginClicked = vs.MarginFromLocation(pt); if ((marginClicked >= 0) && vs.ms[marginClicked].sensitive) { @@ -2452,10 +2432,6 @@ bool Editor::NotifyMarginClick(Point pt, int modifiers) { } } -bool Editor::NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt) { - return NotifyMarginClick(pt, ModifierFlags(shift, ctrl, alt)); -} - bool Editor::NotifyMarginRightClick(Point pt, int modifiers) { int marginRightClicked = vs.MarginFromLocation(pt); if ((marginRightClicked >= 0) && vs.ms[marginRightClicked].sensitive) { @@ -3882,10 +3858,6 @@ int Editor::KeyDownWithModifiers(int key, int modifiers, bool *consumed) { } } -int Editor::KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed) { - return KeyDownWithModifiers(key, ModifierFlags(shift, ctrl, alt), consumed); -} - void Editor::Indent(bool forwards) { UndoGroup ug(pdoc); for (size_t r=0; r<sel.Count(); r++) { @@ -4630,10 +4602,6 @@ void Editor::RightButtonDownWithModifiers(Point pt, unsigned int, int modifiers) return; } -void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) { - return ButtonDownWithModifiers(pt, curTime, ModifierFlags(shift, ctrl, alt)); -} - bool Editor::PositionIsHotspot(Sci::Position position) const { return vs.styles[pdoc->StyleIndexAt(position)].hotspot; } @@ -4703,7 +4671,7 @@ Range Editor::GetHotSpotRange() const { return hotspot; } -void Editor::ButtonMoveWithModifiers(Point pt, int modifiers) { +void Editor::ButtonMoveWithModifiers(Point pt, unsigned int, int modifiers) { if ((ptMouseLast.x != pt.x) || (ptMouseLast.y != pt.y)) { DwellEnd(true); } @@ -4830,11 +4798,7 @@ void Editor::ButtonMoveWithModifiers(Point pt, int modifiers) { } } -void Editor::ButtonMove(Point pt) { - ButtonMoveWithModifiers(pt, 0); -} - -void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) { +void Editor::ButtonUpWithModifiers(Point pt, unsigned int curTime, int modifiers) { //Platform::DebugPrintf("ButtonUp %d %d\n", HaveMouseCapture(), inDragDrop); SelectionPosition newPos = SPositionFromLocation(pt, false, false, AllowVirtualSpace(virtualSpaceOptions, sel.IsRectangular())); @@ -4851,7 +4815,7 @@ void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) { hotSpotClickPos = INVALID_POSITION; SelectionPosition newCharPos = SPositionFromLocation(pt, false, true, false); newCharPos = MovePositionOutsideChar(newCharPos, -1); - NotifyHotSpotReleaseClick(newCharPos.Position(), ctrl ? SCI_CTRL : 0); + NotifyHotSpotReleaseClick(newCharPos.Position(), modifiers & SCI_CTRL); } if (HaveMouseCapture()) { if (PointInSelMargin(pt)) { @@ -4872,7 +4836,7 @@ void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) { if (selStart < selEnd) { if (drag.Length()) { const int length = static_cast<int>(drag.Length()); - if (ctrl) { + if (modifiers & SCI_CTRL) { const Sci::Position lengthInserted = pdoc->InsertString( newPos.Position(), drag.Data(), length); if (lengthInserted > 0) { @@ -4929,7 +4893,7 @@ void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) { void Editor::Tick() { if (HaveMouseCapture()) { // Auto scroll - ButtonMove(ptMouseLast); + ButtonMoveWithModifiers(ptMouseLast, 0, 0); } if (caret.period > 0) { timer.ticksToWait -= timer.tickSize; @@ -4996,7 +4960,7 @@ void Editor::TickFor(TickReason reason) { break; case tickScroll: // Auto scroll - ButtonMove(ptMouseLast); + ButtonMoveWithModifiers(ptMouseLast, 0, 0); break; case tickWiden: SetScrollBars(); |