X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c0ed460c2e7802793d591c84f3cfdbff159c5549..f234c60c4aac2e077b16b8fbb3009ad45a84c73b:/samples/printing/printing.cpp diff --git a/samples/printing/printing.cpp b/samples/printing/printing.cpp index ae9b4126bb..4ace50d72a 100644 --- a/samples/printing/printing.cpp +++ b/samples/printing/printing.cpp @@ -22,7 +22,6 @@ #ifndef WX_PRECOMP #include "wx/wx.h" -#include "wx/postscrp.h" #endif #if !wxUSE_PRINTING_ARCHITECTURE @@ -132,6 +131,12 @@ bool MyApp::OnInit(void) return TRUE; } +int MyApp::OnExit() +{ + delete wxGetApp().m_testFont; + return 1; +} + BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(WXPRINT_QUIT, MyFrame::OnExit) EVT_MENU(WXPRINT_PRINT, MyFrame::OnPrint) @@ -161,11 +166,6 @@ void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnPrint(wxCommandEvent& WXUNUSED(event)) { -#ifdef __WXMSW__ - wxGetApp().SetPrintMode(wxPRINT_WINDOWS); -#else - wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT); -#endif wxPrinter printer; MyPrintout printout("My printout"); if (!printer.Print(this, &printout, TRUE)) @@ -174,11 +174,6 @@ void MyFrame::OnPrint(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnPrintPreview(wxCommandEvent& WXUNUSED(event)) { -#ifdef __WXMSW__ - wxGetApp().SetPrintMode(wxPRINT_WINDOWS); -#else - wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT); -#endif wxPrintData printData; printData.SetOrientation(orientation); @@ -199,19 +194,11 @@ void MyFrame::OnPrintPreview(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnPrintSetup(wxCommandEvent& WXUNUSED(event)) { -#ifdef __WXMSW__ - wxGetApp().SetPrintMode(wxPRINT_WINDOWS); -#else - wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT); -#endif wxPrintData data; data.SetOrientation(orientation); -#ifdef __WXMSW__ wxPrintDialog printerDialog(this, & data); -#else - wxGenericPrintDialog printerDialog(this, & data); -#endif + printerDialog.GetPrintData().SetSetupDialog(TRUE); printerDialog.ShowModal(); @@ -220,19 +207,10 @@ void MyFrame::OnPrintSetup(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnPageSetup(wxCommandEvent& WXUNUSED(event)) { -#ifdef __WXMSW__ - wxGetApp().SetPrintMode(wxPRINT_WINDOWS); -#else - wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT); -#endif wxPageSetupData data; data.SetOrientation(orientation); -#ifdef __WXMSW__ wxPageSetupDialog pageSetupDialog(this, & data); -#else - wxGenericPageSetupDialog pageSetupDialog(this, & data); -#endif pageSetupDialog.ShowModal(); data = pageSetupDialog.GetPageSetupData(); @@ -242,8 +220,6 @@ void MyFrame::OnPageSetup(wxCommandEvent& WXUNUSED(event)) #if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW void MyFrame::OnPrintPS(wxCommandEvent& WXUNUSED(event)) { - wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT); - wxPostScriptPrinter printer; MyPrintout printout("My printout"); printer.Print(this, &printout, TRUE); @@ -251,8 +227,6 @@ void MyFrame::OnPrintPS(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnPrintPreviewPS(wxCommandEvent& WXUNUSED(event)) { - wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT); - wxPrintData printData; printData.SetOrientation(orientation); @@ -266,8 +240,6 @@ void MyFrame::OnPrintPreviewPS(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnPrintSetupPS(wxCommandEvent& WXUNUSED(event)) { - wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT); - wxPrintData data; data.SetOrientation(orientation); @@ -280,8 +252,6 @@ void MyFrame::OnPrintSetupPS(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnPageSetupPS(wxCommandEvent& WXUNUSED(event)) { - wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT); - wxPageSetupData data; data.SetOrientation(orientation); @@ -319,7 +289,7 @@ void MyFrame::Draw(wxDC& dc) dc.DrawLine(0, 0, 200, 200); dc.DrawLine(200, 0, 0, 200); - wxIcon my_icon( wxICON(mondrian) ); + wxIcon my_icon = wxICON(mondrian) ; dc.DrawIcon( my_icon, 100, 100); } @@ -353,14 +323,6 @@ void MyCanvas::OnEvent(wxMouseEvent& WXUNUSED(event)) { } -bool MyFrame::OnClose(void) -{ - Show(FALSE); - delete wxGetApp().m_testFont; - - return TRUE; -} - bool MyPrintout::OnPrintPage(int page) { wxDC *dc = GetDC();