Mercurial > pidgin
comparison src/gtkconv.c @ 9025:b24967757d46
[gaim-migrate @ 9801]
"
- Fixed text-decoration: underline; parsing from being dependent on font-size
specified
- IM HTML Toolbar dialogs now automatically fill with the color/font for the
current text
- Made most of the IMHTML formatting buttons fire signals where appropriate
- Implemented a global on or off "Send default formatting with outgoing
messages" option
- If user previously sent a font name, we assume they want formatting on,
otherwise it defaults to off.
- Removed font and color from the GaimGtkConversation struct, because this
wasn't being used anywhere, by anything and just resulted in more confusing
code.
- Removed three functions related to the struct, including one that was
declared, but never actually written.
- Added get_current_fontface, get_current_fontsize, get_current_forecolor,
get_current_backcolor to gtk_imhtml_* to get the formatting at the cursor
(or whole buffer when wbfo is on)
- Removed all dialogs used only by the old default formatting preferences from
dialogs.c
- When font background, color, or face are "disabled" they are stored as an
empty string in their prefs.
- Fixed a bug where NULL for background, color, or face did not remove the
tags in wbfo
" all that, quoth SimGuy
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Sun, 23 May 2004 03:54:20 +0000 |
parents | 230cf4032e3d |
children | 812e7aa7eafa |
comparison
equal
deleted
inserted
replaced
9024:85caba2f820a | 9025:b24967757d46 |
---|---|
267 GaimGtkConversation *c = GAIM_GTK_CONVERSATION(conv); | 267 GaimGtkConversation *c = GAIM_GTK_CONVERSATION(conv); |
268 GaimConnection *gc = gaim_conversation_get_gc(conv); | 268 GaimConnection *gc = gaim_conversation_get_gc(conv); |
269 | 269 |
270 if (gc && gc->flags & GAIM_CONNECTION_HTML) | 270 if (gc && gc->flags & GAIM_CONNECTION_HTML) |
271 { | 271 { |
272 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) | 272 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_formatting")) |
273 gtk_imhtml_toggle_bold(GTK_IMHTML(c->entry)); | |
274 | |
275 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) | |
276 gtk_imhtml_toggle_italic(GTK_IMHTML(c->entry)); | |
277 | |
278 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) | |
279 gtk_imhtml_toggle_underline(GTK_IMHTML(c->entry)); | |
280 | |
281 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_font") || | |
282 c->has_font) | |
283 { | 273 { |
284 gtk_imhtml_toggle_fontface(GTK_IMHTML(c->entry), c->fontface); | 274 char *color; |
285 } | 275 GdkColor fg_color, bg_color; |
286 | 276 |
287 if (!(gc->flags & GAIM_CONNECTION_NO_FONTSIZE) && | 277 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) |
288 gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_size")) | 278 gtk_imhtml_toggle_bold(GTK_IMHTML(c->entry)); |
289 { | 279 |
290 gtk_imhtml_font_set_size(GTK_IMHTML(c->entry), | 280 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) |
281 gtk_imhtml_toggle_italic(GTK_IMHTML(c->entry)); | |
282 | |
283 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) | |
284 gtk_imhtml_toggle_underline(GTK_IMHTML(c->entry)); | |
285 | |
286 gtk_imhtml_toggle_fontface(GTK_IMHTML(c->entry), | |
287 gaim_prefs_get_string("/gaim/gtk/conversations/font_face")); | |
288 | |
289 if (!(gc->flags & GAIM_CONNECTION_NO_FONTSIZE)) | |
290 gtk_imhtml_font_set_size(GTK_IMHTML(c->entry), | |
291 gaim_prefs_get_int("/gaim/gtk/conversations/font_size")); | 291 gaim_prefs_get_int("/gaim/gtk/conversations/font_size")); |
292 } | 292 |
293 | 293 if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), "") != 0) |
294 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_fgcolor")) | 294 { |
295 { | 295 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), |
296 char *color = g_strdup_printf("#%02x%02x%02x", | 296 &fg_color); |
297 c->fg_color.red / 256, | 297 color = g_strdup_printf("#%02x%02x%02x", |
298 c->fg_color.green / 256, | 298 fg_color.red / 256, |
299 c->fg_color.blue / 256); | 299 fg_color.green / 256, |
300 fg_color.blue / 256); | |
301 } | |
302 else | |
303 color = g_strdup(""); | |
304 | |
300 gtk_imhtml_toggle_forecolor(GTK_IMHTML(c->entry), color); | 305 gtk_imhtml_toggle_forecolor(GTK_IMHTML(c->entry), color); |
301 g_free(color); | 306 g_free(color); |
302 } | 307 |
303 | 308 if(!(gc->flags & GAIM_CONNECTION_NO_BGCOLOR) && |
304 if (!(gc->flags & GAIM_CONNECTION_NO_BGCOLOR) && | 309 strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), "") != 0) |
305 gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_bgcolor")) | 310 { |
306 { | 311 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), |
307 char *color = g_strdup_printf("#%02x%02x%02x", | 312 &bg_color); |
308 c->bg_color.red / 256, | 313 color = g_strdup_printf("#%02x%02x%02x", |
309 c->bg_color.green / 256, | 314 bg_color.red / 256, |
310 c->bg_color.blue / 256); | 315 bg_color.green / 256, |
316 bg_color.blue / 256); | |
317 } | |
318 else | |
319 color = g_strdup(""); | |
320 | |
311 gtk_imhtml_toggle_backcolor(GTK_IMHTML(c->entry), color); | 321 gtk_imhtml_toggle_backcolor(GTK_IMHTML(c->entry), color); |
312 g_free(color); | 322 g_free(color); |
313 } | 323 } |
324 | |
314 | 325 |
315 if (gc->flags & GAIM_CONNECTION_FORMATTING_WBFO) | 326 if (gc->flags & GAIM_CONNECTION_FORMATTING_WBFO) |
316 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), TRUE); | 327 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), TRUE); |
317 else | 328 else |
318 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), FALSE); | 329 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), FALSE); |
319 } | 330 } |
320 } | 331 } |
321 | |
322 static void | 332 static void |
323 send_cb(GtkWidget *widget, GaimConversation *conv) | 333 send_cb(GtkWidget *widget, GaimConversation *conv) |
324 { | 334 { |
325 GaimGtkConversation *gtkconv; | 335 GaimGtkConversation *gtkconv; |
326 GaimAccount *account; | 336 GaimAccount *account; |
4148 conv->ui_data = gtkconv; | 4158 conv->ui_data = gtkconv; |
4149 | 4159 |
4150 /* Setup some initial variables. */ | 4160 /* Setup some initial variables. */ |
4151 gtkconv->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | 4161 gtkconv->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
4152 gtkconv->tooltips = gtk_tooltips_new(); | 4162 gtkconv->tooltips = gtk_tooltips_new(); |
4153 | |
4154 /* Setup the foreground and background colors */ | |
4155 gaim_gtkconv_update_font_colors(conv); | |
4156 | |
4157 /* Setup the font face */ | |
4158 gaim_gtkconv_update_font_face(conv); | |
4159 | 4163 |
4160 if (conv_type == GAIM_CONV_IM) { | 4164 if (conv_type == GAIM_CONV_IM) { |
4161 gtkconv->u.im = g_malloc0(sizeof(GaimGtkImPane)); | 4165 gtkconv->u.im = g_malloc0(sizeof(GaimGtkImPane)); |
4162 gtkconv->u.im->a_virgin = TRUE; | 4166 gtkconv->u.im->a_virgin = TRUE; |
4163 | 4167 |
5304 if(conv == gaim_conv_window_get_active_conversation(gaim_conversation_get_window(conv))) | 5308 if(conv == gaim_conv_window_get_active_conversation(gaim_conversation_get_window(conv))) |
5305 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), buf); | 5309 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), buf); |
5306 } | 5310 } |
5307 | 5311 |
5308 void | 5312 void |
5309 gaim_gtkconv_update_font_colors(GaimConversation *conv) | |
5310 { | |
5311 GaimGtkConversation *gtkconv; | |
5312 | |
5313 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
5314 return; | |
5315 | |
5316 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5317 | |
5318 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), | |
5319 >kconv->fg_color); | |
5320 | |
5321 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), | |
5322 >kconv->bg_color); | |
5323 } | |
5324 | |
5325 void | |
5326 gaim_gtkconv_update_font_face(GaimConversation *conv) | |
5327 { | |
5328 GaimGtkConversation *gtkconv; | |
5329 | |
5330 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
5331 return; | |
5332 | |
5333 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5334 | |
5335 strncpy(gtkconv->fontface, | |
5336 gaim_prefs_get_string("/gaim/gtk/conversations/font_face"), | |
5337 sizeof(gtkconv->fontface)); | |
5338 } | |
5339 | |
5340 void | |
5341 gaim_gtkconv_update_buttons_by_protocol(GaimConversation *conv) | 5313 gaim_gtkconv_update_buttons_by_protocol(GaimConversation *conv) |
5342 { | 5314 { |
5343 GaimConvWindow *win; | 5315 GaimConvWindow *win; |
5344 | 5316 |
5345 if (!GAIM_IS_GTK_CONVERSATION(conv)) | 5317 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
5797 gaim_prefs_add_none("/gaim/gtk/conversations"); | 5769 gaim_prefs_add_none("/gaim/gtk/conversations"); |
5798 gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE); | 5770 gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE); |
5799 gaim_prefs_add_bool("/gaim/gtk/conversations/ctrl_enter_sends", FALSE); | 5771 gaim_prefs_add_bool("/gaim/gtk/conversations/ctrl_enter_sends", FALSE); |
5800 gaim_prefs_add_bool("/gaim/gtk/conversations/enter_sends", TRUE); | 5772 gaim_prefs_add_bool("/gaim/gtk/conversations/enter_sends", TRUE); |
5801 gaim_prefs_add_bool("/gaim/gtk/conversations/escape_closes", FALSE); | 5773 gaim_prefs_add_bool("/gaim/gtk/conversations/escape_closes", FALSE); |
5774 gaim_prefs_add_bool("/gaim/gtk/conversations/send_formatting", FALSE); | |
5802 gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE); | 5775 gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE); |
5803 gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE); | 5776 gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE); |
5804 gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE); | 5777 gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE); |
5805 gaim_prefs_add_bool("/gaim/gtk/conversations/show_timestamps", TRUE); | 5778 gaim_prefs_add_bool("/gaim/gtk/conversations/show_timestamps", TRUE); |
5806 gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE); | 5779 gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE); |
5807 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_formatting", FALSE); | 5780 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_formatting", FALSE); |
5808 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_bgcolor", FALSE); | |
5809 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_fgcolor", FALSE); | |
5810 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_font", FALSE); | |
5811 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_size", FALSE); | |
5812 gaim_prefs_add_bool("/gaim/gtk/conversations/html_shortcuts", FALSE); | 5781 gaim_prefs_add_bool("/gaim/gtk/conversations/html_shortcuts", FALSE); |
5813 gaim_prefs_add_bool("/gaim/gtk/conversations/smiley_shortcuts", FALSE); | 5782 gaim_prefs_add_bool("/gaim/gtk/conversations/smiley_shortcuts", FALSE); |
5814 gaim_prefs_add_bool("/gaim/gtk/conversations/show_formatting_toolbar", TRUE); | 5783 gaim_prefs_add_bool("/gaim/gtk/conversations/show_formatting_toolbar", TRUE); |
5815 gaim_prefs_add_string("/gaim/gtk/conversations/placement", "last"); | 5784 gaim_prefs_add_string("/gaim/gtk/conversations/placement", "last"); |
5816 gaim_prefs_add_int("/gaim/gtk/conversations/placement_number", 1); | 5785 gaim_prefs_add_int("/gaim/gtk/conversations/placement_number", 1); |
5817 gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", "#FFFFFF"); | 5786 gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", ""); |
5818 gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", "#000000"); | 5787 gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", ""); |
5819 gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); | 5788 gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); |
5820 gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3); | 5789 gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3); |
5821 gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE); | 5790 gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE); |
5822 gaim_prefs_add_int("/gaim/gtk/conversations/tab_side", GTK_POS_TOP); | 5791 gaim_prefs_add_int("/gaim/gtk/conversations/tab_side", GTK_POS_TOP); |
5823 | 5792 |