Re: [gtk-list] Gtk_Text customization?



Some Guy <guy@mikepery.pr.mcs.net> writes:
> I was playing around with the text widget and thinking about making a
> C/C++ IDE in Gtk(--).  I have two ideas for it that would require the
> text widget to be more customizable (I think, unless it has features I
> don't know about).  Here are my ideas:
> 
> - adjustable tab length: I hacked my text editor (pico) for this, and
>     it's my favorite feature. All this is is just how many spaces are
>     placed for a tab character (ex: i set the tab length to 4, and
>     whenever a tab shows up, it takes up 4 char lengths, as opposed
>     to 8). This is not substituting spaces in place of tabs, its just
>     how long each tab character is displayed as.
> - comment links: I've never actually tried this, but in theory I think
>     it would be neat if you could put comments in links to text.  It
>     would be a hotlink just like in an HTML browser, and when you click
>     on the text, the comment pops up (it could be embedded in the source
>     code in the for of a comment like /*@link@(<x>, <y>) <comment> */)

These things will probably need to be implemented in low level - and
the implementation will rely quite much on how well the gtk's text
widget is implemented. Worst case, might need to rewrite the whole
drawing engine... Hopefully there's easier way - might also need to add
some public interfaces to GtkText... I dunno, I havent looked into
GtkText widget at all..

(though, if GtkText is well implemented, there would be hooks/virtual methods
in place to override things in smaller pieces..)

> Is the text widget capable of handling these features? 

No idea. Reading source of gtk will probably help about this.

> Or do I have to
> extend it and add these features myself? If so, how easy would that be
> (using gtk--)? If anyone has any ideas on how to implement these two,
> please tell me.

Can always override the low level events in the derived class and try
deal with the changes using that, if they're needed. The problem
becomes then that how much of the GtkText's code need to be cut/pasted
just because of minor change. Anyway, reading through GtkText's code
is next thing to do.

-- 
-- Tero Pulkkinen -- terop@modeemi.cs.tut.fi --



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