gtk-mailund-980720-0.patch
- From: Thomas Mailund Jensen <mailund daimi aau dk>
- To: gtk-list redhat com
- Subject: gtk-mailund-980720-0.patch
- Date: 21 Jul 1998 17:46:25 +0200
This patch contains enhancements of an earlier patch
(gtk-mailund-980713-0), and the optimisations of the text widget found
in gtk-mailund-980718-0.
Small extension of gtk-mailund-980713-0.patch:
==============================================
This patch adds user data to text properties in gtktext, thus making
it possible to associate abitrary data to sections of the text. This
can be usefull when e.g. associating links from parts of the text to
other parts or other files (html links, comments which can be
hidden/show with double-clicks etc.).
See gtk-mailund-980720-0.editor or later for an example.
A gpointer to user_data is added to the text property struct, and three
functions is added to the GtkText struct:
/* Comparison of text property user data. If NULL (default) user
* data pointers are compared. The function must return true for
* equal and false for no equal. */
gboolean (* compare_data) (gpointer, gpointer);
/* Used for making a copy of user data. If this function is NULL,
* the pointer is simply copied. WARNING: This is *not* a good
* idear if you afterwards delete properies! The clone and free
* function should work together, not against each other. */
gpointer (* clone_data) (gpointer);
/* Destructor for user data. If NULL g_free is used. */
void (* free_data) (gpointer);
These are used for more complex user data. If these are not specified
comparison is done on the gpointes, clone_data copies pointers, and
g_free is used to free user_data. Therefore, if properties are ever
deleted, at least one of clone_data or free_data should be provided.
The two functions
void gtk_text_set_property_data (GtkTextProperty *prop,
gpointer user_data);
gpointer gtk_text_get_property_data (GtkTextProperty *prop);
is used to access the user data, and the function
void gtk_text_insert_with_data (GtkText *text,
GdkFont *font,
GdkColor *fore,
GdkColor *back,
gpointer data,
const char *chars,
gint length);
is used for inserting text associated to user data.
The function gtk_text_insert is now a wrapper which calls
gtk_text_insert_with_data, with data == NULL. It is kept for
compatibility.
This patch also creates a better interface to the text properties.
The function gtk_text_get_property_length () returns the property
length,
guint gtk_text_get_property_length (GtkTextProperty *prop);
while the function gtk_text_set_property ()
void gtk_text_set_property (GtkText *text,
guint from,
guint to,
GdkFont *font,
GdkColor *fore,
GdkColor *back,
gpointer data);
makes it possible to change the property of an interval of text.
WARNING: I fear this function messes up the marks or something, but I
am not sure. It leaves the properties in perfect order, but I have
experienced segmentation faults afterwards, because a marks property
suddently is NULL. Whether this is because of an error in this
function, or the function just provokes it, I don't know.
gtk-mailund-980718-0.patch
==========================
Optimisation of advance_mark_n and decrese_mark_n by jumping in
intervals corresponding to property lengths.
Optimisation of find_mark_near by using the new
{advance,decrese}_mark_n.
/mailund
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]