Revert "Fix the pages range in the print dialog in wxOSX."

This reverts r72805 (leaving only the changes to printdlg.cpp which seem
harmless and potentially useful) as it resulted in crashes when using
wxHtmlEasyPrinting because we called wxPrintout::OnPreparePrinting() before
setting the DC to be used, which was wrong.

In fact it's not clear how can we get the correct range of pages at all
because we need a DC to paginate properly (i.e. taking into account its size)
but we need to show a dialog, in which we already want to show the pages
range, before choosing the DC. Perhaps we could create a dummy DC for
pagination purposes but how could this work with printers using different page
sizes?

The best would probably be to avoid setting any limits on the page range as
showing 9999 looks ugly but anything else would be wrong.

See #8349, #11779.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72883 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-11-04 23:49:42 +00:00
parent f0ac9552ed
commit d6e9e15066
2 changed files with 19 additions and 19 deletions

View File

@@ -604,7 +604,6 @@ wxMSW:
wxOSX/Cocoa:
- Fix pages range in the print dialog (Auria).
- Implement image support in wxNotebook (Malcolm MacLeod).
- Add support for button mnemonics (joostn).

View File

@@ -549,24 +549,6 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
return false;
}
printout->OnPreparePrinting();
// Get some parameters from the printout, if defined
int fromPage, toPage;
int minPage, maxPage;
printout->GetPageInfo(&minPage, &maxPage, &fromPage, &toPage);
if (maxPage == 0)
{
sm_lastError = wxPRINTER_ERROR;
return false;
}
// Only set min and max, because from and to will be
// set by the user
m_printDialogData.SetMinPage(minPage);
m_printDialogData.SetMaxPage(maxPage);
if (m_printDialogData.GetMinPage() < 1)
m_printDialogData.SetMinPage(1);
if (m_printDialogData.GetMaxPage() < 1)
@@ -629,8 +611,27 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
dc->GetSizeMM(&mw, &mh);
printout->SetPageSizeMM((int)mw, (int)mh);
// Create an abort window
wxBeginBusyCursor();
printout->OnPreparePrinting();
// Get some parameters from the printout, if defined
int fromPage, toPage;
int minPage, maxPage;
printout->GetPageInfo(&minPage, &maxPage, &fromPage, &toPage);
if (maxPage == 0)
{
sm_lastError = wxPRINTER_ERROR;
return false;
}
// Only set min and max, because from and to will be
// set by the user
m_printDialogData.SetMinPage(minPage);
m_printDialogData.SetMaxPage(maxPage);
printout->OnBeginPrinting();
bool keepGoing = true;