Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

355 lines
5.6 KiB

  1. /*++
  2. Copyright (c) 1990-1998, Microsoft Corporation All rights reserved.
  3. Module Name:
  4. color.h
  5. Abstract:
  6. This module contains the header information for the Win32 color dialogs.
  7. Revision History:
  8. --*/
  9. //
  10. // Include Files.
  11. //
  12. #include <colordlg.h>
  13. #include <help.h>
  14. //
  15. // Constant Declarations.
  16. //
  17. #define COLORBOXES 64
  18. #define NUM_X_BOXES 8
  19. #define BOX_X_MARGIN 5
  20. #define BOX_Y_MARGIN 5
  21. //
  22. // Range of values for HLS scrollbars.
  23. // HLS-RGB conversions work best when RANGE is divisible by 6.
  24. //
  25. #define RANGE 240
  26. #define HLSMAX RANGE
  27. #define RGBMAX 255
  28. #define HUEINC 4
  29. #define SATINC 8
  30. #define LUMINC 8
  31. //
  32. // This used to be in wingdi.h, but recently moved to wingdip.h
  33. // Including wingdip.h causes too many compiler errors, so define
  34. // the one constant we need here.
  35. //
  36. #define HS_DITHEREDTEXTCLR 9
  37. #define COLORPROP (LPCTSTR) 0xA000L
  38. //
  39. // Typedef Declarations.
  40. //
  41. typedef struct {
  42. UINT ApiType;
  43. LPCHOOSECOLOR pCC;
  44. HANDLE hLocal;
  45. HANDLE hDialog;
  46. HPALETTE hPal;
  47. DWORD currentRGB;
  48. WORD currentHue;
  49. WORD currentSat;
  50. WORD currentLum;
  51. WORD nHueWidth;
  52. WORD nSatHeight;
  53. WORD nLumHeight;
  54. WORD nCurMix;
  55. WORD nCurDsp;
  56. WORD nCurBox;
  57. WORD nHuePos;
  58. WORD nSatPos;
  59. WORD nLumPos;
  60. RECT rOriginal;
  61. RECT rRainbow;
  62. RECT rLumScroll;
  63. RECT rLumPaint;
  64. RECT rCurrentColor;
  65. RECT rNearestPure;
  66. RECT rColorSamples;
  67. BOOL bFoldOut;
  68. DWORD rgbBoxColor[COLORBOXES];
  69. #ifdef UNICODE
  70. LPCHOOSECOLORA pCCA;
  71. #endif
  72. } COLORINFO;
  73. typedef COLORINFO *PCOLORINFO;
  74. #define LPDIS LPDRAWITEMSTRUCT
  75. //
  76. // Extern Declarations.
  77. //
  78. extern HDC hDCFastBlt;
  79. extern DWORD rgbClient;
  80. extern WORD gHue,gSat,gLum;
  81. extern HBITMAP hRainbowBitmap;
  82. extern BOOL bMouseCapture;
  83. extern WNDPROC lpprocStatic;
  84. extern SHORT nDriverColors;
  85. extern DWORD rgbBoxColor[COLORBOXES];
  86. extern TCHAR szOEMBIN[];
  87. extern RECT rColorBox[COLORBOXES];
  88. extern SHORT nBoxHeight, nBoxWidth;
  89. extern HWND hSave;
  90. extern WNDPROC qfnColorDlg;
  91. //
  92. // Context Help IDs.
  93. //
  94. const static DWORD aColorHelpIDs[] = // Context Help IDs
  95. {
  96. COLOR_BOX1, IDH_COLOR_BASIC,
  97. COLOR_CUSTOM1, IDH_COLOR_CUSTOM_CUSTOM,
  98. COLOR_MIX, IDH_COLOR_DEFINE,
  99. COLOR_RAINBOW, IDH_COLOR_SAMPLE_COLOR,
  100. COLOR_LUMSCROLL, IDH_COLOR_SAMPLE_SCROLL,
  101. COLOR_CURRENT, IDH_COLOR_COLOR_SOLID,
  102. COLOR_SOLID, IDH_COLOR_COLOR_SOLID,
  103. COLOR_SOLID_LEFT, IDH_COLOR_COLOR_SOLID,
  104. COLOR_SOLID_RIGHT, IDH_COLOR_COLOR_SOLID,
  105. COLOR_HUEACCEL, IDH_COLOR_HUE,
  106. COLOR_HUE, IDH_COLOR_HUE,
  107. COLOR_SATACCEL, IDH_COLOR_SAT,
  108. COLOR_SAT, IDH_COLOR_SAT,
  109. COLOR_LUMACCEL, IDH_COLOR_LUM,
  110. COLOR_LUM, IDH_COLOR_LUM,
  111. COLOR_REDACCEL, IDH_COLOR_RED,
  112. COLOR_RED, IDH_COLOR_RED,
  113. COLOR_GREENACCEL, IDH_COLOR_GREEN,
  114. COLOR_GREEN, IDH_COLOR_GREEN,
  115. COLOR_BLUEACCEL, IDH_COLOR_BLUE,
  116. COLOR_BLUE, IDH_COLOR_BLUE,
  117. COLOR_ADD, IDH_COLOR_ADD,
  118. 0, 0
  119. };
  120. //
  121. // Function Prototypes.
  122. //
  123. //
  124. // color.c
  125. //
  126. BOOL
  127. ChooseColorX(
  128. PCOLORINFO pCI);
  129. BOOL_PTR CALLBACK
  130. ColorDlgProc(
  131. HWND hDlg,
  132. UINT wMsg,
  133. WPARAM wParam,
  134. LPARAM lParam);
  135. BOOL
  136. ChangeColorBox(
  137. register PCOLORINFO pCI,
  138. DWORD dwRGBcolor);
  139. VOID
  140. HiLiteBox(
  141. HDC hDC,
  142. SHORT nBox,
  143. SHORT fStyle);
  144. VOID
  145. ChangeBoxSelection(
  146. PCOLORINFO pCI,
  147. SHORT nNewBox);
  148. VOID
  149. ChangeBoxFocus(
  150. PCOLORINFO pCI,
  151. SHORT nNewBox);
  152. BOOL
  153. ColorKeyDown(
  154. WPARAM wParam,
  155. int *id,
  156. PCOLORINFO pCI,
  157. BOOL bRTL);
  158. VOID
  159. PaintBox(
  160. PCOLORINFO pCI,
  161. register HDC hDC,
  162. SHORT i);
  163. BOOL
  164. InitScreenCoords(
  165. HWND hDlg,
  166. PCOLORINFO pCI);
  167. VOID
  168. SetupRainbowCapture(
  169. PCOLORINFO pCI);
  170. BOOL_PTR
  171. InitColor(
  172. HWND hDlg,
  173. WPARAM wParam,
  174. PCOLORINFO pCI);
  175. VOID
  176. ColorPaint(
  177. HWND hDlg,
  178. PCOLORINFO pCI,
  179. HDC hDC,
  180. LPRECT lpPaintRect);
  181. LONG WINAPI
  182. WantArrows(
  183. HWND hWnd,
  184. UINT msg,
  185. WPARAM wParam,
  186. LPARAM lParam);
  187. DWORD
  188. MapColor(
  189. PCOLORINFO pCI,
  190. DWORD rgb);
  191. VOID
  192. TermColor();
  193. #ifdef UNICODE
  194. VOID
  195. ThunkChooseColorA2W(
  196. PCOLORINFO pCI);
  197. VOID
  198. ThunkChooseColorW2A(
  199. PCOLORINFO pCI);
  200. #endif
  201. //
  202. // color2.c
  203. //
  204. VOID
  205. ChangeColorSettings(
  206. register PCOLORINFO pCI);
  207. VOID
  208. LumArrowPaint(
  209. HDC hDC,
  210. SHORT y,
  211. PCOLORINFO pCI);
  212. VOID
  213. EraseLumArrow(
  214. HDC hDC,
  215. PCOLORINFO pCI);
  216. VOID
  217. EraseCrossHair(
  218. HDC hDC,
  219. PCOLORINFO pCI);
  220. VOID
  221. CrossHairPaint(
  222. register HDC hDC,
  223. SHORT x,
  224. SHORT y,
  225. PCOLORINFO pCI);
  226. VOID
  227. NearestSolid(
  228. register PCOLORINFO pCI);
  229. VOID
  230. HLSPostoHLS(
  231. SHORT nHLSEdit,
  232. register PCOLORINFO pCI);
  233. VOID
  234. HLStoHLSPos(
  235. SHORT nHLSEdit,
  236. register PCOLORINFO pCI);
  237. VOID
  238. SetHLSEdit(
  239. SHORT nHLSEdit,
  240. register PCOLORINFO pCI);
  241. VOID
  242. SetRGBEdit(
  243. SHORT nRGBEdit,
  244. PCOLORINFO pCI);
  245. BOOL
  246. InitRainbow(
  247. register PCOLORINFO pCI);
  248. VOID
  249. PaintRainbow(
  250. HDC hDC,
  251. LPRECT lpRect,
  252. register PCOLORINFO pCI);
  253. void
  254. RainbowPaint(
  255. register PCOLORINFO pCI,
  256. HDC hDC,
  257. LPRECT lpPaintRect);
  258. VOID
  259. RGBtoHLS(
  260. DWORD lRGBColor);
  261. WORD
  262. HueToRGB(
  263. WORD n1,
  264. WORD n2,
  265. WORD hue);
  266. DWORD
  267. HLStoRGB(
  268. WORD hue,
  269. WORD lum,
  270. WORD sat);
  271. SHORT
  272. RGBEditChange(
  273. SHORT nDlgID,
  274. PCOLORINFO pCI);