diff options
author | Christopher James Lahey <clahey@ximian.com> | 2001-09-22 06:08:13 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2001-09-22 06:08:13 +0800 |
commit | 84adebbb963fc2e458018475a8e377873e254062 (patch) | |
tree | 3b8805dad352cfbdc4449096a2831b995bf86f63 /addressbook/printing | |
parent | b9e1d0f5a61a88e7cc9feaaa6bf931805ba96d63 (diff) | |
download | gsoc2013-evolution-84adebbb963fc2e458018475a8e377873e254062.tar gsoc2013-evolution-84adebbb963fc2e458018475a8e377873e254062.tar.gz gsoc2013-evolution-84adebbb963fc2e458018475a8e377873e254062.tar.bz2 gsoc2013-evolution-84adebbb963fc2e458018475a8e377873e254062.tar.lz gsoc2013-evolution-84adebbb963fc2e458018475a8e377873e254062.tar.xz gsoc2013-evolution-84adebbb963fc2e458018475a8e377873e254062.tar.zst gsoc2013-evolution-84adebbb963fc2e458018475a8e377873e254062.zip |
Hooked up print preview button.
2001-09-21 Christopher James Lahey <clahey@ximian.com>
* gui/component/addressbook.c (print_preview_cb): Hooked up print
preview button.
* gui/widgets/e-addressbook-view.c,
gui/widgets/e-addressbook-view.h
(e_addressbook_view_print_preview): Added this function.
* printing/e-contact-print.c, printing/e-contact-print.h
(e_contact_print_preview): Added this function.
svn path=/trunk/; revision=13071
Diffstat (limited to 'addressbook/printing')
-rw-r--r-- | addressbook/printing/e-contact-print.c | 46 | ||||
-rw-r--r-- | addressbook/printing/e-contact-print.h | 1 |
2 files changed, 44 insertions, 3 deletions
diff --git a/addressbook/printing/e-contact-print.c b/addressbook/printing/e-contact-print.c index d1a0324f6d..c4118e0dbf 100644 --- a/addressbook/printing/e-contact-print.c +++ b/addressbook/printing/e-contact-print.c @@ -425,7 +425,7 @@ e_contact_get_card_size(ECardSimple *simple, EContactPrintContext *ctxt) height += gnome_font_get_size (ctxt->style->headings_font) * .2; - for(field = E_CARD_SIMPLE_FIELD_FULL_NAME; field != E_CARD_SIMPLE_FIELD_LAST; field++) { + for(field = E_CARD_SIMPLE_FIELD_FULL_NAME; field != E_CARD_SIMPLE_FIELD_LAST_SIMPLE_STRING; field++) { char *string; string = e_card_simple_get(simple, field); if (string && *string) { @@ -471,7 +471,7 @@ e_contact_print_card (ECardSimple *simple, EContactPrintContext *ctxt) ctxt->y -= gnome_font_get_size (ctxt->style->headings_font) * .2; - for(field = E_CARD_SIMPLE_FIELD_FULL_NAME; field != E_CARD_SIMPLE_FIELD_LAST; field++) { + for(field = E_CARD_SIMPLE_FIELD_FULL_NAME; field != E_CARD_SIMPLE_FIELD_LAST_SIMPLE_STRING; field++) { char *string; string = e_card_simple_get(simple, field); if (string && *string) { @@ -654,7 +654,7 @@ e_contact_get_phone_list_size(ECardSimple *simple, EContactPrintContext *ctxt) height += gnome_font_get_size (ctxt->style->headings_font) * .2; - for(field = E_CARD_SIMPLE_FIELD_FULL_NAME; field != E_CARD_SIMPLE_FIELD_LAST; field++) { + for(field = E_CARD_SIMPLE_FIELD_FULL_NAME; field != E_CARD_SIMPLE_FIELD_LAST_SIMPLE_STRING; field++) { char *string; string = e_card_simple_get(simple, field); if (string && *string) { @@ -1104,6 +1104,46 @@ e_contact_print_dialog_new(EBook *book, char *query) return dialog; } +void +e_contact_print_preview(EBook *book, char *query) +{ + EContactPrintContext *ctxt = g_new(EContactPrintContext, 1); + EContactPrintStyle *style = g_new(EContactPrintStyle, 1); + GnomePrintMaster *master; + GnomePrintContext *pc; + gdouble font_size; + + master = gnome_print_master_new(); + gnome_print_master_set_copies (master, 1, FALSE); + pc = gnome_print_master_get_context (master); + e_contact_build_style (style); + + ctxt->x = 0; + ctxt->y = 0; + ctxt->column = 0; + ctxt->style = style; + ctxt->master = master; + ctxt->first_section = TRUE; + ctxt->first_char_on_page = 'A' - 1; + ctxt->type = GNOME_PRINT_PREVIEW; + + font_size = 72 * ctxt->style->page_height / 27.0 / 2.0; + ctxt->letter_heading_font = gnome_font_new(gnome_font_get_name(ctxt->style->headings_font), gnome_font_get_size (ctxt->style->headings_font) * 1.5); + ctxt->letter_tab_font = gnome_font_new(gnome_font_get_name(ctxt->style->headings_font), font_size); + + ctxt->pc = GNOME_PRINT_CONTEXT(gnome_print_multipage_new_from_sizes(pc, + 72 * style->paper_width, + 72 * style->paper_height, + 72 * style->page_width, + 72 * style->page_height)); + + ctxt->book = book; + ctxt->query = g_strdup(query); + ctxt->cards = NULL; + gtk_object_ref(GTK_OBJECT(book)); + e_contact_do_print(book, ctxt->query, ctxt); +} + GtkWidget * e_contact_print_card_dialog_new(ECard *card) { diff --git a/addressbook/printing/e-contact-print.h b/addressbook/printing/e-contact-print.h index b4060c64ab..9918248b3a 100644 --- a/addressbook/printing/e-contact-print.h +++ b/addressbook/printing/e-contact-print.h @@ -30,6 +30,7 @@ #include "e-contact-print-types.h" GtkWidget *e_contact_print_dialog_new(EBook *book, char *query); +void e_contact_print_preview(EBook *book, char *query); GtkWidget *e_contact_print_card_dialog_new(ECard *card); GtkWidget *e_contact_print_card_list_dialog_new(GList *list); |