beaver-devel
[Top][All Lists]
Advanced

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

Re: [Beaver-devel] Line Numbering


From: Michael Terry
Subject: Re: [Beaver-devel] Line Numbering
Date: Mon, 17 Mar 2003 14:09:38 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3b) Gecko/20030224

Leslie Polzer wrote:
I have postponed the charset stuff until you have time to answer.

In the meanwhile I have made the GtkTextView's left window visible
and thought about the possibilities to display line numbers.
SciTE and Scintilla do it the easy way: they don't display partial lines
and scroll line by line.

I suggest we use Labels to display the numbers - font and size like those
used in the TextView. But how should we position them? With fixed ccordinates?
Should we meddle with things like gtk_text_view_get_line_at_y() ?

That seems reasonable.  Do:

gtk_text_view_window_to_buffer_coords (view, GTK_TEXT_WINDOW_TEXT, 0, 0, &x, &y);
gtk_text_view_get_line_at_y (view, &iter, y, &line_top);
line = gtk_text_iter_get_line (&iter);
gtk_text_view_buffer_to_window_coords (view, GTK_TEXT_WINDOW_TEXT, x, line_top, &x, &y);

Now, place the first label at y-height of y.

You could just keep placing labels from that point on without refering back to the buffer, but that gets hairy with word wrap. You could keep advancing the iter you got by a line and checking to see how far its 'y' went.

-mt

Attachment: pgp2WL1Xsz5MT.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]