'From Squeak3.5 of ''11 April 2003'' [latest update: #5180] on 27 April 2003 at 6:13:05 pm'! "Change Set: ProjectViewMods-sbw Date: 4 March 2002 Author: Stephan B. Wessels Create the morphic project views with an aspect ratio that agrees with the screen, if the preference is set. Also, another new preference controls if the drag resize should also constrain the user to the same aspect ratio. Date Update ------------- ----------------------------------------------------------------------- 15-apr-2003 updated for Squeak 3.5 4-mar-2002 initial file release. "! !Preferences class methodsFor: 'initialization' stamp: 'sbw 3/4/2002 13:32'! addPreferenceForOptionalProjectViewAspect "Preferences addPreferenceForOptionalProjectViewAspect" self preferenceAt: #projectViewsAspectMatchesDisplay ifAbsent: [self addPreference: #projectViewsAspectMatchesDisplay category: #projects default: true balloonHelp: 'If true, the project view morphs size will have an aspect ratio the same as that of the Display.']! ! !Preferences class methodsFor: 'initialization' stamp: 'sbw 3/4/2002 15:12'! addPreferenceForOptionalProjectViewAspectConstrain "Preferences addPreferenceForOptionalProjectViewAspectConstrain" self preferenceAt: #projectViewsAspectConstrained ifAbsent: [self addPreference: #projectViewsAspectConstrained category: #projects default: true balloonHelp: 'If true, the project view morphs size will have an aspect ratio the same as that of the Display while resizing.']! ! !ProjectViewMorph methodsFor: 'events' stamp: 'sbw 3/4/2002 13:45'! on: aProject | aspectRatio | project _ aProject. self addProjectNameMorphFiller. lastProjectThumbnail _ nil. project thumbnail ifNil: [(Preferences valueOfFlag: #projectViewsAspectMatchesDisplay) ifTrue: [ aspectRatio _ World width asFloat / World height asFloat. self extent: (80 * aspectRatio) rounded @ 80] ifFalse: [self extent: 100 @ 80]] ifNotNil: [self extent: project thumbnail extent]! ! !ProjectViewMorph methodsFor: 'as yet unclassified' stamp: 'sbw 3/4/2002 15:26'! setExtentFromHalo: anExtent "The user has dragged the grow box such that the receiver's extent would be anExtent. Set the extent while dragging to maintain the Display's aspect ratio if the preference is so set." | aspectRatio | (Preferences valueOfFlag: #projectViewsAspectConstrained) ifTrue: [aspectRatio _ World width asFloat / World height asFloat. self extent: (anExtent y * aspectRatio) rounded @ anExtent y] ifFalse: [self extent: anExtent]! ! "Postscript: Establish and initialize a preference for us." Preferences addPreferenceForOptionalProjectViewAspect. Preferences addPreferenceForOptionalProjectViewAspectConstrain. !