1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
GtkTextIter Debut, Debut_mot, Fin_mot; // Creation d'iter
gtk_text_buffer_get_start_iter(TextBuffer, &Debut);
gtk_text_buffer_get_start_iter(TextBuffer, &Debut_mot);
gtk_text_buffer_get_start_iter(TextBuffer, &Fin_mot);
/* Mise en place des iter sur le buffer */
GtkTextTag *Tag;
gboolean Found = TRUE;
/* Creation et definition des variables */
Tag = gtk_text_buffer_create_tag(TextBuffer, NULL,
"foreground", "blue",
"size", 12 * PANGO_SCALE,
NULL);
/* Caracterisation du tag : bleu et assez petit */
Found = gtk_text_iter_forward_search(&Debut, "essai", 0, &Debut_mot, &Fin_mot, NULL);
/* On recherche si le mot body existe */
if(Found)
{
gtk_text_buffer_apply_tag(TextBuffer, Tag, &Debut_mot, &Fin_mot);
/* On applique le tag */
while(Found = TRUE)
{
Found = gtk_text_iter_forward_search(&Fin_mot, "essai", 0, &Debut_mot, &Fin_mot, NULL);
gtk_text_buffer_apply_tag(TextBuffer, Tag, &Debut_mot, &Fin_mot);
/* Recherche des mots et application des tags */
}
} |
Partager