~ubuntu-branches/ubuntu/utopic/geany/utopic

« back to all changes in this revision

Viewing changes to src/printing.c

  • Committer: Package Import Robot
  • Author(s): Chow Loong Jin
  • Date: 2011-12-10 07:43:26 UTC
  • mfrom: (3.3.7 sid)
  • Revision ID: package-import@ubuntu.com-20111210074326-s8yqbew5i20h33tf
Tags: 0.21-1ubuntu1
* Merge from Debian Unstable, remaining changes:
  - debian/patches/20_use_evince_viewer.patch:
     + use evince as viewer for pdf and dvi files
  - debian/patches/20_use_x_terminal_emulator.patch:
     + use x-terminal-emulator as terminal
  - debian/control
     + Add breaks on geany-plugins-common << 0.20
* Also fixes bugs:
  - Filter for MATLAB/Octave files filters everythign (LP: 885505)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 *      printing.c - this file is part of Geany, a fast and lightweight IDE
3
3
 *
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>
6
6
 *
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.
20
20
 *
21
 
 * $Id: printing.c 5079 2010-07-01 16:22:45Z ntrel $
 
21
 * $Id: printing.c 5884 2011-08-06 18:33:04Z colombanw $
22
22
 */
23
23
 
24
24
 
25
25
/*
26
 
 * GTK 2.10 printing support
 
26
 * GTK printing support
27
27
 * (basic code layout were adopted from Sylpheed's printing implementation, thanks)
28
28
 */
29
29
 
48
48
PrintingPrefs printing_prefs;
49
49
 
50
50
 
51
 
#if GTK_CHECK_VERSION(2, 10, 0)
52
 
 
53
 
 
54
51
#define ROTATE_RGB(color) \
55
52
        (((color) & 0xFF0000) >> 16) + ((color) & 0x00FF00) + (((color) & 0x0000FF) << 16)
56
53
#define ADD_ATTR(l, a) \
311
308
        g_free(data);
312
309
 
313
310
        datetime = utils_get_date_time(printing_prefs.page_header_datefmt, &(dinfo->print_time));
314
 
        if (NZV(datetime))
 
311
        if (G_LIKELY(NZV(datetime)))
315
312
        {
316
313
                data = g_strdup_printf("<b>%s</b>", datetime);
317
314
                pango_layout_set_markup(layout, data, -1);
380
377
 
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);
385
382
 
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);
390
387
 
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);
396
393
 
408
405
 
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);
413
410
 
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);
425
422
 
426
423
        on_page_header_toggled(GTK_TOGGLE_BUTTON(w->check_print_pageheader), w);
514
511
        GeanyEditor *editor;
515
512
        cairo_t *cr;
516
513
        gdouble width, height;
517
 
        gdouble x, y;
 
514
        gdouble x = 0.0, y = 0.0;
518
515
        /*gint layout_h;*/
519
516
        gint count;
520
517
        GString *str;
861
858
 
862
859
        page_setup = new_page_setup;
863
860
}
864
 
#endif /* GTK 2.10 */
865
861
 
866
862
 
867
863
/* simple file print using an external tool */
918
914
        if (doc == NULL)
919
915
                return;
920
916
 
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);
924
919
        else
925
 
#endif
926
920
                print_external(doc);
927
921
}
928
922