author | Claus Gittinger <cg@exept.de> |
Fri, 11 Jan 2008 20:45:48 +0100 | |
changeset 2239 | 2f8dda52674e |
parent 2228 | 6736186fc553 |
child 2266 | 0234d226a06a |
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 |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
16 |
htmlColorNameHolder' |
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 |
||
59 |
!ColorEditDialog class methodsFor:'interface specs'! |
|
60 |
||
61 |
windowSpec |
|
62 |
"This resource specification was automatically generated |
|
63 |
by the UIPainter of ST/X." |
|
64 |
||
65 |
"Do not manually edit this!! If it is corrupted, |
|
66 |
the UIPainter may not be able to read the specification." |
|
67 |
||
68 |
" |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
69 |
UIPainter new openOnClass:ColorEditDialog andSelector:#windowSpec |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
70 |
ColorEditDialog new openInterface:#windowSpec |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
71 |
ColorEditDialog open |
1840 | 72 |
" |
73 |
||
74 |
<resource: #canvas> |
|
75 |
||
76 |
^ |
|
77 |
#(FullSpec |
|
78 |
name: windowSpec |
|
79 |
window: |
|
80 |
(WindowSpec |
|
81 |
label: 'Define Color' |
|
82 |
name: 'Define Color' |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
83 |
min: (Point 440 300) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
84 |
max: (Point 440 300) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
85 |
bounds: (Rectangle 0 0 436 300) |
1840 | 86 |
) |
87 |
component: |
|
88 |
(SpecCollection |
|
89 |
collection: ( |
|
90 |
(VerticalPanelViewSpec |
|
91 |
name: 'RGBLabelPanel' |
|
92 |
layout: (LayoutFrame 0 0 0 0 58 0 76 0) |
|
93 |
horizontalLayout: fit |
|
94 |
verticalLayout: spreadSpace |
|
95 |
horizontalSpace: 3 |
|
96 |
verticalSpace: 3 |
|
97 |
component: |
|
98 |
(SpecCollection |
|
99 |
collection: ( |
|
100 |
(LabelSpec |
|
101 |
label: 'Red:' |
|
102 |
name: 'RedLabel' |
|
103 |
translateLabel: true |
|
104 |
adjust: right |
|
105 |
useDefaultExtent: true |
|
106 |
) |
|
107 |
(LabelSpec |
|
108 |
label: 'Green:' |
|
109 |
name: 'GreenLabel' |
|
110 |
translateLabel: true |
|
111 |
adjust: right |
|
112 |
useDefaultExtent: true |
|
113 |
) |
|
114 |
(LabelSpec |
|
115 |
label: 'Blue:' |
|
116 |
name: 'BlueLabel' |
|
117 |
translateLabel: true |
|
118 |
adjust: right |
|
119 |
useDefaultExtent: true |
|
120 |
) |
|
121 |
) |
|
122 |
||
123 |
) |
|
124 |
) |
|
125 |
(VerticalPanelViewSpec |
|
126 |
name: 'RGBSliderPanel' |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
127 |
layout: (LayoutFrame 62 0 0 0 -177 1 76 0) |
1840 | 128 |
horizontalLayout: fit |
129 |
verticalLayout: spreadSpace |
|
130 |
horizontalSpace: 3 |
|
131 |
verticalSpace: 3 |
|
132 |
component: |
|
133 |
(SpecCollection |
|
134 |
collection: ( |
|
135 |
(SliderSpec |
|
136 |
name: 'RedSlider' |
|
137 |
tabable: false |
|
138 |
model: red |
|
139 |
orientation: horizontal |
|
140 |
stop: 255 |
|
141 |
step: 1 |
|
142 |
backgroundColor: (Color 100.0 0.0 0.0) |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
143 |
extent: (Point 197 16) |
1840 | 144 |
) |
145 |
(SliderSpec |
|
146 |
name: 'GreenSlider' |
|
147 |
tabable: false |
|
148 |
model: green |
|
149 |
orientation: horizontal |
|
150 |
stop: 255 |
|
151 |
step: 1 |
|
152 |
backgroundColor: (Color 0.0 100.0 0.0) |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
153 |
extent: (Point 197 16) |
1840 | 154 |
) |
155 |
(SliderSpec |
|
156 |
name: 'BlueSlider' |
|
157 |
tabable: false |
|
158 |
model: blue |
|
159 |
orientation: horizontal |
|
160 |
stop: 255 |
|
161 |
step: 1 |
|
162 |
backgroundColor: (Color 0.0 0.0 100.0) |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
163 |
extent: (Point 197 16) |
1840 | 164 |
) |
165 |
) |
|
166 |
||
167 |
) |
|
168 |
) |
|
169 |
(VerticalPanelViewSpec |
|
170 |
name: 'RGBFieldPanel' |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
171 |
layout: (LayoutFrame -173 1 0 0 -143 1 76 0) |
1840 | 172 |
horizontalLayout: fit |
173 |
verticalLayout: spreadSpace |
|
174 |
horizontalSpace: 3 |
|
175 |
verticalSpace: 3 |
|
176 |
component: |
|
177 |
(SpecCollection |
|
178 |
collection: ( |
|
179 |
(InputFieldSpec |
|
180 |
name: 'RedField' |
|
181 |
model: red |
|
182 |
type: numberInRange |
|
183 |
numChars: 3 |
|
184 |
minValue: 0 |
|
185 |
maxValue: 255 |
|
186 |
acceptOnPointerLeave: false |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
187 |
extent: (Point 30 20) |
1840 | 188 |
) |
189 |
(InputFieldSpec |
|
190 |
name: 'GreenField' |
|
191 |
model: green |
|
192 |
type: numberInRange |
|
193 |
numChars: 3 |
|
194 |
minValue: 0 |
|
195 |
maxValue: 255 |
|
196 |
acceptOnPointerLeave: false |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
197 |
extent: (Point 30 20) |
1840 | 198 |
) |
199 |
(InputFieldSpec |
|
200 |
name: 'BlueField' |
|
201 |
model: blue |
|
202 |
type: numberInRange |
|
203 |
numChars: 3 |
|
204 |
minValue: 0 |
|
205 |
maxValue: 255 |
|
206 |
acceptOnPointerLeave: false |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
207 |
extent: (Point 30 20) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
208 |
) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
209 |
) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
210 |
|
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
211 |
) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
212 |
) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
213 |
(VerticalPanelViewSpec |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
214 |
name: 'RGBFieldPanelHex' |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
215 |
layout: (LayoutFrame -141 1 0 0 -121 1 76 0) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
216 |
horizontalLayout: fit |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
217 |
verticalLayout: spreadSpace |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
218 |
horizontalSpace: 3 |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
219 |
verticalSpace: 3 |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
220 |
component: |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
221 |
(SpecCollection |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
222 |
collection: ( |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
223 |
(InputFieldSpec |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
224 |
name: 'EntryField4' |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
225 |
model: red |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
226 |
type: hexIntegerInRange |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
227 |
numChars: 3 |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
228 |
minValue: 0 |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
229 |
maxValue: 255 |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
230 |
acceptOnPointerLeave: false |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
231 |
extent: (Point 20 20) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
232 |
) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
233 |
(InputFieldSpec |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
234 |
name: 'EntryField5' |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
235 |
model: green |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
236 |
type: hexIntegerInRange |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
237 |
numChars: 3 |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
238 |
minValue: 0 |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
239 |
maxValue: 255 |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
240 |
acceptOnPointerLeave: false |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
241 |
extent: (Point 20 20) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
242 |
) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
243 |
(InputFieldSpec |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
244 |
name: 'EntryField6' |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
245 |
model: blue |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
246 |
type: hexIntegerInRange |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
247 |
numChars: 3 |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
248 |
minValue: 0 |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
249 |
maxValue: 255 |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
250 |
acceptOnPointerLeave: false |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
251 |
extent: (Point 20 20) |
1840 | 252 |
) |
253 |
) |
|
254 |
||
255 |
) |
|
256 |
) |
|
257 |
(VerticalPanelViewSpec |
|
258 |
name: 'HLSLabelPanel' |
|
259 |
layout: (LayoutFrame 0 0 86 0 58 0 163 0) |
|
260 |
horizontalLayout: fit |
|
261 |
verticalLayout: spreadSpace |
|
262 |
horizontalSpace: 3 |
|
263 |
verticalSpace: 3 |
|
264 |
component: |
|
265 |
(SpecCollection |
|
266 |
collection: ( |
|
267 |
(LabelSpec |
|
268 |
label: 'Hue:' |
|
269 |
name: 'Label1' |
|
270 |
translateLabel: true |
|
271 |
adjust: right |
|
272 |
useDefaultExtent: true |
|
273 |
) |
|
274 |
(LabelSpec |
|
275 |
label: 'Light:' |
|
276 |
name: 'Label2' |
|
277 |
translateLabel: true |
|
278 |
adjust: right |
|
279 |
useDefaultExtent: true |
|
280 |
) |
|
281 |
(LabelSpec |
|
282 |
label: 'Sat:' |
|
283 |
name: 'Label3' |
|
284 |
translateLabel: true |
|
285 |
adjust: right |
|
286 |
useDefaultExtent: true |
|
287 |
) |
|
288 |
) |
|
289 |
||
290 |
) |
|
291 |
) |
|
292 |
(VerticalPanelViewSpec |
|
293 |
name: 'HLSSliderPanel' |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
294 |
layout: (LayoutFrame 62 0 86 0 -177 1 163 0) |
1840 | 295 |
horizontalLayout: fit |
296 |
verticalLayout: spreadSpace |
|
297 |
horizontalSpace: 3 |
|
298 |
verticalSpace: 3 |
|
299 |
component: |
|
300 |
(SpecCollection |
|
301 |
collection: ( |
|
302 |
(SliderSpec |
|
303 |
name: 'Slider1' |
|
304 |
tabable: false |
|
305 |
model: hue |
|
306 |
orientation: horizontal |
|
307 |
stop: 359 |
|
308 |
step: 1 |
|
309 |
keyboardStep: 1 |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
310 |
extent: (Point 197 16) |
1840 | 311 |
) |
312 |
(SliderSpec |
|
313 |
name: 'Slider2' |
|
314 |
tabable: false |
|
315 |
model: light |
|
316 |
orientation: horizontal |
|
317 |
step: 1 |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
318 |
backgroundColor: (Color 66.999313344015 66.999313344015 66.999313344015) |
1840 | 319 |
keyboardStep: 1 |
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
320 |
extent: (Point 197 16) |
1840 | 321 |
) |
322 |
(SliderSpec |
|
323 |
name: 'Slider3' |
|
324 |
tabable: false |
|
325 |
model: saturation |
|
326 |
orientation: horizontal |
|
327 |
step: 1 |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
328 |
backgroundColor: (Color 66.999313344015 66.999313344015 66.999313344015) |
1840 | 329 |
keyboardStep: 1 |
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
330 |
extent: (Point 197 16) |
1840 | 331 |
) |
332 |
) |
|
333 |
||
334 |
) |
|
335 |
) |
|
336 |
(VerticalPanelViewSpec |
|
337 |
name: 'HLSFieldPanel' |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
338 |
layout: (LayoutFrame -173 1 86 0 -143 1 163 0) |
1840 | 339 |
horizontalLayout: fit |
340 |
verticalLayout: spreadSpace |
|
341 |
horizontalSpace: 3 |
|
342 |
verticalSpace: 3 |
|
343 |
component: |
|
344 |
(SpecCollection |
|
345 |
collection: ( |
|
346 |
(InputFieldSpec |
|
347 |
name: 'EntryField1' |
|
348 |
model: hue |
|
349 |
type: numberInRange |
|
350 |
numChars: 3 |
|
351 |
minValue: 0 |
|
352 |
maxValue: 359 |
|
353 |
acceptOnPointerLeave: false |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
354 |
extent: (Point 30 20) |
1840 | 355 |
) |
356 |
(InputFieldSpec |
|
357 |
name: 'EntryField2' |
|
358 |
model: light |
|
359 |
type: numberInRange |
|
360 |
numChars: 3 |
|
361 |
minValue: 0 |
|
362 |
maxValue: 100 |
|
363 |
acceptOnPointerLeave: false |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
364 |
extent: (Point 30 20) |
1840 | 365 |
) |
366 |
(InputFieldSpec |
|
367 |
name: 'EntryField3' |
|
368 |
model: saturation |
|
369 |
type: numberInRange |
|
370 |
numChars: 3 |
|
371 |
minValue: 0 |
|
372 |
maxValue: 100 |
|
373 |
acceptOnPointerLeave: false |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
374 |
extent: (Point 30 20) |
1840 | 375 |
) |
376 |
) |
|
377 |
||
378 |
) |
|
379 |
) |
|
380 |
(ViewSpec |
|
381 |
name: 'Box1' |
|
382 |
layout: (LayoutFrame -117 1 4 0.0 -3 1.0 -39 1.0) |
|
383 |
level: 1 |
|
384 |
component: |
|
385 |
(SpecCollection |
|
386 |
collection: ( |
|
387 |
(LabelSpec |
|
388 |
label: 'Preview' |
|
389 |
name: 'PreviewBox' |
|
390 |
layout: (LayoutFrame 2 0.0 2 0.0 -2 1.0 -2 1.0) |
|
391 |
level: -1 |
|
392 |
translateLabel: true |
|
393 |
) |
|
394 |
) |
|
395 |
||
396 |
) |
|
397 |
) |
|
398 |
(LabelSpec |
|
399 |
label: 'Color Name:' |
|
400 |
name: 'ColorNameLabel' |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
401 |
layout: (LayoutFrame 0 0 176 0 106 0 198 0) |
1840 | 402 |
translateLabel: true |
403 |
adjust: right |
|
404 |
) |
|
405 |
(InputFieldSpec |
|
406 |
name: 'ColorNameField' |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
407 |
layout: (LayoutFrame 108 0 176 0 -162 1 198 0) |
1840 | 408 |
model: colorNameHolder |
409 |
immediateAccept: true |
|
410 |
acceptOnReturn: true |
|
411 |
acceptOnTab: true |
|
412 |
acceptOnLostFocus: true |
|
413 |
acceptOnPointerLeave: false |
|
414 |
) |
|
415 |
(HorizontalPanelViewSpec |
|
416 |
name: 'HorizontalPanel1' |
|
417 |
layout: (LayoutFrame 0 0.0 -32 1 0 1.0 0 1.0) |
|
418 |
horizontalLayout: fitSpace |
|
419 |
verticalLayout: centerMax |
|
420 |
horizontalSpace: 3 |
|
421 |
verticalSpace: 3 |
|
422 |
reverseOrderIfOKAtLeft: true |
|
423 |
component: |
|
424 |
(SpecCollection |
|
425 |
collection: ( |
|
426 |
(ActionButtonSpec |
|
427 |
label: 'Cancel' |
|
428 |
name: 'CancelButton' |
|
429 |
translateLabel: true |
|
430 |
resizeForLabel: false |
|
431 |
tabable: true |
|
432 |
model: cancel |
|
433 |
useDefaultExtent: true |
|
434 |
) |
|
435 |
(ActionButtonSpec |
|
436 |
label: 'OK' |
|
437 |
name: 'OKButton' |
|
438 |
translateLabel: true |
|
439 |
resizeForLabel: false |
|
440 |
tabable: true |
|
441 |
model: accept |
|
442 |
isDefault: true |
|
443 |
defaultable: true |
|
444 |
useDefaultExtent: true |
|
445 |
) |
|
446 |
) |
|
447 |
||
448 |
) |
|
449 |
) |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
450 |
(LabelSpec |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
451 |
label: 'HTML Color Name:' |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
452 |
name: 'HTMLColorNameLabel' |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
453 |
layout: (LayoutFrame 4 0 204 0 110 0 226 0) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
454 |
translateLabel: true |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
455 |
adjust: right |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
456 |
) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
457 |
(InputFieldSpec |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
458 |
name: 'MLHTColorNameFieldField' |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
459 |
layout: (LayoutFrame 108 0 204 0 -162 1 226 0) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
460 |
model: htmlColorNameHolder |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
461 |
immediateAccept: true |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
462 |
acceptOnReturn: true |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
463 |
acceptOnTab: true |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
464 |
acceptOnLostFocus: true |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
465 |
acceptOnPointerLeave: false |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
466 |
) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
467 |
(ActionButtonSpec |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
468 |
label: 'Copy Color' |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
469 |
name: 'CopyColor' |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
470 |
layout: (LayoutFrame 12 0 236 0 100 0 258 0) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
471 |
translateLabel: true |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
472 |
resizeForLabel: true |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
473 |
tabable: true |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
474 |
model: copyColor |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
475 |
) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
476 |
(ActionButtonSpec |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
477 |
label: 'Paste Color' |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
478 |
name: 'PasteColor' |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
479 |
layout: (LayoutFrame 108 0 236 0 196 0 258 0) |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
480 |
translateLabel: true |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
481 |
resizeForLabel: true |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
482 |
tabable: true |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
483 |
model: pasteColor |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
484 |
) |
1840 | 485 |
) |
486 |
||
487 |
) |
|
488 |
) |
|
489 |
! ! |
|
490 |
||
491 |
!ColorEditDialog methodsFor:'accessing'! |
|
492 |
||
493 |
color |
|
494 |
^Color redByte:(red value) greenByte:(green value) blueByte:(blue value) |
|
495 |
! |
|
496 |
||
497 |
color:aColor |
|
498 |
aColor notNil ifTrue:[ |
|
499 |
self red value:aColor redByte. |
|
500 |
self green value:aColor greenByte. |
|
501 |
self blue value:aColor blueByte. |
|
502 |
] |
|
503 |
! |
|
504 |
||
505 |
colorName |
|
506 |
^ colorNameHolder value |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
507 |
! |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
508 |
|
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
509 |
htmlColorName |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
510 |
^ htmlColorNameHolder value |
1840 | 511 |
! ! |
512 |
||
513 |
!ColorEditDialog methodsFor:'actions'! |
|
514 |
||
515 |
colorChanged |
|
516 |
|box clr| |
|
517 |
||
518 |
box := self componentAt: #PreviewBox. |
|
519 |
box isNil ifTrue:[^ self "called before setup"]. |
|
520 |
||
521 |
clr := self color. |
|
522 |
box backgroundColor:clr. |
|
523 |
box foregroundColor:(clr brightness < 0.5 |
|
524 |
ifTrue:[Color white] |
|
525 |
ifFalse:[Color black]). |
|
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
526 |
|
2228 | 527 |
self htmlColorNameHolder value:(clr htmlPrintString). |
1840 | 528 |
! |
529 |
||
530 |
colorNameChanged |
|
531 |
"compute rgb and hls (if possible)" |
|
532 |
||
533 |
|clr h| |
|
534 |
||
535 |
clr := Color name:colorNameHolder value ifIllegal:nil. |
|
536 |
clr isNil ifTrue:[ |
|
537 |
^ self |
|
538 |
]. |
|
539 |
||
540 |
red value:clr redByte withoutNotifying:self. |
|
541 |
green value:clr greenByte withoutNotifying:self. |
|
542 |
blue value:clr blueByte withoutNotifying:self. |
|
543 |
||
544 |
h := clr hue. |
|
545 |
h notNil ifTrue:[ |
|
546 |
hue value:(h rounded) withoutNotifying:self. |
|
547 |
]. |
|
548 |
light value:(clr light rounded) withoutNotifying:self. |
|
549 |
saturation value:(clr saturation rounded) withoutNotifying:self. |
|
550 |
||
551 |
self colorChanged |
|
552 |
! |
|
553 |
||
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
554 |
copyColor |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
555 |
self window setClipboardObject:self color |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
556 |
! |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
557 |
|
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
558 |
copyColorName |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
559 |
self window setClipboardText:self htmlColorName |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
560 |
! |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
561 |
|
1840 | 562 |
hlsSliderChanged |
563 |
"compute rgb" |
|
564 |
||
565 |
Color withRGBFromHue:hue value light:light value saturation:saturation value do:[:r :g :b | |
|
566 |
red value:(r * 255 / 100) rounded withoutNotifying:self. |
|
567 |
green value:(g * 255 / 100) rounded withoutNotifying:self. |
|
568 |
blue value:(b * 255 / 100) rounded withoutNotifying:self. |
|
569 |
]. |
|
570 |
colorNameHolder value:'' withoutNotifying:self. |
|
571 |
self colorChanged |
|
572 |
! |
|
573 |
||
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
574 |
pasteColor |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
575 |
|copyBufferColor| |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
576 |
|
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
577 |
copyBufferColor := self window getClipboardObject. |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
578 |
copyBufferColor isColor ifFalse:[ |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
579 |
self window beep. |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
580 |
^ self |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
581 |
]. |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
582 |
self color:copyBufferColor |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
583 |
! |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
584 |
|
1840 | 585 |
rgbSliderChanged |
586 |
"compute hls" |
|
587 |
||
588 |
|r g b| |
|
589 |
||
590 |
r := self red value. |
|
591 |
g := self green value. |
|
592 |
b := self blue value. |
|
593 |
||
594 |
Color withHLSFromRed:(r * 100 / 255) green:(g * 100 / 255) blue:(b * 100 / 255) do:[:h :l :s | |
|
595 |
h isNil ifTrue:[ |
|
596 |
"/ achromatic |
|
597 |
] ifFalse:[ |
|
598 |
self hue value:(h rounded) withoutNotifying:self. |
|
599 |
]. |
|
600 |
self light value:(l rounded) withoutNotifying:self. |
|
601 |
self saturation value:(s rounded) withoutNotifying:self. |
|
602 |
]. |
|
603 |
self colorNameHolder value:'' withoutNotifying:self. |
|
604 |
self colorChanged |
|
605 |
! ! |
|
606 |
||
607 |
!ColorEditDialog methodsFor:'aspects'! |
|
608 |
||
609 |
blue |
|
610 |
blue isNil ifTrue:[ |
|
611 |
blue := 0 asValue. |
|
612 |
blue addDependent:self. |
|
613 |
]. |
|
614 |
^blue |
|
615 |
! |
|
616 |
||
617 |
colorNameHolder |
|
618 |
colorNameHolder isNil ifTrue:[ |
|
619 |
colorNameHolder := '' asValue. |
|
620 |
colorNameHolder addDependent:self. |
|
621 |
]. |
|
622 |
^colorNameHolder |
|
623 |
! |
|
624 |
||
625 |
green |
|
626 |
green isNil ifTrue:[ |
|
627 |
green := 0 asValue. |
|
628 |
green addDependent:self. |
|
629 |
]. |
|
630 |
^green |
|
631 |
! |
|
632 |
||
2224
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
633 |
htmlColorNameHolder |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
634 |
htmlColorNameHolder isNil ifTrue:[ |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
635 |
htmlColorNameHolder := '' asValue. |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
636 |
]. |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
637 |
^htmlColorNameHolder |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
638 |
! |
6ec083adc6bf
hex input; hex-name; copy & paste
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
639 |
|
1840 | 640 |
hue |
641 |
hue isNil ifTrue:[ |
|
642 |
hue := 0 asValue. |
|
643 |
hue addDependent:self. |
|
644 |
]. |
|
645 |
^hue |
|
646 |
! |
|
647 |
||
648 |
light |
|
649 |
light isNil ifTrue:[ |
|
650 |
light := 0 asValue. |
|
651 |
light addDependent:self. |
|
652 |
]. |
|
653 |
^light |
|
654 |
! |
|
655 |
||
656 |
red |
|
657 |
red isNil ifTrue:[ |
|
658 |
red := 0 asValue. |
|
659 |
red addDependent:self. |
|
660 |
]. |
|
661 |
^red |
|
662 |
! |
|
663 |
||
664 |
saturation |
|
665 |
saturation isNil ifTrue:[ |
|
666 |
saturation := 0 asValue. |
|
667 |
saturation addDependent:self. |
|
668 |
]. |
|
669 |
^saturation |
|
670 |
! ! |
|
671 |
||
672 |
!ColorEditDialog methodsFor:'change & update'! |
|
673 |
||
674 |
update:something with:aParameter from:changedObject |
|
675 |
(changedObject == red |
|
676 |
or:[changedObject == green |
|
677 |
or:[changedObject == blue]]) ifTrue:[ |
|
678 |
^ self rgbSliderChanged |
|
679 |
]. |
|
680 |
||
681 |
(changedObject == hue |
|
682 |
or:[changedObject == light |
|
683 |
or:[changedObject == saturation]]) ifTrue:[ |
|
684 |
^ self hlsSliderChanged |
|
685 |
]. |
|
686 |
||
687 |
(changedObject == colorNameHolder) ifTrue:[ |
|
688 |
^ self colorNameChanged |
|
689 |
]. |
|
690 |
||
691 |
^ super update:something with:aParameter from:changedObject |
|
692 |
! ! |
|
693 |
||
694 |
!ColorEditDialog methodsFor:'startup & release'! |
|
695 |
||
696 |
postBuildWith:aBuilder |
|
697 |
super postBuildWith:aBuilder. |
|
698 |
self colorChanged. |
|
699 |
||
700 |
"Modified: / 6.9.1998 / 22:55:25 / cg" |
|
701 |
! ! |
|
702 |
||
703 |
!ColorEditDialog class methodsFor:'documentation'! |
|
704 |
||
705 |
version |
|
706 |
^ '$Header$' |
|
707 |
! ! |