Focus handling, visual changes + misc fixes.

This commit is contained in:
Gerard Patel 2000-07-23 14:21:38 +00:00 committed by Alexandre Julliard
parent 8fc00076b9
commit 7f392f5e1b
22 changed files with 128 additions and 84 deletions

View File

@ -122,8 +122,8 @@ FONT 8, "Helv"
} }
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
STYLE WS_CLIPCHILDREN | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Color" CAPTION "Color"
FONT 8, "Helv" FONT 8, "Helv"
{ {

View File

@ -105,8 +105,8 @@ FONT 8, "Helv"
} }
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 200 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 185
STYLE WS_CLIPCHILDREN | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Barvy" CAPTION "Barvy"
FONT 8, "Helv" FONT 8, "Helv"
{ {

View File

@ -122,8 +122,8 @@ FONT 8, "Helv"
} }
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
STYLE WS_CLIPCHILDREN | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Farve" CAPTION "Farve"
FONT 8, "Helv" FONT 8, "Helv"
{ {

View File

@ -122,8 +122,8 @@ FONT 8, "Helv"
} }
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
STYLE WS_CLIPCHILDREN | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Farbe" CAPTION "Farbe"
FONT 8, "Helv" FONT 8, "Helv"
{ {

View File

@ -122,8 +122,8 @@ FONT 8, "Helv"
} }
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
STYLE WS_CLIPCHILDREN | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Color" CAPTION "Color"
FONT 8, "Helv" FONT 8, "Helv"
{ {

View File

@ -105,8 +105,8 @@ FONT 8, "Helv"
} }
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 200 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 185
STYLE WS_CLIPCHILDREN | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Koloro" CAPTION "Koloro"
FONT 8, "Helv" FONT 8, "Helv"
{ {

View File

@ -122,8 +122,8 @@ FONT 8, "Helv"
} }
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
STYLE WS_CLIPCHILDREN | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Color" CAPTION "Color"
FONT 8, "Helv" FONT 8, "Helv"
{ {

View File

@ -122,8 +122,8 @@ FONT 8, "Helv"
} }
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
STYLE WS_CLIPCHILDREN | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Väri" CAPTION "Väri"
FONT 8, "Helv" FONT 8, "Helv"
{ {

View File

@ -120,8 +120,8 @@ FONT 8, "Helv"
CTEXT "AaBbYyZz",1093,104,81,149,37,SS_NOPREFIX | WS_VISIBLE CTEXT "AaBbYyZz",1093,104,81,149,37,SS_NOPREFIX | WS_VISIBLE
} }
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
STYLE WS_CLIPCHILDREN | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Couleurs" CAPTION "Couleurs"
FONT 8, "Helv" FONT 8, "Helv"
{ {
@ -142,7 +142,7 @@ FONT 8, "Helv"
EDITTEXT 705, 226,152,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP EDITTEXT 705, 226,152,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP
CONTROL "" ,720,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP,4,14,140,86 CONTROL "" ,720,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP,4,14,140,86
CONTROL "" ,721,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP,4,116,140,28 CONTROL "" ,721,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP,4,116,140,28
CONTROL "" ,710,"STATIC",WS_BORDER|SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,4,118,116 CONTROL "" ,702,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 278,4,8,116 CONTROL "" ,710,"STATIC",WS_BORDER|SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,4,118,116
CONTROL "" ,702,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 278,4,8,116 CONTROL "" ,702,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 278,4,8,116
CONTROL "" ,709,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,124,40,26 CONTROL "" ,709,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,124,40,26
DEFPUSHBUTTON "Ok", 1, 4, 166, 44, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP DEFPUSHBUTTON "Ok", 1, 4, 166, 44, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP

View File

@ -121,8 +121,8 @@ FONT 8, "Helv"
} }
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
STYLE WS_CLIPCHILDREN | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Szín" CAPTION "Szín"
FONT 8, "Helv" FONT 8, "Helv"
{ {

View File

@ -120,8 +120,8 @@ FONT 8, "Helv"
CTEXT "AaBbYyZz",1093,104,81,149,37,SS_NOPREFIX | WS_VISIBLE CTEXT "AaBbYyZz",1093,104,81,149,37,SS_NOPREFIX | WS_VISIBLE
} }
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
STYLE WS_CLIPCHILDREN | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Colore" CAPTION "Colore"
FONT 8, "Helv" FONT 8, "Helv"
{ {

View File

@ -122,8 +122,8 @@ FONT 8, "System"
} }
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
STYLE WS_CLIPCHILDREN | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "色の設定" CAPTION "色の設定"
FONT 8, "System" FONT 8, "System"
{ {

View File

@ -105,8 +105,8 @@ FONT 8, "Helv"
} }
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
STYLE WS_CLIPCHILDREN | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "»ö" CAPTION "»ö"
FONT 8, "Helv" FONT 8, "Helv"
{ {

View File

@ -122,8 +122,8 @@ FONT 8, "Helv"
} }
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
STYLE WS_CLIPCHILDREN | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Kleur" CAPTION "Kleur"
FONT 8, "Helv" FONT 8, "Helv"
{ {

View File

@ -105,8 +105,8 @@ FONT 8, "Helv"
} }
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 200 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 185
STYLE WS_CLIPCHILDREN | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Farge" CAPTION "Farge"
FONT 8, "Helv" FONT 8, "Helv"
{ {

View File

@ -157,8 +157,8 @@ BEGIN
CONTROL "&Pomoc", 1038, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 174, 75, 68, 14 CONTROL "&Pomoc", 1038, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 174, 75, 68, 14
END END
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
STYLE WS_CLIPCHILDREN | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Color" CAPTION "Color"
FONT 8, "Helv" FONT 8, "Helv"
{ {

View File

@ -122,8 +122,8 @@ FONT 8, "Helv"
} }
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
STYLE WS_CLIPCHILDREN | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Cor" CAPTION "Cor"
FONT 8, "Helv" FONT 8, "Helv"
{ {

View File

@ -122,8 +122,8 @@ FONT 8, "Ms Sans Serif"
} }
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
STYLE WS_CLIPCHILDREN | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Èçìåíåíèå ïàëèòðû" CAPTION "Èçìåíåíèå ïàëèòðû"
FONT 8, "Ms Sans Serif" FONT 8, "Ms Sans Serif"
{ {

View File

@ -105,7 +105,7 @@ FONT 8, "Helv"
} }
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 200 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 185
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Farby" CAPTION "Farby"
FONT 8, "Helv" FONT 8, "Helv"

View File

@ -122,8 +122,8 @@ FONT 8, "Helv"
} }
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
STYLE WS_CLIPCHILDREN | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Färg" CAPTION "Färg"
FONT 8, "Helv" FONT 8, "Helv"
{ {

View File

@ -127,8 +127,8 @@ FONT 8, "Helv"
} }
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
STYLE WS_CLIPCHILDREN | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Coleurs" CAPTION "Coleurs"
FONT 8, "Helv" FONT 8, "Helv"
{ {

View File

@ -5,6 +5,10 @@
* Copyright 1996 Albrecht Kleine * Copyright 1996 Albrecht Kleine
*/ */
/* BUGS : still seems to not refresh correctly
sometimes, especially when 2 instances of the
dialog are loaded at the same time */
#include <ctype.h> #include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@ -67,8 +71,12 @@ struct CCPRIVATE
int s; int s;
int l; /* for temporary storing of hue,sat,lum */ int l; /* for temporary storing of hue,sat,lum */
int capturedGraph; /* control mouse captured */ int capturedGraph; /* control mouse captured */
RECT focusRect; /* rectangle last focused item */
HWND hwndFocus; /* handle last focused item */
}; };
#define LCCPRIV struct CCPRIVATE *
/*********************************************************************** /***********************************************************************
* CC_HSLtoRGB [internal] * CC_HSLtoRGB [internal]
*/ */
@ -181,15 +189,54 @@ static int CC_RGBtoHSL(char c, int r, int g, int b)
return result; /* is this integer arithmetic precise enough ? */ return result; /* is this integer arithmetic precise enough ? */
} }
/***********************************************************************
* CC_DrawCurrentFocusRect [internal]
*/
void CC_DrawCurrentFocusRect( LCCPRIV lpp )
{
if (lpp->hwndFocus)
{
HDC hdc = GetDC(lpp->hwndFocus);
DrawFocusRect(hdc, &lpp->focusRect);
ReleaseDC(lpp->hwndFocus, hdc);
}
}
/***********************************************************************
* CC_DrawFocusRect [internal]
*/
void CC_DrawFocusRect( LCCPRIV lpp, HWND hwnd, int x, int y, int rows, int cols)
{
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);
}
#define DISTANCE 4 #define DISTANCE 4
/*********************************************************************** /***********************************************************************
* CC_MouseCheckPredefColorArray [internal] * CC_MouseCheckPredefColorArray [internal]
* returns 1 if one of the predefined colors is clicked * returns 1 if one of the predefined colors is clicked
* the choosen color is returned in *cr
*/ */
static int CC_MouseCheckPredefColorArray( HWND hDlg, int dlgitem, int rows, int cols, static int CC_MouseCheckPredefColorArray( LCCPRIV lpp, HWND hDlg, int dlgitem, int rows, int cols,
LPARAM lParam, COLORREF *cr ) LPARAM lParam )
{ {
HWND hwnd; HWND hwnd;
POINT point; POINT point;
@ -210,8 +257,8 @@ static int CC_MouseCheckPredefColorArray( HWND hDlg, int dlgitem, int rows, int
{ {
x = point.x / dx; x = point.x / dx;
y = point.y / dy; y = point.y / dy;
*cr = predefcolors[y][x]; lpp->lpcc->rgbResult = predefcolors[y][x];
/* FIXME: Draw_a_Focus_Rect() */ CC_DrawFocusRect(lpp, hwnd, x, y, rows, cols);
return 1; return 1;
} }
} }
@ -220,15 +267,16 @@ static int CC_MouseCheckPredefColorArray( HWND hDlg, int dlgitem, int rows, int
/*********************************************************************** /***********************************************************************
* CC_MouseCheckUserColorArray [internal] * CC_MouseCheckUserColorArray [internal]
* return 1 if the user clicked a color (returned in *cr) * return 1 if the user clicked a color
*/ */
static int CC_MouseCheckUserColorArray( HWND hDlg, int dlgitem, int rows, int cols, static int CC_MouseCheckUserColorArray( LCCPRIV lpp, HWND hDlg, int dlgitem, int rows, int cols,
LPARAM lParam, COLORREF *cr, COLORREF*crarr ) LPARAM lParam )
{ {
HWND hwnd; HWND hwnd;
POINT point; POINT point;
RECT rect; RECT rect;
int dx, dy, x, y; int dx, dy, x, y;
COLORREF *crarr = lpp->lpcc->lpCustColors;
CONV_POINTSTOPOINT(&(MAKEPOINTS(lParam)), &point); CONV_POINTSTOPOINT(&(MAKEPOINTS(lParam)), &point);
ClientToScreen(hDlg, &point); ClientToScreen(hDlg, &point);
@ -244,8 +292,8 @@ static int CC_MouseCheckUserColorArray( HWND hDlg, int dlgitem, int rows, int co
{ {
x = point.x / dx; x = point.x / dx;
y = point.y / dy; y = point.y / dy;
*cr = crarr[x+cols*y]; lpp->lpcc->rgbResult = crarr[x + (cols * y) ];
/* FIXME: Draw_a_Focus_Rect() */ CC_DrawFocusRect(lpp, hwnd, x, y, rows, cols);
return 1; return 1;
} }
} }
@ -397,13 +445,13 @@ static void CC_PaintTriangle( HWND hDlg, int y)
{ {
HDC hDC; HDC hDC;
long temp; long temp;
int w = GetDialogBaseUnits(); int w = LOWORD(GetDialogBaseUnits());
POINT points[3]; POINT points[3];
int height; int height;
int oben; int oben;
RECT rect; RECT rect;
HWND hwnd = GetDlgItem(hDlg, 0x2be); HWND hwnd = GetDlgItem(hDlg, 0x2be);
struct CCPRIVATE *lpp = (struct CCPRIVATE *)GetWindowLongA( hDlg, DWL_USER); LCCPRIV lpp = (LCCPRIV)GetWindowLongA( hDlg, DWL_USER);
if (IsWindowVisible( GetDlgItem(hDlg, 0x2c6))) /* if full size */ if (IsWindowVisible( GetDlgItem(hDlg, 0x2c6))) /* if full size */
{ {
@ -441,7 +489,7 @@ static void CC_PaintCross( HWND hDlg, int x, int y)
HDC hDC; HDC hDC;
int w = GetDialogBaseUnits(); int w = GetDialogBaseUnits();
HWND hwnd = GetDlgItem(hDlg, 0x2c6); HWND hwnd = GetDlgItem(hDlg, 0x2c6);
struct CCPRIVATE * lpp = (struct CCPRIVATE *)GetWindowLongA( hDlg, DWL_USER ); LCCPRIV lpp = (LCCPRIV)GetWindowLongA( hDlg, DWL_USER );
RECT rect; RECT rect;
POINT point, p; POINT point, p;
HPEN hPen; HPEN hPen;
@ -451,7 +499,7 @@ static void CC_PaintCross( HWND hDlg, int x, int y)
GetClientRect(hwnd, &rect); GetClientRect(hwnd, &rect);
hDC = GetDC(hwnd); hDC = GetDC(hwnd);
SelectClipRgn( hDC, CreateRectRgnIndirect(&rect)); SelectClipRgn( hDC, CreateRectRgnIndirect(&rect));
hPen = CreatePen(PS_SOLID, 2, 0); hPen = CreatePen(PS_SOLID, 2, 0xffffff); /* -white- color */
hPen = SelectObject(hDC, hPen); hPen = SelectObject(hDC, hPen);
point.x = ((long)rect.right * (long)x) / (long)MAXHORI; point.x = ((long)rect.right * (long)x) / (long)MAXHORI;
point.y = rect.bottom - ((long)rect.bottom * (long)y) / (long)MAXVERT; point.y = rect.bottom - ((long)rect.bottom * (long)y) / (long)MAXVERT;
@ -486,7 +534,7 @@ static void CC_PrepareColorGraph( HWND hDlg )
{ {
int sdif, hdif, xdif, ydif, r, g, b, hue, sat; int sdif, hdif, xdif, ydif, r, g, b, hue, sat;
HWND hwnd = GetDlgItem(hDlg, 0x2c6); HWND hwnd = GetDlgItem(hDlg, 0x2c6);
struct CCPRIVATE * lpp = (struct CCPRIVATE *)GetWindowLongA(hDlg, DWL_USER); LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
HBRUSH hbrush; HBRUSH hbrush;
HDC hdc ; HDC hdc ;
RECT rect, client; RECT rect, client;
@ -529,7 +577,7 @@ static void CC_PrepareColorGraph( HWND hDlg )
static void CC_PaintColorGraph( HWND hDlg ) static void CC_PaintColorGraph( HWND hDlg )
{ {
HWND hwnd = GetDlgItem( hDlg, 0x2c6 ); HWND hwnd = GetDlgItem( hDlg, 0x2c6 );
struct CCPRIVATE * lpp = (struct CCPRIVATE *)GetWindowLongA(hDlg, DWL_USER); LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
HDC hDC; HDC hDC;
RECT rect; RECT rect;
if (IsWindowVisible(hwnd)) /* if full size */ if (IsWindowVisible(hwnd)) /* if full size */
@ -589,7 +637,7 @@ static void CC_PaintLumBar( HWND hDlg, int hue, int sat )
static void CC_EditSetRGB( HWND hDlg, COLORREF cr ) static void CC_EditSetRGB( HWND hDlg, COLORREF cr )
{ {
char buffer[10]; char buffer[10];
struct CCPRIVATE * lpp = (struct CCPRIVATE *)GetWindowLongA(hDlg, DWL_USER); LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
int r = GetRValue(cr); int r = GetRValue(cr);
int g = GetGValue(cr); int g = GetGValue(cr);
int b = GetBValue(cr); int b = GetBValue(cr);
@ -612,7 +660,7 @@ static void CC_EditSetRGB( HWND hDlg, COLORREF cr )
static void CC_EditSetHSL( HWND hDlg, int h, int s, int l ) static void CC_EditSetHSL( HWND hDlg, int h, int s, int l )
{ {
char buffer[10]; char buffer[10];
struct CCPRIVATE * lpp = (struct CCPRIVATE *)GetWindowLongA(hDlg, DWL_USER); LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
lpp->updating = TRUE; lpp->updating = TRUE;
if (IsWindowVisible( GetDlgItem(hDlg, 0x2c6) )) /* if full size */ if (IsWindowVisible( GetDlgItem(hDlg, 0x2c6) )) /* if full size */
{ {
@ -634,7 +682,7 @@ static void CC_EditSetHSL( HWND hDlg, int h, int s, int l )
static void CC_SwitchToFullSize( HWND hDlg, COLORREF result, LPRECT lprect ) static void CC_SwitchToFullSize( HWND hDlg, COLORREF result, LPRECT lprect )
{ {
int i; int i;
struct CCPRIVATE * lpp = (struct CCPRIVATE *)GetWindowLongA(hDlg, DWL_USER); LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
EnableWindow( GetDlgItem(hDlg, 0x2cf), FALSE); EnableWindow( GetDlgItem(hDlg, 0x2cf), FALSE);
CC_PrepareColorGraph(hDlg); CC_PrepareColorGraph(hDlg);
@ -670,6 +718,7 @@ static void CC_PaintPredefColorArray( HWND hDlg, int rows, int cols)
HDC hdc; HDC hdc;
HBRUSH hBrush; HBRUSH hBrush;
int dx, dy, i, j, k; int dx, dy, i, j, k;
LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
GetClientRect(hwnd, &rect); GetClientRect(hwnd, &rect);
dx = rect.right / cols; dx = rect.right / cols;
@ -697,7 +746,8 @@ static void CC_PaintPredefColorArray( HWND hDlg, int rows, int cols)
rect.left = k; rect.left = k;
} }
ReleaseDC(hwnd, hdc); ReleaseDC(hwnd, hdc);
/* FIXME: draw_a_focus_rect */ if (lpp->hwndFocus == hwnd)
CC_DrawCurrentFocusRect(lpp);
} }
/*********************************************************************** /***********************************************************************
* CC_PaintUserColorArray [internal] * CC_PaintUserColorArray [internal]
@ -710,6 +760,7 @@ static void CC_PaintUserColorArray( HWND hDlg, int rows, int cols, COLORREF* lpc
HDC hdc; HDC hdc;
HBRUSH hBrush; HBRUSH hBrush;
int dx, dy, i, j, k; int dx, dy, i, j, k;
LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
GetClientRect(hwnd, &rect); GetClientRect(hwnd, &rect);
@ -740,7 +791,8 @@ static void CC_PaintUserColorArray( HWND hDlg, int rows, int cols, COLORREF* lpc
} }
ReleaseDC(hwnd, hdc); ReleaseDC(hwnd, hdc);
} }
/* FIXME: draw_a_focus_rect */ if (lpp->hwndFocus == hwnd)
CC_DrawCurrentFocusRect(lpp);
} }
@ -768,7 +820,7 @@ static LONG CC_WMInitDialog( HWND hDlg, WPARAM wParam, LPARAM lParam, BOOL b16 )
HWND hwnd; HWND hwnd;
RECT rect; RECT rect;
POINT point; POINT point;
struct CCPRIVATE * lpp; LCCPRIV lpp;
TRACE("WM_INITDIALOG lParam=%08lX\n", lParam); TRACE("WM_INITDIALOG lParam=%08lX\n", lParam);
lpp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct CCPRIVATE) ); lpp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct CCPRIVATE) );
@ -896,7 +948,7 @@ static LRESULT CC_WMCommand( HWND hDlg, WPARAM wParam, LPARAM lParam, WORD notif
UINT cokmsg; UINT cokmsg;
HDC hdc; HDC hdc;
COLORREF *cr; COLORREF *cr;
struct CCPRIVATE * lpp = (struct CCPRIVATE *)GetWindowLongA(hDlg, DWL_USER); LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
TRACE("CC_WMCommand wParam=%x lParam=%lx\n", wParam, lParam); TRACE("CC_WMCommand wParam=%x lParam=%lx\n", wParam, lParam);
switch (wParam) switch (wParam)
{ {
@ -1045,10 +1097,9 @@ static LRESULT CC_WMPaint( HWND hDlg, WPARAM wParam, LPARAM lParam )
{ {
HDC hdc; HDC hdc;
PAINTSTRUCT ps; PAINTSTRUCT ps;
struct CCPRIVATE * lpp = (struct CCPRIVATE *)GetWindowLongA(hDlg, DWL_USER); LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
hdc = BeginPaint(hDlg, &ps); hdc = BeginPaint(hDlg, &ps);
EndPaint(hDlg, &ps);
/* we have to paint dialog children except text and buttons */ /* we have to paint dialog children except text and buttons */
CC_PaintPredefColorArray(hDlg, 6, 8); CC_PaintPredefColorArray(hDlg, 6, 8);
CC_PaintUserColorArray(hDlg, 2, 8, lpp->lpcc->lpCustColors); CC_PaintUserColorArray(hDlg, 2, 8, lpp->lpcc->lpCustColors);
@ -1057,14 +1108,8 @@ static LRESULT CC_WMPaint( HWND hDlg, WPARAM wParam, LPARAM lParam )
CC_PaintTriangle(hDlg, lpp->l); CC_PaintTriangle(hDlg, lpp->l);
CC_PaintSelectedColor(hDlg, lpp->lpcc->rgbResult); CC_PaintSelectedColor(hDlg, lpp->lpcc->rgbResult);
CC_PaintColorGraph(hDlg); CC_PaintColorGraph(hDlg);
EndPaint(hDlg, &ps);
/* special necessary for Wine */
ValidateRect( GetDlgItem(hDlg, 0x2d0), NULL);
ValidateRect( GetDlgItem(hDlg, 0x2d1), NULL);
ValidateRect( GetDlgItem(hDlg, 0x2be), NULL);
ValidateRect( GetDlgItem(hDlg, 0x2c5), NULL);
ValidateRect( GetDlgItem(hDlg, 0x2c6), NULL);
/* hope we can remove it later -->FIXME */
return TRUE; return TRUE;
} }
@ -1074,7 +1119,7 @@ static LRESULT CC_WMPaint( HWND hDlg, WPARAM wParam, LPARAM lParam )
*/ */
static LRESULT CC_WMLButtonUp( HWND hDlg, WPARAM wParam, LPARAM lParam ) static LRESULT CC_WMLButtonUp( HWND hDlg, WPARAM wParam, LPARAM lParam )
{ {
struct CCPRIVATE * lpp = (struct CCPRIVATE *)GetWindowLongA(hDlg, DWL_USER); LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
if (lpp->capturedGraph) if (lpp->capturedGraph)
{ {
lpp->capturedGraph = 0; lpp->capturedGraph = 0;
@ -1091,7 +1136,7 @@ static LRESULT CC_WMLButtonUp( HWND hDlg, WPARAM wParam, LPARAM lParam )
*/ */
static LRESULT CC_WMMouseMove( HWND hDlg, LPARAM lParam ) static LRESULT CC_WMMouseMove( HWND hDlg, LPARAM lParam )
{ {
struct CCPRIVATE * lpp = (struct CCPRIVATE *)GetWindowLongA(hDlg, DWL_USER); LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
int r, g, b; int r, g, b;
if (lpp->capturedGraph) if (lpp->capturedGraph)
@ -1128,15 +1173,14 @@ static LRESULT CC_WMMouseMove( HWND hDlg, LPARAM lParam )
*/ */
static LRESULT CC_WMLButtonDown( HWND hDlg, WPARAM wParam, LPARAM lParam ) static LRESULT CC_WMLButtonDown( HWND hDlg, WPARAM wParam, LPARAM lParam )
{ {
struct CCPRIVATE * lpp = (struct CCPRIVATE *)GetWindowLongA(hDlg, DWL_USER); LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
int r, g, b, i; int r, g, b, i;
i = 0; i = 0;
if (CC_MouseCheckPredefColorArray(hDlg, 0x2d0, 6, 8, lParam, &lpp->lpcc->rgbResult)) if (CC_MouseCheckPredefColorArray(lpp, hDlg, 0x2d0, 6, 8, lParam))
i = 1; i = 1;
else else
if (CC_MouseCheckUserColorArray(hDlg, 0x2d1, 2, 8, lParam,&lpp->lpcc->rgbResult, if (CC_MouseCheckUserColorArray(lpp, hDlg, 0x2d1, 2, 8, lParam))
lpp->lpcc->lpCustColors))
i = 1; i = 1;
else else
if (CC_MouseCheckColorGraph(hDlg, 0x2c6, &lpp->h, &lpp->s, lParam)) if (CC_MouseCheckColorGraph(hDlg, 0x2c6, &lpp->h, &lpp->s, lParam))
@ -1189,7 +1233,7 @@ static LRESULT WINAPI ColorDlgProc( HWND hDlg, UINT message,
{ {
int res; int res;
struct CCPRIVATE * lpp = (struct CCPRIVATE *)GetWindowLongA(hDlg, DWL_USER); LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
if (message != WM_INITDIALOG) if (message != WM_INITDIALOG)
{ {
if (!lpp) if (!lpp)
@ -1251,7 +1295,7 @@ LRESULT WINAPI ColorDlgProc16( HWND16 hDlg, UINT16 message,
WPARAM16 wParam, LONG lParam ) WPARAM16 wParam, LONG lParam )
{ {
int res; int res;
struct CCPRIVATE * lpp = (struct CCPRIVATE *)GetWindowLongA(hDlg, DWL_USER); LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
if (message != WM_INITDIALOG) if (message != WM_INITDIALOG)
{ {
if (!lpp) if (!lpp)