[squeak-dev] Re: displaying attributed characters on workspaces

Klaus D. Witzel klaus.witzel at cobss.com
Sat Jun 20 15:40:02 UTC 2009


On Sat, 20 Jun 2009 15:55:41 +0200, Ralph Boland wrote:

> I have some code that draws trees using  '|' and '-' characters to link  
> nodes in the tree.  For example:
...
> I have a number of problems when I display the tree in a workspace (or
> debugger for that matter).
>
> 1)  I need a fixed font so that symbols are properly aligned.
>      This problem can be seen in the above figure but the effect is
> worse in Squeak.
> 2)  I also need to add some additional information to my trees.
>      The addition information is text ('|' and '-' characters linking
> nodes in the tree)
>      and needs to be in color (Red) in order avoid making the figure
> too confusing.
>      Thus I need to display attributed characters.

As an example you can look how source methods are pretty printed with  
colors and tabs & breaks, see senders of

  #withStyleFor:do:
  #withColor:emphasis:do:

>  Workspaces can
> handle this but
>      I need for the 'printOn:'  method to handle them as well.
> 3)  I would like to add my own special characters to use instead of
> '|' and '-' so
>      that there are no gaps between these special characters when used  
> in my
>      tree drawings.  I know how the code works to draw the return and  
> assignment
>      arrows but I do not know if I need to use special fonts so that
> there are no forced
>      gaps between characters and lines of text and if so which ones.
>
> Is it possible for me to do these things and have my tree printed
> accordingly when
> my tree is displayed in a workspace (or debugger) resulting from a
> 'printOn: aStream'  message?

Looks complicated, why can't you do (myObject myPrintTree) ? I mean  
instead of hacking system-level debugger or support-level workspace ?

> I know that the stream I get when the printOn:  is invoked is a
> LimitedWriteStream.
> but not much more.
>
> If it is not possible to do these things then I will settle for
> displaying it in a Text Pane.
> I still need to know which font to use though.

Depends on what .image you're using, try this: select text in a method and  
do alt-k, that should bring up the list of fonts which are available.

HTH.

/Klaus

> The code is part of my implementation of the Spine Tree Decomposition
> data structure
> which I will release to www.squeaksource.com when it is completed.
>
> Any help most appreciated.
>
> Ralph Boland
>
>



-- 
"If at first, the idea is not absurd, then there is no hope for it".  
Albert Einstein




More information about the Squeak-dev mailing list