diff options
author | Havoc Pennington <hp@pobox.com> | 2000-09-30 17:08:25 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2000-09-30 17:08:25 +0000 |
commit | 632fda6f0bd578006226b29badcfb63729f5eba2 (patch) | |
tree | 3326ce59b9514267f898dbd4b1d7cd9f49517c7c /gtk/gtktextsegment.h | |
parent | f717bda19732f874762f2c48521d8370f15bf3f0 (diff) | |
download | gtk+-632fda6f0bd578006226b29badcfb63729f5eba2.tar.gz |
Handle NULL start/end pointers
2000-09-30 Havoc Pennington <hp@pobox.com>
* gtk/gtktextbtree.c (gtk_text_btree_get_selection_bounds): Handle
NULL start/end pointers
* gtk/gtktextbuffer.c: Write some docs
(gtk_text_buffer_get_selection_bounds): Allow start/end to be
NULL, so you can just check whether there's a selection.
* gtk/gtktextbtree.c (gtk_text_btree_remove_mark): No need to
cleanup_line or segments_changed ourselves, it gets done
in unlink_segment
* gtk/gtktextmark.h:
s/gtk_text_mark_deleted/gtk_text_mark_get_deleted/
* gtk/gtktextsegment.h: Clean up some indentation and naming mess
* gtk/gtktextmark.c: delete some more old Tk cruft
* gtk/gtktextbuffer.c (gtk_text_buffer_delete_mark): add ref to
mark before removing it, so we can emit MARK_DELETED with a valid
pointer.
(gtk_text_buffer_mark_set): hold ref across signal emission
* gtk/gtktextbtree.c (gtk_text_btree_remove_mark): improve
whining about attempts to delete special marks
* gtk/gtktextbuffer.c (_gtk_text_buffer_spew): Prepend with
underscore, since it's internal.
* gtk/gtktextbuffer.h: Remove find_string prototype, this is
now implemented in terms of iterators in gtktextiter.h
* gtk/gtktextbuffer.c (gtk_text_buffer_set_text):
New function, destructively sets contents of buffer. Also
a convenient way to clear the buffer by setting text to ""
* gtk/gtktextiter.c (gtk_text_iter_make_surreal): reformat
multiline string literal
* gtk/testtext.c (text_changed_callback): Redraw line numbers if
text changes.
* gtk/gtktextiter.c (forward_char): Return FALSE if new location
is not dereferenceable
(gtk_text_iter_forward_lines): fix return value
Diffstat (limited to 'gtk/gtktextsegment.h')
-rw-r--r-- | gtk/gtktextsegment.h | 55 |
1 files changed, 37 insertions, 18 deletions
diff --git a/gtk/gtktextsegment.h b/gtk/gtktextsegment.h index 844663d437..0dfd05630d 100644 --- a/gtk/gtktextsegment.h +++ b/gtk/gtktextsegment.h @@ -39,17 +39,36 @@ struct _GtkTextToggleBody { /* Class struct for segments */ -typedef GtkTextLineSegment *(* GtkTextLineSegmentSplitFunc) (GtkTextLineSegment *segPtr, - int index); -typedef gboolean (* GtkTextViewSegDeleteFunc) (GtkTextLineSegment *segPtr, - GtkTextLine *line, - gboolean treeGone); -typedef GtkTextLineSegment *(* GtkTextViewSegCleanupFunc) (GtkTextLineSegment *segPtr, - GtkTextLine *line); -typedef void (* GtkTextLineSegmentLineChangeFunc) (GtkTextLineSegment *segPtr, - GtkTextLine *line); -typedef void (* GtkTextViewSegCheckFunc) (GtkTextLineSegment *segPtr, - GtkTextLine *line); +/* Split seg at index, returning list of two new segments, and freeing seg */ +typedef GtkTextLineSegment* (*GtkTextSegSplitFunc) (GtkTextLineSegment *seg, + gint index); + +/* Delete seg which is contained in line; if tree_gone, the tree is being + * freed in its entirety, which may matter for some reason (?) + * Return TRUE if the segment is not deleteable, e.g. a mark. + */ +typedef gboolean (*GtkTextSegDeleteFunc) (GtkTextLineSegment *seg, + GtkTextLine *line, + gboolean tree_gone); + +/* Called after segment structure of line changes, so segments can + * cleanup (e.g. merge with adjacent segments). Returns a segment list + * to replace the original segment list with. The line argument is + * the current line. + */ +typedef GtkTextLineSegment* (*GtkTextSegCleanupFunc) (GtkTextLineSegment *seg, + GtkTextLine *line); + +/* Called when a segment moves from one line to another. CleanupFunc is also + * called in that case, so many segments just use CleanupFunc, I'm not sure + * what's up with that (this function may not be needed...) + */ +typedef void (*GtkTextSegLineChangeFunc) (GtkTextLineSegment *seg, + GtkTextLine *line); + +/* Called to do debug checks on the segment. */ +typedef void (*GtkTextSegCheckFunc) (GtkTextLineSegment *seg, + GtkTextLine *line); struct _GtkTextLineSegmentClass { char *name; /* Name of this kind of segment. */ @@ -58,17 +77,17 @@ struct _GtkTextLineSegmentClass { * attach to character to its left * or right? 1 means left, 0 means * right. */ - GtkTextLineSegmentSplitFunc splitFunc; /* Procedure to split large segment + GtkTextSegSplitFunc splitFunc; /* Procedure to split large segment * into two smaller ones. */ - GtkTextViewSegDeleteFunc deleteFunc; /* Procedure to call to delete + GtkTextSegDeleteFunc deleteFunc; /* Procedure to call to delete * segment. */ - GtkTextViewSegCleanupFunc cleanupFunc; /* After any change to a line, this + GtkTextSegCleanupFunc cleanupFunc; /* After any change to a line, this * procedure is invoked for all * segments left in the line to * perform any cleanup they wish * (e.g. joining neighboring * segments). */ - GtkTextLineSegmentLineChangeFunc lineChangeFunc; + GtkTextSegLineChangeFunc lineChangeFunc; /* Invoked when a segment is about * to be moved from its current line * to an earlier line because of @@ -77,7 +96,7 @@ struct _GtkTextLineSegmentClass { * CleanupFunc will be invoked after * the deletion is finished. */ - GtkTextViewSegCheckFunc checkFunc; /* Called during consistency checks + GtkTextSegCheckFunc checkFunc; /* Called during consistency checks * to check internal consistency of * segment. */ }; @@ -88,9 +107,9 @@ struct _GtkTextLineSegmentClass { struct _GtkTextLineSegment { GtkTextLineSegmentClass *type; /* Pointer to record describing - * segment's type. */ + * segment's type. */ GtkTextLineSegment *next; /* Next in list of segments for this - * line, or NULL for end of list. */ + * line, or NULL for end of list. */ int char_count; /* # of chars of index space occupied */ |