8e873041327bbdf2f91cc5dd31bcefdb7e8e1444
2 * PROJECT: PAINT for ReactOS
5 * PURPOSE: Window procedure of the palette window
6 * PROGRAMMERS: Benedikt Freisen
9 /* INCLUDES *********************************************************/
12 #include "globalvar.h"
14 /* FUNCTIONS ********************************************************/
16 LRESULT CALLBACK
PalWinProc (HWND hwnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
22 RECT rc
= {0, 0, 31, 32};
23 HDC hDC
= GetDC(hwnd
);
28 DefWindowProc (hwnd
, message
, wParam
, lParam
);
30 for (b
= 2; b
< 30; b
++)
31 for (a
= 2; a
< 29; a
++)
33 SetPixel(hDC
, a
, b
, GetSysColor(COLOR_BTNHILIGHT
));
35 DrawEdge(hDC
, &rc
, EDGE_RAISED
, BF_TOPLEFT
);
36 DrawEdge(hDC
, &rc
, BDR_SUNKENOUTER
, BF_TOPLEFT
|BF_BOTTOMRIGHT
);
37 SetRect(&rc
, 11, 12, 26, 27);
38 DrawEdge(hDC
, &rc
, BDR_RAISEDINNER
, BF_RECT
|BF_MIDDLE
);
39 oldPen
= SelectObject(hDC
, CreatePen(PS_NULL
, 0, 0));
40 oldBrush
= SelectObject(hDC
, CreateSolidBrush(bgColor
));
41 Rectangle(hDC
, rc
.left
, rc
.top
+ 2, rc
.right
-1, rc
.bottom
- 1);
42 DeleteObject(SelectObject(hDC
, oldBrush
));
43 SetRect(&rc
, 4, 5, 19, 20);
44 DrawEdge(hDC
, &rc
, BDR_RAISEDINNER
, BF_RECT
|BF_MIDDLE
);
45 oldBrush
= SelectObject(hDC
, CreateSolidBrush(fgColor
));
46 Rectangle( hDC
, rc
.left
+ 2,rc
.top
+ 2, rc
.right
- 1, rc
.bottom
- 1);
47 DeleteObject(SelectObject(hDC
, oldBrush
));
48 DeleteObject(SelectObject(hDC
, oldPen
));
52 SetRect(&rc
, 31 + (i
% 14) * 16,
54 16 + 31 + (i
% 14) * 16,
55 16 + 0 + (i
/ 14) * 16);
56 DrawEdge(hDC
, &rc
, EDGE_RAISED
, BF_TOPLEFT
);
57 DrawEdge(hDC
, &rc
, BDR_SUNKENOUTER
, BF_RECT
);
58 oldPen
= SelectObject(hDC
, CreatePen(PS_NULL
, 0, 0));
59 oldBrush
= SelectObject(hDC
, CreateSolidBrush(palColors
[i
]));
60 Rectangle(hDC
, rc
.left
+ 2,rc
.top
+ 2,rc
.right
- 1, rc
.bottom
- 1);
61 DeleteObject(SelectObject(hDC
, oldBrush
));
62 DeleteObject(SelectObject(hDC
, oldPen
));
68 if (LOWORD(lParam
)>=31)
70 fgColor
= palColors
[(LOWORD(lParam
)-31)/16+(HIWORD(lParam
)/16)*14];
71 SendMessage(hwnd
, WM_PAINT
, 0, 0);
75 if (LOWORD(lParam
)>=31)
77 bgColor
= palColors
[(LOWORD(lParam
)-31)/16+(HIWORD(lParam
)/16)*14];
78 SendMessage(hwnd
, WM_PAINT
, 0, 0);
81 case WM_LBUTTONDBLCLK
:
82 if (LOWORD(lParam
)>=31) if (ChooseColor(&choosecolor
))
84 palColors
[(LOWORD(lParam
)-31)/16+(HIWORD(lParam
)/16)*14] = choosecolor
.rgbResult
;
85 fgColor
= choosecolor
.rgbResult
;
86 SendMessage(hwnd
, WM_PAINT
, 0, 0);
89 case WM_RBUTTONDBLCLK
:
90 if (LOWORD(lParam
)>=31) if (ChooseColor(&choosecolor
))
92 palColors
[(LOWORD(lParam
)-31)/16+(HIWORD(lParam
)/16)*14] = choosecolor
.rgbResult
;
93 bgColor
= choosecolor
.rgbResult
;
94 SendMessage(hwnd
, WM_PAINT
, 0, 0);
99 return DefWindowProc (hwnd
, message
, wParam
, lParam
);