diff --git a/harbour/ChangeLog b/harbour/ChangeLog index f300be2634..cb37449c25 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,24 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-11-24 12:07 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbwin/hbwin.ch + * contrib/hbwin/win_prn2.c + + Added support for server name in WIN_PRINTERLIST() (GETPRINTER()) + + * contrib/hbwin/win_prn2.c + * contrib/hbwin/win_prn3.c + * contrib/hbwin/legacycp.c + * ChangeLog + * Some renaming, to keep all functions in the WIN_PRINT*() namespace. + Prev entry updated. + + * contrib/hbwin/tests/testprn.prg + * contrib/hbwin/tests/testprn2.prg + * contrib/hbwin/tests/testprn3.prg + * contrib/hbwin/tests/testprn4.prg + * Updated tests to use new function names. + 2009-11-24 10:57 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbwin/Makefile * contrib/hbwin/win_prn2.c @@ -26,9 +44,9 @@ WIN_PRINTEREXISTS() (old name: PRINTEREXISTS()) WIN_PRINTERSTATUS() (old name: XISPRINTER()) WIN_PRINTERPORTTONAME() (old name: PRINTERPORTTONAME()) - WIN_GETPRINTERS() (old name: GETPRINTERS()) - WIN_GETDEFAULTPRINTER() (old name: GETDEFAULTPRINTER()) - WIN_SETDEFAULTPRINTER() (old name: SETDEFAULTPRINTER()) + WIN_PRINTERLIST() (old name: GETPRINTERS()) + WIN_PRINTERGETDEFAULT() (old name: GETDEFAULTPRINTER()) + WIN_PRINTERSETDEFAULT() (old name: SETDEFAULTPRINTER()) WIN_PRINTFILERAW() (old name: PRINTFILERAW()) ; Old names still work, and they are guarded with HB_WIN_LEGACY_LEVEL_OFF diff --git a/harbour/contrib/hbwin/hbwin.ch b/harbour/contrib/hbwin/hbwin.ch index 75eb4e5e5a..2cce37fcb1 100644 --- a/harbour/contrib/hbwin/hbwin.ch +++ b/harbour/contrib/hbwin/hbwin.ch @@ -62,7 +62,8 @@ #define HB_WINPRN_TYPE 3 #define HB_WINPRN_DRIVER 4 #define HB_WINPRN_SHARE 5 -#define HB_WINPRN_LEN_ 5 +#define HB_WINPRN_SERVER 6 +#define HB_WINPRN_LEN_ 6 /* Registry related values */ diff --git a/harbour/contrib/hbwin/legacycp.c b/harbour/contrib/hbwin/legacycp.c index 1e6872bcd3..e5907a54fa 100644 --- a/harbour/contrib/hbwin/legacycp.c +++ b/harbour/contrib/hbwin/legacycp.c @@ -55,11 +55,11 @@ #if !defined( HB_WIN_LEGACY_LEVEL_OFF ) HB_FUNC_EXTERN( WIN_PRINTEREXISTS ) ; HB_FUNC( PRINTEREXISTS ) { HB_FUNC_EXEC( WIN_PRINTEREXISTS ); } -HB_FUNC_EXTERN( WIN_GETDEFAULTPRINTER ) ; HB_FUNC( GETDEFAULTPRINTER ) { HB_FUNC_EXEC( WIN_GETDEFAULTPRINTER ); } +HB_FUNC_EXTERN( WIN_PRINTERGETDEFAULT ) ; HB_FUNC( GETDEFAULTPRINTER ) { HB_FUNC_EXEC( WIN_PRINTERGETDEFAULT ); } HB_FUNC_EXTERN( WIN_PRINTERSTATUS ) ; HB_FUNC( XISPRINTER ) { HB_FUNC_EXEC( WIN_PRINTERSTATUS ); } HB_FUNC_EXTERN( WIN_PRINTERPORTTONAME ) ; HB_FUNC( PRINTERPORTTONAME ) { HB_FUNC_EXEC( WIN_PRINTERPORTTONAME ); } HB_FUNC_EXTERN( WIN_PRINTFILERAW ) ; HB_FUNC( PRINTFILERAW ) { HB_FUNC_EXEC( WIN_PRINTFILERAW ); } -HB_FUNC_EXTERN( WIN_GETPRINTERS ) ; HB_FUNC( GETPRINTERS ) { HB_FUNC_EXEC( WIN_GETPRINTERS ); } -HB_FUNC_EXTERN( WIN_SETDEFAULTPRINTER ) ; HB_FUNC( SETDEFAULTPRINTER ) { HB_FUNC_EXEC( WIN_SETDEFAULTPRINTER ); } +HB_FUNC_EXTERN( WIN_PRINTERLIST ) ; HB_FUNC( GETPRINTERS ) { HB_FUNC_EXEC( WIN_PRINTERLIST ); } +HB_FUNC_EXTERN( WIN_PRINTERSETDEFAULT ) ; HB_FUNC( SETDEFAULTPRINTER ) { HB_FUNC_EXEC( WIN_PRINTERSETDEFAULT ); } #endif diff --git a/harbour/contrib/hbwin/tests/testprn.prg b/harbour/contrib/hbwin/tests/testprn.prg index 2ad441ec8b..50b4c811ab 100644 --- a/harbour/contrib/hbwin/tests/testprn.prg +++ b/harbour/contrib/hbwin/tests/testprn.prg @@ -7,7 +7,7 @@ PROCEDURE Main() LOCAL nPrn := 1 LOCAL cBMPFile := Space( 40 ) - LOCAL aPrn := GetPrinters() + LOCAL aPrn := WIN_PRINTERLIST() LOCAL GetList := {} CLS diff --git a/harbour/contrib/hbwin/tests/testprn2.prg b/harbour/contrib/hbwin/tests/testprn2.prg index d99abf5487..d633e33644 100644 --- a/harbour/contrib/hbwin/tests/testprn2.prg +++ b/harbour/contrib/hbwin/tests/testprn2.prg @@ -5,7 +5,7 @@ PROCEDURE Main() LOCAL nPrn := 1 LOCAL cFileName := Space( 40 ) - LOCAL aPrn := GetPrinters() + LOCAL aPrn := WIN_PRINTERLIST() LOCAL GetList := {} CLS @@ -17,7 +17,7 @@ PROCEDURE Main() DO WHILE nPrn != 0 CLS - @ 0, 0 SAY "PrintFileRaw() test program. Choose a printer to test" + @ 0, 0 SAY "win_PrintFileRaw() test program. Choose a printer to test" @ 1, 0 SAY "File name" GET cFileName PICT "@!K" READ @ 2, 0 TO MaxRow(), MaxCol() @@ -35,6 +35,6 @@ STATIC PROCEDURE PrnTest( cPrinter, cFileName ) hb_MemoWrit( cFileName := "_hbtest.prn", "Hello World!" + Chr( 12 ) ) ENDIF - Alert( "PrintFileRaw() returned: " + hb_ntos( PrintFileRaw( cPrinter, cFileName, "testing raw printing" ) ) ) + Alert( "win_PrintFileRaw() returned: " + hb_ntos( WIN_PRINTFILERAW( cPrinter, cFileName, "testing raw printing" ) ) ) RETURN diff --git a/harbour/contrib/hbwin/tests/testprn3.prg b/harbour/contrib/hbwin/tests/testprn3.prg index c35fce32c5..2ccf7d3244 100644 --- a/harbour/contrib/hbwin/tests/testprn3.prg +++ b/harbour/contrib/hbwin/tests/testprn3.prg @@ -14,13 +14,13 @@ PROCEDURE Main() - Dump( GetPrinters( .F., .F. ) ) - Dump( GetPrinters( .F., .T. ) ) - Dump( GetPrinters( .T., .F. ) ) - Dump( GetPrinters( .T., .T. ) ) + Dump( WIN_PRINTERLIST( .F., .F. ) ) + Dump( WIN_PRINTERLIST( .F., .T. ) ) + Dump( WIN_PRINTERLIST( .T., .F. ) ) + Dump( WIN_PRINTERLIST( .T., .T. ) ) - ? "GETDEFAULTPRINTER:", ">" + GETDEFAULTPRINTER() + "<" - ? "XISPRINTER:", XISPRINTER() + ? "WIN_PRINTERGETDEFAULT:", ">" + WIN_PRINTERGETDEFAULT() + "<" + ? "WIN_PRINTERSTATUS:", WIN_PRINTERSTATUS() RETURN @@ -28,18 +28,19 @@ STATIC PROCEDURE Dump( a ) LOCAL b, c ? "==================" - ? FOR EACH b IN a + ? IF ValType( b ) == "A" FOR EACH c IN b - ?? c + ?? c:__enumIndex(), c IF c:__enumIndex() == 2 - ?? ">>" + PRINTERPORTTONAME( c ) + "<<", "|>>" + PRINTERPORTTONAME( c, .T. ) + "<<|" + ?? ">>" + WIN_PRINTERPORTTONAME( c ) + "<<", "|>>" + WIN_PRINTERPORTTONAME( c, .T. ) + "<<|" ENDIF ? NEXT + ? "-----" ELSE - ? b, PRINTEREXISTS( b ), XISPRINTER( b ) + ? b, WIN_PRINTEREXISTS( b ), WIN_PRINTERSTATUS( b ) ENDIF NEXT diff --git a/harbour/contrib/hbwin/tests/testprn4.prg b/harbour/contrib/hbwin/tests/testprn4.prg index 6d89382460..1208a374fd 100644 --- a/harbour/contrib/hbwin/tests/testprn4.prg +++ b/harbour/contrib/hbwin/tests/testprn4.prg @@ -13,10 +13,10 @@ #include "simpleio.ch" PROCEDURE Main() - LOCAL a := GETDEFAULTPRINTER() + LOCAL a := WIN_PRINTERGETDEFAULT() ? ">" + a + "<" - ? SETDEFAULTPRINTER( a ) + ? WIN_PRINTERSETDEFAULT( a ) RETURN diff --git a/harbour/contrib/hbwin/win_prn2.c b/harbour/contrib/hbwin/win_prn2.c index b29d0afeff..030bc77952 100644 --- a/harbour/contrib/hbwin/win_prn2.c +++ b/harbour/contrib/hbwin/win_prn2.c @@ -233,7 +233,7 @@ static HB_BOOL hb_GetDefaultPrinter( char * pszPrinterName, HB_SIZE * pnBufferSi return bResult; } -HB_FUNC( WIN_GETDEFAULTPRINTER ) +HB_FUNC( WIN_PRINTERGETDEFAULT ) { char szDefaultPrinter[ MAXBUFFERSIZE ]; HB_SIZE nBufferSize = sizeof( szDefaultPrinter ); @@ -467,14 +467,15 @@ HB_FUNC( WIN_PRINTFILERAW ) /* Positions for GETPRINTERS() array */ -#define HB_WINPRN_NAME 1 -#define HB_WINPRN_PORT 2 -#define HB_WINPRN_TYPE 3 -#define HB_WINPRN_DRIVER 4 -#define HB_WINPRN_SHARE 5 -#define HB_WINPRN_LEN_ 5 +#define HB_WINPRN_NAME 1 +#define HB_WINPRN_PORT 2 +#define HB_WINPRN_TYPE 3 +#define HB_WINPRN_DRIVER 4 +#define HB_WINPRN_SHARE 5 +#define HB_WINPRN_SERVER 6 +#define HB_WINPRN_LEN_ 6 -HB_FUNC( WIN_GETPRINTERS ) +HB_FUNC( WIN_PRINTERLIST ) { HB_BOOL bPrinterNamesOnly = HB_ISLOG( 1 ) ? ! hb_parl( 1 ) : TRUE; HB_BOOL bLocalPrintersOnly = hb_parl( 2 ); @@ -533,12 +534,16 @@ HB_FUNC( WIN_GETPRINTERS ) pszData = HB_TCHAR_CONVFROM( pPrinterInfo2->pShareName ); hb_arraySetC( pTempItem, HB_WINPRN_SHARE, pszData ); HB_TCHAR_FREE( pszData ); + pszData = HB_TCHAR_CONVFROM( pPrinterInfo2->pServerName ); + hb_arraySetC( pTempItem, HB_WINPRN_SERVER, pszData ); + HB_TCHAR_FREE( pszData ); } else { hb_arraySetC( pTempItem, HB_WINPRN_PORT, NULL ); hb_arraySetC( pTempItem, HB_WINPRN_DRIVER, NULL ); hb_arraySetC( pTempItem, HB_WINPRN_SHARE, NULL ); + hb_arraySetC( pTempItem, HB_WINPRN_SERVER, NULL ); } hb_xfree( pPrinterInfo2 ); diff --git a/harbour/contrib/hbwin/win_prn3.c b/harbour/contrib/hbwin/win_prn3.c index f27e5b2252..ad5d26d30a 100644 --- a/harbour/contrib/hbwin/win_prn3.c +++ b/harbour/contrib/hbwin/win_prn3.c @@ -247,7 +247,7 @@ static HB_BOOL hb_SetDefaultPrinter( LPTSTR lpPrinterName ) return HB_TRUE; } -HB_FUNC( WIN_SETDEFAULTPRINTER ) +HB_FUNC( WIN_PRINTERSETDEFAULT ) { if( hb_parclen( 1 ) > 0 ) {