Marcel Taeumel uploaded a new version of ToolBuilder-MVC to project The Trunk:
http://source.squeak.org/trunk/ToolBuilder-MVC-mt.61.mcz ==================== Summary ==================== Name: ToolBuilder-MVC-mt.61 Author: mt Time: 14 July 2020, 3:10:12.065552 pm UUID: 39b7e9cc-2da0-48b8-abc4-da349a22f903 Ancestors: ToolBuilder-MVC-TheresaHMartenK.60 Fixes layout bug in MVC windows. =============== Diff against ToolBuilder-MVC-TheresaHMartenK.60 =============== Item was added: + ----- Method: MVCToolBuilder>>buildAll:in: (in category 'building') ----- + buildAll: aList in: newParent + "Overridden to propagate reduced topSize to widgets." + + | priorTopSize | + priorTopSize := topSize. + topSize := newParent window. + super buildAll: aList in: newParent. + topSize := priorTopSize.! Item was removed: - ----- Method: MVCToolBuilder>>positionSubviewsWithin: (in category 'private') ----- - positionSubviewsWithin: widget - "Translate subviews to position the viewport of each subView relative to - the widget window origin. If subviews are repositioned, as in a row of button - views arranged within a view, then the transformations will later be rescaled - to fit the subviews within the widget window." - - widget subViews ifNotNil: [:subViews | - subViews isEmpty ifFalse: [ | translation | - translation := widget window origin - subViews first window origin. - subViews do: [:v | - v setTransformation: (v transformation translateBy: translation)]]]. - ! Item was changed: ----- Method: MVCToolBuilder>>setFrame:in: (in category 'private') ----- setFrame: fractionsRectangleOrLayoutFrame in: widget + | win | + fractionsRectangleOrLayoutFrame ifNil: [ + "Translate subviews to position the viewport of each subView relative to + the widget window origin. If subviews are repositioned, as in a row of button + views arranged within a view, then the transformations will later be rescaled + to fit the subviews within the widget window." + self flag: #nonProportionalLayout. "See #setLayout:in:." + widget setTransformation: (widget transformation translateBy: parent window origin - widget window origin). + ^ self]. + - fractionsRectangleOrLayoutFrame ifNil: [^nil]. win := fractionsRectangleOrLayoutFrame isRectangle ifTrue: [self asWindow: fractionsRectangleOrLayoutFrame] ifFalse: [fractionsRectangleOrLayoutFrame layout: nil in: topSize]. "assume LayoutFrame" widget window: win.! Item was changed: ----- Method: MVCToolBuilder>>setLayout:in: (in category 'private') ----- setLayout: layout in: widget "Arrange subview horizontally or vertically according to layout directive. If the subview dimensions were specified with layout frames rather than explicit rectangle sizes, then their window horizontal or vertical dimensions will be resized as needed to fit within the widget extent." - self positionSubviewsWithin: widget. layout == #proportional ifTrue:[^self]. layout == #horizontal ifTrue:[ | prev subViewWidth widgetWidth xScale | subViewWidth := (widget subViews collect: [:e | e window extent x]) sum. widgetWidth := widget window extent x. xScale := widgetWidth / subViewWidth. "to adjust corner of prev prior to align:" prev := nil. widget subViews do:[:next| | newWindowWidth newCorner | prev ifNotNil:[ "resize prev window prior to aligning next" xScale < 1 ifTrue: [ "proportional placement spec requires resizing" newWindowWidth := (prev window extent x * xScale) truncated. newCorner := (prev window origin x + newWindowWidth)@(prev window corner y). prev setWindow: (prev window origin corner: newCorner)]. next align: next viewport topLeft with: prev viewport topRight. ]. prev := next. ]. ^self]. layout == #vertical ifTrue:[ | prev subViewHeight widgetHeight yScale | subViewHeight := (widget subViews collect: [:e | e window extent y]) sum. widgetHeight := widget window extent y. yScale := widgetHeight / subViewHeight. "to adjust corner of prev prior to align:" prev := nil. widget subViews do:[:next| | newWindowHeight newCorner | prev ifNotNil:[ "resize prev window prior to aligning next" yScale < 1 ifTrue: [ "proportional placement spec requires resizing" newWindowHeight := (prev window extent y * yScale) truncated. newCorner := (prev window corner x)@(prev window origin y + newWindowHeight). prev setWindow: (prev window origin corner: newCorner)]. next align: next viewport topLeft with: prev viewport bottomLeft. ]. prev := next. ]. ^self]. ^self error: 'Unknown layout: ', layout.! |
Free forum by Nabble | Edit this page |