Mercurial > pidgin
annotate console/libgnt/gnttextview.c @ 15750:0eb7846f9e7e
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).
If you use the s.so WM, pressing alt-shift-c ("toggle-clipboard") will toggle display of the clipboard contents in a possibly easy-to-copy-with-the-x-mouse window.
This includes a plugin which interacts with the X selection, which is not built by default.
author | Richard Nelson <wabz@pidgin.im> |
---|---|
date | Fri, 02 Mar 2007 01:48:11 +0000 |
parents | a09936753f2f |
children | e0027ebd2300 |
rev | line source |
---|---|
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 #include "gnttextview.h" |
14311
fda9dc44807d
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14222
diff
changeset
|
2 #include "gntutils.h" |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
3 |
14398
2377498b4698
[gaim-migrate @ 17106]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14397
diff
changeset
|
4 #include <string.h> |
2377498b4698
[gaim-migrate @ 17106]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14397
diff
changeset
|
5 |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
6 enum |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
7 { |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 SIGS = 1, |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
9 }; |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
10 |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
11 typedef struct |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
12 { |
14371
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
13 GntTextFormatFlags tvflag; |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
14 chtype flags; |
14383
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
15 int start; |
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
16 int end; /* This is the next byte of the last character of this segment */ |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
17 } GntTextSegment; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
18 |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
19 typedef struct |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
20 { |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
21 GList *segments; /* A list of GntTextSegments */ |
14311
fda9dc44807d
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14222
diff
changeset
|
22 int length; /* The current length of the line so far (ie. onscreen width) */ |
14371
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
23 gboolean soft; /* TRUE if it's an overflow from prev. line */ |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
24 } GntTextLine; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
25 |
15171
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
26 typedef struct |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
27 { |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
28 char *name; |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
29 int start; |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
30 int end; |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
31 } GntTextTag; |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
32 |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 static GntWidgetClass *parent_class = NULL; |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
34 |
15750
0eb7846f9e7e
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:
15335
diff
changeset
|
35 static gchar *select_start; |
0eb7846f9e7e
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:
15335
diff
changeset
|
36 static gchar *select_end; |
0eb7846f9e7e
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:
15335
diff
changeset
|
37 static gboolean double_click; |
0eb7846f9e7e
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:
15335
diff
changeset
|
38 |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 static void |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 gnt_text_view_draw(GntWidget *widget) |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 { |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
42 GntTextView *view = GNT_TEXT_VIEW(widget); |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
43 int i = 0; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
44 GList *lines; |
14131
db2311999862
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14123
diff
changeset
|
45 int rows, scrcol; |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
46 |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
47 werase(widget->window); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
48 |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
49 for (i = 0, lines = view->list; i < widget->priv.height && lines; i++, lines = lines->next) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
50 { |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
51 GList *iter; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
52 GntTextLine *line = lines->data; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
53 |
14222
8c13a650cef5
[gaim-migrate @ 16903]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14221
diff
changeset
|
54 wmove(widget->window, widget->priv.height - 1 - i, 0); |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
55 |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
56 for (iter = line->segments; iter; iter = iter->next) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
57 { |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
58 GntTextSegment *seg = iter->data; |
14383
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
59 char *end = view->string->str + seg->end; |
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
60 char back = *end; |
15750
0eb7846f9e7e
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:
15335
diff
changeset
|
61 chtype fl = seg->flags; |
14383
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
62 *end = '\0'; |
15750
0eb7846f9e7e
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:
15335
diff
changeset
|
63 if (select_start < view->string->str + seg->start && select_end > view->string->str + seg->end) { |
0eb7846f9e7e
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:
15335
diff
changeset
|
64 fl |= A_REVERSE; |
0eb7846f9e7e
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:
15335
diff
changeset
|
65 wattrset(widget->window, fl); |
0eb7846f9e7e
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:
15335
diff
changeset
|
66 wprintw(widget->window, "%s", (view->string->str + seg->start)); |
0eb7846f9e7e
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:
15335
diff
changeset
|
67 } else if (select_start && select_end && |
0eb7846f9e7e
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:
15335
diff
changeset
|
68 ((select_start >= view->string->str + seg->start && select_start <= view->string->str + seg->end) || |
0eb7846f9e7e
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:
15335
diff
changeset
|
69 (select_end <= view->string->str + seg->end && select_start <= view->string->str + seg->start))) { |
0eb7846f9e7e
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:
15335
diff
changeset
|
70 char *cur = view->string->str + seg->start; |
0eb7846f9e7e
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:
15335
diff
changeset
|
71 while (*cur != '\0') { |
0eb7846f9e7e
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:
15335
diff
changeset
|
72 if (cur >= select_start && cur <= select_end) |
0eb7846f9e7e
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:
15335
diff
changeset
|
73 fl |= A_REVERSE; |
0eb7846f9e7e
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:
15335
diff
changeset
|
74 else |
0eb7846f9e7e
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:
15335
diff
changeset
|
75 fl = seg->flags; |
0eb7846f9e7e
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:
15335
diff
changeset
|
76 wattrset(widget->window, fl); |
0eb7846f9e7e
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:
15335
diff
changeset
|
77 waddch(widget->window, *cur); |
0eb7846f9e7e
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:
15335
diff
changeset
|
78 cur++; |
0eb7846f9e7e
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:
15335
diff
changeset
|
79 } |
0eb7846f9e7e
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:
15335
diff
changeset
|
80 } else { |
0eb7846f9e7e
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:
15335
diff
changeset
|
81 wattrset(widget->window, fl); |
0eb7846f9e7e
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:
15335
diff
changeset
|
82 wprintw(widget->window, "%s", (view->string->str + seg->start)); |
0eb7846f9e7e
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:
15335
diff
changeset
|
83 } |
14383
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
84 *end = back; |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
85 } |
14727
9baeeaa365d1
[gaim-migrate @ 17482]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14432
diff
changeset
|
86 wattroff(widget->window, A_UNDERLINE | A_BLINK | A_REVERSE); |
9baeeaa365d1
[gaim-migrate @ 17482]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14432
diff
changeset
|
87 whline(widget->window, ' ', widget->priv.width - line->length - 1); |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
88 } |
14123
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
89 |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
90 scrcol = widget->priv.width - 1; |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
91 rows = widget->priv.height - 2; |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
92 if (rows > 0) |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
93 { |
14131
db2311999862
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14123
diff
changeset
|
94 int total = g_list_length(g_list_first(view->list)); |
db2311999862
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14123
diff
changeset
|
95 int showing, position, up, down; |
14123
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
96 |
14131
db2311999862
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14123
diff
changeset
|
97 showing = rows * rows / total + 1; |
14123
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
98 showing = MIN(rows, showing); |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
99 |
14131
db2311999862
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14123
diff
changeset
|
100 total -= rows; |
db2311999862
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14123
diff
changeset
|
101 up = g_list_length(lines); |
db2311999862
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14123
diff
changeset
|
102 down = total - up; |
db2311999862
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14123
diff
changeset
|
103 |
db2311999862
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14123
diff
changeset
|
104 position = (rows - showing) * up / MAX(1, up + down); |
14123
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
105 position = MAX((lines != NULL), position); |
14107
c0ee28af3ca2
[gaim-migrate @ 16741]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14032
diff
changeset
|
106 |
14123
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
107 if (showing + position > rows) |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
108 position = rows - showing; |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
109 |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
110 if (showing + position == rows && view->list && view->list->prev) |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
111 position = MAX(1, rows - 1 - showing); |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
112 else if (showing + position < rows && view->list && !view->list->prev) |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
113 position = rows - showing; |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
114 |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
115 mvwvline(widget->window, position + 1, scrcol, |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
116 ACS_CKBOARD | COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D), showing); |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
117 } |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
118 |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
119 mvwaddch(widget->window, 0, scrcol, |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
120 (lines ? ACS_UARROW : ' ') | COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D)); |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
121 mvwaddch(widget->window, widget->priv.height - 1, scrcol, |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
122 ((view->list && view->list->prev) ? ACS_DARROW : ' ') | |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
123 COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D)); |
14107
c0ee28af3ca2
[gaim-migrate @ 16741]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14032
diff
changeset
|
124 |
14432
3ac156db9cb6
[gaim-migrate @ 17146]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
125 GNTDEBUG; |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
126 } |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
127 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
128 static void |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
129 gnt_text_view_size_request(GntWidget *widget) |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
130 { |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
131 if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_MAPPED)) |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
132 { |
14399
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14398
diff
changeset
|
133 gnt_widget_set_size(widget, 64, 20); |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
134 } |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
135 } |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
136 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
137 static void |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
138 gnt_text_view_map(GntWidget *widget) |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
139 { |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
140 if (widget->priv.width == 0 || widget->priv.height == 0) |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
141 gnt_widget_size_request(widget); |
14432
3ac156db9cb6
[gaim-migrate @ 17146]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
142 GNTDEBUG; |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
143 } |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
144 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
145 static gboolean |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
146 gnt_text_view_key_pressed(GntWidget *widget, const char *text) |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
147 { |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
148 return FALSE; |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
149 } |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
150 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
151 static void |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
152 free_text_segment(gpointer data, gpointer null) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
153 { |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
154 GntTextSegment *seg = data; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
155 g_free(seg); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
156 } |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
157 |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
158 static void |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
159 free_text_line(gpointer data, gpointer null) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
160 { |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
161 GntTextLine *line = data; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
162 g_list_foreach(line->segments, free_text_segment, NULL); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
163 g_list_free(line->segments); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
164 g_free(line); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
165 } |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
166 |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
167 static void |
15171
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
168 free_tag(gpointer data, gpointer null) |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
169 { |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
170 GntTextTag *tag = data; |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
171 g_free(tag->name); |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
172 g_free(tag); |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
173 } |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
174 |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
175 static void |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
176 gnt_text_view_destroy(GntWidget *widget) |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
177 { |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
178 GntTextView *view = GNT_TEXT_VIEW(widget); |
14030
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
179 view->list = g_list_first(view->list); |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
180 g_list_foreach(view->list, free_text_line, NULL); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
181 g_list_free(view->list); |
15171
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
182 g_list_foreach(view->tags, free_tag, NULL); |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
183 g_list_free(view->tags); |
14383
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
184 g_string_free(view->string, TRUE); |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
185 } |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
186 |
15750
0eb7846f9e7e
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:
15335
diff
changeset
|
187 static char * |
0eb7846f9e7e
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:
15335
diff
changeset
|
188 gnt_text_view_get_p(GntTextView *view, int x, int y) |
0eb7846f9e7e
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:
15335
diff
changeset
|
189 { |
0eb7846f9e7e
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:
15335
diff
changeset
|
190 int i; |
0eb7846f9e7e
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:
15335
diff
changeset
|
191 GntWidget *wid = GNT_WIDGET(view); |
0eb7846f9e7e
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:
15335
diff
changeset
|
192 GntTextLine *line; |
0eb7846f9e7e
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:
15335
diff
changeset
|
193 GList *lines; |
0eb7846f9e7e
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:
15335
diff
changeset
|
194 GList *segs; |
0eb7846f9e7e
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:
15335
diff
changeset
|
195 GntTextSegment *seg; |
0eb7846f9e7e
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:
15335
diff
changeset
|
196 |
0eb7846f9e7e
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:
15335
diff
changeset
|
197 y = wid->priv.height - y; |
0eb7846f9e7e
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:
15335
diff
changeset
|
198 if (g_list_length(view->list) < y) { |
0eb7846f9e7e
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:
15335
diff
changeset
|
199 x = 0; |
0eb7846f9e7e
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:
15335
diff
changeset
|
200 y = g_list_length(view->list); |
0eb7846f9e7e
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:
15335
diff
changeset
|
201 } |
0eb7846f9e7e
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:
15335
diff
changeset
|
202 |
0eb7846f9e7e
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:
15335
diff
changeset
|
203 lines = g_list_nth(view->list, y - 1); |
0eb7846f9e7e
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:
15335
diff
changeset
|
204 |
0eb7846f9e7e
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:
15335
diff
changeset
|
205 line = lines->data; |
0eb7846f9e7e
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:
15335
diff
changeset
|
206 for (i = y; line && !line->segments; i++) |
0eb7846f9e7e
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:
15335
diff
changeset
|
207 line = g_list_nth_data(lines, i); |
0eb7846f9e7e
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:
15335
diff
changeset
|
208 if (!line) /* no valid line */ |
0eb7846f9e7e
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:
15335
diff
changeset
|
209 return NULL; |
0eb7846f9e7e
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:
15335
diff
changeset
|
210 segs = line->segments; |
0eb7846f9e7e
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:
15335
diff
changeset
|
211 seg = (GntTextSegment *)segs->data; |
0eb7846f9e7e
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:
15335
diff
changeset
|
212 i = 0; |
0eb7846f9e7e
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:
15335
diff
changeset
|
213 return view->string->str + seg->start + x; |
0eb7846f9e7e
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:
15335
diff
changeset
|
214 } |
0eb7846f9e7e
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:
15335
diff
changeset
|
215 |
0eb7846f9e7e
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:
15335
diff
changeset
|
216 static GString * |
0eb7846f9e7e
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:
15335
diff
changeset
|
217 select_word_text(GntTextView *view, gchar *c) |
0eb7846f9e7e
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:
15335
diff
changeset
|
218 { |
0eb7846f9e7e
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:
15335
diff
changeset
|
219 gchar *start = c; |
0eb7846f9e7e
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:
15335
diff
changeset
|
220 gchar *end = c; |
0eb7846f9e7e
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:
15335
diff
changeset
|
221 gchar *t; |
0eb7846f9e7e
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:
15335
diff
changeset
|
222 while (t = g_utf8_prev_char(start)) { |
0eb7846f9e7e
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:
15335
diff
changeset
|
223 if (!g_ascii_isspace(*t)) { |
0eb7846f9e7e
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:
15335
diff
changeset
|
224 if (start == view->string->str) |
0eb7846f9e7e
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:
15335
diff
changeset
|
225 break; |
0eb7846f9e7e
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:
15335
diff
changeset
|
226 start = t; |
0eb7846f9e7e
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:
15335
diff
changeset
|
227 } else |
0eb7846f9e7e
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:
15335
diff
changeset
|
228 break; |
0eb7846f9e7e
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:
15335
diff
changeset
|
229 } |
0eb7846f9e7e
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:
15335
diff
changeset
|
230 while (t = g_utf8_next_char(end)) { |
0eb7846f9e7e
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:
15335
diff
changeset
|
231 if (!g_ascii_isspace(*t)) |
0eb7846f9e7e
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:
15335
diff
changeset
|
232 end = t; |
0eb7846f9e7e
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:
15335
diff
changeset
|
233 else |
0eb7846f9e7e
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:
15335
diff
changeset
|
234 break; |
0eb7846f9e7e
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:
15335
diff
changeset
|
235 } |
0eb7846f9e7e
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:
15335
diff
changeset
|
236 select_start = start; |
0eb7846f9e7e
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:
15335
diff
changeset
|
237 select_end = end; |
0eb7846f9e7e
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:
15335
diff
changeset
|
238 return g_string_new_len(start, end - start + 1); |
0eb7846f9e7e
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:
15335
diff
changeset
|
239 } |
0eb7846f9e7e
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:
15335
diff
changeset
|
240 |
0eb7846f9e7e
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:
15335
diff
changeset
|
241 static gboolean too_slow(gpointer n) |
0eb7846f9e7e
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:
15335
diff
changeset
|
242 { |
0eb7846f9e7e
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:
15335
diff
changeset
|
243 double_click = FALSE; |
0eb7846f9e7e
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:
15335
diff
changeset
|
244 return FALSE; |
0eb7846f9e7e
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:
15335
diff
changeset
|
245 } |
0eb7846f9e7e
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:
15335
diff
changeset
|
246 |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14311
diff
changeset
|
247 static gboolean |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14311
diff
changeset
|
248 gnt_text_view_clicked(GntWidget *widget, GntMouseEvent event, int x, int y) |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14311
diff
changeset
|
249 { |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14311
diff
changeset
|
250 if (event == GNT_MOUSE_SCROLL_UP) { |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14311
diff
changeset
|
251 gnt_text_view_scroll(GNT_TEXT_VIEW(widget), -1); |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14311
diff
changeset
|
252 } else if (event == GNT_MOUSE_SCROLL_DOWN) { |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14311
diff
changeset
|
253 gnt_text_view_scroll(GNT_TEXT_VIEW(widget), 1); |
15750
0eb7846f9e7e
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:
15335
diff
changeset
|
254 } else if (event == GNT_LEFT_MOUSE_DOWN) { |
0eb7846f9e7e
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:
15335
diff
changeset
|
255 select_start = gnt_text_view_get_p(GNT_TEXT_VIEW(widget), x - widget->priv.x, y - widget->priv.y); |
0eb7846f9e7e
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:
15335
diff
changeset
|
256 g_timeout_add(500, too_slow, NULL); |
0eb7846f9e7e
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:
15335
diff
changeset
|
257 } else if (event == GNT_MOUSE_UP) { |
0eb7846f9e7e
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:
15335
diff
changeset
|
258 if (select_start) { |
0eb7846f9e7e
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:
15335
diff
changeset
|
259 GString *clip; |
0eb7846f9e7e
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:
15335
diff
changeset
|
260 select_end = gnt_text_view_get_p(GNT_TEXT_VIEW(widget), x - widget->priv.x, y - widget->priv.y); |
0eb7846f9e7e
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:
15335
diff
changeset
|
261 if (select_end < select_start) { |
0eb7846f9e7e
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:
15335
diff
changeset
|
262 gchar *t = select_start; |
0eb7846f9e7e
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:
15335
diff
changeset
|
263 select_start = select_end; |
0eb7846f9e7e
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:
15335
diff
changeset
|
264 select_end = t; |
0eb7846f9e7e
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:
15335
diff
changeset
|
265 } |
0eb7846f9e7e
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:
15335
diff
changeset
|
266 if (select_start == select_end) { |
0eb7846f9e7e
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:
15335
diff
changeset
|
267 if (double_click) { |
0eb7846f9e7e
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:
15335
diff
changeset
|
268 clip = select_word_text(GNT_TEXT_VIEW(widget), select_start); |
0eb7846f9e7e
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:
15335
diff
changeset
|
269 double_click = FALSE; |
0eb7846f9e7e
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:
15335
diff
changeset
|
270 } else { |
0eb7846f9e7e
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:
15335
diff
changeset
|
271 double_click = TRUE; |
0eb7846f9e7e
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:
15335
diff
changeset
|
272 select_start = 0; |
0eb7846f9e7e
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:
15335
diff
changeset
|
273 select_end = 0; |
0eb7846f9e7e
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:
15335
diff
changeset
|
274 gnt_widget_draw(widget); |
0eb7846f9e7e
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:
15335
diff
changeset
|
275 return; |
0eb7846f9e7e
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:
15335
diff
changeset
|
276 } |
0eb7846f9e7e
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:
15335
diff
changeset
|
277 } else { |
0eb7846f9e7e
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:
15335
diff
changeset
|
278 clip = g_string_new_len(select_start, select_end - select_start + 1); |
0eb7846f9e7e
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:
15335
diff
changeset
|
279 } |
0eb7846f9e7e
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:
15335
diff
changeset
|
280 gnt_widget_draw(widget); |
0eb7846f9e7e
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:
15335
diff
changeset
|
281 gnt_set_clipboard_string(clip->str); |
0eb7846f9e7e
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:
15335
diff
changeset
|
282 g_string_free(clip, TRUE); |
0eb7846f9e7e
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:
15335
diff
changeset
|
283 } |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14311
diff
changeset
|
284 } else |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14311
diff
changeset
|
285 return FALSE; |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14311
diff
changeset
|
286 return TRUE; |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14311
diff
changeset
|
287 } |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14311
diff
changeset
|
288 |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
289 static void |
14371
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
290 gnt_text_view_reflow(GntTextView *view) |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
291 { |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
292 /* This is pretty ugly, and inefficient. Someone do something about it. */ |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
293 GntTextLine *line; |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
294 GList *back, *iter, *list; |
14383
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
295 GString *string; |
14826
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
296 int pos = 0; /* no. of 'real' lines */ |
14371
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
297 |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
298 list = view->list; |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
299 while (list->prev) { |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
300 line = list->data; |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
301 if (!line->soft) |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
302 pos++; |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
303 list = list->prev; |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
304 } |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
305 |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
306 back = g_list_last(view->list); |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
307 view->list = NULL; |
14383
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
308 |
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
309 string = view->string; |
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
310 view->string = NULL; |
14371
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
311 gnt_text_view_clear(view); |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
312 |
14383
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
313 view->string = g_string_set_size(view->string, string->len); |
14826
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
314 view->string->len = 0; |
14383
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
315 GNT_WIDGET_SET_FLAGS(GNT_WIDGET(view), GNT_WIDGET_DRAWING); |
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
316 |
14371
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
317 for (; back; back = back->prev) { |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
318 line = back->data; |
14383
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
319 if (back->next && !line->soft) { |
14826
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
320 gnt_text_view_append_text_with_flags(view, "\n", GNT_TEXT_FLAG_NORMAL); |
14383
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
321 } |
14826
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
322 |
14371
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
323 for (iter = line->segments; iter; iter = iter->next) { |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
324 GntTextSegment *seg = iter->data; |
14383
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
325 char *start = string->str + seg->start; |
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
326 char *end = string->str + seg->end; |
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
327 char back = *end; |
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
328 *end = '\0'; |
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
329 gnt_text_view_append_text_with_flags(view, start, seg->tvflag); |
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
330 *end = back; |
14371
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
331 } |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
332 free_text_line(line, NULL); |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
333 } |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
334 g_list_free(list); |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
335 |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
336 list = view->list = g_list_first(view->list); |
14826
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
337 /* Go back to the line that was in view before resizing started */ |
14371
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
338 while (pos--) { |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
339 while (((GntTextLine*)list->data)->soft) |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
340 list = list->next; |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
341 list = list->next; |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
342 } |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
343 view->list = list; |
14383
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
344 GNT_WIDGET_UNSET_FLAGS(GNT_WIDGET(view), GNT_WIDGET_DRAWING); |
14881
5228f8cf2a6a
[gaim-migrate @ 17650]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14826
diff
changeset
|
345 if (GNT_WIDGET(view)->window) |
5228f8cf2a6a
[gaim-migrate @ 17650]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14826
diff
changeset
|
346 gnt_widget_draw(GNT_WIDGET(view)); |
14383
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
347 g_string_free(string, TRUE); |
14371
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
348 } |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
349 |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
350 static void |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
351 gnt_text_view_size_changed(GntWidget *widget, int w, int h) |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
352 { |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
353 if (w != widget->priv.width) { |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
354 gnt_text_view_reflow(GNT_TEXT_VIEW(widget)); |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
355 } |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
356 } |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
357 |
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
358 static void |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
359 gnt_text_view_class_init(GntTextViewClass *klass) |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
360 { |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
361 parent_class = GNT_WIDGET_CLASS(klass); |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
362 parent_class->destroy = gnt_text_view_destroy; |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
363 parent_class->draw = gnt_text_view_draw; |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
364 parent_class->map = gnt_text_view_map; |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
365 parent_class->size_request = gnt_text_view_size_request; |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
366 parent_class->key_pressed = gnt_text_view_key_pressed; |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14311
diff
changeset
|
367 parent_class->clicked = gnt_text_view_clicked; |
14371
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
368 parent_class->size_changed = gnt_text_view_size_changed; |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
369 |
14432
3ac156db9cb6
[gaim-migrate @ 17146]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
370 GNTDEBUG; |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
371 } |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
372 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
373 static void |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
374 gnt_text_view_init(GTypeInstance *instance, gpointer class) |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
375 { |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
376 GntWidget *widget = GNT_WIDGET(instance); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
377 |
14371
f3137c1faebe
[gaim-migrate @ 17077]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
378 GNT_WIDGET_SET_FLAGS(GNT_WIDGET(instance), GNT_WIDGET_GROW_Y | GNT_WIDGET_GROW_X); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
379 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
380 widget->priv.minw = 5; |
14123
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
381 widget->priv.minh = 2; |
14432
3ac156db9cb6
[gaim-migrate @ 17146]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
382 GNTDEBUG; |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
383 } |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
384 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
385 /****************************************************************************** |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
386 * GntTextView API |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
387 *****************************************************************************/ |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
388 GType |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
389 gnt_text_view_get_gtype(void) |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
390 { |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
391 static GType type = 0; |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
392 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
393 if(type == 0) |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
394 { |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
395 static const GTypeInfo info = { |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
396 sizeof(GntTextViewClass), |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
397 NULL, /* base_init */ |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
398 NULL, /* base_finalize */ |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
399 (GClassInitFunc)gnt_text_view_class_init, |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
400 NULL, /* class_finalize */ |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
401 NULL, /* class_data */ |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
402 sizeof(GntTextView), |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
403 0, /* n_preallocs */ |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
404 gnt_text_view_init, /* instance_init */ |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
405 }; |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
406 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
407 type = g_type_register_static(GNT_TYPE_WIDGET, |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
408 "GntTextView", |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
409 &info, 0); |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
410 } |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
411 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
412 return type; |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
413 } |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
414 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
415 GntWidget *gnt_text_view_new() |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
416 { |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
417 GntWidget *widget = g_object_new(GNT_TYPE_TEXTVIEW, NULL); |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
418 GntTextView *view = GNT_TEXT_VIEW(widget); |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
419 GntTextLine *line = g_new0(GntTextLine, 1); |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
420 |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
421 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW); |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
422 |
14383
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
423 view->string = g_string_new(NULL); |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
424 view->list = g_list_append(view->list, line); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
425 |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
426 return widget; |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
427 } |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
428 |
13931
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
429 void gnt_text_view_append_text_with_flags(GntTextView *view, const char *text, GntTextFormatFlags flags) |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
430 { |
15171
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
431 gnt_text_view_append_text_with_tag(view, text, flags, NULL); |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
432 } |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
433 |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
434 void gnt_text_view_append_text_with_tag(GntTextView *view, const char *text, |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
435 GntTextFormatFlags flags, const char *tagname) |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
436 { |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
437 GntWidget *widget = GNT_WIDGET(view); |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
438 int fl = 0; |
14383
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
439 const char *start, *end; |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
440 GList *list = view->list; |
14383
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
441 GntTextLine *line; |
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
442 int len; |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
443 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
444 if (text == NULL || *text == '\0') |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
445 return; |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
446 |
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
447 fl = gnt_text_format_flag_to_chtype(flags); |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
448 |
14383
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
449 len = view->string->len; |
14826
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
450 view->string = g_string_append(view->string, text); |
14383
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
451 |
15171
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
452 if (tagname) { |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
453 GntTextTag *tag = g_new0(GntTextTag, 1); |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
454 tag->name = g_strdup(tagname); |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
455 tag->start = len; |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
456 tag->end = view->string->len; |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
457 view->tags = g_list_append(view->tags, tag); |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
458 } |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
459 |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
460 view->list = g_list_first(view->list); |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
461 |
14383
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
462 start = end = view->string->str + len; |
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
463 |
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
464 while (*start) { |
14826
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
465 GntTextSegment *seg = NULL; |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
466 |
14383
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
467 if (*end == '\n' || *end == '\r') { |
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
468 end++; |
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
469 start = end; |
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
470 gnt_text_view_next_line(view); |
14398
2377498b4698
[gaim-migrate @ 17106]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14397
diff
changeset
|
471 view->list = g_list_first(view->list); |
14383
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
472 continue; |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
473 } |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
474 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
475 line = view->list->data; |
14826
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
476 if (line->length == widget->priv.width - 1) { |
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
477 /* The last added line was exactly the same width as the widget */ |
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
478 line = g_new0(GntTextLine, 1); |
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
479 line->soft = TRUE; |
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
480 view->list = g_list_prepend(view->list, line); |
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
481 } |
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
482 |
14397
70f52ff1caec
[gaim-migrate @ 17105]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14383
diff
changeset
|
483 if ((end = strchr(start, '\n')) != NULL || |
70f52ff1caec
[gaim-migrate @ 17105]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14383
diff
changeset
|
484 (end = strchr(start, '\r')) != NULL) { |
14398
2377498b4698
[gaim-migrate @ 17106]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14397
diff
changeset
|
485 len = gnt_util_onscreen_width(start, end - 1); |
2377498b4698
[gaim-migrate @ 17106]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14397
diff
changeset
|
486 if (len >= widget->priv.width - line->length - 1) { |
14397
70f52ff1caec
[gaim-migrate @ 17105]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14383
diff
changeset
|
487 end = NULL; |
70f52ff1caec
[gaim-migrate @ 17105]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14383
diff
changeset
|
488 } |
70f52ff1caec
[gaim-migrate @ 17105]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14383
diff
changeset
|
489 } |
70f52ff1caec
[gaim-migrate @ 17105]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14383
diff
changeset
|
490 |
70f52ff1caec
[gaim-migrate @ 17105]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14383
diff
changeset
|
491 if (end == NULL) |
70f52ff1caec
[gaim-migrate @ 17105]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14383
diff
changeset
|
492 end = gnt_util_onscreen_width_to_pointer(start, |
70f52ff1caec
[gaim-migrate @ 17105]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14383
diff
changeset
|
493 widget->priv.width - line->length - 1, &len); |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
494 |
14826
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
495 /* Try to append to the previous segment if possible */ |
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
496 if (line->segments) { |
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
497 seg = g_list_last(line->segments)->data; |
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
498 if (seg->flags != fl) |
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
499 seg = NULL; |
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
500 } |
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
501 |
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
502 if (seg == NULL) { |
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
503 seg = g_new0(GntTextSegment, 1); |
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
504 seg->start = start - view->string->str; |
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
505 seg->tvflag = flags; |
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
506 seg->flags = fl; |
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
507 line->segments = g_list_append(line->segments, seg); |
955798236bf4
[gaim-migrate @ 17593]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14729
diff
changeset
|
508 } |
14383
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
509 seg->end = end - view->string->str; |
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
510 line->length += len; |
14311
fda9dc44807d
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14222
diff
changeset
|
511 |
14383
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
512 start = end; |
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
513 if (*end && *end != '\n' && *end != '\r') { |
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
514 line = g_new0(GntTextLine, 1); |
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
515 line->soft = TRUE; |
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
516 view->list = g_list_prepend(view->list, line); |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
517 } |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
518 } |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
519 |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
520 view->list = list; |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
521 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
522 gnt_widget_draw(widget); |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
523 } |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
524 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
525 void gnt_text_view_scroll(GntTextView *view, int scroll) |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
526 { |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
527 if (scroll == 0) |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
528 { |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
529 view->list = g_list_first(view->list); |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
530 } |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
531 else if (scroll > 0) |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
532 { |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
533 GList *list = g_list_nth_prev(view->list, scroll); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
534 if (list == NULL) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
535 list = g_list_first(view->list); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
536 view->list = list; |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
537 } |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
538 else if (scroll < 0) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
539 { |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
540 GList *list = g_list_nth(view->list, -scroll); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
541 if (list == NULL) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
542 list = g_list_last(view->list); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
543 view->list = list; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
544 } |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
545 |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
546 gnt_widget_draw(GNT_WIDGET(view)); |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
547 } |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
548 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
549 void gnt_text_view_next_line(GntTextView *view) |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
550 { |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
551 GntTextLine *line = g_new0(GntTextLine, 1); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
552 GList *list = view->list; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
553 |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
554 view->list = g_list_prepend(g_list_first(view->list), line); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
555 view->list = list; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
556 gnt_widget_draw(GNT_WIDGET(view)); |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
557 } |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
558 |
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
559 chtype gnt_text_format_flag_to_chtype(GntTextFormatFlags flags) |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
560 { |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
561 chtype fl = 0; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
562 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
563 if (flags & GNT_TEXT_FLAG_BOLD) |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
564 fl |= A_BOLD; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
565 if (flags & GNT_TEXT_FLAG_UNDERLINE) |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
566 fl |= A_UNDERLINE; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
567 if (flags & GNT_TEXT_FLAG_BLINK) |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
568 fl |= A_BLINK; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
569 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
570 if (flags & GNT_TEXT_FLAG_DIM) |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
571 fl |= (A_DIM | COLOR_PAIR(GNT_COLOR_DISABLED)); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
572 else if (flags & GNT_TEXT_FLAG_HIGHLIGHT) |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
573 fl |= (A_DIM | COLOR_PAIR(GNT_COLOR_HIGHLIGHT)); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
574 else |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
575 fl |= COLOR_PAIR(GNT_COLOR_NORMAL); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
576 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
577 return fl; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
578 } |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
579 |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
580 void gnt_text_view_clear(GntTextView *view) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
581 { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
582 GntTextLine *line; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
583 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
584 g_list_foreach(view->list, free_text_line, NULL); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
585 g_list_free(view->list); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
586 view->list = NULL; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
587 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
588 line = g_new0(GntTextLine, 1); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
589 view->list = g_list_append(view->list, line); |
14383
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
590 if (view->string) |
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
591 g_string_free(view->string, TRUE); |
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14371
diff
changeset
|
592 view->string = g_string_new(NULL); |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
593 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
594 if (GNT_WIDGET(view)->window) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
595 gnt_widget_draw(GNT_WIDGET(view)); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
596 } |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
597 |
14030
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
598 int gnt_text_view_get_lines_below(GntTextView *view) |
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
599 { |
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
600 int below = 0; |
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
601 GList *list = view->list; |
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
602 while ((list = list->prev)) |
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
603 ++below; |
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
604 return below; |
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
605 } |
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
606 |
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
607 int gnt_text_view_get_lines_above(GntTextView *view) |
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
608 { |
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
609 int above = 0; |
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
610 GList *list = view->list; |
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
611 list = g_list_nth(view->list, GNT_WIDGET(view)->priv.height); |
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
612 if (!list) |
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
613 return 0; |
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
614 while ((list = list->next)) |
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
615 ++above; |
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
616 return above; |
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
617 } |
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
618 |
15171
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
619 /** |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
620 * XXX: There are quite possibly more than a few bugs here. |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
621 */ |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
622 int gnt_text_view_tag_change(GntTextView *view, const char *name, const char *text, gboolean all) |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
623 { |
15313
508e64b12d98
[gaim-migrate @ 18104]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15310
diff
changeset
|
624 GList *alllines = g_list_first(view->list); |
15171
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
625 GList *list, *next, *iter, *inext; |
15335
a09936753f2f
[gaim-migrate @ 18127]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15334
diff
changeset
|
626 const int text_length = text ? strlen(text) : 0; |
15171
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
627 int count = 0; |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
628 for (list = view->tags; list; list = next) { |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
629 GntTextTag *tag = list->data; |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
630 next = list->next; |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
631 if (strcmp(tag->name, name) == 0) { |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
632 int change; |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
633 char *before, *after; |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
634 |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
635 count++; |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
636 |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
637 before = g_strndup(view->string->str, tag->start); |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
638 after = g_strdup(view->string->str + tag->end); |
15334
fa49e24d24f3
[gaim-migrate @ 18126]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15313
diff
changeset
|
639 change = (tag->end - tag->start) - text_length; |
15171
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
640 |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
641 g_string_printf(view->string, "%s%s%s", before, text ? text : "", after); |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
642 g_free(before); |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
643 g_free(after); |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
644 |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
645 /* Update the offsets of the next tags */ |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
646 for (iter = next; iter; iter = iter->next) { |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
647 GntTextTag *t = iter->data; |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
648 t->start -= change; |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
649 t->end -= change; |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
650 } |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
651 |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
652 /* Update the offsets of the segments */ |
15313
508e64b12d98
[gaim-migrate @ 18104]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15310
diff
changeset
|
653 for (iter = alllines; iter; iter = inext) { |
15171
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
654 GList *segs, *snext; |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
655 GntTextLine *line = iter->data; |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
656 inext = iter->next; |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
657 for (segs = line->segments; segs; segs = snext) { |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
658 GntTextSegment *seg = segs->data; |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
659 snext = segs->next; |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
660 if (seg->start >= tag->end) { |
15310
e9963b2cfcaf
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15171
diff
changeset
|
661 /* The segment is somewhere after the tag */ |
15171
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
662 seg->start -= change; |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
663 seg->end -= change; |
15310
e9963b2cfcaf
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15171
diff
changeset
|
664 } else if (seg->end <= tag->start) { |
e9963b2cfcaf
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15171
diff
changeset
|
665 /* This segment is somewhere in front of the tag */ |
e9963b2cfcaf
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15171
diff
changeset
|
666 } else if (seg->start >= tag->start) { |
e9963b2cfcaf
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15171
diff
changeset
|
667 /* This segment starts in the middle of the tag */ |
e9963b2cfcaf
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15171
diff
changeset
|
668 if (text == NULL) { |
e9963b2cfcaf
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15171
diff
changeset
|
669 free_text_segment(seg, NULL); |
e9963b2cfcaf
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15171
diff
changeset
|
670 line->segments = g_list_delete_link(line->segments, segs); |
e9963b2cfcaf
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15171
diff
changeset
|
671 if (line->segments == NULL) { |
e9963b2cfcaf
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15171
diff
changeset
|
672 free_text_line(line, NULL); |
15313
508e64b12d98
[gaim-migrate @ 18104]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15310
diff
changeset
|
673 if (view->list == iter) { |
508e64b12d98
[gaim-migrate @ 18104]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15310
diff
changeset
|
674 if (inext) |
508e64b12d98
[gaim-migrate @ 18104]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15310
diff
changeset
|
675 view->list = inext; |
508e64b12d98
[gaim-migrate @ 18104]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15310
diff
changeset
|
676 else |
508e64b12d98
[gaim-migrate @ 18104]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15310
diff
changeset
|
677 view->list = iter->prev; |
508e64b12d98
[gaim-migrate @ 18104]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15310
diff
changeset
|
678 } |
508e64b12d98
[gaim-migrate @ 18104]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15310
diff
changeset
|
679 alllines = g_list_delete_link(alllines, iter); |
15310
e9963b2cfcaf
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15171
diff
changeset
|
680 } |
e9963b2cfcaf
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15171
diff
changeset
|
681 } else { |
e9963b2cfcaf
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15171
diff
changeset
|
682 /* XXX: (null) */ |
e9963b2cfcaf
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15171
diff
changeset
|
683 seg->start = tag->start; |
e9963b2cfcaf
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15171
diff
changeset
|
684 seg->end = tag->end - change; |
e9963b2cfcaf
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15171
diff
changeset
|
685 } |
e9963b2cfcaf
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15171
diff
changeset
|
686 line->length -= change; |
e9963b2cfcaf
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15171
diff
changeset
|
687 /* XXX: Make things work if the tagged text spans over several lines. */ |
e9963b2cfcaf
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15171
diff
changeset
|
688 } else { |
e9963b2cfcaf
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15171
diff
changeset
|
689 /* XXX: handle the rest of the conditions */ |
e9963b2cfcaf
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15171
diff
changeset
|
690 g_printerr("WTF! This needs to be handled properly!!\n"); |
15171
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
691 } |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
692 } |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
693 } |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
694 if (text == NULL) { |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
695 /* Remove the tag */ |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
696 view->tags = g_list_delete_link(view->tags, list); |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
697 free_tag(tag, NULL); |
15310
e9963b2cfcaf
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15171
diff
changeset
|
698 } else { |
e9963b2cfcaf
[gaim-migrate @ 18101]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15171
diff
changeset
|
699 tag->end -= change; |
15171
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
700 } |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
701 if (!all) |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
702 break; |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
703 } |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
704 } |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
705 return count; |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
706 } |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
707 |