ReactOS  0.4.14-dev-115-g4576127
colordlg.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.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 (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]
 
static const WCHAR szColourDialogProp []
 

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 44 of file colordlg.c.

◆ DISTANCE

#define DISTANCE   4

Definition at line 257 of file colordlg.c.

◆ MAXHORI

#define MAXHORI   239

Definition at line 327 of file colordlg.c.

◆ MAXVERT

#define MAXVERT   240

Definition at line 326 of file colordlg.c.

◆ XSTEPS

#define XSTEPS   48

Definition at line 566 of file colordlg.c.

◆ YSTEPS

#define YSTEPS   24

Definition at line 567 of file colordlg.c.

Typedef Documentation

◆ CCPRIV

Function Documentation

◆ CC_CheckDigitsInEdit()

static int CC_CheckDigitsInEdit ( HWND  hwnd,
int  maxval 
)
static

Definition at line 399 of file colordlg.c.

400 {
401  int i, k, m, result, value;
402  long editpos;
403  char buffer[30];
404 
406  m = strlen(buffer);
407  result = 0;
408 
409  for (i = 0 ; i < m ; i++)
410  if (buffer[i] < '0' || buffer[i] > '9')
411  {
412  for (k = i + 1; k <= m; k++) /* delete bad character */
413  {
414  buffer[i] = buffer[k];
415  m--;
416  }
417  buffer[m] = 0;
418  result = 1;
419  }
420 
421  value = atoi(buffer);
422  if (value > maxval) /* build a new string */
423  {
424  sprintf(buffer, "%d", maxval);
425  result = 2;
426  }
427  if (result)
428  {
429  editpos = SendMessageA(hwnd, EM_GETSEL, 0, 0);
431  SendMessageA(hwnd, EM_SETSEL, 0, editpos);
432  }
433  return value;
434 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1326
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLuint buffer
Definition: glext.h:5915
const GLfloat * m
Definition: glext.h:10848
#define EM_GETSEL
Definition: winuser.h:1979
#define sprintf(buf, format,...)
Definition: sprintf.c:55
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
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
#define EM_SETSEL
Definition: winuser.h:2000
GLsizei const GLfloat * value
Definition: glext.h:6069
#define ARRAY_SIZE(a)
Definition: main.h:24
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
GLuint64EXT * result
Definition: glext.h:11304
int k
Definition: mpi.c:3369

Referenced by CC_WMCommand().

◆ CC_DrawCurrentFocusRect()

static void CC_DrawCurrentFocusRect ( const CCPRIV lpp)
static

Definition at line 221 of file colordlg.c.

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

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 234 of file colordlg.c.

235 {
236  RECT rect;
237  int dx, dy;
238  HDC hdc;
239 
240  CC_DrawCurrentFocusRect(lpp); /* remove current focus rect */
241  /* calculate new rect */
243  dx = (rect.right - rect.left) / cols;
244  dy = (rect.bottom - rect.top) / rows;
245  rect.left += (x * dx) - 2;
246  rect.top += (y * dy) - 2;
247  rect.right = rect.left + dx;
248  rect.bottom = rect.top + dy;
249  /* draw it */
250  hdc = GetDC(hwnd);
252  lpp->focusRect = rect;
253  lpp->hwndFocus = hwnd;
254  ReleaseDC(hwnd, hdc);
255 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HDC WINAPI GetDC(_In_opt_ HWND)
HWND hwndFocus
Definition: colordlg.c:90
GLint dy
Definition: linetemp.h:97
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
static HDC
Definition: imagelist.c:92
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
static void CC_DrawCurrentFocusRect(const CCPRIV *lpp)
Definition: colordlg.c:221
& rect
Definition: startmenu.cpp:1413
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
RECT focusRect
Definition: colordlg.c:89
HDC hdc
Definition: main.c:9
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint dx
Definition: linetemp.h:97

Referenced by CC_MouseCheckPredefColorArray(), and CC_MouseCheckUserColorArray().

◆ CC_EditSetHSL()

static void CC_EditSetHSL ( CCPRIV infoPtr)
static

Definition at line 690 of file colordlg.c.

691 {
692  if (IsWindowVisible( GetDlgItem(infoPtr->hwndSelf, IDC_COLOR_GRAPH) )) /* if full size */
693  {
694  infoPtr->updating = TRUE;
695  SetDlgItemInt(infoPtr->hwndSelf, IDC_COLOR_EDIT_H, infoPtr->h, TRUE);
696  SetDlgItemInt(infoPtr->hwndSelf, IDC_COLOR_EDIT_S, infoPtr->s, TRUE);
697  SetDlgItemInt(infoPtr->hwndSelf, IDC_COLOR_EDIT_L, infoPtr->l, TRUE);
698  infoPtr->updating = FALSE;
699  }
700  CC_PaintLumBar(infoPtr);
701 }
static void CC_PaintLumBar(const CCPRIV *infoPtr)
Definition: colordlg.c:637
#define TRUE
Definition: types.h:120
HWND hwndSelf
Definition: colordlg.c:76
BOOL updating
Definition: colordlg.c:84
#define IDC_COLOR_EDIT_H
Definition: cdlg.h:153
#define IDC_COLOR_EDIT_S
Definition: cdlg.h:154
int h
Definition: colordlg.c:85
int l
Definition: colordlg.c:87
#define IDC_COLOR_EDIT_L
Definition: cdlg.h:155
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
int s
Definition: colordlg.c:86
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)
#define IDC_COLOR_GRAPH
Definition: cdlg.h:160
BOOL WINAPI IsWindowVisible(_In_ HWND)

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

◆ CC_EditSetRGB()

static void CC_EditSetRGB ( CCPRIV infoPtr)
static

Definition at line 670 of file colordlg.c.

671 {
672  if (IsWindowVisible( GetDlgItem(infoPtr->hwndSelf, IDC_COLOR_GRAPH) )) /* if full size */
673  {
674  COLORREF cr = infoPtr->lpcc->rgbResult;
675  int r = GetRValue(cr);
676  int g = GetGValue(cr);
677  int b = GetBValue(cr);
678 
679  infoPtr->updating = TRUE;
683  infoPtr->updating = FALSE;
684  }
685 }
#define TRUE
Definition: types.h:120
HWND hwndSelf
Definition: colordlg.c:76
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
BOOL updating
Definition: colordlg.c:84
#define GetRValue(rgb)
Definition: wingdi.h:2930
#define IDC_COLOR_EDIT_G
Definition: cdlg.h:157
#define GetGValue(rgb)
Definition: wingdi.h:2931
GLboolean GLboolean g
Definition: glext.h:6204
#define IDC_COLOR_EDIT_B
Definition: cdlg.h:158
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
LPCHOOSECOLORW lpcc
Definition: colordlg.c:75
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
DWORD COLORREF
Definition: windef.h:285
#define IDC_COLOR_EDIT_R
Definition: cdlg.h:156
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)
#define IDC_COLOR_GRAPH
Definition: cdlg.h:160
COLORREF rgbResult
Definition: commdlg.h:253
BOOL WINAPI IsWindowVisible(_In_ HWND)
#define GetBValue(rgb)
Definition: wingdi.h:2932

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

◆ CC_HookCallChk()

static BOOL CC_HookCallChk ( const CHOOSECOLORW lpcc)
static

Definition at line 833 of file colordlg.c.

834 {
835  if (lpcc)
836  if(lpcc->Flags & CC_ENABLEHOOK)
837  if (lpcc->lpfnHook)
838  return TRUE;
839  return FALSE;
840 }
#define TRUE
Definition: types.h:120
LPCCHOOKPROC lpfnHook
Definition: commdlg.h:257
#define CC_ENABLEHOOK
Definition: commdlg.h:54

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

◆ CC_HSLtoRGB()

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

Definition at line 130 of file colordlg.c.

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

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 339 of file colordlg.c.

