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