The Inbox: Morphic-pre.1491.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Morphic-pre.1491.mcz

commits-2
A new version of Morphic was added to project The Inbox:
http://source.squeak.org/inbox/Morphic-pre.1491.mcz

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

Name: Morphic-pre.1491
Author: pre
Time: 27 June 2019, 2:15:55.295956 pm
UUID: 4b4c32a0-1907-0046-8d95-0b8adf1dcf6b
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]);
- 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]);
- 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
 
  !


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-pre.1491.mcz

marcel.taeumel
Hi all! :-)

I double-checked this. I don't think it is necessary.

In IndentingListItemMorph >> #colorToUse, the last line falls back to ListItemWrapper >> #preferredColor, which is the extension point for models via PluggableTreeViewSpec >> #nodeClass:.

You can try by changing ListItemWrapper >> #preferredColor from "nil" to "Color red". It just works as intended.

For the UI themes, I chose to use #color in instances of IndentingListItemMorph to hold the current theme's text color for items.

Best,
Marcel

Am 27.06.2019 14:16:17 schrieb [hidden email] <[hidden email]>:

A new version of Morphic was added to project The Inbox:
http://source.squeak.org/inbox/Morphic-pre.1491.mcz

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

Name: Morphic-pre.1491
Author: pre
Time: 27 June 2019, 2:15:55.295956 pm
UUID: 4b4c32a0-1907-0046-8d95-0b8adf1dcf6b
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:="">
] 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]);
- 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:="">
] 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]);
- 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

!




Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-pre.1491.mcz

patrick.rein
That is not what this fix provides. If you have a PluggableTree and you return a Text with a TextColor as a label for list items the color will not be rendered. With the fix below this works without requiring special classes or callbacks.

Bests
Patrick

Am 5. Juli 2019, 09:54, um 09:54, Marcel Taeumel <[hidden email]> schrieb:

>Hi all! :-)
>
>I double-checked this. I don't think it is necessary.
>
>In IndentingListItemMorph >> #colorToUse, the last line falls back to
>ListItemWrapper >> #preferredColor, which is the extension point for
>models via PluggableTreeViewSpec >> #nodeClass:.
>
>You can try by changing ListItemWrapper >> #preferredColor from "nil"
>to "Color red". It just works as intended.
>
>For the UI themes, I chose to use #color in instances
>of IndentingListItemMorph to hold the current theme's text color for
>items.
>
>Best,
>Marcel
>Am 27.06.2019 14:16:17 schrieb [hidden email]
><[hidden email]>:
>A new version of Morphic was added to project The Inbox:
>http://source.squeak.org/inbox/Morphic-pre.1491.mcz
>
>==================== Summary ====================
>
>Name: Morphic-pre.1491
>Author: pre
>Time: 27 June 2019, 2:15:55.295956 pm
>UUID: 4b4c32a0-1907-0046-8d95-0b8adf1dcf6b
>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:="">
>] 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]);
>- 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:="">
>] 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]);
>- 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
>
>!
>
>
>
>
>------------------------------------------------------------------------


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-pre.1491.mcz

marcel.taeumel
Hi Patrick,

do you mean a custom PluggableTree that uses a custom IndentingListItemMorph with its own #drawOn: that does not make use of #colorToUse? Yeah, the default version of #drawOn: (in StringMorph) does not make use of #colorToUse but only its own color.

Best,
Marcel

Am 07.07.2019 21:25:12 schrieb Patrick Rein <[hidden email]>:

That is not what this fix provides. If you have a PluggableTree and you return a Text with a TextColor as a label for list items the color will not be rendered. With the fix below this works without requiring special classes or callbacks.

Bests
Patrick

Am 5. Juli 2019, 09:54, um 09:54, Marcel Taeumel schrieb:
>Hi all! :-)
>
>I double-checked this. I don't think it is necessary.
>
>In IndentingListItemMorph >> #colorToUse, the last line falls back to
>ListItemWrapper >> #preferredColor, which is the extension point for
>models via PluggableTreeViewSpec >> #nodeClass:.
>
>You can try by changing ListItemWrapper >> #preferredColor from "nil"
>to "Color red". It just works as intended.
>
>For the UI themes, I chose to use #color in instances
>of IndentingListItemMorph to hold the current theme's text color for
>items.
>
>Best,
>Marcel
>Am 27.06.2019 14:16:17 schrieb [hidden email]
>:
>A new version of Morphic was added to project The Inbox:
>http://source.squeak.org/inbox/Morphic-pre.1491.mcz
>
>==================== Summary ====================
>
>Name: Morphic-pre.1491
>Author: pre
>Time: 27 June 2019, 2:15:55.295956 pm
>UUID: 4b4c32a0-1907-0046-8d95-0b8adf1dcf6b
>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:="">
>] 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]);
>- 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:="">
>] 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]);
>- 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
>
>!
>
>
>
>
>------------------------------------------------------------------------




Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-pre.1491.mcz

Karl Ramberg
In reply to this post by patrick.rein
Sounds reasonable  :-)


Best,
Karl

On Sun, 7 Jul 2019 at 21:25, Patrick Rein <[hidden email]> wrote:
That is not what this fix provides. If you have a PluggableTree and you return a Text with a TextColor as a label for list items the color will not be rendered. With the fix below this works without requiring special classes or callbacks.

Bests
Patrick

Am 5. Juli 2019, 09:54, um 09:54, Marcel Taeumel <[hidden email]> schrieb:
>Hi all! :-)
>
>I double-checked this. I don't think it is necessary.
>
>In IndentingListItemMorph >> #colorToUse, the last line falls back to
>ListItemWrapper >> #preferredColor, which is the extension point for
>models via PluggableTreeViewSpec >> #nodeClass:.
>
>You can try by changing ListItemWrapper >> #preferredColor from "nil"
>to "Color red". It just works as intended.
>
>For the UI themes, I chose to use #color in instances
>of IndentingListItemMorph to hold the current theme's text color for
>items.
>
>Best,
>Marcel
>Am 27.06.2019 14:16:17 schrieb [hidden email]
><[hidden email]>:
>A new version of Morphic was added to project The Inbox:
>http://source.squeak.org/inbox/Morphic-pre.1491.mcz
>
>==================== Summary ====================
>
>Name: Morphic-pre.1491
>Author: pre
>Time: 27 June 2019, 2:15:55.295956 pm
>UUID: 4b4c32a0-1907-0046-8d95-0b8adf1dcf6b
>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:="">
>] 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]);
>- 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:="">
>] 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]);
>- 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
>
>!
>
>
>
>
>------------------------------------------------------------------------