2 * PROJECT: PAINT for ReactOS
5 * PURPOSE: Window procedure of the size boxes
6 * PROGRAMMERS: Benedikt Freisen
9 /* INCLUDES *********************************************************/
14 #include "globalvar.h"
17 /* FUNCTIONS ********************************************************/
19 BOOL resizing
= FALSE
;
24 SizeboxWinProc(HWND hwnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
29 if ((hwnd
== hSizeboxLeftTop
) || (hwnd
== hSizeboxRightBottom
))
30 SetCursor(LoadCursor(NULL
, IDC_SIZENWSE
));
31 if ((hwnd
== hSizeboxLeftBottom
) || (hwnd
== hSizeboxRightTop
))
32 SetCursor(LoadCursor(NULL
, IDC_SIZENESW
));
33 if ((hwnd
== hSizeboxLeftCenter
) || (hwnd
== hSizeboxRightCenter
))
34 SetCursor(LoadCursor(NULL
, IDC_SIZEWE
));
35 if ((hwnd
== hSizeboxCenterTop
) || (hwnd
== hSizeboxCenterBottom
))
36 SetCursor(LoadCursor(NULL
, IDC_SIZENS
));
40 xOrig
= LOWORD(lParam
);
41 yOrig
= HIWORD(lParam
);
50 xRel
= ((short)LOWORD(lParam
) - xOrig
) * 1000 / zoom
;
51 yRel
= ((short)HIWORD(lParam
) - yOrig
) * 1000 / zoom
;
52 if (hwnd
== hSizeboxLeftTop
)
53 _stprintf(sizeStr
, _T("%d x %d"), imgXRes
- xRel
, imgYRes
- yRel
);
54 if (hwnd
== hSizeboxCenterTop
)
55 _stprintf(sizeStr
, _T("%d x %d"), imgXRes
, imgYRes
- yRel
);
56 if (hwnd
== hSizeboxRightTop
)
57 _stprintf(sizeStr
, _T("%d x %d"), imgXRes
+ xRel
, imgYRes
- yRel
);
58 if (hwnd
== hSizeboxLeftCenter
)
59 _stprintf(sizeStr
, _T("%d x %d"), imgXRes
- xRel
, imgYRes
);
60 if (hwnd
== hSizeboxRightCenter
)
61 _stprintf(sizeStr
, _T("%d x %d"), imgXRes
+ xRel
, imgYRes
);
62 if (hwnd
== hSizeboxLeftBottom
)
63 _stprintf(sizeStr
, _T("%d x %d"), imgXRes
- xRel
, imgYRes
+ yRel
);
64 if (hwnd
== hSizeboxCenterBottom
)
65 _stprintf(sizeStr
, _T("%d x %d"), imgXRes
, imgYRes
+ yRel
);
66 if (hwnd
== hSizeboxRightBottom
)
67 _stprintf(sizeStr
, _T("%d x %d"), imgXRes
+ xRel
, imgYRes
+ yRel
);
68 SendMessage(hStatusBar
, SB_SETTEXT
, 2, (LPARAM
) sizeStr
);
78 xRel
= ((short)LOWORD(lParam
) - xOrig
) * 1000 / zoom
;
79 yRel
= ((short)HIWORD(lParam
) - yOrig
) * 1000 / zoom
;
80 if (hwnd
== hSizeboxLeftTop
)
81 cropReversible(imgXRes
- xRel
, imgYRes
- yRel
, xRel
, yRel
);
82 if (hwnd
== hSizeboxCenterTop
)
83 cropReversible(imgXRes
, imgYRes
- yRel
, 0, yRel
);
84 if (hwnd
== hSizeboxRightTop
)
85 cropReversible(imgXRes
+ xRel
, imgYRes
- yRel
, 0, yRel
);
86 if (hwnd
== hSizeboxLeftCenter
)
87 cropReversible(imgXRes
- xRel
, imgYRes
, xRel
, 0);
88 if (hwnd
== hSizeboxRightCenter
)
89 cropReversible(imgXRes
+ xRel
, imgYRes
, 0, 0);
90 if (hwnd
== hSizeboxLeftBottom
)
91 cropReversible(imgXRes
- xRel
, imgYRes
+ yRel
, xRel
, 0);
92 if (hwnd
== hSizeboxCenterBottom
)
93 cropReversible(imgXRes
, imgYRes
+ yRel
, 0, 0);
94 if (hwnd
== hSizeboxRightBottom
)
95 cropReversible(imgXRes
+ xRel
, imgYRes
+ yRel
, 0, 0);
96 SendMessage(hStatusBar
, SB_SETTEXT
, 2, (LPARAM
) _T(""));
101 return DefWindowProc(hwnd
, message
, wParam
, lParam
);