Tools__ViewTreeApplication.st
changeset 2978 a952dfdb1b6a
parent 2888 9adfb8a84696
child 3000 7b530cc76688
--- a/Tools__ViewTreeApplication.st	Wed Mar 13 18:35:46 2013 +0100
+++ b/Tools__ViewTreeApplication.st	Thu Mar 14 14:21:20 2013 +0100
@@ -40,7 +40,7 @@
 	instanceVariableNames:'lockSema selectedSuperItems selection hiddenLevel listOfItems
 		inputEventAction mappedViewAction beforeSelectionChangedAction
 		icons timedUpdateTask selectOnClickHolder testModeChannel
-		hasTargetWidgetChannel'
+		hasTargetWidgetChannel catchEvents'
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:ViewTreeInspectorApplication
@@ -322,9 +322,10 @@
     "Do not manually edit this!! If it is corrupted,
      the MenuEditor may not be able to read the specification."
 
+
     "
-     MenuEditor new openOnClass:Tools::ViewTreeApplication andSelector:#menu
-     (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeApplication menu)) startUp
+     MenuEditor new openOnClass:Tools::ViewTreeInspectorApplication andSelector:#menu
+     (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeInspectorApplication menu)) startUp
     "
 
     <resource: #menu>
@@ -334,40 +335,34 @@
         (
          (MenuItem
             label: 'File'
-            translateLabel: true
             submenu: 
            (Menu
               (
                (MenuItem
                   label: 'Pick a View'
                   itemValue: doPickView
-                  translateLabel: true
                 )
                (MenuItem
                   enabled: hasTargetWidgetChannel
                   label: 'Release Picked View'
                   itemValue: doUnpick
-                  translateLabel: true
                 )
                (MenuItem
                   label: '-'
                 )
                (MenuItem
                   label: 'Settings'
-                  translateLabel: true
                   submenu: 
                  (Menu
                     (
                      (MenuItem
                         label: 'Test Mode'
-                        translateLabel: true
                         hideMenuOnActivated: false
                         indication: testModeChannel
                       )
                      (MenuItem
                         enabled: testModeChannel
                         label: 'Follow Focus'
-                        translateLabel: true
                         hideMenuOnActivated: false
                         indication: followFocusChannel
                       )
@@ -376,7 +371,6 @@
                       )
                      (MenuItem
                         label: 'Select on Click'
-                        translateLabel: true
                         hideMenuOnActivated: false
                         indication: selectOnClickHolder
                       )
@@ -385,7 +379,6 @@
                       )
                      (MenuItem
                         label: 'Show Name of Widgets'
-                        translateLabel: true
                         hideMenuOnActivated: false
                         indication: showNamesHolder
                       )
@@ -400,7 +393,6 @@
                (MenuItem
                   label: 'Exit'
                   itemValue: closeRequest
-                  translateLabel: true
                 )
                )
               nil
@@ -410,27 +402,30 @@
          (MenuItem
             enabled: hasSingleSelectionHolder
             label: 'Selection'
-            translateLabel: true
             submenuChannel: middleButtonMenu
           )
          (MenuItem
             label: 'Application'
-            translateLabel: true
             submenu: 
            (Menu
               (
                (MenuItem
+                  label: 'Redraw'
+                  itemValue: doRedraw
+                )
+               (MenuItem
+                  label: '-'
+                )
+               (MenuItem
                   enabled: hasSingleSelectionHolder
                   label: 'Browse'
                   itemValue: doBrowse:
-                  translateLabel: true
                   argument: application
                 )
                (MenuItem
                   enabled: hasSingleSelectionHolder
                   label: 'Inspect'
                   itemValue: doInspect:
-                  translateLabel: true
                   argument: application
                 )
                (MenuItem
@@ -439,7 +434,6 @@
                (MenuItem
                   enabled: hasTargetWidgetChannel
                   label: 'All Applications'
-                  translateLabel: true
                   submenuChannel: submenuApplications:
                 )
                )
@@ -449,7 +443,6 @@
           )
          (MenuItem
             label: 'Widget'
-            translateLabel: true
             submenu: 
            (Menu
               (
@@ -457,14 +450,12 @@
                   enabled: hasSingleSelectionHolder
                   label: 'Browse'
                   itemValue: doBrowse:
-                  translateLabel: true
                   argument: view
                 )
                (MenuItem
                   enabled: hasSingleSelectionHolder
                   label: 'Inspect'
                   itemValue: doInspect:
-                  translateLabel: true
                   argument: view
                 )
                (MenuItem
@@ -473,7 +464,6 @@
                (MenuItem
                   enabled: hasTargetWidgetChannel
                   label: 'All Components'
-                  translateLabel: true
                   startGroup: right
                   submenuChannel: submenuComponents:
                 )
@@ -484,7 +474,6 @@
           )
          (MenuItem
             label: 'Help'
-            translateLabel: true
             startGroup: conditionalRight
             submenu: 
            (Menu
@@ -492,7 +481,6 @@
                (MenuItem
                   label: 'Documentation'
                   itemValue: openDocumentation
-                  translateLabel: true
                 )
                (MenuItem
                   label: '-'
@@ -500,7 +488,6 @@
                (MenuItem
                   label: 'About this Application...'
                   itemValue: openAboutThisApplication
-                  translateLabel: true
                 )
                )
               nil
@@ -511,8 +498,6 @@
         nil
         nil
       )
-
-    "Modified: / 27-04-2012 / 14:13:17 / cg"
 !
 
 middleButtonMenu
@@ -676,6 +661,7 @@
     "Do not manually edit this!! If it is corrupted,
      the MenuEditor may not be able to read the specification."
 
+
     "
      MenuEditor new openOnClass:Tools::ViewTreeInspectorApplication andSelector:#toolbarMenu
      (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeInspectorApplication toolbarMenu)) startUp
@@ -687,7 +673,17 @@
      #(Menu
         (
          (MenuItem
-            label: 'Pick a View'
+            enabled: hasTargetWidgetChannel
+            label: 'Redraw'
+            itemValue: doRedraw
+            isButton: true
+            labelImage: (ResourceRetriever ToolbarIconLibrary reloadIcon)
+          )
+         (MenuItem
+            label: '-'
+          )
+         (MenuItem
+            label: 'Pick a View and Catch Events'
             itemValue: doPickView
             translateLabel: false
             isButton: true
@@ -696,10 +692,9 @@
           )
          (MenuItem
             enabled: hasTargetWidgetChannel
-            label: 'Release Picked View'
+            label: 'Release Picked View and Uncatch Events'
+            itemValue: doUncatchEvents
             isButton: true
-            itemValue: doUnpick
-            translateLabel: true
             labelImage: (ResourceRetriever ToolbarIconLibrary undoIcon)
           )
          (MenuItem
@@ -1756,10 +1751,18 @@
     ) ifTrue:[
         ^ self
     ].
+
+    model catchEvents:true.
     self setRootItem:(ViewTreeItem buildViewsFrom:topWindow).
     self selectView:clickedView.
 !
 
+doRedraw
+    "redraw the app"
+
+    model rootView withAllSubViewsDo:[:v | v redraw; invalidate].
+!
+
 doSelectNextOfApplicationClass:aClass startingIn:anItem
     |startItem firstFound searchNext|
 
@@ -1812,6 +1815,11 @@
     ].
 !
 
+doUncatchEvents
+    model catchEvents:false.
+    self doRedraw
+!
+
 doUnpick
     "release current picked window and contained subwindows"
 
@@ -2830,6 +2838,13 @@
     listOfItems application:anApplication.
 !
 
+catchEvents:aBoolean
+    catchEvents := aBoolean.
+    aBoolean ifFalse:[
+        self redrawUnselected:selection andLock:false checkTestMode:false.
+    ].
+!
+
 rootItem
     "get the rootItem the event viewer is established on
     "
@@ -3065,6 +3080,8 @@
 
     |evView item rootView testMode|
 
+    catchEvents ifFalse:[^ false].
+
     evView := anEvent view.
     evView isNil ifTrue:[
         (anEvent isMessageSendEvent not or:[anEvent receiver ~~ self]) ifTrue:[
@@ -3155,6 +3172,7 @@
     listOfItems           := ItemList new on:self.
     selectedSuperItems    := #().
     icons                 := IdentityDictionary new.
+    catchEvents           := true.
 
     hasTargetWidgetChannel := false asValue.
     selectOnClickHolder    := true asValue.
@@ -4049,5 +4067,6 @@
     ^ '$Header$'
 ! !
 
+
 ViewTreeInspectorApplication initialize!
 ViewTreeInspectorApplication::ViewTreeItem initialize!