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.
This commit is contained in:
Artur Wieczorek
2017-05-25 23:14:47 +02:00
parent 3543ae0177
commit 8f8534361c

View File

@@ -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