annotate src/gtkhtml.c @ 1294:7f486375bfd5

[gaim-migrate @ 1304] um committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Mon, 18 Dec 2000 22:56:13 +0000
parents b5783215b245
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2 /*
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3 * gaim
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
5 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
6 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
10 * (at your option) any later version.
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
11 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
15 * GNU General Public License for more details.
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
16 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
20 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
21 */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
22
349
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 337
diff changeset
23 #ifdef HAVE_CONFIG_H
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 337
diff changeset
24 #include "../config.h"
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 337
diff changeset
25 #endif
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
26 #include <stdio.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
27 #include <stdlib.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
28 #include <string.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
29 #include <gtk/gtk.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
30 #include <gdk/gdkprivate.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
31 #include <gdk/gdkx.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
32 #include <gdk/gdkkeysyms.h>
604
0b1a132e0f75 [gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 574
diff changeset
33 #include <ctype.h>
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
34
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
35 #ifndef _WIN32
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
36 #include <X11/Xlib.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
37 #include <X11/Xatom.h>
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
38 #endif
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
39
69
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
40 #include "gaim.h"
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
41 #include "gtkhtml.h"
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
42
549
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
43 #include "pixmaps/aol_icon.xpm"
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
44 #include "pixmaps/admin_icon.xpm"
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
45 #include "pixmaps/free_icon.xpm"
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
46 #include "pixmaps/dt_icon.xpm"
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
47 #define MAX_SIZE 7
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
48 #define MIN_HTML_WIDTH_LINES 20
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
49 #define MIN_HTML_HEIGHT_LINES 10
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
50 #define BORDER_WIDTH 2
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
51 #define SCROLL_TIME 100
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
52 #define SCROLL_PIXELS 5
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
53 #define KEY_SCROLL_PIXELS 10
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
54
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
55 int font_sizes[] = { 80, 100, 120, 140, 200, 300, 400 };
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
56
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
57 /*
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
58 GdkFont *fixed_font[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
59 GdkFont *fixed_bold_font[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
60 GdkFont *fixed_italic_font[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
61 GdkFont *fixed_bold_italic_font[] =
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
62 { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
63 GdkFont *prop_font[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
64 GdkFont *prop_bold_font[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
65 GdkFont *prop_italic_font[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
66 GdkFont *prop_bold_italic_font[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
67 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
68
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
69 GData * font_cache;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
70 static gboolean cache_init = FALSE;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
71
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
72 struct font_state
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
73 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
74 int size;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
75 int owncolor;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
76 int ownbg;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
77 gchar font[1024];
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
78 GdkColor *color;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
79 GdkColor *bgcol;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
80 struct font_state *next;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
81 };
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
82
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
83 struct font_state *push_state(struct font_state *current)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
84 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
85 struct font_state *tmp;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
86 tmp = (struct font_state *) g_new0(struct font_state, 1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
87 tmp->next = current;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
88 tmp->color = current->color;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
89 tmp->bgcol = current->bgcol;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
90 tmp->size = current->size;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
91 tmp->owncolor = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
92 tmp->ownbg = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
93 strcpy( tmp->font, current->font );
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
94 return tmp;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
95 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
96
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
97 enum
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
98 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
99 ARG_0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
100 ARG_HADJUSTMENT,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
101 ARG_VADJUSTMENT,
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
102 };
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
103
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
104
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
105 enum
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
106 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
107 TARGET_STRING,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
108 TARGET_TEXT,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
109 TARGET_COMPOUND_TEXT
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
110 };
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
111
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
112
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
113 static void gtk_html_class_init(GtkHtmlClass * klass);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
114 static void gtk_html_set_arg(GtkObject * object, GtkArg * arg, guint arg_id);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
115 static void gtk_html_get_arg(GtkObject * object, GtkArg * arg, guint arg_id);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
116 static void gtk_html_init(GtkHtml * html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
117 static void gtk_html_destroy(GtkObject * object);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
118 static void gtk_html_finalize(GtkObject * object);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
119 static void gtk_html_realize(GtkWidget * widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
120 static void gtk_html_unrealize(GtkWidget * widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
121 static void gtk_html_style_set(GtkWidget * widget, GtkStyle * previous_style);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
122 static void gtk_html_draw_focus(GtkWidget * widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
123 static void gtk_html_size_request(GtkWidget * widget,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
124 GtkRequisition * requisition);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
125 static void gtk_html_size_allocate(GtkWidget * widget,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
126 GtkAllocation * allocation);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
127 static void gtk_html_adjustment(GtkAdjustment * adjustment, GtkHtml * html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
128 static void gtk_html_disconnect(GtkAdjustment * adjustment, GtkHtml * html);
914
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
129 static void gtk_html_add_seperator(GtkHtml *, GdkFont *, GdkColor *, GdkColor *);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
130 static void gtk_html_add_text(GtkHtml * html,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
131 GdkFont * font,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
132 GdkColor * fore,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
133 GdkColor * back,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
134 gchar * chars,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
135 gint length,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
136 gint uline, gint strike, gchar * url);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
137 static void gtk_html_draw_bit(GtkHtml * html,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
138 GtkHtmlBit * htmlbit, gint redraw);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
139 static void gtk_html_selection_get(GtkWidget * widget,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
140 GtkSelectionData * selection_data,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
141 guint sel_info, guint32 time);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
142 static gint gtk_html_selection_clear(GtkWidget * widget,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
143 GdkEventSelection * event);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
144 static gint gtk_html_visibility_notify(GtkWidget * widget,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
145 GdkEventVisibility * event);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
146
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
147
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
148 /* Event handlers */
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
149 static void gtk_html_draw(GtkWidget * widget, GdkRectangle * area);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
150 static gint gtk_html_expose(GtkWidget * widget, GdkEventExpose * event);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
151 static gint gtk_html_button_press(GtkWidget * widget, GdkEventButton * event);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
152 static gint gtk_html_button_release(GtkWidget * widget, GdkEventButton * event);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
153 static gint gtk_html_motion_notify(GtkWidget * widget, GdkEventMotion * event);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
154 static gint gtk_html_key_press(GtkWidget * widget, GdkEventKey * event);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
155 static gint gtk_html_leave_notify(GtkWidget * widget, GdkEventCrossing * event);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
156
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
157 static gint gtk_html_tooltip_timeout(gpointer data);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
158
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
159
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
160 static void clear_area(GtkHtml * html, GdkRectangle * area);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
161 static void expose_html(GtkHtml * html, GdkRectangle * area, gboolean cursor);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
162 static void scroll_down(GtkHtml * html, gint diff0);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
163 static void scroll_up(GtkHtml * html, gint diff0);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
164
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
165 static void adjust_adj(GtkHtml * html, GtkAdjustment * adj);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
166 static void resize_html(GtkHtml * html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
167 static gint html_bit_is_onscreen(GtkHtml * html, GtkHtmlBit * hb);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
168 static void draw_cursor(GtkHtml * html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
169 static void undraw_cursor(GtkHtml * html);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
170
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
171 static int get_line_height(GtkHtml *, GtkHtmlBit *);
895
81a8fb0a565f [gaim-migrate @ 905]
Todd Kulesza <fflewddur>
parents: 894
diff changeset
172
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
173 static GtkWidgetClass *parent_class = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
174
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
175 GtkType gtk_html_get_type(void)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
176 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
177 static GtkType html_type = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
178
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
179 if (!html_type)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
180 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
181 static const GtkTypeInfo html_info = {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
182 "GtkHtml",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
183 sizeof(GtkHtml),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
184 sizeof(GtkHtmlClass),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
185 (GtkClassInitFunc) gtk_html_class_init,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
186 (GtkObjectInitFunc) gtk_html_init,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
187 NULL,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
188 NULL,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
189 NULL,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
190 };
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
191 html_type = gtk_type_unique(GTK_TYPE_WIDGET, &html_info);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
192 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
193 return html_type;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
194 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
195
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
196
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
197 static void gtk_html_class_init(GtkHtmlClass * class)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
198 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
199 GtkObjectClass *object_class;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
200 GtkWidgetClass *widget_class;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
201
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
202 object_class = (GtkObjectClass *) class;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
203 widget_class = (GtkWidgetClass *) class;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
204 parent_class = gtk_type_class(GTK_TYPE_WIDGET);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
205
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
206
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
207 gtk_object_add_arg_type("GtkHtml::hadjustment",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
208 GTK_TYPE_ADJUSTMENT,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
209 GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
210 ARG_HADJUSTMENT);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
211
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
212 gtk_object_add_arg_type("GtkHtml::vadjustment",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
213 GTK_TYPE_ADJUSTMENT,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
214 GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
215 ARG_VADJUSTMENT);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
216
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
217 object_class->set_arg = gtk_html_set_arg;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
218 object_class->get_arg = gtk_html_get_arg;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
219 object_class->destroy = gtk_html_destroy;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
220 object_class->finalize = gtk_html_finalize;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
221
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
222 widget_class->realize = gtk_html_realize;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
223 widget_class->unrealize = gtk_html_unrealize;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
224 widget_class->style_set = gtk_html_style_set;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
225 widget_class->draw_focus = gtk_html_draw_focus;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
226 widget_class->size_request = gtk_html_size_request;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
227 widget_class->size_allocate = gtk_html_size_allocate;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
228 widget_class->draw = gtk_html_draw;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
229 widget_class->expose_event = gtk_html_expose;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
230 widget_class->button_press_event = gtk_html_button_press;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
231 widget_class->button_release_event = gtk_html_button_release;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
232 widget_class->motion_notify_event = gtk_html_motion_notify;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
233 widget_class->leave_notify_event = gtk_html_leave_notify;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
234 widget_class->selection_get = gtk_html_selection_get;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
235 widget_class->selection_clear_event = gtk_html_selection_clear;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
236 widget_class->key_press_event = gtk_html_key_press;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
237 widget_class->visibility_notify_event = gtk_html_visibility_notify;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
238
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
239
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
240 widget_class->set_scroll_adjustments_signal =
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
241 gtk_signal_new("set_scroll_adjustments",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
242 GTK_RUN_LAST,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
243 object_class->type,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
244 GTK_SIGNAL_OFFSET(GtkHtmlClass, set_scroll_adjustments),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
245 gtk_marshal_NONE__POINTER_POINTER,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
246 GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
247 GTK_TYPE_ADJUSTMENT);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
248
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
249
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
250 class->set_scroll_adjustments = gtk_html_set_adjustments;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
251
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
252 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
253
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
254 static void gtk_html_set_arg(GtkObject * object, GtkArg * arg, guint arg_id)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
255 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
256 GtkHtml *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
257
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
258 html = GTK_HTML(object);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
259
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
260 switch (arg_id)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
261 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
262 case ARG_HADJUSTMENT:
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
263 gtk_html_set_adjustments(html, GTK_VALUE_POINTER(*arg), html->vadj);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
264 break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
265 case ARG_VADJUSTMENT:
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
266 gtk_html_set_adjustments(html, html->hadj, GTK_VALUE_POINTER(*arg));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
267 break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
268 default:
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
269 break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
270 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
271 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
272
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
273 static void gtk_html_get_arg(GtkObject * object, GtkArg * arg, guint arg_id)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
274 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
275 GtkHtml *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
276
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
277 html = GTK_HTML(object);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
278
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
279 switch (arg_id)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
280 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
281 case ARG_HADJUSTMENT:
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
282 GTK_VALUE_POINTER(*arg) = html->hadj;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
283 break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
284 case ARG_VADJUSTMENT:
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
285 GTK_VALUE_POINTER(*arg) = html->vadj;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
286 break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
287 default:
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
288 arg->type = GTK_TYPE_INVALID;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
289 break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
290 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
291 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
292
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
293 static void gtk_html_init(GtkHtml * html)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
294 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
295 static const GtkTargetEntry targets[] = {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
296 {"STRING", 0, TARGET_STRING},
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
297 {"TEXT", 0, TARGET_TEXT},
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
298 {"COMPOUND_TEXT", 0, TARGET_COMPOUND_TEXT}
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
299 };
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
300
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
301 static const gint n_targets = sizeof(targets) / sizeof(targets[0]);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
302
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
303 GTK_WIDGET_SET_FLAGS(html, GTK_CAN_FOCUS);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
304
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
305 html->html_area = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
306 html->hadj = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
307 html->vadj = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
308 html->current_x = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
309 html->current_y = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
310 html->start_sel = html->end_sel = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
311 html->start_sel_x = html->start_sel_y = -1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
312 html->num_end = html->num_start = -1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
313
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
314 html->html_bits = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
315 html->urls = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
316 html->selected_text = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
317 html->tooltip_hb = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
318 html->tooltip_timer = -1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
319 html->tooltip_window = NULL;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
320 html->cursor_hb = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
321 html->cursor_pos = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
322
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
323 html->pm = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
324
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
325 html->editable = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
326 html->transparent = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
327
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
328 html->frozen = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
329
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
330 gtk_selection_add_targets(GTK_WIDGET(html), GDK_SELECTION_PRIMARY,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
331 targets, n_targets);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
332
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
333
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
334
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
335 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
336
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
337
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
338 GtkWidget *gtk_html_new(GtkAdjustment * hadj, GtkAdjustment * vadj)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
339 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
340 GtkWidget *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
341 if(!cache_init)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
342 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
343 g_datalist_init(&font_cache);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
344 cache_init = TRUE;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
345 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
346
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
347 if (hadj)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
348 g_return_val_if_fail(GTK_IS_ADJUSTMENT(hadj), NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
349 if (vadj)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
350 g_return_val_if_fail(GTK_IS_ADJUSTMENT(vadj), NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
351
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
352 html = gtk_widget_new(GTK_TYPE_HTML,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
353 "hadjustment", hadj, "vadjustment", vadj, NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
354
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
355 return html;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
356 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
357
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
358
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
359 void gtk_html_set_editable(GtkHtml * html, gboolean is_editable)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
360 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
361 g_return_if_fail(html != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
362 g_return_if_fail(GTK_IS_HTML(html));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
363
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
364
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
365 html->editable = (is_editable != FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
366
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
367 if (is_editable)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
368 draw_cursor(html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
369 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
370 undraw_cursor(html);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
371
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
372 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
373
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
374 void gtk_html_set_transparent(GtkHtml * html, gboolean is_transparent)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
375 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
376 GdkRectangle rect;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
377 gint width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
378 height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
379 GtkWidget *widget;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
380
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
381 g_return_if_fail(html != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
382 g_return_if_fail(GTK_IS_HTML(html));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
383
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
384
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
385 widget = GTK_WIDGET(html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
386 html->transparent = (is_transparent != FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
387
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
388 if (!GTK_WIDGET_REALIZED(widget))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
389 return;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
390
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
391 html->bg_gc = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
392 gdk_window_get_size(widget->window, &width, &height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
393 rect.x = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
394 rect.y = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
395 rect.width = width;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
396 rect.height = height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
397 gdk_window_clear_area(widget->window, rect.x, rect.y, rect.width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
398 rect.height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
399
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
400 expose_html(html, &rect, FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
401 gtk_html_draw_focus((GtkWidget *) html);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
402 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
403
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
404
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
405 void gtk_html_set_adjustments(GtkHtml * html,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
406 GtkAdjustment * hadj, GtkAdjustment * vadj)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
407 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
408 g_return_if_fail(html != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
409 g_return_if_fail(GTK_IS_HTML(html));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
410 if (hadj)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
411 g_return_if_fail(GTK_IS_ADJUSTMENT(hadj));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
412 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
413 hadj = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
414 if (vadj)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
415 g_return_if_fail(GTK_IS_ADJUSTMENT(vadj));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
416 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
417 vadj = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
418
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
419 if (html->hadj && (html->hadj != hadj))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
420 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
421 gtk_signal_disconnect_by_data(GTK_OBJECT(html->hadj), html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
422 gtk_object_unref(GTK_OBJECT(html->hadj));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
423 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
424
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
425 if (html->vadj && (html->vadj != vadj))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
426 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
427 gtk_signal_disconnect_by_data(GTK_OBJECT(html->vadj), html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
428 gtk_object_unref(GTK_OBJECT(html->vadj));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
429 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
430
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
431 if (html->hadj != hadj)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
432 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
433 html->hadj = hadj;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
434 gtk_object_ref(GTK_OBJECT(html->hadj));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
435 gtk_object_sink(GTK_OBJECT(html->hadj));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
436
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
437 gtk_signal_connect(GTK_OBJECT(html->hadj), "changed",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
438 (GtkSignalFunc) gtk_html_adjustment, html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
439 gtk_signal_connect(GTK_OBJECT(html->hadj), "value_changed",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
440 (GtkSignalFunc) gtk_html_adjustment, html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
441 gtk_signal_connect(GTK_OBJECT(html->hadj), "disconnect",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
442 (GtkSignalFunc) gtk_html_disconnect, html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
443 gtk_html_adjustment(hadj, html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
444 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
445
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
446 if (html->vadj != vadj)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
447 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
448 html->vadj = vadj;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
449 gtk_object_ref(GTK_OBJECT(html->vadj));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
450 gtk_object_sink(GTK_OBJECT(html->vadj));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
451
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
452 gtk_signal_connect(GTK_OBJECT(html->vadj), "changed",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
453 (GtkSignalFunc) gtk_html_adjustment, html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
454 gtk_signal_connect(GTK_OBJECT(html->vadj), "value_changed",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
455 (GtkSignalFunc) gtk_html_adjustment, html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
456 gtk_signal_connect(GTK_OBJECT(html->vadj), "disconnect",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
457 (GtkSignalFunc) gtk_html_disconnect, html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
458 gtk_html_adjustment(vadj, html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
459 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
460 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
461
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
462
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
463
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
464 GdkColor *get_color(int colorv, GdkColormap * map)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
465 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
466 GdkColor *color;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
467 #if 0
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
468 fprintf(stdout, "color is %x\n", colorv);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
469 #endif
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
470 color = (GdkColor *) g_new0(GdkColor, 1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
471 color->red = ((colorv & 0xff0000) >> 16) * 256;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
472 color->green = ((colorv & 0xff00) >> 8) * 256;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
473 color->blue = ((colorv & 0xff)) * 256;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
474 #if 0
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
475 fprintf(stdout, "Colors are %d, %d, %d\n", color->red, color->green,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
476 color->blue);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
477 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
478 gdk_color_alloc(map, color);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
479 return color;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
480 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
481
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
482
286
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
483 int load_font_with_cache(const char *name, const char *weight, char slant,
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
484 int size, GdkFont **font_return)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
485 {
286
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
486 gchar font_spec[1024];
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
487
306
a8f964718837 [gaim-migrate @ 316]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 305
diff changeset
488 if (size > 0)
a8f964718837 [gaim-migrate @ 316]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 305
diff changeset
489 g_snprintf(font_spec, sizeof font_spec,
a8f964718837 [gaim-migrate @ 316]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 305
diff changeset
490 "-*-%s-%s-%c-*-*-*-%d-*-*-*-*-*-*",
a8f964718837 [gaim-migrate @ 316]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 305
diff changeset
491 name, weight, slant, size);
852
836d5a02a35c [gaim-migrate @ 862]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 851
diff changeset
492 else
791
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
493 g_snprintf(font_spec, sizeof font_spec,
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
494 "-*-%s-%s-%c-*-*-*-*-*-*-*-*-*-*",
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
495 name, weight, slant);
286
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
496
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
497 if((*font_return = g_datalist_id_get_data(&font_cache,
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
498 g_quark_from_string(font_spec)))) {
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
499 return TRUE;
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
500 } else if ((*font_return = gdk_font_load(font_spec))) {
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
501 g_datalist_id_set_data(&font_cache,
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
502 g_quark_from_string(font_spec), *font_return);
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
503 return TRUE;
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
504 } else {
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
505 return FALSE;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
506 }
286
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
507 }
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
508
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
509
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
510 GdkFont *getfont(const char *font, int bold, int italic, int fixed, int size)
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
511 {
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
512 GdkFont *my_font = NULL;
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
513 gchar *weight, slant;
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
514
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
515 if (!font || !strlen(font)) font = fixed ? "courier" : "helvetica";
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
516 weight = bold ? "bold" : "medium";
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
517 slant = italic ? 'i' : 'r';
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
518
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
519 if (size > MAX_SIZE) size = MAX_SIZE;
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
520 if (size < 1) size = 1;
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
521 size = font_sizes[size-1];
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
522
852
836d5a02a35c [gaim-migrate @ 862]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 851
diff changeset
523 /* try both 'i'talic and 'o'blique for italic fonts */
286
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
524
791
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
525 if (load_font_with_cache(font, weight, slant, size, &my_font))
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
526 return my_font;
852
836d5a02a35c [gaim-migrate @ 862]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 851
diff changeset
527 if (load_font_with_cache(font, weight, 'o', size, &my_font))
836d5a02a35c [gaim-migrate @ 862]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 851
diff changeset
528 return my_font;
836d5a02a35c [gaim-migrate @ 862]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 851
diff changeset
529 if (italic && load_font_with_cache(font, weight, slant, 0, &my_font))
836d5a02a35c [gaim-migrate @ 862]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 851
diff changeset
530 return my_font;
791
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
531 if (italic && load_font_with_cache(font, weight, 'o', 0, &my_font))
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
532 return my_font;
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
533
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
534 /* since we couldn't get the right font, fall back to the default fonts. */
286
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
535
37a1d222b7f8 [gaim-migrate @ 296]
Rob Flynn <gaim@robflynn.com>
parents: 137
diff changeset
536 font = fixed ? "courier" : "helvetica";
791
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
537 if (load_font_with_cache(font, weight, slant, size, &my_font))
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
538 return my_font;
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
539 if (load_font_with_cache(font, weight, slant, 0, &my_font))
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
540 return my_font;
305
77404a4692b1 [gaim-migrate @ 315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 286
diff changeset
541
77404a4692b1 [gaim-migrate @ 315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 286
diff changeset
542 font = fixed ? "helvetica" : "courier";
791
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
543 if (load_font_with_cache(font, weight, slant, size, &my_font))
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
544 return my_font;
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
545 if (load_font_with_cache(font, weight, slant, 0, &my_font))
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
546 return my_font;
305
77404a4692b1 [gaim-migrate @ 315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 286
diff changeset
547
721
8e7ad10b5f26 [gaim-migrate @ 731]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 720
diff changeset
548 /* whoops, couldn't do any of those. maybe they have a default outgoing
8e7ad10b5f26 [gaim-migrate @ 731]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 720
diff changeset
549 * font? maybe we can use that. */
8e7ad10b5f26 [gaim-migrate @ 731]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 720
diff changeset
550 if (fontface[0]) {
8e7ad10b5f26 [gaim-migrate @ 731]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 720
diff changeset
551 /* woohoo! */
791
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
552 if (load_font_with_cache(fontface, "medium", 'r', size, &my_font))
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
553 return my_font;
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
554 if (load_font_with_cache(fontface, "medium", 'r', 0, &my_font))
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
555 return my_font;
721
8e7ad10b5f26 [gaim-migrate @ 731]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 720
diff changeset
556 }
8e7ad10b5f26 [gaim-migrate @ 731]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 720
diff changeset
557
305
77404a4692b1 [gaim-migrate @ 315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 286
diff changeset
558 /* ok, now we're in a pickle. if we can't do any of the above, let's
77404a4692b1 [gaim-migrate @ 315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 286
diff changeset
559 * try doing the most boring font we can find. */
791
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
560 if (load_font_with_cache("helvetica", "medium", 'r', size, &my_font))
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
561 return my_font;
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
562 if (load_font_with_cache("helvetica", "medium", 'r', 0, &my_font))
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
563 return my_font;
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
564
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
565 if (load_font_with_cache("courier", "medium", 'r', size, &my_font))
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
566 return my_font;
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
567 if (load_font_with_cache("courier", "medium", 'r', 0, &my_font))
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
568 return my_font;
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
569
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
570 if (load_font_with_cache("times", "medium", 'r', size, &my_font))
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
571 return my_font;
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
572 if (load_font_with_cache("times", "medium", 'r', 0, &my_font))
678bdc430df7 [gaim-migrate @ 801]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 740
diff changeset
573 return my_font;
305
77404a4692b1 [gaim-migrate @ 315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 286
diff changeset
574
77404a4692b1 [gaim-migrate @ 315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 286
diff changeset
575 /* my god, how did we end up here. is there a 'generic font' function
77404a4692b1 [gaim-migrate @ 315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 286
diff changeset
576 * in gdk? that would be incredibly useful here. there's gotta be a
77404a4692b1 [gaim-migrate @ 315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 286
diff changeset
577 * better way to do this. */
77404a4692b1 [gaim-migrate @ 315]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 286
diff changeset
578
306
a8f964718837 [gaim-migrate @ 316]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 305
diff changeset
579 /* well, if they can't do any of the fonts above, they'll take whatever
a8f964718837 [gaim-migrate @ 316]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 305
diff changeset
580 * they can get, and be happy about it, damn it. :) */
852
836d5a02a35c [gaim-migrate @ 862]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 851
diff changeset
581 load_font_with_cache("*", "*", '*', 0, &my_font);
306
a8f964718837 [gaim-migrate @ 316]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 305
diff changeset
582 return my_font;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
583 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
584
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
585
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
586 /* 'Borrowed' from ETerm */
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
587 GdkWindow *get_desktop_window(GtkWidget * widget)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
588 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
589 #ifndef _WIN32
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
590 GdkAtom prop,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
591 type,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
592 prop2;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
593 int format;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
594 gint length;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
595 guchar *data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
596 GtkWidget *w;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
597
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
598 prop = gdk_atom_intern("_XROOTPMAP_ID", 1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
599 prop2 = gdk_atom_intern("_XROOTCOLOR_PIXEL", 1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
600
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
601 if (prop == None && prop2 == None)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
602 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
603 return NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
604 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
605
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
606
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
607
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
608 for (w = widget; w; w = w->parent)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
609 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
610
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
611 if (prop != None)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
612 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
613 gdk_property_get(w->window, prop, AnyPropertyType, 0L, 1L, 0,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
614 &type, &format, &length, &data);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
615 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
616 else if (prop2 != None)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
617 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
618 gdk_property_get(w->window, prop2, AnyPropertyType, 0L, 1L, 0,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
619 &type, &format, &length, &data);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
620 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
621 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
622 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
623 continue;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
624 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
625 if (type != None)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
626 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
627 return (w->window);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
628 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
629 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
630 #endif
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
631 return NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
632
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
633 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
634
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
635
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
636
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
637 GdkPixmap *get_desktop_pixmap(GtkWidget * widget)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
638 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
639 #ifndef _WIN32
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
640 GdkPixmap *p;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
641 GdkAtom prop,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
642 type,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
643 prop2;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
644 int format;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
645 gint length;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
646 guint32 id;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
647 guchar *data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
648
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
649 prop = gdk_atom_intern("_XROOTPMAP_ID", 1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
650 prop2 = gdk_atom_intern("_XROOTCOLOR_PIXEL", 1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
651
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
652
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
653 if (prop == None && prop2 == None)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
654 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
655 return NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
656 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
657
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
658 if (prop != None)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
659 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
660 gdk_property_get(get_desktop_window(widget), prop, AnyPropertyType, 0L,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
661 1L, 0, &type, &format, &length, &data);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
662 if (type == XA_PIXMAP)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
663 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
664 id = data[0];
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
665 id += data[1] << 8;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
666 id += data[2] << 16;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
667 id += data[3] << 24;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
668 p = gdk_pixmap_foreign_new(id);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
669 return p;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
670 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
671 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
672 if (prop2 != None)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
673 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
674
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
675 /* XGetWindowProperty(Xdisplay, desktop_window, prop2, 0L, 1L, False, AnyPropertyType,
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
676 &type, &format, &length, &after, &data);*/
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
677
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
678 /* if (type == XA_CARDINAL) {*/
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
679 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
680 * D_PIXMAP((" Solid color not yet supported.\n"));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
681 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
682
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
683 /* return NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
684 }*/
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
685 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
686 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
687 * D_PIXMAP(("No suitable attribute found.\n"));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
688 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
689 #endif
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
690 return NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
691 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
692
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
693
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
694 static void clear_focus_area(GtkHtml * html,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
695 gint area_x,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
696 gint area_y, gint area_width, gint area_height)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
697 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
698 GtkWidget *widget = GTK_WIDGET(html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
699 gint x,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
700 y;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
701
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
702 gint ythick = BORDER_WIDTH + widget->style->klass->ythickness;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
703 gint xthick = BORDER_WIDTH + widget->style->klass->xthickness;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
704
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
705 gint width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
706 height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
707
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
708 if (html->frozen > 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
709 return;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
710
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
711 if (html->transparent)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
712 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
713 if (html->pm == NULL)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
714 html->pm = get_desktop_pixmap(widget);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
715
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
716 if (html->pm == NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
717 return;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
718
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
719 if (html->bg_gc == NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
720 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
721 GdkGCValues values;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
722
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
723 values.tile = html->pm;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
724 values.fill = GDK_TILED;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
725
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
726 html->bg_gc = gdk_gc_new_with_values(html->html_area, &values,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
727 GDK_GC_FILL | GDK_GC_TILE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
728
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
729 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
730
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
731 gdk_window_get_deskrelative_origin(widget->window, &x, &y);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
732
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
733 gdk_draw_pixmap(widget->window, html->bg_gc, html->pm,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
734 x + area_x, y + area_y, area_x, area_y, area_width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
735 area_height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
736
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
737
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
738 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
739 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
740 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
741 gdk_window_get_size(widget->style->bg_pixmap[GTK_STATE_NORMAL], &width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
742 &height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
743
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
744 gdk_gc_set_ts_origin(html->bg_gc,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
745 (-html->xoffset + xthick) % width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
746 (-html->yoffset + ythick) % height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
747
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
748 gdk_draw_rectangle(widget->window, html->bg_gc, TRUE,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
749 area_x, area_y, area_width, area_height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
750 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
751 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
752
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
753 static void gtk_html_draw_focus(GtkWidget * widget)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
754 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
755 GtkHtml *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
756 gint width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
757 height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
758 gint x,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
759 y;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
760
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
761 g_return_if_fail(widget != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
762 g_return_if_fail(GTK_IS_HTML(widget));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
763
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
764 html = GTK_HTML(widget);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
765
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
766 if (GTK_WIDGET_DRAWABLE(widget))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
767 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
768 gint ythick = widget->style->klass->ythickness;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
769 gint xthick = widget->style->klass->xthickness;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
770 gint xextra = BORDER_WIDTH;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
771 gint yextra = BORDER_WIDTH;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
772
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
773 x = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
774 y = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
775 width = widget->allocation.width;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
776 height = widget->allocation.height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
777
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
778 if (GTK_WIDGET_HAS_FOCUS(widget))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
779 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
780 x += 1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
781 y += 1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
782 width -= 2;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
783 height -= 2;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
784 xextra -= 1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
785 yextra -= 1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
786
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
787 gtk_paint_focus(widget->style, widget->window,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
788 NULL, widget, "text",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
789 0, 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
790 widget->allocation.width - 1,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
791 widget->allocation.height - 1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
792 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
793
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
794 gtk_paint_shadow(widget->style, widget->window,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
795 GTK_STATE_NORMAL, GTK_SHADOW_IN,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
796 NULL, widget, "text", x, y, width, height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
797
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
798 x += xthick;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
799 y += ythick;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
800 width -= 2 * xthick;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
801 height -= 2 * ythick;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
802
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
803
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
804 if (widget->style->bg_pixmap[GTK_STATE_NORMAL] || html->transparent)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
805 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
806 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
807 * top rect
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
808 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
809 clear_focus_area(html, x, y, width, yextra);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
810 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
811 * left rect
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
812 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
813 clear_focus_area(html, x, y + yextra,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
814 xextra, y + height - 2 * yextra);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
815 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
816 * right rect
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
817 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
818 clear_focus_area(html, x + width - xextra, y + yextra,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
819 xextra, height - 2 * ythick);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
820 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
821 * bottom rect
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
822 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
823 clear_focus_area(html, x, x + height - yextra, width, yextra);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
824 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
825 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
826 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
827
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
828 static void gtk_html_size_request(GtkWidget * widget,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
829 GtkRequisition * requisition)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
830 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
831 gint xthickness;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
832 gint ythickness;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
833 gint char_height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
834 gint char_width;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
835
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
836 g_return_if_fail(widget != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
837 g_return_if_fail(GTK_IS_HTML(widget));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
838 g_return_if_fail(requisition != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
839
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
840 xthickness = widget->style->klass->xthickness + BORDER_WIDTH;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
841 ythickness = widget->style->klass->ythickness + BORDER_WIDTH;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
842
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
843 char_height = MIN_HTML_HEIGHT_LINES * (widget->style->font->ascent +
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
844 widget->style->font->descent);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
845
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
846 char_width = MIN_HTML_WIDTH_LINES * (gdk_text_width(widget->style->font,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
847 "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
848 26) / 26);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
849
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
850 requisition->width = char_width + xthickness * 2;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
851 requisition->height = char_height + ythickness * 2;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
852 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
853
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
854 static void gtk_html_size_allocate(GtkWidget * widget,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
855 GtkAllocation * allocation)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
856 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
857 GtkHtml *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
858
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
859 g_return_if_fail(widget != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
860 g_return_if_fail(GTK_IS_HTML(widget));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
861 g_return_if_fail(allocation != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
862
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
863 html = GTK_HTML(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
864
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
865 widget->allocation = *allocation;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
866 if (GTK_WIDGET_REALIZED(widget))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
867 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
868 gdk_window_move_resize(widget->window,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
869 allocation->x, allocation->y,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
870 allocation->width, allocation->height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
871
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
872 gdk_window_move_resize(html->html_area,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
873 widget->style->klass->xthickness + BORDER_WIDTH,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
874 widget->style->klass->ythickness + BORDER_WIDTH,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
875 MAX(1, (gint) widget->allocation.width -
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
876 (gint) (widget->style->klass->xthickness +
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
877 (gint) BORDER_WIDTH) * 2),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
878 MAX(1, (gint) widget->allocation.height -
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
879 (gint) (widget->style->klass->ythickness +
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
880 (gint) BORDER_WIDTH) * 2));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
881
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
882 resize_html(html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
883 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
884 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
885
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
886 static void gtk_html_draw(GtkWidget * widget, GdkRectangle * area)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
887 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
888 g_return_if_fail(widget != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
889 g_return_if_fail(GTK_IS_HTML(widget));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
890 g_return_if_fail(area != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
891
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
892 if (GTK_WIDGET_DRAWABLE(widget))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
893 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
894 expose_html(GTK_HTML(widget), area, TRUE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
895 gtk_widget_draw_focus(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
896 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
897 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
898
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
899
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
900 static gint gtk_html_expose(GtkWidget * widget, GdkEventExpose * event)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
901 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
902 GtkHtml *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
903
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
904 g_return_val_if_fail(widget != NULL, FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
905 g_return_val_if_fail(GTK_IS_HTML(widget), FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
906 g_return_val_if_fail(event != NULL, FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
907
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
908 html = GTK_HTML(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
909
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
910 if (event->window == html->html_area)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
911 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
912 expose_html(html, &event->area, TRUE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
913 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
914 else if (event->count == 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
915 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
916 gtk_widget_draw_focus(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
917 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
918
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
919 return FALSE;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
920
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
921 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
922
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
923
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
924 static gint gtk_html_selection_clear(GtkWidget * widget,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
925 GdkEventSelection * event)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
926 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
927 GtkHtml *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
928
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
929 g_return_val_if_fail(widget != NULL, FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
930 g_return_val_if_fail(GTK_IS_HTML(widget), FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
931 g_return_val_if_fail(event != NULL, FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
932
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
933 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
934 * Let the selection handling code know that the selection
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
935 * * has been changed, since we've overriden the default handler
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
936 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
937 if (!gtk_selection_clear(widget, event))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
938 return FALSE;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
939
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
940 html = GTK_HTML(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
941
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
942 if (event->selection == GDK_SELECTION_PRIMARY)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
943 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
944 if (html->selected_text)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
945 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
946 GList *hbits = html->html_bits;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
947 GtkHtmlBit *hb;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
948
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
949 g_free(html->selected_text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
950 html->selected_text = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
951 html->start_sel = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
952 html->end_sel = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
953 html->num_start = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
954 html->num_end = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
955 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
956 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
957 hb = (GtkHtmlBit *) hbits->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
958 if (hb->was_selected)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
959 gtk_html_draw_bit(html, hb, 1);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
960 hbits = hbits->prev;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
961 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
962 hbits = g_list_last(html->html_bits);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
963 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
964 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
965
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
966 return TRUE;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
967 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
968
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
969
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
970
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
971 static void gtk_html_selection_get(GtkWidget * widget,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
972 GtkSelectionData * selection_data,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
973 guint sel_info, guint32 time)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
974 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
975 gchar *str;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
976 gint len;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
977 GtkHtml *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
978
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
979 g_return_if_fail(widget != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
980 g_return_if_fail(GTK_IS_HTML(widget));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
981
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
982 html = GTK_HTML(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
983
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
984
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
985 if (selection_data->selection != GDK_SELECTION_PRIMARY)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
986 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
987
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
988 str = html->selected_text;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
989
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
990 if (!str)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
991 return;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
992
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
993 len = strlen(str);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
994
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
995 if (sel_info == TARGET_STRING)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
996 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
997 gtk_selection_data_set(selection_data,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
998 GDK_SELECTION_TYPE_STRING,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
999 8 * sizeof(gchar), (guchar *) str, len);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1000 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1001 else if ((sel_info == TARGET_TEXT) || (sel_info == TARGET_COMPOUND_TEXT))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1002 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1003 guchar *text;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1004 GdkAtom encoding;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1005 gint format;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1006 gint new_length;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1007
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1008 gdk_string_to_compound_text(str, &encoding, &format, &text,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1009 &new_length);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1010 gtk_selection_data_set(selection_data, encoding, format, text,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1011 new_length);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1012 gdk_free_compound_text(text);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1013 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1014
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1015
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1016
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1017 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1018
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1019 static void do_select(GtkHtml * html, int x, int y)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1020 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1021 GList *hbits = g_list_last(html->html_bits);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1022 int epos,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1023 spos;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1024 GtkHtmlBit *hb;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1025
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1026 if (!hbits)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1027 return;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1028
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1029 hb = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1030
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1031 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1032 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1033 hb = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1034 if (hb->type == HTML_BIT_TEXT)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1035 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1036 hbits = hbits->prev;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1037 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1038
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1039 if (!hb)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1040 return;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1041
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1042
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1043 if (y > hb->y)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1044 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1045 html->num_end = strlen(hb->text) - 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1046 html->end_sel = hb;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1047 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1048 else if (y < 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1049 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1050 html->num_end = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1051 html->end_sel = (GtkHtmlBit *) html->html_bits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1052 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1053 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1054 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1055 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1056 hb = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1057 if ((y < hb->y && y > (hb->y - hb->height)) &&
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1058 (x > hb->x + hb->width))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1059 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1060 if (hb->type != HTML_BIT_TEXT)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1061 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1062 html->num_end = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1063 html->end_sel = hb;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1064 break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1065 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1066
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1067 html->num_end = strlen(hb->text) - 1;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1068 html->end_sel = hb;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1069 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1070 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1071 else if ((x > hb->x && x < (hb->x + hb->width)) &&
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1072 (y < hb->y && y > (hb->y - hb->height)))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1073 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1074 int i,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1075 len;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1076 int w = x - hb->x;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1077
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1078 if (hb->type != HTML_BIT_TEXT)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1079 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1080 html->num_end = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1081 html->end_sel = hb;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1082 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1083 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1084
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1085 len = strlen(hb->text);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1086
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1087 for (i = 1; i <= len; i++)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1088 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1089 if (gdk_text_measure(hb->font, hb->text, i) > w)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1090 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1091 html->num_end = i - 1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1092 html->end_sel = hb;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1093 break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1094 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1095 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1096 break;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1097 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1098 hbits = hbits->prev;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1099 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1100
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1101 if (html->end_sel == NULL)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1102 return;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1103 if (html->start_sel == NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1104 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1105 html->start_sel = html->end_sel;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1106 html->num_start = html->num_end;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1107 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1108
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1109 epos = g_list_index(html->html_bits, html->end_sel);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1110 spos = g_list_index(html->html_bits, html->start_sel);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1111 g_free(html->selected_text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1112 html->selected_text = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1113
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1114 if (epos == spos)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1115 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1116 char *str;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1117 if (html->start_sel->type != HTML_BIT_TEXT)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1118 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1119 html->selected_text = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1120 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1121 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1122 if (html->num_end == html->num_start)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1123 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1124 str = g_malloc(2);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1125 if (strlen(html->start_sel->text))
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1126 str[0] = html->start_sel->text[html->num_end];
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1127 else
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1128 str[0] = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1129 str[1] = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1130 gtk_html_draw_bit(html, html->start_sel, 0);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1131 html->selected_text = str;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1132 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1133 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1134 {
79
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 69
diff changeset
1135 size_t st,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1136 en;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1137 char *str;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1138 if (html->num_end > html->num_start)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1139 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1140 en = html->num_end;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1141 st = html->num_start;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1142 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1143 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1144 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1145 en = html->num_start;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1146 st = html->num_end;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1147 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1148
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1149 str = g_malloc(en - st + 2);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1150 strncpy(str, html->start_sel->text + st, (en - st + 1));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1151 str[en - st + 1] = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1152 gtk_html_draw_bit(html, html->start_sel, 0);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1153 html->selected_text = str;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1154
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1155 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1156 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1157 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1158 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1159 GtkHtmlBit *shb,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1160 *ehb;
79
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 69
diff changeset
1161 size_t en,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1162 st;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1163 int len,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1164 nlen;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1165 char *str;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1166 if (epos > spos)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1167 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1168 shb = html->start_sel;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1169 ehb = html->end_sel;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1170 en = html->num_end;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1171 st = html->num_start;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1172 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1173 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1174 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1175 shb = html->end_sel;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1176 ehb = html->start_sel;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1177 en = html->num_start;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1178 st = html->num_end;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1179 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1180
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1181 hbits = g_list_find(html->html_bits, shb);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1182
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1183 if (!hbits)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1184 return;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1185
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1186 if (shb->type == HTML_BIT_TEXT)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1187 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1188 len = strlen(shb->text) - st + 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1189 str = g_malloc(len);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1190 strcpy(str, shb->text + st);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1191 str[len - 1] = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1192 gtk_html_draw_bit(html, shb, 0);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1193 if (shb->newline)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1194 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1195 len += 1;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1196 str = g_realloc(str, len);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1197 str[len - 2] = '\n';
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1198 str[len - 1] = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1199 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1200 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1201 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1202 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1203 len = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1204 str = g_malloc(1);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1205 str[0] = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1206 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1207 if (hbits->next == NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1208 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1209 html->selected_text = str;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1210 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1211 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1212
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1213
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1214 hbits = hbits->next;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1215 while (1)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1216 { /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1217 * Yah I know is dangerous :P
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1218 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1219 hb = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1220 if (hb->type != HTML_BIT_TEXT)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1221 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1222 if (hb == ehb)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1223 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1224 hbits = hbits->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1225 continue;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1226 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1227 if (hb != ehb)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1228 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1229 nlen = len + strlen(hb->text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1230 str = g_realloc(str, nlen);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1231 strcpy(str + (len - 1), hb->text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1232 len = nlen;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1233 str[len - 1] = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1234 gtk_html_draw_bit(html, hb, 0);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1235 if (hb->newline)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1236 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1237 len += 1;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1238 str = g_realloc(str, len);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1239 str[len - 2] = '\n';
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1240 str[len - 1] = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1241 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1242 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1243 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1244 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1245 nlen = len + en + 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1246 str = g_realloc(str, nlen);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1247 strncpy(str + (len - 1), hb->text, en + 1);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1248 len = nlen;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1249 str[len - 1] = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1250
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1251 gtk_html_draw_bit(html, hb, 0);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1252 if (hb->newline && en == strlen(hb->text))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1253 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1254 len += 1;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1255 str = g_realloc(str, len);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1256 str[len - 2] = '\n';
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1257 str[len - 1] = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1258 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1259 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1260 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1261 hbits = hbits->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1262 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1263 html->selected_text = str;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1264 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1265
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1266 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1267
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1268 static gint scroll_timeout(GtkHtml * html)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1269 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1270 GdkEventMotion event;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1271 gint x,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1272 y;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1273 GdkModifierType mask;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1274
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1275 html->timer = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1276 gdk_window_get_pointer(html->html_area, &x, &y, &mask);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1277
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1278 if (mask & GDK_BUTTON1_MASK)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1279 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1280 event.is_hint = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1281 event.x = x;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1282 event.y = y;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1283 event.state = mask;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1284
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1285 gtk_html_motion_notify(GTK_WIDGET(html), &event);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1286 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1287
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1288 return FALSE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1289
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1290 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1291
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1292
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1293 static gint gtk_html_tooltip_paint_window(GtkHtml * html)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1294 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1295 GtkStyle *style;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1296 gint y,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1297 baseline_skip,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1298 gap;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1299
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1300 style = html->tooltip_window->style;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1301
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1302 gap = (style->font->ascent + style->font->descent) / 4;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1303 if (gap < 2)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1304 gap = 2;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1305 baseline_skip = style->font->ascent + style->font->descent + gap;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1306
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1307 if (!html->tooltip_hb)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1308 return FALSE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1309
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1310 gtk_paint_flat_box(style, html->tooltip_window->window,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1311 GTK_STATE_NORMAL, GTK_SHADOW_OUT,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1312 NULL, GTK_WIDGET(html->tooltip_window), "tooltip",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1313 0, 0, -1, -1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1314
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1315 y = style->font->ascent + 4;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1316
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1317 gtk_paint_string(style, html->tooltip_window->window,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1318 GTK_STATE_NORMAL,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1319 NULL, GTK_WIDGET(html->tooltip_window), "tooltip",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1320 4, y, "HTML Link:");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1321 y += baseline_skip;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1322 gtk_paint_string(style, html->tooltip_window->window,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1323 GTK_STATE_NORMAL,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1324 NULL, GTK_WIDGET(html->tooltip_window), "tooltip",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1325 4, y, html->tooltip_hb->url);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1326
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1327 return FALSE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1328
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1329
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1330 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1331
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1332 static gint gtk_html_tooltip_timeout(gpointer data)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1333 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1334 GtkHtml *html = (GtkHtml *) data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1335
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1336
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1337 GDK_THREADS_ENTER();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1338
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1339 if (html->tooltip_hb && GTK_WIDGET_DRAWABLE(GTK_WIDGET(html)))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1340 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1341 GtkWidget *widget;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1342 GtkStyle *style;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1343 gint gap,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1344 x,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1345 y,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1346 w,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1347 h,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1348 scr_w,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1349 scr_h,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1350 baseline_skip;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1351
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1352 if (html->tooltip_window)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1353 gtk_widget_destroy(html->tooltip_window);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1354
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1355 html->tooltip_window = gtk_window_new(GTK_WINDOW_POPUP);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1356 gtk_widget_set_app_paintable(html->tooltip_window, TRUE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1357 gtk_window_set_policy(GTK_WINDOW(html->tooltip_window), FALSE, FALSE,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1358 TRUE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1359 gtk_widget_set_name(html->tooltip_window, "gtk-tooltips");
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1360 gtk_signal_connect_object(GTK_OBJECT(html->tooltip_window),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1361 "expose_event",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1362 GTK_SIGNAL_FUNC
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1363 (gtk_html_tooltip_paint_window),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1364 GTK_OBJECT(html));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1365 gtk_signal_connect_object(GTK_OBJECT(html->tooltip_window), "draw",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1366 GTK_SIGNAL_FUNC
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1367 (gtk_html_tooltip_paint_window),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1368 GTK_OBJECT(html));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1369
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1370 gtk_widget_ensure_style(html->tooltip_window);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1371 style = html->tooltip_window->style;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1372
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1373 widget = GTK_WIDGET(html);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1374
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1375 scr_w = gdk_screen_width();
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1376 scr_h = gdk_screen_height();
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1377
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1378 gap = (style->font->ascent + style->font->descent) / 4;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1379 if (gap < 2)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1380 gap = 2;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1381 baseline_skip = style->font->ascent + style->font->descent + gap;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1382
353
a4df8f1cc61a [gaim-migrate @ 363]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
1383 w = 8 + MAX(gdk_string_width(style->font, _("HTML Link:")),
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1384 gdk_string_width(style->font, html->tooltip_hb->url));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1385 ;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1386 h = 8 - gap;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1387 h += (baseline_skip * 2);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1388
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1389 gdk_window_get_pointer(NULL, &x, &y, NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1390 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1391 * gdk_window_get_origin (widget->window, NULL, &y);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1392 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1393 if (GTK_WIDGET_NO_WINDOW(widget))
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1394 y += widget->allocation.y;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1395
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1396 x -= ((w >> 1) + 4);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1397
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1398 if ((x + w) > scr_w)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1399 x -= (x + w) - scr_w;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1400 else if (x < 0)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1401 x = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1402
1294
7f486375bfd5 [gaim-migrate @ 1304]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1403 if (html->tooltip_hb->font) {
7f486375bfd5 [gaim-migrate @ 1304]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1404 if ((y + h + 4) > scr_h)
7f486375bfd5 [gaim-migrate @ 1304]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1405 y =
7f486375bfd5 [gaim-migrate @ 1304]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1406 y - html->tooltip_hb->font->ascent +
7f486375bfd5 [gaim-migrate @ 1304]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1407 html->tooltip_hb->font->descent;
7f486375bfd5 [gaim-migrate @ 1304]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1408 else
7f486375bfd5 [gaim-migrate @ 1304]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1409 y =
7f486375bfd5 [gaim-migrate @ 1304]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1410 y + html->tooltip_hb->font->ascent +
7f486375bfd5 [gaim-migrate @ 1304]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1411 html->tooltip_hb->font->descent;
7f486375bfd5 [gaim-migrate @ 1304]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1412 } else {
7f486375bfd5 [gaim-migrate @ 1304]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1413 if ((y + h + 4) > scr_h)
7f486375bfd5 [gaim-migrate @ 1304]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1414 y = y - 10 + 4;
7f486375bfd5 [gaim-migrate @ 1304]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1415 else
7f486375bfd5 [gaim-migrate @ 1304]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1416 y = y + 10 + 4;
7f486375bfd5 [gaim-migrate @ 1304]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1417 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1418
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1419 gtk_widget_set_usize(html->tooltip_window, w, h);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1420 gtk_widget_popup(html->tooltip_window, x, y);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1421
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1422 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1423
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1424 html->tooltip_timer = -1;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1425
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1426 GDK_THREADS_LEAVE();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1427
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1428 return FALSE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1429 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1430
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1431
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1432 static gint gtk_html_leave_notify(GtkWidget * widget, GdkEventCrossing * event)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1433 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1434 GtkHtml *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1435
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1436 html = GTK_HTML(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1437
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1438 if (html->tooltip_timer != -1)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1439 gtk_timeout_remove(html->tooltip_timer);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1440 if (html->tooltip_window)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1441 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1442 gtk_widget_destroy(html->tooltip_window);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1443 html->tooltip_window = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1444 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1445
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1446
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1447 html->tooltip_hb = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1448 return TRUE;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1449 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1450
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1451
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1452 static gint gtk_html_motion_notify(GtkWidget * widget, GdkEventMotion * event)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1453 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1454 int x,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1455 y;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1456 gint width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1457 height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1458 GdkModifierType state;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1459 int realx,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1460 realy;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1461 GtkHtml *html = GTK_HTML(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1462
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1463 if (event->is_hint)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1464 gdk_window_get_pointer(event->window, &x, &y, &state);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1465 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1466 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1467 x = event->x;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1468 y = event->y;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1469 state = event->state;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1470 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1471
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1472 gdk_window_get_size(html->html_area, &width, &height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1473
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1474 realx = x;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1475 realy = y + html->yoffset;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1476
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1477
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1478 if (state & GDK_BUTTON1_MASK)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1479 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1480 if (realx != html->start_sel_x || realy != html->start_sel_y)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1481 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1482 char *tmp = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1483
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1484 if (y < 0 || y > height)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1485 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1486 int diff;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1487 if (html->timer == 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1488 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1489 html->timer = gtk_timeout_add(100,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1490 (GtkFunction) scroll_timeout,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1491 html);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1492 if (y < 0)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1493 diff = y / 2;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1494 else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1495 diff = (y - height) / 2;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1496
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1497 if (html->vadj->value + diff >
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1498 html->vadj->upper - height + 20)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1499 gtk_adjustment_set_value(html->vadj,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1500 html->vadj->upper - height +
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1501 20);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1502 else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1503 gtk_adjustment_set_value(html->vadj,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1504 html->vadj->value + diff);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1505
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1506 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1507 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1508
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1509 if (html->selected_text != NULL)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1510 tmp = g_strdup(html->selected_text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1511 do_select(html, realx, realy);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1512 if (tmp)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1513 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1514 if (!html->selected_text || strcmp(tmp, html->selected_text))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1515 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1516 GtkHtmlBit *hb;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1517 GList *hbits = html->html_bits;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1518 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1519 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1520 hb = (GtkHtmlBit *) hbits->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1521 if (hb->was_selected)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1522 gtk_html_draw_bit(html, hb, 0);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1523 hbits = hbits->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1524 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1525 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1526 g_free(tmp);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1527 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1528 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1529 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1530 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1531 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1532 GtkHtmlBit *hb;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1533 GList *urls;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1534
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1535 urls = html->urls;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1536 while (urls)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1537 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1538 hb = (GtkHtmlBit *) urls->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1539 if ((realx > hb->x && realx < (hb->x + hb->width)) &&
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1540 (realy < hb->y && realy > (hb->y - hb->height)))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1541 {
26
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
1542 GdkCursor *cursor = NULL;
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
1543
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1544 if (html->tooltip_hb != hb)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1545 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1546 html->tooltip_hb = hb;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1547 if (html->tooltip_timer != -1)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1548 gtk_timeout_remove(html->tooltip_timer);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1549 if (html->tooltip_window)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1550 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1551 gtk_widget_destroy(html->tooltip_window);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1552 html->tooltip_window = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1553 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1554 html->tooltip_timer =
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1555 gtk_timeout_add(HTML_TOOLTIP_DELAY,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1556 gtk_html_tooltip_timeout, html);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1557 }
26
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
1558
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
1559 cursor = gdk_cursor_new(GDK_HAND2);
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
1560 gdk_window_set_cursor(html->html_area, cursor);
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
1561 gdk_cursor_destroy(cursor);
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
1562
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1563 return TRUE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1564 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1565 urls = urls->next;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1566 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1567 if (html->tooltip_timer != -1)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1568 gtk_timeout_remove(html->tooltip_timer);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1569 if (html->tooltip_window)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1570 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1571 gtk_widget_destroy(html->tooltip_window);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1572 html->tooltip_window = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1573 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1574
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1575
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1576 html->tooltip_hb = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1577 gdk_window_set_cursor(html->html_area, NULL);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1578
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1579
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1580 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1581
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1582 return TRUE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1583 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1584
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1585 static gint gtk_html_button_release(GtkWidget * widget, GdkEventButton * event)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1586 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1587 GtkHtml *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1588
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1589 html = GTK_HTML(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1590
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1591 if (html->frozen > 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1592 return TRUE;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1593
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1594 if (event->button == 1)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1595 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1596 int realx,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1597 realy;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1598 GtkHtmlBit *hb;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1599 GList *urls = html->urls;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1600
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1601 realx = event->x;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1602 realy = event->y + html->yoffset;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1603 if (realx != html->start_sel_x || realy != html->start_sel_y)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1604 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1605 if (gtk_selection_owner_set(widget,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1606 GDK_SELECTION_PRIMARY, event->time))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1607 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1608 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1609 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1610 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1611 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1612 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1613 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1614 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1615 if (gdk_selection_owner_get(GDK_SELECTION_PRIMARY) ==
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1616 widget->window)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1617 gtk_selection_owner_set(NULL, GDK_SELECTION_PRIMARY,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1618 event->time);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1619
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1620
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1621 while (urls)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1622 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1623 void open_url_nw(GtkWidget * w, char *url);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1624 hb = (GtkHtmlBit *) urls->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1625 if ((realx > hb->x && realx < (hb->x + hb->width)) &&
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1626 (realy < hb->y && realy > (hb->y - hb->height)))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1627 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1628 open_url_nw(NULL, hb->url);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1629 // else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1630 // open_url(NULL, hb->url);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1631 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1632 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1633 urls = urls->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1634 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1635 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1636 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1637 return TRUE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1638 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1639
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1640
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1641
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1642 static gint gtk_html_button_press(GtkWidget * widget, GdkEventButton * event)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1643 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1644 GtkHtml *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1645 gfloat value;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1646
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1647
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1648 html = GTK_HTML(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1649 value = html->vadj->value;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1650
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1651 if (html->frozen > 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1652 return TRUE;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1653
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1654 if (event->button == 4)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1655 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1656 value -= html->vadj->step_increment;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1657 if (value < html->vadj->lower)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1658 value = html->vadj->lower;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1659 gtk_adjustment_set_value(html->vadj, value);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1660 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1661 else if (event->button == 5)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1662 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1663 value += html->vadj->step_increment;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1664 if (value > html->vadj->upper)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1665 value = html->vadj->upper;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1666 gtk_adjustment_set_value(html->vadj, value);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1667
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1668 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1669 else if (event->button == 1)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1670 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1671 GList *hbits = g_list_last(html->html_bits);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1672 int realx,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1673 realy;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1674 GtkHtmlBit *hb;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1675
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1676 realx = event->x;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1677 realy = event->y + html->yoffset;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1678
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1679 html->start_sel_x = realx;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1680 html->start_sel_y = realy;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1681
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1682 if (!hbits)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1683 return TRUE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1684
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1685 if (html->selected_text)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1686 {
894
b5b3aa06111d [gaim-migrate @ 904]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 871
diff changeset
1687 gboolean forcedraw = FALSE;
b5b3aa06111d [gaim-migrate @ 904]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 871
diff changeset
1688 hbits = html->html_bits;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1689 g_free(html->selected_text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1690 html->selected_text = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1691 html->start_sel = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1692 html->end_sel = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1693 html->num_start = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1694 html->num_end = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1695 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1696 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1697 hb = (GtkHtmlBit *) hbits->data;
894
b5b3aa06111d [gaim-migrate @ 904]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 871
diff changeset
1698 if (hb->was_selected || forcedraw) {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1699 gtk_html_draw_bit(html, hb, 1);
894
b5b3aa06111d [gaim-migrate @ 904]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 871
diff changeset
1700 forcedraw = TRUE;
b5b3aa06111d [gaim-migrate @ 904]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 871
diff changeset
1701 }
b5b3aa06111d [gaim-migrate @ 904]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 871
diff changeset
1702 hbits = hbits->next;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1703 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1704 hbits = g_list_last(html->html_bits);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1705 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1706
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1707 hb = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1708 if (realy > hb->y)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1709 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1710 if (hb->text)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1711 html->num_start = strlen(hb->text) - 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1712 else
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1713 html->num_start = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1714 html->start_sel = hb;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1715 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1716 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1717 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1718 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1719 hb = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1720 if ((realy < hb->y && realy > (hb->y - hb->height)) &&
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1721 (realx > hb->x + hb->width))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1722 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1723 if (hb->type != HTML_BIT_TEXT)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1724 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1725 html->num_end = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1726 html->end_sel = hb;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1727 break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1728 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1729
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1730 if (hb->text)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1731 html->num_start = strlen(hb->text) - 1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1732 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1733 html->num_start = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1734
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1735 html->start_sel = hb;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1736 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1737 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1738 else if ((realx > hb->x && realx < (hb->x + hb->width)) &&
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1739 (realy < hb->y && realy > (hb->y - hb->height)))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1740 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1741 int i,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1742 len;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1743 int w = realx - hb->x;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1744
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1745 if (hb->type != HTML_BIT_TEXT)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1746 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1747 html->num_end = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1748 html->end_sel = hb;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1749 break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1750 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1751
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1752 if (hb->text)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1753 len = strlen(hb->text);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1754 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1755 len = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1756
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1757 for (i = 1; i <= len; i++)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1758 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1759 if (gdk_text_measure(hb->font, hb->text, i) > w)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1760 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1761 html->num_start = i - 1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1762 html->start_sel = hb;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1763 break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1764 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1765 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1766 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1767 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1768 hbits = hbits->prev;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1769 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1770 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1771 else if (event->button == 3 && event->type == GDK_BUTTON_PRESS)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1772 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1773 GtkHtmlBit *hb = NULL;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1774 int realx,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1775 realy;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1776 GList *urls;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1777
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1778 realx = event->x;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1779 realy = event->y + html->yoffset;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1780
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1781 urls = html->urls;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1782 while (urls)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1783 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1784 hb = (GtkHtmlBit *) urls->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1785 if ((realx > hb->x && realx < (hb->x + hb->width)) &&
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1786 (realy < hb->y && realy > (hb->y - hb->height)))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1787 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1788 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1789 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1790 urls = urls->next;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1791 hb = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1792 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1793
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1794 if (hb != NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1795 {
69
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1796
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1797 GtkWidget *menu, *button;
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1798
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1799 menu = gtk_menu_new();
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1800
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1801 if (web_browser == BROWSER_NETSCAPE) {
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1802
353
a4df8f1cc61a [gaim-migrate @ 363]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
1803 button = gtk_menu_item_new_with_label(_("Open URL in existing window"));
69
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1804 gtk_signal_connect(GTK_OBJECT(button), "activate",
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1805 GTK_SIGNAL_FUNC(open_url), hb->url);
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1806 gtk_menu_append(GTK_MENU(menu), button);
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1807 gtk_widget_show(button);
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1808
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1809 }
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1810
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1811
353
a4df8f1cc61a [gaim-migrate @ 363]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
1812 button = gtk_menu_item_new_with_label(_("Open URL in new window"));
69
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1813 gtk_signal_connect(GTK_OBJECT(button), "activate",
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1814 GTK_SIGNAL_FUNC(open_url_nw), hb->url);
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1815 gtk_menu_append(GTK_MENU(menu), button);
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1816 gtk_widget_show(button);
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1817
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1818 if (web_browser == BROWSER_NETSCAPE) {
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1819
353
a4df8f1cc61a [gaim-migrate @ 363]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
1820 button = gtk_menu_item_new_with_label(_("Add URL as bookmark"));
69
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1821 gtk_signal_connect(GTK_OBJECT(button), "activate",
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1822 GTK_SIGNAL_FUNC(add_bookmark), hb->url);
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1823 gtk_menu_append(GTK_MENU(menu), button);
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1824 gtk_widget_show(button);
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1825
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1826 }
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1827
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1828 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1829 event->button, event->time);
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1830
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1831 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1832 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1833
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1834 return TRUE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1835 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1836
871
75b05911234a [gaim-migrate @ 881]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 869
diff changeset
1837
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1838 static void gtk_html_draw_bit(GtkHtml * html, GtkHtmlBit * hb, int redraw)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1839 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1840 int mypos,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1841 epos,
871
75b05911234a [gaim-migrate @ 881]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 869
diff changeset
1842 spos;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1843 GdkGC *gc = html->gc;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1844 int shift;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1845 GtkStateType selected_state;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1846 GtkWidget *widget = GTK_WIDGET(html);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1847 GdkRectangle area;
895
81a8fb0a565f [gaim-migrate @ 905]
Todd Kulesza <fflewddur>
parents: 894
diff changeset
1848 GList *hbits;
81a8fb0a565f [gaim-migrate @ 905]
Todd Kulesza <fflewddur>
parents: 894
diff changeset
1849
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1850 if (html->frozen > 0)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1851 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1852
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
1853 hbits = g_list_find(html->html_bits, hb);
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
1854
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1855 if (hb->type == HTML_BIT_TEXT)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1856 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1857
716
0995382d0c46 [gaim-migrate @ 726]
Todd Kulesza <fflewddur>
parents: 677
diff changeset
1858 if (!(hb->text))
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1859 return;
720
8b3412f3ac2a [gaim-migrate @ 730]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 716
diff changeset
1860 /* this is possible, don't comment it out >:P */
8b3412f3ac2a [gaim-migrate @ 730]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 716
diff changeset
1861 if (!strlen(hb->text))
8b3412f3ac2a [gaim-migrate @ 730]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 716
diff changeset
1862 return;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1863
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1864 mypos = g_list_index(html->html_bits, hb);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1865 epos = g_list_index(html->html_bits, html->end_sel);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1866 spos = g_list_index(html->html_bits, html->start_sel);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1867
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1868 if (((html->end_sel == NULL) || (html->start_sel == NULL)) ||
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1869 ((epos < mypos) && (spos < mypos)) ||
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1870 ((epos > mypos) && (spos > mypos)))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1871 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1872 selected_state = GTK_STATE_NORMAL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1873 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1874 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1875 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1876 selected_state = GTK_STATE_SELECTED;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1877 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1878
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1879 gdk_text_extents(hb->font, hb->text, 1, &shift, NULL, NULL, NULL, NULL);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1880
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1881 if (selected_state == GTK_STATE_SELECTED)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1882 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1883 int schar = 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1884 echar = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1885 int startx = 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1886 xwidth = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1887
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1888 if (epos > spos ||
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1889 (epos == spos && html->num_end >= html->num_start))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1890 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1891 if (mypos == epos)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1892 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1893 echar = html->num_end;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1894 xwidth =
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1895 gdk_text_width(hb->font, hb->text, html->num_end + 1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1896 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1897 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1898 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1899 echar = strlen(hb->text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1900 xwidth = hb->width;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1901 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1902 if (mypos == spos)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1903 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1904 schar = html->num_start;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1905 startx =
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1906 gdk_text_width(hb->font, hb->text, html->num_start);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1907 xwidth -= startx;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1908 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1909 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1910 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1911 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1912 if (mypos == spos)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1913 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1914 echar = html->num_start;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1915 xwidth =
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1916 gdk_text_width(hb->font, hb->text,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1917 html->num_start + 1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1918 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1919 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1920 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1921 echar = strlen(hb->text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1922 xwidth = hb->width;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1923 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1924 if (mypos == epos)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1925 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1926 schar = html->num_end;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1927 startx =
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1928 gdk_text_width(hb->font, hb->text, html->num_end);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1929 xwidth -= startx;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1930 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1931 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1932
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1933 if (!redraw && echar == hb->sel_e && schar == hb->sel_s)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1934 return;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1935
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1936 hb->sel_e = echar;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1937 hb->sel_s = schar;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1938
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1939 startx += hb->x;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1940
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1941 area.x = hb->x - html->xoffset;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1942 area.y = hb->y - hb->height + 3 - html->yoffset;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1943 area.width = hb->width + 2;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1944 area.height = hb->height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1945 clear_area(html, &area);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1946
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1947 gtk_paint_flat_box(widget->style, html->html_area,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1948 selected_state, GTK_SHADOW_NONE,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1949 NULL, widget, "text",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1950 startx,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1951 hb->y - hb->height + 3 - html->yoffset,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1952 xwidth + 2, hb->height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1953 hb->was_selected = 1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1954 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1955 else if (hb->was_selected)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1956 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1957 area.x = hb->x - html->xoffset;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1958 area.y = hb->y - hb->height + 3 - html->yoffset;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1959 area.width = hb->width + 2;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1960 area.height = hb->height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1961 clear_area(html, &area);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1962
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1963 hb->sel_e = -1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1964 hb->sel_s = -1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1965
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1966 hb->was_selected = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1967 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1968
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1969 if (selected_state == GTK_STATE_SELECTED && (mypos == epos
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1970 || mypos == spos))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1971 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1972 char *s = hb->text;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1973 int num = 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1974 width = 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1975 fsel = 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1976 esel = strlen(hb->text);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1977 int lbearing,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1978 rbearing,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1979 w;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1980
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1981 if (epos > spos ||
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1982 (epos == spos && html->num_end >= html->num_start))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1983 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1984 if (mypos == epos)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1985 esel = html->num_end;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1986 if (mypos == spos)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1987 fsel = html->num_start;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1988 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1989 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1990 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1991 if (mypos == spos)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1992 esel = html->num_start;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1993 if (mypos == epos)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1994 fsel = html->num_end;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1995 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1996
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1997 while (*s)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1998 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1999
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2000 if (num < fsel || num > esel)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2001 selected_state = GTK_STATE_NORMAL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2002 else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2003 selected_state = GTK_STATE_SELECTED;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2004 if (hb->fore != NULL)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2005 gdk_gc_set_foreground(gc, hb->fore);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2006 else
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2007 gdk_gc_set_foreground(gc,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2008 &widget->style->fg[selected_state]);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2009
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2010 gdk_gc_set_font(gc, hb->font);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2011
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2012 gdk_text_extents(hb->font, s, 1, &lbearing, &rbearing, &w, NULL,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2013 NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2014
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2015 gdk_draw_text(html->html_area, hb->font, gc,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2016 shift + hb->x + width, hb->y - html->yoffset, s,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2017 1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2018
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2019 if (hb->uline)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2020 gdk_draw_line(html->html_area, gc, shift + hb->x + width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2021 hb->y - html->yoffset,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2022 shift + hb->x + width + w,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2023 hb->y - html->yoffset);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2024
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2025 if (hb->strike)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2026 gdk_draw_line(html->html_area, gc, shift + hb->x + width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2027 hb->y - html->yoffset - (hb->height / 3),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2028 shift + hb->x + width + w,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2029 hb->y - html->yoffset - (hb->height / 3));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2030
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2031 width += w;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2032
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2033 s++;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2034 num++;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2035 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2036
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2037
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2038 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2039 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2040 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2041 /*my stuff here*/
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2042
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2043 if(!hb->was_selected)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2044 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2045 area.x = hb->x - html->xoffset;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2046 area.y = hb->y - hb->height + 3 - html->yoffset;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2047 area.width = hb->width + 2;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2048 area.height = hb->height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2049 clear_area(html, &area);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2050 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2051
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2052 /*end my stuff*/
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2053
914
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2054 if (hb->text && hb->back != NULL) {
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
2055 int hwidth, hheight, hei, tmpcnt;
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
2056 hei = get_line_height(html, hb);
860
a8633715fb5b [gaim-migrate @ 870]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 853
diff changeset
2057 gdk_window_get_size(html->html_area, &hwidth, &hheight);
629
ce8d8608d05b [gaim-migrate @ 639]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 627
diff changeset
2058 gdk_gc_set_foreground(gc, hb->back);
938
5d140deadc68 [gaim-migrate @ 948]
Todd Kulesza <fflewddur>
parents: 918
diff changeset
2059 /* we use a 2-pixel window border */
5d140deadc68 [gaim-migrate @ 948]
Todd Kulesza <fflewddur>
parents: 918
diff changeset
2060 if (hb->x < 2)
5d140deadc68 [gaim-migrate @ 948]
Todd Kulesza <fflewddur>
parents: 918
diff changeset
2061 hb->x = 2;
635
2ad1a8234ef1 [gaim-migrate @ 645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 632
diff changeset
2062 gdk_draw_rectangle(html->html_area, gc, TRUE /* filled */,
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
2063 hb->x, hb->y - html->yoffset - hei - 6,
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
2064 hwidth - shift - hb->x + 1, hei + hei + 2);
897
b2ce6a6a8633 [gaim-migrate @ 907]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 896
diff changeset
2065 for (tmpcnt = 1; tmpcnt < hb->newline; tmpcnt++) {
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
2066 int eoff = hei + hei + 2;
897
b2ce6a6a8633 [gaim-migrate @ 907]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 896
diff changeset
2067 eoff *= tmpcnt;
b2ce6a6a8633 [gaim-migrate @ 907]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 896
diff changeset
2068 gdk_draw_rectangle(html->html_area, gc, TRUE,
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
2069 2, hb->y - html->yoffset - hei - 6 + eoff,
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
2070 hwidth, hei + hei + 2);
897
b2ce6a6a8633 [gaim-migrate @ 907]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 896
diff changeset
2071 }
629
ce8d8608d05b [gaim-migrate @ 639]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 627
diff changeset
2072 }
ce8d8608d05b [gaim-migrate @ 639]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 627
diff changeset
2073
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2074 if (hb->fore != NULL)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2075 gdk_gc_set_foreground(gc, hb->fore);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2076 else
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2077 gdk_gc_set_foreground(gc, &widget->style->fg[selected_state]);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2078
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2079 gdk_gc_set_font(gc, hb->font);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2080
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2081 gdk_draw_string(html->html_area, hb->font, gc, shift + hb->x,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2082 hb->y - html->yoffset, hb->text);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2083 if (hb->uline)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2084 gdk_draw_line(html->html_area, gc, shift + hb->x,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2085 hb->y - html->yoffset,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2086 hb->x + gdk_string_measure(hb->font, hb->text),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2087 hb->y - html->yoffset);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2088
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2089 if (hb->strike)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2090 gdk_draw_line(html->html_area, gc, shift + hb->x,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2091 hb->y - html->yoffset - (hb->height / 3),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2092 hb->x + gdk_string_measure(hb->font, hb->text),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2093 hb->y - html->yoffset - (hb->height / 3));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2094
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2095 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2096 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2097 else if (hb->type == HTML_BIT_SEP)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2098 {
914
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2099 if (hb->back != NULL) {
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2100 int hwidth, hheight, hei, tmpcnt;
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
2101 hei = get_line_height(html, hb);
914
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2102 gdk_window_get_size(html->html_area, &hwidth, &hheight);
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2103 gdk_gc_set_foreground(gc, hb->back);
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2104 gdk_draw_rectangle(html->html_area, gc, TRUE,
938
5d140deadc68 [gaim-migrate @ 948]
Todd Kulesza <fflewddur>
parents: 918
diff changeset
2105 2, hb->y - html->yoffset,
914
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2106 hwidth, 5);
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2107 for (tmpcnt = 0; tmpcnt < hb->newline; tmpcnt++) {
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2108 int eoff = hei + hei + 2;
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2109 eoff *= tmpcnt;
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2110 eoff += 5;
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2111 gdk_draw_rectangle(html->html_area, gc, TRUE,
938
5d140deadc68 [gaim-migrate @ 948]
Todd Kulesza <fflewddur>
parents: 918
diff changeset
2112 2, hb->y - html->yoffset + eoff,
914
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2113 hwidth, hei + hei + 2);
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2114 }
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2115 }
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2116
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2117 if (hb->fore != NULL)
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2118 gdk_gc_set_foreground(gc, hb->fore);
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2119 else
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2120 gdk_gc_set_foreground(gc, &widget->style->fg[GTK_STATE_NORMAL]);
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2121
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2122 gdk_draw_line(html->html_area, gc, hb->x + 2,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2123 hb->y - html->yoffset - (hb->height / 2 - 1),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2124 hb->x + hb->width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2125 hb->y - html->yoffset - (hb->height / 2 - 1));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2126
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2127 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2128 else if (hb->type == HTML_BIT_PIXMAP)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2129 {
907
08d5037c9296 [gaim-migrate @ 917]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 897
diff changeset
2130 area.x = hb->x - html->xoffset;
08d5037c9296 [gaim-migrate @ 917]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 897
diff changeset
2131 area.y = hb->y - hb->height + 5 - html->yoffset;
911
65c8bd1feec5 [gaim-migrate @ 921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
2132 area.width = hb->width;
907
08d5037c9296 [gaim-migrate @ 917]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 897
diff changeset
2133 area.height = hb->height;
08d5037c9296 [gaim-migrate @ 917]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 897
diff changeset
2134 clear_area(html, &area);
918
5871e1eec10c [gaim-migrate @ 928]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 914
diff changeset
2135 if (hb->back != NULL) {
914
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2136 int hwidth, hheight, hei, tmpcnt;
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
2137 hei = get_line_height(html, hb);
914
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2138 gdk_window_get_size(html->html_area, &hwidth, &hheight);
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2139 gdk_gc_set_foreground(gc, hb->back);
918
5871e1eec10c [gaim-migrate @ 928]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 914
diff changeset
2140 for (tmpcnt = 0; tmpcnt < hb->newline; tmpcnt++) {
914
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2141 int eoff = hei + hei + 2;
918
5871e1eec10c [gaim-migrate @ 928]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 914
diff changeset
2142 eoff *= tmpcnt;
914
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2143 eoff += 5;
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2144 gdk_draw_rectangle(html->html_area, gc, TRUE,
938
5d140deadc68 [gaim-migrate @ 948]
Todd Kulesza <fflewddur>
parents: 918
diff changeset
2145 2, hb->y - html->yoffset + eoff,
914
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2146 hwidth, hei + hei + 2);
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2147 }
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2148 }
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2149
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2150 if (hb->fore != NULL)
918
5871e1eec10c [gaim-migrate @ 928]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 914
diff changeset
2151 gdk_gc_set_foreground(gc, hb->fore);
5871e1eec10c [gaim-migrate @ 928]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 914
diff changeset
2152 else
5871e1eec10c [gaim-migrate @ 928]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 914
diff changeset
2153 gdk_gc_set_foreground(gc, &widget->style->fg[GTK_STATE_NORMAL]);
5871e1eec10c [gaim-migrate @ 928]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 914
diff changeset
2154
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2155 gdk_draw_pixmap(html->html_area, gc, hb->pm, 0, 0, hb->x,
492
56399273ed8d [gaim-migrate @ 502]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
2156 hb->y - html->yoffset - (hb->height) + 4, -1, -1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2157 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2158 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2159
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2160
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2161
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2162 gint compare_types(GtkHtmlBit * hb, GtkHtmlBit * hb2)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2163 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2164 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2165 * In this function, it's OK to accidently return a
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2166 * * 0, but will cause problems on an accidental 1
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2167 */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2168
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2169 if (!hb || !hb2)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2170 return 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2171
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2172
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2173 if (hb->uline != hb2->uline)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2174 return 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2175 if (hb->strike != hb2->strike)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2176 return 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2177 if (hb->font && hb2->font)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2178 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2179 if (!gdk_font_equal(hb->font, hb2->font))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2180 return 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2181 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2182 else if (hb->font && !hb2->font)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2183 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2184 return 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2185 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2186 else if (!hb->font && hb2->font)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2187 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2188 return 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2189 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2190 if (hb->type != hb2->type)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2191 return 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2192
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2193 if (hb->fore && hb2->fore)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2194 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2195 if (!gdk_color_equal(hb->fore, hb2->fore))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2196 return 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2197 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2198 else if (hb->fore && !hb2->fore)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2199 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2200 return 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2201 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2202 else if (!hb->fore && hb2->fore)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2203 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2204 return 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2205 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2206
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2207 if (hb->back && hb2->back)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2208 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2209 if (!gdk_color_equal(hb->back, hb2->back))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2210 return 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2211 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2212 else if (hb->back && !hb2->back)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2213 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2214 return 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2215 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2216 else if (!hb->back && hb2->back)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2217 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2218 return 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2219 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2220
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2221 if ((hb->url != NULL && hb2->url == NULL) ||
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2222 (hb->url == NULL && hb2->url != NULL))
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2223 return 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2224
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2225 if (hb->url != NULL && hb2->url != NULL)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2226 if (strcasecmp(hb->url, hb2->url))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2227 return 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2228
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2229 return 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2230 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2231
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2232 static gint html_bit_is_onscreen(GtkHtml * html, GtkHtmlBit * hb)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2233 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2234 gint width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2235 height;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2236
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2237 gdk_window_get_size(html->html_area, &width, &height);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2238
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2239 if (hb->y < html->yoffset)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2240 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2241 return 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2242 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2243
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2244 if ((hb->y - hb->height) > (html->yoffset + height))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2245 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2246 return 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2247 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2248 return 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2249 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2250
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2251 static void draw_cursor(GtkHtml * html)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2252 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2253 if (html->editable &&
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2254 html->cursor_hb &&
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2255 GTK_WIDGET_DRAWABLE(html) &&
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2256 html_bit_is_onscreen(html, html->cursor_hb))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2257 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2258 gint x,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2259 y;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2260 gint width;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2261
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2262 GdkFont *font = html->cursor_hb->font;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2263
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2264 gdk_text_extents(font, html->cursor_hb->text, html->cursor_pos, NULL,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2265 NULL, &width, NULL, NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2266
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2267 gdk_gc_set_foreground(html->gc,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2268 &GTK_WIDGET(html)->style->text[GTK_STATE_NORMAL]);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2269
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2270 y = html->cursor_hb->y - html->yoffset;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2271 x = html->cursor_hb->x + width;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2272
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2273
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2274 gdk_draw_line(html->html_area, html->gc, x, y, x, y - font->ascent);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2275
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2276 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2277 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2278
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2279 static void undraw_cursor(GtkHtml * html)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2280 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2281 if (html->editable &&
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2282 html->cursor_hb &&
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2283 GTK_WIDGET_DRAWABLE(html) &&
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2284 html_bit_is_onscreen(html, html->cursor_hb))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2285 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2286 gint x,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2287 y;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2288 gint width;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2289 GdkRectangle area;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2290
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2291 GdkFont *font = html->cursor_hb->font;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2292
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2293 gdk_text_extents(font, html->cursor_hb->text, html->cursor_pos, NULL,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2294 NULL, &width, NULL, NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2295
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2296 y = html->cursor_hb->y - html->yoffset;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2297 x = html->cursor_hb->x + width;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2298
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2299 area.x = x;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2300 area.y = y - font->ascent;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2301 area.height = font->ascent + 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2302 area.width = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2303
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2304
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2305 clear_area(html, &area);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2306
897
b2ce6a6a8633 [gaim-migrate @ 907]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 896
diff changeset
2307 gtk_html_draw_bit(html, html->cursor_hb, 1);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2308
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2309
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2310 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2311 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2312
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2313
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2314 static void expose_html(GtkHtml * html, GdkRectangle * area, gboolean cursor)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2315 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2316 GList *hbits;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2317 GtkHtmlBit *hb;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2318 gint width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2319 height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2320 gint realy;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2321
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2322
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2323 if (html->frozen > 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2324 return;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2325
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2326
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2327 hbits = html->html_bits;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2328
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2329 gdk_window_get_size(html->html_area, &width, &height);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2330
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2331 realy = area->y + html->yoffset;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2332
895
81a8fb0a565f [gaim-migrate @ 905]
Todd Kulesza <fflewddur>
parents: 894
diff changeset
2333 /* this is needed since background colors draw across the entire window width
81a8fb0a565f [gaim-migrate @ 905]
Todd Kulesza <fflewddur>
parents: 894
diff changeset
2334 if anyone knows of a cleaner way to work bg colors, please submit code =) */
81a8fb0a565f [gaim-migrate @ 905]
Todd Kulesza <fflewddur>
parents: 894
diff changeset
2335 area->x = 0;
81a8fb0a565f [gaim-migrate @ 905]
Todd Kulesza <fflewddur>
parents: 894
diff changeset
2336 area->width = width;
81a8fb0a565f [gaim-migrate @ 905]
Todd Kulesza <fflewddur>
parents: 894
diff changeset
2337
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2338 clear_area(html, area);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2339
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2340 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2341 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2342
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2343 hb = (GtkHtmlBit *) hbits->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2344
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2345 if (html_bit_is_onscreen(html, hb))
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2346 gtk_html_draw_bit(html, hb, 1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2347
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2348
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2349 hbits = hbits->next;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2350 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2351 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2352
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2353 static void resize_html(GtkHtml * html)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2354 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2355 GList *hbits = html->html_bits;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2356 GList *html_bits = html->html_bits;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2357 GtkHtmlBit *hb,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2358 *hb2;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2359 char *str;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2360 gint height;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2361
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2362 if (!hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2363 return;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2364
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2365
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2366 html->html_bits = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2367
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2368 html->current_x = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2369 html->current_y = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2370
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2371 html->vadj->upper = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2372
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2373 gtk_html_freeze(html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2374
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2375 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2376 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2377 hb = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2378 if (hb->type == HTML_BIT_SEP)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2379 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2380
914
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2381 gtk_html_add_seperator(html, hb->font, hb->fore, hb->back);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2382
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2383 g_free(hb);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2384
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2385 hbits = hbits->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2386 continue;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2387 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2388 if (hb->type == HTML_BIT_PIXMAP)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2389 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2390
536
c9f994ea5833 [gaim-migrate @ 546]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 526
diff changeset
2391 gtk_html_add_pixmap(html, hb->pm, hb->fit, hb->newline);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2392
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2393 g_free(hb);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2394
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2395 hbits = hbits->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2396 continue;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2397 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2398
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2399 if (hb->newline)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2400 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2401 int i;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2402
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2403 if (!hb->text)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2404 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2405 hb->text = g_malloc(1);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2406 hb->text[0] = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2407 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2408 for (i = 0; i < hb->newline; i++)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2409 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2410 str = hb->text;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2411 hb->text = g_strconcat(str, "\n", NULL);
506
58af37870fdd [gaim-migrate @ 516]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 499
diff changeset
2412 if (str) g_free(str);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2413 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2414 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2415
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2416 if (hbits->next)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2417 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2418 hb2 = (GtkHtmlBit *) hbits->next->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2419 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2420 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2421 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2422 hb2 = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2423 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2424
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2425
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2426
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2427 if (!hb->newline && compare_types(hb, hb2))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2428 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2429 str = hb2->text;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2430 hb2->text = g_strconcat(hb->text, hb2->text, NULL);
537
d050f88321a1 [gaim-migrate @ 547]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 536
diff changeset
2431 if (str) g_free(str);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2432 hb2 = NULL;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2433 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2434 else if (hb->text)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2435 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2436 gtk_html_add_text(html, hb->font, hb->fore, hb->back,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2437 hb->text, strlen(hb->text), hb->uline, hb->strike,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2438 hb->url);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2439 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2440
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2441
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2442
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2443 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2444 * Font stays, so do colors (segfaults if I free)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2445 */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2446 if (hb->fore)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2447 gdk_color_free(hb->fore);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2448 if (hb->back)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2449 gdk_color_free(hb->back);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2450 if (hb->text)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2451 g_free(hb->text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2452 if (hb->url)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2453 g_free(hb->url);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2454
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2455 g_free(hb);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2456
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2457 hbits = hbits->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2458 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2459
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2460 g_list_free(html_bits);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2461
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2462
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2463 gtk_html_thaw(html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2464
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2465 gdk_window_get_size(html->html_area, NULL, &height);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2466 gtk_adjustment_set_value(html->vadj, html->vadj->upper - height);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2467
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2468 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2469
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2470 static GdkGC *create_bg_gc(GtkHtml * html)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2471 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2472 GdkGCValues values;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2473
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2474 values.tile = GTK_WIDGET(html)->style->bg_pixmap[GTK_STATE_NORMAL];
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2475 values.fill = GDK_TILED;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2476
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2477 return gdk_gc_new_with_values(html->html_area, &values,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2478 GDK_GC_FILL | GDK_GC_TILE);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2479 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2480
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2481 static void clear_area(GtkHtml * html, GdkRectangle * area)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2482 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2483 GtkWidget *widget = GTK_WIDGET(html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2484 gint x,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2485 y;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2486
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2487
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2488 if (html->transparent)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2489 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2490 if (html->pm == NULL)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2491 html->pm = get_desktop_pixmap(widget);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2492
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2493 if (html->pm == NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2494 return;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2495
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2496 if (html->bg_gc == NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2497 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2498 GdkGCValues values;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2499
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2500 values.tile = html->pm;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2501 values.fill = GDK_TILED;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2502
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2503 html->bg_gc = gdk_gc_new_with_values(html->html_area, &values,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2504 GDK_GC_FILL | GDK_GC_TILE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2505
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2506 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2507
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2508 gdk_window_get_deskrelative_origin(html->html_area, &x, &y);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2509
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2510 gdk_draw_pixmap(html->html_area, html->bg_gc, html->pm,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2511 x + area->x, y + area->y, area->x, area->y, area->width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2512 area->height);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2513
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2514 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2515
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2516 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2517 if (html->bg_gc)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2518 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2519
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2520 gint width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2521 height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2522
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2523 gdk_window_get_size(widget->style->bg_pixmap[GTK_STATE_NORMAL], &width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2524 &height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2525
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2526 gdk_gc_set_ts_origin(html->bg_gc,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2527 (-html->xoffset) % width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2528 (-html->yoffset) % height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2529
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2530 gdk_draw_rectangle(html->html_area, html->bg_gc, TRUE,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2531 area->x, area->y, area->width, area->height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2532 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2533 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2534 gdk_window_clear_area(html->html_area, area->x, area->y, area->width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2535 area->height);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2536 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2537
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2538
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2539
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2540
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2541 static void gtk_html_destroy(GtkObject * object)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2542 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2543 GtkHtml *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2544
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2545 g_return_if_fail(object != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2546 g_return_if_fail(GTK_IS_HTML(object));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2547
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2548 html = (GtkHtml *) object;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2549
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2550
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2551 gtk_signal_disconnect_by_data(GTK_OBJECT(html->hadj), html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2552 gtk_signal_disconnect_by_data(GTK_OBJECT(html->vadj), html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2553
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2554 if (html->timer)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2555 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2556 gtk_timeout_remove(html->timer);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2557 html->timer = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2558 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2559
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2560 if (html->tooltip_timer)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2561 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2562 gtk_timeout_remove(html->tooltip_timer);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2563 html->tooltip_timer = -1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2564 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2565
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2566
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2567 GTK_OBJECT_CLASS(parent_class)->destroy(object);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2568
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2569 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2570
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2571 static void gtk_html_finalize(GtkObject * object)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2572 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2573 GList *hbits;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2574 GtkHtml *html;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2575 GtkHtmlBit *hb;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2576
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2577
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2578 g_return_if_fail(object != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2579 g_return_if_fail(GTK_IS_HTML(object));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2580
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2581 html = (GtkHtml *) object;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2582
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2583 gtk_object_unref(GTK_OBJECT(html->hadj));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2584 gtk_object_unref(GTK_OBJECT(html->vadj));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2585
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2586 hbits = html->html_bits;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2587
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2588 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2589 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2590 hb = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2591 if (hb->fore)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2592 gdk_color_free(hb->fore);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2593 if (hb->back)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2594 gdk_color_free(hb->back);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2595 if (hb->text)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2596 g_free(hb->text);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2597 if (hb->url)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2598 g_free(hb->url);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2599 if (hb->pm)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2600 gdk_pixmap_unref(hb->pm);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2601
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2602 g_free(hb);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2603 hbits = hbits->next;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2604 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2605 if (html->html_bits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2606 g_list_free(html->html_bits);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2607
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2608 if (html->urls)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2609 g_list_free(html->urls);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2610
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2611 if (html->selected_text)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2612 g_free(html->selected_text);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2613
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2614 if (html->gc)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2615 gdk_gc_destroy(html->gc);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2616
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2617 if (html->bg_gc)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2618 gdk_gc_destroy(html->bg_gc);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2619
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2620 if (html->tooltip_window)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2621 gtk_widget_destroy(html->tooltip_window);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2622
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2623 GTK_OBJECT_CLASS(parent_class)->finalize(object);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2624 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2625
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2626 static void gtk_html_realize(GtkWidget * widget)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2627 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2628 GtkHtml *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2629 GdkWindowAttr attributes;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2630 gint attributes_mask;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2631
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2632 g_return_if_fail(widget != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2633 g_return_if_fail(GTK_IS_HTML(widget));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2634
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2635 html = GTK_HTML(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2636 GTK_WIDGET_SET_FLAGS(html, GTK_REALIZED);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2637
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2638 attributes.window_type = GDK_WINDOW_CHILD;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2639 attributes.x = widget->allocation.x;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2640 attributes.y = widget->allocation.y;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2641 attributes.width = widget->allocation.width;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2642 attributes.height = widget->allocation.height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2643 attributes.wclass = GDK_INPUT_OUTPUT;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2644 attributes.visual = gtk_widget_get_visual(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2645 attributes.colormap = gtk_widget_get_colormap(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2646 attributes.event_mask = gtk_widget_get_events(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2647 attributes.event_mask |= (GDK_EXPOSURE_MASK |
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2648 GDK_BUTTON_PRESS_MASK |
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2649 GDK_BUTTON_RELEASE_MASK |
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2650 GDK_BUTTON_MOTION_MASK |
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2651 GDK_ENTER_NOTIFY_MASK |
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2652 GDK_LEAVE_NOTIFY_MASK |
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2653 GDK_POINTER_MOTION_MASK |
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2654 GDK_POINTER_MOTION_HINT_MASK |
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2655 GDK_VISIBILITY_NOTIFY_MASK | GDK_KEY_PRESS_MASK);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2656
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2657 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2658
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2659 widget->window =
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2660 gdk_window_new(gtk_widget_get_parent_window(widget), &attributes,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2661 attributes_mask);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2662 gdk_window_set_user_data(widget->window, html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2663
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2664 attributes.x = (widget->style->klass->xthickness + BORDER_WIDTH);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2665 attributes.y = (widget->style->klass->ythickness + BORDER_WIDTH);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2666 attributes.width =
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2667 MAX(1, (gint) widget->allocation.width - (gint) attributes.x * 2);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2668 attributes.height =
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2669 MAX(1, (gint) widget->allocation.height - (gint) attributes.y * 2);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2670
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2671 html->html_area =
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2672 gdk_window_new(widget->window, &attributes, attributes_mask);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2673 gdk_window_set_user_data(html->html_area, html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2674
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2675 widget->style = gtk_style_attach(widget->style, widget->window);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2676
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2677 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2678 * Can't call gtk_style_set_background here because it's handled specially
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2679 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2680 gdk_window_set_background(widget->window,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2681 &widget->style->base[GTK_STATE_NORMAL]);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2682 gdk_window_set_background(html->html_area,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2683 &widget->style->base[GTK_STATE_NORMAL]);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2684
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2685 if (widget->style->bg_pixmap[GTK_STATE_NORMAL])
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2686 html->bg_gc = create_bg_gc(html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2687
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2688 html->gc = gdk_gc_new(html->html_area);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2689 gdk_gc_set_exposures(html->gc, TRUE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2690 gdk_gc_set_foreground(html->gc, &widget->style->text[GTK_STATE_NORMAL]);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2691
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2692 gdk_window_show(html->html_area);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2693
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2694 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2695
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2696 static void gtk_html_style_set(GtkWidget * widget, GtkStyle * previous_style)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2697 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2698 GtkHtml *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2699
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2700 g_return_if_fail(widget != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2701 g_return_if_fail(GTK_IS_HTML(widget));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2702
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2703 html = GTK_HTML(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2704 if (GTK_WIDGET_REALIZED(widget))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2705 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2706 gdk_window_set_background(widget->window,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2707 &widget->style->base[GTK_STATE_NORMAL]);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2708 gdk_window_set_background(html->html_area,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2709 &widget->style->base[GTK_STATE_NORMAL]);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2710
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2711 if (html->bg_gc)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2712 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2713 gdk_gc_destroy(html->bg_gc);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2714 html->bg_gc = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2715 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2716
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2717 if (widget->style->bg_pixmap[GTK_STATE_NORMAL])
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2718 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2719 html->bg_gc = create_bg_gc(html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2720 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2721
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2722 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2723 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2724
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2725 static void gtk_html_unrealize(GtkWidget * widget)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2726 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2727 GtkHtml *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2728
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2729 g_return_if_fail(widget != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2730 g_return_if_fail(GTK_IS_HTML(widget));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2731
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2732 html = GTK_HTML(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2733
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2734 gdk_window_set_user_data(html->html_area, NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2735 gdk_window_destroy(html->html_area);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2736 html->html_area = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2737
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2738 gdk_gc_destroy(html->gc);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2739 html->gc = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2740
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2741 if (html->bg_gc)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2742 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2743 gdk_gc_destroy(html->bg_gc);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2744 html->bg_gc = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2745 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2746
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2747 if (GTK_WIDGET_CLASS(parent_class)->unrealize)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2748 (*GTK_WIDGET_CLASS(parent_class)->unrealize) (widget);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2749 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2750
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2751
536
c9f994ea5833 [gaim-migrate @ 546]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 526
diff changeset
2752 void gtk_html_add_pixmap(GtkHtml * html, GdkPixmap * pm, int fit, int newline)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2753 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2754 GtkHtmlBit *last_hb;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2755 GtkHtmlBit *hb = g_new0(GtkHtmlBit, 1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2756 GdkWindowPrivate *private = (GdkWindowPrivate *) pm;
536
c9f994ea5833 [gaim-migrate @ 546]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 526
diff changeset
2757 int width, height;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2758
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2759 last_hb = (GtkHtmlBit *) g_list_last(html->html_bits)->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2760
536
c9f994ea5833 [gaim-migrate @ 546]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 526
diff changeset
2761 /* wrap pixmaps */
c9f994ea5833 [gaim-migrate @ 546]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 526
diff changeset
2762 gdk_window_get_size(html->html_area, &width, &height);
c9f994ea5833 [gaim-migrate @ 546]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 526
diff changeset
2763 if ((html->current_x + private->width) >= width) {
c9f994ea5833 [gaim-migrate @ 546]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 526
diff changeset
2764 html->current_x = 0;
c9f994ea5833 [gaim-migrate @ 546]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 526
diff changeset
2765 }
499
3ebd3ca4c3d4 [gaim-migrate @ 509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 492
diff changeset
2766
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2767 hb->fit = fit;
542
872d68495410 [gaim-migrate @ 552]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 540
diff changeset
2768 html->current_x += 2;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2769 hb->x = html->current_x;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2770 hb->y = html->current_y;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2771 if (fit)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2772 hb->height = last_hb->height;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2773 else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2774 hb->height = private->height;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2775 hb->type = HTML_BIT_PIXMAP;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2776 hb->width = private->width;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2777 hb->text = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2778 hb->url = NULL;
918
5871e1eec10c [gaim-migrate @ 928]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 914
diff changeset
2779 if (last_hb->fore) hb->fore = gdk_color_copy(last_hb->fore);
5871e1eec10c [gaim-migrate @ 928]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 914
diff changeset
2780 else hb->fore = NULL;
5871e1eec10c [gaim-migrate @ 928]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 914
diff changeset
2781 if (last_hb->back) hb->back = gdk_color_copy(last_hb->back);
5871e1eec10c [gaim-migrate @ 928]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 914
diff changeset
2782 else hb->back = NULL;
5871e1eec10c [gaim-migrate @ 928]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 914
diff changeset
2783 hb->font = last_hb->font;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2784 hb->uline = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2785 hb->strike = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2786 hb->was_selected = 0;
536
c9f994ea5833 [gaim-migrate @ 546]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 526
diff changeset
2787 hb->newline = newline;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2788 hb->pm = pm;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2789
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2790 if (html->current_x == BORDER_WIDTH)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2791 {
540
f586c3819574 [gaim-migrate @ 550]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 537
diff changeset
2792 html->current_y += hb->height + 3;
f586c3819574 [gaim-migrate @ 550]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 537
diff changeset
2793 hb->y += hb->height + 3;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2794 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2795
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2796
542
872d68495410 [gaim-migrate @ 552]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 540
diff changeset
2797 html->current_x += hb->width + 1;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2798
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2799 gtk_html_draw_bit(html, hb, 1);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2800
536
c9f994ea5833 [gaim-migrate @ 546]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 526
diff changeset
2801 if (hb->newline)
c9f994ea5833 [gaim-migrate @ 546]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 526
diff changeset
2802 html->current_x = 0;
c9f994ea5833 [gaim-migrate @ 546]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 526
diff changeset
2803
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2804 html->html_bits = g_list_append(html->html_bits, hb);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2805
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2806
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2807 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2808
914
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2809 static void gtk_html_add_seperator(GtkHtml * html, GdkFont *font, GdkColor *fore, GdkColor *back)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2810 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2811 GtkHtmlBit *hb = g_new0(GtkHtmlBit, 1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2812 gint width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2813 height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2814
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2815 html->current_x = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2816 html->current_y += 5;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2817
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2818 gdk_window_get_size(html->html_area, &width, &height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2819
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2820 hb->x = html->current_x;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2821 hb->y = html->current_y;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2822 hb->height = 5;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2823 hb->type = HTML_BIT_SEP;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2824 hb->width =
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2825 width -
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2826 GTK_SCROLLED_WINDOW(GTK_WIDGET(html)->parent)->vscrollbar->allocation.
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2827 width - 10;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2828 hb->text = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2829 hb->url = NULL;
914
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2830 if (fore)
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2831 hb->fore = gdk_color_copy(fore);
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2832 else
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2833 hb->fore = NULL;
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2834
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2835 if (back)
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2836 hb->back = gdk_color_copy(back);
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2837 else
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2838 hb->back = NULL;
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
2839 hb->font = font;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2840 hb->uline = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2841 hb->strike = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2842 hb->was_selected = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2843 hb->newline = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2844 hb->pm = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2845
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2846 gtk_html_draw_bit(html, hb, 1);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2847
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2848 html->html_bits = g_list_append(html->html_bits, hb);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2849
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2850 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2851
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2852 static void gtk_html_add_text(GtkHtml * html,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2853 GdkFont * cfont,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2854 GdkColor * fore,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2855 GdkColor * back,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2856 char *chars,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2857 gint length, gint uline, gint strike, char *url)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2858 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2859 char *nextline = NULL,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2860 *c,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2861 *text,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2862 *tmp;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2863 GdkGC *gc;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2864 int nl = 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2865 nl2 = 0;
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
2866 int maxwidth;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2867 gint lb;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2868 GList *hbits;
79
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 69
diff changeset
2869 size_t num = 0;
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 69
diff changeset
2870 int i,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2871 height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2872 GtkHtmlBit *hb;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2873 gint hwidth,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2874 hheight;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2875
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2876 if (length == 1 && chars[0] == '\n')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2877 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2878 GtkHtmlBit *h;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2879 hbits = g_list_last(html->html_bits);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2880 if (!hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2881 return;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2882 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2883 * I realize this loses a \n sometimes
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2884 * * if it's the first thing in the widget.
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2885 * * so fucking what.
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2886 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2887
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2888 h = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2889 h->newline++;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2890 if (html->current_x > 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2891 html->current_x = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2892 else
540
f586c3819574 [gaim-migrate @ 550]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 537
diff changeset
2893 html->current_y += cfont->ascent + cfont->descent + 5;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2894 return;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2895 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2896
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2897
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2898
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2899 c = text = g_malloc(length + 2);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2900 strncpy(text, chars, length);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2901 text[length] = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2902
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2903
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2904 gc = html->gc;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2905
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2906 if (gc == NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2907 gc = html->gc = gdk_gc_new(html->html_area);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2908
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2909 gdk_gc_set_font(gc, cfont);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2910
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2911
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2912 while (*c)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2913 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2914 if (*c == '\n')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2915 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2916 if (*(c + 1) == '\0')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2917 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2918 nl = 1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2919 length--;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2920 c[0] = '\0';
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2921 break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2922 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2923 if (*c)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2924 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2925 gtk_html_add_text(html, cfont, fore, back, text, num + 1, uline,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2926 strike, url);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2927 tmp = text;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2928 length -= (num + 1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2929 text = g_malloc(length + 2);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2930 strncpy(text, (c + 1), length);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2931 text[length] = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2932 c = text;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2933 num = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2934 g_free(tmp);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2935 continue;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2936 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2937 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2938
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2939 num++;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2940 c++;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2941 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2942
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2943 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2944 * Note, yG is chosen because G is damn high, and y is damn low,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2945 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2946 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2947 * it should be just fine. :)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2948 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2949
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2950 gdk_window_get_size(html->html_area, &hwidth, &hheight);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2951
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2952 num = strlen(text);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2953
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2954 while (GTK_WIDGET(html)->allocation.width < 20)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2955 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2956 while (gtk_events_pending())
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2957 gtk_main_iteration();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2958 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2959
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2960 maxwidth = (hwidth - html->current_x - 8);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2961 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2962 * HTK_SCROLLED_WINDOW(GTK_WIDGET(layout)->parent)->vscrollbar->allocation.width) - 8;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2963 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2964
851
2cee5577224b [gaim-migrate @ 861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 850
diff changeset
2965 if ((maxwidth == (hwidth - 8) && gdk_text_measure(cfont, text, num) > 2 * maxwidth) ||
2cee5577224b [gaim-migrate @ 861]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 850
diff changeset
2966 gdk_text_measure(cfont, text, num) < 0) {
847
430a88eb4a68 [gaim-migrate @ 857]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 842
diff changeset
2967 int pos = num / 2;
842
2804dc8e9ba0 [gaim-migrate @ 852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
2968 static int count = 0;
2804dc8e9ba0 [gaim-migrate @ 852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
2969 count ++;
850
902be73a6a43 [gaim-migrate @ 860]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 847
diff changeset
2970 while (pos < num && (!isspace(text[pos]) || text[pos] == '\n')) pos++;
1004
69c936ca2b04 [gaim-migrate @ 1014]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 985
diff changeset
2971 if (pos >= num - 1) {
847
430a88eb4a68 [gaim-migrate @ 857]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 842
diff changeset
2972 pos = num/2;
850
902be73a6a43 [gaim-migrate @ 860]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 847
diff changeset
2973 while (pos > 0 && (!isspace(text[pos]) || text[pos] == '\n')) pos--;
847
430a88eb4a68 [gaim-migrate @ 857]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 842
diff changeset
2974 if (!pos) pos = num / 2;
430a88eb4a68 [gaim-migrate @ 857]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 842
diff changeset
2975 }
850
902be73a6a43 [gaim-migrate @ 860]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 847
diff changeset
2976 gtk_html_add_text(html, cfont, fore, back, text, pos + 1, uline, strike, url);
902be73a6a43 [gaim-migrate @ 860]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 847
diff changeset
2977 gtk_html_add_text(html, cfont, fore, back, &text[pos+1], 1, uline, strike, url);
902be73a6a43 [gaim-migrate @ 860]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 847
diff changeset
2978 gtk_html_add_text(html, cfont, fore, back, &text[pos+2], num - pos + 1, uline, strike, url);
842
2804dc8e9ba0 [gaim-migrate @ 852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
2979 g_free(text);
2804dc8e9ba0 [gaim-migrate @ 852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
2980 count--;
2804dc8e9ba0 [gaim-migrate @ 852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
2981 if (!count) {
853
050f244b6829 [gaim-migrate @ 863]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 852
diff changeset
2982 /* FIXME : sometimes we need to add newline, sometimes we don't */
842
2804dc8e9ba0 [gaim-migrate @ 852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
2983 hbits = g_list_last(html->html_bits);
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
2984 if (!hbits) return; /* does this ever happen? */
842
2804dc8e9ba0 [gaim-migrate @ 852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
2985 hb = (GtkHtmlBit *)hbits->data;
850
902be73a6a43 [gaim-migrate @ 860]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 847
diff changeset
2986 hb->newline++;
842
2804dc8e9ba0 [gaim-migrate @ 852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
2987 }
2804dc8e9ba0 [gaim-migrate @ 852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
2988 return;
2804dc8e9ba0 [gaim-migrate @ 852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
2989 }
2804dc8e9ba0 [gaim-migrate @ 852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
2990
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2991 while (gdk_text_measure(cfont, text, num) > maxwidth)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2992 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2993 if (num > 1)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2994 num--;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2995 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2996 {
26
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
2997 if (html->current_x != 0) {
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
2998 html->current_x = 0;
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
2999 if (nl) {
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
3000 text[length] = '\n';
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
3001 length++;
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
3002 }
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
3003 gtk_html_add_text(html, cfont, fore, back, text, length, uline, strike, url);
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
3004 g_free(text);
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
3005 return;
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
3006 } else {
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
3007 num = strlen (text);
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
3008 break;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3009 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3010 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3011
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3012 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3013
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
3014 height = cfont->ascent + cfont->descent + 2;
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
3015
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
3016
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3017 if ((int) (html->vadj->upper - html->current_y) < (int) (height * 2))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3018 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3019 int val;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3020 val = (height * 2) + html->current_y;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3021 html->vadj->upper = val;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3022 adjust_adj(html, html->vadj);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3023 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3024
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3025
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3026 if (html->current_x == 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3027 {
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
3028 html->current_y += height + 3;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3029 gdk_text_extents(cfont, text, 1, &lb, NULL, NULL, NULL, NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3030 html->current_x += (2 - lb);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3031 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3032 else if ((hbits = g_list_last(html->html_bits)) != NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3033 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3034 int diff,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3035 y;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3036 hb = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3037 if (height > hb->height)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3038 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3039 diff = height - hb->height;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3040 y = hb->y;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3041 html->current_y += diff;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3042 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3043 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3044 hb = (GtkHtmlBit *) hbits->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3045 if (hb->y != y)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3046 break;
492
56399273ed8d [gaim-migrate @ 502]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
3047 if (hb->type != HTML_BIT_PIXMAP)
56399273ed8d [gaim-migrate @ 502]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 481
diff changeset
3048 hb->height = height;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3049 hb->y += diff; ////////////my thing here /////////////////
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3050 gtk_html_draw_bit(html, hb, FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3051
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3052 hbits = hbits->prev;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3053 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3054 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3055 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3056
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3057
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3058
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3059
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3060 if (num != strlen(text))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3061 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3062 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3063 * This is kinda cheesy but it may make things
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3064 * * much better lookin
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3065 */
26
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
3066
842
2804dc8e9ba0 [gaim-migrate @ 852]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
3067 for (i=2; (num > i); i++) {
26
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
3068 if (text[num - i] == ' ') {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3069 num = num - (i - 1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3070 nl2 = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3071 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3072 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3073 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3074
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3075 nextline = g_malloc(length - num + 2);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3076 strncpy(nextline, (char *) (text + num), length - num);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3077 nextline[length - num] = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3078 if (nl)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3079 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3080 nextline[length - num] = '\n';
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3081 nextline[length - num + 1] = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3082 nl = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3083 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3084
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3085
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3086 text[num] = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3087 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3088
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3089
52
ceb0d714d180 [gaim-migrate @ 62]
Rob Flynn <gaim@robflynn.com>
parents: 49
diff changeset
3090 if (url != NULL) {
53
bb007396e0a1 [gaim-migrate @ 63]
Rob Flynn <gaim@robflynn.com>
parents: 52
diff changeset
3091 fore = get_color(3355647, gdk_window_get_colormap(html->html_area));
52
ceb0d714d180 [gaim-migrate @ 62]
Rob Flynn <gaim@robflynn.com>
parents: 49
diff changeset
3092 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3093
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3094 hb = g_new0(GtkHtmlBit, 1);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3095
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3096 hb->text = g_strdup(text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3097
52
ceb0d714d180 [gaim-migrate @ 62]
Rob Flynn <gaim@robflynn.com>
parents: 49
diff changeset
3098 if (fore)
ceb0d714d180 [gaim-migrate @ 62]
Rob Flynn <gaim@robflynn.com>
parents: 49
diff changeset
3099 hb->fore = gdk_color_copy(fore);
ceb0d714d180 [gaim-migrate @ 62]
Rob Flynn <gaim@robflynn.com>
parents: 49
diff changeset
3100 else
ceb0d714d180 [gaim-migrate @ 62]
Rob Flynn <gaim@robflynn.com>
parents: 49
diff changeset
3101 hb->fore = NULL;
49
4d25b98a9d09 [gaim-migrate @ 58]
Jim Duchek <jimduchek>
parents: 26
diff changeset
3102
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3103 if (back)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3104 hb->back = gdk_color_copy(back);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3105 else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3106 hb->back = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3107 hb->font = cfont;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3108 hb->uline = uline;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3109 hb->strike = strike;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3110 hb->height = height;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3111 gdk_text_extents(cfont, text, num, &lb, NULL, &hb->width, NULL, NULL);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3112 hb->x = html->current_x;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3113 hb->y = html->current_y;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3114 hb->type = HTML_BIT_TEXT;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3115 hb->pm = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3116 if (url != NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3117 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3118 uline = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3119 hb->uline = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3120 hb->url = g_strdup(url);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3121 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3122 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3123 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3124 hb->url = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3125 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3126 html->current_x += hb->width;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3127
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3128 html->html_bits = g_list_append(html->html_bits, hb);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3129 if (url != NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3130 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3131 html->urls = g_list_append(html->urls, hb);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3132 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3133
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3134
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3135
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3136 gtk_html_draw_bit(html, hb, 1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3137
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3138 if (nl || nl2)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3139 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3140 if (nl)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3141 hb->newline = 1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3142 html->current_x = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3143 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3144 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3145 hb->newline = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3146
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3147
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3148 if (nextline != NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3149 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3150 gtk_html_add_text(html, cfont, fore, back, nextline, strlen(nextline),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3151 uline, strike, url);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3152 g_free(nextline);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3153 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3154
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3155 g_free(text);
137
fe81c8b4951d [gaim-migrate @ 147]
Rob Flynn <gaim@robflynn.com>
parents: 79
diff changeset
3156 if (url != NULL)
fe81c8b4951d [gaim-migrate @ 147]
Rob Flynn <gaim@robflynn.com>
parents: 79
diff changeset
3157 g_free(fore);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3158 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3159
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3160 static char * html_strtok( char * input, char delim )
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3161 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3162 static char * end;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3163 static char * curr_offset;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3164 int i;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3165 int num_quotes=0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3166
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3167 if( input != NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3168 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3169 curr_offset = input;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3170 end = input+strlen(input);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3171 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3172 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3173 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3174 if( curr_offset + strlen(curr_offset) < end )
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3175 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3176 curr_offset += strlen(curr_offset) + 1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3177 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3178 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3179 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3180 return NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3181 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3182 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3183 for( i=0; curr_offset+i < end &&
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3184 (curr_offset[i] != delim || num_quotes != 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3185 ; i++ )
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3186 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3187 if( curr_offset[i] == '\"' )
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3188 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3189 num_quotes = (num_quotes+1)%2;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3190 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3191 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3192 curr_offset[i] = '\0';
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3193 return curr_offset;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3194 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3195
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3196
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3197 void gtk_html_append_text(GtkHtml * html, char *text, gint options)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3198 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3199 GdkColormap *map;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3200 GdkFont *cfont;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3201 GdkRectangle area;
829
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 791
diff changeset
3202 char *ws,
1079
a4635c7c2128 [gaim-migrate @ 1089]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
3203 *tag,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3204 *c,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3205 *url = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3206 gint intag = 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3207 wpos = 0,
481
64afc8f41bcb [gaim-migrate @ 491]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 353
diff changeset
3208 tpos = 0;
64afc8f41bcb [gaim-migrate @ 491]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 353
diff changeset
3209 static gint colorv,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3210 bold = 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3211 italic = 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3212 fixed = 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3213 uline = 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3214 strike = 0,
481
64afc8f41bcb [gaim-migrate @ 491]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 353
diff changeset
3215 title = 0,
64afc8f41bcb [gaim-migrate @ 491]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 353
diff changeset
3216 height;
64afc8f41bcb [gaim-migrate @ 491]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 353
diff changeset
3217 static struct font_state *current = NULL,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3218 *tmp;
481
64afc8f41bcb [gaim-migrate @ 491]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 353
diff changeset
3219 static struct font_state def_state = { 3, 0, 0, "", NULL, NULL, NULL };
1119
ba292594e938 [gaim-migrate @ 1129]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
3220 gboolean scrolldown = TRUE;
ba292594e938 [gaim-migrate @ 1129]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
3221
ba292594e938 [gaim-migrate @ 1129]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
3222 if (html->vadj->upper > (html->vadj->value + html->vadj->page_size))
ba292594e938 [gaim-migrate @ 1129]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
3223 scrolldown = FALSE;
481
64afc8f41bcb [gaim-migrate @ 491]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 353
diff changeset
3224
64afc8f41bcb [gaim-migrate @ 491]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 353
diff changeset
3225 if (text == NULL) {
740
01d3c96867e2 [gaim-migrate @ 750]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 737
diff changeset
3226 bold = 0;
01d3c96867e2 [gaim-migrate @ 750]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 737
diff changeset
3227 italic = 0;
01d3c96867e2 [gaim-migrate @ 750]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 737
diff changeset
3228 fixed = 0;
01d3c96867e2 [gaim-migrate @ 750]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 737
diff changeset
3229 uline = 0;
01d3c96867e2 [gaim-migrate @ 750]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 737
diff changeset
3230 strike = 0;
01d3c96867e2 [gaim-migrate @ 750]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 737
diff changeset
3231 title = 0;
481
64afc8f41bcb [gaim-migrate @ 491]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 353
diff changeset
3232 while (current->next)
64afc8f41bcb [gaim-migrate @ 491]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 353
diff changeset
3233 {
64afc8f41bcb [gaim-migrate @ 491]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 353
diff changeset
3234 if (current->ownbg)
64afc8f41bcb [gaim-migrate @ 491]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 353
diff changeset
3235 g_free(current->bgcol);
64afc8f41bcb [gaim-migrate @ 491]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 353
diff changeset
3236 if (current->owncolor)
64afc8f41bcb [gaim-migrate @ 491]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 353
diff changeset
3237 g_free(current->color);
64afc8f41bcb [gaim-migrate @ 491]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 353
diff changeset
3238 tmp = current;
64afc8f41bcb [gaim-migrate @ 491]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 353
diff changeset
3239 current = current->next;
64afc8f41bcb [gaim-migrate @ 491]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 353
diff changeset
3240 g_free(tmp);
64afc8f41bcb [gaim-migrate @ 491]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 353
diff changeset
3241 }
64afc8f41bcb [gaim-migrate @ 491]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 353
diff changeset
3242 return;
64afc8f41bcb [gaim-migrate @ 491]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 353
diff changeset
3243 }
64afc8f41bcb [gaim-migrate @ 491]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 353
diff changeset
3244
64afc8f41bcb [gaim-migrate @ 491]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 353
diff changeset
3245 if (!current) current = &def_state;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3246 map = gdk_window_get_colormap(html->html_area);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3247 cfont = getfont(current->font, bold, italic, fixed, current->size);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3248 c = text;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3249
829
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 791
diff changeset
3250 ws = g_malloc(strlen(text) + 2);
1079
a4635c7c2128 [gaim-migrate @ 1089]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
3251 tag = g_malloc(strlen(text) + 2);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3252
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3253 while (*c)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3254 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3255 if (*c == '<')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3256 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3257 if (!intag)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3258 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3259 ws[wpos] = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3260 if (wpos)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3261 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3262 if (title)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3263 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3264 if (html->title)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3265 g_free(html->title);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3266 html->title = g_strdup(ws);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3267 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3268 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3269 gtk_html_add_text(html, cfont, current->color,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3270 current->bgcol, ws, strlen(ws), uline,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3271 strike, url);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3272 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3273 wpos = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3274 intag = 1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3275 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3276 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3277 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3278 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3279 * Assuming you NEVER have nested tags
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3280 * * (and I mean <tag <tag>> by this, not
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3281 * * <tag><tag2></tag2><tag>..
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3282 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3283 tag[tpos] = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3284 gtk_html_add_text(html, cfont, current->color, current->bgcol,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3285 "<", 1, 0, 0, NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3286 gtk_html_add_text(html, cfont, current->color, current->bgcol,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3287 tag, strlen(tag), 0, 0, NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3288 tpos = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3289
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3290 tag[0] = *c;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3291 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3292 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3293 else if (*c == '>')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3294 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3295 if (intag)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3296 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3297 tag[tpos] = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3298 if (!strcasecmp(tag, "B"))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3299 bold = 1;
732
6609b5a16b38 [gaim-migrate @ 742]
Rob Flynn <gaim@robflynn.com>
parents: 721
diff changeset
3300 else if (!strcasecmp(tag, "STRIKE") || !strcasecmp(tag, "S"))
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3301 strike = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3302 else if (!strcasecmp(tag, "I"))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3303 italic = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3304 else if (!strcasecmp(tag, "U"))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3305 uline = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3306 else if (!strcasecmp(tag, "PRE"))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3307 fixed = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3308 else if (!strcasecmp(tag, "HR"))
914
215fe9039ae1 [gaim-migrate @ 924]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 911
diff changeset
3309 gtk_html_add_seperator(html, cfont, current->color, current->bgcol);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3310 else if (!strcasecmp(tag, "/B"))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3311 bold = 0;
732
6609b5a16b38 [gaim-migrate @ 742]
Rob Flynn <gaim@robflynn.com>
parents: 721
diff changeset
3312 else if (!strcasecmp(tag, "/STRIKE") || !strcasecmp(tag, "/S"))
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3313 strike = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3314 else if (!strcasecmp(tag, "/I"))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3315 italic = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3316 else if (!strcasecmp(tag, "/U"))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3317 uline = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3318 else if (!strcasecmp(tag, "/PRE"))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3319 fixed = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3320 else if (!strcasecmp(tag, "TITLE"))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3321 title = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3322 else if (!strcasecmp(tag, "/TITLE"))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3323 title = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3324 else if (!strncasecmp(tag, "IMG", 3))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3325 {
549
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
3326 GdkPixmap *legend_i;
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
3327 GdkBitmap *legend_m;
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
3328
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
3329 if (strstr(tag, "SRC=\"aol_icon.gif\"") != NULL)
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
3330 {
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
3331 legend_i = gdk_pixmap_create_from_xpm_d(GTK_WIDGET(html)->window, &legend_m, NULL, aol_icon_xpm);
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
3332 gtk_html_add_pixmap(html, legend_i, 0, 0);
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
3333 }
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
3334
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
3335 if (strstr(tag, "SRC=\"admin_icon.gif\"") != NULL)
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
3336 {
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
3337 legend_i = gdk_pixmap_create_from_xpm_d(GTK_WIDGET(html)->window, &legend_m, NULL, admin_icon_xpm);
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
3338 gtk_html_add_pixmap(html, legend_i, 0, 0);
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
3339 }
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
3340 if (strstr(tag, "SRC=\"dt_icon.gif\"") != NULL)
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
3341 {
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
3342 legend_i = gdk_pixmap_create_from_xpm_d(GTK_WIDGET(html)->window, &legend_m, NULL, dt_icon_xpm);
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
3343 gtk_html_add_pixmap(html, legend_i, 0, 0);
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
3344 }
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
3345 if (strstr(tag, "SRC=\"free_icon.gif\"") != NULL)
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
3346 {
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
3347 legend_i = gdk_pixmap_create_from_xpm_d(GTK_WIDGET(html)->window, &legend_m, NULL, free_icon_xpm);
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
3348 gtk_html_add_pixmap(html, legend_i, 0, 0);
39853e359a06 [gaim-migrate @ 559]
Rob Flynn <gaim@robflynn.com>
parents: 542
diff changeset
3349 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3350 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3351 else if (!strcasecmp(tag, "H3"))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3352 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3353 current = push_state(current);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3354 current->size = 4;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3355 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3356 else if (!strcasecmp(tag, "/H3"))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3357 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3358 gtk_html_add_text(html, cfont, current->color,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3359 current->bgcol, "\n", 1, 0, 0, NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3360
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3361 if (current->next)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3362 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3363 if (current->ownbg)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3364 g_free(current->bgcol);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3365 if (current->owncolor)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3366 g_free(current->color);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3367 tmp = current;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3368 current = current->next;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3369 g_free(tmp);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3370 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3371 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3372 else if (!strcasecmp(tag, "TABLE"))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3373 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3374 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3375 else if (!strcasecmp(tag, "/TABLE"))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3376 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3377 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3378 else if (!strcasecmp(tag, "TR"))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3379 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3380 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3381 else if (!strcasecmp(tag, "/TR"))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3382 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3383 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3384 else if (!strcasecmp(tag, "/TD"))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3385 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3386 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3387 else if (!strcasecmp(tag, "TD"))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3388 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3389 gtk_html_add_text(html, cfont, current->color,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3390 current->bgcol, " ", 2, 0, 0, NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3391 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3392 else if (!strncasecmp(tag, "A ", 2))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3393 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3394 char *d;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3395 char *temp = d = g_strdup(tag);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3396 int flag = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3397 strtok(tag, " ");
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3398 while ((d = strtok(NULL, " ")))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3399 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3400 if (strlen(d) < 7)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3401 break;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3402 if (!strncasecmp(d, "HREF=\"", strlen("HREF=\"")))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3403 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3404 d += strlen("HREF=\"");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3405 d[strlen(d) - 1] = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3406 url = g_malloc(strlen(d) + 1);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3407 strcpy(url, d);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3408 flag = 1;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3409 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3410 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3411 g_free(temp);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3412 if (!flag)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3413 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3414 gtk_html_add_text(html, cfont, current->color,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3415 current->bgcol, "<", 1, 0, 0, NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3416 gtk_html_add_text(html, cfont, current->color,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3417 current->bgcol, tag, strlen(tag), 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3418 0, NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3419 gtk_html_add_text(html, cfont, current->color,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3420 current->bgcol, ">", 1, 0, 0, NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3421 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3422 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3423 else if (!strcasecmp(tag, "/A"))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3424 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3425 if (url)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3426 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3427 g_free(url);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3428 url = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3429 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3430 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3431 else if (!strncasecmp(tag, "FONT", strlen("FONT")))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3432 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3433 char *d;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3434 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3435 * Push a new state onto the stack, based on the old state
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3436 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3437 current = push_state(current);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3438 html_strtok(tag, ' ');
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3439 while ((d = html_strtok(NULL, ' ')))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3440 {
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1079
diff changeset
3441 if (!strncasecmp(d, "style=", strlen("style=")))
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1079
diff changeset
3442 {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1079
diff changeset
3443 d += strlen("style=");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1079
diff changeset
3444 if (*d == '\"') {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1079
diff changeset
3445 d++;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1079
diff changeset
3446 while (*d != '\0' && *d != '\"') d++;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1079
diff changeset
3447 if (*d == '\0')
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1079
diff changeset
3448 html_strtok(tag, ' ');
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1079
diff changeset
3449 }
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1079
diff changeset
3450 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3451 if (!strncasecmp(d, "COLOR=", strlen("COLOR=")))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3452 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3453 d += strlen("COLOR=");
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3454 if (*d == '\"')
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
3455 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3456 d++;
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
3457 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3458 if (*d == '#')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3459 d++;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3460 if (d[strlen(d) - 1] == '\"')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3461 d[strlen(d) - 1] = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3462 if (sscanf(d, "%x", &colorv)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3463 && !(options & HTML_OPTION_NO_COLOURS))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3464 {
677
05f6f7dabb7e [gaim-migrate @ 687]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 674
diff changeset
3465 current->color = get_color(colorv, map);
05f6f7dabb7e [gaim-migrate @ 687]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 674
diff changeset
3466 current->owncolor = 1;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3467 }
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
3468 else
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
3469 {
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
3470 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3471 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3472 if (!strncasecmp(d, "FACE=", strlen("FACE=")))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3473 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3474 d += strlen("FACE=");
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3475 if (*d == '\"')
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
3476 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3477 d++;
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
3478 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3479 if (d[strlen(d) - 1] == '\"')
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3480 d[strlen(d) - 1] = 0;
1244
eaa0e2f5ace4 [gaim-migrate @ 1254]
Rob Flynn <gaim@robflynn.com>
parents: 1119
diff changeset
3481
eaa0e2f5ace4 [gaim-migrate @ 1254]
Rob Flynn <gaim@robflynn.com>
parents: 1119
diff changeset
3482 if (!(options & HTML_OPTION_NO_FONTS)) {
eaa0e2f5ace4 [gaim-migrate @ 1254]
Rob Flynn <gaim@robflynn.com>
parents: 1119
diff changeset
3483 strcpy(current->font, d);
eaa0e2f5ace4 [gaim-migrate @ 1254]
Rob Flynn <gaim@robflynn.com>
parents: 1119
diff changeset
3484 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3485 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3486 else if (!strncasecmp(d, "BACK=", strlen("BACK=")))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3487 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3488 d += strlen("BACK=");
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3489 if (*d == '\"')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3490 d++;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3491 if (*d == '#')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3492 d++;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3493 if (d[strlen(d) - 1] == '\"')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3494 d[strlen(d) - 1] = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3495 if (sscanf(d, "%x", &colorv)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3496 && !(options & HTML_OPTION_NO_COLOURS))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3497 {
1117
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
3498 if (colorv != 0xffffff ||
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
3499 !(display_options & OPT_DISP_IGN_WHITE)) {
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
3500 current->bgcol = get_color(colorv, map);
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
3501 current->ownbg = 1;
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
3502 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3503 }
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
3504 else
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
3505 {
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
3506 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3507 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3508 else if (!strncasecmp(d, "SIZE=", strlen("SIZE=")))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3509 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3510 d += strlen("SIZE=");
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3511 if (*d == '\"')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3512 d++;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3513 if (*d == '+')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3514 d++;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3515 if (sscanf(d, "%d", &colorv))
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
3516 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3517 current->size = colorv;
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
3518 }
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
3519 else
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
3520 {
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
3521 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3522 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3523 else if (strncasecmp(d, "PTSIZE=", strlen("PTSIZE=")))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3524 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3525 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3526 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3527 }
669
e871081839d0 [gaim-migrate @ 679]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 667
diff changeset
3528 else if (!strncasecmp(tag, "BODY", strlen("BODY")))
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3529 {
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
3530
669
e871081839d0 [gaim-migrate @ 679]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 667
diff changeset
3531 char *d;
632
21c63b26c604 [gaim-migrate @ 642]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 629
diff changeset
3532 current = push_state(current);
669
e871081839d0 [gaim-migrate @ 679]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 667
diff changeset
3533 html_strtok(tag, ' ');
e871081839d0 [gaim-migrate @ 679]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 667
diff changeset
3534 while ((d = html_strtok(NULL, ' ')))
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3535 {
669
e871081839d0 [gaim-migrate @ 679]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 667
diff changeset
3536 if (!strncasecmp(d, "BGCOLOR=", strlen("BGCOLOR=")))
e871081839d0 [gaim-migrate @ 679]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 667
diff changeset
3537 {
677
05f6f7dabb7e [gaim-migrate @ 687]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 674
diff changeset
3538 d += strlen("BGCOLOR=");
669
e871081839d0 [gaim-migrate @ 679]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 667
diff changeset
3539 if (*d == '\"')
e871081839d0 [gaim-migrate @ 679]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 667
diff changeset
3540 d++;
e871081839d0 [gaim-migrate @ 679]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 667
diff changeset
3541 if (*d == '#')
e871081839d0 [gaim-migrate @ 679]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 667
diff changeset
3542 d++;
e871081839d0 [gaim-migrate @ 679]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 667
diff changeset
3543 if (d[strlen(d) - 1] == '\"')
e871081839d0 [gaim-migrate @ 679]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 667
diff changeset
3544 d[strlen(d) - 1] = 0;
e871081839d0 [gaim-migrate @ 679]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 667
diff changeset
3545 if (sscanf(d, "%x", &colorv)
e871081839d0 [gaim-migrate @ 679]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 667
diff changeset
3546 && !(options & HTML_OPTION_NO_COLOURS))
e871081839d0 [gaim-migrate @ 679]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 667
diff changeset
3547 {
677
05f6f7dabb7e [gaim-migrate @ 687]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 674
diff changeset
3548 if (colorv != 0xffffff ||
669
e871081839d0 [gaim-migrate @ 679]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 667
diff changeset
3549 !(display_options & OPT_DISP_IGN_WHITE)) {
e871081839d0 [gaim-migrate @ 679]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 667
diff changeset
3550 current->bgcol = get_color(colorv, map);
e871081839d0 [gaim-migrate @ 679]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 667
diff changeset
3551 current->ownbg = 1;
e871081839d0 [gaim-migrate @ 679]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 667
diff changeset
3552 }
e871081839d0 [gaim-migrate @ 679]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 667
diff changeset
3553 }
667
45ed2ca0756e [gaim-migrate @ 677]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 666
diff changeset
3554 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3555 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3556 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3557 else if (!strncasecmp(tag, "/FONT", strlen("/FONT")))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3558 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3559 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3560 * Pop a font state off the list if possible, freeing
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3561 * any resources it used
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3562 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3563 if (current->next)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3564 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3565 if (current->ownbg)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3566 g_free(current->bgcol);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3567 if (current->owncolor)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3568 g_free(current->color);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3569 tmp = current;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3570 current = current->next;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3571 g_free(tmp);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3572 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3573
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3574 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3575 else if (!strcasecmp(tag, "/BODY"))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3576 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3577 if (current->next)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3578 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3579 if (current->ownbg)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3580 g_free(current->bgcol);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3581 if (current->owncolor)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3582 g_free(current->color);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3583 tmp = current;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3584 current = current->next;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3585 g_free(tmp);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3586 } /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3587 * tags we ignore below
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3588 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3589 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3590 else if (!strncasecmp(tag, "BR", 2))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3591 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3592 gtk_html_add_text(html, cfont, current->color,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3593 current->bgcol, "\n", 1, 0, 0, NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3594 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3595 else if (strncasecmp(tag, "HTML", 4)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3596 && strncasecmp(tag, "/HTML", 5)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3597 && strncasecmp(tag, "BODY", 4)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3598 && strncasecmp(tag, "/BODY", 5)
627
da0a1238874d [gaim-migrate @ 637]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 604
diff changeset
3599 && (strncasecmp(tag, "P", 1) || tag[1] != '>')
da0a1238874d [gaim-migrate @ 637]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 604
diff changeset
3600 && (strncasecmp(tag, "/P", 2) || tag[3] != '>')
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3601 && strncasecmp(tag, "HEAD", 4)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3602 && strncasecmp(tag, "/HEAD", 5))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3603 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3604 if (tpos)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3605 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3606 gtk_html_add_text(html, cfont, current->color,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3607 current->bgcol, "<", 1, 0, 0, NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3608 gtk_html_add_text(html, cfont, current->color,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3609 current->bgcol, tag, strlen(tag), 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3610 0, NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3611 gtk_html_add_text(html, cfont, current->color,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3612 current->bgcol, ">", 1, 0, 0, NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3613
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3614 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3615 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3616 cfont = getfont(current->font, bold, italic, fixed, current->size);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3617 tpos = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3618 intag = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3619 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3620 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3621 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3622 ws[wpos++] = *c;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3623 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3624 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3625 else if (!intag && *c == '&')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3626 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3627 if (!strncasecmp(c, "&amp;", 5))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3628 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3629 ws[wpos++] = '&';
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3630 c += 4;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3631 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3632 else if (!strncasecmp(c, "&lt;", 4))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3633 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3634 ws[wpos++] = '<';
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3635 c += 3;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3636 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3637 else if (!strncasecmp(c, "&gt;", 4))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3638 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3639 ws[wpos++] = '>';
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3640 c += 3;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3641 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3642 else if (!strncasecmp(c, "&nbsp;", 6))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3643 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3644 ws[wpos++] = ' ';
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3645 c += 5;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3646 }
526
5bf71b39cba2 [gaim-migrate @ 536]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 523
diff changeset
3647 else if (!strncasecmp(c, "&copy;", 6))
5bf71b39cba2 [gaim-migrate @ 536]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 523
diff changeset
3648 {
5bf71b39cba2 [gaim-migrate @ 536]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 523
diff changeset
3649 ws[wpos++] = '©';
5bf71b39cba2 [gaim-migrate @ 536]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 523
diff changeset
3650 c += 5;
5bf71b39cba2 [gaim-migrate @ 536]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 523
diff changeset
3651 }
737
c3a920cee3fc [gaim-migrate @ 747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 732
diff changeset
3652 else if (!strncasecmp(c, "&quot;", 6))
c3a920cee3fc [gaim-migrate @ 747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 732
diff changeset
3653 {
c3a920cee3fc [gaim-migrate @ 747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 732
diff changeset
3654 ws[wpos++] = '\"';
c3a920cee3fc [gaim-migrate @ 747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 732
diff changeset
3655 c += 5;
c3a920cee3fc [gaim-migrate @ 747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 732
diff changeset
3656 }
c3a920cee3fc [gaim-migrate @ 747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 732
diff changeset
3657 else if (!strncasecmp(c, "&reg;", 5))
c3a920cee3fc [gaim-migrate @ 747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 732
diff changeset
3658 {
c3a920cee3fc [gaim-migrate @ 747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 732
diff changeset
3659 ws[wpos++] = 174;
c3a920cee3fc [gaim-migrate @ 747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 732
diff changeset
3660 c += 4;
c3a920cee3fc [gaim-migrate @ 747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 732
diff changeset
3661 }
526
5bf71b39cba2 [gaim-migrate @ 536]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 523
diff changeset
3662 else if (*(c + 1) == '#')
5bf71b39cba2 [gaim-migrate @ 536]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 523
diff changeset
3663 {
5bf71b39cba2 [gaim-migrate @ 536]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 523
diff changeset
3664 int pound = 0;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1244
diff changeset
3665 debug_printf("got &#;\n");
526
5bf71b39cba2 [gaim-migrate @ 536]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 523
diff changeset
3666 if (sscanf(c, "&#%d;", &pound) > 0) {
5bf71b39cba2 [gaim-migrate @ 536]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 523
diff changeset
3667 ws[wpos++] = (char)pound;
5bf71b39cba2 [gaim-migrate @ 536]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 523
diff changeset
3668 c += 2;
5bf71b39cba2 [gaim-migrate @ 536]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 523
diff changeset
3669 while (isdigit(*c)) c++;
5bf71b39cba2 [gaim-migrate @ 536]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 523
diff changeset
3670 if (*c != ';') c--;
5bf71b39cba2 [gaim-migrate @ 536]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 523
diff changeset
3671 } else {
5bf71b39cba2 [gaim-migrate @ 536]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 523
diff changeset
3672 ws[wpos++] = *c;
5bf71b39cba2 [gaim-migrate @ 536]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 523
diff changeset
3673 }
5bf71b39cba2 [gaim-migrate @ 536]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 523
diff changeset
3674 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3675 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3676 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3677 ws[wpos++] = *c;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3678 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3679 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3680 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3681 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3682 if (intag)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3683 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3684 tag[tpos++] = *c;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3685 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3686 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3687 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3688 ws[wpos++] = *c;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3689 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3690 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3691 c++;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3692 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3693 ws[wpos] = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3694 tag[tpos] = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3695 if (wpos)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3696 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3697 gtk_html_add_text(html, cfont, current->color, current->bgcol, ws,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3698 strlen(ws), uline, strike, url);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3699 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3700 if (tpos)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3701 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3702 gtk_html_add_text(html, cfont, current->color, current->bgcol, "<", 1,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3703 0, 0, NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3704 gtk_html_add_text(html, cfont, current->color, current->bgcol, tag,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3705 strlen(tag), 0, 0, NULL);
523
023c3851db0a [gaim-migrate @ 533]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 506
diff changeset
3706 /* gtk_html_add_text(html, cfont, current->color, current->bgcol, ">", 1,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3707 0, 0, NULL);
523
023c3851db0a [gaim-migrate @ 533]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 506
diff changeset
3708 */ }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3709
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3710
829
9a123b171f46 [gaim-migrate @ 839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 791
diff changeset
3711 g_free(ws);
1079
a4635c7c2128 [gaim-migrate @ 1089]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
3712 g_free(tag);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3713
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3714 gdk_window_get_size(html->html_area, NULL, &height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3715 area.height = height;
1119
ba292594e938 [gaim-migrate @ 1129]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
3716 if (scrolldown)
ba292594e938 [gaim-migrate @ 1129]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
3717 gtk_adjustment_set_value(html->vadj, html->vadj->upper - area.height);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3718
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3719 return;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3720 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3721
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3722
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3723 static void adjust_adj(GtkHtml * html, GtkAdjustment * adj)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3724 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3725 gint height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3726
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3727 gdk_window_get_size(html->html_area, NULL, &height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3728
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3729 adj->step_increment = MIN(adj->upper, (float) SCROLL_PIXELS);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3730 adj->page_increment = MIN(adj->upper, height - (float) KEY_SCROLL_PIXELS);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3731 adj->page_size = MIN(adj->upper, height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3732 adj->value = MIN(adj->value, adj->upper - adj->page_size);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3733 adj->value = MAX(adj->value, 0.0);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3734
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3735 gtk_signal_emit_by_name(GTK_OBJECT(adj), "changed");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3736 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3737
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3738
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3739 static void scroll_down(GtkHtml * html, gint diff0)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3740 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3741 GdkRectangle rect;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3742 gint width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3743 height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3744
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3745 html->yoffset += diff0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3746
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3747 gdk_window_get_size(html->html_area, &width, &height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3748
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3749 if (html->transparent)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3750 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3751 rect.x = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3752 rect.y = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3753 rect.width = width;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3754 rect.height = height;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3755 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3756 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3757 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3758
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3759
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3760 if (height > diff0 && !html->transparent)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3761 gdk_draw_pixmap(html->html_area,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3762 html->gc,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3763 html->html_area,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3764 0, diff0, 0, 0, width, height - diff0);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3765
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3766 rect.x = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3767 rect.y = MAX(0, height - diff0);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3768 rect.width = width;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3769 rect.height = MIN(height, diff0);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3770 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3771
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3772 expose_html(html, &rect, FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3773 gtk_html_draw_focus((GtkWidget *) html);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3774
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3775 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3776
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3777 static void scroll_up(GtkHtml * html, gint diff0)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3778 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3779 GdkRectangle rect;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3780 gint width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3781 height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3782
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3783 html->yoffset -= diff0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3784
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3785
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3786 gdk_window_get_size(html->html_area, &width, &height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3787
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3788 if (html->transparent)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3789 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3790 rect.x = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3791 rect.y = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3792 rect.width = width;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3793 rect.height = height;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3794 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3795 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3796 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3797
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3798 if (height > diff0)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3799 gdk_draw_pixmap(html->html_area,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3800 html->gc,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3801 html->html_area,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3802 0, 0, 0, diff0, width, height - diff0);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3803
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3804 rect.x = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3805 rect.y = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3806 rect.width = width;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3807 rect.height = MIN(height, diff0);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3808 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3809
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3810 expose_html(html, &rect, FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3811 gtk_html_draw_focus((GtkWidget *) html);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3812
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3813 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3814
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3815
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3816
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3817 static void gtk_html_adjustment(GtkAdjustment * adjustment, GtkHtml * html)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3818 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3819 g_return_if_fail(adjustment != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3820 g_return_if_fail(GTK_IS_ADJUSTMENT(adjustment));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3821 g_return_if_fail(html != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3822 g_return_if_fail(GTK_IS_HTML(html));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3823
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3824 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3825 * Just ignore it if we haven't been size-allocated and realized yet
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3826 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3827 if (html->html_area == NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3828 return;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3829
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3830 if (adjustment == html->hadj)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3831 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3832 g_warning("horizontal scrolling not implemented");
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3833 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3834 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3835 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3836 gint diff = ((gint) adjustment->value) - html->last_ver_value;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3837
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3838 if (diff != 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3839 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3840 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3841 * undraw_cursor (text, FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3842 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3843
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3844 if (diff > 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3845 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3846 scroll_down(html, diff);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3847 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3848 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3849 { /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3850 * if (diff < 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3851 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3852 scroll_up(html, -diff);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3853 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3854 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3855 * draw_cursor (text, FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3856 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3857
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3858 html->last_ver_value = adjustment->value;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3859 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3860 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3861 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3862
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3863 static gint gtk_html_visibility_notify(GtkWidget * widget,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3864 GdkEventVisibility * event)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3865 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3866 GtkHtml *html;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3867 GdkRectangle rect;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3868 gint width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3869 height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3870
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3871 g_return_val_if_fail(widget != NULL, FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3872 g_return_val_if_fail(GTK_IS_HTML(widget), FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3873
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3874 html = GTK_HTML(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3875
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3876 if (GTK_WIDGET_REALIZED(widget) && html->transparent)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3877 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3878 gdk_window_get_size(html->html_area, &width, &height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3879 rect.x = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3880 rect.y = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3881 rect.width = width;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3882 rect.height = height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3883 expose_html(html, &rect, FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3884 gtk_html_draw_focus((GtkWidget *) html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3885 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3886 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3887 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3888 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3889
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3890
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3891 return FALSE;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3892 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3893
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3894
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3895
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3896 static void gtk_html_disconnect(GtkAdjustment * adjustment, GtkHtml * html)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3897 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3898 g_return_if_fail(adjustment != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3899 g_return_if_fail(GTK_IS_ADJUSTMENT(adjustment));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3900 g_return_if_fail(html != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3901 g_return_if_fail(GTK_IS_HTML(html));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3902
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3903 if (adjustment == html->hadj)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3904 gtk_html_set_adjustments(html, NULL, html->vadj);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3905 if (adjustment == html->vadj)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3906 gtk_html_set_adjustments(html, html->hadj, NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3907 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3908
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3909 static void move_cursor_ver(GtkHtml * html, int count)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3910 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3911 GList *hbits = g_list_find(html->html_bits, html->cursor_hb);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3912 GtkHtmlBit *hb = NULL,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3913 *hb2 = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3914 gint y;
79
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 69
diff changeset
3915 size_t len,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3916 len2 = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3917
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3918 undraw_cursor(html);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3919
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3920 if (!html->html_bits)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3921 return;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3922
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3923 if (!html->cursor_hb)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3924 html->cursor_hb = (GtkHtmlBit *) html->html_bits->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3925
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3926 hb = html->cursor_hb;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3927
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3928 len = html->cursor_pos;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3929 hbits = hbits->prev;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3930 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3931 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3932 hb2 = (GtkHtmlBit *) hbits->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3933
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3934 if (hb2->y != hb->y)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3935 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3936
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3937 len += strlen(hb2->text);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3938
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3939 hbits = hbits->prev;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3940 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3941
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3942 hbits = g_list_find(html->html_bits, html->cursor_hb);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3943
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3944 if (count < 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3945 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3946 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3947 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3948 hb2 = (GtkHtmlBit *) hbits->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3949
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3950 if (hb2->y != hb->y)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3951 break;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3952
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3953 hbits = hbits->prev;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3954 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3955 if (!hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3956 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3957 draw_cursor(html);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3958 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3959 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3960 y = hb2->y;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3961 hb = hb2;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3962 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3963 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3964 hb2 = (GtkHtmlBit *) hbits->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3965
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3966 if (hb2->y != y)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3967 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3968
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3969 hb = hb2;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3970
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3971 hbits = hbits->prev;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3972 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3973 hbits = g_list_find(html->html_bits, hb);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3974 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3975 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3976 hb2 = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3977
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3978 if (hb->y != hb2->y)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3979 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3980 html->cursor_hb = hb;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3981 html->cursor_pos = strlen(hb->text);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3982 break;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3983 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3984
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3985
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3986 if (len < len2 + strlen(hb2->text))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3987 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3988 html->cursor_hb = hb2;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3989 html->cursor_pos = len - len2;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3990 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3991 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3992
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3993 len2 += strlen(hb2->text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3994
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3995 hb = hb2;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3996
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3997 hbits = hbits->next;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3998 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3999 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4000 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4001 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4002 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4003 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4004 hb2 = (GtkHtmlBit *) hbits->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4005
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4006 if (hb2->y != hb->y)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4007 break;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4008
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4009 hbits = hbits->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4010 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4011 if (!hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4012 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4013 draw_cursor(html);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4014 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4015 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4016 hb = hb2;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4017 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4018 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4019 hb2 = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4020
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4021 if (hb->y != hb2->y)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4022 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4023 html->cursor_hb = hb;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4024 html->cursor_pos = strlen(hb->text);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4025 break;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4026 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4027
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4028
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4029 if (len < len2 + strlen(hb2->text))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4030 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4031 html->cursor_hb = hb2;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4032 html->cursor_pos = len - len2;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4033 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4034 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4035
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4036 len2 += strlen(hb2->text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4037
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4038 hb = hb2;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4039
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4040 hbits = hbits->next;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4041 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4042 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4043
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4044 draw_cursor(html);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4045
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4046 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4047
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4048 static void move_cursor_hor(GtkHtml * html, int count)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4049 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4050 GList *hbits = g_list_find(html->html_bits, html->cursor_hb);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4051 GtkHtmlBit *hb,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4052 *hb2;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4053
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4054 undraw_cursor(html);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4055
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4056 if (!html->html_bits)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4057 return;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4058
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4059 if (!html->cursor_hb)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4060 html->cursor_hb = (GtkHtmlBit *) html->html_bits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4061
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4062 html->cursor_pos += count;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4063
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4064 if (html->cursor_pos < 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4065 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4066 if (hbits->prev)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4067 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4068 gint diff;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4069 hb = html->cursor_hb;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4070 hb2 = (GtkHtmlBit *) hbits->prev->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4071 diff = html->cursor_pos + strlen(hb2->text) + 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4072 if (hb->y == hb2->y)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4073 --diff;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4074
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4075 html->cursor_pos = diff;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4076
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4077 html->cursor_hb = (GtkHtmlBit *) hbits->prev->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4078 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4079 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4080 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4081 html->cursor_pos = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4082 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4083 }
79
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 69
diff changeset
4084 else if ((unsigned) html->cursor_pos > strlen(html->cursor_hb->text))
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4085 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4086 if (hbits->next)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4087 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4088 gint diff;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4089 hb = html->cursor_hb;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4090 hb2 = (GtkHtmlBit *) hbits->next->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4091
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4092 diff = html->cursor_pos - strlen(html->cursor_hb->text) - 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4093 if (hb->y == hb2->y)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4094 ++diff;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4095 html->cursor_pos = diff;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4096 html->cursor_hb = (GtkHtmlBit *) hbits->next->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4097 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4098 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4099 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4100 html->cursor_pos = strlen(html->cursor_hb->text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4101 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4102
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4103 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4104
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4105 draw_cursor(html);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4106 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4107
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4108 static void move_beginning_of_line(GtkHtml * html)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4109 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4110 GList *hbits = g_list_find(html->html_bits, html->cursor_hb);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4111 GtkHtmlBit *hb = NULL;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4112 gint y;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4113
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4114 undraw_cursor(html);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4115
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4116 if (!html->html_bits)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4117 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4118
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4119 if (!html->cursor_hb)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4120 html->cursor_hb = (GtkHtmlBit *) html->html_bits->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4121
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4122 y = html->cursor_hb->y;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4123
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4124 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4125 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4126 hb = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4127
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4128 if (y != hb->y)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4129 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4130 hb = (GtkHtmlBit *) hbits->next->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4131 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4132 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4133
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4134 hbits = hbits->prev;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4135 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4136 if (!hbits)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4137 html->cursor_hb = (GtkHtmlBit *) html->html_bits->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4138 else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4139 html->cursor_hb = hb;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4140
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4141 html->cursor_pos = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4142
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4143
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4144 draw_cursor(html);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4145
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4146
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4147 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4148
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4149 static void move_end_of_line(GtkHtml * html)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4150 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4151 GList *hbits = g_list_find(html->html_bits, html->cursor_hb);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4152 GtkHtmlBit *hb = NULL;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4153 gint y;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4154
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4155 undraw_cursor(html);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4156
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4157 if (!html->html_bits)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4158 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4159
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4160 if (!html->cursor_hb)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4161 html->cursor_hb = (GtkHtmlBit *) html->html_bits->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4162
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4163 y = html->cursor_hb->y;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4164
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4165 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4166 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4167 hb = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4168
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4169 if (y != hb->y)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4170 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4171 hb = (GtkHtmlBit *) hbits->prev->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4172 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4173 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4174
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4175 hbits = hbits->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4176 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4177 if (!hbits)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4178 html->cursor_hb = (GtkHtmlBit *) g_list_last(html->html_bits)->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4179 else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4180 html->cursor_hb = hb;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4181
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4182 html->cursor_pos = strlen(html->cursor_hb->text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4183
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4184
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4185 draw_cursor(html);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4186
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4187
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4188 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4189
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4190
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4191
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4192 static gint gtk_html_key_press(GtkWidget * widget, GdkEventKey * event)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4193 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4194 GtkHtml *html;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4195 gchar key;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4196 gint return_val;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4197
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4198 g_return_val_if_fail(widget != NULL, FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4199 g_return_val_if_fail(GTK_IS_HTML(widget), FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4200 g_return_val_if_fail(event != NULL, FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4201
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4202 return_val = FALSE;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4203
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4204 html = GTK_HTML(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4205
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4206 key = event->keyval;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4207 return_val = TRUE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4208
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4209
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4210 if (html->editable == FALSE)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4211 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4212 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4213 * switch (event->keyval) {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4214 * case GDK_Home:
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4215 * if (event->state & GDK_CONTROL_MASK)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4216 * scroll_int (text, -text->vadj->value);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4217 * else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4218 * return_val = FALSE;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4219 * break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4220 * case GDK_End:
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4221 * if (event->state & GDK_CONTROL_MASK)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4222 * scroll_int (text, +text->vadj->upper);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4223 * else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4224 * return_val = FALSE;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4225 * break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4226 * case GDK_Page_Up: scroll_int (text, -text->vadj->page_increment); break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4227 * case GDK_Page_Down: scroll_int (text, +text->vadj->page_increment); break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4228 * case GDK_Up: scroll_int (text, -KEY_SCROLL_PIXELS); break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4229 * case GDK_Down: scroll_int (text, +KEY_SCROLL_PIXELS); break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4230 * case GDK_Return:
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4231 * if (event->state & GDK_CONTROL_MASK)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4232 * gtk_signal_emit_by_name (GTK_OBJECT (text), "activate");
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4233 * else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4234 * return_val = FALSE;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4235 * break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4236 * default:
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4237 * return_val = FALSE;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4238 * break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4239 * }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4240 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4241 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4242 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4243 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4244
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4245 switch (event->keyval)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4246 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4247 case GDK_Home:
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4248 move_beginning_of_line(html);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4249 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4250 case GDK_End:
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4251 move_end_of_line(html);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4252 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4253 /*
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4254 * case GDK_Page_Up:
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4255 * move_cursor_page_ver (html, -1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4256 * break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4257 * case GDK_Page_Down:
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4258 * move_cursor_page_ver (html, +1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4259 * break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4260 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4261 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4262 * CUA has Ctrl-Up/Ctrl-Down as paragraph up down
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4263 */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4264 case GDK_Up:
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4265 move_cursor_ver(html, -1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4266 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4267 case GDK_Down:
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4268 move_cursor_ver(html, +1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4269 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4270 case GDK_Left:
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4271 move_cursor_hor(html, -1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4272 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4273 case GDK_Right:
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4274 move_cursor_hor(html, +1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4275 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4276 #if 0
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4277 case GDK_BackSpace:
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4278 if (event->state & GDK_CONTROL_MASK)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4279 gtk_text_delete_backward_word(text);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4280 else
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4281 gtk_text_delete_backward_character(text);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4282 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4283 case GDK_Clear:
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4284 gtk_text_delete_line(text);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4285 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4286 case GDK_Insert:
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4287 if (event->state & GDK_SHIFT_MASK)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4288 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4289 extend_selection = FALSE;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4290 gtk_editable_paste_clipboard(editable);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4291 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4292 else if (event->state & GDK_CONTROL_MASK)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4293 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4294 gtk_editable_copy_clipboard(editable);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4295 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4296 else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4297 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4298 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4299 * gtk_toggle_insert(text) -- IMPLEMENT
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4300 */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4301 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4302 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4303 case GDK_Delete:
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4304 if (event->state & GDK_CONTROL_MASK)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4305 gtk_text_delete_forward_word(text);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4306 else if (event->state & GDK_SHIFT_MASK)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4307 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4308 extend_selection = FALSE;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4309 gtk_editable_cut_clipboard(editable);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4310 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4311 else
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4312 gtk_text_delete_forward_character(text);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4313 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4314 case GDK_Tab:
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4315 position = text->point.index;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4316 gtk_editable_insert_text(editable, "\t", 1, &position);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4317 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4318 case GDK_Return:
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4319 if (event->state & GDK_CONTROL_MASK)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4320 gtk_signal_emit_by_name(GTK_OBJECT(text), "activate");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4321 else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4322 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4323 position = text->point.index;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4324 gtk_editable_insert_text(editable, "\n", 1, &position);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4325 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4326 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4327 case GDK_Escape:
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4328 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4329 * Don't insert literally
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4330 */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4331 return_val = FALSE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4332 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4333 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4334 default:
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4335 return_val = FALSE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4336
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4337 #if 0
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4338 if (event->state & GDK_CONTROL_MASK)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4339 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4340 if ((key >= 'A') && (key <= 'Z'))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4341 key -= 'A' - 'a';
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4342
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4343 if ((key >= 'a') && (key <= 'z')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4344 && control_keys[(int) (key - 'a')])
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4345 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4346 (*control_keys[(int) (key - 'a')]) (editable, event->time);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4347 return_val = TRUE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4348 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4349
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4350 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4351 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4352 else if (event->state & GDK_MOD1_MASK)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4353 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4354 if ((key >= 'A') && (key <= 'Z'))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4355 key -= 'A' - 'a';
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4356
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4357 if ((key >= 'a') && (key <= 'z') && alt_keys[(int) (key - 'a')])
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4358 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4359 (*alt_keys[(int) (key - 'a')]) (editable, event->time);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4360 return_val = TRUE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4361 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4362 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4363 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4364 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4365 /*
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4366 * if (event->length > 0) {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4367 * html->cursor_pos++;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4368 * gtk_editable_insert_text (editable, event->string, event->length, &position);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4369 *
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4370 * return_val = TRUE;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4371 * }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4372 * else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4373 * return_val = FALSE;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4374 */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4375 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4376
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4377 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4378
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4379 return return_val;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4380 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4381
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4382 void gtk_html_freeze(GtkHtml * html)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4383 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4384 g_return_if_fail(html != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4385 g_return_if_fail(GTK_IS_HTML(html));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4386
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4387 html->frozen++;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4388 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4389
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4390 void gtk_html_thaw(GtkHtml * html)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4391 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4392 GdkRectangle area;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4393
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4394 g_return_if_fail(html != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4395 g_return_if_fail(GTK_IS_HTML(html));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4396
481
64afc8f41bcb [gaim-migrate @ 491]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 353
diff changeset
4397 gtk_html_append_text(html, NULL, 0);
64afc8f41bcb [gaim-migrate @ 491]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 353
diff changeset
4398
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4399 html->frozen--;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4400
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4401 if (html->frozen < 0)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4402 html->frozen = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4403
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4404 if (html->frozen == 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4405 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4406 if (html->html_area)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4407 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4408 gint width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4409 height;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4410 area.x = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4411 area.y = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4412
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4413 gdk_window_get_size(html->html_area, &width, &height);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4414
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4415 area.width = width;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4416 area.height = height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4417
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4418 expose_html(html, &area, TRUE);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4419 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4420 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4421 }
895
81a8fb0a565f [gaim-migrate @ 905]
Todd Kulesza <fflewddur>
parents: 894
diff changeset
4422
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
4423 static int get_line_height(GtkHtml *html, GtkHtmlBit *start)
948
16776bb2d344 [gaim-migrate @ 958]
Todd Kulesza <fflewddur>
parents: 938
diff changeset
4424 {
1057
d50d3abb9eb7 [gaim-migrate @ 1067]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1004
diff changeset
4425 int height = 1, max_height = 0;
948
16776bb2d344 [gaim-migrate @ 958]
Todd Kulesza <fflewddur>
parents: 938
diff changeset
4426 GList *hbits = html->html_bits;
16776bb2d344 [gaim-migrate @ 958]
Todd Kulesza <fflewddur>
parents: 938
diff changeset
4427 GtkHtmlBit *hbit = start; /* default this in case hbits is NULL */
16776bb2d344 [gaim-migrate @ 958]
Todd Kulesza <fflewddur>
parents: 938
diff changeset
4428
16776bb2d344 [gaim-migrate @ 958]
Todd Kulesza <fflewddur>
parents: 938
diff changeset
4429 hbits = g_list_find(hbits, start);
16776bb2d344 [gaim-migrate @ 958]
Todd Kulesza <fflewddur>
parents: 938
diff changeset
4430
16776bb2d344 [gaim-migrate @ 958]
Todd Kulesza <fflewddur>
parents: 938
diff changeset
4431 while (hbits)
16776bb2d344 [gaim-migrate @ 958]
Todd Kulesza <fflewddur>
parents: 938
diff changeset
4432 {
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
4433 hbit = hbits->data;
948
16776bb2d344 [gaim-migrate @ 958]
Todd Kulesza <fflewddur>
parents: 938
diff changeset
4434 if (hbit->font)
16776bb2d344 [gaim-migrate @ 958]
Todd Kulesza <fflewddur>
parents: 938
diff changeset
4435 height = gdk_text_height(hbit->font, "C", 1);
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
4436
948
16776bb2d344 [gaim-migrate @ 958]
Todd Kulesza <fflewddur>
parents: 938
diff changeset
4437 if (max_height < height)
16776bb2d344 [gaim-migrate @ 958]
Todd Kulesza <fflewddur>
parents: 938
diff changeset
4438 max_height = height;
16776bb2d344 [gaim-migrate @ 958]
Todd Kulesza <fflewddur>
parents: 938
diff changeset
4439 if (hbit->newline)
16776bb2d344 [gaim-migrate @ 958]
Todd Kulesza <fflewddur>
parents: 938
diff changeset
4440 break;
16776bb2d344 [gaim-migrate @ 958]
Todd Kulesza <fflewddur>
parents: 938
diff changeset
4441 hbits = hbits->next;
16776bb2d344 [gaim-migrate @ 958]
Todd Kulesza <fflewddur>
parents: 938
diff changeset
4442 }
16776bb2d344 [gaim-migrate @ 958]
Todd Kulesza <fflewddur>
parents: 938
diff changeset
4443
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
4444 if (max_height == 0)
948
16776bb2d344 [gaim-migrate @ 958]
Todd Kulesza <fflewddur>
parents: 938
diff changeset
4445 max_height = gdk_text_height(hbit->font, "C", 1);
985
056bd26615ea [gaim-migrate @ 995]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 957
diff changeset
4446
948
16776bb2d344 [gaim-migrate @ 958]
Todd Kulesza <fflewddur>
parents: 938
diff changeset
4447 return max_height;
16776bb2d344 [gaim-migrate @ 958]
Todd Kulesza <fflewddur>
parents: 938
diff changeset
4448 }