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