more backwards compatibility

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1997 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 1999-03-29 16:43:40 +00:00
parent c27eab7e9c
commit 8826f46f0d
5 changed files with 488 additions and 374 deletions

View File

@ -9,6 +9,14 @@
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#ifdef __GNUG__
#pragma implementation "cmndata.h"
#endif
@ -29,10 +37,15 @@
#include "wx/gdicmn.h"
#include "wx/cmndata.h"
#include "wx/paper.h"
// For compatibility
#if (defined(__WXMOTIF__) || defined(__WXGTK__)) && wxUSE_POSTSCRIPT
#define wxCOMPATIBILITY_WITH_PRINTSETUPDATA 1
#endif
#if wxCOMPATIBILITY_WITH_PRINTSETUPDATA
#include "wx/generic/dcpsg.h"
#endif
@ -42,14 +55,13 @@
#if !defined(__WIN32__)
#include <print.h>
#include <commdlg.h>
#endif
#endif // Win16
#if defined(__WATCOMC__) || defined(__SC__) || defined(__SALFORDC__)
#include <windowsx.h>
#include <commdlg.h>
#endif
#endif
#endif // MSW
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxPrintData, wxObject)
@ -59,9 +71,13 @@ IMPLEMENT_DYNAMIC_CLASS(wxFontData, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxColourData, wxObject)
#endif
/*
* wxColourData
*/
// ============================================================================
// implementation
// ============================================================================
// ----------------------------------------------------------------------------
// wxColourData
// ----------------------------------------------------------------------------
wxColourData::wxColourData()
{
@ -108,9 +124,9 @@ void wxColourData::operator=(const wxColourData& data)
chooseFull = data.chooseFull;
}
/*
* Font data
*/
// ----------------------------------------------------------------------------
// Font data
// ----------------------------------------------------------------------------
wxFontData::wxFontData()
{
@ -145,9 +161,9 @@ void wxFontData::operator=(const wxFontData& data)
maxSize = data.maxSize;
}
/*
* Print data
*/
// ----------------------------------------------------------------------------
// Print data
// ----------------------------------------------------------------------------
wxPrintData::wxPrintData()
{
@ -556,7 +572,7 @@ void wxPrintData::operator=(const wxPrintData& data)
}
// For compatibility
#if (defined(__WXMOTIF__) || defined(__WXGTK__)) && wxUSE_POSTSCRIPT
#if wxCOMPATIBILITY_WITH_PRINTSETUPDATA
void wxPrintData::operator=(const wxPrintSetupData& setupData)
{
SetPrinterCommand(setupData.GetPrinterCommand());
@ -579,12 +595,12 @@ void wxPrintData::operator=(const wxPrintSetupData& setupData)
SetColour(setupData.GetColour());
SetFilename(setupData.GetPrinterFile());
}
#endif
#endif // wxCOMPATIBILITY_WITH_PRINTSETUPDATA
/*
* Print dialog data
*/
// ----------------------------------------------------------------------------
// Print dialog data
// ----------------------------------------------------------------------------
wxPrintDialogData::wxPrintDialogData()
{
@ -791,7 +807,7 @@ void wxPrintDialogData::SetOwnerWindow(wxWindow* win)
pd->hwndOwner=(HWND) win->GetHWND();
}
}
#endif
#endif // MSW
void wxPrintDialogData::operator=(const wxPrintDialogData& data)
{
@ -817,9 +833,9 @@ void wxPrintDialogData::operator=(const wxPrintData& data)
m_printData = data;
}
/*
* wxPageSetupDialogData
*/
// ----------------------------------------------------------------------------
// wxPageSetupDialogData
// ----------------------------------------------------------------------------
wxPageSetupDialogData::wxPageSetupDialogData()
{
@ -911,7 +927,7 @@ void wxPageSetupDialogData::operator=(const wxPrintData& data)
m_printData = data;
}
#if defined(__WXMSW__) && defined(__WIN95__)
#if defined(__WIN95__)
void wxPageSetupDialogData::ConvertToNative()
{
m_printData.ConvertToNative();
@ -1056,7 +1072,7 @@ void wxPageSetupDialogData::SetOwnerWindow(wxWindow* win)
pd->hwndOwner=(HWND) win->GetHWND();
}
}
#endif
#endif // Win95
// If a corresponding paper type is found in the paper database, will set the m_printData
// paper size id member as well.
@ -1079,7 +1095,9 @@ void wxPageSetupDialogData::SetPaperSize(wxPaperSize id)
// paper id
void wxPageSetupDialogData::CalculateIdFromPaperSize()
{
wxASSERT_MSG( (wxThePrintPaperDatabase != (wxPrintPaperDatabase*) NULL), "wxThePrintPaperDatabase should not be NULL. Do not create global print dialog data objects." );
wxASSERT_MSG( (wxThePrintPaperDatabase != (wxPrintPaperDatabase*) NULL),
"wxThePrintPaperDatabase should not be NULL. "
"Do not create global print dialog data objects." );
wxSize sz = GetPaperSize();
@ -1093,7 +1111,9 @@ void wxPageSetupDialogData::CalculateIdFromPaperSize()
// Use paper id in wxPrintData to set this object's paper size
void wxPageSetupDialogData::CalculatePaperSizeFromId()
{
wxASSERT_MSG( (wxThePrintPaperDatabase != (wxPrintPaperDatabase*) NULL), "wxThePrintPaperDatabase should not be NULL. Do not create global print dialog data objects." );
wxASSERT_MSG( (wxThePrintPaperDatabase != (wxPrintPaperDatabase*) NULL),
"wxThePrintPaperDatabase should not be NULL. "
"Do not create global print dialog data objects." );
wxSize sz = wxThePrintPaperDatabase->GetSize(m_printData.GetPaperId());
@ -1104,3 +1124,4 @@ void wxPageSetupDialogData::CalculatePaperSizeFromId()
m_paperSize.y = sz.y * 10;
}
}

