From 111ae4b1a706e2daf7c6e561a5389b57d4b7ea2b Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Fri, 31 Aug 2001 23:44:34 +0000 Subject: Moved Windows-specific mouse wheel variables from Editor to ScintillaWin. --- win32/ScintillaWin.cxx | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'win32') diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index c9cad5cd0..de1e8fc34 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -136,6 +136,9 @@ class ScintillaWin : bool lastKeyDownConsumed; bool capturedMouse; + + unsigned int linesPerScroll; ///< Intellimouse support + int wheelDelta; ///< Wheel delta from roll bool hasOKText; @@ -239,6 +242,8 @@ ScintillaWin::ScintillaWin(HWND hwnd) { lastKeyDownConsumed = false; capturedMouse = false; + linesPerScroll = 0; + wheelDelta = 0; // Wheel delta from roll hasOKText = false; @@ -492,27 +497,26 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam } // Either SCROLL or ZOOM. We handle the wheel steppings calculation - cWheelDelta -= static_cast(HiWord(wParam)); - if (abs(cWheelDelta) >= WHEEL_DELTA && ucWheelScrollLines > 0) { - int cLineScroll; - cLineScroll = ucWheelScrollLines; - if (cLineScroll == 0) { - cLineScroll++; + wheelDelta -= static_cast(HiWord(wParam)); + if (abs(wheelDelta) >= WHEEL_DELTA && linesPerScroll > 0) { + int linesToScroll = linesPerScroll; + if (linesToScroll == 0) { + linesToScroll = 1; } - cLineScroll *= (cWheelDelta / WHEEL_DELTA); - cWheelDelta = cWheelDelta % WHEEL_DELTA; + linesToScroll *= (wheelDelta / WHEEL_DELTA); + wheelDelta = wheelDelta % WHEEL_DELTA; if (wParam & MK_CONTROL) { // Zoom! We play with the font sizes in the styles. // Number of steps/line is ignored, we just care if sizing up or down - if (cLineScroll < 0) { + if (linesToScroll < 0) { KeyCommand(SCI_ZOOMIN); } else { KeyCommand(SCI_ZOOMOUT); } } else { // Scroll - ScrollTo(topLine + cLineScroll); + ScrollTo(topLine + linesToScroll); } } return 0; @@ -1312,7 +1316,7 @@ void ScintillaWin::AddCharBytes(char b0, char b1) { void ScintillaWin::GetIntelliMouseParameters() { // This retrieves the number of lines per scroll as configured inthe Mouse Properties sheet in Control Panel - ::SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &ucWheelScrollLines, 0); + ::SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &linesPerScroll, 0); } void ScintillaWin::CopySelTextToClipboard() { -- cgit v1.2.3