'From Squeak3.1alpha of 28 February 2001 [latest update: #4000] on 9 May 2001 at 9:23:38 pm'! "Change Set: UnhibernateFix-ar Date: 9 May 2001 Author: Andreas Raab Fix ViewerFlapTab>>unhibernate."! !Presenter methodsFor: 'viewer' stamp: 'ar 5/9/2001 21:19'! viewObject: anObject "Open up and return a viewer on the given object" | aViewer aRect aPoint nominalHeight aFlapTab flapLoc | anObject isMorph ifTrue: [^ self viewMorph: anObject]. "historic morph/player implementation" associatedMorph addMorph: (aViewer _ self nascentPartsViewerFor: anObject). "19 sept 2000 - allow flaps in any paste up (bob arning)" flapLoc _ associatedMorph "world". Preferences viewersInFlaps ifTrue: [aViewer setProperty: #noInteriorThumbnail toValue: true. aViewer initializeFor: anObject barHeight: 0. aViewer enforceTileColorPolicy. flapLoc hideViewerFlapsOtherThanFor: anObject. aFlapTab _ flapLoc viewerFlapTabFor: anObject. aFlapTab referent submorphs do: [:m | (m isKindOf: Viewer) ifTrue: [m delete]]. aFlapTab referent addMorph: aViewer beSticky. aViewer visible: true. aFlapTab applyThickness: aViewer width + 25. aFlapTab spanWorld. aFlapTab showFlap. aViewer position: aFlapTab referent position. flapLoc startSteppingSubmorphsOf: aFlapTab. flapLoc startSteppingSubmorphsOf: aViewer. ^aFlapTab]. aViewer initializeFor: anObject barHeight: 6. aViewer enforceTileColorPolicy. Preferences automaticViewerPlacement ifTrue: [aPoint _ anObject bounds right @ (anObject center y - ((nominalHeight _ aViewer initialHeightToAllow) // 2)). aRect _ (aPoint extent: (aViewer width @ nominalHeight)) translatedToBeWithin: flapLoc bounds. aViewer position: aRect topLeft. aViewer visible: true. flapLoc startSteppingSubmorphsOf: aViewer. "it's already in the world, somewhat coincidentally" ^ aViewer]. anObject primaryHand attachMorph: (aViewer visible: true). ^aViewer! ! !ViewerFlapTab methodsFor: 'transition' stamp: 'ar 5/9/2001 21:12'! unhibernate | wasShowing viewer | "recreate my viewer" referent ifNotNil: [ (referent findA: Viewer) ifNotNil: [^self]. ]. wasShowing _ flapShowing. "guard against not-quite-player-players" ((scriptedPlayer respondsTo: #costume) and:[scriptedPlayer costume isMorph]) ifTrue:[viewer _ self presenter viewMorph: scriptedPlayer costume] ifFalse:[viewer _ self presenter viewObject: scriptedPlayer]. wasShowing ifFalse: [self hideFlap]. ^ viewer! !