ReactOS 0.4.17-dev-934-g091855f
colordlg.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "colordlg.h"
#include "commdlg.h"
#include "dlgs.h"
#include "cderr.h"
#include "cdlg.h"
#include "wine/debug.h"
#include "wine/heap.h"
Include dependency graph for colordlg.c:

Go to the source code of this file.

Classes

struct  CCPRIVATE
 

Macros

#define CONV_LPARAMTOPOINT(lp, p)   do { (p)->x = (short)LOWORD(lp); (p)->y = (short)HIWORD(lp); } while(0)
 
#define DISTANCE   4
 
#define MAXVERT   240
 
#define MAXHORI   239
 
#define XSTEPS   48
 
#define YSTEPS   24
 

Typedefs

typedef struct CCPRIVATE CCPRIV
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (commdlg)
 
static INT_PTR CALLBACK ColorDlgProc (HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
 
static int hsl_to_x (int hue, int sat, int lum)
 
static COLORREF CC_HSLtoRGB (int hue, int sat, int lum)
 
static int CC_RGBtoHSL (char c, COLORREF rgb)
 
static void CC_DrawCurrentFocusRect (const CCPRIV *lpp)
 
static void CC_DrawFocusRect (CCPRIV *lpp, HWND hwnd, int x, int y, int rows, int cols)
 
static BOOL CC_MouseCheckPredefColorArray (CCPRIV *lpp, int rows, int cols, LPARAM lParam)
 
static BOOL CC_MouseCheckUserColorArray (CCPRIV *lpp, int rows, int cols, LPARAM lParam)
 
static BOOL CC_MouseCheckColorGraph (HWND hDlg, int dlgitem, int *hori, int *vert, LPARAM lParam)
 
static BOOL CC_MouseCheckResultWindow (HWND hDlg, LPARAM lParam)
 
static int CC_CheckDigitsInEdit (CCPRIV *infoPtr, HWND hwnd, int maxval)
 
static void CC_PaintSelectedColor (const CCPRIV *infoPtr)
 
static void CC_PaintTriangle (CCPRIV *infoPtr)
 
static void CC_PaintCross (CCPRIV *infoPtr)
 
static void CC_PrepareColorGraph (CCPRIV *infoPtr)
 
static void CC_PaintColorGraph (CCPRIV *infoPtr)
 
static void CC_PaintLumBar (const CCPRIV *infoPtr)
 
static void CC_EditSetRGB (CCPRIV *infoPtr)
 
static void CC_EditSetHSL (CCPRIV *infoPtr)
 
static void CC_SwitchToFullSize (CCPRIV *infoPtr, const RECT *lprect)
 
static void CC_PaintPredefColorArray (const CCPRIV *infoPtr, int rows, int cols)
 
static void CC_PaintUserColorArray (const CCPRIV *infoPtr, int rows, int cols)
 
static BOOL CC_HookCallChk (const CHOOSECOLORW *lpcc)
 
static LRESULT CC_WMInitDialog (HWND hDlg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CC_WMCommand (CCPRIV *lpp, WPARAM wParam, LPARAM lParam, WORD notifyCode, HWND hwndCtl)
 
static LRESULT CC_WMPaint (CCPRIV *lpp)
 
static LRESULT CC_WMLButtonUp (CCPRIV *infoPtr)
 
static LRESULT CC_WMMouseMove (CCPRIV *infoPtr, LPARAM lParam)
 
static LRESULT CC_WMLButtonDown (CCPRIV *infoPtr, LPARAM lParam)
 
BOOL WINAPI ChooseColorW (CHOOSECOLORW *lpChCol)
 
BOOL WINAPI ChooseColorA (LPCHOOSECOLORA lpChCol)
 

Variables

static const COLORREF predefcolors [6][8]
 

Macro Definition Documentation

◆ CONV_LPARAMTOPOINT

#define CONV_LPARAMTOPOINT (   lp,
  p 
)    do { (p)->x = (short)LOWORD(lp); (p)->y = (short)HIWORD(lp); } while(0)

Definition at line 46 of file colordlg.c.

◆ DISTANCE

#define DISTANCE   4

Definition at line 256 of file colordlg.c.

◆ MAXHORI

#define MAXHORI   239

Definition at line 326 of file colordlg.c.

◆ MAXVERT

#define MAXVERT   240

Definition at line 325 of file colordlg.c.

◆ XSTEPS

#define XSTEPS   48

Definition at line 579 of file colordlg.c.

◆ YSTEPS

#define YSTEPS   24

Definition at line 580 of file colordlg.c.

Typedef Documentation

◆ CCPRIV

Function Documentation

◆ CC_CheckDigitsInEdit()

static int CC_CheckDigitsInEdit ( CCPRIV *  infoPtr,
HWND  hwnd,
int  maxval 
)
static

Definition at line 396 of file colordlg.c.

397{
398 int i, k, m, result, value;
399 char buffer[30];
400
402 m = strlen(buffer);
403 result = 0;
404
405 for (i = 0 ; i < m ; i++)
406 if (buffer[i] < '0' || buffer[i] > '9')
407 {
408 for (k = i + 1; k <= m; k++) /* delete bad character */
409 {
410 buffer[i] = buffer[k];
411 m--;
412 }
413 buffer[m] = 0;
414 result = 1;
415 }
416
417 value = atoi(buffer);
418 if (value > maxval) /* build a new string */
419 {
420 value = maxval;
421 sprintf(buffer, "%d", maxval);
422 result = 2;
423 }
424 if (result)
425 {
426 LRESULT editpos = SendMessageA(hwnd, EM_GETSEL, 0, 0);
427 infoPtr->updating = TRUE;
429 SendMessageA(hwnd, EM_SETSEL, 0, editpos);
430 infoPtr->updating = FALSE;
431 }
432 return value;
433}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
_ACRTIMP int __cdecl atoi(const char *)
Definition: string.c:1720
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
GLuint buffer
Definition: glext.h:5915
GLuint64EXT * result
Definition: glext.h:11304
const GLfloat * m
Definition: glext.h:10848
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LONG_PTR LRESULT
Definition: minwindef.h:176
#define sprintf
Definition: sprintf.c:45
int k
Definition: mpi.c:3369
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
#define EM_GETSEL
Definition: winuser.h:2026
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define EM_SETSEL
Definition: winuser.h:2047
BOOL updating
Definition: colordlg.c:83
Definition: pdh_main.c:64
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1300
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

Referenced by CC_WMCommand().

◆ CC_DrawCurrentFocusRect()

static void CC_DrawCurrentFocusRect ( const CCPRIV *  lpp)
static

Definition at line 220 of file colordlg.c.

221{
222 if (lpp->hwndFocus)
223 {
224 HDC hdc = GetDC(lpp->hwndFocus);
226 ReleaseDC(lpp->hwndFocus, hdc);
227 }
228}
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
RECT focusRect
Definition: colordlg.c:88
HWND hwndFocus
Definition: colordlg.c:89

Referenced by CC_DrawFocusRect(), CC_PaintPredefColorArray(), and CC_PaintUserColorArray().

◆ CC_DrawFocusRect()

static void CC_DrawFocusRect ( CCPRIV *  lpp,
HWND  hwnd,
int  x,
int  y,
int  rows,
int  cols 
)
static

Definition at line 233 of file colordlg.c.

234{
235 RECT rect;
236 int dx, dy;
237 HDC hdc;
238
239 CC_DrawCurrentFocusRect(lpp); /* remove current focus rect */
240 /* calculate new rect */
242 dx = (rect.right - rect.left) / cols;
243 dy = (rect.bottom - rect.top) / rows;
244 rect.left += (x * dx) - 2;
245 rect.top += (y * dy) - 2;
246 rect.right = rect.left + dx;
247 rect.bottom = rect.top + dy;
248 /* draw it */
249 hdc = GetDC(hwnd);
251 lpp->focusRect = rect;
252 lpp->hwndFocus = hwnd;
254}
static void CC_DrawCurrentFocusRect(const CCPRIV *lpp)
Definition: colordlg.c:220
RECT rect
Definition: combotst.c:67
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
Definition: dcommon.idl:28
long bottom
Definition: dcommon.idl:29
long right
Definition: dcommon.idl:29
long left
Definition: dcommon.idl:29
long top
Definition: dcommon.idl:29

Referenced by CC_MouseCheckPredefColorArray(), and CC_MouseCheckUserColorArray().

◆ CC_EditSetHSL()

static void CC_EditSetHSL ( CCPRIV *  infoPtr)
static

Definition at line 703 of file colordlg.c.

704{
705 if (IsWindowVisible( GetDlgItem(infoPtr->hwndSelf, COLOR_RAINBOW) )) /* if full size */
706 {
707 infoPtr->updating = TRUE;
708 SetDlgItemInt(infoPtr->hwndSelf, COLOR_HUE, infoPtr->h, TRUE);
709 SetDlgItemInt(infoPtr->hwndSelf, COLOR_SAT, infoPtr->s, TRUE);
710 SetDlgItemInt(infoPtr->hwndSelf, COLOR_LUM, infoPtr->l, TRUE);
711 infoPtr->updating = FALSE;
712 }
713 CC_PaintLumBar(infoPtr);
714}
static void CC_PaintLumBar(const CCPRIV *infoPtr)
Definition: colordlg.c:650
#define COLOR_HUE
Definition: colordlg.h:29
#define COLOR_LUM
Definition: colordlg.h:31
#define COLOR_RAINBOW
Definition: colordlg.h:36
#define COLOR_SAT
Definition: colordlg.h:30
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)
BOOL WINAPI IsWindowVisible(_In_ HWND)
HWND hwndSelf
Definition: colordlg.c:75
int s
Definition: colordlg.c:85
int l
Definition: colordlg.c:86
int h
Definition: colordlg.c:84

