[ wxwindows-Patches-1947680 ] wxMac: Fixes number of printouts and more
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53703 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -342,7 +342,12 @@ wxPrintDialogData::wxPrintDialogData(const wxPrintData& printData)
|
|||||||
m_printMinPage = 1;
|
m_printMinPage = 1;
|
||||||
m_printMaxPage = 9999;
|
m_printMaxPage = 9999;
|
||||||
m_printNoCopies = 1;
|
m_printNoCopies = 1;
|
||||||
|
// On Mac the Print dialog always defaults to "All Pages"
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
m_printAllPages = true;
|
||||||
|
#else
|
||||||
m_printAllPages = false;
|
m_printAllPages = false;
|
||||||
|
#endif
|
||||||
m_printCollate = false;
|
m_printCollate = false;
|
||||||
m_printToFile = false;
|
m_printToFile = false;
|
||||||
m_printSelection = false;
|
m_printSelection = false;
|
||||||
|
@@ -349,7 +349,11 @@ void wxMacCarbonPrintData::TransferTo( wxPrintDialogData* data )
|
|||||||
|
|
||||||
void wxMacCarbonPrintData::TransferFrom( wxPrintDialogData* data )
|
void wxMacCarbonPrintData::TransferFrom( wxPrintDialogData* data )
|
||||||
{
|
{
|
||||||
PMSetPageRange( m_macPrintSettings , data->GetMinPage() , data->GetMaxPage() ) ;
|
// Respect the value of m_printAllPages
|
||||||
|
if ( data->GetAllPages() )
|
||||||
|
PMSetPageRange( m_macPrintSettings , data->GetMinPage() , (UInt32) kPMPrintAllPages ) ;
|
||||||
|
else
|
||||||
|
PMSetPageRange( m_macPrintSettings , data->GetMinPage() , data->GetMaxPage() ) ;
|
||||||
PMSetCopies( m_macPrintSettings , data->GetNoCopies() , false ) ;
|
PMSetCopies( m_macPrintSettings , data->GetNoCopies() , false ) ;
|
||||||
PMSetFirstPage( m_macPrintSettings , data->GetFromPage() , false ) ;
|
PMSetFirstPage( m_macPrintSettings , data->GetFromPage() , false ) ;
|
||||||
|
|
||||||
@@ -457,58 +461,34 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
|
|||||||
m_printDialogData.SetMinPage(minPage);
|
m_printDialogData.SetMinPage(minPage);
|
||||||
m_printDialogData.SetMaxPage(maxPage);
|
m_printDialogData.SetMaxPage(maxPage);
|
||||||
|
|
||||||
wxWindow *win = CreateAbortWindow(parent, printout);
|
|
||||||
wxSafeYield(win,true);
|
|
||||||
|
|
||||||
if (!win)
|
|
||||||
{
|
|
||||||
wxEndBusyCursor();
|
|
||||||
wxMessageBox(wxT("Sorry, could not create an abort dialog."), wxT("Print Error"), wxOK, parent);
|
|
||||||
delete dc;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
sm_abortWindow = win;
|
|
||||||
sm_abortWindow->Show(true);
|
|
||||||
wxSafeYield(win,true);
|
|
||||||
|
|
||||||
printout->OnBeginPrinting();
|
printout->OnBeginPrinting();
|
||||||
|
|
||||||
bool keepGoing = true;
|
bool keepGoing = true;
|
||||||
|
|
||||||
int copyCount;
|
if (!printout->OnBeginDocument(m_printDialogData.GetFromPage(), m_printDialogData.GetToPage()))
|
||||||
for (copyCount = 1; copyCount <= m_printDialogData.GetNoCopies(); copyCount ++)
|
|
||||||
{
|
{
|
||||||
if (!printout->OnBeginDocument(m_printDialogData.GetFromPage(), m_printDialogData.GetToPage()))
|
|
||||||
{
|
|
||||||
wxEndBusyCursor();
|
wxEndBusyCursor();
|
||||||
wxMessageBox(wxT("Could not start printing."), wxT("Print Error"), wxOK, parent);
|
wxMessageBox(wxT("Could not start printing."), wxT("Print Error"), wxOK, parent);
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
if (sm_abortIt)
|
|
||||||
break;
|
|
||||||
|
|
||||||
int pn;
|
int pn;
|
||||||
for (pn = m_printDialogData.GetFromPage();
|
for (pn = m_printDialogData.GetFromPage();
|
||||||
keepGoing && (pn <= m_printDialogData.GetToPage()) && printout->HasPage(pn);
|
keepGoing && (pn <= m_printDialogData.GetToPage()) && printout->HasPage(pn);
|
||||||
pn++)
|
pn++)
|
||||||
|
{
|
||||||
|
if (sm_abortIt)
|
||||||
{
|
{
|
||||||
if (sm_abortIt)
|
|
||||||
{
|
|
||||||
keepGoing = false;
|
keepGoing = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxSafeYield(win,true);
|
|
||||||
dc->StartPage();
|
dc->StartPage();
|
||||||
keepGoing = printout->OnPrintPage(pn);
|
keepGoing = printout->OnPrintPage(pn);
|
||||||
dc->EndPage();
|
dc->EndPage();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
printout->OnEndDocument();
|
|
||||||
}
|
}
|
||||||
|
printout->OnEndDocument();
|
||||||
|
|
||||||
printout->OnEndPrinting();
|
printout->OnEndPrinting();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user