NewInspectorPanelView.st
changeset 1213 6cf7a4c2dfce
parent 810 032e13b1bfda
child 2171 9ad4c3d354bb
equal deleted inserted replaced
1212:a13dafe6f9fe 1213:6cf7a4c2dfce
    12 
    12 
    13 
    13 
    14 
    14 
    15 "{ NameSpace: NewInspector }"
    15 "{ NameSpace: NewInspector }"
    16 
    16 
    17 SimpleView subclass:#InspectorPanelView
    17 SimpleView subclass:#NewInspectorPanelView
    18 	instanceVariableNames:'frames labelViews listViews scrollBar maxDepth leftHistory
    18 	instanceVariableNames:'frames labelViews listViews scrollBar maxDepth leftHistory
    19 		rightHistory hzpView actionBlock valueChangedAction'
    19 		rightHistory hzpView actionBlock valueChangedAction'
    20 	classVariableNames:''
    20 	classVariableNames:''
    21 	poolDictionaries:''
    21 	poolDictionaries:''
    22 	category:'Interface-Inspector'
    22 	category:'Interface-NewInspector'
    23 !
    23 !
    24 
    24 
    25 !InspectorPanelView class methodsFor:'documentation'!
    25 !NewInspectorPanelView class methodsFor:'documentation'!
    26 
    26 
    27 copyright
    27 copyright
    28 "
    28 "
    29  COPYRIGHT (c) 1997 by eXept Software AG
    29  COPYRIGHT (c) 1997 by eXept Software AG
    30               All Rights Reserved
    30               All Rights Reserved
    47 
    47 
    48                                                                         [exBegin]
    48                                                                         [exBegin]
    49     |top slv|
    49     |top slv|
    50 
    50 
    51     top := StandardSystemView new extent:600@400.
    51     top := StandardSystemView new extent:600@400.
    52     slv := NewInspector::InspectorPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
    52     slv := NewInspector::NewInspectorPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
    53     slv inspect:top.
    53     slv inspect:top.
    54     slv action:[:el|Transcript showCR:el].
    54     slv action:[:el|Transcript showCR:el].
    55     top open.
    55     top open.
    56                                                                         [exEnd]
    56                                                                         [exEnd]
    57 
    57 
    65     a at:4 put:(Array new:6).
    65     a at:4 put:(Array new:6).
    66 
    66 
    67     top := StandardSystemView new extent:600@400.
    67     top := StandardSystemView new extent:600@400.
    68     vvp := VariableVerticalPanel origin:0.0@0.0  corner:1.0@1.0 in:top.
    68     vvp := VariableVerticalPanel origin:0.0@0.0  corner:1.0@1.0 in:top.
    69 
    69 
    70     slv := NewInspector::InspectorPanelView origin:0.0@0.0 corner:1.0@0.5 in:vvp.
    70     slv := NewInspector::NewInspectorPanelView origin:0.0@0.0 corner:1.0@0.5 in:vvp.
    71     edt := Workspace origin:0.0 @ 0.5 corner:1.0 @ 1.0 in:vvp.
    71     edt := Workspace origin:0.0 @ 0.5 corner:1.0 @ 1.0 in:vvp.
    72     edt acceptAction:[:theText|slv accept:theText notifying:edt].
    72     edt acceptAction:[:theText|slv accept:theText notifying:edt].
    73     edt   doItAction:[:theCode|slv doIt:theCode   notifying:edt].
    73     edt   doItAction:[:theCode|slv doIt:theCode   notifying:edt].
    74 
    74 
    75     slv action:[:el| Transcript showCR:(el printString)].
    75     slv action:[:el| Transcript showCR:(el printString)].
    78     top open.
    78     top open.
    79                                                                         [exEnd]
    79                                                                         [exEnd]
    80 "
    80 "
    81 ! !
    81 ! !
    82 
    82 
    83 !InspectorPanelView class methodsFor:'constants'!
    83 !NewInspectorPanelView class methodsFor:'constants'!
    84 
    84 
    85 minDepth
    85 minDepth
    86     "returns the minimum of views assigned to a panel
    86     "returns the minimum of views assigned to a panel
    87     "
    87     "
    88     ^ 4
    88     ^ 4
    89 ! !
    89 ! !
    90 
    90 
    91 !InspectorPanelView methodsFor:'accessing'!
    91 !NewInspectorPanelView methodsFor:'accessing'!
    92 
    92 
    93 depth
    93 depth
    94     "returns number of listViews
    94     "returns number of listViews
    95     "
    95     "
    96   ^ listViews size
    96   ^ listViews size
   142             ]
   142             ]
   143         ]
   143         ]
   144     ]
   144     ]
   145 ! !
   145 ! !
   146 
   146 
   147 !InspectorPanelView methodsFor:'accessing actions'!
   147 !NewInspectorPanelView methodsFor:'accessing actions'!
   148 
   148 
   149 action:aOneArgBlock
   149 action:aOneArgBlock
   150     "set the single click action block.
   150     "set the single click action block.
   151      If non-nil, that one is evaluated on single click, passing the
   151      If non-nil, that one is evaluated on single click, passing the
   152      selected instance as argument
   152      selected instance as argument
   161      the instance as argument
   161      the instance as argument
   162     "
   162     "
   163     valueChangedAction := aOneArgBlock
   163     valueChangedAction := aOneArgBlock
   164 ! !
   164 ! !
   165 
   165 
   166 !InspectorPanelView methodsFor:'accessing selections'!
   166 !NewInspectorPanelView methodsFor:'accessing selections'!
   167 
   167 
   168 inspectedObject
   168 inspectedObject
   169     "returns the current inspected object
   169     "returns the current inspected object
   170     "
   170     "
   171     ^ self findLastValidListWithSelection inspectedObject
   171     ^ self findLastValidListWithSelection inspectedObject
   175     "returns the current selected instance var
   175     "returns the current selected instance var
   176     "
   176     "
   177     ^ self findLastValidListWithSelection selectedInstanceVar
   177     ^ self findLastValidListWithSelection selectedInstanceVar
   178 ! !
   178 ! !
   179 
   179 
   180 !InspectorPanelView methodsFor:'actions'!
   180 !NewInspectorPanelView methodsFor:'actions'!
   181 
   181 
   182 accept:aText notifying:aView
   182 accept:aText notifying:aView
   183     "evaluating aText on the last selected instance var. on success the views
   183     "evaluating aText on the last selected instance var. on success the views
   184      are updated.
   184      are updated.
   185     "
   185     "
   205     view inspect:anObject.
   205     view inspect:anObject.
   206     listViews from:2 do:[:v|v inspect:nil].
   206     listViews from:2 do:[:v|v inspect:nil].
   207     self update.
   207     self update.
   208 ! !
   208 ! !
   209 
   209 
   210 !InspectorPanelView methodsFor:'event handling'!
   210 !NewInspectorPanelView methodsFor:'event handling'!
   211 
   211 
   212 handlesKeyPress:key inView:someView
   212 handlesKeyPress:key inView:someView
   213     "all keys are handled by this instance itself
   213     "all keys are handled by this instance itself
   214     "
   214     "
   215     ^ true
   215     ^ true
   254     listViews from:start do:[:v|v inspect:nil].
   254     listViews from:start do:[:v|v inspect:nil].
   255     self update.
   255     self update.
   256     actionBlock value:sivar.
   256     actionBlock value:sivar.
   257 ! !
   257 ! !
   258 
   258 
   259 !InspectorPanelView methodsFor:'initializing'!
   259 !NewInspectorPanelView methodsFor:'initializing'!
   260 
   260 
   261 initialize
   261 initialize
   262     "initialize instance
   262     "initialize instance
   263     "
   263     "
   264     super initialize.
   264     super initialize.
   285     scrollBar scrollLeftAction:[self moveContentsRight:1].
   285     scrollBar scrollLeftAction:[self moveContentsRight:1].
   286 
   286 
   287     self depth:maxDepth.
   287     self depth:maxDepth.
   288 ! !
   288 ! !
   289 
   289 
   290 !InspectorPanelView methodsFor:'menu - labels & actions'!
   290 !NewInspectorPanelView methodsFor:'menu - labels & actions'!
   291 
   291 
   292 browse:anIndex
   292 browse:anIndex
   293     self classAtLabel:anIndex do:[:cls| cls browserClass openInClass:cls selector:nil ]
   293     self classAtLabel:anIndex do:[:cls| cls browserClass openInClass:cls selector:nil ]
   294 
   294 
   295 !
   295 !
   355    menu args:(Array new:(menu labels size) withAll:anIndex).
   355    menu args:(Array new:(menu labels size) withAll:anIndex).
   356  ^ menu
   356  ^ menu
   357 
   357 
   358 ! !
   358 ! !
   359 
   359 
   360 !InspectorPanelView methodsFor:'menu - views & actions'!
   360 !NewInspectorPanelView methodsFor:'menu - views & actions'!
   361 
   361 
   362 doTrace:anInstance
   362 doTrace:anInstance
   363     "place a trace on messages sent to the instance
   363     "place a trace on messages sent to the instance
   364     "
   364     "
   365     |selectors|
   365     |selectors|
   525             ]
   525             ]
   526         ].
   526         ].
   527         self update
   527         self update
   528     ].
   528     ].
   529 
   529 
   530     (InspectorList isTraceable:inst) ifFalse:[
   530     (NewInspectorList isTraceable:inst) ifFalse:[
   531         ^ menu
   531         ^ menu
   532     ].
   532     ].
   533 
   533 
   534     menu  addLabels:#(
   534     menu  addLabels:#(
   535                       '-'
   535                       '-'
   561   ^ menu
   561   ^ menu
   562 
   562 
   563 
   563 
   564 ! !
   564 ! !
   565 
   565 
   566 !InspectorPanelView methodsFor:'private'!
   566 !NewInspectorPanelView methodsFor:'private'!
   567 
   567 
   568 doItOrAccept:aBlock
   568 doItOrAccept:aBlock
   569     "handle a doIt or accept action; on success all the folloed views are
   569     "handle a doIt or accept action; on success all the folloed views are
   570      updated
   570      updated
   571     "
   571     "
   655     scrollBar thumbHeight:(stop / index) * 100.
   655     scrollBar thumbHeight:(stop / index) * 100.
   656     scrollBar thumbOrigin:(100  / index * leftHistory size).
   656     scrollBar thumbOrigin:(100  / index * leftHistory size).
   657 
   657 
   658 ! !
   658 ! !
   659 
   659 
   660 !InspectorPanelView methodsFor:'private frames'!
   660 !NewInspectorPanelView methodsFor:'private frames'!
   661 
   661 
   662 computeExtentOfFrames
   662 computeExtentOfFrames
   663     "compute the extent of all frames (origin/corner)
   663     "compute the extent of all frames (origin/corner)
   664     "
   664     "
   665     |orig corn offset newX|
   665     |orig corn offset newX|
   689 
   689 
   690     label := Label origin:0.0@0.0 corner:1.0@20 in:frame.
   690     label := Label origin:0.0@0.0 corner:1.0@20 in:frame.
   691     label  leftInset:15.
   691     label  leftInset:15.
   692     label rightInset:2.
   692     label rightInset:2.
   693 
   693 
   694     view  := ScrollableView for:InspectorListView miniScroller:true origin:0.0@20 
   694     view  := ScrollableView for:NewInspectorListView miniScroller:true origin:0.0@20 
   695                          corner:1.0@1.0 in:frame.
   695                          corner:1.0@1.0 in:frame.
   696 
   696 
   697     view := view scrolledView.
   697     view := view scrolledView.
   698 
   698 
   699     frames add:frame.
   699     frames add:frame.
   716     view delegate:self.
   716     view delegate:self.
   717     view menuHolder:self; menuMessage:#viewMenu; menuPerformer:self.
   717     view menuHolder:self; menuMessage:#viewMenu; menuPerformer:self.
   718 
   718 
   719 ! !
   719 ! !
   720 
   720 
   721 !InspectorPanelView methodsFor:'scrolling-basic'!
   721 !NewInspectorPanelView methodsFor:'scrolling-basic'!
   722 
   722 
   723 moveContentsLeft:nTimes
   723 moveContentsLeft:nTimes
   724     "move the contents of all views one position left
   724     "move the contents of all views one position left
   725     "
   725     "
   726     |fView stop pView index|
   726     |fView stop pView index|
   806     ].
   806     ].
   807     no < 0 ifTrue:[self moveContentsLeft:(no negated)]
   807     no < 0 ifTrue:[self moveContentsLeft:(no negated)]
   808           ifFalse:[self moveContentsRight:no]
   808           ifFalse:[self moveContentsRight:no]
   809 ! !
   809 ! !
   810 
   810 
   811 !InspectorPanelView class methodsFor:'documentation'!
   811 !NewInspectorPanelView class methodsFor:'documentation'!
   812 
   812 
   813 version
   813 version
   814     ^ '$Header$'
   814     ^ '$Header$'
   815 ! !
   815 ! !