-
-#endif
-}
-
-// Determine the Default Postscript Previewer
-// available on the platform
-#if defined(__SUN__) && defined(__XVIEW__)
-// OpenWindow/NeWS's Postscript Previewer
-# define PS_VIEWER_PROG "pageview"
-#elif defined(__VMS__)
-#define PS_VIEWER_PROG "view/format=ps/select=x_display"
-#elif defined(__SGI__)
-// SGI's Display Postscript Previewer
-//# define PS_VIEWER_PROG "dps"
-# define PS_VIEWER_PROG "xpsview"
-#elif defined(__X__) || defined(__WXGTK__)
-// Front-end to ghostscript
-# define PS_VIEWER_PROG "ghostview"
-#else
-// Windows ghostscript/ghostview
-# define PS_VIEWER_PROG "gsview"
-#endif
-
-wxPrintSetupData *wxThePrintSetupData = (wxPrintSetupData *) NULL;
-
-IMPLEMENT_DYNAMIC_CLASS(wxPostScriptDC, wxDC)
-IMPLEMENT_DYNAMIC_CLASS(wxPrintSetupData, wxObject)
-
-// Redundant now I think
-#if 1
-IMPLEMENT_CLASS(wxPostScriptPrintDialog, wxDialog)
-
-wxPostScriptPrintDialog::wxPostScriptPrintDialog (wxWindow *parent, const wxString& title,
- const wxPoint& pos, const wxSize& size, wxCoord style):
- wxDialog(parent, -1, title, pos, size, style)
-{
- wxBeginBusyCursor();
-
- char buf[100];
- int yPos = 40;
- wxString
- *orientation = new wxString[2],
- *print_modes = new wxString[3];
- int features;
- wxCoord wx_printer_translate_x, wx_printer_translate_y;
- double wx_printer_scale_x, wx_printer_scale_y;
-
- orientation[0] = _("Portrait");
- orientation[1] = _("Landscape");
-
- print_modes[0] = _("Send to Printer");
- print_modes[1] = _("Print to File");
- print_modes[2] = _("Preview Only");
-
-
-
- wxButton *okBut = new wxButton (this, wxID_OK, _("OK"), wxPoint(5, 5));
- (void) new wxButton (this, wxID_CANCEL, _("Cancel"), wxPoint(40, 5));
- okBut->SetDefault();
-
-
-#if defined(__WXGTK__) || defined (__WXMOTIF__)
- (void) new wxStaticText( this, -1, _("Printer Command: "),
- wxPoint(5, yPos) );
- (void) new wxTextCtrl( this, wxID_PRINTER_COMMAND, wxThePrintSetupData->GetPrinterCommand(),
- wxPoint(100, yPos), wxSize(100, -1) );
-
- (void) new wxStaticText( this, -1, _("Printer Options: "),
- wxPoint(210, yPos) );
- (void) new wxTextCtrl( this, wxID_PRINTER_OPTIONS, wxThePrintSetupData->GetPrinterOptions(),
- wxPoint(305, yPos), wxSize(150, -1) );
-
- yPos += 40;
-#endif
-
-
- wxRadioBox *radio0 = new wxRadioBox(this, wxID_PRINTER_ORIENTATION, "Orientation: ", wxPoint(5, yPos), wxSize(-1,-1),
- 2,orientation,2,wxRA_SPECIFY_ROWS);
- radio0->SetSelection((int)wxThePrintSetupData->GetPrinterOrientation() - 1);
-
- // @@@ Configuration hook
- if ( !wxThePrintSetupData->GetPrintPreviewCommand() )
- wxThePrintSetupData->SetPrintPreviewCommand(PS_VIEWER_PROG);
-
- // wxGetResource ("wxWindows", "PSView", &wxThePrintSetupData->m_previewCommand);
-
- features = (wxThePrintSetupData->GetPrintPreviewCommand() &&
- *wxThePrintSetupData->GetPrintPreviewCommand()) ? 3 : 2;
-
- wxRadioBox *radio1 = new wxRadioBox(this, wxID_PRINTER_MODES, _("PostScript:"),
- wxPoint(150, yPos),
- wxSize(-1,-1), features,
- print_modes, features, wxRA_SPECIFY_ROWS);
-
-#ifdef __WXMSW__
- radio1->Enable(0, FALSE);
- if (wxThePrintSetupData->GetPrintPreviewCommand() && *wxThePrintSetupData->GetPrintPreviewCommand())
- radio1->Enable(2, FALSE);
-#endif
-
- radio1->SetSelection((int)wxThePrintSetupData->GetPrinterMode());
- wxThePrintSetupData->GetPrinterTranslation(&wx_printer_translate_x, &wx_printer_translate_y);
- wxThePrintSetupData->GetPrinterScaling(&wx_printer_scale_x, &wx_printer_scale_y);
-
- sprintf (buf, "%.2f", wx_printer_scale_x);
-
- yPos += 90;
- (void) new wxStaticText(this, -1, _("X Scaling"), wxPoint(5, yPos));
- /* wxTextCtrl *text1 = */ (void) new wxTextCtrl(this, wxID_PRINTER_X_SCALE, buf, wxPoint(100, yPos), wxSize(100, -1));
-
- sprintf (buf, "%.2f", wx_printer_scale_y);
- (void) new wxStaticText(this, -1, _("Y Scaling"), wxPoint(220, yPos));
- /* wxTextCtrl *text2 = */ (void) new wxTextCtrl(this, wxID_PRINTER_Y_SCALE, buf, wxPoint(320, yPos), wxSize(100, -1));
-
- yPos += 25;
-
- (void) new wxStaticText(this, -1, _("X Translation"), wxPoint(5, yPos));
- sprintf (buf, "%.2d", wx_printer_translate_x);
- /* wxTextCtrl *text3 = */ (void) new wxTextCtrl(this, wxID_PRINTER_X_TRANS, buf, wxPoint(100, yPos), wxSize(100, -1));
-
- (void) new wxStaticText(this, -1, _("Y Translation"), wxPoint(220, yPos));
- sprintf (buf, "%.2d", wx_printer_translate_y);
- /* wxTextCtrl *text4 = */ (void) new wxTextCtrl(this, wxID_PRINTER_Y_TRANS, buf, wxPoint(320, yPos), wxSize(100, -1));
-
- Fit ();
-
- delete[] orientation;
- delete[] print_modes;
-
- wxEndBusyCursor();
-}
-
-int wxPostScriptPrintDialog::ShowModal ()
-{
- if ( wxDialog::ShowModal() == wxID_OK )
- {
-// wxTextCtrl *text0 = (wxTextCtrl *)FindWindow(wxID_PRINTER_OPTIONS);
- wxTextCtrl *text1 = (wxTextCtrl *)FindWindow(wxID_PRINTER_X_SCALE);
- wxTextCtrl *text2 = (wxTextCtrl *)FindWindow(wxID_PRINTER_Y_SCALE);
- wxTextCtrl *text3 = (wxTextCtrl *)FindWindow(wxID_PRINTER_X_TRANS);
- wxTextCtrl *text4 = (wxTextCtrl *)FindWindow(wxID_PRINTER_Y_TRANS);
-// wxTextCtrl *text_prt = (wxTextCtrl *)FindWindow(wxID_PRINTER_COMMAND);
- wxRadioBox *radio0 = (wxRadioBox *)FindWindow(wxID_PRINTER_ORIENTATION);
- wxRadioBox *radio1 = (wxRadioBox *)FindWindow(wxID_PRINTER_MODES);
-
- StringToDouble (WXSTRINGCAST text1->GetValue (), &wxThePrintSetupData->m_printerScaleX);
- StringToDouble (WXSTRINGCAST text2->GetValue (), &wxThePrintSetupData->m_printerScaleY);
-
- long dummy;
- StringToLong (WXSTRINGCAST text3->GetValue (), &dummy);
- wxThePrintSetupData->m_printerTranslateX = (wxCoord)dummy;
- StringToLong (WXSTRINGCAST text4->GetValue (), &dummy);
- wxThePrintSetupData->m_printerTranslateY = (wxCoord)dummy;
-
-#ifdef __X__
- // wxThePrintSetupData->SetPrinterOptions(WXSTRINGCAST text0->GetValue ());
- // wxThePrintSetupData->SetPrinterCommand(WXSTRINGCAST text_prt->GetValue ());
-#endif
-
- wxThePrintSetupData->SetPrinterOrientation((radio0->GetSelection() == 1 ? wxLANDSCAPE : wxPORTRAIT));
-
- // C++ wants this
- switch ( radio1->GetSelection() ) {
- case 0: wxThePrintSetupData->SetPrinterMode(PS_PRINTER); break;
- case 1: wxThePrintSetupData->SetPrinterMode(PS_FILE); break;
- case 2: wxThePrintSetupData->SetPrinterMode(PS_PREVIEW); break;
- }
- return wxID_OK;
- }
- return wxID_CANCEL;
-}
-#endif
- // 0 (redundant)
-
-// PostScript printer settings
-// RETAINED FOR BACKWARD COMPATIBILITY
-void wxSetPrinterCommand(const wxString& cmd)
-{
- wxThePrintSetupData->SetPrinterCommand(cmd);
-}
-
-void wxSetPrintPreviewCommand(const wxString& cmd)
-{
- wxThePrintSetupData->SetPrintPreviewCommand(cmd);
-}
-
-void wxSetPrinterOptions(const wxString& flags)
-{
- wxThePrintSetupData->SetPrinterOptions(flags);
-}
-
-void wxSetPrinterFile(const wxString& f)
-{
- wxThePrintSetupData->SetPrinterFile(f);
-}
-
-void wxSetPrinterOrientation(int orient)
-{
- wxThePrintSetupData->SetPrinterOrientation(orient);
-}
-
-void wxSetPrinterScaling(double x, double y)
-{
- wxThePrintSetupData->SetPrinterScaling(x, y);
-}
-
-void wxSetPrinterTranslation(wxCoord x, wxCoord y)
-{
- wxThePrintSetupData->SetPrinterTranslation(x, y);
-}
-
-// 1 = Preview, 2 = print to file, 3 = send to printer
-void wxSetPrinterMode(int mode)
-{
- wxThePrintSetupData->SetPrinterMode(mode);
-}
-
-void wxSetAFMPath(const wxString& f)
-{
- wxThePrintSetupData->SetAFMPath(f);
-}
-
-// Get current values
-wxString wxGetPrinterCommand()
-{
- return wxThePrintSetupData->GetPrinterCommand();
-}
-
-wxString wxGetPrintPreviewCommand()
-{
- return wxThePrintSetupData->GetPrintPreviewCommand();
-}
-
-wxString wxGetPrinterOptions()
-{
- return wxThePrintSetupData->GetPrinterOptions();
-}
-
-wxString wxGetPrinterFile()
-{
- return wxThePrintSetupData->GetPrinterFile();
-}
-
-int wxGetPrinterOrientation()
-{
- return wxThePrintSetupData->GetPrinterOrientation();
-}
-
-void wxGetPrinterScaling(double* x, double* y)
-{
- wxThePrintSetupData->GetPrinterScaling(x, y);
-}
-
-void wxGetPrinterTranslation(wxCoord *x, wxCoord *y)
-{
- wxThePrintSetupData->GetPrinterTranslation(x, y);
-}
-
-int wxGetPrinterMode()
-{
- return wxThePrintSetupData->GetPrinterMode();
-}
-
-wxString wxGetAFMPath()
-{
- return wxThePrintSetupData->GetAFMPath();
-}
-
-/*
- * Print setup data
- */
-
-wxPrintSetupData::wxPrintSetupData()
-{
- m_printerOrient = wxPORTRAIT;
- m_printerScaleX = (double)1.0;
- m_printerScaleY = (double)1.0;
- m_printerTranslateX = 0;
- m_printerTranslateY = 0;
- m_printerMode = wxPRINT_MODE_FILE;
- m_printColour = TRUE;
-}
-
-wxPrintSetupData::~wxPrintSetupData()
-{
-}
-
-void wxPrintSetupData::operator=(wxPrintSetupData& data)
-{
- SetPrinterCommand(data.GetPrinterCommand());
- SetPrintPreviewCommand(data.GetPrintPreviewCommand());
- SetPrinterOptions(data.GetPrinterOptions());
- wxCoord x, y;
- data.GetPrinterTranslation(&x, &y);
- SetPrinterTranslation(x, y);
-
- double x1, y1;
- data.GetPrinterScaling(&x1, &y1);
- SetPrinterScaling(x1, y1);
-
- SetPrinterOrientation(data.GetPrinterOrientation());
- SetPrinterMode(data.GetPrinterMode());
- SetAFMPath(data.GetAFMPath());
- SetPaperName(data.GetPaperName());
- SetColour(data.GetColour());
-}
-
-// Initialize from a wxPrintData object (wxPrintData should now be used instead of wxPrintSetupData).
-void wxPrintSetupData::operator=(const wxPrintData& data)
-{
- SetPrinterCommand(data.GetPrinterCommand());
- SetPrintPreviewCommand(data.GetPreviewCommand());
- SetPrinterOptions(data.GetPrinterOptions());
- SetPrinterTranslation((wxCoord)data.GetPrinterTranslateX(),
- (wxCoord)data.GetPrinterTranslateY());
- SetPrinterScaling(data.GetPrinterScaleX(), data.GetPrinterScaleY());
- SetPrinterOrientation(data.GetOrientation());
- SetPrinterMode((int) data.GetPrintMode());
- SetAFMPath(data.GetFontMetricPath());
- SetPaperName(wxThePrintPaperDatabase->ConvertIdToName(data.GetPaperId()));
- SetColour(data.GetColour());
- SetPrinterFile(data.GetFilename());
-}
-
-void wxInitializePrintSetupData(bool init)
-{
- if (init)
- {
- wxThePrintSetupData = new wxPrintSetupData;
-
- wxThePrintSetupData->SetPrintPreviewCommand(PS_VIEWER_PROG);
- wxThePrintSetupData->SetPrinterOrientation(wxPORTRAIT);
- wxThePrintSetupData->SetPrinterMode(wxPRINT_MODE_PREVIEW);
- wxThePrintSetupData->SetPaperName(_("A4 sheet, 210 x 297 mm"));
-
- // Could have a .ini file to read in some defaults
- // - and/or use environment variables, e.g. WXWIN
-#ifdef __VMS__
- wxThePrintSetupData->SetPrinterCommand("print");
- wxThePrintSetupData->SetPrinterOptions("/nonotify/queue=psqueue");
- wxThePrintSetupData->SetAFMPath("sys$ps_font_metrics:");