From c2543cd474dc72260360283bb06edd285a352be0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 21 Apr 2015 15:48:17 +0200 Subject: [PATCH] Fix using custom paper format in wxOSX. Do actually use the custom paper object the code creates. Closes #16959. --- docs/changes.txt | 1 + src/osx/core/printmac.cpp | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 33e2efee07..b6b78063cf 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -623,6 +623,7 @@ wxOSX: - Compilation fix for wxWebView under 10.10. - Fix conversion of wxBitmap to wxImage in 64 bit builds. - Fix wxFileDialog::GetFilterIndex() for file open dialogs (phsilva). +- Fix custom paper support (tijsv). 3.0.2: (released 2014-10-06) diff --git a/src/osx/core/printmac.cpp b/src/osx/core/printmac.cpp index 148d1b65af..be3eb63aaa 100644 --- a/src/osx/core/printmac.cpp +++ b/src/osx/core/printmac.cpp @@ -198,8 +198,18 @@ void wxOSXPrintData::TransferPaperInfoFrom( const wxPrintData &data ) wxString id, name(wxT("Custom paper")); id.Printf(wxT("wxPaperCustom%dx%d"), papersize.x, papersize.y); - PMPaperCreateCustom(printer, wxCFStringRef( id, wxFont::GetDefaultEncoding() ), wxCFStringRef( name, wxFont::GetDefaultEncoding() ), - papersize.x, papersize.y, &margins, &paper); + if ( PMPaperCreateCustom + ( + printer, + wxCFStringRef(id, wxFont::GetDefaultEncoding()), + wxCFStringRef(name, wxFont::GetDefaultEncoding()), + papersize.x, papersize.y, + &margins, + &paper + ) ) + { + bestPaper = paper; + } } if ( bestPaper != kPMNoData ) {