X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6aacfc7320dd6e5e145848b4f25630d675f8fb10..777469ca936965a1ed15f70f3fe81f665833bf6a:/samples/printing/printing.cpp?ds=sidebyside diff --git a/samples/printing/printing.cpp b/samples/printing/printing.cpp index 14f6545912..89ef0ccd87 100644 --- a/samples/printing/printing.cpp +++ b/samples/printing/printing.cpp @@ -4,7 +4,6 @@ // Author: Julian Smart // Modified by: Francesco Montorsi // Created: 1995 -// RCS-ID: $Id$ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -25,10 +24,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 +31,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 @@ -51,7 +46,7 @@ #include "printing.h" -#if !defined(__WXMSW__) && !defined(__WXPM__) +#ifndef wxHAS_IMAGES_IN_RESOURCES #include "../sample.xpm" #endif @@ -161,7 +156,7 @@ void MyApp::Draw(wxDC&dc) dc.DrawText( wxT("Rectangle 200 by 80"), 40, 40); - dc.SetPen( wxPen(*wxBLACK,0,wxDOT_DASH) ); + dc.SetPen( wxPen(*wxBLACK, 0, wxPENSTYLE_DOT_DASH) ); dc.DrawEllipse(50, 140, 100, 50); dc.SetPen(*wxRED_PEN); @@ -277,7 +272,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 +326,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)")); @@ -410,7 +405,7 @@ void MyFrame::OnPrintPreview(wxCommandEvent& WXUNUSED(event)) wxPreviewFrame *frame = new wxPreviewFrame(preview, this, wxT("Demo Print Preview"), wxPoint(100, 100), wxSize(600, 650)); frame->Centre(wxBOTH); - frame->Initialize(m_previewModality); + frame->InitializeWithModality(m_previewModality); frame->Show(); } @@ -425,21 +420,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);