'From Squeak3.7gamma of ''17 July 2004'' [latest update: #5976] on 17 July 2004 at 11:09:12 am'! "Change Set: ReUseViewerFlaps-nk Date: 21 April 2004 Author: Ned Konz This is a minor change for the eToys environment that will re-use an existing viewer flap when you open a viewer from an object halo. "! !Presenter methodsFor: 'viewer' stamp: 'nk 4/22/2004 19:21'! viewMorph: aMorph | aPlayer aViewer aPalette aRect aPoint nominalHeight aFlapTab topItem flapLoc | Sensor leftShiftDown ifFalse: [((aPalette := aMorph standardPalette) notNil and: [aPalette isInWorld]) ifTrue: [^aPalette viewMorph: aMorph]]. aPlayer := (topItem := aMorph topRendererOrSelf) assuredPlayer. aViewer := (aPlayer allOpenViewers at: 1 ifAbsent: [ self nascentPartsViewer ]). self cacheSpecs: topItem. "redo the spec cache once in a while" "19 sept 2000 - allow flaps in any paste up" flapLoc := associatedMorph. "world" Preferences viewersInFlaps ifTrue: [ aViewer owner ifNotNilDo: [ :f | ^f flapTab showFlap; yourself ]. aViewer setProperty: #noInteriorThumbnail toValue: true. aViewer initializeFor: aPlayer barHeight: 0. aViewer enforceTileColorPolicy. aViewer fullBounds. "force layout" "associatedMorph addMorph: aViewer." "why???" flapLoc hideViewerFlapsOtherThanFor: aPlayer. aFlapTab := flapLoc viewerFlapTabFor: topItem. aFlapTab referent submorphs do: [:m | (m isKindOf: Viewer) ifTrue: [m delete]]. aViewer visible: true. aFlapTab applyThickness: aViewer width + 25. aFlapTab spanWorld. aFlapTab showFlap. aViewer position: aFlapTab referent position. aFlapTab referent addMorph: aViewer beSticky. "moved" flapLoc startSteppingSubmorphsOf: aFlapTab. flapLoc startSteppingSubmorphsOf: aViewer. ^aFlapTab]. aViewer initializeFor: aPlayer barHeight: 6. aViewer enforceTileColorPolicy. aViewer fullBounds. "force layout" Preferences automaticViewerPlacement ifTrue: [aPoint := aMorph bounds right @ (aMorph center y - ((nominalHeight := aViewer initialHeightToAllow) // 2)). aRect := (aPoint extent: aViewer width @ nominalHeight) translatedToBeWithin: flapLoc bounds. aViewer position: aRect topLeft. aViewer visible: true. associatedMorph addMorph: aViewer. flapLoc startSteppingSubmorphsOf: aViewer. "it's already in the world, somewhat coincidentally" ^aViewer]. aMorph primaryHand attachMorph: (aViewer visible: true). ^aViewer! !