'From etoys2.3 of 2 December 2007 [latest update: #1873] on 25 January 2008 at 2:34:42 pm'! "Change Set: GuideUnderPaint-tk Date: 25 January 2008 Author: Ted Kaehler When a new SketchMorphEditor overlaps the Next Page button of an open Help Guide, a new user will get confused. There is no easy way to get to the next page of help. We duplicate the button, and add it to the SketchMorphEditor. It works and sits in front of the paint area. Goes away when paint session is closed."! !Project methodsFor: 'flaps support' stamp: 'tk 1/25/2008 13:09'! helpGuideIfOpen "Return the QuickGuideMorph of the help flap if it is open. Return nil if the Help flap is closed or if there is no help flap." | ref ff | ff _ Flaps globalFlapTab: 'Help' translated. ff ifNil: [^ nil]. ff isInWorld ifFalse: [^ nil]. ff flapShowing ifFalse: [^ nil]. ref _ ff referent. ref ifNil: [^ nil]. ^ ref findDeeplyA: QuickGuideMorph ! ! !QuickGuideMorph methodsFor: 'initialization' stamp: 'tk 1/25/2008 14:30'! initialize | newPage | self beSticky. newPagePrototype _ QuickGuideHolderMorph new. newPagePrototype guideName: 'empty'. newPagePrototype setProperty: #transitionSpec toValue: (Array with: 'silence' with: #none with: #none). super initialize. order _ OrderedCollection with: 'index'. newPage _ newPagePrototype veryDeepCopy. newPage guideName: 'index'. self insertPage: newPage pageSize: 100@100 atIndex: 1. self goToPage: 2. self deletePageBasic. self pageControlsAtTop: false. self jumpToAdjust: self pageControls. "Do we want the user to be able to drag Guide out of the flap simply by clicking on the guide name? Ted thinks not. But, the following code does not prevent it!!!! showPageControls: controlSpecs allowDragging: true is being called somewhere." "self pageControls eventHandler ifNotNil: [ self pageControls eventHandler forgetDispatchesTo: #moveViaTitle:event:from:]." "disable dragging on the controls"! ! !SketchEditorMorph methodsFor: 'initialization' stamp: 'tk 1/25/2008 13:33'! initializeFor: aSketchMorph inBounds: boundsToUse pasteUpMorph: aPasteUpMorph paintBoxPosition: aPosition "NB: if aPosition is nil, then it's assumed that the paintbox is obtained from a flap or some such, so do nothing special regarding a palette in this case. The palette needs already to be in the world for this to work." | w sketchPos | (w _ aPasteUpMorph world) addMorphInLayer: self. "in back of palette" enclosingPasteUpMorph _ aPasteUpMorph. hostView _ aSketchMorph. "may be ownerless" self bounds: boundsToUse. palette _ w paintBox focusMorph: self. palette beStatic. "give Nebraska whatever help we can" palette fixupButtons. palette addWeakDependent: self. aPosition ifNotNil: [w addMorphFront: palette. "bring to front" palette position: aPosition. Preferences useBiggerPaintingBox ifTrue: [palette beSupersized]]. paintingForm _ Form extent: bounds extent depth: w assuredCanvas depth. self dimTheWindow. self addRotationScaleHandles. self addHelpNextButton. sketchPos := (self hasProperty: #background) ifTrue: [aSketchMorph position] ifFalse: [paintingForm extent - aSketchMorph form extent // 2]. aSketchMorph ifNotNil: [aSketchMorph form displayOn: paintingForm at: sketchPos clippingBox: (0@0 extent: paintingForm extent) rule: Form over fillColor: nil. "assume they are the same depth". undoBuffer _ paintingForm deepCopy. rotationCenter _ aSketchMorph rotationCenter]! ! !SketchEditorMorph methodsFor: 'start & finish' stamp: 'tk 1/25/2008 13:51'! addHelpNextButton "This is a TOTAL hack. When the Help Guide is showing, and the user starts painting, the next-page button in the Guide is obscured. A beginner will not know what to do to see the next page of help. He can see the next page button, but clicking paints a dot. To cure this, we make a copy of the NextPage button and put it on top of the paint area. Clicking it turns the page in the guide. If the user closes help while painting, we do not delete the button." | np gg nextPageButton | gg _ Project current helpGuideIfOpen ifNil: [^ nil]. np _ gg pageControls findDeepSubmorphThat: [:mm | (mm respondsTo: #actionSelector) ifTrue: [mm actionSelector == #nextPage] ifFalse: [false] ] ifAbsent: [^ nil]. (np bounds intersects: self bounds) ifFalse: [^ nil]. nextPageButton _ np veryDeepCopy. nextPageButton on: #mouseEnter send: #mouseLeave: to: self. "Hide brush cursor" nextPageButton on: #mouseLeave send: #mouseEnter: to: self. "Show brush cursor" "nextPageButton hasRolloverBorder: true. Just too much" self addMorph: nextPageButton.! !