#include "wx/defs.h"
-#define WINDOWS_PRINTING (wxTheApp->GetPrintMode() == wxPRINT_WINDOWS)
-
#ifndef WX_PRECOMP
#include "wx/utils.h"
#include "wx/dc.h"
#endif
#include "wx/generic/prntdlgg.h"
+
+#if wxUSE_POSTSCRIPT
+#include "wx/generic/dcpsg.h"
+#endif
+
#include "wx/printdlg.h"
+// For print paper things
+#include "wx/prntbase.h"
+
#include <stdlib.h>
#include <string.h>
+#if wxUSE_POSTSCRIPT
+
#if !USE_SHARED_LIBRARY
IMPLEMENT_CLASS(wxGenericPrintDialog, wxDialog)
IMPLEMENT_CLASS(wxGenericPrintSetupDialog, wxDialog)
wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent, wxPrintData* data):
- wxDialog(parent, -1, _("Print"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL)
+ wxDialog(parent, -1, _("Print"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxTAB_TRAVERSAL)
{
if ( data )
printData = *data;
{
wxThePrintSetupData->SetPrinterMode(PS_FILE);
- char *f = wxFileSelector(_("PostScript file"),
- wxPathOnly(wxThePrintSetupData->GetPrinterFile()),
- wxFileNameFromPath(wxThePrintSetupData->GetPrinterFile()),
- "ps", "*.ps", 0, this);
- if (f)
- wxThePrintSetupData->SetPrinterFile(f);
- else
- return;
+ wxString f = wxFileSelector(_("PostScript file"),
+ wxPathOnly(wxThePrintSetupData->GetPrinterFile()),
+ wxFileNameFromPath(wxThePrintSetupData->GetPrinterFile()),
+ "ps", "*.ps", 0, this);
+ if ( f.IsEmpty() )
+ return;
+
+ wxThePrintSetupData->SetPrinterFile(f);
}
else
wxThePrintSetupData->SetPrinterMode(PS_PRINTER);
*/
wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow *parent, wxPrintSetupData* data):
- wxDialog(parent, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL)
+ wxDialog(parent, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxTAB_TRAVERSAL)
{
if ( data )
printData = *data;
orientationRadioBox->SetSelection(0);
(void) new wxStaticBox(this, wxPRINTID_STATIC, _("Options"), wxPoint(10, 130), wxSize(200,50) );
+
+ int colourXPos = 145;
+
+#ifdef __WXMOTIF__
+ colourXPos = 150;
+#endif
- colourCheckBox = new wxCheckBox(this, wxPRINTID_PRINTCOLOUR, _("Print in colour"), wxPoint(15, 145));
+ colourCheckBox = new wxCheckBox(this, wxPRINTID_PRINTCOLOUR, _("Print in colour"), wxPoint(15, colourXPos));
(void) new wxStaticBox(this, wxPRINTID_STATIC, _("Print spooling"), wxPoint(230, 10), wxSize(200,170) );
if (!val.IsNull() && val != "")
printData.SetPaperName((char *)(const char *)val);
}
+ *wxThePrintSetupData = GetPrintData();
return TRUE;
}
sel = i;
}
- wxChoice *choice = new wxChoice(this, wxPRINTID_PAPERSIZE, wxPoint(*x, *y), wxSize(170, -1), n,
+ int width = 170;
+#ifdef __WXMOTIF__
+ width = 150;
+#endif
+
+ wxChoice *choice = new wxChoice(this, wxPRINTID_PAPERSIZE, wxPoint(*x, *y), wxSize(width, -1), n,
choices);
delete[] choices;
choice->SetSelection(sel);
return choice;
}
+#endif
+ // wxUSE_POSTSCRIPT
/*
* Generic page setup dialog
void wxGenericPageSetupDialog::OnPrinter(wxCommandEvent& WXUNUSED(event))
{
- if (wxTheApp->GetPrintMode() == wxPRINT_POSTSCRIPT)
- {
- wxGenericPrintSetupDialog *genericPrintSetupDialog =
- new wxGenericPrintSetupDialog(this, wxThePrintSetupData);
- int ret = genericPrintSetupDialog->ShowModal();
- if (ret == wxID_OK)
- *wxThePrintSetupData = genericPrintSetupDialog->GetPrintData();
+ // We no longer query GetPrintMode, so we can eliminate the need
+ // to call SetPrintMode.
+ // This has the limitation that we can't explicitly call the PostScript
+ // print setup dialog from the generic Page Setup dialog under Windows,
+ // but since this choice would only happen when trying to do PostScript
+ // printing under Windows (and only in 16-bit Windows which
+ // doesn't have a Windows-specific page setup dialog) it's worth it.
- genericPrintSetupDialog->Close(TRUE);
- }
-#ifdef __WXMSW__
- else
- {
wxPrintData data;
data.SetSetupDialog(TRUE);
- wxPrintDialog printDialog(this, & data);
- printDialog.Show(TRUE);
- }
-#endif
+ wxPrintDialog *printDialog = new wxPrintDialog(this, & data);
+ printDialog->ShowModal();
+
+ printDialog->Destroy();
}
wxGenericPageSetupDialog::wxGenericPageSetupDialog(wxWindow *parent, wxPageSetupData* data):
- wxDialog(parent, -1, _("Page Setup"), wxPoint(0, 0), wxSize(600, 600), wxDIALOG_MODAL|wxDEFAULT_DIALOG_STYLE)
+ wxDialog(parent, -1, _("Page Setup"), wxPoint(0, 0), wxSize(600, 600), wxDIALOG_MODAL|wxDEFAULT_DIALOG_STYLE|wxTAB_TRAVERSAL)
{
if ( data )
pageData = *data;
int buttonWidth = 75;
int buttonHeight = 25;
int spacing = 5;
+#ifdef __WXMOTIF__
+ spacing = 15;
+#endif
+
int yPos = 5;
int xPos = 5;
xPos = 5;
yPos += 35;
+#ifdef __WXMOTIF__
+ yPos += 10;
+#endif
+
paperTypeChoice = CreatePaperTypeChoice(&xPos, &yPos);
xPos = 5;
yPos += 60;
int staticWidth = 110;
+#ifdef __WXMOTIF__
+ staticWidth += 20;
+#endif
+
int textWidth = 60;
spacing = 10;
int sel = orientationRadioBox->GetSelection();
if (sel == 0)
{
+#if wxUSE_POSTSCRIPT
wxThePrintSetupData->SetPrinterOrientation(wxPORTRAIT);
+#endif
pageData.SetOrientation(wxPORTRAIT);
}
else
{
+#if wxUSE_POSTSCRIPT
wxThePrintSetupData->SetPrinterOrientation(wxLANDSCAPE);
+#endif
pageData.SetOrientation(wxLANDSCAPE);
}
}
}
}
}
+
return TRUE;
}