2 * PROJECT: PAINT for ReactOS
5 * PURPOSE: Window procedure of the size boxes
6 * PROGRAMMERS: Benedikt Freisen
9 /* INCLUDES *********************************************************/
14 /* FUNCTIONS ********************************************************/
16 BOOL resizing
= FALSE
;
23 WNDCLASSEX wclSizebox
;
24 /* initializing and registering the window class for the size boxes */
25 wclSizebox
.hInstance
= hProgInstance
;
26 wclSizebox
.lpszClassName
= _T("Sizebox");
27 wclSizebox
.lpfnWndProc
= SizeboxWinProc
;
28 wclSizebox
.style
= CS_DBLCLKS
;
29 wclSizebox
.cbSize
= sizeof(WNDCLASSEX
);
30 wclSizebox
.hIcon
= NULL
;
31 wclSizebox
.hIconSm
= NULL
;
32 wclSizebox
.hCursor
= LoadCursor(NULL
, IDC_ARROW
);
33 wclSizebox
.lpszMenuName
= NULL
;
34 wclSizebox
.cbClsExtra
= 0;
35 wclSizebox
.cbWndExtra
= 0;
36 wclSizebox
.hbrBackground
= GetSysColorBrush(COLOR_HIGHLIGHT
);
37 RegisterClassEx (&wclSizebox
);
41 SizeboxWinProc(HWND hwnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
46 if ((hwnd
== hSizeboxLeftTop
) || (hwnd
== hSizeboxRightBottom
))
47 SetCursor(LoadCursor(NULL
, IDC_SIZENWSE
));
48 if ((hwnd
== hSizeboxLeftBottom
) || (hwnd
== hSizeboxRightTop
))
49 SetCursor(LoadCursor(NULL
, IDC_SIZENESW
));
50 if ((hwnd
== hSizeboxLeftCenter
) || (hwnd
== hSizeboxRightCenter
))
51 SetCursor(LoadCursor(NULL
, IDC_SIZEWE
));
52 if ((hwnd
== hSizeboxCenterTop
) || (hwnd
== hSizeboxCenterBottom
))
53 SetCursor(LoadCursor(NULL
, IDC_SIZENS
));
57 xOrig
= GET_X_LPARAM(lParam
);
58 yOrig
= GET_Y_LPARAM(lParam
);
67 xRel
= (GET_X_LPARAM(lParam
) - xOrig
) * 1000 / zoom
;
68 yRel
= (GET_Y_LPARAM(lParam
) - yOrig
) * 1000 / zoom
;
69 if (hwnd
== hSizeboxLeftTop
)
70 _stprintf(sizeStr
, _T("%d x %d"), imgXRes
- xRel
, imgYRes
- yRel
);
71 if (hwnd
== hSizeboxCenterTop
)
72 _stprintf(sizeStr
, _T("%d x %d"), imgXRes
, imgYRes
- yRel
);
73 if (hwnd
== hSizeboxRightTop
)
74 _stprintf(sizeStr
, _T("%d x %d"), imgXRes
+ xRel
, imgYRes
- yRel
);
75 if (hwnd
== hSizeboxLeftCenter
)
76 _stprintf(sizeStr
, _T("%d x %d"), imgXRes
- xRel
, imgYRes
);
77 if (hwnd
== hSizeboxRightCenter
)
78 _stprintf(sizeStr
, _T("%d x %d"), imgXRes
+ xRel
, imgYRes
);
79 if (hwnd
== hSizeboxLeftBottom
)
80 _stprintf(sizeStr
, _T("%d x %d"), imgXRes
- xRel
, imgYRes
+ yRel
);
81 if (hwnd
== hSizeboxCenterBottom
)
82 _stprintf(sizeStr
, _T("%d x %d"), imgXRes
, imgYRes
+ yRel
);
83 if (hwnd
== hSizeboxRightBottom
)
84 _stprintf(sizeStr
, _T("%d x %d"), imgXRes
+ xRel
, imgYRes
+ yRel
);
85 SendMessage(hStatusBar
, SB_SETTEXT
, 2, (LPARAM
) sizeStr
);
95 xRel
= (GET_X_LPARAM(lParam
) - xOrig
) * 1000 / zoom
;
96 yRel
= (GET_Y_LPARAM(lParam
) - yOrig
) * 1000 / zoom
;
97 if (hwnd
== hSizeboxLeftTop
)
98 cropReversible(imgXRes
- xRel
, imgYRes
- yRel
, xRel
, yRel
);
99 if (hwnd
== hSizeboxCenterTop
)
100 cropReversible(imgXRes
, imgYRes
- yRel
, 0, yRel
);
101 if (hwnd
== hSizeboxRightTop
)
102 cropReversible(imgXRes
+ xRel
, imgYRes
- yRel
, 0, yRel
);
103 if (hwnd
== hSizeboxLeftCenter
)
104 cropReversible(imgXRes
- xRel
, imgYRes
, xRel
, 0);
105 if (hwnd
== hSizeboxRightCenter
)
106 cropReversible(imgXRes
+ xRel
, imgYRes
, 0, 0);
107 if (hwnd
== hSizeboxLeftBottom
)
108 cropReversible(imgXRes
- xRel
, imgYRes
+ yRel
, xRel
, 0);
109 if (hwnd
== hSizeboxCenterBottom
)
110 cropReversible(imgXRes
, imgYRes
+ yRel
, 0, 0);
111 if (hwnd
== hSizeboxRightBottom
)
112 cropReversible(imgXRes
+ xRel
, imgYRes
+ yRel
, 0, 0);
113 SendMessage(hStatusBar
, SB_SETTEXT
, 2, (LPARAM
) _T(""));
118 return DefWindowProc(hwnd
, message
, wParam
, lParam
);