2008-04-18 01:41 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbapigt.h
* harbour/source/rtl/gtapi.c
! changed USHORT hb_gtColorToN( char * szColorString ) to
int hb_gtColorToN( char * szColorString ) - it should be the same
type as indexes in hb_gtColorsToString() functions
* harbour/source/rtl/hbgtcore.c
* return -1 from COLORNUM() method when passed color is not
valid color string
* harbour/contrib/hbct/screen2.c
* harbour/contrib/hbct/color.c
* harbour/contrib/hbct/screen1.c
* harbour/contrib/hbct/ctwfunc.c
* harbour/contrib/hbnf/color2n.c
* harbour/contrib/gtwvg/wvtcore.c
* updated to respect -1 returned for wrong color strings
* harbour/source/rtl/tget.prg
* updated to respect -1 returned for wrong color strings
Viktor please check me, now it's simpler and hbtest does not
reports any errors so I guess that this version will work like
in Clipper also for :colorSpec := "R,X,Y,0" or similar
* harbour/source/rtl/tobject.prg
* harbour/source/debug/dbgbrwsr.prg
* formatting
This commit is contained in:
@@ -8,6 +8,35 @@
|
||||
2008-12-31 13:59 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
2008-04-18 01:41 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/include/hbapigt.h
|
||||
* harbour/source/rtl/gtapi.c
|
||||
! changed USHORT hb_gtColorToN( char * szColorString ) to
|
||||
int hb_gtColorToN( char * szColorString ) - it should be the same
|
||||
type as indexes in hb_gtColorsToString() functions
|
||||
|
||||
* harbour/source/rtl/hbgtcore.c
|
||||
* return -1 from COLORNUM() method when passed color is not
|
||||
valid color string
|
||||
|
||||
* harbour/contrib/hbct/screen2.c
|
||||
* harbour/contrib/hbct/color.c
|
||||
* harbour/contrib/hbct/screen1.c
|
||||
* harbour/contrib/hbct/ctwfunc.c
|
||||
* harbour/contrib/hbnf/color2n.c
|
||||
* harbour/contrib/gtwvg/wvtcore.c
|
||||
* updated to respect -1 returned for wrong color strings
|
||||
|
||||
* harbour/source/rtl/tget.prg
|
||||
* updated to respect -1 returned for wrong color strings
|
||||
Viktor please check me, now it's simpler and hbtest does not
|
||||
reports any errors so I guess that this version will work like
|
||||
in Clipper also for :colorSpec := "R,X,Y,0" or similar
|
||||
|
||||
* harbour/source/rtl/tobject.prg
|
||||
* harbour/source/debug/dbgbrwsr.prg
|
||||
* formatting
|
||||
|
||||
2008-04-18 01:04 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
|
||||
* tests/rto_tb.prg
|
||||
+ Added some assigment tests using numerics with decimals.
|
||||
|
||||
@@ -907,6 +907,8 @@ static COLORREF hb_wvt_BgColorParam( int iParam )
|
||||
{
|
||||
int iColor = ISCHAR( iParam ) ? hb_gtColorToN( hb_parc( iParam ) ) :
|
||||
hb_gtGetCurrColor();
|
||||
if( iColor == -1 )
|
||||
iColor = 0
|
||||
color = hb_wvt_gtGetColorData( ( iColor >> 4 ) & 0x0f );
|
||||
}
|
||||
|
||||
@@ -923,6 +925,8 @@ static COLORREF hb_wvt_FgColorParam( int iParam )
|
||||
{
|
||||
int iColor = ISCHAR( iParam ) ? hb_gtColorToN( hb_parc( iParam ) ) :
|
||||
hb_gtGetCurrColor();
|
||||
if( iColor == -1 )
|
||||
iColor = 0
|
||||
color = hb_wvt_gtGetColorData( iColor & 0x0f );
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,15 @@ HB_FUNC( INVERTATTR )
|
||||
{
|
||||
int iAttr;
|
||||
|
||||
iAttr = ISCHAR( 1 ) ? hb_gtColorToN( hb_parc( 1 ) ) : hb_parni( 1 );
|
||||
if( ISCHAR( 1 ) )
|
||||
{
|
||||
iAttr = hb_gtColorToN( hb_parc( 1 ) );
|
||||
if( iAttr == -1 )
|
||||
iAttr = 0;
|
||||
}
|
||||
else
|
||||
iAttr = hb_parni( 1 );
|
||||
|
||||
hb_retni( ( iAttr & 0x88 ) |
|
||||
( ( iAttr & 0x07 ) << 4 ) |
|
||||
( ( iAttr >> 4 ) & 0x07 ) );
|
||||
@@ -134,7 +142,10 @@ HB_FUNC( INVERTATTR )
|
||||
HB_FUNC( COLORTON )
|
||||
{
|
||||
if( ISCHAR( 1 ) )
|
||||
hb_retni( hb_gtColorToN( hb_parc( 1 ) ) );
|
||||
{
|
||||
int iColor = hb_gtColorToN( hb_parc( 1 ) );
|
||||
hb_retni( iColor == -1 ? 0 : iColor );
|
||||
}
|
||||
else
|
||||
hb_retni( hb_parni( 1 ) );
|
||||
}
|
||||
|
||||
@@ -61,7 +61,11 @@ static int hb_ctColorParam( int iParam, int iDefault )
|
||||
if( ISNUM( iParam ) )
|
||||
iColor = hb_parni( iParam );
|
||||
else if( hb_parclen( iParam ) > 0 )
|
||||
{
|
||||
iColor = hb_gtColorToN( hb_parc( iParam ) );
|
||||
if( iColor == -1 )
|
||||
iColor = iDefault;
|
||||
}
|
||||
else
|
||||
iColor = iDefault;
|
||||
|
||||
|
||||
@@ -318,7 +318,11 @@ static int hb_ctGetClearColor( int iParam )
|
||||
if( ISNUM( iParam ) )
|
||||
iColor = hb_parni( iParam );
|
||||
else if( ISCHAR( iParam ) )
|
||||
{
|
||||
iColor = hb_gtColorToN( hb_parc( iParam ) );
|
||||
if( iColor == -1 )
|
||||
iColor = 0;
|
||||
}
|
||||
else
|
||||
iColor = hb_gtGetClearColor();
|
||||
|
||||
|
||||
@@ -411,7 +411,11 @@ HB_FUNC( _HB_CTDSPTIME )
|
||||
if( ISNUM( 4 ) )
|
||||
iColor = hb_parni( 4 );
|
||||
else if( ISCHAR( 4 ) )
|
||||
{
|
||||
iColor = hb_gtColorToN( hb_parc( 4 ) );
|
||||
if( iColor == -1 )
|
||||
iColor = 0;
|
||||
}
|
||||
else
|
||||
iColor = hb_gtGetClearColor();
|
||||
|
||||
|
||||
@@ -59,7 +59,11 @@ HB_FUNC( FT_COLOR2N )
|
||||
int iRet = 0;
|
||||
|
||||
if( ISCHAR( 1 ) )
|
||||
{
|
||||
iRet = hb_gtColorToN( hb_parc( 1 ) );
|
||||
if( iRet == -1 )
|
||||
iRet = 0;
|
||||
}
|
||||
|
||||
hb_retni( iRet );
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ extern HB_EXPORT ERRCODE hb_gtBox( SHORT uiTop, SHORT uiLeft, SHORT uiBottom, SH
|
||||
extern HB_EXPORT ERRCODE hb_gtBoxD( SHORT uiTop, SHORT uiLeft, SHORT uiBottom, SHORT uiRight );
|
||||
extern HB_EXPORT ERRCODE hb_gtBoxS( SHORT uiTop, SHORT uiLeft, SHORT uiBottom, SHORT uiRight );
|
||||
extern HB_EXPORT ERRCODE hb_gtColorSelect( USHORT uiColorIndex );
|
||||
extern HB_EXPORT USHORT hb_gtColorToN( char * szColorString );
|
||||
extern HB_EXPORT int hb_gtColorToN( char * szColorString );
|
||||
extern HB_EXPORT ERRCODE hb_gtColorsToString( int * pColors, int iColorCount, char * pszColorString, int iBufSize );
|
||||
extern HB_EXPORT ERRCODE hb_gtDispBegin( void );
|
||||
extern HB_EXPORT USHORT hb_gtDispCount( void );
|
||||
|
||||
@@ -172,7 +172,7 @@ METHOD ForceStable()
|
||||
@ ::nTop + nRow - 1, nColX SAY PadR( xData, nWid ) + IIf( nCol < Len( ::aColumns ), " ", "" )
|
||||
nColX += nWid + 1
|
||||
ENDIF
|
||||
NEXT
|
||||
NEXT
|
||||
ENDIF
|
||||
::aRowState[ nRow ] := .T.
|
||||
ENDIF
|
||||
|
||||
@@ -308,7 +308,7 @@ HB_EXPORT ERRCODE hb_gtGetColorStr( char * pszColorString )
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
HB_EXPORT USHORT hb_gtColorToN( char * szColorString )
|
||||
HB_EXPORT int hb_gtColorToN( char * szColorString )
|
||||
{
|
||||
PHB_GT pGT;
|
||||
|
||||
|
||||
@@ -308,7 +308,7 @@ static void hb_gt_def_SetClearChar( PHB_GT pGT, int iChar )
|
||||
static const char * hb_gt_def_ColorDecode( const char * szColorString, int * piColor )
|
||||
{
|
||||
char c;
|
||||
int nColor = 0;
|
||||
int nColor = 0, iCount = 0;
|
||||
BOOL bFore = TRUE;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_def_ColorDecode(%s,%p)", szColorString, piColor));
|
||||
@@ -378,7 +378,7 @@ static const char * hb_gt_def_ColorDecode( const char * szColorString, int * piC
|
||||
break;
|
||||
|
||||
case ',':
|
||||
* piColor = nColor;
|
||||
* piColor = iCount == 0 ? -1 : nColor;
|
||||
return szColorString;
|
||||
|
||||
default:
|
||||
@@ -393,10 +393,13 @@ static const char * hb_gt_def_ColorDecode( const char * szColorString, int * piC
|
||||
else
|
||||
nColor = ( nColor & 0x0F8F ) | ( iColor << 4 );
|
||||
}
|
||||
else
|
||||
--iCount;
|
||||
}
|
||||
++iCount;
|
||||
}
|
||||
|
||||
* piColor = nColor;
|
||||
* piColor = iCount == 0 ? -1 : nColor;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -445,9 +448,11 @@ static void hb_gt_def_StringToColors( PHB_GT pGT, const char * szColorString, in
|
||||
{
|
||||
++*piColorCount;
|
||||
pColors = *pColorsPtr = ( int * ) hb_xrealloc( pColors, *piColorCount * sizeof( int ) );
|
||||
pColors[ nPos ] = 0;
|
||||
}
|
||||
pColors[ nPos++ ] = nColor;
|
||||
|
||||
if( nColor != -1 )
|
||||
pColors[ nPos ] = nColor;
|
||||
++nPos;
|
||||
}
|
||||
while( szColorString );
|
||||
|
||||
|
||||
@@ -1172,13 +1172,13 @@ METHOD colorSpec( cColorSpec ) CLASS Get
|
||||
IF ISCHARACTER( cColorSpec )
|
||||
|
||||
#ifdef HB_COMPAT_C53
|
||||
::cColorSpec := hb_NToColor( nClrUns := hb_ColorToN( hb_ColorIndex( cColorSpec, GET_CLR_UNSELECTED ) ) ) +;
|
||||
"," + hb_NToColor( iif( ( nClrOth := hb_ColorToN( cClrOth := hb_ColorIndex( cColorSpec, GET_CLR_ENHANCED ) ) ) != 0 .OR. Upper( StrTran( cClrOth, " ", "" ) ) == "N/N", nClrOth, nClrUns ) ) +;
|
||||
"," + hb_NToColor( iif( ( nClrOth := hb_ColorToN( cClrOth := hb_ColorIndex( cColorSpec, GET_CLR_CAPTION ) ) ) != 0 .OR. Upper( StrTran( cClrOth, " ", "" ) ) == "N/N", nClrOth, nClrUns ) ) +;
|
||||
"," + hb_NToColor( iif( ( nClrOth := hb_ColorToN( cClrOth := hb_ColorIndex( cColorSpec, GET_CLR_ACCEL ) ) ) != 0 .OR. Upper( StrTran( cClrOth, " ", "" ) ) == "N/N", nClrOth, nClrUns ) )
|
||||
::cColorSpec := hb_NToColor( nClrUns := Max( hb_ColorToN( hb_ColorIndex( cColorSpec, GET_CLR_UNSELECTED ) ), 0 ) ) +;
|
||||
"," + hb_NToColor( iif( ( nClrOth := hb_ColorToN( cClrOth := hb_ColorIndex( cColorSpec, GET_CLR_ENHANCED ) ) ) != -1, nClrOth, nClrUns ) ) +;
|
||||
"," + hb_NToColor( iif( ( nClrOth := hb_ColorToN( cClrOth := hb_ColorIndex( cColorSpec, GET_CLR_CAPTION ) ) ) != -1, nClrOth, nClrUns ) ) +;
|
||||
"," + hb_NToColor( iif( ( nClrOth := hb_ColorToN( cClrOth := hb_ColorIndex( cColorSpec, GET_CLR_ACCEL ) ) ) != -1, nClrOth, nClrUns ) )
|
||||
#else
|
||||
::cColorSpec := hb_NToColor( nClrUns := hb_ColorToN( hb_ColorIndex( cColorSpec, GET_CLR_UNSELECTED ) ) ) +;
|
||||
"," + hb_NToColor( iif( ( nClrOth := hb_ColorToN( cClrOth := hb_ColorIndex( cColorSpec, GET_CLR_ENHANCED ) ) ) != 0 .OR. Upper( StrTran( cClrOth, " ", "" ) ) == "N/N", nClrOth, nClrUns ) )
|
||||
::cColorSpec := hb_NToColor( nClrUns := Max( hb_ColorToN( hb_ColorIndex( cColorSpec, GET_CLR_UNSELECTED ) ), 0 ) ) +;
|
||||
"," + hb_NToColor( iif( ( nClrOth := hb_ColorToN( cClrOth := hb_ColorIndex( cColorSpec, GET_CLR_ENHANCED ) ) ) != -1, nClrOth, nClrUns ) )
|
||||
#endif
|
||||
|
||||
RETURN cColorSpec
|
||||
|
||||
@@ -100,7 +100,7 @@ FUNCTION HBObject()
|
||||
|
||||
s_oClass:SetOnError( @HBObject_DftonError() )
|
||||
|
||||
s_oClass:AddInline( "MSGNOTFOUND" , {| Self, cMsg | ::Error( "Message not found", __OBJGETCLSNAME( Self ), cMsg, iif(substr(cMsg,1,1)=="_",1005,1004) ) }, HB_OO_CLSTP_EXPORTED )
|
||||
s_oClass:AddInline( "MSGNOTFOUND" , {| Self, cMsg | ::Error( "Message not found", __OBJGETCLSNAME( Self ), cMsg, IIF( cMsg="_", 1005, 1004 ) ) }, HB_OO_CLSTP_EXPORTED )
|
||||
|
||||
/*s_oClass:AddMultiData(,,HB_OO_CLSTP_EXPORTED,{"CLASS"}, .F. )*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user