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