author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Mon, 05 Feb 2018 12:41:00 +0000 | |
branch | jv |
changeset 4075 | 15f43beff36a |
parent 3855 | 1db7742d33ad |
permissions | -rw-r--r-- |
3855
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
1 |
" |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
2 |
COPYRIGHT (c) Claus Gittinger / 2006 by eXept Software AG |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
3 |
All Rights Reserved |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
4 |
|
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
5 |
This software is furnished under a license and may be used |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
6 |
only in accordance with the terms of that license and with the |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
7 |
inclusion of the above copyright notice. This software may not |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
8 |
be provided or otherwise made available to, or used by, any |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
9 |
other person. No title to or ownership of the software is |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
10 |
hereby transferred. |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
11 |
" |
1789 | 12 |
"{ Package: 'stx:libview2' }" |
13 |
||
3855
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
14 |
"{ NameSpace: Smalltalk }" |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
15 |
|
278 | 16 |
TranslatingWrapper subclass:#LayoutWrapper |
2811 | 17 |
instanceVariableNames:'bounds' |
278 | 18 |
classVariableNames:'' |
19 |
poolDictionaries:'' |
|
1789 | 20 |
category:'Compatibility-ST80-Graphics-Display Objects' |
278 | 21 |
! |
22 |
||
365 | 23 |
!LayoutWrapper class methodsFor:'documentation'! |
24 |
||
3855
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
25 |
copyright |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
26 |
" |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
27 |
COPYRIGHT (c) Claus Gittinger / 2006 by eXept Software AG |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
28 |
All Rights Reserved |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
29 |
|
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
30 |
This software is furnished under a license and may be used |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
31 |
only in accordance with the terms of that license and with the |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
32 |
inclusion of the above copyright notice. This software may not |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
33 |
be provided or otherwise made available to, or used by, any |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
34 |
other person. No title to or ownership of the software is |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
35 |
hereby transferred. |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
36 |
" |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
37 |
! |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
38 |
|
365 | 39 |
documentation |
40 |
" |
|
41 |
Notice: |
|
42 |
this class was implemented using protocol information |
|
43 |
from alpha testers, from reading PD programs and |
|
44 |
from the Hopkins/Horan book. |
|
45 |
- it may not be complete or compatible to the corresponding ST-80 class. |
|
46 |
If you encounter any incompatibilities, please forward a note |
|
47 |
describing the incompatibility verbal (i.e. no code) to the ST/X team. |
|
48 |
||
49 |
[author:] |
|
50 |
Claus Gittinger |
|
51 |
" |
|
52 |
||
53 |
! |
|
292
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
54 |
|
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
55 |
examples |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
56 |
" |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
57 |
[exBegin] |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
58 |
|t view wrapper| |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
59 |
|
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
60 |
t := StandardSystemView extent:200@200. |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
61 |
|
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
62 |
view := View new. |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
63 |
view viewBackground:Color red. |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
64 |
|
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
65 |
wrapper := LayoutWrapper new. |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
66 |
wrapper layout:(LayoutFrame new |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
67 |
leftFraction:0.2; |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
68 |
rightFraction:0.8; |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
69 |
topFraction:0.2; |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
70 |
bottomFraction:0.8). |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
71 |
wrapper component:view. |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
72 |
|
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
73 |
t addComponent:wrapper. |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
74 |
|
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
75 |
t open |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
76 |
[exEnd] |
323 | 77 |
[exBegin] |
78 |
|top frame1 view1 frame2 view2| |
|
79 |
||
80 |
top := StandardSystemView new. |
|
81 |
frame1 := LayoutWrapper new. |
|
82 |
frame1 layout:(0.1@0.1 corner:0.9@0.9) asLayout. |
|
83 |
top addSubView:frame1. |
|
84 |
||
85 |
view1 := View new. |
|
86 |
view1 viewBackground:Color red. |
|
87 |
frame1 component:view1. |
|
88 |
||
89 |
frame2 := LayoutWrapper new. |
|
90 |
frame2 layout:(0.1@0.1 corner:0.9@0.9) asLayout. |
|
91 |
view1 addSubView:frame2. |
|
92 |
||
93 |
view2 := View new. |
|
94 |
view2 viewBackground:Color green. |
|
95 |
frame2 component:view2. |
|
96 |
||
97 |
top openWithExtent:200@200 |
|
98 |
[exEnd] |
|
292
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
99 |
" |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
100 |
! ! |
278 | 101 |
|
365 | 102 |
!LayoutWrapper class methodsFor:'instance creation'! |
278 | 103 |
|
104 |
on:aComponent in:aLayout |
|
105 |
"create and return a layoutWrapper, which controls |
|
106 |
aComponent bounds using aLayout. |
|
107 |
The layout argument may be: |
|
108 |
nil - no constraint |
|
109 |
Point - origin shift |
|
110 |
Rectangle - origin shift & extent |
|
111 |
Layout - full control" |
|
112 |
||
113 |
^ (self on:aComponent) layout:aLayout |
|
114 |
||
115 |
"Created: 26.5.1996 / 16:18:44 / cg" |
|
116 |
"Modified: 26.5.1996 / 16:34:04 / cg" |
|
117 |
! ! |
|
118 |
||
119 |
!LayoutWrapper methodsFor:'accessing'! |
|
120 |
||
323 | 121 |
bounds:newBounds |
122 |
"/ Transcript showCR:newBounds. |
|
123 |
bounds := newBounds. |
|
124 |
self layoutChanged |
|
125 |
||
126 |
"Created: 19.7.1996 / 20:10:09 / cg" |
|
127 |
"Modified: 19.7.1996 / 21:20:42 / cg" |
|
128 |
! |
|
129 |
||
278 | 130 |
layout:something |
292
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
131 |
"set the layout" |
278 | 132 |
|
133 |
layout := something. |
|
323 | 134 |
self layoutChanged |
278 | 135 |
|
136 |
"Created: 26.5.1996 / 16:18:11 / cg" |
|
323 | 137 |
"Modified: 19.7.1996 / 20:15:20 / cg" |
138 |
! ! |
|
139 |
||
140 |
!LayoutWrapper methodsFor:'private'! |
|
141 |
||
142 |
layoutChanged |
|
143 |
|subBounds| |
|
144 |
||
145 |
component notNil ifTrue:[ |
|
146 |
layout notNil ifTrue:[ |
|
147 |
subBounds := (layout |
|
148 |
rectangleRelativeTo:bounds |
|
149 |
preferred:bounds) rounded. |
|
150 |
] ifFalse:[ |
|
151 |
subBounds := bounds |
|
152 |
]. |
|
153 |
||
154 |
origin := subBounds origin. |
|
155 |
"/ Transcript show:layout displayString; show:'subbounds: '; showCR:subBounds. |
|
156 |
component bounds:subBounds. |
|
157 |
] |
|
158 |
||
159 |
"Created: 19.7.1996 / 20:15:05 / cg" |
|
160 |
"Modified: 19.7.1996 / 21:20:46 / cg" |
|
292
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
161 |
! ! |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
162 |
|
321 | 163 |
!LayoutWrapper methodsFor:'queries'! |
164 |
||
165 |
isLayoutWrapper |
|
166 |
^ true |
|
167 |
||
168 |
"Created: 19.7.1996 / 17:51:16 / cg" |
|
323 | 169 |
! |
170 |
||
171 |
preferredBounds |
|
172 |
|b w h lw lh| |
|
173 |
||
174 |
bounds := component preferredBounds. |
|
175 |
layout isNil ifTrue:[^ bounds]. |
|
176 |
||
177 |
w := bounds width. |
|
178 |
h := bounds height. |
|
179 |
||
180 |
"/ now, inverse apply the layouts values |
|
181 |
||
182 |
lw := layout rightFraction - layout leftFraction. |
|
183 |
lw ~~ 0 ifTrue:[ |
|
184 |
lw := w * (1 / lw) |
|
185 |
]. |
|
186 |
lh := layout bottomFraction - layout topFraction. |
|
187 |
lh ~~ 0 ifTrue:[ |
|
188 |
lh := h * (1 / lh) |
|
189 |
]. |
|
190 |
lw := lw + layout rightOffset - layout leftOffset. |
|
191 |
lh := lh + layout bottomOffset - layout topOffset. |
|
192 |
||
193 |
^ 0@0 corner:(lw rounded @ lh rounded) |
|
194 |
||
195 |
"Created: 19.7.1996 / 17:51:16 / cg" |
|
196 |
"Modified: 19.7.1996 / 20:08:51 / cg" |
|
321 | 197 |
! ! |
198 |
||
292
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
199 |
!LayoutWrapper methodsFor:'view protocol mimicri'! |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
200 |
|
323 | 201 |
computeOrigin |
202 |
"return my origin" |
|
203 |
||
204 |
^ 0@0 |
|
205 |
||
206 |
"Created: 19.7.1996 / 20:05:37 / cg" |
|
207 |
! |
|
208 |
||
209 |
origin:org corner:corn |
|
210 |
|newLayout l r t b lF rF tF bF lO rO tO bO| |
|
292
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
211 |
|
323 | 212 |
newLayout := LayoutFrame new. |
213 |
l := org x. |
|
214 |
l isInteger ifTrue:[ |
|
215 |
lO := l. |
|
216 |
lF := 0.0 |
|
217 |
] ifFalse:[ |
|
218 |
lO := 0. |
|
219 |
lF := l |
|
220 |
]. |
|
221 |
r := corn x. |
|
222 |
r isInteger ifTrue:[ |
|
223 |
rO := r. |
|
224 |
rF := 0.0 |
|
225 |
] ifFalse:[ |
|
226 |
rO := 0. |
|
227 |
rF := r |
|
228 |
]. |
|
229 |
t := org y. |
|
230 |
t isInteger ifTrue:[ |
|
231 |
tO := t. |
|
232 |
tF := 0.0 |
|
233 |
] ifFalse:[ |
|
234 |
tO := 0. |
|
235 |
tF := t |
|
236 |
]. |
|
237 |
b := corn y. |
|
238 |
b isInteger ifTrue:[ |
|
239 |
bO := b. |
|
240 |
bF := 0.0 |
|
241 |
] ifFalse:[ |
|
242 |
bO := 0. |
|
243 |
bF := b |
|
244 |
]. |
|
292
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
245 |
|
323 | 246 |
newLayout |
247 |
leftFraction:lF offset:lO; |
|
248 |
rightFraction:rF offset:rO; |
|
249 |
topFraction:tF offset:tO; |
|
250 |
bottomFraction:bF offset:bO. |
|
251 |
||
252 |
self layout:newLayout |
|
253 |
||
254 |
"Modified: 19.7.1996 / 21:22:11 / cg" |
|
278 | 255 |
! ! |
256 |
||
365 | 257 |
!LayoutWrapper class methodsFor:'documentation'! |
278 | 258 |
|
259 |
version |
|
2811 | 260 |
^ '$Header: /cvs/stx/stx/libview2/LayoutWrapper.st,v 1.7 2009-11-24 18:21:01 stefan Exp $' |
261 |
! |
|
262 |
||
263 |
version_CVS |
|
264 |
^ '$Header: /cvs/stx/stx/libview2/LayoutWrapper.st,v 1.7 2009-11-24 18:21:01 stefan Exp $' |
|
278 | 265 |
! ! |
3855
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2811
diff
changeset
|
266 |