--- a/DisplaySurface.st Sat Jul 16 18:24:24 2016 +0200
+++ b/DisplaySurface.st Tue Jul 19 21:44:36 2016 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
"
COPYRIGHT (c) 1992 by Claus Gittinger
All Rights Reserved
@@ -11,6 +9,8 @@
other person. No title to or ownership of the software is
hereby transferred.
"
+'From Smalltalk/X, Version:7.1.0.0 on 19-07-2016 at 15:46:14' !
+
"{ Package: 'stx:libview' }"
"{ NameSpace: Smalltalk }"
@@ -23,13 +23,6 @@
category:'Graphics-Support'
!
-DeviceHandle subclass:#DeviceViewHandle
- instanceVariableNames:''
- classVariableNames:''
- poolDictionaries:''
- privateIn:DisplaySurface
-!
-
!DisplaySurface class methodsFor:'documentation'!
copyright
@@ -115,22 +108,22 @@
newTop newBottom newLeft newRight|
updateRegion isNil ifTrue:[
- updateRegion := OrderedCollection with:newRectangle.
- ^ true
+ updateRegion := OrderedCollection with:newRectangle.
+ ^ true
].
(updateRegion contains:[:oldRectangle | (newRectangle isContainedIn:oldRectangle)]) ifTrue:[
- ^ false.
+ ^ false.
].
numRect := updateRegion size.
numRect > 20 ifTrue:[
- closure := updateRegion
- inject:newRectangle
- into:[:boundsSoFar :thisRectangle |
- boundsSoFar quickMerge:thisRectangle
- ].
- updateRegion := OrderedCollection with:closure.
- ^ true
+ closure := updateRegion
+ inject:newRectangle
+ into:[:boundsSoFar :thisRectangle |
+ boundsSoFar quickMerge:thisRectangle
+ ].
+ updateRegion := OrderedCollection with:closure.
+ ^ true
].
lastRect := updateRegion at:numRect.
@@ -144,24 +137,24 @@
newRight := newRectangle right.
lastTop = newTop ifTrue:[
- lastBottom = newBottom ifTrue:[
- lastLeft <= newLeft ifTrue:[
- lastRight >= newLeft ifTrue:[
- updateRegion at:numRect put:(lastRect copy right:newRight).
- ^ false "/ true
- ]
- ]
- ].
+ lastBottom = newBottom ifTrue:[
+ lastLeft <= newLeft ifTrue:[
+ lastRight >= newLeft ifTrue:[
+ updateRegion at:numRect put:(lastRect copy right:newRight).
+ ^ false "/ true
+ ]
+ ]
+ ].
].
lastLeft = newLeft ifTrue:[
- lastRight = newRight ifTrue:[
- lastTop <= newTop ifTrue:[
- lastBottom >= newTop ifTrue:[
- updateRegion at:numRect put:(lastRect copy bottom:newBottom).
- ^ false "/ true
- ]
- ]
- ].
+ lastRight = newRight ifTrue:[
+ lastTop <= newTop ifTrue:[
+ lastBottom >= newTop ifTrue:[
+ updateRegion at:numRect put:(lastRect copy bottom:newBottom).
+ ^ false "/ true
+ ]
+ ]
+ ].
].
updateRegion add:newRectangle.
@@ -176,7 +169,7 @@
viewBackground ~~ something ifTrue:[
viewBackground := something.
- drawableId notNil ifTrue:[
+ self drawableId notNil ifTrue:[
self setViewBackground
]
]
@@ -235,123 +228,123 @@
|id devBgPixmap bgPixmap w h colorMap
pixmapDepth deviceDepth defBG|
- drawableId notNil ifTrue:[
- viewBackground isColor ifTrue:[
- viewBackground := viewBackground onDevice:device.
- id := viewBackground colorId.
- "
- a real color (i.e. one supported by the device) ?
- "
- id notNil ifTrue:[
- device setWindowBackground:id in:drawableId.
- ^ self
- ].
- "
- no, a dithered one - must have a dither-pattern
- (which is ready for the device, since viewBackground
- is already assigned to the device)
- "
- bgPixmap := viewBackground ditherForm.
- ] ifFalse:[
- viewBackground notNil ifTrue:[
- viewBackground isViewBackground ifTrue:[
- ^ self.
- ].
-
- "
- assume, it can convert itself to a form
- "
- bgPixmap := viewBackground asFormOn:device.
- bgPixmap isNil ifTrue:[
- "/ assume it knows how to draw itself
- ^ self
- ].
- ].
- ].
-
- "
- must now have:
- a dithered color or bitmap or pixmap
- "
- bgPixmap isNil ifTrue:[
- 'DisplaySurface [warning]: background not convertable - ignored' errorPrintCR.
- ^ self
- ].
-
- "/ if the device does not support background pixmaps,
- "/ set the backgroundColor to the default background.
- "/ this will avoid flicker in win32 systems,
- "/ since that background is drawn directly in the
- "/ devices expose event handling.
- "/ (in contrast, the pixmap filling is done by the
- "/ window itself in its expose event handler)
-
- (device supportsViewBackgroundPixmap:bgPixmap) ifFalse:[
- defBG := View defaultViewBackgroundColor.
- defBG isColor ifTrue:[
- defBG := defBG onDevice:device.
- id := defBG colorId.
- id notNil ifTrue:[
- device setWindowBackground:id in:drawableId.
- ].
- ].
- ^ self
- ].
-
- w := bgPixmap width.
- h := bgPixmap height.
-
- deviceDepth := device depth.
- pixmapDepth := bgPixmap depth.
-
- (pixmapDepth ~~ deviceDepth) ifTrue:[
- (pixmapDepth ~~ 1) ifTrue:[
- 'DisplaySurface [warning]: Bad dither depth (must be one or devices depth)' errorPrintCR.
- ^ self
- ].
-
- "
- convert it into a deep form
- "
- colorMap := bgPixmap colorMap.
- devBgPixmap := Form width:w height:h depth:deviceDepth onDevice:device.
- devBgPixmap isNil ifTrue:[
- 'DisplaySurface [warning]: could not create a device form for viewBackground' infoPrintCR.
- ^ self
- ].
- devBgPixmap paint:(colorMap at:1).
- devBgPixmap fillRectangleX:0 y:0 width:w height:h.
- devBgPixmap foreground:(colorMap at:2) background:(colorMap at:1).
- devBgPixmap copyPlaneFrom:bgPixmap x:0 y:0 toX:0 y:0 width:w height:h.
- bgPixmap := devBgPixmap.
- ] ifFalse:[
- (pixmapDepth == 1) ifTrue:[
- "
- although depth matches,
- values in the dither are to be interpreted via the ditherForms
- colormap, which is not always the same as blackpixel/whitepixel ...
- "
- colorMap := bgPixmap colorMap.
- (colorMap at:1) colorId == device whitepixel ifTrue:[
- (colorMap at:2) colorId == device blackpixel ifTrue:[
- "
- ok, can use it
- "
- device setWindowBackgroundPixmap:(bgPixmap id) in:drawableId.
- ^ self
- ]
- ].
-
- "
- no, must invert it
- "
- devBgPixmap := Form width:w height:h depth:deviceDepth onDevice:device.
- devBgPixmap paint:(colorMap at:2) on:(colorMap at:1).
- devBgPixmap copyPlaneFrom:bgPixmap x:0 y:0 toX:0 y:0 width:w height:h.
- bgPixmap := devBgPixmap.
- ]
- ].
- device setWindowBackgroundPixmap:(bgPixmap id) in:drawableId.
+ self drawableId notNil ifTrue:[
+ viewBackground isColor ifTrue:[
+ viewBackground := viewBackground onDevice:self graphicsDevice.
+ id := viewBackground colorId.
+ "
+ a real color (i.e. one supported by the device) ?
+ "
+ id notNil ifTrue:[
+ self graphicsDevice setWindowBackground:id in:self drawableId.
+ ^ self
+ ].
+ "
+ no, a dithered one - must have a dither-pattern
+ (which is ready for the device, since viewBackground
+ is already assigned to the device)
+ "
+ bgPixmap := viewBackground ditherForm.
+ ] ifFalse:[
+ viewBackground notNil ifTrue:[
+ viewBackground isViewBackground ifTrue:[
+ ^ self.
+ ].
+
+ "
+ assume, it can convert itself to a form
+ "
+ bgPixmap := viewBackground asFormOn:self graphicsDevice.
+ bgPixmap isNil ifTrue:[
+ "/ assume it knows how to draw itself
+ ^ self
+ ].
+ ].
+ ].
+
+ "
+ must now have:
+ a dithered color or bitmap or pixmap
+ "
+ bgPixmap isNil ifTrue:[
+ 'DisplaySurface [warning]: background not convertable - ignored' errorPrintCR.
+ ^ self
+ ].
+
+ "/ if the device does not support background pixmaps,
+ "/ set the backgroundColor to the default background.
+ "/ this will avoid flicker in win32 systems,
+ "/ since that background is drawn directly in the
+ "/ devices expose event handling.
+ "/ (in contrast, the pixmap filling is done by the
+ "/ window itself in its expose event handler)
+
+ (self graphicsDevice supportsViewBackgroundPixmap:bgPixmap) ifFalse:[
+ defBG := View defaultViewBackgroundColor.
+ defBG isColor ifTrue:[
+ defBG := defBG onDevice:self graphicsDevice.
+ id := defBG colorId.
+ id notNil ifTrue:[
+ self graphicsDevice setWindowBackground:id in:self drawableId.
+ ].
+ ].
+ ^ self
+ ].
+
+ w := bgPixmap width.
+ h := bgPixmap height.
+
+ deviceDepth := self depth.
+ pixmapDepth := bgPixmap depth.
+
+ (pixmapDepth ~~ deviceDepth) ifTrue:[
+ (pixmapDepth ~~ 1) ifTrue:[
+ 'DisplaySurface [warning]: Bad dither depth (must be one or devices depth)' errorPrintCR.
+ ^ self
+ ].
+
+ "
+ convert it into a deep form
+ "
+ colorMap := bgPixmap colorMap.
+ devBgPixmap := Form width:w height:h depth:deviceDepth onDevice:self graphicsDevice.
+ devBgPixmap isNil ifTrue:[
+ 'DisplaySurface [warning]: could not create a device form for viewBackground' infoPrintCR.
+ ^ self
+ ].
+ devBgPixmap paint:(colorMap at:1).
+ devBgPixmap fillRectangleX:0 y:0 width:w height:h.
+ devBgPixmap foreground:(colorMap at:2) background:(colorMap at:1).
+ devBgPixmap copyPlaneFrom:bgPixmap x:0 y:0 toX:0 y:0 width:w height:h.
+ bgPixmap := devBgPixmap.
+ ] ifFalse:[
+ (pixmapDepth == 1) ifTrue:[
+ "
+ although depth matches,
+ values in the dither are to be interpreted via the ditherForms
+ colormap, which is not always the same as blackpixel/whitepixel ...
+ "
+ colorMap := bgPixmap colorMap.
+ (colorMap at:1) colorId == self graphicsDevice whitepixel ifTrue:[
+ (colorMap at:2) colorId == self graphicsDevice blackpixel ifTrue:[
+ "
+ ok, can use it
+ "
+ self graphicsDevice setWindowBackgroundPixmap:(bgPixmap id) in:self drawableId.
+ ^ self
+ ]
+ ].
+
+ "
+ no, must invert it
+ "
+ devBgPixmap := Form width:w height:h depth:deviceDepth onDevice:self graphicsDevice.
+ devBgPixmap paint:(colorMap at:2) on:(colorMap at:1).
+ devBgPixmap copyPlaneFrom:bgPixmap x:0 y:0 toX:0 y:0 width:w height:h.
+ bgPixmap := devBgPixmap.
+ ]
+ ].
+ self graphicsDevice setWindowBackgroundPixmap:(bgPixmap id) in:self drawableId.
]
"Modified: / 23-01-2011 / 01:44:38 / cg"
@@ -413,10 +406,18 @@
^ self
!
+windowClass:classString name:nameString
+ gc windowClass:classString name:nameString.
+!
+
windowGroup
"return nil - I have no windowGroup"
^ nil
+!
+
+windowName:aString
+ gc windowName:aString.
! !
!DisplaySurface methodsFor:'accessing-cursor'!
@@ -458,20 +459,16 @@
Cursors are typically set at view creation time and left as installed."
aCursor notNil ifTrue:[
- (aCursor ~~ cursor) ifTrue:[
- "/ aCursor = Cursor wait ifTrue:[
- "/ Transcript showCR:'==========================='.
- "/ thisContext fullPrintAllOn:Transcript.
- "/ ].
- cursor := aCursor.
- drawableId notNil ifTrue:[
- self setCursor.
- (showImmediately and:[realized]) ifTrue:[
- "flush, to make cursor immediately visible"
- device flush
- ]
- ]
- ]
+ (aCursor ~~ cursor) ifTrue:[
+ cursor := aCursor.
+ self drawableId notNil ifTrue:[
+ self setCursor.
+ (showImmediately and:[realized]) ifTrue:[
+ "flush, to make cursor immediately visible"
+ self flush
+ ]
+ ]
+ ]
]
"
@@ -482,10 +479,10 @@
v open.
[v shown] whileFalse:[Processor yield].
[v shown] whileTrue:[
- (Delay forSeconds:1) wait.
- v cursor:(Cursor normal).
- (Delay forSeconds:1) wait.
- v cursor:(Cursor wait).
+ (Delay forSeconds:1) wait.
+ v cursor:(Cursor normal).
+ (Delay forSeconds:1) wait.
+ v cursor:(Cursor wait).
]
"
@@ -502,11 +499,11 @@
id := cursor id.
id isNil ifTrue:[
- 'DisplaySurface [warning]: nil cursorId ignored; shape=' errorPrint.
- cursor shape errorPrintCR.
- ^ self.
+ 'DisplaySurface [warning]: nil cursorId ignored; shape=' errorPrint.
+ cursor shape errorPrintCR.
+ ^ self.
].
- self setCursorId:id .
+ gc setCursorId:id .
!
withCursor:aCursor do:aBlock
@@ -560,19 +557,19 @@
|ret|
cursor == aCursor ifTrue:[
- ^ aBlock value
+ ^ aBlock value
].
- self
- withCursor:aCursor do:[
- |timeToExecute remainingShowTime|
-
- timeToExecute := Time millisecondsToRun:[ ret := aBlock value].
- remainingShowTime := UserPreferences current waitCursorVisibleTime - timeToExecute.
- remainingShowTime > 0 ifTrue:[
- Delay waitForMilliseconds:remainingShowTime.
- ].
- ].
+ self
+ withCursor:aCursor do:[
+ |timeToExecute remainingShowTime|
+
+ timeToExecute := Time millisecondsToRun:[ ret := aBlock value].
+ remainingShowTime := UserPreferences current waitCursorVisibleTime - timeToExecute.
+ remainingShowTime > 0 ifTrue:[
+ Delay waitForMilliseconds:remainingShowTime.
+ ].
+ ].
^ ret.
"Modified (comment): / 12-09-2011 / 12:14:29 / cg"
@@ -671,8 +668,8 @@
how may true/false, but also #always, #whenMapped or #never."
how ~~ backed ifTrue:[
- backed := how.
- super backingStore:how.
+ backed := how.
+ super backingStore:how.
]
!
@@ -694,7 +691,7 @@
"tell the Display to assign keyboard focus to the receiver"
self shown ifTrue:[
- device setInputFocusTo:drawableId.
+ device setInputFocusTo:self drawableId.
].
"Modified: / 15.3.1999 / 08:25:10 / cg"
@@ -741,21 +738,21 @@
- used for temporary views (i.e. PopUps and ModalBoxes)"
aBoolean ifTrue:[
- flags := flags bitOr:SaveUnderFlagMask.
+ flags := flags bitOr:SaveUnderFlagMask.
] ifFalse:[
- flags := flags bitClear:SaveUnderFlagMask.
+ flags := flags bitClear:SaveUnderFlagMask.
].
- super saveUnder:aBoolean.
+ gc saveUnder:aBoolean.
!
setPointerPosition:aRelativePoint
"set the pointer to aRelativePoint relative to the views origin"
- device setPointerPosition:aRelativePoint in:drawableId.
+ device setPointerPosition:aRelativePoint in:self drawableId.
"
- Transcript setPointerPosition:Transcript extent // 2.
- Screen current rootView setPointerPosition:100@100.
+ Transcript setPointerPosition:Transcript extent // 2.
+ Screen current rootView setPointerPosition:100@100.
"
! !
@@ -845,15 +842,15 @@
setAttribute:key to:newValue
newValue isNil ifTrue:[
- moreAttributes notNil ifTrue:[
- moreAttributes removeKey:key ifAbsent:[].
- moreAttributes := moreAttributes asNilIfEmpty
- ]
+ moreAttributes notNil ifTrue:[
+ moreAttributes removeKey:key ifAbsent:[].
+ moreAttributes := moreAttributes asNilIfEmpty
+ ]
] ifFalse:[
- moreAttributes isNil ifTrue:[
- moreAttributes := IdentityDictionary new.
- ].
- moreAttributes at:key put:newValue.
+ moreAttributes isNil ifTrue:[
+ moreAttributes := IdentityDictionary new.
+ ].
+ moreAttributes at:key put:newValue.
].
!
@@ -863,6 +860,53 @@
flags := flags bitOr:GotExposeFlagMask.
! !
+!DisplaySurface methodsFor:'binary storage'!
+
+readBinaryContentsFrom: stream manager: manager
+ "tell the newly restored View to recreate itself.
+ Bug: does not work correctly yet.
+ (restored view looses its position & wg process)"
+
+ |wasRealized|
+
+ super readBinaryContentsFrom: stream manager: manager.
+
+ wasRealized := realized.
+ realized := false.
+ self recreate.
+ wasRealized ifTrue:[
+ self remap
+ ]
+
+
+ "
+ |s l|
+ s := 'storedLabel.boss' asFilename writeStream binary.
+ l := (Label label:'hello there') realize.
+ Delay waitForSeconds:1.
+ l storeBinaryOn:s.
+ s close.
+ "
+
+ "
+ |s l|
+ s := 'storedLabel.boss' asFilename writeStream binary.
+ (l := Label label:'hello there') open.
+ (Delay forSeconds:10) wait.
+ l storeBinaryOn:s.
+ s close.
+ l destroy.
+ "
+
+ "
+ |s|
+ s := 'storedLabel.boss' asFilename readStream binary.
+ (Object readBinaryFrom:s)
+ "
+
+ "Modified: 3.5.1996 / 23:59:38 / stefan"
+ "Modified: 14.2.1997 / 15:42:55 / cg"
+! !
!DisplaySurface methodsFor:'button menus'!
@@ -896,9 +940,9 @@
|oldMenu|
(oldMenu := self getMiddleButtonMenu) notNil ifTrue:[
- oldMenu isArray ifFalse:[
- oldMenu destroy
- ]
+ oldMenu isArray ifFalse:[
+ oldMenu destroy
+ ]
].
self setMiddleButtonMenu:aMenu
@@ -918,7 +962,7 @@
"return the object selection
- either the local one, or the displays clipBoard buffer."
- ^ device getClipboardObjectFor:drawableId.
+ ^ device getClipboardObjectFor:self drawableId.
"Modified: 13.2.1997 / 13:18:50 / cg"
!
@@ -933,13 +977,13 @@
getClipboardText:selectionBufferSymbol
"return the text selection - either the local one, or one of the displays
clipBoard buffers determined by selectionBufferSymbol, which should be one of:
- #clipboard
+ #clipboard
or:
- #selection.
+ #selection.
Return aString or nil if there is no selection"
- ^ device getClipboardText:selectionBufferSymbol for:drawableId.
+ ^ device getClipboardText:selectionBufferSymbol for:self drawableId.
!
getSelection
@@ -1016,13 +1060,19 @@
|oldPaint org patternOffsetX patternOffsetY|
+ gc isNil ifTrue:[
+ "nothing to clear"
+ ^ self.
+ ].
viewBackground isNil ifTrue:[^ self]. "/ how can this happen?
viewBackground isColor ifFalse:[
viewBackground isViewBackground ifTrue:[
- self paint:background.
- self fillDeviceRectangleX:x y:y width:w height:h.
- self paint:paint.
+ oldPaint := self paint.
+ self
+ paint:self background;
+ fillDeviceRectangleX:x y:y width:w height:h;
+ paint:oldPaint.
viewBackground fillRectangleX:x y:y width:w height:h in:self.
^ self.
].
@@ -1032,29 +1082,28 @@
self fillDeviceRectangleWithViewBackgroundX:x y:y width:w height:h.
^ self.
].
-
- gcId notNil ifTrue:[
- org := self viewOrigin.
- patternOffsetX := (org x rounded \\ viewBackground width).
- patternOffsetY := (org y rounded \\ viewBackground height).
- (patternOffsetX ~= 0 or:[patternOffsetY ~= 0]) ifTrue:[
- (device supportsMaskedDrawingWithOffset:viewBackground) ifFalse:[
- "/ hand-fill: the device cannot draw with a shifted bitmap pattern underneath.
- self fillDeviceRectangleWithViewBackgroundX:x y:y width:w height:h.
- ^ self.
- ].
- ].
- device setMaskOriginX:patternOffsetX negated y:patternOffsetY negated in:gcId
+
+ org := self viewOrigin.
+ patternOffsetX := (org x rounded \\ viewBackground width).
+ patternOffsetY := (org y rounded \\ viewBackground height).
+ (patternOffsetX ~= 0 or:[patternOffsetY ~= 0]) ifTrue:[
+ (device supportsMaskedDrawingWithOffset:viewBackground) ifFalse:[
+ "/ hand-fill: the device cannot draw with a shifted bitmap pattern underneath.
+ self fillDeviceRectangleWithViewBackgroundX:x y:y width:w height:h.
+ ^ self.
+ ].
].
+ gc setDeviceMaskOriginX:patternOffsetX negated y:patternOffsetY negated.
].
"
fill in device coordinates - not logical coordinates
"
- oldPaint := paint.
- self paint:viewBackground.
- self fillDeviceRectangleX:x y:y width:w height:h "with:viewBackground".
- self paint:oldPaint
+ oldPaint := self paint.
+ self
+ paint:viewBackground;
+ fillDeviceRectangleX:x y:y width:w height:h "with:viewBackground";
+ paint:oldPaint.
"Modified: / 4.5.1999 / 13:00:34 / cg"
!
@@ -1064,32 +1113,28 @@
redefined since GraphicsMedium fills with background
- not viewBackground as we want here."
- |pX pY nW nH rect|
-
- transformation notNil ifTrue:[
- rect := transformation transformRectangle:(Rectangle left:x top:y width:w height:h).
- pX := rect left.
- pY := rect top.
- nW := rect width.
- nH := rect height.
+ |pX pY pW pH currentTransformation|
+
+ currentTransformation := gc transformation.
+ currentTransformation notNil ifTrue:[
+ pX := currentTransformation applyToX:x.
+ pY := currentTransformation applyToY:y.
+ pW := currentTransformation applyScaleX:w.
+ pH := currentTransformation applyScaleY:h.
] ifFalse:[
pX := x.
pY := y.
- nW := w.
- nH := h.
+ pW := w.
+ pH := h.
].
- pX := pX rounded.
- pY := pY rounded.
- nW := nW ceiling.
- nH := nH ceiling.
-
- ^ self clearDeviceRectangleX:pX y:pY width:nW height:nH.
+ ^ self clearDeviceRectangleX:pX rounded y:pY rounded width:pW ceiling height:pH ceiling.
"Modified: / 30.10.1998 / 15:00:37 / cg"
!
fillDeviceRectangleWithPattern:aPixmap x:xIn y:yIn width:wIn height:hIn patternOffset:pattOffs
+ <resource: #obsolete>
"fill a rectangular area with some pattern.
A helper for devices which do not support pixmap drawing (i.e. win95).
This is never invoked with X11 or Win-NT/XP/Vista systems.
@@ -1124,10 +1169,10 @@
oldClip := self deviceClippingRectangle.
oldClip notNil ifTrue:[
- x := x max:oldClip left.
- y := y max:oldClip top.
- r := r min:oldClip right.
- b := b min:oldClip bottom.
+ x := x max:oldClip left.
+ y := y max:oldClip top.
+ r := r min:oldClip right.
+ b := b min:oldClip bottom.
].
w := r-x+1.
h := b-y+1.
@@ -1143,16 +1188,16 @@
xR0 >= xE ifTrue:[^ self].
aPixmap depth == 1 ifTrue:[
- oldFg := foreground.
- oldBg := background.
- (clrMap := aPixmap colorMap) notNil ifTrue:[
- bg := clrMap at:1.
- fg := clrMap at:2.
- ] ifFalse:[
- bg := Color white.
- fg := Color black.
- ].
- self foreground:fg background:bg.
+ oldFg := self foreground.
+ oldBg := self background.
+ (clrMap := aPixmap colorMap) notNil ifTrue:[
+ bg := clrMap at:1.
+ fg := clrMap at:2.
+ ] ifFalse:[
+ bg := Color white.
+ fg := Color black.
+ ].
+ self foreground:fg background:bg.
].
self deviceClippingRectangle:(Rectangle left:x top:y width:w height:h).
@@ -1161,24 +1206,24 @@
oY := offsY.
[yR < yE] whileTrue:[
- xR := xR0.
- oX := offsX.
- [xR < xE] whileTrue:[
- self
- copyFrom:aPixmap
- x:oX y:oY
- toX:xR y:yR
- width:(pW - oX) height:(pH - oY)
- async:true.
- xR := xR + pW - oX.
- oX := 0.
- ].
- yR := yR + pH - oY.
- oY := 0.
+ xR := xR0.
+ oX := offsX.
+ [xR < xE] whileTrue:[
+ self
+ copyFrom:aPixmap
+ x:oX y:oY
+ toX:xR y:yR
+ width:(pW - oX) height:(pH - oY)
+ async:true.
+ xR := xR + pW - oX.
+ oX := 0.
+ ].
+ yR := yR + pH - oY.
+ oY := 0.
].
oldFg notNil ifTrue:[
- self foreground:oldFg background:oldBg.
+ self foreground:oldFg background:oldBg.
].
self deviceClippingRectangle:oldClip.
@@ -1188,49 +1233,46 @@
!
fillDeviceRectangleWithViewBackgroundX:xIn y:yIn width:wIn height:hIn
+ <resource: #obsolete>
"fill a rectangular area with the viewBackground.
A helper for devices which do not support background pixmaps (i.e. win95 screens).
This is never invoked with X11 or Win-NT/XP/Vista systems.
Caller must ensure that the viewBackground is really a form"
self
- fillDeviceRectangleWithPattern:viewBackground
- x:xIn y:yIn width:wIn height:hIn
- patternOffset:self viewOrigin
+ fillDeviceRectangleWithPattern:viewBackground
+ x:xIn y:yIn width:wIn height:hIn
+ patternOffset:self viewOrigin
!
fillRectangleWithPattern:aPixmap x:x y:y width:w height:h patternOffset:pattOffs
+ <resource: #obsolete>
"fill a rectangular area with aPixmap.
A helper for devices which do not support pixmap filling (i.e. win95 screens).
This is never invoked with X11 or Win-NT/XP/Vista systems.
Caller must ensure that the aPixmap is really a form"
- |pX pY nW nH pO pC|
-
- gcId isNil ifTrue:[
- self initGC
- ].
- transformation notNil ifTrue:[
- pO := transformation transformPoint:x@y.
- pC := transformation transformPoint:(x+w-1)@(y+h-1).
- pX := pO x.
- pY := pO y.
- nW := pC x - pX + 1.
- nH := pC y - pY + 1.
-
- nW < 0 ifTrue:[
- nW := nW abs.
- pX := pX - nW.
- ].
- nH < 0 ifTrue:[
- nH := nH abs.
- pY := pY - nH.
- ].
+ |pX pY nW nH currentTransformation|
+
+ currentTransformation := gc transformation.
+ currentTransformation notNil ifTrue:[
+ pX := currentTransformation applyToX:x.
+ pY := currentTransformation applyToY:y.
+ nW := currentTransformation applyScaleX:w.
+ nH := currentTransformation applyScaleY:h.
+ nW < 0 ifTrue:[
+ nW := nW abs.
+ pX := pX - nW.
+ ].
+ nH < 0 ifTrue:[
+ nH := nH abs.
+ pY := pY - nH.
+ ].
] ifFalse:[
- pX := x.
- pY := y.
- nW := w.
- nH := h.
+ pX := x.
+ pY := y.
+ nW := w.
+ nH := h.
].
pX := pX rounded.
pY := pY rounded.
@@ -1238,23 +1280,24 @@
nH := nH rounded.
self
- fillDeviceRectangleWithPattern:aPixmap
- x:pX y:pY width:nW height:nH
- patternOffset:pattOffs
+ fillDeviceRectangleWithPattern:aPixmap
+ x:pX y:pY width:nW height:nH
+ patternOffset:pattOffs
"Modified: 4.6.1996 / 17:58:49 / cg"
!
fillRectangleWithViewBackgroundX:x y:y width:w height:h
+ <resource: #obsolete>
"fill a rectangular area with the viewBackground.
A helper for devices which do not support background pixmaps (i.e. win95 screens).
This is never invoked with X11 or Win-NT/XP/Vista systems.
Caller must ensure that the viewBackground is really a form"
self
- fillRectangleWithPattern:viewBackground
- x:x y:y width:w height:h
- patternOffset:self viewOrigin
+ fillRectangleWithPattern:viewBackground
+ x:x y:y width:w height:h
+ patternOffset:self viewOrigin
!
redraw
@@ -1317,9 +1360,9 @@
this is a private (internal) method not to be used externally.
for a list of allowed event symbols see Workstation class"
- eventMask := eventMask bitAnd:(device eventMaskFor:anEventSymbol) bitInvert.
- drawableId notNil ifTrue:[
- device setEventMask:eventMask in:drawableId
+ eventMask := eventMask bitAnd:(self graphicsDevice eventMaskFor:anEventSymbol) bitInvert.
+ self drawableId notNil ifTrue:[
+ self graphicsDevice setEventMask:eventMask in:self drawableId
]
!
@@ -1378,9 +1421,9 @@
this is a private (internal) method not to be used externally.
for a list of allowed event symbols see Workstation class"
- eventMask := (eventMask ? 0) bitOr:(device eventMaskFor:anEventSymbol).
- drawableId notNil ifTrue:[
- device setEventMask:eventMask in:drawableId
+ eventMask := (eventMask ? 0) bitOr:(self graphicsDevice eventMaskFor:anEventSymbol).
+ self drawableId notNil ifTrue:[
+ self graphicsDevice setEventMask:eventMask in:self drawableId
]
!
@@ -1472,106 +1515,106 @@
rect x y w h delegatedEvent rgn|
type == #damage ifTrue:[
- "/ OLDdamage scheme - this will vanish
- self shown ifTrue:[
- rect := argArray.
- x := rect left.
- y := rect top.
- w := rect width.
- h := rect height.
- transformation notNil ifTrue:[
- self deviceExposeX:x y:y width:w height:h
- ] ifFalse:[
- self exposeX:x y:y width:w height:h
- ]
- ].
- ^ self
+ "/ OLDdamage scheme - this will vanish
+ self shown ifTrue:[
+ rect := argArray.
+ x := rect left.
+ y := rect top.
+ w := rect width.
+ h := rect height.
+ gc transformation notNil ifTrue:[
+ self deviceExposeX:x y:y width:w height:h
+ ] ifFalse:[
+ self exposeX:x y:y width:w height:h
+ ]
+ ].
+ ^ self
].
type == #newDamage ifTrue:[
- "/ New damage scheme
- rgn := updateRegion.
- updateRegion := nil.
- self shown ifTrue:[
- rgn notNil ifTrue:[
- rgn do:[:rect |
- "/ cg: I think the check for being realized may not be enough;
- "/ there is a race here, if the view gets closed, while in the loop...
- realized ifTrue:[
- x := rect left.
- y := rect top.
- w := rect width.
- h := rect height.
- transformation notNil ifTrue:[
- self deviceExposeX:x y:y width:w height:h
- ] ifFalse:[
- self exposeX:x y:y width:w height:h
- ]
- ]
- ]
- ]
- ].
- ^ self
+ "/ New damage scheme
+ rgn := updateRegion.
+ updateRegion := nil.
+ self shown ifTrue:[
+ rgn notNil ifTrue:[
+ rgn do:[:rect |
+ "/ cg: I think the check for being realized may not be enough;
+ "/ there is a race here, if the view gets closed, while in the loop...
+ realized ifTrue:[
+ x := rect left.
+ y := rect top.
+ w := rect width.
+ h := rect height.
+ gc transformation notNil ifTrue:[
+ self deviceExposeX:x y:y width:w height:h
+ ] ifFalse:[
+ self exposeX:x y:y width:w height:h
+ ]
+ ]
+ ]
+ ]
+ ].
+ ^ self
].
isKeyEvent := isButtonEvent := isPointerEvent := isMouseWheelEvent := isExposeEvent := false.
(type == #'keyPress:x:y:') ifTrue:[
- isKeyEvent := true.
- deviceMessage := #'deviceKeyPress:x:y:'.
- delegateMessage := #'keyPress:x:y:view:'.
- delegateQuery := #'handlesKeyPress:inView:'.
+ isKeyEvent := true.
+ deviceMessage := #'deviceKeyPress:x:y:'.
+ delegateMessage := #'keyPress:x:y:view:'.
+ delegateQuery := #'handlesKeyPress:inView:'.
] ifFalse:[ (type == #'keyRelease:x:y:') ifTrue:[
- isKeyEvent := true.
- deviceMessage := #'deviceKeyRelease:x:y:'.
- delegateMessage := #'keyRelease:x:y:view:'.
- delegateQuery := #'handlesKeyRelease:inView:'.
+ isKeyEvent := true.
+ deviceMessage := #'deviceKeyRelease:x:y:'.
+ delegateMessage := #'keyRelease:x:y:view:'.
+ delegateQuery := #'handlesKeyRelease:inView:'.
] ifFalse:[ (type == #'buttonMotion:x:y:') ifTrue:[
- isButtonEvent := true.
- deviceMessage := #'deviceButtonMotion:x:y:'.
- delegateMessage := #'buttonMotion:x:y:view:'.
- delegateQuery := #'handlesButtonMotion:inView:'.
+ isButtonEvent := true.
+ deviceMessage := #'deviceButtonMotion:x:y:'.
+ delegateMessage := #'buttonMotion:x:y:view:'.
+ delegateQuery := #'handlesButtonMotion:inView:'.
] ifFalse:[ (type == #'buttonPress:x:y:') ifTrue:[
- isButtonEvent := true.
- deviceMessage := #'deviceButtonPress:x:y:'.
- delegateMessage := #'buttonPress:x:y:view:'.
- delegateQuery := #'handlesButtonPress:inView:'.
+ isButtonEvent := true.
+ deviceMessage := #'deviceButtonPress:x:y:'.
+ delegateMessage := #'buttonPress:x:y:view:'.
+ delegateQuery := #'handlesButtonPress:inView:'.
] ifFalse:[ (type == #'buttonRelease:x:y:') ifTrue:[
- isButtonEvent := true.
- deviceMessage := #'deviceButtonRelease:x:y:'.
- delegateMessage := #'buttonRelease:x:y:view:'.
- delegateQuery := #'handlesButtonRelease:inView:'.
+ isButtonEvent := true.
+ deviceMessage := #'deviceButtonRelease:x:y:'.
+ delegateMessage := #'buttonRelease:x:y:view:'.
+ delegateQuery := #'handlesButtonRelease:inView:'.
] ifFalse:[ (type == #'buttonShiftPress:x:y:') ifTrue:[
- isButtonEvent := true.
- deviceMessage := #'deviceButtonShiftPress:x:y:'.
- delegateMessage := #'buttonShiftPress:x:y:view:'.
- delegateQuery := #'handlesButtonShiftPress:inView:'.
+ isButtonEvent := true.
+ deviceMessage := #'deviceButtonShiftPress:x:y:'.
+ delegateMessage := #'buttonShiftPress:x:y:view:'.
+ delegateQuery := #'handlesButtonShiftPress:inView:'.
] ifFalse:[ (type == #'buttonMultiPress:x:y:') ifTrue:[
- isButtonEvent := true.
- deviceMessage := #'deviceButtonMultiPress:x:y:'.
- delegateMessage := #'buttonMultiPress:x:y:view:'.
- delegateQuery := #'handlesButtonMultiPress:inView:'.
+ isButtonEvent := true.
+ deviceMessage := #'deviceButtonMultiPress:x:y:'.
+ delegateMessage := #'buttonMultiPress:x:y:view:'.
+ delegateQuery := #'handlesButtonMultiPress:inView:'.
] ifFalse:[ (type == #mouseWheelMotion:x:y:amount:deltaTime:) ifTrue:[
- isMouseWheelEvent := true.
- deviceMessage := type.
- delegateMessage := #mouseWheelMotion:x:y:amount:deltaTime:view:.
- delegateQuery := #handlesMouseWheelMotion:inView:.
+ isMouseWheelEvent := true.
+ deviceMessage := type.
+ delegateMessage := #mouseWheelMotion:x:y:amount:deltaTime:view:.
+ delegateQuery := #handlesMouseWheelMotion:inView:.
] ifFalse:[ (type == #'pointerEnter:x:y:') ifTrue:[
- isPointerEvent := true.
- deviceMessage := #'devicePointerEnter:x:y:'.
- delegateMessage := #'pointerEnter:x:y:view:'.
- delegateQuery := #'handlesPointerEnter:inView:'.
+ isPointerEvent := true.
+ deviceMessage := #'devicePointerEnter:x:y:'.
+ delegateMessage := #'pointerEnter:x:y:view:'.
+ delegateQuery := #'handlesPointerEnter:inView:'.
] ifFalse:[ (type == #'pointerLeave:') ifTrue:[
- isPointerEvent := true.
- deviceMessage := type.
- delegateMessage := #'pointerLeave:view:'.
- delegateQuery := #'handlesPointerLeave:inView:'.
+ isPointerEvent := true.
+ deviceMessage := type.
+ delegateMessage := #'pointerLeave:view:'.
+ delegateQuery := #'handlesPointerLeave:inView:'.
] ifFalse:[ (type == #'exposeX:y:width:height:') ifTrue:[
- isExposeEvent := true.
- deviceMessage := #'deviceExposeX:y:width:height:'.
+ isExposeEvent := true.
+ deviceMessage := #'deviceExposeX:y:width:height:'.
] ifFalse:[ (type == #'graphicsExposeX:y:width:height:final:') ifTrue:[
- isExposeEvent := true.
- deviceMessage := #'deviceGraphicsExposeX:y:width:height:final:'.
+ isExposeEvent := true.
+ deviceMessage := #'deviceGraphicsExposeX:y:width:height:final:'.
]]]]]]]]]]]].
"
@@ -1582,56 +1625,59 @@
"
((isKeyEvent "or:[isMouseWheelEvent]")
and:[focusView notNil and:[self ~~ focusView]]) ifTrue:[
- delegatedEvent := ev shallowCopy.
- delegatedEvent delegatedFrom:ev.
- delegatedEvent arguments:(ev arguments shallowCopy).
- delegatedEvent x:-1; y:-1.
-
- focusView
- dispatchEvent:delegatedEvent
- withFocusOn:nil
- delegate:doDelegate.
- ^ self
+ delegatedEvent := ev shallowCopy.
+ delegatedEvent delegatedFrom:ev.
+ delegatedEvent arguments:(ev arguments shallowCopy).
+ delegatedEvent x:-1; y:-1.
+
+ focusView
+ dispatchEvent:delegatedEvent
+ withFocusOn:nil
+ delegate:doDelegate.
+ ^ self
].
doDelegate ifTrue:[
- "
- handle delegated messages
- "
- (isKeyEvent
- or:[isButtonEvent
- or:[isMouseWheelEvent
- or:[isPointerEvent]]]) ifTrue:[
- delegate := self delegate.
-
- "
- what a kludge - sending to delegate requires
- another selector and an additional argument ...
- "
- (delegate notNil) ifTrue:[
- "
- is the delegate interested in that event ?
- (if it does not respond to the handlesXXX message, assume: NO)
- "
- (delegate askFor:delegateQuery with:(argArray at:1) with:self) ifTrue:[
- "
- mhmh ... have to convert to logical coordinates
- "
- transformation notNil ifTrue:[
- argArray size > 2 ifTrue:[
- argArray at:2 put:(transformation applyInverseToX:(argArray at:2)).
- argArray at:3 put:(transformation applyInverseToY:(argArray at:3)).
- ].
- ].
- argArray isNil ifTrue:[
- delegate perform:delegateMessage with:self
- ] ifFalse:[
- delegate perform:delegateMessage withArguments:(argArray copyWith:self)
- ].
- ^ self
- ]
- ].
- ].
+ "
+ handle delegated messages
+ "
+ (isKeyEvent
+ or:[isButtonEvent
+ or:[isMouseWheelEvent
+ or:[isPointerEvent]]]) ifTrue:[
+ delegate := self delegate.
+
+ "
+ what a kludge - sending to delegate requires
+ another selector and an additional argument ...
+ "
+ (delegate notNil) ifTrue:[
+ "
+ is the delegate interested in that event ?
+ (if it does not respond to the handlesXXX message, assume: NO)
+ "
+ (delegate askFor:delegateQuery with:(argArray at:1) with:self) ifTrue:[
+ "
+ mhmh ... have to convert to logical coordinates
+ "
+ |currentTransformation|
+
+ currentTransformation := gc transformation.
+ currentTransformation notNil ifTrue:[
+ argArray size > 2 ifTrue:[
+ argArray at:2 put:(currentTransformation applyInverseToX:(argArray at:2)).
+ argArray at:3 put:(currentTransformation applyInverseToY:(argArray at:3)).
+ ].
+ ].
+ argArray isNil ifTrue:[
+ delegate perform:delegateMessage with:self
+ ] ifFalse:[
+ delegate perform:delegateMessage withArguments:(argArray copyWith:self)
+ ].
+ ^ self
+ ]
+ ].
+ ].
].
"
@@ -1641,9 +1687,9 @@
or:[isButtonEvent
or:[isMouseWheelEvent
or:[isPointerEvent]]]) ifTrue:[
- realized ifFalse:[
- ^ self
- ]
+ realized ifFalse:[
+ ^ self
+ ]
].
"
@@ -1651,14 +1697,14 @@
"
eventReceiver := self.
(controller := self controller) notNil ifTrue:[
- (isKeyEvent
- or:[isButtonEvent
- or:[isMouseWheelEvent
- or:[isPointerEvent
- or:[(type == #focusIn)
- or:[(type == #focusOut)]]]]]) ifTrue:[
- eventReceiver := controller.
- ]
+ (isKeyEvent
+ or:[isButtonEvent
+ or:[isMouseWheelEvent
+ or:[isPointerEvent
+ or:[(type == #focusIn)
+ or:[(type == #focusOut)]]]]]) ifTrue:[
+ eventReceiver := controller.
+ ]
].
"
@@ -1673,14 +1719,14 @@
"
selector := type.
- transformation notNil ifTrue:[
- (isKeyEvent
- or:[isButtonEvent
- or:[isMouseWheelEvent
- or:[isPointerEvent
- or:[isExposeEvent]]]]) ifTrue:[
- selector := deviceMessage
- ]
+ gc transformation notNil ifTrue:[
+ (isKeyEvent
+ or:[isButtonEvent
+ or:[isMouseWheelEvent
+ or:[isPointerEvent
+ or:[isExposeEvent]]]]) ifTrue:[
+ selector := deviceMessage
+ ]
].
eventReceiver perform:selector withArguments:argArray
@@ -1721,12 +1767,12 @@
|menu|
(menu := self middleButtonMenu) notNil ifTrue:[
- menu isArray ifTrue:[
- "/ a spec array
- menu := menu decodeAsLiteralArray.
- menu receiver:self.
- ].
- menu showAtPointer
+ menu isArray ifTrue:[
+ "/ a spec array
+ menu := menu decodeAsLiteralArray.
+ menu receiver:self.
+ ].
+ menu showAtPointer
]
"Created: 1.3.1996 / 13:24:55 / cg"
@@ -1748,9 +1794,9 @@
"button was pressed - if its middle button and there is a menu, show it."
(button == 2) ifTrue:[
- UserPreferences current showRightButtonMenuOnRelease ifFalse:[
- self activateMenu.
- ].
+ UserPreferences current showRightButtonMenuOnRelease ifFalse:[
+ self activateMenu.
+ ].
]
"Modified: 1.3.1996 / 13:25:07 / cg"
@@ -1758,9 +1804,9 @@
buttonRelease:button x:x y:y
(button == 2) ifTrue:[
- UserPreferences current showRightButtonMenuOnRelease ifTrue:[
- self activateMenu.
- ].
+ UserPreferences current showRightButtonMenuOnRelease ifTrue:[
+ self activateMenu.
+ ].
].
!
@@ -1813,14 +1859,15 @@
those which are interested in logical coordinates
should redefine #buttonMotion:x:y:"
- |lx ly|
+ |lx ly currentTransformation|
lx := x.
ly := y.
- transformation notNil ifTrue:[
+ currentTransformation := gc transformation.
+ currentTransformation notNil ifTrue:[
lx notNil ifTrue:[
- lx := transformation applyInverseToX:lx.
- ly := transformation applyInverseToY:ly.
+ lx := currentTransformation applyInverseToX:lx.
+ ly := currentTransformation applyInverseToY:ly.
].
].
self buttonMotion:state x:lx y:ly
@@ -1840,14 +1887,15 @@
those which are interested in logical coordinates
should redefine #buttonMultiPress:x:y:"
- |lx ly|
+ |lx ly currentTransformation|
lx := x.
ly := y.
- transformation notNil ifTrue:[
+ currentTransformation := gc transformation.
+ currentTransformation notNil ifTrue:[
lx notNil ifTrue:[
- lx := transformation applyInverseToX:lx.
- ly := transformation applyInverseToY:ly.
+ lx := currentTransformation applyInverseToX:lx.
+ ly := currentTransformation applyInverseToY:ly.
].
].
self buttonMultiPress:butt x:lx y:ly
@@ -1867,14 +1915,15 @@
those which are interested in logical coordinates
should redefine #buttonPress:x:y:"
- |lx ly|
+ |lx ly currentTransformation|
lx := x.
ly := y.
- transformation notNil ifTrue:[
+ currentTransformation := gc transformation.
+ currentTransformation notNil ifTrue:[
lx notNil ifTrue:[
- lx := transformation applyInverseToX:lx.
- ly := transformation applyInverseToY:ly.
+ lx := currentTransformation applyInverseToX:lx.
+ ly := currentTransformation applyInverseToY:ly.
].
].
self buttonPress:butt x:lx y:ly
@@ -1894,14 +1943,15 @@
those which are interested in logical coordinates
should redefine #buttonRelease:x:y:"
- |lx ly|
+ |lx ly currentTransformation|
lx := x.
ly := y.
- transformation notNil ifTrue:[
+ currentTransformation := gc transformation.
+ currentTransformation notNil ifTrue:[
lx notNil ifTrue:[
- lx := transformation applyInverseToX:lx.
- ly := transformation applyInverseToY:ly.
+ lx := currentTransformation applyInverseToX:lx.
+ ly := currentTransformation applyInverseToY:ly.
].
].
self buttonRelease:butt x:lx y:ly
@@ -1921,14 +1971,15 @@
those which are interested in logical coordinates
should redefine #buttonShiftPress:x:y:"
- |lx ly|
+ |lx ly currentTransformation|
lx := x.
ly := y.
- transformation notNil ifTrue:[
+ currentTransformation := gc transformation.
+ currentTransformation notNil ifTrue:[
lx notNil ifTrue:[
- lx := transformation applyInverseToX:lx.
- ly := transformation applyInverseToY:ly.
+ lx := currentTransformation applyInverseToX:lx.
+ ly := currentTransformation applyInverseToY:ly.
].
].
self buttonShiftPress:butt x:lx y:ly
@@ -1948,17 +1999,18 @@
those which are interested in logical coordinates
should redefine #exposeX:x:y:width:height:"
- |lx ly lw lh|
+ |lx ly lw lh currentTransformation|
lx := x.
ly := y.
lw := w.
lh := h.
- transformation notNil ifTrue:[
- lx := transformation applyInverseToX:lx.
- ly := transformation applyInverseToY:ly.
- lw := transformation applyInverseScaleX:lw.
- lh := transformation applyInverseScaleY:lh.
+ currentTransformation := gc transformation.
+ currentTransformation notNil ifTrue:[
+ lx := currentTransformation applyInverseToX:lx.
+ ly := currentTransformation applyInverseToY:ly.
+ lw := currentTransformation applyInverseScaleX:lw.
+ lh := currentTransformation applyInverseScaleY:lh.
].
self exposeX:lx y:ly width:lw height:lh
@@ -1977,17 +2029,18 @@
those which are interested in logical coordinates
should redefine #graphicsExposeX:x:y:width:height:"
- |lx ly lw lh|
+ |lx ly lw lh currentTransformation|
lx := x.
ly := y.
lw := w.
lh := h.
- transformation notNil ifTrue:[
- lx := transformation applyInverseToX:lx.
- ly := transformation applyInverseToY:ly.
- lw := transformation applyInverseScaleX:lw.
- lh := transformation applyInverseScaleY:lh.
+ currentTransformation := gc transformation.
+ currentTransformation notNil ifTrue:[
+ lx := currentTransformation applyInverseToX:lx.
+ ly := currentTransformation applyInverseToY:ly.
+ lw := currentTransformation applyInverseScaleX:lw.
+ lh := currentTransformation applyInverseScaleY:lh.
].
self graphicsExposeX:lx y:ly width:lw height:lh final:final
@@ -2006,14 +2059,15 @@
those which are interested in logical coordinates
should redefine #keyPress:x:y:"
- |lx ly|
+ |lx ly currentTransformation|
lx := x.
ly := y.
- transformation notNil ifTrue:[
+ currentTransformation := gc transformation.
+ currentTransformation notNil ifTrue:[
lx notNil ifTrue:[
- lx := transformation applyInverseToX:lx.
- ly := transformation applyInverseToY:ly.
+ lx := currentTransformation applyInverseToX:lx.
+ ly := currentTransformation applyInverseToY:ly.
]
].
self keyPress:key x:lx y:ly
@@ -2033,14 +2087,15 @@
those which are interested in logical coordinates
should redefine #keyRelease:x:y:"
- |lx ly|
+ |lx ly currentTransformation|
lx := x.
ly := y.
- transformation notNil ifTrue:[
+ currentTransformation := gc transformation.
+ currentTransformation notNil ifTrue:[
lx notNil ifTrue:[
- lx := transformation applyInverseToX:lx.
- ly := transformation applyInverseToY:ly.
+ lx := currentTransformation applyInverseToX:lx.
+ ly := currentTransformation applyInverseToY:ly.
]
].
self keyRelease:key x:lx y:ly
@@ -2060,14 +2115,15 @@
those which are interested in logical coordinates
should redefine #pointerEnter:x:y:"
- |lx ly|
+ |lx ly currentTransformation|
lx := x.
ly := y.
- transformation notNil ifTrue:[
+ currentTransformation := gc transformation.
+ currentTransformation notNil ifTrue:[
lx notNil ifTrue:[
- lx := transformation applyInverseToX:lx.
- ly := transformation applyInverseToY:ly.
+ lx := currentTransformation applyInverseToX:lx.
+ ly := currentTransformation applyInverseToY:ly.
]
].
self pointerEnter:state x:lx y:ly
@@ -2113,20 +2169,20 @@
|action rest restKey keyCommands|
(keyCommands := self keyCommands) notNil ifTrue:[
- action := keyCommands at:key ifAbsent:[nil].
- action value
+ action := keyCommands at:key ifAbsent:[nil].
+ action value
].
key isSymbol ifTrue:[
- (key startsWith:'Basic') ifTrue:[
- "/ an unhandled BasicFoo key;
- "/ retry as Foo
- rest := key withoutPrefix:'Basic'.
- restKey := rest asSymbolIfInterned.
- restKey notNil ifTrue:[
- self keyPress:restKey x:x y:y
- ]
- ].
+ (key startsWith:'Basic') ifTrue:[
+ "/ an unhandled BasicFoo key;
+ "/ retry as Foo
+ rest := key withoutPrefix:'Basic'.
+ restKey := rest asSymbolIfInterned.
+ restKey notNil ifTrue:[
+ self keyPress:restKey x:x y:y
+ ]
+ ].
].
"Modified: 6.11.1996 / 17:51:15 / cg"
@@ -2209,8 +2265,8 @@
[self gotExpose] whileFalse:[
realized ifTrue:[
- (device exposeEventPendingFor:drawableId withSync:true) ifTrue:[
- device dispatchExposeEventFor:drawableId.
+ (device exposeEventPendingFor:gc drawableId withSync:true) ifTrue:[
+ device dispatchExposeEventFor:gc drawableId.
].
].
realized ifFalse:[
@@ -2239,43 +2295,10 @@
first destroy menu if there is one and also destroy the GC.
then the view is physically destroyed."
- |id|
-
- self middleButtonMenu:nil.
- self keyCommands:nil.
- id := gcId.
- id notNil ifTrue:[
- gcId := nil.
- device destroyGC:id.
- ].
- self destroyView.
- Lobby unregister:self.
-
- "Modified: 8.2.1997 / 15:50:04 / cg"
-!
-
-destroyGC
- "physically destroy the gc"
-
- |id|
-
- id := gcId.
- id notNil ifTrue:[
- gcId := nil.
- device destroyGC:id.
- ].
-!
-
-destroyView
- "physically destroy the view."
-
- |id|
-
- (id := drawableId) notNil ifTrue:[
- drawableId := nil.
- device destroyView:self withId:id.
- realized := false.
- ].
+ self
+ middleButtonMenu:nil;
+ keyCommands:nil.
+ super destroy.
!
destroyed
@@ -2283,9 +2306,9 @@
|id|
- (id := drawableId) notNil ifTrue:[
- drawableId := nil.
- device removeKnownView:self withId:id.
+ (id := self drawableId) notNil ifTrue:[
+ self setId:nil.
+ self graphicsDevice removeKnownView:self withId:id.
realized := false.
].
self destroy
@@ -2293,22 +2316,6 @@
"Modified: 22.3.1997 / 14:56:34 / cg"
!
-executor
- "redefined for faster creation of finalization copies
- (only device, gcId and drawableId are needed)"
-
- |aCopy container parentId|
-
- container := self container.
- container notNil ifTrue:[ parentId := container id ].
-
- aCopy := DeviceViewHandle basicNew.
- aCopy setDevice:device id:drawableId gcId:gcId parentId:parentId.
- ^ aCopy
-
- "Created: 3.5.1996 / 15:35:13 / stefan"
-!
-
initCursor
"default cursor for all views"
@@ -2328,9 +2335,9 @@
eventMask := 0.
device notNil ifTrue:[
- eventMask := device defaultEventMask.
+ eventMask := device defaultEventMask.
].
- viewBackground := background.
+ viewBackground := gc background.
backed := false.
flags := 0.
self initCursor
@@ -2338,6 +2345,12 @@
"Modified: 18.1.1997 / 18:09:41 / cg"
!
+prepareForReinit
+ gc notNil ifTrue:[
+ gc prepareForReinit.
+ ].
+!
+
reAdjustGeometry
"sent late during snapin processing, nothing done here"
@@ -2348,10 +2361,12 @@
"recreate (i.e. tell X about me) after a snapin or a migration"
viewBackground isColor ifTrue:[
- viewBackground := viewBackground onDevice:device
+ viewBackground := viewBackground onDevice:device.
].
super recreate.
- cursor := cursor onDevice:device.
+ cursor notNil ifTrue:[
+ cursor := cursor onDevice:device.
+ ].
"Modified: 28.3.1997 / 13:48:06 / cg"
!
@@ -2363,14 +2378,8 @@
!
releaseDeviceResources
- self destroyGC.
- self destroyView.
- self unregisterFromLobby.
+ super destroy.
self setDevice:nil id:nil gcId:nil.
-!
-
-unregisterFromLobby
- Lobby unregister:self.
! !
!DisplaySurface methodsFor:'keyboard commands'!
@@ -2413,7 +2422,7 @@
Actually, its a historical leftover"
device flush.
- ^ device eventPending:#buttonMotion for:drawableId
+ ^ device eventPending:#buttonMotion for:gc drawableId
!
buttonReleaseEventPending
@@ -2423,7 +2432,7 @@
Actually, its a historical leftover"
device flush.
- ^ device eventPending:#buttonRelease for:drawableId
+ ^ device eventPending:#buttonRelease for:gc drawableId
!
exposeEventPending
@@ -2435,7 +2444,7 @@
windowGroup notNil ifTrue:[
(windowGroup sensor hasExposeEventFor:self) ifTrue:[^ true].
].
- ^ device eventPending:#expose for:drawableId
+ ^ device eventPending:#expose for:gc drawableId
"Modified: / 15.9.1998 / 23:18:16 / cg"
!
@@ -2548,74 +2557,6 @@
"Modified: 18.5.1996 / 15:44:33 / cg"
! !
-!DisplaySurface::DeviceViewHandle class methodsFor:'documentation'!
-
-documentation
-"
- This is used as a finalization handle for views - in previous systems,
- a shallowCopy of a view was responsible to destroy the underlying
- devices view. To make the memory requirements smaller and to speed up
- view creation a bit, this lightweight class is used now, which only
- keeps the device handle for finalization.
-
- [see also:]
- DeviceHandle DisplaySurface
-
- [author:]
- Claus Gittinger
-"
-! !
-
-!DisplaySurface::DeviceViewHandle methodsFor:'finalization'!
-
-finalize
- "the view for which I am a handle was collected
- - release system resources"
-
- |id|
-
- drawableId notNil ifTrue:[
- [
- (device viewIdKnown:drawableId) ifTrue:[
-"/ 'Display [info]: recycled view (' infoPrint. v infoPrint. ') not destroyed: ' infoPrint.
-"/ drawableId displayString infoPrintCR.
- drawableId := nil.
- ] ifFalse:[
- (id := gcId) notNil ifTrue:[
- gcId := nil.
- device deviceIOErrorSignal handle:[:ex |
- ] do:[
- device destroyGC:id.
- ]
- ].
-
- "/ care for lost-view trouble:
- "/ if the windowID is still registered,
- "/ this may be due to a not-yet-reclaimed
- "/ subview of a view which has already been destroyed
- "/ (X recycles window handles.)
- "/ In this case, we arrive here with a nil-view argument,
- "/ and a windowId, which is already reused for some other view.
- "/ The situation is detected by finding a non-nil (and non-zero)
- "/ view in the devices id<->view table for the given windowId.
-
-"/ 'GC destroy: ' print. drawableId displayString printCR.
-"/ device checkKnownViewId:drawableId.
- id := drawableId.
- drawableId := nil.
- device deviceIOErrorSignal handle:[:ex |
- ] do:[
- device destroyView:nil withId:id.
- ].
- DeviceGraphicsContext cleanupLobbyForChildrenOfViewWithDevice:device id:id.
- ]
- ] valueUninterruptably.
- ].
-
- "Created: / 25.9.1997 / 10:01:46 / stefan"
- "Modified: / 15.11.2001 / 14:17:12 / cg"
-! !
-
!DisplaySurface class methodsFor:'documentation'!
version