Patch level : 2.0 nopatch by now

Files correlati     : xvaga.dll
Ricompilazione Demo : [ ]
Commento            :

Riveduta e corretta gestione moduli di stampa personalizzati


git-svn-id: svn://10.65.10.50/trunk@11758 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2004-02-13 14:52:01 +00:00
parent b6f04fc6a3
commit 3821c153e9
3 changed files with 30 additions and 15 deletions

View File

@ -1,5 +1,6 @@
#include "wxinc.h" #include "wxinc.h"
#include "wx/filename.h" #include "wx/filename.h"
#include "wx/paper.h"
#include "oswin32.h" #include "oswin32.h"
@ -25,13 +26,24 @@ bool OsWin32_CheckPrinterInfo(const void* data, unsigned int size)
return ok; return ok;
} }
static void TestPaper(PDEVMODE dm)
{
wxPrintPaperType* paper = wxThePrintPaperDatabase->FindPaperTypeByPlatformId(dm->dmPaperSize);
if (paper == NULL)
{
dm->dmFields |= DM_PAPERSIZE;
wxThePrintPaperDatabase->WXADDPAPER((wxPaperSize)dm->dmPaperSize /*wxPAPER_NONE*/, dm->dmPaperSize,
dm->dmFormName, dm->dmPaperWidth, dm->dmPaperLength);
}
}
void* OsWin32_ConvertFromNativePrinterInfo(void* hGlobal, unsigned int& nDataSize) void* OsWin32_ConvertFromNativePrinterInfo(void* hGlobal, unsigned int& nDataSize)
{ {
void* ptr = ::GlobalLock(hGlobal); PDEVMODE dm = (PDEVMODE)::GlobalLock(hGlobal);
PDEVMODE dm = (PDEVMODE)ptr;
nDataSize = dm->dmSize+dm->dmDriverExtra; nDataSize = dm->dmSize+dm->dmDriverExtra;
void* buff = new char[nDataSize]; void* buff = new char[nDataSize];
memcpy(buff, ptr, nDataSize); TestPaper(dm);
memcpy(buff, dm, nDataSize);
::GlobalUnlock(hGlobal); ::GlobalUnlock(hGlobal);
return buff; return buff;
} }
@ -39,8 +51,9 @@ void* OsWin32_ConvertFromNativePrinterInfo(void* hGlobal, unsigned int& nDataSiz
void* OsWin32_ConvertToNativePrinterInfo(void* data, unsigned int nDataSize) void* OsWin32_ConvertToNativePrinterInfo(void* data, unsigned int nDataSize)
{ {
HGLOBAL hGlobal = ::GlobalAlloc(GHND, nDataSize); HGLOBAL hGlobal = ::GlobalAlloc(GHND, nDataSize);
void* ptr = ::GlobalLock(hGlobal); PDEVMODE dm = (PDEVMODE)::GlobalLock(hGlobal);
memcpy(ptr, data, nDataSize); memcpy(dm, data, nDataSize);
TestPaper(dm);
::GlobalUnlock(hGlobal); ::GlobalUnlock(hGlobal);
return hGlobal; return hGlobal;
} }

View File

@ -165,6 +165,7 @@ XVTDLL BOOLEAN xvt_fsys_rmdir(const char *pathname);
XVTDLL BOOLEAN xvt_fsys_removefile(const char *pathname); XVTDLL BOOLEAN xvt_fsys_removefile(const char *pathname);
XVTDLL BOOLEAN xvt_fsys_access(const char *pathname, int mode); XVTDLL BOOLEAN xvt_fsys_access(const char *pathname, int mode);
XVTDLL BOOLEAN xvt_fsys_file_exists(const char *pathname); XVTDLL BOOLEAN xvt_fsys_file_exists(const char *pathname);
XVTDLL int xvt_fsys_get_campo_stp_value(const char* name, char* value, int valsize);
XVTDLL const char* xvt_fsys_get_campo_ini(); XVTDLL const char* xvt_fsys_get_campo_ini();
XVTDLL void xvt_help_close_helpfile(XVT_HELP_INFO hi); XVTDLL void xvt_help_close_helpfile(XVT_HELP_INFO hi);

View File

@ -255,19 +255,20 @@ BOOLEAN xvt_dm_post_page_setup(PRINT_RCD* precp)
wxPageSetupDialog dlg((wxWindow*)TASK_WIN); wxPageSetupDialog dlg((wxWindow*)TASK_WIN);
TPRINT_RCD* rcd = (TPRINT_RCD*)precp; TPRINT_RCD* rcd = (TPRINT_RCD*)precp;
wxPageSetupData& pdd = dlg.GetPageSetupData(); wxPageSetupData& pdd = dlg.GetPageSetupData();
wxPrintData& data = pdd.GetPrintData(); wxPrintData& data = pdd.GetPrintData();
#ifdef WIN32 #ifdef WIN32
data.SetNativeData(OsWin32_ConvertToNativePrinterInfo(rcd->m_data, rcd->m_size)); void* pHandle = OsWin32_ConvertToNativePrinterInfo(rcd->m_data, rcd->m_size);
data.ConvertFromNative(); data.SetNativeData(pHandle);
data.ConvertFromNative();
#endif #endif
pdd.EnableMargins(false);
if (dlg.ShowModal() == wxID_OK) const BOOLEAN ok = dlg.ShowModal() == wxID_OK;
if (ok)
{ {
#ifdef WIN32 #ifdef WIN32
data.ConvertToNative(); pHandle = data.GetNativeData();
void* pHandle = data.GetNativeData();
unsigned int nSize = 0; unsigned int nSize = 0;
void* ptr = OsWin32_ConvertFromNativePrinterInfo(pHandle, nSize); void* ptr = OsWin32_ConvertFromNativePrinterInfo(pHandle, nSize);
rcd->SetData(ptr, nSize); rcd->SetData(ptr, nSize);
@ -276,9 +277,9 @@ BOOLEAN xvt_dm_post_page_setup(PRINT_RCD* precp)
rcd->SetData((void *) &data, (unsigned int) sizeof(data)); rcd->SetData((void *) &data, (unsigned int) sizeof(data));
#endif #endif
m_PrintoutCache.Reset(); m_PrintoutCache.Reset();
return TRUE;
} }
return FALSE;
return ok;
} }
long xvt_fmap_get_family_sizes(PRINT_RCD *precp, char *family, long *size_array, BOOLEAN *scalable, long max_sizes) long xvt_fmap_get_family_sizes(PRINT_RCD *precp, char *family, long *size_array, BOOLEAN *scalable, long max_sizes)