Add new print button to pdf view.
authorwwp <wwp@free.fr>
Mon, 3 Apr 2017 10:30:04 +0000 (12:30 +0200)
committerwwp <wwp@free.fr>
Mon, 3 Apr 2017 10:30:04 +0000 (12:30 +0200)
src/pixmaps/printer.xpm
src/plugins/pdf_viewer/poppler_viewer.c
src/plugins/pdf_viewer/poppler_viewer.h
src/prefs_toolbar.c
src/stock_pixmap.c
src/stock_pixmap.h
src/toolbar.c

index eafee3a..aebc17f 100644 (file)
 /* XPM */
 static char * printer_xpm[] = {
-"24 24 109 2",
+"16 16 107 2",
 "      c None",
-".     c #AFB0AE",
-"+     c #FFFFFF",
-"@     c #FDFDFD",
-"#     c #E1E1E1",
-"$     c #CBCBCB",
-"%     c #CCCCCC",
-"&     c #CDCDCD",
-"*     c #CECECE",
-"=     c #E8E8E8",
-"-     c #E2E2E2",
-";     c #E4E4E4",
-">     c #E5E5E5",
-",     c #E7E7E7",
-"'     c #EAEAEA",
-")     c #CFCFCF",
-"!     c #EBEBEB",
-"~     c #E9E9E9",
-"{     c #ECECEC",
-"]     c #EEEEEE",
-"^     c #7D7E7B",
-"/     c #EDEDED",
-"(     c #F0F0F0",
-"_     c #F2F2F2",
-":     c #A3A3A0",
-"<     c #F1F0EE",
-"[     c #6E6E6C",
-"}     c #6C6C69",
-"|     c #878683",
-"1     c #ACABA8",
-"2     c #E4E4E3",
-"3     c #CBCBC9",
-"4     c #F7F7F7",
-"5     c #D3D3D3",
-"6     c #F0EFEE",
-"7     c #B0B0B0",
-"8     c #E7E7E6",
-"9     c #FBFBFB",
-"0     c #C3C3C3",
-"a     c #E9E9E8",
-"b     c #E8E7E7",
-"c     c #8B8B88",
-"d     c #BEBEBC",
-"e     c #959595",
-"f     c #F3F3F2",
-"g     c #BFBFBF",
-"h     c #E0E0DF",
-"i     c #F9F9F8",
-"j     c #F9F9F9",
-"k     c #FAFAFA",
-"l     c #F8F7F7",
-"m     c #F7F6F5",
-"n     c #F1F0F0",
-"o     c #7A7A77",
-"p     c #B8B8B8",
-"q     c #D4D4D4",
-"r     c #949494",
-"s     c #767574",
-"t     c #71716E",
-"u     c #6D6D6B",
-"v     c #6E6D6C",
-"w     c #6C6B69",
-"x     c #6B6968",
-"y     c #777775",
-"z     c #B4B4B4",
-"A     c #C4C4C4",
-"B     c #BABAB9",
-"C     c #ACABAA",
-"D     c #9C9C9A",
-"E     c #9E9C9A",
-"F     c #9D9C9B",
-"G     c #9C9B9A",
-"H     c #979795",
-"I     c #8B8A88",
-"J     c #81807F",
-"K     c #838380",
-"L     c #848481",
-"M     c #858583",
-"N     c #878785",
-"O     c #8E8D8A",
-"P     c #C0C0C0",
-"Q     c #B9BAB8",
-"R     c #B8B7B5",
-"S     c #B3B3B1",
-"T     c #ABABA9",
-"U     c #ABAAA9",
-"V     c #A8A8A7",
-"W     c #A6A5A4",
-"X     c #A7A7A7",
-"Y     c #A6A6A6",
-"Z     c #A5A4A3",
-"`     c #A3A3A1",
-" .    c #A2A2A0",
-"..    c #A1A19F",
-"+.    c #9F9F9D",
-"@.    c #9E9E9E",
-"#.    c #ADADAD",
-"$.    c #C5C5C5",
-"%.    c #9F9F9F",
-"&.    c #8A8B88",
-"*.    c #767774",
-"=.    c #B7B7B5",
-"-.    c #BCBCBC",
-";.    c #BDBDBD",
-">.    c #BCBCBB",
-",.    c #BABAB8",
-"'.    c #B5B5B4",
-").    c #ABABAB",
-"!.    c #787977",
-"                                                ",
-"                                                ",
-"            . . . . . . . . . . . .             ",
-"            . + @ @ @ @ @ @ @ @ + .             ",
-"            . + # $ $ $ % & * = + .             ",
-"            . + # # - ; > , = ' + .             ",
-"            . + # % & & * ) ) ! + .             ",
-"            . + - ; > , = ~ ! { + .             ",
-"            . + ; & * ) ' ! { ] + .             ",
-"          ^ . + > , = ' ! / ] ( + . ^           ",
-"        ^ + . _ > > > > > > > > _ . : ^         ",
-"      ^ + < . [ } } } } } } } } | 1 2 3 ^       ",
-"    ^ + + 4 + + + + + + + + + + + + ~ ~ 5 ^     ",
-"    ^ 6 7 8 9 0 / { ] ] ! a a b a a a c d ^     ",
-"    ^ 5 e f g h i j 9 k 9 9 l l l m n o p ^     ",
-"    ^ q r s t [ u [ v u u } } w x t [ y z ^     ",
-"    ^ A B C D E F F G H I J K L M M N O z ^     ",
-"    ^ P Q R S T U V V W X Y Z `  ...+.@.#.^     ",
-"    ^ ^ $.^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ %.&.*.    ",
-"      ^ =.-.;.g g g g >.-.-.>.,.,.,.'.).^       ",
-"      ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ !.      ",
-"                                                ",
-"                                                ",
-"                                                "};
+".     c #AEAFAD",
+"+     c #B1B2B0",
+"@     c #ADAEAC",
+"#     c #C7C7C6",
+"$     c #FEFEFE",
+"%     c #E9E9E9",
+"&     c #EAEAE9",
+"*     c #FFFFFF",
+"=     c #C6C7C6",
+"-     c #CACAC9",
+";     c #F0F0F0",
+">     c #D1D1D1",
+",     c #D5D5D5",
+"'     c #D7D7D7",
+")     c #F7F7F7",
+"!     c #C9C9C8",
+"~     c #C9CAC9",
+"{     c #F3F3F3",
+"]     c #D9D9D9",
+"^     c #FBFAFB",
+"/     c #C8C9C8",
+"(     c #C9CAC8",
+"_     c #F5F5F5",
+":     c #D4D4D4",
+"<     c #D8D8D8",
+"[     c #EDEDED",
+"}     c #EEEEEE",
+"|     c #FDFCFD",
+"1     c #91928F",
+"2     c #CDCECD",
+"3     c #F2F2F2",
+"4     c #F8F8F8",
+"5     c #CACBC9",
+"6     c #757673",
+"7     c #989997",
+"8     c #FEFEFD",
+"9     c #A8A8A6",
+"0     c #8F8E8D",
+"a     c #8D8D8B",
+"b     c #8E8E8C",
+"c     c #8C8C8A",
+"d     c #949492",
+"e     c #AEADAA",
+"f     c #CFCFCD",
+"g     c #8E8F8C",
+"h     c #7A7B78",
+"i     c #FAFAFA",
+"j     c #EAEAEA",
+"k     c #F1F1F1",
+"l     c #F1F1F0",
+"m     c #F8F8F7",
+"n     c #E5E5E5",
+"o     c #C8C8C7",
+"p     c #81827F",
+"q     c #B9B9B9",
+"r     c #CACACA",
+"s     c #E8E8E7",
+"t     c #F4F4F4",
+"u     c #F2F2F1",
+"v     c #F1F0F0",
+"w     c #FAF9F9",
+"x     c #C3C3C1",
+"y     c #969694",
+"z     c #828380",
+"A     c #7F807D",
+"B     c #BFBFBF",
+"C     c #858484",
+"D     c #757472",
+"E     c #797876",
+"F     c #787776",
+"G     c #767674",
+"H     c #6F6E6C",
+"I     c #6C6C69",
+"J     c #6D6C6A",
+"K     c #706F6D",
+"L     c #6D6D6B",
+"M     c #A3A3A2",
+"N     c #7B7C79",
+"O     c #BEBEBE",
+"P     c #B9B9B7",
+"Q     c #ACACAA",
+"R     c #A9A8A7",
+"S     c #A7A7A6",
+"T     c #A5A5A3",
+"U     c #9E9E9D",
+"V     c #9B9A99",
+"W     c #9A9A98",
+"X     c #999997",
+"Y     c #A9A8A8",
+"Z     c #7D7E7B",
+"`     c #ADADAC",
+" .    c #949593",
+"..    c #989897",
+"+.    c #979895",
+"@.    c #969693",
+"#.    c #9E9F9E",
+"$.    c #919290",
+"%.    c #959694",
+"&.    c #989896",
+"*.    c #979896",
+"=.    c #979795",
+"-.    c #969795",
+";.    c #959693",
+">.    c #969794",
+",.    c #939492",
+"'.    c #7D7E7C",
+"                                ",
+"        . . + + + + @ .         ",
+"        # $ % % & % * =         ",
+"        - ; > , ' ' ) !         ",
+"        ~ { , ] ' ' ^ /         ",
+"        ( _ : < [ } | /         ",
+"      1 2 * 3 _ 4 4 * 5 6       ",
+"    7 8 9 0 a a b c d e f g     ",
+"  h 3 ; i j { { k l ; m n o h   ",
+"  p q r > s _ t t u v w x y z   ",
+"  A B C D E F G H I J K L M p   ",
+"  N O P Q R S T U V W X y Y Z   ",
+"    y `  .....+...7 +.@.#.$.    ",
+"    p %.&.*.&.=.-.-.;.>.,.'.    ",
+"                                ",
+"                                "};
index bdfdbbf..af3f19d 100644 (file)
@@ -30,6 +30,7 @@
 #include "gtk/gtkutils.h"
 #include "gtk/inputdialog.h"
 #include "mimeview.h"
