From ccb2be5b123c97188817d8c0077b03b0f999502b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 9 Mar 2013 15:08:21 +0000 Subject: [PATCH] Test PostScript printing in the print sample if it is compiled in. Just use wxUSE_POSTSCRIPT instead of wxTEST_POSTSCRIPT_IN_MSW and also do it under all platforms, not just MSW. See #1244. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73628 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/printing/printing.cpp | 22 ++++++++++------------ samples/printing/printing.h | 2 +- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/samples/printing/printing.cpp b/samples/printing/printing.cpp index 07c7769912..1cd7cd90d8 100644 --- a/samples/printing/printing.cpp +++ b/samples/printing/printing.cpp @@ -25,10 +25,6 @@ #error "You must set wxUSE_PRINTING_ARCHITECTURE to 1 in setup.h, and recompile the library." #endif -// Set this to 1 if you want to test PostScript printing under MSW. -// However, you'll also need to edit src/msw/makefile.nt. -#define wxTEST_POSTSCRIPT_IN_MSW 0 - #include #include "wx/metafile.h" #include "wx/print.h" @@ -36,7 +32,7 @@ #include "wx/image.h" #include "wx/accel.h" -#if wxTEST_POSTSCRIPT_IN_MSW +#if wxUSE_POSTSCRIPT #include "wx/generic/printps.h" #include "wx/generic/prntdlgg.h" #endif @@ -277,7 +273,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(wxID_PREVIEW, MyFrame::OnPrintPreview) EVT_MENU(WXPRINT_PAGE_SETUP, MyFrame::OnPageSetup) EVT_MENU(wxID_ABOUT, MyFrame::OnPrintAbout) -#if defined(__WXMSW__) &&wxTEST_POSTSCRIPT_IN_MSW +#if wxUSE_POSTSCRIPT EVT_MENU(WXPRINT_PRINT_PS, MyFrame::OnPrintPS) EVT_MENU(WXPRINT_PREVIEW_PS, MyFrame::OnPrintPreviewPS) EVT_MENU(WXPRINT_PAGE_SETUP_PS, MyFrame::OnPageSetupPS) @@ -331,7 +327,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString&title, const wxPoint&pos, const SetAcceleratorTable(accel); #endif -#if defined(__WXMSW__) &&wxTEST_POSTSCRIPT_IN_MSW +#if wxUSE_POSTSCRIPT file_menu->AppendSeparator(); file_menu->Append(WXPRINT_PRINT_PS, wxT("Print PostScript..."), wxT("Print (PostScript)")); file_menu->Append(WXPRINT_PAGE_SETUP_PS, wxT("Page Setup PostScript..."), wxT("Page setup (PostScript)")); @@ -425,21 +421,23 @@ void MyFrame::OnPageSetup(wxCommandEvent& WXUNUSED(event)) (*g_pageSetupData) = pageSetupDialog.GetPageSetupDialogData(); } -#if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW +#if wxUSE_POSTSCRIPT void MyFrame::OnPrintPS(wxCommandEvent& WXUNUSED(event)) { - wxPostScriptPrinter printer(g_printData); - MyPrintout printout(wxT("My printout")); + wxPrintDialogData printDialogData(* g_printData); + + wxPostScriptPrinter printer(&printDialogData); + MyPrintout printout(this, wxT("My printout")); printer.Print(this, &printout, true/*prompt*/); - (*g_printData) = printer.GetPrintData(); + (*g_printData) = printer.GetPrintDialogData().GetPrintData(); } void MyFrame::OnPrintPreviewPS(wxCommandEvent& WXUNUSED(event)) { // Pass two printout objects: for preview, and possible printing. wxPrintDialogData printDialogData(* g_printData); - wxPrintPreview *preview = new wxPrintPreview(new MyPrintout, new MyPrintout, &printDialogData); + wxPrintPreview *preview = new wxPrintPreview(new MyPrintout(this), new MyPrintout(this), &printDialogData); wxPreviewFrame *frame = new wxPreviewFrame(preview, this, wxT("Demo Print Preview"), wxPoint(100, 100), wxSize(600, 650)); frame->Centre(wxBOTH); diff --git a/samples/printing/printing.h b/samples/printing/printing.h index a138d541b4..868568ef0c 100644 --- a/samples/printing/printing.h +++ b/samples/printing/printing.h @@ -49,7 +49,7 @@ public: void OnPrint(wxCommandEvent& event); void OnPrintPreview(wxCommandEvent& event); void OnPageSetup(wxCommandEvent& event); -#if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW +#if wxUSE_POSTSCRIPT void OnPrintPS(wxCommandEvent& event); void OnPrintPreviewPS(wxCommandEvent& event); void OnPageSetupPS(wxCommandEvent& event); -- 2.45.2