annotate src/gtkhtml.c @ 250:c5aa7bf99059

[gaim-migrate @ 260] Mostly just touch-ups to the README.gaim file, and a couple FIXME's thrown about in oscar.c committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Mon, 22 May 2000 15:43:11 +0000
parents fe81c8b4951d
children 37a1d222b7f8
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
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
23 #include <stdio.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
24 #include <stdlib.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
25 #include <string.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
26 #include <gtk/gtk.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
27 #include <gdk/gdkprivate.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
28 #include <gdk/gdkx.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
29 #include <gdk/gdkkeysyms.h>
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
30
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
31 #ifndef _WIN32
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
32 #include <X11/Xlib.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
33 #include <X11/Xatom.h>
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
34 #endif
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
35
69
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
36 #include "gaim.h"
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
37 #include "gtkhtml.h"
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
38
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
39 #define MAX_SIZE 7
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
40 #define MIN_HTML_WIDTH_LINES 20
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
41 #define MIN_HTML_HEIGHT_LINES 10
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
42 #define BORDER_WIDTH 2
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
43 #define SCROLL_TIME 100
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
44 #define SCROLL_PIXELS 5
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
45 #define KEY_SCROLL_PIXELS 10
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
46
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
47 int font_sizes[] = { 80, 100, 120, 140, 200, 300, 400 };
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
48
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
49 /*
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
50 GdkFont *fixed_font[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
51 GdkFont *fixed_bold_font[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
52 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
53 GdkFont *fixed_bold_italic_font[] =
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
54 { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
55 GdkFont *prop_font[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
56 GdkFont *prop_bold_font[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
57 GdkFont *prop_italic_font[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
58 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
59 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
60
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
61 GData * font_cache;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
62 static gboolean cache_init = FALSE;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
63
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
64 struct font_state
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
65 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
66 int size;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
67 int owncolor;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
68 int ownbg;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
69 gchar font[1024];
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
70 GdkColor *color;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
71 GdkColor *bgcol;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
72 struct font_state *next;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
73 };
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
74
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
75 struct font_state *push_state(struct font_state *current)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
76 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
77 struct font_state *tmp;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
78 tmp = (struct font_state *) g_new0(struct font_state, 1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
79 tmp->next = current;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
80 tmp->color = current->color;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
81 tmp->bgcol = current->bgcol;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
82 tmp->size = current->size;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
83 tmp->owncolor = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
84 tmp->ownbg = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
85 strcpy( tmp->font, current->font );
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
86 return tmp;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
87 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
88
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
89 enum
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
90 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
91 ARG_0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
92 ARG_HADJUSTMENT,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
93 ARG_VADJUSTMENT,
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
94 };
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 TARGET_STRING,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
100 TARGET_TEXT,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
101 TARGET_COMPOUND_TEXT
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 static void gtk_html_class_init(GtkHtmlClass * klass);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
106 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
107 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
108 static void gtk_html_init(GtkHtml * html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
109 static void gtk_html_destroy(GtkObject * object);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
110 static void gtk_html_finalize(GtkObject * object);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
111 static void gtk_html_realize(GtkWidget * widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
112 static void gtk_html_unrealize(GtkWidget * widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
113 static void gtk_html_style_set(GtkWidget * widget, GtkStyle * previous_style);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
114 static void gtk_html_draw_focus(GtkWidget * widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
115 static void gtk_html_size_request(GtkWidget * widget,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
116 GtkRequisition * requisition);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
117 static void gtk_html_size_allocate(GtkWidget * widget,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
118 GtkAllocation * allocation);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
119 static void gtk_html_adjustment(GtkAdjustment * adjustment, GtkHtml * html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
120 static void gtk_html_disconnect(GtkAdjustment * adjustment, GtkHtml * html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
121 static void gtk_html_add_seperator(GtkHtml * html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
122 static void gtk_html_add_pixmap(GtkHtml * html, GdkPixmap * pm, gint fit);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
123 static void gtk_html_add_text(GtkHtml * html,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
124 GdkFont * font,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
125 GdkColor * fore,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
126 GdkColor * back,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
127 gchar * chars,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
128 gint length,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
129 gint uline, gint strike, gchar * url);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
130 static void gtk_html_draw_bit(GtkHtml * html,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
131 GtkHtmlBit * htmlbit, gint redraw);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
132 static void gtk_html_selection_get(GtkWidget * widget,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
133 GtkSelectionData * selection_data,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
134 guint sel_info, guint32 time);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
135 static gint gtk_html_selection_clear(GtkWidget * widget,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
136 GdkEventSelection * event);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
137 static gint gtk_html_visibility_notify(GtkWidget * widget,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
138 GdkEventVisibility * event);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
139
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
140
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
141 /* Event handlers */
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
142 static void gtk_html_draw(GtkWidget * widget, GdkRectangle * area);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
143 static gint gtk_html_expose(GtkWidget * widget, GdkEventExpose * event);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
144 static gint gtk_html_button_press(GtkWidget * widget, GdkEventButton * event);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
145 static gint gtk_html_button_release(GtkWidget * widget, GdkEventButton * event);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
146 static gint gtk_html_motion_notify(GtkWidget * widget, GdkEventMotion * event);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
147 static gint gtk_html_key_press(GtkWidget * widget, GdkEventKey * event);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
148 static gint gtk_html_leave_notify(GtkWidget * widget, GdkEventCrossing * event);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
149
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
150 static gint gtk_html_tooltip_timeout(gpointer data);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
151
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
152
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
153 static void clear_area(GtkHtml * html, GdkRectangle * area);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
154 static void expose_html(GtkHtml * html, GdkRectangle * area, gboolean cursor);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
155 static void scroll_down(GtkHtml * html, gint diff0);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
156 static void scroll_up(GtkHtml * html, gint diff0);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
157
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
158 static void adjust_adj(GtkHtml * html, GtkAdjustment * adj);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
159 static void resize_html(GtkHtml * html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
160 static gint html_bit_is_onscreen(GtkHtml * html, GtkHtmlBit * hb);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
161 static void draw_cursor(GtkHtml * html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
162 static void undraw_cursor(GtkHtml * html);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
163
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
164 static GtkWidgetClass *parent_class = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
165
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
166 GtkType gtk_html_get_type(void)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
167 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
168 static GtkType html_type = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
169
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
170 if (!html_type)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
171 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
172 static const GtkTypeInfo html_info = {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
173 "GtkHtml",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
174 sizeof(GtkHtml),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
175 sizeof(GtkHtmlClass),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
176 (GtkClassInitFunc) gtk_html_class_init,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
177 (GtkObjectInitFunc) gtk_html_init,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
178 NULL,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
179 NULL,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
180 NULL,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
181 };
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
182 html_type = gtk_type_unique(GTK_TYPE_WIDGET, &html_info);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
183 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
184 return html_type;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
185 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
186
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
187
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
188 static void gtk_html_class_init(GtkHtmlClass * class)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
189 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
190 GtkObjectClass *object_class;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
191 GtkWidgetClass *widget_class;
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 object_class = (GtkObjectClass *) class;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
194 widget_class = (GtkWidgetClass *) class;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
195 parent_class = gtk_type_class(GTK_TYPE_WIDGET);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
196
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
197
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
198 gtk_object_add_arg_type("GtkHtml::hadjustment",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
199 GTK_TYPE_ADJUSTMENT,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
200 GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
201 ARG_HADJUSTMENT);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
202
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
203 gtk_object_add_arg_type("GtkHtml::vadjustment",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
204 GTK_TYPE_ADJUSTMENT,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
205 GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
206 ARG_VADJUSTMENT);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
207
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
208 object_class->set_arg = gtk_html_set_arg;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
209 object_class->get_arg = gtk_html_get_arg;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
210 object_class->destroy = gtk_html_destroy;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
211 object_class->finalize = gtk_html_finalize;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
212
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
213 widget_class->realize = gtk_html_realize;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
214 widget_class->unrealize = gtk_html_unrealize;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
215 widget_class->style_set = gtk_html_style_set;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
216 widget_class->draw_focus = gtk_html_draw_focus;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
217 widget_class->size_request = gtk_html_size_request;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
218 widget_class->size_allocate = gtk_html_size_allocate;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
219 widget_class->draw = gtk_html_draw;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
220 widget_class->expose_event = gtk_html_expose;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
221 widget_class->button_press_event = gtk_html_button_press;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
222 widget_class->button_release_event = gtk_html_button_release;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
223 widget_class->motion_notify_event = gtk_html_motion_notify;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
224 widget_class->leave_notify_event = gtk_html_leave_notify;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
225 widget_class->selection_get = gtk_html_selection_get;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
226 widget_class->selection_clear_event = gtk_html_selection_clear;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
227 widget_class->key_press_event = gtk_html_key_press;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
228 widget_class->visibility_notify_event = gtk_html_visibility_notify;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
229
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
230
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
231 widget_class->set_scroll_adjustments_signal =
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
232 gtk_signal_new("set_scroll_adjustments",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
233 GTK_RUN_LAST,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
234 object_class->type,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
235 GTK_SIGNAL_OFFSET(GtkHtmlClass, set_scroll_adjustments),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
236 gtk_marshal_NONE__POINTER_POINTER,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
237 GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
238 GTK_TYPE_ADJUSTMENT);
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
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
241 class->set_scroll_adjustments = gtk_html_set_adjustments;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
242
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
243 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
244
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
245 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
246 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
247 GtkHtml *html;
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 html = GTK_HTML(object);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
250
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
251 switch (arg_id)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
252 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
253 case ARG_HADJUSTMENT:
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
254 gtk_html_set_adjustments(html, GTK_VALUE_POINTER(*arg), html->vadj);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
255 break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
256 case ARG_VADJUSTMENT:
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
257 gtk_html_set_adjustments(html, html->hadj, GTK_VALUE_POINTER(*arg));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
258 break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
259 default:
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
260 break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
261 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
262 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
263
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
264 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
265 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
266 GtkHtml *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
267
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
268 html = GTK_HTML(object);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
269
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
270 switch (arg_id)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
271 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
272 case ARG_HADJUSTMENT:
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
273 GTK_VALUE_POINTER(*arg) = html->hadj;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
274 break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
275 case ARG_VADJUSTMENT:
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
276 GTK_VALUE_POINTER(*arg) = html->vadj;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
277 break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
278 default:
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
279 arg->type = GTK_TYPE_INVALID;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
280 break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
281 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
282 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
283
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
284 static void gtk_html_init(GtkHtml * html)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
285 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
286 static const GtkTargetEntry targets[] = {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
287 {"STRING", 0, TARGET_STRING},
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
288 {"TEXT", 0, TARGET_TEXT},
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
289 {"COMPOUND_TEXT", 0, TARGET_COMPOUND_TEXT}
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
290 };
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
291
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
292 static const gint n_targets = sizeof(targets) / sizeof(targets[0]);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
293
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
294 GTK_WIDGET_SET_FLAGS(html, GTK_CAN_FOCUS);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
295
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
296 html->html_area = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
297 html->hadj = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
298 html->vadj = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
299 html->current_x = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
300 html->current_y = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
301 html->start_sel = html->end_sel = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
302 html->start_sel_x = html->start_sel_y = -1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
303 html->num_end = html->num_start = -1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
304
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
305 html->html_bits = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
306 html->urls = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
307 html->selected_text = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
308 html->tooltip_hb = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
309 html->tooltip_timer = -1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
310 html->tooltip_window = NULL;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
311 html->cursor_hb = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
312 html->cursor_pos = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
313
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
314 html->pm = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
315
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
316 html->editable = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
317 html->transparent = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
318
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
319 html->frozen = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
320
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
321 gtk_selection_add_targets(GTK_WIDGET(html), GDK_SELECTION_PRIMARY,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
322 targets, n_targets);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
323
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
324
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
325
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
326 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
327
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
328
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
329 GtkWidget *gtk_html_new(GtkAdjustment * hadj, GtkAdjustment * vadj)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
330 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
331 GtkWidget *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
332 if(!cache_init)
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 g_datalist_init(&font_cache);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
335 cache_init = TRUE;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
336 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
337
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
338 if (hadj)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
339 g_return_val_if_fail(GTK_IS_ADJUSTMENT(hadj), NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
340 if (vadj)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
341 g_return_val_if_fail(GTK_IS_ADJUSTMENT(vadj), NULL);
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 html = gtk_widget_new(GTK_TYPE_HTML,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
344 "hadjustment", hadj, "vadjustment", vadj, NULL);
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 return html;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
347 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
348
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
349
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
350 void gtk_html_set_editable(GtkHtml * html, gboolean is_editable)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
351 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
352 g_return_if_fail(html != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
353 g_return_if_fail(GTK_IS_HTML(html));
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
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
356 html->editable = (is_editable != FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
357
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
358 if (is_editable)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
359 draw_cursor(html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
360 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
361 undraw_cursor(html);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
362
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
363 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
364
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
365 void gtk_html_set_transparent(GtkHtml * html, gboolean is_transparent)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
366 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
367 GdkRectangle rect;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
368 gint width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
369 height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
370 GtkWidget *widget;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
371
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
372 g_return_if_fail(html != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
373 g_return_if_fail(GTK_IS_HTML(html));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
374
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
375
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
376 widget = GTK_WIDGET(html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
377 html->transparent = (is_transparent != FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
378
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
379 if (!GTK_WIDGET_REALIZED(widget))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
380 return;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
381
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
382 html->bg_gc = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
383 gdk_window_get_size(widget->window, &width, &height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
384 rect.x = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
385 rect.y = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
386 rect.width = width;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
387 rect.height = height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
388 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
389 rect.height);
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 expose_html(html, &rect, FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
392 gtk_html_draw_focus((GtkWidget *) html);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
393 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
394
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
395
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
396 void gtk_html_set_adjustments(GtkHtml * html,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
397 GtkAdjustment * hadj, GtkAdjustment * vadj)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
398 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
399 g_return_if_fail(html != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
400 g_return_if_fail(GTK_IS_HTML(html));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
401 if (hadj)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
402 g_return_if_fail(GTK_IS_ADJUSTMENT(hadj));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
403 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
404 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
405 if (vadj)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
406 g_return_if_fail(GTK_IS_ADJUSTMENT(vadj));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
407 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
408 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
409
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
410 if (html->hadj && (html->hadj != hadj))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
411 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
412 gtk_signal_disconnect_by_data(GTK_OBJECT(html->hadj), html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
413 gtk_object_unref(GTK_OBJECT(html->hadj));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
414 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
415
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
416 if (html->vadj && (html->vadj != vadj))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
417 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
418 gtk_signal_disconnect_by_data(GTK_OBJECT(html->vadj), html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
419 gtk_object_unref(GTK_OBJECT(html->vadj));
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
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
422 if (html->hadj != 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 html->hadj = hadj;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
425 gtk_object_ref(GTK_OBJECT(html->hadj));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
426 gtk_object_sink(GTK_OBJECT(html->hadj));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
427
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
428 gtk_signal_connect(GTK_OBJECT(html->hadj), "changed",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
429 (GtkSignalFunc) gtk_html_adjustment, html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
430 gtk_signal_connect(GTK_OBJECT(html->hadj), "value_changed",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
431 (GtkSignalFunc) gtk_html_adjustment, html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
432 gtk_signal_connect(GTK_OBJECT(html->hadj), "disconnect",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
433 (GtkSignalFunc) gtk_html_disconnect, html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
434 gtk_html_adjustment(hadj, html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
435 }
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 if (html->vadj != vadj)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
438 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
439 html->vadj = vadj;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
440 gtk_object_ref(GTK_OBJECT(html->vadj));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
441 gtk_object_sink(GTK_OBJECT(html->vadj));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
442
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
443 gtk_signal_connect(GTK_OBJECT(html->vadj), "changed",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
444 (GtkSignalFunc) gtk_html_adjustment, html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
445 gtk_signal_connect(GTK_OBJECT(html->vadj), "value_changed",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
446 (GtkSignalFunc) gtk_html_adjustment, html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
447 gtk_signal_connect(GTK_OBJECT(html->vadj), "disconnect",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
448 (GtkSignalFunc) gtk_html_disconnect, html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
449 gtk_html_adjustment(vadj, html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
450 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
451 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
452
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
453
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
454
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
455 GdkColor *get_color(int colorv, GdkColormap * map)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
456 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
457 GdkColor *color;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
458 #if 0
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
459 fprintf(stdout, "color is %x\n", colorv);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
460 #endif
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
461 color = (GdkColor *) g_new0(GdkColor, 1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
462 color->red = ((colorv & 0xff0000) >> 16) * 256;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
463 color->green = ((colorv & 0xff00) >> 8) * 256;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
464 color->blue = ((colorv & 0xff)) * 256;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
465 #if 0
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
466 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
467 color->blue);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
468 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
469 gdk_color_alloc(map, color);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
470 return color;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
471 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
472
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
473
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
474
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
475
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
476 GdkFont *getfont(char * font, int bold, int italic, int fixed, int size)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
477 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
478 gchar font_name[1024] = "-*-";
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
479 GdkFont * my_font;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
480 if (size > MAX_SIZE)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
481 size = MAX_SIZE;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
482 if (size < 1)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
483 size = 1;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
484 size--;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
485
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
486 if(strlen(font))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
487 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
488 strcat( font_name, font );
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
489 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
490 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
491 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
492 if( fixed )
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
493 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
494 strcat( font_name, "courier" );
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
495 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
496 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
497 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
498 strcat( font_name, "helvetica" );
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
499 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
500 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
501 strcat( font_name, "-" );
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
502
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
503 if(bold)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
504 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
505 strcat( font_name, "bold");
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
506 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
507 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
508 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
509 strcat( font_name, "medium");
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
510 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
511 strcat( font_name, "-" );
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
512 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
513 * here is the deal, some fonts have oblique but not italics
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
514 * other fonts have italics but not oblique
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
515 * so we are going to try both
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
516 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
517 if( italic == 1 )
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
518 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
519 strcat( font_name, "i");
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
520 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
521 else if( italic == 2 )
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
522 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
523 strcat( font_name, "o" );
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
524 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
525 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
526 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
527 strcat( font_name, "r");
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
528 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
529 strcat( font_name, "-*-*-*-");
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
530 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
531 char buff[256];
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
532 sprintf(buff, "%d-*-*-*-*-*-*", font_sizes[size]);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
533 strcat( font_name, buff );
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
534 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
535
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
536 g_strdown(font_name);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
537
79
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 69
diff changeset
538 if( (my_font =
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 69
diff changeset
539 g_datalist_id_get_data(&font_cache,
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 69
diff changeset
540 g_quark_from_string(font_name)) ) )
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
541 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
542 return my_font;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
543 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
544 my_font = gdk_font_load(font_name);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
545 if( !my_font )
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
546 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
547 if( italic == 1 )
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
548 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
549 my_font = getfont(font, bold, 2, fixed, size+1 );
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
550 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
551 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
552 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
553 my_font = getfont("", bold, italic, fixed, size+1 );
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
554 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
555 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
556 g_datalist_id_set_data( &font_cache,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
557 g_quark_from_string(font_name),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
558 my_font );
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
559 return my_font;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
560 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
561
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
562
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
563
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
564
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
565 /* 'Borrowed' from ETerm */
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
566 GdkWindow *get_desktop_window(GtkWidget * widget)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
567 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
568 #ifndef _WIN32
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
569 GdkAtom prop,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
570 type,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
571 prop2;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
572 int format;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
573 gint length;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
574 guchar *data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
575 GtkWidget *w;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
576
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
577 prop = gdk_atom_intern("_XROOTPMAP_ID", 1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
578 prop2 = gdk_atom_intern("_XROOTCOLOR_PIXEL", 1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
579
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
580 if (prop == None && prop2 == None)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
581 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
582 return NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
583 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
584
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
585
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
586
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
587 for (w = widget; w; w = w->parent)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
588 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
589
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
590 if (prop != None)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
591 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
592 gdk_property_get(w->window, prop, AnyPropertyType, 0L, 1L, 0,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
593 &type, &format, &length, &data);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
594 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
595 else if (prop2 != None)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
596 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
597 gdk_property_get(w->window, prop2, AnyPropertyType, 0L, 1L, 0,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
598 &type, &format, &length, &data);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
599 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
600 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
601 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
602 continue;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
603 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
604 if (type != None)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
605 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
606 return (w->window);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
607 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
608 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
609 #endif
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
610 return NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
611
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
612 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
613
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
614
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
615
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
616 GdkPixmap *get_desktop_pixmap(GtkWidget * widget)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
617 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
618 #ifndef _WIN32
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
619 GdkPixmap *p;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
620 GdkAtom prop,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
621 type,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
622 prop2;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
623 int format;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
624 gint length;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
625 guint32 id;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
626 guchar *data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
627
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
628 prop = gdk_atom_intern("_XROOTPMAP_ID", 1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
629 prop2 = gdk_atom_intern("_XROOTCOLOR_PIXEL", 1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
630
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
631
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
632 if (prop == None && prop2 == None)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
633 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
634 return NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
635 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
636
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
637 if (prop != None)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
638 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
639 gdk_property_get(get_desktop_window(widget), prop, AnyPropertyType, 0L,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
640 1L, 0, &type, &format, &length, &data);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
641 if (type == XA_PIXMAP)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
642 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
643 id = data[0];
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
644 id += data[1] << 8;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
645 id += data[2] << 16;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
646 id += data[3] << 24;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
647 p = gdk_pixmap_foreign_new(id);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
648 return p;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
649 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
650 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
651 if (prop2 != None)
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
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
654 /* XGetWindowProperty(Xdisplay, desktop_window, prop2, 0L, 1L, False, AnyPropertyType,
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
655 &type, &format, &length, &after, &data);*/
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
656
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
657 /* if (type == XA_CARDINAL) {*/
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
658 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
659 * D_PIXMAP((" Solid color not yet supported.\n"));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
660 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
661
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
662 /* return NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
663 }*/
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
664 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
665 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
666 * D_PIXMAP(("No suitable attribute found.\n"));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
667 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
668 #endif
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
669 return NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
670 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
671
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
672
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
673 static void clear_focus_area(GtkHtml * html,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
674 gint area_x,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
675 gint area_y, gint area_width, gint area_height)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
676 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
677 GtkWidget *widget = GTK_WIDGET(html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
678 gint x,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
679 y;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
680
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
681 gint ythick = BORDER_WIDTH + widget->style->klass->ythickness;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
682 gint xthick = BORDER_WIDTH + widget->style->klass->xthickness;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
683
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
684 gint width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
685 height;
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 if (html->frozen > 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
688 return;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
689
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
690 if (html->transparent)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
691 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
692 if (html->pm == NULL)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
693 html->pm = get_desktop_pixmap(widget);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
694
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
695 if (html->pm == NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
696 return;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
697
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
698 if (html->bg_gc == NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
699 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
700 GdkGCValues values;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
701
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
702 values.tile = html->pm;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
703 values.fill = GDK_TILED;
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 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
706 GDK_GC_FILL | GDK_GC_TILE);
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 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
709
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
710 gdk_window_get_deskrelative_origin(widget->window, &x, &y);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
711
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
712 gdk_draw_pixmap(widget->window, html->bg_gc, html->pm,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
713 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
714 area_height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
715
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
716
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
717 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
718 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
719 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
720 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
721 &height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
722
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
723 gdk_gc_set_ts_origin(html->bg_gc,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
724 (-html->xoffset + xthick) % width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
725 (-html->yoffset + ythick) % height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
726
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
727 gdk_draw_rectangle(widget->window, html->bg_gc, TRUE,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
728 area_x, area_y, area_width, area_height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
729 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
730 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
731
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
732 static void gtk_html_draw_focus(GtkWidget * widget)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
733 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
734 GtkHtml *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
735 gint width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
736 height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
737 gint x,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
738 y;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
739
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
740 g_return_if_fail(widget != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
741 g_return_if_fail(GTK_IS_HTML(widget));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
742
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
743 html = GTK_HTML(widget);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
744
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
745 if (GTK_WIDGET_DRAWABLE(widget))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
746 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
747 gint ythick = widget->style->klass->ythickness;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
748 gint xthick = widget->style->klass->xthickness;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
749 gint xextra = BORDER_WIDTH;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
750 gint yextra = BORDER_WIDTH;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
751
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
752 x = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
753 y = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
754 width = widget->allocation.width;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
755 height = widget->allocation.height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
756
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
757 if (GTK_WIDGET_HAS_FOCUS(widget))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
758 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
759 x += 1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
760 y += 1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
761 width -= 2;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
762 height -= 2;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
763 xextra -= 1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
764 yextra -= 1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
765
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
766 gtk_paint_focus(widget->style, widget->window,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
767 NULL, widget, "text",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
768 0, 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
769 widget->allocation.width - 1,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
770 widget->allocation.height - 1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
771 }
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 gtk_paint_shadow(widget->style, widget->window,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
774 GTK_STATE_NORMAL, GTK_SHADOW_IN,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
775 NULL, widget, "text", x, y, width, height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
776
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
777 x += xthick;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
778 y += ythick;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
779 width -= 2 * xthick;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
780 height -= 2 * ythick;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
781
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
782
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
783 if (widget->style->bg_pixmap[GTK_STATE_NORMAL] || html->transparent)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
784 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
785 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
786 * top rect
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
787 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
788 clear_focus_area(html, x, y, width, yextra);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
789 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
790 * left rect
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
791 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
792 clear_focus_area(html, x, y + yextra,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
793 xextra, y + height - 2 * yextra);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
794 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
795 * right rect
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
796 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
797 clear_focus_area(html, x + width - xextra, y + yextra,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
798 xextra, height - 2 * ythick);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
799 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
800 * bottom rect
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
801 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
802 clear_focus_area(html, x, x + height - yextra, width, yextra);
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 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
805 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
806
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
807 static void gtk_html_size_request(GtkWidget * widget,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
808 GtkRequisition * requisition)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
809 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
810 gint xthickness;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
811 gint ythickness;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
812 gint char_height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
813 gint char_width;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
814
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
815 g_return_if_fail(widget != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
816 g_return_if_fail(GTK_IS_HTML(widget));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
817 g_return_if_fail(requisition != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
818
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
819 xthickness = widget->style->klass->xthickness + BORDER_WIDTH;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
820 ythickness = widget->style->klass->ythickness + BORDER_WIDTH;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
821
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
822 char_height = MIN_HTML_HEIGHT_LINES * (widget->style->font->ascent +
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
823 widget->style->font->descent);
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 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
826 "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
827 26) / 26);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
828
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
829 requisition->width = char_width + xthickness * 2;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
830 requisition->height = char_height + ythickness * 2;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
831 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
832
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
833 static void gtk_html_size_allocate(GtkWidget * widget,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
834 GtkAllocation * allocation)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
835 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
836 GtkHtml *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
837
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
838 g_return_if_fail(widget != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
839 g_return_if_fail(GTK_IS_HTML(widget));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
840 g_return_if_fail(allocation != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
841
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
842 html = GTK_HTML(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
843
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
844 widget->allocation = *allocation;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
845 if (GTK_WIDGET_REALIZED(widget))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
846 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
847 gdk_window_move_resize(widget->window,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
848 allocation->x, allocation->y,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
849 allocation->width, allocation->height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
850
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
851 gdk_window_move_resize(html->html_area,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
852 widget->style->klass->xthickness + BORDER_WIDTH,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
853 widget->style->klass->ythickness + BORDER_WIDTH,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
854 MAX(1, (gint) widget->allocation.width -
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
855 (gint) (widget->style->klass->xthickness +
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
856 (gint) BORDER_WIDTH) * 2),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
857 MAX(1, (gint) widget->allocation.height -
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
858 (gint) (widget->style->klass->ythickness +
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
859 (gint) BORDER_WIDTH) * 2));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
860
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
861 resize_html(html);
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 }
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 static void gtk_html_draw(GtkWidget * widget, GdkRectangle * area)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
866 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
867 g_return_if_fail(widget != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
868 g_return_if_fail(GTK_IS_HTML(widget));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
869 g_return_if_fail(area != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
870
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
871 if (GTK_WIDGET_DRAWABLE(widget))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
872 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
873 expose_html(GTK_HTML(widget), area, TRUE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
874 gtk_widget_draw_focus(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
875 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
876 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
877
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
878
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
879 static gint gtk_html_expose(GtkWidget * widget, GdkEventExpose * event)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
880 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
881 GtkHtml *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
882
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
883 g_return_val_if_fail(widget != NULL, FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
884 g_return_val_if_fail(GTK_IS_HTML(widget), FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
885 g_return_val_if_fail(event != NULL, FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
886
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
887 html = GTK_HTML(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
888
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
889 if (event->window == html->html_area)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
890 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
891 expose_html(html, &event->area, TRUE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
892 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
893 else if (event->count == 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
894 {
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 return FALSE;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
899
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
900 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
901
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
902
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
903 static gint gtk_html_selection_clear(GtkWidget * widget,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
904 GdkEventSelection * event)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
905 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
906 GtkHtml *html;
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 g_return_val_if_fail(widget != NULL, FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
909 g_return_val_if_fail(GTK_IS_HTML(widget), FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
910 g_return_val_if_fail(event != NULL, FALSE);
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 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
913 * Let the selection handling code know that the selection
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
914 * * has been changed, since we've overriden the default handler
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 if (!gtk_selection_clear(widget, event))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
917 return FALSE;
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 html = GTK_HTML(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
920
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
921 if (event->selection == GDK_SELECTION_PRIMARY)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
922 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
923 if (html->selected_text)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
924 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
925 GList *hbits = html->html_bits;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
926 GtkHtmlBit *hb;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
927
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
928 g_free(html->selected_text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
929 html->selected_text = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
930 html->start_sel = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
931 html->end_sel = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
932 html->num_start = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
933 html->num_end = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
934 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
935 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
936 hb = (GtkHtmlBit *) hbits->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
937 if (hb->was_selected)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
938 gtk_html_draw_bit(html, hb, 1);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
939 hbits = hbits->prev;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
940 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
941 hbits = g_list_last(html->html_bits);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
942 }
12
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
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
945 return TRUE;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
946 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
947
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
948
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
949
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
950 static void gtk_html_selection_get(GtkWidget * widget,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
951 GtkSelectionData * selection_data,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
952 guint sel_info, guint32 time)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
953 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
954 gchar *str;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
955 gint len;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
956 GtkHtml *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
957
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
958 g_return_if_fail(widget != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
959 g_return_if_fail(GTK_IS_HTML(widget));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
960
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
961 html = GTK_HTML(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
962
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
963
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
964 if (selection_data->selection != GDK_SELECTION_PRIMARY)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
965 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
966
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
967 str = html->selected_text;
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 if (!str)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
970 return;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
971
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
972 len = strlen(str);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
973
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
974 if (sel_info == TARGET_STRING)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
975 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
976 gtk_selection_data_set(selection_data,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
977 GDK_SELECTION_TYPE_STRING,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
978 8 * sizeof(gchar), (guchar *) str, len);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
979 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
980 else if ((sel_info == TARGET_TEXT) || (sel_info == TARGET_COMPOUND_TEXT))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
981 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
982 guchar *text;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
983 GdkAtom encoding;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
984 gint format;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
985 gint new_length;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
986
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
987 gdk_string_to_compound_text(str, &encoding, &format, &text,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
988 &new_length);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
989 gtk_selection_data_set(selection_data, encoding, format, text,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
990 new_length);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
991 gdk_free_compound_text(text);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
992 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
993
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
994
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
995
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
996 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
997
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
998 static void do_select(GtkHtml * html, int x, int y)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
999 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1000 GList *hbits = g_list_last(html->html_bits);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1001 int epos,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1002 spos;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1003 GtkHtmlBit *hb;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1004
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1005 if (!hbits)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1006 return;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1007
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1008 hb = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1009
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1010 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1011 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1012 hb = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1013 if (hb->type == HTML_BIT_TEXT)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1014 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1015 hbits = hbits->prev;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1016 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1017
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1018 if (!hb)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1019 return;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1020
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1021
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1022 if (y > hb->y)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1023 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1024 html->num_end = strlen(hb->text) - 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1025 html->end_sel = hb;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1026 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1027 else if (y < 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1028 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1029 html->num_end = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1030 html->end_sel = (GtkHtmlBit *) html->html_bits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1031 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1032 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1033 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1034 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1035 hb = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1036 if ((y < hb->y && y > (hb->y - hb->height)) &&
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1037 (x > hb->x + hb->width))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1038 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1039 if (hb->type != HTML_BIT_TEXT)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1040 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1041 html->num_end = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1042 html->end_sel = hb;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1043 break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1044 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1045
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1046 html->num_end = strlen(hb->text) - 1;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1047 html->end_sel = hb;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1048 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1049 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1050 else if ((x > hb->x && x < (hb->x + hb->width)) &&
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1051 (y < hb->y && y > (hb->y - hb->height)))
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 int i,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1054 len;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1055 int w = x - hb->x;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1056
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1057 if (hb->type != HTML_BIT_TEXT)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1058 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1059 html->num_end = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1060 html->end_sel = hb;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1061 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1062 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1063
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1064 len = strlen(hb->text);
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 for (i = 1; i <= len; i++)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1067 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1068 if (gdk_text_measure(hb->font, hb->text, i) > w)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1069 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1070 html->num_end = i - 1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1071 html->end_sel = hb;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1072 break;
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 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1075 break;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1076 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1077 hbits = hbits->prev;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1078 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1079
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1080 if (html->end_sel == NULL)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1081 return;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1082 if (html->start_sel == NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1083 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1084 html->start_sel = html->end_sel;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1085 html->num_start = html->num_end;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1086 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1087
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1088 epos = g_list_index(html->html_bits, html->end_sel);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1089 spos = g_list_index(html->html_bits, html->start_sel);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1090 g_free(html->selected_text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1091 html->selected_text = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1092
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1093 if (epos == spos)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1094 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1095 char *str;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1096 if (html->start_sel->type != HTML_BIT_TEXT)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1097 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1098 html->selected_text = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1099 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1100 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1101 if (html->num_end == html->num_start)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1102 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1103 str = g_malloc(2);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1104 if (strlen(html->start_sel->text))
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1105 str[0] = html->start_sel->text[html->num_end];
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1106 else
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1107 str[0] = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1108 str[1] = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1109 gtk_html_draw_bit(html, html->start_sel, 0);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1110 html->selected_text = str;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1111 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1112 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1113 {
79
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 69
diff changeset
1114 size_t st,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1115 en;
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->num_end > html->num_start)
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 en = html->num_end;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1120 st = html->num_start;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1121 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1122 else
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 en = html->num_start;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1125 st = html->num_end;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1126 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1127
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1128 str = g_malloc(en - st + 2);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1129 strncpy(str, html->start_sel->text + st, (en - st + 1));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1130 str[en - st + 1] = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1131 gtk_html_draw_bit(html, html->start_sel, 0);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1132 html->selected_text = str;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1133
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1134 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1135 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1136 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1137 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1138 GtkHtmlBit *shb,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1139 *ehb;
79
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 69
diff changeset
1140 size_t en,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1141 st;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1142 int len,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1143 nlen;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1144 char *str;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1145 if (epos > spos)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1146 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1147 shb = html->start_sel;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1148 ehb = html->end_sel;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1149 en = html->num_end;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1150 st = html->num_start;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1151 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1152 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1153 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1154 shb = html->end_sel;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1155 ehb = html->start_sel;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1156 en = html->num_start;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1157 st = html->num_end;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1158 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1159
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1160 hbits = g_list_find(html->html_bits, shb);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1161
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1162 if (!hbits)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1163 return;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1164
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1165 if (shb->type == HTML_BIT_TEXT)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1166 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1167 len = strlen(shb->text) - st + 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1168 str = g_malloc(len);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1169 strcpy(str, shb->text + st);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1170 str[len - 1] = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1171 gtk_html_draw_bit(html, shb, 0);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1172 if (shb->newline)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1173 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1174 len += 1;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1175 str = g_realloc(str, len);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1176 str[len - 2] = '\n';
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1177 str[len - 1] = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1178 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1179 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1180 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1181 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1182 len = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1183 str = g_malloc(1);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1184 str[0] = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1185 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1186 if (hbits->next == NULL)
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 html->selected_text = str;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1189 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1190 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1191
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1192
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1193 hbits = hbits->next;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1194 while (1)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1195 { /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1196 * Yah I know is dangerous :P
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1197 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1198 hb = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1199 if (hb->type != HTML_BIT_TEXT)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1200 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1201 if (hb == ehb)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1202 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1203 hbits = hbits->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1204 continue;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1205 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1206 if (hb != ehb)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1207 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1208 nlen = len + strlen(hb->text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1209 str = g_realloc(str, nlen);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1210 strcpy(str + (len - 1), hb->text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1211 len = nlen;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1212 str[len - 1] = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1213 gtk_html_draw_bit(html, hb, 0);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1214 if (hb->newline)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1215 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1216 len += 1;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1217 str = g_realloc(str, len);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1218 str[len - 2] = '\n';
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1219 str[len - 1] = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1220 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1221 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1222 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1223 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1224 nlen = len + en + 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1225 str = g_realloc(str, nlen);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1226 strncpy(str + (len - 1), hb->text, en + 1);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1227 len = nlen;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1228 str[len - 1] = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1229
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1230 gtk_html_draw_bit(html, hb, 0);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1231 if (hb->newline && en == strlen(hb->text))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1232 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1233 len += 1;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1234 str = g_realloc(str, len);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1235 str[len - 2] = '\n';
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1236 str[len - 1] = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1237 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1238 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1239 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1240 hbits = hbits->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1241 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1242 html->selected_text = str;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1243 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1244
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1245 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1246
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1247 static gint scroll_timeout(GtkHtml * html)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1248 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1249 GdkEventMotion event;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1250 gint x,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1251 y;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1252 GdkModifierType mask;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1253
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1254 html->timer = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1255 gdk_window_get_pointer(html->html_area, &x, &y, &mask);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1256
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1257 if (mask & GDK_BUTTON1_MASK)
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 event.is_hint = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1260 event.x = x;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1261 event.y = y;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1262 event.state = mask;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1263
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1264 gtk_html_motion_notify(GTK_WIDGET(html), &event);
1
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 return FALSE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1268
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1269 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1270
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1271
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1272 static gint gtk_html_tooltip_paint_window(GtkHtml * html)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1273 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1274 GtkStyle *style;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1275 gint y,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1276 baseline_skip,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1277 gap;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1278
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1279 style = html->tooltip_window->style;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1280
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1281 gap = (style->font->ascent + style->font->descent) / 4;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1282 if (gap < 2)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1283 gap = 2;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1284 baseline_skip = style->font->ascent + style->font->descent + gap;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1285
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1286 if (!html->tooltip_hb)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1287 return FALSE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1288
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1289 gtk_paint_flat_box(style, html->tooltip_window->window,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1290 GTK_STATE_NORMAL, GTK_SHADOW_OUT,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1291 NULL, GTK_WIDGET(html->tooltip_window), "tooltip",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1292 0, 0, -1, -1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1293
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1294 y = style->font->ascent + 4;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1295
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1296 gtk_paint_string(style, html->tooltip_window->window,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1297 GTK_STATE_NORMAL,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1298 NULL, GTK_WIDGET(html->tooltip_window), "tooltip",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1299 4, y, "HTML Link:");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1300 y += baseline_skip;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1301 gtk_paint_string(style, html->tooltip_window->window,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1302 GTK_STATE_NORMAL,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1303 NULL, GTK_WIDGET(html->tooltip_window), "tooltip",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1304 4, y, html->tooltip_hb->url);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1305
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1306 return FALSE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1307
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1308
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
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1311 static gint gtk_html_tooltip_timeout(gpointer data)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1312 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1313 GtkHtml *html = (GtkHtml *) data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1314
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1315
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1316 GDK_THREADS_ENTER();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1317
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1318 if (html->tooltip_hb && GTK_WIDGET_DRAWABLE(GTK_WIDGET(html)))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1319 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1320 GtkWidget *widget;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1321 GtkStyle *style;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1322 gint gap,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1323 x,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1324 y,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1325 w,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1326 h,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1327 scr_w,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1328 scr_h,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1329 baseline_skip;
1
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 if (html->tooltip_window)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1332 gtk_widget_destroy(html->tooltip_window);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1333
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1334 html->tooltip_window = gtk_window_new(GTK_WINDOW_POPUP);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1335 gtk_widget_set_app_paintable(html->tooltip_window, TRUE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1336 gtk_window_set_policy(GTK_WINDOW(html->tooltip_window), FALSE, FALSE,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1337 TRUE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1338 gtk_widget_set_name(html->tooltip_window, "gtk-tooltips");
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1339 gtk_signal_connect_object(GTK_OBJECT(html->tooltip_window),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1340 "expose_event",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1341 GTK_SIGNAL_FUNC
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1342 (gtk_html_tooltip_paint_window),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1343 GTK_OBJECT(html));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1344 gtk_signal_connect_object(GTK_OBJECT(html->tooltip_window), "draw",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1345 GTK_SIGNAL_FUNC
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1346 (gtk_html_tooltip_paint_window),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1347 GTK_OBJECT(html));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1348
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1349 gtk_widget_ensure_style(html->tooltip_window);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1350 style = html->tooltip_window->style;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1351
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1352 widget = GTK_WIDGET(html);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1353
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1354 scr_w = gdk_screen_width();
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1355 scr_h = gdk_screen_height();
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1356
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1357 gap = (style->font->ascent + style->font->descent) / 4;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1358 if (gap < 2)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1359 gap = 2;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1360 baseline_skip = style->font->ascent + style->font->descent + gap;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1361
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1362 w = 8 + MAX(gdk_string_width(style->font, "HTML Link:"),
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1363 gdk_string_width(style->font, html->tooltip_hb->url));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1364 ;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1365 h = 8 - gap;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1366 h += (baseline_skip * 2);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1367
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1368 gdk_window_get_pointer(NULL, &x, &y, NULL);
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 * gdk_window_get_origin (widget->window, NULL, &y);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1371 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1372 if (GTK_WIDGET_NO_WINDOW(widget))
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1373 y += widget->allocation.y;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1374
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1375 x -= ((w >> 1) + 4);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1376
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1377 if ((x + w) > scr_w)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1378 x -= (x + w) - scr_w;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1379 else if (x < 0)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1380 x = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1381
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1382 if ((y + h + 4) > scr_h)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1383 y =
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1384 y - html->tooltip_hb->font->ascent +
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1385 html->tooltip_hb->font->descent;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1386 else
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1387 y =
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1388 y + html->tooltip_hb->font->ascent +
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1389 html->tooltip_hb->font->descent;
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 gtk_widget_set_usize(html->tooltip_window, w, h);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1392 gtk_widget_popup(html->tooltip_window, x, y);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1393
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1394 }
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 html->tooltip_timer = -1;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1397
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1398 GDK_THREADS_LEAVE();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1399
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1400 return FALSE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1401 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1402
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1403
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1404 static gint gtk_html_leave_notify(GtkWidget * widget, GdkEventCrossing * event)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1405 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1406 GtkHtml *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1407
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1408 html = GTK_HTML(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1409
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1410 if (html->tooltip_timer != -1)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1411 gtk_timeout_remove(html->tooltip_timer);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1412 if (html->tooltip_window)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1413 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1414 gtk_widget_destroy(html->tooltip_window);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1415 html->tooltip_window = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1416 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1417
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 html->tooltip_hb = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1420 return TRUE;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1421 }
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
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1424 static gint gtk_html_motion_notify(GtkWidget * widget, GdkEventMotion * event)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1425 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1426 int x,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1427 y;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1428 gint width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1429 height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1430 GdkModifierType state;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1431 int realx,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1432 realy;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1433 GtkHtml *html = GTK_HTML(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1434
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1435 if (event->is_hint)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1436 gdk_window_get_pointer(event->window, &x, &y, &state);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1437 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1438 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1439 x = event->x;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1440 y = event->y;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1441 state = event->state;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1442 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1443
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1444 gdk_window_get_size(html->html_area, &width, &height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1445
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1446 realx = x;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1447 realy = y + html->yoffset;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1448
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1449
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1450 if (state & GDK_BUTTON1_MASK)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1451 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1452 if (realx != html->start_sel_x || realy != html->start_sel_y)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1453 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1454 char *tmp = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1455
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1456 if (y < 0 || y > height)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1457 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1458 int diff;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1459 if (html->timer == 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1460 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1461 html->timer = gtk_timeout_add(100,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1462 (GtkFunction) scroll_timeout,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1463 html);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1464 if (y < 0)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1465 diff = y / 2;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1466 else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1467 diff = (y - height) / 2;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1468
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1469 if (html->vadj->value + diff >
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1470 html->vadj->upper - height + 20)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1471 gtk_adjustment_set_value(html->vadj,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1472 html->vadj->upper - height +
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1473 20);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1474 else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1475 gtk_adjustment_set_value(html->vadj,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1476 html->vadj->value + diff);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1477
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1478 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1479 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1480
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1481 if (html->selected_text != NULL)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1482 tmp = g_strdup(html->selected_text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1483 do_select(html, realx, realy);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1484 if (tmp)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1485 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1486 if (!html->selected_text || strcmp(tmp, html->selected_text))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1487 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1488 GtkHtmlBit *hb;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1489 GList *hbits = html->html_bits;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1490 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1491 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1492 hb = (GtkHtmlBit *) hbits->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1493 if (hb->was_selected)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1494 gtk_html_draw_bit(html, hb, 0);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1495 hbits = hbits->next;
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 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1498 g_free(tmp);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1499 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1500 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1501 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1502 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1503 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1504 GtkHtmlBit *hb;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1505 GList *urls;
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 urls = html->urls;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1508 while (urls)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1509 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1510 hb = (GtkHtmlBit *) urls->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1511 if ((realx > hb->x && realx < (hb->x + hb->width)) &&
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1512 (realy < hb->y && realy > (hb->y - hb->height)))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1513 {
26
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
1514 GdkCursor *cursor = NULL;
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
1515
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1516 if (html->tooltip_hb != hb)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1517 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1518 html->tooltip_hb = hb;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1519 if (html->tooltip_timer != -1)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1520 gtk_timeout_remove(html->tooltip_timer);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1521 if (html->tooltip_window)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1522 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1523 gtk_widget_destroy(html->tooltip_window);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1524 html->tooltip_window = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1525 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1526 html->tooltip_timer =
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1527 gtk_timeout_add(HTML_TOOLTIP_DELAY,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1528 gtk_html_tooltip_timeout, html);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1529 }
26
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
1530
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
1531 cursor = gdk_cursor_new(GDK_HAND2);
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
1532 gdk_window_set_cursor(html->html_area, cursor);
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
1533 gdk_cursor_destroy(cursor);
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
1534
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1535 return TRUE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1536 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1537 urls = urls->next;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1538 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1539 if (html->tooltip_timer != -1)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1540 gtk_timeout_remove(html->tooltip_timer);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1541 if (html->tooltip_window)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1542 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1543 gtk_widget_destroy(html->tooltip_window);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1544 html->tooltip_window = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1545 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1546
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1547
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1548 html->tooltip_hb = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1549 gdk_window_set_cursor(html->html_area, NULL);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1550
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1551
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1552 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1553
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1554 return TRUE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1555 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1556
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1557 static gint gtk_html_button_release(GtkWidget * widget, GdkEventButton * event)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1558 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1559 GtkHtml *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1560
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1561 html = GTK_HTML(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1562
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1563 if (html->frozen > 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1564 return TRUE;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1565
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1566 if (event->button == 1)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1567 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1568 int realx,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1569 realy;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1570 GtkHtmlBit *hb;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1571 GList *urls = html->urls;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1572
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1573 realx = event->x;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1574 realy = event->y + html->yoffset;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1575 if (realx != html->start_sel_x || realy != html->start_sel_y)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1576 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1577 if (gtk_selection_owner_set(widget,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1578 GDK_SELECTION_PRIMARY, event->time))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1579 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1580 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1581 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1582 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1583 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1584 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1585 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1586 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1587 if (gdk_selection_owner_get(GDK_SELECTION_PRIMARY) ==
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1588 widget->window)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1589 gtk_selection_owner_set(NULL, GDK_SELECTION_PRIMARY,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1590 event->time);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1591
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1592
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1593 while (urls)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1594 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1595 void open_url_nw(GtkWidget * w, char *url);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1596 hb = (GtkHtmlBit *) urls->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1597 if ((realx > hb->x && realx < (hb->x + hb->width)) &&
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1598 (realy < hb->y && realy > (hb->y - hb->height)))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1599 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1600 open_url_nw(NULL, hb->url);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1601 // else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1602 // open_url(NULL, hb->url);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1603 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1604 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1605 urls = urls->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1606 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1607 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1608 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1609 return TRUE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1610 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1611
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1612
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1613
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1614 static gint gtk_html_button_press(GtkWidget * widget, GdkEventButton * event)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1615 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1616 GtkHtml *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1617 gfloat value;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1618
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 html = GTK_HTML(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1621 value = html->vadj->value;
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 if (html->frozen > 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1624 return TRUE;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1625
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1626 if (event->button == 4)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1627 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1628 value -= html->vadj->step_increment;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1629 if (value < html->vadj->lower)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1630 value = html->vadj->lower;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1631 gtk_adjustment_set_value(html->vadj, value);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1632 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1633 else if (event->button == 5)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1634 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1635 value += html->vadj->step_increment;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1636 if (value > html->vadj->upper)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1637 value = html->vadj->upper;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1638 gtk_adjustment_set_value(html->vadj, value);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1639
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1640 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1641 else if (event->button == 1)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1642 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1643 GList *hbits = g_list_last(html->html_bits);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1644 int realx,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1645 realy;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1646 GtkHtmlBit *hb;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1647
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1648 realx = event->x;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1649 realy = event->y + html->yoffset;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1650
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1651 html->start_sel_x = realx;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1652 html->start_sel_y = realy;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1653
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1654 if (!hbits)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1655 return TRUE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1656
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1657 if (html->selected_text)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1658 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1659 g_free(html->selected_text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1660 html->selected_text = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1661 html->start_sel = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1662 html->end_sel = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1663 html->num_start = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1664 html->num_end = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1665 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1666 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1667 hb = (GtkHtmlBit *) hbits->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1668 if (hb->was_selected)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1669 gtk_html_draw_bit(html, hb, 1);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1670 hbits = hbits->prev;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1671 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1672 hbits = g_list_last(html->html_bits);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1673 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1674
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1675 hb = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1676 if (realy > hb->y)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1677 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1678 if (hb->text)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1679 html->num_start = strlen(hb->text) - 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1680 else
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1681 html->num_start = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1682 html->start_sel = hb;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1683 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1684 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1685 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1686 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1687 hb = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1688 if ((realy < hb->y && realy > (hb->y - hb->height)) &&
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1689 (realx > hb->x + hb->width))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1690 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1691 if (hb->type != HTML_BIT_TEXT)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1692 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1693 html->num_end = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1694 html->end_sel = hb;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1695 break;
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
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1698 if (hb->text)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1699 html->num_start = strlen(hb->text) - 1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1700 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1701 html->num_start = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1702
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1703 html->start_sel = hb;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1704 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1705 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1706 else if ((realx > hb->x && realx < (hb->x + hb->width)) &&
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1707 (realy < hb->y && realy > (hb->y - hb->height)))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1708 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1709 int i,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1710 len;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1711 int w = realx - hb->x;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1712
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1713 if (hb->type != HTML_BIT_TEXT)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1714 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1715 html->num_end = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1716 html->end_sel = hb;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1717 break;
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
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1720 if (hb->text)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1721 len = strlen(hb->text);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1722 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1723 len = 0;
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 for (i = 1; i <= len; i++)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1726 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1727 if (gdk_text_measure(hb->font, hb->text, i) > w)
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 html->num_start = i - 1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1730 html->start_sel = hb;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1731 break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1732 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1733 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1734 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1735 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1736 hbits = hbits->prev;
1
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 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1739 else if (event->button == 3 && event->type == GDK_BUTTON_PRESS)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1740 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1741 GtkHtmlBit *hb = NULL;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1742 int realx,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1743 realy;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1744 GList *urls;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1745
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1746 realx = event->x;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1747 realy = event->y + html->yoffset;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1748
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1749 urls = html->urls;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1750 while (urls)
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 hb = (GtkHtmlBit *) urls->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1753 if ((realx > hb->x && realx < (hb->x + hb->width)) &&
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1754 (realy < hb->y && realy > (hb->y - hb->height)))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1755 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1756 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1757 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1758 urls = urls->next;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1759 hb = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1760 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1761
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1762 if (hb != NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1763 {
69
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1764
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1765 GtkWidget *menu, *button;
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1766
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1767 menu = gtk_menu_new();
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1768
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1769 if (web_browser == BROWSER_NETSCAPE) {
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1770
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1771 button = gtk_menu_item_new_with_label("Open URL in existing window");
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1772 gtk_signal_connect(GTK_OBJECT(button), "activate",
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1773 GTK_SIGNAL_FUNC(open_url), hb->url);
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1774 gtk_menu_append(GTK_MENU(menu), button);
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1775 gtk_widget_show(button);
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1776
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1777 }
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1778
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1779
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1780 button = gtk_menu_item_new_with_label("Open URL in new window");
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1781 gtk_signal_connect(GTK_OBJECT(button), "activate",
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1782 GTK_SIGNAL_FUNC(open_url_nw), hb->url);
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1783 gtk_menu_append(GTK_MENU(menu), button);
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1784 gtk_widget_show(button);
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1785
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1786 if (web_browser == BROWSER_NETSCAPE) {
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1787
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1788 button = gtk_menu_item_new_with_label("Add URL as bookmark");
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1789 gtk_signal_connect(GTK_OBJECT(button), "activate",
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1790 GTK_SIGNAL_FUNC(add_bookmark), hb->url);
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1791 gtk_menu_append(GTK_MENU(menu), button);
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1792 gtk_widget_show(button);
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1793
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1794 }
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1795
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1796 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1797 event->button, event->time);
3b479e2700c9 [gaim-migrate @ 79]
Rob Flynn <gaim@robflynn.com>
parents: 53
diff changeset
1798
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1799 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1800 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1801
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1802 return TRUE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1803 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1804
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1805
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1806 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
1807 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1808 int mypos,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1809 epos,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1810 spos;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1811 GdkGC *gc = html->gc;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1812 int shift;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1813 GtkStateType selected_state;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1814 GtkWidget *widget = GTK_WIDGET(html);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1815 GdkRectangle area;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1816
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1817 if (html->frozen > 0)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1818 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1819
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1820 if (hb->type == HTML_BIT_TEXT)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1821 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1822
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1823 if (!strlen(hb->text))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1824 return;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1825
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1826 mypos = g_list_index(html->html_bits, hb);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1827 epos = g_list_index(html->html_bits, html->end_sel);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1828 spos = g_list_index(html->html_bits, html->start_sel);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1829
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1830 if (((html->end_sel == NULL) || (html->start_sel == NULL)) ||
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1831 ((epos < mypos) && (spos < mypos)) ||
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1832 ((epos > mypos) && (spos > mypos)))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1833 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1834 selected_state = GTK_STATE_NORMAL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1835 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1836 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1837 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1838 selected_state = GTK_STATE_SELECTED;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1839 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1840
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1841
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1842 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
1843
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1844 if (selected_state == GTK_STATE_SELECTED)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1845 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1846 int schar = 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1847 echar = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1848 int startx = 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1849 xwidth = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1850
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1851 if (epos > spos ||
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1852 (epos == spos && html->num_end >= html->num_start))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1853 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1854 if (mypos == epos)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1855 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1856 echar = html->num_end;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1857 xwidth =
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1858 gdk_text_width(hb->font, hb->text, html->num_end + 1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1859 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1860 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1861 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1862 echar = strlen(hb->text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1863 xwidth = hb->width;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1864 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1865 if (mypos == spos)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1866 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1867 schar = html->num_start;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1868 startx =
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1869 gdk_text_width(hb->font, hb->text, html->num_start);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1870 xwidth -= startx;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1871 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1872 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1873 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1874 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1875 if (mypos == spos)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1876 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1877 echar = html->num_start;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1878 xwidth =
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1879 gdk_text_width(hb->font, hb->text,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1880 html->num_start + 1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1881 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1882 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1883 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1884 echar = strlen(hb->text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1885 xwidth = hb->width;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1886 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1887 if (mypos == epos)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1888 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1889 schar = html->num_end;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1890 startx =
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1891 gdk_text_width(hb->font, hb->text, html->num_end);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1892 xwidth -= startx;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1893 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1894 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1895
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1896 if (!redraw && echar == hb->sel_e && schar == hb->sel_s)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1897 return;
12
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 hb->sel_e = echar;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1900 hb->sel_s = schar;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1901
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1902 startx += hb->x;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1903
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1904
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1905 area.x = hb->x - html->xoffset;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1906 area.y = hb->y - hb->height + 3 - html->yoffset;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1907 area.width = hb->width + 2;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1908 area.height = hb->height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1909 clear_area(html, &area);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1910
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1911 gtk_paint_flat_box(widget->style, html->html_area,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1912 selected_state, GTK_SHADOW_NONE,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1913 NULL, widget, "text",
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1914 startx,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1915 hb->y - hb->height + 3 - html->yoffset,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1916 xwidth + 2, hb->height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1917 hb->was_selected = 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 if (hb->was_selected)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1920 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1921 area.x = hb->x - html->xoffset;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1922 area.y = hb->y - hb->height + 3 - html->yoffset;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1923 area.width = hb->width + 2;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1924 area.height = hb->height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1925 clear_area(html, &area);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1926
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1927 hb->sel_e = -1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1928 hb->sel_s = -1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1929
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1930 hb->was_selected = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1931 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1932
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1933
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1934
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1935
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1936 if (selected_state == GTK_STATE_SELECTED && (mypos == epos
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1937 || mypos == spos))
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 char *s = hb->text;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1940 int num = 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1941 width = 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1942 fsel = 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1943 esel = strlen(hb->text);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1944 int lbearing,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1945 rbearing,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1946 w;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1947
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1948 if (epos > spos ||
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1949 (epos == spos && html->num_end >= html->num_start))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1950 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1951 if (mypos == epos)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1952 esel = html->num_end;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1953 if (mypos == spos)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1954 fsel = html->num_start;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1955 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1956 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1957 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1958 if (mypos == spos)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1959 esel = html->num_start;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1960 if (mypos == epos)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1961 fsel = html->num_end;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1962 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1963
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1964 while (*s)
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
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1967 if (num < fsel || num > esel)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1968 selected_state = GTK_STATE_NORMAL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1969 else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1970 selected_state = GTK_STATE_SELECTED;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1971 if (hb->fore != NULL)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1972 gdk_gc_set_foreground(gc, hb->fore);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1973 else
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1974 gdk_gc_set_foreground(gc,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1975 &widget->style->fg[selected_state]);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1976 if (hb->back != NULL)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1977 gdk_gc_set_background(gc, hb->back);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1978 else
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1979 gdk_gc_set_background(gc,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1980 &widget->style->bg[selected_state]);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1981
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1982
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1983 gdk_gc_set_font(gc, hb->font);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1984
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1985 gdk_text_extents(hb->font, s, 1, &lbearing, &rbearing, &w, NULL,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1986 NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1987
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1988 gdk_draw_text(html->html_area, hb->font, gc,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1989 shift + hb->x + width, hb->y - html->yoffset, s,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1990 1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1991
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1992 if (hb->uline)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1993 gdk_draw_line(html->html_area, gc, shift + hb->x + width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1994 hb->y - html->yoffset,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1995 shift + hb->x + width + w,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1996 hb->y - html->yoffset);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1997
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1998 if (hb->strike)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1999 gdk_draw_line(html->html_area, gc, shift + hb->x + width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2000 hb->y - html->yoffset - (hb->height / 3),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2001 shift + hb->x + width + w,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2002 hb->y - html->yoffset - (hb->height / 3));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2003
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2004 width += w;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2005
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2006 s++;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2007 num++;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2008 }
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
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2011 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2012 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2013 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2014 /*my stuff here*/
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2015
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2016 if(!hb->was_selected)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2017 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2018 area.x = hb->x - html->xoffset;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2019 area.y = hb->y - hb->height + 3 - html->yoffset;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2020 area.width = hb->width + 2;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2021 area.height = hb->height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2022 clear_area(html, &area);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2023 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2024
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2025 /*end my stuff*/
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2026
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2027
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2028 if (hb->fore != NULL)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2029 gdk_gc_set_foreground(gc, hb->fore);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2030 else
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2031 gdk_gc_set_foreground(gc, &widget->style->fg[selected_state]);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2032 if (hb->back != NULL)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2033 gdk_gc_set_background(gc, hb->back);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2034 else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2035 gdk_gc_set_background(gc, &widget->style->bg[selected_state]);
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
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2038 gdk_gc_set_font(gc, hb->font);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2039
12
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 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
2042 hb->y - html->yoffset, hb->text);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2043 if (hb->uline)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2044 gdk_draw_line(html->html_area, gc, shift + hb->x,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2045 hb->y - html->yoffset,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2046 hb->x + gdk_string_measure(hb->font, hb->text),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2047 hb->y - html->yoffset);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2048
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2049 if (hb->strike)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2050 gdk_draw_line(html->html_area, gc, shift + hb->x,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2051 hb->y - html->yoffset - (hb->height / 3),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2052 hb->x + gdk_string_measure(hb->font, hb->text),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2053 hb->y - html->yoffset - (hb->height / 3));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2054
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2055 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2056 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2057 else if (hb->type == HTML_BIT_SEP)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2058 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2059
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2060 gdk_draw_line(html->html_area, gc, hb->x + 2,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2061 hb->y - html->yoffset - (hb->height / 2 - 1),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2062 hb->x + hb->width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2063 hb->y - html->yoffset - (hb->height / 2 - 1));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2064
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2065 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2066 else if (hb->type == HTML_BIT_PIXMAP)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2067 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2068 gdk_gc_set_background(gc, &widget->style->base[GTK_STATE_NORMAL]);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2069 gdk_draw_pixmap(html->html_area, gc, hb->pm, 0, 0, hb->x,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2070 hb->y - html->yoffset - (hb->height) + 4, hb->width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2071 hb->height - 2);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2072 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2073 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2074
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2075
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2076
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2077 gint compare_types(GtkHtmlBit * hb, GtkHtmlBit * hb2)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2078 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2079 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2080 * In this function, it's OK to accidently return a
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2081 * * 0, but will cause problems on an accidental 1
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2082 */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2083
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2084 if (!hb || !hb2)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2085 return 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2086
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2087
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2088 if (hb->uline != hb2->uline)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2089 return 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2090 if (hb->strike != hb2->strike)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2091 return 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2092 if (hb->font && hb2->font)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2093 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2094 if (!gdk_font_equal(hb->font, hb2->font))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2095 return 0;
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->font && !hb2->font)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2098 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2099 return 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2100 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2101 else if (!hb->font && hb2->font)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2102 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2103 return 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2104 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2105 if (hb->type != hb2->type)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2106 return 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2107
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2108 if (hb->fore && hb2->fore)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2109 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2110 if (!gdk_color_equal(hb->fore, hb2->fore))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2111 return 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2112 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2113 else if (hb->fore && !hb2->fore)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2114 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2115 return 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2116 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2117 else if (!hb->fore && hb2->fore)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2118 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2119 return 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2120 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2121
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2122 if (hb->back && hb2->back)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2123 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2124 if (!gdk_color_equal(hb->back, hb2->back))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2125 return 0;
12
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 else if (hb->back && !hb2->back)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2128 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2129 return 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2130 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2131 else if (!hb->back && hb2->back)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2132 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2133 return 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2134 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2135
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2136 if ((hb->url != NULL && hb2->url == NULL) ||
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2137 (hb->url == NULL && hb2->url != NULL))
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2138 return 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2139
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2140 if (hb->url != NULL && hb2->url != NULL)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2141 if (strcasecmp(hb->url, hb2->url))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2142 return 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2143
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2144 return 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2145 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2146
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2147 static gint html_bit_is_onscreen(GtkHtml * html, GtkHtmlBit * hb)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2148 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2149 gint width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2150 height;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2151
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2152 gdk_window_get_size(html->html_area, &width, &height);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2153
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2154 if (hb->y < html->yoffset)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2155 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2156 return 0;
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
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2159 if ((hb->y - hb->height) > (html->yoffset + height))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2160 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2161 return 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2162 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2163 return 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2164 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2165
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2166 static void draw_cursor(GtkHtml * html)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2167 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2168 if (html->editable &&
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2169 html->cursor_hb &&
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2170 GTK_WIDGET_DRAWABLE(html) &&
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2171 html_bit_is_onscreen(html, html->cursor_hb))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2172 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2173 gint x,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2174 y;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2175 gint width;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2176
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2177 GdkFont *font = html->cursor_hb->font;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2178
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2179 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
2180 NULL, &width, NULL, NULL);
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 gdk_gc_set_foreground(html->gc,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2183 &GTK_WIDGET(html)->style->text[GTK_STATE_NORMAL]);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2184
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2185 y = html->cursor_hb->y - html->yoffset;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2186 x = html->cursor_hb->x + width;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2187
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2188
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2189 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
2190
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2191 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2192 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2193
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2194 static void undraw_cursor(GtkHtml * html)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2195 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2196 if (html->editable &&
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2197 html->cursor_hb &&
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2198 GTK_WIDGET_DRAWABLE(html) &&
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2199 html_bit_is_onscreen(html, html->cursor_hb))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2200 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2201 gint x,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2202 y;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2203 gint width;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2204 GdkRectangle area;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2205
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2206 GdkFont *font = html->cursor_hb->font;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2207
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2208 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
2209 NULL, &width, NULL, NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2210
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2211 y = html->cursor_hb->y - html->yoffset;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2212 x = html->cursor_hb->x + width;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2213
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2214 area.x = x;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2215 area.y = y - font->ascent;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2216 area.height = font->ascent + 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2217 area.width = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2218
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2219
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2220 clear_area(html, &area);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2221
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2222 gtk_html_draw_bit(html, html->cursor_hb, 1);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2223
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 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2226 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2227
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2228
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2229 static void expose_html(GtkHtml * html, GdkRectangle * area, gboolean cursor)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2230 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2231 GList *hbits;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2232 GtkHtmlBit *hb;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2233 gint width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2234 height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2235 gint realy;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2236
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2237
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2238 if (html->frozen > 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2239 return;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2240
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2241
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2242 hbits = html->html_bits;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2243
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2244 gdk_window_get_size(html->html_area, &width, &height);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2245
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2246 realy = area->y + html->yoffset;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2247
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2248 clear_area(html, area);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2249
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2250 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2251 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2252
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2253 hb = (GtkHtmlBit *) hbits->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2254
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2255 if (html_bit_is_onscreen(html, hb))
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2256 gtk_html_draw_bit(html, hb, 1);
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
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2259 hbits = hbits->next;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2260 }
1
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
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2263 static void resize_html(GtkHtml * html)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2264 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2265 GList *hbits = html->html_bits;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2266 GList *html_bits = html->html_bits;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2267 GtkHtmlBit *hb,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2268 *hb2;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2269 char *str;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2270 gint height;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2271
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2272 if (!hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2273 return;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2274
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2275
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2276 html->html_bits = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2277
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2278 html->current_x = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2279 html->current_y = 0;
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 html->vadj->upper = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2282
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2283 gtk_html_freeze(html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2284
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2285 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2286 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2287 hb = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2288 if (hb->type == HTML_BIT_SEP)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2289 {
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 gtk_html_add_seperator(html);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2292
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2293 g_free(hb);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2294
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2295 hbits = hbits->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2296 continue;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2297 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2298 if (hb->type == HTML_BIT_PIXMAP)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2299 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2300
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2301 gtk_html_add_pixmap(html, hb->pm, hb->fit);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2302
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2303 g_free(hb);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2304
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2305 hbits = hbits->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2306 continue;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2307 }
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 if (hb->newline)
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 int i;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2312
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2313 if (!hb->text)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2314 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2315 hb->text = g_malloc(1);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2316 hb->text[0] = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2317 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2318 for (i = 0; i < hb->newline; i++)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2319 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2320 str = hb->text;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2321 hb->text = g_strconcat(str, "\n", NULL);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2322 g_free(str);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2323 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2324 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2325
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2326 if (hbits->next)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2327 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2328 hb2 = (GtkHtmlBit *) hbits->next->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2329 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2330 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2331 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2332 hb2 = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2333 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2334
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2335
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2336
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2337 if (!hb->newline && compare_types(hb, hb2))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2338 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2339 str = hb2->text;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2340 hb2->text = g_strconcat(hb->text, hb2->text, NULL);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2341 g_free(str);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2342 hb2 = NULL;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2343 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2344 else if (hb->text)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2345 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2346 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
2347 hb->text, strlen(hb->text), hb->uline, hb->strike,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2348 hb->url);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2349 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2350
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2351
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2352
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2353 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2354 * Font stays, so do colors (segfaults if I free)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2355 */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2356 if (hb->fore)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2357 gdk_color_free(hb->fore);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2358 if (hb->back)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2359 gdk_color_free(hb->back);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2360 if (hb->text)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2361 g_free(hb->text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2362 if (hb->url)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2363 g_free(hb->url);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2364
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2365 g_free(hb);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2366
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2367 hbits = hbits->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2368 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2369
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2370 g_list_free(html_bits);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2371
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_thaw(html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2374
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2375 gdk_window_get_size(html->html_area, NULL, &height);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2376 gtk_adjustment_set_value(html->vadj, html->vadj->upper - height);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2377
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2378 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2379
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2380 static GdkGC *create_bg_gc(GtkHtml * html)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2381 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2382 GdkGCValues values;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2383
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2384 values.tile = GTK_WIDGET(html)->style->bg_pixmap[GTK_STATE_NORMAL];
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2385 values.fill = GDK_TILED;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2386
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2387 return gdk_gc_new_with_values(html->html_area, &values,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2388 GDK_GC_FILL | GDK_GC_TILE);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2389 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2390
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2391 static void clear_area(GtkHtml * html, GdkRectangle * area)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2392 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2393 GtkWidget *widget = GTK_WIDGET(html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2394 gint x,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2395 y;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2396
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2397
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2398 if (html->transparent)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2399 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2400 if (html->pm == NULL)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2401 html->pm = get_desktop_pixmap(widget);
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 (html->pm == NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2404 return;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2405
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2406 if (html->bg_gc == NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2407 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2408 GdkGCValues values;
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 values.tile = html->pm;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2411 values.fill = GDK_TILED;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2412
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2413 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
2414 GDK_GC_FILL | GDK_GC_TILE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2415
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2416 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2417
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2418 gdk_window_get_deskrelative_origin(html->html_area, &x, &y);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2419
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2420 gdk_draw_pixmap(html->html_area, html->bg_gc, html->pm,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2421 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
2422 area->height);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2423
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2424 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2425
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2426 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2427 if (html->bg_gc)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2428 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2429
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2430 gint width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2431 height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2432
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2433 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
2434 &height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2435
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2436 gdk_gc_set_ts_origin(html->bg_gc,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2437 (-html->xoffset) % width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2438 (-html->yoffset) % height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2439
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2440 gdk_draw_rectangle(html->html_area, html->bg_gc, TRUE,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2441 area->x, area->y, area->width, area->height);
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 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2444 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
2445 area->height);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2446 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2447
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2448
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2449
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2450
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2451 static void gtk_html_destroy(GtkObject * object)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2452 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2453 GtkHtml *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2454
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2455 g_return_if_fail(object != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2456 g_return_if_fail(GTK_IS_HTML(object));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2457
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2458 html = (GtkHtml *) object;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2459
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2460
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2461 gtk_signal_disconnect_by_data(GTK_OBJECT(html->hadj), html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2462 gtk_signal_disconnect_by_data(GTK_OBJECT(html->vadj), html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2463
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2464 if (html->timer)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2465 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2466 gtk_timeout_remove(html->timer);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2467 html->timer = 0;
1
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 if (html->tooltip_timer)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2471 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2472 gtk_timeout_remove(html->tooltip_timer);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2473 html->tooltip_timer = -1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2474 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2475
12
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 GTK_OBJECT_CLASS(parent_class)->destroy(object);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2478
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 gtk_html_finalize(GtkObject * object)
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 GList *hbits;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2484 GtkHtml *html;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2485 GtkHtmlBit *hb;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2486
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2487
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2488 g_return_if_fail(object != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2489 g_return_if_fail(GTK_IS_HTML(object));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2490
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2491 html = (GtkHtml *) object;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2492
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2493 gtk_object_unref(GTK_OBJECT(html->hadj));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2494 gtk_object_unref(GTK_OBJECT(html->vadj));
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 hbits = html->html_bits;
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 while (hbits)
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 hb = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2501 if (hb->fore)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2502 gdk_color_free(hb->fore);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2503 if (hb->back)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2504 gdk_color_free(hb->back);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2505 if (hb->text)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2506 g_free(hb->text);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2507 if (hb->url)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2508 g_free(hb->url);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2509 if (hb->pm)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2510 gdk_pixmap_unref(hb->pm);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2511
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2512 g_free(hb);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2513 hbits = hbits->next;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2514 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2515 if (html->html_bits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2516 g_list_free(html->html_bits);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2517
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2518 if (html->urls)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2519 g_list_free(html->urls);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2520
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2521 if (html->selected_text)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2522 g_free(html->selected_text);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2523
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2524 if (html->gc)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2525 gdk_gc_destroy(html->gc);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2526
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2527 if (html->bg_gc)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2528 gdk_gc_destroy(html->bg_gc);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2529
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2530 if (html->tooltip_window)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2531 gtk_widget_destroy(html->tooltip_window);
12
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 GTK_OBJECT_CLASS(parent_class)->finalize(object);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2534 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2535
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2536 static void gtk_html_realize(GtkWidget * widget)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2537 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2538 GtkHtml *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2539 GdkWindowAttr attributes;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2540 gint attributes_mask;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2541
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2542 g_return_if_fail(widget != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2543 g_return_if_fail(GTK_IS_HTML(widget));
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 html = GTK_HTML(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2546 GTK_WIDGET_SET_FLAGS(html, GTK_REALIZED);
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 attributes.window_type = GDK_WINDOW_CHILD;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2549 attributes.x = widget->allocation.x;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2550 attributes.y = widget->allocation.y;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2551 attributes.width = widget->allocation.width;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2552 attributes.height = widget->allocation.height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2553 attributes.wclass = GDK_INPUT_OUTPUT;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2554 attributes.visual = gtk_widget_get_visual(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2555 attributes.colormap = gtk_widget_get_colormap(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2556 attributes.event_mask = gtk_widget_get_events(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2557 attributes.event_mask |= (GDK_EXPOSURE_MASK |
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2558 GDK_BUTTON_PRESS_MASK |
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2559 GDK_BUTTON_RELEASE_MASK |
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2560 GDK_BUTTON_MOTION_MASK |
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2561 GDK_ENTER_NOTIFY_MASK |
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2562 GDK_LEAVE_NOTIFY_MASK |
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2563 GDK_POINTER_MOTION_MASK |
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2564 GDK_POINTER_MOTION_HINT_MASK |
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2565 GDK_VISIBILITY_NOTIFY_MASK | GDK_KEY_PRESS_MASK);
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 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
2568
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2569 widget->window =
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2570 gdk_window_new(gtk_widget_get_parent_window(widget), &attributes,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2571 attributes_mask);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2572 gdk_window_set_user_data(widget->window, html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2573
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2574 attributes.x = (widget->style->klass->xthickness + BORDER_WIDTH);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2575 attributes.y = (widget->style->klass->ythickness + BORDER_WIDTH);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2576 attributes.width =
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2577 MAX(1, (gint) widget->allocation.width - (gint) attributes.x * 2);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2578 attributes.height =
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2579 MAX(1, (gint) widget->allocation.height - (gint) attributes.y * 2);
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->html_area =
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2582 gdk_window_new(widget->window, &attributes, attributes_mask);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2583 gdk_window_set_user_data(html->html_area, html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2584
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2585 widget->style = gtk_style_attach(widget->style, widget->window);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2586
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 * 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
2589 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2590 gdk_window_set_background(widget->window,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2591 &widget->style->base[GTK_STATE_NORMAL]);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2592 gdk_window_set_background(html->html_area,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2593 &widget->style->base[GTK_STATE_NORMAL]);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2594
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2595 if (widget->style->bg_pixmap[GTK_STATE_NORMAL])
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2596 html->bg_gc = create_bg_gc(html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2597
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2598 html->gc = gdk_gc_new(html->html_area);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2599 gdk_gc_set_exposures(html->gc, TRUE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2600 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
2601
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2602 gdk_window_show(html->html_area);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2603
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2604 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2605
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2606 static void gtk_html_style_set(GtkWidget * widget, GtkStyle * previous_style)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2607 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2608 GtkHtml *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2609
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2610 g_return_if_fail(widget != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2611 g_return_if_fail(GTK_IS_HTML(widget));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2612
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2613 html = GTK_HTML(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2614 if (GTK_WIDGET_REALIZED(widget))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2615 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2616 gdk_window_set_background(widget->window,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2617 &widget->style->base[GTK_STATE_NORMAL]);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2618 gdk_window_set_background(html->html_area,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2619 &widget->style->base[GTK_STATE_NORMAL]);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2620
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2621 if (html->bg_gc)
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 gdk_gc_destroy(html->bg_gc);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2624 html->bg_gc = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2625 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2626
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2627 if (widget->style->bg_pixmap[GTK_STATE_NORMAL])
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2628 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2629 html->bg_gc = create_bg_gc(html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2630 }
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 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2633 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2634
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2635 static void gtk_html_unrealize(GtkWidget * widget)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2636 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2637 GtkHtml *html;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2638
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2639 g_return_if_fail(widget != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2640 g_return_if_fail(GTK_IS_HTML(widget));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2641
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2642 html = GTK_HTML(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2643
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2644 gdk_window_set_user_data(html->html_area, NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2645 gdk_window_destroy(html->html_area);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2646 html->html_area = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2647
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2648 gdk_gc_destroy(html->gc);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2649 html->gc = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2650
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2651 if (html->bg_gc)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2652 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2653 gdk_gc_destroy(html->bg_gc);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2654 html->bg_gc = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2655 }
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 if (GTK_WIDGET_CLASS(parent_class)->unrealize)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2658 (*GTK_WIDGET_CLASS(parent_class)->unrealize) (widget);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2659 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2660
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2661
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2662
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2663
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2664
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2665 static void gtk_html_add_pixmap(GtkHtml * html, GdkPixmap * pm, int fit)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2666 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2667 GtkHtmlBit *last_hb;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2668 GtkHtmlBit *hb = g_new0(GtkHtmlBit, 1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2669 GdkWindowPrivate *private = (GdkWindowPrivate *) pm;
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 last_hb = (GtkHtmlBit *) g_list_last(html->html_bits)->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2672
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2673 hb->fit = fit;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2674 hb->x = html->current_x;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2675 hb->y = html->current_y;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2676 if (fit)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2677 hb->height = last_hb->height;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2678 else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2679 hb->height = private->height;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2680 hb->type = HTML_BIT_PIXMAP;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2681 hb->width = private->width;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2682 hb->text = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2683 hb->url = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2684 hb->fore = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2685 hb->back = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2686 hb->font = NULL;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2687 hb->uline = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2688 hb->strike = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2689 hb->was_selected = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2690 hb->newline = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2691 hb->pm = pm;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2692
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2693 if (html->current_x == BORDER_WIDTH)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2694 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2695 html->current_y += hb->height;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2696 hb->y += hb->height;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2697 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2698
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2699
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2700 html->current_x += hb->width;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2701
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2702 gtk_html_draw_bit(html, hb, 1);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2703
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2704 html->html_bits = g_list_append(html->html_bits, hb);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2705
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2706
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2707 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2708
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2709 static void gtk_html_add_seperator(GtkHtml * html)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2710 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2711 GtkHtmlBit *hb = g_new0(GtkHtmlBit, 1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2712 gint width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2713 height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2714
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2715 html->current_x = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2716 html->current_y += 5;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2717
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2718 gdk_window_get_size(html->html_area, &width, &height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2719
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2720 hb->x = html->current_x;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2721 hb->y = html->current_y;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2722 hb->height = 5;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2723 hb->type = HTML_BIT_SEP;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2724 hb->width =
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2725 width -
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2726 GTK_SCROLLED_WINDOW(GTK_WIDGET(html)->parent)->vscrollbar->allocation.
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2727 width - 10;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2728 hb->text = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2729 hb->url = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2730 hb->fore = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2731 hb->back = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2732 hb->font = NULL;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2733 hb->uline = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2734 hb->strike = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2735 hb->was_selected = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2736 hb->newline = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2737 hb->pm = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2738
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2739 gtk_html_draw_bit(html, hb, 1);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2740
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2741 html->html_bits = g_list_append(html->html_bits, hb);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2742
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2743 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2744
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2745
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2746 static void gtk_html_add_text(GtkHtml * html,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2747 GdkFont * cfont,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2748 GdkColor * fore,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2749 GdkColor * back,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2750 char *chars,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2751 gint length, gint uline, gint strike, char *url)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2752 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2753 char *nextline = NULL,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2754 *c,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2755 *text,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2756 *tmp;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2757 GdkGC *gc;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2758 int nl = 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2759 nl2 = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2760 int maxwidth;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2761 gint lb;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2762 GList *hbits;
79
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 69
diff changeset
2763 size_t num = 0;
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 69
diff changeset
2764 int i,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2765 height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2766 GtkHtmlBit *hb;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2767 gint hwidth,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2768 hheight;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2769
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2770 if (length == 1 && chars[0] == '\n')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2771 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2772 GtkHtmlBit *h;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2773 hbits = g_list_last(html->html_bits);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2774 if (!hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2775 return;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2776 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2777 * I realize this loses a \n sometimes
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2778 * * if it's the first thing in the widget.
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2779 * * so fucking what.
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2780 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2781
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2782 h = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2783 h->newline++;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2784 if (html->current_x > 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2785 html->current_x = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2786 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2787 html->current_y += cfont->ascent + cfont->descent + 2;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2788 return;
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
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2791
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2792
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2793 c = text = g_malloc(length + 2);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2794 strncpy(text, chars, length);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2795 text[length] = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2796
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2797
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2798 gc = html->gc;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2799
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2800 if (gc == NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2801 gc = html->gc = gdk_gc_new(html->html_area);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2802
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2803 gdk_gc_set_font(gc, cfont);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2804
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2805
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2806 while (*c)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2807 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2808 if (*c == '\n')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2809 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2810 if (*(c + 1) == '\0')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2811 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2812 nl = 1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2813 length--;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2814 c[0] = '\0';
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2815 break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2816 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2817 if (*c)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2818 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2819 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
2820 strike, url);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2821 tmp = text;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2822 length -= (num + 1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2823 text = g_malloc(length + 2);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2824 strncpy(text, (c + 1), length);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2825 text[length] = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2826 c = text;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2827 num = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2828 g_free(tmp);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2829 continue;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2830 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2831 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2832
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2833 num++;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2834 c++;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2835 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2836
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2837 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2838 * 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
2839 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2840 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2841 * it should be just fine. :)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2842 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2843
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2844 gdk_window_get_size(html->html_area, &hwidth, &hheight);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2845
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2846 num = strlen(text);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2847
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2848 while (GTK_WIDGET(html)->allocation.width < 20)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2849 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2850 while (gtk_events_pending())
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2851 gtk_main_iteration();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2852 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2853
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2854 maxwidth = (hwidth - html->current_x - 8);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2855 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2856 * HTK_SCROLLED_WINDOW(GTK_WIDGET(layout)->parent)->vscrollbar->allocation.width) - 8;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2857 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2858
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2859 while (gdk_text_measure(cfont, text, num) > maxwidth)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2860 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2861 if (num > 1)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2862 num--;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2863 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2864 {
26
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
2865 if (html->current_x != 0) {
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
2866 html->current_x = 0;
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
2867 if (nl) {
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
2868 text[length] = '\n';
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
2869 length++;
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
2870 }
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
2871 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
2872 g_free(text);
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
2873 return;
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
2874 } else {
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
2875 num = strlen (text);
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
2876 break;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2877 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2878 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2879
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2880 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2881
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2882 height = cfont->ascent + cfont->descent + 2;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2883
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2884
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2885 if ((int) (html->vadj->upper - html->current_y) < (int) (height * 2))
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 int val;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2888 val = (height * 2) + html->current_y;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2889 html->vadj->upper = val;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2890 adjust_adj(html, html->vadj);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2891 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2892
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2893
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2894 if (html->current_x == 0)
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 html->current_y += height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2897 gdk_text_extents(cfont, text, 1, &lb, NULL, NULL, NULL, NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2898 html->current_x += (2 - lb);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2899 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2900 else if ((hbits = g_list_last(html->html_bits)) != NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2901 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2902 int diff,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2903 y;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2904 hb = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2905 if (height > hb->height)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2906 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2907 diff = height - hb->height;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2908 y = hb->y;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2909 html->current_y += diff;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2910 while (hbits)
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 hb = (GtkHtmlBit *) hbits->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2913 if (hb->y != y)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2914 break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2915 hb->height = height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2916 hb->y += diff; ////////////my thing here /////////////////
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2917 gtk_html_draw_bit(html, hb, FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2918
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2919 hbits = hbits->prev;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2920 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2921 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2922 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2923
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2924
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2925
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2926
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2927 if (num != strlen(text))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2928 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2929 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2930 * This is kinda cheesy but it may make things
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2931 * * much better lookin
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2932 */
26
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
2933
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
2934 for (i=2; (num - i > 0); i++) {
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 12
diff changeset
2935 if (text[num - i] == ' ') {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2936 num = num - (i - 1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2937 nl2 = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2938 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2939 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2940 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2941
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2942 nextline = g_malloc(length - num + 2);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2943 strncpy(nextline, (char *) (text + num), length - num);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2944 nextline[length - num] = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2945 if (nl)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2946 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2947 nextline[length - num] = '\n';
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2948 nextline[length - num + 1] = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2949 nl = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2950 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2951
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2952
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2953 text[num] = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2954 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2955
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2956
52
ceb0d714d180 [gaim-migrate @ 62]
Rob Flynn <gaim@robflynn.com>
parents: 49
diff changeset
2957 if (url != NULL) {
53
bb007396e0a1 [gaim-migrate @ 63]
Rob Flynn <gaim@robflynn.com>
parents: 52
diff changeset
2958 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
2959 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2960
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2961 hb = g_new0(GtkHtmlBit, 1);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2962
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2963 hb->text = g_strdup(text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2964
52
ceb0d714d180 [gaim-migrate @ 62]
Rob Flynn <gaim@robflynn.com>
parents: 49
diff changeset
2965 if (fore)
ceb0d714d180 [gaim-migrate @ 62]
Rob Flynn <gaim@robflynn.com>
parents: 49
diff changeset
2966 hb->fore = gdk_color_copy(fore);
ceb0d714d180 [gaim-migrate @ 62]
Rob Flynn <gaim@robflynn.com>
parents: 49
diff changeset
2967 else
ceb0d714d180 [gaim-migrate @ 62]
Rob Flynn <gaim@robflynn.com>
parents: 49
diff changeset
2968 hb->fore = NULL;
49
4d25b98a9d09 [gaim-migrate @ 58]
Jim Duchek <jimduchek>
parents: 26
diff changeset
2969
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2970 if (back)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2971 hb->back = gdk_color_copy(back);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2972 else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2973 hb->back = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2974 hb->font = cfont;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2975 hb->uline = uline;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2976 hb->strike = strike;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2977 hb->height = height;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2978 gdk_text_extents(cfont, text, num, &lb, NULL, &hb->width, NULL, NULL);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2979 hb->x = html->current_x;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2980 hb->y = html->current_y;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2981 hb->type = HTML_BIT_TEXT;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2982 hb->pm = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2983 if (url != NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2984 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2985 uline = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2986 hb->uline = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2987 hb->url = g_strdup(url);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2988 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2989 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2990 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2991 hb->url = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2992 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2993 html->current_x += hb->width;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2994
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2995 html->html_bits = g_list_append(html->html_bits, hb);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2996 if (url != NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2997 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2998 html->urls = g_list_append(html->urls, hb);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2999 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3000
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3001
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3002
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3003 gtk_html_draw_bit(html, hb, 1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3004
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3005 if (nl || nl2)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3006 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3007 if (nl)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3008 hb->newline = 1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3009 html->current_x = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3010 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3011 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3012 hb->newline = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3013
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3014
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3015 if (nextline != NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3016 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3017 gtk_html_add_text(html, cfont, fore, back, nextline, strlen(nextline),
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3018 uline, strike, url);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3019 g_free(nextline);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3020 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3021
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3022 g_free(text);
137
fe81c8b4951d [gaim-migrate @ 147]
Rob Flynn <gaim@robflynn.com>
parents: 79
diff changeset
3023 if (url != NULL)
fe81c8b4951d [gaim-migrate @ 147]
Rob Flynn <gaim@robflynn.com>
parents: 79
diff changeset
3024 g_free(fore);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3025 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3026
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3027 static char * html_strtok( char * input, char delim )
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3028 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3029 static char * end;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3030 static char * curr_offset;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3031 int i;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3032 int num_quotes=0;
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 if( input != NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3035 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3036 curr_offset = input;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3037 end = input+strlen(input);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3038 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3039 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3040 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3041 if( curr_offset + strlen(curr_offset) < end )
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3042 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3043 curr_offset += strlen(curr_offset) + 1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3044 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3045 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3046 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3047 return NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3048 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3049 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3050 for( i=0; curr_offset+i < end &&
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3051 (curr_offset[i] != delim || num_quotes != 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3052 ; i++ )
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3053 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3054 if( curr_offset[i] == '\"' )
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3055 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3056 num_quotes = (num_quotes+1)%2;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3057 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3058 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3059 curr_offset[i] = '\0';
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3060 return curr_offset;
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
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3064 void gtk_html_append_text(GtkHtml * html, char *text, gint options)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3065 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3066 GdkColormap *map;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3067 GdkFont *cfont;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3068 GdkRectangle area;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3069 char ws[BUF_LONG],
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3070 tag[BUF_LONG],
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3071 *c,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3072 *url = NULL;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3073 gint intag = 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3074 wpos = 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3075 tpos = 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3076 colorv,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3077 bold = 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3078 italic = 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3079 fixed = 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3080 uline = 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3081 strike = 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3082 title = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3083 gint height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3084 struct font_state *current,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3085 *tmp;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3086 struct font_state def_state = { 3, 0, 0, "", NULL, NULL, NULL };
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3087
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3088 current = &def_state;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3089 map = gdk_window_get_colormap(html->html_area);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3090 cfont = getfont(current->font, bold, italic, fixed, current->size);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3091 c = text;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3092
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3093
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3094 while (*c)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3095 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3096 if (*c == '<')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3097 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3098 if (!intag)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3099 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3100 ws[wpos] = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3101 if (wpos)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3102 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3103 if (title)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3104 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3105 if (html->title)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3106 g_free(html->title);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3107 html->title = g_strdup(ws);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3108 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3109 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3110 gtk_html_add_text(html, cfont, current->color,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3111 current->bgcol, ws, strlen(ws), uline,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3112 strike, url);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3113 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3114 wpos = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3115 intag = 1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3116 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3117 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3118 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3119 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3120 * Assuming you NEVER have nested tags
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3121 * * (and I mean <tag <tag>> by this, not
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3122 * * <tag><tag2></tag2><tag>..
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3123 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3124 tag[tpos] = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3125 gtk_html_add_text(html, cfont, current->color, current->bgcol,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3126 "<", 1, 0, 0, NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3127 gtk_html_add_text(html, cfont, current->color, current->bgcol,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3128 tag, strlen(tag), 0, 0, NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3129 tpos = 0;
12
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 tag[0] = *c;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3132 }
12
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 else if (*c == '>')
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 if (intag)
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 tag[tpos] = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3139 if (!strcasecmp(tag, "B"))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3140 bold = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3141 else if (!strcasecmp(tag, "STRIKE"))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3142 strike = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3143 else if (!strcasecmp(tag, "I"))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3144 italic = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3145 else if (!strcasecmp(tag, "U"))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3146 uline = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3147 else if (!strcasecmp(tag, "PRE"))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3148 fixed = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3149 else if (!strcasecmp(tag, "HR"))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3150 gtk_html_add_seperator(html);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3151 else if (!strcasecmp(tag, "/B"))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3152 bold = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3153 else if (!strcasecmp(tag, "/STRIKE"))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3154 strike = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3155 else if (!strcasecmp(tag, "/I"))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3156 italic = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3157 else if (!strcasecmp(tag, "/U"))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3158 uline = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3159 else if (!strcasecmp(tag, "/PRE"))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3160 fixed = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3161 else if (!strcasecmp(tag, "TITLE"))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3162 title = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3163 else if (!strcasecmp(tag, "/TITLE"))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3164 title = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3165 else if (!strncasecmp(tag, "IMG", 3))
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
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 else if (!strcasecmp(tag, "H3"))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3170 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3171 current = push_state(current);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3172 current->size = 4;
12
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 else if (!strcasecmp(tag, "/H3"))
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 gtk_html_add_text(html, cfont, current->color,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3177 current->bgcol, "\n", 1, 0, 0, NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3178
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3179 if (current->next)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3180 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3181 if (current->ownbg)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3182 g_free(current->bgcol);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3183 if (current->owncolor)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3184 g_free(current->color);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3185 tmp = current;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3186 current = current->next;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3187 g_free(tmp);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3188 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3189 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3190 else if (!strcasecmp(tag, "TABLE"))
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 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3193 else if (!strcasecmp(tag, "/TABLE"))
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 else if (!strcasecmp(tag, "TR"))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3197 {
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 else if (!strcasecmp(tag, "/TR"))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3200 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3201 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3202 else if (!strcasecmp(tag, "/TD"))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3203 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3204 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3205 else if (!strcasecmp(tag, "TD"))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3206 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3207 gtk_html_add_text(html, cfont, current->color,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3208 current->bgcol, " ", 2, 0, 0, NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3209 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3210 else if (!strncasecmp(tag, "A ", 2))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3211 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3212 char *d;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3213 char *temp = d = g_strdup(tag);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3214 int flag = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3215 strtok(tag, " ");
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3216 while ((d = strtok(NULL, " ")))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3217 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3218 if (strlen(d) < 7)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3219 break;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3220 if (!strncasecmp(d, "HREF=\"", strlen("HREF=\"")))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3221 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3222 d += strlen("HREF=\"");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3223 d[strlen(d) - 1] = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3224 url = g_malloc(strlen(d) + 1);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3225 strcpy(url, d);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3226 flag = 1;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3227 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3228 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3229 g_free(temp);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3230 if (!flag)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3231 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3232 gtk_html_add_text(html, cfont, current->color,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3233 current->bgcol, "<", 1, 0, 0, NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3234 gtk_html_add_text(html, cfont, current->color,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3235 current->bgcol, tag, strlen(tag), 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3236 0, NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3237 gtk_html_add_text(html, cfont, current->color,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3238 current->bgcol, ">", 1, 0, 0, NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3239 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3240 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3241 else if (!strcasecmp(tag, "/A"))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3242 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3243 if (url)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3244 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3245 g_free(url);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3246 url = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3247 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3248 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3249 else if (!strncasecmp(tag, "FONT", strlen("FONT")))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3250 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3251 char *d;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3252 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3253 * 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
3254 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3255 current = push_state(current);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3256 html_strtok(tag, ' ');
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3257 while ((d = html_strtok(NULL, ' ')))
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 if (!strncasecmp(d, "COLOR=", strlen("COLOR=")))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3260 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3261 d += strlen("COLOR=");
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3262 if (*d == '\"')
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 d++;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3265 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3266 if (*d == '#')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3267 d++;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3268 if (d[strlen(d) - 1] == '\"')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3269 d[strlen(d) - 1] = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3270 if (sscanf(d, "%x", &colorv)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3271 && !(options & HTML_OPTION_NO_COLOURS))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3272 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3273 current->color = get_color(colorv, map);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3274 current->owncolor = 1;
12
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 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3278 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3279 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3280 if (!strncasecmp(d, "FACE=", strlen("FACE=")))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3281 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3282 d += strlen("FACE=");
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3283 if (*d == '\"')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3284 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3285 d++;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3286 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3287 if (d[strlen(d) - 1] == '\"')
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3288 d[strlen(d) - 1] = 0;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3289 strcpy(current->font, d);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3290 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3291 else if (!strncasecmp(d, "BACK=", strlen("BACK=")))
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 d += strlen("BACK=");
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3294 if (*d == '\"')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3295 d++;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3296 if (*d == '#')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3297 d++;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3298 if (d[strlen(d) - 1] == '\"')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3299 d[strlen(d) - 1] = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3300 if (sscanf(d, "%x", &colorv)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3301 && !(options & HTML_OPTION_NO_COLOURS))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3302 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3303 current->bgcol = get_color(colorv, map);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3304 current->ownbg = 1;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3305 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3306 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3307 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3308 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3309 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3310 else if (!strncasecmp(d, "SIZE=", strlen("SIZE=")))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3311 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3312 d += strlen("SIZE=");
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3313 if (*d == '\"')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3314 d++;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3315 if (*d == '+')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3316 d++;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3317 if (sscanf(d, "%d", &colorv))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3318 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3319 current->size = colorv;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3320 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3321 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3322 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3323 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3324 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3325 else if (strncasecmp(d, "PTSIZE=", strlen("PTSIZE=")))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3326 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3327 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3328 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3329 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3330 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3331 if (!strncasecmp
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3332 (tag, "BODY BGCOLOR", strlen("BODY BGCOLOR")))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3333 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3334
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3335 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3336 * Ditch trailing \"
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3337 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3338 tag[strlen(tag) - 1] = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3339 if (sscanf(tag + strlen("BODY BGCOLOR=\"#"), "%x", &colorv)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3340 && !(options & HTML_OPTION_NO_COLOURS))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3341 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3342 current->bgcol = get_color(colorv, map);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3343 current->ownbg = 1;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3344 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3345 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3346 else if (!strncasecmp(tag, "/FONT", strlen("/FONT")))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3347 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3348 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3349 * Pop a font state off the list if possible, freeing
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3350 * any resources it used
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3351 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3352 if (current->next)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3353 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3354 if (current->ownbg)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3355 g_free(current->bgcol);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3356 if (current->owncolor)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3357 g_free(current->color);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3358 tmp = current;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3359 current = current->next;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3360 g_free(tmp);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3361 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3362
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3363 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3364 else if (!strcasecmp(tag, "/BODY"))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3365 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3366 if (current->next)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3367 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3368 if (current->ownbg)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3369 g_free(current->bgcol);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3370 if (current->owncolor)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3371 g_free(current->color);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3372 tmp = current;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3373 current = current->next;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3374 g_free(tmp);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3375 } /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3376 * tags we ignore below
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 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3379 else if (!strncasecmp(tag, "BR", 2))
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 gtk_html_add_text(html, cfont, current->color,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3382 current->bgcol, "\n", 1, 0, 0, NULL);
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 (strncasecmp(tag, "HTML", 4)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3385 && strncasecmp(tag, "/HTML", 5)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3386 && strncasecmp(tag, "BODY", 4)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3387 && strncasecmp(tag, "/BODY", 5)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3388 && strncasecmp(tag, "P", 1)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3389 && strncasecmp(tag, "/P", 2)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3390 && strncasecmp(tag, "HEAD", 4)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3391 && strncasecmp(tag, "/HEAD", 5))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3392 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3393 if (tpos)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3394 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3395 gtk_html_add_text(html, cfont, current->color,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3396 current->bgcol, "<", 1, 0, 0, NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3397 gtk_html_add_text(html, cfont, current->color,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3398 current->bgcol, tag, strlen(tag), 0,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3399 0, NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3400 gtk_html_add_text(html, cfont, current->color,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3401 current->bgcol, ">", 1, 0, 0, NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3402
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3403 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3404 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3405 cfont = getfont(current->font, bold, italic, fixed, current->size);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3406 tpos = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3407 intag = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3408 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3409 else
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 ws[wpos++] = *c;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3412 }
12
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 else if (!intag && *c == '&')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3415 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3416 if (!strncasecmp(c, "&amp;", 5))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3417 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3418 ws[wpos++] = '&';
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3419 c += 4;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3420 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3421 else if (!strncasecmp(c, "&lt;", 4))
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 ws[wpos++] = '<';
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3424 c += 3;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3425 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3426 else if (!strncasecmp(c, "&gt;", 4))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3427 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3428 ws[wpos++] = '>';
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3429 c += 3;
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(c, "&nbsp;", 6))
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 ws[wpos++] = ' ';
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3434 c += 5;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3435 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3436 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3437 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3438 ws[wpos++] = *c;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3439 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3440 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3441 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3442 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3443 if (intag)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3444 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3445 tag[tpos++] = *c;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3446 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3447 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3448 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3449 ws[wpos++] = *c;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3450 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3451 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3452 c++;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3453 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3454 while (current->next)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3455 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3456 if (current->ownbg)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3457 g_free(current->bgcol);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3458 if (current->owncolor)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3459 g_free(current->color);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3460 tmp = current;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3461 current = current->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3462 g_free(tmp);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3463 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3464 ws[wpos] = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3465 tag[tpos] = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3466 if (wpos)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3467 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3468 gtk_html_add_text(html, cfont, current->color, current->bgcol, ws,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3469 strlen(ws), uline, strike, url);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3470 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3471 if (tpos)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3472 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3473 gtk_html_add_text(html, cfont, current->color, current->bgcol, "<", 1,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3474 0, 0, NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3475 gtk_html_add_text(html, cfont, current->color, current->bgcol, tag,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3476 strlen(tag), 0, 0, NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3477 gtk_html_add_text(html, cfont, current->color, current->bgcol, ">", 1,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3478 0, 0, NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3479 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3480
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3481
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3482
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3483 gdk_window_get_size(html->html_area, NULL, &height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3484 area.height = height;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3485 gtk_adjustment_set_value(html->vadj, html->vadj->upper - area.height);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3486
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3487 return;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3488 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3489
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3490
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3491 static void adjust_adj(GtkHtml * html, GtkAdjustment * adj)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3492 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3493 gint height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3494
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3495 gdk_window_get_size(html->html_area, NULL, &height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3496
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3497 adj->step_increment = MIN(adj->upper, (float) SCROLL_PIXELS);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3498 adj->page_increment = MIN(adj->upper, height - (float) KEY_SCROLL_PIXELS);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3499 adj->page_size = MIN(adj->upper, height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3500 adj->value = MIN(adj->value, adj->upper - adj->page_size);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3501 adj->value = MAX(adj->value, 0.0);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3502
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3503 gtk_signal_emit_by_name(GTK_OBJECT(adj), "changed");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3504 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3505
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3506
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3507 static void scroll_down(GtkHtml * html, gint diff0)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3508 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3509 GdkRectangle rect;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3510 gint width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3511 height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3512
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3513 html->yoffset += diff0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3514
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3515 gdk_window_get_size(html->html_area, &width, &height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3516
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3517 if (html->transparent)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3518 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3519 rect.x = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3520 rect.y = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3521 rect.width = width;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3522 rect.height = height;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3523 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3524 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3525 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3526
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3527
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3528 if (height > diff0 && !html->transparent)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3529 gdk_draw_pixmap(html->html_area,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3530 html->gc,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3531 html->html_area,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3532 0, diff0, 0, 0, width, height - diff0);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3533
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3534 rect.x = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3535 rect.y = MAX(0, height - diff0);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3536 rect.width = width;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3537 rect.height = MIN(height, diff0);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3538 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3539
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3540 expose_html(html, &rect, FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3541 gtk_html_draw_focus((GtkWidget *) html);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3542
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3543 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3544
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3545 static void scroll_up(GtkHtml * html, gint diff0)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3546 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3547 GdkRectangle rect;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3548 gint width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3549 height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3550
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3551 html->yoffset -= diff0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3552
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3553
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3554 gdk_window_get_size(html->html_area, &width, &height);
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 if (html->transparent)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3557 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3558 rect.x = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3559 rect.y = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3560 rect.width = width;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3561 rect.height = height;
12
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 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3564 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3565
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3566 if (height > diff0)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3567 gdk_draw_pixmap(html->html_area,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3568 html->gc,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3569 html->html_area,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3570 0, 0, 0, diff0, width, height - diff0);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3571
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3572 rect.x = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3573 rect.y = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3574 rect.width = width;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3575 rect.height = MIN(height, diff0);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3576 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3577
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3578 expose_html(html, &rect, FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3579 gtk_html_draw_focus((GtkWidget *) html);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3580
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3581 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3582
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3583
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3584
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3585 static void gtk_html_adjustment(GtkAdjustment * adjustment, GtkHtml * html)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3586 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3587 g_return_if_fail(adjustment != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3588 g_return_if_fail(GTK_IS_ADJUSTMENT(adjustment));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3589 g_return_if_fail(html != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3590 g_return_if_fail(GTK_IS_HTML(html));
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 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3593 * 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
3594 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3595 if (html->html_area == NULL)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3596 return;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3597
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3598 if (adjustment == html->hadj)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3599 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3600 g_warning("horizontal scrolling not implemented");
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3601 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3602 else
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 gint diff = ((gint) adjustment->value) - html->last_ver_value;
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 if (diff != 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3607 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3608 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3609 * undraw_cursor (text, FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3610 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3611
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3612 if (diff > 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3613 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3614 scroll_down(html, diff);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3615 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3616 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3617 { /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3618 * if (diff < 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3619 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3620 scroll_up(html, -diff);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3621 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3622 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3623 * draw_cursor (text, FALSE);
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
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3626 html->last_ver_value = adjustment->value;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3627 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3628 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3629 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3630
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3631 static gint gtk_html_visibility_notify(GtkWidget * widget,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3632 GdkEventVisibility * event)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3633 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3634 GtkHtml *html;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3635 GdkRectangle rect;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3636 gint width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3637 height;
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 g_return_val_if_fail(widget != NULL, FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3640 g_return_val_if_fail(GTK_IS_HTML(widget), FALSE);
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 html = GTK_HTML(widget);
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 if (GTK_WIDGET_REALIZED(widget) && html->transparent)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3645 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3646 gdk_window_get_size(html->html_area, &width, &height);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3647 rect.x = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3648 rect.y = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3649 rect.width = width;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3650 rect.height = height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3651 expose_html(html, &rect, FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3652 gtk_html_draw_focus((GtkWidget *) html);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3653 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3654 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3655 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3656 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3657
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3658
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3659 return FALSE;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3660 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3661
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3662
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3663
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3664 static void gtk_html_disconnect(GtkAdjustment * adjustment, GtkHtml * html)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3665 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3666 g_return_if_fail(adjustment != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3667 g_return_if_fail(GTK_IS_ADJUSTMENT(adjustment));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3668 g_return_if_fail(html != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3669 g_return_if_fail(GTK_IS_HTML(html));
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3670
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3671 if (adjustment == html->hadj)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3672 gtk_html_set_adjustments(html, NULL, html->vadj);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3673 if (adjustment == html->vadj)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3674 gtk_html_set_adjustments(html, html->hadj, NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3675 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3676
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3677 static void move_cursor_ver(GtkHtml * html, int count)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3678 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3679 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
3680 GtkHtmlBit *hb = NULL,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3681 *hb2 = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3682 gint y;
79
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 69
diff changeset
3683 size_t len,
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3684 len2 = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3685
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3686 undraw_cursor(html);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3687
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3688 if (!html->html_bits)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3689 return;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3690
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3691 if (!html->cursor_hb)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3692 html->cursor_hb = (GtkHtmlBit *) html->html_bits->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3693
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3694 hb = html->cursor_hb;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3695
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3696 len = html->cursor_pos;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3697 hbits = hbits->prev;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3698 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3699 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3700 hb2 = (GtkHtmlBit *) hbits->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3701
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3702 if (hb2->y != hb->y)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3703 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3704
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3705 len += strlen(hb2->text);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3706
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3707 hbits = hbits->prev;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3708 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3709
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3710 hbits = g_list_find(html->html_bits, html->cursor_hb);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3711
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3712 if (count < 0)
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 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3715 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3716 hb2 = (GtkHtmlBit *) hbits->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3717
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3718 if (hb2->y != hb->y)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3719 break;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3720
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3721 hbits = hbits->prev;
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 if (!hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3724 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3725 draw_cursor(html);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3726 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3727 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3728 y = hb2->y;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3729 hb = hb2;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3730 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3731 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3732 hb2 = (GtkHtmlBit *) hbits->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3733
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3734 if (hb2->y != y)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3735 break;
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 hb = hb2;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3738
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3739 hbits = hbits->prev;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3740 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3741 hbits = g_list_find(html->html_bits, hb);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3742 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3743 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3744 hb2 = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3745
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3746 if (hb->y != hb2->y)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3747 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3748 html->cursor_hb = hb;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3749 html->cursor_pos = strlen(hb->text);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3750 break;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3751 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3752
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3753
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3754 if (len < len2 + strlen(hb2->text))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3755 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3756 html->cursor_hb = hb2;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3757 html->cursor_pos = len - len2;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3758 break;
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
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3761 len2 += strlen(hb2->text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3762
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3763 hb = hb2;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3764
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3765 hbits = hbits->next;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3766 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3767 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3768 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3769 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3770 while (hbits)
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 hb2 = (GtkHtmlBit *) hbits->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3773
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3774 if (hb2->y != hb->y)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3775 break;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3776
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3777 hbits = hbits->next;
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 if (!hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3780 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3781 draw_cursor(html);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3782 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3783 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3784 hb = hb2;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3785 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3786 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3787 hb2 = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3788
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3789 if (hb->y != hb2->y)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3790 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3791 html->cursor_hb = hb;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3792 html->cursor_pos = strlen(hb->text);
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3793 break;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3794 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3795
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3796
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3797 if (len < len2 + strlen(hb2->text))
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3798 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3799 html->cursor_hb = hb2;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3800 html->cursor_pos = len - len2;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3801 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3802 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3803
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3804 len2 += strlen(hb2->text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3805
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3806 hb = hb2;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3807
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3808 hbits = hbits->next;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3809 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3810 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3811
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3812 draw_cursor(html);
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
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3816 static void move_cursor_hor(GtkHtml * html, int count)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3817 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3818 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
3819 GtkHtmlBit *hb,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3820 *hb2;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3821
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3822 undraw_cursor(html);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3823
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3824 if (!html->html_bits)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3825 return;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3826
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3827 if (!html->cursor_hb)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3828 html->cursor_hb = (GtkHtmlBit *) html->html_bits->data;
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 html->cursor_pos += count;
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 if (html->cursor_pos < 0)
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 if (hbits->prev)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3835 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3836 gint diff;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3837 hb = html->cursor_hb;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3838 hb2 = (GtkHtmlBit *) hbits->prev->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3839 diff = html->cursor_pos + strlen(hb2->text) + 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3840 if (hb->y == hb2->y)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3841 --diff;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3842
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3843 html->cursor_pos = diff;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3844
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3845 html->cursor_hb = (GtkHtmlBit *) hbits->prev->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3846 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3847 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3848 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3849 html->cursor_pos = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3850 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3851 }
79
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 69
diff changeset
3852 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
3853 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3854 if (hbits->next)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3855 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3856 gint diff;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3857 hb = html->cursor_hb;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3858 hb2 = (GtkHtmlBit *) hbits->next->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3859
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3860 diff = html->cursor_pos - strlen(html->cursor_hb->text) - 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3861 if (hb->y == hb2->y)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3862 ++diff;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3863 html->cursor_pos = diff;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3864 html->cursor_hb = (GtkHtmlBit *) hbits->next->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3865 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3866 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3867 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3868 html->cursor_pos = strlen(html->cursor_hb->text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3869 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3870
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3871 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3872
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3873 draw_cursor(html);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3874 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3875
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3876 static void move_beginning_of_line(GtkHtml * html)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3877 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3878 GList *hbits = g_list_find(html->html_bits, html->cursor_hb);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3879 GtkHtmlBit *hb = NULL;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3880 gint y;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3881
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3882 undraw_cursor(html);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3883
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3884 if (!html->html_bits)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3885 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3886
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3887 if (!html->cursor_hb)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3888 html->cursor_hb = (GtkHtmlBit *) html->html_bits->data;
1
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 y = html->cursor_hb->y;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3891
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3892 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3893 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3894 hb = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3895
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3896 if (y != hb->y)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3897 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3898 hb = (GtkHtmlBit *) hbits->next->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3899 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3900 }
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3901
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3902 hbits = hbits->prev;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3903 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3904 if (!hbits)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3905 html->cursor_hb = (GtkHtmlBit *) html->html_bits->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3906 else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3907 html->cursor_hb = hb;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3908
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3909 html->cursor_pos = 0;
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
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3912 draw_cursor(html);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3913
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3914
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3915 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3916
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3917 static void move_end_of_line(GtkHtml * html)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3918 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3919 GList *hbits = g_list_find(html->html_bits, html->cursor_hb);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3920 GtkHtmlBit *hb = NULL;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3921 gint y;
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 undraw_cursor(html);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3924
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3925 if (!html->html_bits)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3926 return;
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 if (!html->cursor_hb)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3929 html->cursor_hb = (GtkHtmlBit *) html->html_bits->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3930
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3931 y = html->cursor_hb->y;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3932
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3933 while (hbits)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3934 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3935 hb = (GtkHtmlBit *) hbits->data;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3936
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3937 if (y != hb->y)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3938 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3939 hb = (GtkHtmlBit *) hbits->prev->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3940 break;
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
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3943 hbits = hbits->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3944 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3945 if (!hbits)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3946 html->cursor_hb = (GtkHtmlBit *) g_list_last(html->html_bits)->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3947 else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3948 html->cursor_hb = hb;
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 html->cursor_pos = strlen(html->cursor_hb->text);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3951
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3952
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3953 draw_cursor(html);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3954
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3955
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3956 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3957
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3958
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3959
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3960 static gint gtk_html_key_press(GtkWidget * widget, GdkEventKey * event)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3961 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3962 GtkHtml *html;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3963 gchar key;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3964 gint return_val;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3965
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3966 g_return_val_if_fail(widget != NULL, FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3967 g_return_val_if_fail(GTK_IS_HTML(widget), FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3968 g_return_val_if_fail(event != NULL, FALSE);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3969
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3970 return_val = FALSE;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3971
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3972 html = GTK_HTML(widget);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3973
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3974 key = event->keyval;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3975 return_val = TRUE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3976
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3977
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3978 if (html->editable == FALSE)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3979 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3980 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3981 * switch (event->keyval) {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3982 * case GDK_Home:
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3983 * if (event->state & GDK_CONTROL_MASK)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3984 * scroll_int (text, -text->vadj->value);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3985 * else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3986 * return_val = FALSE;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3987 * break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3988 * case GDK_End:
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3989 * if (event->state & GDK_CONTROL_MASK)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3990 * scroll_int (text, +text->vadj->upper);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3991 * else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3992 * return_val = FALSE;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3993 * break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3994 * 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
3995 * 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
3996 * case GDK_Up: scroll_int (text, -KEY_SCROLL_PIXELS); break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3997 * case GDK_Down: scroll_int (text, +KEY_SCROLL_PIXELS); break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3998 * case GDK_Return:
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3999 * if (event->state & GDK_CONTROL_MASK)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4000 * gtk_signal_emit_by_name (GTK_OBJECT (text), "activate");
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4001 * else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4002 * return_val = FALSE;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4003 * break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4004 * default:
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4005 * return_val = FALSE;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4006 * break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4007 * }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4008 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4009 }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4010 else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4011 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4012
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4013 switch (event->keyval)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4014 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4015 case GDK_Home:
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4016 move_beginning_of_line(html);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4017 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4018 case GDK_End:
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4019 move_end_of_line(html);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4020 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4021 /*
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4022 * case GDK_Page_Up:
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4023 * move_cursor_page_ver (html, -1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4024 * break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4025 * case GDK_Page_Down:
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4026 * move_cursor_page_ver (html, +1);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4027 * break;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4028 */
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4029 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4030 * CUA has Ctrl-Up/Ctrl-Down as paragraph up down
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4031 */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4032 case GDK_Up:
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4033 move_cursor_ver(html, -1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4034 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4035 case GDK_Down:
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4036 move_cursor_ver(html, +1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4037 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4038 case GDK_Left:
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4039 move_cursor_hor(html, -1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4040 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4041 case GDK_Right:
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4042 move_cursor_hor(html, +1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4043 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4044 #if 0
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4045 case GDK_BackSpace:
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4046 if (event->state & GDK_CONTROL_MASK)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4047 gtk_text_delete_backward_word(text);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4048 else
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4049 gtk_text_delete_backward_character(text);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4050 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4051 case GDK_Clear:
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4052 gtk_text_delete_line(text);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4053 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4054 case GDK_Insert:
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4055 if (event->state & GDK_SHIFT_MASK)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4056 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4057 extend_selection = FALSE;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4058 gtk_editable_paste_clipboard(editable);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4059 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4060 else if (event->state & GDK_CONTROL_MASK)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4061 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4062 gtk_editable_copy_clipboard(editable);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4063 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4064 else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4065 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4066 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4067 * gtk_toggle_insert(text) -- IMPLEMENT
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4068 */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4069 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4070 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4071 case GDK_Delete:
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4072 if (event->state & GDK_CONTROL_MASK)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4073 gtk_text_delete_forward_word(text);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4074 else if (event->state & GDK_SHIFT_MASK)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4075 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4076 extend_selection = FALSE;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4077 gtk_editable_cut_clipboard(editable);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4078 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4079 else
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4080 gtk_text_delete_forward_character(text);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4081 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4082 case GDK_Tab:
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4083 position = text->point.index;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4084 gtk_editable_insert_text(editable, "\t", 1, &position);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4085 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4086 case GDK_Return:
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4087 if (event->state & GDK_CONTROL_MASK)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4088 gtk_signal_emit_by_name(GTK_OBJECT(text), "activate");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4089 else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4090 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4091 position = text->point.index;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4092 gtk_editable_insert_text(editable, "\n", 1, &position);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4093 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4094 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4095 case GDK_Escape:
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4096 /*
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4097 * Don't insert literally
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4098 */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4099 return_val = FALSE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4100 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4101 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4102 default:
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4103 return_val = FALSE;
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 #if 0
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4106 if (event->state & GDK_CONTROL_MASK)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4107 {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4108 if ((key >= 'A') && (key <= 'Z'))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4109 key -= 'A' - 'a';
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4110
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4111 if ((key >= 'a') && (key <= 'z')
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4112 && control_keys[(int) (key - 'a')])
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4113 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4114 (*control_keys[(int) (key - 'a')]) (editable, event->time);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4115 return_val = TRUE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4116 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4117
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4118 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4119 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4120 else if (event->state & GDK_MOD1_MASK)
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 if ((key >= 'A') && (key <= 'Z'))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4123 key -= 'A' - 'a';
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4124
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4125 if ((key >= 'a') && (key <= 'z') && alt_keys[(int) (key - 'a')])
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4126 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4127 (*alt_keys[(int) (key - 'a')]) (editable, event->time);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4128 return_val = TRUE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4129 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4130 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4131 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4132 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4133 /*
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4134 * if (event->length > 0) {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4135 * html->cursor_pos++;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4136 * gtk_editable_insert_text (editable, event->string, event->length, &position);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4137 *
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4138 * return_val = TRUE;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4139 * }
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4140 * else
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4141 * return_val = FALSE;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4142 */
1
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
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 return return_val;
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
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4150 void gtk_html_freeze(GtkHtml * html)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4151 {
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4152 g_return_if_fail(html != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4153 g_return_if_fail(GTK_IS_HTML(html));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4154
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4155 html->frozen++;
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
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4158 void gtk_html_thaw(GtkHtml * html)
1
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 GdkRectangle area;
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4161
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4162 g_return_if_fail(html != NULL);
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4163 g_return_if_fail(GTK_IS_HTML(html));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4164
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4165 html->frozen--;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4166
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4167 if (html->frozen < 0)
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4168 html->frozen = 0;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4169
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4170 if (html->frozen == 0)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4171 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4172 if (html->html_area)
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4173 {
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4174 gint width,
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4175 height;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4176 area.x = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4177 area.y = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4178
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4179 gdk_window_get_size(html->html_area, &width, &height);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4180
12
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4181 area.width = width;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4182 area.height = height;
76ab3403bf02 [gaim-migrate @ 21]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
4183
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4184 expose_html(html, &area, TRUE);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4185 }
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 }