author | Claus Gittinger <cg@exept.de> |
Mon, 19 Nov 2007 15:53:43 +0100 | |
changeset 2196 | 7e4e066ca7f5 |
parent 2160 | 8f6a8896f10d |
child 2209 | c7ac53d62021 |
permissions | -rw-r--r-- |
164 | 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 |
" |
|
1386 | 12 |
"{ Package: 'stx:libtool2' }" |
13 |
||
164 | 14 |
ApplicationModel subclass:#UISpecificationTool |
759 | 15 |
instanceVariableNames:'modifiedHolder aspects specification selection specChannel |
1307 | 16 |
buildInView listOfSpecViews' |
164 | 17 |
classVariableNames:'' |
18 |
poolDictionaries:'' |
|
19 |
category:'Interface-UIPainter' |
|
20 |
! |
|
21 |
||
1307 | 22 |
ViewScroller subclass:#BuildInView |
1573 | 23 |
instanceVariableNames:'' |
1307 | 24 |
classVariableNames:'' |
25 |
poolDictionaries:'' |
|
26 |
privateIn:UISpecificationTool |
|
27 |
! |
|
28 |
||
164 | 29 |
!UISpecificationTool class methodsFor:'documentation'! |
30 |
||
31 |
copyright |
|
32 |
" |
|
33 |
COPYRIGHT (c) 1995 by eXept Software AG |
|
34 |
All Rights Reserved |
|
35 |
||
36 |
This software is furnished under a license and may be used |
|
37 |
only in accordance with the terms of that license and with the |
|
38 |
inclusion of the above copyright notice. This software may not |
|
39 |
be provided or otherwise made available to, or used by, any |
|
40 |
other person. No title to or ownership of the software is |
|
41 |
hereby transferred. |
|
42 |
" |
|
43 |
||
44 |
||
45 |
||
46 |
! |
|
47 |
||
48 |
documentation |
|
49 |
" |
|
50 |
used by the UIPainter to manipulate the specifications of the selected component |
|
51 |
||
52 |
[author:] |
|
53 |
Claus Atzkern |
|
54 |
||
55 |
[see also:] |
|
56 |
UIPainter |
|
57 |
UILayoutTool |
|
58 |
UIHelpTool |
|
59 |
" |
|
60 |
! ! |
|
61 |
||
1963
a0c51ed97fc3
autoScrollHoriz is now configurable
Claus Gittinger <cg@exept.de>
parents:
1956
diff
changeset
|
62 |
!UISpecificationTool class methodsFor:'help specs'! |
a0c51ed97fc3
autoScrollHoriz is now configurable
Claus Gittinger <cg@exept.de>
parents:
1956
diff
changeset
|
63 |
|
a0c51ed97fc3
autoScrollHoriz is now configurable
Claus Gittinger <cg@exept.de>
parents:
1956
diff
changeset
|
64 |
helpSpec |
a0c51ed97fc3
autoScrollHoriz is now configurable
Claus Gittinger <cg@exept.de>
parents:
1956
diff
changeset
|
65 |
"This resource specification was automatically generated |
a0c51ed97fc3
autoScrollHoriz is now configurable
Claus Gittinger <cg@exept.de>
parents:
1956
diff
changeset
|
66 |
by the UIHelpTool of ST/X." |
a0c51ed97fc3
autoScrollHoriz is now configurable
Claus Gittinger <cg@exept.de>
parents:
1956
diff
changeset
|
67 |
|
a0c51ed97fc3
autoScrollHoriz is now configurable
Claus Gittinger <cg@exept.de>
parents:
1956
diff
changeset
|
68 |
"Do not manually edit this!! If it is corrupted, |
a0c51ed97fc3
autoScrollHoriz is now configurable
Claus Gittinger <cg@exept.de>
parents:
1956
diff
changeset
|
69 |
the UIHelpTool may not be able to read the specification." |
a0c51ed97fc3
autoScrollHoriz is now configurable
Claus Gittinger <cg@exept.de>
parents:
1956
diff
changeset
|
70 |
|
a0c51ed97fc3
autoScrollHoriz is now configurable
Claus Gittinger <cg@exept.de>
parents:
1956
diff
changeset
|
71 |
" |
a0c51ed97fc3
autoScrollHoriz is now configurable
Claus Gittinger <cg@exept.de>
parents:
1956
diff
changeset
|
72 |
UIHelpTool openOnClass:UISpecificationTool |
a0c51ed97fc3
autoScrollHoriz is now configurable
Claus Gittinger <cg@exept.de>
parents:
1956
diff
changeset
|
73 |
" |
a0c51ed97fc3
autoScrollHoriz is now configurable
Claus Gittinger <cg@exept.de>
parents:
1956
diff
changeset
|
74 |
|
a0c51ed97fc3
autoScrollHoriz is now configurable
Claus Gittinger <cg@exept.de>
parents:
1956
diff
changeset
|
75 |
<resource: #help> |
a0c51ed97fc3
autoScrollHoriz is now configurable
Claus Gittinger <cg@exept.de>
parents:
1956
diff
changeset
|
76 |
|
a0c51ed97fc3
autoScrollHoriz is now configurable
Claus Gittinger <cg@exept.de>
parents:
1956
diff
changeset
|
77 |
^ super helpSpec addPairsFrom:#( |
a0c51ed97fc3
autoScrollHoriz is now configurable
Claus Gittinger <cg@exept.de>
parents:
1956
diff
changeset
|
78 |
|
a0c51ed97fc3
autoScrollHoriz is now configurable
Claus Gittinger <cg@exept.de>
parents:
1956
diff
changeset
|
79 |
#autoScrollHorizontal |
a0c51ed97fc3
autoScrollHoriz is now configurable
Claus Gittinger <cg@exept.de>
parents:
1956
diff
changeset
|
80 |
'' |
a0c51ed97fc3
autoScrollHoriz is now configurable
Claus Gittinger <cg@exept.de>
parents:
1956
diff
changeset
|
81 |
|
a0c51ed97fc3
autoScrollHoriz is now configurable
Claus Gittinger <cg@exept.de>
parents:
1956
diff
changeset
|
82 |
) |
a0c51ed97fc3
autoScrollHoriz is now configurable
Claus Gittinger <cg@exept.de>
parents:
1956
diff
changeset
|
83 |
! ! |
a0c51ed97fc3
autoScrollHoriz is now configurable
Claus Gittinger <cg@exept.de>
parents:
1956
diff
changeset
|
84 |
|
164 | 85 |
!UISpecificationTool class methodsFor:'interface specs'! |
86 |
||
87 |
windowSpec |
|
1307 | 88 |
"This resource specification was automatically generated |
89 |
by the UIPainter of ST/X." |
|
164 | 90 |
|
1307 | 91 |
"Do not manually edit this!! If it is corrupted, |
92 |
the UIPainter may not be able to read the specification." |
|
164 | 93 |
|
94 |
" |
|
95 |
UIPainter new openOnClass:UISpecificationTool andSelector:#windowSpec |
|
96 |
UISpecificationTool new openInterface:#windowSpec |
|
1307 | 97 |
UISpecificationTool open |
164 | 98 |
" |
99 |
||
100 |
<resource: #canvas> |
|
101 |
||
1307 | 102 |
^ |
103 |
#(#FullSpec |
|
104 |
#name: #windowSpec |
|
105 |
#window: |
|
106 |
#(#WindowSpec |
|
107 |
#label: 'unnamed canvas' |
|
108 |
#name: 'unnamed canvas' |
|
1313 | 109 |
#bounds: #(#Rectangle 12 22 312 322) |
1307 | 110 |
) |
111 |
#component: |
|
112 |
#(#SpecCollection |
|
113 |
#collection: #( |
|
114 |
#(#ArbitraryComponentSpec |
|
1313 | 115 |
#name: 'BuildInView' |
1307 | 116 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
1313 | 117 |
#hasVerticalScrollBar: true |
118 |
#miniScrollerVertical: true |
|
119 |
#autoHideScrollBars: true |
|
1307 | 120 |
#hasBorder: false |
1313 | 121 |
#component: #buildInView |
1307 | 122 |
) |
123 |
) |
|
124 |
||
125 |
) |
|
164 | 126 |
) |
127 |
! ! |
|
128 |
||
1781
d67090b1ad57
resources shared with UIPainter class
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
129 |
!UISpecificationTool class methodsFor:'resources'! |
d67090b1ad57
resources shared with UIPainter class
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
130 |
|
d67090b1ad57
resources shared with UIPainter class
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
131 |
classResources |
d67090b1ad57
resources shared with UIPainter class
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
132 |
"my translations are found in the UIPainter classes resources" |
d67090b1ad57
resources shared with UIPainter class
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
133 |
|
d67090b1ad57
resources shared with UIPainter class
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
134 |
^ UIPainter classResources |
d67090b1ad57
resources shared with UIPainter class
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
135 |
! ! |
d67090b1ad57
resources shared with UIPainter class
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
136 |
|
1331 | 137 |
!UISpecificationTool methodsFor:'accessing-channels'! |
1315 | 138 |
|
139 |
modifiedHolder:aValueHolder |
|
140 |
"set the value holder set to true in case of modifying attributes |
|
141 |
" |
|
142 |
||
143 |
modifiedHolder removeDependent:self. |
|
164 | 144 |
|
1315 | 145 |
(modifiedHolder := aValueHolder) notNil ifTrue:[ |
146 |
modifiedHolder addDependent:self. |
|
147 |
]. |
|
1063
9e710dbc7c92
inputFields use modified & acceptChannels
Claus Gittinger <cg@exept.de>
parents:
1051
diff
changeset
|
148 |
|
1315 | 149 |
! ! |
150 |
||
1331 | 151 |
!UISpecificationTool methodsFor:'accessing-specification'! |
1063
9e710dbc7c92
inputFields use modified & acceptChannels
Claus Gittinger <cg@exept.de>
parents:
1051
diff
changeset
|
152 |
|
172 | 153 |
specification |
154 |
"gets current edit specification |
|
155 |
" |
|
156 |
^ specification |
|
157 |
||
158 |
||
159 |
! |
|
160 |
||
161 |
specification:aSpec |
|
162 |
"sets current edit specification |
|
163 |
" |
|
1315 | 164 |
aSpec notNil ifTrue:[ |
165 |
"/ same type of spec - simply change the spec; no need to setup everything |
|
166 |
specification class == aSpec class ifTrue:[ |
|
167 |
specification := aSpec. |
|
168 |
specChannel value:specification. |
|
169 |
^ self |
|
170 |
] |
|
1307 | 171 |
]. |
428 | 172 |
|
1315 | 173 |
"/ release resources |
174 |
specChannel release. |
|
175 |
aspects release. |
|
176 |
selection := listOfSpecViews := nil. |
|
1573 | 177 |
buildInView destroyAllClientViews. |
1315 | 178 |
|
179 |
(specification := aSpec) isNil ifTrue:[ |
|
180 |
aspects := specChannel := nil. |
|
181 |
^ self |
|
1307 | 182 |
]. |
183 |
||
184 |
"/ some tricky specs need the builder during the addBindings phase. |
|
185 |
"/ This is passed down in a special UIBindingsDictionary |
|
186 |
"/ (remain backward compatible) |
|
536
3991e37ec19f
pass special dictionary as bindings-environmnt
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
187 |
|
1307 | 188 |
aspects := UISpecification newBindingsDictionary. |
189 |
aspects builder:builder. |
|
190 |
aspects at:#modifiedChannel put:modifiedHolder. |
|
191 |
aspects at:#acceptChannel put:self acceptChannel. |
|
172 | 192 |
|
1307 | 193 |
specChannel := specification asValue. |
194 |
specification class addBindingsTo:aspects for:specification channel:specChannel. |
|
536
3991e37ec19f
pass special dictionary as bindings-environmnt
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
195 |
|
1307 | 196 |
"/ arrange for being notified, if any aspect changes |
197 |
aspects do:[:el| el addDependent:self ]. |
|
172 | 198 |
! ! |
199 |
||
364 | 200 |
!UISpecificationTool methodsFor:'actions'! |
201 |
||
202 |
setMaxExtent |
|
203 |
"set the windows maxExtent from its current extent" |
|
204 |
||
205 |
|canvas currentExtent| |
|
206 |
||
207 |
canvas := self masterApplication painter topView. |
|
208 |
currentExtent := canvas extent. |
|
209 |
(self aspectFor:#maxX) value:currentExtent x. |
|
210 |
(self aspectFor:#maxY) value:currentExtent y. |
|
211 |
||
212 |
"Modified: / 29.10.1997 / 18:29:17 / cg" |
|
213 |
! |
|
214 |
||
215 |
setMinExtent |
|
216 |
"set the windows minExtent from its current extent" |
|
217 |
||
218 |
|canvas currentExtent| |
|
219 |
||
220 |
canvas := self masterApplication painter topView. |
|
221 |
currentExtent := canvas extent. |
|
222 |
(self aspectFor:#minX) value:currentExtent x. |
|
223 |
(self aspectFor:#minY) value:currentExtent y. |
|
224 |
||
225 |
"Created: / 29.10.1997 / 18:17:55 / cg" |
|
226 |
"Modified: / 29.10.1997 / 18:28:53 / cg" |
|
227 |
! ! |
|
228 |
||
164 | 229 |
!UISpecificationTool methodsFor:'bindings'! |
230 |
||
1315 | 231 |
acceptChannel |
232 |
"return the value of the instance variable 'acceptChannel' (automatically generated)" |
|
233 |
||
234 |
^ masterApplication acceptChannel |
|
235 |
! |
|
236 |
||
164 | 237 |
aspectFor:aKey |
238 |
"returns aspect for a key or nil |
|
239 |
" |
|
240 |
aspects notNil ifTrue:[ |
|
241 |
^ aspects at:aKey ifAbsent:nil |
|
242 |
]. |
|
243 |
^ super aspectFor:aKey |
|
244 |
||
428 | 245 |
! |
246 |
||
1313 | 247 |
buildInView |
248 |
^ buildInView |
|
1307 | 249 |
! |
250 |
||
584
351914fcc5a4
Define #specificationFor: to fetch subspecifications and
Stefan Vogel <sv@exept.de>
parents:
580
diff
changeset
|
251 |
specificationFor:aKey |
351914fcc5a4
Define #specificationFor: to fetch subspecifications and
Stefan Vogel <sv@exept.de>
parents:
580
diff
changeset
|
252 |
"this is called if our current specification contains |
351914fcc5a4
Define #specificationFor: to fetch subspecifications and
Stefan Vogel <sv@exept.de>
parents:
580
diff
changeset
|
253 |
subspecifications or subcanvases. |
351914fcc5a4
Define #specificationFor: to fetch subspecifications and
Stefan Vogel <sv@exept.de>
parents:
580
diff
changeset
|
254 |
Get the subspecification from the current specification" |
351914fcc5a4
Define #specificationFor: to fetch subspecifications and
Stefan Vogel <sv@exept.de>
parents:
580
diff
changeset
|
255 |
|
1307 | 256 |
specification notNil ifTrue:[ |
257 |
^ specification class perform:aKey ifNotUnderstood:nil |
|
584
351914fcc5a4
Define #specificationFor: to fetch subspecifications and
Stefan Vogel <sv@exept.de>
parents:
580
diff
changeset
|
258 |
]. |
351914fcc5a4
Define #specificationFor: to fetch subspecifications and
Stefan Vogel <sv@exept.de>
parents:
580
diff
changeset
|
259 |
^ nil |
172 | 260 |
! ! |
261 |
||
262 |
!UISpecificationTool methodsFor:'change & update'! |
|
164 | 263 |
|
172 | 264 |
update |
265 |
"reload specification |
|
164 | 266 |
" |
172 | 267 |
specChannel notNil ifTrue:[ |
268 |
specChannel value:specification. |
|
269 |
] |
|
164 | 270 |
|
271 |
||
272 |
! |
|
273 |
||
274 |
update:something with:someArgument from:someone |
|
275 |
"any attribute changed its state in the current specification |
|
276 |
" |
|
277 |
someone ~~ modifiedHolder ifTrue:[ |
|
893 | 278 |
"/ any in the spec has changed. |
279 |
"/ update my modified holders value |
|
280 |
||
1071 | 281 |
modifiedHolder value:true |
164 | 282 |
] |
283 |
||
893 | 284 |
"Modified: / 16.7.1998 / 19:25:59 / cg" |
164 | 285 |
! ! |
286 |
||
1956 | 287 |
!UISpecificationTool methodsFor:'help'! |
288 |
||
289 |
basicHelpTextForKey:aKey |
|
290 |
"activeHelp interface: return some help text for a key. |
|
291 |
Redefined to ask the current components Spec first." |
|
292 |
||
293 |
|helpText| |
|
294 |
||
295 |
"/ first, ask the spec |
|
296 |
helpText := (specification helpSpec) at:aKey ifAbsent:nil. |
|
297 |
"/ DEBUG: helpText isNil ifTrue:[^ 'No help for key: ', aKey ]. |
|
298 |
||
299 |
helpText isNil ifTrue:[ |
|
300 |
helpText := super basicHelpTextForKey:aKey. |
|
301 |
]. |
|
302 |
"/ DEBUG: ^ aKey , ': ' , helpText |
|
303 |
^ helpText |
|
304 |
! ! |
|
305 |
||
1315 | 306 |
!UISpecificationTool methodsFor:'initialization'! |
307 |
||
308 |
initialize |
|
309 |
super initialize. |
|
310 |
buildInView := BuildInView new. |
|
1573 | 311 |
buildInView keepViews:true. |
1315 | 312 |
! ! |
313 |
||
164 | 314 |
!UISpecificationTool methodsFor:'selection'! |
315 |
||
316 |
selection:something |
|
172 | 317 |
"selection changed |
318 |
" |
|
1307 | 319 |
|slices index spec window| |
164 | 320 |
|
172 | 321 |
specification notNil ifTrue:[ |
322 |
slices := specification class slices. |
|
1307 | 323 |
index := slices findFirst:[:aSlice| aSlice first = something ]. |
164 | 324 |
|
1307 | 325 |
index ~~ 0 ifTrue:[ |
326 |
spec := specification class perform:((slices at:index) last) |
|
428 | 327 |
] |
164 | 328 |
]. |
329 |
||
172 | 330 |
spec ~= selection ifTrue:[ |
1307 | 331 |
(selection := spec) notNil ifTrue:[ |
332 |
listOfSpecViews isNil ifTrue:[ |
|
333 |
listOfSpecViews := Array new:(slices size). |
|
334 |
] ifFalse:[ |
|
335 |
window := listOfSpecViews at:index |
|
336 |
]. |
|
337 |
window isNil ifTrue:[ |
|
338 |
builder buildFromSpec:spec in:(window := SimpleView new). |
|
339 |
listOfSpecViews at:index put:window. |
|
340 |
]. |
|
341 |
]. |
|
1315 | 342 |
buildInView scrolledView:window. |
164 | 343 |
]. |
344 |
! ! |
|
345 |
||
1307 | 346 |
!UISpecificationTool::BuildInView methodsFor:'accessing'! |
759 | 347 |
|
2160 | 348 |
mapped |
349 |
super mapped. |
|
350 |
||
351 |
scrolledView notNil ifTrue:[ |
|
352 |
scrolledView beVisible. |
|
353 |
scrolledView raise. |
|
354 |
]. |
|
355 |
! |
|
356 |
||
1307 | 357 |
scrolledView:aView |
358 |
"set the view to be scrolled" |
|
1573 | 359 |
|wrapper y| |
1307 | 360 |
|
361 |
scrolledView == aView ifTrue:[^ self]. |
|
759 | 362 |
|
2160 | 363 |
scrolledView notNil ifTrue:[ |
364 |
scrolledView unmap. |
|
365 |
]. |
|
366 |
(scrolledView := aView) notNil ifTrue:[ |
|
367 |
scrolledView superView ~~ frame ifTrue:[ |
|
368 |
scrolledView borderWidth:0; level:0. |
|
1307 | 369 |
|
2160 | 370 |
frame addSubView:scrolledView. |
1573 | 371 |
|
2160 | 372 |
scrolledView subViews size == 1 ifTrue:[ |
373 |
wrapper := scrolledView subViews first. |
|
374 |
wrapper isScrollWrapper ifTrue:[ |
|
375 |
"/ give it a full-relative size, and let it do |
|
376 |
"/ the scrolling itself. |
|
377 |
y := 1.0 |
|
378 |
] |
|
379 |
]. |
|
380 |
y isNil ifTrue:[ |
|
381 |
y := scrolledView preferredExtent y |
|
382 |
]. |
|
383 |
scrolledView origin:0@0 corner:1.0 @ y. |
|
384 |
scrolledView allViewBackground:(self viewBackground). |
|
1351
811686e8acab
no additional scrollBar, if embedded view is itself a scrollable
Claus Gittinger <cg@exept.de>
parents:
1344
diff
changeset
|
385 |
]. |
2160 | 386 |
]. |
387 |
shown ifTrue:[ |
|
388 |
scrolledView beVisible. |
|
389 |
scrolledView raise. |
|
1307 | 390 |
self sizeChanged:nil. |
391 |
]. |
|
1573 | 392 |
model value:scrolledView. |
759 | 393 |
! ! |
394 |
||
1313 | 395 |
!UISpecificationTool::BuildInView methodsFor:'initialization'! |
396 |
||
397 |
level:aLevel |
|
398 |
super level:0 |
|
399 |
! |
|
400 |
||
401 |
realize |
|
1315 | 402 |
|
1313 | 403 |
super realize. |
404 |
superView notNil ifTrue:[superView level:0]. |
|
405 |
! ! |
|
406 |
||
164 | 407 |
!UISpecificationTool class methodsFor:'documentation'! |
408 |
||
409 |
version |
|
410 |
^ '$Header$' |
|
411 |
! ! |