+#include "summaryview.h"
 #ifndef POPPLER_WITH_GDK
 #include "stdbool.h"
 #endif
@@ -82,6 +83,7 @@ static void pdf_viewer_spin_change_page_cb(GtkSpinButton *button, PdfViewer *vie
 static void pdf_viewer_spin_zoom_scroll_cb(GtkSpinButton *button, PdfViewer *viewer);
 /* Show/Hide the index pane */
 static void pdf_viewer_show_document_index_cb(GtkButton *button, PdfViewer *viewer);
+static void pdf_viewer_button_print_cb(GtkButton *button, PdfViewer *viewer);
 static void pdf_viewer_button_document_info_cb(GtkButton *button, PdfViewer *viewer);
 
 static void pdf_viewer_show_controls(PdfViewer *viewer, gboolean show);
@@ -1172,6 +1174,12 @@ static void pdf_viewer_show_document_index_cb(GtkButton *button, PdfViewer *view
 
 }
 
+static void pdf_viewer_button_print_cb(GtkButton *button, PdfViewer *viewer)
+{
+       MainWindow *mainwin = mainwindow_get_mainwindow();
+       summary_print(mainwin->summaryview);
+}
+
 static void pdf_viewer_button_document_info_cb(GtkButton *button, PdfViewer *viewer)
 {
        alertpanel_full(_("PDF properties"), NULL, GTK_STOCK_CLOSE, NULL, NULL,
@@ -1212,6 +1220,7 @@ static void pdf_viewer_show_controls(PdfViewer *viewer, gboolean show)
                gtk_widget_show(viewer->widgets_table);
                gtk_widget_show(viewer->rotate_right);
                gtk_widget_show(viewer->rotate_left);
+               gtk_widget_show(viewer->print);
                gtk_widget_show(viewer->doc_info);
                gtk_widget_show(viewer->doc_index);
        } else {
@@ -1224,12 +1233,13 @@ static void pdf_viewer_show_controls(PdfViewer *viewer, gboolean show)
                gtk_widget_hide(viewer->zoom_out);
                gtk_widget_hide(viewer->zoom_fit);
                gtk_widget_hide(viewer->zoom_width);
+               gtk_widget_hide(viewer->zoom_scroll);
                gtk_widget_hide(viewer->widgets_table);
                gtk_widget_hide(viewer->rotate_right);
                gtk_widget_hide(viewer->rotate_left);
+               gtk_widget_show(viewer->print);
                gtk_widget_hide(viewer->doc_info);
                gtk_widget_hide(viewer->doc_index);
-               gtk_widget_hide(viewer->zoom_scroll);
        }
 }
 /** Render the current page, page_num on the viewer */
@@ -1763,6 +1773,7 @@ static MimeViewer *pdf_viewer_create(void)
        ADD_BUTTON_TO_TABLE(viewer->rotate_left, STOCK_PIXMAP_ROTATE_LEFT)
        ADD_BUTTON_TO_TABLE(viewer->rotate_right, STOCK_PIXMAP_ROTATE_RIGHT)
        ADD_SEP_TO_TABLE
+       ADD_BUTTON_TO_TABLE(viewer->print, STOCK_PIXMAP_PRINTER)
        ADD_BUTTON_TO_TABLE(viewer->doc_info, STOCK_PIXMAP_DOC_INFO)
        ADD_BUTTON_TO_TABLE(viewer->doc_index, STOCK_PIXMAP_DOC_INDEX)
 
@@ -1880,6 +1891,8 @@ static MimeViewer *pdf_viewer_create(void)
        g_object_ref(GTK_WIDGET(viewer->rotate_right));
        gtk_widget_show(GTK_WIDGET(viewer->rotate_left));
        g_object_ref(GTK_WIDGET(viewer->rotate_left));
+       gtk_widget_show(GTK_WIDGET(viewer->print));
+       g_object_ref(GTK_WIDGET(viewer->print));
        gtk_widget_show(GTK_WIDGET(viewer->doc_info));
        g_object_ref(GTK_WIDGET(viewer->doc_info));
        gtk_widget_show(GTK_WIDGET(viewer->doc_index));
@@ -1927,6 +1940,9 @@ static MimeViewer *pdf_viewer_create(void)
        CLAWS_SET_TIP(viewer->rotate_right,
                                _("Rotate Right"));
 
+       CLAWS_SET_TIP(viewer->print,
+                               _("Print Document"));
+
        CLAWS_SET_TIP(viewer->doc_info,
                                _("Document Info"));
 
@@ -1991,6 +2007,11 @@ static MimeViewer *pdf_viewer_create(void)
                                    G_CALLBACK(pdf_viewer_button_rotate_left_cb), 
                                   (gpointer) viewer);
 
