[squeak-dev] The Inbox: MorphicExtras-fbs.109.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Jun 7 11:29:38 UTC 2013


A new version of MorphicExtras was added to project The Inbox:
http://source.squeak.org/inbox/MorphicExtras-fbs.109.mcz

==================== Summary ====================

Name: MorphicExtras-fbs.109
Author: fbs
Time: 7 June 2013, 12:28:41.374 pm
UUID: dcc9ff1b-8603-4625-8ed2-63b6b684e9ae
Ancestors: MorphicExtras-fbs.108

ScrapBook holds the global state formerly stored in Utilities' ScrapsBook class var.

=============== Diff against MorphicExtras-fbs.108 ===============

Item was added:
+ ----- Method: RealEstateAgent class>>reduceByFlaps: (in category '*MorphicExtras-utilities') -----
+ reduceByFlaps: aScreenRect 
+ 	"Return a rectangle that won't interfere with default shared flaps"
+ 
+ 	Flaps sharedFlapsAllowed ifFalse: [^ aScreenRect copy].
+ 	(Flaps globalFlapTabsIfAny allSatisfy:
+ 			[:ft | ft flapID = 'Painting' translated or: [ft edgeToAdhereTo == #bottom]])
+ 		ifTrue: [^ aScreenRect withHeight: aScreenRect height - 18]
+ 		ifFalse: [^ aScreenRect insetBy: 18]!

Item was added:
+ ----- Method: RealEstateAgent class>>strictlyStaggeredInitialFrameFor:initialExtent: (in category '*MorphicExtras-framing') -----
+ strictlyStaggeredInitialFrameFor: aStandardSystemView initialExtent: initialExtent
+ 
+ 	self error: 'please use #strictlyStaggeredInitialFrameFor:initialExtent:world:'!

Item was added:
+ ----- Method: RealEstateAgent class>>strictlyStaggeredInitialFrameFor:initialExtent:world: (in category '*MorphicExtras-framing') -----
+ strictlyStaggeredInitialFrameFor: aStandardSystemView initialExtent: initialExtent world: aWorld
+ 	"This method implements a staggered window placement policy that I (di) like.
+ 	Basically it provides for up to 4 windows, staggered from each of the 4 corners.
+ 	The windows are staggered so that there will always be a corner visible."
+ 
+ 	| allowedArea grid initialFrame otherFrames cornerSel corner delta putativeCorner free maxLevel |
+ 
+ 	allowedArea :=(self maximumUsableAreaInWorld: aWorld)
+ 		insetBy: (self scrollBarSetback @ self screenTopSetback extent: 0 at 0).
+ 	(Smalltalk isMorphic and: [Flaps sharedFlapsAllowed]) ifTrue:
+ 		[allowedArea := self reduceByFlaps: allowedArea].
+ 	"Number to be staggered at each corner (less on small screens)"
+ 	maxLevel := allowedArea area > 300000 ifTrue: [3] ifFalse: [2].
+ 	"Amount by which to stagger (less on small screens)"
+ 	grid := allowedArea area > 500000 ifTrue: [40] ifFalse: [20].
+ 	initialFrame := 0 at 0 extent: ((initialExtent
+ 							"min: (allowedArea extent - (grid*(maxLevel+1*2) + (grid//2))))
+ 							min: 600 at 400")).
+ 	otherFrames := Smalltalk isMorphic
+ 		ifTrue: [(SystemWindow windowsIn: aWorld satisfying: [:w | w isCollapsed not])
+ 					collect: [:w | w bounds]]
+ 		ifFalse: [ScheduledControllers scheduledWindowControllers
+ 				select: [:aController | aController view ~~ nil]
+ 				thenCollect: [:aController | aController view isCollapsed
+ 								ifTrue: [aController view expandedFrame]
+ 								ifFalse: [aController view displayBox]]].
+ 	0 to: maxLevel do:
+ 		[:level | 
+ 		1 to: 4 do:
+ 			[:ci | cornerSel := #(topLeft topRight bottomRight bottomLeft) at: ci.
+ 			corner := allowedArea perform: cornerSel.
+ 			"The extra grid//2 in delta helps to keep title tabs distinct"
+ 			delta := (maxLevel-level*grid+(grid//2)) @ (level*grid).
+ 			1 to: ci-1 do: [:i | delta := delta rotateBy: #right centerAt: 0 at 0]. "slow way"
+ 			putativeCorner := corner + delta.
+ 			free := true.
+ 			otherFrames do:
+ 				[:w |
+ 				free := free & ((w perform: cornerSel) ~= putativeCorner)].
+ 			free ifTrue:
+ 				[^ (initialFrame align: (initialFrame perform: cornerSel)
+ 								with: putativeCorner)
+ 						 translatedAndSquishedToBeWithin: allowedArea]]].
+ 	"If all else fails..."
+ 	^ (self scrollBarSetback @ self screenTopSetback extent: initialFrame extent)
+ 		translatedAndSquishedToBeWithin: allowedArea!



More information about the Squeak-dev mailing list