equal
deleted
inserted
replaced
11 " |
11 " |
12 "{ Package: 'stx:libtool2' }" |
12 "{ Package: 'stx:libtool2' }" |
13 |
13 |
14 SimpleDialog subclass:#ColorEditDialog |
14 SimpleDialog subclass:#ColorEditDialog |
15 instanceVariableNames:'red green blue hue light saturation colorNameHolder |
15 instanceVariableNames:'red green blue hue light saturation colorNameHolder |
16 htmlColorNameHolder' |
16 htmlColorNameHolder previewBox' |
17 classVariableNames:'' |
17 classVariableNames:'' |
18 poolDictionaries:'' |
18 poolDictionaries:'' |
19 category:'Interface-UIPainter' |
19 category:'Interface-UIPainter' |
20 ! |
20 ! |
21 |
21 |
52 editor accepted ifTrue:[ |
52 editor accepted ifTrue:[ |
53 editor color inspect. |
53 editor color inspect. |
54 ] |
54 ] |
55 [exEnd] |
55 [exEnd] |
56 " |
56 " |
|
57 ! ! |
|
58 |
|
59 !ColorEditDialog class methodsFor:'help specs'! |
|
60 |
|
61 flyByHelpSpec |
|
62 "This resource specification was automatically generated |
|
63 by the UIHelpTool of ST/X." |
|
64 |
|
65 "Do not manually edit this!! If it is corrupted, |
|
66 the UIHelpTool may not be able to read the specification." |
|
67 |
|
68 " |
|
69 UIHelpTool openOnClass:ColorEditDialog |
|
70 " |
|
71 |
|
72 <resource: #help> |
|
73 |
|
74 ^ super flyByHelpSpec addPairsFrom:#( |
|
75 |
|
76 #pickColor |
|
77 'Pick a Color from the Screen' |
|
78 |
|
79 ) |
|
80 ! |
|
81 |
|
82 helpSpec |
|
83 "This resource specification was automatically generated |
|
84 by the UIHelpTool of ST/X." |
|
85 |
|
86 "Do not manually edit this!! If it is corrupted, |
|
87 the UIHelpTool may not be able to read the specification." |
|
88 |
|
89 " |
|
90 UIHelpTool openOnClass:ColorEditDialog |
|
91 " |
|
92 |
|
93 <resource: #help> |
|
94 |
|
95 ^ super helpSpec addPairsFrom:#( |
|
96 |
|
97 #copyToClipboard |
|
98 'Copy the color to the clipboard' |
|
99 |
|
100 #hlsMixer |
|
101 'Mix color from hls (hue-light-saturation) components' |
|
102 |
|
103 #pasteFromClipboard |
|
104 'Paste color from the Clipboard' |
|
105 |
|
106 #rgbMixer |
|
107 'Mix color from rgb (red-green-blue) components' |
|
108 |
|
109 ) |
|
110 ! ! |
|
111 |
|
112 !ColorEditDialog class methodsFor:'image specs'! |
|
113 |
|
114 pickColorIcon |
|
115 ^ ToolbarIconLibrary pipette16x16Icon |
57 ! ! |
116 ! ! |
58 |
117 |
59 !ColorEditDialog class methodsFor:'interface specs'! |
118 !ColorEditDialog class methodsFor:'interface specs'! |
60 |
119 |
61 windowSpec |
120 windowSpec |
80 (WindowSpec |
139 (WindowSpec |
81 label: 'Define Color' |
140 label: 'Define Color' |
82 name: 'Define Color' |
141 name: 'Define Color' |
83 min: (Point 440 300) |
142 min: (Point 440 300) |
84 max: (Point 440 300) |
143 max: (Point 440 300) |
85 bounds: (Rectangle 0 0 436 300) |
144 bounds: (Rectangle 0 0 440 300) |
86 ) |
145 ) |
87 component: |
146 component: |
88 (SpecCollection |
147 (SpecCollection |
89 collection: ( |
148 collection: ( |
90 (VerticalPanelViewSpec |
149 (VerticalPanelViewSpec |
91 name: 'RGBLabelPanel' |
150 name: 'RGBLabelPanel' |
92 layout: (LayoutFrame 0 0 0 0 58 0 76 0) |
151 layout: (LayoutFrame 0 0 0 0 70 0 76 0) |
93 horizontalLayout: fit |
152 horizontalLayout: fit |
94 verticalLayout: spreadSpace |
153 verticalLayout: spreadSpace |
95 horizontalSpace: 3 |
154 horizontalSpace: 3 |
96 verticalSpace: 3 |
155 verticalSpace: 3 |
97 component: |
156 component: |
122 |
181 |
123 ) |
182 ) |
124 ) |
183 ) |
125 (VerticalPanelViewSpec |
184 (VerticalPanelViewSpec |
126 name: 'RGBSliderPanel' |
185 name: 'RGBSliderPanel' |
127 layout: (LayoutFrame 62 0 0 0 -177 1 76 0) |
186 layout: (LayoutFrame 70 0 0 0 -177 1 76 0) |
128 horizontalLayout: fit |
187 horizontalLayout: fit |
129 verticalLayout: spreadSpace |
188 verticalLayout: spreadSpace |
130 horizontalSpace: 3 |
189 horizontalSpace: 3 |
131 verticalSpace: 3 |
190 verticalSpace: 3 |
132 component: |
191 component: |
138 model: red |
197 model: red |
139 orientation: horizontal |
198 orientation: horizontal |
140 stop: 255 |
199 stop: 255 |
141 step: 1 |
200 step: 1 |
142 backgroundColor: (Color 100.0 0.0 0.0) |
201 backgroundColor: (Color 100.0 0.0 0.0) |
143 extent: (Point 197 16) |
202 extent: (Point 193 16) |
144 ) |
203 ) |
145 (SliderSpec |
204 (SliderSpec |
146 name: 'GreenSlider' |
205 name: 'GreenSlider' |
147 tabable: false |
206 tabable: false |
148 model: green |
207 model: green |
149 orientation: horizontal |
208 orientation: horizontal |
150 stop: 255 |
209 stop: 255 |
151 step: 1 |
210 step: 1 |
152 backgroundColor: (Color 0.0 100.0 0.0) |
211 backgroundColor: (Color 0.0 100.0 0.0) |
153 extent: (Point 197 16) |
212 extent: (Point 193 16) |
154 ) |
213 ) |
155 (SliderSpec |
214 (SliderSpec |
156 name: 'BlueSlider' |
215 name: 'BlueSlider' |
157 tabable: false |
216 tabable: false |
158 model: blue |
217 model: blue |
159 orientation: horizontal |
218 orientation: horizontal |
160 stop: 255 |
219 stop: 255 |
161 step: 1 |
220 step: 1 |
162 backgroundColor: (Color 0.0 0.0 100.0) |
221 backgroundColor: (Color 0.0 0.0 100.0) |
163 extent: (Point 197 16) |
222 extent: (Point 193 16) |
164 ) |
223 ) |
165 ) |
224 ) |
166 |
225 |
167 ) |
226 ) |
168 ) |
227 ) |
254 |
313 |
255 ) |
314 ) |
256 ) |
315 ) |
257 (VerticalPanelViewSpec |
316 (VerticalPanelViewSpec |
258 name: 'HLSLabelPanel' |
317 name: 'HLSLabelPanel' |
259 layout: (LayoutFrame 0 0 86 0 58 0 163 0) |
318 layout: (LayoutFrame 0 0 86 0 70 0 163 0) |
260 horizontalLayout: fit |
319 horizontalLayout: fit |
261 verticalLayout: spreadSpace |
320 verticalLayout: spreadSpace |
262 horizontalSpace: 3 |
321 horizontalSpace: 3 |
263 verticalSpace: 3 |
322 verticalSpace: 3 |
264 component: |
323 component: |
277 translateLabel: true |
336 translateLabel: true |
278 adjust: right |
337 adjust: right |
279 useDefaultExtent: true |
338 useDefaultExtent: true |
280 ) |
339 ) |
281 (LabelSpec |
340 (LabelSpec |
282 label: 'Sat:' |
341 label: 'Saturation:' |
283 name: 'Label3' |
342 name: 'Label3' |
284 translateLabel: true |
343 translateLabel: true |
285 adjust: right |
344 adjust: right |
286 useDefaultExtent: true |
345 useDefaultExtent: true |
287 ) |
346 ) |
289 |
348 |
290 ) |
349 ) |
291 ) |
350 ) |
292 (VerticalPanelViewSpec |
351 (VerticalPanelViewSpec |
293 name: 'HLSSliderPanel' |
352 name: 'HLSSliderPanel' |
294 layout: (LayoutFrame 62 0 86 0 -177 1 163 0) |
353 layout: (LayoutFrame 70 0 86 0 -177 1 163 0) |
295 horizontalLayout: fit |
354 horizontalLayout: fit |
296 verticalLayout: spreadSpace |
355 verticalLayout: spreadSpace |
297 horizontalSpace: 3 |
356 horizontalSpace: 3 |
298 verticalSpace: 3 |
357 verticalSpace: 3 |
299 component: |
358 component: |
305 model: hue |
364 model: hue |
306 orientation: horizontal |
365 orientation: horizontal |
307 stop: 359 |
366 stop: 359 |
308 step: 1 |
367 step: 1 |
309 keyboardStep: 1 |
368 keyboardStep: 1 |
310 extent: (Point 197 16) |
369 extent: (Point 193 16) |
311 ) |
370 ) |
312 (SliderSpec |
371 (SliderSpec |
313 name: 'Slider2' |
372 name: 'Slider2' |
314 tabable: false |
373 tabable: false |
315 model: light |
374 model: light |
316 orientation: horizontal |
375 orientation: horizontal |
317 step: 1 |
376 step: 1 |
318 backgroundColor: (Color 66.999313344015 66.999313344015 66.999313344015) |
377 backgroundColor: (Color 66.999313344015 66.999313344015 66.999313344015) |
319 keyboardStep: 1 |
378 keyboardStep: 1 |
320 extent: (Point 197 16) |
379 extent: (Point 193 16) |
321 ) |
380 ) |
322 (SliderSpec |
381 (SliderSpec |
323 name: 'Slider3' |
382 name: 'Slider3' |
324 tabable: false |
383 tabable: false |
325 model: saturation |
384 model: saturation |
326 orientation: horizontal |
385 orientation: horizontal |
327 step: 1 |
386 step: 1 |
328 backgroundColor: (Color 66.999313344015 66.999313344015 66.999313344015) |
387 backgroundColor: (Color 66.999313344015 66.999313344015 66.999313344015) |
329 keyboardStep: 1 |
388 keyboardStep: 1 |
330 extent: (Point 197 16) |
389 extent: (Point 193 16) |
331 ) |
390 ) |
332 ) |
391 ) |
333 |
392 |
334 ) |
393 ) |
335 ) |
394 ) |
376 ) |
435 ) |
377 |
436 |
378 ) |
437 ) |
379 ) |
438 ) |
380 (ViewSpec |
439 (ViewSpec |
381 name: 'Box1' |
440 name: 'PreviewBoxFrame' |
382 layout: (LayoutFrame -117 1 4 0.0 -3 1.0 -39 1.0) |
441 layout: (LayoutFrame -117 1 4 0.0 -3 1.0 -39 1.0) |
383 level: 1 |
442 level: 1 |
384 component: |
443 component: |
385 (SpecCollection |
444 (SpecCollection |
386 collection: ( |
445 collection: ( |
388 label: 'Preview' |
447 label: 'Preview' |
389 name: 'PreviewBox' |
448 name: 'PreviewBox' |
390 layout: (LayoutFrame 2 0.0 2 0.0 -2 1.0 -2 1.0) |
449 layout: (LayoutFrame 2 0.0 2 0.0 -2 1.0 -2 1.0) |
391 level: -1 |
450 level: -1 |
392 translateLabel: true |
451 translateLabel: true |
|
452 postBuildCallback: postBuildPreviewBox: |
393 ) |
453 ) |
394 ) |
454 ) |
395 |
455 |
396 ) |
456 ) |
397 ) |
457 ) |
466 ) |
526 ) |
467 (ActionButtonSpec |
527 (ActionButtonSpec |
468 label: 'Copy Color' |
528 label: 'Copy Color' |
469 name: 'CopyColor' |
529 name: 'CopyColor' |
470 layout: (LayoutFrame 12 0 236 0 100 0 258 0) |
530 layout: (LayoutFrame 12 0 236 0 100 0 258 0) |
|
531 activeHelpKey: hlsMixer |
471 translateLabel: true |
532 translateLabel: true |
472 resizeForLabel: true |
533 resizeForLabel: true |
473 tabable: true |
534 tabable: true |
474 model: copyColor |
535 model: copyColor |
475 ) |
536 ) |
480 translateLabel: true |
541 translateLabel: true |
481 resizeForLabel: true |
542 resizeForLabel: true |
482 tabable: true |
543 tabable: true |
483 model: pasteColor |
544 model: pasteColor |
484 ) |
545 ) |
|
546 (ActionButtonSpec |
|
547 label: 'pickColorIcon' |
|
548 name: 'Button1' |
|
549 layout: (LayoutFrame 285 0 236 0 312 0 263 0) |
|
550 activeHelpKey: pickColor |
|
551 hasCharacterOrientedLabel: false |
|
552 translateLabel: true |
|
553 resizeForLabel: true |
|
554 tabable: true |
|
555 model: pickColor |
|
556 ) |
485 ) |
557 ) |
486 |
558 |
487 ) |
559 ) |
488 ) |
560 ) |
489 ! ! |
561 ! ! |
511 ! ! |
583 ! ! |
512 |
584 |
513 !ColorEditDialog methodsFor:'actions'! |
585 !ColorEditDialog methodsFor:'actions'! |
514 |
586 |
515 colorChanged |
587 colorChanged |
516 |box clr| |
588 |clr| |
517 |
|
518 box := self componentAt: #PreviewBox. |
|
519 box isNil ifTrue:[^ self "called before setup"]. |
|
520 |
589 |
521 clr := self color. |
590 clr := self color. |
522 box backgroundColor:clr. |
591 self setPreview:clr. |
523 box foregroundColor:(clr brightness < 0.5 |
|
524 ifTrue:[Color white] |
|
525 ifFalse:[Color black]). |
|
526 |
|
527 self htmlColorNameHolder value:(clr htmlPrintString). |
592 self htmlColorNameHolder value:(clr htmlPrintString). |
528 ! |
593 ! |
529 |
594 |
530 colorNameChanged |
595 colorNameChanged |
531 "compute rgb and hls (if possible)" |
596 "compute rgb and hls (if possible)" |
578 copyBufferColor isColor ifFalse:[ |
643 copyBufferColor isColor ifFalse:[ |
579 self window beep. |
644 self window beep. |
580 ^ self |
645 ^ self |
581 ]. |
646 ]. |
582 self color:copyBufferColor |
647 self color:copyBufferColor |
|
648 ! |
|
649 |
|
650 pickColor |
|
651 |color| |
|
652 |
|
653 color := Color fromUserWithFeedBack:[:clr | self setPreview:clr]. |
|
654 color notNil ifTrue:[ |
|
655 self color:color. |
|
656 ] |
583 ! |
657 ! |
584 |
658 |
585 rgbSliderChanged |
659 rgbSliderChanged |
586 "compute hls" |
660 "compute hls" |
587 |
661 |
600 self light value:(l rounded) withoutNotifying:self. |
674 self light value:(l rounded) withoutNotifying:self. |
601 self saturation value:(s rounded) withoutNotifying:self. |
675 self saturation value:(s rounded) withoutNotifying:self. |
602 ]. |
676 ]. |
603 self colorNameHolder value:'' withoutNotifying:self. |
677 self colorNameHolder value:'' withoutNotifying:self. |
604 self colorChanged |
678 self colorChanged |
|
679 ! |
|
680 |
|
681 setPreview:color |
|
682 previewBox isNil ifTrue:[^ self "called before setup"]. |
|
683 |
|
684 previewBox backgroundColor:color. |
|
685 previewBox foregroundColor:(color brightness < 0.5 |
|
686 ifTrue:[Color white] |
|
687 ifFalse:[Color black]). |
605 ! ! |
688 ! ! |
606 |
689 |
607 !ColorEditDialog methodsFor:'aspects'! |
690 !ColorEditDialog methodsFor:'aspects'! |
608 |
691 |
609 blue |
692 blue |
691 ^ super update:something with:aParameter from:changedObject |
774 ^ super update:something with:aParameter from:changedObject |
692 ! ! |
775 ! ! |
693 |
776 |
694 !ColorEditDialog methodsFor:'startup & release'! |
777 !ColorEditDialog methodsFor:'startup & release'! |
695 |
778 |
|
779 postBuildPreviewBox:aView |
|
780 previewBox := aView |
|
781 ! |
|
782 |
696 postBuildWith:aBuilder |
783 postBuildWith:aBuilder |
697 super postBuildWith:aBuilder. |
784 super postBuildWith:aBuilder. |
698 self colorChanged. |
785 self colorChanged. |
699 |
786 |
700 "Modified: / 6.9.1998 / 22:55:25 / cg" |
787 "Modified: / 6.9.1998 / 22:55:25 / cg" |