#UI_ENHANCEMENT by cg
authorClaus Gittinger <cg@exept.de>
Fri, 13 May 2016 01:59:52 +0200
changeset 3302413a225308d1
parent 3301 1663b107709f
child 3303 d3836d28d2c0
#UI_ENHANCEMENT by cg
class: Tools::ViewTreeInspectorApplication
class definition
added:
#browserVisibleHolder
#inspectorVisibleHolder
#postBuildBrowserCanvas:
#updateBrowser
comment/format in: #inspectorModeIndexHolder
changed:6 methods
Tools__ViewTreeApplication.st
     1.1 --- a/Tools__ViewTreeApplication.st	Thu May 12 21:34:25 2016 +0200
     1.2 +++ b/Tools__ViewTreeApplication.st	Fri May 13 01:59:52 2016 +0200
     1.3 @@ -17,7 +17,7 @@
     1.4  	instanceVariableNames:'model treeView hasSingleSelectionHolder clickedItem clickedPoint
     1.5  		motionAction process followFocusChannel showNamesHolder
     1.6  		inspectorView inspectorModeIndexHolder path
     1.7 -		isCatchingEventsChannel'
     1.8 +		isCatchingEventsChannel browser'
     1.9  	classVariableNames:''
    1.10  	poolDictionaries:''
    1.11  	category:'Interface-Smalltalk'
    1.12 @@ -353,9 +353,22 @@
    1.13                           useIndex: true
    1.14                           translateLabel: true
    1.15                         )
    1.16 +                      (SubCanvasSpec
    1.17 +                         name: 'Browser'
    1.18 +                         layout: (LayoutFrame 0 0 26 0 0 1 0 1)
    1.19 +                         visibilityChannel: browserVisibleHolder
    1.20 +                         hasHorizontalScrollBar: true
    1.21 +                         hasVerticalScrollBar: true
    1.22 +                         majorKey: #'Tools::NewSystemBrowser'
    1.23 +                         minorKey: singleClassWithoutVariableListBrowserSpec
    1.24 +                         createNewApplication: true
    1.25 +                         createNewBuilder: true
    1.26 +                         postBuildCallback: postBuildBrowserCanvas:
    1.27 +                       )
    1.28                        (ViewSpec
    1.29                           name: 'Inspector'
    1.30                           layout: (LayoutFrame 0 0 26 0 0 1 0 1)
    1.31 +                         visibilityChannel: inspectorVisibleHolder
    1.32                           postBuildCallback: postBuildInspectorView:
    1.33                           viewClassName: 'InspectorView'
    1.34                         )
    1.35 @@ -878,6 +891,22 @@
    1.36  
    1.37  !ViewTreeInspectorApplication methodsFor:'aspects'!
    1.38  
    1.39 +browserVisibleHolder
    1.40 +    "what is shown in the inspector:
    1.41 +     1->Widget
    1.42 +     2->Application
    1.43 +     3->WindowGroup
    1.44 +     4->Sensor
    1.45 +     5->Model 
    1.46 +     6->Widget Class 
    1.47 +     7->Application Class 
    1.48 +    "
    1.49 +
    1.50 +    ^ BlockValue
    1.51 +        with:[:v | self inspectorMode == #widgetClass or:[self inspectorMode == #applicationClass] ]
    1.52 +        argument:self inspectorModeIndexHolder
    1.53 +!
    1.54 +
    1.55  canBrowseWindowSpecMethod
    1.56      ^ self hasSingleSelectionHolder value and:[ self windowSpecMethodOfSelection notNil ]
    1.57  !
    1.58 @@ -911,14 +940,13 @@
    1.59       3->WindowGroup
    1.60       4->Sensor
    1.61       5->Model 
    1.62 +     6->Widget Class 
    1.63 +     7->Application Class 
    1.64      "
    1.65  
    1.66 -    (inspectorModeIndexHolder value == 1) ifTrue:[ ^#widget].
    1.67 -    (inspectorModeIndexHolder value == 2) ifTrue:[ ^#application].
    1.68 -    (inspectorModeIndexHolder value == 3) ifTrue:[ ^#group].
    1.69 -    (inspectorModeIndexHolder value == 4) ifTrue:[ ^#sensor].
    1.70 -    (inspectorModeIndexHolder value == 5) ifTrue:[ ^#model].
    1.71 -    ^ #application
    1.72 +    |mode|
    1.73 +    mode := inspectorModeIndexHolder value.
    1.74 +    ^ #( widget application group sensor model widgetClass applicationClass) at:mode ifAbsent:#widget
    1.75  
    1.76      "Created: / 30-07-2013 / 07:44:59 / cg"
    1.77  !
    1.78 @@ -930,6 +958,8 @@
    1.79       3->WindowGroup
    1.80       4->Sensor
    1.81       5->Model 
    1.82 +     6->Widget Class 
    1.83 +     7->Application Class 
    1.84      "
    1.85  
    1.86      ^ inspectorModeIndexHolder
    1.87 @@ -938,11 +968,28 @@
    1.88  !
    1.89  
    1.90  inspectorModes
    1.91 -    ^ #('Widget' 'Application' 'WindowGroup' 'Sensor' 'Model')
    1.92 +    "/ labels of tabs
    1.93 +    ^ #('Widget' 'Application' 'WindowGroup' 'Sensor' 'Model' 'Widget Class' 'App Class')
    1.94  
    1.95      "Created: / 30-07-2013 / 09:42:16 / cg"
    1.96  !
    1.97  
    1.98 +inspectorVisibleHolder
    1.99 +    "what is shown in the inspector:
   1.100 +     1->Widget
   1.101 +     2->Application
   1.102 +     3->WindowGroup
   1.103 +     4->Sensor
   1.104 +     5->Model 
   1.105 +     6->Widget Class 
   1.106 +     7->Application Class 
   1.107 +    "
   1.108 +
   1.109 +    ^ BlockValue
   1.110 +        with:[:v | v not ]
   1.111 +        argument:self browserVisibleHolder
   1.112 +!
   1.113 +
   1.114  isCatchingEventsChannel
   1.115      ^ isCatchingEventsChannel
   1.116  !
   1.117 @@ -1001,7 +1048,8 @@
   1.118  !
   1.119  
   1.120  windowSpecMethodOfSelection
   1.121 -    |item view app spec builder specSelector implementors|
   1.122 +    |item view app nonMeta meta masterApp
   1.123 +     spec builder specSelector implementors|
   1.124  
   1.125      item := model selectedItem.
   1.126      item isNil ifTrue:[^ nil]. 
   1.127 @@ -1011,7 +1059,7 @@
   1.128  
   1.129      app := view application.
   1.130      app isNil ifTrue:[^ nil]. 
   1.131 -
   1.132 +    
   1.133      builder := app builder.
   1.134      builder isNil ifTrue:[^ nil]. 
   1.135  
   1.136 @@ -1021,20 +1069,20 @@
   1.137      specSelector := spec name.
   1.138      specSelector isNil ifTrue:[^ nil].
   1.139  
   1.140 -    (app class theNonMetaclass canUnderstand:specSelector) ifTrue:[
   1.141 -        ^ app class theNonMetaclass lookupMethodFor:specSelector.
   1.142 +    ((nonMeta := app class theNonMetaclass) canUnderstand:specSelector) ifTrue:[
   1.143 +        ^ nonMeta lookupMethodFor:specSelector.
   1.144      ].
   1.145 -    (app class theMetaclass canUnderstand:specSelector) ifTrue:[
   1.146 -        ^ app class theMetaclass lookupMethodFor:specSelector.
   1.147 +    ((meta := app class theMetaclass) canUnderstand:specSelector) ifTrue:[
   1.148 +        ^ meta lookupMethodFor:specSelector.
   1.149      ].
   1.150  
   1.151      "/ maybe a simple dialog given a spec
   1.152 -    app masterApplication notNil ifTrue:[
   1.153 -        (app masterApplication class theNonMetaclass canUnderstand:specSelector) ifTrue:[     
   1.154 -            ^ app masterApplication class theNonMetaclass lookupMethodFor:specSelector.
   1.155 +    (masterApp := app masterApplication) notNil ifTrue:[
   1.156 +        ((nonMeta := masterApp class theNonMetaclass) canUnderstand:specSelector) ifTrue:[     
   1.157 +            ^ nonMeta lookupMethodFor:specSelector.
   1.158          ].
   1.159 -        (app masterApplication class theMetaclass canUnderstand:specSelector) ifTrue:[    
   1.160 -            ^ app masterApplication class theMetaclass lookupMethodFor:specSelector.
   1.161 +        ((meta := masterApp class theMetaclass) canUnderstand:specSelector) ifTrue:[    
   1.162 +            ^ meta lookupMethodFor:specSelector.
   1.163          ].
   1.164      ].
   1.165  
   1.166 @@ -1102,17 +1150,41 @@
   1.167      super update:something with:someArgument from:aModel.
   1.168  !
   1.169  
   1.170 +updateBrowser
   1.171 +    |cls widget|
   1.172 +
   1.173 +    widget := self selectedView.
   1.174 +    
   1.175 +    "/ update the browser
   1.176 +    self inspectorMode == #widgetClass ifTrue:[
   1.177 +        cls := widget class.
   1.178 +    ] ifFalse:[
   1.179 +        cls := widget application class
   1.180 +    ].    
   1.181 +    browser switchToClass:cls selector:nil.
   1.182 +!
   1.183 +
   1.184  updateInspector
   1.185 -    |view obj|
   1.186 +    |view mode obj|
   1.187  
   1.188      view := self selectedView.
   1.189 -    (view isNil or:[self inspectorMode == #widget]) ifTrue:[
   1.190 +    mode := self inspectorMode.
   1.191 +    
   1.192 +    ((mode == #widgetClass) or:[(mode == #applicationClass)]) ifTrue:[
   1.193 +        "/ update the browser
   1.194 +        view notNil ifTrue:[
   1.195 +            self updateBrowser.
   1.196 +        ].
   1.197 +        ^ self.
   1.198 +    ].
   1.199 +    
   1.200 +    (view isNil or:[mode == #widget]) ifTrue:[
   1.201          obj := view.
   1.202 -    ] ifFalse:[ (self inspectorMode == #group) ifTrue:[
   1.203 +    ] ifFalse:[ (mode == #group) ifTrue:[
   1.204          obj := view windowGroup
   1.205 -    ] ifFalse:[ (self inspectorMode == #sensor) ifTrue:[
   1.206 +    ] ifFalse:[ (mode == #sensor) ifTrue:[
   1.207          obj := view sensor
   1.208 -    ] ifFalse:[ (self inspectorMode == #model) ifTrue:[
   1.209 +    ] ifFalse:[ (mode == #model) ifTrue:[
   1.210          obj := view model
   1.211      ] ifFalse:[
   1.212          obj := view application.
   1.213 @@ -1366,6 +1438,13 @@
   1.214      "Modified: / 30-07-2013 / 09:20:08 / cg"
   1.215  !
   1.216  
   1.217 +postBuildBrowserCanvas:aSubCanvas
   1.218 +    browser := aSubCanvas application.
   1.219 +
   1.220 +    "/ browser navigationState meta onChangeEvaluate:(self updateBrowser).
   1.221 +    "/ self updateBrowser.
   1.222 +!
   1.223 +
   1.224  postBuildInspectorView:anInspector
   1.225      inspectorView := anInspector.
   1.226  !
   1.227 @@ -2143,30 +2222,28 @@
   1.228  
   1.229  objectToInspectOrBrowse:what
   1.230      "return one of:
   1.231 -        #view           inspect class
   1.232 +        #view           inspect view/widget
   1.233          #group          inspect windowGroup
   1.234          #model          inspect model
   1.235          #application    inspect application
   1.236          #controller     inspect controller
   1.237          #process        inspect application's process
   1.238 +        #widgetClass    browse widget's class
   1.239      "
   1.240 -    |view inst|
   1.241 +    |view|
   1.242  
   1.243      view := self selectedView.
   1.244      view isNil ifTrue:[^ nil].
   1.245  
   1.246 -             what == #group       ifTrue:[ inst := view windowGroup ]
   1.247 -    ifFalse:[what == #model       ifTrue:[ inst := view model ]
   1.248 -    ifFalse:[what == #application ifTrue:[ inst := view application ]
   1.249 -    ifFalse:[what == #controller  ifTrue:[ inst := view controller  ]
   1.250 -    ifFalse:[what == #process     ifTrue:[ inst := view windowGroup process  ]
   1.251 -    ifFalse:[what == #sensor      ifTrue:[ inst := view sensor  ]
   1.252 -    ifFalse:[inst := view  ]]]]]].
   1.253 -
   1.254 -    (inst isNil and:[what == #application]) ifTrue:[
   1.255 -        inst := view topView
   1.256 -    ].
   1.257 -    ^ inst
   1.258 +    what == #group       ifTrue:[ ^ view windowGroup ].
   1.259 +    what == #model       ifTrue:[ ^ view model ].
   1.260 +    what == #controller  ifTrue:[ ^ view controller ].
   1.261 +    what == #process     ifTrue:[ ^ view windowGroup process ].
   1.262 +    what == #sensor      ifTrue:[ ^ view sensor ].
   1.263 +    what == #application ifTrue:[ ^ view application ? view topView ].
   1.264 +    what == #applicationClass ifTrue:[ ^ view application ? view topView ].
   1.265 +
   1.266 +    ^ view
   1.267  
   1.268      "Modified: / 28-08-2013 / 23:58:27 / cg"
   1.269  !