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