920fe51f8c204f74452f4effefc756b7b7f6b5b1
2 * PROJECT: PAINT for ReactOS
4 * FILE: base/applications/paint/toolsettings.c
5 * PURPOSE: Window procedure of the tool settings window
6 * PROGRAMMERS: Benedikt Freisen
9 /* INCLUDES *********************************************************/
13 /* FUNCTIONS ********************************************************/
15 extern void zoomTo(int, int, int);
18 SettingsWinProc(HWND hwnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
23 zoomTo(125 << SendMessage(hTrackbarZoom
, TBM_GETPOS
, 0, 0), 0, 0);
27 HDC hdc
= GetDC(hwnd
);
28 RECT rect1
= { 0, 0, 42, 66 };
29 RECT rect2
= { 0, 70, 42, 136 };
31 DefWindowProc(hwnd
, message
, wParam
, lParam
);
33 DrawEdge(hdc
, &rect1
, BDR_SUNKENOUTER
, (activeTool
== TOOL_ZOOM
) ? BF_RECT
: BF_RECT
| BF_MIDDLE
);
34 DrawEdge(hdc
, &rect2
, (activeTool
>= TOOL_RECT
) ? BDR_SUNKENOUTER
: 0, BF_RECT
| BF_MIDDLE
);
41 HPEN oldPen
= SelectObject(hdc
, CreatePen(PS_NULL
, 0, 0));
42 SelectObject(hdc
, GetSysColorBrush(COLOR_HIGHLIGHT
));
43 Rectangle(hdc
, 2, transpBg
* 31 + 2, 41, transpBg
* 31 + 33);
44 DeleteObject(SelectObject(hdc
, oldPen
));
45 DrawIconEx(hdc
, 1, 2, hNontranspIcon
, 40, 30, 0, NULL
, DI_NORMAL
);
46 DrawIconEx(hdc
, 1, 33, hTranspIcon
, 40, 30, 0, NULL
, DI_NORMAL
);
52 HPEN oldPen
= SelectObject(hdc
, CreatePen(PS_NULL
, 0, 0));
53 for(i
= 0; i
< 4; i
++)
55 if (rubberRadius
== i
+ 2)
57 SelectObject(hdc
, GetSysColorBrush(COLOR_HIGHLIGHT
));
58 Rectangle(hdc
, 14, i
* 15 + 2, 29, i
* 15 + 17);
59 SelectObject(hdc
, GetSysColorBrush(COLOR_HIGHLIGHTTEXT
));
62 SelectObject(hdc
, GetSysColorBrush(COLOR_WINDOWTEXT
));
63 Rectangle(hdc
, 19 - i
, i
* 14 + 7, 24 + i
, i
* 16 + 12);
65 DeleteObject(SelectObject(hdc
, oldPen
));
71 HPEN oldPen
= SelectObject(hdc
, CreatePen(PS_NULL
, 0, 0));
72 SelectObject(hdc
, GetSysColorBrush(COLOR_HIGHLIGHT
));
73 Rectangle(hdc
, brushStyle
% 3 * 13 + 2, brushStyle
/ 3 * 15 + 2, brushStyle
% 3 * 13 + 15,
74 brushStyle
/ 3 * 15 + 17);
75 DeleteObject(SelectObject(hdc
, oldPen
));
76 for(i
= 0; i
< 12; i
++)
77 Brush(hdc
, i
% 3 * 13 + 7, i
/ 3 * 15 + 8, i
% 3 * 13 + 7, i
/ 3 * 15 + 8,
78 GetSysColor((i
== brushStyle
) ? COLOR_HIGHLIGHTTEXT
: COLOR_WINDOWTEXT
), i
);
83 HPEN oldPen
= SelectObject(hdc
, CreatePen(PS_NULL
, 0, 0));
84 SelectObject(hdc
, GetSysColorBrush(COLOR_HIGHLIGHT
));
85 switch (airBrushWidth
)
88 Rectangle(hdc
, 2, 2, 21, 31);
91 Rectangle(hdc
, 20, 2, 41, 31);
94 Rectangle(hdc
, 2, 30, 16, 61);
97 Rectangle(hdc
, 15, 30, 41, 61);
100 Airbrush(hdc
, 10, 15,
101 GetSysColor((airBrushWidth
== 5) ? COLOR_HIGHLIGHTTEXT
: COLOR_WINDOWTEXT
), 5);
102 Airbrush(hdc
, 30, 15,
103 GetSysColor((airBrushWidth
== 8) ? COLOR_HIGHLIGHTTEXT
: COLOR_WINDOWTEXT
), 8);
105 GetSysColor((airBrushWidth
== 3) ? COLOR_HIGHLIGHTTEXT
: COLOR_WINDOWTEXT
), 3);
106 Airbrush(hdc
, 27, 45,
107 GetSysColor((airBrushWidth
== 12) ? COLOR_HIGHLIGHTTEXT
: COLOR_WINDOWTEXT
), 12);
108 DeleteObject(SelectObject(hdc
, oldPen
));
115 HPEN oldPen
= SelectObject(hdc
, CreatePen(PS_NULL
, 0, 0));
116 for(i
= 0; i
< 5; i
++)
118 if (lineWidth
== i
+ 1)
120 SelectObject(hdc
, GetSysColorBrush(COLOR_HIGHLIGHT
));
121 Rectangle(hdc
, 2, i
* 12 + 2, 41, i
* 12 + 14);
122 SelectObject(hdc
, GetSysColorBrush(COLOR_HIGHLIGHTTEXT
));
125 SelectObject(hdc
, GetSysColorBrush(COLOR_WINDOWTEXT
));
126 Rectangle(hdc
, 5, i
* 12 + 6, 38, i
* 12 + 8 + i
);
128 DeleteObject(SelectObject(hdc
, oldPen
));
137 HPEN oldPen
= SelectObject(hdc
, CreatePen(PS_NULL
, 0, 0));
138 for(i
= 0; i
< 3; i
++)
142 SelectObject(hdc
, GetSysColorBrush(COLOR_HIGHLIGHT
));
143 Rectangle(hdc
, 2, i
* 20 + 2, 41, i
* 20 + 22);
146 Rect(hdc
, 5, 6, 37, 16,
147 GetSysColor((shapeStyle
== 0) ? COLOR_HIGHLIGHTTEXT
: COLOR_WINDOWTEXT
),
148 GetSysColor(COLOR_APPWORKSPACE
), 1, 0);
149 Rect(hdc
, 5, 26, 37, 36,
150 GetSysColor((shapeStyle
== 1) ? COLOR_HIGHLIGHTTEXT
: COLOR_WINDOWTEXT
),
151 GetSysColor(COLOR_APPWORKSPACE
), 1, 1);
152 Rect(hdc
, 5, 46, 37, 56, GetSysColor(COLOR_APPWORKSPACE
), GetSysColor(COLOR_APPWORKSPACE
),
154 for(i
= 0; i
< 5; i
++)
156 if (lineWidth
== i
+ 1)
158 SelectObject(hdc
, GetSysColorBrush(COLOR_HIGHLIGHT
));
159 Rectangle(hdc
, 2, i
* 12 + 72, 41, i
* 12 + 84);
160 SelectObject(hdc
, GetSysColorBrush(COLOR_HIGHLIGHTTEXT
));
163 SelectObject(hdc
, GetSysColorBrush(COLOR_WINDOWTEXT
));
164 Rectangle(hdc
, 5, i
* 12 + 76, 38, i
* 12 + 78 + i
);
166 DeleteObject(SelectObject(hdc
, oldPen
));
170 ReleaseDC(hwnd
, hdc
);
175 int x
= GET_X_LPARAM(lParam
);
176 int y
= GET_Y_LPARAM(lParam
);
182 if ((y
> 1) && (y
< 64))
184 transpBg
= (y
- 2) / 31;
185 InvalidateRect(hwnd
, NULL
, TRUE
);
187 /* force refresh of selection contents */
188 SendMessage(hSelection
, WM_LBUTTONDOWN
, 0, MAKELPARAM(0, 0));
189 SendMessage(hSelection
, WM_MOUSEMOVE
, 0, MAKELPARAM(0, 0));
190 SendMessage(hSelection
, WM_LBUTTONUP
, 0, MAKELPARAM(0, 0));
194 if ((y
> 1) && (y
< 62))
196 rubberRadius
= (y
- 2) / 15 + 2;
197 InvalidateRect(hwnd
, NULL
, TRUE
);
201 if ((x
> 1) && (x
< 40) && (y
> 1)
204 brushStyle
= (y
- 2) / 15 * 3 + (x
- 2) / 13;
205 InvalidateRect(hwnd
, NULL
, TRUE
);
225 InvalidateRect(hwnd
, NULL
, TRUE
);
232 lineWidth
= (y
- 2) / 12 + 1;
233 InvalidateRect(hwnd
, NULL
, TRUE
);
242 shapeStyle
= (y
- 2) / 20;
243 InvalidateRect(hwnd
, NULL
, TRUE
);
245 if ((y
>= 70) && (y
<= 132))
247 lineWidth
= (y
- 72) / 12 + 1;
248 InvalidateRect(hwnd
, NULL
, TRUE
);
256 return DefWindowProc(hwnd
, message
, wParam
, lParam
);