author | Claus Gittinger <cg@exept.de> |
Mon, 18 Oct 2010 14:25:30 +0200 | |
changeset 2807 | b89a09017a97 |
parent 2574 | ae2448675efb |
child 2831 | 3dbef5687ae6 |
permissions | -rw-r--r-- |
1840 | 1 |
" |
2 |
COPYRIGHT (c) 1995 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
"{ Package: 'stx:libtool2' }" |
|
13 |
||
14 |
SimpleDialog subclass:#ColorEditDialog |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
15 |
instanceVariableNames:'red green blue hue light saturation colorNameHolder |
2266
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
16 |
htmlColorNameHolder previewBox' |
1840 | 17 |
classVariableNames:'' |
18 |
poolDictionaries:'' |
|
19 |
category:'Interface-UIPainter' |
|
20 |
! |
|
21 |
||
22 |
!ColorEditDialog class methodsFor:'documentation'! |
|
23 |
||
24 |
copyright |
|
25 |
" |
|
26 |
COPYRIGHT (c) 1995 by eXept Software AG |
|
27 |
All Rights Reserved |
|
28 |
||
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
! |
|
37 |
||
38 |
documentation |
|
39 |
" |
|
40 |
An edit-dialog for colors. |
|
41 |
" |
|
42 |
! |
|
43 |
||
44 |
examples |
|
45 |
" |
|
46 |
[exBegin] |
|
47 |
|editor color| |
|
48 |
||
1846 | 49 |
editor := ColorEditDialog new. |
1840 | 50 |
editor color:(Color green). |
51 |
editor open. |
|
52 |
editor accepted ifTrue:[ |
|
53 |
editor color inspect. |
|
54 |
] |
|
55 |
[exEnd] |
|
56 |
" |
|
57 |
! ! |
|
58 |
||
2266
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
59 |
!ColorEditDialog class methodsFor:'help specs'! |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
60 |
|
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
61 |
flyByHelpSpec |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
62 |
"This resource specification was automatically generated |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
63 |
by the UIHelpTool of ST/X." |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
64 |
|
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
65 |
"Do not manually edit this!! If it is corrupted, |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
66 |
the UIHelpTool may not be able to read the specification." |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
67 |
|
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
68 |
" |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
69 |
UIHelpTool openOnClass:ColorEditDialog |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
70 |
" |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
71 |
|
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
72 |
<resource: #help> |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
73 |
|
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
74 |
^ super flyByHelpSpec addPairsFrom:#( |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
75 |
|
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
76 |
#pickColor |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
77 |
'Pick a Color from the Screen' |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
78 |
|
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
79 |
) |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
80 |
! |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
81 |
|
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
82 |
helpSpec |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
83 |
"This resource specification was automatically generated |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
84 |
by the UIHelpTool of ST/X." |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
85 |
|
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
86 |
"Do not manually edit this!! If it is corrupted, |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
87 |
the UIHelpTool may not be able to read the specification." |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
88 |
|
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
89 |
" |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
90 |
UIHelpTool openOnClass:ColorEditDialog |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
91 |
" |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
92 |
|
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
93 |
<resource: #help> |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
94 |
|
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
95 |
^ super helpSpec addPairsFrom:#( |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
96 |
|
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
97 |
#copyToClipboard |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
98 |
'Copy the color to the clipboard' |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
99 |
|
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
100 |
#hlsMixer |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
101 |
'Mix color from hls (hue-light-saturation) components' |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
102 |
|
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
103 |
#pasteFromClipboard |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
104 |
'Paste color from the Clipboard' |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
105 |
|
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
106 |
#rgbMixer |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
107 |
'Mix color from rgb (red-green-blue) components' |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
108 |
|
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
109 |
) |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
110 |
! ! |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
111 |
|
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
112 |
!ColorEditDialog class methodsFor:'image specs'! |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
113 |
|
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
114 |
pickColorIcon |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
115 |
^ ToolbarIconLibrary pipette16x16Icon |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
116 |
! ! |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
117 |
|
1840 | 118 |
!ColorEditDialog class methodsFor:'interface specs'! |
119 |
||
120 |
windowSpec |
|
121 |
"This resource specification was automatically generated |
|
122 |
by the UIPainter of ST/X." |
|
123 |
||
124 |
"Do not manually edit this!! If it is corrupted, |
|
125 |
the UIPainter may not be able to read the specification." |
|
126 |
||
127 |
" |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
128 |
UIPainter new openOnClass:ColorEditDialog andSelector:#windowSpec |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
129 |
ColorEditDialog new openInterface:#windowSpec |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
130 |
ColorEditDialog open |
1840 | 131 |
" |
132 |
||
133 |
<resource: #canvas> |
|
134 |
||
135 |
^ |
|
136 |
#(FullSpec |
|
137 |
name: windowSpec |
|
138 |
window: |
|
139 |
(WindowSpec |
|
140 |
label: 'Define Color' |
|
141 |
name: 'Define Color' |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
142 |
min: (Point 440 300) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
143 |
max: (Point 440 300) |
2266
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
144 |
bounds: (Rectangle 0 0 440 300) |
1840 | 145 |
) |
146 |
component: |
|
147 |
(SpecCollection |
|
148 |
collection: ( |
|
149 |
(VerticalPanelViewSpec |
|
150 |
name: 'RGBLabelPanel' |
|
2266
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
151 |
layout: (LayoutFrame 0 0 0 0 70 0 76 0) |
1840 | 152 |
horizontalLayout: fit |
153 |
verticalLayout: spreadSpace |
|
154 |
horizontalSpace: 3 |
|
155 |
verticalSpace: 3 |
|
156 |
component: |
|
157 |
(SpecCollection |
|
158 |
collection: ( |
|
159 |
(LabelSpec |
|
160 |
label: 'Red:' |
|
161 |
name: 'RedLabel' |
|
162 |
translateLabel: true |
|
163 |
adjust: right |
|
164 |
useDefaultExtent: true |
|
165 |
) |
|
166 |
(LabelSpec |
|
167 |
label: 'Green:' |
|
168 |
name: 'GreenLabel' |
|
169 |
translateLabel: true |
|
170 |
adjust: right |
|
171 |
useDefaultExtent: true |
|
172 |
) |
|
173 |
(LabelSpec |
|
174 |
label: 'Blue:' |
|
175 |
name: 'BlueLabel' |
|
176 |
translateLabel: true |
|
177 |
adjust: right |
|
178 |
useDefaultExtent: true |
|
179 |
) |
|
180 |
) |
|
181 |
||
182 |
) |
|
183 |
) |
|
184 |
(VerticalPanelViewSpec |
|
185 |
name: 'RGBSliderPanel' |
|
2266
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
186 |
layout: (LayoutFrame 70 0 0 0 -177 1 76 0) |
1840 | 187 |
horizontalLayout: fit |
188 |
verticalLayout: spreadSpace |
|
189 |
horizontalSpace: 3 |
|
190 |
verticalSpace: 3 |
|
191 |
component: |
|
192 |
(SpecCollection |
|
193 |
collection: ( |
|
194 |
(SliderSpec |
|
195 |
name: 'RedSlider' |
|
196 |
tabable: false |
|
197 |
model: red |
|
198 |
orientation: horizontal |
|
199 |
stop: 255 |
|
200 |
step: 1 |
|
201 |
backgroundColor: (Color 100.0 0.0 0.0) |
|
2266
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
202 |
extent: (Point 193 16) |
1840 | 203 |
) |
204 |
(SliderSpec |
|
205 |
name: 'GreenSlider' |
|
206 |
tabable: false |
|
207 |
model: green |
|
208 |
orientation: horizontal |
|
209 |
stop: 255 |
|
210 |
step: 1 |
|
211 |
backgroundColor: (Color 0.0 100.0 0.0) |
|
2266
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
212 |
extent: (Point 193 16) |
1840 | 213 |
) |
214 |
(SliderSpec |
|
215 |
name: 'BlueSlider' |
|
216 |
tabable: false |
|
217 |
model: blue |
|
218 |
orientation: horizontal |
|
219 |
stop: 255 |
|
220 |
step: 1 |
|
221 |
backgroundColor: (Color 0.0 0.0 100.0) |
|
2266
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
222 |
extent: (Point 193 16) |
1840 | 223 |
) |
224 |
) |
|
225 |
||
226 |
) |
|
227 |
) |
|
228 |
(VerticalPanelViewSpec |
|
229 |
name: 'RGBFieldPanel' |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
230 |
layout: (LayoutFrame -173 1 0 0 -143 1 76 0) |
1840 | 231 |
horizontalLayout: fit |
232 |
verticalLayout: spreadSpace |
|
233 |
horizontalSpace: 3 |
|
234 |
verticalSpace: 3 |
|
235 |
component: |
|
236 |
(SpecCollection |
|
237 |
collection: ( |
|
238 |
(InputFieldSpec |
|
239 |
name: 'RedField' |
|
240 |
model: red |
|
241 |
type: numberInRange |
|
242 |
numChars: 3 |
|
243 |
minValue: 0 |
|
244 |
maxValue: 255 |
|
245 |
acceptOnPointerLeave: false |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
246 |
extent: (Point 30 20) |
1840 | 247 |
) |
248 |
(InputFieldSpec |
|
249 |
name: 'GreenField' |
|
250 |
model: green |
|
251 |
type: numberInRange |
|
252 |
numChars: 3 |
|
253 |
minValue: 0 |
|
254 |
maxValue: 255 |
|
255 |
acceptOnPointerLeave: false |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
256 |
extent: (Point 30 20) |
1840 | 257 |
) |
258 |
(InputFieldSpec |
|
259 |
name: 'BlueField' |
|
260 |
model: blue |
|
261 |
type: numberInRange |
|
262 |
numChars: 3 |
|
263 |
minValue: 0 |
|
264 |
maxValue: 255 |
|
265 |
acceptOnPointerLeave: false |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
266 |
extent: (Point 30 20) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
267 |
) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
268 |
) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
269 |
|
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
270 |
) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
271 |
) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
272 |
(VerticalPanelViewSpec |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
273 |
name: 'RGBFieldPanelHex' |
2274 | 274 |
layout: (LayoutFrame -141 1 0 0 -119 1 76 0) |
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
275 |
horizontalLayout: fit |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
276 |
verticalLayout: spreadSpace |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
277 |
horizontalSpace: 3 |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
278 |
verticalSpace: 3 |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
279 |
component: |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
280 |
(SpecCollection |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
281 |
collection: ( |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
282 |
(InputFieldSpec |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
283 |
name: 'EntryField4' |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
284 |
model: red |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
285 |
type: hexIntegerInRange |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
286 |
numChars: 3 |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
287 |
minValue: 0 |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
288 |
maxValue: 255 |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
289 |
acceptOnPointerLeave: false |
2274 | 290 |
extent: (Point 22 20) |
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
291 |
) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
292 |
(InputFieldSpec |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
293 |
name: 'EntryField5' |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
294 |
model: green |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
295 |
type: hexIntegerInRange |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
296 |
numChars: 3 |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
297 |
minValue: 0 |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
298 |
maxValue: 255 |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
299 |
acceptOnPointerLeave: false |
2274 | 300 |
extent: (Point 22 20) |
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
301 |
) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
302 |
(InputFieldSpec |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
303 |
name: 'EntryField6' |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
304 |
model: blue |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
305 |
type: hexIntegerInRange |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
306 |
numChars: 3 |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
307 |
minValue: 0 |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
308 |
maxValue: 255 |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
309 |
acceptOnPointerLeave: false |
2274 | 310 |
extent: (Point 22 20) |
1840 | 311 |
) |
312 |
) |
|
313 |
||
314 |
) |
|
315 |
) |
|
316 |
(VerticalPanelViewSpec |
|
317 |
name: 'HLSLabelPanel' |
|
2266
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
318 |
layout: (LayoutFrame 0 0 86 0 70 0 163 0) |
1840 | 319 |
horizontalLayout: fit |
320 |
verticalLayout: spreadSpace |
|
321 |
horizontalSpace: 3 |
|
322 |
verticalSpace: 3 |
|
323 |
component: |
|
324 |
(SpecCollection |
|
325 |
collection: ( |
|
326 |
(LabelSpec |
|
327 |
label: 'Hue:' |
|
328 |
name: 'Label1' |
|
329 |
translateLabel: true |
|
330 |
adjust: right |
|
331 |
useDefaultExtent: true |
|
332 |
) |
|
333 |
(LabelSpec |
|
334 |
label: 'Light:' |
|
335 |
name: 'Label2' |
|
336 |
translateLabel: true |
|
337 |
adjust: right |
|
338 |
useDefaultExtent: true |
|
339 |
) |
|
340 |
(LabelSpec |
|
2266
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
341 |
label: 'Saturation:' |
1840 | 342 |
name: 'Label3' |
343 |
translateLabel: true |
|
344 |
adjust: right |
|
345 |
useDefaultExtent: true |
|
346 |
) |
|
347 |
) |
|
348 |
||
349 |
) |
|
350 |
) |
|
351 |
(VerticalPanelViewSpec |
|
352 |
name: 'HLSSliderPanel' |
|
2266
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
353 |
layout: (LayoutFrame 70 0 86 0 -177 1 163 0) |
1840 | 354 |
horizontalLayout: fit |
355 |
verticalLayout: spreadSpace |
|
356 |
horizontalSpace: 3 |
|
357 |
verticalSpace: 3 |
|
358 |
component: |
|
359 |
(SpecCollection |
|
360 |
collection: ( |
|
361 |
(SliderSpec |
|
362 |
name: 'Slider1' |
|
363 |
tabable: false |
|
364 |
model: hue |
|
365 |
orientation: horizontal |
|
366 |
stop: 359 |
|
367 |
step: 1 |
|
368 |
keyboardStep: 1 |
|
2266
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
369 |
extent: (Point 193 16) |
1840 | 370 |
) |
371 |
(SliderSpec |
|
372 |
name: 'Slider2' |
|
373 |
tabable: false |
|
374 |
model: light |
|
375 |
orientation: horizontal |
|
376 |
step: 1 |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
377 |
backgroundColor: (Color 66.999313344015 66.999313344015 66.999313344015) |
1840 | 378 |
keyboardStep: 1 |
2266
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
379 |
extent: (Point 193 16) |
1840 | 380 |
) |
381 |
(SliderSpec |
|
382 |
name: 'Slider3' |
|
383 |
tabable: false |
|
384 |
model: saturation |
|
385 |
orientation: horizontal |
|
386 |
step: 1 |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
387 |
backgroundColor: (Color 66.999313344015 66.999313344015 66.999313344015) |
1840 | 388 |
keyboardStep: 1 |
2266
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
389 |
extent: (Point 193 16) |
1840 | 390 |
) |
391 |
) |
|
392 |
||
393 |
) |
|
394 |
) |
|
395 |
(VerticalPanelViewSpec |
|
396 |
name: 'HLSFieldPanel' |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
397 |
layout: (LayoutFrame -173 1 86 0 -143 1 163 0) |
1840 | 398 |
horizontalLayout: fit |
399 |
verticalLayout: spreadSpace |
|
400 |
horizontalSpace: 3 |
|
401 |
verticalSpace: 3 |
|
402 |
component: |
|
403 |
(SpecCollection |
|
404 |
collection: ( |
|
405 |
(InputFieldSpec |
|
406 |
name: 'EntryField1' |
|
407 |
model: hue |
|
408 |
type: numberInRange |
|
409 |
numChars: 3 |
|
410 |
minValue: 0 |
|
411 |
maxValue: 359 |
|
412 |
acceptOnPointerLeave: false |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
413 |
extent: (Point 30 20) |
1840 | 414 |
) |
415 |
(InputFieldSpec |
|
416 |
name: 'EntryField2' |
|
417 |
model: light |
|
418 |
type: numberInRange |
|
419 |
numChars: 3 |
|
420 |
minValue: 0 |
|
421 |
maxValue: 100 |
|
422 |
acceptOnPointerLeave: false |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
423 |
extent: (Point 30 20) |
1840 | 424 |
) |
425 |
(InputFieldSpec |
|
426 |
name: 'EntryField3' |
|
427 |
model: saturation |
|
428 |
type: numberInRange |
|
429 |
numChars: 3 |
|
430 |
minValue: 0 |
|
431 |
maxValue: 100 |
|
432 |
acceptOnPointerLeave: false |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
433 |
extent: (Point 30 20) |
1840 | 434 |
) |
435 |
) |
|
436 |
||
437 |
) |
|
438 |
) |
|
439 |
(ViewSpec |
|
2266
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
440 |
name: 'PreviewBoxFrame' |
1840 | 441 |
layout: (LayoutFrame -117 1 4 0.0 -3 1.0 -39 1.0) |
442 |
level: 1 |
|
443 |
component: |
|
444 |
(SpecCollection |
|
445 |
collection: ( |
|
446 |
(LabelSpec |
|
447 |
label: 'Preview' |
|
448 |
name: 'PreviewBox' |
|
449 |
layout: (LayoutFrame 2 0.0 2 0.0 -2 1.0 -2 1.0) |
|
450 |
level: -1 |
|
451 |
translateLabel: true |
|
2266
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
452 |
postBuildCallback: postBuildPreviewBox: |
1840 | 453 |
) |
454 |
) |
|
455 |
||
456 |
) |
|
457 |
) |
|
458 |
(LabelSpec |
|
459 |
label: 'Color Name:' |
|
460 |
name: 'ColorNameLabel' |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
461 |
layout: (LayoutFrame 0 0 176 0 106 0 198 0) |
1840 | 462 |
translateLabel: true |
463 |
adjust: right |
|
464 |
) |
|
465 |
(InputFieldSpec |
|
466 |
name: 'ColorNameField' |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
467 |
layout: (LayoutFrame 108 0 176 0 -162 1 198 0) |
1840 | 468 |
model: colorNameHolder |
2326
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
469 |
immediateAccept: false |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
470 |
acceptOnReturn: true |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
471 |
acceptOnTab: true |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
472 |
acceptOnLostFocus: true |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
473 |
acceptOnPointerLeave: true |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
474 |
) |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
475 |
(LabelSpec |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
476 |
label: 'HTML Color Name:' |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
477 |
name: 'HTMLColorNameLabel' |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
478 |
layout: (LayoutFrame 4 0 204 0 110 0 226 0) |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
479 |
translateLabel: true |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
480 |
adjust: right |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
481 |
) |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
482 |
(InputFieldSpec |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
483 |
name: 'MLHTColorNameFieldField' |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
484 |
layout: (LayoutFrame 108 0 204 0 -162 1 226 0) |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
485 |
model: htmlColorNameHolder |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
486 |
immediateAccept: false |
1840 | 487 |
acceptOnReturn: true |
488 |
acceptOnTab: true |
|
489 |
acceptOnLostFocus: true |
|
2326
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
490 |
acceptOnPointerLeave: true |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
491 |
) |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
492 |
(ActionButtonSpec |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
493 |
label: 'Copy Color' |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
494 |
name: 'CopyColor' |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
495 |
layout: (LayoutFrame 12 0 236 0 100 0 258 0) |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
496 |
activeHelpKey: hlsMixer |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
497 |
translateLabel: true |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
498 |
resizeForLabel: true |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
499 |
tabable: true |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
500 |
model: copyColor |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
501 |
) |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
502 |
(ActionButtonSpec |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
503 |
label: 'Paste Color' |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
504 |
name: 'PasteColor' |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
505 |
layout: (LayoutFrame 108 0 236 0 196 0 258 0) |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
506 |
translateLabel: true |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
507 |
resizeForLabel: true |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
508 |
tabable: true |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
509 |
model: pasteColor |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
510 |
) |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
511 |
(ActionButtonSpec |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
512 |
label: 'pickColorIcon' |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
513 |
name: 'Button1' |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
514 |
layout: (LayoutFrame 285 0 236 0 312 0 263 0) |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
515 |
activeHelpKey: pickColor |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
516 |
hasCharacterOrientedLabel: false |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
517 |
translateLabel: true |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
518 |
resizeForLabel: true |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
519 |
tabable: true |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
520 |
model: pickColor |
1840 | 521 |
) |
522 |
(HorizontalPanelViewSpec |
|
523 |
name: 'HorizontalPanel1' |
|
524 |
layout: (LayoutFrame 0 0.0 -32 1 0 1.0 0 1.0) |
|
525 |
horizontalLayout: fitSpace |
|
526 |
verticalLayout: centerMax |
|
527 |
horizontalSpace: 3 |
|
528 |
verticalSpace: 3 |
|
529 |
reverseOrderIfOKAtLeft: true |
|
530 |
component: |
|
531 |
(SpecCollection |
|
532 |
collection: ( |
|
533 |
(ActionButtonSpec |
|
534 |
label: 'Cancel' |
|
535 |
name: 'CancelButton' |
|
536 |
translateLabel: true |
|
537 |
resizeForLabel: false |
|
538 |
tabable: true |
|
539 |
model: cancel |
|
540 |
useDefaultExtent: true |
|
541 |
) |
|
542 |
(ActionButtonSpec |
|
543 |
label: 'OK' |
|
544 |
name: 'OKButton' |
|
545 |
translateLabel: true |
|
546 |
resizeForLabel: false |
|
547 |
tabable: true |
|
548 |
model: accept |
|
549 |
isDefault: true |
|
550 |
defaultable: true |
|
551 |
useDefaultExtent: true |
|
552 |
) |
|
553 |
) |
|
554 |
||
555 |
) |
|
556 |
) |
|
557 |
) |
|
558 |
||
559 |
) |
|
560 |
) |
|
561 |
! ! |
|
562 |
||
2347 | 563 |
!ColorEditDialog class methodsFor:'startup'! |
564 |
||
565 |
openOn:aColor |
|
566 |
^ self new |
|
567 |
color:aColor; |
|
568 |
open; |
|
569 |
yourself |
|
570 |
||
571 |
" |
|
572 |
self openOn:Color red |
|
573 |
" |
|
574 |
! ! |
|
575 |
||
1840 | 576 |
!ColorEditDialog methodsFor:'accessing'! |
577 |
||
578 |
color |
|
2279 | 579 |
|colorName| |
580 |
||
581 |
colorName := self colorName. |
|
582 |
colorName notEmptyOrNil ifTrue:[ |
|
2574
ae2448675efb
deliver a color, when asked for one !
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
583 |
^ Color name:(colorName asSymbol) |
2279 | 584 |
]. |
2326
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
585 |
^ Color redByte:(red value) greenByte:(green value) blueByte:(blue value) |
1840 | 586 |
! |
587 |
||
2279 | 588 |
color:aColor |
589 |
aColor isNil ifTrue:[ |
|
590 |
^ self |
|
591 |
]. |
|
592 |
||
593 |
aColor isSymbol ifTrue:[ |
|
594 |
self colorNameHolder value:aColor |
|
595 |
] ifFalse:[ |
|
1840 | 596 |
self red value:aColor redByte. |
597 |
self green value:aColor greenByte. |
|
598 |
self blue value:aColor blueByte. |
|
599 |
] |
|
600 |
! |
|
601 |
||
602 |
colorName |
|
603 |
^ colorNameHolder value |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
604 |
! |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
605 |
|
2574
ae2448675efb
deliver a color, when asked for one !
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
606 |
colorNameOrColor |
ae2448675efb
deliver a color, when asked for one !
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
607 |
|colorName| |
ae2448675efb
deliver a color, when asked for one !
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
608 |
|
ae2448675efb
deliver a color, when asked for one !
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
609 |
colorName := self colorName. |
ae2448675efb
deliver a color, when asked for one !
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
610 |
colorName notEmptyOrNil ifTrue:[ |
ae2448675efb
deliver a color, when asked for one !
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
611 |
"/ ^ Color name:(colorName asSymbol) |
ae2448675efb
deliver a color, when asked for one !
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
612 |
^ colorName asSymbol |
ae2448675efb
deliver a color, when asked for one !
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
613 |
]. |
ae2448675efb
deliver a color, when asked for one !
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
614 |
^ Color redByte:(red value) greenByte:(green value) blueByte:(blue value) |
ae2448675efb
deliver a color, when asked for one !
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
615 |
! |
ae2448675efb
deliver a color, when asked for one !
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
616 |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
617 |
htmlColorName |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
618 |
^ htmlColorNameHolder value |
1840 | 619 |
! ! |
620 |
||
621 |
!ColorEditDialog methodsFor:'actions'! |
|
622 |
||
623 |
colorChanged |
|
2266
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
624 |
|clr| |
1840 | 625 |
|
2574
ae2448675efb
deliver a color, when asked for one !
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
626 |
clr := self colorNameOrColor. |
2279 | 627 |
clr isColor ifTrue:[ |
628 |
"not a symbol" |
|
629 |
self setPreview:clr. |
|
2326
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
630 |
self htmlColorNameHolder value:(clr htmlPrintString) withoutNotifying:self. |
2279 | 631 |
]. |
1840 | 632 |
! |
633 |
||
2326
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
634 |
colorChangedTo:clr |
1840 | 635 |
"compute rgb and hls (if possible)" |
636 |
||
2326
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
637 |
|h| |
1840 | 638 |
|
2279 | 639 |
self red value:clr redByte withoutNotifying:self. |
640 |
self green value:clr greenByte withoutNotifying:self. |
|
641 |
self blue value:clr blueByte withoutNotifying:self. |
|
1840 | 642 |
|
643 |
h := clr hue. |
|
644 |
h notNil ifTrue:[ |
|
2279 | 645 |
self hue value:(h rounded) withoutNotifying:self. |
1840 | 646 |
]. |
2279 | 647 |
self light value:(clr light rounded) withoutNotifying:self. |
648 |
self saturation value:(clr saturation rounded) withoutNotifying:self. |
|
1840 | 649 |
|
650 |
self colorChanged |
|
651 |
! |
|
652 |
||
2326
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
653 |
colorNameChanged |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
654 |
"compute rgb and hls (if possible)" |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
655 |
|
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
656 |
|clr| |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
657 |
|
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
658 |
clr := Color name:colorNameHolder value ifIllegal:nil. |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
659 |
clr isNil ifTrue:[ |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
660 |
^ self |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
661 |
]. |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
662 |
self colorChangedTo:clr. |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
663 |
! |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
664 |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
665 |
copyColor |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
666 |
self window setClipboardObject:self color |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
667 |
! |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
668 |
|
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
669 |
copyColorName |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
670 |
self window setClipboardText:self htmlColorName |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
671 |
! |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
672 |
|
1840 | 673 |
hlsSliderChanged |
674 |
"compute rgb" |
|
675 |
||
676 |
Color withRGBFromHue:hue value light:light value saturation:saturation value do:[:r :g :b | |
|
677 |
red value:(r * 255 / 100) rounded withoutNotifying:self. |
|
678 |
green value:(g * 255 / 100) rounded withoutNotifying:self. |
|
679 |
blue value:(b * 255 / 100) rounded withoutNotifying:self. |
|
680 |
]. |
|
681 |
colorNameHolder value:'' withoutNotifying:self. |
|
682 |
self colorChanged |
|
683 |
! |
|
684 |
||
2326
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
685 |
htmlColorNameChanged |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
686 |
"compute rgb and hls (if possible)" |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
687 |
|
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
688 |
|clr| |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
689 |
|
2417
cc89133cc041
changed #htmlColorNameChanged - ignore empty color names
Stefan Vogel <sv@exept.de>
parents:
2347
diff
changeset
|
690 |
htmlColorNameHolder value isEmptyOrNil ifTrue:[ |
cc89133cc041
changed #htmlColorNameChanged - ignore empty color names
Stefan Vogel <sv@exept.de>
parents:
2347
diff
changeset
|
691 |
^ self. |
cc89133cc041
changed #htmlColorNameChanged - ignore empty color names
Stefan Vogel <sv@exept.de>
parents:
2347
diff
changeset
|
692 |
]. |
cc89133cc041
changed #htmlColorNameChanged - ignore empty color names
Stefan Vogel <sv@exept.de>
parents:
2347
diff
changeset
|
693 |
|
2326
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
694 |
clr := Color rgbValue:(Integer |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
695 |
readFrom:(htmlColorNameHolder value copyFrom:2) |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
696 |
radix:16 |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
697 |
onError:nil). |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
698 |
clr isNil ifTrue:[ |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
699 |
^ self |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
700 |
]. |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
701 |
self colorNameHolder value:'' withoutNotifying:self. |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
702 |
self colorChangedTo:clr. |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
703 |
! |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
704 |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
705 |
pasteColor |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
706 |
|copyBufferColor| |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
707 |
|
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
708 |
copyBufferColor := self window getClipboardObject. |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
709 |
copyBufferColor isColor ifFalse:[ |
2521 | 710 |
UserPreferences current beepInEditor ifTrue:[ |
711 |
self window beep. |
|
712 |
]. |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
713 |
^ self |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
714 |
]. |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
715 |
self color:copyBufferColor |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
716 |
! |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
717 |
|
2266
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
718 |
pickColor |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
719 |
|color| |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
720 |
|
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
721 |
color := Color fromUserWithFeedBack:[:clr | self setPreview:clr]. |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
722 |
color notNil ifTrue:[ |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
723 |
self color:color. |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
724 |
] |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
725 |
! |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
726 |
|
1840 | 727 |
rgbSliderChanged |
728 |
"compute hls" |
|
729 |
||
730 |
|r g b| |
|
731 |
||
732 |
r := self red value. |
|
733 |
g := self green value. |
|
734 |
b := self blue value. |
|
735 |
||
736 |
Color withHLSFromRed:(r * 100 / 255) green:(g * 100 / 255) blue:(b * 100 / 255) do:[:h :l :s | |
|
737 |
h isNil ifTrue:[ |
|
738 |
"/ achromatic |
|
739 |
] ifFalse:[ |
|
740 |
self hue value:(h rounded) withoutNotifying:self. |
|
741 |
]. |
|
742 |
self light value:(l rounded) withoutNotifying:self. |
|
743 |
self saturation value:(s rounded) withoutNotifying:self. |
|
744 |
]. |
|
745 |
self colorNameHolder value:'' withoutNotifying:self. |
|
746 |
self colorChanged |
|
2266
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
747 |
! |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
748 |
|
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
749 |
setPreview:color |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
750 |
previewBox isNil ifTrue:[^ self "called before setup"]. |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
751 |
|
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
752 |
previewBox backgroundColor:color. |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
753 |
previewBox foregroundColor:(color brightness < 0.5 |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
754 |
ifTrue:[Color white] |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
755 |
ifFalse:[Color black]). |
1840 | 756 |
! ! |
757 |
||
758 |
!ColorEditDialog methodsFor:'aspects'! |
|
759 |
||
760 |
blue |
|
761 |
blue isNil ifTrue:[ |
|
762 |
blue := 0 asValue. |
|
763 |
blue addDependent:self. |
|
764 |
]. |
|
765 |
^blue |
|
766 |
! |
|
767 |
||
768 |
colorNameHolder |
|
769 |
colorNameHolder isNil ifTrue:[ |
|
770 |
colorNameHolder := '' asValue. |
|
771 |
colorNameHolder addDependent:self. |
|
772 |
]. |
|
773 |
^colorNameHolder |
|
774 |
! |
|
775 |
||
776 |
green |
|
777 |
green isNil ifTrue:[ |
|
778 |
green := 0 asValue. |
|
779 |
green addDependent:self. |
|
780 |
]. |
|
781 |
^green |
|
782 |
! |
|
783 |
||
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
784 |
htmlColorNameHolder |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
785 |
htmlColorNameHolder isNil ifTrue:[ |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
786 |
htmlColorNameHolder := '' asValue. |
2326
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
787 |
htmlColorNameHolder addDependent:self. |
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
788 |
]. |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
789 |
^htmlColorNameHolder |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
790 |
! |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
791 |
|
1840 | 792 |
hue |
793 |
hue isNil ifTrue:[ |
|
794 |
hue := 0 asValue. |
|
795 |
hue addDependent:self. |
|
796 |
]. |
|
797 |
^hue |
|
798 |
! |
|
799 |
||
800 |
light |
|
801 |
light isNil ifTrue:[ |
|
802 |
light := 0 asValue. |
|
803 |
light addDependent:self. |
|
804 |
]. |
|
805 |
^light |
|
806 |
! |
|
807 |
||
808 |
red |
|
809 |
red isNil ifTrue:[ |
|
810 |
red := 0 asValue. |
|
811 |
red addDependent:self. |
|
812 |
]. |
|
813 |
^red |
|
814 |
! |
|
815 |
||
816 |
saturation |
|
817 |
saturation isNil ifTrue:[ |
|
818 |
saturation := 0 asValue. |
|
819 |
saturation addDependent:self. |
|
820 |
]. |
|
821 |
^saturation |
|
822 |
! ! |
|
823 |
||
824 |
!ColorEditDialog methodsFor:'change & update'! |
|
825 |
||
826 |
update:something with:aParameter from:changedObject |
|
827 |
(changedObject == red |
|
828 |
or:[changedObject == green |
|
829 |
or:[changedObject == blue]]) ifTrue:[ |
|
2326
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
830 |
self rgbSliderChanged. |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
831 |
^ self |
1840 | 832 |
]. |
833 |
||
834 |
(changedObject == hue |
|
835 |
or:[changedObject == light |
|
836 |
or:[changedObject == saturation]]) ifTrue:[ |
|
2326
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
837 |
self hlsSliderChanged. |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
838 |
^ self |
1840 | 839 |
]. |
840 |
||
841 |
(changedObject == colorNameHolder) ifTrue:[ |
|
2326
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
842 |
self colorNameChanged. |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
843 |
^ self |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
844 |
]. |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
845 |
(changedObject == htmlColorNameHolder) ifTrue:[ |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
846 |
self htmlColorNameChanged. |
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
847 |
^ self |
1840 | 848 |
]. |
849 |
||
2326
f23fac376621
allow hexcolor to be entered;
Claus Gittinger <cg@exept.de>
parents:
2279
diff
changeset
|
850 |
super update:something with:aParameter from:changedObject |
1840 | 851 |
! ! |
852 |
||
853 |
!ColorEditDialog methodsFor:'startup & release'! |
|
854 |
||
2266
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
855 |
postBuildPreviewBox:aView |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
856 |
previewBox := aView |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
857 |
! |
0234d226a06a
added pick (pipette) and feedback
Claus Gittinger <cg@exept.de>
parents:
2228
diff
changeset
|
858 |
|
1840 | 859 |
postBuildWith:aBuilder |
860 |
super postBuildWith:aBuilder. |
|
861 |
self colorChanged. |
|
862 |
||
863 |
"Modified: / 6.9.1998 / 22:55:25 / cg" |
|
864 |
! ! |
|
865 |
||
866 |
!ColorEditDialog class methodsFor:'documentation'! |
|
867 |
||
868 |
version |
|
869 |
^ '$Header$' |
|
870 |
! ! |