From c45e2b3e183b4f75b6570cc5d9eb09e2a0920c37 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Wed, 8 Aug 2001 09:42:13 +0000 Subject: Added mouse dwell feature. --- include/Scintilla.h | 9 ++++++++- include/Scintilla.iface | 10 ++++++++++ src/Editor.cxx | 38 +++++++++++++++++++++++++++++++++++--- src/Editor.h | 4 ++++ 4 files changed, 57 insertions(+), 4 deletions(-) diff --git a/include/Scintilla.h b/include/Scintilla.h index ac7614804..65a95b8e9 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -338,6 +338,9 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETTABINDENTS 2261 #define SCI_SETBACKSPACEUNINDENTS 2262 #define SCI_GETBACKSPACEUNINDENTS 2263 +#define SC_TIME_FOREVER 10000000 +#define SCI_SETMOUSEDWELLTIME 2264 +#define SCI_GETMOUSEDWELLTIME 2265 #define SCI_LINEDOWN 2300 #define SCI_LINEDOWNEXTEND 2301 #define SCI_LINEUP 2302 @@ -498,6 +501,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCN_PAINTED 2013 #define SCN_USERLISTSELECTION 2014 #define SCN_URIDROPPED 2015 +#define SCN_DWELLSTART 2016 +#define SCN_DWELLEND 2017 //--Autogenerated -- end of section automatically generated from Scintilla.iface // Optional module for macro recording @@ -552,7 +557,7 @@ struct NotifyHeader { struct SCNotification { struct NotifyHeader nmhdr; - int position; // SCN_STYLENEEDED, SCN_MODIFIED + int position; // SCN_STYLENEEDED, SCN_MODIFIED, SCN_DWELLSTART, SCN_DWELLEND int ch; // SCN_CHARADDED, SCN_KEY int modifiers; // SCN_KEY int modificationType; // SCN_MODIFIED @@ -569,6 +574,8 @@ struct SCNotification { int foldLevelPrev; // SCN_MODIFIED int margin; // SCN_MARGINCLICK int listType; // SCN_USERLISTSELECTION + int x; // SCN_DWELLSTART, SCN_DWELLEND + int y; // SCN_DWELLSTART, SCN_DWELLEND }; #define SC_MASK_FOLDERS ((1<= 0) { @@ -3201,6 +3218,13 @@ void Editor::Tick() { InvalidateCaret(); } } + if ((dwellDelay < SC_TIME_FOREVER) && (ticksToDwell > 0)) { + ticksToDwell -= timer.tickSize; + if (ticksToDwell <= 0) { + dwelling = true; + NotifyDwelling(ptMouseLast, dwelling); + } + } } void Editor::SetFocusState(bool focusState) { @@ -4231,6 +4255,14 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_GETBACKSPACEUNINDENTS: return pdoc->backspaceUnindents; + case SCI_SETMOUSEDWELLTIME: + dwellDelay = wParam; + ticksToDwell = dwellDelay; + break; + + case SCI_GETMOUSEDWELLTIME: + return dwellDelay; + case SCI_GETCOLUMN: return pdoc->GetColumn(wParam); diff --git a/src/Editor.h b/src/Editor.h index 0338467aa..5fdbbfae7 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -104,6 +104,9 @@ protected: // ScintillaBase subclass needs access to much of Editor Point lastClick; unsigned int lastClickTime; + int dwellDelay; + int ticksToDwell; + bool dwelling; enum { selChar, selWord, selLine } selectionType; Point ptMouseLast; bool firstExpose; @@ -259,6 +262,7 @@ protected: // ScintillaBase subclass needs access to much of Editor void NotifyPainted(); bool NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt); void NotifyNeedShown(int pos, int len); + void NotifyDwelling(Point pt, bool state); void NotifyModifyAttempt(Document *document, void *userData); void NotifySavePoint(Document *document, void *userData, bool atSavePoint); -- cgit v1.2.3