View File

@ -531,7 +531,28 @@ void wxPreviewFrame::CreateControlBar()
* Print preview
*/
wxPrintPreviewBase::wxPrintPreviewBase(wxPrintout *printout, wxPrintout *printoutForPrinting, wxPrintDialogData *data)
wxPrintPreviewBase::wxPrintPreviewBase(wxPrintout *printout,
wxPrintout *printoutForPrinting,
wxPrintData *data)
{
if (data)
m_printDialogData = (*data);
Init(printout, printoutForPrinting);
}
wxPrintPreviewBase::wxPrintPreviewBase(wxPrintout *printout,
wxPrintout *printoutForPrinting,
wxPrintDialogData *data)
{
if (data)
m_printDialogData = (*data);
Init(printout, printoutForPrinting);
}
void wxPrintPreviewBase::Init(wxPrintout *printout,
wxPrintout *printoutForPrinting)
{
m_isOk = TRUE;
m_previewPrintout = printout;
@ -539,8 +560,6 @@ wxPrintPreviewBase::wxPrintPreviewBase(wxPrintout *printout, wxPrintout *printou
m_previewPrintout->SetIsPreview(TRUE);
m_printPrintout = printoutForPrinting;
if (data)
m_printDialogData = (*data);
m_previewCanvas = NULL;
m_previewFrame = NULL;

View File

@ -1935,7 +1935,7 @@ wxPostScriptPrintDialog::wxPostScriptPrintDialog (wxWindow *parent, const wxStri
radio0->SetSelection((int)wxThePrintSetupData->GetPrinterOrientation() - 1);
// @@@ Configuration hook
if (wxThePrintSetupData->GetPrintPreviewCommand() == NULL)
if ( !wxThePrintSetupData->GetPrintPreviewCommand() )
wxThePrintSetupData->SetPrintPreviewCommand(PS_VIEWER_PROG);
// wxGetResource ("wxWindows", "PSView", &wxThePrintSetupData->m_previewCommand);

View File

@ -9,6 +9,14 @@
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#ifdef __GNUG__
#pragma implementation "printps.h"
#endif
@ -38,21 +46,29 @@
#include <stdlib.h>
// ----------------------------------------------------------------------------
// wxWin macros
// ----------------------------------------------------------------------------
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxPostScriptPrinter, wxPrinterBase)
IMPLEMENT_CLASS(wxPostScriptPrintPreview, wxPrintPreviewBase)
#endif
/*
* Printer
*/
// ============================================================================
// implementation
// ============================================================================
wxPostScriptPrinter::wxPostScriptPrinter(wxPrintDialogData *data):
wxPrinterBase(data)
// ----------------------------------------------------------------------------
// Printer
// ----------------------------------------------------------------------------
wxPostScriptPrinter::wxPostScriptPrinter(wxPrintDialogData *data)
: wxPrinterBase(data)
{
}
wxPostScriptPrinter::~wxPostScriptPrinter(void)
wxPostScriptPrinter::~wxPostScriptPrinter()
{
}
@ -225,18 +241,34 @@ bool wxPostScriptPrinter::Setup(wxWindow *parent)
return (ret == wxID_OK);
}
/*
* Print preview
*/
// ----------------------------------------------------------------------------
// Print preview
// ----------------------------------------------------------------------------
wxPostScriptPrintPreview::wxPostScriptPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting, wxPrintDialogData *data):
wxPrintPreviewBase(printout, printoutForPrinting, data)
void wxPostScriptPrintPreview::Init(wxPrintout * WXUNUSED(printout),
wxPrintout * WXUNUSED(printoutForPrinting))
{
// Have to call it here since base constructor can't call it
DetermineScaling();
}
wxPostScriptPrintPreview::~wxPostScriptPrintPreview(void)
wxPostScriptPrintPreview::wxPostScriptPrintPreview(wxPrintout *printout,
wxPrintout *printoutForPrinting,
wxPrintDialogData *data)
: wxPrintPreviewBase(printout, printoutForPrinting, data)
{
Init(printout, printoutForPrinting);
}
wxPostScriptPrintPreview::wxPostScriptPrintPreview(wxPrintout *printout,
wxPrintout *printoutForPrinting,
wxPrintData *data)
: wxPrintPreviewBase(printout, printoutForPrinting, data)
{
Init(printout, printoutForPrinting);
}
wxPostScriptPrintPreview::~wxPostScriptPrintPreview()
{
}
@ -248,7 +280,7 @@ bool wxPostScriptPrintPreview::Print(bool interactive)
return printer.Print(m_previewFrame, m_printPrintout, interactive);
}
void wxPostScriptPrintPreview::DetermineScaling(void)
void wxPostScriptPrintPreview::DetermineScaling()
{
wxPaperSize paperType = m_printDialogData.GetPrintData().GetPaperId();
if (paperType == wxPAPER_NONE)

View File

@ -9,6 +9,14 @@
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#ifdef __GNUG__
#pragma implementation "prntdlgg.h"
#endif
@ -53,6 +61,10 @@
#include <stdlib.h>
#include <string.h>
// ----------------------------------------------------------------------------
// wxWin macros
// ----------------------------------------------------------------------------
#if wxUSE_POSTSCRIPT
#if !USE_SHARED_LIBRARY
@ -69,21 +81,50 @@ END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxGenericPageSetupDialog, wxDialog)
EVT_BUTTON(wxPRINTID_SETUP, wxGenericPageSetupDialog::OnPrinter)
END_EVENT_TABLE()
#endif
#endif // USE_SHARED_LIBRARY
// ----------------------------------------------------------------------------
// global vars
// ----------------------------------------------------------------------------
extern wxPrintPaperDatabase *wxThePrintPaperDatabase;
/*
* Generic print dialog for non-Windows printing use.
*/
// ============================================================================
// implementation
// ============================================================================
// ----------------------------------------------------------------------------
// Generic print dialog for non-Windows printing use.
// ----------------------------------------------------------------------------
wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent, wxPrintDialogData* data):
wxDialog(parent, -1, _("Print"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxTAB_TRAVERSAL)
wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent,
wxPrintDialogData* data)
: wxDialog(parent, -1, _("Print"),
wxPoint(0, 0), wxSize(600, 600),
wxDEFAULT_DIALOG_STYLE |
wxDIALOG_MODAL |
wxTAB_TRAVERSAL)
{
if ( data )
m_printDialogData = *data;
Init(parent);
}
wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent,
wxPrintData* data)
{
if ( data )
m_printDialogData = *data;
Init(parent);
}
void wxGenericPrintDialog::Init(wxWindow *parent)
{
wxDialog::Create(parent, -1, _("Print"), wxPoint(0, 0), wxSize(600, 600),
wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL | wxTAB_TRAVERSAL);
(void)new wxStaticBox( this, -1, _( "Printer options" ), wxPoint( 5, 5), wxSize( 300, 60 ) );
m_printToFileCheckBox = new wxCheckBox(this, wxPRINTID_PRINTTOFILE, _("Print to File"), wxPoint(20, 25) );
@ -99,7 +140,9 @@ wxDialog(parent, -1, _("Print"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIAL
if (m_printDialogData.GetFromPage() != 0)
{
m_rangeRadioBox = new wxRadioBox(this, wxPRINTID_RANGE, _("Print Range"),
wxPoint(5, 80), wxSize(-1, -1), 2, choices, 1, wxRA_VERTICAL);
wxPoint(5, 80), wxSize(-1, -1),
2, choices,
1, wxRA_VERTICAL);
m_rangeRadioBox->SetSelection(1);
}
@ -299,9 +342,9 @@ wxDC *wxGenericPrintDialog::GetPrintDC()
return new wxPostScriptDC(wxThePrintSetupData->GetPrinterFile(), FALSE, (wxWindow *) NULL);
}
/*
* Generic print setup dialog
*/
// ----------------------------------------------------------------------------
// Generic print setup dialog
// ----------------------------------------------------------------------------
wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow *parent, wxPrintData* data):
wxDialog(parent, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxTAB_TRAVERSAL)
@ -460,12 +503,11 @@ wxChoice *wxGenericPrintSetupDialog::CreatePaperTypeChoice(int *x, int *y)
choice->SetSelection(sel);
return choice;
}
#endif
// wxUSE_POSTSCRIPT
#endif // wxUSE_POSTSCRIPT
/*
* Generic page setup dialog
*/
// ----------------------------------------------------------------------------
// Generic page setup dialog
// ----------------------------------------------------------------------------
void wxGenericPageSetupDialog::OnPrinter(wxCommandEvent& WXUNUSED(event))
{