added:
authorClaus Gittinger <cg@exept.de>
Wed, 10 Feb 2010 23:10:55 +0100
changeset 27620c66aa3bfdff
parent 2761 6cf2b054258c
child 2763 c36ead4db5bc
added:
#doPickView
#selectView:
changed:
#menu
#openInPickMode
#selectFocusView
#toolbarMenu

when clicking, select the clicked view;
always show a view's name.
Tools__ViewTreeApplication.st
     1.1 --- a/Tools__ViewTreeApplication.st	Fri Feb 05 00:03:17 2010 +0100
     1.2 +++ b/Tools__ViewTreeApplication.st	Wed Feb 10 23:10:55 2010 +0100
     1.3 @@ -324,7 +324,7 @@
     1.4                (
     1.5                 (MenuItem
     1.6                    label: 'Pick a View'
     1.7 -                  itemValue: doPickViews
     1.8 +                  itemValue: doPickView
     1.9                    translateLabel: true
    1.10                  )
    1.11                 (MenuItem
    1.12 @@ -670,7 +670,7 @@
    1.13          (
    1.14           (MenuItem
    1.15              label: 'Pick a View'
    1.16 -            itemValue: doPickViews
    1.17 +            itemValue: doPickView
    1.18              translateLabel: false
    1.19              isButton: true
    1.20              hideMenuOnActivated: false
    1.21 @@ -720,7 +720,7 @@
    1.22  
    1.23      app := self new.
    1.24      app open.
    1.25 -    app doPickViews.
    1.26 +    app doPickView.
    1.27  ! !
    1.28  
    1.29  !ViewTreeInspectorApplication methodsFor:'actions'!
    1.30 @@ -1441,7 +1441,7 @@
    1.31  !ViewTreeInspectorApplication methodsFor:'private'!
    1.32  
    1.33  selectFocusView
    1.34 -    |rootView focusItem focusView|
    1.35 +    |rootView focusView|
    1.36  
    1.37      rootView := model rootView.
    1.38  
    1.39 @@ -1450,15 +1450,21 @@
    1.40      ].
    1.41      focusView isNil ifTrue:[^ self ].
    1.42  
    1.43 -    focusItem := model selectedItem.
    1.44 -
    1.45 -    (focusItem notNil and:[focusItem widget == focusView]) ifTrue:[
    1.46 +    self selectView:focusView
    1.47 +!
    1.48 +
    1.49 +selectView:aView
    1.50 +    |currentItem viewItem|
    1.51 +
    1.52 +    currentItem := model selectedItem.
    1.53 +
    1.54 +    (currentItem notNil and:[currentItem widget == aView]) ifTrue:[
    1.55          ^ self
    1.56      ].
    1.57 -    focusItem := model listOfItems recursiveDetect:[:el| el widget == focusView ].
    1.58 -
    1.59 -    focusItem notNil ifTrue:[
    1.60 -        model selectItem:focusItem.
    1.61 +    viewItem := model listOfItems recursiveDetect:[:el| el widget == aView ].
    1.62 +
    1.63 +    viewItem notNil ifTrue:[
    1.64 +        model selectItem:viewItem.
    1.65      ].        
    1.66  !
    1.67  
    1.68 @@ -1668,27 +1674,28 @@
    1.69      inst notNil ifTrue:[ inst inspect ].
    1.70  !
    1.71  
    1.72 -doPickViews
    1.73 +doPickView
    1.74      "pick a window's topView"
    1.75  
    1.76 -    |screen window cursor|
    1.77 +    |screen clickedView topWindow cursor|
    1.78  
    1.79      self doUnpick.
    1.80  
    1.81      cursor := Cursor fromImage:(self class crossHairIcon).
    1.82  
    1.83      screen := Screen current.
    1.84 -    window := screen viewFromPoint:(screen pointFromUserShowing:cursor).
    1.85 -    window isNil ifTrue:[^ self].
    1.86 -
    1.87 -    window := window topView.
    1.88 -
    1.89 -    (    window == Screen current rootView
    1.90 -     or:[window == self window topView]
    1.91 +    clickedView := screen viewFromPoint:(screen pointFromUserShowing:cursor).
    1.92 +    clickedView isNil ifTrue:[^ self].
    1.93 +
    1.94 +    topWindow := clickedView topView.
    1.95 +
    1.96 +    (    topWindow == Screen current rootView
    1.97 +     or:[topWindow == self window topView]
    1.98      ) ifTrue:[
    1.99          ^ self
   1.100      ].
   1.101 -    self setRootItem:(ViewTreeItem buildViewsFrom:window).
   1.102 +    self setRootItem:(ViewTreeItem buildViewsFrom:topWindow).
   1.103 +    self selectView:clickedView.
   1.104  !
   1.105  
   1.106  doSelectNextOfApplicationClass:aClass startingIn:anItem
   1.107 @@ -2118,7 +2125,8 @@
   1.108          isValidAndShown := widget shown.
   1.109      ].
   1.110      isValidAndShown ifFalse:[
   1.111 -        label := Text string:label emphasis:#italic
   1.112 +        label := Text string:label emphasis:#italic.
   1.113 +        label colorizeAllWith:Color grey.
   1.114      ].
   1.115  
   1.116      labelHeight := self heightOn:aGC.
   1.117 @@ -3880,27 +3888,28 @@
   1.118  additionalLabelForItem:anItem
   1.119      "answer the additional lable for an item or nil"
   1.120  
   1.121 -    |applClass|
   1.122 -
   1.123 +    |l applClass applClassName|
   1.124 +
   1.125 +    l := nil.
   1.126      showWidgetNames == true ifTrue:[
   1.127 -        ^ '[', anItem widget name, ']'
   1.128 +        l := '"', anItem widget name, '"'
   1.129      ].
   1.130  
   1.131      anItem isApplicationClass ifTrue:[
   1.132          applClass := anItem applicationClass.
   1.133 -
   1.134 -        applClass notNil ifTrue:[
   1.135 -            ^ ('[', applClass name, ']')
   1.136 +        applClass notNil ifTrue:[   
   1.137 +            applClassName := '[', applClass name allBold, ']'.
   1.138 +            l := (l isNil ifTrue:[''] ifFalse:[l , ' ']) , applClassName
   1.139          ].
   1.140      ].
   1.141 -    ^ nil
   1.142 +    ^ l
   1.143  !
   1.144  
   1.145  showWidgetNames
   1.146      "answer true if the additional text is the widget name
   1.147       otherwise the name of the application"
   1.148  
   1.149 -    ^ showWidgetNames ? false
   1.150 +    ^ showWidgetNames ? true
   1.151  !
   1.152  
   1.153  showWidgetNames:aBoolean
   1.154 @@ -3932,7 +3941,8 @@
   1.155      "
   1.156      treeModel := aModel.
   1.157      showRoot  := true.
   1.158 -    showWidgetNames := false.
   1.159 +    "/ showWidgetNames := false.
   1.160 +    showWidgetNames := true.
   1.161  ! !
   1.162  
   1.163  !ViewTreeInspectorApplication::ViewTreeModel::ItemList methodsFor:'searching'!