1 | |
2 | /* |
3 | * This library is free software; you can redistribute it and/or |
4 | * modify it under the terms of the GNU Library General Public |
5 | * License as published by the Free Software Foundation; either |
6 | * version 2 of the License, or (at your option) any later version. |
7 | * |
8 | * This library is distributed in the hope that it will be useful, |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11 | * Library General Public License for more details. |
12 | * |
13 | * You should have received a copy of the GNU Library General Public |
14 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
15 | */ |
16 | |
17 | #include "config.h" |
18 | |
19 | #include <gtk/gtk.h> |
20 | |
21 | |
22 | G_MODULE_EXPORT void |
23 | apply_tags_blue (GtkTextView *text_view) |
24 | { |
25 | GtkTextBuffer *buffer; |
26 | GtkTextIter start, end; |
27 | GtkTextIter four, eight; |
28 | |
29 | buffer = gtk_text_view_get_buffer (text_view); |
30 | gtk_text_buffer_get_bounds (buffer, start: &start, end: &end); |
31 | gtk_text_buffer_apply_tag_by_name (buffer, name: "blue" , start: &start, end: &end); |
32 | four = start; |
33 | eight = start; |
34 | gtk_text_iter_forward_chars (iter: &four, count: 4); |
35 | gtk_text_iter_forward_chars (iter: &eight, count: 8); |
36 | gtk_text_buffer_apply_tag_by_name (buffer, name: "black" , start: &four, end: &end); |
37 | gtk_text_buffer_apply_tag_by_name (buffer, name: "white" , start: &eight, end: &end); |
38 | } |
39 | |
40 | G_MODULE_EXPORT void |
41 | apply_tags_red_blue (GtkTextView *text_view) |
42 | { |
43 | GtkTextBuffer *buffer; |
44 | GtkTextIter start, end; |
45 | GtkTextIter four, eight; |
46 | |
47 | buffer = gtk_text_view_get_buffer (text_view); |
48 | gtk_text_buffer_get_bounds (buffer, start: &start, end: &end); |
49 | gtk_text_buffer_apply_tag_by_name (buffer, name: "red" , start: &start, end: &end); |
50 | gtk_text_buffer_apply_tag_by_name (buffer, name: "blue" , start: &start, end: &end); |
51 | four = start; |
52 | eight = start; |
53 | gtk_text_iter_forward_chars (iter: &four, count: 4); |
54 | gtk_text_iter_forward_chars (iter: &eight, count: 8); |
55 | gtk_text_buffer_apply_tag_by_name (buffer, name: "black" , start: &four, end: &eight); |
56 | gtk_text_buffer_apply_tag_by_name (buffer, name: "white" , start: &eight, end: &end); |
57 | } |
58 | |