2007-11-27 [holger] 3.1.0cvs34
authorHolger Berndt <hb@claws-mail.org>
Tue, 27 Nov 2007 10:57:58 +0000 (10:57 +0000)
committerHolger Berndt <hb@claws-mail.org>
Tue, 27 Nov 2007 10:57:58 +0000 (10:57 +0000)
* src/printing.c
Add weights to the list of supported text attributes
for printing

ChangeLog
PATCHSETS
configure.ac
src/printing.c

index ca8dc25945b1ab920b3130ddda2ef87394324612..b19324ba9f4eb57f6cae8120aaddb5e92bc8cb88 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 3c7e0f6aa50d620fdd7ff3bf49524d126cae7980..ff65d5a80670c45683846ba4de5fb078a00ba2eb 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( 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
index e70b70003ffe74f89d41b60979f4a21db906be43..e277e59d8bd71809ffc60e571313aef4e519679e 100644 (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=
 
index 08a6db9daa34cee499b598cd4b40317eecf496c5..8843a75bef39b6a0a833995be68f2864e940df90 100644 (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);
     }