Refactor return code in wxGtkPrinter::Print()

No real changes, just make it simpler to do other things before
returning successfully by handling error returns separately.

This is also more consistent with PrintDialog() method of the same
class.

No real changes.
This commit is contained in:
Vadim Zeitlin
2021-05-16 00:46:27 +02:00
parent 1a515725b3
commit 16ca2df0c4

View File

@@ -977,19 +977,23 @@ bool wxGtkPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt )
// doesn't necessarily show
int ret = dialog.ShowModal();
if (ret == wxID_CANCEL)
{
sm_lastError = wxPRINTER_CANCELLED;
}
if (ret == wxID_NO)
{
sm_lastError = wxPRINTER_ERROR;
}
printout->SetDC(NULL);
wxDELETE(m_dc);
return (sm_lastError == wxPRINTER_NO_ERROR);
if (ret == wxID_CANCEL)
{
sm_lastError = wxPRINTER_CANCELLED;
return false;
}
if (ret == wxID_NO)
{
sm_lastError = wxPRINTER_ERROR;
return false;
}
sm_lastError = wxPRINTER_NO_ERROR;
return true;
}
void wxGtkPrinter::BeginPrint(wxPrintout *printout, GtkPrintOperation *operation, GtkPrintContext *context)