Dylan Smith : winhlp32: Use EM_SCROLL to scroll richedit control.
Alexandre Julliard
julliard at winehq.org
Mon Mar 9 09:40:23 CDT 2009
Module: wine
Branch: master
Commit: fb63cd0c87e6db85bc4ebc31931f0eba8975a0c8
URL: http://source.winehq.org/git/wine.git/?a=commit;h=fb63cd0c87e6db85bc4ebc31931f0eba8975a0c8
Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date: Sat Mar 7 02:09:04 2009 -0500
winhlp32: Use EM_SCROLL to scroll richedit control.
Previously the richedit control contents were scrolled directly using
ScrollWindow. This caused the richedit control to not actually scroll,
but only look like it scrolled, therefore causing plenty of glitches.
---
programs/winhlp32/winhelp.c | 40 ++++++++++------------------------------
1 files changed, 10 insertions(+), 30 deletions(-)
diff --git a/programs/winhlp32/winhelp.c b/programs/winhlp32/winhelp.c
index 02529ee..d62649f 100644
--- a/programs/winhlp32/winhelp.c
+++ b/programs/winhlp32/winhelp.c
@@ -1263,8 +1263,7 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
{
WINHELP_WINDOW *win;
WINHELP_BUTTON *button;
- RECT rect;
- INT curPos, min, max, dy, keyDelta;
+ INT keyDelta;
HWND hTextWnd;
LRESULT ret;
@@ -1379,42 +1378,23 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
case WM_KEYDOWN:
keyDelta = 0;
+ win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0);
+ hTextWnd = GetDlgItem(win->hMainWnd, CTL_ID_TEXT);
switch (wParam)
{
case VK_UP:
+ SendMessage(hTextWnd, EM_SCROLL, SB_LINEUP, 0);
+ return 0;
case VK_DOWN:
- keyDelta = GetSystemMetrics(SM_CXVSCROLL);
- if (wParam == VK_UP)
- keyDelta = -keyDelta;
-
+ SendMessage(hTextWnd, EM_SCROLL, SB_LINEDOWN, 0);
+ return 0;
case VK_PRIOR:
+ SendMessage(hTextWnd, EM_SCROLL, SB_PAGEUP, 0);
+ return 0;
case VK_NEXT:
- win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0);
- hTextWnd = GetDlgItem(win->hMainWnd, CTL_ID_TEXT);
- curPos = GetScrollPos(hTextWnd, SB_VERT);
- GetScrollRange(hTextWnd, SB_VERT, &min, &max);
-
- if (keyDelta == 0)
- {
- GetClientRect(hTextWnd, &rect);
- keyDelta = (rect.bottom - rect.top) / 2;
- if (wParam == VK_PRIOR)
- keyDelta = -keyDelta;
- }
-
- curPos += keyDelta;
- if (curPos > max)
- curPos = max;
- else if (curPos < min)
- curPos = min;
-
- dy = GetScrollPos(hTextWnd, SB_VERT) - curPos;
- SetScrollPos(hTextWnd, SB_VERT, curPos, TRUE);
- ScrollWindow(hTextWnd, 0, dy, NULL, NULL);
- UpdateWindow(hTextWnd);
+ SendMessage(hTextWnd, EM_SCROLL, SB_PAGEDOWN, 0);
return 0;
-
case VK_ESCAPE:
MACRO_Exit();
return 0;
More information about the wine-cvs
mailing list