Patch level : 2.0 630

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

Corretta stampa ultima riga documenti con Generica solo testo in Win 95/98


git-svn-id: svn://10.65.10.50/trunk@11551 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
cris 2003-10-30 18:13:09 +00:00
parent 4f3eefd1cc
commit f0a3ae97c0
3 changed files with 95 additions and 0 deletions

View File

@ -719,6 +719,86 @@ bool OsWin32_GotoUrl(const char* url, const char* action)
return error > 32;
}
// The function that prints one line without formfeed
BOOL OsWin32_SpoolRow(const char* pData,
unsigned int cbBytes,
unsigned int nPrnDC)
{
int iEsc;
BOOL bLocalDC = TRUE; // Assume we must create a DC (hPrnDC == NULL)
HGLOBAL HMem;
char * pOutput;
HMem = GlobalAlloc(GPTR, sizeof(WORD) + cbBytes);
if (HMem == NULL)
return FALSE;
pOutput = (char *)GlobalLock(HMem);
if (pOutput == NULL)
{
GlobalFree(HMem);
return FALSE;
}
BOOL bAbort = FALSE; // Haven't aborted yet
// Make sure we have a printer DC
HDC hPrnDC = (HDC)nPrnDC;
bLocalDC = FALSE; // Use passed in hPrnDC
if (!hPrnDC)
return FALSE;
/*
if (bLocalDC)
Escape (hPrnDC, SETABORTPROC, 0, (LPSTR) PrintAbortProc, NULL);
*/
// PASSTHROUGH is required. If driver doesn't support it, bail out.
bAbort = FALSE;
iEsc = PASSTHROUGH;
if (!Escape(hPrnDC, QUERYESCSUPPORT, sizeof(int), (LPSTR)&iEsc, NULL))
{
bAbort = TRUE;
goto MPLCleanUp;
}
// Call EPSPRINTING if it is supported (that is, if we're on a
// PostScript printer) to suppress downloading the pscript header.
iEsc = EPSPRINTING;
if (Escape(hPrnDC, QUERYESCSUPPORT, sizeof(int), (LPSTR)&iEsc, NULL))
{
iEsc = 1; // 1 == enable PASSTHROUGH (disable pscript header)
Escape(hPrnDC, EPSPRINTING, sizeof(int), (LPSTR)&iEsc, NULL);
}
// Start a Document
Escape (hPrnDC, STARTDOC, 0, "", NULL);
// Put data in the buffer and send to the printer
*(WORD *)pOutput = cbBytes;
memcpy( &(pOutput[sizeof(WORD)]), pData, cbBytes );
if( Escape( hPrnDC, PASSTHROUGH, 0, pOutput, NULL ) <= 0 )
bAbort = TRUE;
// End the Document
if (!bAbort)
Escape(hPrnDC, ENDDOC, NULL, NULL, NULL);
MPLCleanUp: // Done
// Clean up
if (bLocalDC)
DeleteDC( hPrnDC );
GlobalUnlock(HMem);
GlobalFree(HMem);
return !bAbort;
}
#ifdef SPEECH_API
#include "\Programmi\Microsoft Speech SDK 5.1\Include\sapi.h"

View File

@ -36,6 +36,8 @@ bool OsWin32_SL_Logout() ;
bool OsWin32_SL_ReadBlock(unsigned short reg, unsigned short size, unsigned short* data);
bool OsWin32_SL_WriteBlock(unsigned short reg, unsigned short size, const unsigned short* data);
BOOL OsWin32_SpoolRow(const char* pData, unsigned int cbBytes, unsigned int hPrnDC);
#ifdef SPEECH_API
bool OsWin32_InitializeSpeech();
bool OsWin32_Speak(const char* text, bool async);

View File

@ -497,8 +497,21 @@ BOOLEAN xvt_print_start_thread(BOOLEAN(*print_fcn)(long), long data)
print_fcn(data);
DestroyAbortWindow();
#ifdef WIN32
int w, h;
m_po->GetPPIPrinter(&w, &h);
if (h == 6)
{
wxDC* dc = m_po->GetDC();
dc->StartPage();
OsWin32_SpoolRow("\n\n", 1, dc->GetHDC());
dc->EndPage();
}
#endif
m_po->OnEndDocument();
m_po->OnEndPrinting();
delete m_po; m_po = NULL;
return TRUE;