340 {
341  HWND hwnd;
342  POINT point;
343  RECT rect;
344  long x,y;
345 
347  ClientToScreen(hDlg, &point);
348  hwnd = GetDlgItem( hDlg, dlgitem );
350 
351  if (!PtInRect(&rect, point))
352  return FALSE;
353 
356 
357  x = (long) point.x * MAXHORI;
358  x /= rect.right;
359  y = (long) (rect.bottom - point.y) * MAXVERT;
360  y /= rect.bottom;
361 
362  if (x < 0) x = 0;
363  if (y < 0) y = 0;
364  if (x > MAXHORI) x = MAXHORI;
365  if (y > MAXVERT) y = MAXVERT;
366 
367  if (hori)
368  *hori = x;
369  if (vert)
370  *vert = y;
371 
372  return TRUE;
373 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
#define MAXHORI
Definition: colordlg.c:327
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
POINTL point
Definition: edittest.c:50
& rect
Definition: startmenu.cpp:1413
LONG y
Definition: windef.h:315
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
LONG x
Definition: windef.h:314
#define CONV_LPARAMTOPOINT(lp, p)
Definition: colordlg.c:44
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define long
Definition: qsort.c:33
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define MAXVERT
Definition: colordlg.c:326
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
LPARAM lParam
Definition: combotst.c:139

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 263 of file colordlg.c.

264 {
265  HWND hwnd;
266  POINT point;
267  RECT rect;
268  int dx, dy, x, y;
269 
271  ClientToScreen(lpp->hwndSelf, &point);
274  if (PtInRect(&rect, point))
275  {
276  dx = (rect.right - rect.left) / cols;
277  dy = (rect.bottom - rect.top) / rows;
279 
280  if (point.x % dx < ( dx - DISTANCE) && point.y % dy < ( dy - DISTANCE))
281  {
282  x = point.x / dx;
283  y = point.y / dy;
284  lpp->lpcc->rgbResult = predefcolors[y][x];
285  CC_DrawFocusRect(lpp, hwnd, x, y, rows, cols);
286  return TRUE;
287  }
288  }
289  return FALSE;
290 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define DISTANCE
Definition: colordlg.c:257
#define TRUE
Definition: types.h:120
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
HWND hwndSelf
Definition: colordlg.c:76
GLint dy
Definition: linetemp.h:97
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
POINTL point
Definition: edittest.c:50
& rect
Definition: startmenu.cpp:1413
LONG y
Definition: windef.h:315
LPCHOOSECOLORW lpcc
Definition: colordlg.c:75
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_COLOR_PREDEF
Definition: cdlg.h:164
static const COLORREF predefcolors[6][8]
Definition: colordlg.c:46
LONG x
Definition: windef.h:314
#define CONV_LPARAMTOPOINT(lp, p)
Definition: colordlg.c:44
COLORREF rgbResult
Definition: commdlg.h:253
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint dx
Definition: linetemp.h:97
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
LPARAM lParam
Definition: combotst.c:139
static void CC_DrawFocusRect(CCPRIV *lpp, HWND hwnd, int x, int y, int rows, int cols)
Definition: colordlg.c:234

Referenced by CC_WMLButtonDown().

◆ CC_MouseCheckResultWindow()

static BOOL CC_MouseCheckResultWindow ( HWND  hDlg,
LPARAM  lParam 
)
static

Definition at line 378 of file colordlg.c.

379 {
380  HWND hwnd;
381  POINT point;
382  RECT rect;
383 
385  ClientToScreen(hDlg, &point);
388  if (PtInRect(&rect, point))
389  {
391  return TRUE;
392  }
393  return FALSE;
394 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDC_COLOR_RES
Definition: cdlg.h:162
POINTL point
Definition: edittest.c:50
& rect
Definition: startmenu.cpp:1413
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define CONV_LPARAMTOPOINT(lp, p)
Definition: colordlg.c:44
#define WM_COMMAND
Definition: winuser.h:1722
#define IDC_COLOR_RESULT
Definition: cdlg.h:159
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
LPARAM lParam
Definition: combotst.c:139

Referenced by ColorDlgProc().

◆ CC_MouseCheckUserColorArray()

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

Definition at line 296 of file colordlg.c.

297 {
298  HWND hwnd;
299  POINT point;
300  RECT rect;
301  int dx, dy, x, y;
302  COLORREF *crarr = lpp->lpcc->lpCustColors;
303 
305  ClientToScreen(lpp->hwndSelf, &point);
308  if (PtInRect(&rect, point))
309  {
310  dx = (rect.right - rect.left) / cols;
311  dy = (rect.bottom - rect.top) / rows;
313 
314  if (point.x % dx < (dx - DISTANCE) && point.y % dy < (dy - DISTANCE))
315  {
316  x = point.x / dx;
317  y = point.y / dy;
318  lpp->lpcc->rgbResult = crarr[x + (cols * y) ];
319  CC_DrawFocusRect(lpp, hwnd, x, y, rows, cols);
320  return TRUE;
321  }
322  }
323  return FALSE;
324 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define DISTANCE
Definition: colordlg.c:257
#define TRUE
Definition: types.h:120
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
HWND hwndSelf
Definition: colordlg.c:76
GLint dy
Definition: linetemp.h:97
COLORREF * lpCustColors
Definition: commdlg.h:254
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
POINTL point
Definition: edittest.c:50
& rect
Definition: startmenu.cpp:1413
LONG y
Definition: windef.h:315
LPCHOOSECOLORW lpcc
Definition: colordlg.c:75
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
DWORD COLORREF
Definition: windef.h:285
LONG x
Definition: windef.h:314
#define CONV_LPARAMTOPOINT(lp, p)
Definition: colordlg.c:44
COLORREF rgbResult
Definition: commdlg.h:253
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint dx
Definition: linetemp.h:97
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
#define IDC_COLOR_USRDEF
Definition: cdlg.h:165
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
LPARAM lParam
Definition: combotst.c:139
static void CC_DrawFocusRect(CCPRIV *lpp, HWND hwnd, int x, int y, int rows, int cols)
Definition: colordlg.c:234

Referenced by CC_WMLButtonDown().

◆ CC_PaintColorGraph()

static void CC_PaintColorGraph ( CCPRIV infoPtr)
static

Definition at line 613 of file colordlg.c.

614 {
616  HDC hDC;
617  RECT rect;
618 
619  if (IsWindowVisible(hwnd)) /* if full size */
620  {
621  if (!infoPtr->hdcMem)
622  CC_PrepareColorGraph(infoPtr); /* should not be necessary */
623 
624  hDC = GetDC(hwnd);
626  if (infoPtr->hdcMem)
627  BitBlt(hDC, 0, 0, rect.right, rect.bottom, infoPtr->hdcMem, 0, 0, SRCCOPY);
628  else
629  WARN("choose color: hdcMem is not defined\n");
630  ReleaseDC(hwnd, hDC);
631  }
632 }
static void CC_PrepareColorGraph(CCPRIV *infoPtr)
Definition: colordlg.c:573
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HDC hdcMem
Definition: colordlg.c:78
HWND hwndSelf
Definition: colordlg.c:76
HDC WINAPI GetDC(_In_opt_ HWND)
#define WARN(fmt,...)
Definition: debug.h:111
static HDC
Definition: imagelist.c:92
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:410
& rect
Definition: startmenu.cpp:1413
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_COLOR_GRAPH
Definition: cdlg.h:160
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI IsWindowVisible(_In_ HWND)
#define SRCCOPY
Definition: wingdi.h:332

Referenced by CC_WMPaint().

◆ CC_PaintCross()

static void CC_PaintCross ( CCPRIV infoPtr)
static

Definition at line 516 of file colordlg.c.

517 {
519 
520  if (IsWindowVisible(hwnd)) /* if full size */
521  {
522  HDC hDC;
523  int w = GetDialogBaseUnits() - 1;
524  int wc = GetDialogBaseUnits() * 3 / 4;
525  RECT rect;
526  POINT point, p;
527  HPEN hPen;
528  int x, y;
529 
530  x = infoPtr->h;
531  y = infoPtr->s;
532 
534  hDC = GetDC(hwnd);
536 
537  point.x = ((long)rect.right * (long)x) / (long)MAXHORI;
538  point.y = rect.bottom - ((long)rect.bottom * (long)y) / (long)MAXVERT;
539  if ( infoPtr->oldcross.left != infoPtr->oldcross.right )
540  BitBlt(hDC, infoPtr->oldcross.left, infoPtr->oldcross.top,
541  infoPtr->oldcross.right - infoPtr->oldcross.left,
542  infoPtr->oldcross.bottom - infoPtr->oldcross.top,
543  infoPtr->hdcMem, infoPtr->oldcross.left, infoPtr->oldcross.top, SRCCOPY);
544  infoPtr->oldcross.left = point.x - w - 1;
545  infoPtr->oldcross.right = point.x + w + 1;
546  infoPtr->oldcross.top = point.y - w - 1;
547  infoPtr->oldcross.bottom = point.y + w + 1;
548 
549  hPen = CreatePen(PS_SOLID, 3, RGB(0, 0, 0)); /* -black- color */
550  hPen = SelectObject(hDC, hPen);
551  MoveToEx(hDC, point.x - w, point.y, &p);
552  LineTo(hDC, point.x - wc, point.y);
553  MoveToEx(hDC, point.x + wc, point.y, &p);
554  LineTo(hDC, point.x + w, point.y);
555  MoveToEx(hDC, point.x, point.y - w, &p);
556  LineTo(hDC, point.x, point.y - wc);
557  MoveToEx(hDC, point.x, point.y + wc, &p);
558  LineTo(hDC, point.x, point.y + w);
559  DeleteObject( SelectObject(hDC, hPen));
560 
561  ReleaseDC(hwnd, hDC);
562  }
563 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HDC hdcMem
Definition: colordlg.c:78
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
HWND hwndSelf
Definition: colordlg.c:76
HDC WINAPI GetDC(_In_opt_ HWND)
HRGN WINAPI CreateRectRgnIndirect(_In_ LPCRECT)
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:292
#define MAXHORI
Definition: colordlg.c:327
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:410
POINTL point
Definition: edittest.c:50
& rect
Definition: startmenu.cpp:1413
LONG y
Definition: windef.h:315
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
#define PS_SOLID
Definition: wingdi.h:585
int h
Definition: colordlg.c:85
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
int s
Definition: colordlg.c:86
#define RGB(r, g, b)
Definition: wingdi.h:2935
LONG x
Definition: windef.h:314
#define IDC_COLOR_GRAPH
Definition: cdlg.h:160
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define long
Definition: qsort.c:33
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define MAXVERT
Definition: colordlg.c:326
BOOL WINAPI IsWindowVisible(_In_ HWND)
LONG bottom
Definition: windef.h:294
RECT oldcross
Definition: colordlg.c:83
GLfloat GLfloat p
Definition: glext.h:8902
#define SRCCOPY
Definition: wingdi.h:332
LONG WINAPI GetDialogBaseUnits(void)
Definition: dialog.c:2089

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 637 of file colordlg.c.

638 {
640  RECT rect, client;
641  int lum, ldif, ydif;
642  HBRUSH hbrush;
643  HDC hDC;
644 
645  if (IsWindowVisible(hwnd))
646  {
647  hDC = GetDC(hwnd);
649  rect = client;
650 
651  ldif = 240 / YSTEPS;
652  ydif = client.bottom / YSTEPS+1;
653  for (lum = 0; lum < 240 + ldif; lum += ldif)
654  {
655  rect.top = max(0, rect.bottom - ydif);
656  hbrush = CreateSolidBrush(CC_HSLtoRGB(infoPtr->h, infoPtr->s, lum));
657  FillRect(hDC, &rect, hbrush);
659  rect.bottom = rect.top;
660  }
663  ReleaseDC(hwnd, hDC);
664  }
665 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define max(a, b)
Definition: svc.c:63
static HBRUSH hbrush
HWND hwndSelf
Definition: colordlg.c:76
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
& rect
Definition: startmenu.cpp:1413
#define BF_RECT
Definition: winuser.h:462
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
int h
Definition: colordlg.c:85
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define YSTEPS
Definition: colordlg.c:567
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_COLOR_LUMBAR
Definition: cdlg.h:152
int s
Definition: colordlg.c:86
static FILE * client
Definition: client.c:41
#define BDR_SUNKENOUTER
Definition: winuser.h:443
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
static COLORREF CC_HSLtoRGB(int hue, int sat, int lum)
Definition: colordlg.c:130
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
BOOL WINAPI IsWindowVisible(_In_ HWND)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)

Referenced by CC_EditSetHSL(), and CC_WMPaint().

◆ CC_PaintPredefColorArray()

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

Definition at line 737 of file colordlg.c.

738 {
740  RECT rect, blockrect;
741  HDC hdc;
742  HBRUSH hBrush;
743  int dx, dy, i, j, k;
744 
746  dx = rect.right / cols;
747  dy = rect.bottom / rows;
748  k = rect.left;
749 
750  hdc = GetDC(hwnd);
752  hBrush = (HBRUSH)GetClassLongPtrW( hwnd, GCLP_HBRBACKGROUND);
753  if (!hBrush) hBrush = GetSysColorBrush(COLOR_BTNFACE);
754  FillRect(hdc, &rect, hBrush);
755  for ( j = 0; j < rows; j++ )
756  {
757  for ( i = 0; i < cols; i++ )
758  {
759  hBrush = CreateSolidBrush(predefcolors[j][i]);
760  if (hBrush)
761  {
762  blockrect.left = rect.left;
763  blockrect.top = rect.top;
764  blockrect.right = rect.left + dx - DISTANCE;
765  blockrect.bottom = rect.top + dy - DISTANCE;
766  FillRect(hdc, &blockrect, hBrush);
767  DrawEdge(hdc, &blockrect, BDR_SUNKEN, BF_RECT);
768  DeleteObject(hBrush);
769  }
770  rect.left += dx;
771  }
772  rect.top += dy;
773  rect.left = k;
774  }
775  ReleaseDC(hwnd, hdc);
776  if (infoPtr->hwndFocus == hwnd)
777  CC_DrawCurrentFocusRect(infoPtr);
778 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define DISTANCE
Definition: colordlg.c:257
HWND hwndSelf
Definition: colordlg.c:76
HDC WINAPI GetDC(_In_opt_ HWND)
HWND hwndFocus
Definition: colordlg.c:90
GLint dy
Definition: linetemp.h:97
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:292
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
static void CC_DrawCurrentFocusRect(const CCPRIV *lpp)
Definition: colordlg.c:221
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
& rect
Definition: startmenu.cpp:1413
#define BF_RECT
Definition: winuser.h:462
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
#define BDR_SUNKEN
Definition: winuser.h:449
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define GCLP_HBRBACKGROUND
Definition: winuser.h:667
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
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_COLOR_PREDEF
Definition: cdlg.h:164
static const COLORREF predefcolors[6][8]
Definition: colordlg.c:46
HDC hdc
Definition: main.c:9
#define COLOR_BTNFACE
Definition: winuser.h:918
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
GLint dx
Definition: linetemp.h:97
LONG bottom
Definition: windef.h:294
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI GetSysColorBrush(_In_ int)
int k
Definition: mpi.c:3369
#define GetClassLongPtrW
Definition: winuser.h:4465

Referenced by CC_WMPaint().

◆ CC_PaintSelectedColor()

static void CC_PaintSelectedColor ( const CCPRIV infoPtr)
static

Definition at line 441 of file colordlg.c.

442 {
443  if (IsWindowVisible( GetDlgItem(infoPtr->hwndSelf, IDC_COLOR_GRAPH) )) /* if full size */
444  {
445  RECT rect;
446  HDC hdc;
447  HBRUSH hBrush;
449 
450  hdc = GetDC(hwnd);
451  GetClientRect(hwnd, &rect) ;
452  hBrush = CreateSolidBrush(infoPtr->lpcc->rgbResult);
453  if (hBrush)
454  {
455  FillRect(hdc, &rect, hBrush);
457  DeleteObject(hBrush);
458  }
459  ReleaseDC(hwnd, hdc);
460  }
461 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HWND hwndSelf
Definition: colordlg.c:76
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
& rect
Definition: startmenu.cpp:1413
#define BF_RECT
Definition: winuser.h:462
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
LPCHOOSECOLORW lpcc
Definition: colordlg.c:75
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
HDC hdc
Definition: main.c:9
#define BDR_SUNKENOUTER
Definition: winuser.h:443
#define IDC_COLOR_GRAPH
Definition: cdlg.h:160
COLORREF rgbResult
Definition: commdlg.h:253
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define IDC_COLOR_RESULT
Definition: cdlg.h:159
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
BOOL WINAPI IsWindowVisible(_In_ HWND)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)

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 466 of file colordlg.c.

467 {
468  HDC hDC;
469  long temp;
470  int w = LOWORD(GetDialogBaseUnits()) / 2;
471  POINT points[3];
472  int height;
473  int oben;
474  RECT rect;
475  HBRUSH hbr;
477 
478  if (IsWindowVisible( GetDlgItem(infoPtr->hwndSelf, IDC_COLOR_GRAPH))) /* if full size */
479  {
481  height = rect.bottom;
482  hDC = GetDC(infoPtr->hwndSelf);
483  points[0].y = rect.top;
484  points[0].x = rect.right; /* | /| */
485  ClientToScreen(hwnd, points); /* | / | */
486  ScreenToClient(infoPtr->hwndSelf, points); /* |< | */
487  oben = points[0].y; /* | \ | */
488  /* | \| */
489  temp = (long)height * (long)infoPtr->l;
490  points[0].x += 1;
491  points[0].y = oben + height - temp / (long)MAXVERT;
492  points[1].y = points[0].y + w;
493  points[2].y = points[0].y - w;
494  points[2].x = points[1].x = points[0].x + w;
495 
496  hbr = (HBRUSH)GetClassLongPtrW( hwnd, GCLP_HBRBACKGROUND);
497  if (!hbr) hbr = GetSysColorBrush(COLOR_BTNFACE);
498  FillRect(hDC, &infoPtr->old3angle, hbr);
499  infoPtr->old3angle.left = points[0].x;
500  infoPtr->old3angle.right = points[1].x + 1;
501  infoPtr->old3angle.top = points[2].y - 1;
502  infoPtr->old3angle.bottom= points[1].y + 1;
503 
505  Polygon(hDC, points, 3);
506  SelectObject(hDC, hbr);
507 
508  ReleaseDC(infoPtr->hwndSelf, hDC);
509  }
510 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
HWND hwndSelf
Definition: colordlg.c:76
BOOL Polygon(CONST PPOINT UnsafePoints, int Count, int polyFillMode)
Definition: polytest.cpp:730
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:292
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
& rect
Definition: startmenu.cpp:1413
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
int l
Definition: colordlg.c:87
#define GCLP_HBRBACKGROUND
Definition: winuser.h:667
RECT old3angle
Definition: colordlg.c:82
#define BLACK_BRUSH
Definition: wingdi.h:895
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_COLOR_LUMBAR
Definition: cdlg.h:152
GLsizei const GLfloat * points
Definition: glext.h:8112
#define COLOR_BTNFACE
Definition: winuser.h:918
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define IDC_COLOR_GRAPH
Definition: cdlg.h:160
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
static calc_node_t temp
Definition: rpn_ieee.c:38
#define long
Definition: qsort.c:33
#define MAXVERT
Definition: colordlg.c:326
BOOL WINAPI IsWindowVisible(_In_ HWND)
LONG bottom
Definition: windef.h:294
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define LOWORD(l)
Definition: pedump.c:82
#define GetClassLongPtrW
Definition: winuser.h:4465
LONG WINAPI GetDialogBaseUnits(void)
Definition: dialog.c:2089

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 783 of file colordlg.c.

784 {
786  RECT rect, blockrect;
787  HDC hdc;
788  HBRUSH hBrush;
789  int dx, dy, i, j, k;
790 
792 
793  dx = rect.right / cols;
794  dy = rect.bottom / rows;
795  k = rect.left;
796 
797  hdc = GetDC(hwnd);
798  if (hdc)
799  {
800  hBrush = (HBRUSH)GetClassLongPtrW( hwnd, GCLP_HBRBACKGROUND);
801  if (!hBrush) hBrush = GetSysColorBrush(COLOR_BTNFACE);
802  FillRect( hdc, &rect, hBrush );
803  for (j = 0; j < rows; j++)
804  {
805  for (i = 0; i < cols; i++)
806  {
807  hBrush = CreateSolidBrush(infoPtr->lpcc->lpCustColors[i+j*cols]);
808  if (hBrush)
809  {
810  blockrect.left = rect.left;
811  blockrect.top = rect.top;
812  blockrect.right = rect.left + dx - DISTANCE;
813  blockrect.bottom = rect.top + dy - DISTANCE;
814  FillRect(hdc, &blockrect, hBrush);
815  DrawEdge(hdc, &blockrect, BDR_SUNKEN, BF_RECT);
816  DeleteObject(hBrush);
817  }
818  rect.left += dx;
819  }
820  rect.top += dy;
821  rect.left = k;
822  }
823  ReleaseDC(hwnd, hdc);
824  }
825  if (infoPtr->hwndFocus == hwnd)
826  CC_DrawCurrentFocusRect(infoPtr);
827 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define DISTANCE
Definition: colordlg.c:257
HWND hwndSelf
Definition: colordlg.c:76
HDC WINAPI GetDC(_In_opt_ HWND)
HWND hwndFocus
Definition: colordlg.c:90
GLint dy
Definition: linetemp.h:97
COLORREF * lpCustColors
Definition: commdlg.h:254
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:292
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
static void CC_DrawCurrentFocusRect(const CCPRIV *lpp)
Definition: colordlg.c:221
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
& rect
Definition: startmenu.cpp:1413
#define BF_RECT
Definition: winuser.h:462
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
#define BDR_SUNKEN
Definition: winuser.h:449
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define GCLP_HBRBACKGROUND
Definition: winuser.h:667
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
LPCHOOSECOLORW lpcc
Definition: colordlg.c:75
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
HDC hdc
Definition: main.c:9
#define COLOR_BTNFACE
Definition: winuser.h:918
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
GLint dx
Definition: linetemp.h:97
#define IDC_COLOR_USRDEF
Definition: cdlg.h:165
LONG bottom
Definition: windef.h:294
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI GetSysColorBrush(_In_ int)
int k
Definition: mpi.c:3369
#define GetClassLongPtrW
Definition: winuser.h:4465

Referenced by CC_WMCommand(), and CC_WMPaint().

◆ CC_PrepareColorGraph()

static void CC_PrepareColorGraph ( CCPRIV infoPtr)
static

Definition at line 573 of file colordlg.c.

574 {
575  int sdif, hdif, xdif, ydif, hue, sat;
577  HBRUSH hbrush;
578  HDC hdc ;
579  RECT rect, client;
580  HCURSOR hcursor = SetCursor( LoadCursorW(0, (LPCWSTR)IDC_WAIT) );
581 
583  hdc = GetDC(hwnd);
584  infoPtr->hdcMem = CreateCompatibleDC(hdc);
585  infoPtr->hbmMem = CreateCompatibleBitmap(hdc, client.right, client.bottom);
586  SelectObject(infoPtr->hdcMem, infoPtr->hbmMem);
587 
588  xdif = client.right / XSTEPS;
589  ydif = client.bottom / YSTEPS+1;
590  hdif = 239 / XSTEPS;
591  sdif = 240 / YSTEPS;
592  for (rect.left = hue = 0; hue < 239 + hdif; hue += hdif)
593  {
594  rect.right = rect.left + xdif;
595  rect.bottom = client.bottom;
596  for(sat = 0; sat < 240 + sdif; sat += sdif)
597  {
598  rect.top = rect.bottom - ydif;
599  hbrush = CreateSolidBrush(CC_HSLtoRGB(hue, sat, 120));
600  FillRect(infoPtr->hdcMem, &rect, hbrush);
602  rect.bottom = rect.top;
603  }
604  rect.left = rect.right;
605  }
606  ReleaseDC(hwnd, hdc);
607  SetCursor(hcursor);
608 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HDC hdcMem
Definition: colordlg.c:78
static HBRUSH hbrush
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
HWND hwndSelf
Definition: colordlg.c:76
HDC WINAPI GetDC(_In_opt_ HWND)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HBITMAP hbmMem
Definition: colordlg.c:79
HICON HCURSOR
Definition: windef.h:284
& rect
Definition: startmenu.cpp:1413
#define XSTEPS
Definition: colordlg.c:566
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define IDC_WAIT
Definition: winuser.h:684
#define YSTEPS
Definition: colordlg.c:567
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
static FILE * client
Definition: client.c:41
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
HDC hdc
Definition: main.c:9
#define IDC_COLOR_GRAPH
Definition: cdlg.h:160
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
static COLORREF CC_HSLtoRGB(int hue, int sat, int lum)
Definition: colordlg.c:130
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)

Referenced by CC_PaintColorGraph(), and CC_SwitchToFullSize().

◆ CC_RGBtoHSL()

static int CC_RGBtoHSL ( char  c,
COLORREF  rgb 
)
static

Definition at line 149 of file colordlg.c.

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

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

◆ CC_SwitchToFullSize()

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

Definition at line 706 of file colordlg.c.

707 {
708  int i;
709 
711  CC_PrepareColorGraph(infoPtr);
712  for (i = IDC_COLOR_EDIT_H; i <= IDC_COLOR_EDIT_B; i++)
713  ShowWindow( GetDlgItem(infoPtr->hwndSelf, i), SW_SHOW);
714  for (i = IDC_COLOR_HL; i <= IDC_COLOR_BL; i++)
715  ShowWindow( GetDlgItem(infoPtr->hwndSelf, i), SW_SHOW);
718  ShowWindow( GetDlgItem(infoPtr->hwndSelf, 1090), SW_SHOW);
719 
720  if (lprect)
721  SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, lprect->right-lprect->left,
722  lprect->bottom-lprect->top, SWP_NOMOVE|SWP_NOZORDER);
723 
726 
727  CC_EditSetRGB(infoPtr);
728  CC_EditSetHSL(infoPtr);
731 }
static void CC_PrepareColorGraph(CCPRIV *infoPtr)
Definition: colordlg.c:573
HWND hwndSelf
Definition: colordlg.c:76
#define IDC_COLOR_BL
Definition: cdlg.h:171
static void CC_EditSetHSL(CCPRIV *infoPtr)
Definition: colordlg.c:690
BOOL WINAPI UpdateWindow(_In_ HWND)
LONG top
Definition: windef.h:292
#define IDC_COLOR_RES
Definition: cdlg.h:162
LONG left
Definition: windef.h:291
#define SWP_NOZORDER
Definition: winuser.h:1232
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDC_COLOR_EDIT_H
Definition: cdlg.h:153
LONG right
Definition: windef.h:293
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
#define SW_SHOW
Definition: winuser.h:769
#define IDC_COLOR_HL
Definition: cdlg.h:166
#define IDC_COLOR_EDIT_B
Definition: cdlg.h:158
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_COLOR_LUMBAR
Definition: cdlg.h:152
static void CC_EditSetRGB(CCPRIV *infoPtr)
Definition: colordlg.c:670
#define IDC_COLOR_GRAPH
Definition: cdlg.h:160
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define IDC_COLOR_DEFINE
Definition: cdlg.h:163
#define IDC_COLOR_RESULT
Definition: cdlg.h:159
LONG bottom
Definition: windef.h:294
#define SWP_NOMOVE
Definition: winuser.h:1229
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define IDC_COLOR_ADD
Definition: cdlg.h:161

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 955 of file colordlg.c.

956 {
957  int r, g, b, i, xx;
958  UINT cokmsg;
959  HDC hdc;
960  COLORREF *cr;
961 
962  TRACE("CC_WMCommand wParam=%lx lParam=%lx\n", wParam, lParam);
963  switch (LOWORD(wParam))
964  {
965  case IDC_COLOR_EDIT_R: /* edit notify RGB */
966  case IDC_COLOR_EDIT_G:
967  case IDC_COLOR_EDIT_B:
968  if (notifyCode == EN_UPDATE && !lpp->updating)
969  {
970  i = CC_CheckDigitsInEdit(hwndCtl, 255);
971  r = GetRValue(lpp->lpcc->rgbResult);
972  g = GetGValue(lpp->lpcc->rgbResult);
973  b= GetBValue(lpp->lpcc->rgbResult);
974  xx = 0;
975  switch (LOWORD(wParam))
976  {
977  case IDC_COLOR_EDIT_R: if ((xx = (i != r))) r = i; break;
978  case IDC_COLOR_EDIT_G: if ((xx = (i != g))) g = i; break;
979  case IDC_COLOR_EDIT_B: if ((xx = (i != b))) b = i; break;
980  }
981  if (xx) /* something has changed */
982  {
983  lpp->lpcc->rgbResult = RGB(r, g, b);
985  lpp->h = CC_RGBtoHSL('H', lpp->lpcc->rgbResult);
986  lpp->s = CC_RGBtoHSL('S', lpp->lpcc->rgbResult);
987  lpp->l = CC_RGBtoHSL('L', lpp->lpcc->rgbResult);
988  CC_EditSetHSL(lpp);
989  CC_PaintCross(lpp);
990  CC_PaintTriangle(lpp);
991  }
992  }
993  break;
994 
995  case IDC_COLOR_EDIT_H: /* edit notify HSL */
996  case IDC_COLOR_EDIT_S:
997  case IDC_COLOR_EDIT_L:
998  if (notifyCode == EN_UPDATE && !lpp->updating)
999  {
1000  i = CC_CheckDigitsInEdit(hwndCtl , LOWORD(wParam) == IDC_COLOR_EDIT_H ? 239 : 240);
1001  xx = 0;
1002  switch (LOWORD(wParam))
1003  {
1004  case IDC_COLOR_EDIT_H: if ((xx = ( i != lpp->h))) lpp->h = i; break;
1005  case IDC_COLOR_EDIT_S: if ((xx = ( i != lpp->s))) lpp->s = i; break;
1006  case IDC_COLOR_EDIT_L: if ((xx = ( i != lpp->l))) lpp->l = i; break;
1007  }
1008  if (xx) /* something has changed */
1009  {
1010  lpp->lpcc->rgbResult = CC_HSLtoRGB(lpp->h, lpp->s, lpp->l);
1011  CC_PaintSelectedColor(lpp);
1012  CC_EditSetRGB(lpp);
1013  CC_PaintCross(lpp);
1014  CC_PaintTriangle(lpp);
1015  }
1016  }
1017  break;
1018 
1019  case IDC_COLOR_DEFINE:
1020  CC_SwitchToFullSize(lpp, &lpp->fullsize);
1022  break;
1023 
1024  case IDC_COLOR_ADD: /* add colors ... column by column */
1025  cr = lpp->lpcc->lpCustColors;
1026  cr[(lpp->nextuserdef % 2) * 8 + lpp->nextuserdef / 2] = lpp->lpcc->rgbResult;
1027  if (++lpp->nextuserdef == 16)
1028  lpp->nextuserdef = 0;
1029  CC_PaintUserColorArray(lpp, 2, 8);
1030  break;
1031 
1032  case IDC_COLOR_RES: /* resulting color */
1033  hdc = GetDC(lpp->hwndSelf);
1034  lpp->lpcc->rgbResult = GetNearestColor(hdc, lpp->lpcc->rgbResult);
1035  ReleaseDC(lpp->hwndSelf, hdc);
1036  CC_EditSetRGB(lpp);
1037  CC_PaintSelectedColor(lpp);
1038  lpp->h = CC_RGBtoHSL('H', lpp->lpcc->rgbResult);
1039  lpp->s = CC_RGBtoHSL('S', lpp->lpcc->rgbResult);
1040  lpp->l = CC_RGBtoHSL('L', lpp->lpcc->rgbResult);
1041  CC_EditSetHSL(lpp);
1042  CC_PaintCross(lpp);
1043  CC_PaintTriangle(lpp);
1044  break;
1045 
1046  case pshHelp: /* Help! */ /* The Beatles, 1965 ;-) */
1048  if (lpp->lpcc->hwndOwner)
1049  SendMessageA(lpp->lpcc->hwndOwner, i, 0, (LPARAM)lpp->lpcc);
1050  if ( CC_HookCallChk(lpp->lpcc))
1051  CallWindowProcA( (WNDPROC) lpp->lpcc->lpfnHook, lpp->hwndSelf,
1052  WM_COMMAND, psh15, (LPARAM)lpp->lpcc);
1053  break;
1054 
1055  case IDOK :
1057  if (lpp->lpcc->hwndOwner)
1058  if (SendMessageA(lpp->lpcc->hwndOwner, cokmsg, 0, (LPARAM)lpp->lpcc))
1059  break; /* do NOT close */
1060  EndDialog(lpp->hwndSelf, 1) ;
1061  return TRUE ;
1062 
1063  case IDCANCEL :
1064  EndDialog(lpp->hwndSelf, 0) ;
1065  return TRUE ;
1066 
1067  }
1068  return FALSE;
1069 }
static void CC_PaintTriangle(CCPRIV *infoPtr)
Definition: colordlg.c:466
static void CC_PaintCross(CCPRIV *infoPtr)
Definition: colordlg.c:516
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
HWND hwndSelf
Definition: colordlg.c:76
HDC WINAPI GetDC(_In_opt_ HWND)
COLORREF WINAPI GetNearestColor(_In_ HDC, _In_ COLORREF)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
BOOL updating
Definition: colordlg.c:84
static void CC_EditSetHSL(CCPRIV *infoPtr)
Definition: colordlg.c:690
COLORREF * lpCustColors
Definition: commdlg.h:254
static HDC
Definition: imagelist.c:92
#define GetRValue(rgb)
Definition: wingdi.h:2930
HWND WINAPI SetFocus(_In_opt_ HWND)
#define HELPMSGSTRINGA
Definition: commdlg.h:20
#define IDC_COLOR_RES
Definition: cdlg.h:162
#define IDC_COLOR_EDIT_H
Definition: cdlg.h:153
#define COLOROKSTRINGA
Definition: commdlg.h:18
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define IDC_COLOR_EDIT_G
Definition: cdlg.h:157
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define psh15
Definition: dlgs.h:126
#define GetGValue(rgb)
Definition: wingdi.h:2931
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
static void CC_SwitchToFullSize(CCPRIV *infoPtr, const RECT *lprect)
Definition: colordlg.c:706
RECT fullsize
Definition: colordlg.c:80
#define IDC_COLOR_EDIT_S
Definition: cdlg.h:154
int h
Definition: colordlg.c:85
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
int l
Definition: colordlg.c:87
#define IDC_COLOR_EDIT_L
Definition: cdlg.h:155
static void CC_PaintUserColorArray(const CCPRIV *infoPtr, int rows, int cols)
Definition: colordlg.c:783
LONG_PTR LPARAM
Definition: windef.h:208
static int CC_RGBtoHSL(char c, COLORREF rgb)
Definition: colordlg.c:149
#define b
Definition: ke_i.h:79
GLboolean GLboolean g
Definition: glext.h:6204
#define IDC_COLOR_EDIT_B
Definition: cdlg.h:158
static void CC_PaintSelectedColor(const CCPRIV *infoPtr)
Definition: colordlg.c:441
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define TRACE(s)
Definition: solgame.cpp:4
LPCHOOSECOLORW lpcc
Definition: colordlg.c:75
if(!(yy_init))
Definition: macro.lex.yy.c:714
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
HWND hwndOwner
Definition: commdlg.h:251
DWORD COLORREF
Definition: windef.h:285
int nextuserdef
Definition: colordlg.c:77
int s
Definition: colordlg.c:86
#define RGB(r, g, b)
Definition: wingdi.h:2935
int xx
Definition: npserver.c:29
static void CC_EditSetRGB(CCPRIV *infoPtr)
Definition: colordlg.c:670
#define IDC_COLOR_EDIT_R
Definition: cdlg.h:156
static BOOL CC_HookCallChk(const CHOOSECOLORW *lpcc)
Definition: colordlg.c:833
HDC hdc
Definition: main.c:9
#define WM_COMMAND
Definition: winuser.h:1722
#define IDC_COLOR_DEFINE
Definition: cdlg.h:163
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2880
COLORREF rgbResult
Definition: commdlg.h:253
LPCCHOOKPROC lpfnHook
Definition: commdlg.h:257
static COLORREF CC_HSLtoRGB(int hue, int sat, int lum)
Definition: colordlg.c:130
unsigned int UINT
Definition: ndis.h:50
#define pshHelp
Definition: dlgs.h:127
#define GetBValue(rgb)
Definition: wingdi.h:2932
#define EN_UPDATE
Definition: winuser.h:2010
#define IDC_COLOR_ADD
Definition: cdlg.h:161
#define IDCANCEL
Definition: winuser.h:825
static int CC_CheckDigitsInEdit(HWND hwnd, int maxval)
Definition: colordlg.c:399
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
UINT WINAPI RegisterWindowMessageA(_In_ LPCSTR)

Referenced by ColorDlgProc().

◆ CC_WMInitDialog()

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

Definition at line 845 of file colordlg.c.

846 {
848  int i, res;
849  int r, g, b;
850  HWND hwnd;
851  RECT rect;
852  POINT point;
853  CCPRIV *lpp;
854 
855  TRACE("WM_INITDIALOG lParam=%08lX\n", lParam);
856 
857  if (cc->lStructSize != sizeof(CHOOSECOLORW))
858  {
859  EndDialog(hDlg, 0);
860  return FALSE;
861  }
862 
863  lpp = heap_alloc_zero(sizeof(*lpp));
864  lpp->lpcc = cc;
865  lpp->hwndSelf = hDlg;
866 
867  SetPropW( hDlg, szColourDialogProp, lpp );
868 
869  if (!(lpp->lpcc->Flags & CC_SHOWHELP))
872 
873 #if 0
874  cpos = MAKELONG(5,7); /* init */
875  if (lpp->lpcc->Flags & CC_RGBINIT)
876  {
877  for (i = 0; i < 6; i++)
878  for (j = 0; j < 8; j++)
879  if (predefcolors[i][j] == lpp->lpcc->rgbResult)
880  {
881  cpos = MAKELONG(i,j);
882  goto found;
883  }
884  }
885  found:
886  /* FIXME: Draw_a_focus_rect & set_init_values */
887 #endif
888 
889  GetWindowRect(hDlg, &lpp->fullsize);
890  if (lpp->lpcc->Flags & CC_FULLOPEN || lpp->lpcc->Flags & CC_PREVENTFULLOPEN)
891  {
894  }
895  if (!(lpp->lpcc->Flags & CC_FULLOPEN ) || lpp->lpcc->Flags & CC_PREVENTFULLOPEN)
896  {
897  rect = lpp->fullsize;
898  res = rect.bottom - rect.top;
899  hwnd = GetDlgItem(hDlg, IDC_COLOR_GRAPH); /* cut at left border */
900  point.x = point.y = 0;
902  ScreenToClient(hDlg,&point);
903  GetClientRect(hDlg, &rect);
905  SetWindowPos(hDlg, 0, 0, 0, point.x, res, SWP_NOMOVE|SWP_NOZORDER);
906 
907  for (i = IDC_COLOR_EDIT_H; i <= IDC_COLOR_EDIT_B; i++)
908  ShowWindow( GetDlgItem(hDlg, i), SW_HIDE);
909  for (i = IDC_COLOR_HL; i <= IDC_COLOR_BL; i++)
910  ShowWindow( GetDlgItem(hDlg, i), SW_HIDE);
915  ShowWindow( GetDlgItem(hDlg, 1090 ), SW_HIDE);
916  }
917  else
919  res = TRUE;
920  for (i = IDC_COLOR_EDIT_H; i <= IDC_COLOR_EDIT_B; i++)
921  SendMessageA( GetDlgItem(hDlg, i), EM_LIMITTEXT, 3, 0); /* max 3 digits: xyz */
922  if (CC_HookCallChk(lpp->lpcc))
923  {
925  }
926 
927  /* Set the initial values of the color chooser dialog */
928  r = GetRValue(lpp->lpcc->rgbResult);
929  g = GetGValue(lpp->lpcc->rgbResult);
930  b = GetBValue(lpp->lpcc->rgbResult);
931 
933  lpp->h = CC_RGBtoHSL('H', lpp->lpcc->rgbResult);
934  lpp->s = CC_RGBtoHSL('S', lpp->lpcc->rgbResult);
935  lpp->l = CC_RGBtoHSL('L', lpp->lpcc->rgbResult);
936 
937  /* Doing it the long way because CC_EditSetRGB/HSL doesn't seem to work */
938  SetDlgItemInt(hDlg, IDC_COLOR_EDIT_H, lpp->h, TRUE);
939  SetDlgItemInt(hDlg, IDC_COLOR_EDIT_S, lpp->s, TRUE);
940  SetDlgItemInt(hDlg, IDC_COLOR_EDIT_L, lpp->l, TRUE);
944 
945  CC_PaintCross(lpp);
946  CC_PaintTriangle(lpp);
947 
948  return res;
949 }
#define EM_LIMITTEXT
Definition: winuser.h:1982
static void CC_PaintTriangle(CCPRIV *infoPtr)
Definition: colordlg.c:466
static void CC_PaintCross(CCPRIV *infoPtr)
Definition: colordlg.c:516
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
HWND hwndSelf
Definition: colordlg.c:76
#define SW_HIDE
Definition: winuser.h:762
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define CC_RGBINIT
Definition: commdlg.h:50
#define IDC_COLOR_BL
Definition: cdlg.h:171
#define GetRValue(rgb)
Definition: wingdi.h:2930
static const WCHAR szColourDialogProp[]
Definition: colordlg.c:64
#define CC_PREVENTFULLOPEN
Definition: commdlg.h:52
#define IDC_COLOR_RES
Definition: cdlg.h:162
#define SWP_NOZORDER
Definition: winuser.h:1232
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDC_COLOR_EDIT_H
Definition: cdlg.h:153
POINTL point
Definition: edittest.c:50
& rect
Definition: startmenu.cpp:1413
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define IDC_COLOR_EDIT_G
Definition: cdlg.h:157
LONG y
Definition: windef.h:315
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define GetGValue(rgb)
Definition: wingdi.h:2931
#define CC_SHOWHELP
Definition: commdlg.h:53
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
static void CC_SwitchToFullSize(CCPRIV *infoPtr, const RECT *lprect)
Definition: colordlg.c:706
RECT fullsize
Definition: colordlg.c:80
#define IDC_COLOR_EDIT_S
Definition: cdlg.h:154
int h
Definition: colordlg.c:85
int l
Definition: colordlg.c:87
#define MAKELONG(a, b)
Definition: typedefs.h:248
smooth NULL
Definition: ftsmooth.c:416
#define IDC_COLOR_EDIT_L
Definition: cdlg.h:155
static int CC_RGBtoHSL(char c, COLORREF rgb)
Definition: colordlg.c:149
#define IDC_COLOR_HL
Definition: cdlg.h:166
#define b
Definition: ke_i.h:79
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
GLboolean GLboolean g
Definition: glext.h:6204
#define IDC_COLOR_EDIT_B
Definition: cdlg.h:158
static void CC_PaintSelectedColor(const CCPRIV *infoPtr)
Definition: colordlg.c:441
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define TRACE(s)
Definition: solgame.cpp:4
LPCHOOSECOLORW lpcc
Definition: colordlg.c:75
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define SM_CXDLGFRAME
Definition: winuser.h:956
static const COLORREF predefcolors[6][8]
Definition: colordlg.c:46
int s
Definition: colordlg.c:86
int WINAPI GetSystemMetrics(_In_ int)
LONG x
Definition: windef.h:314
#define IDC_COLOR_EDIT_R
Definition: cdlg.h:156
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)
static BOOL CC_HookCallChk(const CHOOSECOLORW *lpcc)
Definition: colordlg.c:833
#define IDC_COLOR_GRAPH
Definition: cdlg.h:160
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define IDC_COLOR_DEFINE
Definition: cdlg.h:163
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2880
uint32_t cc
Definition: isohybrid.c:75
COLORREF rgbResult
Definition: commdlg.h:253
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
LPCCHOOKPROC lpfnHook
Definition: commdlg.h:257
UINT msetrgb
Definition: colordlg.c:81
#define IDC_COLOR_RESULT
Definition: cdlg.h:159
#define pshHelp
Definition: dlgs.h:127
GLuint res
Definition: glext.h:9613
#define GetBValue(rgb)
Definition: wingdi.h:2932
#define SWP_NOMOVE
Definition: winuser.h:1229
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define IDC_COLOR_ADD
Definition: cdlg.h:161
#define SETRGBSTRINGA
Definition: commdlg.h:19
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define CC_FULLOPEN
Definition: commdlg.h:51
UINT WINAPI RegisterWindowMessageA(_In_ LPCSTR)

Referenced by ColorDlgProc().

◆ CC_WMLButtonDown()

static LRESULT CC_WMLButtonDown ( CCPRIV infoPtr,
LPARAM  lParam 
)
static

Definition at line 1142 of file colordlg.c.

1143 {
1144  int i = 0;
1145 
1146  if (CC_MouseCheckPredefColorArray(infoPtr, 6, 8, lParam))
1147  i = 1;
1148  else
1149  if (CC_MouseCheckUserColorArray(infoPtr, 2, 8, lParam))
1150  i = 1;
1151  else
1152  if (CC_MouseCheckColorGraph(infoPtr->hwndSelf, IDC_COLOR_GRAPH, &infoPtr->h, &infoPtr->s, lParam))
1153  {
1154  i = 2;
1155  infoPtr->capturedGraph = IDC_COLOR_GRAPH;
1156  }
1157  else
1158  if (CC_MouseCheckColorGraph(infoPtr->hwndSelf, IDC_COLOR_LUMBAR, NULL, &infoPtr->l, lParam))
1159  {
1160  i = 2;
1161  infoPtr->capturedGraph = IDC_COLOR_LUMBAR;
1162  }
1163  if ( i == 2 )
1164  {
1165  SetCapture(infoPtr->hwndSelf);
1166  infoPtr->lpcc->rgbResult = CC_HSLtoRGB(infoPtr->h, infoPtr->s, infoPtr->l);
1167  }
1168  if ( i == 1 )
1169  {
1170  infoPtr->h = CC_RGBtoHSL('H', infoPtr->lpcc->rgbResult);
1171  infoPtr->s = CC_RGBtoHSL('S', infoPtr->lpcc->rgbResult);
1172  infoPtr->l = CC_RGBtoHSL('L', infoPtr->lpcc->rgbResult);
1173  }
1174  if (i)
1175  {
1176  CC_EditSetRGB(infoPtr);
1177  CC_EditSetHSL(infoPtr);
1178  CC_PaintCross(infoPtr);
1179  CC_PaintTriangle(infoPtr);
1180  CC_PaintSelectedColor(infoPtr);
1181  return TRUE;
1182  }
1183  return FALSE;
1184 }
static void CC_PaintTriangle(CCPRIV *infoPtr)
Definition: colordlg.c:466
static void CC_PaintCross(CCPRIV *infoPtr)
Definition: colordlg.c:516
#define TRUE
Definition: types.h:120
int capturedGraph
Definition: colordlg.c:88
HWND hwndSelf
Definition: colordlg.c:76
static BOOL CC_MouseCheckColorGraph(HWND hDlg, int dlgitem, int *hori, int *vert, LPARAM lParam)
Definition: colordlg.c:339
static void CC_EditSetHSL(CCPRIV *infoPtr)
Definition: colordlg.c:690
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
int h
Definition: colordlg.c:85
int l
Definition: colordlg.c:87
smooth NULL
Definition: ftsmooth.c:416
static int CC_RGBtoHSL(char c, COLORREF rgb)
Definition: colordlg.c:149
static void CC_PaintSelectedColor(const CCPRIV *infoPtr)
Definition: colordlg.c:441
LPCHOOSECOLORW lpcc
Definition: colordlg.c:75
#define IDC_COLOR_LUMBAR
Definition: cdlg.h:152
int s
Definition: colordlg.c:86
static void CC_EditSetRGB(CCPRIV *infoPtr)
Definition: colordlg.c:670
#define IDC_COLOR_GRAPH
Definition: cdlg.h:160
COLORREF rgbResult
Definition: commdlg.h:253
HWND WINAPI SetCapture(_In_ HWND hWnd)
static COLORREF CC_HSLtoRGB(int hue, int sat, int lum)
Definition: colordlg.c:130
static BOOL CC_MouseCheckPredefColorArray(CCPRIV *lpp, int rows, int cols, LPARAM lParam)
Definition: colordlg.c:263
static BOOL CC_MouseCheckUserColorArray(CCPRIV *lpp, int rows, int cols, LPARAM lParam)
Definition: colordlg.c:296
LPARAM lParam
Definition: combotst.c:139

Referenced by ColorDlgProc().

◆ CC_WMLButtonUp()

static LRESULT CC_WMLButtonUp ( CCPRIV infoPtr)
static

Definition at line 1095 of file colordlg.c.

1096 {
1097  if (infoPtr->capturedGraph)
1098  {
1099  infoPtr->capturedGraph = 0;
1100  ReleaseCapture();
1101  CC_PaintCross(infoPtr);
1102  return 1;
1103  }
1104  return 0;
1105 }
static void CC_PaintCross(CCPRIV *infoPtr)
Definition: colordlg.c:516
int capturedGraph
Definition: colordlg.c:88
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2888

Referenced by ColorDlgProc().

◆ CC_WMMouseMove()

static LRESULT CC_WMMouseMove ( CCPRIV infoPtr,
LPARAM  lParam 
)
static

Definition at line 1110 of file colordlg.c.

1111 {
1112  if (infoPtr->capturedGraph)
1113  {
1114  int *ptrh = NULL, *ptrs = &infoPtr->l;
1115  if (infoPtr->capturedGraph == IDC_COLOR_GRAPH)
1116  {
1117  ptrh = &infoPtr->h;
1118  ptrs = &infoPtr->s;
1119  }
1120  if (CC_MouseCheckColorGraph( infoPtr->hwndSelf, infoPtr->capturedGraph, ptrh, ptrs, lParam))
1121  {
1122  infoPtr->lpcc->rgbResult = CC_HSLtoRGB(infoPtr->h, infoPtr->s, infoPtr->l);
1123  CC_EditSetRGB(infoPtr);
1124  CC_EditSetHSL(infoPtr);
1125  CC_PaintCross(infoPtr);
1126  CC_PaintTriangle(infoPtr);
1127  CC_PaintSelectedColor(infoPtr);
1128  }
1129  else
1130  {
1131  ReleaseCapture();
1132  infoPtr->capturedGraph = 0;
1133  }
1134  return 1;
1135  }
1136  return 0;
1137 }
static void CC_PaintTriangle(CCPRIV *infoPtr)
Definition: colordlg.c:466
static void CC_PaintCross(CCPRIV *infoPtr)
Definition: colordlg.c:516
int capturedGraph
Definition: colordlg.c:88
HWND hwndSelf
Definition: colordlg.c:76
static BOOL CC_MouseCheckColorGraph(HWND hDlg, int dlgitem, int *hori, int *vert, LPARAM lParam)
Definition: colordlg.c:339
static void CC_EditSetHSL(CCPRIV *infoPtr)
Definition: colordlg.c:690
int h
Definition: colordlg.c:85
int l
Definition: colordlg.c:87
smooth NULL
Definition: ftsmooth.c:416
static void CC_PaintSelectedColor(const CCPRIV *infoPtr)
Definition: colordlg.c:441
LPCHOOSECOLORW lpcc
Definition: colordlg.c:75
int s
Definition: colordlg.c:86
static void CC_EditSetRGB(CCPRIV *infoPtr)
Definition: colordlg.c:670
#define IDC_COLOR_GRAPH
Definition: cdlg.h:160
COLORREF rgbResult
Definition: commdlg.h:253
static COLORREF CC_HSLtoRGB(int hue, int sat, int lum)
Definition: colordlg.c:130
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2888
LPARAM lParam
Definition: combotst.c:139

Referenced by ColorDlgProc().

◆ CC_WMPaint()

static LRESULT CC_WMPaint ( CCPRIV lpp)
static

Definition at line 1074 of file colordlg.c.

1075 {
1076  PAINTSTRUCT ps;
1077 
1078  BeginPaint(lpp->hwndSelf, &ps);
1079  /* we have to paint dialog children except text and buttons */
1080  CC_PaintPredefColorArray(lpp, 6, 8);
1081  CC_PaintUserColorArray(lpp, 2, 8);
1082  CC_PaintLumBar(lpp);
1083  CC_PaintTriangle(lpp);
1084  CC_PaintSelectedColor(lpp);
1085  CC_PaintColorGraph(lpp);
1086  CC_PaintCross(lpp);
1087  EndPaint(lpp->hwndSelf, &ps);
1088 
1089  return TRUE;
1090 }
static void CC_PaintTriangle(CCPRIV *infoPtr)
Definition: colordlg.c:466
static void CC_PaintCross(CCPRIV *infoPtr)
Definition: colordlg.c:516
static void CC_PaintLumBar(const CCPRIV *infoPtr)
Definition: colordlg.c:637
#define TRUE
Definition: types.h:120
HWND hwndSelf
Definition: colordlg.c:76
static void CC_PaintColorGraph(CCPRIV *infoPtr)
Definition: colordlg.c:613
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
static void CC_PaintUserColorArray(const CCPRIV *infoPtr, int rows, int cols)
Definition: colordlg.c:783
static void CC_PaintSelectedColor(const CCPRIV *infoPtr)
Definition: colordlg.c:441
static void CC_PaintPredefColorArray(const CCPRIV *infoPtr, int rows, int cols)
Definition: colordlg.c:737

Referenced by ColorDlgProc().

◆ ChooseColorA()

BOOL WINAPI ChooseColorA ( LPCHOOSECOLORA  lpChCol)

Definition at line 1325 of file colordlg.c.

1327 {
1328  LPWSTR template_name = NULL;
1329  BOOL ret;
1330 
1331  CHOOSECOLORW *lpcc = heap_alloc_zero(sizeof(*lpcc));
1332  lpcc->lStructSize = sizeof(*lpcc);
1333  lpcc->hwndOwner = lpChCol->hwndOwner;
1334  lpcc->hInstance = lpChCol->hInstance;
1335  lpcc->rgbResult = lpChCol->rgbResult;
1336  lpcc->lpCustColors = lpChCol->lpCustColors;
1337  lpcc->Flags = lpChCol->Flags;
1338  lpcc->lCustData = lpChCol->lCustData;
1339  lpcc->lpfnHook = lpChCol->lpfnHook;
1340  if ((lpcc->Flags & CC_ENABLETEMPLATE) && (lpChCol->lpTemplateName)) {
1341  if (!IS_INTRESOURCE(lpChCol->lpTemplateName)) {
1342  INT len = MultiByteToWideChar( CP_ACP, 0, lpChCol->lpTemplateName, -1, NULL, 0);
1343  template_name = heap_alloc( len * sizeof(WCHAR) );
1344  MultiByteToWideChar( CP_ACP, 0, lpChCol->lpTemplateName, -1, template_name, len );
1345  lpcc->lpTemplateName = template_name;
1346  } else {
1347  lpcc->lpTemplateName = (LPCWSTR)lpChCol->lpTemplateName;
1348  }
1349  }
1350 
1351  ret = ChooseColorW(lpcc);
1352 
1353  if (ret)
1354  lpChCol->rgbResult = lpcc->rgbResult;
1355 
1356  heap_free(template_name);
1357  heap_free(lpcc);
1358  return ret;
1359 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
BOOL WINAPI ChooseColorW(CHOOSECOLORW *lpChCol)
Definition: colordlg.c:1264
#define CP_ACP
Definition: compat.h:99
LPCSTR lpTemplateName
Definition: commdlg.h:247
COLORREF * lpCustColors
Definition: commdlg.h:254
HWND hInstance
Definition: commdlg.h:252
DWORD lStructSize
Definition: commdlg.h:250
COLORREF rgbResult
Definition: commdlg.h:242
int32_t INT
Definition: typedefs.h:56
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define CC_ENABLETEMPLATE
Definition: commdlg.h:55
unsigned int BOOL
Definition: ntddk_ex.h:94
LPCCHOOKPROC lpfnHook
Definition: commdlg.h:246
smooth NULL
Definition: ftsmooth.c:416
LPCWSTR lpTemplateName
Definition: commdlg.h:258
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
__wchar_t WCHAR
Definition: xmlstorage.h:180
HWND hwndOwner
Definition: commdlg.h:251
LPARAM lCustData
Definition: commdlg.h:245
HWND hInstance
Definition: commdlg.h:241
int ret
GLenum GLsizei len
Definition: glext.h:6722
COLORREF rgbResult
Definition: commdlg.h:253
LPCCHOOKPROC lpfnHook
Definition: commdlg.h:257
HWND hwndOwner
Definition: commdlg.h:240
#define MultiByteToWideChar
Definition: compat.h:100
LPARAM lCustData
Definition: commdlg.h:256
WCHAR * LPWSTR
Definition: xmlstorage.h:184
COLORREF * lpCustColors
Definition: commdlg.h:243
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ ChooseColorW()

BOOL WINAPI ChooseColorW ( CHOOSECOLORW lpChCol)

Definition at line 1264 of file colordlg.c.

1265 {
1266  HANDLE hDlgTmpl = 0;
1267  const void *template;
1268 
1269  TRACE("(%p)\n", lpChCol);
1270 
1271  if (!lpChCol) return FALSE;
1272 
1273  if (lpChCol->Flags & CC_ENABLETEMPLATEHANDLE)
1274  {
1275  if (!(template = LockResource(lpChCol->hInstance)))
1276  {
1278  return FALSE;
1279  }
1280  }
1281  else if (lpChCol->Flags & CC_ENABLETEMPLATE)
1282  {
1283  HRSRC hResInfo;
1284  if (!(hResInfo = FindResourceW((HINSTANCE)lpChCol->hInstance,
1285  lpChCol->lpTemplateName,
1286  (LPWSTR)RT_DIALOG)))
1287  {
1289  return FALSE;
1290  }
1291  if (!(hDlgTmpl = LoadResource((HINSTANCE)lpChCol->hInstance, hResInfo)) ||
1292  !(template = LockResource(hDlgTmpl)))
1293  {
1295  return FALSE;
1296  }
1297  }
1298  else
1299  {
1300  HRSRC hResInfo;
1301  HGLOBAL hDlgTmpl;
1302  static const WCHAR wszCHOOSE_COLOR[] = {'C','H','O','O','S','E','_','C','O','L','O','R',0};
1303  if (!(hResInfo = FindResourceW(COMDLG32_hInstance, wszCHOOSE_COLOR, (LPWSTR)RT_DIALOG)))
1304  {
1306  return FALSE;
1307  }
1308  if (!(hDlgTmpl = LoadResource(COMDLG32_hInstance, hResInfo )) ||
1309  !(template = LockResource(hDlgTmpl)))
1310  {
1312  return FALSE;
1313  }
1314  }
1315 
1316  return DialogBoxIndirectParamW(COMDLG32_hInstance, template, lpChCol->hwndOwner,
1317  ColorDlgProc, (LPARAM)lpChCol);
1318 }
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
#define CDERR_LOADRESFAILURE
Definition: cderr.h:12
HWND hInstance
Definition: commdlg.h:252
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
#define CC_ENABLETEMPLATE
Definition: commdlg.h:55
#define CDERR_FINDRESFAILURE
Definition: cderr.h:11
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
#define CC_ENABLETEMPLATEHANDLE
Definition: commdlg.h:56
LONG_PTR LPARAM
Definition: windef.h:208
#define RT_DIALOG
Definition: pedump.c:367
LPCWSTR lpTemplateName
Definition: commdlg.h:258
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
HWND hwndOwner
Definition: commdlg.h:251
void COMDLG32_SetCommDlgExtendedError(DWORD err) DECLSPEC_HIDDEN
Definition: cdlg32.c:119
INT_PTR WINAPI DialogBoxIndirectParamW(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
static INT_PTR CALLBACK ColorDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
Definition: colordlg.c:1190
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by ChooseColorA().

◆ ColorDlgProc()

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

Definition at line 1190 of file colordlg.c.

1192 {
1193 
1194  int res;
1195  CCPRIV *lpp = GetPropW( hDlg, szColourDialogProp );
1196 
1197  if (message != WM_INITDIALOG)
1198  {
1199  if (!lpp)
1200  return FALSE;
1201  res = 0;
1202  if (CC_HookCallChk(lpp->lpcc))
1204  if ( res )
1205  return res;
1206  }
1207 
1208  /* FIXME: SetRGB message
1209  if (message && message == msetrgb)
1210  return HandleSetRGB(hDlg, lParam);
1211  */
1212 
1213  switch (message)
1214  {
1215  case WM_INITDIALOG:
1216  return CC_WMInitDialog(hDlg, wParam, lParam);
1217  case WM_NCDESTROY:
1218  DeleteDC(lpp->hdcMem);
1219  DeleteObject(lpp->hbmMem);
1220  heap_free(lpp);
1222  break;
1223  case WM_COMMAND:
1224  if (CC_WMCommand(lpp, wParam, lParam, HIWORD(wParam), (HWND) lParam))
1225  return TRUE;
1226  break;
1227  case WM_PAINT:
1228  if (CC_WMPaint(lpp))
1229  return TRUE;
1230  break;
1231  case WM_LBUTTONDBLCLK:
1232  if (CC_MouseCheckResultWindow(hDlg, lParam))
1233  return TRUE;
1234  break;
1235  case WM_MOUSEMOVE:
1236  if (CC_WMMouseMove(lpp, lParam))
1237  return TRUE;
1238  break;
1239  case WM_LBUTTONUP: /* FIXME: ClipCursor off (if in color graph)*/
1240  if (CC_WMLButtonUp(lpp))
1241  return TRUE;
1242  break;
1243  case WM_LBUTTONDOWN:/* FIXME: ClipCursor on (if in color graph)*/
1244  if (CC_WMLButtonDown(lpp, lParam))
1245  return TRUE;
1246  break;
1247  }
1248  return FALSE ;
1249 }
HDC hdcMem
Definition: colordlg.c:78
Definition: tftpd.h:59
#define TRUE
Definition: types.h:120
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
static const WCHAR szColourDialogProp[]
Definition: colordlg.c:64
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HBITMAP hbmMem
Definition: colordlg.c:79
static BOOL CC_MouseCheckResultWindow(HWND hDlg, LPARAM lParam)
Definition: colordlg.c:378
WPARAM wParam
Definition: combotst.c:138
HANDLE WINAPI RemovePropW(_In_ HWND, _In_ LPCWSTR)
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static LRESULT CC_WMCommand(CCPRIV *lpp, WPARAM wParam, LPARAM lParam, WORD notifyCode, HWND hwndCtl)
Definition: colordlg.c:955
LPCHOOSECOLORW lpcc
Definition: colordlg.c:75
static LRESULT CC_WMPaint(CCPRIV *lpp)
Definition: colordlg.c:1074
#define WM_NCDESTROY
Definition: winuser.h:1666
static LRESULT CC_WMLButtonDown(CCPRIV *infoPtr, LPARAM lParam)
Definition: colordlg.c:1142
static LRESULT CC_WMMouseMove(CCPRIV *infoPtr, LPARAM lParam)
Definition: colordlg.c:1110
static LRESULT CC_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam)
Definition: colordlg.c:845
#define WM_PAINT
Definition: winuser.h:1602
static BOOL CC_HookCallChk(const CHOOSECOLORW *lpcc)
Definition: colordlg.c:833
static LRESULT CC_WMLButtonUp(CCPRIV *infoPtr)
Definition: colordlg.c:1095
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1760
#define WM_COMMAND
Definition: winuser.h:1722
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2880
BOOL WINAPI DeleteDC(_In_ HDC)
LPCCHOOKPROC lpfnHook
Definition: commdlg.h:257
#define WM_LBUTTONUP
Definition: winuser.h:1759
#define WM_MOUSEMOVE
Definition: winuser.h:1757
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
GLuint res
Definition: glext.h:9613
#define HIWORD(l)
Definition: typedefs.h:246
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by ChooseColorW().

◆ hsl_to_x()

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

Definition at line 93 of file colordlg.c.

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

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 },
}
static const WCHAR L[]
Definition: oid.c:1250

Definition at line 46 of file colordlg.c.

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

◆ szColourDialogProp

const WCHAR szColourDialogProp[]
static
Initial value:
= {
'c','o','l','o','u','r','d','i','a','l','o','g','p','r','o','p',0 }

Definition at line 64 of file colordlg.c.

Referenced by CC_WMInitDialog(), and ColorDlgProc().