2007-11-27 [holger] 3.1.0cvs34

* src/printing.c
		Add weights to the list of supported text attributes
		for printing
This commit is contained in:
Holger Berndt 2007-11-27 10:57:58 +00:00
parent 1d1c924664
commit 2de33dd53b
4 changed files with 42 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2007-11-27 [holger] 3.1.0cvs34
* src/printing.c
Add weights to the list of supported text attributes
for printing
2007-11-27 [wwp] 3.1.0cvs33
* src/Makefile.am

View file

@ -3091,3 +3091,4 @@
( cvs diff -u -r 1.213.2.168 -r 1.213.2.169 src/folder.c; cvs diff -u -r 1.179.2.200 -r 1.179.2.201 src/imap.c; ) > 3.1.0cvs31.patchset
( cvs diff -u -r 1.5.2.6 -r 1.5.2.7 src/addrclip.c; cvs diff -u -r 1.60.2.106 -r 1.60.2.107 src/addressbook.c; cvs diff -u -r 1.13.2.16 -r 1.13.2.17 src/addritem.c; ) > 3.1.0cvs32.patchset
( cvs diff -u -r 1.155.2.80 -r 1.155.2.81 src/Makefile.am; diff -u /dev/null src/addrcustomattr.c; diff -u /dev/null src/addrcustomattr.h; cvs diff -u -r 1.60.2.107 -r 1.60.2.108 src/addressbook.c; cvs diff -u -r 1.14.2.45 -r 1.14.2.46 src/editaddress.c; cvs diff -u -r 1.3.2.7 -r 1.3.2.8 src/editaddress.h; cvs diff -u -r 1.204.2.155 -r 1.204.2.156 src/prefs_common.c; cvs diff -u -r 1.103.2.100 -r 1.103.2.101 src/prefs_common.h; cvs diff -u -r 1.9.2.43 -r 1.9.2.44 src/common/defs.h; ) > 3.1.0cvs33.patchset
( cvs diff -u -r 1.1.2.11 -r 1.1.2.12 src/printing.c; ) > 3.1.0cvs34.patchset

View file

@ -11,7 +11,7 @@ MINOR_VERSION=1
MICRO_VERSION=0
INTERFACE_AGE=0
BINARY_AGE=0
EXTRA_VERSION=33
EXTRA_VERSION=34
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=

View file

@ -1000,12 +1000,13 @@ static void printing_layout_set_text_attributes(PrintData *print_data, GtkPrintC
open_attrs = NULL;
do {
gboolean fg_set, bg_set, under_set, strike_set;
gboolean fg_set, bg_set, under_set, strike_set, weight_set;
GSList *tags, *tag_walk;
GtkTextTag *tag;
GdkColor *color;
PangoUnderline underline;
gboolean strikethrough;
gint weight;
GdkPixbuf *image;
if (prefs_common.print_imgs && (image = gtk_text_iter_get_pixbuf(&iter)) != NULL) {
@ -1047,6 +1048,7 @@ static void printing_layout_set_text_attributes(PrintData *print_data, GtkPrintC
"foreground-set", &fg_set,
"underline-set",&under_set,
"strikethrough-set", &strike_set,
"weight-set", &weight_set,
NULL);
if(fg_set) {
@ -1132,6 +1134,27 @@ static void printing_layout_set_text_attributes(PrintData *print_data, GtkPrintC
if(!found)
debug_print("Error generating attribute list.\n");
}
if(weight_set) {
found = FALSE;
for(attr_walk = open_attrs; attr_walk != NULL; attr_walk = attr_walk->next) {
attr = (PangoAttribute*)attr_walk->data;
if(attr->klass->type == PANGO_ATTR_WEIGHT) {
attr_int = (PangoAttrInt*)attr;
g_object_get(G_OBJECT(tag), "weight", &weight, NULL);
if(attr_int->value == weight) {
attr->end_index = printing_text_iter_get_offset_bytes(print_data, &iter);
pango_attr_list_insert(attr_list, attr);
found = TRUE;
open_attrs = g_slist_delete_link(open_attrs, attr_walk);
break;
}
}
}
if(!found)
debug_print("Error generating attribute list.\n");
}
}
g_slist_free(tags);
@ -1139,6 +1162,9 @@ static void printing_layout_set_text_attributes(PrintData *print_data, GtkPrintC
if(gtk_text_iter_begins_tag(&iter, NULL)) {
tags = gtk_text_iter_get_toggled_tags(&iter, TRUE);
/* Sometimes, an iter has several weights. Use only the first in this case */
gboolean weight_set_for_this_iter;
weight_set_for_this_iter = FALSE;
for(tag_walk = tags; tag_walk != NULL; tag_walk = tag_walk->next) {
tag = GTK_TEXT_TAG(tag_walk->data);
g_object_get(G_OBJECT(tag),
@ -1171,6 +1197,13 @@ static void printing_layout_set_text_attributes(PrintData *print_data, GtkPrintC
attr->start_index = printing_text_iter_get_offset_bytes(print_data, &iter);
open_attrs = g_slist_prepend(open_attrs, attr);
}
if(weight_set && !weight_set_for_this_iter) {
weight_set_for_this_iter = TRUE;
g_object_get(G_OBJECT(tag), "weight", &weight, NULL);
attr = pango_attr_weight_new(weight);
attr->start_index = printing_text_iter_get_offset_bytes(print_data, &iter);
open_attrs = g_slist_prepend(open_attrs, attr);
}
}
g_slist_free(tags);
}