author | Claus Gittinger <cg@exept.de> |
Wed, 07 May 2014 18:06:50 +0200 | |
changeset 14319 | a84b4a0c15ca |
parent 13766 | d2f4defdd705 |
child 14349 | 1639a85ef84a |
permissions | -rw-r--r-- |
30 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
45 | 3 |
All Rights Reserved |
30 | 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 |
" |
|
2831 | 12 |
"{ Package: 'stx:libtool' }" |
13 |
||
30 | 14 |
InspectorView subclass:#ImageInspectorView |
516 | 15 |
instanceVariableNames:'imageView' |
1872
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
16 |
classVariableNames:'LastRatio LastExtent' |
516 | 17 |
poolDictionaries:'' |
18 |
category:'Interface-Inspector' |
|
30 | 19 |
! |
20 |
||
1011
1022e80a1c60
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
21 |
!ImageInspectorView class methodsFor:'documentation'! |
110 | 22 |
|
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
26 |
All Rights Reserved |
|
27 |
||
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
! |
|
36 |
||
128 | 37 |
documentation |
38 |
" |
|
39 |
this class allows better inspection of images, |
|
40 |
by adding another subView, which displays the image. |
|
41 |
" |
|
110 | 42 |
! ! |
43 |
||
1872
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
44 |
!ImageInspectorView class methodsFor:'defaults'! |
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
45 |
|
7868 | 46 |
defaultTopViewExtent |
13766
d2f4defdd705
Replace references to Diplay with "Screen current" - where appropriate
Stefan Vogel <sv@exept.de>
parents:
13297
diff
changeset
|
47 |
|def| |
d2f4defdd705
Replace references to Diplay with "Screen current" - where appropriate
Stefan Vogel <sv@exept.de>
parents:
13297
diff
changeset
|
48 |
|
d2f4defdd705
Replace references to Diplay with "Screen current" - where appropriate
Stefan Vogel <sv@exept.de>
parents:
13297
diff
changeset
|
49 |
def := LastExtent ? self defaultExtent. |
d2f4defdd705
Replace references to Diplay with "Screen current" - where appropriate
Stefan Vogel <sv@exept.de>
parents:
13297
diff
changeset
|
50 |
^ def min:(Screen current usableExtent) |
1872
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
51 |
|
7868 | 52 |
"Created: / 23-10-2007 / 18:58:18 / cg" |
53 |
! |
|
54 |
||
55 |
rememberLastExtent:anExtent |
|
56 |
LastExtent := anExtent |
|
57 |
||
58 |
"Created: / 23-10-2007 / 19:09:34 / cg" |
|
1872
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
59 |
! ! |
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
60 |
|
7799 | 61 |
!ImageInspectorView class methodsFor:'menu specs'! |
62 |
||
63 |
imageMenu |
|
64 |
"This resource specification was automatically generated |
|
65 |
by the MenuEditor of ST/X." |
|
66 |
||
67 |
"Do not manually edit this!! If it is corrupted, |
|
68 |
the MenuEditor may not be able to read the specification." |
|
69 |
||
70 |
" |
|
71 |
MenuEditor new openOnClass:ImageInspectorView andSelector:#imageMenu |
|
72 |
(Menu new fromLiteralArrayEncoding:(ImageInspectorView imageMenu)) startUp |
|
73 |
" |
|
74 |
||
75 |
<resource: #menu> |
|
76 |
||
77 |
^ |
|
78 |
#(Menu |
|
79 |
( |
|
80 |
(MenuItem |
|
8038 | 81 |
label: 'Edit' |
82 |
itemValue: menuEdit |
|
83 |
translateLabel: true |
|
84 |
) |
|
85 |
(MenuItem |
|
13297 | 86 |
label: 'File Browser' |
87 |
itemValue: menuFileBrowser |
|
88 |
translateLabel: true |
|
89 |
enabled: filenameOfImageKnown |
|
90 |
) |
|
91 |
(MenuItem |
|
8038 | 92 |
label: '-' |
93 |
) |
|
94 |
(MenuItem |
|
7799 | 95 |
label: 'Magnification...' |
96 |
itemValue: menuMagnification |
|
97 |
translateLabel: true |
|
98 |
) |
|
8672 | 99 |
(MenuItem |
100 |
label: 'Background' |
|
101 |
translateLabel: true |
|
102 |
submenu: |
|
103 |
(Menu |
|
104 |
( |
|
105 |
(MenuItem |
|
106 |
label: 'White' |
|
107 |
itemValue: menuSetBackgroundColor: |
|
108 |
translateLabel: true |
|
109 |
argument: white |
|
110 |
) |
|
111 |
(MenuItem |
|
112 |
label: 'Grey' |
|
113 |
itemValue: menuSetBackgroundColor: |
|
114 |
translateLabel: true |
|
115 |
argument: grey |
|
116 |
) |
|
117 |
(MenuItem |
|
118 |
label: 'Black' |
|
119 |
itemValue: menuSetBackgroundColor: |
|
120 |
translateLabel: true |
|
121 |
argument: black |
|
122 |
) |
|
123 |
(MenuItem |
|
124 |
label: '-' |
|
125 |
) |
|
126 |
(MenuItem |
|
127 |
label: 'Red' |
|
128 |
itemValue: menuSetBackgroundColor: |
|
129 |
translateLabel: true |
|
130 |
argument: red |
|
131 |
) |
|
132 |
(MenuItem |
|
133 |
label: 'Green' |
|
134 |
itemValue: menuSetBackgroundColor: |
|
135 |
translateLabel: true |
|
136 |
argument: green |
|
137 |
) |
|
138 |
(MenuItem |
|
139 |
label: 'Blue' |
|
140 |
itemValue: menuSetBackgroundColor: |
|
141 |
translateLabel: true |
|
142 |
argument: blue |
|
143 |
) |
|
144 |
) |
|
145 |
nil |
|
146 |
nil |
|
147 |
) |
|
148 |
) |
|
7799 | 149 |
) |
150 |
nil |
|
151 |
nil |
|
152 |
) |
|
153 |
! ! |
|
154 |
||
30 | 155 |
!ImageInspectorView methodsFor:'accessing'! |
156 |
||
157 |
inspect:anObject |
|
8451 | 158 |
"set the object to be inspected" |
159 |
||
30 | 160 |
super inspect:anObject. |
1963
b977d5407ec8
include filename in label, if known.
Claus Gittinger <cg@exept.de>
parents:
1872
diff
changeset
|
161 |
imageView image:anObject. |
30 | 162 |
|
45 | 163 |
" |
164 |
ImageInspectorView inspect:(Image fromScreen:(0@0 corner:800@800)) |
|
165 |
" |
|
30 | 166 |
! ! |
167 |
||
168 |
!ImageInspectorView methodsFor:'initialization'! |
|
169 |
||
1872
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
170 |
destroy |
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
1963
diff
changeset
|
171 |
|imageViewsSuperView| |
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
1963
diff
changeset
|
172 |
|
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
1963
diff
changeset
|
173 |
imageViewsSuperView := imageView superView. |
13077 | 174 |
imageViewsSuperView notNil ifTrue:[ |
175 |
LastRatio := 1.0 - |
|
176 |
(imageViewsSuperView relativeCorner y - imageViewsSuperView relativeOrigin y). |
|
177 |
]. |
|
1872
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
178 |
super destroy |
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
179 |
|
7868 | 180 |
"Created: / 07-09-1998 / 13:13:43 / cg" |
181 |
"Modified: / 23-10-2007 / 19:10:48 / cg" |
|
1872
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
182 |
! |
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
183 |
|
30 | 184 |
initialize |
107 | 185 |
|v newPanel sub| |
30 | 186 |
|
187 |
super initialize. |
|
188 |
||
1872
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
189 |
LastRatio isNil ifTrue:[ |
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
190 |
LastRatio := 0.3 |
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
191 |
]. |
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
192 |
|
45 | 193 |
newPanel := VariableVerticalPanel in:self. |
194 |
newPanel origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
2831 | 195 |
newPanel snapMode:#both. |
30 | 196 |
|
45 | 197 |
" |
198 |
wrap my existing subview into the new |
|
199 |
variable panel |
|
200 |
" |
|
1011
1022e80a1c60
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
201 |
sub := self subViews first. |
45 | 202 |
self removeSubView:sub. |
1872
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
203 |
sub origin:0.0@0.0 corner:1.0@LastRatio. |
45 | 204 |
newPanel addSubView:sub. |
205 |
||
1379 | 206 |
v := HVScrollableView for:ImageView in:newPanel. |
1872
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
207 |
v origin:(0.0 @ LastRatio) corner:(1.0 @ 1.0). |
30 | 208 |
imageView := v scrolledView. |
7799 | 209 |
imageView menuHolder:self; menuMessage:#imageMenu; menuPerformer:self. |
30 | 210 |
|
1872
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
211 |
LastExtent notNil ifTrue:[ |
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
212 |
self extent:LastExtent |
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
213 |
]. |
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
214 |
|
45 | 215 |
" |
216 |
ImageInspectorView new realize |
|
217 |
ImageInspectorView inspect:(Image fromFile:'bitmaps/claus.gif') |
|
218 |
" |
|
1011
1022e80a1c60
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
219 |
|
7799 | 220 |
"Modified: / 28-05-2007 / 15:15:32 / cg" |
221 |
! ! |
|
222 |
||
223 |
!ImageInspectorView methodsFor:'menu'! |
|
224 |
||
225 |
imageMenu |
|
226 |
^ self class imageMenu |
|
227 |
||
228 |
"Created: / 28-05-2007 / 15:12:56 / cg" |
|
229 |
! |
|
230 |
||
8038 | 231 |
menuEdit |
232 |
inspectedObject edit |
|
233 |
! |
|
234 |
||
13297 | 235 |
menuFileBrowser |
236 |
UserPreferences current fileBrowserClass |
|
237 |
openOn:inspectedObject fileName |
|
238 |
! |
|
239 |
||
7799 | 240 |
menuMagnification |
241 |
|mag| |
|
242 |
||
243 |
mag := Dialog |
|
244 |
request:'Magnify by:' |
|
245 |
initialAnswer:1 |
|
246 |
list:#('0.5' '1' '2' '4' '8'). |
|
7875 | 247 |
mag := Number readFrom:mag onError:[nil]. |
248 |
mag notNil ifTrue:[ |
|
249 |
imageView image:(inspectedObject magnifiedBy:mag). |
|
250 |
] |
|
7799 | 251 |
|
252 |
"Created: / 28-05-2007 / 15:14:35 / cg" |
|
7875 | 253 |
"Modified: / 30-10-2007 / 16:49:16 / cg" |
8672 | 254 |
! |
255 |
||
256 |
menuSetBackgroundColor:colorNameSymbol |
|
257 |
imageView backgroundColor:(Color name:colorNameSymbol) |
|
30 | 258 |
! ! |
516 | 259 |
|
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
260 |
!ImageInspectorView methodsFor:'queries'! |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
261 |
|
13297 | 262 |
filenameOfImageKnown |
263 |
^ [ inspectedObject fileName notNil ] |
|
264 |
! |
|
265 |
||
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
266 |
labelFor:anObject |
11659 | 267 |
|l fn| |
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
268 |
|
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
269 |
l := super labelFor:anObject. |
11659 | 270 |
(anObject notNil and:[(fn := anObject fileName) notNil]) ifTrue:[ |
271 |
l := l , ' (''' , fn asFilename baseName, ''')' |
|
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
272 |
]. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
273 |
^ l |
11659 | 274 |
|
275 |
"Modified: / 25-07-2012 / 12:53:13 / cg" |
|
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
276 |
! ! |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
277 |
|
1011
1022e80a1c60
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
278 |
!ImageInspectorView class methodsFor:'documentation'! |
516 | 279 |
|
280 |
version |
|
13766
d2f4defdd705
Replace references to Diplay with "Screen current" - where appropriate
Stefan Vogel <sv@exept.de>
parents:
13297
diff
changeset
|
281 |
^ '$Header: /cvs/stx/stx/libtool/ImageInspectorView.st,v 1.29 2014-01-16 14:32:40 stefan Exp $' |
8836 | 282 |
! |
283 |
||
284 |
version_CVS |
|
13766
d2f4defdd705
Replace references to Diplay with "Screen current" - where appropriate
Stefan Vogel <sv@exept.de>
parents:
13297
diff
changeset
|
285 |
^ '$Header: /cvs/stx/stx/libtool/ImageInspectorView.st,v 1.29 2014-01-16 14:32:40 stefan Exp $' |
516 | 286 |
! ! |
13077 | 287 |