[squeak-dev] The Inbox: Morphic-bp.1033.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Jan 10 23:22:41 UTC 2016


Bernhard Pieber uploaded a new version of Morphic to project The Inbox:
http://source.squeak.org/inbox/Morphic-bp.1033.mcz

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

Name: Morphic-bp.1033
Author: bp
Time: 10 January 2016, 11:41:34.907 pm
UUID: 9f66e1c2-045a-4459-af65-cf222455afca
Ancestors: Morphic-mt.1032

SystemWindows snap and resize when dragged to corners and edges of the Display

=============== Diff against Morphic-mt.1032 ===============

Item was changed:
  MorphicModel subclass: #SystemWindow
  	instanceVariableNames: 'labelString stripes label closeBox collapseBox activeOnlyOnTop paneMorphs paneRects collapsedFrame fullFrame isCollapsed menuBox mustNotClose labelWidgetAllowance updatablePanes allowReframeHandles labelArea expandBox'
+ 	classVariableNames: 'ClickOnLabelToEdit CloseBoxFrame CloseBoxImageFlat CloseBoxImageGradient CollapseBoxImageFlat CollapseBoxImageGradient DoubleClickOnLabelToExpand DragToEdges ExpandBoxFrame ExpandBoxImageFlat ExpandBoxImageGradient FocusFollowsMouse GradientWindow HideExpandButton MenuBoxFrame MenuBoxImageFlat MenuBoxImageGradient ResizeAlongEdges ReuseWindows TopWindow WindowsRaiseOnClick'
- 	classVariableNames: 'ClickOnLabelToEdit CloseBoxFrame CloseBoxImageFlat CloseBoxImageGradient CollapseBoxImageFlat CollapseBoxImageGradient DoubleClickOnLabelToExpand ExpandBoxFrame ExpandBoxImageFlat ExpandBoxImageGradient FocusFollowsMouse GradientWindow HideExpandButton MenuBoxFrame MenuBoxImageFlat MenuBoxImageGradient ResizeAlongEdges ReuseWindows TopWindow WindowsRaiseOnClick'
  	poolDictionaries: ''
  	category: 'Morphic-Windows'!
  
  !SystemWindow commentStamp: '<historical>' prior: 0!
  SystemWindow is the Morphic equivalent of StandardSystemView -- a labelled container for rectangular views, with iconic facilities for close, collapse/expand, and resizing.
  
  The attribute onlyActiveOnTop, if set to true (and any call to activate will set this), determines that only the top member of a collection of such windows on the screen shall be active.  To be not active means that a mouse click in any region will only result in bringing the window to the top and then making it active.!

Item was added:
+ ----- Method: SystemWindow class>>dragToEdges (in category 'preferences') -----
+ dragToEdges
+ 	<preference: 'Drag To Edges'
+ 		category: 'windows'
+ 		description: 'When true, windows snap and resize to corners and edges of the Display.'
+ 		type: #Boolean>
+ 	^DragToEdges ifNil: [false]!

Item was added:
+ ----- Method: SystemWindow class>>dragToEdges: (in category 'preferences') -----
+ dragToEdges: aBoolean
+ 	DragToEdges := aBoolean!

Item was changed:
  ----- Method: SystemWindow>>doFastFrameDrag: (in category 'events') -----
  doFastFrameDrag: grabPoint
  	"Do fast frame dragging from the given point"
  
  	| offset newBounds outerWorldBounds |
  	outerWorldBounds := self boundsIn: nil.
  	offset := outerWorldBounds origin - grabPoint.
+ 	newBounds := outerWorldBounds newRectFrom: [:f |
+ 		| p a selector |
+ 		p := Sensor cursorPoint.
+ 		a := ActiveWorld clearArea.
+ 		(self class dragToEdges and: [(selector := self dragToEdgesSelectorFor: p in: a) notNil])
+ 			ifTrue: [a perform: selector]
+ 			ifFalse: [p + offset extent: outerWorldBounds extent]].
+ 	self bounds: newBounds; comeToFront!
- 	newBounds := outerWorldBounds newRectFrom: [:f | 
- 		Sensor cursorPoint + offset extent: outerWorldBounds extent].
- 	self position: (self globalPointToLocal: newBounds topLeft); comeToFront!

Item was added:
+ ----- Method: SystemWindow>>dragToEdgesSelectorFor:in: (in category 'resize/collapse') -----
+ dragToEdgesSelectorFor: p in: a
+ 	"answer first matching drag resize selector, if none is found, answer nil"
+ 	#(point:nearTopLeftOf: point:nearTopRightOf: point:nearBottomLeftOf: point:nearBottomRightOf: point:nearTopOf: point:nearBottomOf: point:nearLeftOf: point:nearRightOf:)
+ 		with: #(topLeftQuadrant topRightQuadrant bottomLeftQuadrant bottomRightQuadrant topHalf bottomHalf leftHalf rightHalf)
+ 		do: [:predicate :selector |
+ 			(self perform: predicate with: p with: a) ifTrue: [^selector]].
+ 	^nil!

Item was added:
+ ----- Method: SystemWindow>>point:nearBottomLeftOf: (in category 'resize/collapse') -----
+ point: p nearBottomLeftOf: a
+ 	^(self point: p nearBottomOf: a) and: [self point: p nearLeftOf: a]!

Item was added:
+ ----- Method: SystemWindow>>point:nearBottomOf: (in category 'resize/collapse') -----
+ point: p nearBottomOf: a
+ 	^p y > (a bottom - 10)!

Item was added:
+ ----- Method: SystemWindow>>point:nearBottomRightOf: (in category 'resize/collapse') -----
+ point: p nearBottomRightOf: a
+ 	^(self point: p nearBottomOf: a) and: [self point: p nearRightOf: a]!

Item was added:
+ ----- Method: SystemWindow>>point:nearLeftOf: (in category 'resize/collapse') -----
+ point: p nearLeftOf: a
+ 	^p x < (a left + 10)!

Item was added:
+ ----- Method: SystemWindow>>point:nearRightOf: (in category 'resize/collapse') -----
+ point: p nearRightOf: a
+ 	^p x > (a right - 10)!

Item was added:
+ ----- Method: SystemWindow>>point:nearTopLeftOf: (in category 'resize/collapse') -----
+ point: p nearTopLeftOf: a
+ 	^(self point: p nearTopOf: a) and: [self point: p nearLeftOf: a]!

Item was added:
+ ----- Method: SystemWindow>>point:nearTopOf: (in category 'resize/collapse') -----
+ point: p nearTopOf: a
+ 	^p y < (a top + 10)!

Item was added:
+ ----- Method: SystemWindow>>point:nearTopRightOf: (in category 'resize/collapse') -----
+ point: p nearTopRightOf: a
+ 	^(self point: p nearTopOf: a) and: [self point: p nearRightOf: a]!



More information about the Squeak-dev mailing list