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(); 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++) for (int i = from; path[i]; i++)
if (wxIsPathSeparator(path[i])) if (wxIsPathSeparator(path[i]))
@ -40,7 +40,7 @@ int aga_find_slash(const wxString& path, int from)
return -1; return -1;
} }
void aga_create_dir(wxString strPath) static void aga_create_dir(wxString strPath)
{ {
if (!wxEndsWithPathSeparator(strPath)) if (!wxEndsWithPathSeparator(strPath))
strPath += wxFILE_SEP_PATH; 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) void* OsWin32_ConvertFromNativePrinterInfo(void* hGlobal, unsigned int& nDataSize)
{ {
PDEVMODE dm = (PDEVMODE)::GlobalLock(hGlobal); void* buff = NULL;
nDataSize = dm->dmSize+dm->dmDriverExtra; if (hGlobal != NULL)
void* buff = new char[nDataSize]; {
TestPaper(dm); PDEVMODE dm = (PDEVMODE)::GlobalLock(hGlobal);
memcpy(buff, dm, nDataSize); adjust_extra(dm->dmDriverExtra);
::GlobalUnlock(hGlobal); nDataSize = dm->dmSize+dm->dmDriverExtra;
buff = new char[nDataSize];
TestPaper(dm);
memcpy(buff, dm, nDataSize);
::GlobalUnlock(hGlobal);
}
return buff; return buff;
} }
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); // Alloco lo spazio necessario
PDEVMODE dm = (PDEVMODE)::GlobalLock(hGlobal); if (hGlobal != NULL)
memcpy(dm, data, nDataSize); {
TestPaper(dm); PDEVMODE dm = (PDEVMODE)::GlobalLock(hGlobal); // Trasformo l'handle in puntatore
::GlobalUnlock(hGlobal); 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; return hGlobal;
} }
@ -163,7 +178,7 @@ void* OsWin32_GetPrinterInfo(int& size, const char* printer)
if (comma) *comma = '\0'; if (comma) *comma = '\0';
} }
else else
strcpy(name, printer); strncpy(name, printer, sizeof(name));
LPDEVMODE pdm = NULL; LPDEVMODE pdm = NULL;
HANDLE hPrinter; HANDLE hPrinter;

View File

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