git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24407
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
wxWindowsPrinter::~wxWindowsPrinter()
{
// avoids warning about statement with no effect (FreeProcInstance
wxWindowsPrinter::~wxWindowsPrinter()
{
// avoids warning about statement with no effect (FreeProcInstance
- // doesn't do anything under Win32)
+ // doesn't do anything under Win32)
#if !defined(__WIN32__) && !defined(__NT__)
FreeProcInstance((FARPROC) m_lpAbortProc);
#endif
#if !defined(__WIN32__) && !defined(__NT__)
FreeProcInstance((FARPROC) m_lpAbortProc);
#endif
bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
{
bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
{
sm_abortWindow = NULL;
if (!printout)
{
sm_lastError = wxPRINTER_ERROR;
sm_abortWindow = NULL;
if (!printout)
{
sm_lastError = wxPRINTER_ERROR;
- printout->SetIsPreview(FALSE);
+ printout->SetIsPreview(false);
if (m_printDialogData.GetMinPage() < 1)
m_printDialogData.SetMinPage(1);
if (m_printDialogData.GetMinPage() < 1)
m_printDialogData.SetMinPage(1);
{
dc = PrintDialog(parent);
if (!dc)
{
dc = PrintDialog(parent);
if (!dc)
if (!dc || !dc->Ok())
{
if (dc) delete dc;
if (!dc || !dc->Ok())
{
if (dc) delete dc;
{
delete dc;
sm_lastError = wxPRINTER_ERROR;
{
delete dc;
sm_lastError = wxPRINTER_ERROR;
}
printout->SetPPIScreen(logPPIScreenX, logPPIScreenY);
}
printout->SetPPIScreen(logPPIScreenX, logPPIScreenY);
{
sm_lastError = wxPRINTER_ERROR;
wxEndBusyCursor();
{
sm_lastError = wxPRINTER_ERROR;
wxEndBusyCursor();
}
// Only set min and max, because from and to have been
}
// Only set min and max, because from and to have been
delete dc;
}
sm_abortWindow = win;
delete dc;
}
sm_abortWindow = win;
- sm_abortWindow->Show(TRUE);
+ sm_abortWindow->Show();
wxSafeYield();
printout->OnBeginPrinting();
sm_lastError = wxPRINTER_NO_ERROR;
wxSafeYield();
printout->OnBeginPrinting();
sm_lastError = wxPRINTER_NO_ERROR;
+ int minPageNum = minPage, maxPageNum = maxPage;
+
+ if ( !m_printDialogData.GetAllPages() )
+ {
+ minPageNum = minPage;
+ maxPageNum = maxPage;
+ }
+ else
+ {
+ minPageNum = m_printDialogData.GetFromPage();
+ maxPageNum = m_printDialogData.GetToPage();
+ }
+
int copyCount;
for ( copyCount = 1;
copyCount <= m_printDialogData.GetNoCopies();
copyCount++ )
{
int copyCount;
for ( copyCount = 1;
copyCount <= m_printDialogData.GetNoCopies();
copyCount++ )
{
- if (!printout->OnBeginDocument(m_printDialogData.GetFromPage(), m_printDialogData.GetToPage()))
+ if ( !printout->OnBeginDocument(minPageNum, maxPageNum) )
{
wxEndBusyCursor();
wxLogError(_("Could not start printing."));
{
wxEndBusyCursor();
wxLogError(_("Could not start printing."));
- for ( pn = m_printDialogData.GetFromPage();
- pn <= m_printDialogData.GetToPage() && printout->HasPage(pn);
+
+ for ( pn = minPageNum;
+ pn <= maxPageNum && printout->HasPage(pn);
pn++ )
{
if ( sm_abortIt )
pn++ )
{
if ( sm_abortIt )
- sm_abortWindow->Show(FALSE);
+ sm_abortWindow->Show(false);
delete sm_abortWindow;
sm_abortWindow = NULL;
}
delete sm_abortWindow;
sm_abortWindow = NULL;
}
bool wxWindowsPrinter::Setup(wxWindow *parent)
{
wxPrintDialog dialog(parent, & m_printDialogData);
bool wxWindowsPrinter::Setup(wxWindow *parent)
{
wxPrintDialog dialog(parent, & m_printDialogData);
- dialog.GetPrintDialogData().SetSetupDialog(TRUE);
+ dialog.GetPrintDialogData().SetSetupDialog(true);
int ret = dialog.ShowModal();
int ret = dialog.ShowModal();
bool wxWindowsPrintPreview::Print(bool interactive)
{
if (!m_printPrintout)
bool wxWindowsPrintPreview::Print(bool interactive)
{
if (!m_printPrintout)
wxWindowsPrinter printer(&m_printDialogData);
return printer.Print(m_previewFrame, m_printPrintout, interactive);
}
wxWindowsPrinter printer(&m_printDialogData);
return printer.Print(m_previewFrame, m_printPrintout, interactive);
}
m_previewPrintout->SetPageSizeMM(printerWidth, printerHeight);
if (logPPIPrinterX == 0 || logPPIPrinterY == 0 || printerWidth == 0 || printerHeight == 0)
m_previewPrintout->SetPageSizeMM(printerWidth, printerHeight);
if (logPPIPrinterX == 0 || logPPIPrinterY == 0 || printerWidth == 0 || printerHeight == 0)
m_pageWidth = printerXRes;
m_pageHeight = printerYRes;
m_pageWidth = printerXRes;
m_pageHeight = printerYRes;