author | Claus Gittinger <cg@exept.de> |
Thu, 10 Feb 2011 16:58:13 +0100 | |
changeset 9756 | 5a1787bbf85e |
parent 9184 | 276b28d85c4c |
child 11659 | dac2f285a647 |
child 12123 | 4bde08cebd48 |
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 |
|
83 |
label: '-' |
|
84 |
) |
|
85 |
(MenuItem |
|
7799 | 86 |
label: 'Magnification...' |
87 |
itemValue: menuMagnification |
|
88 |
translateLabel: true |
|
89 |
) |
|
8672 | 90 |
(MenuItem |
91 |
label: 'Background' |
|
92 |
translateLabel: true |
|
93 |
submenu: |
|
94 |
(Menu |
|
95 |
( |
|
96 |
(MenuItem |
|
97 |
label: 'White' |
|
98 |
itemValue: menuSetBackgroundColor: |
|
99 |
translateLabel: true |
|
100 |
argument: white |
|
101 |
) |
|
102 |
(MenuItem |
|
103 |
label: 'Grey' |
|
104 |
itemValue: menuSetBackgroundColor: |
|
105 |
translateLabel: true |
|
106 |
argument: grey |
|
107 |
) |
|
108 |
(MenuItem |
|
109 |
label: 'Black' |
|
110 |
itemValue: menuSetBackgroundColor: |
|
111 |
translateLabel: true |
|
112 |
argument: black |
|
113 |
) |
|
114 |
(MenuItem |
|
115 |
label: '-' |
|
116 |
) |
|
117 |
(MenuItem |
|
118 |
label: 'Red' |
|
119 |
itemValue: menuSetBackgroundColor: |
|
120 |
translateLabel: true |
|
121 |
argument: red |
|
122 |
) |
|
123 |
(MenuItem |
|
124 |
label: 'Green' |
|
125 |
itemValue: menuSetBackgroundColor: |
|
126 |
translateLabel: true |
|
127 |
argument: green |
|
128 |
) |
|
129 |
(MenuItem |
|
130 |
label: 'Blue' |
|
131 |
itemValue: menuSetBackgroundColor: |
|
132 |
translateLabel: true |
|
133 |
argument: blue |
|
134 |
) |
|
135 |
) |
|
136 |
nil |
|
137 |
nil |
|
138 |
) |
|
139 |
) |
|
7799 | 140 |
) |
141 |
nil |
|
142 |
nil |
|
143 |
) |
|
144 |
! ! |
|
145 |
||
30 | 146 |
!ImageInspectorView methodsFor:'accessing'! |
147 |
||
148 |
inspect:anObject |
|
8451 | 149 |
"set the object to be inspected" |
150 |
||
30 | 151 |
super inspect:anObject. |
1963
b977d5407ec8
include filename in label, if known.
Claus Gittinger <cg@exept.de>
parents:
1872
diff
changeset
|
152 |
imageView image:anObject. |
30 | 153 |
|
45 | 154 |
" |
155 |
ImageInspectorView inspect:(Image fromScreen:(0@0 corner:800@800)) |
|
156 |
" |
|
30 | 157 |
! ! |
158 |
||
159 |
!ImageInspectorView methodsFor:'initialization'! |
|
160 |
||
1872
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
161 |
destroy |
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
1963
diff
changeset
|
162 |
|imageViewsSuperView| |
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
1963
diff
changeset
|
163 |
|
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
1963
diff
changeset
|
164 |
imageViewsSuperView := imageView superView. |
1872
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
165 |
LastRatio := 1.0 - |
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
1963
diff
changeset
|
166 |
(imageViewsSuperView relativeCorner y - imageViewsSuperView relativeOrigin y). |
7868 | 167 |
|
1872
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
168 |
super destroy |
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
169 |
|
7868 | 170 |
"Created: / 07-09-1998 / 13:13:43 / cg" |
171 |
"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
|
172 |
! |
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
173 |
|
30 | 174 |
initialize |
107 | 175 |
|v newPanel sub| |
30 | 176 |
|
177 |
super initialize. |
|
178 |
||
1872
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
179 |
LastRatio isNil ifTrue:[ |
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
180 |
LastRatio := 0.3 |
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
181 |
]. |
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
182 |
|
45 | 183 |
newPanel := VariableVerticalPanel in:self. |
184 |
newPanel origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
2831 | 185 |
newPanel snapMode:#both. |
30 | 186 |
|
45 | 187 |
" |
188 |
wrap my existing subview into the new |
|
189 |
variable panel |
|
190 |
" |
|
1011
1022e80a1c60
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
191 |
sub := self subViews first. |
45 | 192 |
self removeSubView:sub. |
1872
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
193 |
sub origin:0.0@0.0 corner:1.0@LastRatio. |
45 | 194 |
newPanel addSubView:sub. |
195 |
||
1379 | 196 |
v := HVScrollableView for:ImageView in:newPanel. |
1872
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
197 |
v origin:(0.0 @ LastRatio) corner:(1.0 @ 1.0). |
30 | 198 |
imageView := v scrolledView. |
7799 | 199 |
imageView menuHolder:self; menuMessage:#imageMenu; menuPerformer:self. |
30 | 200 |
|
1872
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
201 |
LastExtent notNil ifTrue:[ |
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
202 |
self extent:LastExtent |
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
203 |
]. |
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
204 |
|
45 | 205 |
" |
206 |
ImageInspectorView new realize |
|
207 |
ImageInspectorView inspect:(Image fromFile:'bitmaps/claus.gif') |
|
208 |
" |
|
1011
1022e80a1c60
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
209 |
|
7799 | 210 |
"Modified: / 28-05-2007 / 15:15:32 / cg" |
211 |
! ! |
|
212 |
||
213 |
!ImageInspectorView methodsFor:'menu'! |
|
214 |
||
215 |
imageMenu |
|
216 |
^ self class imageMenu |
|
217 |
||
218 |
"Created: / 28-05-2007 / 15:12:56 / cg" |
|
219 |
! |
|
220 |
||
8038 | 221 |
menuEdit |
222 |
inspectedObject edit |
|
223 |
! |
|
224 |
||
7799 | 225 |
menuMagnification |
226 |
|mag| |
|
227 |
||
228 |
mag := Dialog |
|
229 |
request:'Magnify by:' |
|
230 |
initialAnswer:1 |
|
231 |
list:#('0.5' '1' '2' '4' '8'). |
|
7875 | 232 |
mag := Number readFrom:mag onError:[nil]. |
233 |
mag notNil ifTrue:[ |
|
234 |
imageView image:(inspectedObject magnifiedBy:mag). |
|
235 |
] |
|
7799 | 236 |
|
237 |
"Created: / 28-05-2007 / 15:14:35 / cg" |
|
7875 | 238 |
"Modified: / 30-10-2007 / 16:49:16 / cg" |
8672 | 239 |
! |
240 |
||
241 |
menuSetBackgroundColor:colorNameSymbol |
|
242 |
imageView backgroundColor:(Color name:colorNameSymbol) |
|
30 | 243 |
! ! |
516 | 244 |
|
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
245 |
!ImageInspectorView methodsFor:'queries'! |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
246 |
|
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
247 |
labelFor:anObject |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
248 |
|l| |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
249 |
|
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
250 |
l := super labelFor:anObject. |
9184 | 251 |
(anObject notNil and:[anObject fileName notNil]) ifTrue:[ |
252 |
l := l , ' (''' , anObject fileName , ''')' |
|
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
253 |
]. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
254 |
^ l |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
255 |
! ! |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
256 |
|
1011
1022e80a1c60
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
257 |
!ImageInspectorView class methodsFor:'documentation'! |
516 | 258 |
|
259 |
version |
|
9184 | 260 |
^ '$Header: /cvs/stx/stx/libtool/ImageInspectorView.st,v 1.25 2009-11-05 17:56:43 cg Exp $' |
8836 | 261 |
! |
262 |
||
263 |
version_CVS |
|
9184 | 264 |
^ '$Header: /cvs/stx/stx/libtool/ImageInspectorView.st,v 1.25 2009-11-05 17:56:43 cg Exp $' |
516 | 265 |
! ! |