Patrick Rein uploaded a new version of Morphic to project The Inbox:
http://source.squeak.org/inbox/Morphic-pre.1490.mcz ==================== Summary ==================== Name: Morphic-pre.1490 Author: pre Time: 26 June 2019, 2:27:35.772055 pm UUID: 95570b89-47fd-8e4f-86ec-f075734e1fb0 Ancestors: Morphic-pre.1489 Fixes a defect preventing colored line items in pluggable tree morphs. The infrastructure was already in place (see StringMorph>>#contents:), however, the ListMorph overrides the determined color later. This changes this overriding to be more conservative to preserve any pre-determined color. =============== Diff against Morphic-pre.1489 =============== Item was changed: ----- Method: SimpleHierarchicalListMorph>>addMorphsTo:from:allowSorting:withExpandedItems:atLevel: (in category 'private') ----- addMorphsTo: morphList from: aCollection allowSorting: sortBoolean withExpandedItems: expandedItems atLevel: newIndent | priorMorph newCollection firstAddition | priorMorph := nil. newCollection := (sortBoolean and: [sortingSelector notNil]) ifTrue: [ aCollection sorted: [ :a :b | (a perform: sortingSelector) <= (b perform: sortingSelector)] ] ifFalse: [ aCollection ]. firstAddition := nil. newCollection do: [:item | priorMorph := self indentingItemClass basicNew initWithContents: item prior: priorMorph forList: self indentLevel: newIndent. priorMorph + color: (priorMorph color ifNil: [self textColor] ifNotNil: [:c | c]); - color: self textColor; font: self font; selectionColor: self selectionColor; selectionTextColor: self selectionTextColor; hoverColor: self hoverColor; highlightTextColor: self highlightTextColor; filterColor: self filterColor; filterTextColor: self filterTextColor. firstAddition ifNil: [firstAddition := priorMorph]. morphList add: priorMorph. ((item hasEquivalentIn: expandedItems) or: [priorMorph isExpanded]) ifTrue: [ priorMorph isExpanded: true. priorMorph addChildrenForList: self addingTo: morphList withExpandedItems: expandedItems. ]. ]. ^firstAddition ! Item was changed: ----- Method: SimpleHierarchicalListMorph>>addSubmorphsAfter:fromCollection:allowSorting: (in category 'private') ----- addSubmorphsAfter: parentMorph fromCollection: aCollection allowSorting: sortBoolean | priorMorph morphList newCollection | priorMorph := nil. newCollection := (sortBoolean and: [sortingSelector notNil]) ifTrue: [ aCollection sorted: [ :a :b | (a perform: sortingSelector) <= (b perform: sortingSelector)] ] ifFalse: [ aCollection ]. morphList := OrderedCollection new. newCollection do: [:item | priorMorph := self indentingItemClass basicNew initWithContents: item prior: priorMorph forList: self indentLevel: parentMorph indentLevel + 1. priorMorph + color: (priorMorph color ifNil: [self textColor] ifNotNil: [:c | c]); - color: self textColor; font: self font; selectionColor: self selectionColor; selectionTextColor: self selectionTextColor; hoverColor: self hoverColor; highlightTextColor: self highlightTextColor; filterColor: self filterColor; filterTextColor: self filterTextColor. morphList add: priorMorph. ]. scroller addAllMorphs: morphList after: parentMorph. ^morphList ! |
On Wed, 26 Jun 2019, [hidden email] wrote:
> Patrick Rein uploaded a new version of Morphic to project The Inbox: > http://source.squeak.org/inbox/Morphic-pre.1490.mcz > > ==================== Summary ==================== > > Name: Morphic-pre.1490 > Author: pre > Time: 26 June 2019, 2:27:35.772055 pm > UUID: 95570b89-47fd-8e4f-86ec-f075734e1fb0 > Ancestors: Morphic-pre.1489 > > Fixes a defect preventing colored line items in pluggable tree morphs. The infrastructure was already in place (see StringMorph>>#contents:), however, the ListMorph overrides the determined color later. This changes this overriding to be more conservative to preserve any pre-determined color. > > =============== Diff against Morphic-pre.1489 =============== > > Item was changed: > ----- Method: SimpleHierarchicalListMorph>>addMorphsTo:from:allowSorting:withExpandedItems:atLevel: (in category 'private') ----- > addMorphsTo: morphList from: aCollection allowSorting: sortBoolean withExpandedItems: expandedItems atLevel: newIndent > > | priorMorph newCollection firstAddition | > priorMorph := nil. > newCollection := (sortBoolean and: [sortingSelector notNil]) ifTrue: [ > aCollection sorted: [ :a :b | > (a perform: sortingSelector) <= (b perform: sortingSelector)] > ] ifFalse: [ > aCollection > ]. > firstAddition := nil. > newCollection do: [:item | > priorMorph := self indentingItemClass basicNew > initWithContents: item > prior: priorMorph > forList: self > indentLevel: newIndent. > priorMorph What's the purpose of the ifNotNil: branch below? Levente > + color: (priorMorph color ifNil: [self textColor] ifNotNil: [:c | c]); > - color: self textColor; > font: self font; > selectionColor: self selectionColor; > selectionTextColor: self selectionTextColor; > hoverColor: self hoverColor; > highlightTextColor: self highlightTextColor; > filterColor: self filterColor; > filterTextColor: self filterTextColor. > firstAddition ifNil: [firstAddition := priorMorph]. > morphList add: priorMorph. > ((item hasEquivalentIn: expandedItems) or: [priorMorph isExpanded]) ifTrue: [ > priorMorph isExpanded: true. > priorMorph > addChildrenForList: self > addingTo: morphList > withExpandedItems: expandedItems. > ]. > ]. > ^firstAddition > > ! > > Item was changed: > ----- Method: SimpleHierarchicalListMorph>>addSubmorphsAfter:fromCollection:allowSorting: (in category 'private') ----- > addSubmorphsAfter: parentMorph fromCollection: aCollection allowSorting: sortBoolean > > | priorMorph morphList newCollection | > priorMorph := nil. > newCollection := (sortBoolean and: [sortingSelector notNil]) ifTrue: [ > aCollection sorted: [ :a :b | > (a perform: sortingSelector) <= (b perform: sortingSelector)] > ] ifFalse: [ > aCollection > ]. > morphList := OrderedCollection new. > newCollection do: [:item | > priorMorph := self indentingItemClass basicNew > initWithContents: item > prior: priorMorph > forList: self > indentLevel: parentMorph indentLevel + 1. > priorMorph > + color: (priorMorph color ifNil: [self textColor] ifNotNil: [:c | c]); > - color: self textColor; > font: self font; > selectionColor: self selectionColor; > selectionTextColor: self selectionTextColor; > hoverColor: self hoverColor; > highlightTextColor: self highlightTextColor; > filterColor: self filterColor; > filterTextColor: self filterTextColor. > morphList add: priorMorph. > ]. > scroller addAllMorphs: morphList after: parentMorph. > ^morphList > > ! |
In reply to this post by commits-2
Note that you do not need the ifNotNil: part Le mer. 26 juin 2019 à 14:27, <[hidden email]> a écrit : Patrick Rein uploaded a new version of Morphic to project The Inbox: |
All morphs should have a non-nil #color and so should priorMorph ... Hmm... Best, Marcel
|
We looked into this yesterday and IndentingListItemMorph having a nil #color
actually has a meaning which is: Inherit the color from the containing list morph. This might be questionable by itself but the fix at least restores this mechanism. Bests Patrick ________________________________________ From: Squeak-dev <[hidden email]> on behalf of Taeumel, Marcel Sent: Thursday, June 27, 2019 9:42:18 AM To: Robert via Squeak-dev Subject: Re: [squeak-dev] The Inbox: Morphic-pre.1490.mcz All morphs should have a non-nil #color and so should priorMorph ... Hmm... Best, Marcel Am 26.06.2019 20:43:32 schrieb Nicolas Cellier <[hidden email]>: Note that you do not need the ifNotNil: part Le mer. 26 juin 2019 à 14:27, <[hidden email]<mailto:[hidden email]>> a écrit : Patrick Rein uploaded a new version of Morphic to project The Inbox: http://source.squeak.org/inbox/Morphic-pre.1490.mcz ==================== Summary ==================== Name: Morphic-pre.1490 Author: pre Time: 26 June 2019, 2:27:35.772055 pm UUID: 95570b89-47fd-8e4f-86ec-f075734e1fb0 Ancestors: Morphic-pre.1489 Fixes a defect preventing colored line items in pluggable tree morphs. The infrastructure was already in place (see StringMorph>>#contents:), however, the ListMorph overrides the determined color later. This changes this overriding to be more conservative to preserve any pre-determined color. =============== Diff against Morphic-pre.1489 =============== Item was changed: ----- Method: SimpleHierarchicalListMorph>>addMorphsTo:from:allowSorting:withExpandedItems:atLevel: (in category 'private') ----- addMorphsTo: morphList from: aCollection allowSorting: sortBoolean withExpandedItems: expandedItems atLevel: newIndent | priorMorph newCollection firstAddition | priorMorph := nil. newCollection := (sortBoolean and: [sortingSelector notNil]) ifTrue: [ aCollection sorted: [ :a :b | (a perform: sortingSelector) <= (b perform: sortingSelector)] ] ifFalse: [ aCollection ]. firstAddition := nil. newCollection do: [:item | priorMorph := self indentingItemClass basicNew initWithContents: item prior: priorMorph forList: self indentLevel: newIndent. priorMorph + color: (priorMorph color ifNil: [self textColor] ifNotNil: [:c | c]); - color: self textColor; font: self font; selectionColor: self selectionColor; selectionTextColor: self selectionTextColor; hoverColor: self hoverColor; highlightTextColor: self highlightTextColor; filterColor: self filterColor; filterTextColor: self filterTextColor. firstAddition ifNil: [firstAddition := priorMorph]. morphList add: priorMorph. ((item hasEquivalentIn: expandedItems) or: [priorMorph isExpanded]) ifTrue: [ priorMorph isExpanded: true. priorMorph addChildrenForList: self addingTo: morphList withExpandedItems: expandedItems. ]. ]. ^firstAddition ! Item was changed: ----- Method: SimpleHierarchicalListMorph>>addSubmorphsAfter:fromCollection:allowSorting: (in category 'private') ----- addSubmorphsAfter: parentMorph fromCollection: aCollection allowSorting: sortBoolean | priorMorph morphList newCollection | priorMorph := nil. newCollection := (sortBoolean and: [sortingSelector notNil]) ifTrue: [ aCollection sorted: [ :a :b | (a perform: sortingSelector) <= (b perform: sortingSelector)] ] ifFalse: [ aCollection ]. morphList := OrderedCollection new. newCollection do: [:item | priorMorph := self indentingItemClass basicNew initWithContents: item prior: priorMorph forList: self indentLevel: parentMorph indentLevel + 1. priorMorph + color: (priorMorph color ifNil: [self textColor] ifNotNil: [:c | c]); - color: self textColor; font: self font; selectionColor: self selectionColor; selectionTextColor: self selectionTextColor; hoverColor: self hoverColor; highlightTextColor: self highlightTextColor; filterColor: self filterColor; filterTextColor: self filterTextColor. morphList add: priorMorph. ]. scroller addAllMorphs: morphList after: parentMorph. ^morphList ! |
On 28/06/19 1:22 PM, Rein, Patrick wrote:
> We looked into this yesterday and IndentingListItemMorph having a nil > #color actually has a meaning which is: Inherit the color from the > containing list morph. This might be questionable by itself but the > fix at least restores this mechanism. Does current color of a item's container a) *override* item's color while it is in the list, or b) *overwrite* item's color while it is in the list what happens to a Morph's color when it is removed from the list? Does it revert to its original color or will it retain its last color in the list? Regards .. Subbu |
Free forum by Nabble | Edit this page |