diff options
| -rw-r--r-- | src/Editor.cxx | 7 | ||||
| -rw-r--r-- | src/Editor.h | 1 | ||||
| -rw-r--r-- | win32/ScintillaWin.cxx | 37 | 
3 files changed, 44 insertions, 1 deletions
| diff --git a/src/Editor.cxx b/src/Editor.cxx index 876be0004..f9f02788a 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -5621,7 +5621,11 @@ void Editor::DwellEnd(bool mouseMoved) {  	}  } -static bool AllowVirtualSpace(int	virtualSpaceOptions, bool rectangular) { +void Editor::MouseLeave() { +	SetHotSpotRange(NULL); +} + +static bool AllowVirtualSpace(int virtualSpaceOptions, bool rectangular) {  	return ((virtualSpaceOptions & SCVS_USERACCESSIBLE) != 0)  		|| (rectangular && ((virtualSpaceOptions & SCVS_RECTANGULARSELECTION) != 0));  } @@ -5897,6 +5901,7 @@ void Editor::ButtonMove(Point pt) {  		if (vs.fixedColumnWidth > 0) {	// There is a margin  			if (PointInSelMargin(pt)) {  				DisplayCursor(Window::cursorReverseArrow); +				SetHotSpotRange(NULL);  				return; 	// No need to test for selection  			}  		} diff --git a/src/Editor.h b/src/Editor.h index ea3718ff3..94454b2d9 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -442,6 +442,7 @@ protected:	// ScintillaBase subclass needs access to much of Editor  	bool PointInSelMargin(Point pt);  	void LineSelection(int lineCurrent_, int lineAnchor_);  	void DwellEnd(bool mouseMoved); +	void MouseLeave();  	virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);  	void ButtonMove(Point pt);  	void ButtonUp(Point pt, unsigned int curTime, bool ctrl); diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index bdc4e1473..d7fd049b3 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -93,6 +93,8 @@ extern bool IsNT();  extern void Platform_Initialise(void *hInstance);  extern void Platform_Finalise(); +typedef BOOL (WINAPI *TrackMouseEventSig)(LPTRACKMOUSEEVENT); +  /** TOTAL_CONTROL ifdef surrounds code that will only work when ScintillaWin   * is derived from ScintillaBase (all features) rather than directly from Editor   * (lightweight editor). @@ -157,6 +159,8 @@ class ScintillaWin :  	bool lastKeyDownConsumed;  	bool capturedMouse; +	bool trackedMouseLeave; +	TrackMouseEventSig TrackMouseEventFn;  	unsigned int linesPerScroll;	///< Intellimouse support  	int wheelDelta; ///< Wheel delta from roll @@ -203,6 +207,7 @@ class ScintillaWin :  	virtual void SetTicking(bool on);  	virtual void SetMouseCapture(bool on);  	virtual bool HaveMouseCapture(); +	virtual void SetTrackMouseLeaveEvent(bool on);  	virtual bool PaintContains(PRectangle rc);  	virtual void ScrollText(int linesToMove);  	virtual void UpdateSystemCaret(); @@ -298,6 +303,9 @@ ScintillaWin::ScintillaWin(HWND hwnd) {  	lastKeyDownConsumed = false;  	capturedMouse = false; +	trackedMouseLeave = false; +	TrackMouseEventFn = 0; +  	linesPerScroll = 0;  	wheelDelta = 0;   // Wheel delta from roll @@ -338,6 +346,18 @@ void ScintillaWin::Initialise() {  	// no effect.  If the app hasnt, we really shouldnt ask them to call  	// it just so this internal feature works.  	hrOle = ::OleInitialize(NULL); + +	// Find TrackMouseEvent which is available on Windows > 95 +	HMODULE user32 = ::GetModuleHandle("user32.dll"); +	TrackMouseEventFn = (TrackMouseEventSig)::GetProcAddress(user32, "TrackMouseEvent"); +	if (TrackMouseEventFn == NULL) { +		// Windows 95 has an emulation in comctl32.dll:_TrackMouseEvent +		HMODULE commctrl32 = ::LoadLibrary("comctl32.dll"); +		if (commctrl32 != NULL) { +			TrackMouseEventFn = (TrackMouseEventSig) +				::GetProcAddress(commctrl32, "_TrackMouseEvent"); +		} +	}  }  void ScintillaWin::Finalise() { @@ -731,9 +751,15 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam  			break;  		case WM_MOUSEMOVE: +			SetTrackMouseLeaveEvent(true);  			ButtonMove(Point::FromLong(lParam));  			break; +		case WM_MOUSELEAVE: +			SetTrackMouseLeaveEvent(false); +			MouseLeave(); +			return ::DefWindowProc(MainHWND(), iMessage, wParam, lParam); +  		case WM_LBUTTONUP:  			ButtonUp(Point::FromLong(lParam),  				::GetMessageTime(), @@ -1101,6 +1127,17 @@ bool ScintillaWin::HaveMouseCapture() {  	//return capturedMouse && (::GetCapture() == MainHWND());  } +void ScintillaWin::SetTrackMouseLeaveEvent(bool on) { +	if (on && TrackMouseEventFn && !trackedMouseLeave) { +		TRACKMOUSEEVENT tme; +		tme.cbSize = sizeof(tme); +		tme.dwFlags = TME_LEAVE; +		tme.hwndTrack = MainHWND(); +		TrackMouseEventFn(&tme); +	} +	trackedMouseLeave = on; +} +  bool ScintillaWin::PaintContains(PRectangle rc) {  	bool contains = true;  	if ((paintState == painting) && (!rc.Empty())) { | 