Referenced by CC_SwitchToFullSize(), CC_WMCommand(), CC_WMLButtonDown(), and CC_WMMouseMove().

◆ CC_EditSetRGB()

static void CC_EditSetRGB ( CCPRIV *  infoPtr)
static

Definition at line 683 of file colordlg.c.

684{
685 if (IsWindowVisible( GetDlgItem(infoPtr->hwndSelf, COLOR_RAINBOW) )) /* if full size */
686 {
687 COLORREF cr = infoPtr->lpcc->rgbResult;
688 int r = GetRValue(cr);
689 int g = GetGValue(cr);
690 int b = GetBValue(cr);
691
692 infoPtr->updating = TRUE;
696 infoPtr->updating = FALSE;
697 }
698}
#define COLOR_BLUE
Definition: ui.h:329
#define COLOR_RED
Definition: ui.h:332
#define COLOR_GREEN
Definition: ui.h:330
#define GetBValue(quad)
Definition: precomp.h:71
#define GetGValue(quad)
Definition: precomp.h:70
#define GetRValue(quad)
Definition: precomp.h:69
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean g
Definition: glext.h:6204
LPCHOOSECOLORW lpcc
Definition: colordlg.c:74
COLORREF rgbResult
Definition: commdlg.h:253
DWORD COLORREF
Definition: windef.h:100

Referenced by CC_SwitchToFullSize(), CC_WMCommand(), CC_WMLButtonDown(), and CC_WMMouseMove().

◆ CC_HookCallChk()

static BOOL CC_HookCallChk ( const CHOOSECOLORW *  lpcc)
static

Definition at line 846 of file colordlg.c.

847{
848 if (lpcc)
849 if(lpcc->Flags & CC_ENABLEHOOK)
850 if (lpcc->lpfnHook)
851 return TRUE;
852 return FALSE;
853}
#define CC_ENABLEHOOK
Definition: commdlg.h:54
LPCCHOOKPROC lpfnHook
Definition: commdlg.h:257

Referenced by CC_WMCommand(), CC_WMInitDialog(), and ColorDlgProc().

◆ CC_HSLtoRGB()

static COLORREF CC_HSLtoRGB ( int  hue,
int  sat,
int  lum 
)
static

Definition at line 129 of file colordlg.c.

130{
131 int h, r, g, b;
132
133 /* r */
134 h = hue > 80 ? hue-80 : hue+160;
135 r = hsl_to_x(h, sat, lum);
136 /* g */
137 h = hue > 160 ? hue-160 : hue+80;
138 g = hsl_to_x(h, sat, lum);
139 /* b */
140 b = hsl_to_x(hue, sat, lum);
141
142 return RGB(r, g, b);
143}
static int hsl_to_x(int hue, int sat, int lum)
Definition: colordlg.c:92
#define RGB(r, g, b)
Definition: precomp.h:67
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define b
Definition: ke_i.h:79

Referenced by CC_PaintLumBar(), CC_PrepareColorGraph(), CC_WMCommand(), CC_WMLButtonDown(), and CC_WMMouseMove().

◆ CC_MouseCheckColorGraph()

static BOOL CC_MouseCheckColorGraph ( HWND  hDlg,
int  dlgitem,
int *  hori,
int *  vert,
LPARAM  lParam 
)
static

Definition at line 338 of file colordlg.c.

339{
340 HWND hwnd;
341 POINT point;
342 RECT rect;
343 int x,y;
344
346 ClientToScreen(hDlg, &point);
347 hwnd = GetDlgItem( hDlg, dlgitem );
349
350 if (!PtInRect(&rect, point))
351 return FALSE;
352
355
356 x = (point.x * MAXHORI) / rect.right;
357 y = ((rect.bottom - point.y) * MAXVERT) / rect.bottom;
358
359 if (x < 0) x = 0;
360 if (y < 0) y = 0;
361 if (x > MAXHORI) x = MAXHORI;
362 if (y > MAXVERT) y = MAXVERT;
363
364 if (hori)
365 *hori = x;
366 if (vert)
367 *vert = y;
368
369 return TRUE;
370}
#define MAXHORI
Definition: colordlg.c:326
#define MAXVERT
Definition: colordlg.c:325
#define CONV_LPARAMTOPOINT(lp, p)
Definition: colordlg.c:46
LPARAM lParam
Definition: combotst.c:139
POINTL point
Definition: edittest.c:50
if(dx< 0)
Definition: linetemp.h:194
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
LONG y
Definition: windef.h:130
LONG x
Definition: windef.h:129

Referenced by CC_WMLButtonDown(), and CC_WMMouseMove().

◆ CC_MouseCheckPredefColorArray()

static BOOL CC_MouseCheckPredefColorArray ( CCPRIV *  lpp,
int  rows,
int  cols,
LPARAM  lParam 
)
static

Definition at line 262 of file colordlg.c.

263{
264 HWND hwnd;
265 POINT point;
266 RECT rect;
267 int dx, dy, x, y;
268
273 if (PtInRect(&rect, point))
274 {
275 dx = (rect.right - rect.left) / cols;
276 dy = (rect.bottom - rect.top) / rows;
278
279 if (point.x % dx < ( dx - DISTANCE) && point.y % dy < ( dy - DISTANCE))
280 {
281 x = point.x / dx;
282 y = point.y / dy;
283 lpp->lpcc->rgbResult = predefcolors[y][x];
284 CC_DrawFocusRect(lpp, hwnd, x, y, rows, cols);
285 return TRUE;
286 }
287 }
288 return FALSE;
289}
static void CC_DrawFocusRect(CCPRIV *lpp, HWND hwnd, int x, int y, int rows, int cols)
Definition: colordlg.c:233
static const COLORREF predefcolors[6][8]
Definition: colordlg.c:48
#define DISTANCE
Definition: colordlg.c:256
#define COLOR_BOX1
Definition: colordlg.h:46

Referenced by CC_WMLButtonDown().

◆ CC_MouseCheckResultWindow()

static BOOL CC_MouseCheckResultWindow ( HWND  hDlg,
LPARAM  lParam 
)
static

Definition at line 375 of file colordlg.c.

376{
377 HWND hwnd;
378 POINT point;
379 RECT rect;
380
382 ClientToScreen(hDlg, &point);
385 if (PtInRect(&rect, point))
386 {
388 return TRUE;
389 }
390 return FALSE;
391}
#define COLOR_CURRENT
Definition: colordlg.h:35
#define COLOR_SOLID
Definition: colordlg.h:39
#define WM_COMMAND
Definition: winuser.h:1768
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by ColorDlgProc().

◆ CC_MouseCheckUserColorArray()

static BOOL CC_MouseCheckUserColorArray ( CCPRIV *  lpp,
int  rows,
int  cols,
LPARAM  lParam 
)
static

Definition at line 295 of file colordlg.c.

