'From etoys3.0 of 21 February 2008 [latest update: #1926] on 20 March 2008 at 1:39:54 am'! "Change Set: helpFlapScroll-sw Date: 20 March 2008 Author: Scott Wallace TRAC 6726 - fixes the bug that the scroll-panes associated with the help-flaps for tools such as the Event Theatre were ill-sized, and in particular if the content required scrolling to be fully seen, the tail-end would be not visible, and the down-pointing scroll-arrow at the bottom of the scrollbar would be off-screen. Solution involves taking Sugar nav-bar into account when re-figuring pane-size."! AlignmentMorph subclass: #HelpFlap instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OLPC'! !Morph methodsFor: 'geometry' stamp: 'sw 3/19/2008 21:51'! spanContainerVertically: aNumber " Set the receiver understood to comprise the referent of a vertically oriented flap, such that its position (top-left corner) and width will remain the same." self height: aNumber! ! !FlapTab methodsFor: 'positioning' stamp: 'sw 3/19/2008 23:50'! spanWorld "Make the receiver's height or width commensurate with that of the container." | container | container _ self pasteUpMorph ifNil: [self currentWorld]. (self orientation == #vertical) ifTrue: [ referent vResizing == #rigid ifTrue:[referent spanContainerVertically: container height]. referent hResizing == #rigid ifTrue:[referent width: (referent width min: container width - self width)]. referent top: container top + self referentMargin y. ] ifFalse: [ referent hResizing == #rigid ifTrue:[referent width: container width]. referent vResizing == #rigid ifTrue:[referent height: (referent height min: container height - self height)]. referent left: container left + self referentMargin x. ] ! ! !HelpFlap methodsFor: 'geometry' stamp: 'sw 3/19/2008 23:49'! spanContainerVertically: aSize "Span the receiver's container verticallly, perhaps taking sugar nav bar into account." Preferences sugarNavigator ifFalse: [^ super spanContainerVertically: aSize]. self height: (aSize - SugarNavigatorBar someInstance height)! ! !StandardScriptingSystem methodsFor: 'help in a flap' stamp: 'sw 3/19/2008 21:54'! openInfoFlapWithLabel: aTitle helpContents: aString edge: anEdge "Open an info flap with the given label, contents, and edge" | aPlug outer leftStrip rightStrip titleRow aDismissButton aFlapTab | Preferences enable: #scrollBarsOnRight. Preferences enable: #inboardScrollbars. aFlapTab := FlapTab new. aFlapTab assureExtension visible: false. aFlapTab referentMargin: (0 @ ActiveWorld sugarAllowance). outer := HelpFlap newRow. outer assureExtension visible: false. outer clipSubmorphs: true. outer beTransparent. outer vResizing: #spaceFill; hResizing: #spaceFill. outer layoutInset: 0; cellInset: 0; borderWidth: 0. outer setProperty: #morphicLayerNumber toValue: 26. leftStrip := Morph new beTransparent. leftStrip layoutInset: 0; cellInset: 0; borderWidth: 0. leftStrip width: 20. leftStrip hResizing: #rigid; vResizing: #spaceFill. outer addMorphBack: leftStrip. rightStrip := AlignmentMorph newColumn. rightStrip beTransparent. rightStrip layoutInset: 0; cellInset: 0; borderWidth: 0. outer addMorphBack: rightStrip. outer clipSubmorphs: true. titleRow := AlignmentMorph newRow. titleRow borderColor: Color veryVeryLightGray; borderWidth: 1. titleRow hResizing: #spaceFill; vResizing: #shrinkWrap. titleRow beTransparent. aDismissButton := aFlapTab tanOButton. aDismissButton actionSelector: #dismissViaHalo. titleRow addMorphFront: aDismissButton. titleRow addTransparentSpacerOfSize: 8 @ 0. titleRow addMorphBack: (StringMorph contents: aTitle font: Preferences standardEToysTitleFont). rightStrip addMorph: titleRow. aPlug := PluggableTextMorph new. aPlug width: 540. aPlug setText: aString. aPlug textMorph beAllFont: Preferences standardEToysFont. aPlug retractable: false; scrollBarOnLeft: false. aPlug hideHScrollBarIndefinitely: true. aPlug borderColor: ScriptingSystem borderColor. aPlug setNameTo: aTitle. aPlug hResizing: #spaceFill. aPlug vResizing: #spaceFill. rightStrip addMorphBack: aPlug. aFlapTab referent ifNotNil: [aFlapTab referent delete]. aFlapTab referent: outer. aFlapTab setName: aTitle edge: anEdge color: (Color r: 0.677 g: 0.935 b: 0.484). aFlapTab submorphs first beAllFont: Preferences standardEToysFont. ActiveWorld addMorphFront: aFlapTab. aFlapTab adaptToWorld: ActiveWorld. aFlapTab computeEdgeFraction. anEdge == #left ifTrue: [aFlapTab position: (outer left @ outer top). outer extent: (540 @ ActiveWorld height)]. anEdge == #right ifTrue: [aFlapTab position: ((ActiveWorld right - aFlapTab width) @ ActiveWorld top). outer extent: (540 @ ActiveWorld height)]. outer beFlap: true. outer color: Color green veryMuchLighter. aPlug textMorph lock. aFlapTab referent hide. aFlapTab openFully. outer beSticky. leftStrip beSticky. rightStrip beSticky. ActiveWorld doOneCycle. aPlug width: 540. aPlug setText: aString. "hmm, again" aPlug color: outer color. aPlug borderWidth: 0. aPlug textMorph contents: aString wrappedTo: 520. aFlapTab applyThickness: 560. aFlapTab fitOnScreen. aFlapTab referent show. ^ aFlapTab! !