Re: canvas rich text widget?



On 1 Feb 2001, Havoc Pennington wrote:

> There is an unavoidable size-speed tradeoff with a text buffer like
> this. There are quite a few places where you can draw the line, but
> the tradeoff is unavoidable; either you are slow in lots of cases but
> use minimal RAM, or you are fast in lots of cases and use more RAM.

	Quite true.  I, of course, would like it to work very fast.  Speed
is essential for what I have in mind, so it sounds good to me.

> The GTK widget tries to balance size vs. speed nicely, but of course
> some people will disagree with the correct balance. In any case, don't
> think you can just shrink the widget without speed/feature penalties.
> Or that you can add features/speed without growing the widget
> further. ;-) No free lunches.

	And I have, in general, found the speed/size decisions of the Gtk+
team to be pretty good.  I will assume the same here, for now. :-)

> You shouldn't need to touch Pango. You can use all the text widget
> files except for gtktreeview.h, gtktreeview.c. The rendering and such
> is abstracted into gtktextlayout.h, gtktextdisplay.h. You simply need
> to write a canvas item which uses the backend in the same way as the
> GtkTreeView widget.
> 
> The GtkTreeView frontend is 6,000 semicolon-terminated lines of code
> you have to duplicate in the canvas item, but the total text widget is
> 25,000 "grep ';'" lines of code, so you are saving yourself 20K lines
> or so by reusing the backend, which is a fair amount of work to
> save. ;-)

	Oooh... and the code is already intended for use in the text canvas
item.  How nice.  :-)

	Since this is already intended for a canvas item, but the GtkCanvas
does not yet exist (at least, I didn't see any files for it in the gtk+ cvs
tree), what should I take into account so you all can use this with little
or no modification once the canvas is in place?  Since this is a fairly
low-level widget, I don't plan on using any of the gnome functions from
within it; also no gtk+ functions, and since it's using pango probably few
gdk functions directly.  Is there anything else I should keep in mind?

	Or does a GtkCanvas already exist somewhere, and this already exist
as an item for it which I could simply use? :-)

> Havoc

- Bibek





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