296{
297 HWND hwnd;
298 POINT point;
299 RECT rect;
300 int dx, dy, x, y;
301 COLORREF *crarr = lpp->lpcc->lpCustColors;
302
307 if (PtInRect(&rect, point))
308 {
309 dx = (rect.right - rect.left) / cols;
310 dy = (rect.bottom - rect.top) / rows;
312
313 if (point.x % dx < (dx - DISTANCE) && point.y % dy < (dy - DISTANCE))
314 {
315 x = point.x / dx;
316 y = point.y / dy;
317 lpp->lpcc->rgbResult = crarr[x + (cols * y) ];
318 CC_DrawFocusRect(lpp, hwnd, x, y, rows, cols);
319 return TRUE;
320 }
321 }
322 return FALSE;
323}
#define COLOR_CUSTOM1
Definition: colordlg.h:47
COLORREF * lpCustColors
Definition: commdlg.h:254

Referenced by CC_WMLButtonDown().

◆ CC_PaintColorGraph()

static void CC_PaintColorGraph ( CCPRIV *  infoPtr)
static

Definition at line 626 of file colordlg.c.

627{
629 HDC hDC;
630 RECT rect;
631
632 if (IsWindowVisible(hwnd)) /* if full size */
633 {
634 if (!infoPtr->hdcMem)
635 CC_PrepareColorGraph(infoPtr); /* should not be necessary */
636
637 hDC = GetDC(hwnd);
639 if (infoPtr->hdcMem)
640 BitBlt(hDC, 0, 0, rect.right, rect.bottom, infoPtr->hdcMem, 0, 0, SRCCOPY);
641 else
642 WARN("choose color: hdcMem is not defined\n");
644 }
645}
static HDC hDC
Definition: 3dtext.c:33
#define WARN(fmt,...)
Definition: precomp.h:61
static void CC_PrepareColorGraph(CCPRIV *infoPtr)
Definition: colordlg.c:586
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Height *Stride) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Stride)
Definition: common.c:42
HDC hdcMem
Definition: colordlg.c:77
#define SRCCOPY
Definition: wingdi.h:333

Referenced by CC_WMPaint().

◆ CC_PaintCross()

static void CC_PaintCross ( CCPRIV *  infoPtr)
static

Definition at line 515 of file colordlg.c.

516{
518
519 if (IsWindowVisible(hwnd)) /* if full size */
520 {
521 HDC hDC;
522#ifdef __REACTOS__
523 int w = 8, wc = 6;
524#else
525 int w = GetDialogBaseUnits() - 1;
526 int wc = GetDialogBaseUnits() * 3 / 4;
527#endif
528 RECT rect;
529 POINT point, p;
530 HRGN region;
531 HPEN hPen;
532 int x, y;
533
534 x = infoPtr->h;
535 y = infoPtr->s;
536
538 hDC = GetDC(hwnd);
542
543 point.x = (rect.right * x) / MAXHORI;
544 point.y = rect.bottom - (rect.bottom * y) / MAXVERT;
545 if ( infoPtr->oldcross.left != infoPtr->oldcross.right )
546 BitBlt(hDC, infoPtr->oldcross.left, infoPtr->oldcross.top,
547 infoPtr->oldcross.right - infoPtr->oldcross.left,
548 infoPtr->oldcross.bottom - infoPtr->oldcross.top,
549 infoPtr->hdcMem, infoPtr->oldcross.left, infoPtr->oldcross.top, SRCCOPY);
550#ifdef __REACTOS__
551 infoPtr->oldcross.left = point.x - w - 3;
552 infoPtr->oldcross.right = point.x + w + 3;
553 infoPtr->oldcross.top = point.y - w - 3;
554 infoPtr->oldcross.bottom = point.y + w + 3;
555#else
556 infoPtr->oldcross.left = point.x - w - 1;
557 infoPtr->oldcross.right = point.x + w + 1;
558 infoPtr->oldcross.top = point.y - w - 1;
559 infoPtr->oldcross.bottom = point.y + w + 1;
560#endif
561
562 hPen = CreatePen(PS_SOLID, 3, RGB(0, 0, 0)); /* -black- color */
563 hPen = SelectObject(hDC, hPen);
564 MoveToEx(hDC, point.x - w, point.y, &p);
565 LineTo(hDC, point.x - wc, point.y);
566 MoveToEx(hDC, point.x + wc, point.y, &p);
567 LineTo(hDC, point.x + w, point.y);
568 MoveToEx(hDC, point.x, point.y - w, &p);
569 LineTo(hDC, point.x, point.y - wc);
570 MoveToEx(hDC, point.x, point.y + wc, &p);
571 LineTo(hDC, point.x, point.y + w);
573
575 }
576}
pKey DeleteObject()
GLfloat GLfloat p
Definition: glext.h:8902
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
LONG WINAPI GetDialogBaseUnits(void)
Definition: dialog.c:2164
RECT oldcross
Definition: colordlg.c:82
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
HRGN WINAPI CreateRectRgnIndirect(_In_ LPCRECT)
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
#define PS_SOLID
Definition: wingdi.h:586

Referenced by CC_WMCommand(), CC_WMInitDialog(), CC_WMLButtonDown(), CC_WMLButtonUp(), CC_WMMouseMove(), and CC_WMPaint().

◆ CC_PaintLumBar()

static void CC_PaintLumBar ( const CCPRIV *  infoPtr)
static

Definition at line 650 of file colordlg.c.

651{
654 int lum, ldif, ydif;
655 HBRUSH hbrush;
656 HDC hDC;
657
659 {
660 hDC = GetDC(hwnd);
662 rect = client;
663
664 ldif = 240 / YSTEPS;
665 ydif = client.bottom / YSTEPS+1;
666 for (lum = 0; lum < 240 + ldif; lum += ldif)
667 {
668 rect.top = max(0, rect.bottom - ydif);
669 hbrush = CreateSolidBrush(CC_HSLtoRGB(infoPtr->h, infoPtr->s, lum));
673 }
677 }
678}
static HBRUSH hbrush
#define YSTEPS
Definition: colordlg.c:580
static COLORREF CC_HSLtoRGB(int hue, int sat, int lum)
Definition: colordlg.c:129
#define COLOR_LUMSCROLL
Definition: colordlg.h:28
#define BDR_SUNKENOUTER
Definition: winuser.h:443
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define BF_RECT
Definition: winuser.h:462
static FILE * client
Definition: client.c:37
#define max(a, b)
Definition: svc.c:63
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)

Referenced by CC_EditSetHSL(), CC_WMCommand(), and CC_WMPaint().

◆ CC_PaintPredefColorArray()

static void CC_PaintPredefColorArray ( const CCPRIV *  infoPtr,
int  rows,
int  cols 
)
static

Definition at line 750 of file colordlg.c.

751{
753 RECT rect, blockrect;
754 HDC hdc;
755 HBRUSH hBrush;
756 int dx, dy, i, j, k;
757
759 dx = rect.right / cols;
760 dy = rect.bottom / rows;
761 k = rect.left;
762
763 hdc = GetDC(hwnd);
765 hBrush = (HBRUSH)GetClassLongPtrW( hwnd, GCLP_HBRBACKGROUND);
766 if (!hBrush) hBrush = GetSysColorBrush(COLOR_BTNFACE);
767 FillRect(hdc, &rect, hBrush);
768 for ( j = 0; j < rows; j++ )
769 {
770 for ( i = 0; i < cols; i++ )
771 {
772 hBrush = CreateSolidBrush(predefcolors[j][i]);
773 if (hBrush)
774 {
775 blockrect.left = rect.left;
776 blockrect.top = rect.top;
777 blockrect.right = rect.left + dx - DISTANCE;
778 blockrect.bottom = rect.top + dy - DISTANCE;
779 FillRect(hdc, &blockrect, hBrush);
780 DrawEdge(hdc, &blockrect, BDR_SUNKEN, BF_RECT);
781 DeleteObject(hBrush);
782 }
783 rect.left += dx;
784 }
785 rect.top += dy;
786 rect.left = k;
787 }
789 if (infoPtr->hwndFocus == hwnd)
791}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define BDR_SUNKEN
Definition: winuser.h:449
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define GetClassLongPtrW
Definition: winuser.h:4718
#define GCLP_HBRBACKGROUND
Definition: winuser.h:680
#define COLOR_BTNFACE
Definition: winuser.h:939

Referenced by CC_WMPaint().

