comdlg32: Use a property for the color dialog's information.
This commit is contained in:
parent
18345170fd
commit
f66c8e3232
|
@ -62,6 +62,9 @@ static const COLORREF predefcolors[6][8]=
|
|||
0x00808040L, 0x00C0C0C0L, 0x00400040L, 0x00FFFFFFL },
|
||||
};
|
||||
|
||||
static const WCHAR szColourDialogProp[] = {
|
||||
'c','o','l','o','u','r','d','i','a','l','o','g','p','r','o','p',0 };
|
||||
|
||||
/* Chose Color PRIVATE Structure:
|
||||
*
|
||||
* This structure is duplicated in the 16 bit code with
|
||||
|
@ -461,7 +464,7 @@ void CC_PaintTriangle( HWND hDlg, int y)
|
|||
int oben;
|
||||
RECT rect;
|
||||
HWND hwnd = GetDlgItem(hDlg, 0x2be);
|
||||
LCCPRIV lpp = (LCCPRIV)GetWindowLongPtrW( hDlg, DWLP_USER);
|
||||
LCCPRIV lpp = (LCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
||||
|
||||
if (IsWindowVisible( GetDlgItem(hDlg, 0x2c6))) /* if full size */
|
||||
{
|
||||
|
@ -499,7 +502,7 @@ void CC_PaintCross( HWND hDlg, int x, int y)
|
|||
HDC hDC;
|
||||
int w = GetDialogBaseUnits();
|
||||
HWND hwnd = GetDlgItem(hDlg, 0x2c6);
|
||||
LCCPRIV lpp = (LCCPRIV)GetWindowLongPtrW( hDlg, DWLP_USER );
|
||||
LCCPRIV lpp = (LCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
||||
RECT rect;
|
||||
POINT point, p;
|
||||
HPEN hPen;
|
||||
|
@ -544,7 +547,7 @@ static void CC_PrepareColorGraph( HWND hDlg )
|
|||
{
|
||||
int sdif, hdif, xdif, ydif, r, g, b, hue, sat;
|
||||
HWND hwnd = GetDlgItem(hDlg, 0x2c6);
|
||||
LCCPRIV lpp = (LCCPRIV)GetWindowLongPtrW(hDlg, DWLP_USER);
|
||||
LCCPRIV lpp = (LCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
||||
HBRUSH hbrush;
|
||||
HDC hdc ;
|
||||
RECT rect, client;
|
||||
|
@ -587,7 +590,7 @@ static void CC_PrepareColorGraph( HWND hDlg )
|
|||
static void CC_PaintColorGraph( HWND hDlg )
|
||||
{
|
||||
HWND hwnd = GetDlgItem( hDlg, 0x2c6 );
|
||||
LCCPRIV lpp = (LCCPRIV)GetWindowLongPtrW(hDlg, DWLP_USER);
|
||||
LCCPRIV lpp = (LCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
||||
HDC hDC;
|
||||
RECT rect;
|
||||
if (IsWindowVisible(hwnd)) /* if full size */
|
||||
|
@ -647,7 +650,7 @@ static void CC_PaintLumBar( HWND hDlg, int hue, int sat )
|
|||
void CC_EditSetRGB( HWND hDlg, COLORREF cr )
|
||||
{
|
||||
char buffer[10];
|
||||
LCCPRIV lpp = (LCCPRIV)GetWindowLongPtrW(hDlg, DWLP_USER);
|
||||
LCCPRIV lpp = (LCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
||||
int r = GetRValue(cr);
|
||||
int g = GetGValue(cr);
|
||||
int b = GetBValue(cr);
|
||||
|
@ -670,7 +673,7 @@ void CC_EditSetRGB( HWND hDlg, COLORREF cr )
|
|||
void CC_EditSetHSL( HWND hDlg, int h, int s, int l )
|
||||
{
|
||||
char buffer[10];
|
||||
LCCPRIV lpp = (LCCPRIV)GetWindowLongPtrW(hDlg, DWLP_USER);
|
||||
LCCPRIV lpp = (LCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
||||
|
||||
if (IsWindowVisible( GetDlgItem(hDlg, 0x2c6) )) /* if full size */
|
||||
{
|
||||
|
@ -692,7 +695,7 @@ void CC_EditSetHSL( HWND hDlg, int h, int s, int l )
|
|||
void CC_SwitchToFullSize( HWND hDlg, COLORREF result, LPRECT lprect )
|
||||
{
|
||||
int i;
|
||||
LCCPRIV lpp = (LCCPRIV)GetWindowLongPtrW(hDlg, DWLP_USER);
|
||||
LCCPRIV lpp = (LCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
||||
|
||||
EnableWindow( GetDlgItem(hDlg, 0x2cf), FALSE);
|
||||
CC_PrepareColorGraph(hDlg);
|
||||
|
@ -728,7 +731,7 @@ static void CC_PaintPredefColorArray( HWND hDlg, int rows, int cols)
|
|||
HDC hdc;
|
||||
HBRUSH hBrush;
|
||||
int dx, dy, i, j, k;
|
||||
LCCPRIV lpp = (LCCPRIV)GetWindowLongPtrW(hDlg, DWLP_USER);
|
||||
LCCPRIV lpp = (LCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
||||
|
||||
GetClientRect(hwnd, &rect);
|
||||
dx = rect.right / cols;
|
||||
|
@ -770,7 +773,7 @@ void CC_PaintUserColorArray( HWND hDlg, int rows, int cols, COLORREF* lpcr )
|
|||
HDC hdc;
|
||||
HBRUSH hBrush;
|
||||
int dx, dy, i, j, k;
|
||||
LCCPRIV lpp = (LCCPRIV)GetWindowLongPtrW(hDlg, DWLP_USER);
|
||||
LCCPRIV lpp = (LCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
||||
|
||||
GetClientRect(hwnd, &rect);
|
||||
|
||||
|
@ -842,7 +845,7 @@ static LONG CC_WMInitDialog( HWND hDlg, WPARAM wParam, LPARAM lParam )
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
SetWindowLongPtrW(hDlg, DWLP_USER, (LONG_PTR)lpp);
|
||||
SetPropW( hDlg, szColourDialogProp, lpp );
|
||||
|
||||
if (!(lpp->lpcc->Flags & CC_SHOWHELP))
|
||||
ShowWindow( GetDlgItem(hDlg,0x40e), SW_HIDE);
|
||||
|
@ -936,7 +939,7 @@ LRESULT CC_WMCommand( HWND hDlg, WPARAM wParam, LPARAM lParam, WORD notifyCode,
|
|||
UINT cokmsg;
|
||||
HDC hdc;
|
||||
COLORREF *cr;
|
||||
LCCPRIV lpp = (LCCPRIV)GetWindowLongPtrW(hDlg, DWLP_USER);
|
||||
LCCPRIV lpp = (LCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
||||
TRACE("CC_WMCommand wParam=%x lParam=%lx\n", wParam, lParam);
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
|
@ -1058,7 +1061,7 @@ LRESULT CC_WMCommand( HWND hDlg, WPARAM wParam, LPARAM lParam, WORD notifyCode,
|
|||
LRESULT CC_WMPaint( HWND hDlg, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
LCCPRIV lpp = (LCCPRIV)GetWindowLongPtrW(hDlg, DWLP_USER);
|
||||
LCCPRIV lpp = (LCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
||||
|
||||
BeginPaint(hDlg, &ps);
|
||||
/* we have to paint dialog children except text and buttons */
|
||||
|
@ -1079,7 +1082,7 @@ LRESULT CC_WMPaint( HWND hDlg, WPARAM wParam, LPARAM lParam )
|
|||
*/
|
||||
LRESULT CC_WMLButtonUp( HWND hDlg, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
LCCPRIV lpp = (LCCPRIV)GetWindowLongPtrW(hDlg, DWLP_USER);
|
||||
LCCPRIV lpp = (LCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
||||
if (lpp->capturedGraph)
|
||||
{
|
||||
lpp->capturedGraph = 0;
|
||||
|
@ -1095,7 +1098,7 @@ LRESULT CC_WMLButtonUp( HWND hDlg, WPARAM wParam, LPARAM lParam )
|
|||
*/
|
||||
LRESULT CC_WMMouseMove( HWND hDlg, LPARAM lParam )
|
||||
{
|
||||
LCCPRIV lpp = (LCCPRIV)GetWindowLongPtrW(hDlg, DWLP_USER);
|
||||
LCCPRIV lpp = (LCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
||||
int r, g, b;
|
||||
|
||||
if (lpp->capturedGraph)
|
||||
|
@ -1133,7 +1136,7 @@ LRESULT CC_WMMouseMove( HWND hDlg, LPARAM lParam )
|
|||
*/
|
||||
LRESULT CC_WMLButtonDown( HWND hDlg, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
LCCPRIV lpp = (LCCPRIV)GetWindowLongPtrW(hDlg, DWLP_USER);
|
||||
LCCPRIV lpp = (LCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
||||
int r, g, b, i;
|
||||
i = 0;
|
||||
|
||||
|
@ -1192,7 +1195,7 @@ static INT_PTR CALLBACK ColorDlgProc( HWND hDlg, UINT message,
|
|||
{
|
||||
|
||||
int res;
|
||||
LCCPRIV lpp = (LCCPRIV)GetWindowLongPtrW(hDlg, DWLP_USER);
|
||||
LCCPRIV lpp = (LCCPRIV) GetPropW( hDlg, szColourDialogProp );
|
||||
if (message != WM_INITDIALOG)
|
||||
{
|
||||
if (!lpp)
|
||||
|
@ -1217,7 +1220,7 @@ static INT_PTR CALLBACK ColorDlgProc( HWND hDlg, UINT message,
|
|||
DeleteDC(lpp->hdcMem);
|
||||
DeleteObject(lpp->hbmMem);
|
||||
HeapFree(GetProcessHeap(), 0, lpp);
|
||||
SetWindowLongPtrW(hDlg, DWLP_USER, 0); /* we don't need it anymore */
|
||||
SetPropW( hDlg, szColourDialogProp, 0 );
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
if (CC_WMCommand( hDlg, wParam, lParam, HIWORD(wParam), (HWND) lParam))
|
||||
|
|
Loading…
Reference in New Issue