diff --git a/harbour/ChangeLog.txt b/harbour/ChangeLog.txt index b6eaed8791..8cd245936a 100644 --- a/harbour/ChangeLog.txt +++ b/harbour/ChangeLog.txt @@ -10,6 +10,27 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2012-11-29 13:16 UTC+0100 Viktor Szakats (harbour syenar.net) + * contrib/hbgd/tests/hbmk.hbm + * contrib/hbgd/tests/animgif.prg + * contrib/hbgd/tests/antialia.prg + * contrib/hbgd/tests/counter.prg + * contrib/hbgd/tests/gdtest.prg + * contrib/hbgd/tests/gdtestcl.prg + * contrib/hbgd/tests/tostring.prg + * contrib/hbgd/tests/tpoly.prg + * experiment: instead of #including "simpleio.ch" in + most tests, I added -u+simpleio.ch to hbmk.hbm so + it's automatically enabled for all tests. + (need to be careful about it f.e. in /tests/ where + some code assumes that ?/?? goes to screen, not + stdout) + + * contrib/hbwin/tests/testprn.prg + * contrib/hbwin/tests/testprn2.prg + * contrib/hbwin/win_tprn.prg + * cleanups (names, avoid QUIT, use hb_StrFormat(), etc) + 2012-11-29 01:44 UTC+0100 Viktor Szakats (harbour syenar.net) * contrib/gtwvg/gtwvg.hbc + added all three headers as standard one diff --git a/harbour/contrib/hbgd/tests/animgif.prg b/harbour/contrib/hbgd/tests/animgif.prg index c1b5c5c994..2b8cf6998f 100644 --- a/harbour/contrib/hbgd/tests/animgif.prg +++ b/harbour/contrib/hbgd/tests/animgif.prg @@ -12,8 +12,6 @@ #require "hbgd" -#include "simpleio.ch" - #define IMAGES_IN "imgs_in" + hb_ps() #define IMAGES_OUT "imgs_out" + hb_ps() @@ -23,12 +21,12 @@ PROCEDURE Main() LOCAL black, trans LOCAL hFile - /* +#if 0 // Check output directory IF ! hb_DirExists( IMAGES_OUT ) DirMake( IMAGES_OUT ) ENDIF - */ +#endif /* Create the image */ im := gdImageCreate( 100, 100 ) diff --git a/harbour/contrib/hbgd/tests/antialia.prg b/harbour/contrib/hbgd/tests/antialia.prg index 97092e1abd..c42ed1e5a8 100644 --- a/harbour/contrib/hbgd/tests/antialia.prg +++ b/harbour/contrib/hbgd/tests/antialia.prg @@ -10,8 +10,6 @@ #require "hbgd" -#include "simpleio.ch" - #define IMAGES_IN "imgs_in" + hb_ps() #define IMAGES_OUT "imgs_out" + hb_ps() @@ -20,12 +18,12 @@ PROCEDURE Main() LOCAL im LOCAL white, blue - /* +#if 0 // Check output directory IF ! hb_DirExists( IMAGES_OUT ) DirMake( IMAGES_OUT ) ENDIF - */ +#endif /* This sample shows differences on use of antiliased command between a diff --git a/harbour/contrib/hbgd/tests/counter.prg b/harbour/contrib/hbgd/tests/counter.prg index a8bcba537d..07c19ff5a0 100644 --- a/harbour/contrib/hbgd/tests/counter.prg +++ b/harbour/contrib/hbgd/tests/counter.prg @@ -13,8 +13,6 @@ #require "hbgd" -#include "simpleio.ch" - /* Some digits images from: http://www.digitmania.holowww.com/all.html */ diff --git a/harbour/contrib/hbgd/tests/gdtest.prg b/harbour/contrib/hbgd/tests/gdtest.prg index 7c6016ebca..cf7636c4cc 100644 --- a/harbour/contrib/hbgd/tests/gdtest.prg +++ b/harbour/contrib/hbgd/tests/gdtest.prg @@ -10,8 +10,6 @@ #require "hbgd" -#include "simpleio.ch" - #define IMAGES_IN "imgs_in" + hb_ps() #define IMAGES_OUT "imgs_out" + hb_ps() @@ -21,12 +19,12 @@ PROCEDURE Main() LOCAL black, blue, red, green, cyan LOCAL color, font -/* +#if 0 // Check output directory IF ! hb_DirExists( IMAGES_OUT ) DirMake( IMAGES_OUT ) ENDIF -*/ +#endif ? gdVersion() diff --git a/harbour/contrib/hbgd/tests/gdtestcl.prg b/harbour/contrib/hbgd/tests/gdtestcl.prg index 1b155d3c24..1998283c1f 100644 --- a/harbour/contrib/hbgd/tests/gdtestcl.prg +++ b/harbour/contrib/hbgd/tests/gdtestcl.prg @@ -10,8 +10,6 @@ #require "hbgd" -#include "simpleio.ch" - #define IMAGES_IN "imgs_in" + hb_ps() #define IMAGES_OUT "imgs_out" + hb_ps() @@ -23,12 +21,12 @@ PROCEDURE Main() LOCAL oI5 LOCAL oB -/* +#if 0 // Check output directory IF ! hb_DirExists( IMAGES_OUT ) DirMake( IMAGES_OUT ) ENDIF -*/ +#endif /* Create an image in memory */ oI := GDImage():Create( 200, 200 ) diff --git a/harbour/contrib/hbgd/tests/hbmk.hbm b/harbour/contrib/hbgd/tests/hbmk.hbm index 811059c0e8..37d616f68a 100644 --- a/harbour/contrib/hbgd/tests/hbmk.hbm +++ b/harbour/contrib/hbgd/tests/hbmk.hbm @@ -5,3 +5,5 @@ hbgd.hbc -w3 -es2 + +-u+simpleio.ch diff --git a/harbour/contrib/hbgd/tests/tostring.prg b/harbour/contrib/hbgd/tests/tostring.prg index 6d217ca4ab..3a4c5cc6a9 100644 --- a/harbour/contrib/hbgd/tests/tostring.prg +++ b/harbour/contrib/hbgd/tests/tostring.prg @@ -10,8 +10,6 @@ #require "hbgd" -#include "simpleio.ch" - #define IMAGES_IN "imgs_in" + hb_ps() #define IMAGES_OUT "imgs_out" + hb_ps() @@ -19,12 +17,12 @@ PROCEDURE Main() LOCAL oI - /* +#if 0 // Check output directory IF ! hb_DirExists( IMAGES_OUT ) DirMake( IMAGES_OUT ) ENDIF - */ +#endif /* Load an image from file */ oI := GDImage():LoadFromFile( IMAGES_IN + "conv_tst.jpg" ) diff --git a/harbour/contrib/hbgd/tests/tpoly.prg b/harbour/contrib/hbgd/tests/tpoly.prg index c89f2cdd60..86a50caa0e 100644 --- a/harbour/contrib/hbgd/tests/tpoly.prg +++ b/harbour/contrib/hbgd/tests/tpoly.prg @@ -8,8 +8,6 @@ #require "hbgd" -#include "simpleio.ch" - #command TurnRight( ) => s_nAngle += Pi() / 3 * #command TurnLeft( ) => s_nAngle -= Pi() / 3 * diff --git a/harbour/contrib/hbwin/tests/testprn.prg b/harbour/contrib/hbwin/tests/testprn.prg index 87b18d9152..3c2f3255de 100644 --- a/harbour/contrib/hbwin/tests/testprn.prg +++ b/harbour/contrib/hbwin/tests/testprn.prg @@ -8,28 +8,26 @@ PROCEDURE Main( cPar1 ) LOCAL nPrn := 1 LOCAL cBMPFile := Space( 40 ) - LOCAL aPrn := win_printerList() LOCAL GetList := {} - CLS + LOCAL aPrn := win_printerList() IF Empty( aPrn ) Alert( "No printers installed - Cannot continue" ) - QUIT + ELSE + DO WHILE nPrn != 0 + CLS + @ 0, 0 SAY "win_Prn() Class test program. Choose a printer to test" + @ 1, 0 SAY "Bitmap file name:" GET cBMPFile PICT "@K" + READ + @ 2, 0 TO MaxRow(), MaxCol() + nPrn := AChoice( 3, 1, MaxRow() - 1, MaxCol() - 1, aPrn, .T.,, nPrn ) + IF nPrn != 0 + PrnTest( aPrn[ nPrn ], cBMPFile, iif( HB_ISSTRING( cPar1 ) .AND. Lower( cPar1 ) == "ask", .T., NIL ) ) + ENDIF + ENDDO ENDIF - DO WHILE nPrn != 0 - CLS - @ 0, 0 SAY "win_Prn() Class test program. Choose a printer to test" - @ 1, 0 SAY "Bitmap file name" GET cBMPFile PICT "@K" - READ - @ 2, 0 TO MaxRow(), MaxCol() - nPrn := AChoice( 3, 1, MaxRow() - 1, MaxCol() - 1, aPrn, .T.,, nPrn ) - IF nPrn != 0 - PrnTest( aPrn[ nPrn ], cBMPFile, iif( HB_ISSTRING( cPar1 ) .AND. Lower( cPar1 ) == "ask", .T., NIL ) ) - ENDIF - ENDDO - RETURN STATIC PROCEDURE PrnTest( cPrinter, cBMPFile, lAsk ) @@ -56,7 +54,7 @@ STATIC PROCEDURE PrnTest( cPrinter, cBMPFile, lAsk ) ELSE oPrinter:SetPen( WIN_PS_SOLID, 1, HB_WIN_RGB_RED ) oPrinter:Bold( WIN_FW_EXTRABOLD ) - oPrinter:TextOut( oPrinter:PrinterName + ": MaxRow() = " + Str( oPrinter:MaxRow(), 4 ) + " MaxCol() = " + Str( oPrinter:MaxCol(), 4 ) ) + oPrinter:TextOut( oPrinter:PrinterName + ": MaxRow() = " + hb_ntos( oPrinter:MaxRow() ) + " MaxCol() = " + hb_ntos( oPrinter:MaxCol() ) ) oPrinter:Bold( WIN_FW_DONTCARE ) oPrinter:NewLine() oPrinter:TextOut( " Partial list of available fonts that are available for OEM_" ) @@ -89,7 +87,7 @@ STATIC PROCEDURE PrnTest( cPrinter, cBMPFile, lAsk ) oPrinter:SetPos( nColTTF ) oPrinter:TextOut( iif( aFonts[ x, 3 ], "Yes", "No" ) ) oPrinter:SetPos( nColCharSet ) - oPrinter:TextOut( Str( aFonts[ x, 4 ], 5 ) ) + oPrinter:TextOut( hb_ntos( aFonts[ x, 4 ] ) ) oPrinter:SetPos( oPrinter:LeftMargin, oPrinter:PosY + ( oPrinter:CharHeight * 2 ) ) IF oPrinter:PRow() > oPrinter:MaxRow() - 16 // Could use "oPrinter:NewPage()" to start a new page EXIT @@ -102,9 +100,9 @@ STATIC PROCEDURE PrnTest( cPrinter, cBMPFile, lAsk ) oPrinter:CharSet( 0 ) // Reset default charset oPrinter:Bold( WIN_FW_EXTRABOLD ) oPrinter:NewLine() - oPrinter:TextOut( "This is on line" + Str( oPrinter:PRow(), 4 ) + ", Printed bold, " ) + oPrinter:TextOut( "This is on line" + hb_ntos( oPrinter:PRow() ) + ", Printed bold, " ) oPrinter:TextOut( " finishing at Column: " ) - oPrinter:TextOut( Str( oPrinter:PCol(), 4 ) ) + oPrinter:TextOut( hb_ntos( oPrinter:PCol() ) ) oPrinter:SetPRC( oPrinter:PRow() + 3, 0 ) oPrinter:Bold( WIN_FW_DONTCARE ) oPrinter:TextOut( "Notice: UNDERLINE only prints correctly if there is a blank line after", .T. ) @@ -121,11 +119,11 @@ STATIC PROCEDURE PrnTest( cPrinter, cBMPFile, lAsk ) oPrinter:Ellipse( 400, oPrinter:PosY + 100, 500, oPrinter:PosY + 200 ) oPrinter:FillRect( 600, oPrinter:PosY + 100, 700, oPrinter:PosY + 200, HB_WIN_RGB_RED ) - // To print a barcode; - // Replace 'BCod39HN' with your own bar code font or any other font - // oPrinter:TextAtFont( oPrinter:MM_TO_POSX( 30 ), oPrinter:MM_TO_POSY( 60 ), "1234567890", "BCod39HN", 24, 0 ) + // To print a barcode; + // Replace "BCod39HN" with your own bar code font or any other font + // oPrinter:TextAtFont( oPrinter:MM_TO_POSX( 30 ), oPrinter:MM_TO_POSY( 60 ), "1234567890", "BCod39HN", 24, 0 ) // - PrintBitMap( oPrinter, cBMPFile ) + PrintBitmap( oPrinter, cBMPFile ) oPrinter:EndDoc() ENDIF @@ -134,26 +132,26 @@ STATIC PROCEDURE PrnTest( cPrinter, cBMPFile, lAsk ) RETURN -STATIC PROCEDURE PrintBitMap( oPrn, cBitFile ) +STATIC PROCEDURE PrintBitmap( oPrn, cBitFile ) LOCAL oBMP - IF Empty( cBitFile ) - // - ELSEIF ! hb_FileExists( cBitFile ) - Alert( cBitFile + " not found " ) - ELSE - oBMP := win_BMP():New() - IF oBmp:loadFile( cBitFile ) - - oBmp:Draw( oPrn, { 200, 200, 2000, 1500 } ) - - // Note: Can also use this method to print bitmap - // oBmp:Rect := { 200, 200, 2000, 1500 } - // oPrn:DrawBitMap( oBmp ) + IF ! Empty( cBitFile ) + IF hb_FileExists( cBitFile ) + oBMP := win_BMP():New() + IF oBmp:loadFile( cBitFile ) + oBmp:Draw( oPrn, { 200, 200, 2000, 1500 } ) +#if 0 + /* Note: Can also use this method to print bitmap */ + oBmp:Rect := { 200, 200, 2000, 1500 } + oPrn:DrawBitmap( oBmp ) +#endif + ENDIF + oBMP:Destroy() + ELSE + Alert( hb_StrFormat( "%1$s not found ", cBitFile ) ) ENDIF - oBMP:Destroy() ENDIF RETURN diff --git a/harbour/contrib/hbwin/tests/testprn2.prg b/harbour/contrib/hbwin/tests/testprn2.prg index e000513dca..268193c089 100644 --- a/harbour/contrib/hbwin/tests/testprn2.prg +++ b/harbour/contrib/hbwin/tests/testprn2.prg @@ -8,28 +8,28 @@ PROCEDURE Main() LOCAL nPrn := 1 LOCAL cFileName := Space( 40 ) - LOCAL aPrn := win_printerList() LOCAL GetList := {} + LOCAL aPrn := win_printerList() + CLS IF Empty( aPrn ) Alert( "No printers installed - Cannot continue" ) - QUIT + ELSE + DO WHILE nPrn != 0 + CLS + @ 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() + nPrn := AChoice( 3, 1, MaxRow() - 1, MaxCol() - 1, aPrn, .T.,, nPrn ) + IF nPrn != 0 + PrnTest( aPrn[ nPrn ], cFileName ) + ENDIF + ENDDO ENDIF - DO WHILE nPrn != 0 - CLS - @ 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() - nPrn := AChoice( 3, 1, MaxRow() - 1, MaxCol() - 1, aPrn, .T.,, nPrn ) - IF nPrn != 0 - PrnTest( aPrn[ nPrn ], cFileName ) - ENDIF - ENDDO - RETURN STATIC PROCEDURE PrnTest( cPrinter, cFileName ) diff --git a/harbour/contrib/hbwin/win_tprn.prg b/harbour/contrib/hbwin/win_tprn.prg index 68ff9d07b2..f6cf05d72a 100644 --- a/harbour/contrib/hbwin/win_tprn.prg +++ b/harbour/contrib/hbwin/win_tprn.prg @@ -124,7 +124,7 @@ CREATE CLASS win_Prn METHOD GetCharHeight() METHOD GetTextWidth( cString ) METHOD GetTextHeight( cString ) - METHOD DrawBitMap( oBmp ) + METHOD DrawBitmap( oBmp ) /* Clipper compatible functions. */ METHOD SetPRC( nRow, nCol ) // Based on ::LineHeight and current ::CharWidth @@ -798,7 +798,7 @@ METHOD GetTextWidth( cString ) CLASS win_Prn METHOD GetTextHeight( cString ) CLASS win_Prn RETURN win_GetTextSize( ::hPrinterDC, cString, Len( cString ), .F. ) // Return Height in device units -METHOD DrawBitMap( oBmp ) CLASS win_Prn +METHOD DrawBitmap( oBmp ) CLASS win_Prn LOCAL lResult := .F.