From 8f8534361cc1be8ed3c88028b7f945555881331e Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Thu, 25 May 2017 23:14:47 +0200 Subject: [PATCH] Set default print data in stc sample Basic paper parameters should be initialized with default values to allow paginating a document even if paper settings are not yet explicitly set by invoking "Print Setup" dialog. See #17107. --- samples/stc/stctest.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/samples/stc/stctest.cpp b/samples/stc/stctest.cpp index c7524bea2a..34ab8a87b5 100644 --- a/samples/stc/stctest.cpp +++ b/samples/stc/stctest.cpp @@ -32,6 +32,9 @@ #include "wx/settings.h" // system settings #include "wx/string.h" // strings support #include "wx/image.h" // images support +#if wxUSE_PRINTING_ARCHITECTURE +#include "wx/paper.h" +#endif // wxUSE_PRINTING_ARCHITECTURE //! application headers #include "defsext.h" // Additional definitions @@ -217,7 +220,14 @@ bool App::OnInit () { #if wxUSE_PRINTING_ARCHITECTURE // initialize print data and setup g_printData = new wxPrintData; + wxPrintPaperType *paper = wxThePrintPaperDatabase->FindPaperType(wxPAPER_A4); + g_printData->SetPaperId(paper->GetId()); + g_printData->SetPaperSize(paper->GetSize()); + g_printData->SetOrientation(wxPORTRAIT); + g_pageSetupData = new wxPageSetupDialogData; + // copy over initial paper size from print record + (*g_pageSetupData) = *g_printData; #endif // wxUSE_PRINTING_ARCHITECTURE // create application frame