2 * PROJECT: PAINT for ReactOS
5 * PURPOSE: Window procedure of the size boxes
6 * PROGRAMMERS: Benedikt Freisen
9 /* INCLUDES *********************************************************/
13 /* FUNCTIONS ********************************************************/
15 BOOL resizing
= FALSE
;
20 SizeboxWinProc(HWND hwnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
25 if ((hwnd
== hSizeboxLeftTop
) || (hwnd
== hSizeboxRightBottom
))
26 SetCursor(LoadCursor(NULL
, IDC_SIZENWSE
));
27 if ((hwnd
== hSizeboxLeftBottom
) || (hwnd
== hSizeboxRightTop
))
28 SetCursor(LoadCursor(NULL
, IDC_SIZENESW
));
29 if ((hwnd
== hSizeboxLeftCenter
) || (hwnd
== hSizeboxRightCenter
))
30 SetCursor(LoadCursor(NULL
, IDC_SIZEWE
));
31 if ((hwnd
== hSizeboxCenterTop
) || (hwnd
== hSizeboxCenterBottom
))
32 SetCursor(LoadCursor(NULL
, IDC_SIZENS
));
36 xOrig
= LOWORD(lParam
);
37 yOrig
= HIWORD(lParam
);
46 xRel
= ((short)LOWORD(lParam
) - xOrig
) * 1000 / zoom
;
47 yRel
= ((short)HIWORD(lParam
) - yOrig
) * 1000 / zoom
;
48 if (hwnd
== hSizeboxLeftTop
)
49 _stprintf(sizeStr
, _T("%d x %d"), imgXRes
- xRel
, imgYRes
- yRel
);
50 if (hwnd
== hSizeboxCenterTop
)
51 _stprintf(sizeStr
, _T("%d x %d"), imgXRes
, imgYRes
- yRel
);
52 if (hwnd
== hSizeboxRightTop
)
53 _stprintf(sizeStr
, _T("%d x %d"), imgXRes
+ xRel
, imgYRes
- yRel
);
54 if (hwnd
== hSizeboxLeftCenter
)
55 _stprintf(sizeStr
, _T("%d x %d"), imgXRes
- xRel
, imgYRes
);
56 if (hwnd
== hSizeboxRightCenter
)
57 _stprintf(sizeStr
, _T("%d x %d"), imgXRes
+ xRel
, imgYRes
);
58 if (hwnd
== hSizeboxLeftBottom
)
59 _stprintf(sizeStr
, _T("%d x %d"), imgXRes
- xRel
, imgYRes
+ yRel
);
60 if (hwnd
== hSizeboxCenterBottom
)
61 _stprintf(sizeStr
, _T("%d x %d"), imgXRes
, imgYRes
+ yRel
);
62 if (hwnd
== hSizeboxRightBottom
)
63 _stprintf(sizeStr
, _T("%d x %d"), imgXRes
+ xRel
, imgYRes
+ yRel
);
64 SendMessage(hStatusBar
, SB_SETTEXT
, 2, (LPARAM
) sizeStr
);
74 xRel
= ((short)LOWORD(lParam
) - xOrig
) * 1000 / zoom
;
75 yRel
= ((short)HIWORD(lParam
) - yOrig
) * 1000 / zoom
;
76 if (hwnd
== hSizeboxLeftTop
)
77 cropReversible(imgXRes
- xRel
, imgYRes
- yRel
, xRel
, yRel
);
78 if (hwnd
== hSizeboxCenterTop
)
79 cropReversible(imgXRes
, imgYRes
- yRel
, 0, yRel
);
80 if (hwnd
== hSizeboxRightTop
)
81 cropReversible(imgXRes
+ xRel
, imgYRes
- yRel
, 0, yRel
);
82 if (hwnd
== hSizeboxLeftCenter
)
83 cropReversible(imgXRes
- xRel
, imgYRes
, xRel
, 0);
84 if (hwnd
== hSizeboxRightCenter
)
85 cropReversible(imgXRes
+ xRel
, imgYRes
, 0, 0);
86 if (hwnd
== hSizeboxLeftBottom
)
87 cropReversible(imgXRes
- xRel
, imgYRes
+ yRel
, xRel
, 0);
88 if (hwnd
== hSizeboxCenterBottom
)
89 cropReversible(imgXRes
, imgYRes
+ yRel
, 0, 0);
90 if (hwnd
== hSizeboxRightBottom
)
91 cropReversible(imgXRes
+ xRel
, imgYRes
+ yRel
, 0, 0);
92 SendMessage(hStatusBar
, SB_SETTEXT
, 2, (LPARAM
) _T(""));
97 return DefWindowProc(hwnd
, message
, wParam
, lParam
);