Re: advice on implementing "elastic tabstops" for GTK+ 2.x?



On 15/10/06, Owen Taylor <otaylor redhat com> wrote:
On Sun, 2006-10-15 at 18:07 +0200, Nick Gravgaard wrote:
> Hi all,
>
> I would like to implement an idea I call "elastic tabstops" (see
> nickgravgaard.com/elastictabstops/) for GTK+ 2.x. Could someone advise
> me on whether support for this should be added to an exisiting widget
> (GtkTextView?), or if another approach should be used?

Because the effect is non-local - the contents of one paragraph effect
the drawing (and line wrapping?) of previous/following paragraphs, you'd
certainly have to change the GtkTextView code to make GtkTextView show
that effect. A GtkTextView uses a PangoLayout per paragraph.

(Nobody uses GtkTextView for editing source code directly, but the
GtkSourceView subclass is used for that extensively. That's a separate
project from GTK+.)

If you also wanted to get the effect for multi-line GtkLabels then you'd
have to also implement support for it inside Pango, since a GtkLabel
uses a single PangoLayout with multiple paragraphs in it.

GtkTextView and GtkLabel are the only GTK+ widgets that show multiple
lines of text.

For both GtkTextView and PangoLayout I think you'd find the job a bit
challenging. (Think days or weeks, not hours.) There is a lot of
existing complexity in both of them you'd have to integrate with. But
possible? I don't see why not.

Thanks for the reply.

Ideally I'd like to write the code in a modular way so that it can be
easily added to any GTK multi-line text widget, but I'm still at the
exploratory stage so I don't know if such an approach is possible. It
would be great if I could write something that could be used by
GtkTextView, GtkSourceView and whatever widget Vim uses...



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