Ticket #1244: msw_ps.patch

File msw_ps.patch, 1.6 KB (added by oneeyeman, 5 years ago)

Fix compilation of PostScript printing on Windows

  • wxWidgets/samples/printing/printing.cpp

    diff -bru wxWidgets/samples/printing/printing.cpp /mnt/winxp/wxWidgets/samples/printing/printing.cpp
    old new  
    2727
    2828// Set this to 1 if you want to test PostScript printing under MSW.
    2929// However, you'll also need to edit src/msw/makefile.nt.
    30 #define wxTEST_POSTSCRIPT_IN_MSW 0
     30#define wxTEST_POSTSCRIPT_IN_MSW 1
    3131
    3232#include <ctype.h>
    3333#include "wx/metafile.h"
     
    428428#if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
    429429void MyFrame::OnPrintPS(wxCommandEvent& WXUNUSED(event))
    430430{
    431     wxPostScriptPrinter printer(g_printData);
    432     MyPrintout printout(wxT("My printout"));
     431    wxPrintDialogData printDialogData(* g_printData);
     432
     433    wxPostScriptPrinter printer(&printDialogData);
     434    MyPrintout printout(this, wxT("My printout"));
    433435    printer.Print(this, &printout, true/*prompt*/);
    434436
    435     (*g_printData) = printer.GetPrintData();
     437    (*g_printData) = printer.GetPrintDialogData().GetPrintData();
    436438}
    437439
    438440void MyFrame::OnPrintPreviewPS(wxCommandEvent& WXUNUSED(event))
    439441{
    440442    // Pass two printout objects: for preview, and possible printing.
    441443    wxPrintDialogData printDialogData(* g_printData);
    442     wxPrintPreview *preview = new wxPrintPreview(new MyPrintout, new MyPrintout, &printDialogData);
     444    wxPrintPreview *preview = new wxPrintPreview(new MyPrintout(this), new MyPrintout(this), &printDialogData);
    443445    wxPreviewFrame *frame =
    444446        new wxPreviewFrame(preview, this, wxT("Demo Print Preview"), wxPoint(100, 100), wxSize(600, 650));
    445447    frame->Centre(wxBOTH);