author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Sat, 30 Sep 2017 22:41:09 +0100 | |
branch | jv |
changeset 4020 | d801dbd5cf3b |
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:
818
diff
changeset
|
1 |
" |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
818
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:
818
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:
818
diff
changeset
|
4 |
|
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
818
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:
818
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:
818
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:
818
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:
818
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:
818
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:
818
diff
changeset
|
11 |
" |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
818
diff
changeset
|
12 |
"{ Package: 'stx:libview2' }" |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
818
diff
changeset
|
13 |
|
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
818
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:
818
diff
changeset
|
15 |
|
818 | 16 |
Object subclass:#Insets |
17 |
instanceVariableNames:'left right top bottom' |
|
18 |
classVariableNames:'' |
|
19 |
poolDictionaries:'' |
|
20 |
category:'Graphics-Geometry' |
|
21 |
! |
|
22 |
||
23 |
!Insets 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:
818
diff
changeset
|
25 |
copyright |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
818
diff
changeset
|
26 |
" |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
818
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:
818
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:
818
diff
changeset
|
29 |
|
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
818
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:
818
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:
818
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:
818
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:
818
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:
818
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:
818
diff
changeset
|
36 |
" |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
818
diff
changeset
|
37 |
! |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
818
diff
changeset
|
38 |
|
818 | 39 |
documentation |
40 |
||
41 |
" |
|
42 |
The Insets class was added as an all purpose class holding the insets of a geometric |
|
43 |
element like a view. A inset object just contains four dimensions specifying the top, left |
|
44 |
right and bottom distance between the object and an outer border. Beside the simple methods |
|
45 |
for setting and querying the instance variables, there also exists the methods for encoding |
|
46 |
and decoding the inset as a literal array. |
|
47 |
The insets class is used i.e. by the GridBagConstraints class. |
|
48 |
||
49 |
[see also:] |
|
50 |
GridBagConstraints GridBagLayout |
|
51 |
||
52 |
[author:] |
|
53 |
Andreas Vogel |
|
54 |
||
55 |
" |
|
56 |
! |
|
57 |
||
58 |
examples |
|
59 |
" |
|
60 |
||
61 |
" |
|
62 |
! |
|
63 |
||
64 |
history |
|
65 |
"Created: / 20.1.1998 / 18:34:00 / av" |
|
66 |
! ! |
|
67 |
||
68 |
!Insets class methodsFor:'instance creation'! |
|
69 |
||
70 |
new |
|
71 |
" create a new instance of my class and do an explicit initialization call" |
|
72 |
||
73 |
^ super new initialize |
|
74 |
||
75 |
"Created: / 20.1.1998 / 18:34:36 / av" |
|
76 |
"Modified: / 1.2.1998 / 12:39:24 / av" |
|
77 |
! ! |
|
78 |
||
79 |
!Insets methodsFor:'accessing'! |
|
80 |
||
81 |
bottom |
|
82 |
"return the value of the instance variable 'bottom'" |
|
83 |
||
84 |
^ bottom |
|
85 |
||
86 |
"Created: / 20.1.1998 / 18:33:50 / av" |
|
87 |
"Modified: / 1.2.1998 / 12:39:50 / av" |
|
88 |
! |
|
89 |
||
90 |
bottom:something |
|
91 |
"set the value of the instance variable 'bottom'" |
|
92 |
||
93 |
bottom := something. |
|
94 |
||
95 |
"Created: / 20.1.1998 / 18:33:51 / av" |
|
96 |
"Modified: / 1.2.1998 / 12:39:56 / av" |
|
97 |
! |
|
98 |
||
99 |
left |
|
100 |
"return the value of the instance variable 'left'" |
|
101 |
||
102 |
^ left |
|
103 |
||
104 |
"Created: / 20.1.1998 / 18:33:50 / av" |
|
105 |
"Modified: / 1.2.1998 / 12:40:01 / av" |
|
106 |
! |
|
107 |
||
108 |
left:something |
|
109 |
"set the value of the instance variable 'left'" |
|
110 |
||
111 |
left := something. |
|
112 |
||
113 |
"Created: / 20.1.1998 / 18:33:50 / av" |
|
114 |
"Modified: / 1.2.1998 / 12:40:06 / av" |
|
115 |
! |
|
116 |
||
117 |
right |
|
118 |
"return the value of the instance variable 'right'" |
|
119 |
||
120 |
^ right |
|
121 |
||
122 |
"Created: / 20.1.1998 / 18:33:50 / av" |
|
123 |
"Modified: / 1.2.1998 / 12:40:11 / av" |
|
124 |
! |
|
125 |
||
126 |
right:something |
|
127 |
"set the value of the instance variable 'right'" |
|
128 |
||
129 |
right := something. |
|
130 |
||
131 |
"Created: / 20.1.1998 / 18:33:50 / av" |
|
132 |
"Modified: / 1.2.1998 / 12:40:16 / av" |
|
133 |
! |
|
134 |
||
135 |
top |
|
136 |
"return the value of the instance variable 'top'" |
|
137 |
||
138 |
^ top |
|
139 |
||
140 |
"Created: / 20.1.1998 / 18:33:50 / av" |
|
141 |
"Modified: / 1.2.1998 / 12:40:26 / av" |
|
142 |
! |
|
143 |
||
144 |
top:something |
|
145 |
"set the value of the instance variable 'top'" |
|
146 |
||
147 |
top := something. |
|
148 |
||
149 |
"Created: / 20.1.1998 / 18:33:50 / av" |
|
150 |
"Modified: / 1.2.1998 / 12:40:31 / av" |
|
151 |
! ! |
|
152 |
||
153 |
!Insets methodsFor:'converting'! |
|
154 |
||
155 |
fromLiteralArrayEncoding:encoding |
|
156 |
"Read my values from an encoding. The encoding is supposed to be of the form: |
|
157 |
(Insets left right top bottom) |
|
158 |
This is the reverse to literalArrayEncoding." |
|
159 |
||
160 |
left := (encoding at:2). |
|
161 |
right := (encoding at:3). |
|
162 |
top := (encoding at:4). |
|
163 |
bottom := (encoding at:5). |
|
164 |
||
165 |
" |
|
166 |
Insets new fromLiteralArrayEncoding:#(#Insets 96 97 98 99) |
|
167 |
#(#Insets 96 97 98 99) decodeAsLiteralArray |
|
168 |
" |
|
169 |
||
170 |
"Created: / 21.1.1998 / 13:57:55 / av" |
|
171 |
"Modified: / 1.2.1998 / 12:41:27 / av" |
|
172 |
! |
|
173 |
||
174 |
fromLiteralArrayEncodingAlt:encoding |
|
175 |
"Read my values from an literal encoding. The encoding is supposed to be of the form: |
|
176 |
(Insets #left: left #right: right #top: top #bottom: bottom) |
|
177 |
In difference to fromLiteralArrayEncoding the instance variables aren't initialized with |
|
178 |
fix positioned values. You have to name each field explicitly. |
|
179 |
This is the reverse to literalArrayEncoding." |
|
180 |
||
181 |
| stop sel | |
|
182 |
||
183 |
stop := encoding size. |
|
184 |
||
185 |
2 to:stop by:2 do:[ :i | |
|
186 |
sel := encoding at:i. |
|
187 |
(self respondsTo:sel) ifTrue:[ |
|
188 |
self perform:sel with:(encoding at:i+1) |
|
189 |
] |
|
190 |
]. |
|
191 |
||
192 |
" |
|
193 |
Insets new fromLiteralArrayEncodingAlt:#(#Insets #'left:' 96 #'right:' 97 #'top:' 98 #'bottom:' 99) |
|
194 |
#(#Insets #'left:' 96 #'right:' 97 #'top:' 98 #'bottom:' 99) decodeAsLiteralArray |
|
195 |
" |
|
196 |
||
197 |
"Created: / 21.1.1998 / 13:57:55 / av" |
|
198 |
"Modified: / 1.2.1998 / 12:44:40 / av" |
|
199 |
! |
|
200 |
||
201 |
literalArrayEncoding |
|
202 |
"Encode myself as a literal array, from which a copy of the receiver |
|
203 |
can be reconstructed with #decodeAsLiteralArray. The encoding is: |
|
204 |
#(#Insets left right top bottom) |
|
205 |
" |
|
206 |
||
207 |
^ (Array with:#Insets with:left with:right with:top with:bottom) |
|
208 |
||
209 |
" |
|
210 |
Insets new literalArrayEncoding |
|
211 |
" |
|
212 |
||
213 |
"Created: / 21.1.1998 / 19:28:17 / av" |
|
214 |
"Modified: / 1.2.1998 / 12:45:26 / av" |
|
215 |
! |
|
216 |
||
217 |
literalArrayEncodingAlt |
|
218 |
"Encode myself as a literal array, from which a copy of the receiver |
|
219 |
can be reconstructed with #decodeAsLiteralArrayAlt. The encoding is: |
|
220 |
#(#Insets #left: left #right: right #top: top #bottom: bottom) |
|
221 |
" |
|
222 |
||
223 |
| coll | |
|
224 |
||
225 |
coll := OrderedCollection new. |
|
226 |
||
227 |
coll add:#Insets. |
|
228 |
coll add:#'left:' ; add:left. |
|
229 |
coll add:#'right:' ; add:right. |
|
230 |
coll add:#'top:' ; add:top. |
|
231 |
coll add:#'bottom:' ; add:bottom. |
|
232 |
||
233 |
^ coll asArray. |
|
234 |
||
235 |
" |
|
236 |
Insets new literalArrayEncodingAlt |
|
237 |
" |
|
238 |
||
239 |
"Created: / 21.1.1998 / 19:31:25 / av" |
|
240 |
"Modified: / 1.2.1998 / 12:50:11 / av" |
|
241 |
! ! |
|
242 |
||
243 |
!Insets methodsFor:'initialization'! |
|
244 |
||
245 |
initialize |
|
246 |
"Initialize a insets instance." |
|
247 |
||
248 |
left := right := top := bottom := 0. |
|
249 |
||
250 |
"Created: / 20.1.1998 / 18:35:07 / av" |
|
251 |
"Modified: / 1.2.1998 / 12:50:47 / av" |
|
252 |
! ! |
|
253 |
||
254 |
!Insets class methodsFor:'documentation'! |
|
255 |
||
256 |
version |
|
257 |
^ '$Header: /cvs/stx/stx/libview2/Insets.st,v 1.1 1998-02-03 18:11:10 cg Exp $' |
|
258 |
! ! |
|
3855
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
818
diff
changeset
|
259 |