Some ideas about GtkText



What I will here suggest may be very hard to code, but I think those idead
are good, so I give them.

I think that the user should choose the flavor of his text editor, and not
the application or library programmer.

What I suggest is that the GtkText class should be an almost abstract
class, with private subclasses that implement text editors with various
flavors.

A text widget would be created using:

GtkWidget * gtk_text_new(GtkTextType    power,
			 const gchar   *hint,
			 GtkAdjustment *h_adj,
			 GtkAdjustment *v_adj);

Where:
typedef enum {
  GTK_TEXT_SIMPLE,
  GTK_TEXT_MEDIUM,
  GTK_TEXT_POWERFUL
} GtkTextType;

The application programmer uses GTK_TEXT_SIMPLE for a text entry that's
only needed for a short text (let's say: an entry in an addressbook),
MEDIUM for something larger, but that needs to load quickly (to edit an
article in a news reader, by example), and POWERFUL for complexes tasks
where load time is not a problem (the editor of an IDE).

The user can bind each type by setting an environment variable (or
something else):
export GTK_TEXT_SIMPLE=GtkTextClassic
export GTK_TEXT_MEDIUM=GtkTextVIM
export GTK_TEXT_POWERFUL=GtkTextDL:/usr/local/lib/libgtkemacs.so,gtk_emacs;

Then, gtk_text_new should check the user preference, and build an instance
of the good widget.
The core Gtk lib should include a basic text widget, a more powerful one,
and a system to dynamically load external text widgets (maybe a portability
problem here ?).

Each effective text widget would get an user argument text (that replaces
the command line switches) from the environment variable, and an
application hint that inform the widget about some properties of the text:
"type=makefile" could be an example.

With that system, each user can use his favorite editor for each task, and
the Gtk developpers don't have to take part in the Vi-Emacs war.

Of course, it's a huge work, but I really think it's not all bad.



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