#include "wx/postscrp.h"
#endif
-#if !USE_PRINTING_ARCHITECTURE
-#error You must set USE_PRINTING_ARCHITECTURE to 1 in wx_setup.h to compile this demo.
+#if !wxUSE_PRINTING_ARCHITECTURE
+#error You must set wxUSE_PRINTING_ARCHITECTURE to 1 in wx_setup.h to compile this demo.
#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 <ctype.h>
#include "wx/metafile.h"
#include "wx/print.h"
#include "wx/printdlg.h"
+
+#if wxTEST_POSTSCRIPT_IN_MSW
#include "wx/generic/printps.h"
#include "wx/generic/prntdlgg.h"
+#endif
#include "printing.h"
// Main proc
IMPLEMENT_APP(MyApp)
-#ifdef __WXGTK__
+#if defined(__WXGTK__) || defined(__WXMOTIF__)
#include "folder.xpm"
#endif
file_menu->Append(WXPRINT_PAGE_SETUP, "Page Set&up...", "Page setup");
file_menu->Append(WXPRINT_PREVIEW, "Print Pre&view", "Preview");
-#ifdef __WXMSW__
+#if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
file_menu->AppendSeparator();
file_menu->Append(WXPRINT_PRINT_PS, "Print PostScript...", "Print (PostScript)");
file_menu->Append(WXPRINT_PRINT_SETUP_PS, "Print Setup PostScript...", "Setup printer properties (PostScript)");
EVT_MENU(WXPRINT_PREVIEW, MyFrame::OnPrintPreview)
EVT_MENU(WXPRINT_PRINT_SETUP, MyFrame::OnPrintSetup)
EVT_MENU(WXPRINT_PAGE_SETUP, MyFrame::OnPageSetup)
+ EVT_MENU(WXPRINT_ABOUT, MyFrame::OnPrintAbout)
+#if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
EVT_MENU(WXPRINT_PRINT_PS, MyFrame::OnPrintPS)
EVT_MENU(WXPRINT_PREVIEW_PS, MyFrame::OnPrintPreviewPS)
EVT_MENU(WXPRINT_PRINT_SETUP_PS, MyFrame::OnPrintSetupPS)
EVT_MENU(WXPRINT_PAGE_SETUP_PS, MyFrame::OnPageSetupPS)
- EVT_MENU(WXPRINT_ABOUT, MyFrame::OnPrintAbout)
+#endif
END_EVENT_TABLE()
// Define my frame constructor
wxMessageBox("There was a problem printing.\nPerhaps your current printer is not set correctly?", "Printing", wxOK);
}
-void MyFrame::OnPrintPS(wxCommandEvent& WXUNUSED(event))
-{
- wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT);
-
- wxPostScriptPrinter printer;
- MyPrintout printout("My printout");
- printer.Print(this, &printout, TRUE);
-}
-
void MyFrame::OnPrintPreview(wxCommandEvent& WXUNUSED(event))
{
#ifdef __WXMSW__
frame->Show(TRUE);
}
-void MyFrame::OnPrintPreviewPS(wxCommandEvent& WXUNUSED(event))
-{
- wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT);
-
- wxPrintData printData;
- printData.SetOrientation(orientation);
-
- // Pass two printout objects: for preview, and possible printing.
- wxPrintPreview *preview = new wxPrintPreview(new MyPrintout, new MyPrintout, & printData);
- wxPreviewFrame *frame = new wxPreviewFrame(preview, this, "Demo Print Preview", wxPoint(100, 100), wxSize(600, 650));
- frame->Centre(wxBOTH);
- frame->Initialize();
- frame->Show(TRUE);
-}
-
void MyFrame::OnPrintSetup(wxCommandEvent& WXUNUSED(event))
{
#ifdef __WXMSW__
orientation = data.GetOrientation();
}
+#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);
+}
+
+void MyFrame::OnPrintPreviewPS(wxCommandEvent& WXUNUSED(event))
+{
+ wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT);
+
+ wxPrintData printData;
+ printData.SetOrientation(orientation);
+
+ // Pass two printout objects: for preview, and possible printing.
+ wxPrintPreview *preview = new wxPrintPreview(new MyPrintout, new MyPrintout, & printData);
+ wxPreviewFrame *frame = new wxPreviewFrame(preview, this, "Demo Print Preview", wxPoint(100, 100), wxSize(600, 650));
+ frame->Centre(wxBOTH);
+ frame->Initialize();
+ frame->Show(TRUE);
+}
+
void MyFrame::OnPrintSetupPS(wxCommandEvent& WXUNUSED(event))
{
wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT);
orientation = pageSetupDialog.GetPageSetupData().GetOrientation();
}
+#endif
+
void MyFrame::OnPrintAbout(wxCommandEvent& WXUNUSED(event))
{
dc.DrawLine(0, 0, 200, 200);
dc.DrawLine(200, 0, 0, 200);
-#if defined(__WXGTK__)
+#if defined(__WXGTK__) || defined(__WXMOTIF__)
wxIcon my_icon( folder_xpm );
#elif defined(__WXMSW__)
wxIcon my_icon( "mondrian" );