Add wxPrintout::SetUp() to reuse the same code in all ports

MSW, GTK, OSX and Postscript implementations all did almost exactly the
same thing to initialize wxPrintout, so extract this common code into a
new wxPrintout method and just call it instead.

There should be no changes in behaviour.
This commit is contained in:
Vadim Zeitlin
2018-05-23 17:52:31 +02:00
parent b6f0693a41
commit 048b7f44ec
6 changed files with 37 additions and 65 deletions

View File

@@ -585,8 +585,6 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
return false;
}
printout->SetPPIScreen(wxGetDisplayPPI());
PMResolution res;
PMPrinter printer;
wxOSXPrintData* nativeData = (wxOSXPrintData*)
@@ -607,15 +605,7 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
printout->SetPPIPrinter(int(res.hRes), int(res.vRes));
// Set printout parameters
printout->SetDC(dc);
int w, h;
dc->GetSize(&w, &h);
printout->SetPageSizePixels((int)w, (int)h);
printout->SetPaperRectPixels(dc->GetPaperRect());
wxCoord mw, mh;
dc->GetSizeMM(&mw, &mh);
printout->SetPageSizeMM((int)mw, (int)mh);
printout->SetUp(*dc);
// Create an abort window
wxBeginBusyCursor();