Tools__ViewTreeApplication.st
changeset 3124 1973e28a2c75
parent 3123 5bdc0a26498c
child 3141 c3fb91a71410
     1.1 --- a/Tools__ViewTreeApplication.st	Thu May 29 11:50:18 2014 +0200
     1.2 +++ b/Tools__ViewTreeApplication.st	Thu Jun 05 17:21:18 2014 +0200
     1.3 @@ -16,7 +16,8 @@
     1.4  ToolApplicationModel subclass:#ViewTreeInspectorApplication
     1.5  	instanceVariableNames:'model treeView hasSingleSelectionHolder clickedItem clickedPoint
     1.6  		motionAction process followFocusChannel showNamesHolder
     1.7 -		inspectorView inspectorModeIndexHolder path'
     1.8 +		inspectorView inspectorModeIndexHolder path
     1.9 +		isCatchingEventsChannel'
    1.10  	classVariableNames:''
    1.11  	poolDictionaries:''
    1.12  	category:'Interface-Smalltalk'
    1.13 @@ -169,10 +170,10 @@
    1.14      ^super flyByHelpSpec addPairsFrom:#(
    1.15  
    1.16  #doUncatchEvents
    1.17 -'Release Picked View and Uncatch Events (Currently Locked)'  
    1.18 +'Release picked view and uncatch events\(currently locked for widget selection)'  
    1.19  
    1.20  #doCatchEvents
    1.21 -'Release Picked View and Uncatch Events (Currently Unlocked)'  
    1.22 +'Lock view and catch events for widget selection\(currently unlocked)'  
    1.23  
    1.24  )
    1.25  ! !
    1.26 @@ -831,12 +832,23 @@
    1.27            )
    1.28           (MenuItem
    1.29              enabled: hasTargetWidgetChannel
    1.30 +            isVisible: isNotCatchingEventsChannel
    1.31 +            label: 'Catch Events of Picked View'
    1.32 +            activeHelpKey: doCatchEvents
    1.33 +            itemValue: doCatchEvents
    1.34 +            nameKey: doCatchEvents
    1.35 +            isButton: true
    1.36 +            labelImage: (ResourceRetriever nil releaseViewIcon)
    1.37 +          )
    1.38 +         (MenuItem
    1.39 +            enabled: hasTargetWidgetChannel
    1.40 +            isVisible: isCatchingEventsChannel
    1.41              label: 'Release Picked View and Uncatch Events'
    1.42              activeHelpKey: doUncatchEvents
    1.43              itemValue: doUncatchEvents
    1.44              nameKey: doUncatchEvents
    1.45              isButton: true
    1.46 -            labelImage: (ResourceRetriever nil releaseViewIcon)
    1.47 +            labelImage: (ResourceRetriever nil lockViewIcon)
    1.48            )
    1.49           (MenuItem
    1.50              label: '-'
    1.51 @@ -875,6 +887,17 @@
    1.52      app := self new.
    1.53      app open.
    1.54      app doPickView.
    1.55 +    ^ app
    1.56 +!
    1.57 +
    1.58 +openInPickModeAndRelease
    1.59 +    "release the pick-lock after picking"
    1.60 +
    1.61 +    |app|
    1.62 +
    1.63 +    app := self openInPickMode.
    1.64 +    app doUncatchEvents.
    1.65 +    ^ app
    1.66  !
    1.67  
    1.68  openOn:aView
    1.69 @@ -886,6 +909,7 @@
    1.70      app := self new.
    1.71      app open.
    1.72      app showWindow:aView.
    1.73 +    ^ app
    1.74  ! !
    1.75  
    1.76  !ViewTreeInspectorApplication methodsFor:'actions'!
    1.77 @@ -965,6 +989,14 @@
    1.78      "Created: / 30-07-2013 / 09:42:16 / cg"
    1.79  !
    1.80  
    1.81 +isCatchingEventsChannel
    1.82 +    ^ isCatchingEventsChannel
    1.83 +!
    1.84 +
    1.85 +isNotCatchingEventsChannel
    1.86 +    ^ BlockValue forLogicalNot:self isCatchingEventsChannel
    1.87 +!
    1.88 +
    1.89  listOfItems
    1.90      "returns the hierarchical list of items"
    1.91  
    1.92 @@ -1317,6 +1349,7 @@
    1.93  
    1.94      hasSingleSelectionHolder := false asValue.
    1.95      followFocusChannel       := false asValue.
    1.96 +    isCatchingEventsChannel  := false asValue.
    1.97      inspectorModeIndexHolder := 1 asValue.
    1.98      inspectorModeIndexHolder onChangeSend:#inspectorModeIndexHolderChanged to:self.
    1.99  
   1.100 @@ -1916,6 +1949,15 @@
   1.101      "Modified: / 28-08-2013 / 23:57:42 / cg"
   1.102  !
   1.103  
   1.104 +doCatchEvents
   1.105 +    model catchEvents:true.
   1.106 +    isCatchingEventsChannel value:true.
   1.107 +"/    ((builder componentAt:'toolbarMenu') itemAt:#doUncatchEvents) 
   1.108 +"/        enabled:true;
   1.109 +"/        label:(self class releaseViewIcon);
   1.110 +"/        activeHelpKey:#doUncatchEvents.
   1.111 +!
   1.112 +
   1.113  doDestroy
   1.114      "destroy the current selected view"
   1.115  
   1.116 @@ -2026,7 +2068,9 @@
   1.117  doRedraw
   1.118      "redraw the app"
   1.119  
   1.120 -    model rootView withAllSubViewsDo:[:v | v "redraw; "invalidate].
   1.121 +    model rootView notNil ifTrue:[
   1.122 +        model rootView withAllSubViewsDo:[:v | v "redraw; "invalidate].
   1.123 +    ]
   1.124  !
   1.125  
   1.126  doSelectNextOfApplicationClass:aClass startingIn:anItem
   1.127 @@ -2082,11 +2126,14 @@
   1.128  !
   1.129  
   1.130  doUncatchEvents
   1.131 +    "release the inspected window (no longer catch its events)"
   1.132 +
   1.133      model catchEvents:false.
   1.134 -    ((builder componentAt:'toolbarMenu') itemAt:#doUncatchEvents) 
   1.135 -        label:(self class releaseViewIcon);
   1.136 -        enabled:false;
   1.137 -        activeHelpKey:#doCatchEvents.
   1.138 +    isCatchingEventsChannel value:false.
   1.139 +"/    ((builder componentAt:'toolbarMenu') itemAt:#doUncatchEvents) 
   1.140 +"/        label:(self class releaseViewIcon);
   1.141 +"/        enabled:false;
   1.142 +"/        activeHelpKey:#doCatchEvents.
   1.143      self doRedraw
   1.144  !
   1.145  
   1.146 @@ -2108,11 +2155,7 @@
   1.147  
   1.148      topWindow := aView topView.
   1.149  
   1.150 -    model catchEvents:true.
   1.151 -    ((builder componentAt:'toolbarMenu') itemAt:#doUncatchEvents) 
   1.152 -        enabled:true;
   1.153 -        label:(self class releaseViewIcon);
   1.154 -        activeHelpKey:#doUncatchEvents.
   1.155 +    self doCatchEvents.
   1.156      self setRootItem:(ViewTreeItem buildViewsFrom:topWindow).
   1.157      self selectView:aView.
   1.158  ! !