◆ CC_PaintSelectedColor()

static void CC_PaintSelectedColor ( const CCPRIV *  infoPtr)
static

Definition at line 440 of file colordlg.c.

441{
442 if (IsWindowVisible( GetDlgItem(infoPtr->hwndSelf, COLOR_RAINBOW) )) /* if full size */
443 {
444 RECT rect;
445 HDC hdc;
446 HBRUSH hBrush;
448
449 hdc = GetDC(hwnd);
451 hBrush = CreateSolidBrush(infoPtr->lpcc->rgbResult);
452 if (hBrush)
453 {
454 FillRect(hdc, &rect, hBrush);
456 DeleteObject(hBrush);
457 }
459 }
460}

Referenced by CC_WMCommand(), CC_WMInitDialog(), CC_WMLButtonDown(), CC_WMMouseMove(), and CC_WMPaint().

◆ CC_PaintTriangle()

static void CC_PaintTriangle ( CCPRIV *  infoPtr)
static

Definition at line 465 of file colordlg.c.

466{
467 HDC hDC;
468 int temp;
469 int w = LOWORD(GetDialogBaseUnits()) / 2;
470 POINT points[3];
471 int height;
472 int oben;
473 RECT rect;
474 HBRUSH hbr;
476
477 if (IsWindowVisible( GetDlgItem(infoPtr->hwndSelf, COLOR_RAINBOW))) /* if full size */
478 {
481 hDC = GetDC(infoPtr->hwndSelf);
482 points[0].y = rect.top;
483 points[0].x = rect.right; /* | /| */
484 ClientToScreen(hwnd, points); /* | / | */
485 ScreenToClient(infoPtr->hwndSelf, points); /* |< | */
486 oben = points[0].y; /* | \ | */
487 /* | \| */
488 temp = height * infoPtr->l;
489 points[0].x += 1;
490 points[0].y = oben + height - temp / MAXVERT;
491 points[1].y = points[0].y + w;
492 points[2].y = points[0].y - w;
493 points[2].x = points[1].x = points[0].x + w;
494
496 if (!hbr) hbr = GetSysColorBrush(COLOR_BTNFACE);
497 FillRect(hDC, &infoPtr->old3angle, hbr);
498 infoPtr->old3angle.left = points[0].x;
499 infoPtr->old3angle.right = points[1].x + 1;
500 infoPtr->old3angle.top = points[2].y - 1;
501 infoPtr->old3angle.bottom= points[1].y + 1;
502
504 Polygon(hDC, points, 3);
505 SelectObject(hDC, hbr);
506
507 ReleaseDC(infoPtr->hwndSelf, hDC);
508 }
509}
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLsizei const GLfloat * points
Definition: glext.h:8112
#define LOWORD(l)
Definition: pedump.c:82
BOOL Polygon(CONST PPOINT UnsafePoints, int Count, int polyFillMode)
Definition: polytest.cpp:730
static calc_node_t temp
Definition: rpn_ieee.c:38
RECT old3angle
Definition: colordlg.c:81
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define BLACK_BRUSH
Definition: wingdi.h:896

Referenced by CC_WMCommand(), CC_WMInitDialog(), CC_WMLButtonDown(), CC_WMMouseMove(), and CC_WMPaint().

◆ CC_PaintUserColorArray()

static void CC_PaintUserColorArray ( const CCPRIV *  infoPtr,
int  rows,
int  cols 
)
static

Definition at line 796 of file colordlg.c.

797{
799 RECT rect, blockrect;
800 HDC hdc;
801 HBRUSH hBrush;
802 int dx, dy, i, j, k;
803
805
806 dx = rect.right / cols;
807 dy = rect.bottom / rows;
808 k = rect.left;
809
810 hdc = GetDC(hwnd);
811 if (hdc)
812 {
813 hBrush = (HBRUSH)GetClassLongPtrW( hwnd, GCLP_HBRBACKGROUND);
814 if (!hBrush) hBrush = GetSysColorBrush(COLOR_BTNFACE);
815 FillRect( hdc, &rect, hBrush );
816 for (j = 0; j < rows; j++)
817 {
818 for (i = 0; i < cols; i++)
819 {
820 hBrush = CreateSolidBrush(infoPtr->lpcc->lpCustColors[i+j*cols]);
821 if (hBrush)
822 {
823 blockrect.left = rect.left;
824 blockrect.top = rect.top;
825 blockrect.right = rect.left + dx - DISTANCE;
826 blockrect.bottom = rect.top + dy - DISTANCE;
827 FillRect(hdc, &blockrect, hBrush);
828 DrawEdge(hdc, &blockrect, BDR_SUNKEN, BF_RECT);
829 DeleteObject(hBrush);
830 }
831 rect.left += dx;
832 }
833 rect.top += dy;
834 rect.left = k;
835 }
837 }
838 if (infoPtr->hwndFocus == hwnd)
840}

Referenced by CC_WMCommand(), and CC_WMPaint().

◆ CC_PrepareColorGraph()

static void CC_PrepareColorGraph ( CCPRIV *  infoPtr)
static

Definition at line 586 of file colordlg.c.

587{
588 int sdif, hdif, xdif, ydif, hue, sat;
590 HBRUSH hbrush;
591 HDC hdc ;
593 HCURSOR hcursor = SetCursor( LoadCursorW(0, (LPCWSTR)IDC_WAIT) );
594
596 hdc = GetDC(hwnd);
597 infoPtr->hdcMem = CreateCompatibleDC(hdc);
598 infoPtr->hbmMem = CreateCompatibleBitmap(hdc, client.right, client.bottom);
599 SelectObject(infoPtr->hdcMem, infoPtr->hbmMem);
600
601 xdif = client.right / XSTEPS;
602 ydif = client.bottom / YSTEPS+1;
603 hdif = 239 / XSTEPS;
604 sdif = 240 / YSTEPS;
605 for (rect.left = hue = 0; hue < 239 + hdif; hue += hdif)
606 {
607 rect.right = rect.left + xdif;
608 rect.bottom = client.bottom;
609 for(sat = 0; sat < 240 + sdif; sat += sdif)
610 {
611 rect.top = rect.bottom - ydif;
612 hbrush = CreateSolidBrush(CC_HSLtoRGB(hue, sat, 120));
613 FillRect(infoPtr->hdcMem, &rect, hbrush);
616 }
618 }
620 SetCursor(hcursor);
621}
#define XSTEPS
Definition: colordlg.c:579
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2474
#define IDC_WAIT
Definition: winuser.h:697
HBITMAP hbmMem
Definition: colordlg.c:78
const uint16_t * LPCWSTR
Definition: typedefs.h:57
HICON HCURSOR
Definition: windef.h:99
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)

Referenced by CC_PaintColorGraph(), and CC_SwitchToFullSize().

◆ CC_RGBtoHSL()

static int CC_RGBtoHSL ( char  c,
COLORREF  rgb 
)
static

Definition at line 148 of file colordlg.c.

149{
150 WORD maxi, mini, mmsum, mmdif, result = 0;
151 int iresult = 0, r, g, b;
152
153 r = GetRValue(rgb);
154 g = GetGValue(rgb);
155 b = GetBValue(rgb);
156
157 maxi = max(r, b);
158 maxi = max(maxi, g);
159 mini = min(r, b);
160 mini = min(mini, g);
161
162 mmsum = maxi + mini;
163 mmdif = maxi - mini;
164
165 switch(c)
166 {
167 /* lum */
168 case 'L': mmsum *= 120; /* 0...61200=(255+255)*120 */
169 result = mmsum / 255; /* 0...240 */
170 break;
171 /* saturation */
172 case 'S': if (!mmsum)
173 result = 0;
174 else
175 if (!mini || maxi == 255)
176 result = 240;
177 else
178 {
179 result = mmdif * 240; /* 0...61200=255*240 */
180 result /= (mmsum > 255 ? 510 - mmsum : mmsum); /* 0..255 */
181 }
182 break;
183 /* hue */
184 case 'H': if (!mmdif)
185 result = 160;
186 else
187 {
188 if (maxi == r)
189 {
190 iresult = 40 * (g - b); /* -10200 ... 10200 */
191 iresult /= (int) mmdif; /* -40 .. 40 */
192 if (iresult < 0)
193 iresult += 240; /* 0..40 and 200..240 */
194 }
195 else
196 if (maxi == g)
197 {
198 iresult = 40 * (b - r);
199 iresult /= (int) mmdif;
200 iresult += 80; /* 40 .. 120 */
201 }
202 else
203 if (maxi == b)
204 {
205 iresult = 40 * (r - g);
206 iresult /= (int) mmdif;
207 iresult += 160; /* 120 .. 200 */
208 }
209 result = iresult;
210 }
211 break;
212 }
213 return result; /* is this integer arithmetic precise enough ? */
214}
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
unsigned short WORD
Definition: ntddk_ex.h:93
const GLubyte * c
Definition: glext.h:8905
#define min(a, b)
Definition: monoChain.cc:55
_In_ ULONG _In_ ULONG rgb
Definition: winddi.h:3521

