--- a/SimpleView.st Tue Feb 26 13:18:52 2002 +0100
+++ b/SimpleView.st Tue Feb 26 13:58:22 2002 +0100
@@ -3351,7 +3351,7 @@
builder window:self.
[
anApplication buildSubCanvas:subSpec withBuilder:builder.
- ] valueNowOrOnUnwindDo:[
+ ] ensure:[
savedView notNil ifTrue:[
builder window:savedView.
].
@@ -3376,7 +3376,7 @@
"/ builder window:self.
"/ [
"/ anApplication buildSubCanvas:subSpec withBuilder:builder.
-"/ ] valueNowOrOnUnwindDo:[
+"/ ] ensure:[
"/ savedView notNil ifTrue:[
"/ builder window:savedView.
"/ ]
@@ -4059,50 +4059,50 @@
ok := true.
bitmaps := #('wheel1' 'wheel2' 'wheel3' 'wheel4')
- collect:[:name |
- |f|
-
- f := Smalltalk imageFromFileNamed:(name , '.xbm') forClass:self class.
- f isNil ifTrue:[
- ('SimpleView [warning]: no bitmap file: ' , name , '.xbm') errorPrintCR.
- ok := false
- ].
- f
- ].
+ collect:[:name |
+ |f|
+
+ f := Smalltalk imageFromFileNamed:(name , '.xbm') forClass:self class.
+ f isNil ifTrue:[
+ ('SimpleView [warning]: no bitmap file: ' , name , '.xbm') errorPrintCR.
+ ok := false
+ ].
+ f
+ ].
mask := Smalltalk imageFromFileNamed:'wheelm.xbm' forClass:self class.
mask isNil ifTrue:[
- ('SimpleView [warning]: no bitmap file: wheelm.xbm') errorPrintCR.
- ok := false
+ ('SimpleView [warning]: no bitmap file: wheelm.xbm') errorPrintCR.
+ ok := false
].
ok ifFalse:[
- self cursor:Cursor wait.
- aBlock valueNowOrOnUnwindDo:[
- self cursor:oldCursor
- ]
+ self cursor:Cursor wait.
+ aBlock ensure:[
+ self cursor:oldCursor
+ ]
] ifTrue:[
- cursors := bitmaps collect:[:form | (Cursor sourceForm:form
- maskForm:mask
- hotX:8
- hotY:8) onDevice:device].
-
- process := [
- Delay waitForSeconds:0.25.
- [true] whileTrue:[
- cursors do:[:curs |
- self cursor:curs.
- Delay waitForSeconds:0.05
- ]
- ]
- ] fork.
-
- Processor activeProcess priority:7.
- aBlock valueNowOrOnUnwindDo:[
- Processor activeProcess priority:8.
- process terminate.
- self cursor:oldCursor
- ]
+ cursors := bitmaps collect:[:form | (Cursor sourceForm:form
+ maskForm:mask
+ hotX:8
+ hotY:8) onDevice:device].
+
+ process := [
+ Delay waitForSeconds:0.25.
+ [true] whileTrue:[
+ cursors do:[:curs |
+ self cursor:curs.
+ Delay waitForSeconds:0.05
+ ]
+ ]
+ ] fork.
+
+ Processor activeProcess priority:7.
+ aBlock ensure:[
+ Processor activeProcess priority:8.
+ process terminate.
+ self cursor:oldCursor
+ ]
].
"
@@ -4121,35 +4121,35 @@
wasBlocked := OperatingSystem blockInterrupts.
[
- |deps|
-
- deps := dependents.
- "/
- "/ store the very first dependent directly in
- "/ the dependents instVar
- "/
- (deps isNil and:[anObject isCollection not]) ifTrue:[
- dependents := anObject
- ] ifFalse:[
- "/
- "/ store more dependents in the dependents collection
- "/
- deps isCollection ifTrue:[
- deps add:anObject
- ] ifFalse:[
- deps == anObject ifFalse:[
- deps isNil ifTrue:[
- dependents := (IdentitySet with:anObject)
- ] ifFalse:[
- dependents := (IdentitySet with:deps with:anObject)
- ]
- ]
- ]
- ]
- ] valueNowOrOnUnwindDo:[
- wasBlocked ifFalse:[
- OperatingSystem unblockInterrupts
- ]
+ |deps|
+
+ deps := dependents.
+ "/
+ "/ store the very first dependent directly in
+ "/ the dependents instVar
+ "/
+ (deps isNil and:[anObject isCollection not]) ifTrue:[
+ dependents := anObject
+ ] ifFalse:[
+ "/
+ "/ store more dependents in the dependents collection
+ "/
+ deps isCollection ifTrue:[
+ deps add:anObject
+ ] ifFalse:[
+ deps == anObject ifFalse:[
+ deps isNil ifTrue:[
+ dependents := (IdentitySet with:anObject)
+ ] ifFalse:[
+ dependents := (IdentitySet with:deps with:anObject)
+ ]
+ ]
+ ]
+ ]
+ ] ensure:[
+ wasBlocked ifFalse:[
+ OperatingSystem unblockInterrupts
+ ]
]
"Modified: 8.1.1997 / 23:40:30 / cg"
@@ -4225,31 +4225,31 @@
wasBlocked := OperatingSystem blockInterrupts.
[
- |deps sz dep|
-
- deps := dependents.
- deps notNil ifTrue:[
- deps isCollection ifTrue:[
- deps remove:anObject ifAbsent:[].
- (sz := deps size) == 0 ifTrue:[
- dependents := nil
- ] ifFalse:[
- sz == 1 ifTrue:[
- (dep := deps first) isCollection ifFalse:[
- dependents := dep
- ]
- ]
- ]
- ] ifFalse:[
- deps == anObject ifTrue:[
- dependents := nil
- ]
- ]
- ]
- ] valueNowOrOnUnwindDo:[
- wasBlocked ifFalse:[
- OperatingSystem unblockInterrupts
- ]
+ |deps sz dep|
+
+ deps := dependents.
+ deps notNil ifTrue:[
+ deps isCollection ifTrue:[
+ deps remove:anObject ifAbsent:[].
+ (sz := deps size) == 0 ifTrue:[
+ dependents := nil
+ ] ifFalse:[
+ sz == 1 ifTrue:[
+ (dep := deps first) isCollection ifFalse:[
+ dependents := dep
+ ]
+ ]
+ ]
+ ] ifFalse:[
+ deps == anObject ifTrue:[
+ dependents := nil
+ ]
+ ]
+ ]
+ ] ensure:[
+ wasBlocked ifFalse:[
+ OperatingSystem unblockInterrupts
+ ]
]
"Modified: 8.1.1997 / 23:41:39 / cg"
@@ -8878,120 +8878,120 @@
|tops mainView mainViewID previousGroup |
self isPopUpView ifFalse:[
- ModalBox usingTransientViews ifTrue:[
- "make view only transient, if there is a visible topView.
- If none of them is visible, we do want an icon for ourself"
+ ModalBox usingTransientViews ifTrue:[
+ "make view only transient, if there is a visible topView.
+ If none of them is visible, we do want an icon for ourself"
- mainGroup notNil ifTrue:[
- (tops := mainGroup topViews) notNil ifTrue:[
- tops notEmpty ifTrue:[
- mainView := tops detect:[:v| v shown] ifNone:nil.
- mainView notNil ifTrue:[
- mainViewID := mainView id.
- ]
- ]
- ].
- ].
-
- mainViewID isNil ifTrue:[
- self origin:(device center - (self extent//2))
- ].
-
- drawableId isNil ifTrue:[self create].
- mainView notNil ifTrue:[
- device setTransient:drawableId for:mainViewID.
- ].
- ].
+ mainGroup notNil ifTrue:[
+ (tops := mainGroup topViews) notNil ifTrue:[
+ tops notEmpty ifTrue:[
+ mainView := tops detect:[:v| v shown] ifNone:nil.
+ mainView notNil ifTrue:[
+ mainViewID := mainView id.
+ ]
+ ]
+ ].
+ ].
+
+ mainViewID isNil ifTrue:[
+ self origin:(device center - (self extent//2))
+ ].
+
+ drawableId isNil ifTrue:[self create].
+ mainView notNil ifTrue:[
+ device setTransient:drawableId for:mainViewID.
+ ].
+ ].
].
self raise.
Processor activeProcessIsSystemProcess ifTrue:[
- "
- put myself into the modal group, let it handle events for
- me as well. This is only a half way solution, since the view
- is not modal at all ... however, the only situation
- where this happens is with modal boxes popped while in a
- modal browser. You will forgive me for that inconvenience.
- "
- windowGroup := mainGroup.
- mainGroup notNil ifTrue:[mainGroup addTopView:self].
- self realize
+ "
+ put myself into the modal group, let it handle events for
+ me as well. This is only a half way solution, since the view
+ is not modal at all ... however, the only situation
+ where this happens is with modal boxes popped while in a
+ modal browser. You will forgive me for that inconvenience.
+ "
+ windowGroup := mainGroup.
+ mainGroup notNil ifTrue:[mainGroup addTopView:self].
+ self realize
] ifFalse:[
- previousGroup := WindowGroup activeGroup.
-
- "
- show a stop-cursor in the main group
- "
- mainGroup notNil ifTrue:[
- self isPopUpView ifFalse:[
- mainGroup showCursor:(Cursor stop).
- (previousGroup notNil and:[previousGroup ~~ mainGroup]) ifTrue:[
- previousGroup showCursor:(Cursor stop).
- ].
- ]
- ].
-
- "
- create a new window group and put myself into it
- "
- windowGroup := WindowGroup new.
- windowGroup addTopView:self.
- windowGroup setPreviousGroup:previousGroup.
-
- superView notNil ifTrue:[
- "/
- "/ special: this is a modal subview,
- "/ prevent the view from reassigning its windowGroup when realized
- "/ (subviews normally place themself into the superviews group)
- "/
- windowGroup isForModalSubview:true.
- ].
-
- "
- go dispatch events in this new group
- (thus current windowgroup is blocked from interaction)
- "
- AbortSignal handle:[:ex |
- self hide.
- ex return.
- ] do:[
- [
- [
- windowGroup startupModal:[realized and:aBlock] forGroup:mainGroup
- ] valueOnUnwindDo:[
- self hide.
- ]
- ] valueNowOrOnUnwindDo:[
- mainGroup notNil ifTrue:[
- mainGroup graphicsDevice sync.
- "/ ensure that eventListener runs here ...
- Delay waitForSeconds:0.05.
- mainGroup processExposeEvents.
-
- ReturnFocusWhenClosingModalBoxes ifTrue:[
- "
- return input focus to previously active groups top.
- This helps with windowmanagers which need an explicit click
- on the view for the focus.
- "
- tops := mainGroup topViews.
- (tops notNil and:[tops notEmpty]) ifTrue:[
- tops first getKeyboardFocus
- ].
- ].
-
- "
- restore cursors in the main group & flush its buffered key & mouse events
- "
- mainGroup restoreCursors.
- (previousGroup notNil and:[previousGroup ~~ mainGroup]) ifTrue:[
- previousGroup restoreCursors.
- ].
+ previousGroup := WindowGroup activeGroup.
+
+ "
+ show a stop-cursor in the main group
+ "
+ mainGroup notNil ifTrue:[
+ self isPopUpView ifFalse:[
+ mainGroup showCursor:(Cursor stop).
+ (previousGroup notNil and:[previousGroup ~~ mainGroup]) ifTrue:[
+ previousGroup showCursor:(Cursor stop).
+ ].
+ ]
+ ].
+
+ "
+ create a new window group and put myself into it
+ "
+ windowGroup := WindowGroup new.
+ windowGroup addTopView:self.
+ windowGroup setPreviousGroup:previousGroup.
+
+ superView notNil ifTrue:[
+ "/
+ "/ special: this is a modal subview,
+ "/ prevent the view from reassigning its windowGroup when realized
+ "/ (subviews normally place themself into the superviews group)
+ "/
+ windowGroup isForModalSubview:true.
+ ].
+
+ "
+ go dispatch events in this new group
+ (thus current windowgroup is blocked from interaction)
+ "
+ AbortSignal handle:[:ex |
+ self hide.
+ ex return.
+ ] do:[
+ [
+ [
+ windowGroup startupModal:[realized and:aBlock] forGroup:mainGroup
+ ] valueOnUnwindDo:[
+ self hide.
+ ]
+ ] ensure:[
+ mainGroup notNil ifTrue:[
+ mainGroup graphicsDevice sync.
+ "/ ensure that eventListener runs here ...
+ Delay waitForSeconds:0.05.
+ mainGroup processExposeEvents.
+
+ ReturnFocusWhenClosingModalBoxes ifTrue:[
+ "
+ return input focus to previously active groups top.
+ This helps with windowmanagers which need an explicit click
+ on the view for the focus.
+ "
+ tops := mainGroup topViews.
+ (tops notNil and:[tops notEmpty]) ifTrue:[
+ tops first getKeyboardFocus
+ ].
+ ].
+
+ "
+ restore cursors in the main group & flush its buffered key & mouse events
+ "
+ mainGroup restoreCursors.
+ (previousGroup notNil and:[previousGroup ~~ mainGroup]) ifTrue:[
+ previousGroup restoreCursors.
+ ].
"/ mainGroup sensor flushUserEvents.
- ]
- ]
- ].
+ ]
+ ]
+ ].
]
"Created: 10.12.1995 / 14:06:14 / cg"
@@ -9274,6 +9274,6 @@
!SimpleView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.433 2002-02-25 20:00:34 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.434 2002-02-26 12:57:32 cg Exp $'
! !
SimpleView initialize!