'From etoys4.0 of 9 October 2008 [latest update: #2247] on 13 August 2009 at 1:44:36 pm'! "Change Set: duplicateViewerFix-sw Date: 13 August 2009 Author: Scott Wallace Fix for JIRA ticket 292. In some circumstances, when a viewer is opened on an object in a project loaded from disk, two copies of the viewer's contents appear, stacked one upon the other."! !Presenter methodsFor: '*connectors-viewer' stamp: 'sw 8/13/2009 13:41'! viewMorph: aMorph | aPlayer aViewer aPalette aRect aPoint nominalHeight aFlapTab topItem flapLoc | aMorph allMorphsWithPlayersDo: [:mwp :p | (mwp ~~ aMorph and: [mwp wantsConnectionWhenEmbedded]) ifTrue: [self viewMorph: mwp]]. 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 nascentPartsViewerFor: aPlayer]. self cacheSpecs: topItem. flapLoc := associatedMorph. Preferences viewersInFlaps ifTrue: [aViewer owner ifNotNilDo: [:f | f dropEnabled: false. f flapTab ifNotNilDo: [:aFlap | ^ aFlap showFlap; yourself]]. aViewer setProperty: #noInteriorThumbnail toValue: true. aViewer initializeFor: aPlayer barHeight: 0. aViewer enforceTileColorPolicy. aViewer fullBounds. flapLoc hideViewerFlapsOtherThanFor: aPlayer. aFlapTab := flapLoc viewerFlapTabFor: topItem. aViewer visible: true. aFlapTab applyThickness: aViewer width. aFlapTab spanWorld. aFlapTab showFlap. aViewer position: aFlapTab referent position. aFlapTab referent submorphs do: [:m | (m isKindOf: Viewer) ifTrue: [m delete]]. aFlapTab referent addMorph: aViewer beSticky. flapLoc startSteppingSubmorphsOf: aFlapTab. flapLoc startSteppingSubmorphsOf: aViewer. aFlapTab referent dropEnabled: false. aFlapTab dropEnabled: false. aViewer dropEnabled: false. ^ aFlapTab]. aViewer initializeFor: aPlayer barHeight: 6. aViewer enforceTileColorPolicy. aViewer fullBounds. 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. ^ aViewer]. aMorph primaryHand attachMorph: (aViewer visible: true). ^ aViewer! !