WindowGroup.st
changeset 3151 7a79503e33fd
parent 3130 d489adbd1fd2
child 3156 38b73e5c08aa
--- a/WindowGroup.st	Mon Jan 24 17:33:25 2000 +0100
+++ b/WindowGroup.st	Mon Jan 24 17:34:12 2000 +0100
@@ -576,15 +576,24 @@
 addView:aView
     "add aView to the windowGroup"
 
+    |sequence|
+
     views isNil ifTrue:[
-	views := OrderedCollection with:aView.
+        views := OrderedCollection with:aView.
     ] ifFalse:[
-	(views includesIdentical:aView) ifFalse:[
-	    views add:aView
-	]
-    ]
+        (views includesIdentical:aView) ifFalse:[
+            views add:aView
+        ]
+    ].
 
-    "Modified: 6.3.1996 / 15:35:41 / cg"
+    aView canTab ifTrue:[
+        sequence := self focusSequence.
+
+        (sequence includesIdentical:aView) ifFalse:[
+            sequence add:aView
+        ]
+    ].
+
 !
 
 mainView
@@ -603,26 +612,28 @@
 
     |sema|
 
+    self focusSequence removeIdentical:aView ifAbsent:nil.
+
     views notNil ifTrue:[
-	views removeIdentical:aView ifAbsent:nil.
-	views isEmpty ifTrue:[
-	    views := nil
-	]
+        views removeIdentical:aView ifAbsent:nil.
+        views isEmpty ifTrue:[
+            views := nil
+        ]
     ].
     topViews notNil ifTrue:[
-	topViews removeIdentical:aView ifAbsent:nil.
-	topViews isEmpty ifTrue:[
-	    topViews := nil
-	]
+        topViews removeIdentical:aView ifAbsent:nil.
+        topViews isEmpty ifTrue:[
+            topViews := nil
+        ]
     ].
     "
      wakeup my process to look if last view has been
      removed (modalBoxes terminate their modalLoop if so)
     "
     mySensor notNil ifTrue:[
-	(sema := mySensor eventSemaphore) notNil ifTrue:[
-	    sema signal
-	]
+        (sema := mySensor eventSemaphore) notNil ifTrue:[
+            sema signal
+        ]
     ]
 
     "Modified: 1.2.1997 / 12:13:26 / cg"
@@ -1546,33 +1557,34 @@
 
     sequence := self focusSequence.
     (lastIndex := sequence size) == 0 ifTrue:[
-	^ self
+        ^ self
     ].
 
     focusView isNil ifTrue:[
-	index := 0
+        index := 0
     ] ifFalse:[
-	index := index0 := self indexOfFocusViewInFocusSequence.
+        index := index0 := self indexOfFocusViewInFocusSequence.
     ].
 
     [next isNil] whileTrue:[
-	index := index + 1.
-	index > lastIndex ifTrue:[
-	    index := 1.
-	    index0 isNil ifTrue:[^ self ].
-	].
-	index == index0 ifTrue:[
-	    ^ self
-	].
+        index := index + 1.
+        index > lastIndex ifTrue:[
+            index := 1.
+            index0 isNil ifTrue:[^ self ].
+        ].
+        index == index0 ifTrue:[
+            ^ self
+        ].
 
-	next := (sequence at:index).
-	next realized not ifTrue:[
-	    next := nil
-	] ifFalse:[
-	    next enabled ifFalse:[
-		next := nil
-	    ]
-	]
+        next := (sequence at:index).
+"/        next realized not ifTrue:[
+        next shown not ifTrue:[
+            next := nil
+        ] ifFalse:[
+            next enabled ifFalse:[
+                next := nil
+            ]
+        ]
     ].
 
     self focusView:next byTab:true
@@ -1613,31 +1625,32 @@
     (lastIndex := sequence size) == 0 ifTrue:[^ self].
 
     focusView isNil ifTrue:[
-	index := 0
+        index := 0
     ] ifFalse:[
-	index := self indexOfFocusViewInFocusSequence.
-	index0 := index.
+        index := self indexOfFocusViewInFocusSequence.
+        index0 := index.
     ].
     index == 0 ifTrue:[
-	index := lastIndex + 1.
+        index := lastIndex + 1.
     ].
 
     [prev isNil] whileTrue:[
-	index := index - 1.
-	index < 1 ifTrue:[
-	    index := lastIndex.
-	    index0 isNil ifTrue:[^ self].
-	].
-	index == index0 ifTrue:[^ self].
+        index := index - 1.
+        index < 1 ifTrue:[
+            index := lastIndex.
+            index0 isNil ifTrue:[^ self].
+        ].
+        index == index0 ifTrue:[^ self].
 
-	prev := (sequence at:index).
-	prev realized not ifTrue:[
-	    prev := nil
-	] ifFalse:[
-	    prev enabled ifFalse:[
-		prev := nil
-	    ]
-	].
+        prev := (sequence at:index).
+"/        prev realized not ifTrue:[
+        prev shown not ifTrue:[
+            prev := nil
+        ] ifFalse:[
+            prev enabled ifFalse:[
+                prev := nil
+            ]
+        ].
     ].
 
     self focusView:prev byTab:true
@@ -1695,19 +1708,18 @@
 
     |sequence|
 
-    "/ a fix focusSequence ...    
     focusSequence notNil ifTrue:[^ focusSequence].
-    topViews isNil ifTrue:[
-	"/ mhmh - a topView-less windowGroup ...
-	^ nil.
-    ].
 
-    topViews do:[:top |
-	sequence := top focusSequence.
-	sequence notNil ifTrue:[^ sequence].
+    topViews notNil ifTrue:[
+        topViews do:[:top |
+            (sequence := top focusSequence) notNil ifTrue:[
+                focusSequence := sequence asOrderedCollection.
+              ^ focusSequence
+            ]
+        ].
     ].
-
-    ^ nil
+    focusSequence := OrderedCollection new.
+  ^ focusSequence
 
     "Modified: / 31.10.1997 / 20:37:54 / cg"
 !
@@ -1717,9 +1729,18 @@
      Focus is stepped in the order in which subviews occur in
      the sequence."
 
-    focusSequence := aSequenceableCollection
+    aSequenceableCollection size ~~ 0 ifTrue:[
+        focusSequence isNil ifTrue:[
+            focusSequence := aSequenceableCollection asOrderedCollection.
+        ] ifFalse:[
+            aSequenceableCollection do:[:aView|
+                (focusSequence includesIdentical:aView) ifFalse:[
+                    focusSequence add:aView
+                ]
+            ]
+        ]
+    ].
 
-    "Modified: / 31.10.1997 / 20:40:04 / cg"
 !
 
 focusToView:aViewOrNil
@@ -2119,6 +2140,6 @@
 !WindowGroup class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.196 1999-12-29 12:05:25 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.197 2000-01-24 16:34:12 ca Exp $'
 ! !
 WindowGroup initialize!