WindowGroup.st
changeset 500 a313e9fda9f0
parent 496 71ecf6bfdff2
child 507 5098d8e9be3c
--- a/WindowGroup.st	Wed Mar 06 14:54:46 1996 +0100
+++ b/WindowGroup.st	Wed Mar 06 16:00:02 1996 +0100
@@ -282,18 +282,26 @@
     "add a topview to the group"
 
     topViews isNil ifTrue:[
-	topViews := OrderedCollection new.
+        topViews := OrderedCollection new.
     ].
-    topViews add:aView
+    (topViews includesIdentical:aView) ifFalse:[
+        topViews add:aView
+    ]
+
+    "Modified: 6.3.1996 / 15:35:15 / cg"
 !
 
 addView:aView
     "add aView to the windowGroup"
 
     views isNil ifTrue:[
-	views := OrderedCollection new.
+        views := OrderedCollection new.
     ].
-    views add:aView
+    (views includesIdentical:aView) ifFalse:[
+        views add:aView
+    ]
+
+    "Modified: 6.3.1996 / 15:35:41 / cg"
 !
 
 device
@@ -760,7 +768,7 @@
     "process events from either the damage- or user input queues.
      Abort is assumed to be handled elsewhere."
 
-    <resource: #keyboard (#FocusNext #FocusPrevious #Escape )>
+    <resource: #keyboard (#FocusNext #FocusPrevious #Tab #Escape )>
 
     |event ignore key|
 
@@ -777,18 +785,18 @@
                     ignore := true.
                 ].
                 ignore ifFalse:[
-                    "/
-                    "/ FocusStepping is done right here
-                    "/
                     event isKeyPressEvent ifTrue:[
-                        (key := event key) == #FocusNext ifTrue:[
-                            self focusNext.
-                            ignore := true
-                        ].
-                        key == #FocusPrevious ifTrue:[
-                            self focusPrevious.
-                            ignore := true
-                        ].
+                        key := event key.
+
+"/                        key == #FocusNext ifTrue:[
+"/                            self focusNext.
+"/                            ignore := true
+"/                        ].
+"/                        key == #FocusPrevious ifTrue:[
+"/                            self focusPrevious.
+"/                            ignore := true
+"/                        ].
+
 "/                        key == #Tab ifTrue:[
 "/                            focusView notNil ifTrue:[
 "/                                focusView canTab ifTrue:[
@@ -844,7 +852,7 @@
         ].
     ]
 
-    "Modified: 4.3.1996 / 18:01:09 / cg"
+    "Modified: 6.3.1996 / 15:57:16 / cg"
 !
 
 processExposeEvents
@@ -903,28 +911,50 @@
 !
 
 waitForExposeFor:aView
-    "wait for a noExpose on aView, then process all exposes.
-     To be used after a scroll"
+    "wait for a noExpose event for aView, then process all exposes.
+     To be used after a scroll.
+     This is very Xspecific and not needed with other systems
+     (i.e. a synthetic noExpose may be generated there)."
 
     mySensor waitForExposeFor:aView.
     AbortSignal catch:[
-	self processExposeEvents
+        self processExposeEvents
     ]
+
+    "Modified: 6.3.1996 / 15:58:36 / cg"
 ! !
 
 !WindowGroup methodsFor:'focus control'!
 
 focusNext
-    "give focus to next view in focusSequence"
+    "give focus to the next view in the focusSequence"
+
+    |index last nextTop nextSequence|
 
-    |index|
+    focusSequence isNil ifTrue:[
+        focusSequence := topViews first focusSequence.
+    ].
 
-    focusSequence size == 0 ifTrue:[^ self].
+    (last := focusSequence size) == 0 ifTrue:[^ self].
     focusView notNil ifTrue:[
-	index := (focusSequence indexOf:focusView) + 1.
-	index > focusSequence size ifTrue:[index := 1].
+        index := (focusSequence indexOf:focusView) + 1.
+        index > last ifTrue:[
+            index := 1.
+            "/ another topView ?
+"/            topViews size > 1 ifTrue:[
+"/                index := topViews identityIndexOf:(focusView topView).
+"/                (index ~~ 0 and:[index < topViews size]) ifTrue:[
+"/                    nextTop := topViews at:index+1.
+"/                    nextSequence := nextTop focusSequence.
+"/                    nextSequence size ~~ 0 ifTrue:[
+"/                        nextTop raiseDeiconified.
+"/                        focusSequence := nextSequence.
+"/                    ]
+"/                ]
+"/            ]
+        ].
     ] ifFalse:[
-	index := 1.
+        index := 1.
     ].
     self focusView:(focusSequence at:index)
 
@@ -940,6 +970,8 @@
      (Delay forSeconds:10) wait.
      top windowGroup focusNext.
     "
+
+    "Modified: 6.3.1996 / 15:53:17 / cg"
 !
 
 focusPrevious
@@ -947,22 +979,29 @@
 
     |index|
 
+    focusSequence isNil ifTrue:[
+        focusSequence := topViews first focusSequence.
+    ].
     focusSequence size == 0 ifTrue:[^ self].
     focusView notNil ifTrue:[
-	index := (focusSequence indexOf:focusView) - 1.
-	index < 1 ifTrue:[index := focusSequence size].
+        index := (focusSequence indexOf:focusView) - 1.
+        index < 1 ifTrue:[index := focusSequence size].
     ] ifFalse:[
-	index := focusSequence size.
+        index := focusSequence size.
     ].
     self focusView:(focusSequence at:index)
+
+    "Modified: 6.3.1996 / 15:46:08 / cg"
 !
 
 focusSequence
-    "return the focus sequence for focusNext/focusPrevious.
+    "return my focus sequence for focusNext/focusPrevious.
      Focus is stepped in the order in which subviews occur in
      the sequence"
 
     ^ focusSequence
+
+    "Modified: 6.3.1996 / 15:46:35 / cg"
 !
 
 focusSequence:aSequenceableCollection
@@ -1208,6 +1247,6 @@
 !WindowGroup class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.68 1996-03-05 00:06:44 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.69 1996-03-06 15:00:02 cg Exp $'
 ! !
 WindowGroup initialize!