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:
@@ -9,66 +9,82 @@
|
|||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// declarations
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// headers
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "cmndata.h"
|
#pragma implementation "cmndata.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "wx/string.h"
|
#include "wx/string.h"
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
#include "wx/app.h"
|
#include "wx/app.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/gdicmn.h"
|
#include "wx/gdicmn.h"
|
||||||
#include "wx/cmndata.h"
|
#include "wx/cmndata.h"
|
||||||
|
|
||||||
#include "wx/paper.h"
|
#include "wx/paper.h"
|
||||||
|
|
||||||
// For compatibility
|
// For compatibility
|
||||||
#if (defined(__WXMOTIF__) || defined(__WXGTK__)) && wxUSE_POSTSCRIPT
|
#if (defined(__WXMOTIF__) || defined(__WXGTK__)) && wxUSE_POSTSCRIPT
|
||||||
#include "wx/generic/dcpsg.h"
|
#define wxCOMPATIBILITY_WITH_PRINTSETUPDATA 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if wxCOMPATIBILITY_WITH_PRINTSETUPDATA
|
||||||
|
#include "wx/generic/dcpsg.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#if !defined(__WIN32__)
|
#if !defined(__WIN32__)
|
||||||
#include <print.h>
|
#include <print.h>
|
||||||
#include <commdlg.h>
|
#include <commdlg.h>
|
||||||
#endif
|
#endif // Win16
|
||||||
|
|
||||||
#if defined(__WATCOMC__) || defined(__SC__) || defined(__SALFORDC__)
|
#if defined(__WATCOMC__) || defined(__SC__) || defined(__SALFORDC__)
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
#include <commdlg.h>
|
#include <commdlg.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif // MSW
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxPrintData, wxObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxPrintData, wxObject)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxPrintDialogData, wxObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxPrintDialogData, wxObject)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxPageSetupDialogData, wxObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxPageSetupDialogData, wxObject)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxFontData, wxObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxFontData, wxObject)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxColourData, wxObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxColourData, wxObject)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
// ============================================================================
|
||||||
* wxColourData
|
// implementation
|
||||||
*/
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxColourData
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxColourData::wxColourData()
|
wxColourData::wxColourData()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
custColours[i].Set(255, 255, 255);
|
custColours[i].Set(255, 255, 255);
|
||||||
|
|
||||||
chooseFull = FALSE;
|
chooseFull = FALSE;
|
||||||
dataColour.Set(0,0,0);
|
dataColour.Set(0,0,0);
|
||||||
}
|
}
|
||||||
@@ -86,7 +102,7 @@ void wxColourData::SetCustomColour(int i, wxColour& colour)
|
|||||||
{
|
{
|
||||||
if (i > 15 || i < 0)
|
if (i > 15 || i < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
custColours[i] = colour;
|
custColours[i] = colour;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,7 +110,7 @@ wxColour wxColourData::GetCustomColour(int i)
|
|||||||
{
|
{
|
||||||
if (i > 15 || i < 0)
|
if (i > 15 || i < 0)
|
||||||
return wxColour(0,0,0);
|
return wxColour(0,0,0);
|
||||||
|
|
||||||
return custColours[i];
|
return custColours[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,20 +119,20 @@ void wxColourData::operator=(const wxColourData& data)
|
|||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
custColours[i] = data.custColours[i];
|
custColours[i] = data.custColours[i];
|
||||||
|
|
||||||
dataColour = (wxColour&)data.dataColour;
|
dataColour = (wxColour&)data.dataColour;
|
||||||
chooseFull = data.chooseFull;
|
chooseFull = data.chooseFull;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// ----------------------------------------------------------------------------
|
||||||
* Font data
|
// Font data
|
||||||
*/
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxFontData::wxFontData()
|
wxFontData::wxFontData()
|
||||||
{
|
{
|
||||||
// Intialize colour to black.
|
// Intialize colour to black.
|
||||||
fontColour.Set(0, 0, 0);
|
fontColour.Set(0, 0, 0);
|
||||||
|
|
||||||
showHelp = FALSE;
|
showHelp = FALSE;
|
||||||
allowSymbols = TRUE;
|
allowSymbols = TRUE;
|
||||||
enableEffects = TRUE;
|
enableEffects = TRUE;
|
||||||
@@ -145,9 +161,9 @@ void wxFontData::operator=(const wxFontData& data)
|
|||||||
maxSize = data.maxSize;
|
maxSize = data.maxSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// ----------------------------------------------------------------------------
|
||||||
* Print data
|
// Print data
|
||||||
*/
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxPrintData::wxPrintData()
|
wxPrintData::wxPrintData()
|
||||||
{
|
{
|
||||||
@@ -157,7 +173,7 @@ wxPrintData::wxPrintData()
|
|||||||
m_printOrientation = wxPORTRAIT;
|
m_printOrientation = wxPORTRAIT;
|
||||||
m_printNoCopies = 1;
|
m_printNoCopies = 1;
|
||||||
m_printCollate = FALSE;
|
m_printCollate = FALSE;
|
||||||
|
|
||||||
// New, 24/3/99
|
// New, 24/3/99
|
||||||
m_printerName = "";
|
m_printerName = "";
|
||||||
m_colour = TRUE;
|
m_colour = TRUE;
|
||||||
@@ -209,7 +225,7 @@ void wxPrintData::ConvertToNative()
|
|||||||
{
|
{
|
||||||
// Use PRINTDLG as a way of creating a DEVMODE object
|
// Use PRINTDLG as a way of creating a DEVMODE object
|
||||||
PRINTDLG *pd = new PRINTDLG;
|
PRINTDLG *pd = new PRINTDLG;
|
||||||
|
|
||||||
// GNU-WIN32 has the wrong size PRINTDLG - can't work out why.
|
// GNU-WIN32 has the wrong size PRINTDLG - can't work out why.
|
||||||
#ifdef __GNUWIN32__
|
#ifdef __GNUWIN32__
|
||||||
pd->lStructSize = 66 ;
|
pd->lStructSize = 66 ;
|
||||||
@@ -222,10 +238,10 @@ void wxPrintData::ConvertToNative()
|
|||||||
pd->hwndOwner = (HWND)NULL;
|
pd->hwndOwner = (HWND)NULL;
|
||||||
pd->hDevMode = NULL; // Will be created by PrintDlg
|
pd->hDevMode = NULL; // Will be created by PrintDlg
|
||||||
pd->hDevNames = NULL; // Ditto
|
pd->hDevNames = NULL; // Ditto
|
||||||
|
|
||||||
pd->Flags = PD_RETURNDEFAULT;
|
pd->Flags = PD_RETURNDEFAULT;
|
||||||
pd->nCopies = 1;
|
pd->nCopies = 1;
|
||||||
|
|
||||||
// Fill out the DEVMODE structure
|
// Fill out the DEVMODE structure
|
||||||
// so we can use it as input in the 'real' PrintDlg
|
// so we can use it as input in the 'real' PrintDlg
|
||||||
if (!PrintDlg(pd))
|
if (!PrintDlg(pd))
|
||||||
@@ -250,28 +266,28 @@ void wxPrintData::ConvertToNative()
|
|||||||
|
|
||||||
delete pd;
|
delete pd;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( hDevMode )
|
if ( hDevMode )
|
||||||
{
|
{
|
||||||
DEVMODE *devMode = (DEVMODE*) GlobalLock(hDevMode);
|
DEVMODE *devMode = (DEVMODE*) GlobalLock(hDevMode);
|
||||||
|
|
||||||
//// Orientation
|
//// Orientation
|
||||||
|
|
||||||
devMode->dmOrientation = m_printOrientation;
|
devMode->dmOrientation = m_printOrientation;
|
||||||
devMode->dmFields = DM_ORIENTATION;
|
devMode->dmFields = DM_ORIENTATION;
|
||||||
|
|
||||||
//// Collation
|
//// Collation
|
||||||
|
|
||||||
devMode->dmCollate = (m_printCollate ? DMCOLLATE_TRUE : DMCOLLATE_FALSE);
|
devMode->dmCollate = (m_printCollate ? DMCOLLATE_TRUE : DMCOLLATE_FALSE);
|
||||||
devMode->dmFields |= DM_COLLATE;
|
devMode->dmFields |= DM_COLLATE;
|
||||||
|
|
||||||
//// Number of copies
|
//// Number of copies
|
||||||
|
|
||||||
devMode->dmCopies = m_printNoCopies;
|
devMode->dmCopies = m_printNoCopies;
|
||||||
devMode->dmFields |= DM_COPIES;
|
devMode->dmFields |= DM_COPIES;
|
||||||
|
|
||||||
//// Printer name
|
//// Printer name
|
||||||
|
|
||||||
if (m_printerName != "")
|
if (m_printerName != "")
|
||||||
{
|
{
|
||||||
// TODO: make this Unicode compatible
|
// TODO: make this Unicode compatible
|
||||||
@@ -281,18 +297,18 @@ void wxPrintData::ConvertToNative()
|
|||||||
devMode->dmDeviceName[i] = m_printerName.GetChar(i);
|
devMode->dmDeviceName[i] = m_printerName.GetChar(i);
|
||||||
devMode->dmDeviceName[i] = 0;
|
devMode->dmDeviceName[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//// Colour
|
//// Colour
|
||||||
|
|
||||||
if (m_colour)
|
if (m_colour)
|
||||||
devMode->dmColor = DMCOLOR_COLOR;
|
devMode->dmColor = DMCOLOR_COLOR;
|
||||||
else
|
else
|
||||||
devMode->dmColor = DMCOLOR_MONOCHROME;
|
devMode->dmColor = DMCOLOR_MONOCHROME;
|
||||||
|
|
||||||
devMode->dmFields |= DM_COLOR;
|
devMode->dmFields |= DM_COLOR;
|
||||||
|
|
||||||
//// Paper size
|
//// Paper size
|
||||||
|
|
||||||
if (m_paperId == wxPAPER_NONE)
|
if (m_paperId == wxPAPER_NONE)
|
||||||
{
|
{
|
||||||
devMode->dmPaperWidth = m_paperSize.x * 10;
|
devMode->dmPaperWidth = m_paperSize.x * 10;
|
||||||
@@ -312,9 +328,9 @@ void wxPrintData::ConvertToNative()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//// Duplex
|
//// Duplex
|
||||||
|
|
||||||
int duplex;
|
int duplex;
|
||||||
switch (m_duplexMode)
|
switch (m_duplexMode)
|
||||||
{
|
{
|
||||||
@@ -331,9 +347,9 @@ void wxPrintData::ConvertToNative()
|
|||||||
}
|
}
|
||||||
devMode->dmDuplex = duplex;
|
devMode->dmDuplex = duplex;
|
||||||
devMode->dmFields |= DM_DUPLEX;
|
devMode->dmFields |= DM_DUPLEX;
|
||||||
|
|
||||||
//// Quality
|
//// Quality
|
||||||
|
|
||||||
int quality;
|
int quality;
|
||||||
switch (m_printQuality)
|
switch (m_printQuality)
|
||||||
{
|
{
|
||||||
@@ -355,7 +371,7 @@ void wxPrintData::ConvertToNative()
|
|||||||
}
|
}
|
||||||
devMode->dmPrintQuality = quality;
|
devMode->dmPrintQuality = quality;
|
||||||
devMode->dmFields |= DM_PRINTQUALITY;
|
devMode->dmFields |= DM_PRINTQUALITY;
|
||||||
|
|
||||||
GlobalUnlock(hDevMode);
|
GlobalUnlock(hDevMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -370,14 +386,14 @@ void wxPrintData::ConvertFromNative()
|
|||||||
if ( hDevMode )
|
if ( hDevMode )
|
||||||
{
|
{
|
||||||
DEVMODE *devMode = (DEVMODE*) GlobalLock(hDevMode);
|
DEVMODE *devMode = (DEVMODE*) GlobalLock(hDevMode);
|
||||||
|
|
||||||
//// Orientation
|
//// Orientation
|
||||||
|
|
||||||
if (devMode->dmFields & DM_ORIENTATION)
|
if (devMode->dmFields & DM_ORIENTATION)
|
||||||
m_printOrientation = devMode->dmOrientation;
|
m_printOrientation = devMode->dmOrientation;
|
||||||
|
|
||||||
//// Collation
|
//// Collation
|
||||||
|
|
||||||
if (devMode->dmFields & DM_COLLATE)
|
if (devMode->dmFields & DM_COLLATE)
|
||||||
{
|
{
|
||||||
if (devMode->dmCollate == DMCOLLATE_TRUE)
|
if (devMode->dmCollate == DMCOLLATE_TRUE)
|
||||||
@@ -385,16 +401,16 @@ void wxPrintData::ConvertFromNative()
|
|||||||
else
|
else
|
||||||
m_printCollate = FALSE;
|
m_printCollate = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//// Number of copies
|
//// Number of copies
|
||||||
|
|
||||||
if (devMode->dmFields & DM_COPIES)
|
if (devMode->dmFields & DM_COPIES)
|
||||||
{
|
{
|
||||||
m_printNoCopies = devMode->dmCopies;
|
m_printNoCopies = devMode->dmCopies;
|
||||||
}
|
}
|
||||||
|
|
||||||
//// Printer name
|
//// Printer name
|
||||||
|
|
||||||
if (devMode->dmDeviceName[0] != 0)
|
if (devMode->dmDeviceName[0] != 0)
|
||||||
{
|
{
|
||||||
// TODO: make this Unicode compatible
|
// TODO: make this Unicode compatible
|
||||||
@@ -406,12 +422,12 @@ void wxPrintData::ConvertFromNative()
|
|||||||
i ++;
|
i ++;
|
||||||
}
|
}
|
||||||
buf[i] = 0;
|
buf[i] = 0;
|
||||||
|
|
||||||
m_printerName = buf;
|
m_printerName = buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
//// Colour
|
//// Colour
|
||||||
|
|
||||||
if (devMode->dmFields & DM_COLOR)
|
if (devMode->dmFields & DM_COLOR)
|
||||||
{
|
{
|
||||||
if (devMode->dmColor == DMCOLOR_COLOR)
|
if (devMode->dmColor == DMCOLOR_COLOR)
|
||||||
@@ -421,9 +437,9 @@ void wxPrintData::ConvertFromNative()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_colour = TRUE;
|
m_colour = TRUE;
|
||||||
|
|
||||||
//// Paper size
|
//// Paper size
|
||||||
|
|
||||||
if (devMode->dmFields & DM_PAPERSIZE)
|
if (devMode->dmFields & DM_PAPERSIZE)
|
||||||
{
|
{
|
||||||
if (wxThePrintPaperDatabase)
|
if (wxThePrintPaperDatabase)
|
||||||
@@ -439,7 +455,7 @@ void wxPrintData::ConvertFromNative()
|
|||||||
{
|
{
|
||||||
// Shouldn't really get here
|
// Shouldn't really get here
|
||||||
wxFAIL_MSG("Couldn't find paper size in paper database.");
|
wxFAIL_MSG("Couldn't find paper size in paper database.");
|
||||||
|
|
||||||
m_paperId = wxPAPER_NONE;
|
m_paperId = wxPAPER_NONE;
|
||||||
m_paperSize.x = 0;
|
m_paperSize.x = 0;
|
||||||
m_paperSize.y = 0;
|
m_paperSize.y = 0;
|
||||||
@@ -449,7 +465,7 @@ void wxPrintData::ConvertFromNative()
|
|||||||
{
|
{
|
||||||
// Shouldn't really get here
|
// Shouldn't really get here
|
||||||
wxFAIL_MSG("Paper database wasn't initialized in wxPrintData::ConvertFromNative.");
|
wxFAIL_MSG("Paper database wasn't initialized in wxPrintData::ConvertFromNative.");
|
||||||
|
|
||||||
m_paperId = wxPAPER_NONE;
|
m_paperId = wxPAPER_NONE;
|
||||||
m_paperSize.x = 0;
|
m_paperSize.x = 0;
|
||||||
m_paperSize.y = 0;
|
m_paperSize.y = 0;
|
||||||
@@ -465,15 +481,15 @@ void wxPrintData::ConvertFromNative()
|
|||||||
{
|
{
|
||||||
// Shouldn't really get here
|
// Shouldn't really get here
|
||||||
wxFAIL_MSG("Couldn't find paper size from DEVMODE.");
|
wxFAIL_MSG("Couldn't find paper size from DEVMODE.");
|
||||||
|
|
||||||
m_paperSize.x = 0;
|
m_paperSize.x = 0;
|
||||||
m_paperSize.y = 0;
|
m_paperSize.y = 0;
|
||||||
m_paperId = wxPAPER_NONE;
|
m_paperId = wxPAPER_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//// Duplex
|
//// Duplex
|
||||||
|
|
||||||
if (devMode->dmFields & DM_DUPLEX)
|
if (devMode->dmFields & DM_DUPLEX)
|
||||||
{
|
{
|
||||||
switch (devMode->dmDuplex)
|
switch (devMode->dmDuplex)
|
||||||
@@ -492,9 +508,9 @@ void wxPrintData::ConvertFromNative()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_duplexMode = wxDUPLEX_SIMPLEX;
|
m_duplexMode = wxDUPLEX_SIMPLEX;
|
||||||
|
|
||||||
//// Quality
|
//// Quality
|
||||||
|
|
||||||
if (devMode->dmFields & DM_PRINTQUALITY)
|
if (devMode->dmFields & DM_PRINTQUALITY)
|
||||||
{
|
{
|
||||||
switch (devMode->dmPrintQuality)
|
switch (devMode->dmPrintQuality)
|
||||||
@@ -517,13 +533,13 @@ void wxPrintData::ConvertFromNative()
|
|||||||
// will the application know if it's high, low, draft etc.??
|
// will the application know if it's high, low, draft etc.??
|
||||||
// wxFAIL_MSG("Warning: DM_PRINTQUALITY was not one of the standard values.");
|
// wxFAIL_MSG("Warning: DM_PRINTQUALITY was not one of the standard values.");
|
||||||
m_printQuality = devMode->dmPrintQuality; break;
|
m_printQuality = devMode->dmPrintQuality; break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_printQuality = wxPRINT_QUALITY_HIGH;
|
m_printQuality = wxPRINT_QUALITY_HIGH;
|
||||||
|
|
||||||
GlobalUnlock(hDevMode);
|
GlobalUnlock(hDevMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -556,7 +572,7 @@ void wxPrintData::operator=(const wxPrintData& data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For compatibility
|
// For compatibility
|
||||||
#if (defined(__WXMOTIF__) || defined(__WXGTK__)) && wxUSE_POSTSCRIPT
|
#if wxCOMPATIBILITY_WITH_PRINTSETUPDATA
|
||||||
void wxPrintData::operator=(const wxPrintSetupData& setupData)
|
void wxPrintData::operator=(const wxPrintSetupData& setupData)
|
||||||
{
|
{
|
||||||
SetPrinterCommand(setupData.GetPrinterCommand());
|
SetPrinterCommand(setupData.GetPrinterCommand());
|
||||||
@@ -579,12 +595,12 @@ void wxPrintData::operator=(const wxPrintSetupData& setupData)
|
|||||||
SetColour(setupData.GetColour());
|
SetColour(setupData.GetColour());
|
||||||
SetFilename(setupData.GetPrinterFile());
|
SetFilename(setupData.GetPrinterFile());
|
||||||
}
|
}
|
||||||
#endif
|
#endif // wxCOMPATIBILITY_WITH_PRINTSETUPDATA
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Print dialog data
|
// ----------------------------------------------------------------------------
|
||||||
*/
|
// Print dialog data
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxPrintDialogData::wxPrintDialogData()
|
wxPrintDialogData::wxPrintDialogData()
|
||||||
{
|
{
|
||||||
@@ -689,7 +705,7 @@ void wxPrintDialogData::ConvertToNative()
|
|||||||
pd->nMinPage = (UINT)m_printMinPage;
|
pd->nMinPage = (UINT)m_printMinPage;
|
||||||
pd->nMaxPage = (UINT)m_printMaxPage;
|
pd->nMaxPage = (UINT)m_printMaxPage;
|
||||||
pd->nCopies = (UINT)m_printNoCopies;
|
pd->nCopies = (UINT)m_printNoCopies;
|
||||||
|
|
||||||
pd->Flags = PD_RETURNDC ;
|
pd->Flags = PD_RETURNDC ;
|
||||||
|
|
||||||
#ifdef __GNUWIN32__
|
#ifdef __GNUWIN32__
|
||||||
@@ -708,7 +724,7 @@ void wxPrintDialogData::ConvertToNative()
|
|||||||
pd->lpSetupTemplateName = NULL;
|
pd->lpSetupTemplateName = NULL;
|
||||||
pd->hPrintTemplate = (HGLOBAL) NULL;
|
pd->hPrintTemplate = (HGLOBAL) NULL;
|
||||||
pd->hSetupTemplate = (HGLOBAL) NULL;
|
pd->hSetupTemplate = (HGLOBAL) NULL;
|
||||||
|
|
||||||
if ( m_printAllPages )
|
if ( m_printAllPages )
|
||||||
pd->Flags |= PD_ALLPAGES;
|
pd->Flags |= PD_ALLPAGES;
|
||||||
if ( m_printCollate )
|
if ( m_printCollate )
|
||||||
@@ -754,7 +770,7 @@ void wxPrintDialogData::ConvertFromNative()
|
|||||||
m_printMinPage = pd->nMinPage ;
|
m_printMinPage = pd->nMinPage ;
|
||||||
m_printMaxPage = pd->nMaxPage ;
|
m_printMaxPage = pd->nMaxPage ;
|
||||||
m_printNoCopies = pd->nCopies ;
|
m_printNoCopies = pd->nCopies ;
|
||||||
|
|
||||||
m_printAllPages = ((pd->Flags & PD_ALLPAGES) == PD_ALLPAGES);
|
m_printAllPages = ((pd->Flags & PD_ALLPAGES) == PD_ALLPAGES);
|
||||||
m_printCollate = ((pd->Flags & PD_COLLATE) == PD_COLLATE);
|
m_printCollate = ((pd->Flags & PD_COLLATE) == PD_COLLATE);
|
||||||
m_printToFile = ((pd->Flags & PD_PRINTTOFILE) == PD_PRINTTOFILE);
|
m_printToFile = ((pd->Flags & PD_PRINTTOFILE) == PD_PRINTTOFILE);
|
||||||
@@ -773,7 +789,7 @@ void wxPrintDialogData::ConvertFromNative()
|
|||||||
m_printData.SetPortName((LPSTR)lpDevNames + lpDevNames->wDriverOffset);
|
m_printData.SetPortName((LPSTR)lpDevNames + lpDevNames->wDriverOffset);
|
||||||
wxString devName = (LPSTR)lpDevNames + lpDevNames->wDeviceOffset;
|
wxString devName = (LPSTR)lpDevNames + lpDevNames->wDeviceOffset;
|
||||||
GlobalUnlock(pd->hDevNames);
|
GlobalUnlock(pd->hDevNames);
|
||||||
|
|
||||||
// wxASSERT_MSG( (m_printerName == "" || (devName == m_printerName)), "Printer name obtained from DEVMODE and DEVNAMES were different!");
|
// wxASSERT_MSG( (m_printerName == "" || (devName == m_printerName)), "Printer name obtained from DEVMODE and DEVNAMES were different!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -784,14 +800,14 @@ void wxPrintDialogData::SetOwnerWindow(wxWindow* win)
|
|||||||
{
|
{
|
||||||
if ( m_printDlgData == NULL )
|
if ( m_printDlgData == NULL )
|
||||||
ConvertToNative();
|
ConvertToNative();
|
||||||
|
|
||||||
if ( m_printDlgData != NULL && win != NULL)
|
if ( m_printDlgData != NULL && win != NULL)
|
||||||
{
|
{
|
||||||
PRINTDLG *pd = (PRINTDLG *) m_printDlgData ;
|
PRINTDLG *pd = (PRINTDLG *) m_printDlgData ;
|
||||||
pd->hwndOwner=(HWND) win->GetHWND();
|
pd->hwndOwner=(HWND) win->GetHWND();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif // MSW
|
||||||
|
|
||||||
void wxPrintDialogData::operator=(const wxPrintDialogData& data)
|
void wxPrintDialogData::operator=(const wxPrintDialogData& data)
|
||||||
{
|
{
|
||||||
@@ -817,9 +833,9 @@ void wxPrintDialogData::operator=(const wxPrintData& data)
|
|||||||
m_printData = data;
|
m_printData = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// ----------------------------------------------------------------------------
|
||||||
* wxPageSetupDialogData
|
// wxPageSetupDialogData
|
||||||
*/
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxPageSetupDialogData::wxPageSetupDialogData()
|
wxPageSetupDialogData::wxPageSetupDialogData()
|
||||||
{
|
{
|
||||||
@@ -911,7 +927,7 @@ void wxPageSetupDialogData::operator=(const wxPrintData& data)
|
|||||||
m_printData = data;
|
m_printData = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__WXMSW__) && defined(__WIN95__)
|
#if defined(__WIN95__)
|
||||||
void wxPageSetupDialogData::ConvertToNative()
|
void wxPageSetupDialogData::ConvertToNative()
|
||||||
{
|
{
|
||||||
m_printData.ConvertToNative();
|
m_printData.ConvertToNative();
|
||||||
@@ -945,7 +961,7 @@ void wxPageSetupDialogData::ConvertToNative()
|
|||||||
// pd->hDevMode = GlobalAlloc(GMEM_MOVEABLE, sizeof(DEVMODE));
|
// pd->hDevMode = GlobalAlloc(GMEM_MOVEABLE, sizeof(DEVMODE));
|
||||||
|
|
||||||
pd->Flags = PSD_MARGINS|PSD_MINMARGINS;
|
pd->Flags = PSD_MARGINS|PSD_MINMARGINS;
|
||||||
|
|
||||||
if ( m_defaultMinMargins )
|
if ( m_defaultMinMargins )
|
||||||
pd->Flags |= PSD_DEFAULTMINMARGINS;
|
pd->Flags |= PSD_DEFAULTMINMARGINS;
|
||||||
if ( !m_enableMargins )
|
if ( !m_enableMargins )
|
||||||
@@ -968,27 +984,27 @@ void wxPageSetupDialogData::ConvertToNative()
|
|||||||
pd->hwndOwner=(HWND)NULL;
|
pd->hwndOwner=(HWND)NULL;
|
||||||
pd->hDevNames=(HWND)NULL;
|
pd->hDevNames=(HWND)NULL;
|
||||||
pd->hInstance=(HINSTANCE)NULL;
|
pd->hInstance=(HINSTANCE)NULL;
|
||||||
|
|
||||||
pd->ptPaperSize.x = m_paperSize.x * 100;
|
pd->ptPaperSize.x = m_paperSize.x * 100;
|
||||||
pd->ptPaperSize.y = m_paperSize.y * 100;
|
pd->ptPaperSize.y = m_paperSize.y * 100;
|
||||||
|
|
||||||
pd->rtMinMargin.left = m_minMarginTopLeft.x * 100;
|
pd->rtMinMargin.left = m_minMarginTopLeft.x * 100;
|
||||||
pd->rtMinMargin.top = m_minMarginTopLeft.y * 100;
|
pd->rtMinMargin.top = m_minMarginTopLeft.y * 100;
|
||||||
pd->rtMinMargin.right = m_minMarginBottomRight.x * 100;
|
pd->rtMinMargin.right = m_minMarginBottomRight.x * 100;
|
||||||
pd->rtMinMargin.bottom = m_minMarginBottomRight.y * 100;
|
pd->rtMinMargin.bottom = m_minMarginBottomRight.y * 100;
|
||||||
|
|
||||||
pd->rtMargin.left = m_marginTopLeft.x * 100;
|
pd->rtMargin.left = m_marginTopLeft.x * 100;
|
||||||
pd->rtMargin.top = m_marginTopLeft.y * 100;
|
pd->rtMargin.top = m_marginTopLeft.y * 100;
|
||||||
pd->rtMargin.right = m_marginBottomRight.x * 100;
|
pd->rtMargin.right = m_marginBottomRight.x * 100;
|
||||||
pd->rtMargin.bottom = m_marginBottomRight.y * 100;
|
pd->rtMargin.bottom = m_marginBottomRight.y * 100;
|
||||||
|
|
||||||
pd->lCustData = 0;
|
pd->lCustData = 0;
|
||||||
pd->lpfnPageSetupHook = NULL;
|
pd->lpfnPageSetupHook = NULL;
|
||||||
pd->lpfnPagePaintHook = NULL;
|
pd->lpfnPagePaintHook = NULL;
|
||||||
pd->hPageSetupTemplate = NULL;
|
pd->hPageSetupTemplate = NULL;
|
||||||
pd->lpPageSetupTemplateName = NULL;
|
pd->lpPageSetupTemplateName = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if ( pd->hDevMode )
|
if ( pd->hDevMode )
|
||||||
{
|
{
|
||||||
DEVMODE *devMode = (DEVMODE*) GlobalLock(pd->hDevMode);
|
DEVMODE *devMode = (DEVMODE*) GlobalLock(pd->hDevMode);
|
||||||
@@ -1006,7 +1022,7 @@ void wxPageSetupDialogData::ConvertFromNative()
|
|||||||
PAGESETUPDLG *pd = (PAGESETUPDLG *) m_pageSetupData ;
|
PAGESETUPDLG *pd = (PAGESETUPDLG *) m_pageSetupData ;
|
||||||
if ( !pd )
|
if ( !pd )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Pass the devmode data back to the wxPrintData structure where it really belongs.
|
// Pass the devmode data back to the wxPrintData structure where it really belongs.
|
||||||
if (pd->hDevMode)
|
if (pd->hDevMode)
|
||||||
{
|
{
|
||||||
@@ -1022,7 +1038,7 @@ void wxPageSetupDialogData::ConvertFromNative()
|
|||||||
m_printData.ConvertFromNative();
|
m_printData.ConvertFromNative();
|
||||||
|
|
||||||
pd->Flags = PSD_MARGINS|PSD_MINMARGINS;
|
pd->Flags = PSD_MARGINS|PSD_MINMARGINS;
|
||||||
|
|
||||||
m_defaultMinMargins = ((pd->Flags & PSD_DEFAULTMINMARGINS) == PSD_DEFAULTMINMARGINS);
|
m_defaultMinMargins = ((pd->Flags & PSD_DEFAULTMINMARGINS) == PSD_DEFAULTMINMARGINS);
|
||||||
m_enableMargins = ((pd->Flags & PSD_DISABLEMARGINS) != PSD_DISABLEMARGINS);
|
m_enableMargins = ((pd->Flags & PSD_DISABLEMARGINS) != PSD_DISABLEMARGINS);
|
||||||
m_enableOrientation = ((pd->Flags & PSD_DISABLEORIENTATION) != PSD_DISABLEORIENTATION);
|
m_enableOrientation = ((pd->Flags & PSD_DISABLEORIENTATION) != PSD_DISABLEORIENTATION);
|
||||||
@@ -1030,15 +1046,15 @@ void wxPageSetupDialogData::ConvertFromNative()
|
|||||||
m_enablePrinter = ((pd->Flags & PSD_DISABLEPRINTER) != PSD_DISABLEPRINTER);
|
m_enablePrinter = ((pd->Flags & PSD_DISABLEPRINTER) != PSD_DISABLEPRINTER);
|
||||||
m_getDefaultInfo = ((pd->Flags & PSD_RETURNDEFAULT) == PSD_RETURNDEFAULT);
|
m_getDefaultInfo = ((pd->Flags & PSD_RETURNDEFAULT) == PSD_RETURNDEFAULT);
|
||||||
m_enableHelp = ((pd->Flags & PSD_SHOWHELP) == PSD_SHOWHELP);
|
m_enableHelp = ((pd->Flags & PSD_SHOWHELP) == PSD_SHOWHELP);
|
||||||
|
|
||||||
m_paperSize.x = pd->ptPaperSize.x / 100;
|
m_paperSize.x = pd->ptPaperSize.x / 100;
|
||||||
m_paperSize.y = pd->ptPaperSize.y / 100;
|
m_paperSize.y = pd->ptPaperSize.y / 100;
|
||||||
|
|
||||||
m_minMarginTopLeft.x = pd->rtMinMargin.left / 100;
|
m_minMarginTopLeft.x = pd->rtMinMargin.left / 100;
|
||||||
m_minMarginTopLeft.y = pd->rtMinMargin.top / 100;
|
m_minMarginTopLeft.y = pd->rtMinMargin.top / 100;
|
||||||
m_minMarginBottomRight.x = pd->rtMinMargin.right / 100;
|
m_minMarginBottomRight.x = pd->rtMinMargin.right / 100;
|
||||||
m_minMarginBottomRight.y = pd->rtMinMargin.bottom / 100;
|
m_minMarginBottomRight.y = pd->rtMinMargin.bottom / 100;
|
||||||
|
|
||||||
m_marginTopLeft.x = pd->rtMargin.left / 100 ;
|
m_marginTopLeft.x = pd->rtMargin.left / 100 ;
|
||||||
m_marginTopLeft.y = pd->rtMargin.top / 100 ;
|
m_marginTopLeft.y = pd->rtMargin.top / 100 ;
|
||||||
m_marginBottomRight.x = pd->rtMargin.right / 100 ;
|
m_marginBottomRight.x = pd->rtMargin.right / 100 ;
|
||||||
@@ -1049,14 +1065,14 @@ void wxPageSetupDialogData::SetOwnerWindow(wxWindow* win)
|
|||||||
{
|
{
|
||||||
if ( m_pageSetupData == NULL )
|
if ( m_pageSetupData == NULL )
|
||||||
ConvertToNative();
|
ConvertToNative();
|
||||||
|
|
||||||
if ( m_pageSetupData != NULL && win != NULL)
|
if ( m_pageSetupData != NULL && win != NULL)
|
||||||
{
|
{
|
||||||
PAGESETUPDLG *pd = (PAGESETUPDLG *) m_pageSetupData ;
|
PAGESETUPDLG *pd = (PAGESETUPDLG *) m_pageSetupData ;
|
||||||
pd->hwndOwner=(HWND) win->GetHWND();
|
pd->hwndOwner=(HWND) win->GetHWND();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif // Win95
|
||||||
|
|
||||||
// If a corresponding paper type is found in the paper database, will set the m_printData
|
// If a corresponding paper type is found in the paper database, will set the m_printData
|
||||||
// paper size id member as well.
|
// paper size id member as well.
|
||||||
@@ -1079,7 +1095,9 @@ void wxPageSetupDialogData::SetPaperSize(wxPaperSize id)
|
|||||||
// paper id
|
// paper id
|
||||||
void wxPageSetupDialogData::CalculateIdFromPaperSize()
|
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();
|
wxSize sz = GetPaperSize();
|
||||||
|
|
||||||
@@ -1089,11 +1107,13 @@ void wxPageSetupDialogData::CalculateIdFromPaperSize()
|
|||||||
m_printData.SetPaperId(id);
|
m_printData.SetPaperId(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use paper id in wxPrintData to set this object's paper size
|
// Use paper id in wxPrintData to set this object's paper size
|
||||||
void wxPageSetupDialogData::CalculatePaperSizeFromId()
|
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());
|
wxSize sz = wxThePrintPaperDatabase->GetSize(m_printData.GetPaperId());
|
||||||
|
|
||||||
@@ -1104,3 +1124,4 @@ void wxPageSetupDialogData::CalculatePaperSizeFromId()
|
|||||||
m_paperSize.y = sz.y * 10;
|
m_paperSize.y = sz.y * 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -110,12 +110,12 @@ wxWindow *wxPrinterBase::CreateAbortWindow(wxWindow *parent, wxPrintout *WXUNUSE
|
|||||||
{
|
{
|
||||||
wxPrintAbortDialog *dialog = new wxPrintAbortDialog(parent, _("Printing"), wxPoint(0, 0), wxSize(400, 400), wxDEFAULT_DIALOG_STYLE);
|
wxPrintAbortDialog *dialog = new wxPrintAbortDialog(parent, _("Printing"), wxPoint(0, 0), wxSize(400, 400), wxDEFAULT_DIALOG_STYLE);
|
||||||
(void) new wxStaticText(dialog, -1, _("Please wait..."), wxPoint(5, 5));
|
(void) new wxStaticText(dialog, -1, _("Please wait..."), wxPoint(5, 5));
|
||||||
|
|
||||||
wxButton *button = new wxButton(dialog, wxID_CANCEL, _("Cancel"), wxPoint(5, 30));
|
wxButton *button = new wxButton(dialog, wxID_CANCEL, _("Cancel"), wxPoint(5, 30));
|
||||||
|
|
||||||
dialog->Fit();
|
dialog->Fit();
|
||||||
button->Centre(wxHORIZONTAL);
|
button->Centre(wxHORIZONTAL);
|
||||||
|
|
||||||
dialog->Centre();
|
dialog->Centre();
|
||||||
return dialog;
|
return dialog;
|
||||||
}
|
}
|
||||||
@@ -189,7 +189,7 @@ wxScrolledWindow(parent, -1, pos, size, style, name)
|
|||||||
{
|
{
|
||||||
m_printPreview = preview;
|
m_printPreview = preview;
|
||||||
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
|
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
|
||||||
|
|
||||||
SetScrollbars(15, 18, 100, 100);
|
SetScrollbars(15, 18, 100, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,7 +201,7 @@ void wxPreviewCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
wxPaintDC dc(this);
|
wxPaintDC dc(this);
|
||||||
PrepareDC( dc );
|
PrepareDC( dc );
|
||||||
|
|
||||||
if (m_printPreview)
|
if (m_printPreview)
|
||||||
{
|
{
|
||||||
m_printPreview->PaintPage(this, dc);
|
m_printPreview->PaintPage(this, dc);
|
||||||
@@ -213,7 +213,7 @@ void wxPreviewCanvas::OnSysColourChanged(wxSysColourChangedEvent& event)
|
|||||||
{
|
{
|
||||||
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
|
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
|
||||||
Refresh();
|
Refresh();
|
||||||
|
|
||||||
// Propagate the event to the non-top-level children
|
// Propagate the event to the non-top-level children
|
||||||
wxWindow::OnSysColourChanged(event);
|
wxWindow::OnSysColourChanged(event);
|
||||||
}
|
}
|
||||||
@@ -223,12 +223,12 @@ void wxPreviewCanvas::OnSysColourChanged(wxSysColourChangedEvent& event)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxPreviewControlBar, wxPanel)
|
BEGIN_EVENT_TABLE(wxPreviewControlBar, wxPanel)
|
||||||
EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnWindowClose)
|
EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnWindowClose)
|
||||||
EVT_BUTTON(wxID_PREVIEW_PRINT, wxPreviewControlBar::OnPrint)
|
EVT_BUTTON(wxID_PREVIEW_PRINT, wxPreviewControlBar::OnPrint)
|
||||||
EVT_BUTTON(wxID_PREVIEW_PREVIOUS, wxPreviewControlBar::OnPrevious)
|
EVT_BUTTON(wxID_PREVIEW_PREVIOUS, wxPreviewControlBar::OnPrevious)
|
||||||
EVT_BUTTON(wxID_PREVIEW_NEXT, wxPreviewControlBar::OnNext)
|
EVT_BUTTON(wxID_PREVIEW_NEXT, wxPreviewControlBar::OnNext)
|
||||||
EVT_CHOICE(wxID_PREVIEW_ZOOM, wxPreviewControlBar::OnZoom)
|
EVT_CHOICE(wxID_PREVIEW_ZOOM, wxPreviewControlBar::OnZoom)
|
||||||
EVT_PAINT(wxPreviewControlBar::OnPaint)
|
EVT_PAINT(wxPreviewControlBar::OnPaint)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
wxPreviewControlBar::wxPreviewControlBar(wxPrintPreviewBase *preview, long buttons,
|
wxPreviewControlBar::wxPreviewControlBar(wxPrintPreviewBase *preview, long buttons,
|
||||||
@@ -252,7 +252,7 @@ wxPreviewControlBar::~wxPreviewControlBar()
|
|||||||
void wxPreviewControlBar::OnPaint(wxPaintEvent& WXUNUSED(event))
|
void wxPreviewControlBar::OnPaint(wxPaintEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxPaintDC dc(this);
|
wxPaintDC dc(this);
|
||||||
|
|
||||||
int w, h;
|
int w, h;
|
||||||
GetSize(&w, &h);
|
GetSize(&w, &h);
|
||||||
dc.SetPen(*wxBLACK_PEN);
|
dc.SetPen(*wxBLACK_PEN);
|
||||||
@@ -312,60 +312,60 @@ void wxPreviewControlBar::OnZoom(wxCommandEvent& WXUNUSED(event))
|
|||||||
void wxPreviewControlBar::CreateButtons()
|
void wxPreviewControlBar::CreateButtons()
|
||||||
{
|
{
|
||||||
SetSize(0, 0, 400, 40);
|
SetSize(0, 0, 400, 40);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
int fontSize = 9;
|
int fontSize = 9;
|
||||||
#else
|
#else
|
||||||
int fontSize = 10;
|
int fontSize = 10;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxFont buttonFont(fontSize, wxSWISS, wxNORMAL, wxBOLD);
|
wxFont buttonFont(fontSize, wxSWISS, wxNORMAL, wxBOLD);
|
||||||
SetFont(buttonFont);
|
SetFont(buttonFont);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int buttonWidth = 65;
|
int buttonWidth = 65;
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
int buttonHeight = -1;
|
int buttonHeight = -1;
|
||||||
#else
|
#else
|
||||||
int buttonHeight = 24;
|
int buttonHeight = 24;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int x = 5;
|
int x = 5;
|
||||||
int y = 5;
|
int y = 5;
|
||||||
|
|
||||||
#ifdef __WXMOTIF__
|
#ifdef __WXMOTIF__
|
||||||
int gap = 15;
|
int gap = 15;
|
||||||
#else
|
#else
|
||||||
int gap = 5;
|
int gap = 5;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_closeButton = new wxButton(this, wxID_PREVIEW_CLOSE, _("Close"),
|
m_closeButton = new wxButton(this, wxID_PREVIEW_CLOSE, _("Close"),
|
||||||
wxPoint(x, y), wxSize(buttonWidth, buttonHeight));
|
wxPoint(x, y), wxSize(buttonWidth, buttonHeight));
|
||||||
|
|
||||||
x += gap + buttonWidth;
|
x += gap + buttonWidth;
|
||||||
|
|
||||||
if (m_buttonFlags & wxPREVIEW_PRINT)
|
if (m_buttonFlags & wxPREVIEW_PRINT)
|
||||||
{
|
{
|
||||||
m_printButton = new wxButton(this, wxID_PREVIEW_PRINT, _("Print..."), wxPoint(x, y),
|
m_printButton = new wxButton(this, wxID_PREVIEW_PRINT, _("Print..."), wxPoint(x, y),
|
||||||
wxSize(buttonWidth, buttonHeight));
|
wxSize(buttonWidth, buttonHeight));
|
||||||
x += gap + buttonWidth;
|
x += gap + buttonWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_buttonFlags & wxPREVIEW_PREVIOUS)
|
if (m_buttonFlags & wxPREVIEW_PREVIOUS)
|
||||||
{
|
{
|
||||||
m_previousPageButton = new wxButton(this, wxID_PREVIEW_PREVIOUS, "<<", wxPoint(x, y),
|
m_previousPageButton = new wxButton(this, wxID_PREVIEW_PREVIOUS, "<<", wxPoint(x, y),
|
||||||
wxSize(buttonWidth, buttonHeight));
|
wxSize(buttonWidth, buttonHeight));
|
||||||
x += gap + buttonWidth;
|
x += gap + buttonWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_buttonFlags & wxPREVIEW_NEXT)
|
if (m_buttonFlags & wxPREVIEW_NEXT)
|
||||||
{
|
{
|
||||||
m_nextPageButton = new wxButton(this, wxID_PREVIEW_NEXT, ">>",
|
m_nextPageButton = new wxButton(this, wxID_PREVIEW_NEXT, ">>",
|
||||||
wxPoint(x, y), wxSize(buttonWidth, buttonHeight));
|
wxPoint(x, y), wxSize(buttonWidth, buttonHeight));
|
||||||
x += gap + buttonWidth;
|
x += gap + buttonWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Yes, this look stupid, but this is because gcc gives up otherwise.
|
// Yes, this look stupid, but this is because gcc gives up otherwise.
|
||||||
wxString *choices = new wxString[23];
|
wxString *choices = new wxString[23];
|
||||||
choices[0] = "10%";
|
choices[0] = "10%";
|
||||||
@@ -391,7 +391,7 @@ void wxPreviewControlBar::CreateButtons()
|
|||||||
choices[20] = "120%";
|
choices[20] = "120%";
|
||||||
choices[21] = "150%";
|
choices[21] = "150%";
|
||||||
choices[22] = "200%";
|
choices[22] = "200%";
|
||||||
|
|
||||||
int n = 23;
|
int n = 23;
|
||||||
if (m_buttonFlags & wxPREVIEW_ZOOM)
|
if (m_buttonFlags & wxPREVIEW_ZOOM)
|
||||||
{
|
{
|
||||||
@@ -399,9 +399,9 @@ void wxPreviewControlBar::CreateButtons()
|
|||||||
wxSize(100, -1), n, (wxString *)choices);
|
wxSize(100, -1), n, (wxString *)choices);
|
||||||
SetZoomControl(m_printPreview->GetZoom());
|
SetZoomControl(m_printPreview->GetZoom());
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] choices;
|
delete[] choices;
|
||||||
|
|
||||||
// m_closeButton->SetDefault();
|
// m_closeButton->SetDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -450,7 +450,7 @@ wxPreviewFrame::~wxPreviewFrame()
|
|||||||
void wxPreviewFrame::OnCloseWindow(wxCloseEvent& event)
|
void wxPreviewFrame::OnCloseWindow(wxCloseEvent& event)
|
||||||
{
|
{
|
||||||
MakeModal(FALSE);
|
MakeModal(FALSE);
|
||||||
|
|
||||||
// Need to delete the printout and the print preview
|
// Need to delete the printout and the print preview
|
||||||
wxPrintout *printout = m_printPreview->GetPrintout();
|
wxPrintout *printout = m_printPreview->GetPrintout();
|
||||||
if (printout)
|
if (printout)
|
||||||
@@ -461,22 +461,22 @@ void wxPreviewFrame::OnCloseWindow(wxCloseEvent& event)
|
|||||||
m_printPreview->SetFrame(NULL);
|
m_printPreview->SetFrame(NULL);
|
||||||
}
|
}
|
||||||
delete m_printPreview;
|
delete m_printPreview;
|
||||||
|
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPreviewFrame::Initialize()
|
void wxPreviewFrame::Initialize()
|
||||||
{
|
{
|
||||||
CreateStatusBar();
|
CreateStatusBar();
|
||||||
|
|
||||||
CreateCanvas();
|
CreateCanvas();
|
||||||
CreateControlBar();
|
CreateControlBar();
|
||||||
|
|
||||||
m_printPreview->SetCanvas(m_previewCanvas);
|
m_printPreview->SetCanvas(m_previewCanvas);
|
||||||
m_printPreview->SetFrame(this);
|
m_printPreview->SetFrame(this);
|
||||||
|
|
||||||
// Set layout constraints here
|
// Set layout constraints here
|
||||||
|
|
||||||
// Control bar constraints
|
// Control bar constraints
|
||||||
wxLayoutConstraints *c1 = new wxLayoutConstraints;
|
wxLayoutConstraints *c1 = new wxLayoutConstraints;
|
||||||
// int w, h;
|
// int w, h;
|
||||||
@@ -487,28 +487,28 @@ void wxPreviewFrame::Initialize()
|
|||||||
#else
|
#else
|
||||||
h = 60;
|
h = 60;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
c1->left.SameAs (this, wxLeft);
|
c1->left.SameAs (this, wxLeft);
|
||||||
c1->top.SameAs (this, wxTop);
|
c1->top.SameAs (this, wxTop);
|
||||||
c1->right.SameAs (this, wxRight);
|
c1->right.SameAs (this, wxRight);
|
||||||
c1->height.Absolute (h);
|
c1->height.Absolute (h);
|
||||||
|
|
||||||
m_controlBar->SetConstraints(c1);
|
m_controlBar->SetConstraints(c1);
|
||||||
|
|
||||||
// Canvas constraints
|
// Canvas constraints
|
||||||
wxLayoutConstraints *c2 = new wxLayoutConstraints;
|
wxLayoutConstraints *c2 = new wxLayoutConstraints;
|
||||||
|
|
||||||
c2->left.SameAs (this, wxLeft);
|
c2->left.SameAs (this, wxLeft);
|
||||||
c2->top.Below (m_controlBar);
|
c2->top.Below (m_controlBar);
|
||||||
c2->right.SameAs (this, wxRight);
|
c2->right.SameAs (this, wxRight);
|
||||||
c2->bottom.SameAs (this, wxBottom);
|
c2->bottom.SameAs (this, wxBottom);
|
||||||
|
|
||||||
m_previewCanvas->SetConstraints(c2);
|
m_previewCanvas->SetConstraints(c2);
|
||||||
|
|
||||||
SetAutoLayout(TRUE);
|
SetAutoLayout(TRUE);
|
||||||
|
|
||||||
MakeModal(TRUE);
|
MakeModal(TRUE);
|
||||||
|
|
||||||
Layout();
|
Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -522,7 +522,7 @@ void wxPreviewFrame::CreateControlBar()
|
|||||||
long buttons = wxPREVIEW_DEFAULT;
|
long buttons = wxPREVIEW_DEFAULT;
|
||||||
if (m_printPreview->GetPrintoutForPrinting())
|
if (m_printPreview->GetPrintoutForPrinting())
|
||||||
buttons |= wxPREVIEW_PRINT;
|
buttons |= wxPREVIEW_PRINT;
|
||||||
|
|
||||||
m_controlBar = new wxPreviewControlBar(m_printPreview, buttons, this, wxPoint(0, 0), wxSize(400, 40));
|
m_controlBar = new wxPreviewControlBar(m_printPreview, buttons, this, wxPoint(0, 0), wxSize(400, 40));
|
||||||
m_controlBar->CreateButtons();
|
m_controlBar->CreateButtons();
|
||||||
}
|
}
|
||||||
@@ -531,17 +531,36 @@ void wxPreviewFrame::CreateControlBar()
|
|||||||
* Print preview
|
* 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_isOk = TRUE;
|
||||||
m_previewPrintout = printout;
|
m_previewPrintout = printout;
|
||||||
if (m_previewPrintout)
|
if (m_previewPrintout)
|
||||||
m_previewPrintout->SetIsPreview(TRUE);
|
m_previewPrintout->SetIsPreview(TRUE);
|
||||||
|
|
||||||
m_printPrintout = printoutForPrinting;
|
m_printPrintout = printoutForPrinting;
|
||||||
if (data)
|
|
||||||
m_printDialogData = (*data);
|
|
||||||
|
|
||||||
m_previewCanvas = NULL;
|
m_previewCanvas = NULL;
|
||||||
m_previewFrame = NULL;
|
m_previewFrame = NULL;
|
||||||
m_previewBitmap = NULL;
|
m_previewBitmap = NULL;
|
||||||
@@ -551,9 +570,9 @@ wxPrintPreviewBase::wxPrintPreviewBase(wxPrintout *printout, wxPrintout *printou
|
|||||||
m_leftMargin = 40;
|
m_leftMargin = 40;
|
||||||
m_pageWidth = 0;
|
m_pageWidth = 0;
|
||||||
m_pageHeight = 0;
|
m_pageHeight = 0;
|
||||||
|
|
||||||
printout->OnPreparePrinting();
|
printout->OnPreparePrinting();
|
||||||
|
|
||||||
// Get some parameters from the printout, if defined
|
// Get some parameters from the printout, if defined
|
||||||
int selFrom, selTo;
|
int selFrom, selTo;
|
||||||
printout->GetPageInfo(&m_minPage, &m_maxPage, &selFrom, &selTo);
|
printout->GetPageInfo(&m_minPage, &m_maxPage, &selFrom, &selTo);
|
||||||
@@ -573,14 +592,14 @@ bool wxPrintPreviewBase::SetCurrentPage(int pageNum)
|
|||||||
{
|
{
|
||||||
if (m_currentPage == pageNum)
|
if (m_currentPage == pageNum)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
m_currentPage = pageNum;
|
m_currentPage = pageNum;
|
||||||
if (m_previewBitmap)
|
if (m_previewBitmap)
|
||||||
{
|
{
|
||||||
delete m_previewBitmap;
|
delete m_previewBitmap;
|
||||||
m_previewBitmap = NULL;
|
m_previewBitmap = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_previewCanvas)
|
if (m_previewCanvas)
|
||||||
{
|
{
|
||||||
RenderPage(pageNum);
|
RenderPage(pageNum);
|
||||||
@@ -592,42 +611,42 @@ bool wxPrintPreviewBase::SetCurrentPage(int pageNum)
|
|||||||
bool wxPrintPreviewBase::PaintPage(wxWindow *canvas, wxDC& dc)
|
bool wxPrintPreviewBase::PaintPage(wxWindow *canvas, wxDC& dc)
|
||||||
{
|
{
|
||||||
DrawBlankPage(canvas, dc);
|
DrawBlankPage(canvas, dc);
|
||||||
|
|
||||||
if (!m_previewBitmap)
|
if (!m_previewBitmap)
|
||||||
RenderPage(m_currentPage);
|
RenderPage(m_currentPage);
|
||||||
|
|
||||||
if (!m_previewBitmap)
|
if (!m_previewBitmap)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!canvas)
|
if (!canvas)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
int canvasWidth, canvasHeight;
|
int canvasWidth, canvasHeight;
|
||||||
canvas->GetSize(&canvasWidth, &canvasHeight);
|
canvas->GetSize(&canvasWidth, &canvasHeight);
|
||||||
|
|
||||||
double zoomScale = ((float)m_currentZoom/(float)100);
|
double zoomScale = ((float)m_currentZoom/(float)100);
|
||||||
double actualWidth = (zoomScale*m_pageWidth*m_previewScale);
|
double actualWidth = (zoomScale*m_pageWidth*m_previewScale);
|
||||||
// float actualHeight = (float)(zoomScale*m_pageHeight*m_previewScale);
|
// float actualHeight = (float)(zoomScale*m_pageHeight*m_previewScale);
|
||||||
|
|
||||||
int x = (int) ((canvasWidth - actualWidth)/2.0);
|
int x = (int) ((canvasWidth - actualWidth)/2.0);
|
||||||
if (x < m_leftMargin)
|
if (x < m_leftMargin)
|
||||||
x = m_leftMargin;
|
x = m_leftMargin;
|
||||||
int y = m_topMargin;
|
int y = m_topMargin;
|
||||||
|
|
||||||
wxMemoryDC temp_dc;
|
wxMemoryDC temp_dc;
|
||||||
temp_dc.SelectObject(*m_previewBitmap);
|
temp_dc.SelectObject(*m_previewBitmap);
|
||||||
|
|
||||||
dc.Blit(x, y, m_previewBitmap->GetWidth(), m_previewBitmap->GetHeight(), &temp_dc, 0, 0);
|
dc.Blit(x, y, m_previewBitmap->GetWidth(), m_previewBitmap->GetHeight(), &temp_dc, 0, 0);
|
||||||
|
|
||||||
temp_dc.SelectObject(wxNullBitmap);
|
temp_dc.SelectObject(wxNullBitmap);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxPrintPreviewBase::RenderPage(int pageNum)
|
bool wxPrintPreviewBase::RenderPage(int pageNum)
|
||||||
{
|
{
|
||||||
int canvasWidth, canvasHeight;
|
int canvasWidth, canvasHeight;
|
||||||
|
|
||||||
if (!m_previewCanvas)
|
if (!m_previewCanvas)
|
||||||
{
|
{
|
||||||
wxMessageBox(_("wxPrintPreviewBase::RenderPage: must use wxPrintPreviewBase::SetCanvas to let me know about the canvas!"),
|
wxMessageBox(_("wxPrintPreviewBase::RenderPage: must use wxPrintPreviewBase::SetCanvas to let me know about the canvas!"),
|
||||||
@@ -635,17 +654,17 @@ bool wxPrintPreviewBase::RenderPage(int pageNum)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
m_previewCanvas->GetSize(&canvasWidth, &canvasHeight);
|
m_previewCanvas->GetSize(&canvasWidth, &canvasHeight);
|
||||||
|
|
||||||
double zoomScale = (m_currentZoom/100.0);
|
double zoomScale = (m_currentZoom/100.0);
|
||||||
int actualWidth = (int)(zoomScale*m_pageWidth*m_previewScale);
|
int actualWidth = (int)(zoomScale*m_pageWidth*m_previewScale);
|
||||||
int actualHeight = (int)(zoomScale*m_pageHeight*m_previewScale);
|
int actualHeight = (int)(zoomScale*m_pageHeight*m_previewScale);
|
||||||
|
|
||||||
int x = (int)((canvasWidth - actualWidth)/2.0);
|
int x = (int)((canvasWidth - actualWidth)/2.0);
|
||||||
if (x < m_leftMargin)
|
if (x < m_leftMargin)
|
||||||
x = m_leftMargin;
|
x = m_leftMargin;
|
||||||
// int y = m_topMargin;
|
// int y = m_topMargin;
|
||||||
|
|
||||||
|
|
||||||
if (!m_previewBitmap)
|
if (!m_previewBitmap)
|
||||||
{
|
{
|
||||||
m_previewBitmap = new wxBitmap((int)actualWidth, (int)actualHeight);
|
m_previewBitmap = new wxBitmap((int)actualWidth, (int)actualHeight);
|
||||||
@@ -657,44 +676,44 @@ bool wxPrintPreviewBase::RenderPage(int pageNum)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMemoryDC memoryDC;
|
wxMemoryDC memoryDC;
|
||||||
memoryDC.SelectObject(*m_previewBitmap);
|
memoryDC.SelectObject(*m_previewBitmap);
|
||||||
|
|
||||||
memoryDC.Clear();
|
memoryDC.Clear();
|
||||||
|
|
||||||
m_previewPrintout->SetDC(&memoryDC);
|
m_previewPrintout->SetDC(&memoryDC);
|
||||||
m_previewPrintout->SetPageSizePixels(m_pageWidth, m_pageHeight);
|
m_previewPrintout->SetPageSizePixels(m_pageWidth, m_pageHeight);
|
||||||
|
|
||||||
m_previewPrintout->OnBeginPrinting();
|
m_previewPrintout->OnBeginPrinting();
|
||||||
|
|
||||||
if (!m_previewPrintout->OnBeginDocument(m_printDialogData.GetFromPage(), m_printDialogData.GetToPage()))
|
if (!m_previewPrintout->OnBeginDocument(m_printDialogData.GetFromPage(), m_printDialogData.GetToPage()))
|
||||||
{
|
{
|
||||||
wxMessageBox(_("Could not start document preview."), _("Print Preview Failure"), wxOK);
|
wxMessageBox(_("Could not start document preview."), _("Print Preview Failure"), wxOK);
|
||||||
|
|
||||||
memoryDC.SelectObject(wxNullBitmap);
|
memoryDC.SelectObject(wxNullBitmap);
|
||||||
|
|
||||||
delete m_previewBitmap;
|
delete m_previewBitmap;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_previewPrintout->OnPrintPage(pageNum);
|
m_previewPrintout->OnPrintPage(pageNum);
|
||||||
m_previewPrintout->OnEndDocument();
|
m_previewPrintout->OnEndDocument();
|
||||||
m_previewPrintout->OnEndPrinting();
|
m_previewPrintout->OnEndPrinting();
|
||||||
|
|
||||||
m_previewPrintout->SetDC(NULL);
|
m_previewPrintout->SetDC(NULL);
|
||||||
|
|
||||||
memoryDC.SelectObject(wxNullBitmap);
|
memoryDC.SelectObject(wxNullBitmap);
|
||||||
|
|
||||||
char buf[200];
|
char buf[200];
|
||||||
if (m_maxPage != 0)
|
if (m_maxPage != 0)
|
||||||
sprintf(buf, _("Page %d of %d"), pageNum, m_maxPage);
|
sprintf(buf, _("Page %d of %d"), pageNum, m_maxPage);
|
||||||
else
|
else
|
||||||
sprintf(buf, _("Page %d"), pageNum);
|
sprintf(buf, _("Page %d"), pageNum);
|
||||||
|
|
||||||
if (m_previewFrame)
|
if (m_previewFrame)
|
||||||
m_previewFrame->SetStatusText(buf);
|
m_previewFrame->SetStatusText(buf);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -703,16 +722,16 @@ bool wxPrintPreviewBase::DrawBlankPage(wxWindow *canvas, wxDC& dc)
|
|||||||
{
|
{
|
||||||
int canvasWidth, canvasHeight;
|
int canvasWidth, canvasHeight;
|
||||||
canvas->GetSize(&canvasWidth, &canvasHeight);
|
canvas->GetSize(&canvasWidth, &canvasHeight);
|
||||||
|
|
||||||
float zoomScale = (float)((float)m_currentZoom/(float)100);
|
float zoomScale = (float)((float)m_currentZoom/(float)100);
|
||||||
float actualWidth = zoomScale*m_pageWidth*m_previewScale;
|
float actualWidth = zoomScale*m_pageWidth*m_previewScale;
|
||||||
float actualHeight = zoomScale*m_pageHeight*m_previewScale;
|
float actualHeight = zoomScale*m_pageHeight*m_previewScale;
|
||||||
|
|
||||||
float x = (float)((canvasWidth - actualWidth)/2.0);
|
float x = (float)((canvasWidth - actualWidth)/2.0);
|
||||||
if (x < m_leftMargin)
|
if (x < m_leftMargin)
|
||||||
x = (float)m_leftMargin;
|
x = (float)m_leftMargin;
|
||||||
float y = (float)m_topMargin;
|
float y = (float)m_topMargin;
|
||||||
|
|
||||||
// Draw shadow, allowing for 1-pixel border AROUND the actual page
|
// Draw shadow, allowing for 1-pixel border AROUND the actual page
|
||||||
int shadowOffset = 4;
|
int shadowOffset = 4;
|
||||||
dc.SetPen(*wxBLACK_PEN);
|
dc.SetPen(*wxBLACK_PEN);
|
||||||
@@ -722,20 +741,20 @@ bool wxPrintPreviewBase::DrawBlankPage(wxWindow *canvas, wxDC& dc)
|
|||||||
*/
|
*/
|
||||||
dc.DrawRectangle((int)(x + shadowOffset), (int)(y + actualHeight+1), (int)(actualWidth), shadowOffset);
|
dc.DrawRectangle((int)(x + shadowOffset), (int)(y + actualHeight+1), (int)(actualWidth), shadowOffset);
|
||||||
dc.DrawRectangle((int)(x + actualWidth), (int)(y + shadowOffset), shadowOffset, (int)(actualHeight));
|
dc.DrawRectangle((int)(x + actualWidth), (int)(y + shadowOffset), shadowOffset, (int)(actualHeight));
|
||||||
|
|
||||||
// Draw blank page allowing for 1-pixel border AROUND the actual page
|
// Draw blank page allowing for 1-pixel border AROUND the actual page
|
||||||
dc.SetPen(*wxBLACK_PEN);
|
dc.SetPen(*wxBLACK_PEN);
|
||||||
dc.SetBrush(*wxWHITE_BRUSH);
|
dc.SetBrush(*wxWHITE_BRUSH);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
wxRegion update_region = canvas->GetUpdateRegion();
|
wxRegion update_region = canvas->GetUpdateRegion();
|
||||||
wxRect r = update_region.GetBox();
|
wxRect r = update_region.GetBox();
|
||||||
|
|
||||||
printf( "x: %d y: %d w: %d h: %d.\n", (int)r.x, (int)r.y, (int)r.width, (int)r.height );
|
printf( "x: %d y: %d w: %d h: %d.\n", (int)r.x, (int)r.y, (int)r.width, (int)r.height );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
dc.DrawRectangle((int)(x-2), (int)(y-1), (int)(actualWidth+3), (int)(actualHeight+2));
|
dc.DrawRectangle((int)(x-2), (int)(y-1), (int)(actualWidth+3), (int)(actualHeight+2));
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -743,7 +762,7 @@ void wxPrintPreviewBase::SetZoom(int percent)
|
|||||||
{
|
{
|
||||||
if (m_currentZoom == percent)
|
if (m_currentZoom == percent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_currentZoom = percent;
|
m_currentZoom = percent;
|
||||||
if (m_previewBitmap)
|
if (m_previewBitmap)
|
||||||
{
|
{
|
||||||
@@ -751,7 +770,7 @@ void wxPrintPreviewBase::SetZoom(int percent)
|
|||||||
m_previewBitmap = NULL;
|
m_previewBitmap = NULL;
|
||||||
}
|
}
|
||||||
RenderPage(m_currentPage);
|
RenderPage(m_currentPage);
|
||||||
|
|
||||||
if (m_previewCanvas)
|
if (m_previewCanvas)
|
||||||
{
|
{
|
||||||
m_previewCanvas->Clear();
|
m_previewCanvas->Clear();
|
||||||
|
@@ -1935,7 +1935,7 @@ wxPostScriptPrintDialog::wxPostScriptPrintDialog (wxWindow *parent, const wxStri
|
|||||||
radio0->SetSelection((int)wxThePrintSetupData->GetPrinterOrientation() - 1);
|
radio0->SetSelection((int)wxThePrintSetupData->GetPrinterOrientation() - 1);
|
||||||
|
|
||||||
// @@@ Configuration hook
|
// @@@ Configuration hook
|
||||||
if (wxThePrintSetupData->GetPrintPreviewCommand() == NULL)
|
if ( !wxThePrintSetupData->GetPrintPreviewCommand() )
|
||||||
wxThePrintSetupData->SetPrintPreviewCommand(PS_VIEWER_PROG);
|
wxThePrintSetupData->SetPrintPreviewCommand(PS_VIEWER_PROG);
|
||||||
|
|
||||||
// wxGetResource ("wxWindows", "PSView", &wxThePrintSetupData->m_previewCommand);
|
// wxGetResource ("wxWindows", "PSView", &wxThePrintSetupData->m_previewCommand);
|
||||||
|
@@ -6,28 +6,36 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// declarations
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// headers
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "printps.h"
|
#pragma implementation "printps.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
#include "wx/dc.h"
|
#include "wx/dc.h"
|
||||||
#include "wx/app.h"
|
#include "wx/app.h"
|
||||||
#include "wx/msgdlg.h"
|
#include "wx/msgdlg.h"
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/generic/printps.h"
|
#include "wx/generic/printps.h"
|
||||||
@@ -38,21 +46,29 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxWin macros
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxPostScriptPrinter, wxPrinterBase)
|
IMPLEMENT_DYNAMIC_CLASS(wxPostScriptPrinter, wxPrinterBase)
|
||||||
IMPLEMENT_CLASS(wxPostScriptPrintPreview, wxPrintPreviewBase)
|
IMPLEMENT_CLASS(wxPostScriptPrintPreview, wxPrintPreviewBase)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
// ============================================================================
|
||||||
* Printer
|
// implementation
|
||||||
*/
|
// ============================================================================
|
||||||
|
|
||||||
wxPostScriptPrinter::wxPostScriptPrinter(wxPrintDialogData *data):
|
// ----------------------------------------------------------------------------
|
||||||
wxPrinterBase(data)
|
// Printer
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
wxPostScriptPrinter::wxPostScriptPrinter(wxPrintDialogData *data)
|
||||||
|
: wxPrinterBase(data)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPostScriptPrinter::~wxPostScriptPrinter(void)
|
wxPostScriptPrinter::~wxPostScriptPrinter()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,21 +76,21 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
|
|||||||
{
|
{
|
||||||
sm_abortIt = FALSE;
|
sm_abortIt = FALSE;
|
||||||
sm_abortWindow = (wxWindow *) NULL;
|
sm_abortWindow = (wxWindow *) NULL;
|
||||||
|
|
||||||
if (!printout)
|
if (!printout)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
printout->SetIsPreview(FALSE);
|
printout->SetIsPreview(FALSE);
|
||||||
printout->OnPreparePrinting();
|
printout->OnPreparePrinting();
|
||||||
|
|
||||||
// Get some parameters from the printout, if defined
|
// Get some parameters from the printout, if defined
|
||||||
int fromPage, toPage;
|
int fromPage, toPage;
|
||||||
int minPage, maxPage;
|
int minPage, maxPage;
|
||||||
printout->GetPageInfo(&minPage, &maxPage, &fromPage, &toPage);
|
printout->GetPageInfo(&minPage, &maxPage, &fromPage, &toPage);
|
||||||
|
|
||||||
if (maxPage == 0)
|
if (maxPage == 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
m_printDialogData.SetMinPage(minPage);
|
m_printDialogData.SetMinPage(minPage);
|
||||||
m_printDialogData.SetMaxPage(maxPage);
|
m_printDialogData.SetMaxPage(maxPage);
|
||||||
if (fromPage != 0)
|
if (fromPage != 0)
|
||||||
@@ -97,7 +113,7 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
|
|||||||
else
|
else
|
||||||
m_printDialogData.EnablePageNumbers(FALSE);
|
m_printDialogData.EnablePageNumbers(FALSE);
|
||||||
|
|
||||||
// Create a suitable device context
|
// Create a suitable device context
|
||||||
wxDC *dc = (wxDC *) NULL;
|
wxDC *dc = (wxDC *) NULL;
|
||||||
if (prompt)
|
if (prompt)
|
||||||
{
|
{
|
||||||
@@ -109,50 +125,50 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
|
|||||||
{
|
{
|
||||||
dc = new wxPostScriptDC(wxThePrintSetupData->GetPrinterFile(), FALSE, (wxWindow *) NULL);
|
dc = new wxPostScriptDC(wxThePrintSetupData->GetPrinterFile(), FALSE, (wxWindow *) NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// May have pressed cancel.
|
// May have pressed cancel.
|
||||||
if (!dc || !dc->Ok())
|
if (!dc || !dc->Ok())
|
||||||
{
|
{
|
||||||
if (dc) delete dc;
|
if (dc) delete dc;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int logPPIScreenX = 0;
|
int logPPIScreenX = 0;
|
||||||
int logPPIScreenY = 0;
|
int logPPIScreenY = 0;
|
||||||
int logPPIPrinterX = 0;
|
int logPPIPrinterX = 0;
|
||||||
int logPPIPrinterY = 0;
|
int logPPIPrinterY = 0;
|
||||||
|
|
||||||
logPPIScreenX = 100;
|
logPPIScreenX = 100;
|
||||||
logPPIScreenY = 100;
|
logPPIScreenY = 100;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// Correct values for X/PostScript?
|
// Correct values for X/PostScript?
|
||||||
logPPIPrinterX = 100;
|
logPPIPrinterX = 100;
|
||||||
logPPIPrinterY = 100;
|
logPPIPrinterY = 100;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
logPPIPrinterX = 72;
|
logPPIPrinterX = 72;
|
||||||
logPPIPrinterY = 72;
|
logPPIPrinterY = 72;
|
||||||
|
|
||||||
printout->SetPPIScreen(logPPIScreenX, logPPIScreenY);
|
printout->SetPPIScreen(logPPIScreenX, logPPIScreenY);
|
||||||
printout->SetPPIPrinter(logPPIPrinterX, logPPIPrinterY);
|
printout->SetPPIPrinter(logPPIPrinterX, logPPIPrinterY);
|
||||||
|
|
||||||
// Set printout parameters
|
// Set printout parameters
|
||||||
printout->SetDC(dc);
|
printout->SetDC(dc);
|
||||||
|
|
||||||
int w, h;
|
int w, h;
|
||||||
dc->GetSize(&w, &h);
|
dc->GetSize(&w, &h);
|
||||||
printout->SetPageSizePixels((int)w, (int)h);
|
printout->SetPageSizePixels((int)w, (int)h);
|
||||||
dc->GetSizeMM(&w, &h);
|
dc->GetSizeMM(&w, &h);
|
||||||
printout->SetPageSizeMM((int)w, (int)h);
|
printout->SetPageSizeMM((int)w, (int)h);
|
||||||
|
|
||||||
// Create an abort window
|
// Create an abort window
|
||||||
wxBeginBusyCursor();
|
wxBeginBusyCursor();
|
||||||
|
|
||||||
printout->OnBeginPrinting();
|
printout->OnBeginPrinting();
|
||||||
|
|
||||||
bool keepGoing = TRUE;
|
bool keepGoing = TRUE;
|
||||||
|
|
||||||
int copyCount;
|
int copyCount;
|
||||||
for (copyCount = 1; copyCount <= m_printDialogData.GetNoCopies(); copyCount ++)
|
for (copyCount = 1; copyCount <= m_printDialogData.GetNoCopies(); copyCount ++)
|
||||||
{
|
{
|
||||||
@@ -164,7 +180,7 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
|
|||||||
}
|
}
|
||||||
if (sm_abortIt)
|
if (sm_abortIt)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
int pn;
|
int pn;
|
||||||
for (pn = m_printDialogData.GetFromPage(); keepGoing && (pn <= m_printDialogData.GetToPage()) && printout->HasPage(pn);
|
for (pn = m_printDialogData.GetFromPage(); keepGoing && (pn <= m_printDialogData.GetToPage()) && printout->HasPage(pn);
|
||||||
pn++)
|
pn++)
|
||||||
@@ -183,13 +199,13 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
|
|||||||
}
|
}
|
||||||
printout->OnEndDocument();
|
printout->OnEndDocument();
|
||||||
}
|
}
|
||||||
|
|
||||||
printout->OnEndPrinting();
|
printout->OnEndPrinting();
|
||||||
|
|
||||||
wxEndBusyCursor();
|
wxEndBusyCursor();
|
||||||
|
|
||||||
delete dc;
|
delete dc;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,18 +241,34 @@ bool wxPostScriptPrinter::Setup(wxWindow *parent)
|
|||||||
return (ret == wxID_OK);
|
return (ret == wxID_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// ----------------------------------------------------------------------------
|
||||||
* Print preview
|
// Print preview
|
||||||
*/
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxPostScriptPrintPreview::wxPostScriptPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting, wxPrintDialogData *data):
|
void wxPostScriptPrintPreview::Init(wxPrintout * WXUNUSED(printout),
|
||||||
wxPrintPreviewBase(printout, printoutForPrinting, data)
|
wxPrintout * WXUNUSED(printoutForPrinting))
|
||||||
{
|
{
|
||||||
// Have to call it here since base constructor can't call it
|
// Have to call it here since base constructor can't call it
|
||||||
DetermineScaling();
|
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,12 +280,12 @@ bool wxPostScriptPrintPreview::Print(bool interactive)
|
|||||||
return printer.Print(m_previewFrame, m_printPrintout, interactive);
|
return printer.Print(m_previewFrame, m_printPrintout, interactive);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPostScriptPrintPreview::DetermineScaling(void)
|
void wxPostScriptPrintPreview::DetermineScaling()
|
||||||
{
|
{
|
||||||
wxPaperSize paperType = m_printDialogData.GetPrintData().GetPaperId();
|
wxPaperSize paperType = m_printDialogData.GetPrintData().GetPaperId();
|
||||||
if (paperType == wxPAPER_NONE)
|
if (paperType == wxPAPER_NONE)
|
||||||
paperType = wxPAPER_NONE;
|
paperType = wxPAPER_NONE;
|
||||||
|
|
||||||
wxPrintPaperType *paper = wxThePrintPaperDatabase->FindPaperType(paperType);
|
wxPrintPaperType *paper = wxThePrintPaperDatabase->FindPaperType(paperType);
|
||||||
if (!paper)
|
if (!paper)
|
||||||
paper = wxThePrintPaperDatabase->FindPaperType(wxPAPER_A4);
|
paper = wxThePrintPaperDatabase->FindPaperType(wxPAPER_A4);
|
||||||
@@ -263,7 +295,7 @@ void wxPostScriptPrintPreview::DetermineScaling(void)
|
|||||||
m_previewPrintout->SetPPIScreen(100, 100);
|
m_previewPrintout->SetPPIScreen(100, 100);
|
||||||
// m_previewPrintout->SetPPIPrinter(100, 100);
|
// m_previewPrintout->SetPPIPrinter(100, 100);
|
||||||
m_previewPrintout->SetPPIPrinter(72, 72);
|
m_previewPrintout->SetPPIPrinter(72, 72);
|
||||||
|
|
||||||
wxSize sizeDevUnits(paper->GetSizeDeviceUnits());
|
wxSize sizeDevUnits(paper->GetSizeDeviceUnits());
|
||||||
wxSize sizeTenthsMM(paper->GetSize());
|
wxSize sizeTenthsMM(paper->GetSize());
|
||||||
wxSize sizeMM(sizeTenthsMM.x / 10, sizeTenthsMM.y / 10);
|
wxSize sizeMM(sizeTenthsMM.x / 10, sizeTenthsMM.y / 10);
|
||||||
@@ -283,7 +315,7 @@ void wxPostScriptPrintPreview::DetermineScaling(void)
|
|||||||
m_previewPrintout->SetPageSizeMM(sizeMM.x, sizeMM.y);
|
m_previewPrintout->SetPageSizeMM(sizeMM.x, sizeMM.y);
|
||||||
m_previewPrintout->SetPageSizePixels(m_pageWidth, m_pageHeight);
|
m_previewPrintout->SetPageSizePixels(m_pageWidth, m_pageHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
// At 100%, the page should look about page-size on the screen.
|
// At 100%, the page should look about page-size on the screen.
|
||||||
m_previewScale = (float)0.8;
|
m_previewScale = (float)0.8;
|
||||||
}
|
}
|
||||||
|
@@ -6,42 +6,50 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// declarations
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// headers
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "prntdlgg.h"
|
#pragma implementation "prntdlgg.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
#include "wx/dc.h"
|
#include "wx/dc.h"
|
||||||
#include "wx/app.h"
|
#include "wx/app.h"
|
||||||
#include "wx/frame.h"
|
#include "wx/frame.h"
|
||||||
#include "wx/stattext.h"
|
#include "wx/stattext.h"
|
||||||
#include "wx/statbox.h"
|
#include "wx/statbox.h"
|
||||||
#include "wx/button.h"
|
#include "wx/button.h"
|
||||||
#include "wx/checkbox.h"
|
#include "wx/checkbox.h"
|
||||||
#include "wx/textctrl.h"
|
#include "wx/textctrl.h"
|
||||||
#include "wx/radiobox.h"
|
#include "wx/radiobox.h"
|
||||||
#include "wx/filedlg.h"
|
#include "wx/filedlg.h"
|
||||||
#include "wx/choice.h"
|
#include "wx/choice.h"
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/generic/prntdlgg.h"
|
#include "wx/generic/prntdlgg.h"
|
||||||
|
|
||||||
#if wxUSE_POSTSCRIPT
|
#if wxUSE_POSTSCRIPT
|
||||||
#include "wx/generic/dcpsg.h"
|
#include "wx/generic/dcpsg.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/printdlg.h"
|
#include "wx/printdlg.h"
|
||||||
@@ -53,79 +61,114 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxWin macros
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#if wxUSE_POSTSCRIPT
|
#if wxUSE_POSTSCRIPT
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_CLASS(wxGenericPrintDialog, wxDialog)
|
IMPLEMENT_CLASS(wxGenericPrintDialog, wxDialog)
|
||||||
IMPLEMENT_CLASS(wxGenericPrintSetupDialog, wxDialog)
|
IMPLEMENT_CLASS(wxGenericPrintSetupDialog, wxDialog)
|
||||||
IMPLEMENT_CLASS(wxGenericPageSetupDialog, wxDialog)
|
IMPLEMENT_CLASS(wxGenericPageSetupDialog, wxDialog)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxGenericPrintDialog, wxDialog)
|
BEGIN_EVENT_TABLE(wxGenericPrintDialog, wxDialog)
|
||||||
EVT_BUTTON(wxID_OK, wxGenericPrintDialog::OnOK)
|
EVT_BUTTON(wxID_OK, wxGenericPrintDialog::OnOK)
|
||||||
EVT_BUTTON(wxPRINTID_SETUP, wxGenericPrintDialog::OnSetup)
|
EVT_BUTTON(wxPRINTID_SETUP, wxGenericPrintDialog::OnSetup)
|
||||||
EVT_RADIOBOX(wxPRINTID_RANGE, wxGenericPrintDialog::OnRange)
|
EVT_RADIOBOX(wxPRINTID_RANGE, wxGenericPrintDialog::OnRange)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxGenericPageSetupDialog, wxDialog)
|
BEGIN_EVENT_TABLE(wxGenericPageSetupDialog, wxDialog)
|
||||||
EVT_BUTTON(wxPRINTID_SETUP, wxGenericPageSetupDialog::OnPrinter)
|
EVT_BUTTON(wxPRINTID_SETUP, wxGenericPageSetupDialog::OnPrinter)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
#endif
|
#endif // USE_SHARED_LIBRARY
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// global vars
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
extern wxPrintPaperDatabase *wxThePrintPaperDatabase;
|
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):
|
wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent,
|
||||||
wxDialog(parent, -1, _("Print"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxTAB_TRAVERSAL)
|
wxPrintDialogData* data)
|
||||||
|
: wxDialog(parent, -1, _("Print"),
|
||||||
|
wxPoint(0, 0), wxSize(600, 600),
|
||||||
|
wxDEFAULT_DIALOG_STYLE |
|
||||||
|
wxDIALOG_MODAL |
|
||||||
|
wxTAB_TRAVERSAL)
|
||||||
{
|
{
|
||||||
if ( data )
|
if ( data )
|
||||||
m_printDialogData = *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 ) );
|
(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) );
|
m_printToFileCheckBox = new wxCheckBox(this, wxPRINTID_PRINTTOFILE, _("Print to File"), wxPoint(20, 25) );
|
||||||
|
|
||||||
m_setupButton = new wxButton(this, wxPRINTID_SETUP, _("Setup..."), wxPoint(160, 25), wxSize(100, -1));
|
m_setupButton = new wxButton(this, wxPRINTID_SETUP, _("Setup..."), wxPoint(160, 25), wxSize(100, -1));
|
||||||
|
|
||||||
wxString *choices = new wxString[2];
|
wxString *choices = new wxString[2];
|
||||||
choices[0] = _("All");
|
choices[0] = _("All");
|
||||||
choices[1] = _("Pages");
|
choices[1] = _("Pages");
|
||||||
|
|
||||||
m_fromText = (wxTextCtrl*)NULL;
|
m_fromText = (wxTextCtrl*)NULL;
|
||||||
|
|
||||||
if (m_printDialogData.GetFromPage() != 0)
|
if (m_printDialogData.GetFromPage() != 0)
|
||||||
{
|
{
|
||||||
m_rangeRadioBox = new wxRadioBox(this, wxPRINTID_RANGE, _("Print Range"),
|
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);
|
m_rangeRadioBox->SetSelection(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_printDialogData.GetFromPage() != 0)
|
if(m_printDialogData.GetFromPage() != 0)
|
||||||
{
|
{
|
||||||
(void) new wxStaticText(this, wxPRINTID_STATIC, _("From:"), wxPoint(5, 135));
|
(void) new wxStaticText(this, wxPRINTID_STATIC, _("From:"), wxPoint(5, 135));
|
||||||
|
|
||||||
m_fromText = new wxTextCtrl(this, wxPRINTID_FROM, "", wxPoint(45, 130), wxSize(40, -1));
|
m_fromText = new wxTextCtrl(this, wxPRINTID_FROM, "", wxPoint(45, 130), wxSize(40, -1));
|
||||||
|
|
||||||
(void) new wxStaticText(this, wxPRINTID_STATIC, _("To:"), wxPoint(100, 135));
|
(void) new wxStaticText(this, wxPRINTID_STATIC, _("To:"), wxPoint(100, 135));
|
||||||
|
|
||||||
m_toText = new wxTextCtrl(this, wxPRINTID_TO, "", wxPoint(133, 130), wxSize(40, -1));
|
m_toText = new wxTextCtrl(this, wxPRINTID_TO, "", wxPoint(133, 130), wxSize(40, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Copies:"), wxPoint(200, 135));
|
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Copies:"), wxPoint(200, 135));
|
||||||
|
|
||||||
m_noCopiesText = new wxTextCtrl(this, wxPRINTID_COPIES, "", wxPoint(252, 130), wxSize(40, -1));
|
m_noCopiesText = new wxTextCtrl(this, wxPRINTID_COPIES, "", wxPoint(252, 130), wxSize(40, -1));
|
||||||
|
|
||||||
wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(40, 180), wxSize(100, -1));
|
wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(40, 180), wxSize(100, -1));
|
||||||
(void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(180, 180), wxSize(100, -1));
|
(void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(180, 180), wxSize(100, -1));
|
||||||
|
|
||||||
okButton->SetDefault();
|
okButton->SetDefault();
|
||||||
okButton->SetFocus();
|
okButton->SetFocus();
|
||||||
Fit();
|
Fit();
|
||||||
Centre(wxBOTH);
|
Centre(wxBOTH);
|
||||||
|
|
||||||
// Calls wxWindow::OnInitDialog and then wxGenericPrintDialog::TransferDataToWindow
|
// Calls wxWindow::OnInitDialog and then wxGenericPrintDialog::TransferDataToWindow
|
||||||
InitDialog();
|
InitDialog();
|
||||||
delete[] choices;
|
delete[] choices;
|
||||||
@@ -171,7 +214,7 @@ wxGenericPrintDialog::~wxGenericPrintDialog()
|
|||||||
void wxGenericPrintDialog::OnOK(wxCommandEvent& WXUNUSED(event))
|
void wxGenericPrintDialog::OnOK(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
TransferDataFromWindow();
|
TransferDataFromWindow();
|
||||||
|
|
||||||
// There are some interactions between the global setup data
|
// There are some interactions between the global setup data
|
||||||
// and the standard print dialog. The global printing 'mode'
|
// and the standard print dialog. The global printing 'mode'
|
||||||
// is determined by whether the user checks Print to file
|
// is determined by whether the user checks Print to file
|
||||||
@@ -180,27 +223,27 @@ void wxGenericPrintDialog::OnOK(wxCommandEvent& WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
m_printDialogData.GetPrintData().SetPrintMode(wxPRINT_MODE_FILE);
|
m_printDialogData.GetPrintData().SetPrintMode(wxPRINT_MODE_FILE);
|
||||||
wxThePrintSetupData->SetPrinterMode(wxPRINT_MODE_FILE);
|
wxThePrintSetupData->SetPrinterMode(wxPRINT_MODE_FILE);
|
||||||
|
|
||||||
wxString f = wxFileSelector(_("PostScript file"),
|
wxString f = wxFileSelector(_("PostScript file"),
|
||||||
wxPathOnly(wxThePrintSetupData->GetPrinterFile()),
|
wxPathOnly(wxThePrintSetupData->GetPrinterFile()),
|
||||||
wxFileNameFromPath(wxThePrintSetupData->GetPrinterFile()),
|
wxFileNameFromPath(wxThePrintSetupData->GetPrinterFile()),
|
||||||
"ps", "*.ps", 0, this);
|
"ps", "*.ps", 0, this);
|
||||||
if ( f.IsEmpty() )
|
if ( f.IsEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_printDialogData.GetPrintData().SetFilename(f);
|
m_printDialogData.GetPrintData().SetFilename(f);
|
||||||
wxThePrintSetupData->SetPrinterFile(f);
|
wxThePrintSetupData->SetPrinterFile(f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
wxThePrintSetupData->SetPrinterMode(wxPRINT_MODE_PRINTER);
|
wxThePrintSetupData->SetPrinterMode(wxPRINT_MODE_PRINTER);
|
||||||
|
|
||||||
EndModal(wxID_OK);
|
EndModal(wxID_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGenericPrintDialog::OnRange(wxCommandEvent& event)
|
void wxGenericPrintDialog::OnRange(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
if (!m_fromText) return;
|
if (!m_fromText) return;
|
||||||
|
|
||||||
if (event.GetInt() == 0)
|
if (event.GetInt() == 0)
|
||||||
{
|
{
|
||||||
m_fromText->Enable(FALSE);
|
m_fromText->Enable(FALSE);
|
||||||
@@ -223,26 +266,26 @@ void wxGenericPrintDialog::OnSetup(wxCommandEvent& WXUNUSED(event))
|
|||||||
*wxThePrintSetupData = genericPrintSetupDialog->GetPrintData();
|
*wxThePrintSetupData = genericPrintSetupDialog->GetPrintData();
|
||||||
m_printDialogData = genericPrintSetupDialog->GetPrintData();
|
m_printDialogData = genericPrintSetupDialog->GetPrintData();
|
||||||
}
|
}
|
||||||
|
|
||||||
genericPrintSetupDialog->Close(TRUE);
|
genericPrintSetupDialog->Close(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGenericPrintDialog::TransferDataToWindow()
|
bool wxGenericPrintDialog::TransferDataToWindow()
|
||||||
{
|
{
|
||||||
char buf[10];
|
char buf[10];
|
||||||
|
|
||||||
if(m_printDialogData.GetFromPage() != 0)
|
if(m_printDialogData.GetFromPage() != 0)
|
||||||
{
|
{
|
||||||
if (m_printDialogData.GetEnablePageNumbers())
|
if (m_printDialogData.GetEnablePageNumbers())
|
||||||
{
|
{
|
||||||
m_fromText->Enable(TRUE);
|
m_fromText->Enable(TRUE);
|
||||||
m_toText->Enable(TRUE);
|
m_toText->Enable(TRUE);
|
||||||
|
|
||||||
sprintf(buf, "%d", m_printDialogData.GetFromPage());
|
sprintf(buf, "%d", m_printDialogData.GetFromPage());
|
||||||
m_fromText->SetValue(buf);
|
m_fromText->SetValue(buf);
|
||||||
sprintf(buf, "%d", m_printDialogData.GetToPage());
|
sprintf(buf, "%d", m_printDialogData.GetToPage());
|
||||||
m_toText->SetValue(buf);
|
m_toText->SetValue(buf);
|
||||||
|
|
||||||
if (m_printDialogData.GetAllPages())
|
if (m_printDialogData.GetAllPages())
|
||||||
m_rangeRadioBox->SetSelection(0);
|
m_rangeRadioBox->SetSelection(0);
|
||||||
else
|
else
|
||||||
@@ -258,7 +301,7 @@ bool wxGenericPrintDialog::TransferDataToWindow()
|
|||||||
}
|
}
|
||||||
sprintf(buf, "%d", m_printDialogData.GetNoCopies());
|
sprintf(buf, "%d", m_printDialogData.GetNoCopies());
|
||||||
m_noCopiesText->SetValue(buf);
|
m_noCopiesText->SetValue(buf);
|
||||||
|
|
||||||
m_printToFileCheckBox->SetValue(m_printDialogData.GetPrintToFile());
|
m_printToFileCheckBox->SetValue(m_printDialogData.GetPrintToFile());
|
||||||
m_printToFileCheckBox->Enable(m_printDialogData.GetEnablePrintToFile());
|
m_printToFileCheckBox->Enable(m_printDialogData.GetEnablePrintToFile());
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -299,9 +342,9 @@ wxDC *wxGenericPrintDialog::GetPrintDC()
|
|||||||
return new wxPostScriptDC(wxThePrintSetupData->GetPrinterFile(), FALSE, (wxWindow *) NULL);
|
return new wxPostScriptDC(wxThePrintSetupData->GetPrinterFile(), FALSE, (wxWindow *) NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// ----------------------------------------------------------------------------
|
||||||
* Generic print setup dialog
|
// Generic print setup dialog
|
||||||
*/
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow *parent, wxPrintData* data):
|
wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow *parent, wxPrintData* data):
|
||||||
wxDialog(parent, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxTAB_TRAVERSAL)
|
wxDialog(parent, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxTAB_TRAVERSAL)
|
||||||
@@ -328,50 +371,50 @@ void wxGenericPrintSetupDialog::Init(wxPrintData* data)
|
|||||||
m_printData = *data;
|
m_printData = *data;
|
||||||
|
|
||||||
int staticBoxWidth = 300;
|
int staticBoxWidth = 300;
|
||||||
|
|
||||||
(void) new wxStaticBox(this, wxPRINTID_STATIC, _("Paper size"), wxPoint(10, 10), wxSize(staticBoxWidth, 60) );
|
(void) new wxStaticBox(this, wxPRINTID_STATIC, _("Paper size"), wxPoint(10, 10), wxSize(staticBoxWidth, 60) );
|
||||||
|
|
||||||
int xPos = 20;
|
int xPos = 20;
|
||||||
int yPos = 30;
|
int yPos = 30;
|
||||||
m_paperTypeChoice = CreatePaperTypeChoice(&xPos, &yPos);
|
m_paperTypeChoice = CreatePaperTypeChoice(&xPos, &yPos);
|
||||||
|
|
||||||
wxString *choices = new wxString[2];
|
wxString *choices = new wxString[2];
|
||||||
choices[0] = _("Portrait");
|
choices[0] = _("Portrait");
|
||||||
choices[1] = _("Landscape");
|
choices[1] = _("Landscape");
|
||||||
|
|
||||||
m_orientationRadioBox = new wxRadioBox(this, wxPRINTID_ORIENTATION, _("Orientation"),
|
m_orientationRadioBox = new wxRadioBox(this, wxPRINTID_ORIENTATION, _("Orientation"),
|
||||||
wxPoint(10, 80), wxSize(-1, -1), 2, choices, 1, wxRA_VERTICAL );
|
wxPoint(10, 80), wxSize(-1, -1), 2, choices, 1, wxRA_VERTICAL );
|
||||||
m_orientationRadioBox->SetSelection(0);
|
m_orientationRadioBox->SetSelection(0);
|
||||||
|
|
||||||
(void) new wxStaticBox(this, wxPRINTID_STATIC, _("Options"), wxPoint(10, 130), wxSize(staticBoxWidth, 50) );
|
(void) new wxStaticBox(this, wxPRINTID_STATIC, _("Options"), wxPoint(10, 130), wxSize(staticBoxWidth, 50) );
|
||||||
|
|
||||||
int colourYPos = 145;
|
int colourYPos = 145;
|
||||||
|
|
||||||
#ifdef __WXMOTIF__
|
#ifdef __WXMOTIF__
|
||||||
colourYPos = 150;
|
colourYPos = 150;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_colourCheckBox = new wxCheckBox(this, wxPRINTID_PRINTCOLOUR, _("Print in colour"), wxPoint(15, colourYPos));
|
m_colourCheckBox = new wxCheckBox(this, wxPRINTID_PRINTCOLOUR, _("Print in colour"), wxPoint(15, colourYPos));
|
||||||
|
|
||||||
(void) new wxStaticBox(this, wxPRINTID_STATIC, _("Print spooling"), wxPoint(330, 10), wxSize(200,170) );
|
(void) new wxStaticBox(this, wxPRINTID_STATIC, _("Print spooling"), wxPoint(330, 10), wxSize(200,170) );
|
||||||
|
|
||||||
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Printer command:"), wxPoint(340, 30));
|
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Printer command:"), wxPoint(340, 30));
|
||||||
|
|
||||||
m_printerCommandText = new wxTextCtrl(this, wxPRINTID_COMMAND, "", wxPoint(360, 55), wxSize(150, -1));
|
m_printerCommandText = new wxTextCtrl(this, wxPRINTID_COMMAND, "", wxPoint(360, 55), wxSize(150, -1));
|
||||||
|
|
||||||
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Printer options:"), wxPoint(340, 110));
|
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Printer options:"), wxPoint(340, 110));
|
||||||
|
|
||||||
m_printerOptionsText = new wxTextCtrl(this, wxPRINTID_OPTIONS, "", wxPoint(360, 135), wxSize(150, -1));
|
m_printerOptionsText = new wxTextCtrl(this, wxPRINTID_OPTIONS, "", wxPoint(360, 135), wxSize(150, -1));
|
||||||
|
|
||||||
wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(130, 200), wxSize(100, -1));
|
wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(130, 200), wxSize(100, -1));
|
||||||
(void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(320, 200), wxSize(100, -1));
|
(void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(320, 200), wxSize(100, -1));
|
||||||
|
|
||||||
okButton->SetDefault();
|
okButton->SetDefault();
|
||||||
okButton->SetFocus();
|
okButton->SetFocus();
|
||||||
|
|
||||||
Fit();
|
Fit();
|
||||||
Centre(wxBOTH);
|
Centre(wxBOTH);
|
||||||
|
|
||||||
InitDialog();
|
InitDialog();
|
||||||
delete[] choices;
|
delete[] choices;
|
||||||
}
|
}
|
||||||
@@ -388,7 +431,7 @@ bool wxGenericPrintSetupDialog::TransferDataToWindow()
|
|||||||
m_printerOptionsText->SetValue(m_printData.GetPrinterOptions());
|
m_printerOptionsText->SetValue(m_printData.GetPrinterOptions());
|
||||||
if (m_colourCheckBox)
|
if (m_colourCheckBox)
|
||||||
m_colourCheckBox->SetValue(m_printData.GetColour());
|
m_colourCheckBox->SetValue(m_printData.GetColour());
|
||||||
|
|
||||||
if (m_orientationRadioBox)
|
if (m_orientationRadioBox)
|
||||||
{
|
{
|
||||||
if (m_printData.GetOrientation() == wxPORTRAIT)
|
if (m_printData.GetOrientation() == wxPORTRAIT)
|
||||||
@@ -447,7 +490,7 @@ wxChoice *wxGenericPrintSetupDialog::CreatePaperTypeChoice(int *x, int *y)
|
|||||||
if (m_printData.GetPaperId() == paper->GetId())
|
if (m_printData.GetPaperId() == paper->GetId())
|
||||||
sel = i;
|
sel = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
int width = 250;
|
int width = 250;
|
||||||
|
|
||||||
wxChoice *choice = new wxChoice(this, wxPRINTID_PAPERSIZE, wxPoint(*x, *y), wxSize(width, -1), n,
|
wxChoice *choice = new wxChoice(this, wxPRINTID_PAPERSIZE, wxPoint(*x, *y), wxSize(width, -1), n,
|
||||||
@@ -456,16 +499,15 @@ wxChoice *wxGenericPrintSetupDialog::CreatePaperTypeChoice(int *x, int *y)
|
|||||||
// SetFont(thisFont);
|
// SetFont(thisFont);
|
||||||
|
|
||||||
delete[] choices;
|
delete[] choices;
|
||||||
|
|
||||||
choice->SetSelection(sel);
|
choice->SetSelection(sel);
|
||||||
return choice;
|
return choice;
|
||||||
}
|
}
|
||||||
#endif
|
#endif // wxUSE_POSTSCRIPT
|
||||||
// wxUSE_POSTSCRIPT
|
|
||||||
|
|
||||||
/*
|
// ----------------------------------------------------------------------------
|
||||||
* Generic page setup dialog
|
// Generic page setup dialog
|
||||||
*/
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
void wxGenericPageSetupDialog::OnPrinter(wxCommandEvent& WXUNUSED(event))
|
void wxGenericPageSetupDialog::OnPrinter(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
@@ -503,89 +545,89 @@ wxDialog(parent, -1, _("Page Setup"), wxPoint(0, 0), wxSize(600, 600), wxDIALOG_
|
|||||||
{
|
{
|
||||||
if ( data )
|
if ( data )
|
||||||
m_pageData = *data;
|
m_pageData = *data;
|
||||||
|
|
||||||
int buttonWidth = 75;
|
int buttonWidth = 75;
|
||||||
int buttonHeight = 25;
|
int buttonHeight = 25;
|
||||||
int spacing = 5;
|
int spacing = 5;
|
||||||
#ifdef __WXMOTIF__
|
#ifdef __WXMOTIF__
|
||||||
spacing = 15;
|
spacing = 15;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int yPos = 5;
|
int yPos = 5;
|
||||||
int xPos = 5;
|
int xPos = 5;
|
||||||
|
|
||||||
wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(5, yPos), wxSize(buttonWidth, buttonHeight));
|
wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(5, yPos), wxSize(buttonWidth, buttonHeight));
|
||||||
(void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(buttonWidth + 5 + spacing, yPos), wxSize(buttonWidth, buttonHeight));
|
(void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(buttonWidth + 5 + spacing, yPos), wxSize(buttonWidth, buttonHeight));
|
||||||
|
|
||||||
m_printerButton = new wxButton(this, wxPRINTID_SETUP, _("Printer..."), wxPoint(buttonWidth*2 + 5 + 2*spacing, yPos), wxSize(buttonWidth, buttonHeight));
|
m_printerButton = new wxButton(this, wxPRINTID_SETUP, _("Printer..."), wxPoint(buttonWidth*2 + 5 + 2*spacing, yPos), wxSize(buttonWidth, buttonHeight));
|
||||||
|
|
||||||
if ( !m_pageData.GetEnablePrinter() )
|
if ( !m_pageData.GetEnablePrinter() )
|
||||||
m_printerButton->Enable(FALSE);
|
m_printerButton->Enable(FALSE);
|
||||||
|
|
||||||
// if (m_printData.GetEnableHelp())
|
// if (m_printData.GetEnableHelp())
|
||||||
// wxButton *helpButton = new wxButton(this, (wxFunction)wxGenericPageSetupHelpProc, _("Help"), -1, -1, buttonWidth, buttonHeight);
|
// wxButton *helpButton = new wxButton(this, (wxFunction)wxGenericPageSetupHelpProc, _("Help"), -1, -1, buttonWidth, buttonHeight);
|
||||||
|
|
||||||
okButton->SetDefault();
|
okButton->SetDefault();
|
||||||
okButton->SetFocus();
|
okButton->SetFocus();
|
||||||
|
|
||||||
xPos = 5;
|
xPos = 5;
|
||||||
yPos += 35;
|
yPos += 35;
|
||||||
|
|
||||||
#ifdef __WXMOTIF__
|
#ifdef __WXMOTIF__
|
||||||
yPos += 10;
|
yPos += 10;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_paperTypeChoice = CreatePaperTypeChoice(&xPos, &yPos);
|
m_paperTypeChoice = CreatePaperTypeChoice(&xPos, &yPos);
|
||||||
|
|
||||||
xPos = 5;
|
xPos = 5;
|
||||||
|
|
||||||
wxString *choices = new wxString[2];
|
wxString *choices = new wxString[2];
|
||||||
choices[0] = _("Portrait");
|
choices[0] = _("Portrait");
|
||||||
choices[1] = _("Landscape");
|
choices[1] = _("Landscape");
|
||||||
m_orientationRadioBox = new wxRadioBox(this, wxPRINTID_ORIENTATION, _("Orientation"),
|
m_orientationRadioBox = new wxRadioBox(this, wxPRINTID_ORIENTATION, _("Orientation"),
|
||||||
wxPoint(xPos, yPos), wxSize(-1, -1), 2, choices, 2);
|
wxPoint(xPos, yPos), wxSize(-1, -1), 2, choices, 2);
|
||||||
m_orientationRadioBox->SetSelection(0);
|
m_orientationRadioBox->SetSelection(0);
|
||||||
|
|
||||||
xPos = 5;
|
xPos = 5;
|
||||||
yPos += 60;
|
yPos += 60;
|
||||||
|
|
||||||
int staticWidth = 110;
|
int staticWidth = 110;
|
||||||
#ifdef __WXMOTIF__
|
#ifdef __WXMOTIF__
|
||||||
staticWidth += 20;
|
staticWidth += 20;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int textWidth = 60;
|
int textWidth = 60;
|
||||||
spacing = 10;
|
spacing = 10;
|
||||||
|
|
||||||
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Left margin (mm):"), wxPoint(xPos, yPos));
|
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Left margin (mm):"), wxPoint(xPos, yPos));
|
||||||
xPos += staticWidth;
|
xPos += staticWidth;
|
||||||
|
|
||||||
m_marginLeftText = new wxTextCtrl(this, wxPRINTID_LEFTMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
|
m_marginLeftText = new wxTextCtrl(this, wxPRINTID_LEFTMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
|
||||||
xPos += textWidth + spacing;
|
xPos += textWidth + spacing;
|
||||||
|
|
||||||
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Right margin (mm):"), wxPoint(xPos, yPos));
|
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Right margin (mm):"), wxPoint(xPos, yPos));
|
||||||
xPos += staticWidth;
|
xPos += staticWidth;
|
||||||
|
|
||||||
m_marginRightText = new wxTextCtrl(this, wxPRINTID_RIGHTMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
|
m_marginRightText = new wxTextCtrl(this, wxPRINTID_RIGHTMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
|
||||||
xPos += textWidth + spacing;
|
xPos += textWidth + spacing;
|
||||||
|
|
||||||
yPos += 35;
|
yPos += 35;
|
||||||
xPos = 5;
|
xPos = 5;
|
||||||
|
|
||||||
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Top margin (mm):"), wxPoint(xPos, yPos));
|
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Top margin (mm):"), wxPoint(xPos, yPos));
|
||||||
xPos += staticWidth;
|
xPos += staticWidth;
|
||||||
|
|
||||||
m_marginTopText = new wxTextCtrl(this, wxPRINTID_TOPMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
|
m_marginTopText = new wxTextCtrl(this, wxPRINTID_TOPMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
|
||||||
xPos += textWidth + spacing;
|
xPos += textWidth + spacing;
|
||||||
|
|
||||||
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Bottom margin (mm):"), wxPoint(xPos, yPos));
|
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Bottom margin (mm):"), wxPoint(xPos, yPos));
|
||||||
xPos += staticWidth;
|
xPos += staticWidth;
|
||||||
|
|
||||||
m_marginBottomText = new wxTextCtrl(this, wxPRINTID_BOTTOMMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
|
m_marginBottomText = new wxTextCtrl(this, wxPRINTID_BOTTOMMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
|
||||||
|
|
||||||
Fit();
|
Fit();
|
||||||
Centre(wxBOTH);
|
Centre(wxBOTH);
|
||||||
|
|
||||||
InitDialog();
|
InitDialog();
|
||||||
delete [] choices;
|
delete [] choices;
|
||||||
}
|
}
|
||||||
@@ -604,7 +646,7 @@ bool wxGenericPageSetupDialog::TransferDataToWindow()
|
|||||||
m_marginRightText->SetValue(IntToString((int) m_pageData.GetMarginBottomRight().x));
|
m_marginRightText->SetValue(IntToString((int) m_pageData.GetMarginBottomRight().x));
|
||||||
if (m_marginBottomText)
|
if (m_marginBottomText)
|
||||||
m_marginBottomText->SetValue(IntToString((int) m_pageData.GetMarginBottomRight().y));
|
m_marginBottomText->SetValue(IntToString((int) m_pageData.GetMarginBottomRight().y));
|
||||||
|
|
||||||
if (m_orientationRadioBox)
|
if (m_orientationRadioBox)
|
||||||
{
|
{
|
||||||
if (m_pageData.GetPrintData().GetOrientation() == wxPORTRAIT)
|
if (m_pageData.GetPrintData().GetOrientation() == wxPORTRAIT)
|
||||||
@@ -636,7 +678,7 @@ bool wxGenericPageSetupDialog::TransferDataFromWindow()
|
|||||||
m_pageData.SetMarginTopLeft(wxPoint(atoi((const char *)m_marginLeftText->GetValue()),atoi((const char *)m_marginTopText->GetValue())));
|
m_pageData.SetMarginTopLeft(wxPoint(atoi((const char *)m_marginLeftText->GetValue()),atoi((const char *)m_marginTopText->GetValue())));
|
||||||
if (m_marginRightText && m_marginBottomText)
|
if (m_marginRightText && m_marginBottomText)
|
||||||
m_pageData.SetMarginBottomRight(wxPoint(atoi((const char *)m_marginRightText->GetValue()),atoi((const char *)m_marginBottomText->GetValue())));
|
m_pageData.SetMarginBottomRight(wxPoint(atoi((const char *)m_marginRightText->GetValue()),atoi((const char *)m_marginBottomText->GetValue())));
|
||||||
|
|
||||||
if (m_orientationRadioBox)
|
if (m_orientationRadioBox)
|
||||||
{
|
{
|
||||||
int sel = m_orientationRadioBox->GetSelection();
|
int sel = m_orientationRadioBox->GetSelection();
|
||||||
@@ -668,7 +710,7 @@ bool wxGenericPageSetupDialog::TransferDataFromWindow()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -690,15 +732,15 @@ wxChoice *wxGenericPageSetupDialog::CreatePaperTypeChoice(int *x, int *y)
|
|||||||
wxPrintPaperType *paper = (wxPrintPaperType *)wxThePrintPaperDatabase->Nth(i)->Data();
|
wxPrintPaperType *paper = (wxPrintPaperType *)wxThePrintPaperDatabase->Nth(i)->Data();
|
||||||
choices[i] = paper->GetName();
|
choices[i] = paper->GetName();
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Paper size"), wxPoint(*x, *y));
|
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Paper size"), wxPoint(*x, *y));
|
||||||
*y += 25;
|
*y += 25;
|
||||||
|
|
||||||
wxChoice *choice = new wxChoice(this, wxPRINTID_PAPERSIZE, wxPoint(*x, *y), wxSize(300, -1), n,
|
wxChoice *choice = new wxChoice(this, wxPRINTID_PAPERSIZE, wxPoint(*x, *y), wxSize(300, -1), n,
|
||||||
choices);
|
choices);
|
||||||
*y += 35;
|
*y += 35;
|
||||||
delete[] choices;
|
delete[] choices;
|
||||||
|
|
||||||
// choice->SetSelection(sel);
|
// choice->SetSelection(sel);
|
||||||
return choice;
|
return choice;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user