Referenced by CC_WMCommand(), CC_WMInitDialog(), and CC_WMLButtonDown().

◆ CC_SwitchToFullSize()

static void CC_SwitchToFullSize ( CCPRIV *  infoPtr,
const RECT *  lprect 
)
static

Definition at line 719 of file colordlg.c.

720{
721 int i;
722
724 CC_PrepareColorGraph(infoPtr);
725 for (i = COLOR_HUE; i <= COLOR_BLUE; i++)
726 ShowWindow( GetDlgItem(infoPtr->hwndSelf, i), SW_SHOW);
727 for (i = COLOR_HUEACCEL; i <= COLOR_BLUEACCEL; i++)
728 ShowWindow( GetDlgItem(infoPtr->hwndSelf, i), SW_SHOW);
731 ShowWindow( GetDlgItem(infoPtr->hwndSelf, 1090), SW_SHOW);
732
733 if (lprect)
734 SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, lprect->right-lprect->left,
735 lprect->bottom-lprect->top, SWP_NOMOVE|SWP_NOZORDER);
736
739
740 CC_EditSetRGB(infoPtr);
741 CC_EditSetHSL(infoPtr);
744}
static void CC_EditSetRGB(CCPRIV *infoPtr)
Definition: colordlg.c:683
static void CC_EditSetHSL(CCPRIV *infoPtr)
Definition: colordlg.c:703
#define COLOR_ADD
Definition: colordlg.h:38
#define COLOR_HUEACCEL
Definition: colordlg.h:49
#define COLOR_MIX
Definition: colordlg.h:45
#define COLOR_BLUEACCEL
Definition: colordlg.h:54
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOMOVE
Definition: winuser.h:1255
BOOL WINAPI UpdateWindow(_In_ HWND)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define SW_SHOW
Definition: winuser.h:786
#define SWP_NOZORDER
Definition: winuser.h:1258

Referenced by CC_WMCommand(), and CC_WMInitDialog().

◆ CC_WMCommand()

static LRESULT CC_WMCommand ( CCPRIV *  lpp,
WPARAM  wParam,
LPARAM  lParam,
WORD  notifyCode,
HWND  hwndCtl 
)
static

Definition at line 968 of file colordlg.c.

969{
970 int r, g, b, i, xx;
971 UINT cokmsg;
972 HDC hdc;
973 COLORREF *cr;
974
975 TRACE("CC_WMCommand wParam=%Ix lParam=%Ix\n", wParam, lParam);
976 switch (LOWORD(wParam))
977 {
978 case COLOR_RED: /* edit notify RGB */
979 case COLOR_GREEN:
980 case COLOR_BLUE:
981 if (notifyCode == EN_UPDATE && !lpp->updating)
982 {
983 i = CC_CheckDigitsInEdit(lpp, hwndCtl, 255);
984 r = GetRValue(lpp->lpcc->rgbResult);
985 g = GetGValue(lpp->lpcc->rgbResult);
986 b = GetBValue(lpp->lpcc->rgbResult);
987 xx = 0;
988 switch (LOWORD(wParam))
989 {
990 case COLOR_RED: if ((xx = (i != r))) r = i; break;
991 case COLOR_GREEN: if ((xx = (i != g))) g = i; break;
992 case COLOR_BLUE: if ((xx = (i != b))) b = i; break;
993 }
994 if (xx) /* something has changed */
995 {
996 lpp->lpcc->rgbResult = RGB(r, g, b);
998 lpp->h = CC_RGBtoHSL('H', lpp->lpcc->rgbResult);
999 lpp->s = CC_RGBtoHSL('S', lpp->lpcc->rgbResult);
1000 lpp->l = CC_RGBtoHSL('L', lpp->lpcc->rgbResult);
1001 CC_EditSetHSL(lpp);
1002 CC_PaintCross(lpp);
1003 CC_PaintTriangle(lpp);
1004#ifdef __REACTOS__
1005 CC_PaintLumBar(lpp);
1006#endif
1007 }
1008 }
1009 break;
1010
1011 case COLOR_HUE: /* edit notify HSL */
1012 case COLOR_SAT:
1013 case COLOR_LUM:
1014 if (notifyCode == EN_UPDATE && !lpp->updating)
1015 {
1016 i = CC_CheckDigitsInEdit(lpp, hwndCtl, LOWORD(wParam) == COLOR_HUE ? 239 : 240);
1017 xx = 0;
1018 switch (LOWORD(wParam))
1019 {
1020 case COLOR_HUE: if ((xx = ( i != lpp->h))) lpp->h = i; break;
1021 case COLOR_SAT: if ((xx = ( i != lpp->s))) lpp->s = i; break;
1022 case COLOR_LUM: if ((xx = ( i != lpp->l))) lpp->l = i; break;
1023 }
1024 if (xx) /* something has changed */
1025 {
1026 lpp->lpcc->rgbResult = CC_HSLtoRGB(lpp->h, lpp->s, lpp->l);
1028 CC_EditSetRGB(lpp);
1029 CC_PaintCross(lpp);
1030 CC_PaintTriangle(lpp);
1031 CC_PaintLumBar(lpp);
1032 }
1033 }
1034 break;
1035
1036 case COLOR_MIX:
1037 CC_SwitchToFullSize(lpp, &lpp->fullsize);
1039 break;
1040
1041 case COLOR_ADD: /* add colors ... column by column */
1042 cr = lpp->lpcc->lpCustColors;
1043 cr[(lpp->nextuserdef % 2) * 8 + lpp->nextuserdef / 2] = lpp->lpcc->rgbResult;
1044 if (++lpp->nextuserdef == 16)
1045 lpp->nextuserdef = 0;
1046 CC_PaintUserColorArray(lpp, 2, 8);
1047 break;
1048
1049 case COLOR_SOLID: /* resulting color */
1050 hdc = GetDC(lpp->hwndSelf);
1052 ReleaseDC(lpp->hwndSelf, hdc);
1053 CC_EditSetRGB(lpp);
1055 lpp->h = CC_RGBtoHSL('H', lpp->lpcc->rgbResult);
1056 lpp->s = CC_RGBtoHSL('S', lpp->lpcc->rgbResult);
1057 lpp->l = CC_RGBtoHSL('L', lpp->lpcc->rgbResult);
1058 CC_EditSetHSL(lpp);
1059 CC_PaintCross(lpp);
1060 CC_PaintTriangle(lpp);
1061 break;
1062
1063 case pshHelp: /* Help! */ /* The Beatles, 1965 ;-) */
1065 if (lpp->lpcc->hwndOwner)
1066 SendMessageA(lpp->lpcc->hwndOwner, i, 0, (LPARAM)lpp->lpcc);
1067 if ( CC_HookCallChk(lpp->lpcc))
1069 WM_COMMAND, psh15, (LPARAM)lpp->lpcc);
1070 break;
1071
1072 case IDOK :
1074 if (lpp->lpcc->hwndOwner)
1075 if (SendMessageA(lpp->lpcc->hwndOwner, cokmsg, 0, (LPARAM)lpp->lpcc))
1076 break; /* do NOT close */
1077 EndDialog(lpp->hwndSelf, 1) ;
1078 return TRUE ;
1079
1080 case IDCANCEL :
1081 EndDialog(lpp->hwndSelf, 0) ;
1082 return TRUE ;
1083
1084 }
1085 return FALSE;
1086}
static void CC_PaintSelectedColor(const CCPRIV *infoPtr)
Definition: colordlg.c:440
static void CC_PaintTriangle(CCPRIV *infoPtr)
Definition: colordlg.c:465
static void CC_PaintCross(CCPRIV *infoPtr)
Definition: colordlg.c:515
static BOOL CC_HookCallChk(const CHOOSECOLORW *lpcc)
Definition: colordlg.c:846
static void CC_SwitchToFullSize(CCPRIV *infoPtr, const RECT *lprect)
Definition: colordlg.c:719
static void CC_PaintUserColorArray(const CCPRIV *infoPtr, int rows, int cols)
Definition: colordlg.c:796
static int CC_RGBtoHSL(char c, COLORREF rgb)
Definition: colordlg.c:148
static int CC_CheckDigitsInEdit(CCPRIV *infoPtr, HWND hwnd, int maxval)
Definition: colordlg.c:396
WPARAM wParam
Definition: combotst.c:138
#define HELPMSGSTRINGA
Definition: commdlg.h:20
#define COLOROKSTRINGA
Definition: commdlg.h:18
#define pshHelp
Definition: dlgs.h:132
#define psh15
Definition: dlgs.h:131
unsigned int UINT
Definition: sysinfo.c:13
LONG_PTR LPARAM
Definition: minwindef.h:175
int xx
Definition: npserver.c:29
UINT WINAPI RegisterWindowMessageA(_In_ LPCSTR)
#define IDCANCEL
Definition: winuser.h:842
#define EN_UPDATE
Definition: winuser.h:2057
#define IDOK
Definition: winuser.h:841
HWND WINAPI SetFocus(_In_opt_ HWND)
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:3014
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define TRACE(s)
Definition: solgame.cpp:4
int nextuserdef
Definition: colordlg.c:76
RECT fullsize
Definition: colordlg.c:79
HWND hwndOwner
Definition: commdlg.h:251
COLORREF WINAPI GetNearestColor(_In_ HDC, _In_ COLORREF)

