comparison src/conversation.c @ 2763:477a035d81e5

[gaim-migrate @ 2776] more font stuff! yay! committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Mon, 19 Nov 2001 12:03:38 +0000
parents 367d19133917
children e5e78d42e49e
comparison
equal deleted inserted replaced
2762:8eb8db9a8449 2763:477a035d81e5
68 GdkBitmap *dark_icon_bm = NULL; 68 GdkBitmap *dark_icon_bm = NULL;
69 69
70 GtkWidget *all_convos = NULL; 70 GtkWidget *all_convos = NULL;
71 static GtkWidget *convo_notebook = NULL; 71 static GtkWidget *convo_notebook = NULL;
72 72
73 char fontface[64]; 73 char fontface[128] = { 0 };
74 char fontxfld[256] = { 0 };
74 int fontsize = 3; 75 int fontsize = 3;
75 extern GdkColor bgcolor; 76 extern GdkColor bgcolor;
76 extern GdkColor fgcolor; 77 extern GdkColor fgcolor;
77 78
78 void check_everything(GtkWidget *entry); 79 void check_everything(GtkWidget *entry);
500 } 501 }
501 502
502 void set_font_face(char *newfont, struct conversation *c) 503 void set_font_face(char *newfont, struct conversation *c)
503 { 504 {
504 char *pre_fontface; 505 char *pre_fontface;
505 int alloc = 1; 506 int i, j = 0, k = 0;
506 507
507 pre_fontface = g_strconcat("<FONT FACE=\"", newfont, "\">", '\0'); 508
508 509 sprintf(c->fontxfld, "%s", newfont && *newfont ? newfont : DEFAULT_FONT_XFLD);
509 if (!strcmp(pre_fontface, "<FONT FACE=\"\">")) { 510 for (i = 0; i < strlen(c->fontxfld); i++) {
510 g_free(pre_fontface); 511 if (c->fontxfld[i] == '-') {
511 alloc--; 512 if (++j > 2)
512 pre_fontface = "<FONT FACE=\"" DEFAULT_FONT_FACE "\">"; 513 break;
513 } 514 } else if (j == 2)
514 515 c->fontface[k++] = c->fontxfld[i];
515 sprintf(c->fontface, "%s", newfont ? 516 }
516 (newfont[0] ? newfont : DEFAULT_FONT_FACE) : DEFAULT_FONT_FACE); 517 c->fontface[k] = '\0';
517 c->hasfont = 1; 518 c->hasfont = 1;
519
520 pre_fontface = g_strconcat("<FONT FACE=\"", c->fontface, "\">", NULL);
518 surround(c->entry, pre_fontface, "</FONT>"); 521 surround(c->entry, pre_fontface, "</FONT>");
519 gtk_widget_grab_focus(c->entry); 522 gtk_widget_grab_focus(c->entry);
520 523 g_free(pre_fontface);
521 if (alloc)
522 g_free(pre_fontface);
523 } 524 }
524 525
525 static gint delete_all_convo(GtkWidget *w, GdkEventAny *e, gpointer d) 526 static gint delete_all_convo(GtkWidget *w, GdkEventAny *e, gpointer d)
526 { 527 {
527 while (conversations) { 528 while (conversations) {
2148 c->fg_color_dialog = NULL; 2149 c->fg_color_dialog = NULL;
2149 c->bg_color_dialog = NULL; 2150 c->bg_color_dialog = NULL;
2150 c->smiley_dialog = NULL; 2151 c->smiley_dialog = NULL;
2151 c->link_dialog = NULL; 2152 c->link_dialog = NULL;
2152 c->log_dialog = NULL; 2153 c->log_dialog = NULL;
2154 sprintf(c->fontxfld, "%s", fontxfld);
2153 sprintf(c->fontface, "%s", fontface); 2155 sprintf(c->fontface, "%s", fontface);
2154 c->hasfont = 0; 2156 c->hasfont = 0;
2155 c->bgcol = bgcolor; 2157 c->bgcol = bgcolor;
2156 c->hasbg = 0; 2158 c->hasbg = 0;
2157 c->fgcol = fgcolor; 2159 c->fgcol = fgcolor;
2584 b = c->data; 2586 b = c->data;
2585 c = c->next; 2587 c = c->next;
2586 if (b->hasfont) 2588 if (b->hasfont)
2587 continue; 2589 continue;
2588 sprintf(b->fontface, "%s", fontface); 2590 sprintf(b->fontface, "%s", fontface);
2591 sprintf(b->fontxfld, "%s", fontxfld);
2589 } 2592 }
2590 } 2593 }
2591 2594
2592 #if USE_PIXBUF 2595 #if USE_PIXBUF
2593 #include <gdk-pixbuf/gdk-pixbuf.h> 2596 #include <gdk-pixbuf/gdk-pixbuf.h>