Mercurial > pidgin.yaz
comparison src/gtkimhtml.c @ 10858:a29815b897c0
[gaim-migrate @ 12534]
this changes the background "fix" to not use the heap, and also does it
for backcolor and font color, so that you can see SmarterChild in its
full glory.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Fri, 22 Apr 2005 02:51:15 +0000 |
parents | 06e71aa662af |
children | c28766b87f64 |
comparison
equal
deleted
inserted
replaced
10857:06e71aa662af | 10858:a29815b897c0 |
---|---|
645 + gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(widget)); | 645 + gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(widget)); |
646 | 646 |
647 color = tag->name + 11; | 647 color = tag->name + 11; |
648 | 648 |
649 if (!gdk_color_parse(color, &gcolor)) { | 649 if (!gdk_color_parse(color, &gcolor)) { |
650 gchar *tmp = g_strdup_printf("#%s", color); | 650 gchar tmp[8]; |
651 tmp[0] = '#'; | |
652 strncpy(&tmp[1], color, 7); | |
653 tmp[7] = '\0'; | |
651 if (!gdk_color_parse(tmp, &gcolor)) | 654 if (!gdk_color_parse(tmp, &gcolor)) |
652 gdk_color_parse("white", &gcolor); | 655 gdk_color_parse("white", &gcolor); |
653 g_free(tmp); | |
654 } | 656 } |
655 gdk_gc_set_rgb_fg_color(gc, &gcolor); | 657 gdk_gc_set_rgb_fg_color(gc, &gcolor); |
656 | 658 |
657 | 659 |
658 gdk_draw_rectangle(event->window, | 660 gdk_draw_rectangle(event->window, |
3346 GtkTextTag *tag; | 3348 GtkTextTag *tag; |
3347 | 3349 |
3348 g_snprintf(str, sizeof(str), "FORECOLOR %s", color); | 3350 g_snprintf(str, sizeof(str), "FORECOLOR %s", color); |
3349 | 3351 |
3350 tag = gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(imhtml->text_buffer), str); | 3352 tag = gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(imhtml->text_buffer), str); |
3351 if (!tag) | 3353 if (!tag) { |
3352 tag = gtk_text_buffer_create_tag(imhtml->text_buffer, str, "foreground", color, NULL); | 3354 GdkColor gcolor; |
3355 if (!gdk_color_parse(color, &gcolor)) { | |
3356 gchar tmp[8]; | |
3357 tmp[0] = '#'; | |
3358 strncpy(&tmp[1], color, 7); | |
3359 tmp[7] = '\0'; | |
3360 if (!gdk_color_parse(tmp, &gcolor)) | |
3361 gdk_color_parse("black", &gcolor); | |
3362 } | |
3363 tag = gtk_text_buffer_create_tag(imhtml->text_buffer, str, "foreground-gdk", &gcolor, NULL); | |
3364 } | |
3353 | 3365 |
3354 return tag; | 3366 return tag; |
3355 } | 3367 } |
3356 | 3368 |
3357 static GtkTextTag *find_font_backcolor_tag(GtkIMHtml *imhtml, gchar *color) | 3369 static GtkTextTag *find_font_backcolor_tag(GtkIMHtml *imhtml, gchar *color) |
3360 GtkTextTag *tag; | 3372 GtkTextTag *tag; |
3361 | 3373 |
3362 g_snprintf(str, sizeof(str), "BACKCOLOR %s", color); | 3374 g_snprintf(str, sizeof(str), "BACKCOLOR %s", color); |
3363 | 3375 |
3364 tag = gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(imhtml->text_buffer), str); | 3376 tag = gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(imhtml->text_buffer), str); |
3365 if (!tag) | 3377 if (!tag) { |
3366 tag = gtk_text_buffer_create_tag(imhtml->text_buffer, str, "background", color, NULL); | 3378 GdkColor gcolor; |
3379 if (!gdk_color_parse(color, &gcolor)) { | |
3380 gchar tmp[8]; | |
3381 tmp[0] = '#'; | |
3382 strncpy(&tmp[1], color, 7); | |
3383 tmp[7] = '\0'; | |
3384 if (!gdk_color_parse(tmp, &gcolor)) | |
3385 gdk_color_parse("white", &gcolor); | |
3386 } | |
3387 tag = gtk_text_buffer_create_tag(imhtml->text_buffer, str, "background-gdk", &gcolor, NULL); | |
3388 } | |
3367 | 3389 |
3368 return tag; | 3390 return tag; |
3369 } | 3391 } |
3370 | 3392 |
3371 static GtkTextTag *find_font_background_tag(GtkIMHtml *imhtml, gchar *color) | 3393 static GtkTextTag *find_font_background_tag(GtkIMHtml *imhtml, gchar *color) |