mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[SHIMGVW] Enable middle button dragging (#6173)
This commit is contained in:
parent
e62d12b140
commit
fed7ee70a6
5 changed files with 76 additions and 2 deletions
|
@ -9,6 +9,9 @@ list(APPEND SOURCE
|
|||
${CMAKE_CURRENT_BINARY_DIR}/shimgvw_stubs.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/shimgvw.def)
|
||||
|
||||
file(GLOB_RECURSE shimgvw_rc_deps res/*.*)
|
||||
add_rc_deps(shimgvw.rc ${shimgvw_rc_deps})
|
||||
|
||||
add_library(shimgvw MODULE ${SOURCE})
|
||||
set_module_type(shimgvw win32dll UNICODE)
|
||||
target_link_libraries(shimgvw wine)
|
||||
|
|
BIN
dll/win32/shimgvw/res/handdrag.cur
Normal file
BIN
dll/win32/shimgvw/res/handdrag.cur
Normal file
Binary file not shown.
After Width: | Height: | Size: 326 B |
|
@ -7,6 +7,9 @@
|
|||
#define IDI_JPG_ICON 4
|
||||
#define IDI_PNG_ICON 5
|
||||
|
||||
/* Cursors */
|
||||
#define IDC_HANDDRAG 100
|
||||
|
||||
/* Toolbar images */
|
||||
#define IDB_PREV_PIC 50
|
||||
#define IDB_NEXT_PIC 51
|
||||
|
|
|
@ -103,6 +103,8 @@ typedef struct tagPREVIEW_DATA
|
|||
ANIME m_Anime; /* Animation */
|
||||
INT m_xScrollOffset;
|
||||
INT m_yScrollOffset;
|
||||
UINT m_nMouseDownMsg;
|
||||
POINT m_ptOrigin;
|
||||
} PREVIEW_DATA, *PPREVIEW_DATA;
|
||||
|
||||
static inline PPREVIEW_DATA
|
||||
|
@ -885,9 +887,56 @@ Preview_EndSlideShow(HWND hwnd)
|
|||
static VOID
|
||||
ZoomWnd_OnButtonDown(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
PPREVIEW_DATA pData = Preview_GetData(hwnd);
|
||||
HWND hParent = GetParent(hwnd);
|
||||
if (!Preview_IsMainWnd(hParent))
|
||||
Preview_EndSlideShow(hParent);
|
||||
if ((uMsg == WM_LBUTTONDOWN) || (uMsg == WM_RBUTTONDOWN))
|
||||
{
|
||||
if (!Preview_IsMainWnd(hParent))
|
||||
Preview_EndSlideShow(hParent);
|
||||
return;
|
||||
}
|
||||
|
||||
pData->m_nMouseDownMsg = uMsg;
|
||||
pData->m_ptOrigin.x = GET_X_LPARAM(lParam);
|
||||
pData->m_ptOrigin.y = GET_Y_LPARAM(lParam);
|
||||
SetCapture(hwnd);
|
||||
SetCursor(LoadCursorW(g_hInstance, MAKEINTRESOURCEW(IDC_HANDDRAG)));
|
||||
}
|
||||
|
||||
static VOID
|
||||
ZoomWnd_OnMouseMove(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
PPREVIEW_DATA pData = Preview_GetData(hwnd);
|
||||
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
|
||||
|
||||
if (pData->m_nMouseDownMsg == WM_MBUTTONDOWN)
|
||||
{
|
||||
INT x = GetScrollPos(hwnd, SB_HORZ) - (pt.x - pData->m_ptOrigin.x);
|
||||
INT y = GetScrollPos(hwnd, SB_VERT) - (pt.y - pData->m_ptOrigin.y);
|
||||
SendMessageW(hwnd, WM_HSCROLL, MAKEWPARAM(SB_THUMBPOSITION, x), 0);
|
||||
SendMessageW(hwnd, WM_VSCROLL, MAKEWPARAM(SB_THUMBPOSITION, y), 0);
|
||||
pData->m_ptOrigin = pt;
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL
|
||||
ZoomWnd_OnSetCursor(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
PPREVIEW_DATA pData = Preview_GetData(hwnd);
|
||||
if (pData->m_nMouseDownMsg == WM_MBUTTONDOWN)
|
||||
{
|
||||
SetCursor(LoadCursorW(g_hInstance, MAKEINTRESOURCEW(IDC_HANDDRAG)));
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static VOID
|
||||
ZoomWnd_OnButtonUp(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
PPREVIEW_DATA pData = Preview_GetData(hwnd);
|
||||
pData->m_nMouseDownMsg = 0;
|
||||
ReleaseCapture();
|
||||
}
|
||||
|
||||
static VOID
|
||||
|
@ -995,6 +1044,23 @@ ZoomWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
ZoomWnd_OnButtonDown(hwnd, uMsg, wParam, lParam);
|
||||
break;
|
||||
}
|
||||
case WM_MOUSEMOVE:
|
||||
{
|
||||
ZoomWnd_OnMouseMove(hwnd, uMsg, wParam, lParam);
|
||||
break;
|
||||
}
|
||||
case WM_SETCURSOR:
|
||||
{
|
||||
if (!ZoomWnd_OnSetCursor(hwnd, uMsg, wParam, lParam))
|
||||
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
case WM_LBUTTONUP:
|
||||
case WM_MBUTTONUP:
|
||||
case WM_RBUTTONUP:
|
||||
{
|
||||
ZoomWnd_OnButtonUp(hwnd, uMsg, wParam, lParam);
|
||||
break;
|
||||
}
|
||||
case WM_PAINT:
|
||||
{
|
||||
ZoomWnd_OnPaint(pData, hwnd);
|
||||
|
|
|
@ -17,6 +17,8 @@ IDI_APP_ICON ICON "res/main.ico"
|
|||
IDI_BMP_ICON ICON "res/bmp.ico"
|
||||
IDI_PNG_ICON ICON "res/png.ico"
|
||||
|
||||
IDC_HANDDRAG CURSOR "res/handdrag.cur"
|
||||
|
||||
IDB_PREV_PIC BITMAP "res/prev.bmp"
|
||||
IDB_NEXT_PIC BITMAP "res/next.bmp"
|
||||
IDB_BEST_FIT BITMAP "res/best_fit.bmp"
|
||||
|
|
Loading…
Reference in a new issue