X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=reactos%2Fdll%2Fwin32%2Fcomdlg32%2Fcolordlg.c;h=ca758e3614ba30c350ca3978d65e25bfd8ae0202;hp=99061d199ec8cce9326796b200f98c469e7830d4;hb=b20974cc24d0eef313f6ce9e4953b37492605c00;hpb=9307b5a3b7669579fb1e24d21a1b91c9b566f5e2;ds=sidebyside diff --git a/reactos/dll/win32/comdlg32/colordlg.c b/reactos/dll/win32/comdlg32/colordlg.c index 99061d199ec..ca758e3614b 100644 --- a/reactos/dll/win32/comdlg32/colordlg.c +++ b/reactos/dll/win32/comdlg32/colordlg.c @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ /* BUGS : still seems to not refresh correctly @@ -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,8 +673,8 @@ 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); - lpp->updating = TRUE; + LCCPRIV lpp = (LCCPRIV) GetPropW( hDlg, szColourDialogProp ); + if (IsWindowVisible( GetDlgItem(hDlg, 0x2c6) )) /* if full size */ { lpp->updating = TRUE; @@ -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,9 +939,9 @@ 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 (wParam) + switch (LOWORD(wParam)) { case 0x2c2: /* edit notify RGB */ case 0x2c3: @@ -950,7 +953,7 @@ LRESULT CC_WMCommand( HWND hDlg, WPARAM wParam, LPARAM lParam, WORD notifyCode, g = GetGValue(lpp->lpcc->rgbResult); b= GetBValue(lpp->lpcc->rgbResult); xx = 0; - switch (wParam) + switch (LOWORD(wParam)) { case 0x2c2: if ((xx = (i != r))) r = i; break; case 0x2c3: if ((xx = (i != g))) g = i; break; @@ -975,9 +978,9 @@ LRESULT CC_WMCommand( HWND hDlg, WPARAM wParam, LPARAM lParam, WORD notifyCode, case 0x2c1: if (notifyCode == EN_UPDATE && !lpp->updating) { - i = CC_CheckDigitsInEdit(hwndCtl , wParam == 0x2bf ? 239:240); + i = CC_CheckDigitsInEdit(hwndCtl , LOWORD(wParam) == 0x2bf ? 239:240); xx = 0; - switch (wParam) + switch (LOWORD(wParam)) { case 0x2bf: if ((xx = ( i != lpp->h))) lpp->h = i; break; case 0x2c0: if ((xx = ( i != lpp->s))) lpp->s = i; break; @@ -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 */ + RemovePropW( hDlg, szColourDialogProp ); break; case WM_COMMAND: if (CC_WMCommand( hDlg, wParam, lParam, HIWORD(wParam), (HWND) lParam))