X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a70d268a1b43dc8ef2025b2beaeb5a595ba173fc..b718a533ac2c8406a786369b4eaa1c84f0039188:/src/common/docview.cpp diff --git a/src/common/docview.cpp b/src/common/docview.cpp index 86d1783490..680ff2bde4 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -425,7 +425,7 @@ bool wxDocument::Revert() #if WXWIN_COMPATIBILITY_2_8 bool wxDocument::GetPrintableName(wxString& buf) const { - // this function can not only be overridden by the user code but also + // this function cannot only be overridden by the user code but also // called by it so we need to ensure that we return the same thing as // GetUserReadableName() but we can't call it because this would result in // an infinite recursion, hence we use the helper DoGetUserReadableName() @@ -1976,8 +1976,27 @@ bool wxDocChildFrameAnyBase::CloseView(wxCloseEvent& event) #if wxUSE_PRINTING_ARCHITECTURE +namespace +{ + +wxString GetAppropriateTitle(const wxView *view, const wxString& titleGiven) +{ + wxString title(titleGiven); + if ( title.empty() ) + { + if ( view && view->GetDocument() ) + title = view->GetDocument()->GetUserReadableName(); + else + title = _("Printout"); + } + + return title; +} + +} // anonymous namespace + wxDocPrintout::wxDocPrintout(wxView *view, const wxString& title) - : wxPrintout(title) + : wxPrintout(GetAppropriateTitle(view, title)) { m_printoutView = view; }