Wed, 06 Jun 2007 15:50:21 +0000
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
through e82c41f34ce5f7439b2f2971139efaf6ef7a54ff
|
17586
5beb8d987e84
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
16186
diff
changeset
|
1 | /** |
|
5beb8d987e84
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
16186
diff
changeset
|
2 | * GNT - The GLib Ncurses Toolkit |
|
5beb8d987e84
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
16186
diff
changeset
|
3 | * |
|
5beb8d987e84
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
16186
diff
changeset
|
4 | * GNT is the legal property of its developers, whose names are too numerous |
|
5beb8d987e84
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
16186
diff
changeset
|
5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
5beb8d987e84
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
16186
diff
changeset
|
6 | * source distribution. |
|
5beb8d987e84
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
16186
diff
changeset
|
7 | * |
|
5beb8d987e84
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
16186
diff
changeset
|
8 | * This library is free software; you can redistribute it and/or modify |
|
5beb8d987e84
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
16186
diff
changeset
|
9 | * it under the terms of the GNU General Public License as published by |
|
5beb8d987e84
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
16186
diff
changeset
|
10 | * the Free Software Foundation; either version 2 of the License, or |
|
5beb8d987e84
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
16186
diff
changeset
|
11 | * (at your option) any later version. |
|
5beb8d987e84
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
16186
diff
changeset
|
12 | * |
|
5beb8d987e84
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
16186
diff
changeset
|
13 | * This program is distributed in the hope that it will be useful, |
|
5beb8d987e84
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
16186
diff
changeset
|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
5beb8d987e84
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
16186
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
5beb8d987e84
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
16186
diff
changeset
|
16 | * GNU General Public License for more details. |
|
5beb8d987e84
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
16186
diff
changeset
|
17 | * |
|
5beb8d987e84
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
16186
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
|
5beb8d987e84
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
16186
diff
changeset
|
19 | * along with this program; if not, write to the Free Software |
|
5beb8d987e84
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
16186
diff
changeset
|
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
5beb8d987e84
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
16186
diff
changeset
|
21 | */ |
|
5beb8d987e84
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
16186
diff
changeset
|
22 | |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
23 | #include "gnttextview.h" |
|
14373
609c902d20f5
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14284
diff
changeset
|
24 | #include "gntutils.h" |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
25 | |
|
14460
ec99f8f548a7
[gaim-migrate @ 17106]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14459
diff
changeset
|
26 | #include <string.h> |
|
ec99f8f548a7
[gaim-migrate @ 17106]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14459
diff
changeset
|
27 | |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
28 | enum |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
29 | { |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
30 | SIGS = 1, |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
31 | }; |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
32 | |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
33 | typedef struct |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
34 | { |
|
14433
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
35 | GntTextFormatFlags tvflag; |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
36 | chtype flags; |
|
14445
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
37 | int start; |
|
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
38 | int end; /* This is the next byte of the last character of this segment */ |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
39 | } GntTextSegment; |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
40 | |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
41 | typedef struct |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
42 | { |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
43 | GList *segments; /* A list of GntTextSegments */ |
|
14373
609c902d20f5
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14284
diff
changeset
|
44 | int length; /* The current length of the line so far (ie. onscreen width) */ |
|
14433
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
45 | gboolean soft; /* TRUE if it's an overflow from prev. line */ |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
46 | } GntTextLine; |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
47 | |
|
15233
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
48 | typedef struct |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
49 | { |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
50 | char *name; |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
51 | int start; |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
52 | int end; |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
53 | } GntTextTag; |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
54 | |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
55 | static GntWidgetClass *parent_class = NULL; |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
56 | |
|
15814
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
57 | static gchar *select_start; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
58 | static gchar *select_end; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
59 | static gboolean double_click; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
60 | |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
61 | static void |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
62 | gnt_text_view_draw(GntWidget *widget) |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
63 | { |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
64 | GntTextView *view = GNT_TEXT_VIEW(widget); |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
65 | int i = 0; |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
66 | GList *lines; |
|
14193
fcfd3eea2160
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14185
diff
changeset
|
67 | int rows, scrcol; |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
68 | |
|
15991
1efb6bd8ba3f
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15906
diff
changeset
|
69 | wbkgd(widget->window, COLOR_PAIR(GNT_COLOR_NORMAL)); |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
70 | werase(widget->window); |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
71 | |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
72 | for (i = 0, lines = view->list; i < widget->priv.height && lines; i++, lines = lines->next) |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
73 | { |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
74 | GList *iter; |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
75 | GntTextLine *line = lines->data; |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
76 | |
|
14284
6c99565d0f50
[gaim-migrate @ 16903]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14283
diff
changeset
|
77 | wmove(widget->window, widget->priv.height - 1 - i, 0); |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
78 | |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
79 | for (iter = line->segments; iter; iter = iter->next) |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
80 | { |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
81 | GntTextSegment *seg = iter->data; |
|
14445
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
82 | char *end = view->string->str + seg->end; |
|
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
83 | char back = *end; |
|
15814
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
84 | chtype fl = seg->flags; |
|
14445
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
85 | *end = '\0'; |
|
15814
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
86 | if (select_start < view->string->str + seg->start && select_end > view->string->str + seg->end) { |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
87 | fl |= A_REVERSE; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
88 | wattrset(widget->window, fl); |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
89 | wprintw(widget->window, "%s", (view->string->str + seg->start)); |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
90 | } else if (select_start && select_end && |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
91 | ((select_start >= view->string->str + seg->start && select_start <= view->string->str + seg->end) || |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
92 | (select_end <= view->string->str + seg->end && select_start <= view->string->str + seg->start))) { |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
93 | char *cur = view->string->str + seg->start; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
94 | while (*cur != '\0') { |
|
15837
7718f3b6f643
Display selected double-width cell chars properly and select the correct number of bytes when these characters are on a selection line.
Richard Nelson <wabz@pidgin.im>
parents:
15826
diff
changeset
|
95 | gchar *last = g_utf8_next_char(cur); |
|
7718f3b6f643
Display selected double-width cell chars properly and select the correct number of bytes when these characters are on a selection line.
Richard Nelson <wabz@pidgin.im>
parents:
15826
diff
changeset
|
96 | gchar *str; |
|
15814
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
97 | if (cur >= select_start && cur <= select_end) |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
98 | fl |= A_REVERSE; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
99 | else |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
100 | fl = seg->flags; |
|
15837
7718f3b6f643
Display selected double-width cell chars properly and select the correct number of bytes when these characters are on a selection line.
Richard Nelson <wabz@pidgin.im>
parents:
15826
diff
changeset
|
101 | str = g_strndup(cur, last - cur); |
|
15814
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
102 | wattrset(widget->window, fl); |
|
15837
7718f3b6f643
Display selected double-width cell chars properly and select the correct number of bytes when these characters are on a selection line.
Richard Nelson <wabz@pidgin.im>
parents:
15826
diff
changeset
|
103 | waddstr(widget->window, str); |
|
7718f3b6f643
Display selected double-width cell chars properly and select the correct number of bytes when these characters are on a selection line.
Richard Nelson <wabz@pidgin.im>
parents:
15826
diff
changeset
|
104 | g_free(str); |
|
7718f3b6f643
Display selected double-width cell chars properly and select the correct number of bytes when these characters are on a selection line.
Richard Nelson <wabz@pidgin.im>
parents:
15826
diff
changeset
|
105 | cur = g_utf8_next_char(cur); |
|
15814
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
106 | } |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
107 | } else { |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
108 | wattrset(widget->window, fl); |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
109 | wprintw(widget->window, "%s", (view->string->str + seg->start)); |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
110 | } |
|
14445
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
111 | *end = back; |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
112 | } |
| 14789 | 113 | wattroff(widget->window, A_UNDERLINE | A_BLINK | A_REVERSE); |
| 114 | whline(widget->window, ' ', widget->priv.width - line->length - 1); | |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
115 | } |
|
14185
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
116 | |
|
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
117 | scrcol = widget->priv.width - 1; |
|
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
118 | rows = widget->priv.height - 2; |
|
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
119 | if (rows > 0) |
|
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
120 | { |
|
14193
fcfd3eea2160
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14185
diff
changeset
|
121 | int total = g_list_length(g_list_first(view->list)); |
|
fcfd3eea2160
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14185
diff
changeset
|
122 | int showing, position, up, down; |
|
14185
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
123 | |
|
14193
fcfd3eea2160
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14185
diff
changeset
|
124 | showing = rows * rows / total + 1; |
|
14185
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
125 | showing = MIN(rows, showing); |
|
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
126 | |
|
14193
fcfd3eea2160
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14185
diff
changeset
|
127 | total -= rows; |
|
fcfd3eea2160
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14185
diff
changeset
|
128 | up = g_list_length(lines); |
|
fcfd3eea2160
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14185
diff
changeset
|
129 | down = total - up; |
|
fcfd3eea2160
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14185
diff
changeset
|
130 | |
|
fcfd3eea2160
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14185
diff
changeset
|
131 | position = (rows - showing) * up / MAX(1, up + down); |
|
14185
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
132 | position = MAX((lines != NULL), position); |
|
14169
90d1d4697e23
[gaim-migrate @ 16741]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14094
diff
changeset
|
133 | |
|
14185
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
134 | if (showing + position > rows) |
|
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
135 | position = rows - showing; |
|
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
136 | |
|
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
137 | if (showing + position == rows && view->list && view->list->prev) |
|
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
138 | position = MAX(1, rows - 1 - showing); |
|
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
139 | else if (showing + position < rows && view->list && !view->list->prev) |
|
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
140 | position = rows - showing; |
|
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
141 | |
|
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
142 | mvwvline(widget->window, position + 1, scrcol, |
|
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
143 | ACS_CKBOARD | COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D), showing); |
|
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
144 | } |
|
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
145 | |
|
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
146 | mvwaddch(widget->window, 0, scrcol, |
|
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
147 | (lines ? ACS_UARROW : ' ') | COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D)); |
|
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
148 | mvwaddch(widget->window, widget->priv.height - 1, scrcol, |
|
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
149 | ((view->list && view->list->prev) ? ACS_DARROW : ' ') | |
|
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
150 | COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D)); |
|
14169
90d1d4697e23
[gaim-migrate @ 16741]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14094
diff
changeset
|
151 | |
|
14494
3575eac3a518
[gaim-migrate @ 17146]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14461
diff
changeset
|
152 | GNTDEBUG; |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
153 | } |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
154 | |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
155 | static void |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
156 | gnt_text_view_size_request(GntWidget *widget) |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
157 | { |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
158 | if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_MAPPED)) |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
159 | { |
|
14461
ed494fb68279
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14460
diff
changeset
|
160 | gnt_widget_set_size(widget, 64, 20); |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
161 | } |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
162 | } |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
163 | |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
164 | static void |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
165 | gnt_text_view_map(GntWidget *widget) |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
166 | { |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
167 | if (widget->priv.width == 0 || widget->priv.height == 0) |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
168 | gnt_widget_size_request(widget); |
|
14494
3575eac3a518
[gaim-migrate @ 17146]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14461
diff
changeset
|
169 | GNTDEBUG; |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
170 | } |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
171 | |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
172 | static gboolean |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
173 | gnt_text_view_key_pressed(GntWidget *widget, const char *text) |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
174 | { |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
175 | return FALSE; |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
176 | } |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
177 | |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
178 | static void |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
179 | free_text_segment(gpointer data, gpointer null) |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
180 | { |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
181 | GntTextSegment *seg = data; |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
182 | g_free(seg); |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
183 | } |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
184 | |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
185 | static void |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
186 | free_text_line(gpointer data, gpointer null) |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
187 | { |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
188 | GntTextLine *line = data; |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
189 | g_list_foreach(line->segments, free_text_segment, NULL); |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
190 | g_list_free(line->segments); |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
191 | g_free(line); |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
192 | } |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
193 | |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
194 | static void |
|
15233
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
195 | free_tag(gpointer data, gpointer null) |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
196 | { |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
197 | GntTextTag *tag = data; |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
198 | g_free(tag->name); |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
199 | g_free(tag); |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
200 | } |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
201 | |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
202 | static void |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
203 | gnt_text_view_destroy(GntWidget *widget) |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
204 | { |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
205 | GntTextView *view = GNT_TEXT_VIEW(widget); |
|
14092
191e12cbe464
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
206 | view->list = g_list_first(view->list); |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
207 | g_list_foreach(view->list, free_text_line, NULL); |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
208 | g_list_free(view->list); |
|
15233
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
209 | g_list_foreach(view->tags, free_tag, NULL); |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
210 | g_list_free(view->tags); |
|
14445
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
211 | g_string_free(view->string, TRUE); |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
212 | } |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
213 | |
|
15814
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
214 | static char * |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
215 | gnt_text_view_get_p(GntTextView *view, int x, int y) |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
216 | { |
|
15837
7718f3b6f643
Display selected double-width cell chars properly and select the correct number of bytes when these characters are on a selection line.
Richard Nelson <wabz@pidgin.im>
parents:
15826
diff
changeset
|
217 | int i = 0; |
|
15814
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
218 | GntWidget *wid = GNT_WIDGET(view); |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
219 | GntTextLine *line; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
220 | GList *lines; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
221 | GList *segs; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
222 | GntTextSegment *seg; |
|
15837
7718f3b6f643
Display selected double-width cell chars properly and select the correct number of bytes when these characters are on a selection line.
Richard Nelson <wabz@pidgin.im>
parents:
15826
diff
changeset
|
223 | gchar *pos; |
|
15814
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
224 | |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
225 | y = wid->priv.height - y; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
226 | if (g_list_length(view->list) < y) { |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
227 | x = 0; |
|
15837
7718f3b6f643
Display selected double-width cell chars properly and select the correct number of bytes when these characters are on a selection line.
Richard Nelson <wabz@pidgin.im>
parents:
15826
diff
changeset
|
228 | y = g_list_length(view->list) - 1; |
|
15814
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
229 | } |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
230 | |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
231 | lines = g_list_nth(view->list, y - 1); |
|
15837
7718f3b6f643
Display selected double-width cell chars properly and select the correct number of bytes when these characters are on a selection line.
Richard Nelson <wabz@pidgin.im>
parents:
15826
diff
changeset
|
232 | if (!lines) |
|
7718f3b6f643
Display selected double-width cell chars properly and select the correct number of bytes when these characters are on a selection line.
Richard Nelson <wabz@pidgin.im>
parents:
15826
diff
changeset
|
233 | return NULL; |
|
15824
94b08838e069
Cute little mod.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15814
diff
changeset
|
234 | do { |
|
94b08838e069
Cute little mod.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15814
diff
changeset
|
235 | line = lines->data; |
|
94b08838e069
Cute little mod.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15814
diff
changeset
|
236 | lines = lines->next; |
|
15826
273b7247786b
Fix a crash when selecting text in an empty TV.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15824
diff
changeset
|
237 | } while (line && !line->segments && lines); |
|
15814
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
238 | |
|
15826
273b7247786b
Fix a crash when selecting text in an empty TV.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15824
diff
changeset
|
239 | if (!line || !line->segments) /* no valid line */ |
|
15814
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
240 | return NULL; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
241 | segs = line->segments; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
242 | seg = (GntTextSegment *)segs->data; |
|
15837
7718f3b6f643
Display selected double-width cell chars properly and select the correct number of bytes when these characters are on a selection line.
Richard Nelson <wabz@pidgin.im>
parents:
15826
diff
changeset
|
243 | pos = view->string->str + seg->start; |
|
7718f3b6f643
Display selected double-width cell chars properly and select the correct number of bytes when these characters are on a selection line.
Richard Nelson <wabz@pidgin.im>
parents:
15826
diff
changeset
|
244 | x = MIN(x, line->length); |
|
7718f3b6f643
Display selected double-width cell chars properly and select the correct number of bytes when these characters are on a selection line.
Richard Nelson <wabz@pidgin.im>
parents:
15826
diff
changeset
|
245 | while (++i <= x) { |
|
7718f3b6f643
Display selected double-width cell chars properly and select the correct number of bytes when these characters are on a selection line.
Richard Nelson <wabz@pidgin.im>
parents:
15826
diff
changeset
|
246 | gunichar *u; |
|
7718f3b6f643
Display selected double-width cell chars properly and select the correct number of bytes when these characters are on a selection line.
Richard Nelson <wabz@pidgin.im>
parents:
15826
diff
changeset
|
247 | pos = g_utf8_next_char(pos); |
|
7718f3b6f643
Display selected double-width cell chars properly and select the correct number of bytes when these characters are on a selection line.
Richard Nelson <wabz@pidgin.im>
parents:
15826
diff
changeset
|
248 | u = g_utf8_to_ucs4(pos, -1, NULL, NULL, NULL); |
|
15866
3f58d8094334
g_unichar_iswide_cjk() is only in glib 2.12 and newer, and I suspect
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15837
diff
changeset
|
249 | if (u && g_unichar_iswide(*u)) |
|
15837
7718f3b6f643
Display selected double-width cell chars properly and select the correct number of bytes when these characters are on a selection line.
Richard Nelson <wabz@pidgin.im>
parents:
15826
diff
changeset
|
250 | i++; |
|
7718f3b6f643
Display selected double-width cell chars properly and select the correct number of bytes when these characters are on a selection line.
Richard Nelson <wabz@pidgin.im>
parents:
15826
diff
changeset
|
251 | g_free(u); |
|
7718f3b6f643
Display selected double-width cell chars properly and select the correct number of bytes when these characters are on a selection line.
Richard Nelson <wabz@pidgin.im>
parents:
15826
diff
changeset
|
252 | } |
|
7718f3b6f643
Display selected double-width cell chars properly and select the correct number of bytes when these characters are on a selection line.
Richard Nelson <wabz@pidgin.im>
parents:
15826
diff
changeset
|
253 | return pos; |
|
15814
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
254 | } |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
255 | |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
256 | static GString * |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
257 | select_word_text(GntTextView *view, gchar *c) |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
258 | { |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
259 | gchar *start = c; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
260 | gchar *end = c; |
|
15837
7718f3b6f643
Display selected double-width cell chars properly and select the correct number of bytes when these characters are on a selection line.
Richard Nelson <wabz@pidgin.im>
parents:
15826
diff
changeset
|
261 | gchar *t, *endsize; |
|
15874
46df7421a1b5
Enable DEBUG_CFLAGS in libgnt and fix up a number of compile warnings and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15866
diff
changeset
|
262 | while ((t = g_utf8_prev_char(start))) { |
|
15814
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
263 | if (!g_ascii_isspace(*t)) { |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
264 | if (start == view->string->str) |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
265 | break; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
266 | start = t; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
267 | } else |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
268 | break; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
269 | } |
|
15874
46df7421a1b5
Enable DEBUG_CFLAGS in libgnt and fix up a number of compile warnings and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15866
diff
changeset
|
270 | while ((t = g_utf8_next_char(end))) { |
|
15814
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
271 | if (!g_ascii_isspace(*t)) |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
272 | end = t; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
273 | else |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
274 | break; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
275 | } |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
276 | select_start = start; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
277 | select_end = end; |
|
15837
7718f3b6f643
Display selected double-width cell chars properly and select the correct number of bytes when these characters are on a selection line.
Richard Nelson <wabz@pidgin.im>
parents:
15826
diff
changeset
|
278 | endsize = g_utf8_next_char(select_end); /* End at the correct byte */ |
|
7718f3b6f643
Display selected double-width cell chars properly and select the correct number of bytes when these characters are on a selection line.
Richard Nelson <wabz@pidgin.im>
parents:
15826
diff
changeset
|
279 | return g_string_new_len(start, endsize - start); |
|
15814
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
280 | } |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
281 | |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
282 | static gboolean too_slow(gpointer n) |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
283 | { |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
284 | double_click = FALSE; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
285 | return FALSE; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
286 | } |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
287 | |
|
14405
4398121ce889
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14373
diff
changeset
|
288 | static gboolean |
|
4398121ce889
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14373
diff
changeset
|
289 | gnt_text_view_clicked(GntWidget *widget, GntMouseEvent event, int x, int y) |
|
4398121ce889
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14373
diff
changeset
|
290 | { |
|
4398121ce889
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14373
diff
changeset
|
291 | if (event == GNT_MOUSE_SCROLL_UP) { |
|
4398121ce889
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14373
diff
changeset
|
292 | gnt_text_view_scroll(GNT_TEXT_VIEW(widget), -1); |
|
4398121ce889
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14373
diff
changeset
|
293 | } else if (event == GNT_MOUSE_SCROLL_DOWN) { |
|
4398121ce889
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14373
diff
changeset
|
294 | gnt_text_view_scroll(GNT_TEXT_VIEW(widget), 1); |
|
15814
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
295 | } else if (event == GNT_LEFT_MOUSE_DOWN) { |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
296 | select_start = gnt_text_view_get_p(GNT_TEXT_VIEW(widget), x - widget->priv.x, y - widget->priv.y); |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
297 | g_timeout_add(500, too_slow, NULL); |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
298 | } else if (event == GNT_MOUSE_UP) { |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
299 | if (select_start) { |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
300 | GString *clip; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
301 | select_end = gnt_text_view_get_p(GNT_TEXT_VIEW(widget), x - widget->priv.x, y - widget->priv.y); |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
302 | if (select_end < select_start) { |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
303 | gchar *t = select_start; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
304 | select_start = select_end; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
305 | select_end = t; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
306 | } |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
307 | if (select_start == select_end) { |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
308 | if (double_click) { |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
309 | clip = select_word_text(GNT_TEXT_VIEW(widget), select_start); |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
310 | double_click = FALSE; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
311 | } else { |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
312 | double_click = TRUE; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
313 | select_start = 0; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
314 | select_end = 0; |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
315 | gnt_widget_draw(widget); |
|
15874
46df7421a1b5
Enable DEBUG_CFLAGS in libgnt and fix up a number of compile warnings and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15866
diff
changeset
|
316 | return TRUE; |
|
15814
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
317 | } |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
318 | } else { |
|
15837
7718f3b6f643
Display selected double-width cell chars properly and select the correct number of bytes when these characters are on a selection line.
Richard Nelson <wabz@pidgin.im>
parents:
15826
diff
changeset
|
319 | gchar *endsize = g_utf8_next_char(select_end); /* End at the correct byte */ |
|
7718f3b6f643
Display selected double-width cell chars properly and select the correct number of bytes when these characters are on a selection line.
Richard Nelson <wabz@pidgin.im>
parents:
15826
diff
changeset
|
320 | clip = g_string_new_len(select_start, endsize - select_start); |
|
15814
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
321 | } |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
322 | gnt_widget_draw(widget); |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
323 | gnt_set_clipboard_string(clip->str); |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
324 | g_string_free(clip, TRUE); |
|
2db42c6a13fa
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15397
diff
changeset
|
325 | } |
|
14405
4398121ce889
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14373
diff
changeset
|
326 | } else |
|
4398121ce889
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14373
diff
changeset
|
327 | return FALSE; |
|
4398121ce889
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14373
diff
changeset
|
328 | return TRUE; |
|
4398121ce889
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14373
diff
changeset
|
329 | } |
|
4398121ce889
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14373
diff
changeset
|
330 | |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
331 | static void |
|
14433
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
332 | gnt_text_view_reflow(GntTextView *view) |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
333 | { |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
334 | /* This is pretty ugly, and inefficient. Someone do something about it. */ |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
335 | GntTextLine *line; |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
336 | GList *back, *iter, *list; |
|
14445
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
337 | GString *string; |
|
14888
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
338 | int pos = 0; /* no. of 'real' lines */ |
|
14433
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
339 | |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
340 | list = view->list; |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
341 | while (list->prev) { |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
342 | line = list->data; |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
343 | if (!line->soft) |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
344 | pos++; |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
345 | list = list->prev; |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
346 | } |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
347 | |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
348 | back = g_list_last(view->list); |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
349 | view->list = NULL; |
|
14445
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
350 | |
|
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
351 | string = view->string; |
|
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
352 | view->string = NULL; |
|
14433
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
353 | gnt_text_view_clear(view); |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
354 | |
|
14445
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
355 | view->string = g_string_set_size(view->string, string->len); |
|
14888
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
356 | view->string->len = 0; |
|
14445
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
357 | GNT_WIDGET_SET_FLAGS(GNT_WIDGET(view), GNT_WIDGET_DRAWING); |
|
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
358 | |
|
14433
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
359 | for (; back; back = back->prev) { |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
360 | line = back->data; |
|
14445
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
361 | if (back->next && !line->soft) { |
|
14888
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
362 | gnt_text_view_append_text_with_flags(view, "\n", GNT_TEXT_FLAG_NORMAL); |
|
14445
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
363 | } |
|
14888
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
364 | |
|
14433
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
365 | for (iter = line->segments; iter; iter = iter->next) { |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
366 | GntTextSegment *seg = iter->data; |
|
14445
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
367 | char *start = string->str + seg->start; |
|
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
368 | char *end = string->str + seg->end; |
|
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
369 | char back = *end; |
|
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
370 | *end = '\0'; |
|
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
371 | gnt_text_view_append_text_with_flags(view, start, seg->tvflag); |
|
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
372 | *end = back; |
|
14433
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
373 | } |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
374 | free_text_line(line, NULL); |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
375 | } |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
376 | g_list_free(list); |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
377 | |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
378 | list = view->list = g_list_first(view->list); |
|
14888
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
379 | /* Go back to the line that was in view before resizing started */ |
|
14433
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
380 | while (pos--) { |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
381 | while (((GntTextLine*)list->data)->soft) |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
382 | list = list->next; |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
383 | list = list->next; |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
384 | } |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
385 | view->list = list; |
|
14445
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
386 | GNT_WIDGET_UNSET_FLAGS(GNT_WIDGET(view), GNT_WIDGET_DRAWING); |
|
14943
ffd493362a87
[gaim-migrate @ 17650]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14888
diff
changeset
|
387 | if (GNT_WIDGET(view)->window) |
|
ffd493362a87
[gaim-migrate @ 17650]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14888
diff
changeset
|
388 | gnt_widget_draw(GNT_WIDGET(view)); |
|
14445
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
389 | g_string_free(string, TRUE); |
|
14433
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
390 | } |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
391 | |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
392 | static void |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
393 | gnt_text_view_size_changed(GntWidget *widget, int w, int h) |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
394 | { |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
395 | if (w != widget->priv.width) { |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
396 | gnt_text_view_reflow(GNT_TEXT_VIEW(widget)); |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
397 | } |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
398 | } |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
399 | |
|
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
400 | static void |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
401 | gnt_text_view_class_init(GntTextViewClass *klass) |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
402 | { |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
403 | parent_class = GNT_WIDGET_CLASS(klass); |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
404 | parent_class->destroy = gnt_text_view_destroy; |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
405 | parent_class->draw = gnt_text_view_draw; |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
406 | parent_class->map = gnt_text_view_map; |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
407 | parent_class->size_request = gnt_text_view_size_request; |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
408 | parent_class->key_pressed = gnt_text_view_key_pressed; |
|
14405
4398121ce889
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14373
diff
changeset
|
409 | parent_class->clicked = gnt_text_view_clicked; |
|
14433
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
410 | parent_class->size_changed = gnt_text_view_size_changed; |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
411 | |
|
14494
3575eac3a518
[gaim-migrate @ 17146]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14461
diff
changeset
|
412 | GNTDEBUG; |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
413 | } |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
414 | |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
415 | static void |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
416 | gnt_text_view_init(GTypeInstance *instance, gpointer class) |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
417 | { |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13993
diff
changeset
|
418 | GntWidget *widget = GNT_WIDGET(instance); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13993
diff
changeset
|
419 | |
|
14433
69975e91d8ca
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14405
diff
changeset
|
420 | GNT_WIDGET_SET_FLAGS(GNT_WIDGET(instance), GNT_WIDGET_GROW_Y | GNT_WIDGET_GROW_X); |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13993
diff
changeset
|
421 | |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13993
diff
changeset
|
422 | widget->priv.minw = 5; |
|
14185
394aa8aa00a3
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14169
diff
changeset
|
423 | widget->priv.minh = 2; |
|
14494
3575eac3a518
[gaim-migrate @ 17146]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14461
diff
changeset
|
424 | GNTDEBUG; |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
425 | } |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
426 | |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
427 | /****************************************************************************** |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
428 | * GntTextView API |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
429 | *****************************************************************************/ |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
430 | GType |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
431 | gnt_text_view_get_gtype(void) |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
432 | { |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
433 | static GType type = 0; |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
434 | |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
435 | if(type == 0) |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
436 | { |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
437 | static const GTypeInfo info = { |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
438 | sizeof(GntTextViewClass), |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
439 | NULL, /* base_init */ |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
440 | NULL, /* base_finalize */ |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
441 | (GClassInitFunc)gnt_text_view_class_init, |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
442 | NULL, /* class_finalize */ |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
443 | NULL, /* class_data */ |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
444 | sizeof(GntTextView), |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
445 | 0, /* n_preallocs */ |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
446 | gnt_text_view_init, /* instance_init */ |
|
15874
46df7421a1b5
Enable DEBUG_CFLAGS in libgnt and fix up a number of compile warnings and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15866
diff
changeset
|
447 | NULL /* value_table */ |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
448 | }; |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
449 | |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
450 | type = g_type_register_static(GNT_TYPE_WIDGET, |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
451 | "GntTextView", |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
452 | &info, 0); |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
453 | } |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
454 | |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
455 | return type; |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
456 | } |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
457 | |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
458 | GntWidget *gnt_text_view_new() |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
459 | { |
|
15991
1efb6bd8ba3f
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15906
diff
changeset
|
460 | GntWidget *widget = g_object_new(GNT_TYPE_TEXT_VIEW, NULL); |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
461 | GntTextView *view = GNT_TEXT_VIEW(widget); |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
462 | GntTextLine *line = g_new0(GntTextLine, 1); |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
463 | |
|
13989
9a647311c9ac
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
464 | GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW); |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
465 | |
|
14445
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
466 | view->string = g_string_new(NULL); |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
467 | view->list = g_list_append(view->list, line); |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
468 | |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
469 | return widget; |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
470 | } |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
471 | |
|
13993
8c12e7d15b40
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13992
diff
changeset
|
472 | void gnt_text_view_append_text_with_flags(GntTextView *view, const char *text, GntTextFormatFlags flags) |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
473 | { |
|
15233
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
474 | gnt_text_view_append_text_with_tag(view, text, flags, NULL); |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
475 | } |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
476 | |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
477 | void gnt_text_view_append_text_with_tag(GntTextView *view, const char *text, |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
478 | GntTextFormatFlags flags, const char *tagname) |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
479 | { |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
480 | GntWidget *widget = GNT_WIDGET(view); |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
481 | int fl = 0; |
|
14445
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
482 | const char *start, *end; |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
483 | GList *list = view->list; |
|
14445
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
484 | GntTextLine *line; |
|
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
485 | int len; |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
486 | |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
487 | if (text == NULL || *text == '\0') |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
488 | return; |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
489 | |
|
14014
223d99ce2f06
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
490 | fl = gnt_text_format_flag_to_chtype(flags); |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
491 | |
|
14445
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
492 | len = view->string->len; |
|
14888
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
493 | view->string = g_string_append(view->string, text); |
|
14445
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
494 | |
|
15233
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
495 | if (tagname) { |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
496 | GntTextTag *tag = g_new0(GntTextTag, 1); |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
497 | tag->name = g_strdup(tagname); |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
498 | tag->start = len; |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
499 | tag->end = view->string->len; |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
500 | view->tags = g_list_append(view->tags, tag); |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
501 | } |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
502 | |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
503 | view->list = g_list_first(view->list); |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
504 | |
|
14445
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
505 | start = end = view->string->str + len; |
|
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
506 | |
|
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
507 | while (*start) { |
|
16072
4902da58e498
word wrapping, fix \r\n newlines
Richard Nelson <wabz@pidgin.im>
parents:
15991
diff
changeset
|
508 | GntTextLine *oldl; |
|
14888
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
509 | GntTextSegment *seg = NULL; |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
510 | |
|
14445
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
511 | if (*end == '\n' || *end == '\r') { |
|
16072
4902da58e498
word wrapping, fix \r\n newlines
Richard Nelson <wabz@pidgin.im>
parents:
15991
diff
changeset
|
512 | if (!strncmp(end, "\r\n", 2)) |
|
4902da58e498
word wrapping, fix \r\n newlines
Richard Nelson <wabz@pidgin.im>
parents:
15991
diff
changeset
|
513 | end++; |
|
14445
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
514 | end++; |
|
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
515 | start = end; |
|
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
516 | gnt_text_view_next_line(view); |
|
14460
ec99f8f548a7
[gaim-migrate @ 17106]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14459
diff
changeset
|
517 | view->list = g_list_first(view->list); |
|
14445
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
518 | continue; |
|
14072
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14033
diff
changeset
|
519 | } |
|
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14033
diff
changeset
|
520 | |
|
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14033
diff
changeset
|
521 | line = view->list->data; |
|
14888
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
522 | if (line->length == widget->priv.width - 1) { |
|
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
523 | /* The last added line was exactly the same width as the widget */ |
|
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
524 | line = g_new0(GntTextLine, 1); |
|
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
525 | line->soft = TRUE; |
|
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
526 | view->list = g_list_prepend(view->list, line); |
|
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
527 | } |
|
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
528 | |
|
16072
4902da58e498
word wrapping, fix \r\n newlines
Richard Nelson <wabz@pidgin.im>
parents:
15991
diff
changeset
|
529 | if ((end = strchr(start, '\r')) != NULL || |
|
4902da58e498
word wrapping, fix \r\n newlines
Richard Nelson <wabz@pidgin.im>
parents:
15991
diff
changeset
|
530 | (end = strchr(start, '\n')) != NULL) { |
|
14460
ec99f8f548a7
[gaim-migrate @ 17106]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14459
diff
changeset
|
531 | len = gnt_util_onscreen_width(start, end - 1); |
|
ec99f8f548a7
[gaim-migrate @ 17106]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14459
diff
changeset
|
532 | if (len >= widget->priv.width - line->length - 1) { |
|
14459
d2e639b92d79
[gaim-migrate @ 17105]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14445
diff
changeset
|
533 | end = NULL; |
|
d2e639b92d79
[gaim-migrate @ 17105]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14445
diff
changeset
|
534 | } |
|
d2e639b92d79
[gaim-migrate @ 17105]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14445
diff
changeset
|
535 | } |
|
d2e639b92d79
[gaim-migrate @ 17105]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14445
diff
changeset
|
536 | |
|
d2e639b92d79
[gaim-migrate @ 17105]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14445
diff
changeset
|
537 | if (end == NULL) |
|
d2e639b92d79
[gaim-migrate @ 17105]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14445
diff
changeset
|
538 | end = gnt_util_onscreen_width_to_pointer(start, |
|
d2e639b92d79
[gaim-migrate @ 17105]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14445
diff
changeset
|
539 | widget->priv.width - line->length - 1, &len); |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
540 | |
|
14888
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
541 | /* Try to append to the previous segment if possible */ |
|
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
542 | if (line->segments) { |
|
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
543 | seg = g_list_last(line->segments)->data; |
|
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
544 | if (seg->flags != fl) |
|
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
545 | seg = NULL; |
|
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
546 | } |
|
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
547 | |
|
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
548 | if (seg == NULL) { |
|
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
549 | seg = g_new0(GntTextSegment, 1); |
|
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
550 | seg->start = start - view->string->str; |
|
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
551 | seg->tvflag = flags; |
|
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
552 | seg->flags = fl; |
|
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
553 | line->segments = g_list_append(line->segments, seg); |
|
aff7c674ca0f
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14791
diff
changeset
|
554 | } |
|
14373
609c902d20f5
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14284
diff
changeset
|
555 | |
|
16072
4902da58e498
word wrapping, fix \r\n newlines
Richard Nelson <wabz@pidgin.im>
parents:
15991
diff
changeset
|
556 | oldl = line; |
|
14445
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
557 | if (*end && *end != '\n' && *end != '\r') { |
|
16072
4902da58e498
word wrapping, fix \r\n newlines
Richard Nelson <wabz@pidgin.im>
parents:
15991
diff
changeset
|
558 | const char *tmp = end; |
|
4902da58e498
word wrapping, fix \r\n newlines
Richard Nelson <wabz@pidgin.im>
parents:
15991
diff
changeset
|
559 | while (end && *end != '\n' && *end != '\r' && !g_ascii_isspace(*end)) { |
|
4902da58e498
word wrapping, fix \r\n newlines
Richard Nelson <wabz@pidgin.im>
parents:
15991
diff
changeset
|
560 | end = g_utf8_find_prev_char(seg->start + view->string->str, end); |
|
4902da58e498
word wrapping, fix \r\n newlines
Richard Nelson <wabz@pidgin.im>
parents:
15991
diff
changeset
|
561 | } |
|
4902da58e498
word wrapping, fix \r\n newlines
Richard Nelson <wabz@pidgin.im>
parents:
15991
diff
changeset
|
562 | if (!end || !g_ascii_isspace(*end)) |
|
4902da58e498
word wrapping, fix \r\n newlines
Richard Nelson <wabz@pidgin.im>
parents:
15991
diff
changeset
|
563 | end = tmp; |
|
4902da58e498
word wrapping, fix \r\n newlines
Richard Nelson <wabz@pidgin.im>
parents:
15991
diff
changeset
|
564 | else |
|
4902da58e498
word wrapping, fix \r\n newlines
Richard Nelson <wabz@pidgin.im>
parents:
15991
diff
changeset
|
565 | end++; /* Remove the space */ |
|
4902da58e498
word wrapping, fix \r\n newlines
Richard Nelson <wabz@pidgin.im>
parents:
15991
diff
changeset
|
566 | |
|
14445
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
567 | line = g_new0(GntTextLine, 1); |
|
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
568 | line->soft = TRUE; |
|
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
569 | view->list = g_list_prepend(view->list, line); |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
570 | } |
|
16072
4902da58e498
word wrapping, fix \r\n newlines
Richard Nelson <wabz@pidgin.im>
parents:
15991
diff
changeset
|
571 | seg->end = end - view->string->str; |
|
4902da58e498
word wrapping, fix \r\n newlines
Richard Nelson <wabz@pidgin.im>
parents:
15991
diff
changeset
|
572 | oldl->length += len; |
|
4902da58e498
word wrapping, fix \r\n newlines
Richard Nelson <wabz@pidgin.im>
parents:
15991
diff
changeset
|
573 | start = end; |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
574 | } |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
575 | |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
576 | view->list = list; |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
577 | |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
578 | gnt_widget_draw(widget); |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
579 | } |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
580 | |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
581 | void gnt_text_view_scroll(GntTextView *view, int scroll) |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
582 | { |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
583 | if (scroll == 0) |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
584 | { |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
585 | view->list = g_list_first(view->list); |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
586 | } |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
587 | else if (scroll > 0) |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
588 | { |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
589 | GList *list = g_list_nth_prev(view->list, scroll); |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
590 | if (list == NULL) |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
591 | list = g_list_first(view->list); |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
592 | view->list = list; |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
593 | } |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
594 | else if (scroll < 0) |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
595 | { |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
596 | GList *list = g_list_nth(view->list, -scroll); |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
597 | if (list == NULL) |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
598 | list = g_list_last(view->list); |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
599 | view->list = list; |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
600 | } |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
601 | |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
602 | gnt_widget_draw(GNT_WIDGET(view)); |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
603 | } |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
604 | |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
605 | void gnt_text_view_next_line(GntTextView *view) |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
606 | { |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
607 | GntTextLine *line = g_new0(GntTextLine, 1); |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
608 | GList *list = view->list; |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
609 | |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
610 | view->list = g_list_prepend(g_list_first(view->list), line); |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
611 | view->list = list; |
|
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13950
diff
changeset
|
612 | gnt_widget_draw(GNT_WIDGET(view)); |
|
13944
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
613 | } |
|
2269d17043b1
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
614 | |
|
14014
223d99ce2f06
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
615 | chtype gnt_text_format_flag_to_chtype(GntTextFormatFlags flags) |
|
223d99ce2f06
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
616 | { |
|
223d99ce2f06
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
617 | chtype fl = 0; |
|
223d99ce2f06
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
618 | |
|
223d99ce2f06
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
619 | if (flags & GNT_TEXT_FLAG_BOLD) |
|
223d99ce2f06
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
620 | fl |= A_BOLD; |
|
223d99ce2f06
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
621 | if (flags & GNT_TEXT_FLAG_UNDERLINE) |
|
223d99ce2f06
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
622 | fl |= A_UNDERLINE; |
|
223d99ce2f06
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
623 | if (flags & GNT_TEXT_FLAG_BLINK) |
|
223d99ce2f06
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
624 | fl |= A_BLINK; |
|
223d99ce2f06
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
625 | |
|
223d99ce2f06
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
626 | if (flags & GNT_TEXT_FLAG_DIM) |
|
223d99ce2f06
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
627 | fl |= (A_DIM | COLOR_PAIR(GNT_COLOR_DISABLED)); |
|
223d99ce2f06
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
628 | else if (flags & GNT_TEXT_FLAG_HIGHLIGHT) |
|
223d99ce2f06
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
629 | fl |= (A_DIM | COLOR_PAIR(GNT_COLOR_HIGHLIGHT)); |
|
223d99ce2f06
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
630 | else |
|
223d99ce2f06
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
631 | fl |= COLOR_PAIR(GNT_COLOR_NORMAL); |
|
223d99ce2f06
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
632 | |
|
223d99ce2f06
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
633 | return fl; |
|
223d99ce2f06
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
634 | } |
|
223d99ce2f06
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
635 | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
636 | void gnt_text_view_clear(GntTextView *view) |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
637 | { |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
638 | GntTextLine *line; |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
639 | |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
640 | g_list_foreach(view->list, free_text_line, NULL); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
641 | g_list_free(view->list); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
642 | view->list = NULL; |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
643 | |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
644 | line = g_new0(GntTextLine, 1); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
645 | view->list = g_list_append(view->list, line); |
|
14445
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
646 | if (view->string) |
|
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
647 | g_string_free(view->string, TRUE); |
|
69f18df58bbf
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14433
diff
changeset
|
648 | view->string = g_string_new(NULL); |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
649 | |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
650 | if (GNT_WIDGET(view)->window) |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
651 | gnt_widget_draw(GNT_WIDGET(view)); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
652 | } |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14014
diff
changeset
|
653 | |
|
14092
191e12cbe464
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
654 | int gnt_text_view_get_lines_below(GntTextView *view) |
|
191e12cbe464
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
655 | { |
|
191e12cbe464
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
656 | int below = 0; |
|
191e12cbe464
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
657 | GList *list = view->list; |
|
191e12cbe464
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
658 | while ((list = list->prev)) |
|
191e12cbe464
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
659 | ++below; |
|
191e12cbe464
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
660 | return below; |
|
191e12cbe464
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
661 | } |
|
191e12cbe464
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
662 | |
|
191e12cbe464
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
663 | int gnt_text_view_get_lines_above(GntTextView *view) |
|
191e12cbe464
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
664 | { |
|
191e12cbe464
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
665 | int above = 0; |
|
191e12cbe464
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
666 | GList *list = view->list; |
|
191e12cbe464
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
667 | list = g_list_nth(view->list, GNT_WIDGET(view)->priv.height); |
|
191e12cbe464
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
668 | if (!list) |
|
191e12cbe464
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
669 | return 0; |
|
191e12cbe464
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
670 | while ((list = list->next)) |
|
191e12cbe464
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
671 | ++above; |
|
191e12cbe464
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
672 | return above; |
|
191e12cbe464
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
673 | } |
|
191e12cbe464
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
674 | |
|
15233
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
675 | /** |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
676 | * XXX: There are quite possibly more than a few bugs here. |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
677 | */ |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
678 | int gnt_text_view_tag_change(GntTextView *view, const char *name, const char *text, gboolean all) |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
679 | { |
|
15375
42b08c34496b
[gaim-migrate @ 18104]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15372
diff
changeset
|
680 | GList *alllines = g_list_first(view->list); |
|
15233
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
681 | GList *list, *next, *iter, *inext; |
|
15397
2a5e63b97a2b
[gaim-migrate @ 18127]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15396
diff
changeset
|
682 | const int text_length = text ? strlen(text) : 0; |
|
15233
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
683 | int count = 0; |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
684 | for (list = view->tags; list; list = next) { |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
685 | GntTextTag *tag = list->data; |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
686 | next = list->next; |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
687 | if (strcmp(tag->name, name) == 0) { |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
688 | int change; |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
689 | char *before, *after; |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
690 | |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
691 | count++; |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
692 | |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
693 | before = g_strndup(view->string->str, tag->start); |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
694 | after = g_strdup(view->string->str + tag->end); |
|
15396
a5938aa3f6c9
[gaim-migrate @ 18126]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15375
diff
changeset
|
695 | change = (tag->end - tag->start) - text_length; |
|
15233
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
696 | |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
697 | g_string_printf(view->string, "%s%s%s", before, text ? text : "", after); |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
698 | g_free(before); |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
699 | g_free(after); |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
700 | |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
701 | /* Update the offsets of the next tags */ |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
702 | for (iter = next; iter; iter = iter->next) { |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
703 | GntTextTag *t = iter->data; |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
704 | t->start -= change; |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
705 | t->end -= change; |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
706 | } |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
707 | |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
708 | /* Update the offsets of the segments */ |
|
15375
42b08c34496b
[gaim-migrate @ 18104]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15372
diff
changeset
|
709 | for (iter = alllines; iter; iter = inext) { |
|
15233
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
710 | GList *segs, *snext; |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
711 | GntTextLine *line = iter->data; |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
712 | inext = iter->next; |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
713 | for (segs = line->segments; segs; segs = snext) { |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
714 | GntTextSegment *seg = segs->data; |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
715 | snext = segs->next; |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
716 | if (seg->start >= tag->end) { |
|
15372
d89caf014964
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15233
diff
changeset
|
717 | /* The segment is somewhere after the tag */ |
|
15233
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
718 | seg->start -= change; |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
719 | seg->end -= change; |
|
15372
d89caf014964
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15233
diff
changeset
|
720 | } else if (seg->end <= tag->start) { |
|
d89caf014964
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15233
diff
changeset
|
721 | /* This segment is somewhere in front of the tag */ |
|
d89caf014964
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15233
diff
changeset
|
722 | } else if (seg->start >= tag->start) { |
|
d89caf014964
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15233
diff
changeset
|
723 | /* This segment starts in the middle of the tag */ |
|
d89caf014964
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15233
diff
changeset
|
724 | if (text == NULL) { |
|
d89caf014964
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15233
diff
changeset
|
725 | free_text_segment(seg, NULL); |
|
d89caf014964
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15233
diff
changeset
|
726 | line->segments = g_list_delete_link(line->segments, segs); |
|
d89caf014964
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15233
diff
changeset
|
727 | if (line->segments == NULL) { |
|
d89caf014964
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15233
diff
changeset
|
728 | free_text_line(line, NULL); |
|
15375
42b08c34496b
[gaim-migrate @ 18104]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15372
diff
changeset
|
729 | if (view->list == iter) { |
|
42b08c34496b
[gaim-migrate @ 18104]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15372
diff
changeset
|
730 | if (inext) |
|
42b08c34496b
[gaim-migrate @ 18104]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15372
diff
changeset
|
731 | view->list = inext; |
|
42b08c34496b
[gaim-migrate @ 18104]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15372
diff
changeset
|
732 | else |
|
42b08c34496b
[gaim-migrate @ 18104]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15372
diff
changeset
|
733 | view->list = iter->prev; |
|
42b08c34496b
[gaim-migrate @ 18104]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15372
diff
changeset
|
734 | } |
|
42b08c34496b
[gaim-migrate @ 18104]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15372
diff
changeset
|
735 | alllines = g_list_delete_link(alllines, iter); |
|
15372
d89caf014964
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15233
diff
changeset
|
736 | } |
|
d89caf014964
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15233
diff
changeset
|
737 | } else { |
|
d89caf014964
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15233
diff
changeset
|
738 | /* XXX: (null) */ |
|
d89caf014964
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15233
diff
changeset
|
739 | seg->start = tag->start; |
|
d89caf014964
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15233
diff
changeset
|
740 | seg->end = tag->end - change; |
|
d89caf014964
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15233
diff
changeset
|
741 | } |
|
d89caf014964
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15233
diff
changeset
|
742 | line->length -= change; |
|
d89caf014964
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15233
diff
changeset
|
743 | /* XXX: Make things work if the tagged text spans over several lines. */ |
|
d89caf014964
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15233
diff
changeset
|
744 | } else { |
|
d89caf014964
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15233
diff
changeset
|
745 | /* XXX: handle the rest of the conditions */ |
|
d89caf014964
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15233
diff
changeset
|
746 | g_printerr("WTF! This needs to be handled properly!!\n"); |
|
15233
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
747 | } |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
748 | } |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
749 | } |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
750 | if (text == NULL) { |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
751 | /* Remove the tag */ |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
752 | view->tags = g_list_delete_link(view->tags, list); |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
753 | free_tag(tag, NULL); |
|
15372
d89caf014964
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15233
diff
changeset
|
754 | } else { |
|
d89caf014964
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15233
diff
changeset
|
755 | tag->end -= change; |
|
15233
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
756 | } |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
757 | if (!all) |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
758 | break; |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
759 | } |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
760 | } |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
761 | return count; |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
762 | } |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14943
diff
changeset
|
763 | |
|
16186
73cb5b43aaf9
Add a utility function to assist scrolling in a textview.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16072
diff
changeset
|
764 | static gboolean |
|
73cb5b43aaf9
Add a utility function to assist scrolling in a textview.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16072
diff
changeset
|
765 | scroll_tv(GntWidget *wid, const char *key, GntTextView *tv) |
|
73cb5b43aaf9
Add a utility function to assist scrolling in a textview.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16072
diff
changeset
|
766 | { |
|
73cb5b43aaf9
Add a utility function to assist scrolling in a textview.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16072
diff
changeset
|
767 | if (strcmp(key, GNT_KEY_PGUP) == 0) { |
|
73cb5b43aaf9
Add a utility function to assist scrolling in a textview.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16072
diff
changeset
|
768 | gnt_text_view_scroll(tv, -(GNT_WIDGET(tv)->priv.height - 2)); |
|
73cb5b43aaf9
Add a utility function to assist scrolling in a textview.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16072
diff
changeset
|
769 | } else if (strcmp(key, GNT_KEY_PGDOWN) == 0) { |
|
73cb5b43aaf9
Add a utility function to assist scrolling in a textview.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16072
diff
changeset
|
770 | gnt_text_view_scroll(tv, GNT_WIDGET(tv)->priv.height - 2); |
|
73cb5b43aaf9
Add a utility function to assist scrolling in a textview.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16072
diff
changeset
|
771 | } else if (strcmp(key, GNT_KEY_DOWN) == 0) { |
|
73cb5b43aaf9
Add a utility function to assist scrolling in a textview.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16072
diff
changeset
|
772 | gnt_text_view_scroll(tv, 1); |
|
73cb5b43aaf9
Add a utility function to assist scrolling in a textview.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16072
diff
changeset
|
773 | } else if (strcmp(key, GNT_KEY_UP) == 0) { |
|
73cb5b43aaf9
Add a utility function to assist scrolling in a textview.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16072
diff
changeset
|
774 | gnt_text_view_scroll(tv, -1); |
|
73cb5b43aaf9
Add a utility function to assist scrolling in a textview.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16072
diff
changeset
|
775 | } else { |
|
73cb5b43aaf9
Add a utility function to assist scrolling in a textview.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16072
diff
changeset
|
776 | return FALSE; |
|
73cb5b43aaf9
Add a utility function to assist scrolling in a textview.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16072
diff
changeset
|
777 | } |
|
73cb5b43aaf9
Add a utility function to assist scrolling in a textview.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16072
diff
changeset
|
778 | return TRUE; |
|
73cb5b43aaf9
Add a utility function to assist scrolling in a textview.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16072
diff
changeset
|
779 | } |
|
73cb5b43aaf9
Add a utility function to assist scrolling in a textview.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16072
diff
changeset
|
780 | |
|
73cb5b43aaf9
Add a utility function to assist scrolling in a textview.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16072
diff
changeset
|
781 | void gnt_text_view_attach_scroll_widget(GntTextView *view, GntWidget *widget) |
|
73cb5b43aaf9
Add a utility function to assist scrolling in a textview.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16072
diff
changeset
|
782 | { |
|
73cb5b43aaf9
Add a utility function to assist scrolling in a textview.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16072
diff
changeset
|
783 | g_signal_connect(G_OBJECT(widget), "key_pressed", G_CALLBACK(scroll_tv), view); |
|
73cb5b43aaf9
Add a utility function to assist scrolling in a textview.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16072
diff
changeset
|
784 | } |
|
73cb5b43aaf9
Add a utility function to assist scrolling in a textview.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16072
diff
changeset
|
785 |