Commit fcabbbf3 authored by Dylan Smith's avatar Dylan Smith Committed by Alexandre Julliard

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

parent b70b3e89
......@@ -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;
}
......
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment