class: Tools::ViewTreeInspectorApplication
authorClaus Gittinger <cg@exept.de>
Tue, 30 Jul 2013 09:45:42 +0200
changeset 3037876c28de42da
parent 3036 a685cbe8ae60
child 3038 52374621e04b
class: Tools::ViewTreeInspectorApplication
class definition
added:5 methods
changed:
#initialize
#selectionChanged
#windowSpec
Tools__ViewTreeApplication.st
     1.1 --- a/Tools__ViewTreeApplication.st	Tue Jul 30 07:59:42 2013 +0200
     1.2 +++ b/Tools__ViewTreeApplication.st	Tue Jul 30 09:45:42 2013 +0200
     1.3 @@ -16,7 +16,7 @@
     1.4  ToolApplicationModel subclass:#ViewTreeInspectorApplication
     1.5  	instanceVariableNames:'model treeView hasSingleSelectionHolder clickedItem clickedPoint
     1.6  		motionAction process followFocusChannel showNamesHolder
     1.7 -		inspectorView'
     1.8 +		inspectorView inspectorModeIndexHolder'
     1.9  	classVariableNames:''
    1.10  	poolDictionaries:''
    1.11  	category:'Interface-Smalltalk'
    1.12 @@ -280,64 +280,82 @@
    1.13      <resource: #canvas>
    1.14  
    1.15      ^ 
    1.16 -     #(FullSpec
    1.17 -        name: windowSpec
    1.18 -        window: 
    1.19 -       (WindowSpec
    1.20 -          label: 'View Tree Inspector'
    1.21 -          name: 'View Tree Inspector'
    1.22 -          min: (Point 10 10)
    1.23 -          max: (Point 1024 9999)
    1.24 -          bounds: (Rectangle 0 0 381 654)
    1.25 -          menu: menu
    1.26 -        )
    1.27 -        component: 
    1.28 -       (SpecCollection
    1.29 -          collection: (
    1.30 -           (MenuPanelSpec
    1.31 -              name: 'toolbarMenu'
    1.32 -              layout: (LayoutFrame 0 0.0 0 0 0 1.0 40 0)
    1.33 -              menu: toolbarMenu
    1.34 -              textDefault: true
    1.35 -            )
    1.36 -       (VariableVerticalPanelSpec
    1.37 -              name: 'VariableVerticalPanel1'
    1.38 -              layout: (LayoutFrame 0 0.0 40 0.0 0 1.0 0 1.0)
    1.39 -              component: 
    1.40 -             (SpecCollection
    1.41 -                collection: (
    1.42 -                 (HierarchicalListViewSpec
    1.43 -                    name: 'List'
    1.44 -                    level: 1
    1.45 -                    model: model
    1.46 -                    menu: middleButtonMenu
    1.47 -                    hasHorizontalScrollBar: true
    1.48 -                    hasVerticalScrollBar: true
    1.49 -                    miniScrollerHorizontal: true
    1.50 -                    miniScrollerVertical: false
    1.51 -                    listModel: listOfItems
    1.52 -                    multipleSelectOk: true
    1.53 -                    useIndex: false
    1.54 -                    highlightMode: label
    1.55 -                    showLeftIndicators: false
    1.56 -                    indicatorSelector: indicatorClicked:
    1.57 -                    useDefaultIcons: false
    1.58 -                    postBuildCallback: postBuildTree:
    1.59 -                  )
    1.60 -                 (ViewSpec
    1.61 -                    name: 'Box1'
    1.62 -                    viewClassName: 'InspectorView'
    1.63 -                    postBuildCallback: postBuildInspectorView:
    1.64 -                  )
    1.65 +    #(FullSpec
    1.66 +       name: windowSpec
    1.67 +       window: 
    1.68 +      (WindowSpec
    1.69 +         label: 'View Tree Inspector'
    1.70 +         name: 'View Tree Inspector'
    1.71 +         min: (Point 10 10)
    1.72 +         max: (Point 1024 9999)
    1.73 +         bounds: (Rectangle 0 0 381 654)
    1.74 +         menu: menu
    1.75 +       )
    1.76 +       component: 
    1.77 +      (SpecCollection
    1.78 +         collection: (
    1.79 +          (MenuPanelSpec
    1.80 +             name: 'toolbarMenu'
    1.81 +             layout: (LayoutFrame 0 0.0 0 0 0 1.0 40 0)
    1.82 +             menu: toolbarMenu
    1.83 +             textDefault: true
    1.84 +           )
    1.85 +          (VariableVerticalPanelSpec
    1.86 +             name: 'VariableVerticalPanel1'
    1.87 +             layout: (LayoutFrame 0 0.0 40 0.0 0 1.0 0 1.0)
    1.88 +             component: 
    1.89 +            (SpecCollection
    1.90 +               collection: (
    1.91 +                (HierarchicalListViewSpec
    1.92 +                   name: 'List'
    1.93 +                   level: 1
    1.94 +                   model: model
    1.95 +                   menu: middleButtonMenu
    1.96 +                   hasHorizontalScrollBar: true
    1.97 +                   hasVerticalScrollBar: true
    1.98 +                   miniScrollerHorizontal: true
    1.99 +                   miniScrollerVertical: false
   1.100 +                   listModel: listOfItems
   1.101 +                   multipleSelectOk: true
   1.102 +                   useIndex: false
   1.103 +                   highlightMode: label
   1.104 +                   showLeftIndicators: false
   1.105 +                   indicatorSelector: indicatorClicked:
   1.106 +                   useDefaultIcons: false
   1.107 +                   postBuildCallback: postBuildTree:
   1.108                   )
   1.109 -               
   1.110 -              )
   1.111 -              handles: (Any 0.5 1.0)
   1.112 -            )
   1.113 +                (ViewSpec
   1.114 +                   name: 'Box2'
   1.115 +                   component: 
   1.116 +                  (SpecCollection
   1.117 +                     collection: (
   1.118 +                      (ViewSpec
   1.119 +                         name: 'Inspector'
   1.120 +                         layout: (LayoutFrame 0 0 26 0 0 1 0 1)
   1.121 +                         postBuildCallback: postBuildInspectorView:
   1.122 +                         viewClassName: 'InspectorView'
   1.123 +                       )
   1.124 +                      (TabViewSpec
   1.125 +                         name: 'TabHeader1'
   1.126 +                         layout: (LayoutFrame 0 0.0 0 0 0 1.0 25 0)
   1.127 +                         model: inspectorModeIndexHolder
   1.128 +                         menu: inspectorModes
   1.129 +                         useIndex: true
   1.130 +                         translateLabel: true
   1.131 +                       )
   1.132 +                      )
   1.133 +                    
   1.134 +                   )
   1.135 +                 )
   1.136 +                )
   1.137 +              
   1.138 +             )
   1.139 +             handles: (Any 0.5 1.0)
   1.140             )
   1.141 -         
   1.142 -        )
   1.143 -      )
   1.144 +          )
   1.145 +        
   1.146 +       )
   1.147 +     )
   1.148  ! !
   1.149  
   1.150  !ViewTreeInspectorApplication class methodsFor:'menu specs'!
   1.151 @@ -835,6 +853,34 @@
   1.152      ^ model hasTargetWidgetChannel
   1.153  !
   1.154  
   1.155 +inspectorMode
   1.156 +    "what is shwn in the inspector:
   1.157 +     1->widget
   1.158 +     2->application"
   1.159 +
   1.160 +    ^ (inspectorModeIndexHolder value == 1) 
   1.161 +        ifTrue:[#widget]
   1.162 +        ifFalse:[#application]
   1.163 +
   1.164 +    "Created: / 30-07-2013 / 07:44:59 / cg"
   1.165 +!
   1.166 +
   1.167 +inspectorModeIndexHolder
   1.168 +    "what is shwn in the inspector:
   1.169 +     1->widget
   1.170 +     2->application"
   1.171 +
   1.172 +    ^ inspectorModeIndexHolder
   1.173 +
   1.174 +    "Created: / 30-07-2013 / 07:44:07 / cg"
   1.175 +!
   1.176 +
   1.177 +inspectorModes
   1.178 +    ^ #('Widget' 'Application')
   1.179 +
   1.180 +    "Created: / 30-07-2013 / 09:42:16 / cg"
   1.181 +!
   1.182 +
   1.183  listOfItems
   1.184      "returns the hierarchical list of items"
   1.185  
   1.186 @@ -872,6 +918,12 @@
   1.187  
   1.188  !ViewTreeInspectorApplication methodsFor:'change & update'!
   1.189  
   1.190 +inspectorModeIndexHolderChanged
   1.191 +    self updateInspector
   1.192 +
   1.193 +    "Created: / 30-07-2013 / 09:21:51 / cg"
   1.194 +!
   1.195 +
   1.196  selectionChanged
   1.197      |info view item|
   1.198  
   1.199 @@ -896,7 +948,9 @@
   1.200          info := ''
   1.201      ].
   1.202      hasSingleSelectionHolder value:(view notNil).
   1.203 -    inspectorView inspect:view.
   1.204 +    self updateInspector
   1.205 +
   1.206 +    "Modified: / 30-07-2013 / 09:21:27 / cg"
   1.207  !
   1.208  
   1.209  update:something with:someArgument from:aModel
   1.210 @@ -916,6 +970,21 @@
   1.211      ].
   1.212  
   1.213      super update:something with:someArgument from:aModel.
   1.214 +!
   1.215 +
   1.216 +updateInspector
   1.217 +    |view obj|
   1.218 +
   1.219 +    view := self selectedView.
   1.220 +    (view isNil or:[self inspectorMode == #widget]) ifTrue:[
   1.221 +        obj := view.
   1.222 +    ] ifFalse:[
   1.223 +        obj := view application.
   1.224 +    ].
   1.225 +    inspectorView inspect:obj.
   1.226 +    inspectorView headLineLabel:(obj class nameWithoutPrefix)
   1.227 +
   1.228 +    "Created: / 30-07-2013 / 09:21:16 / cg"
   1.229  ! !
   1.230  
   1.231  !ViewTreeInspectorApplication methodsFor:'event processing'!
   1.232 @@ -1144,6 +1213,8 @@
   1.233  
   1.234      hasSingleSelectionHolder := false asValue.
   1.235      followFocusChannel       := false asValue.
   1.236 +    inspectorModeIndexHolder := 1 asValue.
   1.237 +    inspectorModeIndexHolder onChangeSend:#inspectorModeIndexHolderChanged to:self.
   1.238  
   1.239      model := ViewTreeModel new.
   1.240      model inputEventAction:[:ev| self processEvent:ev ].
   1.241 @@ -1154,6 +1225,8 @@
   1.242  
   1.243      showNamesHolder := false asValue.
   1.244      showNamesHolder addDependent:self.
   1.245 +
   1.246 +    "Modified: / 30-07-2013 / 09:20:08 / cg"
   1.247  !
   1.248  
   1.249  postBuildInspectorView:anInspector