X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xoptions.c;h=5616840354e782105e48def6b73aa12f3df5a459;hb=f360f5c49d27a95ca64e5755c42156ee1f7e95db;hp=c213bbcdeddb1bbf2cd2b2e72f766865e22ad436;hpb=b602e7faa8f3973c5b3c4ae00108eaea982ea196;p=xboard.git diff --git a/xoptions.c b/xoptions.c index c213bbc..5616840 100644 --- a/xoptions.c +++ b/xoptions.c @@ -546,6 +546,22 @@ ICSKeyEvent(GtkWidget *widget, GdkEventKey *event) } } +void +HighlightText (Option *opt, int from, int to, Boolean highlight) +{ +# define INIT 0x8000 + static GtkTextIter start, end; + + if(!(opt->min & INIT)) { + opt->min |= INIT; // each memo its own init flag! + gtk_text_buffer_create_tag(opt->handle, "highlight", "background", "yellow", NULL); + gtk_text_buffer_create_tag(opt->handle, "normal", "background", "white", NULL); + } + gtk_text_buffer_get_iter_at_offset(opt->handle, &start, from); + gtk_text_buffer_get_iter_at_offset(opt->handle, &end, to); + gtk_text_buffer_apply_tag_by_name(opt->handle, highlight ? "highlight" : "normal", &start, &end); +} + static gboolean MemoEvent(GtkWidget *widget, GdkEvent *event, gpointer gdata) { // handle mouse clicks on text widgets that need it