diff --git a/harbour/ChangeLog b/harbour/ChangeLog index fe6d16b9d0..ff1694dfea 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,20 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-01-15 21:23 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/contrib/hbwin/win_prn1.c + * changed 7-th parameter of WIN_TEXTOUT() function to operate on + TA_* constant value instead of custom 0, 1, 2 + * modified WIN_SETBKMODE() to return current BkMode setting when called + without 2-nd parameter + + * harbour/contrib/hbwin/win_tprn.prg + + added BkMode member to WIN_PRN class + * modified TextOut(), TextOutAt() and TextAtFont() methods to use + nAlign as windows TA_* value instead of custom 0, 1, 2 and set + default alignment to ( TA_BOTTOM + TA_LEFT ) + * formatting + 2010-01-15 20:48 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/hbnetio/netiosrv.c ! fixed c&p typo - it should fix problem reported by Viktor in netiostv diff --git a/harbour/contrib/hbwin/win_prn1.c b/harbour/contrib/hbwin/win_prn1.c index de34c73785..e92548ce5f 100644 --- a/harbour/contrib/hbwin/win_prn1.c +++ b/harbour/contrib/hbwin/win_prn1.c @@ -277,14 +277,9 @@ HB_FUNC( WIN_TEXTOUT ) int iRow = hb_parni( 2 ); int iCol = hb_parni( 3 ); int iWidth = hb_parni( 6 ); /* defaults to 0 */ - int iAlign = hb_parni( 7 ); /* defaults to 0 */ - if( iAlign == 1 ) - SetTextAlign( ( HDC ) hDC, TA_NOUPDATECP | TA_BOTTOM | TA_RIGHT ); - else if( iAlign == 2 ) - SetTextAlign( ( HDC ) hDC, TA_NOUPDATECP | TA_BOTTOM | TA_CENTER ); - else - SetTextAlign( ( HDC ) hDC, TA_NOUPDATECP | TA_BOTTOM | TA_LEFT ); + if( HB_ISNUM( 7 ) ) + SetTextAlign( ( HDC ) hDC, TA_NOUPDATECP | hb_parni( 7 ) ); if( iWidth < 0 && nLen < 1024 ) { @@ -773,8 +768,16 @@ HB_FUNC( WIN_ELLIPSE ) HB_FUNC( WIN_SETBKMODE ) { HDC hDC = win_HDC_par( 1 ); + int iMode = 0; - hb_retni( hDC ? SetBkMode( win_HDC_par( 1 ), hb_parni( 2 ) ) : 0 ); + if( hDC ) + { + if( HB_ISNUM( 2 ) ) + iMode = SetBkMode( win_HDC_par( 1 ), hb_parni( 2 ) ); + else + iMode = GetBkMode( win_HDC_par( 1 ) ); + } + hb_retni( iMode ); } #endif diff --git a/harbour/contrib/hbwin/win_tprn.prg b/harbour/contrib/hbwin/win_tprn.prg index 7629be5b27..15bb857699 100644 --- a/harbour/contrib/hbwin/win_tprn.prg +++ b/harbour/contrib/hbwin/win_tprn.prg @@ -106,7 +106,7 @@ CREATE CLASS WIN_PRN METHOD SetPos( nPosX, nPosY ) // **WARNING** : ( Col, Row ) _NOT_ ( Row, Col ) METHOD SetColor( nClrText, nClrPane, nAlign ) - METHOD TextOut( cString, lNewLine, lUpdatePosX, nAlign ) // nAlign : 0 == left, 1 == right, 2 == centered + METHOD TextOut( cString, lNewLine, lUpdatePosX, nAlign ) // nAlign : TA_LEFT, TA_RGIHT, TA_CENTER, TA_TOP, TA_BOTTOM, TA_BASELINE METHOD TextOutAt( nPosX, nPosY, cString, lNewLine, lUpdatePosX, nAlign ) // **WARNING** : ( Col, Row ) _NOT_ ( Row, Col ) @@ -196,6 +196,8 @@ CREATE CLASS WIN_PRN VAR BkColor VAR TextAlign + VAR BkMode + VAR hPen INIT 0 VAR PenStyle VAR PenWidth @@ -490,6 +492,12 @@ METHOD SetColor( nClrText, nClrPane, nAlign ) CLASS WIN_PRN RETURN win_SetColor( ::hPrinterDC, nClrText, nClrPane, nAlign ) +METHOD SetBkMode( nMode ) CLASS WIN_PRN + IF HB_ISNUMERIC( nMode ) + ::BkMode := nMode + ENDIF + RETURN win_SetBkMode( ::hPrinterDc, nMode ) + METHOD TextOut( cString, lNewLine, lUpdatePosX, nAlign ) CLASS WIN_PRN LOCAL lResult := .F. LOCAL nPosX @@ -498,7 +506,7 @@ METHOD TextOut( cString, lNewLine, lUpdatePosX, nAlign ) CLASS WIN_PRN DEFAULT lNewLine TO .F. DEFAULT lUpdatePosX TO .T. - DEFAULT nAlign TO 0 + DEFAULT nAlign TO HB_BITOR( TA_BOTTOM, TA_LEFT ) nPosX := win_TextOut( ::hPrinterDC, ::PosX, ::PosY, cString, Len( cString ), ::fCharWidth, nAlign ) @@ -522,7 +530,7 @@ METHOD SetPen( nStyle, nWidth, nColor ) CLASS WIN_PRN ::PenStyle := nStyle ::PenWidth := nWidth ::PenColor := nColor - RETURN ! Empty( ::hPen := win_SetPen(::hPrinterDC, nStyle, nWidth, nColor ) ) + RETURN ! Empty( ::hPen := win_SetPen( ::hPrinterDC, nStyle, nWidth, nColor ) ) METHOD Line( nX1, nY1, nX2, nY2 ) CLASS WIN_PRN LOCAL lResult := win_LineTo( ::hPrinterDC, nX1, nY1, nX2, nY2 ) @@ -603,7 +611,7 @@ METHOD PCol() CLASS WIN_PRN RETURN Int( ( ::PosX - ::LeftMargin ) / ::CharWidth ) // Uses width of current character METHOD MaxRow() CLASS WIN_PRN - RETURN Int( ( ( ::BottomMargin - ::TopMargin ) + 1) / ::LineHeight ) - 1 + RETURN Int( ( ( ::BottomMargin - ::TopMargin ) + 1 ) / ::LineHeight ) - 1 METHOD MaxCol() CLASS WIN_PRN RETURN Int( ( ( ::RightMargin - ::LeftMargin ) + 1 ) / ::CharWidth ) - 1 @@ -641,7 +649,7 @@ METHOD TextAtFont( nPosX, nPosY, cString, cFont, nPointSize, nWidth, nBold, lUnd IF nColor != NIL nColor := win_SetColor( ::hPrinterDC, nColor ) ENDIF - lResult := ::TextOutAt( nPosX, nPosY, cString, lNewLine, lUpdatePosX, nAlign) + lResult := ::TextOutAt( nPosX, nPosY, cString, lNewLine, lUpdatePosX, nAlign ) IF lCreated ::SetFont() // Reset font ENDIF @@ -650,11 +658,8 @@ METHOD TextAtFont( nPosX, nPosY, cString, cFont, nPointSize, nWidth, nBold, lUnd ENDIF RETURN lResult -METHOD SetBkMode( nMode ) CLASS WIN_PRN - RETURN win_SetBkMode( ::hPrinterDc, nMode ) - METHOD GetDeviceCaps( nCaps ) CLASS WIN_PRN - RETURN win_GetDeviceCaps( ::hPrinterDC, nCaps) + RETURN win_GetDeviceCaps( ::hPrinterDC, nCaps ) // Bitmap class