'From Squeak3.5 of ''11 April 2003'' [latest update: #5180] on 15 December 2003 at 5:19:46 pm'! "Change Set: SystemWindowAndBabel-dgd Date: 15 December 2003 Author: Diego Gomez Deck Some missing #translated sends in SystemWindow"! !SystemWindow methodsFor: 'initialization' stamp: 'dgd 12/15/2003 10:33'! createCloseBox ^ self createBox labelGraphic: self class closeBoxImage; extent: self boxExtent; actionSelector: #closeBoxHit; setBalloonText: 'close this window' translated! ! !SystemWindow methodsFor: 'initialization' stamp: 'dgd 12/15/2003 10:34'! createExpandBox ^ self createBox labelGraphic: (ScriptingSystem formAtKey: 'expandBox'); extent: self boxExtent; actWhen: #buttonUp; actionSelector: #expandBoxHit; setBalloonText: 'expand to full screen' translated! ! !SystemWindow methodsFor: 'initialization' stamp: 'dgd 12/15/2003 10:34'! createMenuBox ^ self createBox labelGraphic: (ScriptingSystem formAtKey: 'TinyMenu'); extent: self boxExtent; actWhen: #buttonDown; actionSelector: #offerWindowMenu; setBalloonText: 'window menu' translated! ! !SystemWindow methodsFor: 'initialization' stamp: 'dgd 12/15/2003 10:37'! initialize "Initialize a system window. Add label, stripes, etc., if desired" super initialize. allowReframeHandles := true. labelString ifNil: [labelString := 'Untitled Window' translated]. isCollapsed := false. activeOnlyOnTop := true. paneMorphs := Array new. Preferences alternativeWindowLook ifTrue: ["" borderColor := #raised. borderWidth := 2. color := Color white] ifFalse: ["" borderColor := Color black. borderWidth := 1. color := Color black]. self layoutPolicy: ProportionalLayout new. self wantsLabel ifTrue: [""label := StringMorph new contents: labelString; font: Preferences windowTitleFont emphasis: 1. "Add collapse box so #labelHeight will work" collapseBox := self createCollapseBox. stripes := Array with: (RectangleMorph newBounds: bounds) with: (RectangleMorph newBounds: bounds). "see extent:" self addLabelArea. labelArea addMorph: (stripes first borderWidth: 1). labelArea addMorph: (stripes second borderWidth: 2). self setLabelWidgetAllowance. self addCloseBox. self addMenuControl. labelArea addMorph: label. self wantsExpandBox ifTrue: [self addExpandBox]. labelArea addMorph: collapseBox. self setFramesForLabelArea. Preferences clickOnLabelToEdit ifTrue: [label on: #mouseDown send: #relabel to: self]. Preferences noviceMode ifTrue: [closeBox ifNotNil: [closeBox setBalloonText: 'close window' translated]. menuBox ifNotNil: [menuBox setBalloonText: 'window menu' translated]. collapseBox ifNotNil: [collapseBox setBalloonText: 'collapse/expand window' translated]]]. self on: #mouseEnter send: #spawnReframeHandle: to: self. self on: #mouseLeave send: #spawnReframeHandle: to: self. self extent: 300 @ 200. mustNotClose := false. updatablePanes := Array new! ! !SystemWindow methodsFor: 'resize/collapse' stamp: 'dgd 12/15/2003 10:36'! collapseOrExpand "Collapse or expand the window, depending on existing state" | cf | isCollapsed ifTrue: ["Expand -- restore panes to morphics structure" isCollapsed _ false. self activate. "Bring to frint first" Preferences collapseWindowsInPlace ifTrue: [fullFrame := fullFrame align: fullFrame topLeft with: self getBoundsWithFlex topLeft] ifFalse: [collapsedFrame _ self getBoundsWithFlex]. collapseBox ifNotNil: [collapseBox setBalloonText: 'collapse this window' translated]. self setBoundsWithFlex: fullFrame. paneMorphs reverseDo: [:m | self addMorph: m unlock. self world startSteppingSubmorphsOf: m]] ifFalse: ["Collapse -- remove panes from morphics structure" isCollapsed _ true. fullFrame _ self getBoundsWithFlex. "First save latest fullFrame" paneMorphs do: [:m | m delete; releaseCachedState]. model modelSleep. cf := self getCollapsedFrame. (collapsedFrame isNil and: [Preferences collapseWindowsInPlace not]) ifTrue: [collapsedFrame _ cf]. self setBoundsWithFlex: cf. collapseBox ifNotNil: [collapseBox setBalloonText: 'expand this window' translated]. expandBox ifNotNil: [expandBox setBalloonText: 'expand to full screen' translated]]. self layoutChanged! ! !SystemWindow methodsFor: 'resize/collapse' stamp: 'dgd 12/15/2003 10:34'! expandBoxHit "The full screen expand box has been hit" isCollapsed ifTrue: [self hide. self collapseOrExpand. self unexpandedFrame ifNil: [ self unexpandedFrame: fullFrame. ]. self fullScreen. expandBox setBalloonText: 'contract to original size' translated. ^ self show]. self unexpandedFrame ifNil: [self unexpandedFrame: fullFrame. self fullScreen. expandBox setBalloonText: 'contract to original size' translated] ifNotNil: [self bounds: self unexpandedFrame. self unexpandedFrame: nil. expandBox setBalloonText: 'expand to full screen' translated]! !