1999-02-28 21:05:11 +01:00
|
|
|
/*
|
2000-04-24 19:35:11 +02:00
|
|
|
* COMMDLG - Color Dialog
|
1999-02-28 21:05:11 +01:00
|
|
|
*
|
|
|
|
* Copyright 1994 Martin Ayotte
|
|
|
|
* Copyright 1996 Albrecht Kleine
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
1999-02-28 21:05:11 +01:00
|
|
|
*/
|
|
|
|
|
2000-07-23 16:21:38 +02:00
|
|
|
/* BUGS : still seems to not refresh correctly
|
|
|
|
sometimes, especially when 2 instances of the
|
|
|
|
dialog are loaded at the same time */
|
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
#include <ctype.h>
|
|
|
|
#include <stdlib.h>
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2000-02-10 20:03:02 +01:00
|
|
|
#include <stdio.h>
|
1999-02-28 21:05:11 +01:00
|
|
|
#include <string.h>
|
2000-02-10 20:03:02 +01:00
|
|
|
#include "windef.h"
|
1999-02-28 21:05:11 +01:00
|
|
|
#include "winbase.h"
|
2000-02-10 20:03:02 +01:00
|
|
|
#include "wingdi.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "winuser.h"
|
1999-02-28 21:05:11 +01:00
|
|
|
#include "commdlg.h"
|
|
|
|
#include "dlgs.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
1999-03-13 18:07:56 +01:00
|
|
|
#include "cderr.h"
|
2003-12-12 07:09:13 +01:00
|
|
|
#include "cdlg.h"
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
|
1999-04-19 16:56:29 +02:00
|
|
|
|
2002-10-31 02:04:39 +01:00
|
|
|
static INT_PTR CALLBACK ColorDlgProc( HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam );
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2003-09-17 06:28:28 +02:00
|
|
|
#define CONV_LPARAMTOPOINT(lp,p) do { (p)->x = (short)LOWORD(lp); (p)->y = (short)HIWORD(lp); } while(0)
|
2000-09-27 00:20:14 +02:00
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
static const COLORREF predefcolors[6][8]=
|
|
|
|
{
|
|
|
|
{ 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 },
|
|
|
|
};
|
|
|
|
|
2006-03-09 16:45:16 +01:00
|
|
|
static const WCHAR szColourDialogProp[] = {
|
|
|
|
'c','o','l','o','u','r','d','i','a','l','o','g','p','r','o','p',0 };
|
|
|
|
|
2003-12-12 07:09:13 +01:00
|
|
|
/* Chose Color PRIVATE Structure:
|
|
|
|
*
|
|
|
|
* This structure is duplicated in the 16 bit code with
|
2005-03-23 14:15:18 +01:00
|
|
|
* an extra member
|
2003-12-12 07:09:13 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct CCPRIVATE
|
|
|
|
{
|
|
|
|
LPCHOOSECOLORW lpcc; /* points to public known data structure */
|
|
|
|
int nextuserdef; /* next free place in user defined color array */
|
|
|
|
HDC hdcMem; /* color graph used for BitBlt() */
|
|
|
|
HBITMAP hbmMem; /* color graph bitmap */
|
|
|
|
RECT fullsize; /* original dialog window size */
|
|
|
|
UINT msetrgb; /* # of SETRGBSTRING message (today not used) */
|
|
|
|
RECT old3angle; /* last position of l-marker */
|
|
|
|
RECT oldcross; /* last position of color/satuation marker */
|
|
|
|
BOOL updating; /* to prevent recursive WM_COMMAND/EN_UPDATE processing */
|
|
|
|
int h;
|
|
|
|
int s;
|
|
|
|
int l; /* for temporary storing of hue,sat,lum */
|
|
|
|
int capturedGraph; /* control mouse captured */
|
|
|
|
RECT focusRect; /* rectangle last focused item */
|
|
|
|
HWND hwndFocus; /* handle last focused item */
|
2007-04-04 23:22:20 +02:00
|
|
|
} CCPRIV, *LPCCPRIV;
|
2003-12-12 07:09:13 +01:00
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* CC_HSLtoRGB [internal]
|
|
|
|
*/
|
2003-12-01 23:45:30 +01:00
|
|
|
int CC_HSLtoRGB(char c, int hue, int sat, int lum)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
int res = 0, maxrgb;
|
1999-02-28 21:05:11 +01:00
|
|
|
|
|
|
|
/* hue */
|
|
|
|
switch(c)
|
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
case 'R': if (hue > 80) hue -= 80; else hue += 160; break;
|
|
|
|
case 'G': if (hue > 160) hue -= 160; else hue += 80; break;
|
|
|
|
case 'B': break;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* l below 120 */
|
2000-04-24 19:35:11 +02:00
|
|
|
maxrgb = (256 * min(120,lum)) / 120; /* 0 .. 256 */
|
|
|
|
if (hue < 80)
|
|
|
|
res = 0;
|
1999-02-28 21:05:11 +01:00
|
|
|
else
|
2000-04-24 19:35:11 +02:00
|
|
|
if (hue < 120)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
res = (hue - 80) * maxrgb; /* 0...10240 */
|
|
|
|
res /= 40; /* 0...256 */
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
else
|
2000-04-24 19:35:11 +02:00
|
|
|
if (hue < 200)
|
|
|
|
res = maxrgb;
|
1999-02-28 21:05:11 +01:00
|
|
|
else
|
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
res= (240 - hue) * maxrgb;
|
|
|
|
res /= 40;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
2000-04-24 19:35:11 +02:00
|
|
|
res = res - maxrgb / 2; /* -128...128 */
|
1999-02-28 21:05:11 +01:00
|
|
|
|
|
|
|
/* saturation */
|
2000-04-24 19:35:11 +02:00
|
|
|
res = maxrgb / 2 + (sat * res) / 240; /* 0..256 */
|
1999-02-28 21:05:11 +01:00
|
|
|
|
|
|
|
/* lum above 120 */
|
2000-04-24 19:35:11 +02:00
|
|
|
if (lum > 120 && res < 256)
|
|
|
|
res += ((lum - 120) * (256 - res)) / 120;
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
return min(res, 255);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CC_RGBtoHSL [internal]
|
|
|
|
*/
|
2003-12-01 23:45:30 +01:00
|
|
|
int CC_RGBtoHSL(char c, int r, int g, int b)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
WORD maxi, mini, mmsum, mmdif, result = 0;
|
|
|
|
int iresult = 0;
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
maxi = max(r, b);
|
|
|
|
maxi = max(maxi, g);
|
|
|
|
mini = min(r, b);
|
|
|
|
mini = min(mini, g);
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
mmsum = maxi + mini;
|
|
|
|
mmdif = maxi - mini;
|
1999-02-28 21:05:11 +01:00
|
|
|
|
|
|
|
switch(c)
|
|
|
|
{
|
|
|
|
/* lum */
|
2000-04-24 19:35:11 +02:00
|
|
|
case 'L': mmsum *= 120; /* 0...61200=(255+255)*120 */
|
|
|
|
result = mmsum / 255; /* 0...240 */
|
1999-02-28 21:05:11 +01:00
|
|
|
break;
|
|
|
|
/* saturation */
|
2000-04-24 19:35:11 +02:00
|
|
|
case 'S': if (!mmsum)
|
|
|
|
result = 0;
|
1999-02-28 21:05:11 +01:00
|
|
|
else
|
2000-04-24 19:35:11 +02:00
|
|
|
if (!mini || maxi == 255)
|
|
|
|
result = 240;
|
1999-02-28 21:05:11 +01:00
|
|
|
else
|
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
result = mmdif * 240; /* 0...61200=255*240 */
|
|
|
|
result /= (mmsum > 255 ? mmsum = 510 - mmsum : mmsum); /* 0..255 */
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
/* hue */
|
2000-04-24 19:35:11 +02:00
|
|
|
case 'H': if (!mmdif)
|
|
|
|
result = 160;
|
1999-02-28 21:05:11 +01:00
|
|
|
else
|
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
if (maxi == r)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
iresult = 40 * (g - b); /* -10200 ... 10200 */
|
|
|
|
iresult /= (int) mmdif; /* -40 .. 40 */
|
|
|
|
if (iresult < 0)
|
|
|
|
iresult += 240; /* 0..40 and 200..240 */
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
else
|
2000-04-24 19:35:11 +02:00
|
|
|
if (maxi == g)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
iresult = 40 * (b - r);
|
|
|
|
iresult /= (int) mmdif;
|
|
|
|
iresult += 80; /* 40 .. 120 */
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
else
|
2000-04-24 19:35:11 +02:00
|
|
|
if (maxi == b)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
iresult = 40 * (r - g);
|
|
|
|
iresult /= (int) mmdif;
|
|
|
|
iresult += 160; /* 120 .. 200 */
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
2000-04-24 19:35:11 +02:00
|
|
|
result = iresult;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return result; /* is this integer arithmetic precise enough ? */
|
|
|
|
}
|
|
|
|
|
2000-07-23 16:21:38 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CC_DrawCurrentFocusRect [internal]
|
|
|
|
*/
|
2007-04-04 23:22:20 +02:00
|
|
|
static void CC_DrawCurrentFocusRect( const CCPRIV *lpp )
|
2000-07-23 16:21:38 +02:00
|
|
|
{
|
|
|
|
if (lpp->hwndFocus)
|
|
|
|
{
|
|
|
|
HDC hdc = GetDC(lpp->hwndFocus);
|
|
|
|
DrawFocusRect(hdc, &lpp->focusRect);
|
|
|
|
ReleaseDC(lpp->hwndFocus, hdc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CC_DrawFocusRect [internal]
|
|
|
|
*/
|
2007-04-04 23:22:20 +02:00
|
|
|
static void CC_DrawFocusRect( LPCCPRIV lpp, HWND hwnd, int x, int y, int rows, int cols)
|
2000-07-23 16:21:38 +02:00
|
|
|
{
|
|
|
|
RECT rect;
|
|
|
|
int dx, dy;
|
|
|
|
HDC hdc;
|
|
|
|
|
|
|
|
CC_DrawCurrentFocusRect(lpp); /* remove current focus rect */
|
|
|
|
/* calculate new rect */
|
|
|
|
GetClientRect(hwnd, &rect);
|
|
|
|
dx = (rect.right - rect.left) / cols;
|
|
|
|
dy = (rect.bottom - rect.top) / rows;
|
|
|
|
rect.left += (x * dx) - 2;
|
|
|
|
rect.top += (y * dy) - 2;
|
|
|
|
rect.right = rect.left + dx;
|
|
|
|
rect.bottom = rect.top + dy;
|
|
|
|
/* draw it */
|
|
|
|
hdc = GetDC(hwnd);
|
|
|
|
DrawFocusRect(hdc, &rect);
|
|
|
|
CopyRect(&lpp->focusRect, &rect);
|
|
|
|
lpp->hwndFocus = hwnd;
|
|
|
|
ReleaseDC(hwnd, hdc);
|
|
|
|
}
|
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
#define DISTANCE 4
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CC_MouseCheckPredefColorArray [internal]
|
2000-04-24 19:35:11 +02:00
|
|
|
* returns 1 if one of the predefined colors is clicked
|
1999-02-28 21:05:11 +01:00
|
|
|
*/
|
2007-04-04 23:22:20 +02:00
|
|
|
static int CC_MouseCheckPredefColorArray( LPCCPRIV lpp, HWND hDlg, int dlgitem, int rows, int cols,
|
2000-07-23 16:21:38 +02:00
|
|
|
LPARAM lParam )
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
HWND hwnd;
|
|
|
|
POINT point;
|
|
|
|
RECT rect;
|
|
|
|
int dx, dy, x, y;
|
|
|
|
|
2000-09-27 00:20:14 +02:00
|
|
|
CONV_LPARAMTOPOINT(lParam, &point);
|
2000-04-24 19:35:11 +02:00
|
|
|
ClientToScreen(hDlg, &point);
|
|
|
|
hwnd = GetDlgItem(hDlg, dlgitem);
|
|
|
|
GetWindowRect(hwnd, &rect);
|
|
|
|
if (PtInRect(&rect, point))
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
dx = (rect.right - rect.left) / cols;
|
|
|
|
dy = (rect.bottom - rect.top) / rows;
|
|
|
|
ScreenToClient(hwnd, &point);
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
if (point.x % dx < ( dx - DISTANCE) && point.y % dy < ( dy - DISTANCE))
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
x = point.x / dx;
|
|
|
|
y = point.y / dy;
|
2000-07-23 16:21:38 +02:00
|
|
|
lpp->lpcc->rgbResult = predefcolors[y][x];
|
|
|
|
CC_DrawFocusRect(lpp, hwnd, x, y, rows, cols);
|
1999-02-28 21:05:11 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CC_MouseCheckUserColorArray [internal]
|
2000-07-23 16:21:38 +02:00
|
|
|
* return 1 if the user clicked a color
|
1999-02-28 21:05:11 +01:00
|
|
|
*/
|
2007-04-04 23:22:20 +02:00
|
|
|
static int CC_MouseCheckUserColorArray( LPCCPRIV lpp, HWND hDlg, int dlgitem, int rows, int cols,
|
2000-07-23 16:21:38 +02:00
|
|
|
LPARAM lParam )
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
HWND hwnd;
|
|
|
|
POINT point;
|
|
|
|
RECT rect;
|
|
|
|
int dx, dy, x, y;
|
2000-07-23 16:21:38 +02:00
|
|
|
COLORREF *crarr = lpp->lpcc->lpCustColors;
|
2000-04-24 19:35:11 +02:00
|
|
|
|
2000-09-27 00:20:14 +02:00
|
|
|
CONV_LPARAMTOPOINT(lParam, &point);
|
2000-04-24 19:35:11 +02:00
|
|
|
ClientToScreen(hDlg, &point);
|
2000-07-23 16:21:38 +02:00
|
|
|
hwnd = GetDlgItem(hDlg, dlgitem);
|
2000-04-24 19:35:11 +02:00
|
|
|
GetWindowRect(hwnd, &rect);
|
|
|
|
if (PtInRect(&rect, point))
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
dx = (rect.right - rect.left) / cols;
|
|
|
|
dy = (rect.bottom - rect.top) / rows;
|
|
|
|
ScreenToClient(hwnd, &point);
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
if (point.x % dx < (dx - DISTANCE) && point.y % dy < (dy - DISTANCE))
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
x = point.x / dx;
|
|
|
|
y = point.y / dy;
|
2000-07-23 16:21:38 +02:00
|
|
|
lpp->lpcc->rgbResult = crarr[x + (cols * y) ];
|
|
|
|
CC_DrawFocusRect(lpp, hwnd, x, y, rows, cols);
|
1999-02-28 21:05:11 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define MAXVERT 240
|
|
|
|
#define MAXHORI 239
|
|
|
|
|
|
|
|
/* 240 ^...... ^^ 240
|
|
|
|
| . ||
|
|
|
|
SAT | . || LUM
|
|
|
|
| . ||
|
|
|
|
+-----> 239 ----
|
|
|
|
HUE
|
|
|
|
*/
|
|
|
|
/***********************************************************************
|
|
|
|
* CC_MouseCheckColorGraph [internal]
|
|
|
|
*/
|
2000-04-24 19:35:11 +02:00
|
|
|
static int CC_MouseCheckColorGraph( HWND hDlg, int dlgitem, int *hori, int *vert, LPARAM lParam )
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
|
|
|
HWND hwnd;
|
2000-04-24 19:35:11 +02:00
|
|
|
POINT point;
|
|
|
|
RECT rect;
|
1999-02-28 21:05:11 +01:00
|
|
|
long x,y;
|
|
|
|
|
2000-09-27 00:20:14 +02:00
|
|
|
CONV_LPARAMTOPOINT(lParam, &point);
|
2000-04-24 19:35:11 +02:00
|
|
|
ClientToScreen(hDlg, &point);
|
|
|
|
hwnd = GetDlgItem( hDlg, dlgitem );
|
|
|
|
GetWindowRect(hwnd, &rect);
|
|
|
|
if (PtInRect(&rect, point))
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
GetClientRect(hwnd, &rect);
|
|
|
|
ScreenToClient(hwnd, &point);
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
x = (long) point.x * MAXHORI;
|
|
|
|
x /= rect.right;
|
|
|
|
y = (long) (rect.bottom - point.y) * MAXVERT;
|
|
|
|
y /= rect.bottom;
|
1999-02-28 21:05:11 +01:00
|
|
|
|
|
|
|
if (hori)
|
2000-04-24 19:35:11 +02:00
|
|
|
*hori = x;
|
1999-02-28 21:05:11 +01:00
|
|
|
if (vert)
|
2000-04-24 19:35:11 +02:00
|
|
|
*vert = y;
|
1999-02-28 21:05:11 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/***********************************************************************
|
|
|
|
* CC_MouseCheckResultWindow [internal]
|
2000-04-24 19:35:11 +02:00
|
|
|
* test if double click one of the result colors
|
1999-02-28 21:05:11 +01:00
|
|
|
*/
|
2003-06-13 20:07:45 +02:00
|
|
|
int CC_MouseCheckResultWindow( HWND hDlg, LPARAM lParam )
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
HWND hwnd;
|
|
|
|
POINT point;
|
|
|
|
RECT rect;
|
|
|
|
|
2000-09-27 00:20:14 +02:00
|
|
|
CONV_LPARAMTOPOINT(lParam, &point);
|
2000-04-24 19:35:11 +02:00
|
|
|
ClientToScreen(hDlg, &point);
|
|
|
|
hwnd = GetDlgItem(hDlg, 0x2c5);
|
|
|
|
GetWindowRect(hwnd, &rect);
|
|
|
|
if (PtInRect(&rect, point))
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
PostMessageA(hDlg, WM_COMMAND, 0x2c9, 0);
|
1999-02-28 21:05:11 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CC_CheckDigitsInEdit [internal]
|
|
|
|
*/
|
2003-12-01 23:45:30 +01:00
|
|
|
int CC_CheckDigitsInEdit( HWND hwnd, int maxval )
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
int i, k, m, result, value;
|
1999-02-28 21:05:11 +01:00
|
|
|
long editpos;
|
|
|
|
char buffer[30];
|
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
GetWindowTextA(hwnd, buffer, sizeof(buffer));
|
|
|
|
m = strlen(buffer);
|
|
|
|
result = 0;
|
|
|
|
|
|
|
|
for (i = 0 ; i < m ; i++)
|
|
|
|
if (buffer[i] < '0' || buffer[i] > '9')
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
for (k = i + 1; k <= m; k++) /* delete bad character */
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
buffer[i] = buffer[k];
|
1999-02-28 21:05:11 +01:00
|
|
|
m--;
|
|
|
|
}
|
2000-04-24 19:35:11 +02:00
|
|
|
buffer[m] = 0;
|
|
|
|
result = 1;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
value = atoi(buffer);
|
|
|
|
if (value > maxval) /* build a new string */
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
sprintf(buffer, "%d", maxval);
|
|
|
|
result = 2;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
if (result)
|
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
editpos = SendMessageA(hwnd, EM_GETSEL, 0, 0);
|
|
|
|
SetWindowTextA(hwnd, buffer );
|
|
|
|
SendMessageA(hwnd, EM_SETSEL, 0, editpos);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CC_PaintSelectedColor [internal]
|
|
|
|
*/
|
2003-12-01 23:45:30 +01:00
|
|
|
void CC_PaintSelectedColor( HWND hDlg, COLORREF cr )
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
RECT rect;
|
1999-02-28 21:05:11 +01:00
|
|
|
HDC hdc;
|
|
|
|
HBRUSH hBrush;
|
2000-04-24 19:35:11 +02:00
|
|
|
HWND hwnd = GetDlgItem(hDlg, 0x2c5);
|
|
|
|
if (IsWindowVisible( GetDlgItem(hDlg, 0x2c6) )) /* if full size */
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
hdc = GetDC(hwnd);
|
|
|
|
GetClientRect(hwnd, &rect) ;
|
1999-02-28 21:05:11 +01:00
|
|
|
hBrush = CreateSolidBrush(cr);
|
|
|
|
if (hBrush)
|
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
hBrush = SelectObject(hdc, hBrush) ;
|
|
|
|
Rectangle(hdc, rect.left, rect.top, rect.right/2, rect.bottom);
|
|
|
|
DeleteObject ( SelectObject(hdc, hBrush) ) ;
|
|
|
|
hBrush = CreateSolidBrush( GetNearestColor(hdc, cr) );
|
1999-02-28 21:05:11 +01:00
|
|
|
if (hBrush)
|
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
hBrush = SelectObject(hdc, hBrush) ;
|
|
|
|
Rectangle(hdc, rect.right/2-1, rect.top, rect.right, rect.bottom);
|
|
|
|
DeleteObject(SelectObject(hdc, hBrush)) ;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
}
|
2000-04-24 19:35:11 +02:00
|
|
|
ReleaseDC(hwnd, hdc);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CC_PaintTriangle [internal]
|
|
|
|
*/
|
2003-12-01 23:45:30 +01:00
|
|
|
void CC_PaintTriangle( HWND hDlg, int y)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
|
|
|
HDC hDC;
|
|
|
|
long temp;
|
2000-07-23 16:21:38 +02:00
|
|
|
int w = LOWORD(GetDialogBaseUnits());
|
2000-04-24 19:35:11 +02:00
|
|
|
POINT points[3];
|
1999-02-28 21:05:11 +01:00
|
|
|
int height;
|
|
|
|
int oben;
|
2000-04-24 19:35:11 +02:00
|
|
|
RECT rect;
|
2007-02-12 09:42:19 +01:00
|
|
|
HBRUSH hbr;
|
2000-04-24 19:35:11 +02:00
|
|
|
HWND hwnd = GetDlgItem(hDlg, 0x2be);
|
2007-04-04 23:22:20 +02:00
|
|
|
LPCCPRIV lpp = (LPCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
if (IsWindowVisible( GetDlgItem(hDlg, 0x2c6))) /* if full size */
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
GetClientRect(hwnd, &rect);
|
|
|
|
height = rect.bottom;
|
|
|
|
hDC = GetDC(hDlg);
|
|
|
|
points[0].y = rect.top;
|
2001-01-26 21:40:50 +01:00
|
|
|
points[0].x = rect.right; /* | /| */
|
|
|
|
ClientToScreen(hwnd, points); /* | / | */
|
|
|
|
ScreenToClient(hDlg, points); /* |< | */
|
|
|
|
oben = points[0].y; /* | \ | */
|
|
|
|
/* | \| */
|
2000-04-24 19:35:11 +02:00
|
|
|
temp = (long)height * (long)y;
|
|
|
|
points[0].y = oben + height - temp / (long)MAXVERT;
|
|
|
|
points[1].y = points[0].y + w;
|
|
|
|
points[2].y = points[0].y - w;
|
|
|
|
points[2].x = points[1].x = points[0].x + w;
|
|
|
|
|
2007-02-12 09:42:19 +01:00
|
|
|
hbr = (HBRUSH)GetClassLongPtrW( hwnd, GCLP_HBRBACKGROUND);
|
|
|
|
if (!hbr) hbr = GetSysColorBrush(COLOR_BTNFACE);
|
|
|
|
FillRect(hDC, &lpp->old3angle, hbr);
|
2000-04-24 19:35:11 +02:00
|
|
|
lpp->old3angle.left = points[0].x;
|
|
|
|
lpp->old3angle.right = points[1].x + 1;
|
|
|
|
lpp->old3angle.top = points[2].y - 1;
|
|
|
|
lpp->old3angle.bottom= points[1].y + 1;
|
|
|
|
Polygon(hDC, points, 3);
|
|
|
|
ReleaseDC(hDlg, hDC);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CC_PaintCross [internal]
|
|
|
|
*/
|
2003-12-01 23:45:30 +01:00
|
|
|
void CC_PaintCross( HWND hDlg, int x, int y)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
|
|
|
HDC hDC;
|
2000-04-24 19:35:11 +02:00
|
|
|
int w = GetDialogBaseUnits();
|
|
|
|
HWND hwnd = GetDlgItem(hDlg, 0x2c6);
|
2007-04-04 23:22:20 +02:00
|
|
|
LPCCPRIV lpp = (LPCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
2000-04-24 19:35:11 +02:00
|
|
|
RECT rect;
|
|
|
|
POINT point, p;
|
1999-02-28 21:05:11 +01:00
|
|
|
HPEN hPen;
|
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
if (IsWindowVisible( GetDlgItem(hDlg, 0x2c6) )) /* if full size */
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
GetClientRect(hwnd, &rect);
|
|
|
|
hDC = GetDC(hwnd);
|
|
|
|
SelectClipRgn( hDC, CreateRectRgnIndirect(&rect));
|
2000-07-23 16:21:38 +02:00
|
|
|
hPen = CreatePen(PS_SOLID, 2, 0xffffff); /* -white- color */
|
2000-04-24 19:35:11 +02:00
|
|
|
hPen = SelectObject(hDC, hPen);
|
|
|
|
point.x = ((long)rect.right * (long)x) / (long)MAXHORI;
|
|
|
|
point.y = rect.bottom - ((long)rect.bottom * (long)y) / (long)MAXVERT;
|
|
|
|
if ( lpp->oldcross.left != lpp->oldcross.right )
|
|
|
|
BitBlt(hDC, lpp->oldcross.left, lpp->oldcross.top,
|
|
|
|
lpp->oldcross.right - lpp->oldcross.left,
|
|
|
|
lpp->oldcross.bottom - lpp->oldcross.top,
|
|
|
|
lpp->hdcMem, lpp->oldcross.left, lpp->oldcross.top, SRCCOPY);
|
|
|
|
lpp->oldcross.left = point.x - w - 1;
|
|
|
|
lpp->oldcross.right = point.x + w + 1;
|
|
|
|
lpp->oldcross.top = point.y - w - 1;
|
2002-06-01 01:06:46 +02:00
|
|
|
lpp->oldcross.bottom = point.y + w + 1;
|
2000-04-24 19:35:11 +02:00
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
MoveToEx(hDC, point.x - w, point.y, &p);
|
2000-04-24 19:35:11 +02:00
|
|
|
LineTo(hDC, point.x + w, point.y);
|
2002-06-01 01:06:46 +02:00
|
|
|
MoveToEx(hDC, point.x, point.y - w, &p);
|
2000-04-24 19:35:11 +02:00
|
|
|
LineTo(hDC, point.x, point.y + w);
|
|
|
|
DeleteObject( SelectObject(hDC, hPen)) ;
|
|
|
|
ReleaseDC(hwnd, hDC);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define XSTEPS 48
|
|
|
|
#define YSTEPS 24
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CC_PrepareColorGraph [internal]
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
static void CC_PrepareColorGraph( HWND hDlg )
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
int sdif, hdif, xdif, ydif, r, g, b, hue, sat;
|
|
|
|
HWND hwnd = GetDlgItem(hDlg, 0x2c6);
|
2007-04-04 23:22:20 +02:00
|
|
|
LPCCPRIV lpp = (LPCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
1999-02-28 21:05:11 +01:00
|
|
|
HBRUSH hbrush;
|
|
|
|
HDC hdc ;
|
2000-04-24 19:35:11 +02:00
|
|
|
RECT rect, client;
|
2005-02-15 22:51:06 +01:00
|
|
|
HCURSOR hcursor = SetCursor( LoadCursorW(0, (LPCWSTR)IDC_WAIT) );
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
GetClientRect(hwnd, &client);
|
|
|
|
hdc = GetDC(hwnd);
|
1999-02-28 21:05:11 +01:00
|
|
|
lpp->hdcMem = CreateCompatibleDC(hdc);
|
2000-04-24 19:35:11 +02:00
|
|
|
lpp->hbmMem = CreateCompatibleBitmap(hdc, client.right, client.bottom);
|
|
|
|
SelectObject(lpp->hdcMem, lpp->hbmMem);
|
|
|
|
|
|
|
|
xdif = client.right / XSTEPS;
|
|
|
|
ydif = client.bottom / YSTEPS+1;
|
|
|
|
hdif = 239 / XSTEPS;
|
|
|
|
sdif = 240 / YSTEPS;
|
|
|
|
for (rect.left = hue = 0; hue < 239 + hdif; hue += hdif)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
rect.right = rect.left + xdif;
|
|
|
|
rect.bottom = client.bottom;
|
|
|
|
for(sat = 0; sat < 240 + sdif; sat += sdif)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
rect.top = rect.bottom - ydif;
|
|
|
|
r = CC_HSLtoRGB('R', hue, sat, 120);
|
|
|
|
g = CC_HSLtoRGB('G', hue, sat, 120);
|
|
|
|
b = CC_HSLtoRGB('B', hue, sat, 120);
|
|
|
|
hbrush = CreateSolidBrush( RGB(r, g, b));
|
|
|
|
FillRect(lpp->hdcMem, &rect, hbrush);
|
1999-02-28 21:05:11 +01:00
|
|
|
DeleteObject(hbrush);
|
2000-04-24 19:35:11 +02:00
|
|
|
rect.bottom = rect.top;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
2000-04-24 19:35:11 +02:00
|
|
|
rect.left = rect.right;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
2000-04-24 19:35:11 +02:00
|
|
|
ReleaseDC(hwnd, hdc);
|
|
|
|
SetCursor(hcursor);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CC_PaintColorGraph [internal]
|
|
|
|
*/
|
2000-04-24 19:35:11 +02:00
|
|
|
static void CC_PaintColorGraph( HWND hDlg )
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
HWND hwnd = GetDlgItem( hDlg, 0x2c6 );
|
2007-04-04 23:22:20 +02:00
|
|
|
LPCCPRIV lpp = (LPCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
1999-02-28 21:05:11 +01:00
|
|
|
HDC hDC;
|
2000-04-24 19:35:11 +02:00
|
|
|
RECT rect;
|
1999-02-28 21:05:11 +01:00
|
|
|
if (IsWindowVisible(hwnd)) /* if full size */
|
|
|
|
{
|
|
|
|
if (!lpp->hdcMem)
|
|
|
|
CC_PrepareColorGraph(hDlg); /* should not be necessary */
|
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
hDC = GetDC(hwnd);
|
|
|
|
GetClientRect(hwnd, &rect);
|
1999-02-28 21:05:11 +01:00
|
|
|
if (lpp->hdcMem)
|
2000-04-24 19:35:11 +02:00
|
|
|
BitBlt(hDC, 0, 0, rect.right, rect.bottom, lpp->hdcMem, 0, 0, SRCCOPY);
|
1999-02-28 21:05:11 +01:00
|
|
|
else
|
2000-04-24 19:35:11 +02:00
|
|
|
WARN("choose color: hdcMem is not defined\n");
|
|
|
|
ReleaseDC(hwnd, hDC);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
}
|
2000-04-24 19:35:11 +02:00
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* CC_PaintLumBar [internal]
|
|
|
|
*/
|
2000-04-24 19:35:11 +02:00
|
|
|
static void CC_PaintLumBar( HWND hDlg, int hue, int sat )
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
HWND hwnd = GetDlgItem(hDlg, 0x2be);
|
|
|
|
RECT rect, client;
|
|
|
|
int lum, ldif, ydif, r, g, b;
|
1999-02-28 21:05:11 +01:00
|
|
|
HBRUSH hbrush;
|
|
|
|
HDC hDC;
|
|
|
|
|
|
|
|
if (IsWindowVisible(hwnd))
|
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
hDC = GetDC(hwnd);
|
|
|
|
GetClientRect(hwnd, &client);
|
|
|
|
rect = client;
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
ldif = 240 / YSTEPS;
|
|
|
|
ydif = client.bottom / YSTEPS+1;
|
|
|
|
for (lum = 0; lum < 240 + ldif; lum += ldif)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
rect.top = max(0, rect.bottom - ydif);
|
|
|
|
r = CC_HSLtoRGB('R', hue, sat, lum);
|
|
|
|
g = CC_HSLtoRGB('G', hue, sat, lum);
|
|
|
|
b = CC_HSLtoRGB('B', hue, sat, lum);
|
|
|
|
hbrush = CreateSolidBrush( RGB(r, g, b) );
|
|
|
|
FillRect(hDC, &rect, hbrush);
|
1999-02-28 21:05:11 +01:00
|
|
|
DeleteObject(hbrush);
|
2000-04-24 19:35:11 +02:00
|
|
|
rect.bottom = rect.top;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
2000-04-24 19:35:11 +02:00
|
|
|
GetClientRect(hwnd, &rect);
|
|
|
|
FrameRect(hDC, &rect, GetStockObject(BLACK_BRUSH) );
|
|
|
|
ReleaseDC(hwnd, hDC);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CC_EditSetRGB [internal]
|
|
|
|
*/
|
2003-12-01 23:45:30 +01:00
|
|
|
void CC_EditSetRGB( HWND hDlg, COLORREF cr )
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
|
|
|
char buffer[10];
|
2007-04-04 23:22:20 +02:00
|
|
|
LPCCPRIV lpp = (LPCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
2000-04-24 19:35:11 +02:00
|
|
|
int r = GetRValue(cr);
|
|
|
|
int g = GetGValue(cr);
|
|
|
|
int b = GetBValue(cr);
|
|
|
|
if (IsWindowVisible( GetDlgItem(hDlg, 0x2c6) )) /* if full size */
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
lpp->updating = TRUE;
|
|
|
|
sprintf(buffer, "%d", r);
|
|
|
|
SetWindowTextA( GetDlgItem(hDlg, 0x2c2), buffer);
|
|
|
|
sprintf(buffer, "%d", g);
|
|
|
|
SetWindowTextA( GetDlgItem(hDlg, 0x2c3), buffer);
|
|
|
|
sprintf( buffer, "%d", b );
|
|
|
|
SetWindowTextA( GetDlgItem(hDlg, 0x2c4),buffer);
|
|
|
|
lpp->updating = FALSE;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CC_EditSetHSL [internal]
|
|
|
|
*/
|
2003-12-01 23:45:30 +01:00
|
|
|
void CC_EditSetHSL( HWND hDlg, int h, int s, int l )
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
|
|
|
char buffer[10];
|
2007-04-04 23:22:20 +02:00
|
|
|
LPCCPRIV lpp = (LPCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
2005-12-31 13:23:30 +01:00
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
if (IsWindowVisible( GetDlgItem(hDlg, 0x2c6) )) /* if full size */
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
lpp->updating = TRUE;
|
|
|
|
sprintf(buffer, "%d", h);
|
|
|
|
SetWindowTextA( GetDlgItem(hDlg, 0x2bf), buffer);
|
|
|
|
sprintf(buffer, "%d", s);
|
|
|
|
SetWindowTextA( GetDlgItem(hDlg, 0x2c0), buffer);
|
|
|
|
sprintf(buffer, "%d", l);
|
|
|
|
SetWindowTextA( GetDlgItem(hDlg, 0x2c1), buffer);
|
|
|
|
lpp->updating = FALSE;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
2000-04-24 19:35:11 +02:00
|
|
|
CC_PaintLumBar(hDlg, h, s);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CC_SwitchToFullSize [internal]
|
|
|
|
*/
|
2007-04-04 23:22:20 +02:00
|
|
|
void CC_SwitchToFullSize( HWND hDlg, COLORREF result, LPCRECT lprect )
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
|
|
|
int i;
|
2007-04-04 23:22:20 +02:00
|
|
|
LPCCPRIV lpp = (LPCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
EnableWindow( GetDlgItem(hDlg, 0x2cf), FALSE);
|
1999-02-28 21:05:11 +01:00
|
|
|
CC_PrepareColorGraph(hDlg);
|
2000-04-24 19:35:11 +02:00
|
|
|
for (i = 0x2bf; i < 0x2c5; i++)
|
|
|
|
ShowWindow( GetDlgItem(hDlg, i), SW_SHOW);
|
|
|
|
for (i = 0x2d3; i < 0x2d9; i++)
|
|
|
|
ShowWindow( GetDlgItem(hDlg, i), SW_SHOW);
|
|
|
|
ShowWindow( GetDlgItem(hDlg, 0x2c9), SW_SHOW);
|
|
|
|
ShowWindow( GetDlgItem(hDlg, 0x2c8), SW_SHOW);
|
|
|
|
ShowWindow( GetDlgItem(hDlg, 1090), SW_SHOW);
|
1999-02-28 21:05:11 +01:00
|
|
|
|
|
|
|
if (lprect)
|
2000-04-24 19:35:11 +02:00
|
|
|
SetWindowPos(hDlg, 0, 0, 0, lprect->right-lprect->left,
|
1999-02-28 21:05:11 +01:00
|
|
|
lprect->bottom-lprect->top, SWP_NOMOVE|SWP_NOZORDER);
|
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
ShowWindow( GetDlgItem(hDlg, 0x2be), SW_SHOW);
|
|
|
|
ShowWindow( GetDlgItem(hDlg, 0x2c5), SW_SHOW);
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
CC_EditSetRGB(hDlg, result);
|
|
|
|
CC_EditSetHSL(hDlg, lpp->h, lpp->s, lpp->l);
|
|
|
|
ShowWindow( GetDlgItem( hDlg, 0x2c6), SW_SHOW);
|
|
|
|
UpdateWindow( GetDlgItem(hDlg, 0x2c6) );
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CC_PaintPredefColorArray [internal]
|
2000-04-24 19:35:11 +02:00
|
|
|
* Paints the default standard 48 colors
|
1999-02-28 21:05:11 +01:00
|
|
|
*/
|
2000-04-24 19:35:11 +02:00
|
|
|
static void CC_PaintPredefColorArray( HWND hDlg, int rows, int cols)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
HWND hwnd = GetDlgItem(hDlg, 0x2d0);
|
|
|
|
RECT rect;
|
1999-02-28 21:05:11 +01:00
|
|
|
HDC hdc;
|
|
|
|
HBRUSH hBrush;
|
2000-04-24 19:35:11 +02:00
|
|
|
int dx, dy, i, j, k;
|
2007-04-04 23:22:20 +02:00
|
|
|
LPCCPRIV lpp = (LPCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
GetClientRect(hwnd, &rect);
|
|
|
|
dx = rect.right / cols;
|
|
|
|
dy = rect.bottom / rows;
|
|
|
|
k = rect.left;
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
hdc = GetDC(hwnd);
|
|
|
|
GetClientRect(hwnd, &rect);
|
2007-02-12 09:42:19 +01:00
|
|
|
hBrush = (HBRUSH)GetClassLongPtrW( hwnd, GCLP_HBRBACKGROUND);
|
|
|
|
if (!hBrush) hBrush = GetSysColorBrush(COLOR_BTNFACE);
|
|
|
|
FillRect(hdc, &rect, hBrush);
|
2000-04-24 19:35:11 +02:00
|
|
|
for ( j = 0; j < rows; j++ )
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
for ( i = 0; i < cols; i++ )
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
|
|
|
hBrush = CreateSolidBrush(predefcolors[j][i]);
|
|
|
|
if (hBrush)
|
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
hBrush = SelectObject(hdc, hBrush);
|
1999-02-28 21:05:11 +01:00
|
|
|
Rectangle(hdc, rect.left, rect.top,
|
2000-04-24 19:35:11 +02:00
|
|
|
rect.left + dx - DISTANCE, rect.top + dy - DISTANCE);
|
|
|
|
rect.left = rect.left + dx;
|
|
|
|
DeleteObject(SelectObject(hdc, hBrush)) ;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
}
|
2000-04-24 19:35:11 +02:00
|
|
|
rect.top = rect.top + dy;
|
|
|
|
rect.left = k;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
2000-04-24 19:35:11 +02:00
|
|
|
ReleaseDC(hwnd, hdc);
|
2000-07-23 16:21:38 +02:00
|
|
|
if (lpp->hwndFocus == hwnd)
|
|
|
|
CC_DrawCurrentFocusRect(lpp);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
/***********************************************************************
|
|
|
|
* CC_PaintUserColorArray [internal]
|
2002-06-01 01:06:46 +02:00
|
|
|
* Paint the 16 user-selected colors
|
1999-02-28 21:05:11 +01:00
|
|
|
*/
|
2007-04-04 23:22:20 +02:00
|
|
|
void CC_PaintUserColorArray( HWND hDlg, int rows, int cols, const COLORREF *lpcr )
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
HWND hwnd = GetDlgItem(hDlg, 0x2d1);
|
|
|
|
RECT rect;
|
1999-02-28 21:05:11 +01:00
|
|
|
HDC hdc;
|
|
|
|
HBRUSH hBrush;
|
2000-04-24 19:35:11 +02:00
|
|
|
int dx, dy, i, j, k;
|
2007-04-04 23:22:20 +02:00
|
|
|
LPCCPRIV lpp = (LPCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
GetClientRect(hwnd, &rect);
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
dx = rect.right / cols;
|
|
|
|
dy = rect.bottom / rows;
|
|
|
|
k = rect.left;
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
hdc = GetDC(hwnd);
|
2002-06-01 01:06:46 +02:00
|
|
|
if (hdc)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2007-02-12 09:42:19 +01:00
|
|
|
hBrush = (HBRUSH)GetClassLongPtrW( hwnd, GCLP_HBRBACKGROUND);
|
|
|
|
if (!hBrush) hBrush = GetSysColorBrush(COLOR_BTNFACE);
|
|
|
|
FillRect( hdc, &rect, hBrush );
|
2000-04-24 19:35:11 +02:00
|
|
|
for (j = 0; j < rows; j++)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
for (i = 0; i < cols; i++)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
|
|
|
hBrush = CreateSolidBrush(lpcr[i+j*cols]);
|
|
|
|
if (hBrush)
|
2002-06-01 01:06:46 +02:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
hBrush = SelectObject(hdc, hBrush) ;
|
|
|
|
Rectangle(hdc, rect.left, rect.top,
|
|
|
|
rect.left + dx - DISTANCE, rect.top + dy - DISTANCE);
|
|
|
|
rect.left = rect.left + dx;
|
|
|
|
DeleteObject( SelectObject(hdc, hBrush) ) ;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
}
|
2000-04-24 19:35:11 +02:00
|
|
|
rect.top = rect.top + dy;
|
|
|
|
rect.left = k;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
2000-04-24 19:35:11 +02:00
|
|
|
ReleaseDC(hwnd, hdc);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
2000-07-23 16:21:38 +02:00
|
|
|
if (lpp->hwndFocus == hwnd)
|
|
|
|
CC_DrawCurrentFocusRect(lpp);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CC_HookCallChk [internal]
|
|
|
|
*/
|
2007-04-04 23:22:20 +02:00
|
|
|
BOOL CC_HookCallChk( const CHOOSECOLORW *lpcc )
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
|
|
|
if (lpcc)
|
|
|
|
if(lpcc->Flags & CC_ENABLEHOOK)
|
|
|
|
if (lpcc->lpfnHook)
|
|
|
|
return TRUE;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2000-04-24 19:35:11 +02:00
|
|
|
* CC_WMInitDialog [internal]
|
1999-02-28 21:05:11 +01:00
|
|
|
*/
|
2005-06-28 21:19:07 +02:00
|
|
|
static LONG CC_WMInitDialog( HWND hDlg, WPARAM wParam, LPARAM lParam )
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
int i, res;
|
1999-02-28 21:05:11 +01:00
|
|
|
int r, g, b;
|
2000-04-24 19:35:11 +02:00
|
|
|
HWND hwnd;
|
|
|
|
RECT rect;
|
|
|
|
POINT point;
|
2007-04-04 23:22:20 +02:00
|
|
|
LPCCPRIV lpp;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-06-12 17:45:58 +02:00
|
|
|
TRACE("WM_INITDIALOG lParam=%08lX\n", lParam);
|
2000-04-24 19:35:11 +02:00
|
|
|
lpp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct CCPRIVATE) );
|
2003-12-01 23:45:30 +01:00
|
|
|
|
|
|
|
lpp->lpcc = (LPCHOOSECOLORW) lParam;
|
|
|
|
if (lpp->lpcc->lStructSize != sizeof(CHOOSECOLORW) )
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2003-12-01 23:45:30 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, lpp);
|
|
|
|
EndDialog (hDlg, 0) ;
|
|
|
|
return FALSE;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
2003-12-01 23:45:30 +01:00
|
|
|
|
2006-03-09 16:45:16 +01:00
|
|
|
SetPropW( hDlg, szColourDialogProp, lpp );
|
1999-02-28 21:05:11 +01:00
|
|
|
|
|
|
|
if (!(lpp->lpcc->Flags & CC_SHOWHELP))
|
2000-04-24 19:35:11 +02:00
|
|
|
ShowWindow( GetDlgItem(hDlg,0x40e), SW_HIDE);
|
2001-01-22 03:13:58 +01:00
|
|
|
lpp->msetrgb = RegisterWindowMessageA(SETRGBSTRINGA);
|
1999-02-28 21:05:11 +01:00
|
|
|
|
|
|
|
#if 0
|
2000-04-24 19:35:11 +02:00
|
|
|
cpos = MAKELONG(5,7); /* init */
|
1999-02-28 21:05:11 +01:00
|
|
|
if (lpp->lpcc->Flags & CC_RGBINIT)
|
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
for (i = 0; i < 6; i++)
|
2000-04-24 19:35:11 +02:00
|
|
|
for (j = 0; j < 8; j++)
|
|
|
|
if (predefcolors[i][j] == lpp->lpcc->rgbResult)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
cpos = MAKELONG(i,j);
|
1999-02-28 21:05:11 +01:00
|
|
|
goto found;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
found:
|
|
|
|
/* FIXME: Draw_a_focus_rect & set_init_values */
|
|
|
|
#endif
|
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
GetWindowRect(hDlg, &lpp->fullsize);
|
1999-02-28 21:05:11 +01:00
|
|
|
if (lpp->lpcc->Flags & CC_FULLOPEN || lpp->lpcc->Flags & CC_PREVENTFULLOPEN)
|
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
hwnd = GetDlgItem(hDlg, 0x2cf);
|
|
|
|
EnableWindow(hwnd, FALSE);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
2000-04-24 19:35:11 +02:00
|
|
|
if (!(lpp->lpcc->Flags & CC_FULLOPEN ) || lpp->lpcc->Flags & CC_PREVENTFULLOPEN)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
rect = lpp->fullsize;
|
|
|
|
res = rect.bottom - rect.top;
|
|
|
|
hwnd = GetDlgItem(hDlg, 0x2c6); /* cut at left border */
|
|
|
|
point.x = point.y = 0;
|
|
|
|
ClientToScreen(hwnd, &point);
|
|
|
|
ScreenToClient(hDlg,&point);
|
|
|
|
GetClientRect(hDlg, &rect);
|
|
|
|
point.x += GetSystemMetrics(SM_CXDLGFRAME);
|
|
|
|
SetWindowPos(hDlg, 0, 0, 0, point.x, res, SWP_NOMOVE|SWP_NOZORDER);
|
|
|
|
|
|
|
|
for (i = 0x2bf; i < 0x2c5; i++)
|
|
|
|
ShowWindow( GetDlgItem(hDlg, i), SW_HIDE);
|
|
|
|
for (i = 0x2d3; i < 0x2d9; i++)
|
|
|
|
ShowWindow( GetDlgItem(hDlg, i), SW_HIDE);
|
|
|
|
ShowWindow( GetDlgItem(hDlg, 0x2c9), SW_HIDE);
|
|
|
|
ShowWindow( GetDlgItem(hDlg, 0x2c8), SW_HIDE);
|
|
|
|
ShowWindow( GetDlgItem(hDlg, 0x2c6), SW_HIDE);
|
|
|
|
ShowWindow( GetDlgItem(hDlg, 0x2c5), SW_HIDE);
|
|
|
|
ShowWindow( GetDlgItem(hDlg, 1090 ), SW_HIDE);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
else
|
2000-04-24 19:35:11 +02:00
|
|
|
CC_SwitchToFullSize(hDlg, lpp->lpcc->rgbResult, NULL);
|
2000-07-23 16:21:38 +02:00
|
|
|
res = TRUE;
|
2000-04-24 19:35:11 +02:00
|
|
|
for (i = 0x2bf; i < 0x2c5; i++)
|
|
|
|
SendMessageA( GetDlgItem(hDlg, i), EM_LIMITTEXT, 3, 0); /* max 3 digits: xyz */
|
1999-02-28 21:05:11 +01:00
|
|
|
if (CC_HookCallChk(lpp->lpcc))
|
2000-04-24 19:35:11 +02:00
|
|
|
{
|
|
|
|
res = CallWindowProcA( (WNDPROC)lpp->lpcc->lpfnHook, hDlg, WM_INITDIALOG, wParam, lParam);
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
/* Set the initial values of the color chooser dialog */
|
|
|
|
r = GetRValue(lpp->lpcc->rgbResult);
|
|
|
|
g = GetGValue(lpp->lpcc->rgbResult);
|
|
|
|
b = GetBValue(lpp->lpcc->rgbResult);
|
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
CC_PaintSelectedColor(hDlg, lpp->lpcc->rgbResult);
|
|
|
|
lpp->h = CC_RGBtoHSL('H', r, g, b);
|
|
|
|
lpp->s = CC_RGBtoHSL('S', r, g, b);
|
|
|
|
lpp->l = CC_RGBtoHSL('L', r, g, b);
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2003-04-02 03:23:43 +02:00
|
|
|
/* Doing it the long way because CC_EditSetRGB/HSL doesn't seem to work */
|
1999-02-28 21:05:11 +01:00
|
|
|
SetDlgItemInt(hDlg, 703, lpp->h, TRUE);
|
|
|
|
SetDlgItemInt(hDlg, 704, lpp->s, TRUE);
|
|
|
|
SetDlgItemInt(hDlg, 705, lpp->l, TRUE);
|
|
|
|
SetDlgItemInt(hDlg, 706, r, TRUE);
|
|
|
|
SetDlgItemInt(hDlg, 707, g, TRUE);
|
|
|
|
SetDlgItemInt(hDlg, 708, b, TRUE);
|
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
CC_PaintCross(hDlg, lpp->h, lpp->s);
|
|
|
|
CC_PaintTriangle(hDlg, lpp->l);
|
1999-02-28 21:05:11 +01:00
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* CC_WMCommand [internal]
|
|
|
|
*/
|
2003-06-13 20:07:45 +02:00
|
|
|
LRESULT CC_WMCommand( HWND hDlg, WPARAM wParam, LPARAM lParam, WORD notifyCode, HWND hwndCtl )
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
int r, g, b, i, xx;
|
|
|
|
UINT cokmsg;
|
1999-02-28 21:05:11 +01:00
|
|
|
HDC hdc;
|
|
|
|
COLORREF *cr;
|
2007-04-04 23:22:20 +02:00
|
|
|
LPCCPRIV lpp = (LPCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
2007-05-24 16:41:17 +02:00
|
|
|
TRACE("CC_WMCommand wParam=%lx lParam=%lx\n", wParam, lParam);
|
2005-12-31 13:23:30 +01:00
|
|
|
switch (LOWORD(wParam))
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
|
|
|
case 0x2c2: /* edit notify RGB */
|
|
|
|
case 0x2c3:
|
|
|
|
case 0x2c4:
|
2000-04-24 19:35:11 +02:00
|
|
|
if (notifyCode == EN_UPDATE && !lpp->updating)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
i = CC_CheckDigitsInEdit(hwndCtl, 255);
|
|
|
|
r = GetRValue(lpp->lpcc->rgbResult);
|
|
|
|
g = GetGValue(lpp->lpcc->rgbResult);
|
|
|
|
b= GetBValue(lpp->lpcc->rgbResult);
|
|
|
|
xx = 0;
|
2005-12-31 13:23:30 +01:00
|
|
|
switch (LOWORD(wParam))
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
case 0x2c2: if ((xx = (i != r))) r = i; break;
|
|
|
|
case 0x2c3: if ((xx = (i != g))) g = i; break;
|
|
|
|
case 0x2c4: if ((xx = (i != b))) b = i; break;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
if (xx) /* something has changed */
|
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
lpp->lpcc->rgbResult = RGB(r, g, b);
|
|
|
|
CC_PaintSelectedColor(hDlg, lpp->lpcc->rgbResult);
|
|
|
|
lpp->h = CC_RGBtoHSL('H', r, g, b);
|
|
|
|
lpp->s = CC_RGBtoHSL('S', r, g, b);
|
|
|
|
lpp->l = CC_RGBtoHSL('L', r, g, b);
|
|
|
|
CC_EditSetHSL(hDlg, lpp->h, lpp->s, lpp->l);
|
|
|
|
CC_PaintCross(hDlg, lpp->h, lpp->s);
|
|
|
|
CC_PaintTriangle(hDlg, lpp->l);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
case 0x2bf: /* edit notify HSL */
|
|
|
|
case 0x2c0:
|
|
|
|
case 0x2c1:
|
2000-04-24 19:35:11 +02:00
|
|
|
if (notifyCode == EN_UPDATE && !lpp->updating)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2005-12-31 13:23:30 +01:00
|
|
|
i = CC_CheckDigitsInEdit(hwndCtl , LOWORD(wParam) == 0x2bf ? 239:240);
|
2000-04-24 19:35:11 +02:00
|
|
|
xx = 0;
|
2005-12-31 13:23:30 +01:00
|
|
|
switch (LOWORD(wParam))
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
case 0x2bf: if ((xx = ( i != lpp->h))) lpp->h = i; break;
|
|
|
|
case 0x2c0: if ((xx = ( i != lpp->s))) lpp->s = i; break;
|
|
|
|
case 0x2c1: if ((xx = ( i != lpp->l))) lpp->l = i; break;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
if (xx) /* something has changed */
|
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
r = CC_HSLtoRGB('R', lpp->h, lpp->s, lpp->l);
|
|
|
|
g = CC_HSLtoRGB('G', lpp->h, lpp->s, lpp->l);
|
|
|
|
b = CC_HSLtoRGB('B', lpp->h, lpp->s, lpp->l);
|
|
|
|
lpp->lpcc->rgbResult = RGB(r, g, b);
|
|
|
|
CC_PaintSelectedColor(hDlg, lpp->lpcc->rgbResult);
|
|
|
|
CC_EditSetRGB(hDlg, lpp->lpcc->rgbResult);
|
|
|
|
CC_PaintCross(hDlg, lpp->h, lpp->s);
|
|
|
|
CC_PaintTriangle(hDlg, lpp->l);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
case 0x2cf:
|
2000-04-24 19:35:11 +02:00
|
|
|
CC_SwitchToFullSize(hDlg, lpp->lpcc->rgbResult, &lpp->fullsize);
|
|
|
|
SetFocus( GetDlgItem(hDlg, 0x2bf));
|
1999-02-28 21:05:11 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x2c8: /* add colors ... column by column */
|
2000-04-24 19:35:11 +02:00
|
|
|
cr = lpp->lpcc->lpCustColors;
|
|
|
|
cr[(lpp->nextuserdef % 2) * 8 + lpp->nextuserdef / 2] = lpp->lpcc->rgbResult;
|
|
|
|
if (++lpp->nextuserdef == 16)
|
|
|
|
lpp->nextuserdef = 0;
|
|
|
|
CC_PaintUserColorArray(hDlg, 2, 8, lpp->lpcc->lpCustColors);
|
1999-02-28 21:05:11 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x2c9: /* resulting color */
|
2000-04-24 19:35:11 +02:00
|
|
|
hdc = GetDC(hDlg);
|
|
|
|
lpp->lpcc->rgbResult = GetNearestColor(hdc, lpp->lpcc->rgbResult);
|
|
|
|
ReleaseDC(hDlg, hdc);
|
|
|
|
CC_EditSetRGB(hDlg, lpp->lpcc->rgbResult);
|
|
|
|
CC_PaintSelectedColor(hDlg, lpp->lpcc->rgbResult);
|
|
|
|
r = GetRValue(lpp->lpcc->rgbResult);
|
|
|
|
g = GetGValue(lpp->lpcc->rgbResult);
|
|
|
|
b = GetBValue(lpp->lpcc->rgbResult);
|
|
|
|
lpp->h = CC_RGBtoHSL('H', r, g, b);
|
|
|
|
lpp->s = CC_RGBtoHSL('S', r, g, b);
|
|
|
|
lpp->l = CC_RGBtoHSL('L', r, g, b);
|
|
|
|
CC_EditSetHSL(hDlg, lpp->h, lpp->s, lpp->l);
|
|
|
|
CC_PaintCross(hDlg, lpp->h, lpp->s);
|
|
|
|
CC_PaintTriangle(hDlg, lpp->l);
|
1999-02-28 21:05:11 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x40e: /* Help! */ /* The Beatles, 1965 ;-) */
|
2001-01-22 03:13:58 +01:00
|
|
|
i = RegisterWindowMessageA(HELPMSGSTRINGA);
|
2000-04-24 19:35:11 +02:00
|
|
|
if (lpp->lpcc->hwndOwner)
|
|
|
|
SendMessageA(lpp->lpcc->hwndOwner, i, 0, (LPARAM)lpp->lpcc);
|
|
|
|
if ( CC_HookCallChk(lpp->lpcc))
|
|
|
|
CallWindowProcA( (WNDPROC) lpp->lpcc->lpfnHook, hDlg,
|
|
|
|
WM_COMMAND, psh15, (LPARAM)lpp->lpcc);
|
1999-02-28 21:05:11 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case IDOK :
|
2001-01-22 03:13:58 +01:00
|
|
|
cokmsg = RegisterWindowMessageA(COLOROKSTRINGA);
|
2000-04-24 19:35:11 +02:00
|
|
|
if (lpp->lpcc->hwndOwner)
|
|
|
|
if (SendMessageA(lpp->lpcc->hwndOwner, cokmsg, 0, (LPARAM)lpp->lpcc))
|
2003-12-01 23:45:30 +01:00
|
|
|
break; /* do NOT close */
|
2000-04-24 19:35:11 +02:00
|
|
|
EndDialog(hDlg, 1) ;
|
1999-02-28 21:05:11 +01:00
|
|
|
return TRUE ;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
case IDCANCEL :
|
2000-04-24 19:35:11 +02:00
|
|
|
EndDialog(hDlg, 0) ;
|
1999-02-28 21:05:11 +01:00
|
|
|
return TRUE ;
|
|
|
|
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CC_WMPaint [internal]
|
|
|
|
*/
|
2003-06-13 20:07:45 +02:00
|
|
|
LRESULT CC_WMPaint( HWND hDlg, WPARAM wParam, LPARAM lParam )
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
|
|
|
PAINTSTRUCT ps;
|
2007-04-04 23:22:20 +02:00
|
|
|
LPCCPRIV lpp = (LPCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2005-01-09 17:42:53 +01:00
|
|
|
BeginPaint(hDlg, &ps);
|
1999-02-28 21:05:11 +01:00
|
|
|
/* we have to paint dialog children except text and buttons */
|
2000-04-24 19:35:11 +02:00
|
|
|
CC_PaintPredefColorArray(hDlg, 6, 8);
|
|
|
|
CC_PaintUserColorArray(hDlg, 2, 8, lpp->lpcc->lpCustColors);
|
|
|
|
CC_PaintLumBar(hDlg, lpp->h, lpp->s);
|
|
|
|
CC_PaintCross(hDlg, lpp->h, lpp->s);
|
|
|
|
CC_PaintTriangle(hDlg, lpp->l);
|
|
|
|
CC_PaintSelectedColor(hDlg, lpp->lpcc->rgbResult);
|
1999-02-28 21:05:11 +01:00
|
|
|
CC_PaintColorGraph(hDlg);
|
2000-07-23 16:21:38 +02:00
|
|
|
EndPaint(hDlg, &ps);
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2005-01-09 17:42:53 +01:00
|
|
|
return TRUE;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* CC_WMLButtonUp [internal]
|
|
|
|
*/
|
2003-06-13 20:07:45 +02:00
|
|
|
LRESULT CC_WMLButtonUp( HWND hDlg, WPARAM wParam, LPARAM lParam )
|
2000-04-24 19:35:11 +02:00
|
|
|
{
|
2007-04-04 23:22:20 +02:00
|
|
|
LPCCPRIV lpp = (LPCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
2000-04-24 19:35:11 +02:00
|
|
|
if (lpp->capturedGraph)
|
|
|
|
{
|
|
|
|
lpp->capturedGraph = 0;
|
|
|
|
ReleaseCapture();
|
|
|
|
CC_PaintCross(hDlg, lpp->h, lpp->s);
|
|
|
|
return 1;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2000-04-24 19:35:11 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CC_WMMouseMove [internal]
|
|
|
|
*/
|
2003-06-13 20:07:45 +02:00
|
|
|
LRESULT CC_WMMouseMove( HWND hDlg, LPARAM lParam )
|
2000-04-24 19:35:11 +02:00
|
|
|
{
|
2007-04-04 23:22:20 +02:00
|
|
|
LPCCPRIV lpp = (LPCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
2000-04-24 19:35:11 +02:00
|
|
|
int r, g, b;
|
|
|
|
|
|
|
|
if (lpp->capturedGraph)
|
|
|
|
{
|
|
|
|
int *ptrh = NULL, *ptrs = &lpp->l;
|
2002-06-01 01:06:46 +02:00
|
|
|
if (lpp->capturedGraph == 0x2c6)
|
2000-04-24 19:35:11 +02:00
|
|
|
{
|
|
|
|
ptrh = &lpp->h;
|
|
|
|
ptrs = &lpp->s;
|
|
|
|
}
|
|
|
|
if (CC_MouseCheckColorGraph( hDlg, lpp->capturedGraph, ptrh, ptrs, lParam))
|
|
|
|
{
|
|
|
|
r = CC_HSLtoRGB('R', lpp->h, lpp->s, lpp->l);
|
|
|
|
g = CC_HSLtoRGB('G', lpp->h, lpp->s, lpp->l);
|
|
|
|
b = CC_HSLtoRGB('B', lpp->h, lpp->s, lpp->l);
|
|
|
|
lpp->lpcc->rgbResult = RGB(r, g, b);
|
|
|
|
CC_EditSetRGB(hDlg, lpp->lpcc->rgbResult);
|
|
|
|
CC_EditSetHSL(hDlg,lpp->h, lpp->s, lpp->l);
|
|
|
|
CC_PaintCross(hDlg, lpp->h, lpp->s);
|
|
|
|
CC_PaintTriangle(hDlg, lpp->l);
|
|
|
|
CC_PaintSelectedColor(hDlg, lpp->lpcc->rgbResult);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ReleaseCapture();
|
|
|
|
lpp->capturedGraph = 0;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2003-06-13 20:07:45 +02:00
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* CC_WMLButtonDown [internal]
|
|
|
|
*/
|
2003-06-13 20:07:45 +02:00
|
|
|
LRESULT CC_WMLButtonDown( HWND hDlg, WPARAM wParam, LPARAM lParam )
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2007-04-04 23:22:20 +02:00
|
|
|
LPCCPRIV lpp = (LPCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
2000-04-24 19:35:11 +02:00
|
|
|
int r, g, b, i;
|
|
|
|
i = 0;
|
|
|
|
|
2000-07-23 16:21:38 +02:00
|
|
|
if (CC_MouseCheckPredefColorArray(lpp, hDlg, 0x2d0, 6, 8, lParam))
|
2000-04-24 19:35:11 +02:00
|
|
|
i = 1;
|
1999-02-28 21:05:11 +01:00
|
|
|
else
|
2000-07-23 16:21:38 +02:00
|
|
|
if (CC_MouseCheckUserColorArray(lpp, hDlg, 0x2d1, 2, 8, lParam))
|
2000-04-24 19:35:11 +02:00
|
|
|
i = 1;
|
1999-02-28 21:05:11 +01:00
|
|
|
else
|
2000-04-24 19:35:11 +02:00
|
|
|
if (CC_MouseCheckColorGraph(hDlg, 0x2c6, &lpp->h, &lpp->s, lParam))
|
|
|
|
{
|
|
|
|
i = 2;
|
|
|
|
lpp->capturedGraph = 0x2c6;
|
|
|
|
}
|
1999-02-28 21:05:11 +01:00
|
|
|
else
|
2000-04-24 19:35:11 +02:00
|
|
|
if (CC_MouseCheckColorGraph(hDlg, 0x2be, NULL, &lpp->l, lParam))
|
|
|
|
{
|
|
|
|
i = 2;
|
|
|
|
lpp->capturedGraph = 0x2be;
|
|
|
|
}
|
|
|
|
if ( i == 2 )
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
SetCapture(hDlg);
|
|
|
|
r = CC_HSLtoRGB('R', lpp->h, lpp->s, lpp->l);
|
|
|
|
g = CC_HSLtoRGB('G', lpp->h, lpp->s, lpp->l);
|
|
|
|
b = CC_HSLtoRGB('B', lpp->h, lpp->s, lpp->l);
|
|
|
|
lpp->lpcc->rgbResult = RGB(r, g, b);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
2000-04-24 19:35:11 +02:00
|
|
|
if ( i == 1 )
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
r = GetRValue(lpp->lpcc->rgbResult);
|
|
|
|
g = GetGValue(lpp->lpcc->rgbResult);
|
|
|
|
b = GetBValue(lpp->lpcc->rgbResult);
|
|
|
|
lpp->h = CC_RGBtoHSL('H', r, g, b);
|
|
|
|
lpp->s = CC_RGBtoHSL('S', r, g, b);
|
|
|
|
lpp->l = CC_RGBtoHSL('L', r, g, b);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
if (i)
|
|
|
|
{
|
2000-04-24 19:35:11 +02:00
|
|
|
CC_EditSetRGB(hDlg, lpp->lpcc->rgbResult);
|
|
|
|
CC_EditSetHSL(hDlg,lpp->h, lpp->s, lpp->l);
|
|
|
|
CC_PaintCross(hDlg, lpp->h, lpp->s);
|
|
|
|
CC_PaintTriangle(hDlg, lpp->l);
|
|
|
|
CC_PaintSelectedColor(hDlg, lpp->lpcc->rgbResult);
|
1999-02-28 21:05:11 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* ColorDlgProc32 [internal]
|
|
|
|
*
|
|
|
|
*/
|
2002-10-31 02:04:39 +01:00
|
|
|
static INT_PTR CALLBACK ColorDlgProc( HWND hDlg, UINT message,
|
2000-04-24 19:35:11 +02:00
|
|
|
WPARAM wParam, LPARAM lParam )
|
|
|
|
{
|
|
|
|
|
|
|
|
int res;
|
2007-04-04 23:22:20 +02:00
|
|
|
LPCCPRIV lpp = (LPCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
2000-04-24 19:35:11 +02:00
|
|
|
if (message != WM_INITDIALOG)
|
|
|
|
{
|
|
|
|
if (!lpp)
|
|
|
|
return FALSE;
|
|
|
|
res = 0;
|
|
|
|
if (CC_HookCallChk(lpp->lpcc))
|
|
|
|
res = CallWindowProcA( (WNDPROC)lpp->lpcc->lpfnHook, hDlg, message, wParam, lParam);
|
|
|
|
if ( res )
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: SetRGB message
|
|
|
|
if (message && message == msetrgb)
|
|
|
|
return HandleSetRGB(hDlg, lParam);
|
|
|
|
*/
|
|
|
|
|
|
|
|
switch (message)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
2003-12-01 23:45:30 +01:00
|
|
|
return CC_WMInitDialog(hDlg, wParam, lParam);
|
2000-04-24 19:35:11 +02:00
|
|
|
case WM_NCDESTROY:
|
2002-06-01 01:06:46 +02:00
|
|
|
DeleteDC(lpp->hdcMem);
|
|
|
|
DeleteObject(lpp->hbmMem);
|
2000-04-24 19:35:11 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, lpp);
|
2006-03-10 04:26:50 +01:00
|
|
|
RemovePropW( hDlg, szColourDialogProp );
|
2000-04-24 19:35:11 +02:00
|
|
|
break;
|
|
|
|
case WM_COMMAND:
|
|
|
|
if (CC_WMCommand( hDlg, wParam, lParam, HIWORD(wParam), (HWND) lParam))
|
|
|
|
return TRUE;
|
2002-06-01 01:06:46 +02:00
|
|
|
break;
|
2000-04-24 19:35:11 +02:00
|
|
|
case WM_PAINT:
|
|
|
|
if ( CC_WMPaint(hDlg, wParam, lParam))
|
|
|
|
return TRUE;
|
|
|
|
break;
|
|
|
|
case WM_LBUTTONDBLCLK:
|
|
|
|
if (CC_MouseCheckResultWindow(hDlg, lParam))
|
|
|
|
return TRUE;
|
|
|
|
break;
|
|
|
|
case WM_MOUSEMOVE:
|
|
|
|
if (CC_WMMouseMove(hDlg, lParam))
|
|
|
|
return TRUE;
|
|
|
|
break;
|
|
|
|
case WM_LBUTTONUP: /* FIXME: ClipCursor off (if in color graph)*/
|
|
|
|
if (CC_WMLButtonUp(hDlg, wParam, lParam))
|
|
|
|
return TRUE;
|
|
|
|
break;
|
|
|
|
case WM_LBUTTONDOWN:/* FIXME: ClipCursor on (if in color graph)*/
|
|
|
|
if (CC_WMLButtonDown(hDlg, wParam, lParam))
|
|
|
|
return TRUE;
|
2002-06-01 01:06:46 +02:00
|
|
|
break;
|
2000-04-24 19:35:11 +02:00
|
|
|
}
|
|
|
|
return FALSE ;
|
|
|
|
}
|
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
/***********************************************************************
|
2001-06-19 05:34:07 +02:00
|
|
|
* ChooseColorW (COMDLG32.@)
|
2005-11-12 20:12:25 +01:00
|
|
|
*
|
|
|
|
* Create a color dialog box.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* lpChCol [I/O] in: information to initialize the dialog box.
|
|
|
|
* out: User's color selection
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE: Ok button clicked.
|
|
|
|
* FALSE: Cancel button clicked, or error.
|
1999-02-28 21:05:11 +01:00
|
|
|
*/
|
2000-04-24 19:35:11 +02:00
|
|
|
BOOL WINAPI ChooseColorW( LPCHOOSECOLORW lpChCol )
|
|
|
|
{
|
|
|
|
HANDLE hDlgTmpl = 0;
|
|
|
|
BOOL bRet = FALSE;
|
|
|
|
LPCVOID template;
|
|
|
|
|
|
|
|
TRACE("ChooseColor\n");
|
2002-06-01 01:06:46 +02:00
|
|
|
if (!lpChCol) return FALSE;
|
2000-04-24 19:35:11 +02:00
|
|
|
|
|
|
|
if (lpChCol->Flags & CC_ENABLETEMPLATEHANDLE)
|
|
|
|
{
|
|
|
|
if (!(template = LockResource(lpChCol->hInstance)))
|
|
|
|
{
|
|
|
|
COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (lpChCol->Flags & CC_ENABLETEMPLATE)
|
|
|
|
{
|
2002-09-17 00:47:05 +02:00
|
|
|
HRSRC hResInfo;
|
2002-11-22 00:55:10 +01:00
|
|
|
if (!(hResInfo = FindResourceW((HINSTANCE)lpChCol->hInstance,
|
2000-04-24 19:35:11 +02:00
|
|
|
lpChCol->lpTemplateName,
|
2003-09-10 05:56:47 +02:00
|
|
|
(LPWSTR)RT_DIALOG)))
|
2000-04-24 19:35:11 +02:00
|
|
|
{
|
|
|
|
COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2002-11-22 00:55:10 +01:00
|
|
|
if (!(hDlgTmpl = LoadResource((HINSTANCE)lpChCol->hInstance, hResInfo)) ||
|
2000-04-24 19:35:11 +02:00
|
|
|
!(template = LockResource(hDlgTmpl)))
|
|
|
|
{
|
|
|
|
COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-09-17 00:47:05 +02:00
|
|
|
HRSRC hResInfo;
|
|
|
|
HGLOBAL hDlgTmpl;
|
2005-01-10 14:22:35 +01:00
|
|
|
static const WCHAR wszCHOOSE_COLOR[] = {'C','H','O','O','S','E','_','C','O','L','O','R',0};
|
|
|
|
if (!(hResInfo = FindResourceW(COMDLG32_hInstance, wszCHOOSE_COLOR, (LPWSTR)RT_DIALOG)))
|
2000-04-24 19:35:11 +02:00
|
|
|
{
|
|
|
|
COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2003-04-30 00:52:02 +02:00
|
|
|
if (!(hDlgTmpl = LoadResource(COMDLG32_hInstance, hResInfo )) ||
|
2000-04-24 19:35:11 +02:00
|
|
|
!(template = LockResource(hDlgTmpl)))
|
|
|
|
{
|
|
|
|
COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-04-30 00:52:02 +02:00
|
|
|
bRet = DialogBoxIndirectParamW(COMDLG32_hInstance, template, lpChCol->hwndOwner,
|
2005-09-02 13:32:17 +02:00
|
|
|
ColorDlgProc, (LPARAM)lpChCol);
|
2000-04-24 19:35:11 +02:00
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-19 05:34:07 +02:00
|
|
|
* ChooseColorA (COMDLG32.@)
|
2005-11-12 20:12:25 +01:00
|
|
|
*
|
|
|
|
* See ChooseColorW.
|
2000-04-24 19:35:11 +02:00
|
|
|
*/
|
|
|
|
BOOL WINAPI ChooseColorA( LPCHOOSECOLORA lpChCol )
|
1999-02-28 21:05:11 +01:00
|
|
|
|
|
|
|
{
|
2006-10-22 14:32:29 +02:00
|
|
|
LPWSTR template_name = NULL;
|
2000-04-24 19:35:11 +02:00
|
|
|
BOOL ret;
|
2006-10-22 14:32:29 +02:00
|
|
|
|
2000-04-25 21:53:04 +02:00
|
|
|
LPCHOOSECOLORW lpcc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CHOOSECOLORW));
|
2000-04-24 19:35:11 +02:00
|
|
|
lpcc->lStructSize = sizeof(*lpcc);
|
|
|
|
lpcc->hwndOwner = lpChCol->hwndOwner;
|
|
|
|
lpcc->hInstance = lpChCol->hInstance;
|
|
|
|
lpcc->rgbResult = lpChCol->rgbResult;
|
|
|
|
lpcc->lpCustColors = lpChCol->lpCustColors;
|
|
|
|
lpcc->Flags = lpChCol->Flags;
|
|
|
|
lpcc->lCustData = lpChCol->lCustData;
|
|
|
|
lpcc->lpfnHook = (LPCCHOOKPROC) lpChCol->lpfnHook;
|
2000-06-25 14:51:14 +02:00
|
|
|
if ((lpcc->Flags & CC_ENABLETEMPLATE) && (lpChCol->lpTemplateName)) {
|
2002-01-04 19:23:46 +01:00
|
|
|
if (HIWORD(lpChCol->lpTemplateName)) {
|
|
|
|
INT len = MultiByteToWideChar( CP_ACP, 0, lpChCol->lpTemplateName, -1, NULL, 0);
|
2006-10-22 14:32:29 +02:00
|
|
|
template_name = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, lpChCol->lpTemplateName, -1, template_name, len );
|
|
|
|
lpcc->lpTemplateName = template_name;
|
2002-01-04 19:23:46 +01:00
|
|
|
} else {
|
2006-09-02 17:33:45 +02:00
|
|
|
lpcc->lpTemplateName = (LPCWSTR)lpChCol->lpTemplateName;
|
2002-01-04 19:23:46 +01:00
|
|
|
}
|
2000-06-25 14:51:14 +02:00
|
|
|
}
|
|
|
|
|
2000-04-24 19:35:11 +02:00
|
|
|
ret = ChooseColorW(lpcc);
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2000-04-25 21:53:04 +02:00
|
|
|
if (ret)
|
2000-04-24 19:35:11 +02:00
|
|
|
lpChCol->rgbResult = lpcc->rgbResult;
|
2006-10-22 14:32:29 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, template_name);
|
2000-04-25 21:53:04 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, lpcc);
|
2000-04-24 19:35:11 +02:00
|
|
|
return ret;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|