[Pkg] The Trunk: ToolBuilder-MVC-dtl.30.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Feb 18 05:31:28 UTC 2013

David T. Lewis uploaded a new version of ToolBuilder-MVC to project The Trunk:

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

Name: ToolBuilder-MVC-dtl.30
Author: dtl
Time: 18 February 2013, 12:27:28.584 am
UUID: 499f21e0-6d8d-46ec-a501-04438715485f
Ancestors: ToolBuilder-MVC-ul.29

Make browsers work in MVC.

Arrange for subviews (e.g. a row of buttons in a browser) to be scaled properly and to be translated to the viewport of the containing view.

View coordinate systems are transformed relative to their containing views, not to the top level view, so change MVCToolBuilder>>asWindow: to scale relative to window of the containing view.

Change MVCToolbuilder>>buildPluggablePanel to call setFrame:in: prior to building subviews so that the view window is available to subviews for scaling subview windows.

In MVCToolBuilder>>setLayout:in adjust translation in the window transformation of subviews to position correctly in their viewports.

Caution - save image before testing, other problems await.

=============== Diff against ToolBuilder-MVC-ul.29 ===============

Item was changed:
  ----- Method: MVCToolBuilder>>asWindow: (in category 'private') -----
  asWindow: aRectangle
+ 	| outer |
+ 	outer := parent window ifNil: [topSize].
+ 	^(aRectangle origin * outer extent) truncated
+ 		corner: (aRectangle corner * outer extent) truncated!
- 	^(aRectangle origin * topSize extent) truncated
- 		corner: (aRectangle corner * topSize extent) truncated!

Item was changed:
  ----- Method: MVCToolBuilder>>buildPluggablePanel: (in category 'pluggable widgets') -----
  buildPluggablePanel: aSpec
  	| widget children |
  	widget := View new model: aSpec model.
  	self register: widget id: aSpec name.
  	children := aSpec children.
  	children isSymbol ifTrue:[
  		"@@@@ FIXME: PluggablePanes need to remember their getChildrenSelector"
  		"widget getChildrenSelector: children.
  		widget update: children."
  		children := #().
- 	self buildAll: children in: widget.
  	self setFrame: aSpec frame in: widget.
+ 	self buildAll: children in: widget.
  	parent ifNotNil:[parent addSubView: widget].
  	self setLayout: aSpec layout in: widget.

Item was changed:
  ----- Method: MVCToolBuilder>>setLayout:in: (in category 'private') -----
  setLayout: layout in: widget
+ 	"translate subviews to position viewport"
+ 	widget subViews ifNotNilDo: [:subViews |
+ 		subViews isEmpty ifFalse: [ | translation |
+ 			translation := widget window origin - subViews first window origin.
+ 			subViews do: [:v | 
+ 				v setTransformation: (v transformation translateBy: translation)]]].
  	layout == #proportional ifTrue:[^self].
  	layout == #horizontal ifTrue:[
  		| prev |
  		prev := nil.
  		widget subViews do:[:next|
  			prev ifNotNil:[
  				next align: next viewport topLeft with: prev viewport topRight.
  			prev := next.
  	layout == #vertical ifTrue:[
  		| prev |
  		prev := nil.
  		widget subViews do:[:next|
  			prev ifNotNil:[
  				next align: next viewport topLeft with: prev viewport bottomLeft.
  			prev := next.
  	^self error: 'Unknown layout: ', layout.!

More information about the Packages mailing list