Tools__ViewTreeApplication.st
changeset 2978 a952dfdb1b6a
parent 2888 9adfb8a84696
child 3000 7b530cc76688
     1.1 --- a/Tools__ViewTreeApplication.st	Wed Mar 13 18:35:46 2013 +0100
     1.2 +++ b/Tools__ViewTreeApplication.st	Thu Mar 14 14:21:20 2013 +0100
     1.3 @@ -40,7 +40,7 @@
     1.4  	instanceVariableNames:'lockSema selectedSuperItems selection hiddenLevel listOfItems
     1.5  		inputEventAction mappedViewAction beforeSelectionChangedAction
     1.6  		icons timedUpdateTask selectOnClickHolder testModeChannel
     1.7 -		hasTargetWidgetChannel'
     1.8 +		hasTargetWidgetChannel catchEvents'
     1.9  	classVariableNames:''
    1.10  	poolDictionaries:''
    1.11  	privateIn:ViewTreeInspectorApplication
    1.12 @@ -322,9 +322,10 @@
    1.13      "Do not manually edit this!! If it is corrupted,
    1.14       the MenuEditor may not be able to read the specification."
    1.15  
    1.16 +
    1.17      "
    1.18 -     MenuEditor new openOnClass:Tools::ViewTreeApplication andSelector:#menu
    1.19 -     (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeApplication menu)) startUp
    1.20 +     MenuEditor new openOnClass:Tools::ViewTreeInspectorApplication andSelector:#menu
    1.21 +     (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeInspectorApplication menu)) startUp
    1.22      "
    1.23  
    1.24      <resource: #menu>
    1.25 @@ -334,40 +335,34 @@
    1.26          (
    1.27           (MenuItem
    1.28              label: 'File'
    1.29 -            translateLabel: true
    1.30              submenu: 
    1.31             (Menu
    1.32                (
    1.33                 (MenuItem
    1.34                    label: 'Pick a View'
    1.35                    itemValue: doPickView
    1.36 -                  translateLabel: true
    1.37                  )
    1.38                 (MenuItem
    1.39                    enabled: hasTargetWidgetChannel
    1.40                    label: 'Release Picked View'
    1.41                    itemValue: doUnpick
    1.42 -                  translateLabel: true
    1.43                  )
    1.44                 (MenuItem
    1.45                    label: '-'
    1.46                  )
    1.47                 (MenuItem
    1.48                    label: 'Settings'
    1.49 -                  translateLabel: true
    1.50                    submenu: 
    1.51                   (Menu
    1.52                      (
    1.53                       (MenuItem
    1.54                          label: 'Test Mode'
    1.55 -                        translateLabel: true
    1.56                          hideMenuOnActivated: false
    1.57                          indication: testModeChannel
    1.58                        )
    1.59                       (MenuItem
    1.60                          enabled: testModeChannel
    1.61                          label: 'Follow Focus'
    1.62 -                        translateLabel: true
    1.63                          hideMenuOnActivated: false
    1.64                          indication: followFocusChannel
    1.65                        )
    1.66 @@ -376,7 +371,6 @@
    1.67                        )
    1.68                       (MenuItem
    1.69                          label: 'Select on Click'
    1.70 -                        translateLabel: true
    1.71                          hideMenuOnActivated: false
    1.72                          indication: selectOnClickHolder
    1.73                        )
    1.74 @@ -385,7 +379,6 @@
    1.75                        )
    1.76                       (MenuItem
    1.77                          label: 'Show Name of Widgets'
    1.78 -                        translateLabel: true
    1.79                          hideMenuOnActivated: false
    1.80                          indication: showNamesHolder
    1.81                        )
    1.82 @@ -400,7 +393,6 @@
    1.83                 (MenuItem
    1.84                    label: 'Exit'
    1.85                    itemValue: closeRequest
    1.86 -                  translateLabel: true
    1.87                  )
    1.88                 )
    1.89                nil
    1.90 @@ -410,27 +402,30 @@
    1.91           (MenuItem
    1.92              enabled: hasSingleSelectionHolder
    1.93              label: 'Selection'
    1.94 -            translateLabel: true
    1.95              submenuChannel: middleButtonMenu
    1.96            )
    1.97           (MenuItem
    1.98              label: 'Application'
    1.99 -            translateLabel: true
   1.100              submenu: 
   1.101             (Menu
   1.102                (
   1.103                 (MenuItem
   1.104 +                  label: 'Redraw'
   1.105 +                  itemValue: doRedraw
   1.106 +                )
   1.107 +               (MenuItem
   1.108 +                  label: '-'
   1.109 +                )
   1.110 +               (MenuItem
   1.111                    enabled: hasSingleSelectionHolder
   1.112                    label: 'Browse'
   1.113                    itemValue: doBrowse:
   1.114 -                  translateLabel: true
   1.115                    argument: application
   1.116                  )
   1.117                 (MenuItem
   1.118                    enabled: hasSingleSelectionHolder
   1.119                    label: 'Inspect'
   1.120                    itemValue: doInspect:
   1.121 -                  translateLabel: true
   1.122                    argument: application
   1.123                  )
   1.124                 (MenuItem
   1.125 @@ -439,7 +434,6 @@
   1.126                 (MenuItem
   1.127                    enabled: hasTargetWidgetChannel
   1.128                    label: 'All Applications'
   1.129 -                  translateLabel: true
   1.130                    submenuChannel: submenuApplications:
   1.131                  )
   1.132                 )
   1.133 @@ -449,7 +443,6 @@
   1.134            )
   1.135           (MenuItem
   1.136              label: 'Widget'
   1.137 -            translateLabel: true
   1.138              submenu: 
   1.139             (Menu
   1.140                (
   1.141 @@ -457,14 +450,12 @@
   1.142                    enabled: hasSingleSelectionHolder
   1.143                    label: 'Browse'
   1.144                    itemValue: doBrowse:
   1.145 -                  translateLabel: true
   1.146                    argument: view
   1.147                  )
   1.148                 (MenuItem
   1.149                    enabled: hasSingleSelectionHolder
   1.150                    label: 'Inspect'
   1.151                    itemValue: doInspect:
   1.152 -                  translateLabel: true
   1.153                    argument: view
   1.154                  )
   1.155                 (MenuItem
   1.156 @@ -473,7 +464,6 @@
   1.157                 (MenuItem
   1.158                    enabled: hasTargetWidgetChannel
   1.159                    label: 'All Components'
   1.160 -                  translateLabel: true
   1.161                    startGroup: right
   1.162                    submenuChannel: submenuComponents:
   1.163                  )
   1.164 @@ -484,7 +474,6 @@
   1.165            )
   1.166           (MenuItem
   1.167              label: 'Help'
   1.168 -            translateLabel: true
   1.169              startGroup: conditionalRight
   1.170              submenu: 
   1.171             (Menu
   1.172 @@ -492,7 +481,6 @@
   1.173                 (MenuItem
   1.174                    label: 'Documentation'
   1.175                    itemValue: openDocumentation
   1.176 -                  translateLabel: true
   1.177                  )
   1.178                 (MenuItem
   1.179                    label: '-'
   1.180 @@ -500,7 +488,6 @@
   1.181                 (MenuItem
   1.182                    label: 'About this Application...'
   1.183                    itemValue: openAboutThisApplication
   1.184 -                  translateLabel: true
   1.185                  )
   1.186                 )
   1.187                nil
   1.188 @@ -511,8 +498,6 @@
   1.189          nil
   1.190          nil
   1.191        )
   1.192 -
   1.193 -    "Modified: / 27-04-2012 / 14:13:17 / cg"
   1.194  !
   1.195  
   1.196  middleButtonMenu
   1.197 @@ -676,6 +661,7 @@
   1.198      "Do not manually edit this!! If it is corrupted,
   1.199       the MenuEditor may not be able to read the specification."
   1.200  
   1.201 +
   1.202      "
   1.203       MenuEditor new openOnClass:Tools::ViewTreeInspectorApplication andSelector:#toolbarMenu
   1.204       (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeInspectorApplication toolbarMenu)) startUp
   1.205 @@ -687,7 +673,17 @@
   1.206       #(Menu
   1.207          (
   1.208           (MenuItem
   1.209 -            label: 'Pick a View'
   1.210 +            enabled: hasTargetWidgetChannel
   1.211 +            label: 'Redraw'
   1.212 +            itemValue: doRedraw
   1.213 +            isButton: true
   1.214 +            labelImage: (ResourceRetriever ToolbarIconLibrary reloadIcon)
   1.215 +          )
   1.216 +         (MenuItem
   1.217 +            label: '-'
   1.218 +          )
   1.219 +         (MenuItem
   1.220 +            label: 'Pick a View and Catch Events'
   1.221              itemValue: doPickView
   1.222              translateLabel: false
   1.223              isButton: true
   1.224 @@ -696,10 +692,9 @@
   1.225            )
   1.226           (MenuItem
   1.227              enabled: hasTargetWidgetChannel
   1.228 -            label: 'Release Picked View'
   1.229 +            label: 'Release Picked View and Uncatch Events'
   1.230 +            itemValue: doUncatchEvents
   1.231              isButton: true
   1.232 -            itemValue: doUnpick
   1.233 -            translateLabel: true
   1.234              labelImage: (ResourceRetriever ToolbarIconLibrary undoIcon)
   1.235            )
   1.236           (MenuItem
   1.237 @@ -1756,10 +1751,18 @@
   1.238      ) ifTrue:[
   1.239          ^ self
   1.240      ].
   1.241 +
   1.242 +    model catchEvents:true.
   1.243      self setRootItem:(ViewTreeItem buildViewsFrom:topWindow).
   1.244      self selectView:clickedView.
   1.245  !
   1.246  
   1.247 +doRedraw
   1.248 +    "redraw the app"
   1.249 +
   1.250 +    model rootView withAllSubViewsDo:[:v | v redraw; invalidate].
   1.251 +!
   1.252 +
   1.253  doSelectNextOfApplicationClass:aClass startingIn:anItem
   1.254      |startItem firstFound searchNext|
   1.255  
   1.256 @@ -1812,6 +1815,11 @@
   1.257      ].
   1.258  !
   1.259  
   1.260 +doUncatchEvents
   1.261 +    model catchEvents:false.
   1.262 +    self doRedraw
   1.263 +!
   1.264 +
   1.265  doUnpick
   1.266      "release current picked window and contained subwindows"
   1.267  
   1.268 @@ -2830,6 +2838,13 @@
   1.269      listOfItems application:anApplication.
   1.270  !
   1.271  
   1.272 +catchEvents:aBoolean
   1.273 +    catchEvents := aBoolean.
   1.274 +    aBoolean ifFalse:[
   1.275 +        self redrawUnselected:selection andLock:false checkTestMode:false.
   1.276 +    ].
   1.277 +!
   1.278 +
   1.279  rootItem
   1.280      "get the rootItem the event viewer is established on
   1.281      "
   1.282 @@ -3065,6 +3080,8 @@
   1.283  
   1.284      |evView item rootView testMode|
   1.285  
   1.286 +    catchEvents ifFalse:[^ false].
   1.287 +
   1.288      evView := anEvent view.
   1.289      evView isNil ifTrue:[
   1.290          (anEvent isMessageSendEvent not or:[anEvent receiver ~~ self]) ifTrue:[
   1.291 @@ -3155,6 +3172,7 @@
   1.292      listOfItems           := ItemList new on:self.
   1.293      selectedSuperItems    := #().
   1.294      icons                 := IdentityDictionary new.
   1.295 +    catchEvents           := true.
   1.296  
   1.297      hasTargetWidgetChannel := false asValue.
   1.298      selectOnClickHolder    := true asValue.
   1.299 @@ -4049,5 +4067,6 @@
   1.300      ^ '$Header$'
   1.301  ! !
   1.302  
   1.303 +
   1.304  ViewTreeInspectorApplication initialize!
   1.305  ViewTreeInspectorApplication::ViewTreeItem initialize!