--- a/SimpleView.st Mon Oct 11 11:05:37 2010 +0200
+++ b/SimpleView.st Mon Oct 11 11:06:17 2010 +0200
@@ -100,164 +100,164 @@
[Instance variables:]
- superView <View> my superview i.e. the view I am in
-
- subViews <Collection> the collection of subviews
- These are the views proper.
-
- components <Collection> collection of gadgets (will be merged with subViews, soon)
- These are lightweight gadgets (not seen by windows/x11).
-
- styleSheet <ResourcePack> contains widget attributes (see libview/styles/*.style)
-
- resources <ResourcePack> contains national language translations (see lib*/resources/*.rs)
-
- border <Border> color and width of border
-
- unused <nil> to keep the instVar size constant
-
- viewShape <Form> shape of view & border (if device supports it)
-
- top <Number> actual top coordinate (pixels) in superview
-
- left <Number> actual left coordinate (pixels) in superview
-
- flagBits <Integer> flag bits (used to be individual booleans)
- extendChanged true if extend changed during setup
- originChanged true if origin changed during setup
-
- relativeOrigin <Number> relative origin in percent within superview
-
- relativeExtent <Number> relative extent in percent within superview
-
- relativeCorner <Number> relative corner in percent within superview
-
- originRule <Block> rule to compute origin if superview changes size
-
- extentRule <Block> rule to compute extent if superview changes size
-
- cornerRule <Block> rule to compute corner if superview changes size
-
- insets <Array> array with top, left, bottom & right insets (or nil)
-
- layout <LayoutObject> not yet implemented - will replace the above layout
- variables.
-
- shown <Boolean> true if visible (false if iconified, unmapped or covered)
-
- hiddenOnRealize <Boolean> dont show automatically when superview is realized
-
- name <String> my name (future use for resources)
-
- level (**) <Number> 3D level relative to superview
-
- margin <Number> convenient margin; that is the number of pixels
- which are taken up by border plus 3D level
- (i.e. borderWidth + level abs)
-
- innerClipRect <Rectangle> convenient inner clip (minus margin)
-
- shadowColor (**) <Color> color used to draw 3D shadowed edges
-
- lightColor (**) <Color> color used to draw 3D lighted edges
-
- bitGravity <nil | Symbol> gravity of contents (if device supports it)
-
- viewGravity <nil | Symbol> gravity of view (if device supports it)
-
- controller <nil | Controller> the controller (if any)
-
- windowGroup <WindowGroup> the windowGroup
-
- preferredExtent(*) <nil | Point> preferredExtent overWrite
- if nonNil, the widget will not compute
- its pref-extent, but use that value.
-
- explicitExtent(*) <nil | Point> preferredExtent overWrite
- if nonNil, the widget will not compute
- its pref-extent, but use that value.
-
- dependents <nil | Collection> who depends on me
-
- layoutManager
-
- visibilityChannel
-
- helpKey
-
- dropTarget
+ superView <View> my superview i.e. the view I am in
+
+ subViews <Collection> the collection of subviews
+ These are the views proper.
+
+ components <Collection> collection of gadgets (will be merged with subViews, soon)
+ These are lightweight gadgets (not seen by windows/x11).
+
+ styleSheet <ResourcePack> contains widget attributes (see libview/styles/*.style)
+
+ resources <ResourcePack> contains national language translations (see lib*/resources/*.rs)
+
+ border <Border> color and width of border
+
+ unused <nil> to keep the instVar size constant
+
+ viewShape <Form> shape of view & border (if device supports it)
+
+ top <Number> actual top coordinate (pixels) in superview
+
+ left <Number> actual left coordinate (pixels) in superview
+
+ flagBits <Integer> flag bits (used to be individual booleans)
+ extendChanged true if extend changed during setup
+ originChanged true if origin changed during setup
+
+ relativeOrigin <Number> relative origin in percent within superview
+
+ relativeExtent <Number> relative extent in percent within superview
+
+ relativeCorner <Number> relative corner in percent within superview
+
+ originRule <Block> rule to compute origin if superview changes size
+
+ extentRule <Block> rule to compute extent if superview changes size
+
+ cornerRule <Block> rule to compute corner if superview changes size
+
+ insets <Array> array with top, left, bottom & right insets (or nil)
+
+ layout <LayoutObject> not yet implemented - will replace the above layout
+ variables.
+
+ shown <Boolean> true if visible (false if iconified, unmapped or covered)
+
+ hiddenOnRealize <Boolean> dont show automatically when superview is realized
+
+ name <String> my name (future use for resources)
+
+ level (**) <Number> 3D level relative to superview
+
+ margin <Number> convenient margin; that is the number of pixels
+ which are taken up by border plus 3D level
+ (i.e. borderWidth + level abs)
+
+ innerClipRect <Rectangle> convenient inner clip (minus margin)
+
+ shadowColor (**) <Color> color used to draw 3D shadowed edges
+
+ lightColor (**) <Color> color used to draw 3D lighted edges
+
+ bitGravity <nil | Symbol> gravity of contents (if device supports it)
+
+ viewGravity <nil | Symbol> gravity of view (if device supports it)
+
+ controller <nil | Controller> the controller (if any)
+
+ windowGroup <WindowGroup> the windowGroup
+
+ preferredExtent(*) <nil | Point> preferredExtent overWrite
+ if nonNil, the widget will not compute
+ its pref-extent, but use that value.
+
+ explicitExtent(*) <nil | Point> preferredExtent overWrite
+ if nonNil, the widget will not compute
+ its pref-extent, but use that value.
+
+ dependents <nil | Collection> who depends on me
+
+ layoutManager
+
+ visibilityChannel
+
+ helpKey
+
+ dropTarget
(*) about to be changed to use preferredExtent as a cache and explicitExtent as
- an overwrite value.
+ an overwrite value.
(**) We have recently started to change the system to use borders instead of separate
- borderWidth, borderColor, level, shadow- and lightColors.
- Expect more changes here in the near future..
+ borderWidth, borderColor, level, shadow- and lightColors.
+ Expect more changes here in the near future..
[Class variables:]
- Grey <Color> the color grey - its used so often
-
- ViewSpacing <Number> preferred spacing between views; 1mm
-
- CentPoint <Point> 100 @ 100 - its used so often
-
- StyleSheet <ResourcePack> contains all view-style specifics
-
- ReturnFocusWhenClosingModalBoxes if true, a closing modalBox returns
- <Boolean> the keyboard focus to the view which was
- active when the box was opened.
- If false (the default), it is left to
- window manager to assign a new focus.
- If running on olwm/olvwm (which requires an
- explicit click to reassign a focus), it is
- better to turn this on in a private.rc file.
+ Grey <Color> the color grey - its used so often
+
+ ViewSpacing <Number> preferred spacing between views; 1mm
+
+ CentPoint <Point> 100 @ 100 - its used so often
+
+ StyleSheet <ResourcePack> contains all view-style specifics
+
+ ReturnFocusWhenClosingModalBoxes if true, a closing modalBox returns
+ <Boolean> the keyboard focus to the view which was
+ active when the box was opened.
+ If false (the default), it is left to
+ window manager to assign a new focus.
+ If running on olwm/olvwm (which requires an
+ explicit click to reassign a focus), it is
+ better to turn this on in a private.rc file.
[styleSheet parameters:]
- popupShadow <Boolean> if true, popupViews show a shadow below
-
- popupLevel <nil | Integer> 3D level
-
- borderWidth <nil | Integer> borderWidth (ignored in 3D styles)
-
- borderColor <nil | Color> borderColor (ignored in 3D styles)
-
- viewBackground <nil | Color> views background
-
- shadowColor <nil | Color> color for shadow edges (ignored in 2D styles)
-
- lightColor <nil | Color> color for light edges (ignored in 2D styles)
-
- font <nil | Font> font to use
+ popupShadow <Boolean> if true, popupViews show a shadow below
+
+ popupLevel <nil | Integer> 3D level
+
+ borderWidth <nil | Integer> borderWidth (ignored in 3D styles)
+
+ borderColor <nil | Color> borderColor (ignored in 3D styles)
+
+ viewBackground <nil | Color> views background
+
+ shadowColor <nil | Color> color for shadow edges (ignored in 2D styles)
+
+ lightColor <nil | Color> color for light edges (ignored in 2D styles)
+
+ font <nil | Font> font to use
TODO:
- get rid of relativeOrigin, relativeCorner, originRule, extentRule,
- and insets; replace by a single object which defines the size
- (mhmh - ST-80 seems to call this LayoutFrame ?)
- -> be prepared for a change here in the near future and ONLY use
- access methods to get those instance variables' values
-
- get rid of 3D level & margin, move it to extra wrappers
- (although this will make view setup more complicated, it will remove
- complexity from the internals of view. Also, it will allow for more
- varieties of borders.)
-
- add components (could also call them gadgets or lightweight views)
- - views are expensive in terms of X resources. This would make all
- framing/edge and panel helper views become cheap ST objects, instead
- of views.
+ get rid of relativeOrigin, relativeCorner, originRule, extentRule,
+ and insets; replace by a single object which defines the size
+ (mhmh - ST-80 seems to call this LayoutFrame ?)
+ -> be prepared for a change here in the near future and ONLY use
+ access methods to get those instance variables' values
+
+ get rid of 3D level & margin, move it to extra wrappers
+ (although this will make view setup more complicated, it will remove
+ complexity from the internals of view. Also, it will allow for more
+ varieties of borders.)
+
+ add components (could also call them gadgets or lightweight views)
+ - views are expensive in terms of X resources. This would make all
+ framing/edge and panel helper views become cheap ST objects, instead
+ of views.
[see also:]
- StandardSystemView DialogBox
- WindowGroup WindowEvent
- Layout
- ( introduction to view programming :html: programming/viewintro.html )
+ StandardSystemView DialogBox
+ WindowGroup WindowEvent
+ Layout
+ ( introduction to view programming :html: programming/viewintro.html )
[author:]
- Claus Gittinger
+ Claus Gittinger
"
!
@@ -267,50 +267,50 @@
to make the individual subviews visible)
a subView in a topView:
- [exBegin]
- |top v|
-
- top := StandardSystemView new.
- v := View new.
- v origin:0.25 @ 0.25 corner:0.75 @ 0.75.
- top addSubView:v.
- top open
- [exEnd]
+ [exBegin]
+ |top v|
+
+ top := StandardSystemView new.
+ v := View new.
+ v origin:0.25 @ 0.25 corner:0.75 @ 0.75.
+ top addSubView:v.
+ top open
+ [exEnd]
the same, a bit more compact:
- [exBegin]
- |top v|
-
- top := StandardSystemView new.
- v := View origin:0.25 @ 0.25 corner:0.75 @ 0.75 in:top.
- top open
- [exEnd]
+ [exBegin]
+ |top v|
+
+ top := StandardSystemView new.
+ v := View origin:0.25 @ 0.25 corner:0.75 @ 0.75 in:top.
+ top open
+ [exEnd]
fixed position/size:
- [exBegin]
+ [exBegin]
|top v1 v2|
top := StandardSystemView new.
top extent:300@300.
v1 := View origin:10@10
- corner:50@50
- in:top.
+ corner:50@50
+ in:top.
v2 := View origin:60@10
- corner:150@100
- in:top.
+ corner:150@100
+ in:top.
v1 viewBackground:(Color red).
v2 viewBackground:(Color yellow).
top open
- [exEnd]
+ [exEnd]
same, using ST-80 way of bulding up view hierarchies
(recommended, if you plan to port applications later)
- [exBegin]
+ [exBegin]
|top v1 v2|
top := StandardSystemView new.
@@ -332,10 +332,10 @@
v2 viewBackground:(Color yellow).
top open
- [exEnd]
+ [exEnd]
fixed origin, variable size:
- [exBegin]
+ [exBegin]
|top v1 v2|
top := StandardSystemView new.
@@ -354,11 +354,11 @@
top add:v2.
top open
- [exEnd]
+ [exEnd]
fixed origin, variable size,
bottomInset for constant distance from bottom:
- [exBegin]
+ [exBegin]
|top v1 v2|
top := StandardSystemView new.
@@ -379,10 +379,10 @@
top add:v2.
top open
- [exEnd]
+ [exEnd]
variable origin, variable size,
- [exBegin]
+ [exBegin]
|top v1 v2|
top := StandardSystemView new.
@@ -401,11 +401,11 @@
top add:v2.
top open
- [exEnd]
+ [exEnd]
variable origin, variable size,
insets for some constant distance
- [exBegin]
+ [exBegin]
|top v1 v2|
top := StandardSystemView new.
@@ -426,11 +426,11 @@
top add:v2.
top open
- [exEnd]
+ [exEnd]
using layout objects (ST-80 style):
fully specifying the frame
- [exBegin]
+ [exBegin]
|top v1 v2|
top := StandardSystemView new.
@@ -443,21 +443,21 @@
v2 viewBackground:(Color yellow).
top add:v1 in:(LayoutFrame new
- leftFraction:0.25;
- rightFraction:0.75;
- topFraction:0.0;
- bottomFraction:0.5).
+ leftFraction:0.25;
+ rightFraction:0.75;
+ topFraction:0.0;
+ bottomFraction:0.5).
top add:v2 in:(LayoutFrame new
- leftFraction:0.5;
- rightFraction:1.0;
- topFraction:0.5;
- bottomFraction:0.75).
+ leftFraction:0.5;
+ rightFraction:1.0;
+ topFraction:0.5;
+ bottomFraction:0.75).
top open
- [exEnd]
+ [exEnd]
another one, with offsets:
- [exBegin]
+ [exBegin]
|top v1 v2|
top := StandardSystemView new.
@@ -470,22 +470,22 @@
v2 viewBackground:(Color yellow).
top add:v1 in:(LayoutFrame new
- leftFraction:0.0 offset:10;
- rightFraction:1.0 offset:-10;
- topFraction:0.0 offset:10;
- bottomFraction:0.5).
+ leftFraction:0.0 offset:10;
+ rightFraction:1.0 offset:-10;
+ topFraction:0.0 offset:10;
+ bottomFraction:0.5).
top add:v2 in:(LayoutFrame new
- leftFraction:0.0 offset:30;
- rightFraction:1.0 offset:-30;
- topFraction:0.5 offset:10;
- bottomFraction:0.75).
+ leftFraction:0.0 offset:30;
+ rightFraction:1.0 offset:-30;
+ topFraction:0.5 offset:10;
+ bottomFraction:0.75).
top open
- [exEnd]
+ [exEnd]
specifying origin only. Extent is views preferred
(notice, that plain views have some defaultExtent of 100@100)
- [exBegin]
+ [exBegin]
|top v1 v2|
top := StandardSystemView new.
@@ -498,17 +498,17 @@
v2 viewBackground:(Color yellow).
top add:v1 in:(LayoutOrigin new
- leftFraction:0.25;
- topFraction:0.0).
+ leftFraction:0.25;
+ topFraction:0.0).
top add:v2 in:(LayoutOrigin new
- leftFraction:0.5;
- topFraction:0.5).
+ leftFraction:0.5;
+ topFraction:0.5).
top open
- [exEnd]
+ [exEnd]
same example, using buttons which compute their preferredBounds:
- [exBegin]
+ [exBegin]
|top v1 v2|
top := StandardSystemView new.
@@ -521,17 +521,17 @@
v2 backgroundColor:(Color yellow).
top add:v1 in:(LayoutOrigin new
- leftFraction:0.25;
- topFraction:0.0).
+ leftFraction:0.25;
+ topFraction:0.0).
top add:v2 in:(LayoutOrigin new
- leftFraction:0.5;
- topFraction:0.5).
+ leftFraction:0.5;
+ topFraction:0.5).
top open
- [exEnd]
+ [exEnd]
border:
- [exBegin]
+ [exBegin]
|top v1 v2|
top := StandardSystemView new.
@@ -545,7 +545,7 @@
v1 border:(SimpleBorder width:1 color:Color red).
v2 border:(SimpleBorder width:1 color:Color blue).
top open
- [exEnd]
+ [exEnd]
"
!
@@ -1191,8 +1191,8 @@
Needed after a style change or when a style file has been changed"
DefaultStyle notNil ifTrue:[
- self readStyleSheet.
- self updateAllStyleCaches.
+ self readStyleSheet.
+ self updateAllStyleCaches.
].
"Created: / 15.9.1998 / 22:03:59 / cg"
@@ -1296,8 +1296,8 @@
anyway."
<resource: #style (#viewSpacing #font #borderWidth #borderColor
- #viewBackground #shadowColor #lightColor
- #focusColor #focusBorderWidth)>
+ #viewBackground #shadowColor #lightColor
+ #focusColor #focusBorderWidth)>
|bgGrey currentScreen|
@@ -1306,68 +1306,68 @@
and keep the values in fast class variables
"
StyleSheet isNil ifTrue:[
- self setDefaultStyle.
- self readStyleSheet.
+ self setDefaultStyle.
+ self readStyleSheet.
].
currentScreen := Screen current.
Grey := StyleSheet viewGrey.
Grey isNil ifTrue:[
- Grey := Color grey
+ Grey := Color grey
].
Grey := Grey onDevice:currentScreen.
StyleSheet fileReadFailed ifTrue:[
- bgGrey := White
+ bgGrey := White
] ifFalse:[
- currentScreen hasGrayscales ifTrue:[
- bgGrey := Grey
- ] ifFalse:[
- bgGrey := White
- ]
+ currentScreen hasGrayscales ifTrue:[
+ bgGrey := Grey
+ ] ifFalse:[
+ bgGrey := White
+ ]
].
bgGrey := bgGrey onDevice:currentScreen.
ViewSpacing := StyleSheet at:#viewSpacing.
ViewSpacing isNil ifTrue:[
- ViewSpacing := currentScreen defaultStyleValueFor:#viewSpacing.
+ ViewSpacing := currentScreen defaultStyleValueFor:#viewSpacing.
].
DefaultBorderColor := StyleSheet colorAt:#borderColor.
DefaultBorderColor isNil ifTrue:[
- DefaultBorderColor := currentScreen defaultStyleValueFor:#borderColor
+ DefaultBorderColor := currentScreen defaultStyleValueFor:#borderColor
].
StyleSheet fileReadFailed ifTrue:[
- DefaultBorderWidth := 1.
- DefaultShadowColor := Black.
- DefaultLightColor := White.
- DefaultFocusColor := Black.
- DefaultFocusBorderWidth := 1.
- DefaultViewBackgroundColor := White.
+ DefaultBorderWidth := 1.
+ DefaultShadowColor := Black.
+ DefaultLightColor := White.
+ DefaultFocusColor := Black.
+ DefaultFocusBorderWidth := 1.
+ DefaultViewBackgroundColor := White.
] ifFalse:[
- DefaultBorderWidth := StyleSheet at:#borderWidth default:0.
- DefaultViewBackgroundColor := StyleSheet colorAt:#viewBackground default:bgGrey.
- DefaultShadowColor := StyleSheet colorAt:#shadowColor.
- DefaultLightColor := StyleSheet colorAt:#lightColor.
- DefaultFocusColor := StyleSheet colorAt:#focusColor default:Color red.
- DefaultFocusBorderWidth := StyleSheet at:'focusBorderWidth' default:2.
+ DefaultBorderWidth := StyleSheet at:#borderWidth default:0.
+ DefaultViewBackgroundColor := StyleSheet colorAt:#viewBackground default:bgGrey.
+ DefaultShadowColor := StyleSheet colorAt:#shadowColor.
+ DefaultLightColor := StyleSheet colorAt:#lightColor.
+ DefaultFocusColor := StyleSheet colorAt:#focusColor default:Color red.
+ DefaultFocusBorderWidth := StyleSheet at:'focusBorderWidth' default:2.
].
self == SimpleView ifTrue:[
- DefaultFont := StyleSheet at:#font.
- DefaultFont isNil ifTrue:[
- DefaultFont := Font family:'courier' face:'medium' style:'roman' size:12.
- ].
- DefaultFont := DefaultFont onDevice:currentScreen.
+ DefaultFont := StyleSheet at:#font.
+ DefaultFont isNil ifTrue:[
+ DefaultFont := Font family:'courier' face:'medium' style:'roman' size:12.
+ ].
+ DefaultFont := DefaultFont onDevice:currentScreen.
] ifFalse:[
- DefaultFont := nil
+ DefaultFont := nil
].
DefaultViewBackgroundColor isNil ifTrue:[
- 'SimpleView [warning]: bad viewBackground in style - using white' errorPrintCR.
- DefaultViewBackgroundColor := White
+ 'SimpleView [warning]: bad viewBackground in style - using white' errorPrintCR.
+ DefaultViewBackgroundColor := White
].
"Modified: / 29.4.1997 / 11:16:52 / dq"
@@ -1847,7 +1847,7 @@
"return my border"
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[
- ^ superView border
+ ^ superView border
].
^ border
@@ -1866,15 +1866,15 @@
|clr|
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[
- ^ superView borderColor
+ ^ superView borderColor
].
"/ ^ borderColor
- border notNil ifTrue:[
- clr := border color
- ].
+ border notNil ifTrue:[
+ clr := border color
+ ].
clr isNil ifTrue:[
- ^ Color black
+ ^ Color black
].
^ clr.
@@ -1887,16 +1887,16 @@
"/ backward compatibility
"/ superView will be renamed to container soon.
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[
- superView borderColor:aColor.
- ^ self
+ superView borderColor:aColor.
+ ^ self
].
aColor isNil ifTrue:[
- border isNil ifTrue:[^ self].
- self border:nil.
+ border isNil ifTrue:[^ self].
+ self border:nil.
] ifFalse:[
- aColor = (self borderColor) ifTrue:[^ self].
- self border:(SimpleBorder new width:(self borderWidth) color:aColor)
+ aColor = (self borderColor) ifTrue:[^ self].
+ self border:(SimpleBorder new width:(self borderWidth) color:aColor)
].
self invalidate.
@@ -1936,7 +1936,7 @@
"return my borderWidth"
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[
- ^ superView borderWidth
+ ^ superView borderWidth
].
border isNil ifTrue:[^ 0].
@@ -1952,18 +1952,18 @@
"/ backward compatibility
"/ superView will be renamed to container soon.
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[
- ^ superView borderWidth:aNumber
+ ^ superView borderWidth:aNumber
].
(aNumber == 0 or:[aNumber isNil]) ifTrue:[
- border isNil ifTrue:[^ self].
- self border:nil.
+ border isNil ifTrue:[^ self].
+ self border:nil.
] ifFalse:[
- border notNil ifTrue:[
- self border:(border copy width:aNumber)
- ] ifFalse:[
- self border:(SimpleBorder new width:aNumber color:(self borderColor)).
- ]
+ border notNil ifTrue:[
+ self border:(border copy width:aNumber)
+ ] ifFalse:[
+ self border:(SimpleBorder new width:aNumber color:(self borderColor)).
+ ]
].
"/ (aNumber ~~ borderWidth) ifTrue:[
@@ -1978,8 +1978,8 @@
computeMargin
border isNil ifTrue:[
- margin := level abs.
- ^ self.
+ margin := level abs.
+ ^ self.
].
margin := border width.
!
@@ -2017,7 +2017,7 @@
"return my level relative to superView (3D)"
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[
- ^ superView level
+ ^ superView level
].
border notNil ifTrue:[^ border level].
^ level
@@ -2568,50 +2568,50 @@
extent:extent
"set the views extent;
extent may be:
- a point
- where integer fields mean 'pixel-values'
- and float values mean 'relative-to-superview'
- and nil means 'leave current value';
+ a point
+ where integer fields mean 'pixel-values'
+ and float values mean 'relative-to-superview'
+ and nil means 'leave current value';
or a block returning a point which is interpreted as above.
Be careful when using relative extents: rounding errors may
accumulate. Better use origin/corner.
Best: migrate to use layour objects.
Notice: this sets the views explicitExtent flag, which prevents it normally
- from resizing itself to its preferredExtent.
- See initialExtent: for a variation."
+ from resizing itself to its preferredExtent.
+ See initialExtent: for a variation."
|w h pixelExtent e|
self explicitExtent:true.
extent isBlock ifTrue:[
- extentRule := extent.
- drawableId notNil ifTrue:[
- pixelExtent := extent value
- ] ifFalse:[
- self extentChangedFlag:true
- ]
+ extentRule := extent.
+ drawableId notNil ifTrue:[
+ pixelExtent := extent value
+ ] ifFalse:[
+ self extentChangedFlag:true
+ ]
] ifFalse:[
- w := extent x.
- h := extent y.
- w isNil ifTrue:[w := width].
- h isNil ifTrue:[h := height].
- e := w@h.
- ((w isInteger not) or:[h isInteger not]) ifTrue:[
- "/ w > 1 ifTrue:[self halt].
- relativeExtent := e.
- pixelExtent := self extentFromRelativeExtent.
- pixelExtent isNil ifTrue:[
- self extentChangedFlag:true
- ]
- ] ifFalse:[
- relativeExtent := nil.
- pixelExtent := e
- ]
+ w := extent x.
+ h := extent y.
+ w isNil ifTrue:[w := width].
+ h isNil ifTrue:[h := height].
+ e := w@h.
+ ((w isInteger not) or:[h isInteger not]) ifTrue:[
+ "/ w > 1 ifTrue:[self halt].
+ relativeExtent := e.
+ pixelExtent := self extentFromRelativeExtent.
+ pixelExtent isNil ifTrue:[
+ self extentChangedFlag:true
+ ]
+ ] ifFalse:[
+ relativeExtent := nil.
+ pixelExtent := e
+ ]
].
pixelExtent notNil ifTrue:[
- self pixelExtent:pixelExtent
+ self pixelExtent:pixelExtent
]
"Modified: / 07-07-2010 / 16:44:57 / cg"
@@ -2788,9 +2788,9 @@
layout := aLayoutObject.
superView isNil ifTrue:[
- self originChangedFlag:true extentChangedFlag:true cornerChangedFlag:true.
+ self originChangedFlag:true extentChangedFlag:true cornerChangedFlag:true.
] ifFalse:[
- self containerChangedSize.
+ self containerChangedSize.
]
"Modified: 19.9.1995 / 16:17:25 / claus"
@@ -2852,40 +2852,31 @@
into the visible screen area if nescessary.
This method will be moved to StandardSystemView ..."
- |devBot devRgt devLft devTop newTop newLeft monitorInfoAtPoint|
-
+ |devBot devRgt devLft devTop newTop newLft screenBounds|
+
+"/ ******* MULTI SCREEN
newTop := top.
- newLeft := left.
-
- monitorInfoAtPoint := device monitorInfoAtPoint:(left@top).
-
- monitorInfoAtPoint notNil ifTrue:[
- devLft := monitorInfoAtPoint screenX.
- devRgt := monitorInfoAtPoint screenWidth + devLft.
- devTop := monitorInfoAtPoint screenY.
- devBot := monitorInfoAtPoint screenHeight + devTop.
- ] ifFalse:[
- devLft := 0.
- devRgt := device usableExtent x.
- devTop := 0.
- devBot := device usableExtent y.
- ].
+ newLft := left.
+
+ screenBounds := device monitorBoundsAt:(left@top).
+
+ devLft := screenBounds left.
+ devRgt := screenBounds right.
+ devTop := screenBounds top.
+ devBot := screenBounds bottom.
+
(top + height) > devBot ifTrue:[
- newTop := (devBot - height) max:devTop.
+ newTop := devBot - height.
].
(left + width) > devRgt ifTrue:[
- newLeft := (devRgt - width) max:devLft.
- ].
-
- (newTop < 0) ifTrue:[
- newTop := 0.
- ].
- (newLeft < 0) ifTrue:[
- newLeft := 0
- ].
- ((newTop ~~ top) or:[newLeft ~~ left]) ifTrue:[
- self origin:newLeft @ newTop
- ]
+ newLft := devRgt - width.
+ ].
+ newLft := newLft max:devLft.
+ newTop := newTop max:devTop.
+
+ ((newTop ~~ top) or:[newLft ~~ left]) ifTrue:[
+ self origin:( newLft @ newTop ).
+ ].
!
makeRoundViewShapeWithBorder:bw
@@ -5208,15 +5199,15 @@
"find a visible subview for which aBlock returns true (recursively)"
subViews notNil ifTrue:[
- subViews do:[:aSubview |
- |v|
-
- aSubview shown ifTrue:[
- (aBlock value:aSubview) ifTrue:[ ^ aSubview ].
- v := aSubview allVisibleSubViewsDetect:aBlock ifNone:nil.
- v notNil ifTrue:[^ v].
- ].
- ]
+ subViews do:[:aSubview |
+ |v|
+
+ aSubview shown ifTrue:[
+ (aBlock value:aSubview) ifTrue:[ ^ aSubview ].
+ v := aSubview allVisibleSubViewsDetect:aBlock ifNone:nil.
+ v notNil ifTrue:[^ v].
+ ].
+ ]
].
^ exceptionBlock value.
!
@@ -5438,7 +5429,7 @@
configureX:x y:y width:newWidth height:newHeight
"my size has changed by window manager action"
- |how anyEdge mustRedrawBottomEdge mustRedrawRightEdge
+ |how anyEdge mustRedrawBottomEdge mustRedrawRightEdge
mustRedrawPreviousRightBorderArea mustRedrawPreviousBottomBorderArea p originChanged|
originChanged := (left ~= x) or:[top ~= y].
@@ -5448,74 +5439,74 @@
(superView isNil
and:[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 := 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 := 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:[
@@ -5525,11 +5516,11 @@
"/ self drawRightEdge
"/ ].
"/ self deviceClippingRectangle:innerClipRect
- ]
+ ]
].
originChanged ifTrue:[
- self changed:#origin.
+ self changed:#origin.
].
"Modified: / 10.10.2001 / 14:14:19 / cg"
@@ -5694,7 +5685,7 @@
|leftEdge topEdge rightEdge botEdge anyEdge nx ny nw nh dx dy dw dh old oldPaint|
shown ifFalse:[
- ^ self
+ ^ self
].
nw := dw := w.
@@ -5708,112 +5699,112 @@
check if there is a need to draw an edge (i.e. if margin is hit)
"
(margin ~~ 0) ifTrue:[
- leftEdge := false.
- topEdge := false.
- rightEdge := false.
- botEdge := false.
- transformation notNil ifTrue:[
- "
- need device coordinates for this test
- "
- nx := transformation applyToX:nx.
- ny := transformation applyToY:ny.
- nw := transformation applyScaleX:nw.
- nh := transformation applyScaleY:nh.
- ].
- "
- adjust expose rectangle, to exclude the margin.
- Care for rounding errors ...
- "
- (nx isMemberOf:SmallInteger) ifFalse:[
- old := nx.
- nx := nx truncated.
- nw := nw + (nx - old).
- ].
- (ny isMemberOf:SmallInteger) ifFalse:[
- old := ny.
- ny := ny truncated.
- nh := nh + (ny - old).
- ].
- (nw isMemberOf:SmallInteger) ifFalse:[
- nw := nw truncated + 1
- ].
- (nh isMemberOf:SmallInteger) ifFalse:[
- nh := nh truncated + 1
- ].
-
- dx := nx.
- dy := ny.
- dw := nw.
- dh := nh.
-
- (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.
- ].
- transformation notNil ifTrue:[
- "
- need logical coordinates for redraw
- "
- nx := transformation applyInverseToX:nx.
- ny := transformation applyInverseToY:ny.
- nw := transformation applyInverseScaleX:nw.
- nh := transformation applyInverseScaleY:nh.
- ].
+ leftEdge := false.
+ topEdge := false.
+ rightEdge := false.
+ botEdge := false.
+ transformation notNil ifTrue:[
+ "
+ need device coordinates for this test
+ "
+ nx := transformation applyToX:nx.
+ ny := transformation applyToY:ny.
+ nw := transformation applyScaleX:nw.
+ nh := transformation applyScaleY:nh.
+ ].
+ "
+ adjust expose rectangle, to exclude the margin.
+ Care for rounding errors ...
+ "
+ (nx isMemberOf:SmallInteger) ifFalse:[
+ old := nx.
+ nx := nx truncated.
+ nw := nw + (nx - old).
+ ].
+ (ny isMemberOf:SmallInteger) ifFalse:[
+ old := ny.
+ ny := ny truncated.
+ nh := nh + (ny - old).
+ ].
+ (nw isMemberOf:SmallInteger) ifFalse:[
+ nw := nw truncated + 1
+ ].
+ (nh isMemberOf:SmallInteger) ifFalse:[
+ nh := nh truncated + 1
+ ].
+
+ dx := nx.
+ dy := ny.
+ dw := nw.
+ dh := nh.
+
+ (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.
+ ].
+ transformation notNil ifTrue:[
+ "
+ need logical coordinates for redraw
+ "
+ nx := transformation applyInverseToX:nx.
+ ny := transformation applyInverseToY:ny.
+ nw := transformation applyInverseScaleX:nw.
+ nh := transformation applyInverseScaleY:nh.
+ ].
].
(nw > 0 and:[nh > 0]) ifTrue:[
- "
- redraw inside area
- "
- self clippingRectangle:(Rectangle left:nx top:ny width:nw height:nh).
-
- self redrawX:nx y:ny width:nw height:nh.
+ "
+ redraw inside area
+ "
+ self clippingRectangle:(Rectangle left:nx top:ny width:nw height:nh).
+
+ self redrawX:nx y:ny width:nw height:nh.
].
"
redraw edge(s)
"
anyEdge ifTrue:[
- self deviceClippingRectangle:nil.
- oldPaint := 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 deviceClippingRectangle:nil.
+ oldPaint := 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 deviceClippingRectangle:innerClipRect.
@@ -6456,17 +6447,17 @@
|viewInSubView|
self subviewsInFocusOrder do:[:aSubView|
- aSubView shown ifTrue:[
- (aSubView canTab
- and:[aSubView enabled
- and:[aCondition value:aSubView]]) ifTrue:[
- ^ aSubView
- ].
-
- (viewInSubView := aSubView focusNextForWhich:aCondition) notNil ifTrue:[
- ^ viewInSubView
- ]
- ]
+ aSubView shown ifTrue:[
+ (aSubView canTab
+ and:[aSubView enabled
+ and:[aCondition value:aSubView]]) ifTrue:[
+ ^ aSubView
+ ].
+
+ (viewInSubView := aSubView focusNextForWhich:aCondition) notNil ifTrue:[
+ ^ viewInSubView
+ ]
+ ]
].
^ nil
!
@@ -6900,32 +6891,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 := Black
+ shadowColor := Black
].
((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
@@ -6998,15 +6989,15 @@
"/ self originChangedFlag:false extentChangedFlag:false cornerChangedFlag:false.
name isNil ifTrue:[
- name := self class name.
+ name := self class name.
].
bitGravity := #NorthWest. "/ nil.
viewGravity := nil.
controllerClass := self defaultControllerClass.
controllerClass notNil ifTrue:[
- controller := controllerClass new.
- controller view:self.
+ controller := controllerClass new.
+ controller view:self.
].
self initializeMiddleButtonMenu.
@@ -7037,11 +7028,11 @@
self initStyle.
(drawableId notNil and:[gcId notNil]) ifTrue:[
- "force a change"
- t := self borderWidth. self borderWidth:nil. self borderWidth:t.
- t := viewBackground. viewBackground := nil. self viewBackground:t.
- self clearView.
- self invalidate.
+ "force a change"
+ t := self borderWidth. self borderWidth:nil. self borderWidth:t.
+ t := viewBackground. viewBackground := nil. self viewBackground:t.
+ self clearView.
+ self invalidate.
].
"Modified: / 18.9.1998 / 21:15:33 / cg"
@@ -7708,25 +7699,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 ...
- "/
- drawableId notNil ifTrue:[
- device moveWindow: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 ...
+ "/
+ drawableId notNil ifTrue:[
+ device moveWindow:drawableId x:left y:top
+ ] ifFalse:[
+ self originChangedFlag:true
+ ]
]
!
@@ -7761,16 +7752,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].
- self changed:#origin.
- ^ self pixelOrigin:origin
+ sameOrigin ifTrue:[^ self].
+ self changed:#origin.
+ ^ self pixelOrigin:origin
].
top := newTop.
@@ -7778,143 +7769,143 @@
"/ shown ifTrue:[ "4-nov-94 actually correct,"
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 clippingRectangle:nil.
- oldPaint := paint.
- self paint:viewBackground.
- self fillDeviceRectangleX:(width - margin)
- y:0
- width:margin
- height:height.
- mustRepaintRight := true.
- ].
- newHeight > height ifTrue:[
- self clippingRectangle:nil.
- oldPaint := 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: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 clippingRectangle:nil.
+ oldPaint := paint.
+ self paint:viewBackground.
+ self fillDeviceRectangleX:(width - margin)
+ y:0
+ width:margin
+ height:height.
+ mustRepaintRight := true.
+ ].
+ newHeight > height ifTrue:[
+ self clippingRectangle:nil.
+ oldPaint := 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: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: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 deviceClippingRectangle:nil.
- oldPaint := paint.
- mustRedrawBottomEdge ifTrue:[
- self drawBottomEdge
- ].
- mustRedrawRightEdge ifTrue:[
- self drawRightEdge
- ].
- self paint:oldPaint.
- self deviceClippingRectangle:innerClipRect
- ]
- ].
- ].
-
- mustRepaintRight ifTrue:[
- self invalidateDeviceRectangle:(((oldWidth - margin) @ 0)
- extent:margin@height)
- repairNow:false.
+ device moveResizeWindow: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 deviceClippingRectangle:nil.
+ oldPaint := paint.
+ mustRedrawBottomEdge ifTrue:[
+ self drawBottomEdge
+ ].
+ mustRedrawRightEdge ifTrue:[
+ self drawRightEdge
+ ].
+ self paint:oldPaint.
+ self deviceClippingRectangle: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 size > 0 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 size > 0 ifTrue:[
+ self extentChangedBeforeCreatedFlag:true.
+ ].
].
sameOrigin ifFalse:[
- self changed:#origin.
+ self changed:#origin.
].
"Modified: / 25.5.1999 / 14:49:56 / cg"
@@ -8315,10 +8306,10 @@
newBits := flagBits bitClear:(FlagOriginChanged | FlagExtentChanged).
originChanged ifTrue:[
- newBits := newBits bitOr:FlagOriginChanged
+ newBits := newBits bitOr:FlagOriginChanged
].
extentChanged ifTrue:[
- newBits := newBits bitOr:FlagExtentChanged
+ newBits := newBits bitOr:FlagExtentChanged
].
flagBits := newBits.
@@ -8330,13 +8321,13 @@
newBits := flagBits bitClear:(FlagOriginChanged | FlagExtentChanged | FlagCornerChanged).
originChanged ifTrue:[
- newBits := newBits bitOr:FlagOriginChanged
+ newBits := newBits bitOr:FlagOriginChanged
].
extentChanged ifTrue:[
- newBits := newBits bitOr:FlagExtentChanged
+ newBits := newBits bitOr:FlagExtentChanged
].
cornerChanged ifTrue:[
- newBits := newBits bitOr:FlagCornerChanged
+ newBits := newBits bitOr:FlagCornerChanged
].
flagBits := newBits.
@@ -8592,11 +8583,11 @@
This does not make the view visible (needs a #map for that)"
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:[
@@ -8604,42 +8595,42 @@
"/ controller manager:(superView controller manager)
"/ ]
"/ ]
- ] ifFalse:[
- "/
- "/ 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:[
+ "/
+ "/ 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"
@@ -8901,20 +8892,20 @@
isInputOnly := self isInputOnly.
drawableId := device
- createWindowFor:self
- type:(self windowType)
- origin:(left @ top)
- extent:(width @ height)
- minExtent:nil
- maxExtent:nil
- borderWidth:0 "self borderWidth"
- subViewOf:sv
- style:(self windowStyle)
- inputOnly:isInputOnly
- label:nil
- owner:nil
- icon:nil iconMask:nil
- iconView:nil.
+ createWindowFor:self
+ type:(self windowType)
+ origin:(left @ top)
+ extent:(width @ height)
+ minExtent:nil
+ maxExtent:nil
+ borderWidth:0 "self borderWidth"
+ subViewOf:sv
+ style:(self windowStyle)
+ inputOnly:isInputOnly
+ label:nil
+ owner:nil
+ icon:nil iconMask:nil
+ iconView:nil.
Lobby registerChange:self.
@@ -8932,28 +8923,28 @@
"/ ]
"/ ].
(viewGravity notNil "and:[viewGravity ~~ #NorthWest]") ifTrue:[
- device setWindowGravity:viewGravity in:drawableId
+ device setWindowGravity:viewGravity in:drawableId
].
(bitGravity notNil "and:[bitGravity ~~ #NorthWest]") ifTrue:[
- isInputOnly ifFalse:[
- device setBitGravity:bitGravity in:drawableId
- ]
+ isInputOnly ifFalse:[
+ device setBitGravity:bitGravity in:drawableId
+ ]
].
viewShape notNil ifTrue:[
- self setViewShape
+ self setViewShape
].
(backed notNil and:[backed ~~ false]) ifTrue:[
- device setBackingStore:backed in:drawableId
+ device setBackingStore:backed in:drawableId
].
self saveUnder ifTrue:[
- device setSaveUnder:true in:drawableId
+ device setSaveUnder:true in:drawableId
].
cursor notNil ifTrue:[
- self setCursor
+ self setCursor
].
name notNil ifTrue:[
- device setWindowName:name in:drawableId.
+ device setWindowName:name in:drawableId.
].
"Modified: / 9.4.1998 / 20:18:12 / cg"
@@ -9545,12 +9536,12 @@
self clippingRectangle:area.
self clearExposedAreaInRedraw ifTrue:[
- "/ win95 workaround: non-existing bg-pixmap support (obsolete)
- (viewBackground isImageOrForm and:[ device supportsAnyViewBackgroundPixmaps not ]) ifTrue:[
- self fillRectangleWithViewBackgroundX:x y:y width:w height:h
- ] ifFalse:[
- self clearRectangleX:x y:y width:w height:h.
- ]
+ "/ win95 workaround: non-existing bg-pixmap support (obsolete)
+ (viewBackground isImageOrForm and:[ device supportsAnyViewBackgroundPixmaps not ]) ifTrue:[
+ self fillRectangleWithViewBackgroundX:x y:y width:w height:h
+ ] ifFalse:[
+ self clearRectangleX:x y:y width:w height:h.
+ ]
].
self renderOrRedraw.
@@ -9564,12 +9555,12 @@
renderOrRedraw
renderer notNil ifTrue:[
- "/ experimental feature
- thisContext isRecursive ifTrue:[self halt].
- renderer render:self on:self at:0@0
+ "/ experimental feature
+ thisContext isRecursive ifTrue:[self halt].
+ renderer render:self on:self at:0@0
] ifFalse:[
- "/ redraw everything - a fallBack for lazy views.
- self redraw.
+ "/ redraw everything - a fallBack for lazy views.
+ self redraw.
].
!
@@ -9716,8 +9707,8 @@
|viewOrigin|
nPixels ~~ 0 ifTrue:[
- viewOrigin := self viewOrigin.
- self scrollTo:(viewOrigin x @ (viewOrigin y + nPixels))
+ viewOrigin := self viewOrigin.
+ self scrollTo:(viewOrigin x @ (viewOrigin y + nPixels))
]
"Modified: / 20-08-1996 / 17:34:36 / stefan"
@@ -10237,137 +10228,140 @@
|tops mainView mainViewID previousGroup mainGroup|
self isPopUpView ifFalse:[
- "/ the following allows for knowledgable programmers to suppress dialog boxes,
- "/ or to patch common controls right before opening...
- (Dialog aboutToOpenBoxNotificationSignal raiseRequestWith:self) == #abort ifTrue:[
- ^ self
- ].
-
- aWindowGroup notNil ifTrue:[
- (tops := aWindowGroup topViews) notEmptyOrNil ifTrue:[
- mainView := tops detect:[:v| v shown] ifNone:nil.
- mainView notNil ifTrue:[
- mainViewID := mainView id.
- ]
- ].
- ].
-
- mainView notNil ifTrue:[
- mainView activate; setForegroundWindow.
- ].
-
- ModalBox usingTransientViews ifTrue:[
- "make view only transient, if there is a visible topView.
- If none of them is visible, we do want an icon for ourself"
-
- mainViewID isNil ifTrue:[
- self origin:(device center - (self extent//2))
- ].
-
- drawableId isNil ifTrue:[self create].
- mainView notNil ifTrue:[
- device setTransient:drawableId for:mainViewID.
- ].
- ].
+ "/ the following allows for knowledgable programmers to suppress dialog boxes,
+ "/ or to patch common controls right before opening...
+ (Dialog aboutToOpenBoxNotificationSignal raiseRequestWith:self) == #abort ifTrue:[
+ ^ self
+ ].
+
+ aWindowGroup notNil ifTrue:[
+ (tops := aWindowGroup topViews) notEmptyOrNil ifTrue:[
+ mainView := tops detect:[:v| v shown] ifNone:nil.
+ mainView notNil ifTrue:[
+ mainViewID := mainView id.
+ ]
+ ].
+ ].
+
+ mainView notNil ifTrue:[
+ mainView activate; setForegroundWindow.
+ ].
+
+ ModalBox usingTransientViews ifTrue:[
+ "make view only transient, if there is a visible topView.
+ If none of them is visible, we do want an icon for ourself"
+
+ mainViewID isNil ifTrue:[
+"/ ******* MULTI SCREEN
+ |monitorBounds|
+ monitorBounds := device monitorBoundsAt:(device pointerPosition).
+ self origin:(monitorBounds center rounded - (self extent//2))
+ ].
+
+ drawableId isNil ifTrue:[self create].
+ mainView notNil ifTrue:[
+ device setTransient:drawableId for:mainViewID.
+ ].
+ ].
].
self raise.
Processor activeProcessIsSystemProcess ifTrue:[
- "
- put myself into the modal group, let it handle events for
- me as well. This is only a half way solution, since the view
- is not modal at all ... however, the only situation
- where this happens is with modal boxes popped while in a
- modal browser. You will forgive me for that inconvenience.
- "
- windowGroup := aWindowGroup.
- aWindowGroup notNil ifTrue:[aWindowGroup addTopView:self].
- self realize
+ "
+ put myself into the modal group, let it handle events for
+ me as well. This is only a half way solution, since the view
+ is not modal at all ... however, the only situation
+ where this happens is with modal boxes popped while in a
+ modal browser. You will forgive me for that inconvenience.
+ "
+ windowGroup := aWindowGroup.
+ aWindowGroup notNil ifTrue:[aWindowGroup addTopView:self].
+ self realize
] ifFalse:[
- previousGroup := WindowGroup activeGroup.
-
- "
- show a stop-cursor in the suspended window groups
- "
- (aWindowGroup notNil and:[self isPopUpView not]) ifTrue:[
- mainGroup := aWindowGroup mainGroup.
- mainGroup showCursor:(Cursor stop).
- previousGroup ~~ mainGroup ifTrue:[
- previousGroup showCursor:(Cursor stop).
- ].
- ].
-
- "
- create a new window group and put myself into it
- "
- windowGroup := self windowGroupClass new.
- windowGroup addTopView:self.
- windowGroup setPreviousGroup:previousGroup.
-
- superView notNil ifTrue:[
- "/
- "/ special: this is a modal subview,
- "/ prevent the view from reassigning its windowGroup when realized
- "/ (subviews normaly place themself into the superviews group)
- "/
- windowGroup isForModalSubview:true.
- ].
-
- "
- go dispatch events in this new group
- (thus current windowgroup is blocked from interaction)
- "
- AbortOperationRequest handle:[:ex |
- AbortOperationRequest handle:[:ex2 |
- "/ an aborted hide (user confirmation ?)
- self breakPoint:#cg.
- ex proceed
- ] do:[
- self hide.
- self realized ifTrue:[
- "/ self halt. "/ hide handled and closeRequest not wanted:
- ex proceed
- ].
- ].
- ] do:[
- [
- [
- windowGroup startupModal:[realized and:aBlock] forGroup:aWindowGroup
- ] ifCurtailed:[
- self hide.
- ]
- ] ensure:[
- aWindowGroup notNil ifTrue:[
- aWindowGroup graphicsDevice sync. "thats a round trip - make sure that all drawing has been processed"
- "/ ensure that eventListener runs here ...
- Delay waitForSeconds:0.05.
- aWindowGroup processExposeEvents.
-
- ReturnFocusWhenClosingModalBoxes ifTrue:[
- "
- return the input focus to the previously active group's top.
- This helps with windowmanagers which need an explicit click
- on the view for the focus.
- "
- tops := aWindowGroup topViews.
- (tops notEmptyOrNil) ifTrue:[
- tops first getKeyboardFocus
- ].
- ].
-
- "
- restore cursors in the changed groups
- "
- mainGroup notNil ifTrue:[
- mainGroup restoreCursors.
- previousGroup ~~ mainGroup ifTrue:[
- previousGroup restoreCursors.
- ].
- ].
- ]
- ]
- ].
+ previousGroup := WindowGroup activeGroup.
+
+ "
+ show a stop-cursor in the suspended window groups
+ "
+ (aWindowGroup notNil and:[self isPopUpView not]) ifTrue:[
+ mainGroup := aWindowGroup mainGroup.
+ mainGroup showCursor:(Cursor stop).
+ previousGroup ~~ mainGroup ifTrue:[
+ previousGroup showCursor:(Cursor stop).
+ ].
+ ].
+
+ "
+ create a new window group and put myself into it
+ "
+ windowGroup := self windowGroupClass new.
+ windowGroup addTopView:self.
+ windowGroup setPreviousGroup:previousGroup.
+
+ superView notNil ifTrue:[
+ "/
+ "/ special: this is a modal subview,
+ "/ prevent the view from reassigning its windowGroup when realized
+ "/ (subviews normaly place themself into the superviews group)
+ "/
+ windowGroup isForModalSubview:true.
+ ].
+
+ "
+ go dispatch events in this new group
+ (thus current windowgroup is blocked from interaction)
+ "
+ AbortOperationRequest handle:[:ex |
+ AbortOperationRequest handle:[:ex2 |
+ "/ an aborted hide (user confirmation ?)
+ self breakPoint:#cg.
+ ex proceed
+ ] do:[
+ self hide.
+ self realized ifTrue:[
+ "/ self halt. "/ hide handled and closeRequest not wanted:
+ ex proceed
+ ].
+ ].
+ ] do:[
+ [
+ [
+ windowGroup startupModal:[realized and:aBlock] forGroup:aWindowGroup
+ ] ifCurtailed:[
+ self hide.
+ ]
+ ] ensure:[
+ aWindowGroup notNil ifTrue:[
+ aWindowGroup graphicsDevice sync. "thats a round trip - make sure that all drawing has been processed"
+ "/ ensure that eventListener runs here ...
+ Delay waitForSeconds:0.05.
+ aWindowGroup processExposeEvents.
+
+ ReturnFocusWhenClosingModalBoxes ifTrue:[
+ "
+ return the input focus to the previously active group's top.
+ This helps with windowmanagers which need an explicit click
+ on the view for the focus.
+ "
+ tops := aWindowGroup topViews.
+ (tops notEmptyOrNil) ifTrue:[
+ tops first getKeyboardFocus
+ ].
+ ].
+
+ "
+ restore cursors in the changed groups
+ "
+ mainGroup notNil ifTrue:[
+ mainGroup restoreCursors.
+ previousGroup ~~ mainGroup ifTrue:[
+ previousGroup restoreCursors.
+ ].
+ ].
+ ]
+ ]
+ ].
]
"Created: / 10-12-1995 / 14:06:14 / cg"
@@ -10527,45 +10521,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 waitForSeconds:0.05.
- (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 waitForSeconds:0.05.
+ (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"
@@ -10658,11 +10652,11 @@
!SimpleView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.666 2010-10-05 15:57:16 mb Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.667 2010-10-11 09:06:17 mb Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.666 2010-10-05 15:57:16 mb Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.667 2010-10-11 09:06:17 mb Exp $'
! !
SimpleView initialize!