#include <windowsx.h>
#include "wx/msw/private.h"
- #ifndef __SMARTPHONE__
+ #ifndef __SMARTPHONE__ /* of WinCE */
#include <commdlg.h>
#endif
printerName.Length() + 1 +
portName.Length()+1 ) * sizeof(wxChar) );
LPDEVNAMES lpDev = (LPDEVNAMES)GlobalLock(hDev);
- lpDev->wDriverOffset = sizeof(WORD)*4;
- wxStrcpy((wxChar*)((char*)lpDev + lpDev->wDriverOffset ), driverName);
+ lpDev->wDriverOffset = sizeof(WORD) * 4 / sizeof(wxChar);
+ wxStrcpy((wxChar*)lpDev + lpDev->wDriverOffset, driverName);
lpDev->wDeviceOffset = (WORD)( lpDev->wDriverOffset +
- sizeof(wxChar) * ( driverName.Length() + 1 ) );
- wxStrcpy((wxChar*)((char*)lpDev + lpDev->wDeviceOffset ), printerName);
+ driverName.Length() + 1 );
+ wxStrcpy((wxChar*)lpDev + lpDev->wDeviceOffset, printerName);
lpDev->wOutputOffset = (WORD)( lpDev->wDeviceOffset +
- sizeof(wxChar) * ( printerName.Length() + 1 ) );
- wxStrcpy((wxChar*)((char*) lpDev + lpDev->wOutputOffset ), portName);
+ printerName.Length() + 1 );
+ wxStrcpy((wxChar*)lpDev + lpDev->wOutputOffset, portName);
lpDev->wDefault = 0;
//// Orientation
- devMode->dmOrientation = m_printOrientation;
+ devMode->dmOrientation = (short)m_printOrientation;
//// Collation
//// Number of copies
- devMode->dmCopies = m_printNoCopies;
+ devMode->dmCopies = (short)m_printNoCopies;
devMode->dmFields |= DM_COPIES;
//// Printer name
if (m_paperId == wxPAPER_NONE)
{
// DEVMODE is in tenths of a milimeter
- devMode->dmPaperWidth = m_paperSize.x * 10;
- devMode->dmPaperLength = m_paperSize.y * 10;
+ devMode->dmPaperWidth = (short)(m_paperSize.x * 10);
+ devMode->dmPaperLength = (short)(m_paperSize.y * 10);
devMode->dmPaperSize = DMPAPER_USER;
devMode->dmFields |= DM_PAPERWIDTH;
devMode->dmFields |= DM_PAPERLENGTH;
wxPrintPaperType* paper = wxThePrintPaperDatabase->FindPaperType(m_paperId);
if (paper)
{
- devMode->dmPaperSize = paper->GetPlatformId();
+ devMode->dmPaperSize = (short)paper->GetPlatformId();
devMode->dmFields |= DM_PAPERSIZE;
}
}
//// Duplex
- int duplex;
+ short duplex;
switch (m_duplexMode)
{
- case wxDUPLEX_HORIZONTAL: {
- duplex = DMDUP_HORIZONTAL; break;
- }
- case wxDUPLEX_VERTICAL: {
- duplex = DMDUP_VERTICAL; break;
- }
- default:
- case wxDUPLEX_SIMPLEX: {
- duplex = DMDUP_SIMPLEX; break;
- }
+ case wxDUPLEX_HORIZONTAL:
+ duplex = DMDUP_HORIZONTAL;
+ break;
+ case wxDUPLEX_VERTICAL:
+ duplex = DMDUP_VERTICAL;
+ break;
+ default:
+ // in fact case wxDUPLEX_SIMPLEX:
+ duplex = DMDUP_SIMPLEX;
+ break;
}
devMode->dmDuplex = duplex;
devMode->dmFields |= DM_DUPLEX;
//// Quality
- int quality;
+ short quality;
switch (m_printQuality)
{
- case wxPRINT_QUALITY_MEDIUM: {
- quality = DMRES_MEDIUM; break;
- }
- case wxPRINT_QUALITY_LOW: {
- quality = DMRES_LOW; break;
- }
- case wxPRINT_QUALITY_DRAFT: {
- quality = DMRES_DRAFT; break;
- }
- case wxPRINT_QUALITY_HIGH: {
- quality = DMRES_HIGH; break;
- }
- default: {
- quality = m_printQuality; break;
- }
+ case wxPRINT_QUALITY_MEDIUM:
+ quality = DMRES_MEDIUM;
+ break;
+ case wxPRINT_QUALITY_LOW:
+ quality = DMRES_LOW;
+ break;
+ case wxPRINT_QUALITY_DRAFT:
+ quality = DMRES_DRAFT;
+ break;
+ case wxPRINT_QUALITY_HIGH:
+ quality = DMRES_HIGH;
+ break;
+ default:
+ quality = (short)m_printQuality;
+ break;
}
devMode->dmPrintQuality = quality;
devMode->dmFields |= DM_PRINTQUALITY;
case wxPRINTBIN_FORMSOURCE: devMode->dmDefaultSource = DMBIN_FORMSOURCE; break;
default:
- devMode->dmDefaultSource = DMBIN_USER + m_bin - wxPRINTBIN_USER;
+ devMode->dmDefaultSource = (short)(DMBIN_USER + m_bin - wxPRINTBIN_USER);
break;
}