Hi All,
May I ask you, how is it done that Traits' method names are displayed in italic? I cannot find a code which do this.
Thank you in advance, Juraj
Hello Juraj,
the code you are looking for is in OBMethodNode>>displayString. There the text attribute TextEmphasis italic is added when the selector belongs to a trait (= is not local)
Regards Robert
Am 23.06.2007 um 17:29 schrieb Juraj Kubelka:
Hi All,
May I ask you, how is it done that Traits' method names are displayed in italic? I cannot find a code which do this.
Thank you in advance, Juraj
Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Hello Robert,
Thank you!
I am playing with OB and I tried to make a filter which should display Traits' names with bold text. But it doesn't work. It displays prefix '(t) ' but nothing more. I have no idea where is the mistake. Do you have any idea? I can file out the filter class, if you wish.
displayString: aString forNode: aNode (aNode isKindOf: OBClassNode) ifFalse: [^ aString]. ^ ((aNode theClass respondsTo: #isTrait) and: [ aNode theClass isTrait ]) ifTrue: [('(t) ', aString) asText addAttribute: TextEmphasis bold ] ifFalse: ['(c) ', aString].
Thank you in advance, Juraj
On 23.6.2007, at 18:32, Robert Krahn wrote:
Hello Juraj,
the code you are looking for is in OBMethodNode>>displayString. There the text attribute TextEmphasis italic is added when the selector belongs to a trait (= is not local)
Regards Robert
Am 23.06.2007 um 17:29 schrieb Juraj Kubelka:
Hi All,
May I ask you, how is it done that Traits' method names are displayed in italic? I cannot find a code which do this.
Thank you in advance, Juraj
Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Hello Juraj,
From where do you call #displayString:forNode: ?
Am 23.06.2007 um 19:11 schrieb Juraj Kubelka:
Hello Robert,
Thank you!
I am playing with OB and I tried to make a filter which should display Traits' names with bold text. But it doesn't work. It displays prefix '(t) ' but nothing more. I have no idea where is the mistake. Do you have any idea? I can file out the filter class, if you wish.
displayString: aString forNode: aNode (aNode isKindOf: OBClassNode) ifFalse: [^ aString]. ^ ((aNode theClass respondsTo: #isTrait) and: [ aNode theClass isTrait ]) ifTrue: [('(t) ', aString) asText addAttribute: TextEmphasis bold ] ifFalse: ['(c) ', aString].
Thank you in advance, Juraj
On 23.6.2007, at 18:32, Robert Krahn wrote:
Hello Juraj,
the code you are looking for is in OBMethodNode>>displayString. There the text attribute TextEmphasis italic is added when the selector belongs to a trait (= is not local)
Regards Robert
Am 23.06.2007 um 17:29 schrieb Juraj Kubelka:
Hi All,
May I ask you, how is it done that Traits' method names are displayed in italic? I cannot find a code which do this.
Thank you in advance, Juraj
Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Hello Robert,
It is a standard OB filter subclassed from OBFilter. It is added to OBCodeBrowser metagraph. There are source codes in attachment.
Best regards, Juraj
On 23.6.2007, at 19:34, Robert Krahn wrote:
Hello Juraj,
From where do you call #displayString:forNode: ?
Am 23.06.2007 um 19:11 schrieb Juraj Kubelka:
Hello Robert,
Thank you!
I am playing with OB and I tried to make a filter which should display Traits' names with bold text. But it doesn't work. It displays prefix '(t) ' but nothing more. I have no idea where is the mistake. Do you have any idea? I can file out the filter class, if you wish.
displayString: aString forNode: aNode (aNode isKindOf: OBClassNode) ifFalse: [^ aString]. ^ ((aNode theClass respondsTo: #isTrait) and: [ aNode theClass isTrait ]) ifTrue: [('(t) ', aString) asText addAttribute: TextEmphasis bold ] ifFalse: ['(c) ', aString].
Thank you in advance, Juraj
On 23.6.2007, at 18:32, Robert Krahn wrote:
Hello Juraj,
the code you are looking for is in OBMethodNode>>displayString. There the text attribute TextEmphasis italic is added when the selector belongs to a trait (= is not local)
Regards Robert
Am 23.06.2007 um 17:29 schrieb Juraj Kubelka:
Hi All,
May I ask you, how is it done that Traits' method names are displayed in italic? I cannot find a code which do this.
Thank you in advance, Juraj
Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
It is a standard OB filter subclassed from OBFilter. It is added to OBCodeBrowser metagraph. There are source codes in attachment.
Have a look at OB-Refactory, it uses filters to show elements within an environment in bold:
displayString: aString forParent: aParentNode child: aNode "Display elements that are part of the environment in bold." ^ (mode = #highlight and: [ aNode withinBrowserEnvironment: environment ]) ifTrue: [ Text string: aString attribute: TextEmphasis bold ] ifFalse: [ aString ]
Lukas
Hello Juraj,
the reason why your code doesn't work is located in OBClassSortFilter>>displayString:forParent:child: . This filter is evaluated after the OBTraitColorFilter. The string which is passed to this method is your created Text. But in this method a new String (which is a ByteString) is constructed. There your text attribute is lost.
If I have some time later on I will look for a workaround.
Regards Robert
Hello Juraj
If you replace String with Text in OBClassSortFilter>>displayString:forParent:child: everything works fine. But thats quite dirty. I think something general should be changed with the handling of those displayString methods. On the one hand sometimes Text-objects are used (and needed for the attributes). On the other hand the variables which refer to those objects are named aString and sometimes they are Strings.
Best, Robert
Hi Robert,
thank you a lot. I will think about better handling of those methods. It is possible to use TextEmphasis>>bold now but TextColor>>green attribute doesn't work.
Best regards, Juraj
On 23.6.2007, at 22:05, Robert Krahn wrote:
Hello Juraj
If you replace String with Text in OBClassSortFilter>>displayString:forParent:child: everything works fine. But thats quite dirty. I think something general should be changed with the handling of those displayString methods. On the one hand sometimes Text-objects are used (and needed for the attributes). On the other hand the variables which refer to those objects are named aString and sometimes they are Strings.
Best, Robert _______________________________________________ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Am 24.06.2007 um 00:44 schrieb Juraj Kubelka:
It is possible to use TextEmphasis>>bold now but TextColor>>green attribute doesn't work.
Yes, thats why the standard colors in LazyListMorph overwrite your chosen color. LazyListMorph >>display: atRow:on: looks like that:
display: item atRow: row on: canvas "display the given item at row row" | drawBounds | drawBounds := self drawBoundsForRow: row. drawBounds := drawBounds intersect: self bounds. item isText ifTrue: [ canvas drawString: item in: drawBounds font: (font emphasized: (item emphasisAt: 1)) color: (self colorForRow: row) ] ifFalse: [ canvas drawString: item in: drawBounds font: font color: (self colorForRow: row) ].
The item is your displayString but the color is changed to LazyListMorph >>colorForRow: which turns out to be the follow:
colorForRow: row ^(selectedRow notNil and: [ row = selectedRow]) ifTrue: [ Color red ] ifFalse: [ self color ].
It seems that those things are really in the guts of the system and because of that they cannot be parameterized easily (yet).
Sorry, I don't want to spam you but I thought about a possible solution for that issue.
The first thing one could do is to subclass LazyListMorph to have a Morph which permits the displayStrings to keep their color. Then there is the need for a new PluggableListMorph which overrides PluggableListMorph >>listMorphClass to get this subclass of LazyListMorph. The next thing is to construct another OBMorphBuilder which changes #listMorphForColumn:.
Then a new builder exists which delivers browsers with the wanted property. I don't know if there are other classes which have to be changed (OBPane?) or if there is an easier solution. Please give me your opinion.
Robert
Am 24.06.2007 um 02:18 schrieb Robert Krahn:
Am 24.06.2007 um 00:44 schrieb Juraj Kubelka:
It is possible to use TextEmphasis>>bold now but TextColor>>green attribute doesn't work.
Yes, thats why the standard colors in LazyListMorph overwrite your chosen color. LazyListMorph >>display: atRow:on: looks like that:
display: item atRow: row on: canvas "display the given item at row row" | drawBounds | drawBounds := self drawBoundsForRow: row. drawBounds := drawBounds intersect: self bounds. item isText ifTrue: [ canvas drawString: item in: drawBounds font: (font emphasized: (item emphasisAt: 1)) color: (self colorForRow: row) ] ifFalse: [ canvas drawString: item in: drawBounds font: font color: (self colorForRow: row) ].
The item is your displayString but the color is changed to LazyListMorph >>colorForRow: which turns out to be the follow:
colorForRow: row ^(selectedRow notNil and: [ row = selectedRow]) ifTrue: [ Color red ] ifFalse: [ self color ].
It seems that those things are really in the guts of the system and because of that they cannot be parameterized easily (yet). _______________________________________________ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
beginners@lists.squeakfoundation.org