163
|
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 |
|
|
16 |
ApplicationModel subclass:#UILayoutTool
|
221
|
17 |
instanceVariableNames:'modifiedHolder aspects selection layoutView tabList'
|
163
|
18 |
classVariableNames:''
|
|
19 |
poolDictionaries:''
|
|
20 |
category:'Interface-UIPainter'
|
|
21 |
!
|
|
22 |
|
184
|
23 |
ApplicationModel subclass:#AlignmentOrigin
|
163
|
24 |
instanceVariableNames:''
|
|
25 |
classVariableNames:''
|
|
26 |
poolDictionaries:''
|
|
27 |
privateIn:UILayoutTool
|
|
28 |
!
|
|
29 |
|
184
|
30 |
ApplicationModel subclass:#Extent
|
|
31 |
instanceVariableNames:''
|
|
32 |
classVariableNames:''
|
|
33 |
poolDictionaries:''
|
|
34 |
privateIn:UILayoutTool
|
|
35 |
!
|
|
36 |
|
|
37 |
ApplicationModel subclass:#LayoutFrame
|
|
38 |
instanceVariableNames:''
|
|
39 |
classVariableNames:''
|
|
40 |
poolDictionaries:''
|
|
41 |
privateIn:UILayoutTool
|
|
42 |
!
|
|
43 |
|
|
44 |
ApplicationModel subclass:#LayoutOrigin
|
163
|
45 |
instanceVariableNames:''
|
|
46 |
classVariableNames:''
|
|
47 |
poolDictionaries:''
|
|
48 |
privateIn:UILayoutTool
|
|
49 |
!
|
|
50 |
|
|
51 |
ApplicationModel subclass:#Point
|
|
52 |
instanceVariableNames:''
|
|
53 |
classVariableNames:''
|
|
54 |
poolDictionaries:''
|
|
55 |
privateIn:UILayoutTool
|
|
56 |
!
|
|
57 |
|
184
|
58 |
ApplicationModel subclass:#Rectangle
|
163
|
59 |
instanceVariableNames:''
|
|
60 |
classVariableNames:''
|
|
61 |
poolDictionaries:''
|
|
62 |
privateIn:UILayoutTool
|
|
63 |
!
|
|
64 |
|
|
65 |
!UILayoutTool class methodsFor:'documentation'!
|
|
66 |
|
|
67 |
copyright
|
|
68 |
"
|
|
69 |
COPYRIGHT (c) 1995 by eXept Software AG
|
|
70 |
All Rights Reserved
|
|
71 |
|
|
72 |
This software is furnished under a license and may be used
|
|
73 |
only in accordance with the terms of that license and with the
|
|
74 |
inclusion of the above copyright notice. This software may not
|
|
75 |
be provided or otherwise made available to, or used by, any
|
|
76 |
other person. No title to or ownership of the software is
|
|
77 |
hereby transferred.
|
|
78 |
"
|
|
79 |
|
|
80 |
|
|
81 |
|
|
82 |
!
|
|
83 |
|
|
84 |
documentation
|
|
85 |
"
|
|
86 |
used by the UIPainter to manipulate the layout of the selected component
|
|
87 |
|
|
88 |
[author:]
|
|
89 |
Claus Atzkern
|
|
90 |
|
|
91 |
[see also:]
|
|
92 |
UIPainter
|
|
93 |
UIHelpTool
|
|
94 |
UISpecificationTool
|
|
95 |
"
|
|
96 |
|
|
97 |
|
|
98 |
! !
|
|
99 |
|
|
100 |
!UILayoutTool class methodsFor:'constants'!
|
|
101 |
|
|
102 |
label
|
|
103 |
^ 'Layout'
|
|
104 |
! !
|
|
105 |
|
184
|
106 |
!UILayoutTool class methodsFor:'help specs'!
|
|
107 |
|
|
108 |
helpSpec
|
|
109 |
"return a dictionary filled with helpKey -> helptext associations.
|
293
|
110 |
These are used by the activeHelp tool."
|
|
111 |
|
184
|
112 |
"
|
293
|
113 |
UIHelpTool openOnClass:UILayoutTool
|
|
114 |
"
|
|
115 |
|
184
|
116 |
^ super helpSpec addPairsFrom:#(
|
|
117 |
|
|
118 |
#leftAbsolute
|
714
|
119 |
'Offset of the left edge; positive is to the right, negative to the left.'
|
184
|
120 |
|
201
|
121 |
#originY
|
714
|
122 |
'Absolute origin y of the selected widget.'
|
201
|
123 |
|
|
124 |
#cornerY
|
714
|
125 |
'Absolute corner y of the selected widget.'
|
201
|
126 |
|
|
127 |
#makeLeftAbsolute
|
714
|
128 |
'Computes current left offset and relative origin x to an absolute origin x.'
|
201
|
129 |
|
184
|
130 |
#topAbsolute
|
714
|
131 |
'Offset of the top edge; positive is to the bottom, negative to the top.'
|
184
|
132 |
|
201
|
133 |
#makeTopRelative
|
714
|
134 |
'Computes current relative origin y and offset of the top edge to a relative origin y.'
|
201
|
135 |
|
|
136 |
#leftRelative
|
714
|
137 |
'Relative origin x of the selected widget.'
|
184
|
138 |
|
|
139 |
#makeLeftRelative
|
714
|
140 |
'Compute current relative origin x and offset of the left edge to a relative origin x.'
|
184
|
141 |
|
201
|
142 |
#topRelative
|
714
|
143 |
'Relative origin y of the selected widget.'
|
201
|
144 |
|
|
145 |
#originX
|
714
|
146 |
'Absolute origin x of the selected widget.'
|
184
|
147 |
|
201
|
148 |
#cornerX
|
714
|
149 |
'Absolute corner x of the selected widget.'
|
201
|
150 |
|
|
151 |
#layoutTool
|
714
|
152 |
'Tool to set the layout of the selected widget.'
|
184
|
153 |
|
|
154 |
#makeTopAbsolute
|
714
|
155 |
'Computes current top offset and relative origin y to an absolute origin y.'
|
184
|
156 |
|
|
157 |
)
|
|
158 |
! !
|
|
159 |
|
163
|
160 |
!UILayoutTool class methodsFor:'interface specs'!
|
|
161 |
|
184
|
162 |
layoutOriginSpec
|
|
163 |
"this window spec was automatically generated by the ST/X UIPainter"
|
|
164 |
|
|
165 |
"do not manually edit this - the painter/builder may not be able to
|
|
166 |
handle the specification if its corrupted."
|
|
167 |
|
|
168 |
"
|
259
|
169 |
UIPainter new openOnClass:UILayoutTool andSelector:#layoutOriginSpec
|
|
170 |
UILayoutTool new openInterface:#layoutOriginSpec
|
184
|
171 |
"
|
|
172 |
|
|
173 |
<resource: #canvas>
|
|
174 |
|
|
175 |
^
|
259
|
176 |
|
184
|
177 |
#(#FullSpec
|
690
|
178 |
#window:
|
184
|
179 |
#(#WindowSpec
|
690
|
180 |
#name: 'uIPainterView'
|
|
181 |
#layout: #(#LayoutFrame 31 0 423 0 293 0 525 0)
|
|
182 |
#label: 'unnamed'
|
|
183 |
#min: #(#Point 10 10)
|
|
184 |
#max: #(#Point 1152 900)
|
|
185 |
#bounds: #(#Rectangle 31 423 294 526)
|
|
186 |
#usePreferredExtent: false
|
184
|
187 |
)
|
690
|
188 |
#component:
|
184
|
189 |
#(#SpecCollection
|
690
|
190 |
#collection:
|
184
|
191 |
#(
|
|
192 |
#(#LabelSpec
|
690
|
193 |
#name: 'labelRelative'
|
|
194 |
#layout: #(#Point 80 12)
|
|
195 |
#label: 'Relative:'
|
184
|
196 |
)
|
|
197 |
#(#LabelSpec
|
690
|
198 |
#name: 'labelAbsolute'
|
|
199 |
#layout: #(#Point 177 13)
|
|
200 |
#label: 'Offset:'
|
184
|
201 |
)
|
|
202 |
#(#LabelSpec
|
690
|
203 |
#name: 'labelLeft'
|
|
204 |
#layout: #(#AlignmentOrigin 78 0 39 0 1 0)
|
|
205 |
#label: 'Left:'
|
184
|
206 |
)
|
|
207 |
#(#InputFieldSpec
|
690
|
208 |
#name: 'fieldLeftFraction'
|
|
209 |
#layout: #(#LayoutFrame 80 0 36 0 137 0 58 0)
|
|
210 |
#activeHelpKey: #leftRelative
|
|
211 |
#tabable: true
|
|
212 |
#model: #leftFraction
|
|
213 |
#type: #numberOrNil
|
184
|
214 |
)
|
|
215 |
#(#ActionButtonSpec
|
690
|
216 |
#name: 'actionRelativeLeft'
|
|
217 |
#layout: #(#LayoutFrame 142 0 36 0 161 0 54 0)
|
|
218 |
#activeHelpKey: #makeLeftRelative
|
|
219 |
#model: #relativeLeft
|
184
|
220 |
)
|
|
221 |
#(#InputFieldSpec
|
690
|
222 |
#name: 'fieldLeftOffset'
|
|
223 |
#layout: #(#LayoutFrame 177 0 36 0 235 0 58 0)
|
|
224 |
#activeHelpKey: #leftAbsolute
|
|
225 |
#tabable: true
|
|
226 |
#model: #leftOffset
|
|
227 |
#type: #numberOrNil
|
184
|
228 |
)
|
|
229 |
#(#ActionButtonSpec
|
690
|
230 |
#name: 'actionAbsoluteLeft'
|
|
231 |
#layout: #(#LayoutFrame 239 0 36 0 258 0 54 0)
|
|
232 |
#activeHelpKey: #makeLeftAbsolute
|
|
233 |
#model: #absoluteLeft
|
184
|
234 |
)
|
|
235 |
#(#LabelSpec
|
690
|
236 |
#name: 'labelTop'
|
|
237 |
#layout: #(#AlignmentOrigin 78 0 66 0 1 0)
|
|
238 |
#label: 'Top:'
|
184
|
239 |
)
|
|
240 |
#(#InputFieldSpec
|
690
|
241 |
#name: 'fieldTopFraction'
|
|
242 |
#layout: #(#LayoutFrame 80 0 63 0 137 0 85 0)
|
|
243 |
#activeHelpKey: #topRelative
|
|
244 |
#tabable: true
|
|
245 |
#model: #topFraction
|
|
246 |
#type: #numberOrNil
|
184
|
247 |
)
|
|
248 |
#(#ActionButtonSpec
|
690
|
249 |
#name: 'actionRelativeTop'
|
|
250 |
#layout: #(#LayoutFrame 142 0 63 0 161 0 81 0)
|
|
251 |
#activeHelpKey: #makeTopRelative
|
|
252 |
#model: #relativeTop
|
184
|
253 |
)
|
|
254 |
#(#InputFieldSpec
|
690
|
255 |
#name: 'fieldTopOffset'
|
|
256 |
#layout: #(#LayoutFrame 177 0 63 0 235 0 85 0)
|
|
257 |
#activeHelpKey: #topAbsolute
|
|
258 |
#tabable: true
|
|
259 |
#model: #topOffset
|
|
260 |
#type: #numberOrNil
|
184
|
261 |
)
|
|
262 |
#(#ActionButtonSpec
|
690
|
263 |
#name: 'actionAbsoluteTop'
|
|
264 |
#layout: #(#LayoutFrame 239 0 63 0 258 0 81 0)
|
|
265 |
#activeHelpKey: #makeTopAbsolute
|
|
266 |
#model: #absoluteTop
|
184
|
267 |
)
|
|
268 |
)
|
|
269 |
)
|
|
270 |
)
|
|
271 |
!
|
|
272 |
|
|
273 |
layoutPointSpec
|
|
274 |
"this window spec was automatically generated by the ST/X UIPainter"
|
|
275 |
|
|
276 |
"do not manually edit this - the painter/builder may not be able to
|
|
277 |
handle the specification if its corrupted."
|
|
278 |
|
|
279 |
"
|
259
|
280 |
UIPainter new openOnClass:UILayoutTool andSelector:#layoutPointSpec
|
|
281 |
UILayoutTool new openInterface:#layoutPointSpec
|
184
|
282 |
"
|
259
|
283 |
|
184
|
284 |
<resource: #canvas>
|
|
285 |
|
|
286 |
^
|
259
|
287 |
|
184
|
288 |
#(#FullSpec
|
690
|
289 |
#window:
|
184
|
290 |
#(#WindowSpec
|
690
|
291 |
#name: 'uIPainterView'
|
|
292 |
#layout: #(#LayoutFrame 31 0 423 0 220 0 499 0)
|
|
293 |
#label: 'unnamed'
|
|
294 |
#min: #(#Point 10 10)
|
|
295 |
#max: #(#Point 1152 900)
|
|
296 |
#bounds: #(#Rectangle 31 423 221 500)
|
|
297 |
#usePreferredExtent: false
|
184
|
298 |
)
|
690
|
299 |
#component:
|
184
|
300 |
#(#SpecCollection
|
690
|
301 |
#collection:
|
184
|
302 |
#(
|
|
303 |
#(#LabelSpec
|
690
|
304 |
#name: 'labelOriginX'
|
|
305 |
#layout: #(#AlignmentOrigin 78 0 23 0 1 0)
|
|
306 |
#label: 'Origin x:'
|
184
|
307 |
)
|
|
308 |
#(#InputFieldSpec
|
690
|
309 |
#name: 'fieldOriginX'
|
|
310 |
#layout: #(#LayoutFrame 80 0 20 0 173 0 42 0)
|
|
311 |
#activeHelpKey: #originX
|
|
312 |
#tabable: true
|
|
313 |
#model: #leftOffset
|
|
314 |
#type: #numberOrNil
|
184
|
315 |
)
|
|
316 |
#(#LabelSpec
|
690
|
317 |
#name: 'labelOriginY'
|
|
318 |
#layout: #(#AlignmentOrigin 78 0 50 0 1 0)
|
|
319 |
#label: 'Origin y:'
|
184
|
320 |
)
|
|
321 |
#(#InputFieldSpec
|
690
|
322 |
#name: 'fieldOriginY'
|
|
323 |
#layout: #(#LayoutFrame 80 0 47 0 173 0 69 0)
|
|
324 |
#activeHelpKey: #originY
|
|
325 |
#tabable: true
|
|
326 |
#model: #topOffset
|
|
327 |
#type: #numberOrNil
|
184
|
328 |
)
|
|
329 |
)
|
|
330 |
)
|
|
331 |
)
|
|
332 |
!
|
|
333 |
|
163
|
334 |
slices
|
|
335 |
^ #(
|
|
336 |
( 'Frame' LayoutFrame)
|
|
337 |
( 'Origin' LayoutOrigin)
|
|
338 |
( 'Alig.Origin' AlignmentOrigin)
|
|
339 |
( 'Point' Point)
|
|
340 |
( 'Rectangle' Rectangle)
|
|
341 |
( 'Extent' Extent)
|
|
342 |
)
|
|
343 |
|
|
344 |
!
|
|
345 |
|
|
346 |
windowSpec
|
|
347 |
"this window spec was automatically generated by the ST/X UIPainter"
|
|
348 |
|
|
349 |
"do not manually edit this - the painter/builder may not be able to
|
|
350 |
handle the specification if its corrupted."
|
|
351 |
|
|
352 |
"
|
|
353 |
UIPainter new openOnClass:UILayoutTool andSelector:#windowSpec
|
|
354 |
UILayoutTool new openInterface:#windowSpec
|
|
355 |
"
|
|
356 |
"UILayoutTool open"
|
|
357 |
|
|
358 |
<resource: #canvas>
|
|
359 |
|
|
360 |
^
|
|
361 |
|
|
362 |
#(#FullSpec
|
|
363 |
#'window:'
|
|
364 |
#(#WindowSpec
|
|
365 |
#'name:' 'uIPainterView'
|
|
366 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
|
|
367 |
#'label:' 'unnamed canvas'
|
|
368 |
#'bounds:' #(#Rectangle 0 0 300 300)
|
|
369 |
)
|
|
370 |
#'component:'
|
|
371 |
#(#SpecCollection
|
|
372 |
#'collection:'
|
|
373 |
#(
|
|
374 |
#(#NoteBookViewSpec
|
|
375 |
#'name:' 'NoteBook'
|
|
376 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
|
184
|
377 |
#'activeHelpKey:' #layoutTool
|
|
378 |
#'enableChannel:' #enableChannel
|
163
|
379 |
#'tabable:' true
|
|
380 |
#'menu:' #noteBookList
|
|
381 |
#'style:'
|
|
382 |
#(#FontDescription
|
|
383 |
#helvetica #medium
|
|
384 |
#roman #'10'
|
|
385 |
)
|
|
386 |
#'model:' #noteBookModel
|
|
387 |
#'tabWidget:' #Window
|
|
388 |
#'direction:' #bottom
|
|
389 |
#'canvas:' #noteBookView
|
|
390 |
)
|
|
391 |
)
|
|
392 |
)
|
|
393 |
)
|
|
394 |
! !
|
|
395 |
|
|
396 |
!UILayoutTool methodsFor:'accessing'!
|
|
397 |
|
|
398 |
layout
|
|
399 |
"returns configued layout or nil
|
|
400 |
"
|
|
401 |
|appl|
|
|
402 |
|
|
403 |
(appl := self noteBookView application) notNil ifTrue:[
|
|
404 |
^ appl layout
|
|
405 |
].
|
|
406 |
^ nil
|
|
407 |
!
|
|
408 |
|
|
409 |
layoutType
|
|
410 |
"returns current layout type or nil
|
|
411 |
"
|
|
412 |
|slice|
|
|
413 |
|
|
414 |
(slice := self selectedSlice) notNil ifTrue:[
|
|
415 |
^ slice last
|
|
416 |
].
|
|
417 |
^ nil
|
|
418 |
!
|
|
419 |
|
|
420 |
layoutView
|
|
421 |
"returns current edited view
|
|
422 |
"
|
|
423 |
^ layoutView
|
|
424 |
!
|
|
425 |
|
|
426 |
layoutView:aView
|
|
427 |
"change current edited view
|
|
428 |
"
|
283
|
429 |
self layoutView:aView type:nil
|
|
430 |
!
|
|
431 |
|
|
432 |
layoutView:aView type:aTypeOrNil
|
|
433 |
"change current edited view
|
|
434 |
"
|
163
|
435 |
|type name list|
|
|
436 |
|
|
437 |
layoutView := aView.
|
|
438 |
|
283
|
439 |
aTypeOrNil notNil ifTrue:[
|
163
|
440 |
self class slices findFirst:[:e|
|
283
|
441 |
e last == aTypeOrNil ifTrue:[name := e first. true]
|
163
|
442 |
].
|
283
|
443 |
list := Array with:name
|
|
444 |
] ifFalse:[
|
|
445 |
(type := UIPainterView layoutType:layoutView) notNil ifTrue:[
|
|
446 |
self class slices findFirst:[:e|
|
|
447 |
e last == type ifTrue:[name := e first. true]
|
|
448 |
].
|
|
449 |
list := tabList.
|
235
|
450 |
|
283
|
451 |
type == #Extent ifTrue:[
|
|
452 |
aView superView specClass isLayoutContainer ifTrue:[
|
|
453 |
list := Array with:name
|
|
454 |
] ifFalse:[
|
|
455 |
list := list copyWith:name
|
|
456 |
]
|
235
|
457 |
]
|
|
458 |
]
|
163
|
459 |
].
|
|
460 |
self noteBookList value:list.
|
|
461 |
self noteBookModel value:name.
|
|
462 |
self update.
|
|
463 |
!
|
|
464 |
|
|
465 |
modifiedHolder:aValueHolder
|
|
466 |
"set the value holder set to true in case of modifying attributes
|
|
467 |
"
|
|
468 |
modifiedHolder notNil ifTrue:[
|
|
469 |
modifiedHolder removeDependent:self.
|
|
470 |
].
|
|
471 |
|
|
472 |
(modifiedHolder := aValueHolder) notNil ifTrue:[
|
|
473 |
modifiedHolder addDependent:self.
|
|
474 |
].
|
|
475 |
|
|
476 |
!
|
|
477 |
|
|
478 |
update
|
|
479 |
"update from view
|
|
480 |
"
|
|
481 |
|view appl|
|
|
482 |
|
|
483 |
selection notNil ifTrue:[
|
|
484 |
(view := self layoutView) notNil ifTrue:[
|
|
485 |
(appl := self noteBookView application) notNil ifTrue:[
|
|
486 |
appl fetch:view
|
|
487 |
]
|
|
488 |
]
|
|
489 |
].
|
|
490 |
|
|
491 |
! !
|
|
492 |
|
|
493 |
!UILayoutTool methodsFor:'aspects'!
|
|
494 |
|
|
495 |
aspectFor:aKey
|
|
496 |
"returns aspect for a key or nil
|
|
497 |
"
|
|
498 |
^ aspects at:aKey ifAbsent:[ super aspectFor:aKey ]
|
|
499 |
|
|
500 |
|
|
501 |
!
|
|
502 |
|
|
503 |
noteBookList
|
|
504 |
"returns list of tab labels
|
|
505 |
"
|
|
506 |
|holder|
|
|
507 |
|
|
508 |
(holder := builder bindingAt:#noteBookList) isNil ifTrue:[
|
|
509 |
holder := nil asValue.
|
|
510 |
builder aspectAt:#noteBookList put:holder
|
|
511 |
].
|
|
512 |
^ holder
|
|
513 |
!
|
|
514 |
|
|
515 |
noteBookModel
|
|
516 |
"automatically generated by UIPainter ..."
|
|
517 |
|
|
518 |
|holder|
|
|
519 |
|
|
520 |
(holder := builder bindingAt:#noteBookModel) isNil ifTrue:[
|
|
521 |
holder := AspectAdaptor new subject:self; forAspect:#selection.
|
|
522 |
builder aspectAt:#noteBookModel put:holder.
|
|
523 |
].
|
|
524 |
^ holder
|
|
525 |
!
|
|
526 |
|
|
527 |
noteBookView
|
|
528 |
"automatically generated by UIPainter ...
|
|
529 |
"
|
|
530 |
|holder|
|
|
531 |
|
|
532 |
(holder := builder bindingAt:#noteBookView) isNil ifTrue:[
|
|
533 |
holder := SubCanvas new.
|
|
534 |
builder aspectAt:#noteBookView put:holder
|
|
535 |
].
|
|
536 |
^ holder
|
|
537 |
! !
|
|
538 |
|
|
539 |
!UILayoutTool methodsFor:'change & update'!
|
|
540 |
|
|
541 |
update:something with:aParameter from:changedObject
|
|
542 |
"one of my models changed its value
|
|
543 |
"
|
|
544 |
changedObject ~~ modifiedHolder ifTrue:[
|
|
545 |
modifiedHolder value ~~ true ifTrue:[
|
|
546 |
modifiedHolder isNil ifFalse:[
|
|
547 |
modifiedHolder value:true
|
|
548 |
]
|
|
549 |
]
|
|
550 |
]
|
|
551 |
|
|
552 |
! !
|
|
553 |
|
|
554 |
!UILayoutTool methodsFor:'converting absolute'!
|
|
555 |
|
|
556 |
absolute:what xOrY:xOrY
|
|
557 |
|extent fraction offset fractSymb offsetSymb|
|
|
558 |
|
|
559 |
extent := (self layoutView superView computeExtent) perform:xOrY.
|
|
560 |
fractSymb := (what, 'Fraction') asSymbol.
|
|
561 |
offsetSymb := (what, 'Offset') asSymbol.
|
|
562 |
fraction := (self aspectFor:fractSymb) value.
|
|
563 |
offset := (self aspectFor:offsetSymb) value.
|
|
564 |
offset := offset + ((fraction * extent) asInteger).
|
|
565 |
|
|
566 |
(self aspectFor:offsetSymb) value:offset.
|
|
567 |
(self aspectFor:fractSymb) value:0.
|
|
568 |
|
|
569 |
|
|
570 |
|
|
571 |
!
|
|
572 |
|
|
573 |
absoluteBottom
|
|
574 |
self absolute:'bottom' xOrY:#y
|
|
575 |
|
|
576 |
!
|
|
577 |
|
|
578 |
absoluteLeft
|
|
579 |
self absolute:'left' xOrY:#x
|
|
580 |
|
|
581 |
!
|
|
582 |
|
|
583 |
absoluteRight
|
|
584 |
self absolute:'right' xOrY:#x
|
|
585 |
|
|
586 |
!
|
|
587 |
|
|
588 |
absoluteTop
|
|
589 |
self absolute:'top' xOrY:#y
|
|
590 |
|
|
591 |
! !
|
|
592 |
|
|
593 |
!UILayoutTool methodsFor:'converting relative'!
|
|
594 |
|
|
595 |
relative:what xOrY:xOrY
|
|
596 |
|extent fraction offset fractSymb offsetSymb|
|
|
597 |
|
|
598 |
extent := (self layoutView superView computeExtent) perform:xOrY.
|
|
599 |
fractSymb := (what, 'Fraction') asSymbol.
|
|
600 |
offsetSymb := (what, 'Offset') asSymbol.
|
|
601 |
fraction := (self aspectFor:fractSymb) value.
|
|
602 |
offset := (self aspectFor:offsetSymb) value.
|
|
603 |
fraction := (fraction + (offset / extent)) asFloat.
|
|
604 |
|
|
605 |
(fraction > 1.0) ifTrue:[ fraction := 1.0 ].
|
|
606 |
(fraction < 0.0) ifTrue:[ fraction := 0 ].
|
|
607 |
|
|
608 |
(self aspectFor:offsetSymb) value:0.
|
|
609 |
(self aspectFor:fractSymb) value:fraction.
|
|
610 |
|
|
611 |
|
|
612 |
|
|
613 |
!
|
|
614 |
|
|
615 |
relativeBottom
|
|
616 |
self relative:'bottom' xOrY:#y
|
|
617 |
|
|
618 |
|
|
619 |
!
|
|
620 |
|
|
621 |
relativeLeft
|
|
622 |
self relative:'left' xOrY:#x
|
|
623 |
|
|
624 |
!
|
|
625 |
|
|
626 |
relativeRight
|
|
627 |
self relative:'right' xOrY:#x
|
|
628 |
|
|
629 |
!
|
|
630 |
|
|
631 |
relativeTop
|
|
632 |
self relative:'top' xOrY:#y
|
|
633 |
|
|
634 |
! !
|
|
635 |
|
|
636 |
!UILayoutTool methodsFor:'initialization'!
|
|
637 |
|
|
638 |
initialize
|
|
639 |
"initialize channels
|
|
640 |
"
|
221
|
641 |
|slices size|
|
|
642 |
|
163
|
643 |
super initialize.
|
|
644 |
|
|
645 |
aspects := IdentityDictionary new.
|
|
646 |
|
|
647 |
#( bottomFraction bottomOffset
|
|
648 |
leftFraction leftOffset
|
|
649 |
topFraction topOffset
|
|
650 |
rightFraction rightOffset
|
|
651 |
leftAlignmentFraction topAlignmentFraction
|
|
652 |
)
|
|
653 |
|
|
654 |
do:[:aKey||holder|
|
|
655 |
holder := ValueHolder new.
|
|
656 |
holder addDependent:self.
|
|
657 |
aspects at:aKey put:holder.
|
|
658 |
].
|
|
659 |
|
221
|
660 |
slices := self class slices.
|
|
661 |
size := slices size - 1.
|
|
662 |
tabList := Array new:size.
|
163
|
663 |
|
221
|
664 |
1 to:size do:[:i| tabList at:i put:((slices at:i) first) ].
|
163
|
665 |
|
|
666 |
|
|
667 |
! !
|
|
668 |
|
|
669 |
!UILayoutTool methodsFor:'selection'!
|
|
670 |
|
|
671 |
selectedSlice
|
|
672 |
"returns slice assigned to selection or nil
|
|
673 |
"
|
|
674 |
selection notNil ifTrue:[
|
|
675 |
self class slices do:[:aSlice|
|
|
676 |
aSlice first = selection ifTrue:[
|
|
677 |
^ aSlice
|
|
678 |
]
|
|
679 |
]
|
|
680 |
].
|
|
681 |
^ nil
|
|
682 |
|
|
683 |
!
|
|
684 |
|
|
685 |
selection
|
|
686 |
^ selection
|
|
687 |
!
|
|
688 |
|
|
689 |
selection:aSelection
|
296
|
690 |
|appl slice sel noteBook|
|
163
|
691 |
|
293
|
692 |
aSelection isNumber ifTrue:[
|
|
693 |
aSelection ~~ 0 ifTrue:[sel := tabList at:aSelection]
|
|
694 |
] ifFalse:[
|
|
695 |
sel := aSelection
|
|
696 |
].
|
|
697 |
selection = sel ifFalse:[
|
|
698 |
(selection := sel) notNil ifTrue:[
|
163
|
699 |
slice := self selectedSlice.
|
|
700 |
appl := slice last asString.
|
|
701 |
appl := Smalltalk classNamed:(self class name asString, '::', appl).
|
|
702 |
appl := appl new.
|
|
703 |
appl masterApplication:self.
|
184
|
704 |
modifiedHolder value:true.
|
163
|
705 |
].
|
296
|
706 |
noteBook := self noteBookView.
|
|
707 |
noteBook client:appl.
|
|
708 |
|
|
709 |
appl notNil ifTrue:[
|
|
710 |
noteBook scrolledView allViewBackground:(noteBook viewBackground).
|
|
711 |
]
|
163
|
712 |
].
|
|
713 |
self update
|
293
|
714 |
|
163
|
715 |
! !
|
|
716 |
|
184
|
717 |
!UILayoutTool::AlignmentOrigin class methodsFor:'help specs'!
|
163
|
718 |
|
184
|
719 |
helpSpec
|
|
720 |
"return a dictionary filled with helpKey -> helptext associations.
|
293
|
721 |
These are used by the activeHelp tool."
|
|
722 |
|
163
|
723 |
"
|
293
|
724 |
UIHelpTool openOnClass:UILayoutTool::AlignmentOrigin
|
|
725 |
"
|
|
726 |
|
184
|
727 |
^ super helpSpec addPairsFrom:#(
|
163
|
728 |
|
293
|
729 |
#alignLeftCenter
|
714
|
730 |
'Aligns the selected widget leftCenter to location.'
|
293
|
731 |
|
|
732 |
#alignBottomCenter
|
714
|
733 |
'Aligns the selected widget bottomCenter to location.'
|
163
|
734 |
|
293
|
735 |
#alignHorizontal
|
714
|
736 |
'Horizontal inset to the location point of the selected widget.'
|
293
|
737 |
|
|
738 |
#alignBottomRight
|
714
|
739 |
'Aligns the selected widget bottomRight to location.'
|
293
|
740 |
|
|
741 |
#alignTopCenter
|
714
|
742 |
'Aligns the selected widget topCenter to location.'
|
163
|
743 |
|
293
|
744 |
#alignTopLeft
|
714
|
745 |
'Aligns the selected widget topLeft to location.'
|
293
|
746 |
|
|
747 |
#alignTopRight
|
714
|
748 |
'Aligns the selected widget topRight to location.'
|
293
|
749 |
|
|
750 |
#alignCenter
|
714
|
751 |
'Aligns the selected widget center to location.'
|
163
|
752 |
|
293
|
753 |
#alignVertical
|
714
|
754 |
'Vertical inset to the location point of the widget.'
|
293
|
755 |
|
|
756 |
#alignBottomLeft
|
714
|
757 |
'Aligns the selected widget bottomLeft to location.'
|
293
|
758 |
|
|
759 |
#alignRightCenter
|
714
|
760 |
'Aligns the selected widget rightCenter to location.'
|
163
|
761 |
|
184
|
762 |
)
|
163
|
763 |
! !
|
|
764 |
|
|
765 |
!UILayoutTool::AlignmentOrigin class methodsFor:'interface specs'!
|
|
766 |
|
|
767 |
windowSpec
|
|
768 |
"this window spec was automatically generated by the ST/X UIPainter"
|
|
769 |
|
|
770 |
"do not manually edit this - the painter/builder may not be able to
|
|
771 |
handle the specification if its corrupted."
|
|
772 |
|
|
773 |
"
|
|
774 |
UIPainter new openOnClass:UILayoutTool::AlignmentOrigin andSelector:#windowSpec
|
|
775 |
UILayoutTool::AlignmentOrigin new openInterface:#windowSpec
|
|
776 |
"
|
|
777 |
"UILayoutTool::AlignmentOrigin open"
|
|
778 |
|
|
779 |
<resource: #canvas>
|
|
780 |
|
|
781 |
^
|
|
782 |
|
|
783 |
#(#FullSpec
|
690
|
784 |
#window:
|
163
|
785 |
#(#WindowSpec
|
690
|
786 |
#name: 'uIPainterView'
|
|
787 |
#layout: #(#LayoutFrame 31 0 423 0 298 0 627 0)
|
|
788 |
#label: 'AlignmentOrigin'
|
|
789 |
#min: #(#Point 10 10)
|
|
790 |
#max: #(#Point 1152 900)
|
|
791 |
#bounds: #(#Rectangle 31 423 299 628)
|
|
792 |
#usePreferredExtent: false
|
163
|
793 |
)
|
690
|
794 |
#component:
|
163
|
795 |
#(#SpecCollection
|
690
|
796 |
#collection:
|
163
|
797 |
#(
|
|
798 |
#(#UISubSpecification
|
690
|
799 |
#name: 'subSpecification'
|
|
800 |
#layout: #(#LayoutOrigin 0 0 0 0)
|
|
801 |
#majorKey: #UILayoutTool
|
|
802 |
#minorKey: #layoutOriginSpec
|
163
|
803 |
)
|
|
804 |
#(#LabelSpec
|
690
|
805 |
#name: 'label5'
|
|
806 |
#layout: #(#AlignmentOrigin 78 0 102 0 1 0)
|
|
807 |
#label: 'Align H:'
|
|
808 |
#adjust: #right
|
163
|
809 |
)
|
|
810 |
#(#LabelSpec
|
690
|
811 |
#name: 'label6'
|
|
812 |
#layout: #(#AlignmentOrigin 78 0 128 0 1 0)
|
|
813 |
#label: 'Align V:'
|
|
814 |
#adjust: #right
|
163
|
815 |
)
|
|
816 |
#(#InputFieldSpec
|
690
|
817 |
#name: 'editField5'
|
|
818 |
#layout: #(#LayoutFrame 80 0 99 0 137 0 121 0)
|
|
819 |
#activeHelpKey: #alignHorizontal
|
|
820 |
#tabable: true
|
|
821 |
#model: #leftAlignmentFraction
|
|
822 |
#type: #numberOrNil
|
163
|
823 |
)
|
|
824 |
#(#InputFieldSpec
|
690
|
825 |
#name: 'editField6'
|
|
826 |
#layout: #(#LayoutFrame 80 0 125 0 137 0 147 0)
|
|
827 |
#activeHelpKey: #alignVertical
|
|
828 |
#tabable: true
|
|
829 |
#model: #topAlignmentFraction
|
|
830 |
#type: #numberOrNil
|
163
|
831 |
)
|
|
832 |
#(#DividerSpec
|
690
|
833 |
#name: 'separator1'
|
|
834 |
#layout: #(#Rectangle 166 103 215 106)
|
|
835 |
#orientation: #horizontal
|
163
|
836 |
)
|
|
837 |
#(#DividerSpec
|
690
|
838 |
#name: 'separator2'
|
|
839 |
#layout: #(#Rectangle 166 133 215 136)
|
|
840 |
#orientation: #horizontal
|
163
|
841 |
)
|
|
842 |
#(#DividerSpec
|
690
|
843 |
#name: 'separator3'
|
|
844 |
#layout: #(#Rectangle 161 111 164 132)
|
|
845 |
#orientation: #vertical
|
163
|
846 |
)
|
|
847 |
#(#DividerSpec
|
690
|
848 |
#name: 'separator4'
|
|
849 |
#layout: #(#Rectangle 217 111 220 132)
|
|
850 |
#orientation: #vertical
|
163
|
851 |
)
|
|
852 |
#(#ActionButtonSpec
|
690
|
853 |
#name: 'alignBottomRight'
|
|
854 |
#layout: #(#Rectangle 213 131 225 143)
|
|
855 |
#activeHelpKey: #alignBottomRight
|
|
856 |
#model: #alignBottomRight
|
163
|
857 |
)
|
|
858 |
#(#ActionButtonSpec
|
690
|
859 |
#name: 'alignTopLeft'
|
|
860 |
#layout: #(#Rectangle 157 100 169 112)
|
|
861 |
#activeHelpKey: #alignTopLeft
|
|
862 |
#model: #alignTopLeft
|
163
|
863 |
)
|
|
864 |
#(#ActionButtonSpec
|
690
|
865 |
#name: 'alignTopRight'
|
|
866 |
#layout: #(#Rectangle 213 100 225 112)
|
|
867 |
#activeHelpKey: #alignTopRight
|
|
868 |
#model: #alignTopRight
|
163
|
869 |
)
|
|
870 |
#(#ActionButtonSpec
|
690
|
871 |
#name: 'alignBottomLeft'
|
|
872 |
#layout: #(#Rectangle 157 130 169 142)
|
|
873 |
#activeHelpKey: #alignBottomLeft
|
|
874 |
#model: #alignBottomLeft
|
163
|
875 |
)
|
|
876 |
#(#ActionButtonSpec
|
690
|
877 |
#name: 'alignTopCenter'
|
|
878 |
#layout: #(#Rectangle 185 100 197 112)
|
|
879 |
#activeHelpKey: #alignTopCenter
|
|
880 |
#model: #alignTopCenter
|
163
|
881 |
)
|
|
882 |
#(#ActionButtonSpec
|
690
|
883 |
#name: 'alignBottomCenter'
|
|
884 |
#layout: #(#Rectangle 185 131 197 143)
|
|
885 |
#activeHelpKey: #alignBottomCenter
|
|
886 |
#model: #alignBottomCenter
|
163
|
887 |
)
|
|
888 |
#(#ActionButtonSpec
|
690
|
889 |
#name: 'alignLeftCenter'
|
|
890 |
#layout: #(#Rectangle 157 115 169 127)
|
|
891 |
#activeHelpKey: #alignLeftCenter
|
|
892 |
#model: #alignLeftCenter
|
163
|
893 |
)
|
|
894 |
#(#ActionButtonSpec
|
690
|
895 |
#name: 'alignRightCenter'
|
|
896 |
#layout: #(#Rectangle 213 115 225 127)
|
|
897 |
#activeHelpKey: #alignRightCenter
|
|
898 |
#model: #alignRightCenter
|
163
|
899 |
)
|
|
900 |
#(#ActionButtonSpec
|
690
|
901 |
#name: 'alignCenter'
|
|
902 |
#layout: #(#Rectangle 185 115 197 127)
|
|
903 |
#activeHelpKey: #alignCenter
|
|
904 |
#model: #alignCenter
|
163
|
905 |
)
|
|
906 |
)
|
|
907 |
)
|
|
908 |
)
|
|
909 |
! !
|
|
910 |
|
|
911 |
!UILayoutTool::AlignmentOrigin methodsFor:'accessing'!
|
|
912 |
|
|
913 |
fetch:aView
|
|
914 |
"fetch alignmentOrigin
|
|
915 |
"
|
252
|
916 |
|layout type|
|
163
|
917 |
|
|
918 |
type := UIPainterView layoutType:aView.
|
|
919 |
layout := aView geometryLayout.
|
|
920 |
|
|
921 |
layout isLayout ifTrue:[
|
|
922 |
(self aspectFor:#leftOffset) value:(layout leftOffset).
|
|
923 |
(self aspectFor:#leftFraction) value:(layout leftFraction).
|
|
924 |
(self aspectFor:#topOffset) value:(layout topOffset).
|
|
925 |
(self aspectFor:#topFraction) value:(layout topFraction).
|
|
926 |
|
|
927 |
type == #AlignmentOrigin ifTrue:[
|
|
928 |
(self aspectFor:#leftAlignmentFraction) value:(layout leftAlignmentFraction).
|
|
929 |
(self aspectFor:#topAlignmentFraction) value:(layout topAlignmentFraction).
|
|
930 |
^ self
|
|
931 |
]
|
|
932 |
] ifFalse:[
|
|
933 |
layout := aView computeOrigin.
|
|
934 |
|
|
935 |
(self aspectFor:#leftOffset) value:(layout x).
|
|
936 |
(self aspectFor:#leftFraction) value:0.
|
|
937 |
(self aspectFor:#topOffset) value:(layout y).
|
|
938 |
(self aspectFor:#topFraction) value:0.
|
|
939 |
].
|
|
940 |
(self aspectFor:#leftAlignmentFraction) value:0.
|
|
941 |
(self aspectFor:#topAlignmentFraction) value:0.
|
|
942 |
|
|
943 |
|
|
944 |
!
|
|
945 |
|
|
946 |
layout
|
|
947 |
"returns current layout as alignmentOrigin
|
|
948 |
"
|
|
949 |
|layout|
|
|
950 |
|
|
951 |
layout := Smalltalk::AlignmentOrigin new.
|
|
952 |
|
|
953 |
layout leftOffset:((self aspectFor:#leftOffset) value) ? 0.
|
|
954 |
layout topOffset:((self aspectFor:#topOffset) value) ? 0.
|
|
955 |
layout leftFraction:((self aspectFor:#leftFraction) value) ? 0.
|
|
956 |
layout topFraction:((self aspectFor:#topFraction) value) ? 0.
|
|
957 |
|
|
958 |
layout leftAlignmentFraction:((self aspectFor:#leftAlignmentFraction) value) ? 0.
|
|
959 |
layout topAlignmentFraction:((self aspectFor:#topAlignmentFraction) value) ? 0.
|
|
960 |
|
|
961 |
^ layout
|
|
962 |
! !
|
|
963 |
|
|
964 |
!UILayoutTool::AlignmentOrigin methodsFor:'alignment'!
|
|
965 |
|
|
966 |
alignBottomCenter
|
|
967 |
self makeAlignLeft:0.5 top:1
|
|
968 |
|
|
969 |
|
|
970 |
!
|
|
971 |
|
|
972 |
alignBottomLeft
|
|
973 |
self makeAlignLeft:0 top:1
|
|
974 |
|
|
975 |
|
|
976 |
!
|
|
977 |
|
|
978 |
alignBottomRight
|
|
979 |
self makeAlignLeft:1 top:1
|
|
980 |
|
|
981 |
|
|
982 |
!
|
|
983 |
|
|
984 |
alignCenter
|
|
985 |
self makeAlignLeft:0.5 top:0.5
|
|
986 |
|
|
987 |
|
|
988 |
!
|
|
989 |
|
|
990 |
alignLeftCenter
|
|
991 |
self makeAlignLeft:0 top:0.5
|
|
992 |
|
|
993 |
|
|
994 |
!
|
|
995 |
|
|
996 |
alignRightCenter
|
|
997 |
self makeAlignLeft:1 top:0.5
|
|
998 |
|
|
999 |
|
|
1000 |
!
|
|
1001 |
|
|
1002 |
alignTopCenter
|
|
1003 |
self makeAlignLeft:0.5 top:0
|
|
1004 |
|
|
1005 |
|
|
1006 |
!
|
|
1007 |
|
|
1008 |
alignTopLeft
|
|
1009 |
self makeAlignLeft:0 top:0
|
|
1010 |
|
|
1011 |
|
|
1012 |
!
|
|
1013 |
|
|
1014 |
alignTopRight
|
|
1015 |
self makeAlignLeft:1 top:0
|
|
1016 |
|
|
1017 |
|
|
1018 |
!
|
|
1019 |
|
|
1020 |
makeAlignLeft:leftAlignmentFraction top:topAlignmentFraction
|
|
1021 |
|lAF tAF lO tO ext|
|
|
1022 |
|
|
1023 |
lAF := (self aspectFor:#leftAlignmentFraction) value ? 0.
|
|
1024 |
tAF := (self aspectFor:#topAlignmentFraction) value ? 0.
|
|
1025 |
ext := (self aspectFor:#layoutView) computeExtent.
|
|
1026 |
|
|
1027 |
(self aspectFor:#leftAlignmentFraction) value:leftAlignmentFraction.
|
|
1028 |
(self aspectFor:#topAlignmentFraction) value:topAlignmentFraction.
|
|
1029 |
|
|
1030 |
lO := (self aspectFor:#leftOffset) value ? 0.
|
|
1031 |
tO := (self aspectFor:#topOffset) value ? 0.
|
|
1032 |
|
|
1033 |
lO := lO + (ext x * (leftAlignmentFraction - lAF)).
|
|
1034 |
tO := tO + (ext y * (topAlignmentFraction - tAF)).
|
|
1035 |
|
|
1036 |
(self aspectFor:#leftOffset) value:(lO rounded).
|
|
1037 |
(self aspectFor:#topOffset) value:(tO rounded).
|
|
1038 |
|
|
1039 |
!
|
|
1040 |
|
|
1041 |
makeAlignTopRight
|
|
1042 |
self makeAlignLeft:1 top:0
|
|
1043 |
|
|
1044 |
|
|
1045 |
! !
|
|
1046 |
|
184
|
1047 |
!UILayoutTool::Extent class methodsFor:'help specs'!
|
|
1048 |
|
|
1049 |
helpSpec
|
|
1050 |
"return a dictionary filled with helpKey -> helptext associations.
|
293
|
1051 |
These are used by the activeHelp tool."
|
|
1052 |
|
184
|
1053 |
"
|
293
|
1054 |
UIHelpTool openOnClass:UILayoutTool::Extent
|
|
1055 |
"
|
|
1056 |
|
184
|
1057 |
^ super helpSpec addPairsFrom:#(
|
|
1058 |
|
293
|
1059 |
#vrtExtent
|
714
|
1060 |
'Vertical extent of the selected widget.'
|
293
|
1061 |
|
|
1062 |
#hrzExtent
|
714
|
1063 |
'Horizontal extent of the selected widget.'
|
184
|
1064 |
|
|
1065 |
)
|
|
1066 |
! !
|
|
1067 |
|
163
|
1068 |
!UILayoutTool::Extent class methodsFor:'interface specs'!
|
|
1069 |
|
|
1070 |
windowSpec
|
|
1071 |
"this window spec was automatically generated by the ST/X UIPainter"
|
|
1072 |
|
|
1073 |
"do not manually edit this - the painter/builder may not be able to
|
|
1074 |
handle the specification if its corrupted."
|
|
1075 |
|
|
1076 |
"
|
|
1077 |
UIPainter new openOnClass:UILayoutTool::Extent andSelector:#windowSpec
|
|
1078 |
UILayoutTool::Extent new openInterface:#windowSpec
|
|
1079 |
"
|
|
1080 |
"UILayoutTool::Extent open"
|
|
1081 |
|
|
1082 |
<resource: #canvas>
|
|
1083 |
|
|
1084 |
^
|
|
1085 |
|
|
1086 |
#(#FullSpec
|
690
|
1087 |
#window:
|
163
|
1088 |
#(#WindowSpec
|
690
|
1089 |
#name: 'uIPainterView'
|
|
1090 |
#layout: #(#LayoutFrame 31 0 423 0 256 0 508 0)
|
|
1091 |
#label: 'unnamed'
|
|
1092 |
#min: #(#Point 10 10)
|
|
1093 |
#max: #(#Point 1152 900)
|
|
1094 |
#bounds: #(#Rectangle 31 423 257 509)
|
|
1095 |
#usePreferredExtent: false
|
163
|
1096 |
)
|
690
|
1097 |
#component:
|
163
|
1098 |
#(#SpecCollection
|
690
|
1099 |
#collection:
|
163
|
1100 |
#(
|
|
1101 |
#(#LabelSpec
|
690
|
1102 |
#name: 'labelWidth'
|
|
1103 |
#layout: #(#AlignmentOrigin 79 0 31 0 1 0.5)
|
|
1104 |
#label: 'Width:'
|
|
1105 |
#adjust: #right
|
163
|
1106 |
)
|
|
1107 |
#(#InputFieldSpec
|
690
|
1108 |
#name: 'fieldLeftOffset'
|
|
1109 |
#layout: #(#LayoutFrame 80 0 20 0 173 0 42 0)
|
|
1110 |
#activeHelpKey: #hrzExtent
|
|
1111 |
#tabable: true
|
|
1112 |
#model: #leftOffset
|
|
1113 |
#type: #numberOrNil
|
163
|
1114 |
)
|
|
1115 |
#(#LabelSpec
|
690
|
1116 |
#name: 'labelHeight'
|
|
1117 |
#layout: #(#AlignmentOrigin 79 0 58 0 1 0.5)
|
|
1118 |
#label: 'Height:'
|
|
1119 |
#adjust: #right
|
163
|
1120 |
)
|
|
1121 |
#(#InputFieldSpec
|
690
|
1122 |
#name: 'fieldRightOffset'
|
|
1123 |
#layout: #(#LayoutFrame 80 0 47 0 173 0 69 0)
|
|
1124 |
#activeHelpKey: #vrtExtent
|
|
1125 |
#tabable: true
|
|
1126 |
#model: #rightOffset
|
|
1127 |
#type: #numberOrNil
|
163
|
1128 |
)
|
|
1129 |
)
|
|
1130 |
)
|
|
1131 |
)
|
|
1132 |
! !
|
|
1133 |
|
|
1134 |
!UILayoutTool::Extent methodsFor:'accessing'!
|
|
1135 |
|
|
1136 |
fetch:aView
|
|
1137 |
"fetch extent
|
|
1138 |
"
|
|
1139 |
|extent|
|
|
1140 |
|
|
1141 |
extent := aView computeExtent.
|
|
1142 |
|
|
1143 |
(self aspectFor:#leftOffset) value:(extent x).
|
|
1144 |
(self aspectFor:#rightOffset) value:(extent y).
|
|
1145 |
|
|
1146 |
|
|
1147 |
!
|
|
1148 |
|
|
1149 |
layout
|
|
1150 |
"returns current extent
|
|
1151 |
"
|
|
1152 |
^ Smalltalk::Point x:(((self aspectFor:#leftOffset) value) ? 0)
|
|
1153 |
y:(((self aspectFor:#rightOffset) value) ? 0)
|
|
1154 |
|
|
1155 |
! !
|
|
1156 |
|
184
|
1157 |
!UILayoutTool::LayoutFrame class methodsFor:'help specs'!
|
|
1158 |
|
|
1159 |
helpSpec
|
|
1160 |
"return a dictionary filled with helpKey -> helptext associations.
|
293
|
1161 |
These are used by the activeHelp tool."
|
|
1162 |
|
184
|
1163 |
"
|
293
|
1164 |
UIHelpTool openOnClass:UILayoutTool::LayoutFrame
|
|
1165 |
"
|
|
1166 |
|
184
|
1167 |
^ super helpSpec addPairsFrom:#(
|
|
1168 |
|
|
1169 |
#makeRightRelative
|
714
|
1170 |
'Computes current relative corner x and offset of the right edge to a relative corner x.'
|
293
|
1171 |
|
|
1172 |
#makeBottomAbsolute
|
714
|
1173 |
'Computes current bottom offset and relative corner y to an absolute corner y.'
|
293
|
1174 |
|
|
1175 |
#bottomAbsolute
|
714
|
1176 |
'Offset of the bottom edge; positive is to the bottom, negative to the top.'
|
293
|
1177 |
|
|
1178 |
#rightRelative
|
714
|
1179 |
'Relative corner x of the selected widget.'
|
184
|
1180 |
|
|
1181 |
#makeBottomRelative
|
714
|
1182 |
'Computes current relative corner y and offset of the bottom edge to a relative corner y.'
|
184
|
1183 |
|
|
1184 |
#makeRightAbsolute
|
714
|
1185 |
'Computes current right offset and relative corner x to an absolute corner x.'
|
184
|
1186 |
|
293
|
1187 |
#bottomRelative
|
714
|
1188 |
'Relative corner y of the selected widget.'
|
184
|
1189 |
|
|
1190 |
#rightAbsolute
|
714
|
1191 |
'Offset of the right edge; positive is to the right, negative to the left.'
|
184
|
1192 |
|
|
1193 |
)
|
|
1194 |
! !
|
|
1195 |
|
|
1196 |
!UILayoutTool::LayoutFrame class methodsFor:'interface specs'!
|
|
1197 |
|
|
1198 |
windowSpec
|
|
1199 |
"this window spec was automatically generated by the ST/X UIPainter"
|
|
1200 |
|
|
1201 |
"do not manually edit this - the painter/builder may not be able to
|
|
1202 |
handle the specification if its corrupted."
|
|
1203 |
|
|
1204 |
"
|
|
1205 |
UIPainter new openOnClass:UILayoutTool::LayoutFrame andSelector:#windowSpec
|
|
1206 |
UILayoutTool::LayoutFrame new openInterface:#windowSpec
|
|
1207 |
"
|
|
1208 |
"UILayoutTool::LayoutFrame open"
|
|
1209 |
|
|
1210 |
<resource: #canvas>
|
|
1211 |
|
|
1212 |
^
|
|
1213 |
|
|
1214 |
#(#FullSpec
|
690
|
1215 |
#window:
|
184
|
1216 |
#(#WindowSpec
|
690
|
1217 |
#name: 'uIPainterView'
|
|
1218 |
#layout: #(#LayoutFrame 31 0 423 0 280 0 615 0)
|
|
1219 |
#label: 'unnamed'
|
|
1220 |
#min: #(#Point 10 10)
|
|
1221 |
#max: #(#Point 1152 900)
|
|
1222 |
#bounds: #(#Rectangle 31 423 281 616)
|
|
1223 |
#usePreferredExtent: false
|
184
|
1224 |
)
|
690
|
1225 |
#component:
|
184
|
1226 |
#(#SpecCollection
|
690
|
1227 |
#collection:
|
184
|
1228 |
#(
|
|
1229 |
#(#UISubSpecification
|
690
|
1230 |
#name: 'subLayoutSpec'
|
|
1231 |
#layout: #(#LayoutOrigin 0 0 0 0)
|
|
1232 |
#majorKey: #UILayoutTool
|
|
1233 |
#minorKey: #layoutOriginSpec
|
184
|
1234 |
)
|
|
1235 |
#(#LabelSpec
|
690
|
1236 |
#name: 'labelRight'
|
|
1237 |
#layout: #(#AlignmentOrigin 78 0 101 0 1 0)
|
|
1238 |
#label: 'Right:'
|
184
|
1239 |
)
|
|
1240 |
#(#InputFieldSpec
|
690
|
1241 |
#name: 'fieldRightFraction'
|
|
1242 |
#layout: #(#LayoutFrame 80 0 98 0 137 0 120 0)
|
|
1243 |
#activeHelpKey: #rightRelative
|
|
1244 |
#model: #rightFraction
|
|
1245 |
#type: #numberOrNil
|
184
|
1246 |
)
|
|
1247 |
#(#ActionButtonSpec
|
690
|
1248 |
#name: 'actionRelativeRight'
|
|
1249 |
#layout: #(#LayoutFrame 142 0 98 0 161 0 116 0)
|
|
1250 |
#activeHelpKey: #makeRightRelative
|
|
1251 |
#model: #relativeRight
|
184
|
1252 |
)
|
|
1253 |
#(#InputFieldSpec
|
690
|
1254 |
#name: 'fieldRightOffset'
|
|
1255 |
#layout: #(#LayoutFrame 177 0 98 0 235 0 120 0)
|
|
1256 |
#activeHelpKey: #rightAbsolute
|
|
1257 |
#model: #rightOffset
|
|
1258 |
#type: #numberOrNil
|
184
|
1259 |
)
|
|
1260 |
#(#ActionButtonSpec
|
690
|
1261 |
#name: 'actionAbsoluteRight'
|
|
1262 |
#layout: #(#LayoutFrame 239 0 98 0 258 0 116 0)
|
|
1263 |
#activeHelpKey: #makeRightAbsolute
|
|
1264 |
#model: #absoluteRight
|
184
|
1265 |
)
|
|
1266 |
#(#LabelSpec
|
690
|
1267 |
#name: 'labelBottom'
|
|
1268 |
#layout: #(#AlignmentOrigin 78 0 129 0 1 0)
|
|
1269 |
#label: 'Bottom:'
|
184
|
1270 |
)
|
|
1271 |
#(#InputFieldSpec
|
690
|
1272 |
#name: 'fieldBottomFraction'
|
|
1273 |
#layout: #(#LayoutFrame 80 0 126 0 137 0 148 0)
|
|
1274 |
#activeHelpKey: #bottomRelative
|
|
1275 |
#model: #bottomFraction
|
|
1276 |
#type: #numberOrNil
|
184
|
1277 |
)
|
|
1278 |
#(#ActionButtonSpec
|
690
|
1279 |
#name: 'actionRelativeBottom'
|
|
1280 |
#layout: #(#LayoutFrame 142 0 126 0 161 0 144 0)
|
|
1281 |
#activeHelpKey: #makeBottomRelative
|
|
1282 |
#model: #relativeBottom
|
184
|
1283 |
)
|
|
1284 |
#(#InputFieldSpec
|
690
|
1285 |
#name: 'fieldBottomOffset'
|
|
1286 |
#layout: #(#LayoutFrame 177 0 126 0 234 0 148 0)
|
|
1287 |
#activeHelpKey: #bottomAbsolute
|
|
1288 |
#model: #bottomOffset
|
|
1289 |
#type: #numberOrNil
|
184
|
1290 |
)
|
|
1291 |
#(#ActionButtonSpec
|
690
|
1292 |
#name: 'actionAbsoluteBottom'
|
|
1293 |
#layout: #(#LayoutFrame 239 0 126 0 258 0 144 0)
|
|
1294 |
#activeHelpKey: #makeBottomAbsolute
|
|
1295 |
#model: #absoluteBottom
|
184
|
1296 |
)
|
|
1297 |
)
|
|
1298 |
)
|
|
1299 |
)
|
|
1300 |
! !
|
|
1301 |
|
|
1302 |
!UILayoutTool::LayoutFrame methodsFor:'accessing'!
|
|
1303 |
|
|
1304 |
fetch:aView
|
|
1305 |
|layout|
|
|
1306 |
|
|
1307 |
layout := UIPainterView asLayoutFrameFromView:aView.
|
|
1308 |
|
|
1309 |
(self aspectFor:#leftOffset) value:(layout leftOffset).
|
|
1310 |
(self aspectFor:#leftFraction) value:(layout leftFraction).
|
|
1311 |
(self aspectFor:#topOffset) value:(layout topOffset).
|
|
1312 |
(self aspectFor:#topFraction) value:(layout topFraction).
|
|
1313 |
(self aspectFor:#rightOffset) value:(layout rightOffset).
|
|
1314 |
(self aspectFor:#bottomOffset) value:(layout bottomOffset).
|
|
1315 |
(self aspectFor:#rightFraction) value:(layout rightFraction).
|
|
1316 |
(self aspectFor:#bottomFraction) value:(layout bottomFraction).
|
|
1317 |
|
|
1318 |
!
|
|
1319 |
|
|
1320 |
layout
|
|
1321 |
"returns current layout as layoutFrame
|
|
1322 |
"
|
|
1323 |
|layout|
|
|
1324 |
|
|
1325 |
layout := Smalltalk::LayoutFrame new.
|
|
1326 |
|
|
1327 |
layout leftOffset:((self aspectFor:#leftOffset) value) ? 0.
|
|
1328 |
layout rightOffset:((self aspectFor:#rightOffset) value) ? 0.
|
|
1329 |
layout topOffset:((self aspectFor:#topOffset) value) ? 0.
|
|
1330 |
layout bottomOffset:((self aspectFor:#bottomOffset) value) ? 0.
|
|
1331 |
layout leftFraction:((self aspectFor:#leftFraction) value) ? 0.
|
|
1332 |
layout rightFraction:((self aspectFor:#rightFraction) value) ? 0.
|
|
1333 |
layout topFraction:((self aspectFor:#topFraction) value) ? 0.
|
|
1334 |
layout bottomFraction:((self aspectFor:#bottomFraction) value) ? 0.
|
|
1335 |
|
|
1336 |
^ layout
|
|
1337 |
|
|
1338 |
! !
|
|
1339 |
|
|
1340 |
!UILayoutTool::LayoutOrigin class methodsFor:'interface specs'!
|
|
1341 |
|
|
1342 |
windowSpec
|
|
1343 |
"this window spec was automatically generated by the ST/X UIPainter"
|
|
1344 |
|
|
1345 |
"do not manually edit this - the painter/builder may not be able to
|
|
1346 |
handle the specification if its corrupted."
|
|
1347 |
|
|
1348 |
"
|
|
1349 |
UIPainter new openOnClass:UILayoutTool::LayoutOrigin andSelector:#windowSpec
|
|
1350 |
UILayoutTool::LayoutOrigin new openInterface:#windowSpec
|
|
1351 |
"
|
|
1352 |
"UILayoutTool::LayoutOrigin open"
|
|
1353 |
|
|
1354 |
<resource: #canvas>
|
|
1355 |
|
|
1356 |
^
|
|
1357 |
|
|
1358 |
#(#FullSpec
|
|
1359 |
#'window:'
|
|
1360 |
#(#WindowSpec
|
|
1361 |
#'name:' 'uIPainterView'
|
|
1362 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
|
|
1363 |
#'label:' 'unnamed'
|
|
1364 |
#'bounds:' #(#Rectangle 0 0 258 93)
|
|
1365 |
)
|
|
1366 |
#'component:'
|
|
1367 |
#(#SpecCollection
|
|
1368 |
#'collection:'
|
|
1369 |
#(
|
|
1370 |
#(#UISubSpecification
|
|
1371 |
#'name:' 'subSpecification'
|
|
1372 |
#'layout:' #(#LayoutOrigin 0 0 0 0)
|
|
1373 |
#'majorKey:' #UILayoutTool
|
|
1374 |
#'minorKey:' #layoutOriginSpec
|
|
1375 |
)
|
|
1376 |
)
|
|
1377 |
)
|
|
1378 |
)
|
|
1379 |
! !
|
|
1380 |
|
|
1381 |
!UILayoutTool::LayoutOrigin methodsFor:'accessing'!
|
|
1382 |
|
|
1383 |
fetch:aView
|
|
1384 |
"fetch layoutOrigin
|
|
1385 |
"
|
|
1386 |
|layout|
|
|
1387 |
|
|
1388 |
layout := UIPainterView asLayoutFrameFromView:aView.
|
|
1389 |
|
|
1390 |
(self aspectFor:#leftOffset) value:(layout leftOffset).
|
|
1391 |
(self aspectFor:#leftFraction) value:(layout leftFraction).
|
|
1392 |
(self aspectFor:#topOffset) value:(layout topOffset).
|
|
1393 |
(self aspectFor:#topFraction) value:(layout topFraction).
|
|
1394 |
|
|
1395 |
|
|
1396 |
!
|
|
1397 |
|
|
1398 |
layout
|
|
1399 |
"returns current layout as layoutOrigin
|
|
1400 |
"
|
|
1401 |
|layout|
|
|
1402 |
|
|
1403 |
layout := Smalltalk::LayoutOrigin new.
|
|
1404 |
|
|
1405 |
layout leftOffset:((self aspectFor:#leftOffset) value) ? 0.
|
|
1406 |
layout topOffset:((self aspectFor:#topOffset) value) ? 0.
|
|
1407 |
layout leftFraction:((self aspectFor:#leftFraction) value) ? 0.
|
|
1408 |
layout topFraction:((self aspectFor:#topFraction) value) ? 0.
|
|
1409 |
|
|
1410 |
^ layout
|
|
1411 |
|
|
1412 |
! !
|
|
1413 |
|
|
1414 |
!UILayoutTool::Point class methodsFor:'interface specs'!
|
|
1415 |
|
|
1416 |
windowSpec
|
|
1417 |
"this window spec was automatically generated by the ST/X UIPainter"
|
|
1418 |
|
|
1419 |
"do not manually edit this - the painter/builder may not be able to
|
|
1420 |
handle the specification if its corrupted."
|
|
1421 |
|
|
1422 |
"
|
|
1423 |
UIPainter new openOnClass:UILayoutTool::Point andSelector:#windowSpec
|
|
1424 |
UILayoutTool::Point new openInterface:#windowSpec
|
|
1425 |
"
|
|
1426 |
"UILayoutTool::Point open"
|
|
1427 |
|
|
1428 |
<resource: #canvas>
|
|
1429 |
|
|
1430 |
^
|
|
1431 |
|
|
1432 |
#(#FullSpec
|
|
1433 |
#'window:'
|
|
1434 |
#(#WindowSpec
|
|
1435 |
#'name:' 'uIPainterView'
|
|
1436 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
|
|
1437 |
#'label:' 'unnamed'
|
|
1438 |
#'bounds:' #(#Rectangle 0 0 194 66)
|
|
1439 |
)
|
|
1440 |
#'component:'
|
|
1441 |
#(#SpecCollection
|
|
1442 |
#'collection:'
|
|
1443 |
#(
|
|
1444 |
#(#UISubSpecification
|
|
1445 |
#'name:' 'subSpecification'
|
|
1446 |
#'layout:' #(#LayoutOrigin 0 0 0 0)
|
|
1447 |
#'majorKey:' #UILayoutTool
|
|
1448 |
#'minorKey:' #layoutPointSpec
|
|
1449 |
)
|
|
1450 |
)
|
|
1451 |
)
|
|
1452 |
)
|
|
1453 |
! !
|
|
1454 |
|
|
1455 |
!UILayoutTool::Point methodsFor:'accessing'!
|
|
1456 |
|
|
1457 |
fetch:aView
|
|
1458 |
"fetch point
|
|
1459 |
"
|
|
1460 |
|origin|
|
|
1461 |
|
|
1462 |
origin := aView computeOrigin.
|
|
1463 |
|
|
1464 |
(self aspectFor:#leftOffset) value:(origin x).
|
|
1465 |
(self aspectFor:#topOffset) value:(origin y).
|
|
1466 |
|
|
1467 |
|
|
1468 |
!
|
|
1469 |
|
|
1470 |
layout
|
|
1471 |
"returns current layout as point
|
|
1472 |
"
|
|
1473 |
^ Smalltalk::Point x:(((self aspectFor:#leftOffset) value) ? 0)
|
|
1474 |
y:(((self aspectFor:#topOffset) value) ? 0)
|
|
1475 |
|
|
1476 |
! !
|
|
1477 |
|
|
1478 |
!UILayoutTool::Rectangle class methodsFor:'interface specs'!
|
|
1479 |
|
|
1480 |
windowSpec
|
|
1481 |
"this window spec was automatically generated by the ST/X UIPainter"
|
|
1482 |
|
|
1483 |
"do not manually edit this - the painter/builder may not be able to
|
|
1484 |
handle the specification if its corrupted."
|
|
1485 |
|
|
1486 |
"
|
|
1487 |
UIPainter new openOnClass:UILayoutTool::Rectangle andSelector:#windowSpec
|
|
1488 |
UILayoutTool::Rectangle new openInterface:#windowSpec
|
|
1489 |
"
|
|
1490 |
"UILayoutTool::Rectangle open"
|
|
1491 |
|
|
1492 |
<resource: #canvas>
|
|
1493 |
|
|
1494 |
^
|
|
1495 |
|
|
1496 |
#(#FullSpec
|
690
|
1497 |
#window:
|
184
|
1498 |
#(#WindowSpec
|
690
|
1499 |
#name: 'uIPainterView'
|
|
1500 |
#layout: #(#LayoutFrame 31 0 423 0 254 0 568 0)
|
|
1501 |
#label: 'unnamed'
|
|
1502 |
#min: #(#Point 10 10)
|
|
1503 |
#max: #(#Point 1152 900)
|
|
1504 |
#bounds: #(#Rectangle 31 423 255 569)
|
|
1505 |
#usePreferredExtent: false
|
184
|
1506 |
)
|
690
|
1507 |
#component:
|
184
|
1508 |
#(#SpecCollection
|
690
|
1509 |
#collection:
|
184
|
1510 |
#(
|
|
1511 |
#(#UISubSpecification
|
690
|
1512 |
#name: 'subSpecification'
|
|
1513 |
#layout: #(#LayoutOrigin 0 0 0 0)
|
|
1514 |
#majorKey: #UILayoutTool
|
|
1515 |
#minorKey: #layoutPointSpec
|
184
|
1516 |
)
|
|
1517 |
#(#LabelSpec
|
690
|
1518 |
#name: 'labelCornerX'
|
|
1519 |
#layout: #(#AlignmentOrigin 78 0 77 0 1 0)
|
|
1520 |
#label: 'Corner x:'
|
|
1521 |
#adjust: #left
|
184
|
1522 |
)
|
|
1523 |
#(#InputFieldSpec
|
690
|
1524 |
#name: 'fieldCornerX'
|
|
1525 |
#layout: #(#LayoutFrame 80 0 74 0 173 0 96 0)
|
|
1526 |
#activeHelpKey: #cornerX
|
|
1527 |
#tabable: true
|
|
1528 |
#model: #rightOffset
|
|
1529 |
#type: #numberOrNil
|
184
|
1530 |
)
|
|
1531 |
#(#LabelSpec
|
690
|
1532 |
#name: 'labelCornerY'
|
|
1533 |
#layout: #(#AlignmentOrigin 78 0 104 0 1 0)
|
|
1534 |
#label: 'Corner y:'
|
|
1535 |
#adjust: #left
|
184
|
1536 |
)
|
|
1537 |
#(#InputFieldSpec
|
690
|
1538 |
#name: 'fieldCornerY'
|
|
1539 |
#layout: #(#LayoutFrame 80 0 101 0 173 0 123 0)
|
|
1540 |
#activeHelpKey: #cornerY
|
|
1541 |
#tabable: true
|
|
1542 |
#model: #bottomOffset
|
|
1543 |
#type: #numberOrNil
|
184
|
1544 |
)
|
|
1545 |
)
|
|
1546 |
)
|
|
1547 |
)
|
|
1548 |
! !
|
|
1549 |
|
|
1550 |
!UILayoutTool::Rectangle methodsFor:'accessing'!
|
|
1551 |
|
|
1552 |
fetch:aView
|
|
1553 |
"fetch rectangle
|
|
1554 |
"
|
|
1555 |
|origin corner|
|
|
1556 |
|
|
1557 |
origin := aView computeOrigin.
|
|
1558 |
corner := aView computeCorner.
|
|
1559 |
|
|
1560 |
(self aspectFor:#leftOffset) value:(origin x).
|
|
1561 |
(self aspectFor:#rightOffset) value:(corner x).
|
|
1562 |
(self aspectFor:#topOffset) value:(origin y).
|
|
1563 |
(self aspectFor:#bottomOffset) value:(corner y).
|
|
1564 |
|
|
1565 |
|
|
1566 |
!
|
|
1567 |
|
|
1568 |
layout
|
|
1569 |
"returns current layout as rectangle
|
|
1570 |
"
|
|
1571 |
^ Smalltalk::Rectangle left:(((self aspectFor:#leftOffset) value) ? 0)
|
|
1572 |
top:(((self aspectFor:#topOffset) value) ? 0)
|
|
1573 |
right:(((self aspectFor:#rightOffset) value) ? 0)
|
|
1574 |
bottom:(((self aspectFor:#bottomOffset) value) ? 0)
|
|
1575 |
|
|
1576 |
|
|
1577 |
! !
|
|
1578 |
|
163
|
1579 |
!UILayoutTool class methodsFor:'documentation'!
|
|
1580 |
|
|
1581 |
version
|
|
1582 |
^ '$Header$'
|
|
1583 |
! !
|