If we have never seen a GtkTextTag in the GtkTextTagTable with the
invisible bit set, then we do not need to go through the process of
checking the accumulated tags.
Not using invisible tags is overwhelmingly the common case.
Sprinkle various g_assert() around the code where gcc cannot figure out
on its own that a variable is not NULL and too much refactoring would be
needed to make it do that.
Also fix usage of g_assert_nonnull(x) to use g_assert(x) because the
first is not marked as G_GNUC_NORETURN because of course GTester
supports not aborting on aborts.
This changes gtk_text_buffer_insert_texture() to
gtk_text_buffer_insert_paintable() which is strictly more useful
(as textures are paintables). It also fixes the code to actually
support drawing the paintables (as well as tracking changes
to the paintables.
This affects a few apis, such as gtk_text_iter_get_pixbuf,
gtk_text_buffer_insert_pixbuf and GtkTextBuffer::insert-pixbuf,
which have all been replaced by texture equivalents.
Update all callers.
Use GSlice to allocate all types of segments:
- char
- toggle
- mark
- pixbuf
- child widget
Char segments are a bit more complicated because the length of the text
is determined at run time and stored in the 'byte_count' field. If the
text is long, GSlice will call the system malloc() anyway, so it's
better to always use GSlice for GtkTextLineSegment.
Toggle segments are also freed in gtktextbtree.c, hence the function
_gtk_toggle_segment_free() (for a later commit it would be nice to
rename those functions with the _gtk_text prefix).
https://bugzilla.gnome.org/show_bug.cgi?id=727908
Especially the gtk_*_type ones in gtktexttypes.h were mentioned in
gtk.symbols presumably by accident. That header isn't even installed,
so no way can they be supposed to be public.
gtk_text_attr_appearance_type is from the installed but "semi-private"
gtktextlayout.h, so drop that one too from gtk.symbols for now.
The use of gtk_text_unknown_char_utf8 is bit of a mess. Code in a few
files knew implicitly that it is three bytes. Define a symbolic name
for the length of it instead. Add an exported function
gtk_text_unknown_char_utf8_gtk_tests_only() that returns a pointer to
it just for the sake of gtk/tests/textbuffer.c. Prefix the variable
with an underscore.
I doubt the usefulness of the test_utf8() in textbuffer.c. If it could
be dropped, gtk_text_unknown_char_utf8_gtk_tests_only() could be
dropped, too.
Preferrably should be made just into a local variable for libgtk like
_gdk_debug_flags for libgdk. But for now used by
gtk/tests/textbuffer.c and modules/printbackends/cups/gtkprintbackendcups.c.
2007-11-15 Yevgen Muntyan <muntyan@tamu.edu>
* gtk/gtktextbtree.h:
* gtk/gtktextbtree.c: new functions _gtk_text_btree_get_insert()
and _gtk_text_btree_get_selection_bound() (#497102).
* gtk/gtktextbuffer.c (gtk_text_buffer_get_insert),
(gtk_text_buffer_get_selection_bound): use them here instead of
hash table lookup.
svn path=/trunk/; revision=18996
2007-10-26 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (_gtk_text_btree_char_is_invisible):
Pay attention to tags that turn invisibility off as well
as tags that turn invsibility on. (#488051, Mathias Hasselmann)
svn path=/trunk/; revision=18949
2007-06-01 Yevgen Muntyan <muntyan@tamu.edu>
Avoid recreating pangolayouts in GtkTextView on cursor movement
(#435405, Behdad Esfahbod).
* gtk/gtktextlayout.c:
* gtk/gtktextlayout.h: new GtkTextLayout method invalidate_cursors(),
and functions gtk_text_layout_invalidate_cursors() and
gtk_text_layout_cursors_changed(), to use when invalidation is due
to moved marks or changed selection.
* gtk/gtktextbtree.c:
* gtk/gtktextbtree.h: use what's appropriate when invalidating layout.
* gtk/gtk.symbols: add new functions.
* README.in: added a note about changed GtkTextLayout API.
svn path=/trunk/; revision=18000
2007-05-25 Matthias Clasen <mclasen@redhat.com>
Allow to separate GtkTextMark creation from buffer insertion.
(#132818, Gustavo Giráldez, patch by Yevgen Muntyan)
* gtk/gtktextmarkprivate.h:
* gtk/gtktextmark.[hc] (gtk_text_mark_new): New function to
create a GtkTextMark.
* gtk/gtktextbuffer.[hc] (gtk_text_buffer_add_mark): New
function to add an existing mark to a buffer.
* gtk/gtktextbtree.c: Allow adding existing marks.
* gtk/gtk.symbols: Add new functions.
* tests/testtextbuffer.c: Add some tests for new mark
functionality.
svn path=/trunk/; revision=17922
2007-02-15 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktextbtree.c (_gtk_text_btree_delete): Free the lines
even if there are no views. (#408018, Albert Huang)
svn path=/trunk/; revision=17302
2006-05-13 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktextbtree.c:
* gtk/gtktextview.c: Move some asserts to the right
place. (#341661, #341665, Pascal Terjan)