diff options
author | nyamatongwe <unknown> | 2010-10-11 21:40:17 +1100 |
---|---|---|
committer | nyamatongwe <unknown> | 2010-10-11 21:40:17 +1100 |
commit | 66c09167ac82b63f4584ffd28ad425194811595b (patch) | |
tree | 7ac755258f485f98c53e4fe7423831d5a24040c1 /src | |
parent | 54cd02b4bbe654fea892975d46cd9071a7fc891e (diff) | |
download | scintilla-mirror-66c09167ac82b63f4584ffd28ad425194811595b.tar.gz |
Feature request #3082409 implemented for SCN_HOTSPOTRELEASECLICK event.
Contributed by Farshid Lashkari.
Diffstat (limited to 'src')
-rw-r--r-- | src/Editor.cxx | 22 | ||||
-rw-r--r-- | src/Editor.h | 2 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index d180e6194..681cb12cd 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -135,6 +135,7 @@ Editor::Editor() { dropWentOutside = false; posDrag = SelectionPosition(invalidPosition); posDrop = SelectionPosition(invalidPosition); + hotSpotClickPos = INVALID_POSITION; selectionType = selChar; lastXChosen = 0; @@ -4198,6 +4199,15 @@ void Editor::NotifyHotSpotClicked(int position, bool shift, bool ctrl, bool alt) NotifyParent(scn); } +void Editor::NotifyHotSpotReleaseClick(int position, bool shift, bool ctrl, bool alt) { + SCNotification scn = {0}; + scn.nmhdr.code = SCN_HOTSPOTRELEASECLICK; + scn.position = position; + scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | + (alt ? SCI_ALT : 0); + NotifyParent(scn); +} + void Editor::NotifyUpdateUI() { SCNotification scn = {0}; scn.nmhdr.code = SCN_UPDATEUI; @@ -5939,6 +5949,7 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b } else { if (PointIsHotspot(pt)) { NotifyHotSpotClicked(newPos.Position(), shift, ctrl, alt); + hotSpotClickPos = PositionFromLocation(pt,true,false); } if (!shift) { if (PointInSelection(pt) && !SelectionEmpty()) @@ -6118,6 +6129,13 @@ void Editor::ButtonMove(Point pt) { if (hsStart != -1 && !PositionIsHotspot(movePos.Position())) SetHotSpotRange(NULL); + if (hotSpotClickPos != INVALID_POSITION && PositionFromLocation(pt,true,false) != hotSpotClickPos ) { + if (inDragDrop == ddNone) { + DisplayCursor(Window::cursorText); + } + hotSpotClickPos = INVALID_POSITION; + } + } else { if (vs.fixedColumnWidth > 0) { // There is a margin if (PointInSelMargin(pt)) { @@ -6148,6 +6166,10 @@ void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) { inDragDrop = ddNone; SetEmptySelection(newPos.Position()); } + if (hotSpotClickPos != INVALID_POSITION && PointIsHotspot(pt)) { + hotSpotClickPos = INVALID_POSITION; + NotifyHotSpotReleaseClick(newPos.Position(), false, ctrl, false); + } if (HaveMouseCapture()) { if (PointInSelMargin(pt)) { DisplayCursor(Window::cursorReverseArrow); diff --git a/src/Editor.h b/src/Editor.h index 3f36c9088..17683c63a 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -197,6 +197,7 @@ protected: // ScintillaBase subclass needs access to much of Editor bool dropWentOutside; SelectionPosition posDrag; SelectionPosition posDrop; + int hotSpotClickPos; int lastXChosen; int lineAnchor; int originalAnchorPos; @@ -417,6 +418,7 @@ protected: // ScintillaBase subclass needs access to much of Editor virtual void NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt); void NotifyHotSpotClicked(int position, bool shift, bool ctrl, bool alt); void NotifyHotSpotDoubleClicked(int position, bool shift, bool ctrl, bool alt); + void NotifyHotSpotReleaseClick(int position, bool shift, bool ctrl, bool alt); void NotifyUpdateUI(); void NotifyPainted(); void NotifyIndicatorClick(bool click, int position, bool shift, bool ctrl, bool alt); |