2
2
* printing.c - this file is part of Geany, a fast and lightweight IDE
4
* Copyright 2007-2010 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
5
* Copyright 2007-2010 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
4
* Copyright 2007-2011 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
5
* Copyright 2007-2011 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
7
7
* This program is free software; you can redistribute it and/or modify
8
8
* it under the terms of the GNU General Public License as published by
18
18
* along with this program; if not, write to the Free Software
19
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
* $Id: printing.c 5079 2010-07-01 16:22:45Z ntrel $
21
* $Id: printing.c 5884 2011-08-06 18:33:04Z colombanw $
26
* GTK 2.10 printing support
26
* GTK printing support
27
27
* (basic code layout were adopted from Sylpheed's printing implementation, thanks)
48
48
PrintingPrefs printing_prefs;
51
#if GTK_CHECK_VERSION(2, 10, 0)
54
51
#define ROTATE_RGB(color) \
55
52
(((color) & 0xFF0000) >> 16) + ((color) & 0x00FF00) + (((color) & 0x0000FF) << 16)
56
53
#define ADD_ATTR(l, a) \
313
310
datetime = utils_get_date_time(printing_prefs.page_header_datefmt, &(dinfo->print_time));
311
if (G_LIKELY(NZV(datetime)))
316
313
data = g_strdup_printf("<b>%s</b>", datetime);
317
314
pango_layout_set_markup(layout, data, -1);
381
378
w->check_print_linenumbers = gtk_check_button_new_with_mnemonic(_("Print line numbers"));
382
379
gtk_box_pack_start(GTK_BOX(page), w->check_print_linenumbers, FALSE, FALSE, 0);
383
ui_widget_set_tooltip_text(w->check_print_linenumbers, _("Add line numbers to the printed page"));
380
gtk_widget_set_tooltip_text(w->check_print_linenumbers, _("Add line numbers to the printed page"));
384
381
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w->check_print_linenumbers), printing_prefs.print_line_numbers);
386
383
w->check_print_pagenumbers = gtk_check_button_new_with_mnemonic(_("Print page numbers"));
387
384
gtk_box_pack_start(GTK_BOX(page), w->check_print_pagenumbers, FALSE, FALSE, 0);
388
ui_widget_set_tooltip_text(w->check_print_pagenumbers, _("Add page numbers at the bottom of each page. It takes 2 lines of the page."));
385
gtk_widget_set_tooltip_text(w->check_print_pagenumbers, _("Add page numbers at the bottom of each page. It takes 2 lines of the page."));
389
386
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w->check_print_pagenumbers), printing_prefs.print_page_numbers);
391
388
w->check_print_pageheader = gtk_check_button_new_with_mnemonic(_("Print page header"));
392
389
gtk_box_pack_start(GTK_BOX(page), w->check_print_pageheader, FALSE, FALSE, 0);
393
ui_widget_set_tooltip_text(w->check_print_pageheader, _("Add a little header to every page containing the page number, the filename and the current date (see below). It takes 3 lines of the page."));
390
gtk_widget_set_tooltip_text(w->check_print_pageheader, _("Add a little header to every page containing the page number, the filename and the current date (see below). It takes 3 lines of the page."));
394
391
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w->check_print_pageheader), printing_prefs.print_page_header);
395
392
g_signal_connect(w->check_print_pageheader, "toggled", G_CALLBACK(on_page_header_toggled), w);
409
406
w->check_print_basename = gtk_check_button_new_with_mnemonic(_("Use the basename of the printed file"));
410
407
gtk_box_pack_start(GTK_BOX(vbox30), w->check_print_basename, FALSE, FALSE, 0);
411
ui_widget_set_tooltip_text(w->check_print_basename, _("Print only the basename(without the path) of the printed file"));
408
gtk_widget_set_tooltip_text(w->check_print_basename, _("Print only the basename(without the path) of the printed file"));
412
409
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w->check_print_basename), printing_prefs.page_header_basename);
414
411
hbox10 = gtk_hbox_new(FALSE, 5);
420
417
w->entry_print_dateformat = gtk_entry_new();
421
418
ui_entry_add_clear_icon(GTK_ENTRY(w->entry_print_dateformat));
422
419
gtk_box_pack_start(GTK_BOX(hbox10), w->entry_print_dateformat, TRUE, TRUE, 0);
423
ui_widget_set_tooltip_text(w->entry_print_dateformat, _("Specify a format for the date and time stamp which is added to the page header on each page. You can use any conversion specifiers which can be used with the ANSI C strftime function."));
420
gtk_widget_set_tooltip_text(w->entry_print_dateformat, _("Specify a format for the date and time stamp which is added to the page header on each page. You can use any conversion specifiers which can be used with the ANSI C strftime function."));
424
421
gtk_entry_set_text(GTK_ENTRY(w->entry_print_dateformat), printing_prefs.page_header_datefmt);
426
423
on_page_header_toggled(GTK_TOGGLE_BUTTON(w->check_print_pageheader), w);
921
#if GTK_CHECK_VERSION(2, 10, 0)
922
if (gtk_check_version(2, 10, 0) == NULL && printing_prefs.use_gtk_printing)
917
if (printing_prefs.use_gtk_printing)
923
918
printing_print_gtk(doc);
926
920
print_external(doc);