+       g_signal_connect(G_OBJECT(viewer->print), 
+                                   "clicked", 
+                                   G_CALLBACK(pdf_viewer_button_print_cb), 
+                                  (gpointer) viewer);
+
        g_signal_connect(G_OBJECT(viewer->doc_info), 
                                    "clicked", 
                                    G_CALLBACK(pdf_viewer_button_document_info_cb), 
index a843aec..14dfd21 100644 (file)
@@ -85,6 +85,7 @@ struct _PdfViewer
        GtkWidget                       *zoom_width;
        GtkWidget                       *rotate_left;
        GtkWidget                       *rotate_right;
+       GtkWidget                       *print;
        GtkWidget                       *doc_info;
        GtkWidget                       *doc_index;
        /* end GtkButtons */
index d05b050..e8ce780 100644 (file)
@@ -128,7 +128,7 @@ static const gint ToolbarIcons[] =
        STOCK_PIXMAP_MIME_PS,
        STOCK_PIXMAP_MIME_TEXT_CALENDAR,
        STOCK_PIXMAP_MIME_PGP_SIG,
-       STOCK_PIXMAP_PRINTER,
+       STOCK_PIXMAP_PRINTER_BTN,
        STOCK_PIXMAP_PRIVACY_SIGNED,
        STOCK_PIXMAP_PRIVACY_PASSED,
        STOCK_PIXMAP_PRIVACY_FAILED,
index 58fc013..2c84151 100644 (file)
@@ -393,6 +393,7 @@ static StockPixmapData pixmaps[] =
     {mime_ps_xpm                      , NULL, NULL, "mime_ps", NULL, NULL},
     {mime_calendar_xpm                , NULL, NULL, "mime_calendar", NULL, NULL},
     {mime_pgpsig_xpm                  , NULL, NULL, "mime_pgpsig", NULL, NULL},
+    {printer_btn_xpm                  , NULL, NULL, "printer_btn", NULL, NULL},
     {printer_xpm                      , NULL, NULL, "printer", NULL, NULL},
     {privacy_signed_xpm               , NULL, NULL, "privacy_signed", NULL, NULL},
     {privacy_passed_xpm               , NULL, NULL, "privacy_passed", NULL, NULL},
index 87fa1c4..38b38ad 100644 (file)
@@ -147,6 +147,7 @@ typedef enum
        STOCK_PIXMAP_MIME_PS,
        STOCK_PIXMAP_MIME_TEXT_CALENDAR,
        STOCK_PIXMAP_MIME_PGP_SIG,
+       STOCK_PIXMAP_PRINTER_BTN,
        STOCK_PIXMAP_PRINTER,
        STOCK_PIXMAP_PRIVACY_SIGNED,
        STOCK_PIXMAP_PRIVACY_PASSED,
index c5a5785..1835683 100644 (file)
@@ -567,7 +567,7 @@ gint toolbar_get_icon(int action) {
        case A_READ:            return STOCK_PIXMAP_MARK_READ;
        case A_UNREAD:          return STOCK_PIXMAP_MARK_UNREAD;
 
-       case A_PRINT:           return STOCK_PIXMAP_PRINTER;
+       case A_PRINT:           return STOCK_PIXMAP_PRINTER_BTN;
        case A_LEARN_SPAM:      return STOCK_PIXMAP_SPAM_BTN;
        case A_GO_FOLDERS:      return STOCK_PIXMAP_GO_FOLDERS;
        case A_PREFERENCES:     return STOCK_PIXMAP_PREFERENCES;