From 88bd2188c961dd57cc515b285fd7f4812888f5cf Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sun, 4 Sep 2011 10:22:47 +1000 Subject: Autocompletion lists respond to mouse wheel events. Feature #3403600. From David Wolfendale. --- win32/PlatWin.cxx | 32 +++++++++++++++++++++++++++++++- win32/ScintillaWin.cxx | 7 +++++++ 2 files changed, 38 insertions(+), 1 deletion(-) (limited to 'win32') 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(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(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 -- cgit v1.2.3 From 9b4a855ed7962ce5da8c3e538a38f3eb396a8cc7 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Tue, 6 Sep 2011 19:50:21 +1000 Subject: Updating for 2.29 release. --- win32/ScintRes.rc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'win32') diff --git a/win32/ScintRes.rc b/win32/ScintRes.rc index 41443340a..2b50d1730 100644 --- a/win32/ScintRes.rc +++ b/win32/ScintRes.rc @@ -5,8 +5,8 @@ #include VS_VERSION_INFO VERSIONINFO -FILEVERSION 2, 2, 8, 0 -PRODUCTVERSION 2, 2, 8, 0 +FILEVERSION 2, 2, 9, 0 +PRODUCTVERSION 2, 2, 9, 0 FILEFLAGSMASK 0x3fL FILEFLAGS 0 FILEOS VOS_NT_WINDOWS32 @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "Neil Hodgson neilh@scintilla.org\0" VALUE "FileDescription", "Scintilla.DLL - a Source Editing Component\0" - VALUE "FileVersion", "2.28\0" + VALUE "FileVersion", "2.29\0" VALUE "InternalName", "Scintilla\0" VALUE "LegalCopyright", "Copyright 1998-2011 by Neil Hodgson\0" VALUE "OriginalFilename", "Scintilla.DLL\0" VALUE "ProductName", "Scintilla\0" - VALUE "ProductVersion", "2.28\0" + VALUE "ProductVersion", "2.29\0" END END END -- cgit v1.2.3