2748
|
1 |
"
|
|
2 |
COPYRIGHT (c) 2007 by eXept Software AG
|
|
3 |
All Rights Reserved
|
|
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 |
"
|
2177
|
12 |
"{ Package: 'stx:libtool2' }"
|
|
13 |
|
|
14 |
"{ NameSpace: Tools }"
|
|
15 |
|
2744
|
16 |
ToolApplicationModel subclass:#ViewTreeInspectorApplication
|
2177
|
17 |
instanceVariableNames:'model treeView hasSingleSelectionHolder clickedItem clickedPoint
|
2770
|
18 |
motionAction process followFocusChannel showNamesHolder
|
|
19 |
inspectorView'
|
2177
|
20 |
classVariableNames:''
|
|
21 |
poolDictionaries:''
|
2744
|
22 |
category:'Interface-Smalltalk'
|
2177
|
23 |
!
|
|
24 |
|
|
25 |
Object subclass:#MenuDesc
|
|
26 |
instanceVariableNames:'title value action'
|
|
27 |
classVariableNames:''
|
|
28 |
poolDictionaries:''
|
2744
|
29 |
privateIn:ViewTreeInspectorApplication
|
|
30 |
!
|
|
31 |
|
|
32 |
HierarchicalItem subclass:#ViewTreeItem
|
|
33 |
instanceVariableNames:'widget isDrawnShown exists xOffsetAdditionalName'
|
|
34 |
classVariableNames:'HandleExtent'
|
|
35 |
poolDictionaries:''
|
|
36 |
privateIn:ViewTreeInspectorApplication
|
2177
|
37 |
!
|
|
38 |
|
2744
|
39 |
ValueModel subclass:#ViewTreeModel
|
|
40 |
instanceVariableNames:'lockSema selectedSuperItems selection hiddenLevel listOfItems
|
|
41 |
inputEventAction mappedViewAction beforeSelectionChangedAction
|
|
42 |
icons timedUpdateTask selectOnClickHolder testModeChannel
|
|
43 |
hasTargetWidgetChannel'
|
|
44 |
classVariableNames:''
|
|
45 |
poolDictionaries:''
|
|
46 |
privateIn:ViewTreeInspectorApplication
|
|
47 |
!
|
|
48 |
|
|
49 |
HierarchicalList subclass:#ItemList
|
|
50 |
instanceVariableNames:'treeModel eventHook eventHookInitialized showWidgetNames'
|
|
51 |
classVariableNames:''
|
|
52 |
poolDictionaries:''
|
|
53 |
privateIn:ViewTreeInspectorApplication::ViewTreeModel
|
|
54 |
!
|
|
55 |
|
|
56 |
!ViewTreeInspectorApplication class methodsFor:'documentation'!
|
2177
|
57 |
|
2748
|
58 |
copyright
|
|
59 |
"
|
|
60 |
COPYRIGHT (c) 2007 by eXept Software AG
|
|
61 |
All Rights Reserved
|
|
62 |
|
|
63 |
This software is furnished under a license and may be used
|
|
64 |
only in accordance with the terms of that license and with the
|
|
65 |
inclusion of the above copyright notice. This software may not
|
|
66 |
be provided or otherwise made available to, or used by, any
|
|
67 |
other person. No title to or ownership of the software is
|
|
68 |
hereby transferred.
|
|
69 |
"
|
|
70 |
!
|
|
71 |
|
2177
|
72 |
documentation
|
|
73 |
"
|
|
74 |
Small application showing a ViewTreeModel use.
|
|
75 |
|
|
76 |
It displays a hierarchical list of a selected TopView and
|
|
77 |
all its contained subViews.
|
|
78 |
Useful to have a look at subcomponents - to see how views
|
|
79 |
are structured.
|
|
80 |
|
|
81 |
|
|
82 |
[Instance variables:]
|
|
83 |
model <ViewTreeModel> the used ViewTreeModel
|
|
84 |
clickedItem <ViewTreeItem> item under the clickedPoint (motion action)
|
|
85 |
clickedPoint <Point> point where the motion action started from.
|
|
86 |
motionAction <Action> (oneArg-) action called durring buttonMotion.
|
|
87 |
|
|
88 |
|
|
89 |
[author:]
|
|
90 |
Claus Atzkern
|
|
91 |
|
|
92 |
[see also:]
|
|
93 |
ViewTreeModel
|
|
94 |
ViewTreeItem
|
|
95 |
"
|
|
96 |
! !
|
|
97 |
|
2744
|
98 |
!ViewTreeInspectorApplication class methodsFor:'initialization'!
|
2177
|
99 |
|
|
100 |
initialize
|
|
101 |
"add myself to the launcher menu
|
|
102 |
"
|
|
103 |
self installInLauncher.
|
|
104 |
!
|
|
105 |
|
|
106 |
installInLauncher
|
2744
|
107 |
"add myself to the launcher menu"
|
|
108 |
|
2177
|
109 |
|menuItem icon|
|
|
110 |
|
|
111 |
NewLauncher isNil ifTrue:[^ self].
|
2744
|
112 |
"/ cg - disabled. the icon is too ugly.
|
|
113 |
^ self.
|
2177
|
114 |
|
|
115 |
icon := ToolbarIconLibrary inspectLocals20x20Icon magnifiedTo:28@28.
|
|
116 |
|
|
117 |
menuItem := MenuItem new
|
2744
|
118 |
label: 'View Tree Inspector';
|
|
119 |
value: [ ViewTreeInspectorApplication open];
|
2177
|
120 |
isButton: true;
|
|
121 |
icon: icon;
|
|
122 |
nameKey: #viewInspect.
|
|
123 |
|
|
124 |
menuItem startGroup:#right.
|
|
125 |
NewLauncher addMenuItem:menuItem in:'toolbar'
|
|
126 |
position:#( #before #help)
|
|
127 |
space:false.
|
|
128 |
|
|
129 |
"
|
|
130 |
self installInLauncher
|
|
131 |
self removeFromLauncher
|
|
132 |
"
|
|
133 |
!
|
|
134 |
|
|
135 |
postAutoload
|
|
136 |
"add myself to the launcher menu
|
|
137 |
"
|
|
138 |
self installInLauncher.
|
|
139 |
"
|
|
140 |
self installInLauncher
|
|
141 |
self removeFromLauncher
|
|
142 |
"
|
|
143 |
!
|
|
144 |
|
|
145 |
removeFromLauncher
|
|
146 |
"remove myself from the launcher menu
|
|
147 |
"
|
|
148 |
NewLauncher isNil ifTrue:[^ self].
|
|
149 |
NewLauncher removeUserTool:#viewInspect
|
|
150 |
|
|
151 |
"
|
|
152 |
self installInLauncher
|
|
153 |
self removeFromLauncher
|
|
154 |
"
|
|
155 |
!
|
|
156 |
|
|
157 |
unload
|
|
158 |
"class is about to be unloaded - remove myself from the launcher menu
|
|
159 |
"
|
|
160 |
self removeFromLauncher.
|
|
161 |
super unload.
|
|
162 |
! !
|
|
163 |
|
2744
|
164 |
!ViewTreeInspectorApplication class methodsFor:'image specs'!
|
|
165 |
|
2759
|
166 |
crossHairIcon
|
|
167 |
"This resource specification was automatically generated
|
|
168 |
by the ImageEditor of ST/X."
|
|
169 |
|
|
170 |
"Do not manually edit this!! If it is corrupted,
|
|
171 |
the ImageEditor may not be able to read the specification."
|
|
172 |
|
|
173 |
"
|
|
174 |
self crossHairIcon inspect
|
|
175 |
ImageEditor openOnClass:self andSelector:#crossHairIcon
|
|
176 |
Icon flushCachedIcons
|
|
177 |
"
|
|
178 |
|
|
179 |
<resource: #image>
|
|
180 |
|
|
181 |
^Icon
|
|
182 |
constantNamed:'Tools::ViewTreeInspectorApplication class crossHairIcon'
|
|
183 |
ifAbsentPut:[(Depth1Image new) width: 24; height: 24; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@F0@@XL@@>>@A8O@A>?@B,Z B(J @@@@B(J B,Z A>?@A8O@@>>@@XL@@F0@@@@@@@@@@@@@@@@@@@@@') ; colorMapFromArray:#[255 255 255 0 0 0]; mask:((Depth1Image new) width: 24; height: 24; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@G0@@_<@@?>@A??@C?? C?? G??0G<_0G<_0G<_0G??0C?? C?? A??@@?>@@_<@@G0@@@@@@@@@@@@@@@@@') ; yourself); yourself]
|
|
184 |
!
|
|
185 |
|
2744
|
186 |
pickWindowIcon
|
|
187 |
"This resource specification was automatically generated
|
|
188 |
by the ImageEditor of ST/X."
|
|
189 |
|
|
190 |
"Do not manually edit this!! If it is corrupted,
|
|
191 |
the ImageEditor may not be able to read the specification."
|
|
192 |
|
|
193 |
"
|
|
194 |
self pickWindowIcon inspect
|
|
195 |
ImageEditor openOnClass:self andSelector:#pickWindowIcon
|
|
196 |
Icon flushCachedIcons
|
|
197 |
"
|
|
198 |
|
|
199 |
<resource: #image>
|
|
200 |
|
|
201 |
^Icon
|
|
202 |
constantNamed:'Tools::ViewTreeInspectorApplication class pickWindowIcon'
|
|
203 |
ifAbsentPut:[(Depth8Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
|
|
204 |
,;N3,;N3,;N3,;N3,;N3,;N3,;N3,3H<P38;M3P,H2@^GA(VEQHQCP0KA D<[&-%XU=WST%BN#D!!GQ$TD@(IBP\BQF)+Z6E_U4-FPCX+G1,WEA@JBP$HAT23
|
|
205 |
,;N3,;N3,;N3,;N$():Z&IRR&1!!^,;N3,;N3,;N3,;N$)JJ^&)"T$),0W[N3,;N3,;N3,;N3,:R"'')*X%IJWK523,;N3,;N3,0@@@KN3)JJ^&)"T$"5Z,;N3
|
|
206 |
,;N3@@B3-KL@@JJ^&)"T$)D*V[N3,;N3@KN3-KR4)JH@&)"T$)*MJE"3,;N3,0B3)JJ4&*R"@I*X%IJZ#RYV,;N3,0B3@JR"-JR"-I(@%IJV%H %U[N3,;L@
|
|
207 |
-@B4-KR4-KR4@IRR%IJEIER3,;N3@KL@)JJ4():4&@BO#9RR!!RIS,;N3,;L@,:R"-JJ^& BT#8>O#8H"T+N3,;N3@KN$@@@@'')(@%H>O#(>AH%F3,;N3,;L@
|
|
208 |
@JR4'' @@%IJO#8>O RIO,;N3,;N3):P@@@BX%IJO#8>O#7<"S*63,;N$():Z&IRR&IRR#8>O#8=>H"&-,;N$():Z&IRR&)"T$(>O#8>O @<)R$!!GQTD?OS$8
|
|
209 |
MSL.I2H"H"H"H"HO,;N3,;N3,;N3,;N3,;N3,;N3,;N3,0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; colorMapFromArray:#[0 0 0 0 50 164 0 50 171 0 137 0 0 206 0 1 50 177 2 56 178 3 64 241 3 67 246 3 73 255 4 74 255 5 63 191 7 66 194 10 71 196 10 79 255 12 59 167 12 82 255 14 77 199 18 83 201 19 88 255 21 91 255 23 89 204 27 95 206 28 97 255 29 72 179 30 100 255 32 101 209 36 106 255 36 107 211 39 109 255 41 113 214 45 115 255 45 119 216 48 118 255 50 87 176 50 125 219 51 88 176 51 88 177 52 89 178 52 90 178 53 90 178 53 127 212 54 91 179 54 123 255 54 131 221 55 92 180 55 95 181 56 93 180 56 94 181 57 127 255 57 149 229 58 99 184 58 137 224 61 104 187 63 132 255 63 143 226 64 108 190 66 113 193 66 135 255 67 149 229 68 157 232 69 117 196 71 155 231 72 122 199 72 141 255 75 126 202 75 144 255 75 160 234 77 163 236 78 131 206 80 149 255 81 136 209 84 140 212 84 153 255 87 145 215 88 157 255 91 168 235 93 161 255 94 154 222 96 157 223 96 165 255 97 159 225 98 160 225 98 162 226 99 163 227 100 165 228 101 166 229 101 170 255 102 167 230 103 169 231 104 170 232 104 173 255 105 172 233 105 174 234 106 175 235 109 178 255 112 180 255 117 186 255 119 187 255 122 154 245 125 160 253 125 193 255 126 161 253 126 194 255 127 162 254 130 165 254 132 200 255 132 201 255 133 60 36 135 170 255 139 207 255 140 175 255 144 179 255 149 184 255 153 188 255 157 192 255 162 196 255 166 200 255 170 204 255 174 208 255 174 218 230 177 212 255 181 215 255 185 219 255 188 222 255 191 225 255 212 211 224 218 217 230 219 219 230 220 220 231 222 221 232 223 223 233 225 224 234 225 225 234 226 226 237 227 226 235 227 227 236 227 227 238 228 228 237 229 229 239 231 230 238 231 231 238 231 231 240 232 232 241 233 232 239 233 233 240 234 234 242 235 234 241 236 236 243 237 236 242 237 237 244 238 237 243 238 238 244 239 238 243 239 239 245 240 239 244 241 240 245 241 241 246 241 241 247 242 242 246 242 242 247 243 243 247 243 243 248 244 244 248 244 244 249 245 244 247 246 246 249 246 246 250 247 246 249 247 247 250 248 248 251 249 249 250 249 249 251 250 250 251 250 250 252 251 251 252 251 251 253 253 253 254 254 254 255 255 255 255 0 0 0]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@C????????????????????????????????????????????????????????????????????????????????@@@C') ; yourself); yourself]
|
2759
|
210 |
!
|
|
211 |
|
|
212 |
pickWindowIcon2
|
|
213 |
"This resource specification was automatically generated
|
|
214 |
by the ImageEditor of ST/X."
|
|
215 |
|
|
216 |
"Do not manually edit this!! If it is corrupted,
|
|
217 |
the ImageEditor may not be able to read the specification."
|
|
218 |
|
|
219 |
"
|
|
220 |
self pickWindowIcon2 inspect
|
|
221 |
ImageEditor openOnClass:self andSelector:#pickWindowIcon2
|
|
222 |
Icon flushCachedIcons
|
|
223 |
"
|
|
224 |
|
|
225 |
<resource: #image>
|
|
226 |
|
|
227 |
^Icon
|
|
228 |
constantNamed:'Tools::ViewTreeInspectorApplication class pickWindowIcon2'
|
|
229 |
ifAbsentPut:[(Depth8Image new) width: 22; height: 23; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
|
|
230 |
@CH<O#,7MB0#HA8\F!!XUD!!DMC@,F@P@<[&U!!W5]MRTH:LRD]FQPPB $IA0H@QF)+XU=WR4Y@M",_F1\TD@(IBP E@D23,;N3,;N3,;N3,;N"'')*X%IJ[F@A^
|
|
231 |
,;N3,;N3,0@@@@@@():Z&IRR&3@@W+N3,;N3@@B3,0B3)@@@&)"T$),0@E63,;N3@KN3@@@@@@B"'' BX%IJWK0A\,;N3@KN3,;N3@JR"'')*X@IRR&24@V+N3
|
|
232 |
@KN3,;L@@@@@@I:Z&IP@$),*@E&3,0B3,;N3,:P@():Z&IRT@IJ[J@AX,0B3@KL@,;L@@@B^& BT@IP@&2X@U+L@,0B3@KL@)JJ^@I @%@BT@I,%@EV3@@@@
|
|
233 |
@@@@@JR"'' @@@@@@@@B[I@AT,0B3@KL@)@B$()8@&@BZ@IP@&2H@T;L@,0B3@JR$@@@@%I @& BT@I,"@EJ3,0B3,:R$)I8@&IRX%I*X@IJ[H AQ,;L@,:R$
|
|
234 |
)@@@@@@@&IRO#0BO RH@S;N3,0B$)JR"'' BX%I"T#0BO#7<"@D:-,;N$@JR$@@@@@@BR#0BO#8=>H AN+[N$)JH@@I"T@I"T@@BO#8>O_"H@JZ63)JJ^&) @
|
|
235 |
@@@@@IJO#8>O#8@O@B&3,;N3,;N3,;N3,;N"'')*X%IJ[C0@)R$]EPS<=NS 5L28''H"H"H"H"H <b') ; colorMapFromArray:#[0 0 0 0 50 164 0 50 171 0 137 0 0 206 0 1 50 177 2 56 178 3 64 241 3 67 246 3 73 255 4 74 255 5 63 191 7 66 194 10 71 196 10 79 255 12 59 167 12 82 255 14 77 199 18 83 201 19 88 255 21 91 255 23 89 204 27 95 206 28 97 255 29 72 179 30 100 255 32 101 209 36 106 255 36 107 211 39 109 255 41 113 214 45 115 255 45 119 216 48 118 255 50 87 176 50 125 219 51 88 176 51 88 177 52 89 178 52 90 178 53 90 178 53 127 212 54 91 179 54 123 255 54 131 221 55 92 180 55 95 181 56 93 180 56 94 181 57 127 255 57 149 229 58 99 184 58 137 224 61 104 187 63 132 255 63 143 226 64 108 190 66 113 193 66 135 255 67 149 229 68 157 232 69 117 196 71 155 231 72 122 199 72 141 255 75 126 202 75 144 255 75 160 234 77 163 236 78 131 206 80 149 255 81 136 209 84 140 212 84 153 255 87 145 215 88 157 255 91 168 235 93 161 255 94 154 222 96 157 223 96 165 255 97 159 225 98 160 225 98 162 226 99 163 227 100 165 228 101 166 229 101 170 255 102 167 230 103 169 231 104 170 232 104 173 255 105 172 233 105 174 234 106 175 235 109 178 255 112 180 255 117 186 255 119 187 255 122 154 245 125 160 253 125 193 255 126 161 253 126 194 255 127 162 254 130 165 254 132 200 255 132 201 255 133 60 36 135 170 255 139 207 255 140 175 255 144 179 255 149 184 255 153 188 255 157 192 255 162 196 255 166 200 255 170 204 255 174 208 255 174 218 230 177 212 255 181 215 255 185 219 255 188 222 255 191 225 255 212 211 224 218 217 230 219 219 230 220 220 231 222 221 232 223 223 233 225 224 234 225 225 234 226 226 237 227 226 235 227 227 236 227 227 238 228 228 237 229 229 239 231 230 238 231 231 238 231 231 240 232 232 241 233 232 239 233 233 240 234 234 242 235 234 241 236 236 243 237 236 242 237 237 244 238 237 243 238 238 244 239 238 243 239 239 245 240 239 244 241 240 245 241 241 246 241 241 247 242 242 246 242 242 247 243 243 247 243 243 248 244 244 248 244 244 249 245 244 247 246 246 249 246 246 250 247 246 249 247 247 250 248 248 251 249 249 250 249 249 251 250 250 251 250 250 252 251 251 252 251 251 253 253 253 254 254 254 255 255 255 255]; mask:((Depth1Image new) width: 22; height: 23; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<') ; yourself); yourself]
|
2744
|
236 |
! !
|
|
237 |
|
|
238 |
!ViewTreeInspectorApplication class methodsFor:'interface specs'!
|
2177
|
239 |
|
|
240 |
windowSpec
|
|
241 |
"This resource specification was automatically generated
|
|
242 |
by the UIPainter of ST/X."
|
|
243 |
|
|
244 |
"Do not manually edit this!! If it is corrupted,
|
|
245 |
the UIPainter may not be able to read the specification."
|
|
246 |
|
|
247 |
"
|
2757
|
248 |
UIPainter new openOnClass:Tools::ViewTreeInspectorApplication andSelector:#windowSpec
|
|
249 |
Tools::ViewTreeInspectorApplication new openInterface:#windowSpec
|
|
250 |
Tools::ViewTreeInspectorApplication open
|
2177
|
251 |
"
|
|
252 |
|
|
253 |
<resource: #canvas>
|
|
254 |
|
|
255 |
^
|
|
256 |
#(FullSpec
|
|
257 |
name: windowSpec
|
|
258 |
window:
|
|
259 |
(WindowSpec
|
2744
|
260 |
label: 'View Tree Inspector'
|
2757
|
261 |
name: 'View Tree Inspector'
|
2177
|
262 |
min: (Point 10 10)
|
|
263 |
max: (Point 1024 9999)
|
2451
|
264 |
bounds: (Rectangle 0 0 381 654)
|
2177
|
265 |
menu: menu
|
|
266 |
)
|
|
267 |
component:
|
|
268 |
(SpecCollection
|
|
269 |
collection: (
|
|
270 |
(MenuPanelSpec
|
|
271 |
name: 'toolbarMenu'
|
2757
|
272 |
layout: (LayoutFrame 0 0.0 0 0 0 1.0 40 0)
|
2177
|
273 |
menu: toolbarMenu
|
|
274 |
textDefault: true
|
|
275 |
)
|
2770
|
276 |
(VariableVerticalPanelSpec
|
|
277 |
name: 'VariableVerticalPanel1'
|
2757
|
278 |
layout: (LayoutFrame 0 0.0 40 0.0 0 1.0 0 1.0)
|
2770
|
279 |
component:
|
|
280 |
(SpecCollection
|
|
281 |
collection: (
|
|
282 |
(HierarchicalListViewSpec
|
|
283 |
name: 'List'
|
|
284 |
level: 1
|
|
285 |
model: model
|
|
286 |
menu: middleButtonMenu
|
|
287 |
hasHorizontalScrollBar: true
|
|
288 |
hasVerticalScrollBar: true
|
|
289 |
miniScrollerHorizontal: true
|
|
290 |
miniScrollerVertical: false
|
|
291 |
listModel: listOfItems
|
|
292 |
multipleSelectOk: true
|
|
293 |
useIndex: false
|
|
294 |
highlightMode: label
|
|
295 |
showLeftIndicators: false
|
|
296 |
indicatorSelector: indicatorClicked:
|
|
297 |
useDefaultIcons: false
|
|
298 |
postBuildCallback: postBuildTree:
|
|
299 |
)
|
|
300 |
(ViewSpec
|
|
301 |
name: 'Box1'
|
|
302 |
viewClassName: 'InspectorView'
|
|
303 |
postBuildCallback: postBuildInspectorView:
|
|
304 |
)
|
|
305 |
)
|
|
306 |
|
|
307 |
)
|
|
308 |
handles: (Any 0.5 1.0)
|
2177
|
309 |
)
|
|
310 |
)
|
|
311 |
|
|
312 |
)
|
|
313 |
)
|
|
314 |
! !
|
|
315 |
|
2744
|
316 |
!ViewTreeInspectorApplication class methodsFor:'menu specs'!
|
2177
|
317 |
|
|
318 |
menu
|
|
319 |
"This resource specification was automatically generated
|
|
320 |
by the MenuEditor of ST/X."
|
|
321 |
|
|
322 |
"Do not manually edit this!! If it is corrupted,
|
|
323 |
the MenuEditor may not be able to read the specification."
|
|
324 |
|
|
325 |
"
|
2454
|
326 |
MenuEditor new openOnClass:Tools::ViewTreeApplication andSelector:#menu
|
|
327 |
(Menu new fromLiteralArrayEncoding:(Tools::ViewTreeApplication menu)) startUp
|
2177
|
328 |
"
|
|
329 |
|
|
330 |
<resource: #menu>
|
|
331 |
|
|
332 |
^
|
|
333 |
#(Menu
|
|
334 |
(
|
|
335 |
(MenuItem
|
|
336 |
label: 'File'
|
|
337 |
translateLabel: true
|
|
338 |
submenu:
|
|
339 |
(Menu
|
|
340 |
(
|
|
341 |
(MenuItem
|
|
342 |
label: 'Pick a View'
|
2762
|
343 |
itemValue: doPickView
|
2177
|
344 |
translateLabel: true
|
|
345 |
)
|
|
346 |
(MenuItem
|
2455
|
347 |
enabled: hasTargetWidgetChannel
|
2177
|
348 |
label: 'Release Picked View'
|
|
349 |
itemValue: doUnpick
|
|
350 |
translateLabel: true
|
|
351 |
)
|
|
352 |
(MenuItem
|
|
353 |
label: '-'
|
|
354 |
)
|
|
355 |
(MenuItem
|
2744
|
356 |
label: 'Settings'
|
|
357 |
translateLabel: true
|
|
358 |
submenu:
|
|
359 |
(Menu
|
|
360 |
(
|
|
361 |
(MenuItem
|
|
362 |
label: 'Test Mode'
|
|
363 |
translateLabel: true
|
|
364 |
hideMenuOnActivated: false
|
|
365 |
indication: testModeChannel
|
|
366 |
)
|
|
367 |
(MenuItem
|
|
368 |
enabled: testModeChannel
|
|
369 |
label: 'Follow Focus'
|
|
370 |
translateLabel: true
|
|
371 |
hideMenuOnActivated: false
|
|
372 |
indication: followFocusChannel
|
|
373 |
)
|
|
374 |
(MenuItem
|
|
375 |
label: '-'
|
|
376 |
)
|
|
377 |
(MenuItem
|
|
378 |
label: 'Select on Click'
|
|
379 |
translateLabel: true
|
|
380 |
hideMenuOnActivated: false
|
|
381 |
indication: selectOnClickHolder
|
|
382 |
)
|
|
383 |
(MenuItem
|
|
384 |
label: '-'
|
|
385 |
)
|
|
386 |
(MenuItem
|
|
387 |
label: 'Show Name of Widgets'
|
|
388 |
translateLabel: true
|
|
389 |
hideMenuOnActivated: false
|
|
390 |
indication: showNamesHolder
|
|
391 |
)
|
|
392 |
)
|
|
393 |
nil
|
|
394 |
nil
|
|
395 |
)
|
|
396 |
)
|
|
397 |
(MenuItem
|
|
398 |
label: '-'
|
|
399 |
)
|
|
400 |
(MenuItem
|
2177
|
401 |
label: 'Exit'
|
|
402 |
itemValue: closeRequest
|
|
403 |
translateLabel: true
|
|
404 |
)
|
|
405 |
)
|
|
406 |
nil
|
|
407 |
nil
|
|
408 |
)
|
|
409 |
)
|
|
410 |
(MenuItem
|
2744
|
411 |
enabled: hasSingleSelectionHolder
|
|
412 |
label: 'Selection'
|
|
413 |
translateLabel: true
|
|
414 |
submenuChannel: middleButtonMenu
|
|
415 |
)
|
|
416 |
(MenuItem
|
|
417 |
label: 'Application'
|
2454
|
418 |
translateLabel: true
|
|
419 |
submenu:
|
|
420 |
(Menu
|
|
421 |
(
|
|
422 |
(MenuItem
|
2744
|
423 |
enabled: hasSingleSelectionHolder
|
|
424 |
label: 'Browse'
|
|
425 |
itemValue: doBrowse:
|
2454
|
426 |
translateLabel: true
|
2744
|
427 |
argument: application
|
2454
|
428 |
)
|
|
429 |
(MenuItem
|
2744
|
430 |
enabled: hasSingleSelectionHolder
|
|
431 |
label: 'Inspect'
|
|
432 |
itemValue: doInspect:
|
2454
|
433 |
translateLabel: true
|
2744
|
434 |
argument: application
|
2454
|
435 |
)
|
|
436 |
(MenuItem
|
|
437 |
label: '-'
|
|
438 |
)
|
|
439 |
(MenuItem
|
2744
|
440 |
enabled: hasTargetWidgetChannel
|
|
441 |
label: 'All Applications'
|
2454
|
442 |
translateLabel: true
|
2744
|
443 |
submenuChannel: submenuApplications:
|
2454
|
444 |
)
|
|
445 |
)
|
|
446 |
nil
|
|
447 |
nil
|
|
448 |
)
|
|
449 |
)
|
|
450 |
(MenuItem
|
2744
|
451 |
label: 'Widget'
|
2177
|
452 |
translateLabel: true
|
2744
|
453 |
submenu:
|
|
454 |
(Menu
|
|
455 |
(
|
|
456 |
(MenuItem
|
|
457 |
enabled: hasSingleSelectionHolder
|
|
458 |
label: 'Browse'
|
|
459 |
itemValue: doBrowse:
|
|
460 |
translateLabel: true
|
|
461 |
argument: view
|
|
462 |
)
|
|
463 |
(MenuItem
|
|
464 |
enabled: hasSingleSelectionHolder
|
|
465 |
label: 'Inspect'
|
|
466 |
itemValue: doInspect:
|
|
467 |
translateLabel: true
|
|
468 |
argument: view
|
|
469 |
)
|
|
470 |
(MenuItem
|
|
471 |
label: '-'
|
|
472 |
)
|
|
473 |
(MenuItem
|
|
474 |
enabled: hasTargetWidgetChannel
|
|
475 |
label: 'All Components'
|
|
476 |
translateLabel: true
|
|
477 |
startGroup: right
|
|
478 |
submenuChannel: submenuComponents:
|
|
479 |
)
|
|
480 |
)
|
|
481 |
nil
|
|
482 |
nil
|
|
483 |
)
|
2177
|
484 |
)
|
|
485 |
(MenuItem
|
2744
|
486 |
label: 'Help'
|
2177
|
487 |
translateLabel: true
|
2744
|
488 |
startGroup: conditionalRight
|
|
489 |
submenu:
|
|
490 |
(Menu
|
|
491 |
(
|
|
492 |
(MenuItem
|
|
493 |
label: 'Documentation'
|
|
494 |
itemValue: openDocumentation
|
|
495 |
translateLabel: true
|
|
496 |
)
|
|
497 |
(MenuItem
|
|
498 |
label: '-'
|
|
499 |
)
|
|
500 |
(MenuItem
|
|
501 |
label: 'About this Application...'
|
|
502 |
itemValue: openAboutThisApplication
|
|
503 |
translateLabel: true
|
|
504 |
)
|
|
505 |
)
|
|
506 |
nil
|
|
507 |
nil
|
|
508 |
)
|
2177
|
509 |
)
|
|
510 |
)
|
|
511 |
nil
|
|
512 |
nil
|
|
513 |
)
|
2888
|
514 |
|
|
515 |
"Modified: / 27-04-2012 / 14:13:17 / cg"
|
2177
|
516 |
!
|
|
517 |
|
|
518 |
middleButtonMenu
|
|
519 |
"This resource specification was automatically generated
|
|
520 |
by the MenuEditor of ST/X."
|
|
521 |
|
|
522 |
"Do not manually edit this!! If it is corrupted,
|
|
523 |
the MenuEditor may not be able to read the specification."
|
|
524 |
|
|
525 |
"
|
|
526 |
MenuEditor new openOnClass:ViewTreeApplication andSelector:#middleButtonMenu
|
|
527 |
(Menu new fromLiteralArrayEncoding:(ViewTreeApplication middleButtonMenu)) startUp
|
|
528 |
"
|
|
529 |
|
|
530 |
<resource: #menu>
|
|
531 |
|
|
532 |
^
|
|
533 |
#(Menu
|
|
534 |
(
|
|
535 |
(MenuItem
|
|
536 |
label: 'Geometry'
|
|
537 |
translateLabel: true
|
|
538 |
submenuChannel: submenuGeometry:
|
|
539 |
keepLinkedMenu: true
|
|
540 |
)
|
|
541 |
(MenuItem
|
|
542 |
label: 'Interface'
|
|
543 |
translateLabel: true
|
|
544 |
submenuChannel: submenuInterface:
|
|
545 |
keepLinkedMenu: true
|
|
546 |
)
|
|
547 |
(MenuItem
|
|
548 |
label: 'Visibility'
|
|
549 |
translateLabel: true
|
|
550 |
submenuChannel: submenuVisibility:
|
|
551 |
keepLinkedMenu: true
|
|
552 |
)
|
|
553 |
(MenuItem
|
|
554 |
label: '-'
|
|
555 |
)
|
|
556 |
(MenuItem
|
|
557 |
label: 'Browse View Class'
|
|
558 |
itemValue: doBrowse:
|
|
559 |
translateLabel: true
|
|
560 |
argument: view
|
|
561 |
)
|
|
562 |
(MenuItem
|
|
563 |
label: 'Browse Model Class'
|
|
564 |
itemValue: doBrowse:
|
|
565 |
translateLabel: true
|
|
566 |
isVisible: hasModel
|
|
567 |
argument: model
|
|
568 |
)
|
|
569 |
(MenuItem
|
|
570 |
label: 'Browse Application Class'
|
|
571 |
itemValue: doBrowse:
|
|
572 |
translateLabel: true
|
|
573 |
isVisible: hasApplication
|
|
574 |
argument: application
|
|
575 |
)
|
|
576 |
(MenuItem
|
|
577 |
label: 'Browse Controller Class'
|
|
578 |
itemValue: doBrowse:
|
|
579 |
translateLabel: true
|
|
580 |
isVisible: hasController
|
|
581 |
argument: controller
|
|
582 |
)
|
|
583 |
(MenuItem
|
|
584 |
label: '-'
|
|
585 |
)
|
|
586 |
(MenuItem
|
|
587 |
label: 'Inspect View'
|
|
588 |
itemValue: doInspect:
|
|
589 |
translateLabel: true
|
|
590 |
argument: view
|
|
591 |
)
|
|
592 |
(MenuItem
|
|
593 |
label: 'Inspect Window Group'
|
|
594 |
itemValue: doInspect:
|
|
595 |
translateLabel: true
|
|
596 |
argument: group
|
|
597 |
)
|
|
598 |
(MenuItem
|
|
599 |
label: 'Inspect Model'
|
|
600 |
itemValue: doInspect:
|
|
601 |
translateLabel: true
|
|
602 |
isVisible: hasModel
|
|
603 |
argument: model
|
|
604 |
)
|
|
605 |
(MenuItem
|
|
606 |
label: 'Inspect Application'
|
|
607 |
itemValue: doInspect:
|
|
608 |
translateLabel: true
|
|
609 |
isVisible: hasApplication
|
|
610 |
argument: application
|
|
611 |
)
|
|
612 |
(MenuItem
|
|
613 |
label: 'Inspect Controller'
|
|
614 |
itemValue: doInspect:
|
|
615 |
translateLabel: true
|
|
616 |
isVisible: hasController
|
|
617 |
argument: controller
|
|
618 |
)
|
|
619 |
(MenuItem
|
|
620 |
label: '-'
|
|
621 |
)
|
|
622 |
(MenuItem
|
|
623 |
label: 'Flash'
|
|
624 |
itemValue: doFlash
|
|
625 |
translateLabel: true
|
|
626 |
)
|
|
627 |
(MenuItem
|
|
628 |
label: '-'
|
|
629 |
)
|
|
630 |
(MenuItem
|
|
631 |
label: 'Destroy'
|
|
632 |
itemValue: doDestroy
|
|
633 |
translateLabel: true
|
|
634 |
)
|
|
635 |
(MenuItem
|
|
636 |
label: '-'
|
|
637 |
)
|
|
638 |
(MenuItem
|
|
639 |
label: 'Instance Variables'
|
|
640 |
translateLabel: true
|
|
641 |
submenuChannel: submenuInspector:
|
|
642 |
keepLinkedMenu: true
|
|
643 |
)
|
|
644 |
(MenuItem
|
|
645 |
label: '='
|
|
646 |
)
|
|
647 |
(MenuItem
|
|
648 |
label: ''
|
|
649 |
)
|
|
650 |
(MenuItem
|
|
651 |
enabled: selectedComponentHasChildren
|
|
652 |
label: 'Applications'
|
|
653 |
nameKey: single
|
|
654 |
translateLabel: true
|
|
655 |
submenuChannel: submenuApplications:
|
|
656 |
keepLinkedMenu: true
|
|
657 |
)
|
|
658 |
(MenuItem
|
|
659 |
enabled: selectedComponentHasChildren
|
|
660 |
label: 'Components'
|
|
661 |
nameKey: single
|
|
662 |
translateLabel: true
|
|
663 |
submenuChannel: submenuComponents:
|
|
664 |
keepLinkedMenu: true
|
|
665 |
)
|
|
666 |
)
|
|
667 |
nil
|
|
668 |
nil
|
|
669 |
)
|
|
670 |
!
|
|
671 |
|
|
672 |
toolbarMenu
|
|
673 |
"This resource specification was automatically generated
|
|
674 |
by the MenuEditor of ST/X."
|
|
675 |
|
|
676 |
"Do not manually edit this!! If it is corrupted,
|
|
677 |
the MenuEditor may not be able to read the specification."
|
|
678 |
|
|
679 |
"
|
2757
|
680 |
MenuEditor new openOnClass:Tools::ViewTreeInspectorApplication andSelector:#toolbarMenu
|
|
681 |
(Menu new fromLiteralArrayEncoding:(Tools::ViewTreeInspectorApplication toolbarMenu)) startUp
|
2177
|
682 |
"
|
|
683 |
|
|
684 |
<resource: #menu>
|
|
685 |
|
|
686 |
^
|
|
687 |
#(Menu
|
|
688 |
(
|
|
689 |
(MenuItem
|
2744
|
690 |
label: 'Pick a View'
|
2762
|
691 |
itemValue: doPickView
|
2744
|
692 |
translateLabel: false
|
|
693 |
isButton: true
|
|
694 |
hideMenuOnActivated: false
|
2759
|
695 |
labelImage: (ResourceRetriever #'Tools::ViewTreeInspectorApplication' pickWindowIcon2)
|
2744
|
696 |
)
|
|
697 |
(MenuItem
|
2757
|
698 |
enabled: hasTargetWidgetChannel
|
|
699 |
label: 'Release Picked View'
|
|
700 |
isButton: true
|
|
701 |
itemValue: doUnpick
|
|
702 |
translateLabel: true
|
|
703 |
labelImage: (ResourceRetriever ToolbarIconLibrary undoIcon)
|
|
704 |
)
|
|
705 |
(MenuItem
|
|
706 |
label: '-'
|
|
707 |
)
|
|
708 |
(MenuItem
|
2454
|
709 |
enabled: hasSingleSelectionHolder
|
2744
|
710 |
label: 'Browse Application'
|
2454
|
711 |
itemValue: doBrowse:
|
|
712 |
translateLabel: false
|
2744
|
713 |
isButton: true
|
|
714 |
hideMenuOnActivated: false
|
2454
|
715 |
labelImage: (ResourceRetriever ToolbarIconLibrary systemBrowser24x24Icon2)
|
|
716 |
argument: application
|
|
717 |
)
|
|
718 |
(MenuItem
|
|
719 |
enabled: hasSingleSelectionHolder
|
2744
|
720 |
label: 'Inspect Application'
|
2454
|
721 |
itemValue: doInspect:
|
|
722 |
translateLabel: false
|
2744
|
723 |
isButton: true
|
|
724 |
hideMenuOnActivated: false
|
|
725 |
labelImage: (ResourceRetriever ToolbarIconLibrary inspect22x24Icon)
|
2454
|
726 |
argument: application
|
2177
|
727 |
)
|
|
728 |
)
|
|
729 |
nil
|
|
730 |
nil
|
|
731 |
)
|
|
732 |
! !
|
|
733 |
|
2747
|
734 |
!ViewTreeInspectorApplication class methodsFor:'startup'!
|
|
735 |
|
|
736 |
openInPickMode
|
|
737 |
|app|
|
|
738 |
|
|
739 |
app := self new.
|
|
740 |
app open.
|
2762
|
741 |
app doPickView.
|
2747
|
742 |
! !
|
|
743 |
|
2744
|
744 |
!ViewTreeInspectorApplication methodsFor:'actions'!
|
2177
|
745 |
|
|
746 |
indicatorClicked:anIndex
|
|
747 |
|item sensor|
|
|
748 |
|
|
749 |
item := model listOfItems at:anIndex ifAbsent:nil.
|
|
750 |
|
|
751 |
item notNil ifTrue:[
|
|
752 |
( (sensor := self window sensor) notNil
|
|
753 |
and:[(sensor ctrlDown or:[sensor shiftDown])]
|
|
754 |
) ifTrue:[
|
|
755 |
item recursiveToggleExpand
|
|
756 |
] ifFalse:[
|
|
757 |
item toggleExpand
|
|
758 |
]
|
|
759 |
].
|
|
760 |
! !
|
|
761 |
|
2744
|
762 |
!ViewTreeInspectorApplication methodsFor:'aspects'!
|
2177
|
763 |
|
|
764 |
followFocusChannel
|
2455
|
765 |
"boolean holder, which indicates whether selection changed dependend on the focus view"
|
|
766 |
|
2177
|
767 |
^ followFocusChannel
|
|
768 |
!
|
|
769 |
|
|
770 |
hasSingleSelectionHolder
|
2455
|
771 |
"boolean holder, true if one item is selected"
|
|
772 |
|
2177
|
773 |
^ hasSingleSelectionHolder
|
|
774 |
!
|
|
775 |
|
2455
|
776 |
hasTargetWidgetChannel
|
|
777 |
"answer the channel which is set to true if a target widget exists"
|
|
778 |
|
|
779 |
^ model hasTargetWidgetChannel
|
|
780 |
!
|
|
781 |
|
2177
|
782 |
listOfItems
|
2455
|
783 |
"returns the hierarchical list of items"
|
|
784 |
|
2177
|
785 |
^ model listOfItems
|
|
786 |
!
|
|
787 |
|
|
788 |
model
|
2455
|
789 |
"returns my selection model, a ViewTreeModel"
|
|
790 |
|
2177
|
791 |
^ model
|
|
792 |
!
|
|
793 |
|
|
794 |
selectOnClickHolder
|
2455
|
795 |
"boolean holder, which indicates whether the selection will change on click"
|
|
796 |
|
2177
|
797 |
^ model selectOnClickHolder
|
|
798 |
!
|
|
799 |
|
2451
|
800 |
showNamesHolder
|
|
801 |
"boolean holder, which indicates whether application names or widget names
|
2455
|
802 |
as additional text are shown for the items"
|
|
803 |
|
2451
|
804 |
^ showNamesHolder
|
|
805 |
!
|
|
806 |
|
2177
|
807 |
testModeChannel
|
2455
|
808 |
"answer a boolean channel which describes the behaviour how to process
|
|
809 |
events on the target view.
|
|
810 |
|
|
811 |
false: all input events are eaten and the selection is shown on the target view.
|
|
812 |
true: no input events are eaten and no selection is shown on the target view."
|
|
813 |
|
|
814 |
^ model testModeChannel
|
2177
|
815 |
! !
|
|
816 |
|
2744
|
817 |
!ViewTreeInspectorApplication methodsFor:'change & update'!
|
2177
|
818 |
|
|
819 |
selectionChanged
|
|
820 |
|info view item|
|
|
821 |
|
|
822 |
item := model selectedItem.
|
|
823 |
|
|
824 |
item notNil ifTrue:[ |state|
|
|
825 |
view := item widget.
|
|
826 |
|
|
827 |
view id isNil ifTrue:[
|
|
828 |
state := 'no ID'.
|
|
829 |
] ifFalse:[
|
|
830 |
view shown ifTrue:[
|
|
831 |
state := 'visible'.
|
|
832 |
] ifFalse:[
|
|
833 |
state := 'invisible'
|
|
834 |
].
|
|
835 |
].
|
|
836 |
info := '%1 [%2] - %3' bindWith:(view class name)
|
|
837 |
with:(view name ? '') with:state allBold.
|
|
838 |
|
|
839 |
] ifFalse:[
|
|
840 |
info := ''
|
|
841 |
].
|
|
842 |
hasSingleSelectionHolder value:(view notNil).
|
2770
|
843 |
inspectorView inspect:view.
|
2177
|
844 |
!
|
|
845 |
|
|
846 |
update:something with:someArgument from:aModel
|
2454
|
847 |
|oldSelection|
|
|
848 |
|
2451
|
849 |
aModel == showNamesHolder ifTrue:[
|
2455
|
850 |
oldSelection := model selectedItem.
|
2454
|
851 |
model selectedItem:nil.
|
2451
|
852 |
self listOfItems showWidgetNames:(aModel value).
|
2454
|
853 |
model selectedItem:oldSelection.
|
2451
|
854 |
^ self
|
|
855 |
].
|
2458
|
856 |
|
|
857 |
aModel == model ifTrue:[
|
|
858 |
self selectionChanged.
|
|
859 |
^ self
|
|
860 |
].
|
|
861 |
|
2177
|
862 |
super update:something with:someArgument from:aModel.
|
|
863 |
! !
|
|
864 |
|
2744
|
865 |
!ViewTreeInspectorApplication methodsFor:'event processing'!
|
2177
|
866 |
|
|
867 |
processButtonMotionEvent:ev
|
2455
|
868 |
|click rootView|
|
|
869 |
|
|
870 |
motionAction isNil ifTrue:[^ self].
|
2177
|
871 |
|
2455
|
872 |
(rootView := model rootView) isNil ifTrue:[
|
|
873 |
clickedItem := motionAction := nil.
|
|
874 |
^ self
|
|
875 |
].
|
2177
|
876 |
|
2455
|
877 |
click := rootView device
|
|
878 |
translatePoint:((ev x)@ (ev y))
|
|
879 |
fromView:(ev view)
|
|
880 |
toView:rootView.
|
|
881 |
|
|
882 |
click = clickedPoint ifFalse:[
|
|
883 |
(clickedItem isNil or:[(click dist:clickedPoint) > 5.0]) ifTrue:[
|
|
884 |
motionAction value:click
|
2177
|
885 |
]
|
|
886 |
].
|
|
887 |
!
|
|
888 |
|
|
889 |
processButtonPressEvent:ev
|
2455
|
890 |
|rootView sensor lastRectangle|
|
|
891 |
|
|
892 |
rootView := model rootView.
|
2177
|
893 |
sensor := model rootView sensor.
|
|
894 |
clickedItem := model listOfItems detectItemRespondsToView:(ev view).
|
|
895 |
|
|
896 |
(sensor ctrlDown or:[sensor shiftDown]) ifTrue:[
|
|
897 |
clickedItem notNil ifTrue:[
|
|
898 |
self selectOnClickHolder value ifTrue:[
|
|
899 |
model toggleSelectItem:clickedItem
|
|
900 |
].
|
|
901 |
].
|
|
902 |
clickedItem := motionAction := nil.
|
2455
|
903 |
^ self
|
|
904 |
].
|
2177
|
905 |
|
2455
|
906 |
clickedPoint := rootView device translatePoint:((ev x)@ (ev y)) fromView:(ev view) toView:rootView.
|
|
907 |
lastRectangle := nil.
|
2177
|
908 |
|
2455
|
909 |
motionAction :=[:p|
|
|
910 |
rootView := model rootView device rootView.
|
|
911 |
rootView := model rootView.
|
|
912 |
clickedItem := nil.
|
2177
|
913 |
|
2455
|
914 |
rootView xoring:[
|
|
915 |
lastRectangle notNil ifTrue:[ rootView displayRectangle:lastRectangle ]
|
|
916 |
ifFalse:[ rootView clippedByChildren:false ].
|
|
917 |
|
|
918 |
p isNil ifTrue:[
|
|
919 |
rootView clippedByChildren:true.
|
|
920 |
motionAction := nil.
|
|
921 |
] ifFalse:[
|
|
922 |
lastRectangle := Rectangle origin:(clickedPoint min:p) corner:(clickedPoint max:p).
|
|
923 |
rootView displayRectangle:lastRectangle.
|
2177
|
924 |
].
|
2455
|
925 |
rootView flush.
|
|
926 |
].
|
|
927 |
lastRectangle
|
|
928 |
].
|
2177
|
929 |
!
|
|
930 |
|
|
931 |
processButtonReleaseEvent:anEvent
|
|
932 |
|rootView rectangle newItems widget origin|
|
|
933 |
|
2455
|
934 |
(rootView := model rootView) isNil ifTrue:[
|
|
935 |
clickedItem := motionAction := nil.
|
|
936 |
^ self
|
|
937 |
].
|
2177
|
938 |
motionAction isNil ifTrue:[ ^ self ].
|
|
939 |
clickedItem notNil ifTrue:[ ^ model selectItem:clickedItem ].
|
|
940 |
|
2455
|
941 |
rectangle := motionAction value:nil.
|
|
942 |
rectangle isNil ifTrue:[^ self].
|
|
943 |
|
|
944 |
newItems := OrderedCollection new.
|
2177
|
945 |
|
2455
|
946 |
model rootItem recursiveDo:[:anItem|
|
|
947 |
widget := anItem widget.
|
|
948 |
origin := widget originRelativeTo:rootView.
|
2177
|
949 |
|
2455
|
950 |
(rectangle containsRect:(Rectangle origin:origin extent:(widget extent))) ifTrue:[
|
|
951 |
newItems add:anItem.
|
|
952 |
]
|
2177
|
953 |
].
|
2455
|
954 |
model value:newItems.
|
2177
|
955 |
!
|
|
956 |
|
|
957 |
processEvent:anEvent
|
|
958 |
|button menu|
|
|
959 |
|
2758
|
960 |
anEvent isKeyPressEvent ifTrue:[ self processKeyPressEvent:anEvent. ^ self ].
|
2177
|
961 |
anEvent isButtonEvent ifFalse:[ ^ self ].
|
|
962 |
|
|
963 |
button := anEvent button.
|
|
964 |
|
|
965 |
(button == 2 or:[button == #menu]) ifTrue:[
|
|
966 |
motionAction isNil ifTrue:[
|
|
967 |
anEvent isButtonPressEvent ifTrue:[
|
|
968 |
self selectOnClickHolder value ifTrue:[
|
|
969 |
menu := self middleButtonMenu value.
|
|
970 |
menu notNil ifTrue:[
|
2758
|
971 |
menu := MenuPanel
|
|
972 |
menu:(Menu new fromLiteralArrayEncoding:menu)
|
|
973 |
receiver:self.
|
2177
|
974 |
menu startUp.
|
|
975 |
]
|
|
976 |
].
|
|
977 |
].
|
|
978 |
clickedItem := nil.
|
|
979 |
].
|
|
980 |
^ self
|
|
981 |
].
|
|
982 |
|
2758
|
983 |
anEvent isButtonPressEvent ifTrue:[ self processButtonPressEvent:anEvent. ^ self ].
|
|
984 |
anEvent isButtonMotionEvent ifTrue:[ self processButtonMotionEvent:anEvent. ^ self ].
|
2177
|
985 |
|
|
986 |
anEvent isButtonReleaseEvent ifTrue:[
|
|
987 |
self selectOnClickHolder value ifTrue:[
|
|
988 |
self processButtonReleaseEvent:anEvent
|
|
989 |
].
|
|
990 |
].
|
|
991 |
clickedItem := motionAction := nil.
|
|
992 |
|
|
993 |
anEvent type == #'buttonMultiPress:x:y:' ifTrue:[
|
|
994 |
self selectOnClickHolder value ifTrue:[
|
|
995 |
self doInspect:#view.
|
|
996 |
].
|
|
997 |
].
|
|
998 |
!
|
|
999 |
|
|
1000 |
processKeyPressEvent:anEvent
|
|
1001 |
|item prnt idx key max next|
|
|
1002 |
|
|
1003 |
key := anEvent key.
|
|
1004 |
key isSymbol ifFalse:[^ self].
|
|
1005 |
|
|
1006 |
key == #Delete ifTrue:[ ^ self doDestroy ].
|
|
1007 |
key == #InspectIt ifTrue:[ ^ self doInspect:#view ].
|
|
1008 |
|
|
1009 |
( key == #CursorUp
|
|
1010 |
or:[key == #CursorDown
|
|
1011 |
or:[key == #CursorLeft
|
|
1012 |
or:[key == #CursorRight]]]
|
|
1013 |
) ifFalse:[
|
|
1014 |
^ self
|
|
1015 |
].
|
|
1016 |
item := model selectedItem.
|
|
1017 |
|
|
1018 |
item isNil ifTrue:[
|
|
1019 |
^ model selectedItem:(model first ? model rootItem)
|
|
1020 |
].
|
|
1021 |
|
|
1022 |
prnt := item parent.
|
|
1023 |
prnt isNil ifTrue:[
|
|
1024 |
"/ is the root item
|
|
1025 |
(key == #CursorUp or:[key == #CursorLeft]) ifTrue:[item := model listOfItems last]
|
|
1026 |
ifFalse:[item := item at:1 ifAbsent:item].
|
|
1027 |
|
2758
|
1028 |
^ model selectedItem:item
|
2177
|
1029 |
].
|
|
1030 |
key == #CursorLeft ifTrue:[ ^ model selectedItem:prnt ].
|
|
1031 |
|
|
1032 |
key == #CursorRight ifTrue:[
|
|
1033 |
next := item at:1 ifAbsent:nil.
|
|
1034 |
next notNil ifTrue:[ model selectedItem:next ].
|
2758
|
1035 |
^ self
|
2177
|
1036 |
].
|
|
1037 |
|
|
1038 |
max := prnt size.
|
|
1039 |
|
|
1040 |
key == #CursorUp ifTrue:[
|
|
1041 |
idx := prnt identityIndexOf:item.
|
|
1042 |
idx == 1 ifTrue:[idx := max + 1].
|
|
1043 |
model selectedItem:(prnt at:idx - 1).
|
2758
|
1044 |
^ self.
|
2177
|
1045 |
].
|
|
1046 |
|
|
1047 |
key == #CursorDown ifTrue:[
|
|
1048 |
idx := prnt identityIndexOf:item.
|
|
1049 |
idx == max ifTrue:[idx := 0].
|
|
1050 |
model selectedItem:(prnt at:idx + 1).
|
2758
|
1051 |
^ self.
|
2177
|
1052 |
].
|
|
1053 |
!
|
|
1054 |
|
|
1055 |
processMappedView:aView
|
|
1056 |
|parent anchor|
|
|
1057 |
|
|
1058 |
parent := self listOfItems detectItemRespondsToView:aView.
|
|
1059 |
parent isNil ifTrue:[ ^ self ].
|
|
1060 |
|
|
1061 |
NotFoundSignal handle:[:ex|
|
|
1062 |
"contained subvies used by spec are not yet created;
|
|
1063 |
thus we have to wait until last used subview is build
|
|
1064 |
"
|
|
1065 |
anchor := nil.
|
|
1066 |
] do:[
|
|
1067 |
anchor := parent class buildViewsFrom:(parent widget).
|
|
1068 |
].
|
|
1069 |
anchor notNil ifTrue:[
|
|
1070 |
parent updateFromChildren:anchor children.
|
|
1071 |
].
|
|
1072 |
! !
|
|
1073 |
|
2744
|
1074 |
!ViewTreeInspectorApplication methodsFor:'initialization & release'!
|
2177
|
1075 |
|
|
1076 |
closeDownViews
|
2455
|
1077 |
"release the grapped application"
|
|
1078 |
|
2177
|
1079 |
process := nil.
|
|
1080 |
super closeDownViews.
|
|
1081 |
self doUnpick.
|
|
1082 |
!
|
|
1083 |
|
|
1084 |
initialize
|
2455
|
1085 |
"setup my model and channels"
|
|
1086 |
|
2177
|
1087 |
super initialize.
|
|
1088 |
|
|
1089 |
hasSingleSelectionHolder := false asValue.
|
|
1090 |
followFocusChannel := false asValue.
|
|
1091 |
|
|
1092 |
model := ViewTreeModel new.
|
|
1093 |
model inputEventAction:[:ev| self processEvent:ev ].
|
|
1094 |
model mappedViewAction:[:vw| self processMappedView:vw ].
|
|
1095 |
model application:self.
|
2458
|
1096 |
model addDependent:self.
|
|
1097 |
|
2177
|
1098 |
|
2451
|
1099 |
showNamesHolder := false asValue.
|
|
1100 |
showNamesHolder addDependent:self.
|
2177
|
1101 |
!
|
|
1102 |
|
2770
|
1103 |
postBuildInspectorView:anInspector
|
|
1104 |
inspectorView := anInspector.
|
|
1105 |
!
|
|
1106 |
|
2177
|
1107 |
postBuildTree:aTree
|
|
1108 |
treeView := aTree scrolledView.
|
|
1109 |
treeView hasConstantHeight:true.
|
|
1110 |
! !
|
|
1111 |
|
2744
|
1112 |
!ViewTreeInspectorApplication methodsFor:'menu queries'!
|
2177
|
1113 |
|
|
1114 |
hasApplication
|
2455
|
1115 |
"returns true if the current selected view has an application"
|
|
1116 |
|
2177
|
1117 |
|view|
|
|
1118 |
|
|
1119 |
view := self selectedView.
|
|
1120 |
^ (view notNil and:[view application notNil])
|
|
1121 |
!
|
|
1122 |
|
|
1123 |
hasController
|
|
1124 |
"returns true if the current selected item's view has a controller
|
2455
|
1125 |
other than nil or the view itself"
|
|
1126 |
|
2177
|
1127 |
|view controller|
|
|
1128 |
|
|
1129 |
view := self selectedView.
|
|
1130 |
|
|
1131 |
view notNil ifTrue:[
|
|
1132 |
controller := view controller.
|
|
1133 |
^ (controller notNil and:[controller ~~ view])
|
|
1134 |
].
|
|
1135 |
^ false
|
|
1136 |
!
|
|
1137 |
|
|
1138 |
hasModel
|
2455
|
1139 |
"returns true if the current selected view has a model"
|
|
1140 |
|
2177
|
1141 |
|view|
|
|
1142 |
|
|
1143 |
view := self selectedView.
|
|
1144 |
^ (view notNil and:[view model notNil])
|
|
1145 |
! !
|
|
1146 |
|
2744
|
1147 |
!ViewTreeInspectorApplication methodsFor:'menu specs'!
|
2177
|
1148 |
|
|
1149 |
middleButtonMenu
|
2455
|
1150 |
"returns the middleButton menu for the single selected item or nil"
|
|
1151 |
|
2758
|
1152 |
^ [
|
|
1153 |
model selectedItem notNil
|
|
1154 |
ifTrue:[self class middleButtonMenu]
|
|
1155 |
ifFalse:[nil]
|
2177
|
1156 |
]
|
|
1157 |
!
|
|
1158 |
|
|
1159 |
submenuApplications:aMenu
|
|
1160 |
|applications menu item list addBlock|
|
|
1161 |
|
|
1162 |
item := aMenu selection nameKey == #single ifTrue:[model selectedItem]
|
|
1163 |
ifFalse:[model rootItem].
|
|
1164 |
item isNil ifTrue:[^ nil].
|
|
1165 |
|
|
1166 |
applications := IdentityDictionary new.
|
|
1167 |
|
|
1168 |
addBlock := [:el| |cls ctr|
|
|
1169 |
cls := self resolveApplicationClassFor:el.
|
|
1170 |
|
|
1171 |
cls notNil ifTrue:[
|
|
1172 |
ctr := applications at:cls ifAbsent:0.
|
|
1173 |
applications at:cls put:(ctr + 1).
|
|
1174 |
].
|
|
1175 |
].
|
|
1176 |
item recursiveDo:addBlock.
|
|
1177 |
addBlock value:item.
|
|
1178 |
|
|
1179 |
applications isEmpty ifTrue:[^ nil ].
|
|
1180 |
list := SortedCollection sortBlock:[:a :b| a title < b title ].
|
|
1181 |
|
|
1182 |
applications keysAndValuesDo:[:cls :ctr|
|
|
1183 |
list add:(MenuDesc title:(cls name)
|
|
1184 |
value:(ctr printString)
|
|
1185 |
action:[self doSelectNextOfApplicationClass:cls startingIn:item]
|
|
1186 |
).
|
|
1187 |
].
|
|
1188 |
|
|
1189 |
menu := MenuDesc buildFromList:list onGC:aMenu.
|
|
1190 |
menu do:[:el|
|
|
1191 |
el hideMenuOnActivated:false
|
|
1192 |
].
|
|
1193 |
^ menu
|
|
1194 |
!
|
|
1195 |
|
|
1196 |
submenuComponents:aMenu
|
|
1197 |
|widgets list total menu item|
|
|
1198 |
|
|
1199 |
item := aMenu selection nameKey == #single ifTrue:[model selectedItem]
|
|
1200 |
ifFalse:[model rootItem].
|
|
1201 |
item isNil ifTrue:[^ nil].
|
|
1202 |
|
|
1203 |
widgets := IdentityDictionary new.
|
|
1204 |
total := 0.
|
|
1205 |
|
|
1206 |
item recursiveDo:[:el| |cls ctr|
|
|
1207 |
cls := el widget.
|
|
1208 |
|
|
1209 |
cls notNil ifTrue:[
|
|
1210 |
cls := cls class.
|
|
1211 |
ctr := widgets at:cls ifAbsent:0.
|
|
1212 |
widgets at:cls put:(ctr + 1).
|
|
1213 |
total := total + 1.
|
|
1214 |
].
|
|
1215 |
].
|
|
1216 |
total == 0 ifTrue:[^ nil].
|
|
1217 |
list := SortedCollection sortBlock:[:a :b| a title < b title ].
|
|
1218 |
|
|
1219 |
widgets keysAndValuesDo:[:cls :ctr|
|
|
1220 |
list add:(MenuDesc title:(cls name)
|
|
1221 |
value:(ctr printString)
|
|
1222 |
action:[self doSelectNextOfClass:cls startingIn:item]
|
|
1223 |
).
|
|
1224 |
].
|
|
1225 |
list := list asOrderedCollection.
|
|
1226 |
list add:(MenuDesc separator).
|
|
1227 |
list add:(MenuDesc title:'Total' value:(total printString)).
|
|
1228 |
menu := MenuDesc buildFromList:list onGC:aMenu.
|
|
1229 |
menu do:[:el|
|
|
1230 |
el hideMenuOnActivated:false
|
|
1231 |
].
|
|
1232 |
^ menu
|
|
1233 |
!
|
|
1234 |
|
|
1235 |
submenuGeometry:aMenu
|
2455
|
1236 |
"builds and returns the geometry submenu"
|
|
1237 |
|
2177
|
1238 |
|view point inst list x y|
|
|
1239 |
|
|
1240 |
view := self selectedView.
|
|
1241 |
view isNil ifTrue:[^ nil].
|
|
1242 |
|
|
1243 |
list := OrderedCollection new.
|
|
1244 |
|
|
1245 |
"/ origin
|
|
1246 |
point := view relativeOrigin.
|
|
1247 |
point isNil ifTrue:[ point := view origin ].
|
|
1248 |
|
|
1249 |
x := view left.
|
|
1250 |
y := view top.
|
|
1251 |
|
|
1252 |
(x == point x and:[y == point y]) ifTrue:[ inst := point ]
|
|
1253 |
ifFalse:[ inst := '%1 --> (%2@%3)' bindWith:point with:x with:y ].
|
|
1254 |
|
|
1255 |
list add:(MenuDesc title:'origin' value:inst).
|
|
1256 |
|
|
1257 |
"/ corner
|
|
1258 |
point := view relativeCorner.
|
|
1259 |
point isNil ifTrue:[ point := view corner ].
|
|
1260 |
|
|
1261 |
x := view right.
|
|
1262 |
y := view bottom.
|
|
1263 |
|
|
1264 |
(x == point x and:[y == point y]) ifTrue:[ inst := point ]
|
|
1265 |
ifFalse:[ inst := '%1 --> (%2@%3)' bindWith:point with:x with:y ].
|
|
1266 |
|
|
1267 |
list add:(MenuDesc title:'corner' value:inst).
|
|
1268 |
|
|
1269 |
"/ extent
|
|
1270 |
(point := view relativeExtent) isNil ifTrue:[point := view extent].
|
|
1271 |
list add:(MenuDesc title:'extent' value:point).
|
|
1272 |
|
|
1273 |
"/ preferred extent
|
|
1274 |
list add:(MenuDesc title:'pref. extent' value:(view preferredExtent)).
|
|
1275 |
list add:(MenuDesc separator).
|
|
1276 |
|
|
1277 |
"/ view insets
|
|
1278 |
inst := 'l:%1 r:%2 t:%3 b:%4' bindWith:(view leftInset)
|
|
1279 |
with:(view rightInset)
|
|
1280 |
with:(view topInset)
|
|
1281 |
with:(view bottomInset).
|
|
1282 |
|
|
1283 |
list add:(MenuDesc title:'insets' value:inst).
|
|
1284 |
list add:(MenuDesc title:'borderWidth' value:(view borderWidth)).
|
|
1285 |
list add:(MenuDesc title:'level' value:(view level)).
|
|
1286 |
list add:(MenuDesc separator).
|
|
1287 |
|
|
1288 |
(inst := view layout) notNil ifTrue:[ inst := inst displayString ].
|
|
1289 |
list add:(MenuDesc title:'layout' value:inst).
|
|
1290 |
|
|
1291 |
(inst := view transformation) notNil ifTrue:[ inst := inst displayString ].
|
|
1292 |
list add:(MenuDesc title:'transformation' value:inst).
|
|
1293 |
|
|
1294 |
^ MenuDesc buildFromList:list onGC:aMenu
|
|
1295 |
!
|
|
1296 |
|
|
1297 |
submenuInspector:aMenu
|
2455
|
1298 |
"builds and returns the inspector submenu"
|
|
1299 |
|
2177
|
1300 |
|view list n names label value|
|
|
1301 |
|
|
1302 |
view := self selectedView.
|
|
1303 |
view isNil ifTrue:[^ nil].
|
|
1304 |
|
|
1305 |
n := view class instSize.
|
|
1306 |
n > 0 ifFalse:[^ nil ].
|
|
1307 |
|
|
1308 |
list := OrderedCollection new:n.
|
|
1309 |
names := view class allInstVarNames.
|
|
1310 |
|
|
1311 |
1 to:n do:[:i| |action|
|
|
1312 |
label := (names at:i) printString.
|
|
1313 |
value := view instVarAt:i.
|
|
1314 |
value isNil ifTrue:[
|
|
1315 |
value := '------'.
|
|
1316 |
action := nil.
|
|
1317 |
] ifFalse:[
|
|
1318 |
value := value displayString contractAtEndTo:40.
|
|
1319 |
action := [(view instVarAt:i) inspect].
|
|
1320 |
].
|
|
1321 |
list add:(MenuDesc title:label value:value action:action).
|
|
1322 |
].
|
|
1323 |
|
|
1324 |
^ MenuDesc buildFromList:list onGC:aMenu
|
|
1325 |
!
|
|
1326 |
|
|
1327 |
submenuInterface:aMenu
|
2455
|
1328 |
"builds and returns the interface submenu"
|
|
1329 |
|
2177
|
1330 |
|view label inst value list|
|
|
1331 |
|
|
1332 |
view := self selectedView.
|
|
1333 |
view isNil ifTrue:[^ nil].
|
|
1334 |
|
|
1335 |
list := OrderedCollection new.
|
|
1336 |
|
|
1337 |
inst := view controller.
|
|
1338 |
value := nil.
|
|
1339 |
|
|
1340 |
inst isNil ifTrue:[
|
|
1341 |
label := nil
|
|
1342 |
] ifFalse:[
|
2758
|
1343 |
inst == view ifTrue:[
|
|
1344 |
label := '== view itself'
|
|
1345 |
] ifFalse:[
|
|
1346 |
label := inst displayString.
|
|
1347 |
value := [view controller inspect].
|
|
1348 |
].
|
2177
|
1349 |
].
|
|
1350 |
list add:(MenuDesc title:'controller' value:label action:value).
|
|
1351 |
|
|
1352 |
inst := view delegate.
|
|
1353 |
inst notNil ifTrue:[
|
|
1354 |
list add:(MenuDesc title:'delegate' value:(inst displayString) action:[ view delegate inspect ]).
|
|
1355 |
].
|
|
1356 |
|
|
1357 |
inst := view application.
|
|
1358 |
|
2758
|
1359 |
inst notNil ifTrue:[
|
|
1360 |
|topAppl|
|
|
1361 |
|
2177
|
1362 |
list add:(MenuDesc title:'application' value:inst action:[ view application inspect ]).
|
|
1363 |
|
|
1364 |
topAppl := inst topApplication.
|
|
1365 |
|
|
1366 |
(topAppl notNil and:[topAppl ~~ inst]) ifTrue:[
|
|
1367 |
list add:(MenuDesc title:'topApplication' value:topAppl action:[ inst topApplication inspect ]).
|
|
1368 |
].
|
|
1369 |
].
|
|
1370 |
list add:(MenuDesc separator).
|
|
1371 |
|
2888
|
1372 |
(view respondsTo:#'model') ifTrue:[
|
2779
|
1373 |
inst := view model.
|
2177
|
1374 |
|
2888
|
1375 |
inst isNil
|
|
1376 |
ifTrue:[ label := value := nil ]
|
|
1377 |
ifFalse:[ label := inst displayString.
|
|
1378 |
label := label,(self aspectLabelFor:inst inApplicationOf:view).
|
|
1379 |
value := [ view model inspect ].
|
|
1380 |
].
|
2177
|
1381 |
|
|
1382 |
list add:(MenuDesc title:'model' value:label action:value).
|
|
1383 |
|
|
1384 |
(inst notNil and:[view respondsTo:#modelInterface]) ifTrue:[
|
|
1385 |
view modelInterface keysAndValuesDo:[:key : val|
|
|
1386 |
val isNil ifTrue:[ label := nil ]
|
|
1387 |
ifFalse:[ label := val displayString ].
|
|
1388 |
|
|
1389 |
list add:(MenuDesc title:(' - ', key) value:label ).
|
|
1390 |
]
|
|
1391 |
].
|
|
1392 |
].
|
|
1393 |
|
|
1394 |
(view respondsTo:#enableChannel) ifTrue:[
|
|
1395 |
inst := view enableChannel.
|
|
1396 |
|
|
1397 |
inst isNil ifTrue:[ label := value := nil ]
|
|
1398 |
ifFalse:[ label := inst displayString.
|
2888
|
1399 |
label := label,(self aspectLabelFor:inst inApplicationOf:view).
|
2177
|
1400 |
value := [ view enableChannel inspect ].
|
|
1401 |
].
|
|
1402 |
|
|
1403 |
list add:(MenuDesc title:'enableChannel' value:label action:value).
|
|
1404 |
].
|
|
1405 |
|
2888
|
1406 |
#( #action #pressAction #releaseAction ) do:[:actionSelector |
|
2779
|
1407 |
(view respondsTo:actionSelector) ifTrue:[
|
|
1408 |
inst := view perform:actionSelector.
|
|
1409 |
|
|
1410 |
inst isNil
|
|
1411 |
ifTrue:[ label := value := nil ]
|
|