[squeak-dev] The Trunk: Morphic-mt.1124.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Apr 29 11:05:47 UTC 2016
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1124.mcz
==================== Summary ====================
Name: Morphic-mt.1124
Author: mt
Time: 29 April 2016, 1:04:05.656719 pm
UUID: 20b80e2e-df90-fa43-bf17-339878efb46a
Ancestors: Morphic-cmm.1123
Speeds up drawing of large tree morphs by introducing a cache for the width of each column. Invalidate that cache each time the nodes in the tree are re-layouted.
Try out "CompiledMethod allInstances explore" before and after this change. Have "PluggableListMorph highlightHoveredRow: true".
Why? Computation of largest item in a column is O(n) at the moment. Drawing code needs width of column to position the strings in each row. Each row is a (string) morph and the columns are "faked".
=============== Diff against Morphic-cmm.1123 ===============
Item was changed:
----- Method: IndentingListItemMorph>>widthOfColumn: (in category 'accessing - columns') -----
widthOfColumn: columnIndex
| widthOrSpec |
container columns ifNil: [ ^ self width ].
+ (container columnsCache at: columnIndex)
+ ifNotNil: [ :cachedWidth | ^ cachedWidth ].
widthOrSpec := container columns at: columnIndex.
+ container columnsCache at: columnIndex put: (widthOrSpec isNumber
- ^ widthOrSpec isNumber
ifTrue: [ widthOrSpec ]
ifFalse:
[ widthOrSpec isBlock
ifTrue:
[ widthOrSpec
cull: container
cull: self ]
ifFalse:
[ widthOrSpec
ifNil: [ self width ]
ifNotNil: [ "Fall back"
+ 50 ] ] ]).
+ ^ container columnsCache at: columnIndex!
- 50 ] ] ]!
Item was changed:
ScrollPane subclass: #SimpleHierarchicalListMorph
+ instanceVariableNames: 'selectedMorph hoveredMorph getListSelector keystrokeActionSelector autoDeselect columns columnsCache sortingSelector getSelectionSelector setSelectionSelector potentialDropMorph lineColor'
- instanceVariableNames: 'selectedMorph hoveredMorph getListSelector keystrokeActionSelector autoDeselect columns sortingSelector getSelectionSelector setSelectionSelector potentialDropMorph lineColor'
classVariableNames: 'WrappedNavigation'
poolDictionaries: ''
category: 'Morphic-Explorer'!
SimpleHierarchicalListMorph class
instanceVariableNames: 'expandedForm notExpandedForm'!
!SimpleHierarchicalListMorph commentStamp: 'ls 3/1/2004 12:15' prior: 0!
Display a hierarchical list of items. Each item should be wrapped with a ListItemWrapper.
For a simple example, look at submorphsExample. For beefier examples, look at ObjectExplorer or FileList2.!
SimpleHierarchicalListMorph class
instanceVariableNames: 'expandedForm notExpandedForm'!
Item was changed:
----- Method: SimpleHierarchicalListMorph>>adjustSubmorphPositions (in category 'private') -----
adjustSubmorphPositions
| p |
p := 0 at 0.
scroller submorphsDo: [ :each | | h |
each visible ifTrue: [
h := each height.
each privateBounds: (p extent: self preferredSubmorphWidth at h).
p := p + (0 at h) ]].
self
+ clearColumnsCache;
changed;
layoutChanged;
setScrollDeltas.
!
Item was added:
+ ----- Method: SimpleHierarchicalListMorph>>clearColumnsCache (in category 'private - caching') -----
+ clearColumnsCache
+
+ columnsCache := self columns
+ ifNil: [Array empty]
+ ifNotNil: [:c | Array new: c size].!
Item was added:
+ ----- Method: SimpleHierarchicalListMorph>>columnsCache (in category 'private - caching') -----
+ columnsCache
+ columnsCache ifNil: [self clearColumnsCache].
+ ^ columnsCache!
Item was changed:
----- Method: SimpleHierarchicalListMorph>>drawLinesOn: (in category 'drawing') -----
drawLinesOn: aCanvas
| lColor |
lColor := self lineColor.
aCanvas
transformBy: scroller transform
clippingTo: scroller innerBounds
during:[:clippedCanvas |
+ scroller submorphsDo: [ :submorph |
+ (submorph visible and: [(submorph isExpanded
+ or: [clippedCanvas isVisible: submorph fullBounds] )
+ or: [ submorph nextSibling notNil and: [clippedCanvas isVisible: submorph nextSibling fullBounds]]])
+ ifTrue: [submorph drawLinesOn: clippedCanvas lineColor: lColor indentThreshold: 0] ] ]
- scroller submorphs
- select: [:submorph | submorph visible]
- thenDo: [ :submorph |
- ((submorph isExpanded
- or: [clippedCanvas isVisible: submorph fullBounds] )
- or: [ submorph nextSibling notNil and: [clippedCanvas isVisible: submorph nextSibling bounds]])
- ifTrue: [submorph drawLinesOn: clippedCanvas lineColor: lColor indentThreshold: 0] ] ]
smoothing: scroller smoothing.
!
More information about the Squeak-dev
mailing list
|