Referenced by ColorDlgProc().

◆ CC_WMInitDialog()

static LRESULT CC_WMInitDialog ( HWND  hDlg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 858 of file colordlg.c.

859{
861 int i, res;
862 int r, g, b;
863 HWND hwnd;
864 RECT rect;
865 POINT point;
866 CCPRIV *lpp;
867
868 TRACE("WM_INITDIALOG lParam=%08IX\n", lParam);
869
870 if (cc->lStructSize != sizeof(CHOOSECOLORW))
871 {
872 EndDialog(hDlg, 0);
873 return FALSE;
874 }
875
876 lpp = heap_alloc_zero(sizeof(*lpp));
877 lpp->lpcc = cc;
878 lpp->hwndSelf = hDlg;
879
880 SetPropW( hDlg, L"colourdialogprop", lpp );
881
882 if (!(lpp->lpcc->Flags & CC_SHOWHELP))
885
886#if 0
887 cpos = MAKELONG(5,7); /* init */
888 if (lpp->lpcc->Flags & CC_RGBINIT)
889 {
890 for (i = 0; i < 6; i++)
891 for (j = 0; j < 8; j++)
892 if (predefcolors[i][j] == lpp->lpcc->rgbResult)
893 {
894 cpos = MAKELONG(i,j);
895 goto found;
896 }
897 }
898 found:
899 /* FIXME: Draw_a_focus_rect & set_init_values */
900#endif
901
902 GetWindowRect(hDlg, &lpp->fullsize);
903 if (lpp->lpcc->Flags & CC_FULLOPEN || lpp->lpcc->Flags & CC_PREVENTFULLOPEN)
904 {
905 hwnd = GetDlgItem(hDlg, COLOR_MIX);
907 }
908 if (!(lpp->lpcc->Flags & CC_FULLOPEN ) || lpp->lpcc->Flags & CC_PREVENTFULLOPEN)
909 {
910 rect = lpp->fullsize;
911 res = rect.bottom - rect.top;
912 hwnd = GetDlgItem(hDlg, COLOR_RAINBOW); /* cut at left border */
913 point.x = point.y = 0;
915 ScreenToClient(hDlg,&point);
916 GetClientRect(hDlg, &rect);
918 SetWindowPos(hDlg, 0, 0, 0, point.x, res, SWP_NOMOVE|SWP_NOZORDER);
919
920 for (i = COLOR_HUE; i <= COLOR_BLUE; i++)
921 ShowWindow( GetDlgItem(hDlg, i), SW_HIDE);
922 for (i = COLOR_HUEACCEL; i <= COLOR_BLUEACCEL; i++)
923 ShowWindow( GetDlgItem(hDlg, i), SW_HIDE);
928 ShowWindow( GetDlgItem(hDlg, 1090 ), SW_HIDE);
929 }
930 else
932 res = TRUE;
933 for (i = COLOR_HUE; i <= COLOR_BLUE; i++)
934 SendMessageA( GetDlgItem(hDlg, i), EM_LIMITTEXT, 3, 0); /* max 3 digits: xyz */
935 if (CC_HookCallChk(lpp->lpcc))
936 {
938 }
939
940 /* Set the initial values of the color chooser dialog */
941 r = GetRValue(lpp->lpcc->rgbResult);
942 g = GetGValue(lpp->lpcc->rgbResult);
943 b = GetBValue(lpp->lpcc->rgbResult);
944
946 lpp->h = CC_RGBtoHSL('H', lpp->lpcc->rgbResult);
947 lpp->s = CC_RGBtoHSL('S', lpp->lpcc->rgbResult);
948 lpp->l = CC_RGBtoHSL('L', lpp->lpcc->rgbResult);
949
950 /* Doing it the long way because CC_EditSetRGB/HSL doesn't seem to work */
951 SetDlgItemInt(hDlg, COLOR_HUE, lpp->h, TRUE);
952 SetDlgItemInt(hDlg, COLOR_SAT, lpp->s, TRUE);
953 SetDlgItemInt(hDlg, COLOR_LUM, lpp->l, TRUE);
954 SetDlgItemInt(hDlg, COLOR_RED, r, TRUE);
957
958 CC_PaintCross(lpp);
959 CC_PaintTriangle(lpp);
960
961 return res;
962}
#define CC_SHOWHELP
Definition: commdlg.h:53
#define CC_RGBINIT
Definition: commdlg.h:50
#define SETRGBSTRINGA
Definition: commdlg.h:19
#define CC_PREVENTFULLOPEN
Definition: commdlg.h:52
#define CC_FULLOPEN
Definition: commdlg.h:51
#define NULL
Definition: types.h:112
#define L(x)
Definition: resources.c:13
GLuint res
Definition: glext.h:9613
uint32_t cc
Definition: isohybrid.c:75
#define SW_HIDE
Definition: winuser.h:779
#define EM_LIMITTEXT
Definition: winuser.h:2029
#define WM_INITDIALOG
Definition: winuser.h:1767
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
#define SM_CXDLGFRAME
Definition: winuser.h:977
int WINAPI GetSystemMetrics(_In_ int)
UINT msetrgb
Definition: colordlg.c:80
#define MAKELONG(a, b)
Definition: typedefs.h:249

Referenced by ColorDlgProc().

◆ CC_WMLButtonDown()

static LRESULT CC_WMLButtonDown ( CCPRIV *  infoPtr,
LPARAM  lParam 
)
static

Definition at line 1162 of file colordlg.c.

1163{
1164 int i = 0;
1165
1166 if (CC_MouseCheckPredefColorArray(infoPtr, 6, 8, lParam))
1167 i = 1;
1168 else
1169 if (CC_MouseCheckUserColorArray(infoPtr, 2, 8, lParam))
1170 i = 1;
1171 else
1172 if (CC_MouseCheckColorGraph(infoPtr->hwndSelf, COLOR_RAINBOW, &infoPtr->h, &infoPtr->s, lParam))
1173 {
1174 i = 2;
1175 infoPtr->capturedGraph = COLOR_RAINBOW;
1176 }
1177 else
1178 if (CC_MouseCheckColorGraph(infoPtr->hwndSelf, COLOR_LUMSCROLL, NULL, &infoPtr->l, lParam))
1179 {
1180 i = 2;
1181 infoPtr->capturedGraph = COLOR_LUMSCROLL;
1182 }
1183 if ( i == 2 )
1184 {
1185 SetCapture(infoPtr->hwndSelf);
1186 infoPtr->lpcc->rgbResult = CC_HSLtoRGB(infoPtr->h, infoPtr->s, infoPtr->l);
1187 }
1188 if ( i == 1 )
1189 {
1190 infoPtr->h = CC_RGBtoHSL('H', infoPtr->lpcc->rgbResult);
1191 infoPtr->s = CC_RGBtoHSL('S', infoPtr->lpcc->rgbResult);
1192 infoPtr->l = CC_RGBtoHSL('L', infoPtr->lpcc->rgbResult);
1193 }
1194 if (i)
1195 {
1196#ifdef __REACTOS__
1197 if (infoPtr->capturedGraph)
1198 {
1199 RECT rect;
1200 GetWindowRect(GetDlgItem(infoPtr->hwndSelf, infoPtr->capturedGraph), &rect);
1201 ClipCursor(&rect);
1202 }
1203#endif
1204 CC_EditSetRGB(infoPtr);
1205 CC_EditSetHSL(infoPtr);
1206 CC_PaintCross(infoPtr);
1207 CC_PaintTriangle(infoPtr);
1208 CC_PaintSelectedColor(infoPtr);
1209 return TRUE;
1210 }
1211 return FALSE;
1212}
static BOOL CC_MouseCheckPredefColorArray(CCPRIV *lpp, int rows, int cols, LPARAM lParam)
Definition: colordlg.c:262
static BOOL CC_MouseCheckUserColorArray(CCPRIV *lpp, int rows, int cols, LPARAM lParam)
Definition: colordlg.c:295
static BOOL CC_MouseCheckColorGraph(HWND hDlg, int dlgitem, int *hori, int *vert, LPARAM lParam)
Definition: colordlg.c:338
HWND WINAPI SetCapture(_In_ HWND hWnd)
BOOL WINAPI ClipCursor(_In_opt_ LPCRECT)
int capturedGraph
Definition: colordlg.c:87

Referenced by ColorDlgProc().

◆ CC_WMLButtonUp()

static LRESULT CC_WMLButtonUp ( CCPRIV *  infoPtr)
static

Definition at line 1112 of file colordlg.c.

1113{
1114 if (infoPtr->capturedGraph)
1115 {
1116#ifdef __REACTOS__
1118#endif
1119 infoPtr->capturedGraph = 0;
1121 CC_PaintCross(infoPtr);
1122 return 1;
1123 }
1124 return 0;
1125}
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890

Referenced by ColorDlgProc().

◆ CC_WMMouseMove()

static LRESULT CC_WMMouseMove ( CCPRIV *  infoPtr,
LPARAM  lParam 
)
static

Definition at line 1130 of file colordlg.c.

1131{
1132 if (infoPtr->capturedGraph)
1133 {
1134 int *ptrh = NULL, *ptrs = &infoPtr->l;
1135 if (infoPtr->capturedGraph == COLOR_RAINBOW)
1136 {
1137 ptrh = &infoPtr->h;
1138 ptrs = &infoPtr->s;
1139 }
1140 if (CC_MouseCheckColorGraph( infoPtr->hwndSelf, infoPtr->capturedGraph, ptrh, ptrs, lParam))
1141 {
1142 infoPtr->lpcc->rgbResult = CC_HSLtoRGB(infoPtr->h, infoPtr->s, infoPtr->l);
1143 CC_EditSetRGB(infoPtr);
1144 CC_EditSetHSL(infoPtr);
1145 CC_PaintCross(infoPtr);
1146 CC_PaintTriangle(infoPtr);
1147 CC_PaintSelectedColor(infoPtr);
1148 }
1149 else
1150 {
1152 infoPtr->capturedGraph = 0;
1153 }
1154 return 1;
1155 }
1156 return 0;
1157}

Referenced by ColorDlgProc().

◆ CC_WMPaint()

static LRESULT CC_WMPaint ( CCPRIV *  lpp)
static

Definition at line 1091 of file colordlg.c.

1092{
1093 PAINTSTRUCT ps;
1094
1095 BeginPaint(lpp->hwndSelf, &ps);
1096 /* we have to paint dialog children except text and buttons */
1097 CC_PaintPredefColorArray(lpp, 6, 8);
1098 CC_PaintUserColorArray(lpp, 2, 8);
1099 CC_PaintLumBar(lpp);
1100 CC_PaintTriangle(lpp);
1102 CC_PaintColorGraph(lpp);
1103 CC_PaintCross(lpp);
1104 EndPaint(lpp->hwndSelf, &ps);
1105
1106 return TRUE;
1107}
static void CC_PaintColorGraph(CCPRIV *infoPtr)
Definition: colordlg.c:626
static void CC_PaintPredefColorArray(const CCPRIV *infoPtr, int rows, int cols)
Definition: colordlg.c:750
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)

