diff options
-rw-r--r-- | doc/ScintillaHistory.html | 1 | ||||
-rw-r--r-- | win32/PlatWin.cxx | 32 | ||||
-rw-r--r-- | win32/ScintillaWin.cxx | 7 |
3 files changed, 39 insertions, 1 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 27430ae52..bfe47bebc 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -383,6 +383,7 @@ </tr><tr> <td>Occam's Razor</td> <td>Ben Bluemel</td> + <td>David Wolfendale</td> </tr> </table> <p> diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 6a2f103ba..0ccc8aa13 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -1382,6 +1382,7 @@ class ListBoxX : public ListBox { PRectangle rcPreSize; Point dragOffset; Point location; // Caret location at which the list is opened + int wheelDelta; // mouse wheel residue HWND GetHWND() const; void AppendListItem(const char *startword, const char *numword); @@ -1409,7 +1410,7 @@ public: ListBoxX() : lineHeight(10), fontCopy(0), lb(0), unicodeMode(false), desiredVisibleRows(5), maxItemCharacters(0), aveCharWidth(8), parent(NULL), ctrlID(0), doubleClickAction(NULL), doubleClickActionData(NULL), - widestItem(NULL), maxCharWidth(1), resizeHit(0) { + widestItem(NULL), maxCharWidth(1), resizeHit(0), wheelDelta(0) { } virtual ~ListBoxX() { if (fontCopy) { @@ -1986,6 +1987,10 @@ LRESULT PASCAL ListBoxX::ControlWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA } } return 0; + + case WM_MBUTTONDOWN: + // disable the scroll wheel button click action + return 0; } WNDPROC prevWndProc = reinterpret_cast<WNDPROC>(GetWindowLongPtr(hWnd, GWLP_USERDATA)); @@ -2097,6 +2102,31 @@ LRESULT ListBoxX::WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam } return ::DefWindowProc(hWnd, iMessage, wParam, lParam); + case WM_MOUSEWHEEL: + wheelDelta -= GET_WHEEL_DELTA_WPARAM(wParam); + if (abs(wheelDelta) >= WHEEL_DELTA) { + int nRows = GetVisibleRows(); + int linesToScroll = 1; + if (nRows > 1) { + linesToScroll = nRows - 1; + } + if (linesToScroll > 3) { + linesToScroll = 3; + } + linesToScroll *= (wheelDelta / WHEEL_DELTA); + int top = ::SendMessage(lb, LB_GETTOPINDEX, 0, 0) + linesToScroll; + if (top < 0) { + top = 0; + } + ::SendMessage(lb, LB_SETTOPINDEX, top, 0); + // update wheel delta residue + if (wheelDelta >= 0) + wheelDelta = wheelDelta % WHEEL_DELTA; + else + wheelDelta = - (-wheelDelta % WHEEL_DELTA); + } + break; + default: return ::DefWindowProc(hWnd, iMessage, wParam, lParam); } diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 9925a64bb..d1f450479 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -680,6 +680,13 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam break; case WM_MOUSEWHEEL: + // if autocomplete list active then send mousewheel message to it + if (ac.Active()) { + HWND hWnd = reinterpret_cast<HWND>(ac.lb->GetID()); + ::SendMessage(hWnd, iMessage, wParam, lParam); + break; + } + // Don't handle datazoom. // (A good idea for datazoom would be to "fold" or "unfold" details. // i.e. if datazoomed out only class structures are visible, when datazooming in the control |