Re: GtkTexTag utility functions



On 3 May 2001, Havoc Pennington wrote:

> 
> Gustavo Joćo Alves Marques Carneiro <ee96090 fe up pt> writes:
> >   I find these functions useful, so maybe others will too. Can they be
> > included in GTK?
> > 
> 
> Can you give some more details on why/when you are using them? It
> isn't obvious to me why you want to do this, I would imagine instead
> either sharing a tag table, or having a function:
> 
> GtkTextTag*
> create_foo_tag (buffer)
> {
>   return gtk_text_buffer_create_tag (..........);
> }
> 
> Which you then call to get a tag.
> 
> How are you structuring your app?
> 
> It probably makes sense to have these functions on the general "value-like
> objects should be copiable" principle, but I'd like to understand
> better when they are used.

  I'm trying to implement syntax highlighting.  I have a 'syntax
table' structure that holds a list of syntax elements.  Each syntax
element has a GtkTextTag to store the text style to apply, a name and a
one or two matching functions.
  I am going to use a syntax table in an object called 'console view' that
has a vpaned with two text buffers (one for editing text and another to
display the results).  The syntax table is shared, so I want to use it
with multiple console views, and each view has two GtkTextBuffer's.
  Before I use any of the tags from the elements, they would have to
belong to the GtkTextBuffer's tag table. But I'm going to  use them at
more than one buffer, so they must be copied.

  But yes, I see what you mean, the text buffers can share a single tag
table, but I don't feel very well about constraining all the text buffers
to using the same tag table.  But yes, I probably could share a single tag
table, for now, but I can't predict the future and later on I might be
forced for some reason to not share a single tag table. 


> 
> Havoc
> 

-- 
Gustavo J. A. M. Carneiro
[http://linuxdeec.fe.up.pt/~ee96090]





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]