Patch level : 4.0

Files correlati     : xvaga,dll
Ricompilazione Demo : [ ]
Commento            :
Migliorata gestione stampanti con driver troppo pretenziosi:
se hanno piu' di 4096 bytes di parametri extra, questi vengono ignorati.
Tale sotterfugio serve per impedire di nuocere alla stampante Konica del CRPA


git-svn-id: svn://10.65.10.50/trunk@14134 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2006-06-29 15:35:17 +00:00
parent a04c11c59e
commit e579568335
3 changed files with 34 additions and 20 deletions

View File

@ -31,7 +31,7 @@ static unsigned int aga_getziplist(const char* zipfile, wxArrayString& aFiles)
return aFiles.GetCount();
}
int aga_find_slash(const wxString& path, int from)
static int aga_find_slash(const wxString& path, int from)
{
for (int i = from; path[i]; i++)
if (wxIsPathSeparator(path[i]))
@ -40,7 +40,7 @@ int aga_find_slash(const wxString& path, int from)
return -1;
}
void aga_create_dir(wxString strPath)
static void aga_create_dir(wxString strPath)
{
if (!wxEndsWithPathSeparator(strPath))
strPath += wxFILE_SEP_PATH;

View File

@ -39,24 +39,39 @@ static void TestPaper(PDEVMODE dm)
}
}
static void adjust_extra(WORD& w)
{
if (w > 4096)
w = 0;
}
void* OsWin32_ConvertFromNativePrinterInfo(void* hGlobal, unsigned int& nDataSize)
{
PDEVMODE dm = (PDEVMODE)::GlobalLock(hGlobal);
nDataSize = dm->dmSize+dm->dmDriverExtra;
void* buff = new char[nDataSize];
TestPaper(dm);
memcpy(buff, dm, nDataSize);
::GlobalUnlock(hGlobal);
void* buff = NULL;
if (hGlobal != NULL)
{
PDEVMODE dm = (PDEVMODE)::GlobalLock(hGlobal);
adjust_extra(dm->dmDriverExtra);
nDataSize = dm->dmSize+dm->dmDriverExtra;
buff = new char[nDataSize];
TestPaper(dm);
memcpy(buff, dm, nDataSize);
::GlobalUnlock(hGlobal);
}
return buff;
}
void* OsWin32_ConvertToNativePrinterInfo(void* data, unsigned int nDataSize)
{
HGLOBAL hGlobal = ::GlobalAlloc(GHND, nDataSize);
PDEVMODE dm = (PDEVMODE)::GlobalLock(hGlobal);
memcpy(dm, data, nDataSize);
TestPaper(dm);
::GlobalUnlock(hGlobal);
HGLOBAL hGlobal = ::GlobalAlloc(GHND, nDataSize); // Alloco lo spazio necessario
if (hGlobal != NULL)
{
PDEVMODE dm = (PDEVMODE)::GlobalLock(hGlobal); // Trasformo l'handle in puntatore
memcpy(dm, data, nDataSize); // Ricopio i dati della stampante
adjust_extra(dm->dmDriverExtra);
TestPaper(dm); // Controllo il formato della carta
::GlobalUnlock(hGlobal); // Libero il lock sull'handle
}
return hGlobal;
}
@ -163,7 +178,7 @@ void* OsWin32_GetPrinterInfo(int& size, const char* printer)
if (comma) *comma = '\0';
}
else
strcpy(name, printer);
strncpy(name, printer, sizeof(name));
LPDEVMODE pdm = NULL;
HANDLE hPrinter;

View File

@ -4449,14 +4449,13 @@ void xvt_vobj_destroy(WINDOW win)
if (_nice_windows.Get(win) != NULL)
{
CAST_TWIN(win, w);
w.Close(true);
if (win != TASK_WIN)
{
CAST_TWIN(win, w);
w.Close(true);
}
GetTDCMapper().DestroyTDC(win);
}
#ifdef DBG
else
XVT_ASSERT(FALSE); // Happens to list box windows
#endif
}
GetTDCMapper().DestroyTDC(win);
}