X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=libview%2Fev-print-operation.c;h=85ba06c2fe158be29a80875d0ee91f09176c6564;hb=d7fb55dfd86a0f5d5789f9a6dcc2ec32c2d40a33;hp=4c6d03610b420f40f79bca5b04f00af4f7cbef9d;hpb=7a84044cdf9470e21fd8c2d65b253a4eeed203fc;p=evince.git diff --git a/libview/ev-print-operation.c b/libview/ev-print-operation.c index 4c6d0361..85ba06c2 100644 --- a/libview/ev-print-operation.c +++ b/libview/ev-print-operation.c @@ -338,11 +338,11 @@ ev_print_operation_update_status (EvPrintOperation *op, if (page == -1) { /* Initial state */ - op->status = g_strdup (_("Preparing to print ...")); + op->status = g_strdup (_("Preparing to print…")); } else if (page > n_pages) { - op->status = g_strdup (_("Finishing...")); + op->status = g_strdup (_("Finishing…")); } else { - op->status = g_strdup_printf (_("Printing page %d of %d..."), + op->status = g_strdup_printf (_("Printing page %d of %d…"), page, n_pages); } @@ -1234,7 +1234,7 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial "%s", _("Invalid page selection")); gtk_window_set_title (GTK_WINDOW (message_dialog), _("Warning")); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message_dialog), - "%s", _("Your print range selection does not include any page")); + "%s", _("Your print range selection does not include any pages")); g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL); @@ -1522,6 +1522,7 @@ typedef enum { #define EV_PRINT_SETTING_PAGE_SCALE "evince-print-setting-page-scale" #define EV_PRINT_SETTING_AUTOROTATE "evince-print-setting-page-autorotate" +#define EV_PRINT_SETTING_PAGE_SIZE "evince-print-setting-page-size" struct _EvPrintOperationPrint { EvPrintOperation parent; @@ -1537,6 +1538,8 @@ struct _EvPrintOperationPrint { EvPrintScale page_scale; GtkWidget *autorotate_button; gboolean autorotate; + GtkWidget *source_button; + gboolean use_source_size; }; struct _EvPrintOperationPrintClass { @@ -1734,16 +1737,24 @@ ev_print_operation_print_request_page_setup (EvPrintOperationPrint *print, { EvPrintOperation *op = EV_PRINT_OPERATION (print); gdouble width, height; - - if (!print->autorotate) - return; + GtkPaperSize *paper_size; ev_document_get_page_size (op->document, page_nr, &width, &height); - if (width > height) - gtk_page_setup_set_orientation (setup, GTK_PAGE_ORIENTATION_LANDSCAPE); - else - gtk_page_setup_set_orientation (setup, GTK_PAGE_ORIENTATION_PORTRAIT); + + if (print->use_source_size) { + paper_size = gtk_paper_size_new_custom ("custom", "custom", + width, height, GTK_UNIT_POINTS); + gtk_page_setup_set_paper_size_and_default_margins (setup, paper_size); + gtk_paper_size_free (paper_size); + } + + if (print->autorotate) { + if (width > height) + gtk_page_setup_set_orientation (setup, GTK_PAGE_ORIENTATION_LANDSCAPE); + else + gtk_page_setup_set_orientation (setup, GTK_PAGE_ORIENTATION_PORTRAIT); + } } static void @@ -1862,15 +1873,17 @@ ev_print_operation_print_create_custom_widget (EvPrintOperationPrint *print, GtkWidget *label; GtkWidget *table; EvPrintScale page_scale; - gboolean autorotate = TRUE; + gboolean autorotate; + gboolean use_source_size; settings = gtk_print_operation_get_print_settings (print->op); page_scale = gtk_print_settings_get_int_with_default (settings, EV_PRINT_SETTING_PAGE_SCALE, 0); autorotate = gtk_print_settings_has_key (settings, EV_PRINT_SETTING_AUTOROTATE) ? gtk_print_settings_get_bool (settings, EV_PRINT_SETTING_AUTOROTATE) : TRUE; + use_source_size = gtk_print_settings_get_bool (settings, EV_PRINT_SETTING_PAGE_SIZE); - table = gtk_table_new (2, 2, FALSE); + table = gtk_table_new (3, 2, FALSE); gtk_table_set_row_spacings (GTK_TABLE (table), 6); gtk_table_set_col_spacings (GTK_TABLE (table), 12); gtk_container_set_border_width (GTK_CONTAINER (table), 12); @@ -1890,7 +1903,7 @@ ev_print_operation_print_create_custom_widget (EvPrintOperationPrint *print, "• \"None\": No page scaling is performed.\n" "\n" "• \"Shrink to Printable Area\": Document pages larger than the printable area" - " are reduced fit the printable area of the printer page.\n" + " are reduced to fit the printable area of the printer page.\n" "\n" "• \"Fit to Printable Area\": Document pages are enlarged or reduced as" " required to fit the printable area of the printer page.\n")); @@ -1905,6 +1918,13 @@ ev_print_operation_print_create_custom_widget (EvPrintOperationPrint *print, gtk_table_attach (GTK_TABLE (table), print->autorotate_button, 0, 2, 1, 2, GTK_FILL, 0, 0, 0); gtk_widget_show (print->autorotate_button); + print->source_button = gtk_check_button_new_with_label (_("Select page size using document page size")); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (print->source_button), use_source_size); + gtk_widget_set_tooltip_text (print->source_button, _("When enabled, each page will be printed on " + "the same size paper as the document page.")); + gtk_table_attach (GTK_TABLE (table), print->source_button, 0, 2, 2, 3, GTK_FILL, 0, 0, 0); + gtk_widget_show (print->source_button); + return G_OBJECT (table); } @@ -1916,9 +1936,11 @@ ev_print_operation_print_custom_widget_apply (EvPrintOperationPrint *print, print->page_scale = gtk_combo_box_get_active (GTK_COMBO_BOX (print->scale_combo)); print->autorotate = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (print->autorotate_button)); + print->use_source_size = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (print->source_button)); settings = gtk_print_operation_get_print_settings (print->op); gtk_print_settings_set_int (settings, EV_PRINT_SETTING_PAGE_SCALE, print->page_scale); gtk_print_settings_set_bool (settings, EV_PRINT_SETTING_AUTOROTATE, print->autorotate); + gtk_print_settings_set_bool (settings, EV_PRINT_SETTING_PAGE_SIZE, print->use_source_size); } static void @@ -2040,6 +2062,8 @@ ev_print_operation_new (EvDocument *document) #if GTKUNIXPRINT_ENABLED op = EV_PRINT_OPERATION (g_object_new (EV_TYPE_PRINT_OPERATION_EXPORT, "document", document, NULL)); +#else + op = NULL; #endif return op; }