author | Claus Gittinger <cg@exept.de> |
Wed, 26 Nov 2008 16:45:35 +0100 | |
changeset 8451 | f81ab0ad5809 |
parent 8038 | 4283cb9e492a |
child 8672 | b407d6ab29da |
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 |
) |
|
90 |
) |
|
91 |
nil |
|
92 |
nil |
|
93 |
) |
|
94 |
! ! |
|
95 |
||
30 | 96 |
!ImageInspectorView methodsFor:'accessing'! |
97 |
||
98 |
inspect:anObject |
|
8451 | 99 |
"set the object to be inspected" |
100 |
||
30 | 101 |
super inspect:anObject. |
102 |
realized ifFalse:[^ self]. |
|
1963
b977d5407ec8
include filename in label, if known.
Claus Gittinger <cg@exept.de>
parents:
1872
diff
changeset
|
103 |
imageView image:anObject. |
30 | 104 |
|
45 | 105 |
" |
106 |
ImageInspectorView inspect:(Image fromScreen:(0@0 corner:800@800)) |
|
107 |
" |
|
30 | 108 |
! ! |
109 |
||
110 |
!ImageInspectorView methodsFor:'initialization'! |
|
111 |
||
1872
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
112 |
destroy |
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
1963
diff
changeset
|
113 |
|imageViewsSuperView| |
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
1963
diff
changeset
|
114 |
|
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
1963
diff
changeset
|
115 |
imageViewsSuperView := imageView superView. |
1872
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
116 |
LastRatio := 1.0 - |
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
1963
diff
changeset
|
117 |
(imageViewsSuperView relativeCorner y - imageViewsSuperView relativeOrigin y). |
7868 | 118 |
|
1872
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
119 |
super destroy |
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
120 |
|
7868 | 121 |
"Created: / 07-09-1998 / 13:13:43 / cg" |
122 |
"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
|
123 |
! |
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
124 |
|
30 | 125 |
initialize |
107 | 126 |
|v newPanel sub| |
30 | 127 |
|
128 |
super initialize. |
|
129 |
||
1872
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
130 |
LastRatio isNil ifTrue:[ |
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
131 |
LastRatio := 0.3 |
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
132 |
]. |
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
133 |
|
45 | 134 |
newPanel := VariableVerticalPanel in:self. |
135 |
newPanel origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
2831 | 136 |
newPanel snapMode:#both. |
30 | 137 |
|
45 | 138 |
" |
139 |
wrap my existing subview into the new |
|
140 |
variable panel |
|
141 |
" |
|
1011
1022e80a1c60
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
142 |
sub := self subViews first. |
45 | 143 |
self removeSubView:sub. |
1872
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
144 |
sub origin:0.0@0.0 corner:1.0@LastRatio. |
45 | 145 |
newPanel addSubView:sub. |
146 |
||
1379 | 147 |
v := HVScrollableView for:ImageView in:newPanel. |
1872
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
148 |
v origin:(0.0 @ LastRatio) corner:(1.0 @ 1.0). |
30 | 149 |
imageView := v scrolledView. |
7799 | 150 |
imageView menuHolder:self; menuMessage:#imageMenu; menuPerformer:self. |
30 | 151 |
|
1872
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
152 |
LastExtent notNil ifTrue:[ |
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
153 |
self extent:LastExtent |
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
154 |
]. |
1c3c80a1973f
remember last extent and variable frame ratio;
Claus Gittinger <cg@exept.de>
parents:
1379
diff
changeset
|
155 |
|
45 | 156 |
" |
157 |
ImageInspectorView new realize |
|
158 |
ImageInspectorView inspect:(Image fromFile:'bitmaps/claus.gif') |
|
159 |
" |
|
1011
1022e80a1c60
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
160 |
|
7799 | 161 |
"Modified: / 28-05-2007 / 15:15:32 / cg" |
162 |
! ! |
|
163 |
||
164 |
!ImageInspectorView methodsFor:'menu'! |
|
165 |
||
166 |
imageMenu |
|
167 |
^ self class imageMenu |
|
168 |
||
169 |
"Created: / 28-05-2007 / 15:12:56 / cg" |
|
170 |
! |
|
171 |
||
8038 | 172 |
menuEdit |
173 |
inspectedObject edit |
|
174 |
! |
|
175 |
||
7799 | 176 |
menuMagnification |
177 |
|mag| |
|
178 |
||
179 |
mag := Dialog |
|
180 |
request:'Magnify by:' |
|
181 |
initialAnswer:1 |
|
182 |
list:#('0.5' '1' '2' '4' '8'). |
|
7875 | 183 |
mag := Number readFrom:mag onError:[nil]. |
184 |
mag notNil ifTrue:[ |
|
185 |
imageView image:(inspectedObject magnifiedBy:mag). |
|
186 |
] |
|
7799 | 187 |
|
188 |
"Created: / 28-05-2007 / 15:14:35 / cg" |
|
7875 | 189 |
"Modified: / 30-10-2007 / 16:49:16 / cg" |
30 | 190 |
! ! |
516 | 191 |
|
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
192 |
!ImageInspectorView methodsFor:'queries'! |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
193 |
|
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
194 |
labelFor:anObject |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
195 |
|l| |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
196 |
|
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
197 |
l := super labelFor:anObject. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
198 |
anObject fileName notNil ifTrue:[ |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
199 |
l := l , ' (''' , anObject fileName , ''')' |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
200 |
]. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
201 |
^ l |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
202 |
|
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
203 |
|
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
204 |
! ! |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
205 |
|
1011
1022e80a1c60
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
206 |
!ImageInspectorView class methodsFor:'documentation'! |
516 | 207 |
|
208 |
version |
|
8451 | 209 |
^ '$Header: /cvs/stx/stx/libtool/ImageInspectorView.st,v 1.22 2008-11-26 15:45:35 cg Exp $' |
516 | 210 |
! ! |