'From Squeak3.2 of 11 July 2002 [latest update: #4956] on 15 March 2003 at 1:31:54 am'! RectangleMorph subclass: #MagicLensGraphMorph instanceVariableNames: 'data textMorph ' classVariableNames: '' poolDictionaries: '' category: 'Morphic-MagicLens'! RectangleMorph subclass: #MagicLensMorph instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Morphic-MagicLens'! TextMorph subclass: #MagicLensTextMorph instanceVariableNames: 'data ' classVariableNames: '' poolDictionaries: '' category: 'Morphic-MagicLens'! !MagicLensGraphMorph methodsFor: 'initialization' stamp: 'sumim 3/14/2003 15:27'! initialize super initialize. data _ #(1 2 3)! ! !MagicLensGraphMorph methodsFor: 'private' stamp: 'sumim 3/14/2003 16:15'! fixBounds: bunds ^ (bunds left min: bunds right) @ (bunds top min: bunds bottom) corner: (bunds left max: bunds right) @ (bunds top max: bunds bottom)! ! !MagicLensGraphMorph methodsFor: 'drawing' stamp: 'sumim 3/14/2003 17:10'! drawOn: aCanvas | columnWidth gap | super drawOn: aCanvas. data size > 0 ifTrue: [ gap _ 0.2. columnWidth _ (self width / ((1 + gap) * data size + gap)) asFloat. 0 to: data size - 1 do: [ :idx | aCanvas fillRectangle: (self fixBounds: (self bottomLeft + (((idx * (1 + gap) + gap) * columnWidth) @ 0) extent: columnWidth @ (self height * 0.9 * (data at: idx + 1) / data max negated))) fillStyle: self fillStyle borderStyle: self borderStyle]]! ! !MagicLensGraphMorph methodsFor: 'accessing' stamp: 'sumim 3/14/2003 16:53'! data: anArray data _ anArray! ! !MagicLensGraphMorph methodsFor: 'accessing' stamp: 'sumim 3/14/2003 16:19'! textMorph ^ textMorph! ! !MagicLensGraphMorph methodsFor: 'accessing' stamp: 'sumim 3/14/2003 16:20'! textMorph: aTextMorph textMorph _ aTextMorph! ! !MagicLensMorph methodsFor: 'initialization' stamp: 'sumim 3/15/2003 00:01'! initialize super initialize. bounds _ 0@0 corner: 160@160. color _ Color white alpha: 0. self setProperty: #clipSubmorphs toValue: true! ! !MagicLensMorph methodsFor: 'stepping and presenter' stamp: 'sumim 3/15/2003 00:25'! step | intersects subs subsTextMorphs | (intersects _ World submorphs select: [ :m | (m isKindOf: MagicLensTextMorph) and: [ m bounds intersects: self bounds]]) size > 0 ifTrue: [ (subs _ self submorphs select: [ :m | intersects includes: m textMorph ]) do: [ :m | m position: m textMorph position; extent: m textMorph extent; data: m textMorph data]. self submorphsDo: [ :m | (intersects includes: m textMorph) ifFalse: [m delete]]. subsTextMorphs _ subs collect: [ :m | m textMorph ]. (intersects select: [ :m | (subsTextMorphs includes: m) not ]) do: [ :t | self addMorph: (MagicLensGraphMorph new position: t position; extent: t extent; textMorph: t; data: t data)]] ifFalse: [ self submorphsDo: [ :m | m delete ]]! ! !MagicLensMorph methodsFor: 'stepping and presenter' stamp: 'sumim 3/15/2003 00:03'! stepTime ^ 10! ! !MagicLensTextMorph methodsFor: 'initialization' stamp: 'sumim 3/14/2003 15:12'! initialize super initialize. bounds _ 0@0 corner: 160@160. borderWidth _ 1. borderColor _ Color gray. self setProperty: #autoFitContents toValue: false. text _ '#(1 2 3 4 5)' asText! ! !MagicLensTextMorph methodsFor: 'editing' stamp: 'sumim 3/14/2003 17:05'! acceptContents super acceptContents. data _ self data! ! !MagicLensTextMorph methodsFor: 'accessing' stamp: 'sumim 3/14/2003 17:07'! data data _ Compiler new evaluate: text asString in: nil to: nil notifying: nil ifFail: [nil]. (data isKindOf: Collection) ifTrue: [data _ data asArray] ifFalse: [data _ #()]. ^ data! !