diff -r a7e3b6a9aa63 -r 9dd8621ec788 SimpleView.st --- a/SimpleView.st Wed Jul 20 10:09:01 2016 +0200 +++ b/SimpleView.st Wed Jul 20 10:10:58 2016 +0200 @@ -1,6 +1,6 @@ " COPYRIGHT (c) 1989 by Claus Gittinger - All Rights Reserved + All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the @@ -16,25 +16,25 @@ "{ NameSpace: Smalltalk }" DisplaySurface subclass:#SimpleView - instanceVariableNames:'superView subViews components styleSheet resources border unused - viewShape top left flagBits relativeOrigin relativeExtent - relativeCorner originRule extentRule cornerRule insets layout - shown hiddenOnRealize name level margin innerClipRect shadowColor - lightColor bitGravity viewGravity controller windowGroup - preferredExtent explicitExtent dependents layoutManager - visibilityChannel helpKey dropTarget' - classVariableNames:'CentPoint DefaultBorderColor DefaultBorderWidth - DefaultFocusBorderWidth DefaultFocusColor DefaultLightColor - DefaultShadowColor DefaultStyle DefaultViewBackgroundColor - FlagBeingDestroyed FlagCanTab FlagCornerChanged - FlagDoNotRequestFocusOnPointerEnter FlagExtentChanged - FlagExtentChangedBeforeCreated FlagHasExplicitExtent - FlagHiddenOnRealize FlagIsMDIChild FlagIsUnmappedModalBox - FlagNativeWidget FlagOriginChanged FlagRequestFocusOnPointerEnter - FlagTakeFocusWhenMapped Grey ReturnFocusWhenClosingModalBoxes - StyleSheet ViewSpacing' - poolDictionaries:'' - category:'Views-Basic' + instanceVariableNames:'superView subViews components styleSheet resources border unused + viewShape top left flagBits relativeOrigin relativeExtent + relativeCorner originRule extentRule cornerRule insets layout + shown hiddenOnRealize name level margin innerClipRect shadowColor + lightColor bitGravity viewGravity controller windowGroup + preferredExtent explicitExtent dependents layoutManager + visibilityChannel helpKey dropTarget' + classVariableNames:'CentPoint DefaultBorderColor DefaultBorderWidth + DefaultFocusBorderWidth DefaultFocusColor DefaultLightColor + DefaultShadowColor DefaultStyle DefaultViewBackgroundColor + FlagBeingDestroyed FlagCanTab FlagCornerChanged + FlagDoNotRequestFocusOnPointerEnter FlagExtentChanged + FlagExtentChangedBeforeCreated FlagHasExplicitExtent + FlagHiddenOnRealize FlagIsMDIChild FlagIsUnmappedModalBox + FlagNativeWidget FlagOriginChanged FlagRequestFocusOnPointerEnter + FlagTakeFocusWhenMapped Grey ReturnFocusWhenClosingModalBoxes + StyleSheet ViewSpacing' + poolDictionaries:'' + category:'Views-Basic' ! SimpleView class instanceVariableNames:'ClassResources DefaultFont' @@ -45,38 +45,38 @@ ! ProceedingNotification subclass:#AboutToOpenBoxNotificationSignal - instanceVariableNames:'' - classVariableNames:'' - poolDictionaries:'' - privateIn:SimpleView + instanceVariableNames:'' + classVariableNames:'' + poolDictionaries:'' + privateIn:SimpleView ! Object subclass:#ViewShape - instanceVariableNames:'' - classVariableNames:'' - poolDictionaries:'' - privateIn:SimpleView + instanceVariableNames:'' + classVariableNames:'' + poolDictionaries:'' + privateIn:SimpleView ! ProceedingNotification subclass:#BoxClosedNotificationSignal - instanceVariableNames:'' - classVariableNames:'' - poolDictionaries:'' - privateIn:SimpleView + instanceVariableNames:'' + classVariableNames:'' + poolDictionaries:'' + privateIn:SimpleView ! SimpleView::ViewShape subclass:#RoundViewShape - instanceVariableNames:'' - classVariableNames:'' - poolDictionaries:'' - privateIn:SimpleView + instanceVariableNames:'' + classVariableNames:'' + poolDictionaries:'' + privateIn:SimpleView ! SimpleView::ViewShape subclass:#ArbitraryViewShape - instanceVariableNames:'viewShapeForm borderShapeForm' - classVariableNames:'' - poolDictionaries:'' - privateIn:SimpleView + instanceVariableNames:'viewShapeForm borderShapeForm' + classVariableNames:'' + poolDictionaries:'' + privateIn:SimpleView ! !SimpleView class methodsFor:'documentation'! @@ -84,7 +84,7 @@ copyright " COPYRIGHT (c) 1989 by Claus Gittinger - All Rights Reserved + All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the @@ -111,164 +111,164 @@ [Instance variables:] - superView my superview i.e. the view I am in - - subViews the collection of subviews - These are the views proper. - - components collection of gadgets (will be merged with subViews, soon) - These are lightweight gadgets (not seen by windows/x11). - - styleSheet contains widget attributes (see libview/styles/*.style) - - resources contains national language translations (see lib*/resources/*.rs) - - border color and width of border - - unused to keep the instVar size constant - - viewShape
shape of view & border (if device supports it) - - top actual top coordinate (pixels) in superview - - left actual left coordinate (pixels) in superview - - flagBits flag bits (used to be individual booleans) - extendChanged true if extend changed during setup - originChanged true if origin changed during setup - - relativeOrigin relative origin in percent within superview - - relativeExtent relative extent in percent within superview - - relativeCorner relative corner in percent within superview - - originRule rule to compute origin if superview changes size - - extentRule rule to compute extent if superview changes size - - cornerRule rule to compute corner if superview changes size - - insets array with top, left, bottom & right insets (or nil) - - layout not yet implemented - will replace the above layout - variables. - - shown true if visible (false if iconified, unmapped or covered) - - hiddenOnRealize dont show automatically when superview is realized - - name my name (future use for resources) - - level (**) 3D level relative to superview - - margin convenient margin; that is the number of pixels - which are taken up by border plus 3D level - (i.e. borderWidth + level abs) - - innerClipRect convenient inner clip (minus margin) - - shadowColor (**) color used to draw 3D shadowed edges - - lightColor (**) color used to draw 3D lighted edges - - bitGravity gravity of contents (if device supports it) - - viewGravity gravity of view (if device supports it) - - controller the controller (if any) - - windowGroup the windowGroup - - preferredExtent(*) preferredExtent overWrite - if nonNil, the widget will not compute - its pref-extent, but use that value. - - explicitExtent(*) preferredExtent overWrite - if nonNil, the widget will not compute - its pref-extent, but use that value. - - dependents who depends on me - - layoutManager - - visibilityChannel - - helpKey - - dropTarget + superView my superview i.e. the view I am in + + subViews the collection of subviews + These are the views proper. + + components collection of gadgets (will be merged with subViews, soon) + These are lightweight gadgets (not seen by windows/x11). + + styleSheet contains widget attributes (see libview/styles/*.style) + + resources contains national language translations (see lib*/resources/*.rs) + + border color and width of border + + unused to keep the instVar size constant + + viewShape shape of view & border (if device supports it) + + top actual top coordinate (pixels) in superview + + left actual left coordinate (pixels) in superview + + flagBits flag bits (used to be individual booleans) + extendChanged true if extend changed during setup + originChanged true if origin changed during setup + + relativeOrigin relative origin in percent within superview + + relativeExtent relative extent in percent within superview + + relativeCorner relative corner in percent within superview + + originRule rule to compute origin if superview changes size + + extentRule rule to compute extent if superview changes size + + cornerRule rule to compute corner if superview changes size + + insets array with top, left, bottom & right insets (or nil) + + layout not yet implemented - will replace the above layout + variables. + + shown true if visible (false if iconified, unmapped or covered) + + hiddenOnRealize dont show automatically when superview is realized + + name my name (future use for resources) + + level (**) 3D level relative to superview + + margin convenient margin; that is the number of pixels + which are taken up by border plus 3D level + (i.e. borderWidth + level abs) + + innerClipRect convenient inner clip (minus margin) + + shadowColor (**) color used to draw 3D shadowed edges + + lightColor (**) color used to draw 3D lighted edges + + bitGravity gravity of contents (if device supports it) + + viewGravity gravity of view (if device supports it) + + controller the controller (if any) + + windowGroup the windowGroup + + preferredExtent(*) preferredExtent overWrite + if nonNil, the widget will not compute + its pref-extent, but use that value. + + explicitExtent(*) preferredExtent overWrite + if nonNil, the widget will not compute + its pref-extent, but use that value. + + dependents 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 the color grey - its used so often - - ViewSpacing preferred spacing between views; 1mm - - CentPoint 100 @ 100 - its used so often - - StyleSheet contains all view-style specifics - - ReturnFocusWhenClosingModalBoxes if true, a closing modalBox returns - 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 the color grey - its used so often + + ViewSpacing preferred spacing between views; 1mm + + CentPoint 100 @ 100 - its used so often + + StyleSheet contains all view-style specifics + + ReturnFocusWhenClosingModalBoxes if true, a closing modalBox returns + 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 if true, popupViews show a shadow below - - popupLevel 3D level - - borderWidth borderWidth (ignored in 3D styles) - - borderColor borderColor (ignored in 3D styles) - - viewBackground views background - - shadowColor color for shadow edges (ignored in 2D styles) - - lightColor color for light edges (ignored in 2D styles) - - font font to use + popupShadow if true, popupViews show a shadow below + + popupLevel 3D level + + borderWidth borderWidth (ignored in 3D styles) + + borderColor borderColor (ignored in 3D styles) + + viewBackground views background + + shadowColor color for shadow edges (ignored in 2D styles) + + lightColor color for light edges (ignored in 2D styles) + + 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 " ! @@ -278,50 +278,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. @@ -343,10 +343,10 @@ v2 viewBackground:(Color yellow). top open - [exEnd] + [exEnd] fixed origin, variable size: - [exBegin] + [exBegin] |top v1 v2| top := StandardSystemView new. @@ -365,11 +365,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. @@ -390,10 +390,10 @@ top add:v2. top open - [exEnd] + [exEnd] variable origin, variable size, - [exBegin] + [exBegin] |top v1 v2| top := StandardSystemView new. @@ -412,11 +412,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. @@ -437,11 +437,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. @@ -454,21 +454,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. @@ -481,22 +481,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. @@ -509,17 +509,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. @@ -532,17 +532,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. @@ -556,7 +556,7 @@ v1 border:(SimpleBorder width:1 color:Color red). v2 border:(SimpleBorder width:1 color:Color blue). top open - [exEnd] + [exEnd] " ! @@ -565,40 +565,40 @@ Currently, these are experimental and work under Windows only an MDI child: - [exBegin] - |top v1 v2| - - top := StandardSystemView new. - top extent:450 @ 300. - top name:'MDI Client'. - top beMDIClientView. - top open. - - v1 := View new. - v1 viewBackground:Color red. - v1 origin:50 @ 50 corner:150 @ 100. - v1 beMDIChildView. - top addSubView:v1. - - v2 := View new. - v2 viewBackground:Color green. - v2 origin:50 @ 50 corner:150 @ 100. - v2 beMDIChildView. - top addSubView:v2. - [exEnd] + [exBegin] + |top v1 v2| + + top := StandardSystemView new. + top extent:450 @ 300. + top name:'MDI Client'. + top beMDIClientView. + top open. + + v1 := View new. + v1 viewBackground:Color red. + v1 origin:50 @ 50 corner:150 @ 100. + v1 beMDIChildView. + top addSubView:v1. + + v2 := View new. + v2 viewBackground:Color green. + v2 origin:50 @ 50 corner:150 @ 100. + v2 beMDIChildView. + top addSubView:v2. + [exEnd] " ! layoutComputation " Due to historic reasons, there are 2 mechanisms to resize a view: - - (old, to be eliminated mechanism) - based upon info found in - relativeOrigin / relativeCorner / relativeExtent - originRule / cornerRule / extentRule - - - (new, will migrate to that one) - letting a layoutObject compute things + - (old, to be eliminated mechanism) + based upon info found in + relativeOrigin / relativeCorner / relativeExtent + originRule / cornerRule / extentRule + + - (new, will migrate to that one) + letting a layoutObject compute things Actually, the old mechanism is just as powerful, as the new (layoutObject based) mechanism; with the help of block=rules, you can compute whatever @@ -615,13 +615,13 @@ Notice, that a view recomputes its size whenever its superview changes size. This is done via: - sizeChanged - -> allSubviews: superViewChangedSize + sizeChanged + -> allSubviews: superViewChangedSize If the geometry computation as performed in superViewChangedSize is not powerful enough for your application, you can either: - - redefine superViewChangedSize - - create a special layoutObject which computes a new layout. + - redefine superViewChangedSize + - create a special layoutObject which computes a new layout. " ! @@ -630,11 +630,11 @@ Due to historic reasons, there are multiple mechanisms for popupMenu definition: - - static menus - - - dynamic menus from the view - - - dynamic menus from the model / menuHolder + - static menus + + - dynamic menus from the view + + - dynamic menus from the model / menuHolder static menus @@ -645,35 +645,35 @@ It can be defined at initialization time or redefined any time later. The menu is defined with: - someView middleButtonMenu: + someView middleButtonMenu: Compatibility note: - static menus should no longer be used - their operation - is incompatible with ST-80 and ST/X's dynamic menus. - Do not use them if you care for compatibility. + static menus should no longer be used - their operation + is incompatible with ST-80 and ST/X's dynamic menus. + Do not use them if you care for compatibility. Also, they do not care for any menuPerformers or menuHolders. (instead, they use a receiver instance variable, which gets the messages). example: - |top v1 v2| - - top := StandardSystemView new. - top extent:300@300. - - v1 := View origin:0.0@0.0 corner:0.5@1.0 in:top. - v1 viewBackground:Color red. - - v2 := View origin:0.5@0.0 corner:1.0@1.0 in:top. - v2 viewBackground:Color yellow. - - v1 middleButtonMenu:( - PopUpMenu - labels:#('foo' 'bar') - selectors:#(foo bar) - receiver:v1 - ). - - top open. + |top v1 v2| + + top := StandardSystemView new. + top extent:300@300. + + v1 := View origin:0.0@0.0 corner:0.5@1.0 in:top. + v1 viewBackground:Color red. + + v2 := View origin:0.5@0.0 corner:1.0@1.0 in:top. + v2 viewBackground:Color yellow. + + v1 middleButtonMenu:( + PopUpMenu + labels:#('foo' 'bar') + selectors:#(foo bar) + receiver:v1 + ). + + top open. @@ -699,42 +699,42 @@ to the view IFF the model would not respond to the menu message. (this allows mixing of menu messages for the view AND the model). - |top v1 v2 holder| - - holder := Plug new. - holder respondTo:#menu1 - with:[ - v1 menuMessage:#otherMenu1. - PopUpMenu - labels:#('foo' 'bar') - selectors:#(foo bar). - ]. - holder respondTo:#otherMenu1 - with:[ - v1 menuMessage:#menu1. - PopUpMenu - labels:#('other foo' 'other bar') - selectors:#(foo bar). - ]. - holder respondTo:#menu2 - with:[ PopUpMenu - labels:#('copy' 'bar2') - selectors:#(copySelection bar2) - ]. - - top := StandardSystemView new. - top extent:300@300. - - v1 := View origin:0.0@0.0 corner:0.5@1.0 in:top. - v1 viewBackground:Color red. - - v2 := TextView origin:0.5@0.0 corner:1.0@1.0 in:top. - v2 contents:'pop me up'. - - v1 model:holder; menuMessage:#menu1. - v2 menuHolder:holder; menuMessage:#menu2. - - top open. + |top v1 v2 holder| + + holder := Plug new. + holder respondTo:#menu1 + with:[ + v1 menuMessage:#otherMenu1. + PopUpMenu + labels:#('foo' 'bar') + selectors:#(foo bar). + ]. + holder respondTo:#otherMenu1 + with:[ + v1 menuMessage:#menu1. + PopUpMenu + labels:#('other foo' 'other bar') + selectors:#(foo bar). + ]. + holder respondTo:#menu2 + with:[ PopUpMenu + labels:#('copy' 'bar2') + selectors:#(copySelection bar2) + ]. + + top := StandardSystemView new. + top extent:300@300. + + v1 := View origin:0.0@0.0 corner:0.5@1.0 in:top. + v1 viewBackground:Color red. + + v2 := TextView origin:0.5@0.0 corner:1.0@1.0 in:top. + v2 contents:'pop me up'. + + v1 model:holder; menuMessage:#menu1. + v2 menuHolder:holder; menuMessage:#menu2. + + top open. an additional goody is the possibility, to change the menuPerformer (textViews only). If defined, that one will get the menus message (instead of the model/view). @@ -747,31 +747,31 @@ - it could be forwarded to the view, though. This could be useful to intercept/filter things). - |top v menuProvider menuExecutor | - - menuProvider := Plug new. - menuProvider respondTo:#menu - with:[ PopUpMenu - labels:#('copy' 'foo') - selectors:#(copySelection foo) - ]. - - menuExecutor := Plug new. - menuExecutor respondTo:#copySelection - with:[Transcript showCR:'copy function']. - menuExecutor respondTo:#foo - with:[Transcript showCR:'foo function']. - - top := StandardSystemView new. - top extent:300@300. - - v := TextView origin:0.0@0.0 corner:1.0@1.0 in:top. - v contents:'pop me up'. - - v menuHolder:menuProvider; menuMessage:#menu. - v menuPerformer:menuExecutor. - - top open. + |top v menuProvider menuExecutor | + + menuProvider := Plug new. + menuProvider respondTo:#menu + with:[ PopUpMenu + labels:#('copy' 'foo') + selectors:#(copySelection foo) + ]. + + menuExecutor := Plug new. + menuExecutor respondTo:#copySelection + with:[Transcript showCR:'copy function']. + menuExecutor respondTo:#foo + with:[Transcript showCR:'foo function']. + + top := StandardSystemView new. + top extent:300@300. + + v := TextView origin:0.0@0.0 corner:1.0@1.0 in:top. + v contents:'pop me up'. + + v menuHolder:menuProvider; menuMessage:#menu. + v menuPerformer:menuExecutor. + + top open. " ! ! @@ -779,12 +779,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. @@ -811,7 +811,7 @@ postAutoload (Screen notNil and:[Screen current notNil]) ifTrue:[ - self updateStyleCache. + self updateStyleCache. ] ! ! @@ -847,14 +847,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 @@ -903,9 +903,9 @@ |viewsDevice| anotherView notNil ifTrue:[ - viewsDevice := anotherView graphicsDevice. + viewsDevice := anotherView graphicsDevice. ] ifFalse:[ - viewsDevice := Screen current. + viewsDevice := Screen current. ]. ^ self onDevice:viewsDevice @@ -998,8 +998,8 @@ ! origin:anOrigin extent:anExtent - label:aLabel icon:aForm - minExtent:minExtent maxExtent:maxExtent + label:aLabel icon:aForm + minExtent:minExtent maxExtent:maxExtent |newView| newView := self new. "/ onDevice:Screen current. @@ -1040,11 +1040,11 @@ update:something with:aParameter from:changedObject changedObject == Smalltalk ifTrue:[ - (something == #Language or:[something == #LanguageTerritory]) ifTrue:[ - "flush resources on language changes" - self flushAllClassResources. - self allSubInstancesDo:[:eachView | eachView languageChanged]. - ]. + (something == #Language or:[something == #LanguageTerritory]) ifTrue:[ + "flush resources on language changes" + self flushAllClassResources. + self allSubInstancesDo:[:eachView | eachView languageChanged]. + ]. ] "Created: 15.6.1996 / 15:23:04 / cg" @@ -1082,17 +1082,17 @@ DefaultFont notNil ifTrue:[^ DefaultFont]. self == SimpleView ifTrue:[ - f := super defaultFont + f := super defaultFont ] ifFalse:[ - f := self superclass defaultFont. + f := self superclass defaultFont. ]. f notNil ifTrue:[ - DefaultFont := f. - f := f onDevice:Screen current. - f notNil ifTrue:[ - DefaultFont := f. - ] + DefaultFont := f. + f := f onDevice:Screen current. + f notNil ifTrue:[ + DefaultFont := f. + ] ]. ^ DefaultFont @@ -1106,12 +1106,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" @@ -1133,7 +1133,7 @@ DefaultStyle := aStyle. MIMETypeIconLibrary notNil ifTrue:[ - MIMETypeIconLibrary flushIcons + MIMETypeIconLibrary flushIcons ]. "/ no need to read the stylesheet always here @@ -1145,9 +1145,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. + ]. ]. " @@ -1179,20 +1179,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. @@ -1206,8 +1206,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" @@ -1248,28 +1248,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" @@ -1279,7 +1279,7 @@ "return the view style sheet information (a dictionary)" StyleSheet isNil ifTrue:[ - self updateAllStyleCaches. + self updateAllStyleCaches. ]. ^ StyleSheet @@ -1311,33 +1311,33 @@ self changed:#style. SimpleView updateStyleCache. SimpleView allSubclassesDo:[:aClass | - "JV@2010-12-02: Removed to avoid lost of preferred fonts on image restart" - "/ cg: no, this is required!!!!!! - "/ otherwise, we get ugly courier fonts on windows - "/ updateStyleCache MUST clear any previously - "/ cached font values, otherwise you cannot load a style's font. - "/ if you want to keep your fonts, do it elsewhere (keep some userFontPrefs and restore from there) - - "/ JV: Font preferences ARE already saved in user's setting.rc/setting.stx, but they - "/ are not reloaded on snapshot restart (which is correct, I think). - "/ This just discard such fonts. I would say calling this upon snapshot restart - "/ is a bad idea. Workaround it only for me is not a solution as all other - "/ Linux users are ... off. Let's workaround it: - (Smalltalk isInitialized not and: - [OperatingSystem getOSType == #linux and: - [UserPreferences current linuxFontWorkaround]]) - ifFalse:[ - aClass defaultFont:nil. - ]. - - (aClass class includesSelector:#updateStyleCache) ifTrue:[ - aClass updateStyleCache - ]. + "JV@2010-12-02: Removed to avoid lost of preferred fonts on image restart" + "/ cg: no, this is required!!!!!! + "/ otherwise, we get ugly courier fonts on windows + "/ updateStyleCache MUST clear any previously + "/ cached font values, otherwise you cannot load a style's font. + "/ if you want to keep your fonts, do it elsewhere (keep some userFontPrefs and restore from there) + + "/ JV: Font preferences ARE already saved in user's setting.rc/setting.stx, but they + "/ are not reloaded on snapshot restart (which is correct, I think). + "/ This just discard such fonts. I would say calling this upon snapshot restart + "/ is a bad idea. Workaround it only for me is not a solution as all other + "/ Linux users are ... off. Let's workaround it: + (Smalltalk isInitialized not and: + [OperatingSystem getOSType == #linux and: + [UserPreferences current linuxFontWorkaround]]) + ifFalse:[ + aClass defaultFont:nil. + ]. + + (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 ]. @@ -1359,8 +1359,8 @@ anyway." + #viewBackground #shadowColor #lightColor + #focusColor #focusBorderWidth)> |styleSheet bgGrey currentScreen| @@ -1371,67 +1371,67 @@ and keep the values in fast class variables " styleSheet isNil ifTrue:[ - self setDefaultStyle. - self readStyleSheet. - styleSheet := StyleSheet. + self setDefaultStyle. + self readStyleSheet. + styleSheet := StyleSheet. ]. currentScreen := Screen current ? Screen default. Grey := styleSheet viewGrey. Grey isNil ifTrue:[ - Grey := Color gray + Grey := Color gray ]. Grey := Grey onDevice:currentScreen. styleSheet fileReadFailed ifTrue:[ - bgGrey := Color white + bgGrey := Color white ] ifFalse:[ - currentScreen hasGrayscales ifTrue:[ - bgGrey := Grey - ] ifFalse:[ - bgGrey := Color white. - ] + currentScreen hasGrayscales ifTrue:[ + bgGrey := Grey + ] ifFalse:[ + bgGrey := Color 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. - DefaultFocusColor := DefaultShadowColor := Color black. - DefaultViewBackgroundColor := DefaultLightColor := Color white. - DefaultFocusBorderWidth := 1. + DefaultBorderWidth := 1. + DefaultFocusColor := DefaultShadowColor := Color black. + DefaultViewBackgroundColor := DefaultLightColor := Color white. + DefaultFocusBorderWidth := 1. ] 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 := Color white + 'SimpleView [warning]: bad viewBackground in style - using white' errorPrintCR. + DefaultViewBackgroundColor := Color white ]. "Modified: / 29-04-1997 / 11:16:52 / dq" @@ -1465,7 +1465,7 @@ "if not already loaded, get the classes resourcePack and return it" ClassResources isNil ifTrue:[ - ClassResources := super classResources. + ClassResources := super classResources. ]. ^ ClassResources ! @@ -1482,20 +1482,20 @@ ResourcePack flushCachedResourcePacks. SimpleView withAllSubclassesDo:[:aClass | - aClass flushClassResources. + aClass flushClassResources. ] " View flushAllClassResources " "to change the language: - Language := #en. - Smalltalk changed:#Language. - View flushAllClassResources + Language := #en. + Smalltalk changed:#Language. + View flushAllClassResources or: - Language := #de. - Smalltalk changed:#Language. - View flushAllClassResources + Language := #de. + Smalltalk changed:#Language. + View flushAllClassResources " ! @@ -1542,10 +1542,10 @@ |newDevice| [ - newDevice := XWorkstation newDispatchingFor:aScreenName. + newDevice := XWorkstation newDispatchingFor:aScreenName. ] on:Screen deviceOpenErrorSignal do:[:ex| - self warn:'Could not open display: ' , aScreenName. - ^ self + self warn:'Could not open display: ' , aScreenName. + ^ self ]. ^ (self onDevice:newDevice) open. @@ -1582,7 +1582,7 @@ "/ what a kludge - Dolphin and Squeak mean: printOn:; "/ ST/X (and some old ST80's) mean: draw-yourself on. (aGCOrStream isStream) ifTrue:[ - ^ super displayOn:aGCOrStream + ^ super displayOn:aGCOrStream ]. self redraw @@ -1692,25 +1692,25 @@ isApplicationModel := true. (builder := aBuilder) isNil ifTrue:[ - "/ problem: anApplication could have no builder - "/ or anApplication could be a non-appModel (theoretically - only providing a spec) - builder := anApplication perform:#builder ifNotUnderstood:[isApplicationModel := false. nil]. - builder isNil ifTrue:[ - isApplicationModel ifTrue:[ - anApplication createBuilder. - builder := anApplication builder - ] ifFalse:[ - builder := UIBuilder new. - ] - ] + "/ problem: anApplication could have no builder + "/ or anApplication could be a non-appModel (theoretically - only providing a spec) + builder := anApplication perform:#builder ifNotUnderstood:[isApplicationModel := false. nil]. + builder isNil ifTrue:[ + isApplicationModel ifTrue:[ + anApplication createBuilder. + builder := anApplication builder + ] ifFalse:[ + builder := UIBuilder new. + ] + ] ]. (subSpec := aWindowSpecOrSpecSymbol) isSymbol ifTrue:[ - anApplication isNil ifTrue:[^ self]. - subSpec := anApplication interfaceSpecFor:aWindowSpecOrSpecSymbol. - subSpec isNil ifTrue:[ - ^ self - ]. + anApplication isNil ifTrue:[^ self]. + subSpec := anApplication interfaceSpecFor:aWindowSpecOrSpecSymbol. + subSpec isNil ifTrue:[ + ^ self + ]. ]. "/ if the appl is not the master, but the masters builder is used, @@ -1718,35 +1718,35 @@ masterApp := anApplication perform:#masterApplication ifNotUnderstood:[isApplicationModel := false. nil]. masterApp isNil ifTrue:[ - isApplicationModel := false. + isApplicationModel := false. ]. thisApp := builder application. (isApplicationModel and:[anApplication ~~ thisApp]) ifTrue:[ - masterApp ~~ thisApp ifTrue:[ - self error:'should not happen' mayProceed:true. - masterApp isNil ifTrue:[ - anApplication masterApplication:thisApp. - ]. - ]. - - builder application:anApplication. - savedView := builder window. - builder window:self. - [ - anApplication buildSubCanvas:subSpec withMenu:withMenuBoolean withBuilder:builder. - ] ensure:[ - builder window:savedView. - builder application:thisApp. - ]. + masterApp ~~ thisApp ifTrue:[ + self error:'should not happen' mayProceed:true. + masterApp isNil ifTrue:[ + anApplication masterApplication:thisApp. + ]. + ]. + + builder application:anApplication. + savedView := builder window. + builder window:self. + [ + anApplication buildSubCanvas:subSpec withMenu:withMenuBoolean withBuilder:builder. + ] ensure:[ + builder window:savedView. + builder application:thisApp. + ]. ] ifFalse:[ - thisIsANewBuild := builder window isNil. - thisIsANewBuild ifTrue:[ - builder window:self. - anApplication buildSubCanvas:subSpec withMenu:withMenuBoolean withBuilder:builder. - ] ifFalse:[ - "/ WARNING: in case of rebuilding, we do NOT invoke pre- and postBuilds - builder buildFromSpec:subSpec in:self. - ] + thisIsANewBuild := builder window isNil. + thisIsANewBuild ifTrue:[ + builder window:self. + anApplication buildSubCanvas:subSpec withMenu:withMenuBoolean withBuilder:builder. + ] ifFalse:[ + "/ WARNING: in case of rebuilding, we do NOT invoke pre- and postBuilds + builder buildFromSpec:subSpec in:self. + ] ]. "/ postBuildWith: will be called twice if code below is enabled @@ -1874,9 +1874,9 @@ recursively in all of my subviews" subViews notNil ifTrue:[ - subViews do:[:v| - v allViewBackground:something if:condition - ] + subViews do:[:v| + v allViewBackground:something if:condition + ] ] "Modified: / 18.7.1996 / 13:34:26 / cg" @@ -1888,9 +1888,9 @@ recursively in all of my subviews" subViews notNil ifTrue:[ - subViews do:[:v| - v allViewForeground:something - ] + subViews do:[:v| + v allViewForeground:something + ] ] ! @@ -1935,7 +1935,7 @@ self viewBackground:aColor. shown ifTrue:[ - self clear; invalidate. + self clear; invalidate. ]. "Created: 3.5.1997 / 10:26:49 / cg" @@ -1946,7 +1946,7 @@ "return my border" (superView notNil and:[superView isBorderedWrapper]) ifTrue:[ - ^ superView border + ^ superView border ]. ^ border @@ -1961,11 +1961,11 @@ border := aBorder. self computeMargin. realized ifTrue:[ - m := prevMargin max:margin. - self invalidate:(0@0 corner:width@m). "/ top margin - self invalidate:((width-m)@m corner:width@height). "/ right margin - self invalidate:(0@(height-m) corner:width@height). "/ bottom margin - self invalidate:(0@m corner:m@(height-m)). "/ left margin + m := prevMargin max:margin. + self invalidate:(0@0 corner:width@m). "/ top margin + self invalidate:((width-m)@m corner:width@height). "/ right margin + self invalidate:(0@(height-m) corner:width@height). "/ bottom margin + self invalidate:(0@m corner:m@(height-m)). "/ left margin ]. ! @@ -1975,15 +1975,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:[ - ^ Color black + ^ Color black ]. ^ clr. @@ -1996,16 +1996,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. @@ -2024,18 +2024,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" @@ -2045,7 +2045,7 @@ "return my borderWidth" (superView notNil and:[superView isBorderedWrapper]) ifTrue:[ - ^ superView borderWidth + ^ superView borderWidth ]. border isNil ifTrue:[^ 0]. @@ -2061,25 +2061,25 @@ aNumber := aNumberOrNil. aNumber notNil ifTrue:[ - self assert:(aNumber >= 0). - aNumber := aNumber max: 0 + self assert:(aNumber >= 0). + aNumber := aNumber max: 0 ]. "/ 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:[ @@ -2094,8 +2094,8 @@ computeMargin border isNil ifTrue:[ - margin := level abs. - ^ self. + margin := level abs. + ^ self. ]. margin := border width. ! @@ -2125,15 +2125,15 @@ "set both the foreground and background colors of the contents" self - foregroundColor:fgColor; - backgroundColor:bgColor + foregroundColor:fgColor; + backgroundColor:bgColor ! level "return my level relative to superView (3D)" (superView notNil and:[superView isBorderedWrapper]) ifTrue:[ - ^ superView level + ^ superView level ]. border notNil ifTrue:[^ border level]. ^ level @@ -2149,36 +2149,36 @@ "/ backward compatibility "/ superView will be renamed to container soon. (superView notNil and:[superView isBorderedWrapper]) ifTrue:[ - ^ superView level:aNumber + ^ superView level:aNumber ]. (aNumber ~~ level and:[aNumber notNil]) ifTrue:[ - self is3D ifTrue:[ - level := aNumber. - oldMargin := margin. - margin := level abs. - - realized ifTrue:[ - margin ~~ oldMargin ifTrue:[ - (margin > oldMargin) ifTrue:[ - how := #smaller - ] ifFalse:[ - how := #larger - ]. - self sizeChanged:how. - self setInnerClip. - ]. - shown ifTrue:[ - margin ~~ oldMargin ifTrue:[ - self clearView. - self redrawX:margin y:margin - width:width-(margin*2) - height:height-(margin*2) - ]. - self redrawEdges. - ] - ] - ] + self is3D ifTrue:[ + level := aNumber. + oldMargin := margin. + margin := level abs. + + realized ifTrue:[ + margin ~~ oldMargin ifTrue:[ + (margin > oldMargin) ifTrue:[ + how := #smaller + ] ifFalse:[ + how := #larger + ]. + self sizeChanged:how. + self setInnerClip. + ]. + shown ifTrue:[ + margin ~~ oldMargin ifTrue:[ + self clearView. + self redrawX:margin y:margin + width:width-(margin*2) + height:height-(margin*2) + ]. + self redrawEdges. + ] + ] + ] ] "Modified: 5.6.1996 / 14:12:17 / cg" @@ -2188,10 +2188,10 @@ "return the color to be used for lighted edges (3D only)" lightColor isNil ifTrue:[ - |avgColor| - - avgColor := viewBackground averageColorIn:(0@0 corner:7@7). - lightColor := avgColor lightened. + |avgColor| + + avgColor := viewBackground averageColorIn:(0@0 corner:7@7). + lightColor := avgColor lightened. ]. ^ lightColor ! @@ -2242,10 +2242,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 ! @@ -2268,11 +2268,11 @@ self assert:(something notNil) message:'invalid viewBackground argument'. something isColor ifTrue:[ - device hasGrayscales ifTrue:[ - avgColor := something averageColorIn:(0@0 corner:7@7). - shadowColor := avgColor darkened "on:device". - lightColor := avgColor lightened "on:device". - ] + device hasGrayscales ifTrue:[ + avgColor := something averageColorIn:(0@0 corner:7@7). + shadowColor := avgColor darkened "on:device". + lightColor := avgColor lightened "on:device". + ] ]. super viewBackground:something @@ -2284,10 +2284,10 @@ in myself and recursively in all of my subviews" (condition value:self) ifTrue:[ - viewBackground ~~ something ifTrue:[ - self viewBackground:something. - self invalidate - ]. + viewBackground ~~ something ifTrue:[ + self viewBackground:something. + self invalidate + ]. ]. ! @@ -2295,19 +2295,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" @@ -2328,25 +2328,25 @@ oldChannel == newChannel ifTrue:[^ self]. oldChannel notNil ifTrue:[ - changeSelector isNil ifTrue:[ - oldChannel removeDependent:self - ] ifFalse:[ - oldChannel retractInterestsFor:self. - ]. - oldValue := oldChannel value. + changeSelector isNil ifTrue:[ + oldChannel removeDependent:self + ] ifFalse:[ + oldChannel retractInterestsFor:self. + ]. + oldValue := oldChannel value. ]. newChannel notNil ifTrue:[ - changeSelector isNil ifTrue:[ - newChannel addDependent:self. - newChannel value ~~ oldValue ifTrue:[ - self update:#value with:nil from:newChannel. - ] - ] ifFalse:[ - newChannel onChangeSend:changeSelector to:self. - newChannel value ~~ oldValue ifTrue:[ - self perform:changeSelector. - ] - ] + changeSelector isNil ifTrue:[ + newChannel addDependent:self. + newChannel value ~~ oldValue ifTrue:[ + self update:#value with:nil from:newChannel. + ] + ] ifFalse:[ + newChannel onChangeSend:changeSelector to:self. + newChannel value ~~ oldValue ifTrue:[ + self perform:changeSelector. + ] + ] ]. ^ newChannel @@ -2423,7 +2423,7 @@ Obsolete: please use a layout object." insets isNil ifTrue:[ - insets := Array new:4. + insets := Array new:4. ]. insets atAllPut:aNumber. @@ -2431,7 +2431,7 @@ "/ drawableId isNil ifTrue:[ "/ self originChangedFlag:true "/ ] ifFalse:[ - self containerChangedSize. + self containerChangedSize. "/ ] "Modified: 19.7.1996 / 17:30:18 / cg" @@ -2467,15 +2467,15 @@ |newInset| insets isNil ifTrue:[ - insets := Array with:0 with:0 with:0 with:0 + insets := Array with:0 with:0 with:0 with:0 ]. newInset := aNumber. newInset isNil ifTrue:[ - newInset := 0. + newInset := 0. ]. (insets at:4) ~= newInset ifTrue:[ - insets at:4 put:newInset. - self containerChangedSize + insets at:4 put:newInset. + self containerChangedSize ] "Modified: 19.7.1996 / 17:30:22 / cg" @@ -2495,7 +2495,7 @@ self explicitExtent:true. self pixelOrigin:aRectangle origin - corner:aRectangle corner + corner:aRectangle corner "Created: 4.6.1996 / 21:44:27 / cg" "Modified: 10.1.1997 / 19:46:36 / cg" @@ -2525,39 +2525,39 @@ slowly migrating to use layoutObjects ... " layout notNil ifTrue:[ - superView isNil ifTrue:[^ self preferredBounds corner]. - ^ (layout rectangleRelativeTo:(superView viewRectangle) - preferred:[self preferredBounds]) corner rounded + superView isNil ifTrue:[^ self preferredBounds corner]. + ^ (layout rectangleRelativeTo:(superView viewRectangle) + preferred:[self preferredBounds]) corner rounded ]. (cornerRule notNil) ifTrue:[ - newCorner := cornerRule value. - " - allow return of relative values ... - " - x := newCorner x. - y := newCorner y. - x isNil ifTrue:[x := self corner x]. - y isNil ifTrue:[y := self corner y]. - ((x isInteger not) or:[y isInteger not]) ifTrue:[ - newCorner := self cornerFromRelativeCorner:x@y - ] + newCorner := cornerRule value. + " + allow return of relative values ... + " + x := newCorner x. + y := newCorner y. + x isNil ifTrue:[x := self corner x]. + y isNil ifTrue:[y := self corner y]. + ((x isInteger not) or:[y isInteger not]) ifTrue:[ + newCorner := self cornerFromRelativeCorner:x@y + ] ] ifFalse:[ - (relativeCorner notNil) ifTrue:[ - newCorner := self cornerFromRelativeCorner:relativeCorner - ] ifFalse:[ - org := self computeOrigin. - (extentRule notNil) ifTrue:[ - newExt := extentRule value - ] ifFalse:[ - (relativeExtent notNil) ifTrue:[ - newExt := self extentFromRelativeExtent:relativeExtent - ] ifFalse:[ - newExt := self extent. - ] - ]. - newCorner := org + newExt - ] + (relativeCorner notNil) ifTrue:[ + newCorner := self cornerFromRelativeCorner:relativeCorner + ] ifFalse:[ + org := self computeOrigin. + (extentRule notNil) ifTrue:[ + newExt := extentRule value + ] ifFalse:[ + (relativeExtent notNil) ifTrue:[ + newExt := self extentFromRelativeExtent:relativeExtent + ] ifFalse:[ + newExt := self extent. + ] + ]. + newCorner := org + newExt + ] ]. ^ newCorner @@ -2578,51 +2578,51 @@ slowly migrating to use layoutObjects ... " layout notNil ifTrue:[ - ^ (layout rectangleRelativeTo:(superView viewRectangle) - preferred:[self preferredBounds]) extent rounded + ^ (layout rectangleRelativeTo:(superView viewRectangle) + preferred:[self preferredBounds]) extent rounded ]. (cornerRule notNil) ifTrue:[ - newCorner := cornerRule value. - " - allow return of relative values ... - " - x := newCorner x. - y := newCorner y. - x isNil ifTrue:[x := self corner x]. - y isNil ifTrue:[y := self corner y]. - ((x isInteger not) or:[y isInteger not]) ifTrue:[ - newCorner := self cornerFromRelativeCorner:x@y - ] + newCorner := cornerRule value. + " + allow return of relative values ... + " + x := newCorner x. + y := newCorner y. + x isNil ifTrue:[x := self corner x]. + y isNil ifTrue:[y := self corner y]. + ((x isInteger not) or:[y isInteger not]) ifTrue:[ + newCorner := self cornerFromRelativeCorner:x@y + ] ] ifFalse:[ - (relativeCorner notNil) ifTrue:[ - newCorner := self cornerFromRelativeCorner:relativeCorner - ] ifFalse:[ - (extentRule notNil) ifTrue:[ - newExt := extentRule value. - " - allow return of relative values ... - " - x := newExt x. - y := newExt y. - x isNil ifTrue:[x := width]. - y isNil ifTrue:[y := height]. - ((x isInteger not) or:[y isInteger not]) ifTrue:[ - newExt := self extentFromRelativeExtent:x@y - ] - ] ifFalse:[ - (relativeExtent notNil) ifTrue:[ - newExt := self extentFromRelativeExtent:relativeExtent - ] ifFalse:[ - newExt := (width @ height). - ]. - ]. - ]. + (relativeCorner notNil) ifTrue:[ + newCorner := self cornerFromRelativeCorner:relativeCorner + ] ifFalse:[ + (extentRule notNil) ifTrue:[ + newExt := extentRule value. + " + allow return of relative values ... + " + x := newExt x. + y := newExt y. + x isNil ifTrue:[x := width]. + y isNil ifTrue:[y := height]. + ((x isInteger not) or:[y isInteger not]) ifTrue:[ + newExt := self extentFromRelativeExtent:x@y + ] + ] ifFalse:[ + (relativeExtent notNil) ifTrue:[ + newExt := self extentFromRelativeExtent:relativeExtent + ] ifFalse:[ + newExt := (width @ height). + ]. + ]. + ]. ]. newCorner notNil ifTrue:[ - newOrg := self computeOrigin. - ^ newCorner - newOrg. + newOrg := self computeOrigin. + ^ newCorner - newOrg. ]. ^ newExt. ! @@ -2639,29 +2639,29 @@ slowly migrating to use layoutObjects ... " layout notNil ifTrue:[ - superView isNil ifTrue:[^ 0@0]. - ^ (layout rectangleRelativeTo:(superView viewRectangle) - preferred:[self preferredBounds]) origin rounded + superView isNil ifTrue:[^ 0@0]. + ^ (layout rectangleRelativeTo:(superView viewRectangle) + preferred:[self preferredBounds]) origin rounded ]. (originRule notNil) ifTrue:[ - newOrg := originRule value. - " - allow return of relative values ... - " - x := newOrg x. - y := newOrg y. - x isNil ifTrue:[x := self origin x]. - y isNil ifTrue:[y := self origin y]. - ((x isInteger not) or:[y isInteger not]) ifTrue:[ - newOrg := self originFromRelativeOrigin:x@y. - ] + newOrg := originRule value. + " + allow return of relative values ... + " + x := newOrg x. + y := newOrg y. + x isNil ifTrue:[x := self origin x]. + y isNil ifTrue:[y := self origin y]. + ((x isInteger not) or:[y isInteger not]) ifTrue:[ + newOrg := self originFromRelativeOrigin:x@y. + ] ] ifFalse:[ - (relativeOrigin notNil) ifTrue:[ - newOrg := self originFromRelativeOrigin:relativeOrigin. - ] ifFalse:[ - ^ (left @ top). - ]. + (relativeOrigin notNil) ifTrue:[ + newOrg := self originFromRelativeOrigin:relativeOrigin. + ] ifFalse:[ + ^ (left @ top). + ]. ]. ^ newOrg ! @@ -2678,10 +2678,10 @@ corner:corner "set the views corner; the corner argument may be: - a point - where integer fields mean 'pixel-values' - and float values mean 'relative-to-superview' - and nil means 'take current value'; + a point + where integer fields mean 'pixel-values' + and float values mean 'relative-to-superview' + and nil means 'take current value'; or a block returning a point which is interpreted as above. Please migrate to use layoutObjects, if possible." @@ -2690,31 +2690,31 @@ self explicitExtent:true. corner isBlock ifTrue:[ - cornerRule := corner. - self drawableId notNil ifTrue:[ - pixelCorner := corner value - ] ifFalse:[ - self extentChangedFlag:true - ] + cornerRule := corner. + self drawableId notNil ifTrue:[ + pixelCorner := corner value + ] ifFalse:[ + self extentChangedFlag:true + ] ] ifFalse:[ - x := corner x. - y := corner y. - x isNil ifTrue:[x := self corner x]. - y isNil ifTrue:[y := self corner y]. - c := x @ y. - ((x isInteger not) or:[y isInteger not]) ifTrue:[ - relativeCorner := c. - pixelCorner := self cornerFromRelativeCorner. - pixelCorner isNil ifTrue:[ - self extentChangedFlag:true - ] - ] ifFalse:[ - pixelCorner := c - ] + x := corner x. + y := corner y. + x isNil ifTrue:[x := self corner x]. + y isNil ifTrue:[y := self corner y]. + c := x @ y. + ((x isInteger not) or:[y isInteger not]) ifTrue:[ + relativeCorner := c. + pixelCorner := self cornerFromRelativeCorner. + pixelCorner isNil ifTrue:[ + self extentChangedFlag:true + ] + ] ifFalse:[ + pixelCorner := c + ] ]. pixelCorner notNil ifTrue:[ - self pixelCorner:pixelCorner + self pixelCorner:pixelCorner ] "Modified: 15.7.1996 / 09:51:06 / cg" @@ -2729,50 +2729,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. - self drawableId notNil ifTrue:[ - pixelExtent := extent value - ] ifFalse:[ - self extentChangedFlag:true - ] + extentRule := extent. + self 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" @@ -2822,7 +2822,7 @@ "/ aNumber isInteger ifTrue:[ "/ height := aNumber. "/ ] ifFalse:[ - self extent:(width @ aNumber) + self extent:(width @ aNumber) "/ ]. "Modified: / 02-02-2011 / 12:16:44 / cg" @@ -2844,11 +2844,11 @@ |newInset| insets isNil ifTrue:[ - insets := Array with:0 with:0 with:0 with:0 + insets := Array with:0 with:0 with:0 with:0 ]. newInset := aNumber. aNumber isNil ifTrue:[ - newInset := 0. + newInset := 0. ]. insets at:1 put:newInset. insets at:3 put:newInset. @@ -2857,7 +2857,7 @@ "/ drawableId isNil ifTrue:[ "/ self originChangedFlag:true "/ ] ifFalse:[ - self containerChangedSize. + self containerChangedSize. "/ ] "Modified: / 30-09-2006 / 15:19:28 / cg" @@ -2953,8 +2953,8 @@ "set the layout object which controls my geometry." layout ~= aLayoutObject ifTrue:[ - layout := aLayoutObject. - self layoutChanged. + layout := aLayoutObject. + self layoutChanged. ]. "Modified: 19.9.1995 / 16:17:25 / claus" @@ -2963,9 +2963,9 @@ layoutChanged 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" @@ -3008,15 +3008,15 @@ |newInset| insets isNil ifTrue:[ - insets := Array with:0 with:0 with:0 with:0 + insets := Array with:0 with:0 with:0 with:0 ]. newInset := aNumber. newInset isNil ifTrue:[ - newInset := 0. + newInset := 0. ]. (insets at:1) ~= newInset ifTrue:[ - insets at:1 put:newInset. - self containerChangedSize. + insets at:1 put:newInset. + self containerChangedSize. ] "Modified: 19.7.1996 / 17:30:30 / cg" @@ -3042,19 +3042,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. @@ -3067,40 +3067,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" @@ -3125,35 +3125,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. @@ -3204,28 +3204,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. ] ! @@ -3254,42 +3254,42 @@ origin:origin "set the views origin; origin may be: - a point - where integer fields mean 'pixel-values' - and float values mean 'relative-to-superview' - and nil means 'take current value'; + a point + where integer fields mean 'pixel-values' + and float values mean 'relative-to-superview' + and nil means 'take current value'; or a block returning a point which is interpreted as above. Please migrate to use layout objects." |newLeft newTop pixelOrigin o| origin isBlock ifTrue:[ - originRule := origin. - self drawableId notNil ifTrue:[ - pixelOrigin := origin value - ] ifFalse:[ - self originChangedFlag:true - ] + originRule := origin. + self drawableId notNil ifTrue:[ + pixelOrigin := origin value + ] ifFalse:[ + self originChangedFlag:true + ] ] ifFalse:[ - o := origin. - newLeft := origin x. - newTop := origin y. - newLeft isNil ifTrue:[newLeft := left]. - newTop isNil ifTrue:[newTop := top]. - o := newLeft @ newTop. - ((newLeft isInteger not) or:[newTop isInteger not]) ifTrue:[ - relativeOrigin := o. - pixelOrigin := self originFromRelativeOrigin. - pixelOrigin isNil ifTrue:[ - self originChangedFlag:true - ] - ] ifFalse:[ - relativeOrigin := nil. - pixelOrigin := o - ] + o := origin. + newLeft := origin x. + newTop := origin y. + newLeft isNil ifTrue:[newLeft := left]. + newTop isNil ifTrue:[newTop := top]. + o := newLeft @ newTop. + ((newLeft isInteger not) or:[newTop isInteger not]) ifTrue:[ + relativeOrigin := o. + pixelOrigin := self originFromRelativeOrigin. + pixelOrigin isNil ifTrue:[ + self originChangedFlag:true + ] + ] ifFalse:[ + relativeOrigin := nil. + pixelOrigin := o + ] ]. pixelOrigin notNil ifTrue:[ - self pixelOrigin:pixelOrigin + self pixelOrigin:pixelOrigin ]. "Modified: 19.4.1996 / 15:12:36 / cg" @@ -3305,21 +3305,21 @@ "do it as one operation if possible" origin isBlock ifFalse:[ - corner isBlock ifFalse:[ - newLeft := origin x. - newLeft isInteger ifTrue:[ - newTop := origin y. - newTop isInteger ifTrue:[ - newRight := corner x. - newRight isInteger ifTrue:[ - newBot := corner y. - newBot isInteger ifTrue:[ - self pixelOrigin:origin corner:corner - ] - ] - ] - ] - ] + corner isBlock ifFalse:[ + newLeft := origin x. + newLeft isInteger ifTrue:[ + newTop := origin y. + newTop isInteger ifTrue:[ + newRight := corner x. + newRight isInteger ifTrue:[ + newBot := corner y. + newBot isInteger ifTrue:[ + self pixelOrigin:origin corner:corner + ] + ] + ] + ] + ] ]. self origin:origin. self corner:corner @@ -3337,21 +3337,21 @@ "do it as one operation if possible" origin isBlock ifFalse:[ - extent isBlock ifFalse:[ - newLeft := origin x. - newLeft isInteger ifTrue:[ - newTop := origin y. - newTop isInteger ifTrue:[ - newWidth := extent x. - newWidth isInteger ifTrue:[ - newHeight := extent y. - newHeight isInteger ifTrue:[ - self pixelOrigin:origin extent:extent - ] - ] - ] - ] - ] + extent isBlock ifFalse:[ + newLeft := origin x. + newLeft isInteger ifTrue:[ + newTop := origin y. + newTop isInteger ifTrue:[ + newWidth := extent x. + newWidth isInteger ifTrue:[ + newHeight := extent y. + newHeight isInteger ifTrue:[ + self pixelOrigin:origin extent:extent + ] + ] + ] + ] + ] ]. self extent:extent. self origin:origin @@ -3373,17 +3373,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 @@ -3423,10 +3423,10 @@ "MB:added {" "needed if layout is used e.g. POUEditor" layout notNil ifTrue:[ - layout isRectangle ifTrue:[ - ^ 0@0 - ]. - ^(layout rightFraction) @ (layout bottomFraction) + layout isRectangle ifTrue:[ + ^ 0@0 + ]. + ^(layout rightFraction) @ (layout bottomFraction) ]. "MB:added }" @@ -3440,8 +3440,8 @@ relativeCorner := aPoint. "MB:added {" "needed if layout is used e.g. POUEditor" layout notNil ifTrue:[ - layout rightFraction: aPoint x. - layout bottomFraction: aPoint y. + layout rightFraction: aPoint x. + layout bottomFraction: aPoint y. ]. "MB:added }" ! @@ -3466,10 +3466,10 @@ "MB:added {" "needed if layout is used e.g. POUEditor" layout notNil ifTrue:[ - layout isRectangle ifTrue:[ - ^ 0@0 - ]. - ^(layout leftFraction) @ (layout topFraction) + layout isRectangle ifTrue:[ + ^ 0@0 + ]. + ^(layout leftFraction) @ (layout topFraction) ]. "MB:added }" ^relativeOrigin @@ -3481,8 +3481,8 @@ relativeOrigin := aPoint. "MB:added {" "needed if layout is used e.g. POUEditor" layout notNil ifTrue:[ - layout leftFraction: aPoint x. - layout topFraction: aPoint y. + layout leftFraction: aPoint x. + layout topFraction: aPoint y. ]. "MB:added }" ! @@ -3519,15 +3519,15 @@ |newInset| insets isNil ifTrue:[ - insets := Array with:0 with:0 with:0 with:0 + insets := Array with:0 with:0 with:0 with:0 ]. newInset := aNumber. newInset isNil ifTrue:[ - newInset := 0. + newInset := 0. ]. (insets at:3) ~= newInset ifTrue:[ - insets at:3 put:newInset. - self containerChangedSize. + insets at:3 put:newInset. + self containerChangedSize. ] "Modified: 19.7.1996 / 17:30:32 / cg" @@ -3578,7 +3578,7 @@ "return the inside area of the superView." superView isNil ifTrue:[ - ^ Rectangle left:0 top:0 right:0 bottom:0. + ^ Rectangle left:0 top:0 right:0 bottom:0. ]. ^ superView viewRectangle. @@ -3614,15 +3614,15 @@ |newInset| insets isNil ifTrue:[ - insets := Array with:0 with:0 with:0 with:0 + insets := Array with:0 with:0 with:0 with:0 ]. newInset := aNumber. newInset isNil ifTrue:[ - newInset := 0. + newInset := 0. ]. (insets at:2) ~= newInset ifTrue:[ - insets at:2 put:newInset. - self containerChangedSize. + insets at:2 put:newInset. + self containerChangedSize. ] "Modified: 19.7.1996 / 17:30:45 / cg" @@ -3636,11 +3636,11 @@ |newInset| insets isNil ifTrue:[ - insets := Array with:0 with:0 with:0 with:0 + insets := Array with:0 with:0 with:0 with:0 ]. newInset := aNumber. aNumber isNil ifTrue:[ - newInset := 0. + newInset := 0. ]. insets at:2 put:newInset. insets at:4 put:newInset. @@ -3649,7 +3649,7 @@ "/ drawableId isNil ifTrue:[ "/ self originChangedFlag:true "/ ] ifFalse:[ - self containerChangedSize. + self containerChangedSize. "/ ] "Modified: / 30-09-2006 / 15:19:45 / cg" @@ -3680,7 +3680,7 @@ "/ aNumber isInteger ifTrue:[ "/ width := aNumber. "/ ] ifFalse:[ - self extent:(aNumber @ height) + self extent:(aNumber @ height) "/ ] "Modified: / 02-02-2011 / 12:16:26 / cg" @@ -3751,19 +3751,19 @@ "set my container (i.e. superView) to be aContainer" superView == aContainer ifTrue:[ - "/ no change - ^ self. + "/ no change + ^ self. ]. (self drawableId notNil) ifTrue:[ - "/ actually, this is worth an exception - "/ ('View [error]: ' , self printString , ' already realized - cannot change container') errorPrintCR. - self error:'already realized - cannot change container' mayProceed:true. + "/ actually, this is worth an exception + "/ ('View [error]: ' , self printString , ' already realized - cannot change container') errorPrintCR. + self error:'already realized - cannot change container' mayProceed:true. ]. (superView notNil and:[superView ~~ aContainer]) ifTrue:[ - "/ actually, this is worth an exception - ('View [warning]: ' , self printString , ' already has a container') errorPrintCR. - superView removeComponent:self. + "/ actually, this is worth an exception + ('View [warning]: ' , self printString , ' already has a container') errorPrintCR. + superView removeComponent:self. ]. superView := aContainer @@ -3781,7 +3781,7 @@ myName := self uuidStringOrName. viewsWithSameName := aViewCollection select:[:v | v uuidStringOrName = myName]. viewsWithSameName size = 1 ifTrue:[ - ^ nil "/ no conflict + ^ nil "/ no conflict ]. ^ viewsWithSameName indexOf:self ! @@ -3799,21 +3799,21 @@ superV := self superView. [superV isNil] whileFalse:[ - hierarchicalViews addFirst: superV. - superV := superV superView. + hierarchicalViews addFirst: superV. + superV := superV superView. ]. hierarchicalViews doWithIndex:[:aView :index | - uuidOrName := aView uuidStringOrName. - indexString := nil. - index > 1 ifTrue:[ - indexOrNil := aView hierarchicalIndex. - (indexOrNil notNil and:[indexOrNil ~= 1]) ifTrue:[ - indexString := '[',indexOrNil printString,']' - ] - ]. - separator := index == 1 ifTrue:[''] ifFalse:['.']. - hierarchicalUUID := hierarchicalUUID,separator,uuidOrName,(indexString?''). + uuidOrName := aView uuidStringOrName. + indexString := nil. + index > 1 ifTrue:[ + indexOrNil := aView hierarchicalIndex. + (indexOrNil notNil and:[indexOrNil ~= 1]) ifTrue:[ + indexString := '[',indexOrNil printString,']' + ] + ]. + separator := index == 1 ifTrue:[''] ifFalse:['.']. + hierarchicalUUID := hierarchicalUUID,separator,uuidOrName,(indexString?''). ]. ^ hierarchicalUUID ! @@ -3880,9 +3880,9 @@ subViews := aListOfViews. subViews notNil ifTrue:[ - subViews do:[:view | - view container:self - ] + subViews do:[:view | + view container:self + ] ] "Modified: 9.5.1996 / 00:42:28 / cg" @@ -3922,10 +3922,10 @@ n := 1. v := self. [v notNil] whileTrue:[ - (next := v container) isNil ifTrue:[^ v]. - v := next. - n := n + 1. - n > 1000 ifTrue:[self error:'circular superView chain']. + (next := v container) isNil ifTrue:[^ v]. + v := next. + n := n + 1. + n > 1000 ifTrue:[self error:'circular superView chain']. ]. ^ nil @@ -3993,14 +3993,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). ]. " @@ -4023,8 +4023,8 @@ when the view is resized." bitGravity ~~ gravity ifTrue:[ - bitGravity := gravity. - gc bitGravity:gravity. + bitGravity := gravity. + gc bitGravity:gravity. ] ! @@ -4037,53 +4037,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 @@ -4095,7 +4095,7 @@ "return my full name to be used for resource-access" superView notNil ifTrue:[ - ^ superView fullName , '.' , self name + ^ superView fullName , '.' , self name ]. ^ self name ! @@ -4104,7 +4104,7 @@ "return my name component to be used for resource-access" name isNil ifTrue:[ - name := self class name "asString" asLowercaseFirst + name := self class name "asString" asLowercaseFirst ]. ^ name ! @@ -4161,8 +4161,8 @@ when the superView is resized." viewGravity ~~ gravity ifTrue:[ - viewGravity := gravity. - gc viewGravity:gravity. + viewGravity := gravity. + gc viewGravity:gravity. ] ! ! @@ -4173,7 +4173,7 @@ or nil, if there is no application" superView notNil ifTrue:[ - ^ superView application + ^ superView application ]. ^ nil @@ -4202,7 +4202,7 @@ controller := aController. controller notNil ifTrue:[ - controller view:self. + controller view:self. ] "Modified: / 31.10.1997 / 19:58:33 / cg" @@ -4220,7 +4220,7 @@ "return the views sensor" windowGroup notNil ifTrue:[ - ^ windowGroup sensor. + ^ windowGroup sensor. ]. "there is no window group. Deliver events synchronously" @@ -4257,18 +4257,18 @@ If I am currently in a group, remove me from it it." windowGroup notNil ifTrue:[ - windowGroup removeView:self. - windowGroup := nil + windowGroup removeView:self. + windowGroup := nil ]. windowGroup := newGroup. newGroup notNil ifTrue:[ - newGroup addView:self. + newGroup addView:self. ]. subViews notNil ifTrue:[ - subViews do:[:aSubview | - aSubview windowGroup:newGroup - ] + subViews do:[:aSubview | + aSubview windowGroup:newGroup + ] ]. "Modified: 20.8.1997 / 13:26:37 / cg" @@ -4322,14 +4322,14 @@ currentTransformation := gc transformation. currentTransformation isNil ifTrue:[ - (aPoint x ~~ 0 or:[aPoint y ~~ 0]) ifTrue:[ - gc transformation:(WindowingTransformation scale:1 translation:aPoint negated). - ]. + (aPoint x ~~ 0 or:[aPoint y ~~ 0]) ifTrue:[ + gc transformation:(WindowingTransformation scale:1 translation:aPoint negated). + ]. ] ifFalse:[ - currentTransformation translation:aPoint negated. + currentTransformation translation:aPoint negated. ]. self clippingBoundsOrNil notNil ifTrue:[ - self setInnerClip. + self setInnerClip. ]. ! @@ -4342,7 +4342,7 @@ currentTransformation := gc transformation. currentTransformation isNil ifTrue:[ - ^ 0@0 + ^ 0@0 ]. ^ currentTransformation translation negated ! @@ -4356,10 +4356,10 @@ currentTransformation := gc transformation. currentTransformation isNil ifTrue:[ - ^ Rectangle left:0 top:0 width:width height:height. + ^ Rectangle left:0 top:0 width:width height:height. ]. ^ Rectangle origin:(currentTransformation translation negated) - extent:((width @ height) scaledBy:(currentTransformation scale)). + extent:((width @ height) scaledBy:(currentTransformation scale)). "Created: 12.7.1996 / 11:57:04 / stefan" ! @@ -4388,12 +4388,12 @@ self hiddenOnRealize:true. realized ifTrue:[ - (superView isNil "/ I am a topView - or:[superView realized "/ superview already shown - or:[superView id notNil]]) "/ superview already created - ifTrue:[ - self unmap - ] + (superView isNil "/ I am a topView + or:[superView realized "/ superview already shown + or:[superView id notNil]]) "/ superview already created + ifTrue:[ + self unmap + ] ] "Modified: 3.4.1997 / 21:20:40 / cg" @@ -4411,22 +4411,22 @@ self hiddenOnRealize:false. realized ifFalse:[ - superView isNil ifTrue:[ "/ I am a topView - self drawableId isNil ifTrue:[ - "this once was: - self realize. - but we don't want Topviews to realize implicitly. - BTW. the code doesn't work anyway" - ] ifFalse:[ - self remap. - ]. - ] ifFalse:[ - (superView realized "/ superview already shown - or:[superView id notNil]) "/ superview already created - ifTrue:[ - self realize - ] - ]. + superView isNil ifTrue:[ "/ I am a topView + self drawableId isNil ifTrue:[ + "this once was: + self realize. + but we don't want Topviews to realize implicitly. + BTW. the code doesn't work anyway" + ] ifFalse:[ + self remap. + ]. + ] ifFalse:[ + (superView realized "/ superview already shown + or:[superView id notNil]) "/ superview already created + ifTrue:[ + self realize + ] + ]. ] " @@ -4504,9 +4504,9 @@ "/ hiddenOnRealize := aBoolean aBoolean ifTrue:[ - flagBits := flagBits bitOr:FlagHiddenOnRealize + flagBits := flagBits bitOr:FlagHiddenOnRealize ] ifFalse:[ - flagBits := flagBits bitClear:FlagHiddenOnRealize + flagBits := flagBits bitClear:FlagHiddenOnRealize ]. "Modified: 17.6.1997 / 11:23:26 / cg" @@ -4526,9 +4526,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 ]. ! @@ -4550,8 +4550,8 @@ v := self. [v notNil] whileTrue:[ - v shown ifFalse:[^ false]. - v := v container. + v shown ifFalse:[^ false]. + v := v container. ]. ^ true @@ -4568,9 +4568,9 @@ "make the view visible or invisible" aBoolean ifTrue:[ - self beVisible + self beVisible ] ifFalse:[ - self beInvisible + self beInvisible ] "Created: / 27.10.1997 / 04:23:04 / cg" @@ -4676,12 +4676,12 @@ |l wrapper| aComponentOrCollection isCollection ifTrue:[ - wrapper := View new. - aComponentOrCollection do:[:aComponent | - wrapper add:aComponent - ] + wrapper := View new. + aComponentOrCollection do:[:aComponent | + wrapper add:aComponent + ] ] ifFalse:[ - wrapper := aComponentOrCollection + wrapper := aComponentOrCollection ]. l := aRectangleOrLayoutFrame asLayout. @@ -4702,16 +4702,16 @@ Dont use this right now for non-views" aComponent isView ifTrue:[ - self addSubView:aComponent + self addSubView:aComponent ] ifFalse:[ - components isNil ifTrue:[ - components := OrderedCollection new - ]. - components add:aComponent. - aComponent container:self. - shown ifTrue:[ - aComponent displayOn:self - ] + components isNil ifTrue:[ + components := OrderedCollection new + ]. + components add:aComponent. + aComponent container:self. + shown ifTrue:[ + aComponent displayOn:self + ] ] "Modified: 13.5.1996 / 21:19:51 / cg" @@ -4721,13 +4721,13 @@ "add a view to the collection of subviews" subViews isNil ifTrue:[ - subViews := OrderedCollection with:newView + subViews := OrderedCollection with:newView ] ifFalse:[ - (subViews includesIdentical:newView) ifTrue:[ - self error:'trying to add a view twice' mayProceed:true. - ^ self. - ]. - subViews add:newView. + (subViews includesIdentical:newView) ifTrue:[ + self error:'trying to add a view twice' mayProceed:true. + ^ self. + ]. + subViews add:newView. ]. self setContainerIn:newView. @@ -4741,17 +4741,17 @@ element at some defined place." subViews isNil ifTrue:[ - subViews := OrderedCollection with:newView + subViews := OrderedCollection with:newView ] ifFalse:[ - (subViews includesIdentical:newView) ifTrue:[ - self error:'trying to add a view twice' mayProceed:true. - ^ self. - ]. - aViewOrNil isNil ifTrue:[ - subViews add:newView - ] ifFalse:[ - subViews add:newView after:aViewOrNil. - ] + (subViews includesIdentical:newView) ifTrue:[ + self error:'trying to add a view twice' mayProceed:true. + ^ self. + ]. + aViewOrNil isNil ifTrue:[ + subViews add:newView + ] ifFalse:[ + subViews add:newView after:aViewOrNil. + ] ]. self setContainerIn:newView. @@ -4766,17 +4766,17 @@ element at some defined place." subViews isNil ifTrue:[ - subViews := OrderedCollection with:newView + subViews := OrderedCollection with:newView ] ifFalse:[ - (subViews includesIdentical:newView) ifTrue:[ - self error:'trying to add a view twice' mayProceed:true. - ^ self. - ]. - aViewOrNil isNil ifTrue:[ - subViews addFirst:newView - ] ifFalse:[ - subViews add:newView before:aViewOrNil. - ] + (subViews includesIdentical:newView) ifTrue:[ + self error:'trying to add a view twice' mayProceed:true. + ^ self. + ]. + aViewOrNil isNil ifTrue:[ + subViews addFirst:newView + ] ifFalse:[ + subViews add:newView before:aViewOrNil. + ] ]. self setContainerIn:newView. @@ -4795,13 +4795,13 @@ "add a view to the front of the collection of subviews" subViews isNil ifTrue:[ - subViews := OrderedCollection with:newView + subViews := OrderedCollection with:newView ] ifFalse:[ - (subViews includesIdentical:newView) ifTrue:[ - self error:'trying to add a view twice' mayProceed:true. - ^ self. - ]. - subViews addFirst:newView. + (subViews includesIdentical:newView) ifTrue:[ + self error:'trying to add a view twice' mayProceed:true. + ^ self. + ]. + subViews addFirst:newView. ]. self setContainerIn:newView. @@ -4815,14 +4815,14 @@ aComponent origin:0.0@0.0 corner:1.0@1.0. aComponent isView ifTrue:[ - self addSubView:aComponent + self addSubView:aComponent ] ifFalse:[ - components := OrderedCollection with:aComponent. - aComponent container:self. - - shown ifTrue:[ - aComponent displayOn:self - ] + components := OrderedCollection with:aComponent. + aComponent container:self. + + shown ifTrue:[ + aComponent displayOn:self + ] ] "Modified: 13.5.1996 / 21:20:29 / cg" @@ -4832,22 +4832,22 @@ "remove all subviews" subViews notNil ifTrue:[ - subViews copy do:[:aSubView | - aSubView destroy. - ]. - - "/ paranoia ;-) - subViews size ~~ 0 ifTrue:[ - (self class name , ' >>View [warning]: some subView(s) did not destroy: ' , subViews printString) infoPrintCR. - subViews := nil - ]. + subViews copy do:[:aSubView | + aSubView destroy. + ]. + + "/ paranoia ;-) + subViews size ~~ 0 ifTrue:[ + (self class name , ' >>View [warning]: some subView(s) did not destroy: ' , subViews printString) infoPrintCR. + subViews := nil + ]. ]. components notNil ifTrue:[ - components copy do:[:aComponent | - aComponent destroy. - ]. - components := nil. + components copy do:[:aComponent | + aComponent destroy. + ]. + components := nil. ] ! @@ -4856,11 +4856,11 @@ Dont use this right now for non-views" aComponent isView ifTrue:[ - self removeSubView:aComponent + self removeSubView:aComponent ] ifFalse:[ - components isNil ifTrue:[^self]. - components remove:aComponent ifAbsent:[]. - aComponent container:nil + components isNil ifTrue:[^self]. + components remove:aComponent ifAbsent:[]. + aComponent container:nil ] "Modified: / 11-09-2006 / 17:14:30 / User" @@ -4870,12 +4870,12 @@ "remove a view from the collection of subviews" subViews notNil ifTrue:[ - subViews remove:aView ifAbsent:[nil]. - aView setContainer:nil. - - (subViews size == 0) ifTrue:[ - subViews := nil - ] + subViews remove:aView ifAbsent:[nil]. + aView setContainer:nil. + + (subViews size == 0) ifTrue:[ + subViews := nil + ] ] ! @@ -4884,10 +4884,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" @@ -4913,9 +4913,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 @@ -4936,50 +4936,50 @@ ok := true. bitmaps := #('wheel1' 'wheel2' 'wheel3' 'wheel4') - collect:[:name | - |f| - - f := Smalltalk imageFromFileNamed:(name , '.xbm') forClass:self class. - f isNil ifTrue:[ - ('SimpleView [warning]: no bitmap file: ' , name , '.xbm') errorPrintCR. - ok := false - ]. - f - ]. + collect:[:name | + |f| + + f := Smalltalk imageFromFileNamed:(name , '.xbm') forClass:self class. + f isNil ifTrue:[ + ('SimpleView [warning]: no bitmap file: ' , name , '.xbm') errorPrintCR. + ok := false + ]. + f + ]. ok ifTrue:[ - maskForm := Smalltalk imageFromFileNamed:'wheelm.xbm' forClass:self class. - maskForm isNil ifTrue:[ - ('SimpleView [warning]: no bitmap file: wheelm.xbm') errorPrintCR. - ok := false - ]. + maskForm := Smalltalk imageFromFileNamed:'wheelm.xbm' forClass:self class. + maskForm isNil ifTrue:[ + ('SimpleView [warning]: no bitmap file: wheelm.xbm') errorPrintCR. + ok := false + ]. ]. ok ifFalse:[ - self cursor:Cursor wait. - aBlock ensure:[ - self cursor:oldCursor - ] + self cursor:Cursor wait. + aBlock ensure:[ + self cursor:oldCursor + ] ] ifTrue:[ - cursors := bitmaps collect:[:form | (Cursor sourceForm:form - maskForm:maskForm - hotX:8 - hotY:8) onDevice:device]. - - process := [ - Delay waitForSeconds:0.25. - [ - cursors do:[:curs | - self cursor:curs. - Delay waitForSeconds:0.05. - ] - ] loop. - ] forkAt:(Processor activeProcess priority + 1). - - aBlock ensure:[ - process terminate. - self cursor:oldCursor - ] + cursors := bitmaps collect:[:form | (Cursor sourceForm:form + maskForm:maskForm + hotX:8 + hotY:8) onDevice:device]. + + process := [ + Delay waitForSeconds:0.25. + [ + cursors do:[:curs | + self cursor:curs. + Delay waitForSeconds:0.05. + ] + ] loop. + ] forkAt:(Processor activeProcess priority + 1). + + aBlock ensure:[ + process terminate. + self cursor:oldCursor + ] ]. " @@ -4999,35 +4999,35 @@ wasBlocked := OperatingSystem blockInterrupts. [ - |deps| - - deps := dependents. - "/ - "/ store the very first dependent directly in - "/ the dependents instVar - "/ - (deps isNil and:[anObject isCollection not]) ifTrue:[ - dependents := anObject - ] ifFalse:[ - "/ - "/ store more dependents in the dependents collection - "/ - deps isCollection ifTrue:[ - deps add:anObject - ] ifFalse:[ - deps == anObject ifFalse:[ - deps isNil ifTrue:[ - dependents := (IdentitySet with:anObject) - ] ifFalse:[ - dependents := (IdentitySet with:deps with:anObject) - ] - ] - ] - ] + |deps| + + deps := dependents. + "/ + "/ store the very first dependent directly in + "/ the dependents instVar + "/ + (deps isNil and:[anObject isCollection not]) ifTrue:[ + dependents := anObject + ] ifFalse:[ + "/ + "/ store more dependents in the dependents collection + "/ + deps isCollection ifTrue:[ + deps add:anObject + ] ifFalse:[ + deps == anObject ifFalse:[ + deps isNil ifTrue:[ + dependents := (IdentitySet with:anObject) + ] ifFalse:[ + dependents := (IdentitySet with:deps with:anObject) + ] + ] + ] + ] ] ensure:[ - wasBlocked ifFalse:[ - OperatingSystem unblockInterrupts - ] + wasBlocked ifFalse:[ + OperatingSystem unblockInterrupts + ] ] "Modified: 8.1.1997 / 23:40:30 / cg" @@ -5040,7 +5040,7 @@ dependents isNil ifTrue:[^ #()]. dependents isCollection ifTrue:[ - ^ dependents + ^ dependents ]. ^ IdentitySet with:dependents @@ -5055,11 +5055,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 @@ -5075,11 +5075,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" @@ -5097,31 +5097,31 @@ wasBlocked := OperatingSystem blockInterrupts. [ - |deps sz dep| - - deps := dependents. - deps notNil ifTrue:[ - deps isCollection ifTrue:[ - deps remove:anObject ifAbsent:[]. - (sz := deps size) == 0 ifTrue:[ - dependents := nil - ] ifFalse:[ - sz == 1 ifTrue:[ - (dep := deps first) isCollection ifFalse:[ - dependents := dep - ] - ] - ] - ] ifFalse:[ - deps == anObject ifTrue:[ - dependents := nil - ] - ] - ] + |deps sz dep| + + deps := dependents. + deps notNil ifTrue:[ + deps isCollection ifTrue:[ + deps remove:anObject ifAbsent:[]. + (sz := deps size) == 0 ifTrue:[ + dependents := nil + ] ifFalse:[ + sz == 1 ifTrue:[ + (dep := deps first) isCollection ifFalse:[ + dependents := dep + ] + ] + ] + ] ifFalse:[ + deps == anObject ifTrue:[ + dependents := nil + ] + ] + ] ] ensure:[ - wasBlocked ifFalse:[ - OperatingSystem unblockInterrupts - ] + wasBlocked ifFalse:[ + OperatingSystem unblockInterrupts + ] ] "Modified: 8.1.1997 / 23:41:39 / cg" @@ -5277,11 +5277,11 @@ "draw bottom 3D edge into window frame" self drawBottomEdgeLevel:level - shadow:shadowColor - light:lightColor - halfShadow:nil - halfLight:nil - style:nil. + shadow:shadowColor + light:lightColor + halfShadow:nil + halfLight:nil + style:nil. ! drawBottomEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle @@ -5293,28 +5293,28 @@ count == 0 ifTrue:[^ self]. (count < 0) ifTrue:[ - botFg := lightColor. - count := count negated + botFg := lightColor. + count := count negated ] ifFalse:[ - ((edgeStyle == #soft) and:[level > 1]) ifTrue:[ - botFg := halfShadowColor - ] ifFalse:[ - botFg := shadowColor - ]. + ((edgeStyle == #soft) and:[level > 1]) ifTrue:[ + botFg := halfShadowColor + ] ifFalse:[ + botFg := shadowColor + ]. ]. super paint:botFg. super lineWidth:0. r := width - 1. 0 to:(count - 1) do:[:i | - b := height - 1 - i. - super displayDeviceLineFromX:i y:b toX:(r - i) y:b + b := height - 1 - i. + super displayDeviceLineFromX:i y:b toX:(r - i) y:b ]. ((edgeStyle == #soft) and:[level > 1]) ifTrue:[ - b := height - 1. - super paint:shadowColor. - super displayDeviceLineFromX:1 y:b toX:r y:b. + b := height - 1. + super paint:shadowColor. + super displayDeviceLineFromX:1 y:b toX:r y:b. ]. self edgeDrawn:#bottom. @@ -5326,32 +5326,32 @@ "draw all of my 3D edges" self drawEdgesForX:0 y:0 width:width height:height level:level - shadow:shadowColor - light:lightColor - halfShadow:nil - halfLight:nil - style:nil + shadow:shadowColor + light:lightColor + halfShadow:nil + halfLight:nil + style:nil ! drawEdgesForX:x y:y width:w height:h level:l "draw 3D edges into a rectangle" self - drawEdgesForX:x y:y width:w height:h level:l - shadow:shadowColor light:lightColor - halfShadow:nil halfLight:nil - style:nil + drawEdgesForX:x y:y width:w height:h level:l + shadow:shadowColor light:lightColor + halfShadow:nil halfLight:nil + style:nil ! drawLeftEdge "draw left 3D edge into window frame" self drawLeftEdgeLevel:level - shadow:shadowColor - light:lightColor - halfShadow:nil - halfLight:nil - style:nil. + shadow:shadowColor + light:lightColor + halfShadow:nil + halfLight:nil + style:nil. ! drawLeftEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle @@ -5362,33 +5362,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. @@ -5400,11 +5400,11 @@ "draw right 3D edge into window frame" self drawRightEdgeLevel:level - shadow:shadowColor - light:lightColor - halfShadow:nil - halfLight:nil - style:nil. + shadow:shadowColor + light:lightColor + halfShadow:nil + halfLight:nil + style:nil. ! drawRightEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle @@ -5416,27 +5416,27 @@ count == 0 ifTrue:[^ self]. (count < 0) ifTrue:[ - rightFg := lightColor. - count := count negated + rightFg := lightColor. + count := count negated ] ifFalse:[ - ((edgeStyle == #soft) and:[level > 1]) ifTrue:[ - rightFg := halfShadowColor - ] ifFalse:[ - rightFg := shadowColor - ]. + ((edgeStyle == #soft) and:[level > 1]) ifTrue:[ + rightFg := halfShadowColor + ] ifFalse:[ + rightFg := shadowColor + ]. ]. super paint:rightFg. super lineWidth:0. b := height - 1. 0 to:(count - 1) do:[:i | - r := width - 1 - i. - super displayDeviceLineFromX:r y:i toX:r y:(b - i) + r := width - 1 - i. + super displayDeviceLineFromX:r y:i toX:r y:(b - i) ]. ((edgeStyle == #soft) and:[level > 1]) ifTrue:[ - r := width - 1. - super paint:shadowColor. - super displayDeviceLineFromX:r y:1 toX:r y:b. + r := width - 1. + super paint:shadowColor. + super displayDeviceLineFromX:r y:1 toX:r y:b. ]. self edgeDrawn:#right. @@ -5448,11 +5448,11 @@ "draw top 3D edge into window frame" self drawTopEdgeLevel:level - shadow:shadowColor - light:lightColor - halfShadow:nil - halfLight:nil - style:nil. + shadow:shadowColor + light:lightColor + halfShadow:nil + halfLight:nil + style:nil. ! drawTopEdgeLevel:level atY:y shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle @@ -5463,32 +5463,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. @@ -5508,32 +5508,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. @@ -5545,11 +5545,11 @@ "redraw my edges (if any)" (level ~~ 0) ifTrue:[ - shown ifTrue:[ - gc clippingBounds:nil. - self drawEdges. - gc deviceClippingBounds:innerClipRect - ] + shown ifTrue:[ + gc clippingBounds:nil. + self drawEdges. + gc deviceClippingBounds:innerClipRect + ] ] "Modified: / 25.5.1999 / 14:50:25 / cg" @@ -5562,13 +5562,13 @@ If there is none, return the value from exceptionValue" subViews notNil ifTrue:[ - subViews do:[:aSubview | - |v| - - (aBlock value:aSubview) ifTrue:[ ^ aSubview ]. - v := aSubview allSubViewsDetect:aBlock ifNone:nil. - v notNil ifTrue:[^ v]. - ] + subViews do:[:aSubview | + |v| + + (aBlock value:aSubview) ifTrue:[ ^ aSubview ]. + v := aSubview allSubViewsDetect:aBlock ifNone:nil. + v notNil ifTrue:[^ v]. + ] ]. ^ exceptionValue value. @@ -5579,9 +5579,9 @@ "evaluate aBlock for all subviews (recursively)" subViews notNil ifTrue:[ - subViews do:[:aSubview | - aSubview withAllSubViewsDo:aBlock - ] + subViews do:[:aSubview | + aSubview withAllSubViewsDo:aBlock + ] ] "Modified: 12.2.1997 / 12:23:38 / cg" @@ -5595,8 +5595,8 @@ v := self container. [v notNil] whileTrue:[ - (aBlock value:v) ifTrue:[^ v]. - v := v container. + (aBlock value:v) ifTrue:[^ v]. + v := v container. ]. ^ exceptionValue value ! @@ -5608,8 +5608,8 @@ v := self container. [v notNil] whileTrue:[ - aBlock value:v. - v := v container. + aBlock value:v. + v := v container. ]. ! @@ -5617,15 +5617,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. ! @@ -5636,7 +5636,7 @@ unless they overlap. In that case, the later view is placed above the earlier." aSubViewOrComponent isView ifFalse:[ - ^ self changeSequenceOrderForComponent:aSubViewOrComponent to:anIndex + ^ self changeSequenceOrderForComponent:aSubViewOrComponent to:anIndex ]. ^ self changeSequenceOrderForView:aSubViewOrComponent to:anIndex ! @@ -5648,11 +5648,11 @@ |removedComponent| (components notNil and:[components size >= anIndex]) ifTrue:[ - removedComponent := components remove:aComponent ifAbsent:nil. - removedComponent notNil ifTrue:[ - components add:removedComponent beforeIndex:anIndex. - ^ true - ] + removedComponent := components remove:aComponent ifAbsent:nil. + removedComponent notNil ifTrue:[ + components add:removedComponent beforeIndex:anIndex. + ^ true + ] ]. ^ false ! @@ -5665,11 +5665,11 @@ |removedView| (subViews notNil and:[subViews size >= anIndex]) ifTrue:[ - removedView := subViews remove:aSubView ifAbsent:nil. - removedView notNil ifTrue:[ - subViews add:removedView beforeIndex:anIndex. - ^ true - ] + removedView := subViews remove:aSubView ifAbsent:nil. + removedView notNil ifTrue:[ + subViews add:removedView beforeIndex:anIndex. + ^ true + ] ]. ^ false ! @@ -5694,35 +5694,35 @@ "/ how comes ? And what should be done to avoid this ? checkForAnyNonExisting := - [ - anyNonExisting := false. - aCollectionOfDropObjects do:[:eachDropObject | - eachDropObject isFileObject ifTrue:[ - eachDropObject isDirectory ifFalse:[ - eachDropObject theObject asFilename exists ifFalse:[ - anyNonExisting := true. - whichNonExisting := eachDropObject theObject asFilename. - ] - ] - ]. - ]. - anyNonExisting - ]. + [ + anyNonExisting := false. + aCollectionOfDropObjects do:[:eachDropObject | + eachDropObject isFileObject ifTrue:[ + eachDropObject isDirectory ifFalse:[ + eachDropObject theObject asFilename exists ifFalse:[ + anyNonExisting := true. + whichNonExisting := eachDropObject theObject asFilename. + ] + ] + ]. + ]. + anyNonExisting + ]. self withWaitCursorDo:[ - tDelayed := 0. - checkForAnyNonExisting doWhile:[ - anyNonExisting ifTrue:[ - Delay waitForSeconds:0.3. - tDelayed := tDelayed + 0.3. - ]. - anyNonExisting and:[ tDelayed <= 3]. - ]. + tDelayed := 0. + checkForAnyNonExisting doWhile:[ + anyNonExisting ifTrue:[ + Delay waitForSeconds:0.3. + tDelayed := tDelayed + 0.3. + ]. + anyNonExisting and:[ tDelayed <= 3]. + ]. ]. (anyNonExisting and:[checkForAnyNonExisting value]) ifTrue:[ - Dialog warn:('Dropfile not present: %1' bindWith:whichNonExisting pathName). - ^ self + Dialog warn:('Dropfile not present: %1' bindWith:whichNonExisting pathName). + ^ self ]. view := self. @@ -5730,32 +5730,32 @@ app := view application. app notNil ifTrue:[ - (app canDropObjects:aCollectionOfDropObjects in:view at:positionInView) ifTrue:[ - app dropObjects:aCollectionOfDropObjects in:view at:positionInView. - ^ self. - ]. + (app canDropObjects:aCollectionOfDropObjects in:view at:positionInView) ifTrue:[ + app dropObjects:aCollectionOfDropObjects in:view at:positionInView. + ^ self. + ]. ]. [view notNil] whileTrue:[ - "new mechanism to get a dropTarget" - target := view dropTarget. - target notNil ifTrue:[ - dropContext := DropContext new. - dropContext dropObjects:aCollectionOfDropObjects. - dropContext dropTarget:target. - - (target canDrop:dropContext) ifTrue:[ - target drop:dropContext. - ^ self. - ]. - ]. - - (view canDropObjects:aCollectionOfDropObjects at:positionInView) ifTrue:[ - view dropObjects:aCollectionOfDropObjects at:positionInView. - ^ self. - ]. - view := view superView. - positionInView := nil. + "new mechanism to get a dropTarget" + target := view dropTarget. + target notNil ifTrue:[ + dropContext := DropContext new. + dropContext dropObjects:aCollectionOfDropObjects. + dropContext dropTarget:target. + + (target canDrop:dropContext) ifTrue:[ + target drop:dropContext. + ^ self. + ]. + ]. + + (view canDropObjects:aCollectionOfDropObjects at:positionInView) ifTrue:[ + view dropObjects:aCollectionOfDropObjects at:positionInView. + ^ self. + ]. + view := view superView. + positionInView := nil. ] "Modified: / 17-10-2006 / 18:00:46 / cg" @@ -5765,8 +5765,8 @@ "button was moved" self topView == TopView currentWindowBeingMoved ifTrue:[ - self topView doWindowMove. - ^ self. + self topView doWindowMove. + ^ self. ]. "Created: / 03-03-2011 / 19:11:11 / cg" @@ -5776,10 +5776,10 @@ "button was pressed quickly again - check my components for a hit." components notNil ifTrue:[ - self componentsContainingX:x y:y do:[:comp :cx :cy | - comp buttonMultiPress:button x:cx y:cy. - ^ self - ] + self componentsContainingX:x y:y do:[:comp :cx :cy | + comp buttonMultiPress:button x:cx y:cy. + ^ self + ] ]. super buttonMultiPress:button x:x y:y @@ -5794,16 +5794,16 @@ |topView| components notNil ifTrue:[ - self componentsContainingX:x y:y do:[:comp :cx :cy | - comp buttonPress:button x:cx y:cy. - ^ self - ] + self componentsContainingX:x y:y do:[:comp :cx :cy | + comp buttonPress:button x:cx y:cy. + ^ self + ] ]. "/ an undecorated (but modeless) topView -> do a window move (topView := self topView) startWindowMoveOnButtonPress ifTrue:[ - topView startWindowMove. - ^ self. + topView startWindowMove. + ^ self. ]. super buttonPress:button x:x y:y @@ -5815,15 +5815,15 @@ "button was released - check my components for a hit." components notNil ifTrue:[ - self componentsContainingX:x y:y do:[:comp :cx :cy | - comp buttonRelease:button x:cx y:cy. - ^ self - ] + self componentsContainingX:x y:y do:[:comp :cx :cy | + comp buttonRelease:button x:cx y:cy. + ^ self + ] ]. self topView == TopView currentWindowBeingMoved ifTrue:[ - self topView endWindowMove. - ^ self. + self topView endWindowMove. + ^ self. ]. super buttonRelease:button x:x y:y @@ -5839,9 +5839,9 @@ |oldScale newScale factor| amount > 0 ifTrue:[ - factor := 1.2. + factor := 1.2. ] ifFalse:[ - factor := 0.8. + factor := 0.8. ]. oldScale := self scale. newScale := (oldScale * factor) max:0.1. @@ -5856,7 +5856,7 @@ |app| (app := self application) notNil ifTrue:[ - app clientMessage:msgType format:msgFormat eventData:msgData + app clientMessage:msgType format:msgFormat eventData:msgData ]. ! @@ -5881,74 +5881,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:[ @@ -5958,11 +5958,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" @@ -5983,20 +5983,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. ]]. @@ -6037,7 +6037,7 @@ "/ my subviews (they remember this in the shown instVar) realized ifTrue:[ - shown ifFalse:[ + shown ifFalse:[ "/ old: "/ shown := true. "/ subViews notNil ifTrue:[ @@ -6047,8 +6047,8 @@ "/ ] "/ which is equivalent to: - self mapped. - ] + self mapped. + ] ]. "Modified: 30.5.1996 / 11:41:02 / cg" @@ -6063,9 +6063,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,7 +6079,7 @@ |app| (app := self application) notNil ifTrue:[ - app copyDataEvent:parameter eventData:msgData + app copyDataEvent:parameter eventData:msgData ]. ! @@ -6100,11 +6100,11 @@ "view has been destroyed by someone else (usually window system)" shown ifTrue:[ - shown := false. - dependents notNil ifTrue:[ - self changed:#visibility. - self changed:#destroyed - ]. + shown := false. + dependents notNil ifTrue:[ + self changed:#visibility. + self changed:#destroyed + ]. ]. super destroyed @@ -6119,17 +6119,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:'. @@ -6150,7 +6150,7 @@ |leftEdge topEdge rightEdge botEdge anyEdge nx ny nw nh old oldPaint| shown ifFalse:[ - ^ self + ^ self ]. nw := w. @@ -6164,110 +6164,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. @@ -6290,7 +6290,7 @@ "notification from the windowGroup that I got the keyboardFocus." delegate notNil ifTrue:[ - delegate perform:#hasKeyboardFocus: with:aBoolean ifNotUnderstood:nil + delegate perform:#hasKeyboardFocus: with:aBoolean ifNotUnderstood:nil ]. ^ self ! @@ -6305,44 +6305,44 @@ |focusView| components notNil ifTrue:[ - components notNil ifTrue:[ - self componentsContainingX:x y:y do:[:comp :cx :cy | - comp keyPress:key x:cx y:cy. - ^ self - ] - ]. + components notNil ifTrue:[ + self componentsContainingX:x y:y do:[:comp :cx :cy | + comp keyPress:key x:cx y:cy. + ^ self + ] + ]. ]. key == #Menu ifTrue:[ - ((focusView := self windowGroup focusView) notNil - and:[focusView ~~ self]) - ifTrue:[ - "/ forward to the focusView - focusView keyPress:key x:-1 y:-1. - ^ self - ]. - ^ self activateMenu. + ((focusView := self windowGroup focusView) notNil + and:[focusView ~~ self]) + ifTrue:[ + "/ forward to the focusView + focusView keyPress:key x:-1 y:-1. + ^ self + ]. + ^ self activateMenu. ]. x isNil ifTrue:[ - "/ already redelegated, but nowhere handled - superView notNil ifTrue:[ - superView keyPress:key x:nil y:nil. - ]. - ^ self + "/ already redelegated, but nowhere handled + superView notNil ifTrue:[ + superView keyPress:key x:nil y:nil. + ]. + ^ self ]. superView notNil ifTrue:[ - superView - dispatchEvent:#keyPress:x:y: - arguments:(Array with:key with:0 with:0) + superView + dispatchEvent:#keyPress:x:y: + arguments:(Array with:key with:0 with:0) "/ WindowEvent "/ sendEvent:#keyPress:x:y: "/ arguments:(Array with:key with:0 with:0) "/ view:superView ] ifFalse:[ - super keyPress:key x:x y:y + super keyPress:key x:x y:y ] "Modified: / 20.5.1998 / 22:55:08 / cg" @@ -6354,12 +6354,12 @@ Otherwise, do whatever my superclass would do." components notNil ifTrue:[ - components notNil ifTrue:[ - self componentsContainingX:x y:y do:[:comp :cx :cy | - comp keyRelease:key x:cx y:cy. - ^ self - ] - ]. + components notNil ifTrue:[ + self componentsContainingX:x y:y do:[:comp :cx :cy | + comp keyRelease:key x:cx y:cy. + ^ self + ] + ]. ]. super keyRelease:key x:x y:y @@ -6384,9 +6384,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 @@ -6396,41 +6396,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:[ - subViews do:[:v | + 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" @@ -6450,39 +6450,39 @@ sensor := self sensor. UserPreferences current allowMouseWheelZoom ifTrue:[ - zoomInOrOut := sensor ctrlDown or:[sensor metaDown]. - zoomInOrOut ifTrue:[ - self mouseWheelZoom:amount. - ^ self. - ]. + zoomInOrOut := sensor ctrlDown or:[sensor metaDown]. + zoomInOrOut ifTrue:[ + self mouseWheelZoom:amount. + ^ self. + ]. ]. 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. + amountToScroll := horizontal + ifTrue:[ self horizontalScrollStep] + ifFalse:[ self verticalScrollStep ]. + amountToScroll := self scaleMouseWheelScrollAmount:amountToScroll. ]. amount > 0 ifTrue:[ - pageScroll ifTrue:[ - horizontal ifTrue:[self pageLeft] ifFalse:[self pageUp] - ] ifFalse:[ - horizontal ifTrue:[self scrollLeft:amountToScroll] ifFalse:[self scrollUp:amountToScroll] - ] + pageScroll ifTrue:[ + horizontal ifTrue:[self pageLeft] ifFalse:[self pageUp] + ] ifFalse:[ + horizontal ifTrue:[self scrollLeft:amountToScroll] ifFalse:[self scrollUp:amountToScroll] + ] ] ifFalse:[ - pageScroll ifTrue:[ - horizontal ifTrue:[self pageRight] ifFalse:[self pageDown] - ] ifFalse:[ - horizontal ifTrue:[self scrollRight:amountToScroll] ifFalse:[self scrollDown:amountToScroll] - ] + pageScroll ifTrue:[ + horizontal ifTrue:[self pageRight] ifFalse:[self pageDown] + ] ifFalse:[ + horizontal ifTrue:[self scrollRight:amountToScroll] ifFalse:[self scrollDown:amountToScroll] + ] ]. "Modified: / 21.5.1999 / 19:58:42 / cg" @@ -6502,18 +6502,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 ] @@ -6579,8 +6579,8 @@ hCont := self heightOfContents. hCont > (innerHeight * 3) ifTrue:[ - factor := (hCont // innerHeight) min:4. - ^ amountToScroll * factor. + factor := (hCont // innerHeight) min:4. + ^ amountToScroll * factor. ]. ^ amountToScroll ! @@ -6593,58 +6593,58 @@ |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:[ - (how isNil "false" - or:[how == #smaller]) ifTrue:[ - subViews do:[:view | - view notNil ifTrue:[ - view containerChangedSize - ] - ] - ] ifFalse:[ - "doing it reverse speeds up resizing - usually subviews - are created from top-left to bottom-right; therefore - bottom-right views will be moved/resized first, then top-left ones; - this avoids multiple redraws of subviews" - - subViews reverseDo:[:view | - view notNil ifTrue:[ - view containerChangedSize - ] - ] - ] + (how isNil "false" + or:[how == #smaller]) ifTrue:[ + subViews do:[:view | + view notNil ifTrue:[ + view containerChangedSize + ] + ] + ] ifFalse:[ + "doing it reverse speeds up resizing - usually subviews + are created from top-left to bottom-right; therefore + bottom-right views will be moved/resized first, then top-left ones; + this avoids multiple redraws of subviews" + + subViews reverseDo:[:view | + view notNil ifTrue:[ + view containerChangedSize + ] + ] + ] ]. components notNil ifTrue:[ - (how isNil "false" - or:[how == #smaller]) ifTrue:[ - components do:[:view | - view containerChangedSize - ] - ] ifFalse:[ - "doing it reverse speeds up resizing - usually subviews - are created from top-left to bottom-right; therefore - bottom-right views will be moved/resized first, then top-left ones; - this avoids multiple redraws of subviews" - - components reverseDo:[:view | - view containerChangedSize - ] - ] + (how isNil "false" + or:[how == #smaller]) ifTrue:[ + components do:[:view | + view containerChangedSize + ] + ] ifFalse:[ + "doing it reverse speeds up resizing - usually subviews + are created from top-left to bottom-right; therefore + bottom-right views will be moved/resized first, then top-left ones; + this avoids multiple redraws of subviews" + + components reverseDo:[:view | + view containerChangedSize + ] + ] ]. self changed:#sizeOfView with:how. superView notNil ifTrue:[ - superView subViewChangedSize + superView subViewChangedSize ] "Modified: / 2.4.1998 / 13:59:59 / cg" @@ -6688,20 +6688,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" @@ -6716,8 +6716,8 @@ newShown := how ~~ #fullyObscured. newShown ~~ shown ifTrue:[ - shown := newShown. - dependents notNil ifTrue:[ self changed:#visibility ]. + shown := newShown. + dependents notNil ifTrue:[ self changed:#visibility ]. ]. ! @@ -6733,56 +6733,56 @@ sent to scrollableViews..." scrollCode == #SB_LINEDOWN ifTrue:[ - self scrollDown. - ^ self. + self scrollDown. + ^ self. ]. scrollCode == #SB_LINEUP ifTrue:[ - self scrollUp. - ^ self. + self scrollUp. + ^ self. ]. scrollCode == #SB_LINELEFT ifTrue:[ - self scrollLeft. - ^ self. + self scrollLeft. + ^ self. ]. scrollCode == #SB_LINERIGHT ifTrue:[ - self scrollRight. - ^ self. + self scrollRight. + ^ self. ]. scrollCode == #SB_PAGEDOWN ifTrue:[ - self pageDown. - ^ self. + self pageDown. + ^ self. ]. scrollCode == #SB_PAGEUP ifTrue:[ - self pageUp. - ^ self. + self pageUp. + ^ self. ]. scrollCode == #SB_PAGELEFT ifTrue:[ - self pageLeft. - ^ self. + self pageLeft. + ^ self. ]. scrollCode == #SB_PAGERIGHT ifTrue:[ - self pageRight. - ^ self. + self pageRight. + ^ self. ]. scrollCode == #SB_THUMBPOSITIONVERTICAL ifTrue:[ - self scrollVerticalToPercent:newPosition. - ^ self. + self scrollVerticalToPercent:newPosition. + ^ self. ]. scrollCode == #SB_THUMBPOSITIONHORIZONTAL ifTrue:[ - self scrollHorizontalToPercent:newPosition. - ^ self. + self scrollHorizontalToPercent:newPosition. + ^ self. ]. scrollCode == #SB_THUMBTRACKVERTICAL ifTrue:[ - self scrollVerticalToPercent:newPosition. - ^ self. + self scrollVerticalToPercent:newPosition. + ^ self. ]. scrollCode == #SB_THUMBTRACKHORIZONTAL ifTrue:[ - self scrollHorizontalToPercent:newPosition. - ^ self. + self scrollHorizontalToPercent:newPosition. + ^ self. ]. scrollCode == #SB_ENDSCROLL ifTrue:[ - ^ self. + ^ self. ]. ! ! @@ -6914,13 +6914,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 ! @@ -6941,17 +6941,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 ! @@ -6972,13 +6972,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 ! @@ -7012,45 +7012,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 - targetView := device activePointerGrab. + "/ if there is a pointer grab, the event has to sent to that one + targetView := device activePointerGrab. ] ifFalse:[ - (ev isKeyEvent) ifTrue:[ - "/ if there is a pointer grab, the event has to sent to that one - targetView := device activeKeyboardGrab. - ]. + (ev isKeyEvent) ifTrue:[ + "/ if there is a pointer grab, the event has to sent to that one + targetView := 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 @@ -7067,13 +7067,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. @@ -7086,8 +7086,8 @@ (p := device buttonLongPressedHandlerProcess) notNil ifTrue:[ "/ Transcript showCR:'stop'. - device buttonLongPressedHandlerProcess:nil. - p terminate. + device buttonLongPressedHandlerProcess:nil. + p terminate. ]. ! ! @@ -7098,13 +7098,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. + ]. ]. ! @@ -7125,25 +7125,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" @@ -7161,9 +7161,9 @@ "/ canTab := aBoolean aBoolean ifTrue:[ - flagBits := flagBits bitOr:FlagCanTab + flagBits := flagBits bitOr:FlagCanTab ] ifFalse:[ - flagBits := flagBits bitClear:FlagCanTab + flagBits := flagBits bitClear:FlagCanTab ]. ! @@ -7179,9 +7179,9 @@ if false, the behavior depends upon the settings." aBoolean ifTrue:[ - flagBits := flagBits bitOr:FlagDoNotRequestFocusOnPointerEnter + flagBits := flagBits bitOr:FlagDoNotRequestFocusOnPointerEnter ] ifFalse:[ - flagBits := flagBits bitClear:FlagDoNotRequestFocusOnPointerEnter + flagBits := flagBits bitClear:FlagDoNotRequestFocusOnPointerEnter ]. ! @@ -7209,16 +7209,16 @@ index == 0 ifTrue:[ ^ nil ]. subviewsInFocusOrder from:(index + 1) do:[:eachChildAfterTheOne | - eachChildAfterTheOne shown ifTrue:[ - (eachChildAfterTheOne canTab - and:[eachChildAfterTheOne enabled]) ifTrue:[ - ^ eachChildAfterTheOne - ]. - - (viewInSubView := eachChildAfterTheOne focusNext) notNil ifTrue:[ - ^ viewInSubView - ]. - ]. + eachChildAfterTheOne shown ifTrue:[ + (eachChildAfterTheOne canTab + and:[eachChildAfterTheOne enabled]) ifTrue:[ + ^ eachChildAfterTheOne + ]. + + (viewInSubView := eachChildAfterTheOne focusNext) notNil ifTrue:[ + ^ viewInSubView + ]. + ]. ]. ^ nil ! @@ -7230,15 +7230,15 @@ |viewInSubView| self subviewsInFocusOrder do:[:aSubView| - (aSubView canTab - and:[aSubView enabled - and:[aCondition value:aSubView]]) ifTrue:[ - ^ aSubView - ]. - - (viewInSubView := aSubView focusNextForWhich:aCondition) notNil ifTrue:[ - ^ viewInSubView - ] + (aSubView canTab + and:[aSubView enabled + and:[aCondition value:aSubView]]) ifTrue:[ + ^ aSubView + ]. + + (viewInSubView := aSubView focusNextForWhich:aCondition) notNil ifTrue:[ + ^ viewInSubView + ] ]. ^ nil ! @@ -7250,18 +7250,18 @@ |viewInSubView| shown ifTrue:[ - self subviewsInFocusOrder reverseDo:[:aSubView| - aSubView shown ifTrue:[ - viewInSubView := aSubView focusPrevious. - - viewInSubView notNil ifTrue:[ - ^ viewInSubView - ]. - (aSubView canTab and:[aSubView enabled]) ifTrue:[ - ^ aSubView - ]. - ] - ] + self subviewsInFocusOrder reverseDo:[:aSubView| + aSubView shown ifTrue:[ + viewInSubView := aSubView focusPrevious. + + viewInSubView notNil ifTrue:[ + ^ viewInSubView + ]. + (aSubView canTab and:[aSubView enabled]) ifTrue:[ + ^ aSubView + ]. + ] + ] ]. ^ nil ! @@ -7280,19 +7280,19 @@ index == 0 ifTrue:[ ^ nil ]. subviewsInFocusOrder from:1 to:(index - 1) reverseDo:[:eachChildBeforeTheOne | - eachChildBeforeTheOne shown ifTrue:[ - (viewInSubView := eachChildBeforeTheOne focusPrevious) notNil ifTrue:[ - ^ viewInSubView - ]. - - (eachChildBeforeTheOne canTab and:[eachChildBeforeTheOne enabled]) ifTrue:[ - ^ eachChildBeforeTheOne - ]. - ]. + eachChildBeforeTheOne shown ifTrue:[ + (viewInSubView := eachChildBeforeTheOne focusPrevious) notNil ifTrue:[ + ^ viewInSubView + ]. + + (eachChildBeforeTheOne canTab and:[eachChildBeforeTheOne enabled]) ifTrue:[ + ^ eachChildBeforeTheOne + ]. + ]. ]. "/ the code below allows for a notebooks tab-list to be reached (self canTab and:[self enabled]) ifTrue:[ - ^ self + ^ self ]. ^ nil @@ -7327,7 +7327,7 @@ "/ Transcript show:'take: '; showCR:self. windowGroup notNil ifTrue:[ - ^ windowGroup focusRequestFrom:self + ^ windowGroup focusRequestFrom:self ]. "/ Transcript show:'oops: '; showCR:self. ^ true @@ -7349,9 +7349,9 @@ " aBoolean ifTrue:[ - flagBits := flagBits bitOr:FlagRequestFocusOnPointerEnter + flagBits := flagBits bitOr:FlagRequestFocusOnPointerEnter ] ifFalse:[ - flagBits := flagBits bitClear:FlagRequestFocusOnPointerEnter + flagBits := flagBits bitClear:FlagRequestFocusOnPointerEnter ]. ! @@ -7364,34 +7364,34 @@ |delta clrId bd graphicsDevice| explicit ifTrue:[ - (self drawableId notNil - and:[superView notNil - and:[styleSheet notNil]]) ifTrue:[ - (styleSheet at:#'focus.showBorder' default:true) ifTrue:[ - graphicsDevice := device. - - (graphicsDevice supportsWindowBorder:(bd := DefaultFocusBorderWidth)) ifFalse:[ - (graphicsDevice supportsWindowBorder:(bd := 1)) ifFalse:[ - bd := 0. - ] - ]. - delta := bd - self borderWidth. - delta ~~ 0 ifTrue:[ - (left == 0 or:[top == 0]) ifTrue:[ - graphicsDevice resizeWindow:self drawableId width:width-delta-delta height:height-delta-delta. - ] ifFalse:[ - graphicsDevice moveWindow:self drawableId x:left-delta y:top-delta. - ]. - graphicsDevice setWindowBorderWidth:bd in:self drawableId. - ]. - - clrId := (DefaultFocusColor onDevice:graphicsDevice) colorId. - clrId isNil ifTrue:[ - clrId := graphicsDevice blackpixel - ]. - graphicsDevice setWindowBorderColor:clrId in:self drawableId. - ] - ] + (self drawableId notNil + and:[superView notNil + and:[styleSheet notNil]]) ifTrue:[ + (styleSheet at:#'focus.showBorder' default:true) ifTrue:[ + graphicsDevice := device. + + (graphicsDevice supportsWindowBorder:(bd := DefaultFocusBorderWidth)) ifFalse:[ + (graphicsDevice supportsWindowBorder:(bd := 1)) ifFalse:[ + bd := 0. + ] + ]. + delta := bd - self borderWidth. + delta ~~ 0 ifTrue:[ + (left == 0 or:[top == 0]) ifTrue:[ + graphicsDevice resizeWindow:self drawableId width:width-delta-delta height:height-delta-delta. + ] ifFalse:[ + graphicsDevice moveWindow:self drawableId x:left-delta y:top-delta. + ]. + graphicsDevice setWindowBorderWidth:bd in:self drawableId. + ]. + + clrId := (DefaultFocusColor onDevice:graphicsDevice) colorId. + clrId isNil ifTrue:[ + clrId := graphicsDevice blackpixel + ]. + graphicsDevice setWindowBorderColor:clrId in:self drawableId. + ] + ] ] "Modified: / 17.9.1998 / 15:08:34 / cg" @@ -7406,24 +7406,24 @@ |delta bd graphicsDevice| explicit ifTrue:[ - (self drawableId notNil and:[superView notNil]) ifTrue:[ - (styleSheet at:#'focus.showBorder' default:true) ifTrue:[ - graphicsDevice := device. - - (graphicsDevice supportsWindowBorder:(bd := self borderWidth)) ifFalse:[ - (graphicsDevice supportsWindowBorder:(bd := 1)) ifFalse:[ - bd := 0. - ] - ]. - delta := DefaultFocusBorderWidth - bd. - delta ~~ 0 ifTrue:[ - graphicsDevice setWindowBorderWidth:bd in:self drawableId. - graphicsDevice moveWindow:self drawableId x:left y:top. - graphicsDevice resizeWindow:self drawableId width:width height:height. - ]. - self setBorderColor. - ] - ] + (self drawableId notNil and:[superView notNil]) ifTrue:[ + (styleSheet at:#'focus.showBorder' default:true) ifTrue:[ + graphicsDevice := device. + + (graphicsDevice supportsWindowBorder:(bd := self borderWidth)) ifFalse:[ + (graphicsDevice supportsWindowBorder:(bd := 1)) ifFalse:[ + bd := 0. + ] + ]. + delta := DefaultFocusBorderWidth - bd. + delta ~~ 0 ifTrue:[ + graphicsDevice setWindowBorderWidth:bd in:self drawableId. + graphicsDevice moveWindow:self drawableId x:left y:top. + graphicsDevice resizeWindow:self drawableId width:width height:height. + ]. + self setBorderColor. + ] + ] ] "Modified: / 17.9.1998 / 15:08:02 / cg" @@ -7437,7 +7437,7 @@ "Unconditionally take the focus from my windowGroup" windowGroup notNil ifTrue:[ - windowGroup focusView:self byTab:nil "/false. + windowGroup focusView:self byTab:nil "/false. ]. ! @@ -7449,9 +7449,9 @@ takeFocusWhenMapped:aBoolean aBoolean ifTrue:[ - flagBits := flagBits bitOr:FlagTakeFocusWhenMapped + flagBits := flagBits bitOr:FlagTakeFocusWhenMapped ] ifFalse:[ - flagBits := flagBits bitClear:FlagTakeFocusWhenMapped + flagBits := flagBits bitClear:FlagTakeFocusWhenMapped ]. "Created: / 09-12-2010 / 10:34:11 / cg" @@ -7461,15 +7461,15 @@ "invoked when my topView is mapped" self isKeyboardConsumer ifTrue:[ - self takeFocusWhenMapped ifTrue:[ - self requestFocus - ] + self takeFocusWhenMapped ifTrue:[ + self requestFocus + ] ] ifFalse:[ - subViews notNil ifTrue:[ - subViews do:[:eachSubView | - eachSubView topViewWasMapped - ]. - ]. + subViews notNil ifTrue:[ + subViews do:[:eachSubView | + eachSubView topViewWasMapped + ]. + ]. ]. "Created: / 09-12-2010 / 18:11:51 / cg" @@ -7550,8 +7550,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 ! @@ -7562,14 +7562,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. ]. ! @@ -7579,14 +7579,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. ] ! ! @@ -7603,7 +7603,7 @@ |app| (app := self application) notNil ifTrue:[ - app noticeOfWindowClose:self + app noticeOfWindowClose:self ]. ! @@ -7611,7 +7611,7 @@ |app| (app := self application) notNil ifTrue:[ - app noticeOfWindowOpen:self + app noticeOfWindowOpen:self ]. dependents notNil ifTrue:[ self changed:#opened ] ! @@ -7662,11 +7662,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:[ @@ -7675,11 +7675,11 @@ "/ ]. subViews notNil ifTrue:[ - self destroySubViews. + self destroySubViews. ]. superView notNil ifTrue:[ - superView removeSubView:self. - superView := nil + superView removeSubView:self. + superView := nil ]. super destroy. @@ -7691,13 +7691,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. @@ -7718,32 +7718,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 @@ -7760,12 +7760,12 @@ and keep the values in fast class variables " StyleSheet isNil ifTrue:[ - DefaultStyle isNil ifTrue:[ - "/ the very-very first time (no styleSheet yet) - View setDefaultStyle. - View defaultStyle:DefaultStyle. - ]. - SimpleView updateAllStyleCaches + DefaultStyle isNil ifTrue:[ + "/ the very-very first time (no styleSheet yet) + View setDefaultStyle. + View defaultStyle:DefaultStyle. + ]. + SimpleView updateAllStyleCaches ]. styleSheet := StyleSheet. @@ -7816,15 +7816,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. @@ -7844,7 +7844,7 @@ prepareForReinit super prepareForReinit. windowGroup notNil ifTrue:[ - windowGroup reinitialize + windowGroup reinitialize ] ! @@ -7861,12 +7861,12 @@ oldBorder := self border. self initStyle. (self drawableId notNil and:[self gcId notNil]) ifTrue:[ - "force a change" - self border:oldBorder. - self level:oldLevel. - self viewBackground:self viewBackground. - self clearView. - self invalidate. + "force a change" + self border:oldBorder. + self level:oldLevel. + self viewBackground:self viewBackground. + self clearView. + self invalidate. ]. "Modified: / 18.9.1998 / 21:15:33 / cg" @@ -7879,16 +7879,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" @@ -7900,18 +7900,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" @@ -7924,8 +7924,8 @@ "remove all dependencies from the receiver" visibilityChannel notNil ifTrue:[ - visibilityChannel retractInterestsFor:self. - visibilityChannel removeDependent:self. visibilityChannel := nil + visibilityChannel retractInterestsFor:self. + visibilityChannel removeDependent:self. visibilityChannel := nil ]. dependents := nil. @@ -7983,9 +7983,9 @@ "set or clear the mnemonic key" aSymbolOrNil isSymbol ifTrue:[ - self objectAttributeAt:#mnemonicKey put:aSymbolOrNil + self objectAttributeAt:#mnemonicKey put:aSymbolOrNil ] ifFalse:[ - self removeObjectAttribute:#mnemonicKey + self removeObjectAttribute:#mnemonicKey ]. ! @@ -7998,19 +7998,19 @@ key := aKeyEvent key. rawKey := aKeyEvent rawKey. (shown and:[ subViews notNil ]) ifTrue:[ - subViews do:[:aSubView | - aSubView shown ifTrue:[ - (aSubView enabled - and:[ (mnemonic := aSubView mnemonicKey) notNil - and:[ (mnemonic == rawKey or:[ mnemonic == key ]) ]]) - ifTrue:[ - ^ aSubView - ]. - (view := aSubView mnemonicViewNext:aKeyEvent) notNil ifTrue:[ - ^ view - ]. - ] - ] + subViews do:[:aSubView | + aSubView shown ifTrue:[ + (aSubView enabled + and:[ (mnemonic := aSubView mnemonicKey) notNil + and:[ (mnemonic == rawKey or:[ mnemonic == key ]) ]]) + ifTrue:[ + ^ aSubView + ]. + (view := aSubView mnemonicViewNext:aKeyEvent) notNil ifTrue:[ + ^ view + ]. + ] + ] ]. ^ nil @@ -8030,22 +8030,22 @@ |key| shown ifTrue:[ - self enabled ifTrue:[ - (key := self shortcutKey) notNil ifTrue:[ - (key == aKeyEvent key or:[ key == aKeyEvent rawKey ]) ifTrue:[ - self requestFocus. - (controller ? self) performShortcutAction. - ^ true - ] - ]. - ]. - subViews notNil ifTrue:[ - subViews do:[:aSubView | - (aSubView processShortcut:aKeyEvent) ifTrue:[ - ^ true - ] - ] - ] + self enabled ifTrue:[ + (key := self shortcutKey) notNil ifTrue:[ + (key == aKeyEvent key or:[ key == aKeyEvent rawKey ]) ifTrue:[ + self requestFocus. + (controller ? self) performShortcutAction. + ^ true + ] + ]. + ]. + subViews notNil ifTrue:[ + subViews do:[:aSubView | + (aSubView processShortcut:aKeyEvent) ifTrue:[ + ^ true + ] + ] + ] ]. ^ false ! @@ -8061,33 +8061,33 @@ s := aString readStream. [s atEnd] whileFalse:[ - c := s next. - c == $& ifTrue:[ - n := s peek. - (n notNil and:[n isLetter]) ifTrue:[ - c := s next. - pos := xLatedString size + 1. - ] ifFalse:[ - n == $& ifTrue:[ - s next. - ] - ] - ]. - c notNil ifTrue:[ - xLatedString nextPut:c - ] + c := s next. + c == $& ifTrue:[ + n := s peek. + (n notNil and:[n isLetter]) ifTrue:[ + c := s next. + pos := xLatedString size + 1. + ] ifFalse:[ + n == $& ifTrue:[ + s next. + ] + ] + ]. + c notNil ifTrue:[ + xLatedString nextPut:c + ] ]. xLatedString := xLatedString contents. pos notNil ifTrue:[ - shortcutCharacter := xLatedString at:pos ifAbsent:nil. - - xLatedString isText ifFalse:[ - xLatedString := xLatedString asText - ]. - xLatedString emphasisAt:pos add:#underline. - - shortcut := ('Cmd' , shortcutCharacter asLowercase) asSymbol. + shortcutCharacter := xLatedString at:pos ifAbsent:nil. + + xLatedString isText ifFalse:[ + xLatedString := xLatedString asText + ]. + xLatedString emphasisAt:pos add:#underline. + + shortcut := ('Cmd' , shortcutCharacter asLowercase) asSymbol. ]. ^ Array with:shortcut with:xLatedString @@ -8112,12 +8112,25 @@ "set or clear the shortcut key" aSymbolOrNil notNil ifTrue:[ - self objectAttributeAt:#shortcutKey put:aSymbolOrNil + self objectAttributeAt:#shortcutKey put:aSymbolOrNil ] ifFalse:[ - self removeObjectAttribute:#shortcutKey + self removeObjectAttribute:#shortcutKey ]. ! ! +!SimpleView methodsFor:'menu & menu actions'! + +fontLargerOrSmaller:largerBoolean + |newFont| + + newFont := font asSize:(largerBoolean + ifTrue:[(font size + 1) min:100] + ifFalse:[(font size-1) max:4]). + self font:newFont. + + "Modified: / 27-02-1996 / 00:53:51 / cg" + "Created: / 10-03-2012 / 09:38:32 / cg" +! ! !SimpleView methodsFor:'menu handling'! @@ -8128,86 +8141,86 @@ and handled in the superClass (static menus are a historic leftOver). Otherwise, the follwing steps are performed: - - ask the receiver for the menu (via #yellowButtonMenu) - - ask the receiver for the menuPerformer. - - startUp the menu - it is supposed to return an actionSelector - - if the menuPerformer responds to the selector, - send it to the performer; - otherwise send it to the view (the receiver) - This is funny, it allows additional menuItems to be added - AND still get the views copy/cut/paste functionality. - Without this, you had to redefine and forward all of those - messages in the performer." + - ask the receiver for the menu (via #yellowButtonMenu) + - ask the receiver for the menuPerformer. + - startUp the menu - it is supposed to return an actionSelector + - if the menuPerformer responds to the selector, + send it to the performer; + otherwise send it to the view (the receiver) + This is funny, it allows additional menuItems to be added + AND still get the views copy/cut/paste functionality. + Without this, you had to redefine and forward all of those + messages in the performer." |menu menuPerformer actionSelector prevReceiver wg| self middleButtonMenu isNil ifTrue:[ - " - try ST-80 style menus first: - if there is a model, and a menuMessage is defined, - ask model for the menu and launch that if non-nil. - " - menu := self yellowButtonMenu. - menu notNil ifTrue:[ - " - got one, launch the menu. It is supposed - to return an actionSelector. - " - menuPerformer := self menuPerformer value. - - "/ could be a spec ... - menu isArray ifTrue:[ - menu := menu decodeAsLiteralArray. - menu receiver:menuPerformer. - menu findGuiResourcesIn:(self menuHolder). - ] ifFalse:[ - (menu respondsTo:#receiver) ifTrue:[ - menuPerformer := menu receiver ? menuPerformer. - ]. - ]. - - " - a temporary kludge: - pass myself as receiver, the menuPerformer as performer; - the menu will send its messages to either the - menuPerformer or me (its receiver). - This allows for the ST-80 behavior, where some messages - go to the model, others to the view - (copy/cut/paste). - " - (prevReceiver := menu receiver) isNil ifTrue:[ - "/ kludge for oldStyle menus (MenuView/PopUpMenu) - "/ not req'd for real Menus - "/ (menu isKindOf:Menu) ifFalse:[ - (menu respondsTo:#menuPerformer:) ifTrue:[ - menu receiver:self. "/ really ? - menu menuPerformer:menuPerformer. - ] ifFalse:[ - "/ ] ifTrue:[ - "/ new style menu - menu receiver:menuPerformer. - ] - ]. - - "/ - "/ startup the menu - this returns a selector - "/ - actionSelector := self startUpMenu:menu. - - "/ before doing anything else, redraw expose area from - "/ the menu (in case the action changes my state) - (wg := self windowGroup) notNil ifTrue:[ - wg processExposeEvents. - ]. - - (actionSelector notNil and:[actionSelector isSymbol]) ifTrue:[ - self dispatchMenuSelection:actionSelector to: menuPerformer. - ]. - - menu receiver:prevReceiver. - - ^ self - ]. + " + try ST-80 style menus first: + if there is a model, and a menuMessage is defined, + ask model for the menu and launch that if non-nil. + " + menu := self yellowButtonMenu. + menu notNil ifTrue:[ + " + got one, launch the menu. It is supposed + to return an actionSelector. + " + menuPerformer := self menuPerformer value. + + "/ could be a spec ... + menu isArray ifTrue:[ + menu := menu decodeAsLiteralArray. + menu receiver:menuPerformer. + menu findGuiResourcesIn:(self menuHolder). + ] ifFalse:[ + (menu respondsTo:#receiver) ifTrue:[ + menuPerformer := menu receiver ? menuPerformer. + ]. + ]. + + " + a temporary kludge: + pass myself as receiver, the menuPerformer as performer; + the menu will send its messages to either the + menuPerformer or me (its receiver). + This allows for the ST-80 behavior, where some messages + go to the model, others to the view + (copy/cut/paste). + " + (prevReceiver := menu receiver) isNil ifTrue:[ + "/ kludge for oldStyle menus (MenuView/PopUpMenu) + "/ not req'd for real Menus + "/ (menu isKindOf:Menu) ifFalse:[ + (menu respondsTo:#menuPerformer:) ifTrue:[ + menu receiver:self. "/ really ? + menu menuPerformer:menuPerformer. + ] ifFalse:[ + "/ ] ifTrue:[ + "/ new style menu + menu receiver:menuPerformer. + ] + ]. + + "/ + "/ startup the menu - this returns a selector + "/ + actionSelector := self startUpMenu:menu. + + "/ before doing anything else, redraw expose area from + "/ the menu (in case the action changes my state) + (wg := self windowGroup) notNil ifTrue:[ + wg processExposeEvents. + ]. + + (actionSelector notNil and:[actionSelector isSymbol]) ifTrue:[ + self dispatchMenuSelection:actionSelector to: menuPerformer. + ]. + + menu receiver:prevReceiver. + + ^ self + ]. ]. "/ @@ -8231,8 +8244,8 @@ mhmh - kludge for selectors with argument " (menuSelection isMemberOf:Array) ifTrue:[ - actionArg1 := menuSelection at:2. - actionSelector := menuSelection at:1. + actionArg1 := menuSelection at:2. + actionSelector := menuSelection at:1. ]. menuPerformer := aMenuPerformerOrNil ? self menuPerformer. @@ -8243,18 +8256,18 @@ Simulate this behavior, by looking what the model responds to. " actionSelector isSymbol ifTrue:[ - (menuPerformer respondsTo:actionSelector) ifFalse:[ - ((app := self application) respondsTo:actionSelector) ifTrue:[ - menuPerformer := app. - actionArg1 := self model. - actionArg2 := self controller. - ] ifFalse:[ - (self respondsTo:actionSelector) ifTrue:[ - menuPerformer := self - ] - ] - ]. - menuPerformer perform:actionSelector withOptionalArgument:actionArg1 and:actionArg2. + (menuPerformer respondsTo:actionSelector) ifFalse:[ + ((app := self application) respondsTo:actionSelector) ifTrue:[ + menuPerformer := app. + actionArg1 := self model. + actionArg2 := self controller. + ] ifFalse:[ + (self respondsTo:actionSelector) ifTrue:[ + menuPerformer := self + ] + ] + ]. + menuPerformer perform:actionSelector withOptionalArgument:actionArg1 and:actionArg2. ]. "Created: / 20.6.1997 / 11:47:42 / cg" @@ -8269,9 +8282,9 @@ aMenuOrMenuSpec isNil ifTrue:[^ nil]. aMenuOrMenuSpec isArray ifTrue:[ - spec := aMenuOrMenuSpec decodeAsLiteralArray. + spec := aMenuOrMenuSpec decodeAsLiteralArray. ] ifFalse:[ - spec := aMenuOrMenuSpec. + spec := aMenuOrMenuSpec. ]. "/ spec receiver:self. -- now done in findGuiResources ... spec findGuiResourcesIn:self. @@ -8296,25 +8309,25 @@ componentsContainingX:x y:y do:aBlock (x isNil or:[y isNil]) ifTrue:[ - "/ delegated - ^ self + "/ delegated + ^ self ]. components notNil ifTrue:[ - components reverseDo:[:aComponent | - |thisFrame| - - thisFrame := aComponent bounds. - (thisFrame containsPointX:x y:y) ifTrue:[ - "/ prepare for masked/non-rectangular components ... - (aComponent perform:#containsPointX:y: with:x with:y ifNotUnderstood:true) - ifTrue:[ - aBlock value:aComponent - value:x - thisFrame left - value:y - thisFrame top. - ] - ] - ] + components reverseDo:[:aComponent | + |thisFrame| + + thisFrame := aComponent bounds. + (thisFrame containsPointX:x y:y) ifTrue:[ + "/ prepare for masked/non-rectangular components ... + (aComponent perform:#containsPointX:y: with:x with:y ifNotUnderstood:true) + ifTrue:[ + aBlock value:aComponent + value:x - thisFrame left + value:y - thisFrame top. + ] + ] + ] ]. "Created: / 08-05-1996 / 23:40:59 / cg" @@ -8328,24 +8341,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" @@ -8366,10 +8379,10 @@ bw := self borderWidth ? 0. insets isNil ifTrue:[ - bw == 0 ifTrue:[ - ^ p - ]. - ^ (p x - bw) @ (p y - bw) + bw == 0 ifTrue:[ + ^ p + ]. + ^ (p x - bw) @ (p y - bw) ]. r := (insets at:3) + bw. b := (insets at:4) + bw. @@ -8382,7 +8395,7 @@ "/ b := bottomInset + bw "/ ]. ((r ~~ 0) or:[b ~~ 0]) ifTrue:[ - ^ (p x - r) @ (p y - b) + ^ (p x - r) @ (p y - b) ]. ^ p @@ -8404,17 +8417,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 @@ -8426,9 +8439,9 @@ "set the exeplicit extent flag to aBoolean." aBoolean ifTrue:[ - flagBits := flagBits bitOr:FlagHasExplicitExtent + flagBits := flagBits bitOr:FlagHasExplicitExtent ] ifFalse:[ - flagBits := flagBits bitClear:FlagHasExplicitExtent + flagBits := flagBits bitClear:FlagHasExplicitExtent ]. ! @@ -8446,50 +8459,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 ! @@ -8508,7 +8521,7 @@ p := self pointFromRelative:aPoint. insets isNil ifTrue:[ - ^ p + ^ p ]. l := insets at:1. t := insets at:2. @@ -8521,7 +8534,7 @@ "/ t := topInset "/ ]. ((l ~~ 0) or:[t ~~ 0]) ifTrue:[ - ^ (p x + l) @ (p y + t) + ^ (p x + l) @ (p y + t) ]. ^ p ! @@ -8560,25 +8573,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" @@ -8615,16 +8628,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. @@ -8632,142 +8645,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 clippingRectangle:nil. - oldPaint := self paint. - self paint:viewBackground. - self fillDeviceRectangleX:(width - margin) - y:0 - width:margin - height:height. - mustRepaintRight := true. - ]. - newHeight > height ifTrue:[ - self clippingRectangle: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 clippingRectangle:nil. + oldPaint := self paint. + self paint:viewBackground. + self fillDeviceRectangleX:(width - margin) + y:0 + width:margin + height:height. + mustRepaintRight := true. + ]. + newHeight > height ifTrue:[ + self clippingRectangle: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 deviceClippingRectangle:nil. - oldPaint := self 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: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 deviceClippingRectangle:nil. + oldPaint := self 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:[ - dependents notNil ifTrue:[ self changed:#origin ]. + dependents notNil ifTrue:[ self changed:#origin ]. ]. "Modified: / 25.5.1999 / 14:49:56 / cg" @@ -8781,39 +8794,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 @@ -8861,17 +8874,17 @@ |form| (form := viewShape borderShapeForm) notNil ifTrue:[ - gc windowBorderShape:form. + gc windowBorderShape:form. ]. (form := viewShape viewShapeForm) notNil ifTrue:[ - gc windowShape:form. + gc windowShape:form. ]. "Created: 18.9.1997 / 11:09:00 / cg" ! windowGroupClass - ^ WindowGroup + ^ WindowGroup ! ! !SimpleView methodsFor:'queries'! @@ -8895,16 +8908,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 @@ -8937,11 +8950,11 @@ savedPref := preferredExtent. savedExplicit := explicitExtent. [ - preferredExtent := explicitExtent := nil. - computedPref := self preferredExtent. + preferredExtent := explicitExtent := nil. + computedPref := self preferredExtent. ] ensure:[ - preferredExtent := savedPref. - explicitExtent := savedExplicit. + preferredExtent := savedPref. + explicitExtent := savedExplicit. ]. ^ computedPref ! @@ -8954,9 +8967,9 @@ cornerChangedFlag:aBoolean "/ cornerChangedFlag := aBoolean aBoolean ifTrue:[ - flagBits := flagBits bitOr:FlagCornerChanged + flagBits := flagBits bitOr:FlagCornerChanged ] ifFalse:[ - flagBits := flagBits bitClear:FlagCornerChanged + flagBits := flagBits bitClear:FlagCornerChanged ]. ! @@ -8979,9 +8992,9 @@ extentChangedBeforeCreatedFlag:aBoolean aBoolean ifTrue:[ - flagBits := flagBits bitOr:FlagExtentChangedBeforeCreated + flagBits := flagBits bitOr:FlagExtentChangedBeforeCreated ] ifFalse:[ - flagBits := flagBits bitClear:FlagExtentChangedBeforeCreated + flagBits := flagBits bitClear:FlagExtentChangedBeforeCreated ]. ! @@ -8993,9 +9006,9 @@ extentChangedFlag:aBoolean "/ extentChangedFlag := aBoolean aBoolean ifTrue:[ - flagBits := flagBits bitOr:FlagExtentChanged + flagBits := flagBits bitOr:FlagExtentChanged ] ifFalse:[ - flagBits := flagBits bitClear:FlagExtentChanged + flagBits := flagBits bitClear:FlagExtentChanged ]. ! @@ -9026,11 +9039,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 @@ -9067,7 +9080,7 @@ sview := self. [ (sview := sview container) notNil ] whileTrue:[ - sview == aViewOrComponent ifTrue:[^ true]. + sview == aViewOrComponent ifTrue:[^ true]. ]. ^ false ! @@ -9210,9 +9223,9 @@ originChangedFlag:aBoolean "/ originChangedFlag := aBoolean aBoolean ifTrue:[ - flagBits := flagBits bitOr:FlagOriginChanged + flagBits := flagBits bitOr:FlagOriginChanged ] ifFalse:[ - flagBits := flagBits bitClear:FlagOriginChanged + flagBits := flagBits bitClear:FlagOriginChanged ]. ! @@ -9222,10 +9235,10 @@ newBits := flagBits bitClear:(FlagOriginChanged bitOr: FlagExtentChanged). originChanged ifTrue:[ - newBits := newBits bitOr:FlagOriginChanged + newBits := newBits bitOr:FlagOriginChanged ]. extentChanged ifTrue:[ - newBits := newBits bitOr:FlagExtentChanged + newBits := newBits bitOr:FlagExtentChanged ]. flagBits := newBits. @@ -9237,13 +9250,13 @@ newBits := flagBits bitClear:((FlagOriginChanged bitOr: FlagExtentChanged) bitOr: 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. @@ -9277,48 +9290,48 @@ "/ If I have an explicit preferredExtent.. explicitExtent notNil ifTrue:[ - ^ explicitExtent + ^ explicitExtent ]. "/ If I have a cached preferredExtent value.. preferredExtent notNil ifTrue:[ - ^ preferredExtent + ^ preferredExtent ]. "/ mhmh - if I have subViews, collect their "/ preferred bounds ... subViews notNil ifTrue:[ - maxX := maxY := 0. - subViews do:[:aSubView | - |org corn| - - org := aSubView computeOrigin. - corn := org + aSubView preferredExtent. - maxX := maxX max:corn x. - maxY := maxY max:corn y. - ] + maxX := maxY := 0. + subViews do:[:aSubView | + |org corn| + + org := aSubView computeOrigin. + corn := org + aSubView preferredExtent. + maxX := maxX max:corn x. + maxY := maxY max:corn y. + ] ]. "/ mhmh - if I have components, collect their preferred bounds ... components notNil ifTrue:[ - maxX isNil ifTrue:[ - maxX := maxY := 0. - ]. - components do:[:aComponent | - |bounds org corn| - - bounds := aComponent preferredBounds. - corn := bounds corner. - maxX := maxX max:corn x. - maxY := maxY max:corn y. - ] + maxX isNil ifTrue:[ + maxX := maxY := 0. + ]. + components do:[:aComponent | + |bounds org corn| + + bounds := aComponent preferredBounds. + corn := bounds corner. + maxX := maxX max:corn x. + maxY := maxY max:corn y. + ] ]. "/ nothing found - return the actual size maxX isNil ifTrue:[ - ^ self extent. + ^ self extent. ]. ^ maxX @ maxY. @@ -9401,7 +9414,7 @@ Actually, its a historical leftover" windowGroup notNil ifTrue:[ - ^ windowGroup sensor hasButtonMotionEventFor:self + ^ windowGroup sensor hasButtonMotionEventFor:self ]. ^ super buttonMotionEventPending @@ -9419,7 +9432,7 @@ myClass := self class. (myClass == View or:[myClass == SimpleView]) ifTrue:[ - ^ ViewSpec "/ CompositeSpecCollection + ^ ViewSpec "/ CompositeSpecCollection ]. "/ try: appending 'Spec' to my classes name @@ -9427,8 +9440,8 @@ myName := self class name. cls := Smalltalk classNamed:(myName , 'Spec'). cls notNil ifTrue:[ - cls := cls autoload. - (cls isSubclassOf:UISpecification) ifTrue:[^ cls]. + cls := cls autoload. + (cls isSubclassOf:UISpecification) ifTrue:[^ cls]. ]. (myName endsWith:'View') ifTrue:[ @@ -9439,12 +9452,12 @@ "/ (cls isSubclassOf:UISpecification) ifTrue:[^ cls]. "/ ]. - "/ try with 'View' replaced by 'Spec' - cls := Smalltalk classNamed:((myName copyButLast:4) , 'View'). - cls notNil ifTrue:[ - cls := cls autoload. - (cls isSubclassOf:UISpecification) ifTrue:[^ cls]. - ] + "/ try with 'View' replaced by 'Spec' + cls := Smalltalk classNamed:((myName copyButLast:4) , 'View'). + cls notNil ifTrue:[ + cls := cls autoload. + (cls isSubclassOf:UISpecification) ifTrue:[^ cls]. + ] ]. "/ fall back for all others @@ -9462,10 +9475,10 @@ "return a symbol describing my style (one of: #dialog, #popUp or #normal)" self isPopUpView ifTrue:[ - ^ #popUp + ^ #popUp ]. self isMDIChildView ifTrue:[ - ^ #mdiChild + ^ #mdiChild ]. ^ #normal @@ -9499,11 +9512,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:[ @@ -9511,42 +9524,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" @@ -9557,7 +9570,7 @@ self drawableId isNil ifTrue:[self create]. subViews notNil ifTrue:[ - subViews do:[:subView | subView createWithAllSubViews] + subViews do:[:subView | subView createWithAllSubViews] ] ! @@ -9573,10 +9586,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" @@ -9595,25 +9608,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 ..." @@ -9625,20 +9638,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" @@ -9659,24 +9672,24 @@ realized ifFalse:[^ self]. (windowGroup notNil and:[windowGroup isModal]) ifTrue:[ - masterGroup := windowGroup previousGroup. - windowGroup focusView:nil. + masterGroup := windowGroup previousGroup. + windowGroup focusView:nil. ]. self unmap. self flush. masterGroup notNil ifTrue:[ - " - this is a kludge for IRIS and others which do not provide backingstore: - when we hide a modalbox (such as a searchbox) which covered - a scrollbar, the scrollbars bitblt-method will copy from the - not-yet redrawn area - effectively clearing the scroller. - We need a short delay here, since at this time, the expose event has - not yet arrived. - " - Delay waitForSeconds:0.05. - masterGroup processExposeEvents + " + this is a kludge for IRIS and others which do not provide backingstore: + when we hide a modalbox (such as a searchbox) which covered + a scrollbar, the scrollbars bitblt-method will copy from the + not-yet redrawn area - effectively clearing the scroller. + We need a short delay here, since at this time, the expose event has + not yet arrived. + " + Delay waitForSeconds:0.05. + masterGroup processExposeEvents ]. "/ WindowGroup leaveSignal raise. @@ -9696,7 +9709,7 @@ ignored here." self isPopUpView ifTrue:[ - self hide + self hide ]. ^ self ! @@ -9706,8 +9719,8 @@ For topViews, the windowManager will choose (or ask for) the views position on the screen. 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'" self mapAt:nil iconified:false @@ -9719,8 +9732,8 @@ For topViews, if aPoint is nonNil, the views origin is located there (unless you have a dictator as windowManager ;-) 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'" self mapAt:aPoint iconified:false @@ -9733,61 +9746,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" @@ -9849,28 +9862,28 @@ "/ ] "/ ]. (viewGravity notNil "and:[viewGravity ~~ #NorthWest]") ifTrue:[ - gc viewGravity:viewGravity. + gc viewGravity:viewGravity. ]. (bitGravity notNil "and:[bitGravity ~~ #NorthWest]") ifTrue:[ - isInputOnly ifFalse:[ - gc bitGravity:bitGravity. - ] + isInputOnly ifFalse:[ + gc bitGravity:bitGravity. + ] ]. viewShape notNil ifTrue:[ - self setViewShape + self setViewShape ]. (backed notNil and:[backed ~~ false]) ifTrue:[ - self backingStore:backed. + self backingStore:backed. ]. self saveUnder ifTrue:[ - self saveUnder:true. + self saveUnder:true. ]. cursor notNil ifTrue:[ - self setCursor + self setCursor ]. name notNil ifTrue:[ - self windowName:name. + self windowName:name. ]. "Modified: / 9.4.1998 / 20:18:12 / cg" @@ -9909,14 +9922,14 @@ "realize all my subviews - but not myself." subViews notNil ifTrue:[ - subViews do:[:subView | - subView realize - ] + subViews do:[:subView | + subView realize + ] ]. components notNil ifTrue:[ - components do:[:component | - component realize - ] + components do:[:component | + component realize + ] ]. "Modified: 5.9.1995 / 23:30:47 / claus" @@ -9959,11 +9972,11 @@ self fetchDeviceResources. self drawableId isNil ifTrue:[ - self create. - self drawableId isNil ifTrue:[ - ('SimpleView [warning]: could not create view: ' , self class name) errorPrintCR. - ^ self - ] + self create. + self drawableId isNil ifTrue:[ + ('SimpleView [warning]: could not create view: ' , self class name) errorPrintCR. + ^ self + ] ]. self isBeingDestroyed:false. "/ in case a view gets rerealized @@ -9972,85 +9985,85 @@ (windowGroup notNil and:[superView isNil and:[windowGroup isForModalSubview]]) ifTrue:[ - keep := true. + keep := true. ] ifFalse:[ - keep := keepGroupAsIs + keep := keepGroupAsIs ]. keep ifFalse:[ - " - put myself into superviews windowgroup if there is a superview - This is the default behavior, which may be suppressed by - passing true as keepGroupAsIs-argument. - (it may be useful to assign a separate windowGroup to - a childView to have it execute independent of the parent - -> an example is found in the fileBrowsers kill-button) - " - superView notNil ifTrue:[ - superGroup := superView windowGroup. - (windowGroup notNil and:[superGroup ~~ windowGroup]) ifTrue:[ - " - mhmh - seems that the windowgroup has changed .... - " + " + put myself into superviews windowgroup if there is a superview + This is the default behavior, which may be suppressed by + passing true as keepGroupAsIs-argument. + (it may be useful to assign a separate windowGroup to + a childView to have it execute independent of the parent + -> an example is found in the fileBrowsers kill-button) + " + superView notNil ifTrue:[ + superGroup := superView windowGroup. + (windowGroup notNil and:[superGroup ~~ windowGroup]) ifTrue:[ + " + mhmh - seems that the windowgroup has changed .... + " "/ 'oops - wgroup change on realize' printNL. - groupChange := true. - - "/ - "/ recursively change the windowGroup of - "/ myself and all of my children - "/ - self windowGroup:superGroup. - ] ifFalse:[ - windowGroup isNil ifTrue:[ - "/ - "/ only change the group of myself - - "/ subviews will fetch it when realized. - "/ - windowGroup := superGroup. - superGroup notNil ifTrue:[superGroup addView:self]. - ] - ]. - ]. + groupChange := true. + + "/ + "/ recursively change the windowGroup of + "/ myself and all of my children + "/ + self windowGroup:superGroup. + ] ifFalse:[ + windowGroup isNil ifTrue:[ + "/ + "/ only change the group of myself - + "/ subviews will fetch it when realized. + "/ + windowGroup := superGroup. + superGroup notNil ifTrue:[superGroup addView:self]. + ] + ]. + ]. ]. (self originOrExtentChanged) ifTrue:[ - self fixSize. - self sizeChanged:nil. + self fixSize. + self sizeChanged:nil. ]. position notNil ifTrue:[ - self origin:position. + self origin:position. ]. (subViews notNil or:[components notNil]) ifTrue:[ - (realized not or:[groupChange]) ifTrue:[ - self isHiddenOnRealize ifFalse:[ - self realizeAllSubViews. - ]. - ]. + (realized not or:[groupChange]) ifTrue:[ + self isHiddenOnRealize ifFalse:[ + self realizeAllSubViews. + ]. + ]. ]. self preRealize. iconified ifTrue:[ - realized ifFalse:[ - self mapIconified - ] + realized ifFalse:[ + self mapIconified + ] ] ifFalse:[ - (self isHiddenOnRealize not - and:[visibilityChannel isNil or:[visibilityChannel value]]) ifTrue:[ - self setInnerClip. - - realized ifFalse:[ - " - now, make the view visible - " - self mapAt:position - ] - ] + (self isHiddenOnRealize not + and:[visibilityChannel isNil or:[visibilityChannel value]]) ifTrue:[ + self setInnerClip. + + realized ifFalse:[ + " + now, make the view visible + " + self mapAt:position + ] + ] ]. controller notNil ifTrue:[ - controller startUp + controller startUp ]. self postRealize @@ -10064,22 +10077,22 @@ "recreate (i.e. tell X about me) after a snapin or a migration" 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 ] ! @@ -10087,16 +10100,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. + ] ]. ! @@ -10107,14 +10120,14 @@ are known to ignore this ..." realized 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) + " + 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" @@ -10137,14 +10150,14 @@ self drawableId isNil ifTrue:[self create]. self drawableId notNil ifTrue:[ - aWindowGroup ~~ windowGroup ifTrue:[ - windowGroup notNil ifTrue:[ - windowGroup removeView:self - ]. - windowGroup := aWindowGroup. - aWindowGroup addTopView:self. - ]. - self remap. + aWindowGroup ~~ windowGroup ifTrue:[ + windowGroup notNil ifTrue:[ + windowGroup removeView:self + ]. + windowGroup := aWindowGroup. + aWindowGroup addTopView:self. + ]. + self remap. ] "Modified: 3.5.1996 / 23:59:30 / stefan" @@ -10155,17 +10168,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" @@ -10177,10 +10190,10 @@ preferredExtent), but may be redefined in some subclasses." self hasExplicitExtent ifFalse:[ - layout isNil ifTrue:[ - self extent:(self preferredExtent). - self explicitExtent:false. - ]. + layout isNil ifTrue:[ + self extent:(self preferredExtent). + self explicitExtent:false. + ]. ] "Modified: 15.7.1996 / 11:20:27 / cg" @@ -10197,24 +10210,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 ]. + ] ]. " @@ -10224,9 +10237,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. @@ -10266,11 +10279,11 @@ drawFocusFrame self hasFocus ifTrue:[ - (styleSheet at:#focusHighlightStyle) == #win95 ifTrue:[ - self windowGroup focusCameByTab ifTrue:[ - self drawWin95FocusFrame - ] - ]. + (styleSheet at:#focusHighlightStyle) == #win95 ifTrue:[ + self windowGroup focusCameByTab ifTrue:[ + self drawWin95FocusFrame + ] + ]. ] ! @@ -10325,16 +10338,16 @@ self fill:flashColor. messageOrNil notNil ifTrue:[ - self withForeground:Color white do:[ - self displayString:messageOrNil centeredAt:(self center). - ]. + self withForeground:Color white do:[ + self displayString:messageOrNil centeredAt:(self center). + ]. ]. Delay waitForSeconds:0.1. self fill:self whiteColor. messageOrNil notNil ifTrue:[ - self withForeground:Color black do:[ - self displayString:messageOrNil centeredAt:(self center). - ]. + self withForeground:Color black do:[ + self displayString:messageOrNil centeredAt:(self center). + ]. ]. Delay waitForSeconds:0.1. self fill:viewBackground. @@ -10368,13 +10381,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" ! @@ -10389,9 +10402,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 @@ -10407,15 +10420,15 @@ |r currentTransformation| 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 ]. r := aRectangle. currentTransformation := gc transformation. currentTransformation notNil ifTrue:[ - r := (currentTransformation transformPoint:r origin) corner:(currentTransformation transformPoint:r corner). + r := (currentTransformation transformPoint:r origin) corner:(currentTransformation transformPoint:r corner). ]. self invalidateDeviceRectangle:r repairNow:doRepairNow @@ -10430,17 +10443,17 @@ The given rectangle is in device coordinate space." 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 ]. (aRectangle width <= 0 or:[aRectangle height <= 0]) ifTrue:[ - "/ no need to add damages with extent <= 0 - ^ self + "/ no need to add damages with extent <= 0 + ^ self ]. self sensor addDamage:aRectangle view:self. doRepairNow ifTrue:[ - self repairDamage + self repairDamage ] "Modified: / 10.11.1998 / 01:55:03 / cg" @@ -10453,13 +10466,13 @@ damaged areas right now." 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:doRepair + invalidateDeviceRectangle:(Rectangle left:0 top:0 width:width height:height) + repairNow:doRepair "Created: 19.4.1997 / 11:58:04 / cg" "Modified: 19.4.1997 / 12:00:00 / cg" @@ -10469,9 +10482,9 @@ "add a damage to redraw all of the receiver, to its input event queue." 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:(Rectangle left:x top:y width:w height:h) ! @@ -10482,9 +10495,9 @@ damaged areas right now." 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:(Rectangle left:x top:y width:w height:h) repairNow:doRepair ! @@ -10502,24 +10515,24 @@ "redraw a part of the view immediately." self - redrawX:(aRectangle left) - y:(aRectangle top) - width:(aRectangle width) - height:(aRectangle height) + redrawX:(aRectangle left) + y:(aRectangle top) + width:(aRectangle width) + height:(aRectangle height) "Modified: 19.4.1997 / 11:54:23 / cg" ! redrawComponentsIn:aRectangle components notNil ifTrue:[ - components do:[:aComponent | - |thisFrame is| - - thisFrame := aComponent bounds. - (thisFrame notNil and:[thisFrame intersects:aRectangle]) ifTrue:[ - aComponent displayOn:self - ] - ] + components do:[:aComponent | + |thisFrame is| + + thisFrame := aComponent bounds. + (thisFrame notNil and:[thisFrame intersects:aRectangle]) ifTrue:[ + aComponent displayOn:self + ] + ] ]. ! @@ -10533,15 +10546,15 @@ currentTransformation := gc transformation. currentTransformation isNil ifTrue:[ - lx := x. - ly := y. - lw := w. - lh := h. + lx := x. + ly := y. + lw := w. + lh := h. ] ifFalse:[ - lx := currentTransformation applyInverseToX:x. - ly := currentTransformation applyInverseToY:y. - lw := currentTransformation applyInverseScaleX:w. - lh := currentTransformation applyInverseScaleY:h. + lx := currentTransformation applyInverseToX:x. + ly := currentTransformation applyInverseToY:y. + lw := currentTransformation applyInverseScaleX:w. + lh := currentTransformation applyInverseScaleY:h. ]. self redrawX:lx y:ly width:lw height:lh ! @@ -10561,12 +10574,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. @@ -10596,10 +10609,10 @@ |wg| shown ifTrue:[ - (wg := self windowGroup) notNil ifTrue:[ - "/ wg processRealExposeEventsFor:self. "/ this ignores map/unmap - wg processExposeEventsFor:self. "/ this handles map/unmap - ] + (wg := self windowGroup) notNil ifTrue:[ + "/ wg processRealExposeEventsFor:self. "/ this ignores map/unmap + wg processExposeEventsFor:self. "/ this handles map/unmap + ] ] "Created: / 19.4.1997 / 12:01:13 / cg" @@ -10700,10 +10713,10 @@ wCont := self widthOfContents. currentTransformation := gc transformation. currentTransformation notNil ifTrue:[ - wCont := currentTransformation applyScaleX:wCont. + wCont := currentTransformation applyScaleX:wCont. ]. self scrollHorizontalTo: - ((((wCont * percent) / 100.0) + 0.5) asInteger) + ((((wCont * percent) / 100.0) + 0.5) asInteger) ! scrollLeft @@ -10719,8 +10732,8 @@ |viewOrigin| nPixels ~~ 0 ifTrue:[ - viewOrigin := self viewOrigin. - self scrollTo:((viewOrigin x - nPixels) @ viewOrigin y). + viewOrigin := self viewOrigin. + self scrollTo:((viewOrigin x - nPixels) @ viewOrigin y). ] "Modified: / 20.8.1996 / 17:35:09 / stefan" @@ -10733,8 +10746,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" @@ -10754,8 +10767,8 @@ |viewOrigin| nPixels ~~ 0 ifTrue:[ - viewOrigin := self viewOrigin. - self scrollTo:((viewOrigin x + nPixels) @ viewOrigin y) + viewOrigin := self viewOrigin. + self scrollTo:((viewOrigin x + nPixels) @ viewOrigin y) ] "Modified: / 20.8.1996 / 17:35:37 / stefan" @@ -10787,12 +10800,12 @@ currentTransformation := gc transformation. currentTransformation notNil ifTrue:[ - wCont := currentTransformation applyScaleX:wCont. - hCont := currentTransformation applyScaleY:hCont. + wCont := currentTransformation applyScaleX:wCont. + hCont := currentTransformation applyScaleY:hCont. ]. self scrollTo: - ((((wCont * percent x) / 100.0) + 0.5) asInteger) @ - ((((hCont * percent y) / 100.0) + 0.5) asInteger) + ((((wCont * percent x) / 100.0) + 0.5) asInteger) @ + ((((hCont * percent y) / 100.0) + 0.5) asInteger) "Created: 5.8.1996 / 12:15:53 / stefan" "Modified: 5.8.1996 / 12:42:57 / stefan" @@ -10806,7 +10819,7 @@ wCont := self widthOfContents. currentTransformation := gc transformation. currentTransformation notNil ifTrue:[ - wCont := currentTransformation applyScaleX:wCont. + wCont := currentTransformation applyScaleX:wCont. ]. self scrollHorizontalTo:((wCont - self innerWidth) max:0) ! @@ -10857,10 +10870,10 @@ hCont := self heightOfContents. currentTransformation := gc transformation. currentTransformation notNil ifTrue:[ - hCont := currentTransformation applyScaleY:hCont. + hCont := currentTransformation applyScaleY:hCont. ]. self scrollVerticalTo: - ((((hCont * percent) / 100.0) + 0.5) asInteger) + ((((hCont * percent) / 100.0) + 0.5) asInteger) ! verticalScrollStep @@ -10900,9 +10913,9 @@ point." ^ self - scrollTo:newOrigin - redraw:doRedraw - allowScrollBeyondContents:false + scrollTo:newOrigin + redraw:doRedraw + allowScrollBeyondContents:false ! scrollTo:newOrigin redraw:doRedraw allowScrollBeyondContents:allowScrollBeyondContents @@ -10922,12 +10935,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. @@ -10939,20 +10952,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. @@ -10963,79 +10976,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). @@ -11099,17 +11112,17 @@ "does not work: - |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: - |v| - - v := View new openAndWait. - v displayLineFrom:0@0 to:50@50 + |v| + + v := View new openAndWait. + v displayLineFrom:0@0 to:50@50 " ! @@ -11146,10 +11159,10 @@ The view will be handled by its own process, effectively running in parallel. Notice: - This entry is for NON-topviews, which want to be served - autonomous from their real topview. - (see the fileBrowsers kill-button - when executing unix commands as an example)" + This entry is for NON-topviews, which want to be served + autonomous from their real topview. + (see the fileBrowsers kill-button + when executing unix commands as an example)" |wg mainGroup| @@ -11158,7 +11171,7 @@ mainGroup := WindowGroup activeGroup. mainGroup notNil ifTrue:[ - mainGroup := mainGroup mainGroup. + mainGroup := mainGroup mainGroup. ]. wg isForModalSubview:true. "/ make it handle update events for the main group @@ -11194,14 +11207,14 @@ " the same: - YesNoBox new open - - YesNoBox new openModal + YesNoBox new open + + YesNoBox new openModal different: - (Button label:'hello') open - - (Button label:'hello') openModal + (Button label:'hello') open + + (Button label:'hello') openModal " ! @@ -11249,8 +11262,8 @@ isPopup := self isPopUpView. aWindowGroup notNil ifTrue:[ - mainGroup := aWindowGroup mainGroup. - mainView := mainGroup mainView. + mainGroup := aWindowGroup mainGroup. + mainView := mainGroup mainView. ]. "/ set the windowgroup BEFORE sending the aboutToOpen notification @@ -11258,154 +11271,154 @@ "/ this allows for the handler to enqueue an event, "/ or to add event hooks. 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]. + " + 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]. ] ifFalse:[ - previousGroup := WindowGroup activeGroup. + previousGroup := WindowGroup activeGroup. ]. windowGroup isNil ifTrue:[ - "/ create a new window group put myself into it - windowGroup := self windowGroupClass new. - windowGroup - addTopView:self; - 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. - ]. + "/ create a new window group put myself into it + windowGroup := self windowGroupClass new. + windowGroup + addTopView:self; + 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. + ]. ]. makeTransient := true. isPopup 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 - ]. - windowGroup isNil ifTrue:[ - "/ the aboutToOpenBoxNotificationSignal handler destroyed me (although it should proceed with #abort)!! - "/ Transcript showCR:(self class name,': box opening suppressed by aboutToOpenBoxNotificationSignal handler'). - ^ self. - ]. - - "/ the following allows for hooks to add a bell sound or other whenever a dialog opens - device modalWindowListenersDo:[:listener | listener aboutToOpenWindow:self]. - - "/ 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 - ]]) ifFalse:[ - self tracePoint:#cg message:'activate'. - self debuggingCodeFor:#cg is:[ Transcript showCR:mainView; showCR:mainView windowGroup. ]. - mainView activate; setForegroundWindow. - ] ifTrue:[ - makeTransient := false. - ] - ]. + "/ 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 + ]. + windowGroup isNil ifTrue:[ + "/ the aboutToOpenBoxNotificationSignal handler destroyed me (although it should proceed with #abort)!! + "/ Transcript showCR:(self class name,': box opening suppressed by aboutToOpenBoxNotificationSignal handler'). + ^ self. + ]. + + "/ the following allows for hooks to add a bell sound or other whenever a dialog opens + device modalWindowListenersDo:[:listener | listener aboutToOpenWindow:self]. + + "/ 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 + ]]) ifFalse:[ + self tracePoint:#cg message:'activate'. + self debuggingCodeFor:#cg is:[ Transcript showCR:mainView; showCR:mainView windowGroup. ]. + mainView activate; setForegroundWindow. + ] ifTrue:[ + makeTransient := false. + ] + ]. ]. makeTransient ifTrue:[ - mainView 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. - ] + mainView 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. + ] ]. self raise. Processor activeProcessIsSystemProcess ifTrue:[ - self realize + self realize ] ifFalse:[ - " - show a stop-cursor in the suspended window groups - " - (mainGroup notNil and:[isPopup not]) ifTrue:[ - mainGroup showCursor:(Cursor stop). - previousGroup ~~ mainGroup ifTrue:[ - previousGroup showCursor:(Cursor stop). - ]. - cursorChanged := true. - ]. - - " - go dispatch events in this new group - (thus current windowgroup is blocked from interaction) - " - AbortOperationRequest handle:[:ex | - "/ the dialog/popup is aborted - hide it. Care for another abort during the hide. - AbortOperationRequest handle:[:ex2 | - "/ an aborted hide (possibly due to a cancelled user confirmation or similar) - self breakPoint:#cg. - ex exit. - ] do:[ - self hide. - realized ifTrue:[ - "/ self halt. "/ hide handled and closeRequest not wanted: - ex exit. - ]. - ]. - ] 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 waitForMilliseconds:50. - aWindowGroup processExposeEvents. - - (self isPopUpView or:[ReturnFocusWhenClosingModalBoxes]) ifTrue:[ - " - return the input focus to the previously active group's top. - This helps with window managers which need an explicit click - on the view for the focus. - 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. - (tops notEmptyOrNil) ifTrue:[ - tops first getKeyboardFocus - ]. - ]. - ]. - - " - restore cursors in the changed groups - " - cursorChanged notNil ifTrue:[ - mainGroup restoreCursors. - previousGroup ~~ mainGroup ifTrue:[ - previousGroup restoreCursors. - ]. - ]. - ]. - Dialog boxClosedNotificationSignal raiseRequestWith:self. - ] - ]. + " + show a stop-cursor in the suspended window groups + " + (mainGroup notNil and:[isPopup not]) ifTrue:[ + mainGroup showCursor:(Cursor stop). + previousGroup ~~ mainGroup ifTrue:[ + previousGroup showCursor:(Cursor stop). + ]. + cursorChanged := true. + ]. + + " + go dispatch events in this new group + (thus current windowgroup is blocked from interaction) + " + AbortOperationRequest handle:[:ex | + "/ the dialog/popup is aborted - hide it. Care for another abort during the hide. + AbortOperationRequest handle:[:ex2 | + "/ an aborted hide (possibly due to a cancelled user confirmation or similar) + self breakPoint:#cg. + ex exit. + ] do:[ + self hide. + realized ifTrue:[ + "/ self halt. "/ hide handled and closeRequest not wanted: + ex exit. + ]. + ]. + ] 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 waitForMilliseconds:50. + aWindowGroup processExposeEvents. + + (self isPopUpView or:[ReturnFocusWhenClosingModalBoxes]) ifTrue:[ + " + return the input focus to the previously active group's top. + This helps with window managers which need an explicit click + on the view for the focus. + 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. + (tops notEmptyOrNil) ifTrue:[ + tops first getKeyboardFocus + ]. + ]. + ]. + + " + restore cursors in the changed groups + " + cursorChanged notNil ifTrue:[ + mainGroup restoreCursors. + previousGroup ~~ mainGroup ifTrue:[ + previousGroup restoreCursors. + ]. + ]. + ]. + Dialog boxClosedNotificationSignal raiseRequestWith:self. + ] + ]. ] "Created: / 10-12-1995 / 14:06:14 / cg" @@ -11466,25 +11479,25 @@ " the same: - (Button label:'hello') open - - (Button label:'hello') openModeless + (Button label:'hello') open + + (Button label:'hello') openModeless different: - YesNoBox new open - - YesNoBox new openModeless + YesNoBox new open + + YesNoBox new openModeless " " (almost) the same: - YesNoBox new open - - YesNoBox new openModal + YesNoBox new open + + YesNoBox new openModal different: - (Button label:'hello') open - - (Button label:'hello') openModal + (Button label:'hello') open + + (Button label:'hello') openModal " "Modified: 24.7.1997 / 13:17:49 / cg" @@ -11520,10 +11533,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. @@ -11532,13 +11545,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. ]. " @@ -11591,45 +11604,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" @@ -11705,71 +11718,71 @@ be customized by additional widgets. i.e. its typical use is like: - |doNotShowHolder| - - doNotShowHolder := false asValue. - Dialog aboutToOpenBoxNotificationSignal handle:[:ex | - |box| - - box := ex box. - box verticalPanel - add:(CheckBox label:('Do not show this information in the future.') - model:doNotShowHolder). - ] do:[ - Dialog information:'This is a standard information box.\(but has an additional check toggle in it)' withCRs. - ]. + |doNotShowHolder| + + doNotShowHolder := false asValue. + Dialog aboutToOpenBoxNotificationSignal handle:[:ex | + |box| + + box := ex box. + box verticalPanel + add:(CheckBox label:('Do not show this information in the future.') + model:doNotShowHolder). + ] do:[ + Dialog information:'This is a standard information box.\(but has an additional check toggle in it)' withCRs. + ]. Another application is to suppress dialogs, by returning #abort from the query (of course, in real life, the Dialog call is deeply nested below the handler and done elsewhere): - Dialog aboutToOpenBoxNotificationSignal - answer:#abort - do:[ - Dialog information:'This box is not shown.' - ]. + Dialog aboutToOpenBoxNotificationSignal + answer:#abort + do:[ + Dialog information:'This box is not shown.' + ]. or to automatically answer all dialogs by simulating user entering a return: - Dialog aboutToOpenBoxNotificationSignal - handle:[:ex | - ex box windowGroup sensor - pushEvent: - (WindowEvent - keyPress:#Return - rawKey:#Return - hasShift:false ctrl:false alt:false meta:false - button1:false button2:false button3:false - x:1 y:1 view:ex box). - ] do:[ - Transcript showCR:(Dialog confirm:'Please confirm.') - ]. + Dialog aboutToOpenBoxNotificationSignal + handle:[:ex | + ex box windowGroup sensor + pushEvent: + (WindowEvent + keyPress:#Return + rawKey:#Return + hasShift:false ctrl:false alt:false meta:false + button1:false button2:false button3:false + x:1 y:1 view:ex box). + ] do:[ + Transcript showCR:(Dialog confirm:'Please confirm.') + ]. or an escape: - Dialog aboutToOpenBoxNotificationSignal - handle:[:ex | - ex box windowGroup sensor - pushEvent: - (WindowEvent - keyPress:#Escape - rawKey:#Escape - hasShift:false ctrl:false alt:false meta:false - button1:false button2:false button3:false - x:1 y:1 view:ex box). - ] do:[ - Transcript showCR:(Dialog confirm:'Please confirm.') - ]. + Dialog aboutToOpenBoxNotificationSignal + handle:[:ex | + ex box windowGroup sensor + pushEvent: + (WindowEvent + keyPress:#Escape + rawKey:#Escape + hasShift:false ctrl:false alt:false meta:false + button1:false button2:false button3:false + x:1 y:1 view:ex box). + ] do:[ + Transcript showCR:(Dialog confirm:'Please confirm.') + ]. Finally, a recorder may want to keep track of which dialogs have been opened: (of course, again, the Dialog calls are deeply nested below the handler and done elsewhere): - Dialog aboutToOpenBoxNotificationSignal handle:[:ex | - Transcript showCR:ex box topView label - ] do:[ - Dialog information:'box #1.'. - Dialog information:'box #2.'. - Dialog confirm:'bla'. - ]. + Dialog aboutToOpenBoxNotificationSignal handle:[:ex | + Transcript showCR:ex box topView label + ] do:[ + Dialog information:'box #1.'. + Dialog information:'box #2.'. + Dialog confirm:'bla'. + ]. " ! ! @@ -11807,25 +11820,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.'. + ]. + ]. " ! !