author | tz |
Sat, 14 Feb 1998 22:42:27 +0100 | |
changeset 636 | b06bea6cbe1b |
parent 327 | 0040d47658c6 |
child 809 | 6f127dd5e578 |
permissions | -rw-r--r-- |
35 | 1 |
"{ NameSpace: NewInspector }" |
2 |
||
3 |
SimpleView subclass:#InspectorPanelView |
|
4 |
instanceVariableNames:'frames labelViews listViews scrollBar maxDepth leftHistory |
|
5 |
rightHistory hzpView actionBlock valueChangedAction' |
|
6 |
classVariableNames:'' |
|
7 |
poolDictionaries:'' |
|
8 |
category:'Inspector' |
|
9 |
! |
|
10 |
||
11 |
!InspectorPanelView class methodsFor:'documentation'! |
|
12 |
||
13 |
examples |
|
14 |
" |
|
15 |
example 1 |
|
16 |
========= |
|
17 |
||
39 | 18 |
[exBegin] |
35 | 19 |
|top slv| |
20 |
||
21 |
top := StandardSystemView new extent:600@400. |
|
22 |
slv := NewInspector::InspectorPanelView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
23 |
slv inspect:top. |
|
24 |
slv action:[:el|Transcript showCR:el]. |
|
25 |
top open. |
|
39 | 26 |
[exEnd] |
35 | 27 |
|
28 |
||
29 |
example 2 |
|
30 |
========= |
|
39 | 31 |
[exBegin] |
35 | 32 |
|top slv edt a vvp| |
33 |
||
34 |
a := Array new:5. |
|
35 |
a at:4 put:(Array new:6). |
|
36 |
||
37 |
top := StandardSystemView new extent:600@400. |
|
38 |
vvp := VariableVerticalPanel origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
39 |
||
40 |
slv := NewInspector::InspectorPanelView origin:0.0@0.0 corner:1.0@0.5 in:vvp. |
|
41 |
edt := Workspace origin:0.0 @ 0.5 corner:1.0 @ 1.0 in:vvp. |
|
42 |
edt acceptAction:[:theText|slv accept:theText notifying:edt]. |
|
43 |
edt doItAction:[:theCode|slv doIt:theCode notifying:edt]. |
|
44 |
||
45 |
slv action:[:el| Transcript showCR:(el printString)]. |
|
46 |
slv inspect:a. |
|
47 |
||
48 |
top open. |
|
39 | 49 |
[exEnd] |
35 | 50 |
" |
51 |
! ! |
|
52 |
||
53 |
!InspectorPanelView class methodsFor:'constants'! |
|
54 |
||
55 |
minDepth |
|
39 | 56 |
"returns the minimum of views assigned to a panel |
35 | 57 |
" |
58 |
^ 4 |
|
59 |
! ! |
|
60 |
||
61 |
!InspectorPanelView methodsFor:'accessing'! |
|
62 |
||
63 |
depth |
|
64 |
"returns number of listViews |
|
65 |
" |
|
66 |
^ listViews size |
|
67 |
! |
|
68 |
||
69 |
depth:aDepth |
|
70 |
"change the number of existing listViews |
|
71 |
" |
|
72 |
|sz min| |
|
73 |
||
74 |
min := self class minDepth. |
|
75 |
||
76 |
aDepth > min ifTrue:[ |
|
77 |
sz := aDepth min:maxDepth. |
|
78 |
||
79 |
sz < listViews size ifTrue:[ |
|
80 |
sz := listViews size |
|
81 |
] |
|
82 |
] ifFalse:[ |
|
83 |
sz := min |
|
84 |
]. |
|
85 |
||
86 |
listViews size == sz ifTrue:[ |
|
87 |
sz == aDepth ifFalse:[self moveContentsLeft:1]. |
|
88 |
] ifFalse:[ |
|
89 |
[self createViewWithoutRedraw. listViews size ~~ sz] whileTrue. |
|
90 |
self computeExtentOfFrames. |
|
91 |
||
92 |
(self topView shown) ifTrue:[ |
|
93 |
hzpView sizeChanged:nil. |
|
94 |
hzpView realizeAllSubViews. |
|
95 |
] |
|
96 |
] |
|
97 |
! |
|
98 |
||
99 |
maxDepth |
|
100 |
^ maxDepth |
|
101 |
! |
|
102 |
||
103 |
maxDepth:aNumber |
|
104 |
"change max depth for instance |
|
105 |
" |
|
106 |
aNumber > listViews size ifTrue:[ |
|
107 |
aNumber >= (self class minDepth) ifTrue:[ |
|
108 |
maxDepth := aNumber. |
|
109 |
||
110 |
maxDepth < listViews size ifTrue:[ |
|
111 |
self depth:maxDepth |
|
112 |
] |
|
113 |
] |
|
114 |
] |
|
115 |
! ! |
|
116 |
||
117 |
!InspectorPanelView methodsFor:'accessing actions'! |
|
118 |
||
119 |
action:aOneArgBlock |
|
120 |
"set the single click action block. |
|
121 |
If non-nil, that one is evaluated on single click, passing the |
|
122 |
selected instance as argument |
|
123 |
" |
|
124 |
actionBlock := aOneArgBlock |
|
125 |
||
126 |
||
127 |
! |
|
128 |
||
129 |
valueChangedAction:aOneArgBlock |
|
130 |
"evaluated if an instnace changed its value; passing |
|
131 |
the instance as argument |
|
132 |
" |
|
133 |
valueChangedAction := aOneArgBlock |
|
134 |
! ! |
|
135 |
||
136 |
!InspectorPanelView methodsFor:'accessing selections'! |
|
137 |
||
138 |
inspectedObject |
|
139 |
"returns the current inspected object |
|
140 |
" |
|
39 | 141 |
^ self findLastValidListWithSelection inspectedObject |
35 | 142 |
! |
143 |
||
144 |
selectedInstanceVar |
|
145 |
"returns the current selected instance var |
|
146 |
" |
|
39 | 147 |
^ self findLastValidListWithSelection selectedInstanceVar |
35 | 148 |
! ! |
149 |
||
150 |
!InspectorPanelView methodsFor:'actions'! |
|
151 |
||
152 |
accept:aText notifying:aView |
|
39 | 153 |
"evaluating aText on the last selected instance var. on success the views |
154 |
are updated. |
|
155 |
" |
|
156 |
self doItOrAccept:[:aList|aList accept:aText notifying:aView] |
|
35 | 157 |
! |
158 |
||
159 |
doIt:aCode notifying:aView |
|
39 | 160 |
"evaluating aCode on the selected instance var; on success the views |
161 |
are updated. |
|
162 |
" |
|
163 |
^ self doItOrAccept:[:aList|aList doIt:aCode notifying:aView] |
|
35 | 164 |
! |
165 |
||
166 |
inspect:anObject |
|
39 | 167 |
"change the inspected object and all views |
35 | 168 |
" |
169 |
|view| |
|
170 |
||
171 |
view := listViews first. |
|
172 |
leftHistory removeAll. |
|
173 |
rightHistory removeAll. |
|
174 |
||
175 |
view inspect:anObject. |
|
176 |
listViews from:2 do:[:v|v inspect:nil]. |
|
177 |
self update. |
|
178 |
! ! |
|
179 |
||
180 |
!InspectorPanelView methodsFor:'event handling'! |
|
181 |
||
182 |
handlesKeyPress:key inView:someView |
|
39 | 183 |
"all keys are handled by this instance itself |
184 |
" |
|
35 | 185 |
^ true |
186 |
||
187 |
! |
|
188 |
||
189 |
keyPress:key x:x y:y view:someView |
|
39 | 190 |
"handle some special keys |
191 |
" |
|
35 | 192 |
key == #CursorLeft ifTrue:[^ self moveContentsRight:1]. |
193 |
key == #CursorRight ifTrue:[^ self moveContentsLeft:1 ]. |
|
194 |
||
195 |
someView keyPress:key x:x y:y. |
|
196 |
||
197 |
! |
|
198 |
||
199 |
singleClickAt:anIndex |
|
39 | 200 |
"the view at an index changed its selection caused by a single click |
35 | 201 |
" |
202 |
|view start sivar| |
|
203 |
||
204 |
rightHistory removeAll. |
|
205 |
||
206 |
view := listViews at:anIndex. |
|
207 |
start := anIndex + 1. |
|
208 |
sivar := view selectedInstanceVar. |
|
209 |
||
210 |
start > listViews size ifTrue:[ |
|
211 |
start >= maxDepth ifTrue:[ |
|
212 |
self moveContentsLeft:1. |
|
213 |
^ actionBlock value:sivar. |
|
214 |
]. |
|
215 |
]. |
|
216 |
||
217 |
(view selectedInstanceType) == #directory ifTrue:[ |
|
218 |
(listViews at:start) setSelection:nil. |
|
219 |
(listViews at:start) inspect:sivar. |
|
220 |
||
221 |
start := start + 1. |
|
222 |
]. |
|
223 |
||
224 |
listViews from:start do:[:v|v inspect:nil]. |
|
225 |
self update. |
|
226 |
actionBlock value:sivar. |
|
227 |
! ! |
|
228 |
||
229 |
!InspectorPanelView methodsFor:'initializing'! |
|
230 |
||
231 |
initialize |
|
232 |
"initialize instance |
|
233 |
" |
|
234 |
super initialize. |
|
235 |
||
236 |
frames := OrderedCollection new. |
|
237 |
listViews := OrderedCollection new. |
|
238 |
labelViews := OrderedCollection new. |
|
239 |
leftHistory := OrderedCollection new. |
|
240 |
rightHistory := OrderedCollection new. |
|
241 |
maxDepth := self class minDepth. |
|
242 |
||
243 |
actionBlock := [:el| ]. |
|
244 |
||
245 |
hzpView := VariableHorizontalPanel origin:0.0@0.0 corner:1.0@1.0 in:self. |
|
246 |
scrollBar := HorizontalScrollBar origin:0.0@1.0 corner:1.0@1.0 in:self. |
|
247 |
scrollBar asynchronousOperation. |
|
248 |
||
249 |
hzpView bottomInset:(scrollBar preferredExtent y). |
|
250 |
||
251 |
scrollBar topInset:(scrollBar preferredExtent y) negated. |
|
252 |
scrollBar thumbHeight:100. |
|
253 |
scrollBar scrollAction:[:percent | self scrollTo:percent]. |
|
254 |
scrollBar scrollRightAction:[self moveContentsLeft:1]. |
|
255 |
scrollBar scrollLeftAction:[self moveContentsRight:1]. |
|
256 |
||
257 |
self depth:maxDepth. |
|
258 |
! ! |
|
259 |
||
260 |
!InspectorPanelView methodsFor:'menu - labels & actions'! |
|
261 |
||
262 |
browse:anIndex |
|
263 |
self classAtLabel:anIndex do:[:cls| cls browserClass openInClass:cls selector:nil ] |
|
264 |
||
265 |
! |
|
266 |
||
267 |
browseClassHierarchy:anIndex |
|
268 |
self classAtLabel:anIndex do:[:cls| cls browserClass browseClassHierarchy:cls ] |
|
269 |
||
270 |
! |
|
271 |
||
272 |
browseFullClassProtocol:anIndex |
|
273 |
self classAtLabel:anIndex do:[:cls| cls browserClass browseFullClassProtocol:cls ] |
|
274 |
||
275 |
! |
|
276 |
||
277 |
classAtLabel:anIndex do:anAction |
|
278 |
"evaluate action on class assigned to label |
|
279 |
" |
|
280 |
|cls| |
|
281 |
||
282 |
anIndex <= labelViews size ifTrue:[ |
|
283 |
(cls := Smalltalk classNamed:((labelViews at:anIndex) label)) notNil ifTrue:[ |
|
284 |
anAction value:cls |
|
285 |
] |
|
286 |
] |
|
287 |
||
288 |
! |
|
289 |
||
290 |
labelMenu |
|
291 |
"popup menu required by any label. Delegate the request to the corresponding label |
|
292 |
" |
|
293 |
|sqNr view| |
|
294 |
||
295 |
view := (WindowGroup lastEventQuerySignal raise) view. |
|
296 |
sqNr := labelViews findFirst:[:v| v == view]. |
|
297 |
||
298 |
sqNr ~~ 0 ifTrue:[ |
|
299 |
view := labelViews at:sqNr. |
|
300 |
||
301 |
view label notEmpty ifTrue:[ |
|
302 |
^ self labelMenu:sqNr |
|
303 |
] |
|
304 |
]. |
|
305 |
^ nil |
|
306 |
! |
|
307 |
||
308 |
labelMenu:anIndex |
|
309 |
"popup menu required for a label identified by its sequence number |
|
310 |
" |
|
311 |
|menu| |
|
312 |
||
313 |
menu := PopUpMenu labels:#( |
|
314 |
'browse' |
|
315 |
'browse class hierarchy' |
|
316 |
'browse full class protocol' |
|
317 |
) |
|
318 |
selectors:#( |
|
319 |
browse: |
|
320 |
browseClassHierarchy: |
|
321 |
browseFullClassProtocol: |
|
322 |
) |
|
323 |
receiver:self. |
|
324 |
||
325 |
menu args:(Array new:(menu labels size) withAll:anIndex). |
|
326 |
^ menu |
|
327 |
||
328 |
! ! |
|
329 |
||
330 |
!InspectorPanelView methodsFor:'menu - views & actions'! |
|
331 |
||
332 |
doTrace:anInstance |
|
333 |
"place a trace on messages sent to the instance |
|
334 |
" |
|
335 |
|selectors| |
|
336 |
||
337 |
selectors := self messageMenu:anInstance. |
|
338 |
||
339 |
selectors notNil ifTrue:[ |
|
340 |
self topView withWaitCursorDo:[MessageTracer trace:anInstance selectors:selectors] |
|
341 |
]. |
|
342 |
||
343 |
! |
|
344 |
||
345 |
doTraceAll:anInstance |
|
346 |
"place a trace on all messages sent to the instance |
|
347 |
" |
|
348 |
self topView withWaitCursorDo:[MessageTracer traceAll:anInstance] |
|
349 |
! |
|
350 |
||
351 |
doTrap:anInstance |
|
352 |
"place a trap on a message sent to the instance |
|
353 |
" |
|
354 |
|selectors| |
|
355 |
||
356 |
selectors := self messageMenu:anInstance. |
|
357 |
||
358 |
selectors notNil ifTrue:[ |
|
359 |
self topView withWaitCursorDo:[MessageTracer trap:anInstance selectors:selectors] |
|
360 |
] |
|
361 |
! |
|
362 |
||
363 |
doTrapAll:anInstance |
|
364 |
"place a trap on all messages sent to the instance |
|
365 |
" |
|
366 |
self topView withWaitCursorDo:[MessageTracer trapAll:anInstance] |
|
367 |
||
368 |
! |
|
369 |
||
370 |
doUntrace:anInstance |
|
371 |
"remove all traps and traces to the instance |
|
372 |
" |
|
373 |
self topView withWaitCursorDo:[MessageTracer untrace:anInstance]. |
|
374 |
||
375 |
! |
|
376 |
||
377 |
messageMenu:anInstance |
|
378 |
"open menu to select messages; on accepted a list of messages is returned |
|
379 |
" |
|
380 |
|sll acl lst inset top hzp slv acv dblClcAct btp b1 b2 accepted viewSpacing| |
|
381 |
||
382 |
top := StandardSystemView new. |
|
383 |
top extent:500 @ 400. |
|
384 |
top label:(anInstance printString). |
|
385 |
||
386 |
(Label origin:(0.0 @ 0.0) corner:(0.5 @ 20) in:top) label:'messages'. |
|
387 |
(Label origin:(0.5 @ 0.0) corner:(1.0 @ 20) in:top) label:'selected'. |
|
388 |
hzp := VariableHorizontalPanel origin:(0.0 @ 20) corner:(1.0 @ 1.0) in:top. |
|
389 |
btp := HorizontalPanelView origin:(0.0 @1.0) corner:(1.0 @ 1.0) in:top. |
|
390 |
||
391 |
b1 := Button abortButtonIn:btp. |
|
392 |
b2 := Button okButtonIn:btp. |
|
393 |
accepted := false. |
|
394 |
||
395 |
b1 action:[accepted := false. top destroy]. |
|
396 |
b2 action:[accepted := true. top destroy]. |
|
397 |
||
398 |
btp horizontalLayout:#fitSpace. |
|
399 |
viewSpacing := top class viewSpacing. |
|
400 |
inset := (b2 preferredExtent y) + viewSpacing. |
|
401 |
viewSpacing := viewSpacing // 2. |
|
402 |
||
403 |
hzp bottomInset:inset. |
|
404 |
btp topInset:((inset - viewSpacing) negated). |
|
405 |
btp bottomInset:viewSpacing. |
|
406 |
||
407 |
slv := ScrollableView for:SelectionInListView |
|
408 |
miniScrollerV:true |
|
409 |
origin:(0.0 @ 0.0) |
|
410 |
corner:(0.5 @ 1.0) |
|
411 |
in:hzp. |
|
412 |
||
413 |
acv := ScrollableView for:SelectionInListView |
|
414 |
miniScrollerV:true |
|
415 |
origin:(0.5 @ 0.0) |
|
416 |
corner:(1.0 @ 1.0) |
|
417 |
in:hzp. |
|
418 |
||
419 |
slv := slv scrolledView. |
|
420 |
acv := acv scrolledView. |
|
421 |
||
422 |
sll := (MessageTracer realClassOf:anInstance) selectors. |
|
423 |
acl := OrderedCollection new. |
|
424 |
||
425 |
(MessageTracer wrappedSelectorsOf:anInstance) do:[:el| |
|
426 |
el notNil ifTrue:[ |
|
427 |
acl add:el. |
|
428 |
sll remove:el ifAbsent:nil |
|
429 |
] |
|
430 |
]. |
|
431 |
||
432 |
slv list:(sll copy). |
|
433 |
acv list:(acl copy). |
|
434 |
||
435 |
dblClcAct := [:from :to| |
|
436 |
to add:(from selectionValue). |
|
437 |
from removeIndex:(from selection). |
|
438 |
from redraw. |
|
439 |
]. |
|
440 |
||
441 |
slv doubleClickAction:[:index| dblClcAct value:slv value:acv]. |
|
442 |
acv doubleClickAction:[:index| dblClcAct value:acv value:slv]. |
|
443 |
||
444 |
top openModal. |
|
445 |
||
446 |
accepted ifFalse:[ |
|
447 |
^ nil |
|
448 |
]. |
|
449 |
lst := acv list. |
|
450 |
||
451 |
"undo existing traps HACK: removes traps and traces" |
|
452 |
||
453 |
acl notEmpty ifTrue:[ |
|
454 |
MessageTracer untrace:anInstance |
|
455 |
]. |
|
456 |
||
457 |
lst notEmpty ifTrue:[^ lst] |
|
458 |
ifFalse:[^ nil] |
|
459 |
! |
|
460 |
||
461 |
viewMenu |
|
462 |
"popup menu required by any view. Delegate the request to the corresponding view |
|
463 |
" |
|
464 |
|sqNr view| |
|
465 |
||
466 |
view := (WindowGroup lastEventQuerySignal raise) view. |
|
467 |
sqNr := listViews findFirst:[:v| v == view]. |
|
468 |
||
469 |
sqNr notNil ifTrue:[^ self viewMenu:sqNr] |
|
470 |
ifFalse:[^ nil] |
|
471 |
! |
|
472 |
||
473 |
viewMenu:anIndex |
|
474 |
"popup menu required for a view identified by its sequence number |
|
475 |
" |
|
327
0040d47658c6
check - warnings eliminated. Fix in InspectorList.st
Claus Gittinger <cg@exept.de>
parents:
39
diff
changeset
|
476 |
|view menu inst args lbls| |
35 | 477 |
|
478 |
view := listViews at:anIndex. |
|
479 |
view hasSelection ifFalse:[^ nil]. |
|
480 |
inst := view selectedInstanceVar. |
|
481 |
||
39 | 482 |
menu := PopUpMenu labels:#( 'update' ) |
483 |
selectors:#( #update ) |
|
35 | 484 |
receiver:self. |
485 |
||
486 |
menu actionAt:#update put:[ |
|
39 | 487 |
view update. |
35 | 488 |
|
489 |
listViews from:(anIndex + 1) do:[:v| |
|
490 |
(view selectedInstanceType) ~~ #directory ifTrue:[ |
|
491 |
v inspect:nil |
|
492 |
] ifFalse:[ |
|
493 |
v inspect:(view selectedInstanceVar). |
|
494 |
view := v. |
|
495 |
] |
|
496 |
]. |
|
497 |
self update |
|
498 |
]. |
|
499 |
||
39 | 500 |
(InspectorList isTraceable:inst) ifFalse:[ |
501 |
^ menu |
|
502 |
]. |
|
503 |
||
35 | 504 |
menu addLabels:#( |
39 | 505 |
'-' |
35 | 506 |
'trace' |
507 |
'trap' |
|
508 |
'untrace / untrap' |
|
509 |
) |
|
510 |
selectors:#( |
|
39 | 511 |
nil |
35 | 512 |
trace |
513 |
trap |
|
514 |
untrace |
|
515 |
). |
|
516 |
||
517 |
menu actionAt:#untrace put:[self doUntrace:inst]. |
|
518 |
||
519 |
args := Array new:2 withAll:inst. |
|
520 |
lbls := Array with:'message' |
|
521 |
with:((Text string:' all ' emphasis:#underline), ' messages'). |
|
522 |
||
523 |
menu subMenuAt:#trace put:( |
|
524 |
PopUpMenu labels:lbls selectors:#(doTrace: doTraceAll:) args:args |
|
525 |
). |
|
526 |
||
527 |
menu subMenuAt:#trap put:( |
|
528 |
PopUpMenu labels:lbls selectors:#(doTrap: doTrapAll:) args:args |
|
529 |
). |
|
530 |
||
531 |
^ menu |
|
532 |
||
533 |
||
534 |
! ! |
|
535 |
||
536 |
!InspectorPanelView methodsFor:'private'! |
|
537 |
||
538 |
doItOrAccept:aBlock |
|
39 | 539 |
"handle a doIt or accept action; on success all the folloed views are |
540 |
updated |
|
35 | 541 |
" |
39 | 542 |
|index list result instVar| |
35 | 543 |
|
39 | 544 |
list := self findLastValidListWithSelection. |
545 |
result := aBlock value:list. |
|
546 |
instVar := list selectedInstanceVar. |
|
547 |
index := listViews findLast:[:v|v == list]. |
|
35 | 548 |
|
39 | 549 |
(index ~~ 0 and:[index ~~ listViews size]) ifTrue:[ |
550 |
index := index + 1. |
|
551 |
(list selectedInstanceType) == #directory ifTrue:[ |
|
552 |
(listViews at:index) inspect:instVar |
|
553 |
] ifFalse:[ |
|
554 |
(listViews at:index) inspect:nil |
|
555 |
]. |
|
556 |
self update |
|
557 |
]. |
|
558 |
valueChangedAction notNil ifTrue:[ |
|
559 |
valueChangedAction value:instVar |
|
35 | 560 |
]. |
39 | 561 |
^ result |
562 |
! |
|
563 |
||
564 |
findLastValidListWithSelection |
|
565 |
"returns last valid list with a selection; if no selection exists in any |
|
566 |
view, the list assigned to the inspected object is returned |
|
567 |
" |
|
568 |
|index| |
|
569 |
||
570 |
rightHistory notEmpty ifTrue:[ |
|
571 |
^ rightHistory first |
|
572 |
]. |
|
573 |
index := listViews findLast:[:v| v hasSelection ]. |
|
35 | 574 |
|
575 |
index ~~ 0 ifTrue:[ |
|
39 | 576 |
^ listViews at:index |
577 |
]. |
|
35 | 578 |
|
39 | 579 |
leftHistory notEmpty ifTrue:[^ leftHistory last] |
580 |
ifFalse:[^ listViews at:1] |
|
35 | 581 |
! |
582 |
||
583 |
update |
|
584 |
"update labels and scrollbar |
|
585 |
" |
|
586 |
|pview cview stop index ispObj label| |
|
587 |
||
588 |
"UPDATE LABELS |
|
589 |
" |
|
590 |
index := 1. |
|
591 |
stop := listViews size. |
|
592 |
||
593 |
[ cview := listViews at:index. |
|
594 |
ispObj := cview inspectedObject. |
|
595 |
label := labelViews at:index. |
|
596 |
index := index + 1. |
|
597 |
||
598 |
ispObj notNil ifTrue:[ |
|
599 |
label label:(ispObj class name asString). |
|
600 |
pview := cview. |
|
601 |
] ifFalse:[ |
|
602 |
[index <= stop] whileTrue:[ |
|
603 |
(labelViews at:index) label:''. |
|
604 |
index := index + 1 |
|
605 |
]. |
|
606 |
||
607 |
(pview isNil or:[pview selectedInstanceType == #normal]) ifTrue:[ |
|
608 |
pview notNil ifTrue:[ispObj := pview selectedInstanceVar]. |
|
609 |
label label:ispObj class name asString |
|
610 |
] ifFalse:[ |
|
611 |
label label:'' |
|
612 |
] |
|
613 |
]. |
|
614 |
index > stop |
|
615 |
||
616 |
] whileFalse. |
|
617 |
||
618 |
"UPDATE SCROLLBARS |
|
619 |
" |
|
620 |
index := listViews size + leftHistory size + rightHistory size. |
|
621 |
||
622 |
(listViews last) selectedInstanceType notNil ifTrue:[ |
|
623 |
index := index + 1 |
|
624 |
]. |
|
625 |
scrollBar thumbHeight:(stop / index) * 100. |
|
626 |
scrollBar thumbOrigin:(100 / index * leftHistory size). |
|
627 |
||
628 |
! ! |
|
629 |
||
630 |
!InspectorPanelView methodsFor:'private frames'! |
|
631 |
||
632 |
computeExtentOfFrames |
|
633 |
"compute the extent of all frames (origin/corner) |
|
634 |
" |
|
635 |
|orig corn offset newX| |
|
636 |
||
637 |
orig := ( 0.0 @ 0.0 ). |
|
638 |
corn := ( 0.0 @ 1.0 ). |
|
639 |
||
640 |
offset := 1.0 / (frames size). |
|
641 |
newX := 0.0. |
|
642 |
||
643 |
frames do:[:frame| |
|
644 |
(newX := newX + offset) > 1.0 ifTrue:[ newX := 1.0 ]. |
|
645 |
corn := newX @ corn y. |
|
646 |
frame origin:orig corner:corn. |
|
647 |
orig := newX @ orig y. |
|
648 |
]. |
|
649 |
||
650 |
||
651 |
! |
|
652 |
||
653 |
createViewWithoutRedraw |
|
39 | 654 |
"add a new view at end of the panel |
35 | 655 |
" |
656 |
|view frame label index| |
|
657 |
||
658 |
frame := SimpleView in:hzpView. |
|
659 |
||
660 |
label := Label origin:0.0@0.0 corner:1.0@20 in:frame. |
|
661 |
label leftInset:15. |
|
662 |
label rightInset:2. |
|
663 |
||
664 |
view := ScrollableView for:InspectorListView miniScroller:true origin:0.0@20 |
|
665 |
corner:1.0@1.0 in:frame. |
|
666 |
||
667 |
view := view scrolledView. |
|
668 |
||
669 |
frames add:frame. |
|
670 |
labelViews add:label. |
|
671 |
listViews add:view. |
|
672 |
||
673 |
index := listViews size. |
|
674 |
||
675 |
index == 1 ifTrue:[ |
|
676 |
view includesSelf:true |
|
677 |
]. |
|
678 |
||
679 |
label adjust:#left. |
|
680 |
label label:''. |
|
681 |
label level:1. |
|
682 |
label menuHolder:self; menuMessage:#labelMenu; menuPerformer:self. |
|
683 |
||
684 |
view action:[:el|self singleClickAt:index]. |
|
685 |
||
686 |
view delegate:self. |
|
687 |
view menuHolder:self; menuMessage:#viewMenu; menuPerformer:self. |
|
688 |
||
689 |
! ! |
|
690 |
||
691 |
!InspectorPanelView methodsFor:'scrolling-basic'! |
|
692 |
||
693 |
moveContentsLeft:nTimes |
|
39 | 694 |
"move the contents of all views one position left |
35 | 695 |
" |
327
0040d47658c6
check - warnings eliminated. Fix in InspectorList.st
Claus Gittinger <cg@exept.de>
parents:
39
diff
changeset
|
696 |
|fView stop pView index| |
35 | 697 |
|
698 |
(nTimes < 1 or:[listViews last isEmpty]) ifTrue:[ |
|
699 |
^ self |
|
700 |
]. |
|
701 |
||
702 |
index := nTimes. |
|
703 |
stop := (listViews size) - 1. |
|
704 |
fView := listViews first. |
|
705 |
pView := listViews at:stop. |
|
706 |
||
707 |
||
39 | 708 |
[ leftHistory add:(fView list). |
35 | 709 |
|
710 |
1 to:stop do:[:i| |
|
39 | 711 |
(listViews at:i) list:(listViews at:(i+1)) |
35 | 712 |
]. |
713 |
||
714 |
rightHistory notEmpty ifTrue:[ |
|
39 | 715 |
(listViews last) list:(rightHistory removeLast) |
35 | 716 |
] ifFalse:[ |
717 |
(listViews last) inspect:(pView selectedInstanceVar) |
|
718 |
]. |
|
719 |
((index := index - 1) == 0 or:[listViews last isEmpty]) |
|
720 |
||
721 |
] whileFalse. |
|
722 |
||
723 |
self update. |
|
724 |
||
725 |
||
726 |
||
727 |
! |
|
728 |
||
729 |
moveContentsRight:nTimes |
|
39 | 730 |
"move the contents of all views one position right |
35 | 731 |
" |
327
0040d47658c6
check - warnings eliminated. Fix in InspectorList.st
Claus Gittinger <cg@exept.de>
parents:
39
diff
changeset
|
732 |
|size index lView fView| |
35 | 733 |
|
734 |
size := leftHistory size. |
|
735 |
||
736 |
(nTimes > 0 and:[size ~~ 0]) ifTrue:[ |
|
737 |
nTimes > size ifFalse:[index := nTimes] |
|
738 |
ifTrue:[index := size]. |
|
739 |
||
740 |
size := listViews size. |
|
741 |
lView := listViews last. |
|
742 |
fView := listViews first. |
|
743 |
||
744 |
1 to:index do:[:i| |
|
745 |
lView hasSelection ifTrue:[ |
|
39 | 746 |
rightHistory add:(lView list) |
35 | 747 |
]. |
748 |
size to:2 by:-1 do:[:i| |
|
39 | 749 |
(listViews at:i) list:(listViews at:(i-1)) |
35 | 750 |
]. |
39 | 751 |
fView list:(leftHistory removeLast) |
35 | 752 |
]. |
753 |
self update |
|
754 |
] |
|
755 |
||
756 |
! |
|
757 |
||
758 |
scrollTo:nPercent |
|
39 | 759 |
"set views and contents dependant on scroll bar |
35 | 760 |
" |
761 |
|dY no noScr pR| |
|
762 |
||
763 |
noScr := listViews size + leftHistory size + rightHistory size. |
|
764 |
||
765 |
(listViews last) selectedInstanceType notNil ifTrue:[ |
|
766 |
noScr := noScr + 1 |
|
767 |
]. |
|
768 |
dY := 100 / noScr. |
|
769 |
pR := nPercent roundTo:dY. |
|
770 |
||
771 |
no := ((dY * leftHistory size) - pR) / dY. |
|
772 |
||
773 |
no == 0 ifTrue:[ |
|
774 |
(nPercent - pR) > 0 ifTrue:[no := -1] |
|
775 |
ifFalse:[no := 1] |
|
776 |
]. |
|
777 |
no < 0 ifTrue:[self moveContentsLeft:(no negated)] |
|
778 |
ifFalse:[self moveContentsRight:no] |
|
779 |
! ! |
|
780 |
||
781 |
!InspectorPanelView class methodsFor:'documentation'! |
|
782 |
||
783 |
version |
|
784 |
^ '$Header$' |
|
785 |
! ! |