X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/565ed8bfd80a39ed13f3314c0fe9e66bd54c4d5a..3dd30495169b650e8a37699d714f183691d8f2c5:/src/gtk/print.cpp?ds=sidebyside diff --git a/src/gtk/print.cpp b/src/gtk/print.cpp index ec14f2c4c9..f45ec9c043 100644 --- a/src/gtk/print.cpp +++ b/src/gtk/print.cpp @@ -31,7 +31,6 @@ #endif #include "wx/fontutil.h" -#include "wx/gtk/private.h" #include "wx/dynlib.h" #include "wx/paper.h" @@ -75,7 +74,7 @@ public: { #if wxUSE_LIBGNOMEPRINT // This module must be initialized AFTER gnomeprint's one - AddDependency(CLASSINFO(wxGnomePrintModule)); + AddDependency(wxCLASSINFO(wxGnomePrintModule)); #endif } bool OnInit(); @@ -620,8 +619,6 @@ wxGtkPrintDialog::~wxGtkPrintDialog() // This is called even if we actually don't want the dialog to appear. int wxGtkPrintDialog::ShowModal() { - GtkPrintOperationResult response; - // We need to restore the settings given in the constructor. wxPrintData data = m_printDialogData.GetPrintData(); wxGtkPrintNativeData *native = @@ -655,10 +652,17 @@ int wxGtkPrintDialog::ShowModal() // Show the dialog if needed. GError* gError = NULL; - if (GetShowDialog()) - response = gtk_print_operation_run (printOp, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, GTK_WINDOW(gtk_widget_get_toplevel(m_parent->m_widget) ), &gError); - else - response = gtk_print_operation_run (printOp, GTK_PRINT_OPERATION_ACTION_PRINT, GTK_WINDOW(gtk_widget_get_toplevel(m_parent->m_widget)), &gError); + GtkPrintOperationResult response = gtk_print_operation_run + ( + printOp, + GetShowDialog() + ? GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG + : GTK_PRINT_OPERATION_ACTION_PRINT, + m_parent + ? GTK_WINDOW(gtk_widget_get_toplevel(m_parent->m_widget)) + : NULL, + &gError + ); // Does everything went well? if (response == GTK_PRINT_OPERATION_RESULT_CANCEL) @@ -771,7 +775,9 @@ int wxGtkPageSetupDialog::ShowModal() title = _("Page Setup"); GtkWidget * dlg = gtk_page_setup_unix_dialog_new(title.utf8_str(), - GTK_WINDOW(m_parent->m_widget)); + m_parent + ? GTK_WINDOW(m_parent->m_widget) + : NULL); gtk_page_setup_unix_dialog_set_print_settings( GTK_PAGE_SETUP_UNIX_DIALOG(dlg), nativeData); @@ -1738,24 +1744,11 @@ void wxGtkPrinterDCImpl::DoDrawRotatedText(const wxString& text, wxCoord x, wxCo angle = -angle; - bool underlined = m_font.IsOk() && m_font.GetUnderlined(); - const wxScopedCharBuffer data = text.utf8_str(); - size_t datalen = strlen(data); - pango_layout_set_text( m_layout, data, datalen); - - if (underlined) - { - PangoAttrList *attrs = pango_attr_list_new(); - PangoAttribute *a = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE); - a->start_index = 0; - a->end_index = datalen; - pango_attr_list_insert(attrs, a); - pango_layout_set_attributes(m_layout, attrs); - pango_attr_list_unref(attrs); - } + pango_layout_set_text(m_layout, data, data.length()); + const bool setAttrs = m_font.GTKSetPangoAttrs(m_layout); if (m_textForegroundColour.IsOk()) { unsigned char red = m_textForegroundColour.Red(); @@ -1816,7 +1809,7 @@ void wxGtkPrinterDCImpl::DoDrawRotatedText(const wxString& text, wxCoord x, wxCo cairo_restore( m_cairo ); - if (underlined) + if (setAttrs) { // Undo underline attributes setting pango_layout_set_attributes(m_layout, NULL);