Applied patch [ 1583316 ] set media source for printing

by d2walter


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42627 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2006-10-29 17:29:40 +00:00
parent 03db59bd43
commit 781609f290
3 changed files with 16 additions and 2 deletions

View File

@ -166,6 +166,7 @@ enum wxPrintBin
wxPRINTBIN_USER
};
const int wxPRINTMEDIA_DEFAULT = 0;
class WXDLLEXPORT wxPrintData: public wxObject
{
@ -191,6 +192,7 @@ public:
wxPrintQuality GetQuality() const { return m_printQuality; }
wxPrintBin GetBin() const { return m_bin; }
wxPrintMode GetPrintMode() const { return m_printMode; }
int GetMedia() const { return m_media; }
void SetNoCopies(int v) { m_printNoCopies = v; }
void SetCollate(bool flag) { m_printCollate = flag; }
@ -203,6 +205,7 @@ public:
void SetPaperSize(const wxSize& sz) { m_paperSize = sz; }
void SetQuality(wxPrintQuality quality) { m_printQuality = quality; }
void SetBin(wxPrintBin bin) { m_bin = bin; }
void SetMedia(int media) { m_media = media; }
void SetPrintMode(wxPrintMode printMode) { m_printMode = printMode; }
wxString GetFilename() const { return m_filename; }
@ -246,6 +249,7 @@ public:
private:
wxPrintBin m_bin;
int m_media;
wxPrintMode m_printMode;
int m_printNoCopies;

View File

@ -150,6 +150,7 @@ wxFontDialogBase::~wxFontDialogBase()
wxPrintData::wxPrintData()
{
m_bin = wxPRINTBIN_DEFAULT;
m_media = wxPRINTMEDIA_DEFAULT;
m_printMode = wxPRINT_MODE_PRINTER;
m_printOrientation = wxPORTRAIT;
m_printNoCopies = 1;
@ -224,6 +225,7 @@ void wxPrintData::operator=(const wxPrintData& data)
m_paperId = data.m_paperId;
m_paperSize = data.m_paperSize;
m_bin = data.m_bin;
m_media = data.m_media;
m_printMode = data.m_printMode;
m_filename = data.m_filename;

View File

@ -198,7 +198,11 @@ bool wxWindowsPrintNativeData::TransferTo( wxPrintData &data )
} else {
data.SetBin(wxPRINTBIN_DEFAULT);
}
if (devMode->dmFields & DM_MEDIATYPE)
{
wxASSERT(devMode->dmMediaType != wxPRINTMEDIA_DEFAULT);
data.SetMedia(devMode->dmMediaType);
}
//// Printer name
if (devMode->dmDeviceName[0] != 0)
// This syntax fixes a crash when using VS 7.1
@ -547,7 +551,11 @@ bool wxWindowsPrintNativeData::TransferFrom( const wxPrintData &data )
devMode->dmFields |= DM_DEFAULTSOURCE;
}
if (data.GetMedia() != wxPRINTMEDIA_DEFAULT)
{
devMode->dmMediaType = data.GetMedia();
devMode->dmFields |= DM_MEDIATYPE;
}
GlobalUnlock(hDevMode);
}