--- a/DeviceWorkstation.st Sat Aug 21 20:05:39 1999 +0200
+++ b/DeviceWorkstation.st Mon Aug 23 14:00:59 1999 +0200
@@ -23,7 +23,7 @@
shiftModifiers supportsDeepIcons preferredIconSize ditherColors
fixColors numFixRed numFixGreen numFixBlue fixGrayColors
copyBuffer lastCopyBuffer blackColor whiteColor focusMode
- activeView clipBoardEncoding focusView'
+ activeView clipBoardEncoding focusView deviceErrorSignal deviceIOErrorSignal'
classVariableNames:'ButtonTranslation MultiClickTimeDelta DeviceErrorSignal
DeviceIOErrorSignal DeviceIOTimeoutErrorSignal ErrorPrinting
DefaultScreen AllScreens CurrentScreenQuerySignal
@@ -861,6 +861,7 @@
The default here is the global DeviceErrorSignal
(which is the parent of any per-instance error signals)."
+ deviceErrorSignal notNil ifTrue:[^ deviceErrorSignal].
^ self class deviceErrorSignal
!
@@ -869,6 +870,7 @@
The default here is the global DeviceIOErrorSignal
(which is the parent of any per-instance I/O error signals)."
+ deviceIOErrorSignal notNil ifTrue:[^ deviceIOErrorSignal].
^ self class deviceIOErrorSignal
!
@@ -2460,9 +2462,9 @@
colorScaledRed:red scaledGreen:green scaledBlue:blue
visualType == #TrueColor ifTrue:[
- ^ (((red bitShift:-8) bitShift:redShift)
- bitOr:((green bitShift:-8) bitShift:greenShift))
- bitOr:((blue bitShift:-8) bitShift:blueShift)
+ ^ (((red bitShift:-8) bitShift:redShift)
+ bitOr:((green bitShift:-8) bitShift:greenShift))
+ bitOr:((blue bitShift:-8) bitShift:blueShift)
].
self subclassResponsibility
!
@@ -3609,21 +3611,21 @@
dispatching ifFalse:[^ self].
self == Display ifTrue:[
- ExitOnLastClose == true ifFalse:[^ self].
+ ExitOnLastClose == true ifFalse:[^ self].
].
exitOnLastClose == true ifFalse:[^ self].
knownViews notNil ifTrue:[
- (knownViews findFirst:[:slot |
- slot notNil
- and:[slot ~~ 0
- and:[slot isRootView not
- and:[slot superView isNil
- and:[slot realized]]]]]) == 0 ifTrue:[
- "/ my last view was closed
- dispatching := false.
- 'DeviceWorkstation [info]: finished dispatch (last view closed)' infoPrintCR.
- ]
+ (knownViews findFirst:[:slot |
+ slot notNil
+ and:[slot ~~ 0
+ and:[slot isRootView not
+ and:[slot superView isNil
+ and:[slot realized]]]]]) == 0 ifTrue:[
+ "/ my last view was closed
+ dispatching := false.
+ 'DeviceWorkstation [info]: finished dispatch (last view closed)' infoPrintCR.
+ ]
].
"Modified: 19.9.1995 / 11:31:54 / claus"
@@ -4585,14 +4587,21 @@
"initialize heavily used device resources - to avoid looking them up later"
blackColor isNil ifTrue:[
- blackColor := Color black onDevice:self.
- whiteColor := Color white onDevice:self.
- Color getPrimaryColorsOn:self.
+ blackColor := Color black onDevice:self.
+ whiteColor := Color white onDevice:self.
+ Color getPrimaryColorsOn:self.
]
"Modified: 24.2.1997 / 22:07:50 / cg"
!
+initializeDeviceSignals
+ deviceErrorSignal := DeviceErrorSignal newSignalMayProceed:false.
+ deviceErrorSignal nameClass:self message:#deviceErrorSignal.
+ deviceIOErrorSignal := DeviceIOErrorSignal newSignalMayProceed:false.
+ deviceIOErrorSignal nameClass:self message:#deviceIOErrorSignal.
+!
+
initializeFor:aDisplayOrNilForAny
"initialize the receiver for a connection to a display. If the
argument is non-nil, it should specify which workstation should be
@@ -4671,9 +4680,9 @@
self initializeFor:nil.
displayId isNil ifTrue:[
- 'DevWorkstation [error]: could not connect to display' errorPrintCR.
- Smalltalk exit.
- ^ self
+ 'DevWorkstation [error]: could not connect to display' errorPrintCR.
+ Smalltalk exit.
+ ^ self
].
"
@@ -4685,51 +4694,51 @@
"/ prevMapping notNil ifTrue:[
prevKnownViews notNil ifTrue:[
- "
- first round: flush all device specific stuff
- "
+ "
+ first round: flush all device specific stuff
+ "
"/ prevMapping keysAndValuesDo:[:anId :aView |
- prevKnownViews do:[:aView |
- (aView notNil and:[aView ~~ 0]) ifTrue:[
- aView prepareForReinit
- ]
- ].
-
- "
- 2nd round: all views should reinstall themself
- on the new display
- "
+ prevKnownViews do:[:aView |
+ (aView notNil and:[aView ~~ 0]) ifTrue:[
+ aView prepareForReinit
+ ]
+ ].
+
+ "
+ 2nd round: all views should reinstall themself
+ on the new display
+ "
"/ prevMapping keysAndValuesDo:[:anId :aView |
- prevKnownViews do:[:aView |
- (aView notNil and:[aView ~~ 0]) ifTrue:[
- "have to re-create the view"
- UserInterruptSignal catch:[
- AbortSignal catch:[
- GraphicsContext drawingOnClosedDrawableSignal handle:[:ex |
- 'DeviceWorkstation [warning]: drawing attempt on closed drawable during reinit' errorPrintCR.
- ex return
- ] do:[
- aView reinitialize
- ]
- ]
- ]
- ]
- ].
-
- (prevWidth ~~ width
- or:[prevHeight ~~ height]) ifTrue:[
- "
- 3rd round: all views get a chance to handle
- changed environment (colors, font sizes etc)
- "
+ prevKnownViews do:[:aView |
+ (aView notNil and:[aView ~~ 0]) ifTrue:[
+ "have to re-create the view"
+ UserInterruptSignal catch:[
+ AbortSignal catch:[
+ GraphicsContext drawingOnClosedDrawableSignal handle:[:ex |
+ 'DeviceWorkstation [warning]: drawing attempt on closed drawable during reinit' errorPrintCR.
+ ex return
+ ] do:[
+ aView reinitialize
+ ]
+ ]
+ ]
+ ]
+ ].
+
+ (prevWidth ~~ width
+ or:[prevHeight ~~ height]) ifTrue:[
+ "
+ 3rd round: all views get a chance to handle
+ changed environment (colors, font sizes etc)
+ "
"/ prevMapping keysAndValuesDo:[:anId :aView |
- prevKnownViews do:[:aView |
- (aView notNil and:[aView ~~ 0]) ifTrue:[
- aView reAdjustGeometry
- ]
- ].
- ]
+ prevKnownViews do:[:aView |
+ (aView notNil and:[aView ~~ 0]) ifTrue:[
+ aView reAdjustGeometry
+ ]
+ ].
+ ]
].
dispatching := false.
@@ -5985,82 +5994,82 @@
lastId := nil.
lastView := nil.
focusView == aView ifTrue:[
- focusView := nil
+ focusView := nil
].
knownViews notNil ifTrue:[
- wasBlocked := OperatingSystem blockInterrupts.
-
- index := 0.
- aViewId notNil ifTrue:[
- idToTableIndexMapping notNil ifTrue:[
- index := idToTableIndexMapping at:aViewId ifAbsent:0.
- ]
- ].
- index == 0 ifTrue:[
- aView notNil ifTrue:[
- index := knownViews identityIndexOf:aView.
- ].
- ].
-
- index ~~ 0 ifTrue:[
- idToTableIndexMapping notNil ifTrue:[
- aViewId notNil ifTrue:[
- idToTableIndexMapping removeKey:aViewId ifAbsent:nil
- ] ifFalse:[
- id := knownIds at:index.
- id notNil ifTrue:[
- idToTableIndexMapping removeKey:id ifAbsent:nil.
- ]
- ]
- ].
- knownViews at:index put:nil.
- knownIds at:index put:nil.
- lastId := nil.
- lastView := nil.
- ].
-
- wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
-
- aView notNil ifTrue:[
- aView isTopView ifTrue:[
- "/ check for sparsely filled knownViews - array
- wasBlocked := OperatingSystem blockInterrupts.
- n := 0.
- knownViews do:[:v |
- (v notNil and:[v ~~ 0]) ifTrue:[
- n := n + 1
- ].
- ].
- n < (knownViews size * 2 // 3) ifTrue:[
- newSize := n * 3 // 2.
- newSize > 50 ifTrue:[
- nV := WeakArray new:newSize.
- nI := Array new:newSize.
- dstIdx := 1.
- 1 to:knownViews size do:[:srcIdx |
- v := knownViews at:srcIdx.
- (v notNil and:[v ~~ 0]) ifTrue:[
- nV at:dstIdx put:v.
- nI at:dstIdx put:(knownIds at:srcIdx).
- dstIdx := dstIdx + 1.
- ].
- ].
- idToTableIndexMapping := nil.
- knownViews := nV.
- knownIds := nI.
- idToTableIndexMapping := Dictionary new.
- knownIds keysAndValuesDo:[:idx :id |
- id notNil ifTrue:[
- idToTableIndexMapping at:id put:idx
- ]
- ].
- ].
- ].
- wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
- ].
- ].
- self checkForEndOfDispatch.
+ wasBlocked := OperatingSystem blockInterrupts.
+
+ index := 0.
+ aViewId notNil ifTrue:[
+ idToTableIndexMapping notNil ifTrue:[
+ index := idToTableIndexMapping at:aViewId ifAbsent:0.
+ ]
+ ].
+ index == 0 ifTrue:[
+ aView notNil ifTrue:[
+ index := knownViews identityIndexOf:aView.
+ ].
+ ].
+
+ index ~~ 0 ifTrue:[
+ idToTableIndexMapping notNil ifTrue:[
+ aViewId notNil ifTrue:[
+ idToTableIndexMapping removeKey:aViewId ifAbsent:nil
+ ] ifFalse:[
+ id := knownIds at:index.
+ id notNil ifTrue:[
+ idToTableIndexMapping removeKey:id ifAbsent:nil.
+ ]
+ ]
+ ].
+ knownViews at:index put:nil.
+ knownIds at:index put:nil.
+ lastId := nil.
+ lastView := nil.
+ ].
+
+ wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+
+ aView notNil ifTrue:[
+ aView isTopView ifTrue:[
+ "/ check for sparsely filled knownViews - array
+ wasBlocked := OperatingSystem blockInterrupts.
+ n := 0.
+ knownViews do:[:v |
+ (v notNil and:[v ~~ 0]) ifTrue:[
+ n := n + 1
+ ].
+ ].
+ n < (knownViews size * 2 // 3) ifTrue:[
+ newSize := n * 3 // 2.
+ newSize > 50 ifTrue:[
+ nV := WeakArray new:newSize.
+ nI := Array new:newSize.
+ dstIdx := 1.
+ 1 to:knownViews size do:[:srcIdx |
+ v := knownViews at:srcIdx.
+ (v notNil and:[v ~~ 0]) ifTrue:[
+ nV at:dstIdx put:v.
+ nI at:dstIdx put:(knownIds at:srcIdx).
+ dstIdx := dstIdx + 1.
+ ].
+ ].
+ idToTableIndexMapping := nil.
+ knownViews := nV.
+ knownIds := nI.
+ idToTableIndexMapping := Dictionary new.
+ knownIds keysAndValuesDo:[:idx :id |
+ id notNil ifTrue:[
+ idToTableIndexMapping at:id put:idx
+ ]
+ ].
+ ].
+ ].
+ wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+ ].
+ ].
+ self checkForEndOfDispatch.
]
"Created: 22.3.1997 / 14:56:20 / cg"
@@ -6472,6 +6481,6 @@
!DeviceWorkstation class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.316 1999-08-21 18:05:39 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.317 1999-08-23 12:00:58 cg Exp $'
! !
DeviceWorkstation initialize!