--- a/SimpleView.st Fri Nov 18 20:50:35 2016 +0000
+++ b/SimpleView.st Fri Nov 18 21:26:33 2016 +0000
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
"
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
@@ -156,7 +154,9 @@
shown <Boolean> true if visible (false if iconified, unmapped or covered)
- hiddenOnRealize <Boolean> dont show automatically when superview is realized
+ unused_hiddenOnRealize <Boolean> don't show automatically when superview is realized.
+ now encoded in the flags.
+ (kept to keep the instVar size constant)
name <String> my name (future use for resources)
@@ -190,13 +190,14 @@
dependents <nil | Collection> who depends on me
- layoutManager
-
- visibilityChannel
-
- helpKey
-
- dropTarget
+ layoutManager currently unused; will be responsible for
+ child layout management
+
+ visibilityChannel valueHolder to control the visiblity
+
+ helpKey for tooltips
+
+ dropTarget for drag&drop
(*) about to be changed to use preferredExtent as a cache and explicitExtent as
an overwrite value.
@@ -688,7 +689,7 @@
For textViews, the above is also valid, except if the menuHolder is explicitely
set - in this case, that one provides the menu; not the model.
- Dont get confused by the fact that menuHolders are only supported
+ Don't get confused by the fact that menuHolders are only supported
by textViews.
example: (in your application, the plug would be your application, topView or model)
@@ -780,12 +781,12 @@
initialize
DefaultStyle isNil ifTrue:[
- Font initialize.
- Form initialize.
- Color initialize.
+ Font initialize.
+ Form initialize.
+ Color initialize.
].
self == SimpleView ifTrue:[
- Smalltalk addDependent:self "/ to get language changes
+ Smalltalk addDependent:self "/ to get language changes
].
ReturnFocusWhenClosingModalBoxes := true. "/ false.
@@ -848,14 +849,14 @@
newView := self basicNew.
aView notNil ifTrue:[
- viewsDevice := aView graphicsDevice.
+ viewsDevice := aView graphicsDevice.
"/ newView container:aView.
] ifFalse:[
- viewsDevice := Screen current
+ viewsDevice := Screen current
].
newView initializeForDevice:viewsDevice.
(viewsDevice supportsNativeWidgetType:newView nativeWindowType) ifTrue:[
- newView beNativeWidget
+ newView beNativeWidget
].
aView notNil ifTrue:[aView addSubView:newView].
^ newView
@@ -904,9 +905,9 @@
|viewsDevice|
anotherView notNil ifTrue:[
- viewsDevice := anotherView graphicsDevice.
+ viewsDevice := anotherView graphicsDevice.
] ifFalse:[
- viewsDevice := Screen current.
+ viewsDevice := Screen current.
].
^ self onDevice:viewsDevice
@@ -1107,12 +1108,12 @@
DefaultFont := aFont.
aFont notNil ifTrue:[
- Display notNil ifTrue:[
- f := aFont onDevice:(Screen current).
- f notNil ifTrue:[
- DefaultFont := f.
- ]
- ]
+ Display notNil ifTrue:[
+ f := aFont onDevice:(Screen current).
+ f notNil ifTrue:[
+ DefaultFont := f.
+ ]
+ ]
]
"Modified: 18.3.1996 / 12:56:20 / cg"
@@ -1134,7 +1135,7 @@
DefaultStyle := aStyle.
MIMETypeIconLibrary notNil ifTrue:[
- MIMETypeIconLibrary flushIcons
+ MIMETypeIconLibrary flushIcons
].
"/ no need to read the stylesheet always here
@@ -1146,9 +1147,9 @@
"/ no need to read the stylesheet, then.
"/ used to be unconditional, before.
StyleSheet notNil ifTrue:[
- (Screen notNil and:[Screen current notNil]) ifTrue:[
- self readStyleSheetAndUpdateAllStyleCaches.
- ].
+ (Screen notNil and:[Screen current notNil]) ifTrue:[
+ self readStyleSheetAndUpdateAllStyleCaches.
+ ].
].
"
@@ -1180,20 +1181,20 @@
|iconLibraryClass |
DefaultStyle isNil ifTrue:[
- self setDefaultStyle
+ self setDefaultStyle
].
StyleSheet := ViewStyle fromFile:(DefaultStyle , '.style').
StyleSheet fileReadFailed ifTrue:[
- ('SimpleView [warning]: ***** no styleSheet for ' , DefaultStyle , '-style.') errorPrintCR.
- DefaultStyle ~~ #normal ifTrue:[
- DefaultStyle := #normal.
- StyleSheet := ViewStyle fromFile:(DefaultStyle , '.style').
-
- StyleSheet fileReadFailed ifTrue:[
- 'SimpleView [warning]: not even a styleSheet for normal-style (using ugly defaults).' errorPrintCR.
- ]
- ]
+ ('SimpleView [warning]: ***** no styleSheet for ' , DefaultStyle , '-style.') errorPrintCR.
+ DefaultStyle ~~ #normal ifTrue:[
+ DefaultStyle := #normal.
+ StyleSheet := ViewStyle fromFile:(DefaultStyle , '.style').
+
+ StyleSheet fileReadFailed ifTrue:[
+ 'SimpleView [warning]: not even a styleSheet for normal-style (using ugly defaults).' errorPrintCR.
+ ]
+ ]
].
iconLibraryClass := StyleSheet at:#ToolbarIconLibrary.
@@ -1249,28 +1250,28 @@
|defStyle|
true "DefaultStyle isNil" ifTrue:[
- defStyle := OperatingSystem getEnvironment:'STX_VIEWSTYLE'.
- defStyle notNil ifTrue:[
- DefaultStyle := defStyle asSymbol.
- ] ifFalse:[
- "/ use XP for both linux and older windows systems;
- DefaultStyle := ViewStyle msWindowsXP.
-
- OperatingSystem isMSWINDOWSlike ifTrue:[
- "/ use Vista for vista and newer systems;
- OperatingSystem isVistaLike ifTrue:[
- DefaultStyle := ViewStyle msWindowsVista.
- OperatingSystem isWin8Like ifTrue:[
- "/ use win8 for 8 and newer systems;
- DefaultStyle := ViewStyle msWindows8
- ].
- ].
- ] ifFalse:[
- OperatingSystem isOSXlike ifTrue:[
- DefaultStyle := #macosx
- ].
- ].
- ].
+ defStyle := OperatingSystem getEnvironment:'STX_VIEWSTYLE'.
+ defStyle notNil ifTrue:[
+ DefaultStyle := defStyle asSymbol.
+ ] ifFalse:[
+ "/ use XP for both linux and older windows systems;
+ DefaultStyle := ViewStyle msWindowsXP.
+
+ OperatingSystem isMSWINDOWSlike ifTrue:[
+ "/ use Vista for vista and newer systems;
+ OperatingSystem isVistaLike ifTrue:[
+ DefaultStyle := ViewStyle msWindowsVista.
+ OperatingSystem isWin8Like ifTrue:[
+ "/ use win8 for 8 and newer systems;
+ DefaultStyle := ViewStyle msWindows8
+ ].
+ ].
+ ] ifFalse:[
+ OperatingSystem isOSXlike ifTrue:[
+ DefaultStyle := #macosx
+ ].
+ ].
+ ].
].
"Modified: / 03-02-2011 / 21:41:35 / cg"
@@ -1320,14 +1321,14 @@
SimpleView updateStyleCache.
SimpleView allSubclassesDo:[:aClass |
aClass defaultFont:nil.
- (aClass class includesSelector:#updateStyleCache) ifTrue:[
- aClass updateStyleCache
- ].
+ (aClass class includesSelector:#updateStyleCache) ifTrue:[
+ aClass updateStyleCache
+ ].
].
"/ use #at: to avoid introducing a depency to libview2
(Smalltalk at:#MIMETypeIconLibrary) notNil ifTrue:[
- (Smalltalk at:#MIMETypeIconLibrary) flushIcons
+ (Smalltalk at:#MIMETypeIconLibrary) flushIcons
].
@@ -1953,15 +1954,15 @@
|clr|
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[
- ^ superView borderColor
+ ^ superView borderColor
].
"/ ^ borderColor
border notNil ifTrue:[
- clr := border color
+ clr := border color
].
clr isNil ifTrue:[
- ^ self blackColor
+ ^ self blackColor
].
^ clr.
@@ -2002,18 +2003,18 @@
"set the borderShape to aForm"
aForm isNil ifTrue:[
- viewShape := nil.
- self drawableId notNil ifTrue:[
- device setWindowBorderShape:nil in:self drawableId
- ]
+ viewShape := nil.
+ self drawableId notNil ifTrue:[
+ device setWindowBorderShape:nil in:self drawableId
+ ]
] ifFalse:[
- viewShape isNil ifTrue:[
- viewShape := ArbitraryViewShape new
- ].
- viewShape borderShapeForm:aForm.
- self drawableId notNil ifTrue:[
- device setWindowBorderShape:(aForm id) in:self drawableId
- ]
+ viewShape isNil ifTrue:[
+ viewShape := ArbitraryViewShape new
+ ].
+ viewShape borderShapeForm:aForm.
+ self drawableId notNil ifTrue:[
+ device setWindowBorderShape:(aForm id) in:self drawableId
+ ]
]
"Modified: 18.9.1997 / 11:09:40 / cg"
@@ -2166,10 +2167,10 @@
"return the color to be used for lighted edges (3D only)"
lightColor isNil ifTrue:[
- |avgColor|
+ |avgColor|
- avgColor := viewBackground averageColorIn:(0@0 corner:7@7).
- lightColor := avgColor lightened.
+ avgColor := viewBackground averageColorIn:(0@0 corner:7@7).
+ lightColor := avgColor lightened.
].
^ lightColor
!
@@ -2220,10 +2221,10 @@
"return the color to be used for shadowed edges (3D only)"
shadowColor isNil ifTrue:[
- |avgColor|
-
- avgColor := viewBackground averageColorIn:(0@0 corner:7@7).
- shadowColor := avgColor darkened.
+ |avgColor|
+
+ avgColor := viewBackground averageColorIn:(0@0 corner:7@7).
+ shadowColor := avgColor darkened.
].
^ shadowColor
!
@@ -2246,7 +2247,7 @@
self assert:(something notNil) message:'invalid viewBackground argument'.
something isColor ifTrue:[
- device hasGrayscales ifTrue:[
+ (device notNil and:[device hasGrayscales]) ifTrue:[
avgColor := something averageColorIn:(0@0 corner:7@7).
shadowColor := avgColor darkened "on:device".
lightColor := avgColor lightened "on:device".
@@ -2273,19 +2274,19 @@
"set the viewShape to aForm"
aForm isNil ifTrue:[
- viewShape := nil.
- self drawableId notNil ifTrue:[
- device setWindowShape:nil in:self drawableId
- ]
+ viewShape := nil.
+ self drawableId notNil ifTrue:[
+ device setWindowShape:nil in:self drawableId
+ ]
] ifFalse:[
- viewShape isNil ifTrue:[
- viewShape := ArbitraryViewShape new
- ].
-
- viewShape viewShapeForm:aForm.
- self drawableId notNil ifTrue:[
- device setWindowShape:(aForm id) in:self drawableId
- ]
+ viewShape isNil ifTrue:[
+ viewShape := ArbitraryViewShape new
+ ].
+
+ viewShape viewShapeForm:aForm.
+ self drawableId notNil ifTrue:[
+ device setWindowShape:(aForm id) in:self drawableId
+ ]
]
"Modified: 18.9.1997 / 11:11:04 / cg"
@@ -2732,7 +2733,7 @@
self extentChangedFlag:true
]
] ifFalse:[
- extentRule := nil.
+ extentRule := nil.
w := extent x.
h := extent y.
w isNil ifTrue:[w := width].
@@ -2843,7 +2844,7 @@
!
initialExtent:extent
- "set the views extent, but dont change its explicitExtent setting.
+ "set the views extent, but don't change its explicitExtent setting.
a variant of #extent."
|expl|
@@ -2854,13 +2855,13 @@
!
initialHeight:aNumber
- "set the views height in pixels, but dont change its explicitExtent setting"
+ "set the views height in pixels, but don't change its explicitExtent setting"
self initialExtent:(width @ aNumber)
!
initialWidth:aNumber
- "set the views width in pixels, but dont change its explicitExtent setting"
+ "set the views width in pixels, but don't change its explicitExtent setting"
self initialExtent:(aNumber @ height)
!
@@ -3021,19 +3022,19 @@
cornerVisible := myDevice pointIsVisible:corner.
(myDevice pointsAreOnSameMonitor:origin and:corner) ifTrue:[
- referencePoint := origin.
+ referencePoint := origin.
] ifFalse:[
- originVisible ifTrue:[
- "origin is visible"
- referencePoint := origin.
- ] ifFalse:[
- cornerVisible notNil ifTrue:[
- "corner is visible"
- referencePoint := corner.
- ] ifFalse:[
- referencePoint := 1@1.
- ].
- ].
+ originVisible ifTrue:[
+ "origin is visible"
+ referencePoint := origin.
+ ] ifFalse:[
+ cornerVisible notNil ifTrue:[
+ "corner is visible"
+ referencePoint := corner.
+ ] ifFalse:[
+ referencePoint := 1@1.
+ ].
+ ].
].
deviceBounds := myDevice monitorBoundsAt:referencePoint.
@@ -3046,40 +3047,40 @@
cornerVisible ifTrue:[ deviceBottom := deviceBottom min:(myDevice usableHeightAt:corner) ].
corner y > deviceBottom ifTrue:[
- cornerVisible := false.
+ cornerVisible := false.
].
UserPreferences current forceWindowsIntoMonitorBounds ifFalse:[
- (originVisible and:[cornerVisible]) ifTrue:[^ self].
+ (originVisible and:[cornerVisible]) ifTrue:[^ self].
].
"/ deviceRight := deviceRight min:device usableWidth.
originVisible ifFalse:[
- cornerVisible ifFalse:[
- newTop := deviceBottom - height.
- newLeft := deviceRight - width.
- newLeft := newLeft max:deviceLeft.
- newTop := newTop max:deviceTop.
- ] ifTrue:[
- "/ origin is not; corner is in
- newLeft := (deviceLeft max:newLeft).
- newTop := (deviceTop max:newTop).
- ].
+ cornerVisible ifFalse:[
+ newTop := deviceBottom - height.
+ newLeft := deviceRight - width.
+ newLeft := newLeft max:deviceLeft.
+ newTop := newTop max:deviceTop.
+ ] ifTrue:[
+ "/ origin is not; corner is in
+ newLeft := (deviceLeft max:newLeft).
+ newTop := (deviceTop max:newTop).
+ ].
] ifTrue:[
- "/ notice, the position-dependent query: if there is a higher secondary screen,
- "/ this makes a difference in where a popUpMenu is allowed...
- (corner y > deviceBottom) ifTrue:[
- newTop := deviceBottom - height
- ].
- (corner x > deviceRight) ifTrue:[
- newLeft := deviceRight - width
- ].
- newLeft := newLeft max:deviceLeft.
- newTop := newTop max:deviceTop.
+ "/ notice, the position-dependent query: if there is a higher secondary screen,
+ "/ this makes a difference in where a popUpMenu is allowed...
+ (corner y > deviceBottom) ifTrue:[
+ newTop := deviceBottom - height
+ ].
+ (corner x > deviceRight) ifTrue:[
+ newLeft := deviceRight - width
+ ].
+ newLeft := newLeft max:deviceLeft.
+ newTop := newTop max:deviceTop.
].
((newTop ~~ top) or:[newLeft ~~ left]) ifTrue:[
- self origin:newLeft @ newTop
+ self origin:newLeft @ newTop
].
"Modified: / 27-10-2012 / 13:15:58 / cg"
@@ -3104,35 +3105,35 @@
"/ ].
device supportsArbitraryShapedViews ifTrue:[
- extent := self extent.
- w := extent x.
- h := extent y.
- borderForm := Form extent:extent.
- shapeForm := Form extent:extent.
-
- borderForm fillArcX:0 y:0
- width:w
- height:h
- from:0
- angle:360.
-
- opaque ifFalse:[
- f := borderForm.
- borderForm foreground:(Color colorId:0).
- ] ifTrue:[
- f := shapeForm.
- shapeForm foreground:(Color colorId:1).
- ].
-
- f fillArcX:(lw := gc lineWidth) y:lw
- width:w - (bw * 2)
- height:h - (bw * 2)
- from:0
- angle:360.
-
- self borderShape:borderForm.
- self viewShape:shapeForm.
- ^ self.
+ extent := self extent.
+ w := extent x.
+ h := extent y.
+ borderForm := Form extent:extent.
+ shapeForm := Form extent:extent.
+
+ borderForm fillArcX:0 y:0
+ width:w
+ height:h
+ from:0
+ angle:360.
+
+ opaque ifFalse:[
+ f := borderForm.
+ borderForm foreground:(Color colorId:0).
+ ] ifTrue:[
+ f := shapeForm.
+ shapeForm foreground:(Color colorId:1).
+ ].
+
+ f fillArcX:(lw := gc lineWidth) y:lw
+ width:w - (bw * 2)
+ height:h - (bw * 2)
+ from:0
+ angle:360.
+
+ self borderShape:borderForm.
+ self viewShape:shapeForm.
+ ^ self.
"/
"/ extent := self extent.
@@ -3183,28 +3184,28 @@
"/ ].
device supportsArbitraryShapedViews ifTrue:[
- extent := self extent.
- w := extent x.
- h := extent y.
- borderForm := Form extent:extent.
- shapeForm := Form extent:extent.
-
- borderForm
- fillRectangleX:0 y:0
- width:w
- height:h.
-
- f := borderForm.
- borderForm foreground:(Color colorId:0).
-
- borderForm
- fillRectangleX:bw y:bw
- width:w - (bw * 2)
- height:h - (bw * 2).
-
- self borderShape:borderForm.
- self viewShape:shapeForm.
- ^ self.
+ extent := self extent.
+ w := extent x.
+ h := extent y.
+ borderForm := Form extent:extent.
+ shapeForm := Form extent:extent.
+
+ borderForm
+ fillRectangleX:0 y:0
+ width:w
+ height:h.
+
+ f := borderForm.
+ borderForm foreground:(Color colorId:0).
+
+ borderForm
+ fillRectangleX:bw y:bw
+ width:w - (bw * 2)
+ height:h - (bw * 2).
+
+ self borderShape:borderForm.
+ self viewShape:shapeForm.
+ ^ self.
]
!
@@ -3352,17 +3353,17 @@
sumX := 0.
sumY := 0.
[currentView notNil] whileTrue:[
- (currentView == aView) ifTrue:[
- ^ (sumX @ sumY)
- ].
- bw := currentView borderWidth.
- sumX := sumX + (currentView left) + bw.
- sumY := sumY + (currentView top) + bw.
- currentView := currentView superView
+ (currentView == aView) ifTrue:[
+ ^ (sumX @ sumY)
+ ].
+ bw := currentView borderWidth.
+ sumX := sumX + (currentView left) + bw.
+ sumY := sumY + (currentView top) + bw.
+ currentView := currentView superView
].
(aView isNil or:[aView == device rootView]) ifTrue:[
- "return relative to screen ..."
- ^ (sumX @ sumY)
+ "return relative to screen ..."
+ ^ (sumX @ sumY)
].
^ nil
@@ -3402,8 +3403,8 @@
"MB:added {" "needed if layout is used e.g. POUEditor"
layout notNil ifTrue:[
- layout isRectangle ifTrue:[
- ^ 0@0
+ layout isRectangle ifTrue:[
+ ^ 0@0
].
^(layout rightFraction) @ (layout bottomFraction)
].
@@ -3445,8 +3446,8 @@
"MB:added {" "needed if layout is used e.g. POUEditor"
layout notNil ifTrue:[
- layout isRectangle ifTrue:[
- ^ 0@0
+ layout isRectangle ifTrue:[
+ ^ 0@0
].
^(layout leftFraction) @ (layout topFraction)
].
@@ -3972,14 +3973,14 @@
the model first, then use the views menu.
"
(menuHolder respondsTo:sym) ifFalse:[
- (self respondsTo:sym) ifTrue:[
- menuHolder := self
- ]
+ (self respondsTo:sym) ifTrue:[
+ menuHolder := self
+ ]
].
sym numArgs > 0 ifTrue:[
- "/ squeak compatibility (with args): create the empty menu here, let model add items
- ^ menuHolder perform:sym withOptionalArgument:(Menu new) and:(device shiftDown).
+ "/ squeak compatibility (with args): create the empty menu here, let model add items
+ ^ menuHolder perform:sym withOptionalArgument:(Menu new) and:(device shiftDown).
].
"
@@ -4002,7 +4003,7 @@
when the view is resized."
bitGravity ~~ gravity ifTrue:[
- bitGravity := gravity.
+ bitGravity := gravity.
gc bitGravity:gravity.
]
!
@@ -4016,53 +4017,53 @@
currentClippingBounds := gc clippingBoundsOrNil.
(currentClippingBounds = aRectangleOrNil) ifTrue:[
- ^ self
+ ^ self
].
newBounds := aRectangleOrNil.
aRectangleOrNil notNil ifTrue:[
- |currentTransformation|
-
- x := aRectangleOrNil left.
- y := aRectangleOrNil top.
- w := aRectangleOrNil width.
- h := aRectangleOrNil height.
- currentTransformation := gc transformation.
- currentTransformation notNil ifTrue:[
- x := currentTransformation applyToX:x.
- y := currentTransformation applyToY:y.
- w := currentTransformation applyScaleX:w.
- h := currentTransformation applyScaleY:h.
- ].
- (x class ~~ SmallInteger) ifTrue:[
- w := w + (x - x truncated).
- x := x truncated
- ].
- (y class ~~ SmallInteger) ifTrue:[
- h := h + (y - y truncated).
- y := y truncated
- ].
- (w class ~~ SmallInteger) ifTrue:[
- w := w truncated + 1
- ].
- (h class ~~ SmallInteger) ifTrue:[
- h := h truncated + 1
- ].
- x < margin ifTrue:[
- x := margin.
- ].
- y < margin ifTrue:[
- y := margin.
- ].
- x + w - 1 >= (width-margin) ifTrue:[
- w := width - margin - x
- ].
- y + h - 1 >= (height-margin) ifTrue:[
- h := height - margin - y
- ].
- w := w max:0.
- h := h max:0.
- newBounds := Rectangle left:x top:y width:w height:h.
+ |currentTransformation|
+
+ x := aRectangleOrNil left.
+ y := aRectangleOrNil top.
+ w := aRectangleOrNil width.
+ h := aRectangleOrNil height.
+ currentTransformation := gc transformation.
+ currentTransformation notNil ifTrue:[
+ x := currentTransformation applyToX:x.
+ y := currentTransformation applyToY:y.
+ w := currentTransformation applyScaleX:w.
+ h := currentTransformation applyScaleY:h.
+ ].
+ (x class ~~ SmallInteger) ifTrue:[
+ w := w + (x - x truncated).
+ x := x truncated
+ ].
+ (y class ~~ SmallInteger) ifTrue:[
+ h := h + (y - y truncated).
+ y := y truncated
+ ].
+ (w class ~~ SmallInteger) ifTrue:[
+ w := w truncated + 1
+ ].
+ (h class ~~ SmallInteger) ifTrue:[
+ h := h truncated + 1
+ ].
+ x < margin ifTrue:[
+ x := margin.
+ ].
+ y < margin ifTrue:[
+ y := margin.
+ ].
+ x + w - 1 >= (width-margin) ifTrue:[
+ w := width - margin - x
+ ].
+ y + h - 1 >= (height-margin) ifTrue:[
+ h := height - margin - y
+ ].
+ w := w max:0.
+ h := h max:0.
+ newBounds := Rectangle left:x top:y width:w height:h.
].
gc deviceClippingBounds:newBounds
@@ -4140,7 +4141,7 @@
when the superView is resized."
viewGravity ~~ gravity ifTrue:[
- viewGravity := gravity.
+ viewGravity := gravity.
gc viewGravity:gravity.
]
! !
@@ -4479,9 +4480,9 @@
be mapped (i.e. shown) automatically when the superview is realized.
The hiddenOnRealize flag is useful to create views which are
to be made visible conditionally or later.
+ Notice: if there is a visibilityChanne, this static flag is ignored.
For ST-80 compatibility, please use #beVisible / #beInvisible."
- "/ hiddenOnRealize := aBoolean
aBoolean ifTrue:[
flagBits := flagBits bitOr:FlagHiddenOnRealize
] ifFalse:[
@@ -4505,9 +4506,9 @@
(especially in panels), which otherwise occur while subviews are removed."
aBoolean ifTrue:[
- flagBits := flagBits bitOr:FlagBeingDestroyed
+ flagBits := flagBits bitOr:FlagBeingDestroyed
] ifFalse:[
- flagBits := flagBits bitClear:FlagBeingDestroyed
+ flagBits := flagBits bitClear:FlagBeingDestroyed
].
!
@@ -4515,10 +4516,14 @@
"return true, if the receiver will NOT be mapped when realized.
False otherwise.
The hiddenOnRealize flag is useful to create views which are
- to be made visible conditionally or later."
-
- ^ flagBits bitTest:FlagHiddenOnRealize.
-
+ to be made visible conditionally or later.
+ Notice: if there is a visibilityChanne, the static flag is ignored."
+
+ visibilityChannel isNil ifTrue:[
+ ^ flagBits bitTest:FlagHiddenOnRealize.
+ ].
+ ^ visibilityChannel value not
+
"Created: 17.6.1997 / 11:21:42 / cg"
!
@@ -4678,7 +4683,7 @@
addComponent:aComponent
"components (i.e. gadgets or lightweight views) are being prepared.
- Dont use this right now for non-views"
+ Don't use this right now for non-views"
aComponent isView ifTrue:[
self addSubView:aComponent
@@ -4790,7 +4795,7 @@
component:aComponent
"components (i.e. gadgets or lightweight views) are being prepared.
- Dont use this right now for non-views"
+ Don't use this right now for non-views"
aComponent origin:0.0@0.0 corner:1.0@1.0.
aComponent isView ifTrue:[
@@ -4832,7 +4837,7 @@
removeComponent:aComponent
"components (i.e. gadgets or lightweight views) are being prepared.
- Dont use this right now for non-views"
+ Don't use this right now for non-views"
aComponent isView ifTrue:[
self removeSubView:aComponent
@@ -4863,10 +4868,10 @@
aView container:self.
(aView graphicsDevice ~~ device) ifTrue:[
- 'SimpleView [warning]: subview (' errorPrint. aView class name errorPrint.
- ') has different device than me (' errorPrint.
- self class name errorPrint. ').' errorPrintCR.
- aView device:device
+ 'SimpleView [warning]: subview (' errorPrint. aView class name errorPrint.
+ ') has different device than me (' errorPrint.
+ self class name errorPrint. ').' errorPrintCR.
+ aView device:device
].
"Created: 9.5.1996 / 00:46:59 / cg"
@@ -4892,9 +4897,9 @@
"an update request"
aspect == #sizeOfView ifTrue:[
- "one of the views we depend on changed its size"
- "/ cg: #containerChangedSize has already been sent by the caller
- ^ self "containerChangedSize".
+ "one of the views we depend on changed its size"
+ "/ cg: #containerChangedSize has already been sent by the caller
+ ^ self "containerChangedSize".
].
super update:aspect with:aParameter from:changedObject
@@ -4943,7 +4948,7 @@
cursors := bitmaps collect:[:form | (Cursor sourceForm:form
maskForm:maskForm
hotX:8
- hotY:8) onDevice:device].
+ hotY:8) onDevice:device].
process := [
Delay waitForSeconds:0.25.
@@ -5019,7 +5024,7 @@
dependents isNil ifTrue:[^ #()].
dependents isCollection ifTrue:[
- ^ dependents
+ ^ dependents
].
^ IdentitySet with:dependents
@@ -5034,11 +5039,11 @@
|dep|
aCollection size == 1 ifTrue:[
- dep := aCollection first.
- dep isCollection ifFalse:[
- dependents := aCollection first.
- ^ self
- ]
+ dep := aCollection first.
+ dep isCollection ifFalse:[
+ dependents := aCollection first.
+ ^ self
+ ]
].
dependents := aCollection
@@ -5054,11 +5059,11 @@
deps := dependents.
deps notNil ifTrue:[
- deps isCollection ifTrue:[
- deps do:aBlock
- ] ifFalse:[
- aBlock value:deps
- ]
+ deps isCollection ifTrue:[
+ deps do:aBlock
+ ] ifFalse:[
+ aBlock value:deps
+ ]
]
"Created: 11.6.1997 / 13:10:51 / cg"
@@ -5341,33 +5346,33 @@
count == 0 ifTrue:[^ self].
(count < 0) ifTrue:[
- leftFg := shadowColor.
- leftHalfFg := halfShadowColor.
- count := count negated.
+ leftFg := shadowColor.
+ leftHalfFg := halfShadowColor.
+ count := count negated.
] ifFalse:[
- leftFg := lightColor.
- leftHalfFg := halfLightColor.
+ leftFg := lightColor.
+ leftHalfFg := halfLightColor.
].
leftHalfFg isNil ifTrue:[
- leftHalfFg := leftFg
+ leftHalfFg := leftFg
].
((edgeStyle == #soft) and:[level > 0]) ifTrue:[
- paint := leftHalfFg
+ paint := leftHalfFg
] ifFalse:[
- paint := leftFg
+ paint := leftFg
].
super paint:paint.
super lineWidth:0.
b := height - 1.
0 to:(count - 1) do:[:i |
- super displayDeviceLineFromX:i y:i toX:i y:(b - i)
+ super displayDeviceLineFromX:i y:i toX:i y:(b - i)
].
((edgeStyle == #soft) and:[level > 2]) ifTrue:[
- super paint:(device blackColor).
- super displayDeviceLineFromX:0 y:0 toX:0 y:b.
+ super paint:(device blackColor).
+ super displayDeviceLineFromX:0 y:0 toX:0 y:b.
].
self edgeDrawn:#left.
@@ -5442,32 +5447,32 @@
count == 0 ifTrue:[^ self].
(count < 0) ifTrue:[
- topFg := shadowColor.
- topHalfFg := halfShadowColor.
- count := count negated
+ topFg := shadowColor.
+ topHalfFg := halfShadowColor.
+ count := count negated
] ifFalse:[
- topFg := lightColor.
- topHalfFg := halfLightColor.
+ topFg := lightColor.
+ topHalfFg := halfLightColor.
].
topHalfFg isNil ifTrue:[
- topHalfFg := topFg
+ topHalfFg := topFg
].
((edgeStyle == #soft) and:[level > 0]) ifTrue:[
- paint := topHalfFg
+ paint := topHalfFg
] ifFalse:[
- paint := topFg
+ paint := topFg
].
super paint:paint.
super lineWidth:0.
r := width - 1.
0 to:(count - 1) do:[:i |
- super displayDeviceLineFromX:i y:y+i toX:(r - i) y:y+i
+ super displayDeviceLineFromX:i y:y+i toX:(r - i) y:y+i
].
((edgeStyle == #soft) and:[level > 2]) ifTrue:[
- super paint:(device blackColor).
- super displayDeviceLineFromX:0 y:y+0 toX:r y:y+0.
+ super paint:(device blackColor).
+ super displayDeviceLineFromX:0 y:y+0 toX:r y:y+0.
].
self edgeDrawn:#top.
@@ -5487,32 +5492,32 @@
count == 0 ifTrue:[^ self].
(count < 0) ifTrue:[
- topFg := shadowColor.
- topHalfFg := halfShadowColor.
- count := count negated
+ topFg := shadowColor.
+ topHalfFg := halfShadowColor.
+ count := count negated
] ifFalse:[
- topFg := lightColor.
- topHalfFg := halfLightColor.
+ topFg := lightColor.
+ topHalfFg := halfLightColor.
].
topHalfFg isNil ifTrue:[
- topHalfFg := topFg
+ topHalfFg := topFg
].
((edgeStyle == #soft) and:[level > 0]) ifTrue:[
- paint := topHalfFg
+ paint := topHalfFg
] ifFalse:[
- paint := topFg
+ paint := topFg
].
super paint:paint.
super lineWidth:0.
r := width - 1.
0 to:(count - 1) do:[:i |
- super displayDeviceLineFromX:i y:i toX:(r - i) y:i
+ super displayDeviceLineFromX:i y:i toX:(r - i) y:i
].
((edgeStyle == #soft) and:[level > 2]) ifTrue:[
- super paint:(device blackColor).
- super displayDeviceLineFromX:0 y:0 toX:r y:0.
+ super paint:(device blackColor).
+ super displayDeviceLineFromX:0 y:0 toX:r y:0.
].
self edgeDrawn:#top.
@@ -5860,74 +5865,74 @@
(superView isNil
and:[self drawableId notNil]) ifTrue:[
- "/ have to be careful - some window managers (motif) wrap another
- "/ view around and the reported origin is relative to that.
- "/ not relative to the screen.
- p := device translatePoint:0@0 fromView:self toView:nil.
- p := p + self borderWidth.
- left := p x.
- top := p y.
+ "/ have to be careful - some window managers (motif) wrap another
+ "/ view around and the reported origin is relative to that.
+ "/ not relative to the screen.
+ p := device translatePoint:0@0 fromView:self toView:nil.
+ p := p + self borderWidth.
+ left := p x.
+ top := p y.
].
((width ~~ newWidth) or:[height ~~ newHeight]) ifTrue:[
- realized ifFalse:[
- width := newWidth.
- height := newHeight.
- self extentChangedFlag:true.
- ^ self
- ].
-
- ((newWidth <= width) and:[newHeight <= height]) ifTrue:[
- how := #smaller
- ] ifFalse:[
- ((newWidth >= width) and:[newHeight >= height]) ifTrue:[
- how := #larger
- ]
- ].
-
- margin ~~ 0 ifTrue:[
- mustRedrawBottomEdge := newHeight < height.
- mustRedrawRightEdge := newWidth < width.
- anyEdge := mustRedrawBottomEdge or:[mustRedrawRightEdge].
-
- mustRedrawPreviousRightBorderArea := newWidth > width.
- mustRedrawPreviousBottomBorderArea := newHeight > height.
- ] ifFalse:[
- anyEdge := mustRedrawPreviousRightBorderArea := mustRedrawPreviousBottomBorderArea := false
- ].
-
- mustRedrawPreviousRightBorderArea ifTrue:[
- self invalidateDeviceRectangle:((width-margin)@0 extent:margin@height) repairNow:false.
- ].
- mustRedrawPreviousBottomBorderArea ifTrue:[
- self invalidateDeviceRectangle:((0 @ (height-margin)) extent:width@margin) repairNow:false.
- ].
-
- width := newWidth.
- height := newHeight.
-
- "recompute inner-clip if needed"
- self setInnerClip.
-
- "
- must first process pending exposes;
- otherwise, those may be drawn at a wrong position
- "
+ realized ifFalse:[
+ width := newWidth.
+ height := newHeight.
+ self extentChangedFlag:true.
+ ^ self
+ ].
+
+ ((newWidth <= width) and:[newHeight <= height]) ifTrue:[
+ how := #smaller
+ ] ifFalse:[
+ ((newWidth >= width) and:[newHeight >= height]) ifTrue:[
+ how := #larger
+ ]
+ ].
+
+ margin ~~ 0 ifTrue:[
+ mustRedrawBottomEdge := newHeight < height.
+ mustRedrawRightEdge := newWidth < width.
+ anyEdge := mustRedrawBottomEdge or:[mustRedrawRightEdge].
+
+ mustRedrawPreviousRightBorderArea := newWidth > width.
+ mustRedrawPreviousBottomBorderArea := newHeight > height.
+ ] ifFalse:[
+ anyEdge := mustRedrawPreviousRightBorderArea := mustRedrawPreviousBottomBorderArea := false
+ ].
+
+ mustRedrawPreviousRightBorderArea ifTrue:[
+ self invalidateDeviceRectangle:((width-margin)@0 extent:margin@height) repairNow:false.
+ ].
+ mustRedrawPreviousBottomBorderArea ifTrue:[
+ self invalidateDeviceRectangle:((0 @ (height-margin)) extent:width@margin) repairNow:false.
+ ].
+
+ width := newWidth.
+ height := newHeight.
+
+ "recompute inner-clip if needed"
+ self setInnerClip.
+
+ "
+ must first process pending exposes;
+ otherwise, those may be drawn at a wrong position
+ "
"/ claus: no; expose events are in the same queue as configure events;
"/ which is exactly for that reason ...
"/ windowGroup notNil ifTrue:[
"/ windowGroup processExposeEvents
"/ ].
- self sizeChanged:how.
-
- (anyEdge and:[shown]) ifTrue:[
- mustRedrawBottomEdge ifTrue:[
- self invalidateDeviceRectangle:((0 @ (height-margin)) extent:width@margin) repairNow:false.
- ].
- mustRedrawRightEdge ifTrue:[
- self invalidateDeviceRectangle:((width-margin)@0 extent:margin@height) repairNow:false.
- ].
+ self sizeChanged:how.
+
+ (anyEdge and:[shown]) ifTrue:[
+ mustRedrawBottomEdge ifTrue:[
+ self invalidateDeviceRectangle:((0 @ (height-margin)) extent:width@margin) repairNow:false.
+ ].
+ mustRedrawRightEdge ifTrue:[
+ self invalidateDeviceRectangle:((width-margin)@0 extent:margin@height) repairNow:false.
+ ].
"/ OLD code:
"/ self clippingRectangle:nil.
"/ mustRedrawBottomEdge ifTrue:[
@@ -5937,11 +5942,11 @@
"/ self drawRightEdge
"/ ].
"/ self deviceClippingRectangle:innerClipRect
- ]
+ ]
].
originChanged ifTrue:[
- dependents notNil ifTrue:[ self changed:#origin ].
+ dependents notNil ifTrue:[ self changed:#origin ].
].
"Modified: / 10.10.2001 / 14:14:19 / cg"
@@ -5962,20 +5967,20 @@
slowly migrating to use layoutObjects ...
"
layout isNil ifTrue:[
- newOrg := self computeOrigin.
- newExt := self computeExtent.
+ newOrg := self computeOrigin.
+ newExt := self computeExtent.
] ifFalse:[layout isAssociation ifTrue:[
- layout key == #extent ifTrue:[
- newOrg := 1@1.
- newExt := layout value.
- ] ifFalse:[
- self shouldImplement.
- ].
+ layout key == #extent ifTrue:[
+ newOrg := 1@1.
+ newExt := layout value.
+ ] ifFalse:[
+ self shouldImplement.
+ ].
] ifFalse:[
- r := (layout rectangleRelativeTo:(superView viewRectangle)
- preferred:[self preferredBounds]).
- newOrg := r origin rounded.
- newExt := r extent rounded.
+ r := (layout rectangleRelativeTo:(superView viewRectangle)
+ preferred:[self preferredBounds]).
+ newOrg := r origin rounded.
+ newExt := r extent rounded.
"/ newOrg printCR.
"/ newExt printCR.
]].
@@ -6042,9 +6047,9 @@
"/ my subviews (they remember this in the shown instVar)
realized ifTrue:[
- shown ifTrue:[
- self unmapped
- ]
+ shown ifTrue:[
+ self unmapped
+ ]
]
"Modified: 30.5.1996 / 11:41:25 / cg"
@@ -6079,11 +6084,11 @@
"view has been destroyed by someone else (usually window system)"
shown ifTrue:[
- shown := false.
- dependents notNil ifTrue:[
- self changed:#visibility.
+ shown := false.
+ dependents notNil ifTrue:[
+ self changed:#visibility.
self changed:#destroyed
- ].
+ ].
].
super destroyed
@@ -6098,17 +6103,17 @@
(dropTypeSymbol == WindowEvent dropType_file
or:[dropTypeSymbol == WindowEvent dropType_directory]) ifTrue:[
- dropObjects := Array with:(DropObject newFile:dropValue)
+ dropObjects := Array with:(DropObject newFile:dropValue)
] ifFalse:[
- dropTypeSymbol == WindowEvent dropType_files ifTrue:[
- dropObjects := (dropValue collect:[:fn | DropObject newFile:fn])
- ] ifFalse:[
- dropTypeSymbol == WindowEvent dropType_text ifTrue:[
- dropObjects := Array with:(DropObject newText:dropValue)
- ] ifFalse:[
- dropObjects := Array with:(DropObject new:dropValue)
- ]
- ]
+ dropTypeSymbol == WindowEvent dropType_files ifTrue:[
+ dropObjects := (dropValue collect:[:fn | DropObject newFile:fn])
+ ] ifFalse:[
+ dropTypeSymbol == WindowEvent dropType_text ifTrue:[
+ dropObjects := Array with:(DropObject newText:dropValue)
+ ] ifFalse:[
+ dropObjects := Array with:(DropObject new:dropValue)
+ ]
+ ]
].
"/ Transcript showCR:'Drop:'.
@@ -6129,7 +6134,7 @@
|leftEdge topEdge rightEdge botEdge anyEdge nx ny nw nh old oldPaint|
shown ifFalse:[
- ^ self
+ ^ self
].
"/ JV@2016-02-21: Double check to make sure GC is not already destroyed
"/ to avoid 'attempt to draw to closed drawable. Not sure how this could
@@ -6149,110 +6154,110 @@
check if there is a need to draw an edge (i.e. if margin is hit)
"
(margin ~~ 0) ifTrue:[
- |currentTransformation|
-
- leftEdge := false.
- topEdge := false.
- rightEdge := false.
- botEdge := false.
- currentTransformation := gc transformation.
- currentTransformation notNil ifTrue:[
- "
- need device coordinates for this test
- "
- nx := currentTransformation applyToX:nx.
- ny := currentTransformation applyToY:ny.
- nw := currentTransformation applyScaleX:nw.
- nh := currentTransformation applyScaleY:nh.
- ].
- "
- adjust expose rectangle, to exclude the margin.
- Care for rounding errors ...
- "
- (nx class ~~ SmallInteger) ifTrue:[
- old := nx.
- nx := nx truncated.
- nw := nw + (nx - old).
- ].
- (ny class ~~ SmallInteger) ifTrue:[
- old := ny.
- ny := ny truncated.
- nh := nh + (ny - old).
- ].
- (nw class ~~ SmallInteger) ifTrue:[
- nw := nw truncated + 1
- ].
- (nh class ~~ SmallInteger) ifTrue:[
- nh := nh truncated + 1
- ].
-
- (nx < margin) ifTrue:[
- old := nx.
- nx := margin.
- nw := nw - (nx - old).
- leftEdge := anyEdge := true.
- ].
- ((nx + nw - 1) >= (width - margin)) ifTrue:[
- nw := (width - margin - nx).
- rightEdge := anyEdge := true.
- ].
- (ny < margin) ifTrue:[
- old := ny.
- ny := margin.
- nh := nh - (ny - old).
- topEdge := anyEdge := true.
- ].
- ((ny + nh - 1) >= (height - margin)) ifTrue:[
- nh := (height - margin - ny).
- botEdge := anyEdge := true.
- ].
- currentTransformation notNil ifTrue:[
- "
- need logical coordinates for redraw
- "
- nx := currentTransformation applyInverseToX:nx.
- ny := currentTransformation applyInverseToY:ny.
- nw := currentTransformation applyInverseScaleX:nw.
- nh := currentTransformation applyInverseScaleY:nh.
- ].
+ |currentTransformation|
+
+ leftEdge := false.
+ topEdge := false.
+ rightEdge := false.
+ botEdge := false.
+ currentTransformation := gc transformation.
+ currentTransformation notNil ifTrue:[
+ "
+ need device coordinates for this test
+ "
+ nx := currentTransformation applyToX:nx.
+ ny := currentTransformation applyToY:ny.
+ nw := currentTransformation applyScaleX:nw.
+ nh := currentTransformation applyScaleY:nh.
+ ].
+ "
+ adjust expose rectangle, to exclude the margin.
+ Care for rounding errors ...
+ "
+ (nx class ~~ SmallInteger) ifTrue:[
+ old := nx.
+ nx := nx truncated.
+ nw := nw + (nx - old).
+ ].
+ (ny class ~~ SmallInteger) ifTrue:[
+ old := ny.
+ ny := ny truncated.
+ nh := nh + (ny - old).
+ ].
+ (nw class ~~ SmallInteger) ifTrue:[
+ nw := nw truncated + 1
+ ].
+ (nh class ~~ SmallInteger) ifTrue:[
+ nh := nh truncated + 1
+ ].
+
+ (nx < margin) ifTrue:[
+ old := nx.
+ nx := margin.
+ nw := nw - (nx - old).
+ leftEdge := anyEdge := true.
+ ].
+ ((nx + nw - 1) >= (width - margin)) ifTrue:[
+ nw := (width - margin - nx).
+ rightEdge := anyEdge := true.
+ ].
+ (ny < margin) ifTrue:[
+ old := ny.
+ ny := margin.
+ nh := nh - (ny - old).
+ topEdge := anyEdge := true.
+ ].
+ ((ny + nh - 1) >= (height - margin)) ifTrue:[
+ nh := (height - margin - ny).
+ botEdge := anyEdge := true.
+ ].
+ currentTransformation notNil ifTrue:[
+ "
+ need logical coordinates for redraw
+ "
+ nx := currentTransformation applyInverseToX:nx.
+ ny := currentTransformation applyInverseToY:ny.
+ nw := currentTransformation applyInverseScaleX:nw.
+ nh := currentTransformation applyInverseScaleY:nh.
+ ].
].
(nw > 0 and:[nh > 0]) ifTrue:[
- "
- redraw inside area
- "
- self
- clippingBounds:(Rectangle left:nx top:ny width:nw height:nh);
- redrawX:nx y:ny width:nw height:nh.
+ "
+ redraw inside area
+ "
+ self
+ clippingBounds:(Rectangle left:nx top:ny width:nw height:nh);
+ redrawX:nx y:ny width:nw height:nh.
].
"
redraw edge(s)
"
anyEdge ifTrue:[
- self clippingBounds:nil.
- oldPaint := self paint.
- border notNil ifTrue:[
- border displayOn:self forDisplayBox:(Rectangle left:0 top:0 width:width height:height).
- ] ifFalse:[
- (topEdge and:[leftEdge and:[botEdge and:[rightEdge]]]) ifTrue:[
- self drawEdges
- ] ifFalse:[
- topEdge ifTrue:[
- self drawTopEdge
- ].
- leftEdge ifTrue:[
- self drawLeftEdge
- ].
- botEdge ifTrue:[
- self drawBottomEdge
- ].
- rightEdge ifTrue:[
- self drawRightEdge
- ]
- ].
- ].
- self paint:oldPaint.
+ self clippingBounds:nil.
+ oldPaint := self paint.
+ border notNil ifTrue:[
+ border displayOn:self forDisplayBox:(Rectangle left:0 top:0 width:width height:height).
+ ] ifFalse:[
+ (topEdge and:[leftEdge and:[botEdge and:[rightEdge]]]) ifTrue:[
+ self drawEdges
+ ] ifFalse:[
+ topEdge ifTrue:[
+ self drawTopEdge
+ ].
+ leftEdge ifTrue:[
+ self drawLeftEdge
+ ].
+ botEdge ifTrue:[
+ self drawBottomEdge
+ ].
+ rightEdge ifTrue:[
+ self drawRightEdge
+ ]
+ ].
+ ].
+ self paint:oldPaint.
].
gc deviceClippingBounds:innerClipRect.
@@ -6285,7 +6290,9 @@
pass it to the corresponding one.
Otherwise, forward it to the superview, if there is any."
- <resource: #keyboard ( #Menu ) >
+ <resource: #keyboard ( #Menu
+ #ZoomIn #ZoomOut
+ #ZoomInAll #ZoomOutAll) >
|focusView|
@@ -6309,6 +6316,15 @@
^ self activateMenu.
].
+ (key == #ZoomIn or:[key == #ZoomOut]) ifTrue:[
+ self keyboardZoom:(key == #ZoomIn).
+ ^ self
+ ].
+ (key == #ZoomInAll or:[key == #ZoomOutAll]) ifTrue:[
+ self keyboardZoomInAllViews:(key == #ZoomInAll).
+ ^ self
+ ].
+
x isNil ifTrue:[
"/ already redelegated, but nowhere handled
superView notNil ifTrue:[
@@ -6357,7 +6373,16 @@
"CTRL+/- action.
ignored here - redefined in views which can zoom"
-"/ self changeScaleForMouseWheelZoom:amount
+ "/ self changeScaleForMouseWheelZoom:amount
+!
+
+keyboardZoomInAllViews:larger
+ "CTRL+/- zoom action global.
+ Sent to all windows; some may ignore it."
+
+ self device allViewsDo:[:each |
+ each keyboardZoom:larger
+ ].
!
mapped
@@ -6369,9 +6394,9 @@
"
the old code was:
- realized := true.
- shown := true.
- ...
+ realized := true.
+ shown := true.
+ ...
this created a race condition, if the view was
realized and shortly after unrealized - before the mapped event
@@ -6381,41 +6406,41 @@
"
realized ifTrue:[
- shownBefore := shown.
-
- "/ currently, the 'shown ifFalse:' optimization is
- "/ not ok, since 'shown' is also modified by visibilityChanges.
- "/ Also, when remapped, X11 only sends a mapped event for the topView.
- "/ Therefore, synthetically generate those #superViewMapped messages
- "/ in any case.
-
- shown := true.
- "
- backed views will not get expose events - have
- to force a redraw here to get things drawn into
- backing store.
- "
- backed ifTrue:[
- self redrawX:0 y:0 width:width height:height
- ].
-
- "/ tell my subViews ...
- subViews notNil ifTrue:[
+ shownBefore := shown.
+
+ "/ currently, the 'shown ifFalse:' optimization is
+ "/ not ok, since 'shown' is also modified by visibilityChanges.
+ "/ Also, when remapped, X11 only sends a mapped event for the topView.
+ "/ Therefore, synthetically generate those #superViewMapped messages
+ "/ in any case.
+
+ shown := true.
+ "
+ backed views will not get expose events - have
+ to force a redraw here to get things drawn into
+ backing store.
+ "
+ backed ifTrue:[
+ self redrawX:0 y:0 width:width height:height
+ ].
+
+ "/ tell my subViews ...
+ subViews notNil ifTrue:[
subViews do:[:v |
"/ v shown ifFalse:[
- v mapped.
+ v mapped.
"/ ]
- ]
- ].
- shownBefore ~~ true ifTrue:[
- dependents notNil ifTrue:[ self changed:#visibility ].
- ].
- self takeFocusWhenMapped ifTrue:[
- "/ this is a one-shot!!
- self takeFocusWhenMapped:false.
- self assignKeyboardFocusToFirstKeyboardConsumer.
- "/ self requestFocus
- ].
+ ]
+ ].
+ shownBefore ~~ true ifTrue:[
+ dependents notNil ifTrue:[ self changed:#visibility ].
+ ].
+ self takeFocusWhenMapped ifTrue:[
+ "/ this is a one-shot!!
+ self takeFocusWhenMapped:false.
+ self assignKeyboardFocusToFirstKeyboardConsumer.
+ "/ self requestFocus
+ ].
]
"Modified: / 09-12-2010 / 18:12:24 / cg"
@@ -6444,29 +6469,29 @@
horizontal := pageScroll := false.
(UserPreferences current shiftMouseWheelScrollsHorizontally) ifTrue:[
- horizontal := sensor shiftDown
+ horizontal := sensor shiftDown
] ifFalse:[
- pageScroll := sensor shiftDown.
+ pageScroll := sensor shiftDown.
].
pageScroll ifFalse:[
amountToScroll := horizontal
- ifTrue:[ self horizontalScrollStep]
- ifFalse:[ self verticalScrollStep ].
- amountToScroll := self scaleMouseWheelScrollAmount:amountToScroll.
+ ifTrue:[ self horizontalScrollStep]
+ ifFalse:[ self verticalScrollStep ].
+ amountToScroll := self scaleMouseWheelScrollAmount:amountToScroll.
].
amount > 0 ifTrue:[
pageScroll ifTrue:[
- horizontal ifTrue:[self pageLeft] ifFalse:[self pageUp]
+ horizontal ifTrue:[self pageLeft] ifFalse:[self pageUp]
] ifFalse:[
- horizontal ifTrue:[self scrollLeft:amountToScroll] ifFalse:[self scrollUp:amountToScroll]
+ horizontal ifTrue:[self scrollLeft:amountToScroll] ifFalse:[self scrollUp:amountToScroll]
]
] ifFalse:[
pageScroll ifTrue:[
- horizontal ifTrue:[self pageRight] ifFalse:[self pageDown]
+ horizontal ifTrue:[self pageRight] ifFalse:[self pageDown]
] ifFalse:[
- horizontal ifTrue:[self scrollRight:amountToScroll] ifFalse:[self scrollDown:amountToScroll]
+ horizontal ifTrue:[self scrollRight:amountToScroll] ifFalse:[self scrollDown:amountToScroll]
]
].
@@ -6487,18 +6512,18 @@
"/ first ask my flags if its enforced or forbidden
self requestFocusOnPointerEnter ifTrue:[
- doRequestFocus := true
+ doRequestFocus := true
] ifFalse:[
- self doNotRequestFocusOnPointerEnter ifTrue:[
- doRequestFocus := false
- ] ifFalse:[
- "/ then look for the settings.
- doRequestFocus := self wantsFocusWithPointerEnter
- ]
+ self doNotRequestFocusOnPointerEnter ifTrue:[
+ doRequestFocus := false
+ ] ifFalse:[
+ "/ then look for the settings.
+ doRequestFocus := self wantsFocusWithPointerEnter
+ ]
].
doRequestFocus ifTrue:[
- self requestFocus.
+ self requestFocus.
].
dependents notNil ifTrue:[ self changed:#pointerInView ]
@@ -6578,12 +6603,12 @@
|subViews|
viewBackground isViewBackground ifTrue:[
- "/ there is only one, which needs this: a gradient over the actual height/width;
- "/ this cannot just fill the new exposed area, but must recompute the gradient scales
- (viewBackground needsFullRedrawOnChangeOfWidth
- or:[ viewBackground needsFullRedrawOnChangeOfHeight]) ifTrue:[
- self invalidate
- ]
+ "/ there is only one, which needs this: a gradient over the actual height/width;
+ "/ this cannot just fill the new exposed area, but must recompute the gradient scales
+ (viewBackground needsFullRedrawOnChangeOfWidth
+ or:[ viewBackground needsFullRedrawOnChangeOfHeight]) ifTrue:[
+ self invalidate
+ ]
].
(subViews := self subViews) notEmptyOrNil ifTrue:[
@@ -6676,20 +6701,20 @@
|wdgr|
shown ifTrue:[
- shown := false.
- dependents notNil ifTrue:[ self changed:#visibility ].
+ shown := false.
+ dependents notNil ifTrue:[ self changed:#visibility ].
].
(wdgr := self windowGroup) notNil ifTrue:[
- wdgr focusView == self ifTrue:[
- wdgr focusViewUnmapped.
- ].
+ wdgr focusView == self ifTrue:[
+ wdgr focusViewUnmapped.
+ ].
].
subViews notNil ifTrue:[
- subViews do:[:v |
- v containerUnmapped
- ].
- dependents notNil ifTrue:[ self changed:#visibility ].
+ subViews do:[:v |
+ v containerUnmapped
+ ].
+ dependents notNil ifTrue:[ self changed:#visibility ].
]
"Modified: 25.2.1997 / 22:40:52 / cg"
@@ -6704,8 +6729,8 @@
newShown := how ~~ #fullyObscured.
newShown ~~ shown ifTrue:[
- shown := newShown.
- dependents notNil ifTrue:[ self changed:#visibility ].
+ shown := newShown.
+ dependents notNil ifTrue:[ self changed:#visibility ].
].
!
@@ -6902,13 +6927,13 @@
|sequence ev lastView|
(keyOrStringOrSymbol isCharacter or:[keyOrStringOrSymbol isSymbol])
- ifTrue:[ sequence := Array with:keyOrStringOrSymbol ]
- ifFalse:[ sequence := keyOrStringOrSymbol ].
+ ifTrue:[ sequence := Array with:keyOrStringOrSymbol ]
+ ifFalse:[ sequence := keyOrStringOrSymbol ].
sequence do:[:each |
- ev := WindowEvent keyPress:each x:0 y:0 view:self.
- "/ x/y will be set in simulateUserEvent:ev at:aPoint
- lastView := self simulateUserEvent:ev at:aPoint sendDisplayEvent:sendDisplayEvent
+ ev := WindowEvent keyPress:each x:0 y:0 view:self.
+ "/ x/y will be set in simulateUserEvent:ev at:aPoint
+ lastView := self simulateUserEvent:ev at:aPoint sendDisplayEvent:sendDisplayEvent
].
^ lastView
!
@@ -6929,17 +6954,17 @@
|sequence ev1 ev2 lastView|
(keyOrStringOrSymbol isCharacter or:[keyOrStringOrSymbol isSymbol])
- ifTrue:[ sequence := Array with:keyOrStringOrSymbol ]
- ifFalse:[ sequence := keyOrStringOrSymbol ].
+ ifTrue:[ sequence := Array with:keyOrStringOrSymbol ]
+ ifFalse:[ sequence := keyOrStringOrSymbol ].
sequence do:[:each |
- ev1 := WindowEvent keyPress:each x:0 y:0 view:self.
- "/ x/y will be set in simulateUserEvent:ev at:aPoint
- lastView := self simulateUserEvent:ev1 at:aPoint sendDisplayEvent:sendDisplayEvent.
-
- ev2 := WindowEvent keyRelease:each x:0 y:0 view:self.
- "/ x/y will be set in simulateUserEvent:ev at:aPoint
- lastView := self simulateUserEvent:ev2 at:aPoint sendDisplayEvent:sendDisplayEvent.
+ ev1 := WindowEvent keyPress:each x:0 y:0 view:self.
+ "/ x/y will be set in simulateUserEvent:ev at:aPoint
+ lastView := self simulateUserEvent:ev1 at:aPoint sendDisplayEvent:sendDisplayEvent.
+
+ ev2 := WindowEvent keyRelease:each x:0 y:0 view:self.
+ "/ x/y will be set in simulateUserEvent:ev at:aPoint
+ lastView := self simulateUserEvent:ev2 at:aPoint sendDisplayEvent:sendDisplayEvent.
].
^ lastView
!
@@ -6960,13 +6985,13 @@
|sequence ev lastView|
(keyOrStringOrSymbol isCharacter or:[keyOrStringOrSymbol isSymbol])
- ifTrue:[ sequence := Array with:keyOrStringOrSymbol ]
- ifFalse:[ sequence := keyOrStringOrSymbol ].
+ ifTrue:[ sequence := Array with:keyOrStringOrSymbol ]
+ ifFalse:[ sequence := keyOrStringOrSymbol ].
sequence do:[:each |
- ev := WindowEvent keyRelease:each x:0 y:0 view:self.
- "/ x/y will be set in simulateUserEvent:ev at:aPoint
- lastView := self simulateUserEvent:ev at:aPoint sendDisplayEvent:sendDisplayEvent
+ ev := WindowEvent keyRelease:each x:0 y:0 view:self.
+ "/ x/y will be set in simulateUserEvent:ev at:aPoint
+ lastView := self simulateUserEvent:ev at:aPoint sendDisplayEvent:sendDisplayEvent
].
^ lastView
!
@@ -7000,45 +7025,45 @@
|targetView pointXLated|
sendDisplayEvent ifTrue:[
- "/ translate to screen coordinates
- pointXLated := device translatePoint:aPoint from:(self id) to:(device rootWindowId).
- device
- sendKeyOrButtonEvent:ev type
- x:pointXLated x y:pointXLated y
- keyOrButton:(ev isKeyEvent ifTrue:[ev rawKey] ifFalse:[ev button])
- state:(ev modifierFlags)
- toViewId:self id.
- ^ self.
+ "/ translate to screen coordinates
+ pointXLated := device translatePoint:aPoint from:(self id) to:(device rootWindowId).
+ device
+ sendKeyOrButtonEvent:ev type
+ x:pointXLated x y:pointXLated y
+ keyOrButton:(ev isKeyEvent ifTrue:[ev rawKey] ifFalse:[ev button])
+ state:(ev modifierFlags)
+ toViewId:self id.
+ ^ self.
].
(ev isButtonEvent or:[ev isPointerEnterLeaveEvent]) ifTrue:[
- "/ if there is a pointer grab, the event has to sent to that one
+ "/ if there is a pointer grab, the event has to sent to that one
targetView := self device activePointerGrab.
] ifFalse:[
- (ev isKeyEvent) ifTrue:[
- "/ if there is a pointer grab, the event has to sent to that one
+ (ev isKeyEvent) ifTrue:[
+ "/ if there is a pointer grab, the event has to sent to that one
targetView := self device activeKeyboardGrab.
- ].
+ ].
].
targetView isNil ifTrue:[
- ((0@0 corner:self extent) containsPoint:aPoint) ifTrue:[
- self subViews do:[:each |
- |whichView|
-
- whichView := each simulateUserEvent:ev at:(device translatePoint:aPoint fromView:self toView:each).
- whichView notNil ifTrue:[^ whichView].
- ].
- targetView := self.
- ].
+ ((0@0 corner:self extent) containsPoint:aPoint) ifTrue:[
+ self subViews do:[:each |
+ |whichView|
+
+ whichView := each simulateUserEvent:ev at:(device translatePoint:aPoint fromView:self toView:each).
+ whichView notNil ifTrue:[^ whichView].
+ ].
+ targetView := self.
+ ].
].
targetView notNil ifTrue:[
- pointXLated := device translatePoint:aPoint fromView:self toView:targetView.
- ev x:(pointXLated x).
- ev y:(pointXLated y).
- ev view:targetView.
- targetView sensor pushEvent:ev.
- ^ targetView
+ pointXLated := device translatePoint:aPoint fromView:self toView:targetView.
+ ev x:(pointXLated x).
+ ev y:(pointXLated y).
+ ev view:targetView.
+ targetView sensor pushEvent:ev.
+ ^ targetView
].
^ nil
@@ -7055,13 +7080,13 @@
self stopButtonLongPressedHandlerProcess.
p :=
- [
- Delay waitForSeconds:0.7.
- self sensor leftButtonPressed ifTrue:[
- "/ simulate a right-button press
- self buttonPress:2 x:0 y:0
- ]
- ] newProcess.
+ [
+ Delay waitForSeconds:0.7.
+ self sensor leftButtonPressed ifTrue:[
+ "/ simulate a right-button press
+ self buttonPress:2 x:0 y:0
+ ]
+ ] newProcess.
device buttonLongPressedHandlerProcess:p.
p resume.
@@ -7074,8 +7099,8 @@
(p := device buttonLongPressedHandlerProcess) notNil ifTrue:[
"/ Transcript showCR:'stop'.
- device buttonLongPressedHandlerProcess:nil.
- p terminate.
+ device buttonLongPressedHandlerProcess:nil.
+ p terminate.
].
! !
@@ -7086,13 +7111,13 @@
wg := self windowGroup.
wg notNil ifTrue:[
- device isWindowsPlatform ifTrue:[
- wg focusView:aConsumer byTab:true.
- ] ifFalse:[
- aConsumer requestFocus.
- "/ consumer requestFocus. - could be denied; but we force it here
- wg focusView:aConsumer byTab:false.
- ].
+ device isWindowsPlatform ifTrue:[
+ wg focusView:aConsumer byTab:true.
+ ] ifFalse:[
+ aConsumer requestFocus.
+ "/ consumer requestFocus. - could be denied; but we force it here
+ wg focusView:aConsumer byTab:false.
+ ].
].
!
@@ -7113,25 +7138,25 @@
|firstInputField firstConsumer firstCursorConsumer consumer|
self withAllSubViewsDo:[:v |
- v shown ifTrue:[
- (firstInputField isNil and:[v isInputField]) ifTrue:[
- firstInputField := v
- ].
- (firstConsumer isNil and:[v isKeyboardConsumer]) ifTrue:[
- firstConsumer := v
- ].
- (firstCursorConsumer isNil and:[v isCursorKeyConsumer]) ifTrue:[
- firstCursorConsumer := v
- ].
- ].
+ v shown ifTrue:[
+ (firstInputField isNil and:[v isInputField]) ifTrue:[
+ firstInputField := v
+ ].
+ (firstConsumer isNil and:[v isKeyboardConsumer]) ifTrue:[
+ firstConsumer := v
+ ].
+ (firstCursorConsumer isNil and:[v isCursorKeyConsumer]) ifTrue:[
+ firstCursorConsumer := v
+ ].
+ ].
].
(firstInputField notNil and:[self preferFirstInputFieldWhenAssigningInitialFocus]) ifTrue:[
- consumer := firstInputField.
+ consumer := firstInputField.
].
consumer := (consumer ? firstConsumer ? firstCursorConsumer).
"/ Transcript showCR:consumer.
consumer notNil ifTrue:[
- self assignKeyboardFocusTo:consumer
+ self assignKeyboardFocusTo:consumer
].
"Modified: / 29-08-2006 / 14:32:30 / cg"
@@ -7356,7 +7381,7 @@
and:[superView notNil
and:[styleSheet notNil]]) ifTrue:[
(styleSheet at:#'focus.showBorder' default:true) ifTrue:[
- graphicsDevice := device.
+ graphicsDevice := device.
(graphicsDevice supportsWindowBorder:(bd := DefaultFocusBorderWidth)) ifFalse:[
(graphicsDevice supportsWindowBorder:(bd := 1)) ifFalse:[
@@ -7400,7 +7425,7 @@
explicit ifTrue:[
(self drawableId notNil and:[superView notNil]) ifTrue:[
(styleSheet at:#'focus.showBorder' default:true) ifTrue:[
- graphicsDevice := device.
+ graphicsDevice := device.
(graphicsDevice supportsWindowBorder:(bd := self borderWidth)) ifFalse:[
(graphicsDevice supportsWindowBorder:(bd := 1)) ifFalse:[
@@ -7542,8 +7567,8 @@
"/ sensor flushMotionEventsFor:nil
"/ ].
aCursorOrNil notNil ifTrue:[
- cursor := (aCursorOrNil onDevice:device).
- ^ device grabPointerInView:self withCursor:cursor
+ cursor := (aCursorOrNil onDevice:device).
+ ^ device grabPointerInView:self withCursor:cursor
].
^ device grabPointerInView:self
!
@@ -7554,14 +7579,14 @@
|sensor|
device activeKeyboardGrab == self ifTrue:[
- (sensor := self sensor) notNil ifTrue:[
- "/ make certain all X events have been received
- device sync.
- "/ now all events have been received.
- "/ now, flush all pointer events
- sensor flushKeyboardFor:self
- ].
- device ungrabKeyboard.
+ (sensor := self sensor) notNil ifTrue:[
+ "/ make certain all X events have been received
+ device sync.
+ "/ now all events have been received.
+ "/ now, flush all pointer events
+ sensor flushKeyboardFor:self
+ ].
+ device ungrabKeyboard.
].
!
@@ -7571,14 +7596,14 @@
|sensor|
device activePointerGrab == self ifTrue:[
- (sensor := self sensor) notNil ifTrue:[
- "/ make certain all X events have been received
- device sync.
- "/ now all events have been received.
- "/ now, flush all pointer events
- sensor flushMotionEventsFor:self
- ].
- device ungrabPointer.
+ (sensor := self sensor) notNil ifTrue:[
+ "/ make certain all X events have been received
+ device sync.
+ "/ now all events have been received.
+ "/ now, flush all pointer events
+ sensor flushMotionEventsFor:self
+ ].
+ device ungrabPointer.
]
! !
@@ -7595,7 +7620,7 @@
|app|
(app := self application) notNil ifTrue:[
- app noticeOfWindowClose:self
+ app noticeOfWindowClose:self
].
!
@@ -7603,7 +7628,7 @@
|app|
(app := self application) notNil ifTrue:[
- app noticeOfWindowOpen:self
+ app noticeOfWindowOpen:self
].
dependents notNil ifTrue:[ self changed:#opened ]
!
@@ -7654,11 +7679,11 @@
self isBeingDestroyed:true.
realized ifTrue:[
- self unmap.
+ self unmap.
].
shown ifTrue:[
- shown := false.
- dependents notNil ifTrue:[ self changed:#visibility ].
+ shown := false.
+ dependents notNil ifTrue:[ self changed:#visibility ].
].
"/ controller notNil ifTrue:[
@@ -7667,11 +7692,11 @@
"/ ].
subViews notNil ifTrue:[
- self destroySubViews.
+ self destroySubViews.
].
superView notNil ifTrue:[
- superView removeSubView:self.
- superView := nil
+ superView removeSubView:self.
+ superView := nil
].
super destroy.
@@ -7683,13 +7708,13 @@
"/ ].
controller notNil ifTrue:[
- controller release.
- controller := nil.
+ controller release.
+ controller := nil.
].
windowGroup notNil ifTrue:[
- windowGroup removeView:self.
- windowGroup := nil
+ windowGroup removeView:self.
+ windowGroup := nil
].
self noticeOfWindowClose.
@@ -7710,32 +7735,32 @@
viewBackground := DefaultViewBackgroundColor.
DefaultLightColor notNil ifTrue:[
- lightColor := DefaultLightColor.
+ lightColor := DefaultLightColor.
] ifFalse:[
- device hasGrayscales ifTrue:[
- (viewBackground isImageOrForm and:[viewBackground colorMap isNil]) ifTrue:[
- lightColor := viewBackground averageColor lightened.
- ] ifFalse:[
- lightColor := viewBackground lightened.
- ].
- DefaultLightColor := lightColor.
- ] ifFalse:[
- "
- this seems strange: on B&W screens, we create the light color
- darker than normal viewBackground (White) -
- to make the boundary of the view visible
- "
- lightColor := Color gray:50
- ]
+ device hasGrayscales ifTrue:[
+ (viewBackground isImageOrForm and:[viewBackground colorMap isNil]) ifTrue:[
+ lightColor := viewBackground averageColor lightened.
+ ] ifFalse:[
+ lightColor := viewBackground lightened.
+ ].
+ DefaultLightColor := lightColor.
+ ] ifFalse:[
+ "
+ this seems strange: on B&W screens, we create the light color
+ darker than normal viewBackground (White) -
+ to make the boundary of the view visible
+ "
+ lightColor := Color gray:50
+ ]
].
DefaultShadowColor notNil ifTrue:[
- shadowColor := DefaultShadowColor.
+ shadowColor := DefaultShadowColor.
] ifFalse:[
- shadowColor := self blackColor.
+ shadowColor := self blackColor.
].
((DefaultBorderWidth ? 1) ~= 0 and:[DefaultBorderColor notNil]) ifTrue:[
- self border:(SimpleBorder width:(DefaultBorderWidth ? 1) color:DefaultBorderColor)
+ self border:(SimpleBorder width:(DefaultBorderWidth ? 1) color:DefaultBorderColor)
].
"/ font := self defaultFont. -- already done in #initialize
@@ -7783,7 +7808,6 @@
self basicFont:self defaultFont.
shown := realized := false.
- "/ hiddenOnRealize := false.
"/ explicitExtent := false.
"fill in some defaults - some of them are usually redefined in subclasses
@@ -7853,9 +7877,9 @@
self initStyle.
(self drawableId notNil and:[self gcId notNil]) ifTrue:[
"force a change"
- self border:oldBorder.
- self level:oldLevel.
- self viewBackground:self viewBackground.
+ self border:oldBorder.
+ self level:oldLevel.
+ self viewBackground:self viewBackground.
self clearView.
self invalidate.
].
@@ -7870,16 +7894,16 @@
"if I have already been reinited - return"
self drawableId notNil ifTrue:[
- ^ self
+ ^ self
].
"
superView must be there, first
"
superView notNil ifTrue:[
- (sv := superView view) id isNil ifTrue:[
- sv reinitialize
- ]
+ (sv := superView view) id isNil ifTrue:[
+ sv reinitialize
+ ]
].
"reinit cursor"
@@ -7891,18 +7915,18 @@
"if I was mapped, do it again"
realized ifTrue:[
- "only remap if I have a superview - otherwise, I might be
- a hidden iconView or menu ..."
- superView notNil ifTrue:[
+ "only remap if I have a superview - otherwise, I might be
+ a hidden iconView or menu ..."
+ superView notNil ifTrue:[
"/ shown ifTrue:[
- device
- moveResizeWindow:self drawableId x:left y:top width:width height:height;
- mapWindow:self drawableId
+ device
+ moveResizeWindow:self drawableId x:left y:top width:width height:height;
+ mapWindow:self drawableId
"/ mapView:self id:self drawableId iconified:false
"/ atX:left y:top width:width height:height
"/ minExtent:(self minExtent) maxExtent:(self maxExtent)
"/ ].
- ].
+ ].
].
"restore controller"
@@ -8108,8 +8132,8 @@
font := gc font.
oldSize := font size.
newFont := font asSize:(largerBoolean
- ifTrue:[(oldSize + 1) min:100]
- ifFalse:[(oldSize-1) max:4]).
+ ifTrue:[(oldSize + 1) min:100]
+ ifFalse:[(oldSize-1) max:4]).
self font:newFont.
"Modified: / 27-02-1996 / 00:53:51 / cg"
@@ -8325,24 +8349,24 @@
margin isNil ifTrue:[margin := 0].
(margin ~~ 0) ifTrue:[
- m2 := margin + margin.
- nX := nY := margin.
- nW := width - m2.
- nH := height - m2.
+ m2 := margin + margin.
+ nX := nY := margin.
+ nW := width - m2.
+ nH := height - m2.
"/ transformation notNil ifTrue:[
"/ nX := transformation applyInverseToX:nX.
"/ nY := transformation applyInverseToY:nY.
"/ nW := transformation applyInverseScaleX:nW.
"/ nH := transformation applyInverseScaleY:nH.
"/ ].
- innerClipRect := Rectangle
- left:nX
- top:nY
- width:nW
- height:nH
+ innerClipRect := Rectangle
+ left:nX
+ top:nY
+ width:nW
+ height:nH
] ifFalse:[
- "no clipping"
- innerClipRect := nil
+ "no clipping"
+ innerClipRect := nil
]
"Modified: / 22.5.1999 / 16:50:58 / cg"
@@ -8401,17 +8425,17 @@
|subViews|
(subViews := self subViews) notNil ifTrue:[
- subViews do:[:v| |p|
- (ignoreInvisible or:[v shown]) ifTrue:[
- ( (aPoint x between:(v left) and:(v right))
- and:[aPoint y between:(v top) and:(v bottom)]
- ) ifTrue:[
- "/ found a subview - the point is there
- p := device translatePoint:aPoint fromView:self toView:v.
- ^ v detectViewAt:p ignoreInvisible:ignoreInvisible.
- ]
- ]
- ]
+ subViews do:[:v| |p|
+ (ignoreInvisible or:[v shown]) ifTrue:[
+ ( (aPoint x between:(v left) and:(v right))
+ and:[aPoint y between:(v top) and:(v bottom)]
+ ) ifTrue:[
+ "/ found a subview - the point is there
+ p := device translatePoint:aPoint fromView:self toView:v.
+ ^ v detectViewAt:p ignoreInvisible:ignoreInvisible.
+ ]
+ ]
+ ]
].
"/ no subview - the point is here
^ self
@@ -8443,50 +8467,50 @@
bw := self borderWidth ? 0.
superView isNil ifTrue:[
- inRect := 0@0 extent:device extent
+ inRect := 0@0 extent:device extent
] ifFalse:[
- inRect := superView viewRectangle.
+ inRect := superView viewRectangle.
].
bw2 := bw * 2.
rel := aPoint x.
rel isInteger ifFalse:[
- newX := (rel * (inRect width + bw2)) asInteger + inRect left.
- (bw ~~ 0) ifTrue:[
- newX := newX - bw
- ].
+ newX := (rel * (inRect width + bw2)) asInteger + inRect left.
+ (bw ~~ 0) ifTrue:[
+ newX := newX - bw
+ ].
] ifTrue:[
- newX := rel
+ newX := rel
].
rel := aPoint y.
rel isInteger ifFalse:[
- newY := (rel * (inRect height + bw2)) asInteger + inRect top.
- (bw ~~ 0) ifTrue:[
- newY := newY - bw
- ].
+ newY := (rel * (inRect height + bw2)) asInteger + inRect top.
+ (bw ~~ 0) ifTrue:[
+ newY := newY - bw
+ ].
] ifTrue:[
- newY := rel
+ newY := rel
].
insets notNil ifTrue:[
- i := insets at:1. "top"
- (i ~~ 0) ifTrue:[
- newX := newX - i
- ].
- i := insets at:3. "left"
- (i ~~ 0) ifTrue:[
- newX := newX - i
- ].
- i := insets at:2. "right"
- (i ~~ 0) ifTrue:[
- newY := newY - i
- ].
- i := insets at:4. "bottom"
- (i ~~ 0) ifTrue:[
- newY := newY - i
- ].
+ i := insets at:1. "top"
+ (i ~~ 0) ifTrue:[
+ newX := newX - i
+ ].
+ i := insets at:3. "left"
+ (i ~~ 0) ifTrue:[
+ newX := newX - i
+ ].
+ i := insets at:2. "right"
+ (i ~~ 0) ifTrue:[
+ newY := newY - i
+ ].
+ i := insets at:4. "bottom"
+ (i ~~ 0) ifTrue:[
+ newY := newY - i
+ ].
].
^ newX @ newY
!
@@ -8557,25 +8581,25 @@
newLeft := origin x.
newTop := origin y.
((newTop ~~ top) or:[newLeft ~~ left]) ifTrue:[
- top := newTop.
- left := newLeft.
-
- "
- if the receiver is visible, or is a topView, perform the
- operation right away - otherwise, simply remember that the
- origin has changed - will tell the display once we get realized
- "
+ top := newTop.
+ left := newLeft.
+
+ "
+ if the receiver is visible, or is a topView, perform the
+ operation right away - otherwise, simply remember that the
+ origin has changed - will tell the display once we get realized
+ "
"/ (shown
"/ or:[superView isNil and:[drawableId notNil]]) ifTrue:[
- "/ no, have to do it if drawableId is there
- "/ (otherwise, we could not move unmapped views around ...
- "/
- self drawableId notNil ifTrue:[
- device moveWindow:self drawableId x:left y:top
- ] ifFalse:[
- self originChangedFlag:true
- ]
+ "/ no, have to do it if drawableId is there
+ "/ (otherwise, we could not move unmapped views around ...
+ "/
+ self drawableId notNil ifTrue:[
+ device moveWindow:self drawableId x:left y:top
+ ] ifFalse:[
+ self originChangedFlag:true
+ ]
]
"Modified: / 21-01-2011 / 13:59:08 / cg"
@@ -8612,16 +8636,16 @@
a dimension <= 0 ... (although I think that 0 makes sense ...)
"
newWidth < 1 ifTrue:[
- newWidth := 1.
+ newWidth := 1.
].
newHeight < 1 ifTrue:[
- newHeight := 1
+ newHeight := 1
].
((newWidth == width) and:[newHeight == height]) ifTrue:[
- sameOrigin ifTrue:[^ self].
- dependents notNil ifTrue:[ self changed:#origin ].
- ^ self pixelOrigin:origin
+ sameOrigin ifTrue:[^ self].
+ dependents notNil ifTrue:[ self changed:#origin ].
+ ^ self pixelOrigin:origin
].
top := newTop.
@@ -8629,142 +8653,142 @@
"/ shown ifTrue:[ "4-nov-94 actually correct,"
self drawableId notNil ifTrue:[ "but theres a bug in menus when resized while hidden"
- mustRedrawBottomEdge := (margin ~~ 0) and:[newHeight < height].
- mustRedrawRightEdge := (margin ~~ 0) and:[newWidth < width].
-
- ((newHeight <= height) and:[newWidth <= width]) ifTrue:[
- how := #smaller
- ] ifFalse:[
- ((newHeight >= height) and:[newWidth >= width]) ifTrue:[
- how := #larger
- ]
- ].
-
- mustRepaintRight := false.
- mustRepaintBottom := false.
-
- oldWidth := width.
- oldHeight := height.
-
- shown ifTrue:[
- (margin ~~ 0) ifTrue:[
- "clear the old edges"
-
- oldPaint := nil.
- newWidth > width ifTrue:[
- self clippingBounds:nil.
- oldPaint := self paint.
- self paint:viewBackground.
- self fillDeviceRectangleX:(width - margin)
- y:0
- width:margin
- height:height.
- mustRepaintRight := true.
- ].
- newHeight > height ifTrue:[
- self clippingBounds:nil.
- oldPaint := self paint.
- self paint:viewBackground.
- self fillDeviceRectangleX:0
- y:(height - margin)
- width:width
- height:margin.
- mustRepaintBottom := true.
- ].
- oldPaint notNil ifTrue:[ self paint:oldPaint. ]
- ]
- ].
-
- width := newWidth.
- height := newHeight.
-
- self setInnerClip.
-
- "if view becomes smaller, send sizeChanged first"
- true "(how == #smaller)" ifTrue:[
- self sizeChanged:how
- ].
-
- "have to tell X, when extent of view is changed"
- sameOrigin ifTrue:[
- device resizeWindow:self drawableId width:width height:height.
- ] ifFalse:[
- "claus: some xservers seem to do better when resizing
- first ...."
+ mustRedrawBottomEdge := (margin ~~ 0) and:[newHeight < height].
+ mustRedrawRightEdge := (margin ~~ 0) and:[newWidth < width].
+
+ ((newHeight <= height) and:[newWidth <= width]) ifTrue:[
+ how := #smaller
+ ] ifFalse:[
+ ((newHeight >= height) and:[newWidth >= width]) ifTrue:[
+ how := #larger
+ ]
+ ].
+
+ mustRepaintRight := false.
+ mustRepaintBottom := false.
+
+ oldWidth := width.
+ oldHeight := height.
+
+ shown ifTrue:[
+ (margin ~~ 0) ifTrue:[
+ "clear the old edges"
+
+ oldPaint := nil.
+ newWidth > width ifTrue:[
+ self clippingBounds:nil.
+ oldPaint := self paint.
+ self paint:viewBackground.
+ self fillDeviceRectangleX:(width - margin)
+ y:0
+ width:margin
+ height:height.
+ mustRepaintRight := true.
+ ].
+ newHeight > height ifTrue:[
+ self clippingBounds:nil.
+ oldPaint := self paint.
+ self paint:viewBackground.
+ self fillDeviceRectangleX:0
+ y:(height - margin)
+ width:width
+ height:margin.
+ mustRepaintBottom := true.
+ ].
+ oldPaint notNil ifTrue:[ self paint:oldPaint. ]
+ ]
+ ].
+
+ width := newWidth.
+ height := newHeight.
+
+ self setInnerClip.
+
+ "if view becomes smaller, send sizeChanged first"
+ true "(how == #smaller)" ifTrue:[
+ self sizeChanged:how
+ ].
+
+ "have to tell X, when extent of view is changed"
+ sameOrigin ifTrue:[
+ device resizeWindow:self drawableId width:width height:height.
+ ] ifFalse:[
+ "claus: some xservers seem to do better when resizing
+ first ...."
"
- (how == #smaller) ifTrue:[
- device resizeWindow:drawableId width:width height:height.
- device moveWindow:drawableId x:left y:top
- ] ifFalse:[
- device moveResizeWindow:drawableId x:left y:top width:width height:height
- ].
+ (how == #smaller) ifTrue:[
+ device resizeWindow:drawableId width:width height:height.
+ device moveWindow:drawableId x:left y:top
+ ] ifFalse:[
+ device moveResizeWindow:drawableId x:left y:top width:width height:height
+ ].
"
- device moveResizeWindow:self drawableId x:left y:top
- width:width height:height.
- ].
-
- "if view becomes bigger, send sizeChanged after"
- false "(how ~~ #smaller)" ifTrue:[
- self sizeChanged:how
- ].
-
- shown ifTrue:[
- (mustRedrawBottomEdge or:[mustRedrawRightEdge]) ifTrue:[
- border notNil ifTrue:[
- mustRedrawBottomEdge ifTrue:[
- self invalidateDeviceRectangle:((0 @ (height - margin)) extent:width@margin) repairNow:false.
- ].
- mustRedrawRightEdge ifTrue:[
- self invalidateDeviceRectangle:(((width - margin) @ 0) extent:margin@height) repairNow:false.
- ].
- ] ifFalse:[
- self deviceClippingBounds:nil.
- oldPaint := self paint.
- mustRedrawBottomEdge ifTrue:[
- self drawBottomEdge
- ].
- mustRedrawRightEdge ifTrue:[
- self drawRightEdge
- ].
- self paint:oldPaint.
- self deviceClippingBounds:innerClipRect
- ]
- ].
- ].
-
- mustRepaintRight ifTrue:[
- self invalidateDeviceRectangle:(((oldWidth - margin) @ 0)
- extent:margin@height)
- repairNow:false.
+ device moveResizeWindow:self drawableId x:left y:top
+ width:width height:height.
+ ].
+
+ "if view becomes bigger, send sizeChanged after"
+ false "(how ~~ #smaller)" ifTrue:[
+ self sizeChanged:how
+ ].
+
+ shown ifTrue:[
+ (mustRedrawBottomEdge or:[mustRedrawRightEdge]) ifTrue:[
+ border notNil ifTrue:[
+ mustRedrawBottomEdge ifTrue:[
+ self invalidateDeviceRectangle:((0 @ (height - margin)) extent:width@margin) repairNow:false.
+ ].
+ mustRedrawRightEdge ifTrue:[
+ self invalidateDeviceRectangle:(((width - margin) @ 0) extent:margin@height) repairNow:false.
+ ].
+ ] ifFalse:[
+ self deviceClippingBounds:nil.
+ oldPaint := self paint.
+ mustRedrawBottomEdge ifTrue:[
+ self drawBottomEdge
+ ].
+ mustRedrawRightEdge ifTrue:[
+ self drawRightEdge
+ ].
+ self paint:oldPaint.
+ self deviceClippingBounds:innerClipRect
+ ]
+ ].
+ ].
+
+ mustRepaintRight ifTrue:[
+ self invalidateDeviceRectangle:(((oldWidth - margin) @ 0)
+ extent:margin@height)
+ repairNow:false.
"/ self redrawDeviceX:(oldWidth - margin)
"/ y:0
"/ width:margin
"/ height:height.
- ].
- mustRepaintBottom ifTrue:[
- self invalidateDeviceRectangle:((0 @ (oldHeight - margin))
- extent:width@margin)
- repairNow:false.
+ ].
+ mustRepaintBottom ifTrue:[
+ self invalidateDeviceRectangle:((0 @ (oldHeight - margin))
+ extent:width@margin)
+ repairNow:false.
"/ self redrawDeviceX:0
"/ y:(oldHeight - margin)
"/ width:width
"/ height:margin.
- ].
+ ].
] ifFalse:[
- "otherwise memorize the need for a sizeChanged message"
-
- width := newWidth.
- height := newHeight.
- sameOrigin ifFalse:[
- self originChangedFlag:true.
- ].
- self extentChangedFlag:true.
- subViews notEmptyOrNil ifTrue:[
- self extentChangedBeforeCreatedFlag:true.
- ].
+ "otherwise memorize the need for a sizeChanged message"
+
+ width := newWidth.
+ height := newHeight.
+ sameOrigin ifFalse:[
+ self originChangedFlag:true.
+ ].
+ self extentChangedFlag:true.
+ subViews notEmptyOrNil ifTrue:[
+ self extentChangedBeforeCreatedFlag:true.
+ ].
].
sameOrigin ifFalse:[
- dependents notNil ifTrue:[ self changed:#origin ].
+ dependents notNil ifTrue:[ self changed:#origin ].
].
"Modified: / 25.5.1999 / 14:49:56 / cg"
@@ -8778,39 +8802,39 @@
bw := self borderWidth ? 0.
superView isNil ifTrue:[
- superWidth := device width + bw.
- superHeight := device height + bw.
- superLeft := superTop := 0.
+ superWidth := device width + bw.
+ superHeight := device height + bw.
+ superLeft := superTop := 0.
] ifFalse:[
- inRect := superView viewRectangle.
- superWidth := inRect width.
- superHeight := inRect height.
- superLeft := inRect left.
- superTop := inRect top.
+ inRect := superView viewRectangle.
+ superWidth := inRect width.
+ superHeight := inRect height.
+ superLeft := inRect left.
+ superTop := inRect top.
].
rel := p x.
rel isInteger ifTrue:[
- newX := rel
+ newX := rel
] ifFalse:[
- newX := (rel * superWidth) asInteger + superLeft.
- (bw ~~ 0) ifTrue:[
- rel ~= 1.0 ifTrue:[
- newX := newX - bw
- ]
- ]
+ newX := (rel * superWidth) asInteger + superLeft.
+ (bw ~~ 0) ifTrue:[
+ rel ~= 1.0 ifTrue:[
+ newX := newX - bw
+ ]
+ ]
].
rel := p y.
rel isInteger ifTrue:[
- newY := rel
+ newY := rel
] ifFalse:[
- newY := (rel * superHeight) asInteger + superTop.
- (bw ~~ 0) ifTrue:[
- rel ~= 1.0 ifTrue:[
- newY := newY - bw
- ]
- ]
+ newY := (rel * superHeight) asInteger + superTop.
+ (bw ~~ 0) ifTrue:[
+ rel ~= 1.0 ifTrue:[
+ newY := newY - bw
+ ]
+ ]
].
^ newX @ newY
@@ -8892,16 +8916,16 @@
focusViewToCheck == self ifTrue:[ ^ true ].
focusViewToCheck notNil ifTrue:[
- (focusViewToCheck isComponentOf: self) ifTrue:[ ^ true ].
-
- "mhmh - is there a delegation to me ?"
- (delegate := focusViewToCheck delegate) notNil ifTrue:[
- delegate == self ifTrue:[^ true].
- "/ no: delegate does not understand this (EnterFieldGroup or KbdForwarder)
- "/ we will see, if commenting this leads to problems...
- "/ (delegate isComponentOf: self) ifTrue:[ ^ true ].
- ^ delegate askFor:#delegatesTo: with:self
- ]
+ (focusViewToCheck isComponentOf: self) ifTrue:[ ^ true ].
+
+ "mhmh - is there a delegation to me ?"
+ (delegate := focusViewToCheck delegate) notNil ifTrue:[
+ delegate == self ifTrue:[^ true].
+ "/ no: delegate does not understand this (EnterFieldGroup or KbdForwarder)
+ "/ we will see, if commenting this leads to problems...
+ "/ (delegate isComponentOf: self) ifTrue:[ ^ true ].
+ ^ delegate askFor:#delegatesTo: with:self
+ ]
].
^ false
@@ -9023,11 +9047,11 @@
focusViewToCheck == self ifTrue:[ ^ true ].
focusViewToCheck notNil ifTrue:[
- "mhmh - is there a delegation to me ?"
- (delegate := focusViewToCheck delegate) notNil ifTrue:[
- delegate == self ifTrue:[^ true].
- ^ delegate askFor:#delegatesTo: with:self
- ]
+ "mhmh - is there a delegation to me ?"
+ (delegate := focusViewToCheck delegate) notNil ifTrue:[
+ delegate == self ifTrue:[^ true].
+ ^ delegate askFor:#delegatesTo: with:self
+ ]
].
^ false
@@ -9393,7 +9417,7 @@
buttonMotionEventPending
"return true, if a button motion event is pending.
- Normally, you dont want to use this, since no polling is needed
+ Normally, you don't want to use this, since no polling is needed
(not even for mouse-tracking).
Actually, its a historical leftover"
@@ -9496,11 +9520,11 @@
This does not make the view visible (needs a #map for that)"
self drawableId isNil ifTrue:[
- "
- make certain that superview is created also
- "
- superView notNil ifTrue:[
- superView view create.
+ "
+ make certain that superview is created also
+ "
+ superView notNil ifTrue:[
+ superView view create.
"/ "and put my controller into the superviews controller list"
"/ controller notNil ifTrue:[
@@ -9508,43 +9532,43 @@
"/ controller manager:(superView controller manager)
"/ ]
"/ ]
- ] ifFalse:[
- device isNil ifTrue:[ device := Screen current ].
- "/
- "/ if the display is not already dispatching events,
- "/ this starts the event process.
- "/
- device startDispatch
- ].
-
- cursor notNil ifTrue:[
- cursor := cursor onDevice:device.
- ].
-
- self extentChangedBeforeCreatedFlag ifTrue:[
- "/ this is true, if the extent was changed before
- "/ this view was created (and therefore, no sizeChangeEvent
- "/ was sent to me, which would notify children.)
- "/ have to do this here.
- self sizeChanged:nil. "/ must tell children (if any)
- ].
- self hasExplicitExtent ifFalse:[
- self resize
- ].
-
- self physicalCreate.
-
- viewBackground notNil ifTrue:[
- self setViewBackground
- ].
-
- self initEvents.
-
- "
- this is the first create,
- force sizechange messages to be sent to the view
- "
- self originChangedFlag:true extentChangedFlag:true
+ ] ifFalse:[
+ device isNil ifTrue:[ device := Screen current ].
+ "/
+ "/ if the display is not already dispatching events,
+ "/ this starts the event process.
+ "/
+ device startDispatch
+ ].
+
+ cursor notNil ifTrue:[
+ cursor := cursor onDevice:device.
+ ].
+
+ self extentChangedBeforeCreatedFlag ifTrue:[
+ "/ this is true, if the extent was changed before
+ "/ this view was created (and therefore, no sizeChangeEvent
+ "/ was sent to me, which would notify children.)
+ "/ have to do this here.
+ self sizeChanged:nil. "/ must tell children (if any)
+ ].
+ self hasExplicitExtent ifFalse:[
+ self resize
+ ].
+
+ self physicalCreate.
+
+ viewBackground notNil ifTrue:[
+ self setViewBackground
+ ].
+
+ self initEvents.
+
+ "
+ this is the first create,
+ force sizechange messages to be sent to the view
+ "
+ self originChangedFlag:true extentChangedFlag:true
]
"Modified: 28.3.1997 / 13:50:17 / cg"
@@ -9571,10 +9595,10 @@
is always sent."
shadowColor notNil ifTrue:[
- shadowColor := shadowColor onDevice:device
+ shadowColor := shadowColor onDevice:device
].
lightColor notNil ifTrue:[
- lightColor := lightColor onDevice:device
+ lightColor := lightColor onDevice:device
].
"Created: 13.1.1997 / 21:51:59 / cg"
@@ -9593,25 +9617,25 @@
slowly migrating to use layoutObjects ...
"
layout notNil ifTrue:[
- superView notNil ifTrue:[
- (self originOrExtentOrCornerChanged) ifTrue:[
- layout isAssociation ifTrue:[
- layout key == #extent ifTrue:[
- org := 1@1.
- ext := layout value.
- ] ifFalse:[
- self shouldImplement.
- ].
- ] ifFalse:[
- r := (layout rectangleRelativeTo:(superView viewRectangle)
- preferred:[self preferredBounds]).
- org := r origin rounded.
- ext := r extent rounded.
- ].
- self pixelOrigin:org extent:ext.
- ].
- ].
- ^ self.
+ superView notNil ifTrue:[
+ (self originOrExtentOrCornerChanged) ifTrue:[
+ layout isAssociation ifTrue:[
+ layout key == #extent ifTrue:[
+ org := 1@1.
+ ext := layout value.
+ ] ifFalse:[
+ self shouldImplement.
+ ].
+ ] ifFalse:[
+ r := (layout rectangleRelativeTo:(superView viewRectangle)
+ preferred:[self preferredBounds]).
+ org := r origin rounded.
+ ext := r extent rounded.
+ ].
+ self pixelOrigin:org extent:ext.
+ ].
+ ].
+ ^ self.
].
"if the extent is not the one we created the window with ..."
@@ -9623,20 +9647,20 @@
self originChangedFlag ifTrue:[
"/ org := self computeOrigin.
"/ self pixelOrigin:org.
- originRule notNil ifTrue:[
- self pixelOrigin:self computeOrigin
- ] ifFalse:[
- relativeOrigin notNil ifTrue:[
- self originFromRelativeOrigin:relativeOrigin
- ] ifFalse:[
- shown ifTrue:[
- device moveWindow:self drawableId x:left y:top.
- ] ifFalse:[
- self pixelOrigin:left@top
- ].
- ].
- ].
- self originChangedFlag:false
+ originRule notNil ifTrue:[
+ self pixelOrigin:self computeOrigin
+ ] ifFalse:[
+ relativeOrigin notNil ifTrue:[
+ self originFromRelativeOrigin:relativeOrigin
+ ] ifFalse:[
+ shown ifTrue:[
+ device moveWindow:self drawableId x:left y:top.
+ ] ifFalse:[
+ self pixelOrigin:left@top
+ ].
+ ].
+ ].
+ self originChangedFlag:false
]
"Modified: 18.6.1996 / 21:44:03 / cg"
@@ -9731,61 +9755,61 @@
(unless you have a dictator as windowManager ;-).
If the iconified argument is true, the window is created as icon initially.
Notice:
- Actually, this method is only valid for topViews;
- however, it is defined here to allow things like 'Button new realize'"
+ Actually, this method is only valid for topViews;
+ however, it is defined here to allow things like 'Button new realize'"
|subs|
realized ifFalse:[
- self drawableId isNil ifTrue:[
- "
- first time ?
- yes, realize (implies a map)
- "
- self realizeKeepingGroup:false at:aPoint iconified:iconified
- ] ifFalse:[
- "
- no, map only
- "
- realized := true.
- aPoint isNil ifTrue:[
- iconified ifTrue:[
- device
- mapView:self id:self drawableId iconified:iconified
- atX:0 y:0
- width:width height:height
- minExtent:(self minExtent) maxExtent:(self maxExtent).
- ] ifFalse:[
- device mapWindow:self drawableId.
- ]
- ] ifFalse:[
- left := aPoint x.
- top := aPoint y.
- device
- mapView:self id:self drawableId iconified:iconified
- atX:left y:top
- width:width height:height
- minExtent:(self minExtent) maxExtent:(self maxExtent).
- ].
-
- "/
- "/ implies that all realized subviews
- "/ are now also mapped
- "/
- "/ not needed for topViews - the mapped event does exactly the same
- "/ however, X does not generate mapped events for non-topViews
- "/ when a view gets deiconified.
-
- superView notNil ifTrue:[
- (subs := self subViews) notNil ifTrue:[
- subs do:[:v |
- v realized "shown" ifFalse:[
- v mapped
- ]
- ]
- ]
- ]
- ].
+ self drawableId isNil ifTrue:[
+ "
+ first time ?
+ yes, realize (implies a map)
+ "
+ self realizeKeepingGroup:false at:aPoint iconified:iconified
+ ] ifFalse:[
+ "
+ no, map only
+ "
+ realized := true.
+ aPoint isNil ifTrue:[
+ iconified ifTrue:[
+ device
+ mapView:self id:self drawableId iconified:iconified
+ atX:0 y:0
+ width:width height:height
+ minExtent:(self minExtent) maxExtent:(self maxExtent).
+ ] ifFalse:[
+ device mapWindow:self drawableId.
+ ]
+ ] ifFalse:[
+ left := aPoint x.
+ top := aPoint y.
+ device
+ mapView:self id:self drawableId iconified:iconified
+ atX:left y:top
+ width:width height:height
+ minExtent:(self minExtent) maxExtent:(self maxExtent).
+ ].
+
+ "/
+ "/ implies that all realized subviews
+ "/ are now also mapped
+ "/
+ "/ not needed for topViews - the mapped event does exactly the same
+ "/ however, X does not generate mapped events for non-topViews
+ "/ when a view gets deiconified.
+
+ superView notNil ifTrue:[
+ (subs := self subViews) notNil ifTrue:[
+ subs do:[:v |
+ v realized "shown" ifFalse:[
+ v mapped
+ ]
+ ]
+ ]
+ ]
+ ].
]
"Modified: 23.8.1996 / 14:53:55 / stefan"
@@ -10034,8 +10058,7 @@
self mapIconified
]
] ifFalse:[
- (self isHiddenOnRealize not
- and:[visibilityChannel isNil or:[visibilityChannel value]]) ifTrue:[
+ self isHiddenOnRealize ifFalse:[
self setInnerClip.
realized ifFalse:[
@@ -10068,22 +10091,22 @@
self isBeingDestroyed ifTrue:[ ^self ].
self drawableId isNil ifTrue:[
- super recreate.
- self physicalCreate.
-
- viewBackground notNil ifTrue:[
- self setViewBackground
- ].
-
- "
- XXX has to be changed: eventmasks are device specific -
- XXX will not allow restart on another Workstation-type.
- XXX event masks must become symbolic
- "
- eventMask isNil ifTrue:[
- eventMask := device defaultEventMask
- ].
- device setEventMask:eventMask in:self drawableId
+ super recreate.
+ self physicalCreate.
+
+ viewBackground notNil ifTrue:[
+ self setViewBackground
+ ].
+
+ "
+ XXX has to be changed: eventmasks are device specific -
+ XXX will not allow restart on another Workstation-type.
+ XXX event masks must become symbolic
+ "
+ eventMask isNil ifTrue:[
+ eventMask := device defaultEventMask
+ ].
+ device setEventMask:eventMask in:self drawableId
]
!
@@ -10091,16 +10114,16 @@
"realize all my subviews and all of their subviews - but not myself."
subViews notNil ifTrue:[
- subViews do:[:subView |
- subView realize.
- subView recursiveRealizeAllSubViews.
- ]
+ subViews do:[:subView |
+ subView realize.
+ subView recursiveRealizeAllSubViews.
+ ]
].
components notNil ifTrue:[
- components do:[:component |
- component realize.
- component recursiveRealizeAllSubViews.
- ]
+ components do:[:component |
+ component realize.
+ component recursiveRealizeAllSubViews.
+ ]
].
!
@@ -10111,18 +10134,18 @@
are known to ignore this ..."
realized ifFalse:[
- self drawableId isNil ifTrue:[
- self realize
- ] ifFalse:[
- "
- now, make the view visible
- "
- realized := true.
- device
- mapView:self id:self drawableId iconified:false
- atX:left y:top width:width height:height
- minExtent:(self minExtent) maxExtent:(self maxExtent)
- ]
+ self drawableId isNil ifTrue:[
+ self realize
+ ] ifFalse:[
+ "
+ now, make the view visible
+ "
+ realized := true.
+ device
+ mapView:self id:self drawableId iconified:false
+ atX:left y:top width:width height:height
+ minExtent:(self minExtent) maxExtent:(self maxExtent)
+ ]
]
"Created: 8.5.1996 / 09:33:06 / cg"
@@ -10163,17 +10186,17 @@
"rerealize myself with all subviews"
self drawableId notNil ifTrue:[
- realized := true.
- self realizeAllSubViews.
- superView isNil ifTrue:[
- device
- mapView:self id:self drawableId iconified:false
- atX:left y:top width:width height:height
- minExtent:(self minExtent) maxExtent:(self maxExtent)
- ] ifFalse:[
- device
- mapWindow:self drawableId
- ].
+ realized := true.
+ self realizeAllSubViews.
+ superView isNil ifTrue:[
+ device
+ mapView:self id:self drawableId iconified:false
+ atX:left y:top width:width height:height
+ minExtent:(self minExtent) maxExtent:(self maxExtent)
+ ] ifFalse:[
+ device
+ mapWindow:self drawableId
+ ].
]
"Modified: 28.1.1997 / 17:59:28 / cg"
@@ -10205,24 +10228,24 @@
"unmap the view - the view stays created (but invisible), and can be remapped again later."
realized ifTrue:[
- realized := false.
- self drawableId notNil ifTrue:[
- device unmapWindow:self drawableId.
-
- "/ make it go away immediately
- "/ (this hides the subview killing)
- self flush.
- ].
-
- "/ Normally, this is not correct with X, where the
- "/ unmap is an asynchronous operation.
- "/ (shown is cleared also in unmapped event)
- "/ Do it anyway, to avoid synchronisation problems.
-
- shown ifTrue:[
- shown := false.
- dependents notNil ifTrue:[ self changed:#visibility ].
- ]
+ realized := false.
+ self drawableId notNil ifTrue:[
+ device unmapWindow:self drawableId.
+
+ "/ make it go away immediately
+ "/ (this hides the subview killing)
+ self flush.
+ ].
+
+ "/ Normally, this is not correct with X, where the
+ "/ unmap is an asynchronous operation.
+ "/ (shown is cleared also in unmapped event)
+ "/ Do it anyway, to avoid synchronisation problems.
+
+ shown ifTrue:[
+ shown := false.
+ dependents notNil ifTrue:[ self changed:#visibility ].
+ ]
].
"
@@ -10232,9 +10255,9 @@
top extent:200@200.
sub := View
- origin:0.2@0.2
- corner:0.8@0.8
- in:top.
+ origin:0.2@0.2
+ corner:0.8@0.8
+ in:top.
sub viewBackground:Color red.
sub hiddenOnRealize:true.
@@ -10333,16 +10356,16 @@
self fill:flashColor.
messageOrNil notNil ifTrue:[
- self withForeground:self whiteColor do:[
- self displayString:messageOrNil centeredAt:(self center).
- ].
+ self withForeground:self whiteColor do:[
+ self displayString:messageOrNil centeredAt:(self center).
+ ].
].
Delay waitForSeconds:0.1.
self fill:self whiteColor.
messageOrNil notNil ifTrue:[
- self withForeground:self blackColor do:[
- self displayString:messageOrNil centeredAt:(self center).
- ].
+ self withForeground:self blackColor do:[
+ self displayString:messageOrNil centeredAt:(self center).
+ ].
].
Delay waitForSeconds:0.1.
self fill:viewBackground.
@@ -10376,13 +10399,13 @@
until the receiver's windowGroupProcess gets rescheduled."
shown ifFalse:[
- "/ no need to add damage - will get a full-redraw anyway,
- "/ when I will be shown again.
- ^ self
+ "/ no need to add damage - will get a full-redraw anyway,
+ "/ when I will be shown again.
+ ^ self
].
self
- invalidateDeviceRectangle:(Rectangle left:0 top:0 width:width height:height)
- repairNow:false
+ invalidateDeviceRectangle:(Rectangle left:0 top:0 width:width height:height)
+ repairNow:false
"Modified: / 9.11.1998 / 21:04:16 / cg"
!
@@ -10397,9 +10420,9 @@
intil the receiver's windowGroupProcess gets rescheduled."
shown ifFalse:[
- "/ no need to add damage - will get a full-redraw anyway,
- "/ when I will be shown again.
- ^ self
+ "/ no need to add damage - will get a full-redraw anyway,
+ "/ when I will be shown again.
+ ^ self
].
self invalidate:aRectangle repairNow:false
@@ -10500,7 +10523,7 @@
redraw
"redraw myself completely - this is sent by redrawX:y:width:height:
as a fallback.
- Cannot do much here - is redefined in subclasses which dont care for
+ Cannot do much here - is redefined in subclasses which don't care for
updating regions but instead update everything."
"Modified: 29.5.1996 / 18:02:52 / cg"
@@ -10569,7 +10592,7 @@
self clippingBounds:area.
self clearExposedAreaInRedraw ifTrue:[
- self clearRectangleX:x y:y width:w height:h.
+ self clearRectangleX:x y:y width:w height:h.
].
self renderOrRedraw.
@@ -10925,12 +10948,12 @@
wCont := self widthOfContents.
currentTransformation := gc transformation.
currentTransformation isNil ifTrue:[
- orgY := orgX := 0
+ orgY := orgX := 0
] ifFalse:[
- wCont := (currentTransformation applyScaleX:wCont) rounded.
- hCont := (currentTransformation applyScaleY:hCont) rounded.
- orgY := currentTransformation translation y negated.
- orgX := currentTransformation translation x negated
+ wCont := (currentTransformation applyScaleX:wCont) rounded.
+ hCont := (currentTransformation applyScaleY:hCont) rounded.
+ orgY := currentTransformation translation y negated.
+ orgX := currentTransformation translation x negated
].
iw := self innerWidth.
@@ -10942,20 +10965,20 @@
y := newOrigin y.
allowScrollBeyondContents ifFalse:[
- x + iw > wCont ifTrue:[
- x := (wCont - iw) asInteger.
- ].
+ x + iw > wCont ifTrue:[
+ x := (wCont - iw) asInteger.
+ ].
].
x < 0 ifTrue:[
- x := 0
+ x := 0
].
allowScrollBeyondContents ifFalse:[
- y + ih > hCont ifTrue:[
- y := (hCont - ih) asInteger.
- ].
+ y + ih > hCont ifTrue:[
+ y := (hCont - ih) asInteger.
+ ].
].
y < 0 ifTrue:[
- y := 0.
+ y := 0.
].
dX := x - orgX.
@@ -10966,79 +10989,79 @@
].
(wg := self windowGroup) notNil ifTrue:[
- wg processRealExposeEventsFor:self.
+ wg processRealExposeEventsFor:self.
].
self originWillChange.
(shown and:[doRedraw]) ifTrue:[
- copyWidth := iw - dX abs.
- copyHeight := ih - dY abs.
- ((copyWidth > 0) and:[copyHeight > 0]) ifTrue:[
- "/ some of the currently displayed pixels
- "/ remain visible. Copy them
-
- dX < 0 ifTrue:[
- fromX := margin.
- toX := margin - dX.
- redrawX := margin
- ] ifFalse:[
- fromX := margin + dX.
- toX := margin.
- redrawX := margin + copyWidth.
- ].
- dY < 0 ifTrue:[
- fromY := margin.
- toY := margin - dY.
- redrawY := margin.
- ] ifFalse:[
- fromY := margin + dY.
- toY := margin.
- redrawY := margin + copyHeight.
- ].
- self catchExpose.
- self setViewOrigin:(x @ y).
- self
- copyFrom:self
- x:fromX y:fromY
- toX:toX y:toY
- width:copyWidth
- height:copyHeight
- async:true.
-
- self setInnerClip.
-
- "first redraw the rectangle above/below the
- copied area (with full width)."
-
- copyHeight < ih ifTrue:[
- self invalidateDeviceRectangle:((margin@redrawY) extent:(iw@(ih - copyHeight))) repairNow:false.
+ copyWidth := iw - dX abs.
+ copyHeight := ih - dY abs.
+ ((copyWidth > 0) and:[copyHeight > 0]) ifTrue:[
+ "/ some of the currently displayed pixels
+ "/ remain visible. Copy them
+
+ dX < 0 ifTrue:[
+ fromX := margin.
+ toX := margin - dX.
+ redrawX := margin
+ ] ifFalse:[
+ fromX := margin + dX.
+ toX := margin.
+ redrawX := margin + copyWidth.
+ ].
+ dY < 0 ifTrue:[
+ fromY := margin.
+ toY := margin - dY.
+ redrawY := margin.
+ ] ifFalse:[
+ fromY := margin + dY.
+ toY := margin.
+ redrawY := margin + copyHeight.
+ ].
+ self catchExpose.
+ self setViewOrigin:(x @ y).
+ self
+ copyFrom:self
+ x:fromX y:fromY
+ toX:toX y:toY
+ width:copyWidth
+ height:copyHeight
+ async:true.
+
+ self setInnerClip.
+
+ "first redraw the rectangle above/below the
+ copied area (with full width)."
+
+ copyHeight < ih ifTrue:[
+ self invalidateDeviceRectangle:((margin@redrawY) extent:(iw@(ih - copyHeight))) repairNow:false.
"/ self
"/ redrawDeviceX:margin y:redrawY
"/ width:iw height:(ih - copyHeight).
- ].
-
- "second redraw the rectangle left/right of the
- copied area"
-
- copyWidth < iw ifTrue:[
- self invalidateDeviceRectangle:((redrawX@toY) extent:((iw-copyWidth)@copyHeight)) repairNow:false.
+ ].
+
+ "second redraw the rectangle left/right of the
+ copied area"
+
+ copyWidth < iw ifTrue:[
+ self invalidateDeviceRectangle:((redrawX@toY) extent:((iw-copyWidth)@copyHeight)) repairNow:false.
"/ self redrawDeviceX:redrawX y:toY
"/
"/ width:iw - copyWidth
"/ height:copyHeight.
- ].
- self waitForExpose.
- ] ifFalse:[
- "redraw everything"
-
- self setViewOrigin:(x @ y).
- self invalidateDeviceRectangle:((margin@margin) extent:(iw@ih)) repairNow:false.
+ ].
+ self waitForExpose.
+ ] ifFalse:[
+ "redraw everything"
+
+ self setViewOrigin:(x @ y).
+ self invalidateDeviceRectangle:((margin@margin) extent:(iw@ih)) repairNow:false.
"/ self redrawDeviceX:margin y:margin
"/ width:iw
"/ height:ih.
- ].
+ ].
] ifFalse:[
- self setViewOrigin:(x @ y).
+ self setViewOrigin:(x @ y).
].
self originChanged:(dX negated @ dY negated).
@@ -11237,7 +11260,7 @@
"Modified: / 9.7.1998 / 01:20:57 / cg"
!
-openModal:aBlock inGroup:aWindowGroup
+openModal:aBlock inGroup:activeWindowGroup
"create a new windowgroup, but start processing in the current process -
actually suspending event processing for the main group.
Stay in this modal loop while aBlock evaluates to true AND the receiver is
@@ -11246,13 +11269,14 @@
This makes any interaction with the current window impossible -
however, other views (in other windowgroups) still work."
- |tops mainView previousGroup mainGroup cursorChanged isPopup makeTransient|
+ |tops mainView previousGroup mainGroup cursorChanged
+ isPopup inSystemProcess makeTransient transientFor|
StandardSystemView cancelAutoRaise.
isPopup := self isPopUpView.
- aWindowGroup notNil ifTrue:[
- mainGroup := aWindowGroup mainGroup.
+ activeWindowGroup notNil ifTrue:[
+ mainGroup := activeWindowGroup mainGroup.
mainView := mainGroup mainView.
].
@@ -11260,7 +11284,7 @@
"/ (so the handler sees me with a wGroup, sensor etc).
"/ this allows for the handler to enqueue an event,
"/ or to add event hooks.
- Processor activeProcessIsSystemProcess ifTrue:[
+ (inSystemProcess := 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
@@ -11268,16 +11292,17 @@
where this happens is with modal boxes popped while in a
modal browser. You will forgive me for that inconvenience.
"
- windowGroup := aWindowGroup.
- aWindowGroup notNil ifTrue:[aWindowGroup addTopView:self].
+ windowGroup := activeWindowGroup.
+ activeWindowGroup notNil ifTrue:[activeWindowGroup addTopView:self].
] ifFalse:[
- previousGroup := WindowGroup activeGroup.
+ previousGroup := activeWindowGroup.
].
windowGroup isNil ifTrue:[
"/ create a new window group put myself into it
windowGroup := self windowGroupClass new.
windowGroup
+ setProcess:Processor activeProcess;
addTopView:self;
setPreviousGroup:previousGroup.
@@ -11285,13 +11310,14 @@
"/
"/ special: this is a modal subview,
"/ prevent the view from reassigning its windowGroup when realized
- "/ (subviews normaly place themself into the superviews group)
+ "/ (subviews normally place themself into the superviews group)
"/
windowGroup isForModalSubview:true.
].
].
makeTransient := true.
+ transientFor := mainView.
isPopup ifFalse:[
"/ the following allows for knowledgable programmers to suppress dialog boxes,
"/ or to patch common controls right before opening...
@@ -11310,32 +11336,38 @@
"/ the following raises the corresponding mainview, so the dialog shows above
"/ any currently covered view. However, be careful if being debugged, or if this dialog
"/ is opened by an already open dialog.
- mainView notNil ifTrue:[
- (mainView windowGroup isInModalLoop
- or:[ mainView windowGroup isDebugged
- or:[ WindowGroup activeGroup isDebugged
+ (mainView isNil or:[mainView windowGroup isInModalLoop]) ifTrue:[
+ (previousGroup notNil and:[previousGroup isModal]) ifTrue:[
+ transientFor := previousGroup mainView.
+ ].
+ ].
+
+ transientFor notNil ifTrue:[
+ (transientFor windowGroup isInModalLoop
+ or:[ transientFor windowGroup isDebugged
+ or:[ activeWindowGroup isDebugged
]]) ifFalse:[
self tracePoint:#cg message:'activate'.
- self debuggingCodeFor:#cg is:[ Transcript showCR:mainView; showCR:mainView windowGroup. ].
- mainView activate; setForegroundWindow.
- ] ifTrue:[
- makeTransient := false.
+ self debuggingCodeFor:#cg is:[ Transcript showCR:transientFor; showCR:transientFor windowGroup. ].
+ transientFor activate; setForegroundWindow.
+"/ ] ifTrue:[
+"/ makeTransient := false.
]
].
].
- makeTransient ifTrue:[
- mainView notNil ifTrue:[
+ "/ makeTransient ifTrue:[
+ transientFor notNil ifTrue:[
"set the transient property.
This is currently used for X, to tell the Window Manager
That this view should be always on top of the mainView"
self drawableId isNil ifTrue:[self create].
- device setTransient:self drawableId for:mainView id.
- ]
- ].
+ device setTransient:self drawableId for:transientFor id.
+ ].
+ "/ ].
self raise.
- Processor activeProcessIsSystemProcess ifTrue:[
+ inSystemProcess ifTrue:[
self realize
] ifFalse:[
"
@@ -11369,16 +11401,16 @@
] do:[
[
[
- windowGroup startupModal:[realized and:aBlock] forGroup:aWindowGroup
+ windowGroup startupModal:[realized and:aBlock] forGroup:activeWindowGroup
] ifCurtailed:[
self hide.
]
] ensure:[
- aWindowGroup notNil ifTrue:[
- aWindowGroup graphicsDevice sync. "that's a round trip - make sure that all drawing has been processed"
+ activeWindowGroup notNil ifTrue:[
+ activeWindowGroup graphicsDevice sync. "that's a round trip - make sure that all drawing has been processed"
"/ ensure that eventListener runs here ...
Delay waitForMilliseconds:50.
- aWindowGroup processExposeEvents.
+ activeWindowGroup processExposeEvents.
(self isPopUpView or:[ ReturnFocusWhenClosingModalBoxes ]) ifTrue:[
"
@@ -11388,8 +11420,8 @@
Only do this, if the previous group is still having the focus.
(i.e. no other view was opened in the meantime)
"
- aWindowGroup graphicsDevice focusView isNil ifTrue:[
- tops := aWindowGroup topViews.
+ activeWindowGroup graphicsDevice focusView isNil ifTrue:[
+ tops := activeWindowGroup topViews.
(tops notEmptyOrNil) ifTrue:[
tops first getKeyboardFocus
].
@@ -11523,10 +11555,10 @@
self drawableId isNil ifTrue:[self create].
windowGroup isNil ifTrue:[
- newGroup := true.
- windowGroup := self windowGroupClass new.
+ newGroup := true.
+ windowGroup := self windowGroupClass new.
] ifFalse:[
- newGroup := false.
+ newGroup := false.
].
windowGroup addTopView:self.
@@ -11535,13 +11567,13 @@
device nonModalWindowListenersDo:[:listener | listener aboutToOpenWindow:self].
newGroup ifTrue:[
- (aPoint isNil and:[iconified not]) ifTrue:[
- windowGroup startupWith:[self realize].
- ] ifFalse:[
- windowGroup startupWith:[self realizeKeepingGroup:false at:aPoint iconified:iconified].
- ].
+ (aPoint isNil and:[iconified not]) ifTrue:[
+ windowGroup startupWith:[self realize].
+ ] ifFalse:[
+ windowGroup startupWith:[self realizeKeepingGroup:false at:aPoint iconified:iconified].
+ ].
] ifFalse:[
- self realizeInGroup.
+ self realizeInGroup.
].
"
@@ -11610,45 +11642,45 @@
another view (which is only available once visible),
use this to suspend the current process until the receiver is shown.
Caveat:
- we poll here for the view to be shown - we need a semaphore
- which is raised by the view in order to do it right."
+ we poll here for the view to be shown - we need a semaphore
+ which is raised by the view in order to do it right."
|wg n|
n := 0.
[self shown] whileFalse:[
- (device notNil and:[device isOpen not]) ifTrue:[^ self].
-
- "/ this was added to avoid a deadlock, when called from within
- "/ the event dispatch process (as when doing foo inspect there).
- n > (10 / 0.05) ifTrue:[
- 'SimpleView [info]: View not visible after 10 seconds - will not wait any longer in waitUntilVisible' infoPrintCR.
- ^ self
- ].
- n := n + 1.
- Delay waitForMilliseconds:50.
- (wg := self windowGroup) notNil ifTrue:[
- wg processExposeEvents.
- ].
+ (device notNil and:[device isOpen not]) ifTrue:[^ self].
+
+ "/ this was added to avoid a deadlock, when called from within
+ "/ the event dispatch process (as when doing foo inspect there).
+ n > (10 / 0.05) ifTrue:[
+ 'SimpleView [info]: View not visible after 10 seconds - will not wait any longer in waitUntilVisible' infoPrintCR.
+ ^ self
+ ].
+ n := n + 1.
+ Delay waitForMilliseconds:50.
+ (wg := self windowGroup) notNil ifTrue:[
+ wg processExposeEvents.
+ ].
].
"does not work (the view is in its opening phase,
when we attempt to draw a line - this gives an error, since
its internals are not yet correctly setup):
- |v|
-
- v := View new open.
- v displayLineFrom:0@0 to:50@50
+ |v|
+
+ v := View new open.
+ v displayLineFrom:0@0 to:50@50
does work (since we wait until the view has completely finished
its startup phase):
- |v|
-
- v := View new open.
- v waitUntilVisible.
- v displayLineFrom:0@0 to:50@50
+ |v|
+
+ v := View new open.
+ v waitUntilVisible.
+ v displayLineFrom:0@0 to:50@50
"
"Modified: / 08-08-2010 / 14:46:34 / cg"
@@ -11818,25 +11850,25 @@
be wrapped by other programs.
i.e. its typical use is like:
- Dialog boxClosedNotificationSignal handle:[:ex |
- Transcript showCR:'box closed'
- ] do:[
- Dialog aboutToOpenBoxNotificationSignal handle:[:ex |
- Transcript showCR:'box about to open'
- ] do:[
- Dialog information:'This is a standard information box.'.
- ].
- ].
-
- Dialog boxClosedNotificationSignal handle:[:ex |
- Transcript showCR:'box closed'
- ] do:[
- Dialog aboutToOpenBoxNotificationSignal handle:[:ex |
- Transcript showCR:'box about to open'
- ] do:[
- Dialog confirm:'Yes or No.'.
- ].
- ].
+ Dialog boxClosedNotificationSignal handle:[:ex |
+ Transcript showCR:'box closed'
+ ] do:[
+ Dialog aboutToOpenBoxNotificationSignal handle:[:ex |
+ Transcript showCR:'box about to open'
+ ] do:[
+ Dialog information:'This is a standard information box.'.
+ ].
+ ].
+
+ Dialog boxClosedNotificationSignal handle:[:ex |
+ Transcript showCR:'box closed'
+ ] do:[
+ Dialog aboutToOpenBoxNotificationSignal handle:[:ex |
+ Transcript showCR:'box about to open'
+ ] do:[
+ Dialog confirm:'Yes or No.'.
+ ].
+ ].
"
! !