Re: [gtk-list] gtktext and other stuff



Arun,
  I started working on the Text widget last week.  I've already got it
editing, and I'm now working on line cache pruning.  The best way to
do the scrollbars is to write a container widget which contains the text
widget, and two scrollbars.  It's important to do it this way because you
can directly control the size request, eliminating those "all the way up
the container chain" resizes when you hide the scrollbar.  

  I have run into a few problems with the background pixmap
implimentation.  When a line changes size, or you hit "enter", the lines
below are moved down with a gdk_draw_pixmap.  Background pixmaps are
handled specially for the text widget, with it's own pixmap tileing
routine.  This is done so the pixmap will scroll with the text, instead of
the text scrolling over a fixed pixmap.  This works until you want to
reduce flickering and redraws using the pixmap drawing, destroying the
tileing.  However, this whole technique leaves somthing to be desired.  I
think the best thing to do is replace this code.  By creating a extra
parent window, the text window can be allocated exatly one tile wider and
longer than the displayed size, and placed inside the parent window.  Then
a background pixmap can be set for the window, and a combination of
gdk_window_move(s) and gdk_draw_pixmap(s) can be used to scroll with the
same effect.  I think it would probably even be faster, and less work to
code.

-----------------------------------------------------------------------
Jay Painter -- jpaint@serv.net -- jpaint@gimp.org -- jpaint@real.com
http://www.serv.net/~jpaint

On 12 Jan 1998, Arun Sharma wrote:

> Hi,
> 
> I've been spending the last couple of days looking at ways to make
> gtktext work. After reading the code a couple of times, I have a rough
> idea of how the widget works.
> 
> Here's is what I think about it:
> 
> 1. As things stand now, one needs to call gtk_widget_realize before
>    calling gtk_text_insert (at least testgtk.c does). I've removed
>    this unnecessary restriction. In my book, the widget should be as
>    easy to use as:
> 
> 	gtk_text_new()
> 	gtk_text_insert()
> 	gtk_widget_show()
> 
> 2. The scroll bars should be automatic from the widget user's point of
>    view i.e. one doesn't have to explicitly create and attach them.
> 
> 3. Is there a reason why text->cursor_mark exists ? I think it's
>    duplicating text->point. Am I missing something here ?
> 
> Also, I tried integrating Python-gtk bindings with gnome. I have a
> Makefile that works (attached) and am unable to write a Makefile.am
> that does the same. Can someone help ? Having a leading underscore in
> "_gtkmodule.so" seems to be a problem with automake.
> 
> 	-Arun
> 
> ----
> SWIG=swig -nocomment -python -I swig
> CC=gcc
> CFLAGS=-s -pipe -fPIC -I/usr/include/python1.4
> LIBS=-L/usr/X11/lib -lglib -lgdk -lgtk -lX11 -lm -lXext
> INTERFACES=gtk.i swig/*.i
> 
> all: _gtkmodule.so
> 
> gtk_wrap.c: $(INTERFACES)
>         $(SWIG) gtk.i
> 
> _gtkmodule.so: gtk_wrap.o
>         $(CC) -shared gtk_wrap.o -o _gtkmodule.so $(LIBS)
> 
> -- 
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
> 
> 



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