Referenced by ColorDlgProc().

◆ ChooseColorA()

BOOL WINAPI ChooseColorA ( LPCHOOSECOLORA  lpChCol)

Definition at line 1362 of file colordlg.c.

1364{
1365 LPWSTR template_name = NULL;
1366 BOOL ret;
1367
1368 CHOOSECOLORW *lpcc = heap_alloc_zero(sizeof(*lpcc));
1369 lpcc->lStructSize = sizeof(*lpcc);
1370 lpcc->hwndOwner = lpChCol->hwndOwner;
1371 lpcc->hInstance = lpChCol->hInstance;
1372 lpcc->rgbResult = lpChCol->rgbResult;
1373 lpcc->lpCustColors = lpChCol->lpCustColors;
1374 lpcc->Flags = lpChCol->Flags;
1375 lpcc->lCustData = lpChCol->lCustData;
1376 lpcc->lpfnHook = lpChCol->lpfnHook;
1377 if ((lpcc->Flags & CC_ENABLETEMPLATE) && (lpChCol->lpTemplateName)) {
1378 if (!IS_INTRESOURCE(lpChCol->lpTemplateName)) {
1379 INT len = MultiByteToWideChar( CP_ACP, 0, lpChCol->lpTemplateName, -1, NULL, 0);
1380 template_name = heap_alloc( len * sizeof(WCHAR) );
1381 MultiByteToWideChar( CP_ACP, 0, lpChCol->lpTemplateName, -1, template_name, len );
1382 lpcc->lpTemplateName = template_name;
1383 } else {
1384 lpcc->lpTemplateName = (LPCWSTR)lpChCol->lpTemplateName;
1385 }
1386 }
1387
1388 ret = ChooseColorW(lpcc);
1389
1390 if (ret)
1391 lpChCol->rgbResult = lpcc->rgbResult;
1392
1393 heap_free(template_name);
1394 heap_free(lpcc);
1395 return ret;
1396}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
BOOL WINAPI ChooseColorW(CHOOSECOLORW *lpChCol)
Definition: colordlg.c:1302
#define CC_ENABLETEMPLATE
Definition: commdlg.h:55
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
#define IS_INTRESOURCE(x)
Definition: loader.c:613
return ret
Definition: mutex.c:147
unsigned int BOOL
Definition: ntddk_ex.h:94
GLenum GLsizei len
Definition: glext.h:6722
short WCHAR
Definition: pedump.c:58
HWND hInstance
Definition: commdlg.h:241
COLORREF rgbResult
Definition: commdlg.h:242
HWND hwndOwner
Definition: commdlg.h:240
LPARAM lCustData
Definition: commdlg.h:245
COLORREF * lpCustColors
Definition: commdlg.h:243
LPCCHOOKPROC lpfnHook
Definition: commdlg.h:246
LPCSTR lpTemplateName
Definition: commdlg.h:247
HWND hInstance
Definition: commdlg.h:252
LPARAM lCustData
Definition: commdlg.h:256
DWORD lStructSize
Definition: commdlg.h:250
LPCWSTR lpTemplateName
Definition: commdlg.h:258
uint16_t * LPWSTR
Definition: typedefs.h:56
int32_t INT
Definition: typedefs.h:58

◆ ChooseColorW()

BOOL WINAPI ChooseColorW ( CHOOSECOLORW *  lpChCol)

Definition at line 1302 of file colordlg.c.

