forked from thesunRider/Reubus
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ColorChooser.au3
1511 lines (1315 loc) · 45.4 KB
/
ColorChooser.au3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#Region Header
#cs
Title: Color Chooser Dialog UDF Library for AutoIt3
Filename: ColorChooser.au3
Description: Creates a "Color Chooser" dialog box to select a custom color
Author: Yashied
Version: 1.1
Requirements: AutoIt v3.3 +, Developed/Tested on WindowsXP Pro Service Pack 2
Uses: Constants.au3, EditConstants.au3, GUIConstantsEx.au3, GDIPlus.au3, Memory.au3, StaticConstants.au3, WinAPI.au3, WindowsConstants.au3
Notes: The library registers (permanently) the following window message:
WM_COMMAND
WM_NCRBUTTONDOWN
WM_SETCURSOR
WM_SYSCOMMAND
Available functions:
_ColorChooserDialog
Example1:
#Include <ColorChooser.au3>
Opt('MustDeclareVars', 1)
Global $hForm, $Msg, $Label, $Button, $Data, $Color = 0x50CA1B
$hForm = GUICreate('MyGUI', 170, 200)
$Label = GUICtrlCreateLabel('', 15, 15, 140, 140, $SS_SUNKEN)
GUICtrlSetBkColor(-1, $Color)
$Button = GUICtrlCreateButton('Select color...', 35, 166, 100, 23)
GUISetState()
While 1
$Msg = GUIGetMsg()
Switch $Msg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $Button
$Data = _ColorChooserDialog($Color, $hForm)
If $Data > -1 Then
GUICtrlSetBkColor($Label, $Data)
$Color = $Data
EndIf
EndSwitch
WEnd
Example2 (required ColorPicker.au3):
#Include <ColorChooser.au3>
#Include <ColorPicker.au3>
Opt('MustDeclareVars', 1)
Global $hForm, $Msg, $Label, $Picker
$hForm = GUICreate('MyGUI', 170, 200)
$Label = GUICtrlCreateLabel('', 15, 15, 140, 140, $SS_SUNKEN)
GUICtrlSetBkColor(-1, 0x50CA1B)
$Picker = _GUIColorPicker_Create('', 55, 166, 60, 23, 0x50CA1B, BitOR($CP_FLAG_CHOOSERBUTTON, $CP_FLAG_MAGNIFICATION, $CP_FLAG_ARROWSTYLE), 0, -1, -1, 0, 'Simple Text', 'Custom...', '_ColorChooserDialog')
GUISetState()
While 1
$Msg = GUIGetMsg()
Switch $Msg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $Picker
GUICtrlSetBkColor($Label, _GUIColorPicker_GetColor($Picker))
EndSwitch
WEnd
#ce
#Include-once
#Include <Constants.au3>
#Include <EditConstants.au3>
#Include <GUIConstantsEx.au3>
#Include <GDIPlus.au3>
#Include <Memory.au3>
#Include <StaticConstants.au3>
#Include <WinAPI.au3>
#Include <WindowsConstants.au3>
#EndRegion Header
#Region Global Variables and Constants
Global Const $CC_FLAG_SOLIDCOLOR = 0x01
Global Const $CC_FLAG_CAPTURECOLOR = 0x02
Global Const $CC_FLAG_USERCOLOR = 0x40
Global Const $CC_FLAG_DEFAULT = BitOR($CC_FLAG_SOLIDCOLOR, $CC_FLAG_CAPTURECOLOR)
#EndRegion Global Variables and Constants
#Region Local Variables and Constants
Global Const $CC_REG_COMMONDATA = 'HKCU\SOFTWARE\Y''s\Common Data\Color Chooser\1.1\Palette'
Global Const $CC_WM_COMMAND = 0x0111
Global Const $CC_WM_NCRBUTTONDOWN = 0x00A4
Global Const $CC_WM_SETCURSOR = 0x0020
Global Const $CC_WM_SYSCOMMAND = 0x0112
Dim $ccData[29] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, Default, Default, 0, 0]
#cs
DO NOT USE THIS ARRAY IN THE SCRIPT, INTERNAL USE ONLY!
$ccData[0 ] - Handle to the "Color Chooser" window
[1 ] - The control ID of the main palette image control
[2 ] - The control ID of the arrow image control (left)
[3 ] - The control ID of the arrow image control (right)
[4 ] - The control ID of the HSB palette image control
[5 ] - The control ID of the solid color preview image control (left)
[6 ] - The control ID of the solid color preview image control (right)
[7 ] - The control ID of the picker image control
[8 ] - Handle to the left/right arrow image (HImage)
[9 ] - Handle to the cursor (uses ColorPicker.au3)
[10] - The control ID of the "R" (RGB) input
[11] - The control ID of the "G" (RGB) input
[12] - The control ID of the "B" (RGB) input
[13] - The control ID of the "H" (HSL) input
[14] - The control ID of the "S" (HSL) input
[15] - The control ID of the "L" (HSL) input
[16] - The control ID of the "H" (HSB) input
[17] - The control ID of the "S" (HSB) input
[18] - The control ID of the "B" (HSB) input
[19] - The control ID of the "#" (HEX) input
[20] - Passed/Initialization update value
[21] - Capture color, in RGB
[22] - Update input control flag
[23] - The control ID of the "OK" button control
[24] - The control ID of the Dummy control (input)
[25] - X-offset relative to the parent window (Optional)
[26] - Y-offset relative to the parent window (Optional)
[27] - The control ID of the Dummy control (dounle click item)
[28] - Reserved
#ce
Dim $ccPalette[21][3] = [[0, 1, 0]]
For $i = 1 To UBound($ccPalette) - 1
$ccPalette[$i][0] = -1
Next
#cs
DO NOT USE THIS ARRAY IN THE SCRIPT, INTERNAL USE ONLY!
$ccPalette[0][0] - Current selected item
[0][1] - Tooltip control flag (Optional)
[0][2] - Don't used
$ccPalette[i][0] - User color, in RGB
[i][1] - The control ID of the "User Color" image control
[i][2] - Reserved
#ce
Global $__CC_RGB[3], $__CC_HSL[3], $__CC_HSB[3]
Global $__CC_WM0111 = 0
Global $__CC_WM0020 = 0
#EndRegion Local Variables and Constants
#Region Initialization
; IMPORTANT! If you register the following window messages in your code, you should call handlers from this library until
; you return from your handlers, otherwise the Clor Chooser dialog box will not work properly. For example:
;
; Func MY_WM_SETCURSOR($hWnd, $iMsg, $wParam, $lParam)
; Local $Result = CC_WM_SETCURSOR($hWnd, $iMsg, $wParam, $lParam)
; If Not $Result Then
; Return 0
; EndIf
; ...
; Return $GUI_RUNDEFMSG
; EndFunc ;==>MY_WM_SETCURSOR
GUIRegisterMsg($CC_WM_COMMAND, 'CC_WM_COMMAND')
GUIRegisterMsg($CC_WM_NCRBUTTONDOWN, 'CC_WM_NCRBUTTONDOWN')
GUIRegisterMsg($CC_WM_SETCURSOR, 'CC_WM_SETCURSOR')
GUIRegisterMsg($CC_WM_SYSCOMMAND, 'CC_WM_SYSCOMMAND')
#EndRegion Initialization
#Region Public Functions
; #FUNCTION# ====================================================================================================================
; Name...........: _ColorChooserDialog
; Description....: Creates a "Color Chooser" dialog box that enables the user to select a color.
; Syntax.........: _ColorChooserDialog ( [$iColor [, $hParent [, $iRefType [, $iReturnType [, $iFlags [, $sTitle]]]]]] )
; Parameters.....: $iColor - Default selected color. Type of this parameter depends on the $iRefType value and
; should be one of the following types.
;
; RGB (Red, Green, Blue)
; Value of RGB color, like 0xRRGGBB.
;
; HSL (Hue, Saturation, Lightness)
; 3-item array of values for the Hue, Saturation, and Lightness, respectively.
;
; [0] - H (0-240)
; [1] - S (0-240)
; [2] - L (0-240)
;
; HSB (Hue, Saturation, Brightness)
; 3-item array of values for the Hue, Saturation, and Brightness, respectively.
;
; [0] - H (0-360)°
; [1] - S (0-100)%
; [2] - B (0-100)%
;
; $hParent - Handle to the window that owns the dialog box.
; $iRefType - Type of $iColor passed in, valid values:
; |0 - RGB
; |1 - HSL
; |2 - HSB
; $iReturnType - Determines return type, valid values:
; |0 - RGB
; |1 - HSL
; |2 - HSB
; $iFlags - The flags that defines a style of the "Color Chooser" dialog box. This parameter can be
; a combination of the following values.
;
; $CC_FLAG_SOLIDCOLOR
; $CC_FLAG_CAPTURECOLOR
; $CC_FLAG_USERCOLOR
; $CC_FLAG_DEFAULT
;
; (See constants section in this library)
;
; If this parameter contains $CC_FLAG_USERCOLOR flag, you can save up to 20 color values (in RGB).
; These values are in the following registry hive and will be available for other programs that
; use _ColorChooserDialog() function.
;
; HKEY_CURRENT_USER\SOFTWARE\Y's Common Data\Color Chooser\Palette
;
; $sTitle - Title of the "Color Chooser" dialog box.
; Return values..: Success - Selected color depending on value of the $iReturnType parameter (see above).
; Failure - (-1)
; Author.........: Yashied
; Modified.......:
; Remarks........: This function is fully compatible with the ColorPicker.au3 UDF library (v1.5) and can be used as a custom
; function for a "Color Chooser" dialog box (see examples). Since both these libraries use the same window messages,
; when using these messages in your code, you should refer to only one message from any library (see above).
; Related........:
; Link...........:
; Example........: Yes
; ===============================================================================================================================
Func _ColorChooserDialog($iColor = 0, $hParent = 0, $iRefType = 0, $iReturnType = 0, $iFlags = -1, $sTitle = 'Color')
_GDIPlus_Startup()
If $iFlags < 0 Then
$iFlags = $CC_FLAG_DEFAULT
EndIf
$ccData[8 ] = _Image_Arrow()
Local $hPopup = 0, $Msg, $Xp, $Yp, $Pos, $Cursor, $Index, $H1 = 0, $H2 = 0, $Pressed = False, $Return = False
Local $H1 = 69 * (BitAND($iFlags, $CC_FLAG_SOLIDCOLOR) = $CC_FLAG_SOLIDCOLOR)
LocaL $H2 = 56 * (BitAND($iFlags, $CC_FLAG_USERCOLOR) = $CC_FLAG_USERCOLOR)
Local $GUIOnEventMode = Opt('GUIOnEventMode', 0)
Local $GUICloseOnESC = Opt('GUICloseOnESC', 1)
GUISetState(@SW_DISABLE, $hParent)
$ccData[0 ] = GUICreate($sTitle, 315, 396 + $H1 + $H2, -1, -1, BitOR($WS_CAPTION, $WS_POPUP, $WS_SYSMENU), $WS_EX_DLGMODALFRAME, $hParent)
CC_SetChildPos($ccData[0], $hParent, $ccData[25], $ccData[26])
GUISetFont(9, 400, 0, 'Tahoma', $ccData[0])
$ccData[23] = GUICtrlCreateButton('OK', 115, 365 + $H1 + $H2, 85, 23)
GUICtrlSetFont(-1, 8.5, 400, 0, 'MS Shell Dlg')
GUICtrlSetState(-1, $GUI_DEFBUTTON)
$ccData[1 ] = GUICtrlCreatePic('', 20 , 20 , 243, 243, BitOR($GUI_SS_DEFAULT_PIC, $SS_SUNKEN))
If $ccData[9] Then
GUICtrlSetState(-1, $GUI_DISABLE)
EndIf
$ccData[2 ] = GUICtrlCreatePic('', 264, 17 , 8 , 249)
$ccData[3 ] = GUICtrlCreatePic('', 296, 17 , 8 , 249)
$ccData[4 ] = GUICtrlCreatePic('', 273, 20 , 22 , 243, BitOR($GUI_SS_DEFAULT_PIC, $SS_SUNKEN))
If BitAND($iFlags, $CC_FLAG_SOLIDCOLOR) Then
GUICtrlCreatePic('', 20, 273, 243, 59, BitOR($GUI_SS_DEFAULT_PIC, $SS_SUNKEN))
GUICtrlSetState(-1, $GUI_DISABLE)
$ccData[5] = GUICtrlCreatePic('', 21 , 274, 123, 57)
$ccData[6] = GUICtrlCreatePic('', 144, 274, 118, 57)
Else
$ccData[5] = 0
$ccData[6] = 0
EndIf
If BitAND($iFlags, $CC_FLAG_CAPTURECOLOR) Then
$ccData[7] = GUICtrlCreatePic('', 275, 273, 19 , 19)
Else
$ccData[7] = 0
EndIf
$ccPalette[0][0] = 0
If BitAND($iFlags, $CC_FLAG_USERCOLOR) Then
CC_LoadUserColor()
For $i = 1 To 2
For $j = 1 To 10
$Index = 10 * ($i - 1) + $j
$ccPalette[$Index][1] = GUICtrlCreatePic('', 18 + 25 * ($j - 1), 271 + 28 * ($i - 1) + $H1, 22, 22)
CC_SetUserColor($Index)
Next
Next
Else
For $i = 1 To 10
$ccPalette[$i][1] = 0
Next
EndIf
GUICtrlCreateLabel('R:', 19 , 279 + $H1 + $H2, 13, 14)
$ccData[10] = GUICtrlCreateInput('', 33 , 277 + $H1 + $H2, 34, 19)
GUICtrlCreateLabel('G:', 19 , 304 + $H1 + $H2, 13, 14)
$ccData[11] = GUICtrlCreateInput('', 33 , 302 + $H1 + $H2, 34, 19)
GUICtrlCreateLabel('B:', 19 , 329 + $H1 + $H2, 13, 14)
$ccData[12] = GUICtrlCreateInput('', 33 , 327 + $H1 + $H2, 34, 19)
GUICtrlCreateLabel('H:', 86 , 279 + $H1 + $H2, 13, 14)
$ccData[13] = GUICtrlCreateInput('', 100, 277 + $H1 + $H2, 34, 19)
GUICtrlCreateLabel('S:', 86 , 304 + $H1 + $H2, 13, 14)
$ccData[14] = GUICtrlCreateInput('', 100, 302 + $H1 + $H2, 34, 19)
GUICtrlCreateLabel('L:', 86 , 329 + $H1 + $H2, 13, 14)
$ccData[15] = GUICtrlCreateInput('', 100, 327 + $H1 + $H2, 34, 19)
GUICtrlCreateLabel('H:', 153, 279 + $H1 + $H2, 13, 14)
GUICtrlCreateLabel('°' , 202, 279 + $H1 + $H2, 14, 14)
$ccData[16] = GUICtrlCreateInput('', 167, 277 + $H1 + $H2, 34, 19)
GUICtrlCreateLabel('S:', 153, 304 + $H1 + $H2, 13, 14)
GUICtrlCreateLabel('%' , 202, 304 + $H1 + $H2, 14, 14)
$ccData[17] = GUICtrlCreateInput('', 167, 302 + $H1 + $H2, 34, 19)
GUICtrlCreateLabel('B:', 153, 329 + $H1 + $H2, 13, 14)
GUICtrlCreateLabel('%' , 202, 329 + $H1 + $H2, 14, 14)
$ccData[18] = GUICtrlCreateInput('', 167, 327 + $H1 + $H2, 34, 19)
GUICtrlCreateLabel('#' , 223, 279 + $H1 + $H2, 10, 14)
$ccData[19] = GUICtrlCreateInput('', 234, 277 + $H1 + $H2, 61, 19)
GUICtrlSetLimit(-1, 6)
$ccData[24] = GUICtrlCreateDummy()
$ccData[27] = GUICtrlCreateDummy()
For $i = 10 To 18
GUICtrlSetLimit($ccData[$i], 3)
Next
CC_SetPalette()
CC_SetPicker()
CC_ValidateColor($iColor, $iRefType)
CC_Update($ccData[20])
CC_SetColor($__CC_RGB)
GUISetState(@SW_SHOW, $ccData[0])
$ccData[22] = 0
While 1
$Msg = 0
$Cursor = GUIGetCursorInfo($ccData[0])
If (Not @error) And (BitAND(WinGetState($ccData[0]), 8)) Then
If $Cursor[2] Then
If $Cursor[4] = $ccData[1] Then
If Not $Pressed Then
$Msg = $GUI_EVENT_PRIMARYDOWN
EndIf
Else
$Pressed = 1
EndIf
Else
$Pressed = 0
EndIf
EndIf
If Not $Msg Then
$Msg = GUIGetMsg(1)
If $Msg[1] = $ccData[0] Then
$Msg = $Msg[0]
Else
ContinueLoop
EndIf
If $Msg = $GUI_EVENT_PRIMARYDOWN Then
ContinueLoop
EndIf
EndIf
Switch $Msg
Case $GUI_EVENT_PRIMARYDOWN
GUICtrlSetState($ccData[23], $GUI_FOCUS)
$Xp = Default
While CC_IsPressed(0x01)
$Pos = CC_GetCursor($ccData[1])
If Not @error Then
If ($Pos[0] <> $Xp) Or ($Pos[1] <> $Yp) Then
For $i = 1 To 2
$__CC_HSB[$i] = Round($Pos[$i - 1] / 240 * 100)
If $__CC_HSB[$i] > 100 Then
$__CC_HSB[$i] = 100
EndIf
If $__CC_HSB[$i] < 0 Then
$__CC_HSB[$i] = 0
EndIf
Next
$__CC_HSB[2] = 100 - $__CC_HSB[2]
CC_Update(3, 0)
$Xp = $Pos[0]
$Yp = $Pos[1]
EndIf
EndIf
WEnd
Case 0
ContinueLoop
Case $GUI_EVENT_CLOSE
ExitLoop
Case $ccData[2], $ccData[3], $ccData[4]
GUICtrlSetState($ccData[23], $GUI_FOCUS)
$Xp = Default
While CC_IsPressed(0x01)
$Pos = CC_GetCursor($ccData[2])
If Not @error Then
If $Pos[1] <> $Yp Then
$__CC_HSB[0] = Round((240 - $Pos[1] + 4) / 240 * 359)
If $__CC_HSB[0] > 359 Then
$__CC_HSB[0] = 359
EndIf
If $__CC_HSB[0] < 0 Then
$__CC_HSB[0] = 0
EndIf
CC_Update(3, 1)
$Xp = $Pos[0]
$Yp = $Pos[1]
EndIf
EndIf
WEnd
Case $ccData[7]
GUICtrlSetState($ccData[23], $GUI_FOCUS)
If Not $ccData[5] Then
$hPopup = GUICreate('', 95, 95, -1, -1, $WS_POPUP, $WS_EX_TOPMOST, $ccData[0])
GUISetBkColor(0x000000)
$ccData[5] = GUICtrlCreatePic('', 1, 1, 93, 93, $SS_WHITERECT)
GUICtrlSetState(-1, $GUI_DISABLE)
EndIf
$Xp = Default
While CC_IsPressed(0x01)
$Pos = CC_GetCursor()
If Not @error Then
If ($Pos[0] <> $Xp) Or ($Pos[1] <> $Yp) Then
If $hPopup Then
WinMove($hPopup, '', $Pos[0] + 16, $Pos[1] + 16)
If Not BitAND(WinGetState($hPopup), 2) Then
GUISetState(@SW_SHOWNOACTIVATE, $hPopup)
EndIf
CC_SetBitmap($ccData[5], CC_Capture($Pos[0] - 15, $Pos[1] - 15, 31, 31, 93, 93))
Else
CC_SetBitmap($ccData[5], CC_Capture($Pos[0] - 20, $Pos[1] - 9, 41, 19, 123, 57))
EndIf
$Xp = $Pos[0]
$Yp = $Pos[1]
EndIf
EndIf
WEnd
If $hPopup Then
GUIDelete($hPopup)
$ccData[5] = 0
EndIf
$__CC_RGB = CC_SplitColor($ccData[21])
CC_Update(1)
Case $ccData[23]
$Return = 1
ExitLoop
Case $ccData[24]
$Index = GUICtrlRead($ccData[24])
If $Index Then
CC_Update($Index, 1, 1)
EndIf
Case $ccData[27]
$Index = GUICtrlRead($ccData[27])
Switch $Index
Case 0
Case $ccData[1], $ccData[5]
If $ccPalette[0][0] Then
$ccPalette[$ccPalette[0][0]][0] = CC_RGB($__CC_RGB)
CC_SetUserColor($ccPalette[0][0], 1)
EndIf
Case $ccData[6]
CC_ValidateColor($iColor, $iRefType)
CC_Update($ccData[20])
Case Else
For $i = 1 To 20
If $Index = $ccPalette[$i][1] Then
If ($ccPalette[$i][0] > -1) And ($ccPalette[$i][0] <> CC_RGB($__CC_RGB)) Then
$__CC_RGB = CC_SplitColor($ccPalette[$i][0])
CC_Update(1)
EndIf
ExitLoop
EndIf
Next
EndSwitch
Case Else
For $i = 1 To 20
If $Msg = $ccPalette[$i][1] Then
If $i <> $ccPalette[0][0] Then
CC_SetUserColor($ccPalette[0][0])
CC_SetUserColor($i, 1)
$ccPalette[0][0] = $i
EndIf
ExitLoop
EndIf
Next
EndSwitch
WEnd
$ccData[22] = 1
GUISetState(@SW_ENABLE, $hParent)
GUIDelete($ccData[0])
$ccData[0 ] = 0
Opt('GUIOnEventMode', $GUIOnEventMode)
Opt('GUICloseOnESC', $GUICloseOnESC)
_GDIPlus_ImageDispose($ccData[8])
_GDIPlus_Shutdown()
If BitAND($iFlags, $CC_FLAG_USERCOLOR) Then
CC_SaveUserColor()
EndIf
If $Return Then
Switch $iReturnType
Case 1
Return $__CC_HSL
Case 2
Return $__CC_HSB
Case Else
Return CC_RGB($__CC_RGB)
EndSwitch
Else
Return -1
EndIf
EndFunc ;==>_ColorChooserDialog
#EndRegion Public Functions
#Region Internal Functions
Func CC_Beep()
DllCall('user32.dll', 'int', 'MessageBeep', 'int', 0)
EndFunc ;==>CC_Beep
Func CC_Capture($iX, $iY, $iSrcWidth, $iSrcHeight, $iDstWidth, $iDstHeight)
Local $tRECT, $hWnd, $hDC, $hSrcDC, $hDstDC, $hGraphics, $hBrush, $hPen, $hImage, $hBitmap, $hScreen
Local $Pos = CC_GetClientPos($ccData[0])
$hWnd = _WinAPI_GetDesktopWindow()
$hDC = _WinAPI_GetDC($hWnd)
$hSrcDC = _WinAPI_CreateCompatibleDC($hDC)
$hScreen = _WinAPI_CreateCompatibleBitmap($hDC, $iSrcWidth, $iSrcHeight)
_WinAPI_SelectObject($hSrcDC, $hScreen)
_WinAPI_BitBlt($hSrcDC, 0, 0, $iSrcWidth, $iSrcHeight, $hDC, $iX, $iY, $SRCCOPY)
$tRECT = DllStructCreate($tagRECT)
DllStructSetData($tRECT, 1, $Pos[0] - $iX + 21 )
DllStructSetData($tRECT, 2, $Pos[1] - $iY + 274)
DllStructSetData($tRECT, 3, $Pos[0] - $iX + 21 + 123)
DllStructSetData($tRECT, 4, $Pos[1] - $iY + 274 + 57 )
$hBrush = _WinAPI_CreateSolidBrush(0)
_WinAPI_FillRect($hSrcDC, DllStructGetPtr($tRECT), $hBrush)
_WinAPI_DeleteObject($hBrush)
$hDstDC = _WinAPI_CreateCompatibleDC($hDC)
$hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iDstWidth, $iDstHeight)
_WinAPI_SelectObject($hDstDC, $hBitmap)
DllCall('gdi32.dll', 'int', 'SetStretchBltMode', 'hwnd', $hDstDC, 'int', 3)
DllCall('gdi32.dll', 'int', 'StretchBlt', 'hwnd', $hDstDC, 'int', 0, 'int', 0, 'int', $iDstWidth, 'int', $iDstHeight, 'hwnd', $hSrcDC, 'int', 0, 'int', 0, 'int', $iSrcWidth, 'int', $iSrcHeight, 'dword', $SRCCOPY)
_WinAPI_ReleaseDC($hWnd, $hDC)
_WinAPI_DeleteDC($hDstDC)
_WinAPI_DeleteDC($hSrcDC)
_WinAPI_DeleteObject($hScreen)
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)
_WinAPI_DeleteObject($hBitmap)
$ccData[21] = __GDIPlus_BitmapGetPixel($hImage, $iDstWidth / 2, $iDstHeight / 2)
$hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage)
$hPen = _GDIPlus_PenCreate(0x60FF0000, 3)
_GDIPlus_GraphicsDrawLine($hGraphics, 0, $iDstHeight / 2, $iDstWidth / 2 - 4, $iDstHeight / 2, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphics, $iDstWidth / 2 + 5, $iDstHeight / 2, $iDstWidth, $iDstHeight / 2, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphics, $iDstWidth / 2, 0, $iDstWidth / 2, $iDstHeight / 2 - 4, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphics, $iDstWidth / 2, $iDstHeight / 2 + 5, $iDstWidth / 2, $iDstHeight, $hPen)
_GDIPlus_GraphicsDrawRect($hGraphics, $iDstWidth / 2 - 3, $iDstHeight / 2 - 3, 6, 6, $hPen)
_GDIPlus_PenDispose($hPen)
_GDIPlus_GraphicsDispose($hGraphics)
$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
_GDIPlus_ImageDispose($hImage)
Return $hBitmap
EndFunc ;==>CC_Capture
Func CC_GetBValue($iRGB)
Return BitAND($iRGB, 0x0000FF)
EndFunc ;==>CC_GetBValue
Func CC_GetClientPos($hWnd)
Local $Size = WinGetClientSize($hWnd)
If Not IsArray($Size) Then
Return SetError(1, 0, 0)
EndIf
Local $tPOINT = DllStructCreate($tagPOINT)
For $i = 1 To 2
DllStructSetData($tPOINT, $i, 0)
Next
_WinAPI_ClientToScreen($hWnd, $tPOINT)
If @error Then
Return SetError(1, 0, 0)
EndIf
Local $Pos[4]
For $i = 0 To 1
$Pos[$i] = DllStructGetData($tPOINT, $i + 1)
Next
For $i = 2 To 3
$Pos[$i] = $Size[$i - 2]
Next
Return $Pos
EndFunc ;==>CC_GetClientPos
Func CC_GetCursor($hWnd = 0)
If Not IsHWnd($hWnd) Then
$hWnd = GUICtrlGetHandle($hWnd)
EndIf
Local $tPOINT = _WinAPI_GetMousePos($hWnd, $hWnd)
If @error Then
Return SetError(1, 0, 0)
EndIf
Local $Pos[2]
For $i = 0 To 1
$Pos[$i] = DllStructGetData($tPOINT, $i + 1)
Next
Return $Pos
EndFunc ;==>CC_GetCursor
Func CC_GetGValue($iRGB)
Return BitShift(BitAND($iRGB, 0x00FF00), 8)
EndFunc ;==>CC_GetGValue
Func CC_GetRValue($iRGB)
Return BitShift(BitAND($iRGB, 0xFF0000), 16)
EndFunc ;==>CC_GetRValue
Func CC_IsDark($iRGB)
If CC_GetRValue($iRGB) + CC_GetGValue($iRGB) + CC_GetBValue($iRGB) < 3 * 255 / 2 Then
Return 1
Else
Return 0
EndIf
EndFunc ;==>CC_IsDark
Func CC_IsPressed($iKey)
Local $Ret = DllCall('user32.dll', 'short', 'GetAsyncKeyState', 'int', $iKey)
If @error Then
Return SetError(1, 0, 0)
EndIf
Return Number(BitAND($Ret[0], 0x8000) <> 0)
EndFunc ;==>CC_IsPressed
Func CC_LoadImageFromMem(ByRef $bImage)
Local $hImage, $hStream, $bData, $hData, $pData, $tData, $Lenght
$bData = Binary($bImage)
$Lenght = BinaryLen($bData)
$hData = _MemGlobalAlloc($Lenght, 2)
$pData = _MemGlobalLock($hData)
$tData = DllStructCreate('byte[' & $Lenght & ']', $pData)
DllStructSetData($tData, 1, $bData)
_MemGlobalUnlock($hData)
$hStream = DllCall('ole32.dll', 'int', 'CreateStreamOnHGlobal', 'ptr', $hData, 'int', 1, 'ptr*', 0)
$hImage = __GDIPlus_BitmapCreateFromStream($hStream[3])
; If Not $hImage Then
; _MemGlobalFree($hData)
; EndIf
Return $hImage
EndFunc ;==>CC_LoadImageFromMem
Func CC_LoadUserColor()
For $i = 1 To UBound($ccPalette) - 1
$ccPalette[$i][0] = RegRead($CC_REG_COMMONDATA, StringFormat('#%02d', $i))
If (@error) Or (BitAND(0xFF000000, $ccPalette[$i][0])) Then
$ccPalette[$i][0] = -1
EndIf
Next
EndFunc ;==>CC_LoadUserColor
Func CC_RGB($aRGB)
Return BitOR(BitShift($aRGB[0], -16), BitShift($aRGB[1], -8), $aRGB[2])
EndFunc ;==>CC_RGB
Func CC_SaveUserColor()
For $i = 1 To UBound($ccPalette) - 1
RegWrite($CC_REG_COMMONDATA, StringFormat('#%02d', $i), 'REG_DWORD', $ccPalette[$i][0])
Next
EndFunc ;==>CC_SaveUserColor
Func CC_SetBitmap($hWnd, $hBitmap)
If Not IsHWnd($hWnd) Then
$hWnd = GUICtrlGetHandle($hWnd)
If $hWnd = 0 Then
Return
EndIf
EndIf
Local $hObj
$hObj = _SendMessage($hWnd, 0x0172, 0, $hBitmap)
If $hObj Then
_WinAPI_DeleteObject($hObj)
EndIf
_WinAPI_InvalidateRect($hWnd)
$hObj = _SendMessage($hWnd, 0x0173)
If $hObj <> $hBitmap Then
_WinAPI_DeleteObject($hBitmap)
EndIf
EndFunc ;==>CC_SetBitmap
Func CC_SetChildPos($hChild, $hParent, $iX = Default, $iY = Default)
Local $Pos1, $Pos2 = CC_GetClientPos($hParent)
Local $tRECT, $Ret, $X, $Y, $Height
$Pos1 = WinGetPos($hChild)
If (@error) Or (Not IsArray($Pos2)) Then
Return SetError(1, 0, 0)
EndIf
If $iX = Default Then
$X = $Pos2[0] + ($Pos2[2] - $Pos1[2]) / 2
Else
$X = $Pos2[0] + $iX
EndIf
If $iY = Default Then
$Y = $Pos2[1] + ($Pos2[3] - $Pos1[3]) / 2
Else
$Y = $Pos2[1] + $iY
EndIf
$tRECT = DllStructCreate($tagRECT)
$Ret = DllCall('user32.dll', 'int', 'SystemParametersInfo', 'int', 48, 'int', 0, 'ptr', DllStructGetPtr($tRECT), 'int', 0)
If (@error) Or ($Ret[0] = 0) Then
$Height = @DesktopHeight
Else
$Height = DllStructGetData($tRECT, 4)
EndIf
If $X < 0 Then
$X = 0
EndIf
If $X > @DesktopWidth - $Pos1[2] Then
$X = @DesktopWidth - $Pos1[2]
EndIf
If $Y < 0 Then
$Y = 0
EndIf
If $Y > $Height - $Pos1[3] Then
$Y = $Height - $Pos1[3]
EndIf
If Not WinMove($hChild, '', $X, $Y) Then
Return SetError(1, 0, 0)
EndIf
Return 1
EndFunc ;==>CC_SetChildPos
Func CC_SetColor($RGB)
Local $hGraphics, $hBrush, $hImage, $hBitmap
$hBitmap = _WinAPI_CreateBitmap(118, 57, 1, 32)
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)
_WinAPI_DeleteObject($hBitmap)
$hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage)
$hBrush = _GDIPlus_BrushCreateSolid(BitOR(0xFF000000, CC_RGB($RGB)))
_GDIPlus_GraphicsFillRect($hGraphics, 0, 0, 118, 57, $hBrush)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_GraphicsDispose($hGraphics)
$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
_GDIPlus_ImageDispose($hImage)
CC_SetBitmap($ccData[6], $hBitmap)
EndFunc ;==>CC_SetColor
Func CC_SetPalette()
Local $hGraphics, $hPen, $hImage, $hBitmap
Local $ARGB, $RGB, $HSB[3]
$hBitmap = _WinAPI_CreateBitmap(20, 241, 1, 32)
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)
_WinAPI_DeleteObject($hBitmap)
$hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage)
$HSB[1] = 100
$HSB[2] = 100
For $i = 0 To 240
$HSB[0] = (240 - $i) * 359 / 240
$RGB = _HSB2RGB($HSB)
$hPen = _GDIPlus_PenCreate(BitOR(0xFF000000, CC_RGB($RGB)), 1)
_GDIPlus_GraphicsDrawLine($hGraphics, 0, $i, 19, $i, $hPen)
_GDIPlus_PenDispose($hPen)
Next
_GDIPlus_GraphicsDispose($hGraphics)
$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
_GDIPlus_ImageDispose($hImage)
CC_SetBitmap($ccData[4], $hBitmap)
EndFunc ;==>CC_SetPalette
Func CC_SetPicker()
Local $hGraphics, $hBrush, $hPicker, $hImage, $hBitmap
$hBitmap = _WinAPI_CreateBitmap(19, 19, 1, 32)
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)
_WinAPI_DeleteObject($hBitmap)
$hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage)
$hBrush = _GDIPlus_BrushCreateSolid(BitOR(0xFF000000, CC_SwitchColor(_WinAPI_GetSysColor($COLOR_3DFACE))))
_GDIPlus_GraphicsFillRect($hGraphics, 0, 0, 19, 19, $hBrush)
_GDIPlus_BrushDispose($hBrush)
$hPicker = _Image_Picker()
_GDIPlus_GraphicsDrawImageRect($hGraphics, $hPicker, 0, 0, 19, 19)
_GDIPlus_GraphicsDispose($hGraphics)
$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
_GDIPlus_ImageDispose($hPicker)
_GDIPlus_ImageDispose($hImage)
CC_SetBitmap($ccData[7], $hBitmap)
EndFunc ;==>CC_SetPicker
Func CC_SetUserColor($iIndex, $fSelect = 0)
Local $hGraphics, $hBrush, $hPen, $hImage, $hBitmap
$hBitmap = _WinAPI_CreateBitmap(22, 22, 1, 32)
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)
_WinAPI_DeleteObject($hBitmap)
$hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage)
$hBrush = _GDIPlus_BrushCreateSolid(BitOR(0xFF000000, CC_SwitchColor(_WinAPI_GetSysColor($COLOR_3DFACE))))
_GDIPlus_GraphicsFillRect($hGraphics, 0, 0, 22, 22, $hBrush)
$hPen = _GDIPlus_PenCreate(0xFFA7A7A7)
_GDIPlus_GraphicsDrawRect($hGraphics, 2, 2, 17, 17, $hPen)
If $fSelect Then
_GDIPlus_PenSetColor($hPen, 0xFF606060)
_GDIPlus_GraphicsDrawRect($hGraphics, 0, 0, 21, 21, $hPen)
EndIf
If $ccPalette[$iIndex][0] > -1 Then
_GDIPlus_BrushSetSolidColor($hBrush, BitOR(0xFF000000, $ccPalette[$iIndex][0]))
_GDIPlus_GraphicsFillRect($hGraphics, 3, 3, 16, 16, $hBrush)
If $ccPalette[0][1] Then
GUICtrlSetTip($ccPalette[$iIndex][1], '#' & Hex($ccPalette[$iIndex][0], 6))
EndIf
Else
If $ccPalette[0][1] Then
GUICtrlSetTip($ccPalette[$iIndex][1], 'None')
EndIf
EndIf
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_PenDispose($hPen)
_GDIPlus_GraphicsDispose($hGraphics)
$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
_GDIPlus_ImageDispose($hImage)
CC_SetBitmap($ccPalette[$iIndex][1], $hBitmap)
EndFunc ;==>CC_SetUserColor
Func CC_SplitColor($iColor)
Local $RGB[3]
$RGB[0] = CC_GetRValue($iColor)
$RGB[1] = CC_GetGValue($iColor)
$RGB[2] = CC_GetBValue($iColor)
Return $RGB
EndFunc ;==>CC_SplitColor
Func CC_SwitchColor($iColor)
Return BitOR(BitAND($iColor, 0x00FF00), BitShift(BitAND($iColor, 0x0000FF), -16), BitShift(BitAND($iColor, 0xFF0000), 16))
EndFunc ;==>CC_SwitchColor
Func CC_Update($iIndex, $fPalette = 1, $fSkip = 0)
Local $hGraphics, $hBrush, $hPen, $hImage, $hBitmap
Local $X, $Y, $ARGB, $RGB, $HSB
Switch $iIndex
Case 4 ; HEX
ContinueCase
Case 1 ; RGB
$__CC_HSL = _RGB2HSL($__CC_RGB)
$__CC_HSB = _RGB2HSB($__CC_RGB)
Case 2 ; HSL
$__CC_RGB = _HSL2RGB($__CC_HSL)
$__CC_HSB = _RGB2HSB($__CC_RGB)
Case 3 ; HSB
$__CC_RGB = _HSB2RGB($__CC_HSB)
$__CC_HSL = _RGB2HSL($__CC_RGB)
EndSwitch
If $fPalette Then
$hBitmap = _WinAPI_CreateBitmap(8, 249, 1, 32)
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)
_WinAPI_DeleteObject($hBitmap)
$hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage)
$hBrush = _GDIPlus_BrushCreateSolid(BitOR(0xFF000000, CC_SwitchColor(_WinAPI_GetSysColor($COLOR_3DFACE))))
_GDIPlus_GraphicsFillRect($hGraphics, 0, 0, 8, 249, $hBrush)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_GraphicsDrawImageRect($hGraphics, $ccData[8], 0, Round((359 - $__CC_HSB[0]) / 359 * 240), 8, 9)
_GDIPlus_GraphicsDispose($hGraphics)
$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
CC_SetBitmap($ccData[2], $hBitmap)
__GDIPlus_ImageRotateFlip($hImage, 4)
$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
_GDIPlus_ImageDispose($hImage)
CC_SetBitmap($ccData[3], $hBitmap)
EndIf
$HSB = $__CC_HSB
$HSB[1] = 100
$HSB[2] = 100
$RGB = _HSB2RGB($HSB)
$hBitmap = _WinAPI_CreateBitmap(241, 241, 1, 32)
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)
_WinAPI_DeleteObject($hBitmap)
$hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage)
$hBrush = __GDIPlus_LineBrushCreate(0, 0, 241, 0, 0xFFFFFFFF, BitOR(0xFF000000, CC_RGB($RGB)))
_GDIPlus_GraphicsFillRect($hGraphics, 0, 0, 241, 241, $hBrush)
_GDIPlus_BrushDispose($hBrush)
$hBrush = __GDIPlus_LineBrushCreate(0, 0, 0, 241, 0, 0xFF000000)
_GDIPlus_GraphicsFillRect($hGraphics, 0, 0, 241, 241, $hBrush)
_GDIPlus_BrushDispose($hBrush)
$X = Round($__CC_HSB[1] / 100 * 241)
$Y = Round((1 - $__CC_HSB[2] / 100) * 241)
If CC_IsDark(CC_RGB($__CC_RGB)) Then
$ARGB = 0xFFFFFFFF
Else
$ARGB = 0xFF000000
EndIf
$hPen = _GDIPlus_PenCreate($ARGB, 2)
_GDIPlus_GraphicsDrawLine($hGraphics, $X - 7, $Y, $X - 3, $Y, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphics, $X + 3, $Y, $X + 7, $Y, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphics, $X, $Y - 7, $X, $Y - 3, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphics, $X, $Y + 3, $X, $Y + 7, $hPen)
_GDIPlus_PenDispose($hPen)
_GDIPlus_GraphicsDispose($hGraphics)
$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
_GDIPlus_ImageDispose($hImage)
CC_SetBitmap($ccData[1], $hBitmap)
If $ccData[5] Then
$hBitmap = _WinAPI_CreateBitmap(123, 57, 1, 32)
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)
_WinAPI_DeleteObject($hBitmap)
$hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage)
$hBrush = _GDIPlus_BrushCreateSolid(BitOR(0xFF000000, CC_RGB($__CC_RGB)))
_GDIPlus_GraphicsFillRect($hGraphics, 0, 0, 123, 57, $hBrush)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_GraphicsDispose($hGraphics)
$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
_GDIPlus_ImageDispose($hImage)
CC_SetBitmap($ccData[5], $hBitmap)
EndIf
$ccData[22] = 1
If ($iIndex <> 1) Or (Not $fSkip) Then
For $i = 10 To 12
GUICtrlSetData($ccData[$i], $__CC_RGB[$i - 10])
Next
EndIf
If ($iIndex <> 2) Or (Not $fSkip) Then
For $i = 13 To 15
GUICtrlSetData($ccData[$i], $__CC_HSL[$i - 13])
Next
EndIf
If ($iIndex <> 3) Or (Not $fSkip) Then
For $i = 16 To 18
GUICtrlSetData($ccData[$i], $__CC_HSB[$i - 16])
Next
EndIf
If ($iIndex <> 4) Or (Not $fSkip) Then
GUICtrlSetData($ccData[19], Hex(CC_RGB($__CC_RGB), 6))
EndIf
$ccData[22] = 0
If Not $fSkip Then
GUICtrlSetState($ccData[23], $GUI_FOCUS)
EndIf
EndFunc ;==>CC_Update
Func CC_ValidateColor($iColor, $iType)
For $i = 0 To 2