mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 09:13:01 +00:00
[MSPAINT] Mouse Wheel support (#4195)
Improve usability by mouse wheel handling. Plain wheel, Ctrl+Wheel, and Shift+Wheel. CORE-17937
This commit is contained in:
parent
29718e009a
commit
90c3f89bb2
10 changed files with 78 additions and 3 deletions
|
@ -157,6 +157,56 @@ void CMainWindow::InsertSelectionFromHBITMAP(HBITMAP bitmap, HWND window)
|
|||
ForceRefreshSelectionContents();
|
||||
}
|
||||
|
||||
LRESULT CMainWindow::OnMouseWheel(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
INT zDelta = (SHORT)HIWORD(wParam);
|
||||
|
||||
if (::GetAsyncKeyState(VK_CONTROL) < 0)
|
||||
{
|
||||
if (zDelta < 0)
|
||||
{
|
||||
if (toolsModel.GetZoom() > MIN_ZOOM)
|
||||
zoomTo(toolsModel.GetZoom() / 2, 0, 0);
|
||||
}
|
||||
else if (zDelta > 0)
|
||||
{
|
||||
if (toolsModel.GetZoom() < MAX_ZOOM)
|
||||
zoomTo(toolsModel.GetZoom() * 2, 0, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UINT nCount = 3;
|
||||
if (::GetAsyncKeyState(VK_SHIFT) < 0)
|
||||
{
|
||||
#ifndef SPI_GETWHEELSCROLLCHARS
|
||||
#define SPI_GETWHEELSCROLLCHARS 0x006C // Needed for pre-NT6 PSDK
|
||||
#endif
|
||||
SystemParametersInfoW(SPI_GETWHEELSCROLLCHARS, 0, &nCount, 0);
|
||||
for (UINT i = 0; i < nCount; ++i)
|
||||
{
|
||||
if (zDelta < 0)
|
||||
::PostMessageW(scrollboxWindow, WM_HSCROLL, MAKEWPARAM(SB_LINEDOWN, 0), 0);
|
||||
else if (zDelta > 0)
|
||||
::PostMessageW(scrollboxWindow, WM_HSCROLL, MAKEWPARAM(SB_LINEUP, 0), 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SystemParametersInfoW(SPI_GETWHEELSCROLLLINES, 0, &nCount, 0);
|
||||
for (UINT i = 0; i < nCount; ++i)
|
||||
{
|
||||
if (zDelta < 0)
|
||||
::PostMessageW(scrollboxWindow, WM_VSCROLL, MAKEWPARAM(SB_LINEDOWN, 0), 0);
|
||||
else if (zDelta > 0)
|
||||
::PostMessageW(scrollboxWindow, WM_VSCROLL, MAKEWPARAM(SB_LINEUP, 0), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CMainWindow::OnDropFiles(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
TCHAR droppedfile[MAX_PATH];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue