focus handling
authorca
Wed, 07 Mar 2007 18:18:44 +0100
changeset 2159 7f02407f0bbf
parent 2158 20265a129645
child 2160 8f6a8896f10d
focus handling
UIPainter.st
--- a/UIPainter.st	Thu Mar 01 15:48:50 2007 +0100
+++ b/UIPainter.st	Wed Mar 07 18:18:44 2007 +0100
@@ -2442,47 +2442,17 @@
 noteBookView
     "returns the notebook view; initialize the tools embedded in the notebook"
 
-    |noteBook modifiedChannel applBuilder applWindow|
+    |noteBook|
 
     (noteBook := builder bindingAt:#noteBookView) isNil ifTrue:[
-        modifiedChannel := self modifiedChannel.
         noteBook := View new.
         builder aspectAt:#noteBookView put:noteBook.
 
-        layoutTool := UILayoutTool new.
-        layoutTool createBuilder.
-        applBuilder := layoutTool builder.
-        applWindow  := ApplicationSubView origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
-        applWindow level:0.
-        layoutTool masterApplication:self.
-        applBuilder window:applWindow.
-        applWindow client:layoutTool spec:#windowSpec builder:applBuilder.
-        applBuilder window:applWindow.
-        layoutTool modifiedHolder:modifiedChannel.
-
-        helpTool := UIHelpTool new.
-        applBuilder := helpTool builder.
-        applWindow  := ApplicationSubView origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
-        applWindow level:0.
+        layoutTool := self createToolApplication:UILayoutTool        spec:#windowSpec in:noteBook.
+        helpTool   := self createToolApplication:UIHelpTool          spec:#innerSpec  in:noteBook.
+        specTool   := self createToolApplication:UISpecificationTool spec:#windowSpec in:noteBook.
+
         helpTool loadFromClass:specClass.
-        helpTool masterApplication:self.
-        applBuilder window:applWindow.
-        applWindow client:helpTool spec:#innerSpec builder:applBuilder.
-        applBuilder window:applWindow.
-        helpTool modifiedHolder:modifiedChannel.
-
-        specTool := UISpecificationTool new.
-        specTool createBuilder.
-        applBuilder := specTool builder.
-        applWindow  := ApplicationSubView origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
-        specTool masterApplication:self.
-        applWindow level:0.
-
-        applBuilder window:applWindow.
-        applWindow client:specTool spec:#windowSpec builder:applBuilder.
-        applBuilder window:applWindow.
-
-        specTool modifiedHolder:modifiedChannel.
     ].
     ^ noteBook
 
@@ -3163,6 +3133,26 @@
     "Modified: 12.8.1997 / 23:39:10 / cg"
 !
 
+createToolApplication:anApplicationClass spec:aSpec in:aView
+    |appl applBuilder applWindow|
+
+    appl := anApplicationClass new.
+    appl createBuilder.
+    applBuilder := appl builder.
+
+    applWindow  := ApplicationSubView origin:0.0@0.0 corner:1.0@1.0 in:aView.
+    applWindow level:0.
+    applWindow hiddenOnRealize:true.
+
+    appl masterApplication:self.
+    applBuilder window:applWindow.
+    applWindow client:appl spec:aSpec builder:applBuilder.
+    appl modifiedHolder:(self modifiedChannel).
+    applBuilder window:applWindow.
+
+    ^ appl
+!
+
 hideUIView:aView
     "hides the view which is an application or top view"
 
@@ -3171,25 +3161,23 @@
 !
 
 raiseTabView
-
-    self isLayoutToolSelected ifTrue:[
-        helpTool   window unmap.
-        specTool   window unmap.
-        layoutTool window realize.
-    ] ifFalse:[
-        self isHelpToolSelected ifTrue:[
-            layoutTool window unmap.
-            specTool   window unmap.
-            helpTool   window realize.
-        ] ifFalse:[
-            specTool selection:tabSelection.
-            helpTool   window unmap.
-            layoutTool window unmap.
-            specTool   window realize.
-
-"/            specTool selection:tabSelection.
-        ]
-    ]
+    |tool|
+
+             self isLayoutToolSelected ifTrue:[tool := layoutTool ]
+    ifFalse:[self isHelpToolSelected   ifTrue:[tool := helpTool   ]
+    ifFalse:[
+        tool := specTool.
+        tool notNil ifTrue:[ specTool selection:tabSelection ].
+    ]].
+
+    (Array with:helpTool with:layoutTool with:specTool) do:[:aTool|
+        aTool ~~ tool ifTrue:[
+            aTool window beInvisible.
+        ].
+    ].
+    tool notNil ifTrue:[
+        tool window beVisible.
+    ].
 !
 
 raiseUIView:aView