diff options
author | Havoc Pennington <hp@redhat.com> | 2001-05-07 15:58:47 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2001-05-07 15:58:47 +0000 |
commit | b4e4a0ed9d66132efad0539bc5901b35ea262d88 (patch) | |
tree | 7eea37afc0c2f32334112872547373758ac7d6b6 /gtk/gtktextbuffer.c | |
parent | 607ac1e1b31dc21598830a22930bcc39a77cb5c3 (diff) | |
download | gtk+-b4e4a0ed9d66132efad0539bc5901b35ea262d88.tar.gz |
fix some shell typos
2001-05-04 Havoc Pennington <hp@redhat.com>
* configure.in: fix some shell typos
* gtk/gtkcolorsel.c (gtk_color_selection_destroy): warning fix
* gtk/gtkimage.c: handle animations
* gtk/gtkcheckbutton.c (gtk_check_button_size_request): request
border_width * 2, not just border_width
* gtk/gtkscale.c: add "format_value" signal to allow people
to override the way values are drawn.
(gtk_scale_get_value_size): fix width/height mistake,
and compute size from actual displayed text, not
from made-up text.
* gtk/gtktexttag.c (gtk_text_tag_class_init): fix return type in
signal registration
* tests/testtext.c: Add "Remove all tags" menu item for testing
* gtk/gtktextbuffer.c (gtk_text_buffer_remove_all_tags): implement
* demos/gtk-demo/main.c (main): add hack so we can find modules
without installing gtk
* demos/gtk-demo/textview.c (insert_text): demo font scaling
* gtk/gtkcellrenderertext.c: Add "scale" property (font scaling
factor)
(gtk_cell_renderer_text_set_property): remove some bogus
g_object_notify
* gtk/gtktexttag.c: add "scale" property which is a font scaling
factor
* gtk/gtktextlayout.c (add_text_attrs): add font scale attribute
to layout
* gtk/gtktextiter.c (gtk_text_iter_is_start): rename from
gtk_text_iter_is_first
2001-05-04 Havoc Pennington <hp@redhat.com>
* pixops/pixops.c (pixops_process): merge fix from stable: Patch
from hoshem@mel.comcen.com.au to fix nonzero X offsets. Fixes
bug #50371.
* gdk-pixbuf/pixops/pixops.c (pixops_composite_nearest): merge
from stable: Patch from OKADA Mitsuru <m-okada@fjb.co.jp> to fix
confusion of using "src" instead of "p".
(pixops_composite_color_nearest): Use a more accurate (and
correct, to begin with) compositing method. This cures checks
showing through on images with no alpha.
* gdk-pixbuf.c (gdk_pixbuf_fill): fix bug that left some trailing
bytes unfilled.
* gdk-pixbuf-io.h: fix UpdatedNotifyFunc to use signed ints
* gdk-pixbuf-loader.h (struct _GdkPixbufLoaderClass): Change
area_updated signal to use signed ints. Removed animation-related
signals.
* io-gif.c, io-gif-animation.h, io-gif-animation.c: Massive
rewrite action
* gdk-pixbuf-animation.c: Add GdkPixbufAnimationIter to abstract
all the pesky details. Remove old frame-based API. Make
GdkPixbufAnimation an abstract base class, derived by the loaders.
Diffstat (limited to 'gtk/gtktextbuffer.c')
-rw-r--r-- | gtk/gtktextbuffer.c | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/gtk/gtktextbuffer.c b/gtk/gtktextbuffer.c index 1074ca0f9a..2e30d026ac 100644 --- a/gtk/gtktextbuffer.c +++ b/gtk/gtktextbuffer.c @@ -2106,6 +2106,127 @@ gtk_text_buffer_remove_tag_by_name (GtkTextBuffer *buffer, gtk_text_buffer_emit_tag (buffer, tag, FALSE, start, end); } +static gint +pointer_cmp (gconstpointer a, + gconstpointer b) +{ + if (a < b) + return -1; + else if (a > b) + return 1; + else + return 0; +} + +/** + * gtk_text_buffer_remove_all_tags: + * @buffer: a #GtkTextBuffer + * @start: one bound of range to be untagged + * @end: other bound of range to be untagged + * + * Removes all tags in the range between @start and @end. Be careful + * with this function; it could remove tags added in code unrelated to + * the code you're currently writing. That is, using this function is + * probably a bad idea if you have two or more unrelated code sections + * that add tags. + **/ +void +gtk_text_buffer_remove_all_tags (GtkTextBuffer *buffer, + const GtkTextIter *start, + const GtkTextIter *end) +{ + GtkTextIter first, second, tmp; + GSList *tags; + GSList *tmp_list; + GSList *prev; + GtkTextTag *tag; + + g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer)); + g_return_if_fail (start != NULL); + g_return_if_fail (end != NULL); + + first = *start; + second = *end; + + gtk_text_iter_reorder (&first, &second); + + /* Get all tags turned on at the start */ + tags = gtk_text_iter_get_tags (&first); + + /* Find any that are toggled on within the range */ + tmp = first; + while (gtk_text_iter_forward_to_tag_toggle (&tmp, NULL)) + { + GSList *toggled; + GSList *tmp_list2; + + if (gtk_text_iter_compare (&tmp, &second) >= 0) + break; /* past the end of the range */ + + toggled = gtk_text_iter_get_toggled_tags (&tmp, TRUE); + + /* We could end up with a really big-ass list here. + * Fix it someday. + */ + tmp_list2 = toggled; + while (tmp_list2 != NULL) + { + tags = g_slist_prepend (tags, tmp_list2->data); + + tmp_list2 = g_slist_next (tmp_list2); + } + + g_slist_free (toggled); + } + + /* Sort the list */ + tags = g_slist_sort (tags, pointer_cmp); + + /* Strip duplicates */ + tag = NULL; + prev = NULL; + tmp_list = tags; + while (tmp_list != NULL) + { + if (tag == tmp_list->data) + { + /* duplicate */ + if (prev) + prev->next = tmp_list->next; + + tmp_list->next = NULL; + + g_slist_free (tmp_list); + + tmp_list = prev->next; + /* prev is unchanged */ + } + else + { + /* not a duplicate */ + tag = GTK_TEXT_TAG (tmp_list->data); + prev = tmp_list; + tmp_list = tmp_list->next; + } + } + + g_list_foreach (tags, (GFunc) g_object_ref, NULL); + + tmp_list = tags; + while (tmp_list != NULL) + { + tag = GTK_TEXT_TAG (tmp_list->data); + + gtk_text_buffer_remove_tag (buffer, tag, &first, &second); + + tmp_list = tmp_list->next; + } + + g_list_foreach (tags, (GFunc) g_object_unref, NULL); + + g_slist_free (tags); +} + /* * Obtain various iterators |