richedit: Zoom in and out with mouse wheel with control held.

This commit is contained in:
Dylan Smith 2009-01-13 13:39:32 -05:00 committed by Alexandre Julliard
parent b70b3e893f
commit fcabbbf30f
2 changed files with 29 additions and 12 deletions

View File

@ -4096,18 +4096,35 @@ static LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
{
int gcWheelDelta;
UINT pulScrollLines;
BOOL ctrl_is_down;
if ((editor->nEventMask & ENM_MOUSEEVENTS) &&
!ME_FilterEvent(editor, msg, &wParam, &lParam))
return 0;
SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &pulScrollLines, 0);
gcWheelDelta = -GET_WHEEL_DELTA_WPARAM(wParam);
if (abs(gcWheelDelta) >= WHEEL_DELTA && pulScrollLines)
ctrl_is_down = GetKeyState(VK_CONTROL) & 0x8000;
gcWheelDelta = GET_WHEEL_DELTA_WPARAM(wParam);
if (abs(gcWheelDelta) >= WHEEL_DELTA)
{
/* FIXME follow the original */
ME_ScrollDown(editor,pulScrollLines * (gcWheelDelta / WHEEL_DELTA) * 8);
if (ctrl_is_down) {
int numerator;
if (!editor->nZoomNumerator || !editor->nZoomDenominator)
{
numerator = 100;
} else {
numerator = editor->nZoomNumerator * 100 / editor->nZoomDenominator;
}
numerator = numerator + (gcWheelDelta / WHEEL_DELTA) * 10;
if (numerator >= 10 && numerator <= 500)
ME_SetZoom(editor, numerator, 100);
} else {
SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &pulScrollLines, 0);
/* FIXME follow the original */
if (pulScrollLines)
ME_ScrollDown(editor,pulScrollLines * (-gcWheelDelta / WHEEL_DELTA) * 8);
}
}
break;
}

View File

@ -6292,8 +6292,8 @@ static void test_zoom(void)
release_key(VK_CONTROL);
ret = SendMessage(hwnd, EM_GETZOOM, (WPARAM)&numerator, (LPARAM)&denominator);
todo_wine ok(numerator == 110, "incorrect numerator is %d\n", numerator);
todo_wine ok(denominator == 100, "incorrect denominator is %d\n", denominator);
ok(numerator == 110, "incorrect numerator is %d\n", numerator);
ok(denominator == 100, "incorrect denominator is %d\n", denominator);
ok(ret == TRUE, "EM_GETZOOM failed (%d).\n", ret);
/* Test how much the mouse wheel can zoom in and out. */
@ -6307,7 +6307,7 @@ static void test_zoom(void)
release_key(VK_CONTROL);
ret = SendMessage(hwnd, EM_GETZOOM, (WPARAM)&numerator, (LPARAM)&denominator);
todo_wine ok(numerator == 500, "incorrect numerator is %d\n", numerator);
ok(numerator == 500, "incorrect numerator is %d\n", numerator);
ok(denominator == 100, "incorrect denominator is %d\n", denominator);
ok(ret == TRUE, "EM_GETZOOM failed (%d).\n", ret);
@ -6335,7 +6335,7 @@ static void test_zoom(void)
release_key(VK_CONTROL);
ret = SendMessage(hwnd, EM_GETZOOM, (WPARAM)&numerator, (LPARAM)&denominator);
todo_wine ok(numerator == 10, "incorrect numerator is %d\n", numerator);
ok(numerator == 10, "incorrect numerator is %d\n", numerator);
ok(denominator == 100, "incorrect denominator is %d\n", denominator);
ok(ret == TRUE, "EM_GETZOOM failed (%d).\n", ret);
@ -6364,8 +6364,8 @@ static void test_zoom(void)
release_key(VK_CONTROL);
ret = SendMessage(hwnd, EM_GETZOOM, (WPARAM)&numerator, (LPARAM)&denominator);
todo_wine ok(numerator == 394, "incorrect numerator is %d\n", numerator);
todo_wine ok(denominator == 100, "incorrect denominator is %d\n", denominator);
ok(numerator == 394, "incorrect numerator is %d\n", numerator);
ok(denominator == 100, "incorrect denominator is %d\n", denominator);
ok(ret == TRUE, "EM_GETZOOM failed (%d).\n", ret);
/* Test bounds checking on EM_SETZOOM */