From f0a3ae97c02f1fec3e77dbe56c8fe52a08a3193d Mon Sep 17 00:00:00 2001 From: cris Date: Thu, 30 Oct 2003 18:13:09 +0000 Subject: [PATCH] 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 --- xvaga/oswin32.cpp | 80 ++++++++++++++++++++++++++++++++++++++++++++++ xvaga/oswin32.h | 2 ++ xvaga/xvtextra.cpp | 13 ++++++++ 3 files changed, 95 insertions(+) diff --git a/xvaga/oswin32.cpp b/xvaga/oswin32.cpp index a39e453db..7daa6958d 100755 --- a/xvaga/oswin32.cpp +++ b/xvaga/oswin32.cpp @@ -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" diff --git a/xvaga/oswin32.h b/xvaga/oswin32.h index dee97b7ef..5720052b8 100755 --- a/xvaga/oswin32.h +++ b/xvaga/oswin32.h @@ -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); diff --git a/xvaga/xvtextra.cpp b/xvaga/xvtextra.cpp index eba377979..c6e514899 100755 --- a/xvaga/xvtextra.cpp +++ b/xvaga/xvtextra.cpp @@ -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;