2 * COMMDLG - Color Dialog
4 * Copyright 1994 Martin Ayotte
5 * Copyright 1996 Albrecht Kleine
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 /* BUGS : still seems to not refresh correctly
23 sometimes, especially when 2 instances of the
24 dialog are loaded at the same time */
34 #include "wine/winbase16.h"
35 #include "wine/winuser16.h"
39 #include "wine/debug.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(commdlg
);
47 static INT_PTR CALLBACK
ColorDlgProc( HWND hWnd
, UINT wMsg
, WPARAM wParam
, LPARAM lParam
);
49 #define CONV_LPARAMTOPOINT(lp,p) do { (p)->x = (short)LOWORD(lp); (p)->y = (short)HIWORD(lp); } while(0)
51 static const COLORREF predefcolors
[6][8]=
53 { 0x008080FFL
, 0x0080FFFFL
, 0x0080FF80L
, 0x0080FF00L
,
54 0x00FFFF80L
, 0x00FF8000L
, 0x00C080FFL
, 0x00FF80FFL
},
55 { 0x000000FFL
, 0x0000FFFFL
, 0x0000FF80L
, 0x0040FF00L
,
56 0x00FFFF00L
, 0x00C08000L
, 0x00C08080L
, 0x00FF00FFL
},
58 { 0x00404080L
, 0x004080FFL
, 0x0000FF00L
, 0x00808000L
,
59 0x00804000L
, 0x00FF8080L
, 0x00400080L
, 0x008000FFL
},
60 { 0x00000080L
, 0x000080FFL
, 0x00008000L
, 0x00408000L
,
61 0x00FF0000L
, 0x00A00000L
, 0x00800080L
, 0x00FF0080L
},
63 { 0x00000040L
, 0x00004080L
, 0x00004000L
, 0x00404000L
,
64 0x00800000L
, 0x00400000L
, 0x00400040L
, 0x00800040L
},
65 { 0x00000000L
, 0x00008080L
, 0x00408080L
, 0x00808080L
,
66 0x00808040L
, 0x00C0C0C0L
, 0x00400040L
, 0x00FFFFFFL
},
69 /***********************************************************************
70 * CC_HSLtoRGB [internal]
72 int CC_HSLtoRGB(char c
, int hue
, int sat
, int lum
)
79 case 'R': if (hue
> 80) hue
-= 80; else hue
+= 160; break;
80 case 'G': if (hue
> 160) hue
-= 160; else hue
+= 80; break;
85 maxrgb
= (256 * min(120,lum
)) / 120; /* 0 .. 256 */
91 res
= (hue
- 80) * maxrgb
; /* 0...10240 */
92 res
/= 40; /* 0...256 */
99 res
= (240 - hue
) * maxrgb
;
102 res
= res
- maxrgb
/ 2; /* -128...128 */
105 res
= maxrgb
/ 2 + (sat
* res
) / 240; /* 0..256 */
108 if (lum
> 120 && res
< 256)
109 res
+= ((lum
- 120) * (256 - res
)) / 120;
111 return min(res
, 255);
114 /***********************************************************************
115 * CC_RGBtoHSL [internal]
117 int CC_RGBtoHSL(char c
, int r
, int g
, int b
)
119 WORD maxi
, mini
, mmsum
, mmdif
, result
= 0;
133 case 'L': mmsum
*= 120; /* 0...61200=(255+255)*120 */
134 result
= mmsum
/ 255; /* 0...240 */
137 case 'S': if (!mmsum
)
140 if (!mini
|| maxi
== 255)
144 result
= mmdif
* 240; /* 0...61200=255*240 */
145 result
/= (mmsum
> 255 ? mmsum
= 510 - mmsum
: mmsum
); /* 0..255 */
149 case 'H': if (!mmdif
)
155 iresult
= 40 * (g
- b
); /* -10200 ... 10200 */
156 iresult
/= (int) mmdif
; /* -40 .. 40 */
158 iresult
+= 240; /* 0..40 and 200..240 */
163 iresult
= 40 * (b
- r
);
164 iresult
/= (int) mmdif
;
165 iresult
+= 80; /* 40 .. 120 */
170 iresult
= 40 * (r
- g
);
171 iresult
/= (int) mmdif
;
172 iresult
+= 160; /* 120 .. 200 */
178 return result
; /* is this integer arithmetic precise enough ? */
182 /***********************************************************************
183 * CC_DrawCurrentFocusRect [internal]
185 void CC_DrawCurrentFocusRect( LCCPRIV lpp
)
189 HDC hdc
= GetDC(lpp
->hwndFocus
);
190 DrawFocusRect(hdc
, &lpp
->focusRect
);
191 ReleaseDC(lpp
->hwndFocus
, hdc
);
195 /***********************************************************************
196 * CC_DrawFocusRect [internal]
198 void CC_DrawFocusRect( LCCPRIV lpp
, HWND hwnd
, int x
, int y
, int rows
, int cols
)
204 CC_DrawCurrentFocusRect(lpp
); /* remove current focus rect */
205 /* calculate new rect */
206 GetClientRect(hwnd
, &rect
);
207 dx
= (rect
.right
- rect
.left
) / cols
;
208 dy
= (rect
.bottom
- rect
.top
) / rows
;
209 rect
.left
+= (x
* dx
) - 2;
210 rect
.top
+= (y
* dy
) - 2;
211 rect
.right
= rect
.left
+ dx
;
212 rect
.bottom
= rect
.top
+ dy
;
215 DrawFocusRect(hdc
, &rect
);
216 CopyRect(&lpp
->focusRect
, &rect
);
217 lpp
->hwndFocus
= hwnd
;
218 ReleaseDC(hwnd
, hdc
);
223 /***********************************************************************
224 * CC_MouseCheckPredefColorArray [internal]
225 * returns 1 if one of the predefined colors is clicked
227 static int CC_MouseCheckPredefColorArray( LCCPRIV lpp
, HWND hDlg
, int dlgitem
, int rows
, int cols
,
235 CONV_LPARAMTOPOINT(lParam
, &point
);
236 ClientToScreen(hDlg
, &point
);
237 hwnd
= GetDlgItem(hDlg
, dlgitem
);
238 GetWindowRect(hwnd
, &rect
);
239 if (PtInRect(&rect
, point
))
241 dx
= (rect
.right
- rect
.left
) / cols
;
242 dy
= (rect
.bottom
- rect
.top
) / rows
;
243 ScreenToClient(hwnd
, &point
);
245 if (point
.x
% dx
< ( dx
- DISTANCE
) && point
.y
% dy
< ( dy
- DISTANCE
))
249 lpp
->lpcc
->rgbResult
= predefcolors
[y
][x
];
250 CC_DrawFocusRect(lpp
, hwnd
, x
, y
, rows
, cols
);
257 /***********************************************************************
258 * CC_MouseCheckUserColorArray [internal]
259 * return 1 if the user clicked a color
261 static int CC_MouseCheckUserColorArray( LCCPRIV lpp
, HWND hDlg
, int dlgitem
, int rows
, int cols
,
268 COLORREF
*crarr
= lpp
->lpcc
->lpCustColors
;
270 CONV_LPARAMTOPOINT(lParam
, &point
);
271 ClientToScreen(hDlg
, &point
);
272 hwnd
= GetDlgItem(hDlg
, dlgitem
);
273 GetWindowRect(hwnd
, &rect
);
274 if (PtInRect(&rect
, point
))
276 dx
= (rect
.right
- rect
.left
) / cols
;
277 dy
= (rect
.bottom
- rect
.top
) / rows
;
278 ScreenToClient(hwnd
, &point
);
280 if (point
.x
% dx
< (dx
- DISTANCE
) && point
.y
% dy
< (dy
- DISTANCE
))
284 lpp
->lpcc
->rgbResult
= crarr
[x
+ (cols
* y
) ];
285 CC_DrawFocusRect(lpp
, hwnd
, x
, y
, rows
, cols
);
295 /* 240 ^...... ^^ 240
302 /***********************************************************************
303 * CC_MouseCheckColorGraph [internal]
305 static int CC_MouseCheckColorGraph( HWND hDlg
, int dlgitem
, int *hori
, int *vert
, LPARAM lParam
)
312 CONV_LPARAMTOPOINT(lParam
, &point
);
313 ClientToScreen(hDlg
, &point
);
314 hwnd
= GetDlgItem( hDlg
, dlgitem
);
315 GetWindowRect(hwnd
, &rect
);
316 if (PtInRect(&rect
, point
))
318 GetClientRect(hwnd
, &rect
);
319 ScreenToClient(hwnd
, &point
);
321 x
= (long) point
.x
* MAXHORI
;
323 y
= (long) (rect
.bottom
- point
.y
) * MAXVERT
;
335 /***********************************************************************
336 * CC_MouseCheckResultWindow [internal]
337 * test if double click one of the result colors
339 int CC_MouseCheckResultWindow( HWND hDlg
, LPARAM lParam
)
345 CONV_LPARAMTOPOINT(lParam
, &point
);
346 ClientToScreen(hDlg
, &point
);
347 hwnd
= GetDlgItem(hDlg
, 0x2c5);
348 GetWindowRect(hwnd
, &rect
);
349 if (PtInRect(&rect
, point
))
351 PostMessageA(hDlg
, WM_COMMAND
, 0x2c9, 0);
357 /***********************************************************************
358 * CC_CheckDigitsInEdit [internal]
360 int CC_CheckDigitsInEdit( HWND hwnd
, int maxval
)
362 int i
, k
, m
, result
, value
;
366 GetWindowTextA(hwnd
, buffer
, sizeof(buffer
));
370 for (i
= 0 ; i
< m
; i
++)
371 if (buffer
[i
] < '0' || buffer
[i
] > '9')
373 for (k
= i
+ 1; k
<= m
; k
++) /* delete bad character */
375 buffer
[i
] = buffer
[k
];
382 value
= atoi(buffer
);
383 if (value
> maxval
) /* build a new string */
385 sprintf(buffer
, "%d", maxval
);
390 editpos
= SendMessageA(hwnd
, EM_GETSEL
, 0, 0);
391 SetWindowTextA(hwnd
, buffer
);
392 SendMessageA(hwnd
, EM_SETSEL
, 0, editpos
);
399 /***********************************************************************
400 * CC_PaintSelectedColor [internal]
402 void CC_PaintSelectedColor( HWND hDlg
, COLORREF cr
)
407 HWND hwnd
= GetDlgItem(hDlg
, 0x2c5);
408 if (IsWindowVisible( GetDlgItem(hDlg
, 0x2c6) )) /* if full size */
411 GetClientRect(hwnd
, &rect
) ;
412 hBrush
= CreateSolidBrush(cr
);
415 hBrush
= SelectObject(hdc
, hBrush
) ;
416 Rectangle(hdc
, rect
.left
, rect
.top
, rect
.right
/2, rect
.bottom
);
417 DeleteObject ( SelectObject(hdc
, hBrush
) ) ;
418 hBrush
= CreateSolidBrush( GetNearestColor(hdc
, cr
) );
421 hBrush
= SelectObject(hdc
, hBrush
) ;
422 Rectangle(hdc
, rect
.right
/2-1, rect
.top
, rect
.right
, rect
.bottom
);
423 DeleteObject(SelectObject(hdc
, hBrush
)) ;
426 ReleaseDC(hwnd
, hdc
);
430 /***********************************************************************
431 * CC_PaintTriangle [internal]
433 void CC_PaintTriangle( HWND hDlg
, int y
)
437 int w
= LOWORD(GetDialogBaseUnits());
442 HWND hwnd
= GetDlgItem(hDlg
, 0x2be);
443 LCCPRIV lpp
= (LCCPRIV
)GetWindowLongA( hDlg
, DWL_USER
);
445 if (IsWindowVisible( GetDlgItem(hDlg
, 0x2c6))) /* if full size */
447 GetClientRect(hwnd
, &rect
);
448 height
= rect
.bottom
;
450 points
[0].y
= rect
.top
;
451 points
[0].x
= rect
.right
; /* | /| */
452 ClientToScreen(hwnd
, points
); /* | / | */
453 ScreenToClient(hDlg
, points
); /* |< | */
454 oben
= points
[0].y
; /* | \ | */
456 temp
= (long)height
* (long)y
;
457 points
[0].y
= oben
+ height
- temp
/ (long)MAXVERT
;
458 points
[1].y
= points
[0].y
+ w
;
459 points
[2].y
= points
[0].y
- w
;
460 points
[2].x
= points
[1].x
= points
[0].x
+ w
;
462 FillRect(hDC
, &lpp
->old3angle
, (HBRUSH
)GetClassLongA( hwnd
, GCL_HBRBACKGROUND
));
463 lpp
->old3angle
.left
= points
[0].x
;
464 lpp
->old3angle
.right
= points
[1].x
+ 1;
465 lpp
->old3angle
.top
= points
[2].y
- 1;
466 lpp
->old3angle
.bottom
= points
[1].y
+ 1;
467 Polygon(hDC
, points
, 3);
468 ReleaseDC(hDlg
, hDC
);
473 /***********************************************************************
474 * CC_PaintCross [internal]
476 void CC_PaintCross( HWND hDlg
, int x
, int y
)
479 int w
= GetDialogBaseUnits();
480 HWND hwnd
= GetDlgItem(hDlg
, 0x2c6);
481 LCCPRIV lpp
= (LCCPRIV
)GetWindowLongA( hDlg
, DWL_USER
);
486 if (IsWindowVisible( GetDlgItem(hDlg
, 0x2c6) )) /* if full size */
488 GetClientRect(hwnd
, &rect
);
490 SelectClipRgn( hDC
, CreateRectRgnIndirect(&rect
));
491 hPen
= CreatePen(PS_SOLID
, 2, 0xffffff); /* -white- color */
492 hPen
= SelectObject(hDC
, hPen
);
493 point
.x
= ((long)rect
.right
* (long)x
) / (long)MAXHORI
;
494 point
.y
= rect
.bottom
- ((long)rect
.bottom
* (long)y
) / (long)MAXVERT
;
495 if ( lpp
->oldcross
.left
!= lpp
->oldcross
.right
)
496 BitBlt(hDC
, lpp
->oldcross
.left
, lpp
->oldcross
.top
,
497 lpp
->oldcross
.right
- lpp
->oldcross
.left
,
498 lpp
->oldcross
.bottom
- lpp
->oldcross
.top
,
499 lpp
->hdcMem
, lpp
->oldcross
.left
, lpp
->oldcross
.top
, SRCCOPY
);
500 lpp
->oldcross
.left
= point
.x
- w
- 1;
501 lpp
->oldcross
.right
= point
.x
+ w
+ 1;
502 lpp
->oldcross
.top
= point
.y
- w
- 1;
503 lpp
->oldcross
.bottom
= point
.y
+ w
+ 1;
505 MoveToEx(hDC
, point
.x
- w
, point
.y
, &p
);
506 LineTo(hDC
, point
.x
+ w
, point
.y
);
507 MoveToEx(hDC
, point
.x
, point
.y
- w
, &p
);
508 LineTo(hDC
, point
.x
, point
.y
+ w
);
509 DeleteObject( SelectObject(hDC
, hPen
)) ;
510 ReleaseDC(hwnd
, hDC
);
519 /***********************************************************************
520 * CC_PrepareColorGraph [internal]
522 static void CC_PrepareColorGraph( HWND hDlg
)
524 int sdif
, hdif
, xdif
, ydif
, r
, g
, b
, hue
, sat
;
525 HWND hwnd
= GetDlgItem(hDlg
, 0x2c6);
526 LCCPRIV lpp
= (LCCPRIV
)GetWindowLongA(hDlg
, DWL_USER
);
530 HCURSOR hcursor
= SetCursor( LoadCursorA(0, (LPSTR
)IDC_WAIT
) );
532 GetClientRect(hwnd
, &client
);
534 lpp
->hdcMem
= CreateCompatibleDC(hdc
);
535 lpp
->hbmMem
= CreateCompatibleBitmap(hdc
, client
.right
, client
.bottom
);
536 SelectObject(lpp
->hdcMem
, lpp
->hbmMem
);
538 xdif
= client
.right
/ XSTEPS
;
539 ydif
= client
.bottom
/ YSTEPS
+1;
542 for (rect
.left
= hue
= 0; hue
< 239 + hdif
; hue
+= hdif
)
544 rect
.right
= rect
.left
+ xdif
;
545 rect
.bottom
= client
.bottom
;
546 for(sat
= 0; sat
< 240 + sdif
; sat
+= sdif
)
548 rect
.top
= rect
.bottom
- ydif
;
549 r
= CC_HSLtoRGB('R', hue
, sat
, 120);
550 g
= CC_HSLtoRGB('G', hue
, sat
, 120);
551 b
= CC_HSLtoRGB('B', hue
, sat
, 120);
552 hbrush
= CreateSolidBrush( RGB(r
, g
, b
));
553 FillRect(lpp
->hdcMem
, &rect
, hbrush
);
554 DeleteObject(hbrush
);
555 rect
.bottom
= rect
.top
;
557 rect
.left
= rect
.right
;
559 ReleaseDC(hwnd
, hdc
);
563 /***********************************************************************
564 * CC_PaintColorGraph [internal]
566 static void CC_PaintColorGraph( HWND hDlg
)
568 HWND hwnd
= GetDlgItem( hDlg
, 0x2c6 );
569 LCCPRIV lpp
= (LCCPRIV
)GetWindowLongA(hDlg
, DWL_USER
);
572 if (IsWindowVisible(hwnd
)) /* if full size */
575 CC_PrepareColorGraph(hDlg
); /* should not be necessary */
578 GetClientRect(hwnd
, &rect
);
580 BitBlt(hDC
, 0, 0, rect
.right
, rect
.bottom
, lpp
->hdcMem
, 0, 0, SRCCOPY
);
582 WARN("choose color: hdcMem is not defined\n");
583 ReleaseDC(hwnd
, hDC
);
587 /***********************************************************************
588 * CC_PaintLumBar [internal]
590 static void CC_PaintLumBar( HWND hDlg
, int hue
, int sat
)
592 HWND hwnd
= GetDlgItem(hDlg
, 0x2be);
594 int lum
, ldif
, ydif
, r
, g
, b
;
598 if (IsWindowVisible(hwnd
))
601 GetClientRect(hwnd
, &client
);
605 ydif
= client
.bottom
/ YSTEPS
+1;
606 for (lum
= 0; lum
< 240 + ldif
; lum
+= ldif
)
608 rect
.top
= max(0, rect
.bottom
- ydif
);
609 r
= CC_HSLtoRGB('R', hue
, sat
, lum
);
610 g
= CC_HSLtoRGB('G', hue
, sat
, lum
);
611 b
= CC_HSLtoRGB('B', hue
, sat
, lum
);
612 hbrush
= CreateSolidBrush( RGB(r
, g
, b
) );
613 FillRect(hDC
, &rect
, hbrush
);
614 DeleteObject(hbrush
);
615 rect
.bottom
= rect
.top
;
617 GetClientRect(hwnd
, &rect
);
618 FrameRect(hDC
, &rect
, GetStockObject(BLACK_BRUSH
) );
619 ReleaseDC(hwnd
, hDC
);
623 /***********************************************************************
624 * CC_EditSetRGB [internal]
626 void CC_EditSetRGB( HWND hDlg
, COLORREF cr
)
629 LCCPRIV lpp
= (LCCPRIV
)GetWindowLongA(hDlg
, DWL_USER
);
630 int r
= GetRValue(cr
);
631 int g
= GetGValue(cr
);
632 int b
= GetBValue(cr
);
633 if (IsWindowVisible( GetDlgItem(hDlg
, 0x2c6) )) /* if full size */
635 lpp
->updating
= TRUE
;
636 sprintf(buffer
, "%d", r
);
637 SetWindowTextA( GetDlgItem(hDlg
, 0x2c2), buffer
);
638 sprintf(buffer
, "%d", g
);
639 SetWindowTextA( GetDlgItem(hDlg
, 0x2c3), buffer
);
640 sprintf( buffer
, "%d", b
);
641 SetWindowTextA( GetDlgItem(hDlg
, 0x2c4),buffer
);
642 lpp
->updating
= FALSE
;
646 /***********************************************************************
647 * CC_EditSetHSL [internal]
649 void CC_EditSetHSL( HWND hDlg
, int h
, int s
, int l
)
652 LCCPRIV lpp
= (LCCPRIV
)GetWindowLongA(hDlg
, DWL_USER
);
653 lpp
->updating
= TRUE
;
654 if (IsWindowVisible( GetDlgItem(hDlg
, 0x2c6) )) /* if full size */
656 lpp
->updating
= TRUE
;
657 sprintf(buffer
, "%d", h
);
658 SetWindowTextA( GetDlgItem(hDlg
, 0x2bf), buffer
);
659 sprintf(buffer
, "%d", s
);
660 SetWindowTextA( GetDlgItem(hDlg
, 0x2c0), buffer
);
661 sprintf(buffer
, "%d", l
);
662 SetWindowTextA( GetDlgItem(hDlg
, 0x2c1), buffer
);
663 lpp
->updating
= FALSE
;
665 CC_PaintLumBar(hDlg
, h
, s
);
668 /***********************************************************************
669 * CC_SwitchToFullSize [internal]
671 void CC_SwitchToFullSize( HWND hDlg
, COLORREF result
, LPRECT lprect
)
674 LCCPRIV lpp
= (LCCPRIV
)GetWindowLongA(hDlg
, DWL_USER
);
676 EnableWindow( GetDlgItem(hDlg
, 0x2cf), FALSE
);
677 CC_PrepareColorGraph(hDlg
);
678 for (i
= 0x2bf; i
< 0x2c5; i
++)
679 ShowWindow( GetDlgItem(hDlg
, i
), SW_SHOW
);
680 for (i
= 0x2d3; i
< 0x2d9; i
++)
681 ShowWindow( GetDlgItem(hDlg
, i
), SW_SHOW
);
682 ShowWindow( GetDlgItem(hDlg
, 0x2c9), SW_SHOW
);
683 ShowWindow( GetDlgItem(hDlg
, 0x2c8), SW_SHOW
);
684 ShowWindow( GetDlgItem(hDlg
, 1090), SW_SHOW
);
687 SetWindowPos(hDlg
, 0, 0, 0, lprect
->right
-lprect
->left
,
688 lprect
->bottom
-lprect
->top
, SWP_NOMOVE
|SWP_NOZORDER
);
690 ShowWindow( GetDlgItem(hDlg
, 0x2be), SW_SHOW
);
691 ShowWindow( GetDlgItem(hDlg
, 0x2c5), SW_SHOW
);
693 CC_EditSetRGB(hDlg
, result
);
694 CC_EditSetHSL(hDlg
, lpp
->h
, lpp
->s
, lpp
->l
);
695 ShowWindow( GetDlgItem( hDlg
, 0x2c6), SW_SHOW
);
696 UpdateWindow( GetDlgItem(hDlg
, 0x2c6) );
699 /***********************************************************************
700 * CC_PaintPredefColorArray [internal]
701 * Paints the default standard 48 colors
703 static void CC_PaintPredefColorArray( HWND hDlg
, int rows
, int cols
)
705 HWND hwnd
= GetDlgItem(hDlg
, 0x2d0);
710 LCCPRIV lpp
= (LCCPRIV
)GetWindowLongA(hDlg
, DWL_USER
);
712 GetClientRect(hwnd
, &rect
);
713 dx
= rect
.right
/ cols
;
714 dy
= rect
.bottom
/ rows
;
718 GetClientRect(hwnd
, &rect
);
719 FillRect(hdc
, &rect
, (HBRUSH
)GetClassLongA(hwnd
, GCL_HBRBACKGROUND
));
720 for ( j
= 0; j
< rows
; j
++ )
722 for ( i
= 0; i
< cols
; i
++ )
724 hBrush
= CreateSolidBrush(predefcolors
[j
][i
]);
727 hBrush
= SelectObject(hdc
, hBrush
);
728 Rectangle(hdc
, rect
.left
, rect
.top
,
729 rect
.left
+ dx
- DISTANCE
, rect
.top
+ dy
- DISTANCE
);
730 rect
.left
= rect
.left
+ dx
;
731 DeleteObject(SelectObject(hdc
, hBrush
)) ;
734 rect
.top
= rect
.top
+ dy
;
737 ReleaseDC(hwnd
, hdc
);
738 if (lpp
->hwndFocus
== hwnd
)
739 CC_DrawCurrentFocusRect(lpp
);
741 /***********************************************************************
742 * CC_PaintUserColorArray [internal]
743 * Paint the 16 user-selected colors
745 void CC_PaintUserColorArray( HWND hDlg
, int rows
, int cols
, COLORREF
* lpcr
)
747 HWND hwnd
= GetDlgItem(hDlg
, 0x2d1);
752 LCCPRIV lpp
= (LCCPRIV
)GetWindowLongA(hDlg
, DWL_USER
);
754 GetClientRect(hwnd
, &rect
);
756 dx
= rect
.right
/ cols
;
757 dy
= rect
.bottom
/ rows
;
763 FillRect(hdc
, &rect
, (HBRUSH
)GetClassLongA(hwnd
, GCL_HBRBACKGROUND
) );
764 for (j
= 0; j
< rows
; j
++)
766 for (i
= 0; i
< cols
; i
++)
768 hBrush
= CreateSolidBrush(lpcr
[i
+j
*cols
]);
771 hBrush
= SelectObject(hdc
, hBrush
) ;
772 Rectangle(hdc
, rect
.left
, rect
.top
,
773 rect
.left
+ dx
- DISTANCE
, rect
.top
+ dy
- DISTANCE
);
774 rect
.left
= rect
.left
+ dx
;
775 DeleteObject( SelectObject(hdc
, hBrush
) ) ;
778 rect
.top
= rect
.top
+ dy
;
781 ReleaseDC(hwnd
, hdc
);
783 if (lpp
->hwndFocus
== hwnd
)
784 CC_DrawCurrentFocusRect(lpp
);
789 /***********************************************************************
790 * CC_HookCallChk [internal]
792 BOOL
CC_HookCallChk( LPCHOOSECOLORW lpcc
)
795 if(lpcc
->Flags
& CC_ENABLEHOOK
)
801 /***********************************************************************
802 * CC_WMInitDialog [internal]
804 LONG
CC_WMInitDialog( HWND hDlg
, WPARAM wParam
, LPARAM lParam
)
813 TRACE("WM_INITDIALOG lParam=%08lX\n", lParam
);
814 lpp
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(struct CCPRIVATE
) );
816 lpp
->lpcc
= (LPCHOOSECOLORW
) lParam
;
817 if (lpp
->lpcc
->lStructSize
!= sizeof(CHOOSECOLORW
) )
819 HeapFree(GetProcessHeap(), 0, lpp
);
820 EndDialog (hDlg
, 0) ;
824 SetWindowLongA(hDlg
, DWL_USER
, (LONG
)lpp
);
826 if (!(lpp
->lpcc
->Flags
& CC_SHOWHELP
))
827 ShowWindow( GetDlgItem(hDlg
,0x40e), SW_HIDE
);
828 lpp
->msetrgb
= RegisterWindowMessageA(SETRGBSTRINGA
);
831 cpos
= MAKELONG(5,7); /* init */
832 if (lpp
->lpcc
->Flags
& CC_RGBINIT
)
834 for (i
= 0; i
< 6; i
++)
835 for (j
= 0; j
< 8; j
++)
836 if (predefcolors
[i
][j
] == lpp
->lpcc
->rgbResult
)
838 cpos
= MAKELONG(i
,j
);
843 /* FIXME: Draw_a_focus_rect & set_init_values */
846 GetWindowRect(hDlg
, &lpp
->fullsize
);
847 if (lpp
->lpcc
->Flags
& CC_FULLOPEN
|| lpp
->lpcc
->Flags
& CC_PREVENTFULLOPEN
)
849 hwnd
= GetDlgItem(hDlg
, 0x2cf);
850 EnableWindow(hwnd
, FALSE
);
852 if (!(lpp
->lpcc
->Flags
& CC_FULLOPEN
) || lpp
->lpcc
->Flags
& CC_PREVENTFULLOPEN
)
854 rect
= lpp
->fullsize
;
855 res
= rect
.bottom
- rect
.top
;
856 hwnd
= GetDlgItem(hDlg
, 0x2c6); /* cut at left border */
857 point
.x
= point
.y
= 0;
858 ClientToScreen(hwnd
, &point
);
859 ScreenToClient(hDlg
,&point
);
860 GetClientRect(hDlg
, &rect
);
861 point
.x
+= GetSystemMetrics(SM_CXDLGFRAME
);
862 SetWindowPos(hDlg
, 0, 0, 0, point
.x
, res
, SWP_NOMOVE
|SWP_NOZORDER
);
864 for (i
= 0x2bf; i
< 0x2c5; i
++)
865 ShowWindow( GetDlgItem(hDlg
, i
), SW_HIDE
);
866 for (i
= 0x2d3; i
< 0x2d9; i
++)
867 ShowWindow( GetDlgItem(hDlg
, i
), SW_HIDE
);
868 ShowWindow( GetDlgItem(hDlg
, 0x2c9), SW_HIDE
);
869 ShowWindow( GetDlgItem(hDlg
, 0x2c8), SW_HIDE
);
870 ShowWindow( GetDlgItem(hDlg
, 0x2c6), SW_HIDE
);
871 ShowWindow( GetDlgItem(hDlg
, 0x2c5), SW_HIDE
);
872 ShowWindow( GetDlgItem(hDlg
, 1090 ), SW_HIDE
);
875 CC_SwitchToFullSize(hDlg
, lpp
->lpcc
->rgbResult
, NULL
);
877 for (i
= 0x2bf; i
< 0x2c5; i
++)
878 SendMessageA( GetDlgItem(hDlg
, i
), EM_LIMITTEXT
, 3, 0); /* max 3 digits: xyz */
879 if (CC_HookCallChk(lpp
->lpcc
))
881 res
= CallWindowProcA( (WNDPROC
)lpp
->lpcc
->lpfnHook
, hDlg
, WM_INITDIALOG
, wParam
, lParam
);
884 /* Set the initial values of the color chooser dialog */
885 r
= GetRValue(lpp
->lpcc
->rgbResult
);
886 g
= GetGValue(lpp
->lpcc
->rgbResult
);
887 b
= GetBValue(lpp
->lpcc
->rgbResult
);
889 CC_PaintSelectedColor(hDlg
, lpp
->lpcc
->rgbResult
);
890 lpp
->h
= CC_RGBtoHSL('H', r
, g
, b
);
891 lpp
->s
= CC_RGBtoHSL('S', r
, g
, b
);
892 lpp
->l
= CC_RGBtoHSL('L', r
, g
, b
);
894 /* Doing it the long way because CC_EditSetRGB/HSL doesn't seem to work */
895 SetDlgItemInt(hDlg
, 703, lpp
->h
, TRUE
);
896 SetDlgItemInt(hDlg
, 704, lpp
->s
, TRUE
);
897 SetDlgItemInt(hDlg
, 705, lpp
->l
, TRUE
);
898 SetDlgItemInt(hDlg
, 706, r
, TRUE
);
899 SetDlgItemInt(hDlg
, 707, g
, TRUE
);
900 SetDlgItemInt(hDlg
, 708, b
, TRUE
);
902 CC_PaintCross(hDlg
, lpp
->h
, lpp
->s
);
903 CC_PaintTriangle(hDlg
, lpp
->l
);
909 /***********************************************************************
910 * CC_WMCommand [internal]
912 LRESULT
CC_WMCommand( HWND hDlg
, WPARAM wParam
, LPARAM lParam
, WORD notifyCode
, HWND hwndCtl
)
918 LCCPRIV lpp
= (LCCPRIV
)GetWindowLongA(hDlg
, DWL_USER
);
919 TRACE("CC_WMCommand wParam=%x lParam=%lx\n", wParam
, lParam
);
922 case 0x2c2: /* edit notify RGB */
925 if (notifyCode
== EN_UPDATE
&& !lpp
->updating
)
927 i
= CC_CheckDigitsInEdit(hwndCtl
, 255);
928 r
= GetRValue(lpp
->lpcc
->rgbResult
);
929 g
= GetGValue(lpp
->lpcc
->rgbResult
);
930 b
= GetBValue(lpp
->lpcc
->rgbResult
);
934 case 0x2c2: if ((xx
= (i
!= r
))) r
= i
; break;
935 case 0x2c3: if ((xx
= (i
!= g
))) g
= i
; break;
936 case 0x2c4: if ((xx
= (i
!= b
))) b
= i
; break;
938 if (xx
) /* something has changed */
940 lpp
->lpcc
->rgbResult
= RGB(r
, g
, b
);
941 CC_PaintSelectedColor(hDlg
, lpp
->lpcc
->rgbResult
);
942 lpp
->h
= CC_RGBtoHSL('H', r
, g
, b
);
943 lpp
->s
= CC_RGBtoHSL('S', r
, g
, b
);
944 lpp
->l
= CC_RGBtoHSL('L', r
, g
, b
);
945 CC_EditSetHSL(hDlg
, lpp
->h
, lpp
->s
, lpp
->l
);
946 CC_PaintCross(hDlg
, lpp
->h
, lpp
->s
);
947 CC_PaintTriangle(hDlg
, lpp
->l
);
952 case 0x2bf: /* edit notify HSL */
955 if (notifyCode
== EN_UPDATE
&& !lpp
->updating
)
957 i
= CC_CheckDigitsInEdit(hwndCtl
, wParam
== 0x2bf ? 239:240);
961 case 0x2bf: if ((xx
= ( i
!= lpp
->h
))) lpp
->h
= i
; break;
962 case 0x2c0: if ((xx
= ( i
!= lpp
->s
))) lpp
->s
= i
; break;
963 case 0x2c1: if ((xx
= ( i
!= lpp
->l
))) lpp
->l
= i
; break;
965 if (xx
) /* something has changed */
967 r
= CC_HSLtoRGB('R', lpp
->h
, lpp
->s
, lpp
->l
);
968 g
= CC_HSLtoRGB('G', lpp
->h
, lpp
->s
, lpp
->l
);
969 b
= CC_HSLtoRGB('B', lpp
->h
, lpp
->s
, lpp
->l
);
970 lpp
->lpcc
->rgbResult
= RGB(r
, g
, b
);
971 CC_PaintSelectedColor(hDlg
, lpp
->lpcc
->rgbResult
);
972 CC_EditSetRGB(hDlg
, lpp
->lpcc
->rgbResult
);
973 CC_PaintCross(hDlg
, lpp
->h
, lpp
->s
);
974 CC_PaintTriangle(hDlg
, lpp
->l
);
980 CC_SwitchToFullSize(hDlg
, lpp
->lpcc
->rgbResult
, &lpp
->fullsize
);
981 SetFocus( GetDlgItem(hDlg
, 0x2bf));
984 case 0x2c8: /* add colors ... column by column */
985 cr
= lpp
->lpcc
->lpCustColors
;
986 cr
[(lpp
->nextuserdef
% 2) * 8 + lpp
->nextuserdef
/ 2] = lpp
->lpcc
->rgbResult
;
987 if (++lpp
->nextuserdef
== 16)
988 lpp
->nextuserdef
= 0;
989 CC_PaintUserColorArray(hDlg
, 2, 8, lpp
->lpcc
->lpCustColors
);
992 case 0x2c9: /* resulting color */
994 lpp
->lpcc
->rgbResult
= GetNearestColor(hdc
, lpp
->lpcc
->rgbResult
);
995 ReleaseDC(hDlg
, hdc
);
996 CC_EditSetRGB(hDlg
, lpp
->lpcc
->rgbResult
);
997 CC_PaintSelectedColor(hDlg
, lpp
->lpcc
->rgbResult
);
998 r
= GetRValue(lpp
->lpcc
->rgbResult
);
999 g
= GetGValue(lpp
->lpcc
->rgbResult
);
1000 b
= GetBValue(lpp
->lpcc
->rgbResult
);
1001 lpp
->h
= CC_RGBtoHSL('H', r
, g
, b
);
1002 lpp
->s
= CC_RGBtoHSL('S', r
, g
, b
);
1003 lpp
->l
= CC_RGBtoHSL('L', r
, g
, b
);
1004 CC_EditSetHSL(hDlg
, lpp
->h
, lpp
->s
, lpp
->l
);
1005 CC_PaintCross(hDlg
, lpp
->h
, lpp
->s
);
1006 CC_PaintTriangle(hDlg
, lpp
->l
);
1009 case 0x40e: /* Help! */ /* The Beatles, 1965 ;-) */
1010 i
= RegisterWindowMessageA(HELPMSGSTRINGA
);
1011 if (lpp
->lpcc
->hwndOwner
)
1012 SendMessageA(lpp
->lpcc
->hwndOwner
, i
, 0, (LPARAM
)lpp
->lpcc
);
1013 if ( CC_HookCallChk(lpp
->lpcc
))
1014 CallWindowProcA( (WNDPROC
) lpp
->lpcc
->lpfnHook
, hDlg
,
1015 WM_COMMAND
, psh15
, (LPARAM
)lpp
->lpcc
);
1019 cokmsg
= RegisterWindowMessageA(COLOROKSTRINGA
);
1020 if (lpp
->lpcc
->hwndOwner
)
1021 if (SendMessageA(lpp
->lpcc
->hwndOwner
, cokmsg
, 0, (LPARAM
)lpp
->lpcc
))
1022 break; /* do NOT close */
1023 EndDialog(hDlg
, 1) ;
1027 EndDialog(hDlg
, 0) ;
1034 /***********************************************************************
1035 * CC_WMPaint [internal]
1037 LRESULT
CC_WMPaint( HWND hDlg
, WPARAM wParam
, LPARAM lParam
)
1041 LCCPRIV lpp
= (LCCPRIV
)GetWindowLongA(hDlg
, DWL_USER
);
1043 hdc
= BeginPaint(hDlg
, &ps
);
1044 /* we have to paint dialog children except text and buttons */
1045 CC_PaintPredefColorArray(hDlg
, 6, 8);
1046 CC_PaintUserColorArray(hDlg
, 2, 8, lpp
->lpcc
->lpCustColors
);
1047 CC_PaintLumBar(hDlg
, lpp
->h
, lpp
->s
);
1048 CC_PaintCross(hDlg
, lpp
->h
, lpp
->s
);
1049 CC_PaintTriangle(hDlg
, lpp
->l
);
1050 CC_PaintSelectedColor(hDlg
, lpp
->lpcc
->rgbResult
);
1051 CC_PaintColorGraph(hDlg
);
1052 EndPaint(hDlg
, &ps
);
1057 /***********************************************************************
1058 * CC_WMLButtonUp [internal]
1060 LRESULT
CC_WMLButtonUp( HWND hDlg
, WPARAM wParam
, LPARAM lParam
)
1062 LCCPRIV lpp
= (LCCPRIV
)GetWindowLongA(hDlg
, DWL_USER
);
1063 if (lpp
->capturedGraph
)
1065 lpp
->capturedGraph
= 0;
1067 CC_PaintCross(hDlg
, lpp
->h
, lpp
->s
);
1073 /***********************************************************************
1074 * CC_WMMouseMove [internal]
1076 LRESULT
CC_WMMouseMove( HWND hDlg
, LPARAM lParam
)
1078 LCCPRIV lpp
= (LCCPRIV
)GetWindowLongA(hDlg
, DWL_USER
);
1081 if (lpp
->capturedGraph
)
1083 int *ptrh
= NULL
, *ptrs
= &lpp
->l
;
1084 if (lpp
->capturedGraph
== 0x2c6)
1089 if (CC_MouseCheckColorGraph( hDlg
, lpp
->capturedGraph
, ptrh
, ptrs
, lParam
))
1091 r
= CC_HSLtoRGB('R', lpp
->h
, lpp
->s
, lpp
->l
);
1092 g
= CC_HSLtoRGB('G', lpp
->h
, lpp
->s
, lpp
->l
);
1093 b
= CC_HSLtoRGB('B', lpp
->h
, lpp
->s
, lpp
->l
);
1094 lpp
->lpcc
->rgbResult
= RGB(r
, g
, b
);
1095 CC_EditSetRGB(hDlg
, lpp
->lpcc
->rgbResult
);
1096 CC_EditSetHSL(hDlg
,lpp
->h
, lpp
->s
, lpp
->l
);
1097 CC_PaintCross(hDlg
, lpp
->h
, lpp
->s
);
1098 CC_PaintTriangle(hDlg
, lpp
->l
);
1099 CC_PaintSelectedColor(hDlg
, lpp
->lpcc
->rgbResult
);
1104 lpp
->capturedGraph
= 0;
1111 /***********************************************************************
1112 * CC_WMLButtonDown [internal]
1114 LRESULT
CC_WMLButtonDown( HWND hDlg
, WPARAM wParam
, LPARAM lParam
)
1116 LCCPRIV lpp
= (LCCPRIV
)GetWindowLongA(hDlg
, DWL_USER
);
1120 if (CC_MouseCheckPredefColorArray(lpp
, hDlg
, 0x2d0, 6, 8, lParam
))
1123 if (CC_MouseCheckUserColorArray(lpp
, hDlg
, 0x2d1, 2, 8, lParam
))
1126 if (CC_MouseCheckColorGraph(hDlg
, 0x2c6, &lpp
->h
, &lpp
->s
, lParam
))
1129 lpp
->capturedGraph
= 0x2c6;
1132 if (CC_MouseCheckColorGraph(hDlg
, 0x2be, NULL
, &lpp
->l
, lParam
))
1135 lpp
->capturedGraph
= 0x2be;
1140 r
= CC_HSLtoRGB('R', lpp
->h
, lpp
->s
, lpp
->l
);
1141 g
= CC_HSLtoRGB('G', lpp
->h
, lpp
->s
, lpp
->l
);
1142 b
= CC_HSLtoRGB('B', lpp
->h
, lpp
->s
, lpp
->l
);
1143 lpp
->lpcc
->rgbResult
= RGB(r
, g
, b
);
1147 r
= GetRValue(lpp
->lpcc
->rgbResult
);
1148 g
= GetGValue(lpp
->lpcc
->rgbResult
);
1149 b
= GetBValue(lpp
->lpcc
->rgbResult
);
1150 lpp
->h
= CC_RGBtoHSL('H', r
, g
, b
);
1151 lpp
->s
= CC_RGBtoHSL('S', r
, g
, b
);
1152 lpp
->l
= CC_RGBtoHSL('L', r
, g
, b
);
1156 CC_EditSetRGB(hDlg
, lpp
->lpcc
->rgbResult
);
1157 CC_EditSetHSL(hDlg
,lpp
->h
, lpp
->s
, lpp
->l
);
1158 CC_PaintCross(hDlg
, lpp
->h
, lpp
->s
);
1159 CC_PaintTriangle(hDlg
, lpp
->l
);
1160 CC_PaintSelectedColor(hDlg
, lpp
->lpcc
->rgbResult
);
1166 /***********************************************************************
1167 * ColorDlgProc32 [internal]
1170 static INT_PTR CALLBACK
ColorDlgProc( HWND hDlg
, UINT message
,
1171 WPARAM wParam
, LPARAM lParam
)
1175 LCCPRIV lpp
= (LCCPRIV
)GetWindowLongA(hDlg
, DWL_USER
);
1176 if (message
!= WM_INITDIALOG
)
1181 if (CC_HookCallChk(lpp
->lpcc
))
1182 res
= CallWindowProcA( (WNDPROC
)lpp
->lpcc
->lpfnHook
, hDlg
, message
, wParam
, lParam
);
1187 /* FIXME: SetRGB message
1188 if (message && message == msetrgb)
1189 return HandleSetRGB(hDlg, lParam);
1195 return CC_WMInitDialog(hDlg
, wParam
, lParam
);
1197 DeleteDC(lpp
->hdcMem
);
1198 DeleteObject(lpp
->hbmMem
);
1199 HeapFree(GetProcessHeap(), 0, lpp
);
1200 SetWindowLongA(hDlg
, DWL_USER
, 0L); /* we don't need it anymore */
1203 if (CC_WMCommand( hDlg
, wParam
, lParam
, HIWORD(wParam
), (HWND
) lParam
))
1207 if ( CC_WMPaint(hDlg
, wParam
, lParam
))
1210 case WM_LBUTTONDBLCLK
:
1211 if (CC_MouseCheckResultWindow(hDlg
, lParam
))
1215 if (CC_WMMouseMove(hDlg
, lParam
))
1218 case WM_LBUTTONUP
: /* FIXME: ClipCursor off (if in color graph)*/
1219 if (CC_WMLButtonUp(hDlg
, wParam
, lParam
))
1222 case WM_LBUTTONDOWN
:/* FIXME: ClipCursor on (if in color graph)*/
1223 if (CC_WMLButtonDown(hDlg
, wParam
, lParam
))
1230 /***********************************************************************
1231 * ChooseColorW (COMDLG32.@)
1233 BOOL WINAPI
ChooseColorW( LPCHOOSECOLORW lpChCol
)
1235 HANDLE hDlgTmpl
= 0;
1239 TRACE("ChooseColor\n");
1240 if (!lpChCol
) return FALSE
;
1242 if (lpChCol
->Flags
& CC_ENABLETEMPLATEHANDLE
)
1244 if (!(template = LockResource(lpChCol
->hInstance
)))
1246 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE
);
1250 else if (lpChCol
->Flags
& CC_ENABLETEMPLATE
)
1253 if (!(hResInfo
= FindResourceW((HINSTANCE
)lpChCol
->hInstance
,
1254 lpChCol
->lpTemplateName
,
1255 (LPWSTR
)RT_DIALOG
)))
1257 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE
);
1260 if (!(hDlgTmpl
= LoadResource((HINSTANCE
)lpChCol
->hInstance
, hResInfo
)) ||
1261 !(template = LockResource(hDlgTmpl
)))
1263 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE
);
1271 if (!(hResInfo
= FindResourceA(COMDLG32_hInstance
, "CHOOSE_COLOR", (LPSTR
)RT_DIALOG
)))
1273 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE
);
1276 if (!(hDlgTmpl
= LoadResource(COMDLG32_hInstance
, hResInfo
)) ||
1277 !(template = LockResource(hDlgTmpl
)))
1279 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE
);
1284 bRet
= DialogBoxIndirectParamW(COMDLG32_hInstance
, template, lpChCol
->hwndOwner
,
1285 ColorDlgProc
, (DWORD
)lpChCol
);
1289 /***********************************************************************
1290 * ChooseColorA (COMDLG32.@)
1292 BOOL WINAPI
ChooseColorA( LPCHOOSECOLORA lpChCol
)
1296 LPCHOOSECOLORW lpcc
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(CHOOSECOLORW
));
1297 lpcc
->lStructSize
= sizeof(*lpcc
);
1298 lpcc
->hwndOwner
= lpChCol
->hwndOwner
;
1299 lpcc
->hInstance
= lpChCol
->hInstance
;
1300 lpcc
->rgbResult
= lpChCol
->rgbResult
;
1301 lpcc
->lpCustColors
= lpChCol
->lpCustColors
;
1302 lpcc
->Flags
= lpChCol
->Flags
;
1303 lpcc
->lCustData
= lpChCol
->lCustData
;
1304 lpcc
->lpfnHook
= (LPCCHOOKPROC
) lpChCol
->lpfnHook
;
1305 if ((lpcc
->Flags
& CC_ENABLETEMPLATE
) && (lpChCol
->lpTemplateName
)) {
1306 if (HIWORD(lpChCol
->lpTemplateName
)) {
1307 INT len
= MultiByteToWideChar( CP_ACP
, 0, lpChCol
->lpTemplateName
, -1, NULL
, 0);
1308 lpcc
->lpTemplateName
= HeapAlloc( GetProcessHeap(), 0, len
* sizeof(WCHAR
) );
1309 MultiByteToWideChar( CP_ACP
, 0, lpChCol
->lpTemplateName
, -1, (LPWSTR
)lpcc
->lpTemplateName
, len
);
1311 lpcc
->lpTemplateName
= (LPWSTR
)lpChCol
->lpTemplateName
;
1315 ret
= ChooseColorW(lpcc
);
1318 lpChCol
->rgbResult
= lpcc
->rgbResult
;
1319 if (HIWORD(lpcc
->lpTemplateName
)) HeapFree(GetProcessHeap(), 0, (LPSTR
)lpcc
->lpTemplateName
);
1320 HeapFree(GetProcessHeap(), 0, lpcc
);