1303{
1304 HANDLE hDlgTmpl = 0;
1305 const void *template;
1306
1307 TRACE("(%p)\n", lpChCol);
1308
1309 if (!lpChCol) return FALSE;
1310
1311 if (lpChCol->Flags & CC_ENABLETEMPLATEHANDLE)
1312 {
1313 if (!(template = LockResource(lpChCol->hInstance)))
1314 {
1316 return FALSE;
1317 }
1318 }
1319 else if (lpChCol->Flags & CC_ENABLETEMPLATE)
1320 {
1321 HRSRC hResInfo;
1322 if (!(hResInfo = FindResourceW((HINSTANCE)lpChCol->hInstance,
1323 lpChCol->lpTemplateName,
1324 (LPWSTR)RT_DIALOG)))
1325 {
1327 return FALSE;
1328 }
1329 if (!(hDlgTmpl = LoadResource((HINSTANCE)lpChCol->hInstance, hResInfo)) ||
1330 !(template = LockResource(hDlgTmpl)))
1331 {
1333 return FALSE;
1334 }
1335 }
1336 else
1337 {
1338 HRSRC hResInfo;
1339 HGLOBAL hDlgTmpl;
1340 if (!(hResInfo = FindResourceW(COMDLG32_hInstance, L"CHOOSE_COLOR", (LPWSTR)RT_DIALOG)))
1341 {
1343 return FALSE;
1344 }
1345 if (!(hDlgTmpl = LoadResource(COMDLG32_hInstance, hResInfo )) ||
1346 !(template = LockResource(hDlgTmpl)))
1347 {
1349 return FALSE;
1350 }
1351 }
1352
1353 return DialogBoxIndirectParamW(COMDLG32_hInstance, template, lpChCol->hwndOwner,
1354 ColorDlgProc, (LPARAM)lpChCol);
1355}
#define CDERR_LOADRESFAILURE
Definition: cderr.h:12
#define CDERR_FINDRESFAILURE
Definition: cderr.h:11
void COMDLG32_SetCommDlgExtendedError(DWORD err)
Definition: cdlg32.c:124
HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
static INT_PTR CALLBACK ColorDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
Definition: colordlg.c:1218
#define CC_ENABLETEMPLATEHANDLE
Definition: commdlg.h:56
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
#define RT_DIALOG
Definition: pedump.c:367
INT_PTR WINAPI DialogBoxIndirectParamW(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by ChooseColorA().

◆ ColorDlgProc()

static INT_PTR CALLBACK ColorDlgProc ( HWND  hWnd,
UINT  wMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1218 of file colordlg.c.

1220{
1221
1222 int res;
1223 CCPRIV *lpp = GetPropW( hDlg, L"colourdialogprop" );
1224
1225 if (message != WM_INITDIALOG)
1226 {
1227 if (!lpp)
1228 return FALSE;
1229 res = 0;
1230 if (CC_HookCallChk(lpp->lpcc))
1232 if ( res )
1233 return res;
1234 }
1235
1236 /* FIXME: SetRGB message
1237 if (message && message == msetrgb)
1238 return HandleSetRGB(hDlg, lParam);
1239 */
1240
1241 switch (message)
1242 {
1243 case WM_INITDIALOG:
1244 return CC_WMInitDialog(hDlg, wParam, lParam);
1245 case WM_NCDESTROY:
1246#ifdef __REACTOS__
1247 // Ensure clipping is released, in case the dialog is closed before WM_LBUTTONUP is received.
1249#endif
1250 DeleteDC(lpp->hdcMem);
1251 DeleteObject(lpp->hbmMem);
1252 heap_free(lpp);
1253 RemovePropW( hDlg, L"colourdialogprop" );
1254 break;
1255 case WM_COMMAND:
1257 return TRUE;
1258 break;
1259 case WM_PAINT:
1260 if (CC_WMPaint(lpp))
1261 return TRUE;
1262 break;
1263 case WM_LBUTTONDBLCLK:
1265 return TRUE;
1266 break;
1267 case WM_MOUSEMOVE:
1268 if (CC_WMMouseMove(lpp, lParam))
1269 return TRUE;
1270 break;
1271#ifdef __REACTOS__
1272 /* ReactOS: The following comment doesn't apply */
1273#endif
1274 case WM_LBUTTONUP: /* FIXME: ClipCursor off (if in color graph)*/
1275 if (CC_WMLButtonUp(lpp))
1276 return TRUE;
1277 break;
1278#ifdef __REACTOS__
1279 /* ReactOS: The following comment doesn't apply */
1280#endif
1281 case WM_LBUTTONDOWN:/* FIXME: ClipCursor on (if in color graph)*/
1282 if (CC_WMLButtonDown(lpp, lParam))
1283 return TRUE;
1284 break;
1285 }
1286 return FALSE ;
1287}
static BOOL CC_MouseCheckResultWindow(HWND hDlg, LPARAM lParam)
Definition: colordlg.c:375
static LRESULT CC_WMLButtonDown(CCPRIV *infoPtr, LPARAM lParam)
Definition: colordlg.c:1162
static LRESULT CC_WMMouseMove(CCPRIV *infoPtr, LPARAM lParam)
Definition: colordlg.c:1130
static LRESULT CC_WMLButtonUp(CCPRIV *infoPtr)
Definition: colordlg.c:1112
static LRESULT CC_WMCommand(CCPRIV *lpp, WPARAM wParam, LPARAM lParam, WORD notifyCode, HWND hwndCtl)
Definition: colordlg.c:968
static LRESULT CC_WMPaint(CCPRIV *lpp)
Definition: colordlg.c:1091
static LRESULT CC_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam)
Definition: colordlg.c:858
#define WM_PAINT
Definition: winuser.h:1648
HANDLE WINAPI RemovePropW(_In_ HWND, _In_ LPCWSTR)
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1806
#define WM_MOUSEMOVE
Definition: winuser.h:1803
#define WM_LBUTTONDOWN
Definition: winuser.h:1804
#define WM_LBUTTONUP
Definition: winuser.h:1805
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
#define WM_NCDESTROY
Definition: winuser.h:1712
Definition: tftpd.h:60
#define HIWORD(l)
Definition: typedefs.h:247
BOOL WINAPI DeleteDC(_In_ HDC)

Referenced by ChooseColorW().

◆ hsl_to_x()

static int hsl_to_x ( int  hue,
int  sat,
int  lum 
)
static

Definition at line 92 of file colordlg.c.

93{
94 int res = 0, maxrgb;
95
96 /* l below 120 */
97 maxrgb = (256 * min(120,lum)) / 120; /* 0 .. 256 */
98 if (hue < 80)
99 res = 0;
100 else
101 if (hue < 120)
102 {
103 res = (hue - 80) * maxrgb; /* 0...10240 */
104 res /= 40; /* 0...256 */
105 }
106 else
107 if (hue < 200)
108 res = maxrgb;
109 else
110 {
111 res= (240 - hue) * maxrgb;
112 res /= 40;
113 }
114 res = res - maxrgb / 2; /* -128...128 */
115
116 /* saturation */
117 res = maxrgb / 2 + (sat * res) / 240; /* 0..256 */
118
119 /* lum above 120 */
120 if (lum > 120 && res < 256)
121 res += ((lum - 120) * (256 - res)) / 120;
122
123 return min(res, 255);
124}

Referenced by CC_HSLtoRGB().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( commdlg  )

Variable Documentation

◆ predefcolors

const COLORREF predefcolors[6][8]
static
Initial value:
=
{
{ 0x008080FFL, 0x0080FFFFL, 0x0080FF80L, 0x0080FF00L,
0x00FFFF80L, 0x00FF8000L, 0x00C080FFL, 0x00FF80FFL },
{ 0x000000FFL, 0x0000FFFFL, 0x0000FF80L, 0x0040FF00L,
0x00FFFF00L, 0x00C08000L, 0x00C08080L, 0x00FF00FFL },
{ 0x00404080L, 0x004080FFL, 0x0000FF00L, 0x00808000L,
0x00804000L, 0x00FF8080L, 0x00400080L, 0x008000FFL },
{ 0x00000080L, 0x000080FFL, 0x00008000L, 0x00408000L,
0x00FF0000L, 0x00A00000L, 0x00800080L, 0x00FF0080L },
{ 0x00000040L, 0x00004080L, 0x00004000L, 0x00404000L,
0x00800000L, 0x00400000L, 0x00400040L, 0x00800040L },
{ 0x00000000L, 0x00008080L, 0x00408080L, 0x00808080L,
0x00808040L, 0x00C0C0C0L, 0x00400040L, 0x00FFFFFFL },
}

Definition at line 48 of file colordlg.c.

Referenced by CC_MouseCheckPredefColorArray(), CC_PaintPredefColorArray(), and CC_WMInitDialog().