2008-06-13 10:56 UTC+0800 Pritpal Bedi (pritpal@vouchcac.com)
* harbour/source/rtl/gtwvt/gtwvt.c
* harbour/source/rtl/gtfunc.c
* harbour/include/hbapigt.h
+ Added Palette implementation by color index.
Hb_GtInfo( HB_GTI_PALETTE, nIndex[, nNewRGB ] ) -> nOldRGB
* harbour/tests/wvtext.prg
* Updated to demonstrate above functionality.
This commit is contained in:
@@ -8,6 +8,16 @@
|
||||
2008-12-31 13:59 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
2008-06-13 10:56 UTC+0800 Pritpal Bedi (pritpal@vouchcac.com)
|
||||
* harbour/source/rtl/gtwvt/gtwvt.c
|
||||
* harbour/source/rtl/gtfunc.c
|
||||
* harbour/include/hbapigt.h
|
||||
+ Added Palette implementation by color index.
|
||||
Hb_GtInfo( HB_GTI_PALETTE, nIndex[, nNewRGB ] ) -> nOldRGB
|
||||
|
||||
* harbour/tests/wvtext.prg
|
||||
* Updated to demonstrate above functionality.
|
||||
|
||||
2008-06-13 09:12 UTC+0800 Pritpal Bedi (pritpal@vouchcac.com
|
||||
* harbour/source/rtl/gtwvt/gtwvt.c
|
||||
* harbour/include/hbgtinfo.ch
|
||||
|
||||
@@ -130,6 +130,7 @@ typedef struct
|
||||
{
|
||||
PHB_ITEM pNewVal;
|
||||
PHB_ITEM pResult;
|
||||
PHB_ITEM pNewVal2;
|
||||
} HB_GT_INFO, * PHB_GT_INFO;
|
||||
|
||||
/* Public interface. These should never change, only be added to. */
|
||||
@@ -201,7 +202,7 @@ extern HB_EXPORT ERRCODE hb_gtScrollEx( int iTop, int iLeft, int iBottom, int iR
|
||||
extern HB_EXPORT ERRCODE hb_gtBoxEx( int iTop, int iLeft, int iBottom, int iRight, BYTE * pbyFrame, BYTE bColor );
|
||||
extern HB_EXPORT int hb_gtGfxPrimitive( int iType, int iTop, int iLeft, int iBottom, int iRight, int iColor );
|
||||
extern HB_EXPORT ERRCODE hb_gtGfxText( int iTop, int iLeft, char * szText, int iColor, int iSize, int iWidth );
|
||||
|
||||
|
||||
extern HB_EXPORT BOOL hb_mouseIsPresent( void );
|
||||
extern HB_EXPORT BOOL hb_mouseGetCursor( void );
|
||||
extern HB_EXPORT void hb_mouseSetCursor( BOOL bVisible );
|
||||
@@ -251,7 +252,7 @@ extern HB_EXPORT void hb_gtWApp( HB_GT_WND ** wnd );
|
||||
extern HB_EXPORT void hb_gtWCurrent( HB_GT_WND * wnd );
|
||||
extern HB_EXPORT void hb_gtWPos( HB_GT_WND * wnd, HB_GT_RECT * rect );
|
||||
extern HB_EXPORT BOOL hb_gtWVis( HB_GT_WND * wnd, USHORT uiStatus );
|
||||
|
||||
|
||||
extern HB_EXPORT ERRCODE hb_gtSLR( HB_GT_SLR * pSLR ); /* System Level Request */
|
||||
extern HB_EXPORT ERRCODE hb_gtModalRead( void * );
|
||||
extern HB_EXPORT ERRCODE hb_gtFlushCursor( void );
|
||||
|
||||
@@ -100,8 +100,9 @@ HB_FUNC( HB_GTINFO )
|
||||
{
|
||||
HB_GT_INFO gtInfo;
|
||||
|
||||
gtInfo.pNewVal = hb_param( 2, HB_IT_ANY );
|
||||
gtInfo.pResult = NULL;
|
||||
gtInfo.pNewVal = hb_param( 2, HB_IT_ANY );
|
||||
gtInfo.pNewVal2 = hb_param( 3, HB_IT_ANY );
|
||||
gtInfo.pResult = NULL;
|
||||
|
||||
hb_gtInfo( hb_parni( 1 ), >Info );
|
||||
if( gtInfo.pResult )
|
||||
@@ -118,7 +119,7 @@ HB_FUNC( HB_GTVERSION )
|
||||
|
||||
HB_FUNC( HB_GTALERT )
|
||||
{
|
||||
hb_retni( hb_gtAlert( hb_param( 1, HB_IT_ANY ),
|
||||
hb_retni( hb_gtAlert( hb_param( 1, HB_IT_ANY ),
|
||||
hb_param( 2, HB_IT_ANY ),
|
||||
ISCHAR( 3 ) ? hb_gtColorToN( hb_parc( 3 ) ) : hb_parni( 3 ) /* iClrNorm */,
|
||||
ISCHAR( 4 ) ? hb_gtColorToN( hb_parc( 4 ) ) : hb_parni( 4 ) /* iClrHigh */,
|
||||
@@ -141,6 +142,6 @@ HB_FUNC( HB_GFXTEXT )
|
||||
hb_parni( 2 ) /* nLeft */,
|
||||
hb_parc( 3 ) /* cText */,
|
||||
hb_parni( 4 ) /* nColor */,
|
||||
hb_parni( 5 ) /* nSize */,
|
||||
hb_parni( 5 ) /* nSize */,
|
||||
hb_parni( 6 ) /* nWidth */ );
|
||||
}
|
||||
|
||||
@@ -2219,22 +2219,35 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
|
||||
}
|
||||
case HB_GTI_PALETTE:
|
||||
{
|
||||
int i;
|
||||
|
||||
if( !pInfo->pResult )
|
||||
if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC )
|
||||
{
|
||||
pInfo->pResult = hb_itemNew( NULL );
|
||||
}
|
||||
hb_arrayNew( pInfo->pResult, 16 );
|
||||
for( i = 0; i < 16; i++ )
|
||||
hb_itemPutNL( hb_arrayGetItemPtr( pInfo->pResult,i ), pWVT->COLORS[ i ] );
|
||||
|
||||
if( hb_itemType( pInfo->pNewVal ) & HB_IT_ARRAY )
|
||||
{
|
||||
if( hb_arrayLen( pInfo->pNewVal ) == 16 )
|
||||
int iIndex = hb_itemGetNI( pInfo->pNewVal );
|
||||
if( iIndex > 0 && iIndex <= 16 )
|
||||
{
|
||||
for( i = 0; i < 16; i++ )
|
||||
pWVT->COLORS[ i ] = hb_arrayGetNL( pInfo->pNewVal, i );
|
||||
pInfo->pResult = hb_itemPutNL( pInfo->pResult, pWVT->COLORS[ iIndex - 1 ] );
|
||||
|
||||
if( hb_itemType( pInfo->pNewVal2 ) & HB_IT_NUMERIC )
|
||||
pWVT->COLORS[ iIndex - 1 ] = hb_itemGetNL( pInfo->pNewVal2 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
if( !pInfo->pResult )
|
||||
{
|
||||
pInfo->pResult = hb_itemNew( NULL );
|
||||
}
|
||||
hb_arrayNew( pInfo->pResult, 16 );
|
||||
for( i = 1; i <= 16; i++ )
|
||||
hb_itemPutNL( hb_arrayGetItemPtr( pInfo->pResult, i ), pWVT->COLORS[ i - 1 ] );
|
||||
|
||||
if( hb_itemType( pInfo->pNewVal ) & HB_IT_ARRAY )
|
||||
{
|
||||
if( hb_arrayLen( pInfo->pNewVal ) == 16 )
|
||||
{
|
||||
for( i = 0; i < 16; i++ )
|
||||
pWVT->COLORS[ i ] = hb_arrayGetNL( pInfo->pNewVal, i + 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -65,10 +65,13 @@ FUNCTION Main()
|
||||
hb_GtInfo( HB_GTI_CLOSABLE, !lClose )
|
||||
|
||||
CASE nKey == K_F5
|
||||
SetPallete( 1 )
|
||||
SetPalette( 1 )
|
||||
|
||||
CASE nKey == K_F6
|
||||
SetPallete( 0 )
|
||||
SetPalette( 0 )
|
||||
|
||||
CASE nKey == K_F7
|
||||
SetPaletteIndex()
|
||||
|
||||
ENDCASE
|
||||
ENDDO
|
||||
@@ -118,6 +121,7 @@ STATIC FUNCTION DispScreen()
|
||||
DispOutAt( ++nRow, nCol, '< F4 Closable Toggle >', cColor )
|
||||
DispOutAt( ++nRow, nCol, '< F5 Palette L Repeat >', cColor )
|
||||
DispOutAt( ++nRow, nCol, '< F6 Palette D Repeat >', cColor )
|
||||
DispOutAt( ++nRow, nCol, '< F7 Palette By Index R >', cColor )
|
||||
DispOutAt( ++nRow, nCol, '< Click Other Window >', cColor )
|
||||
DispOutAt( ++nRow, nCol, '< Click X Button >', cColor )
|
||||
|
||||
@@ -145,7 +149,7 @@ PROCEDURE HB_GT_WVT_DEFAULT()
|
||||
|
||||
//----------------------------------------------------------------------//
|
||||
|
||||
Function SetPallete( nMode )
|
||||
FUNCTION SetPalette( nMode )
|
||||
Local aPalette := Hb_GtInfo( HB_GTI_PALETTE )
|
||||
|
||||
static nR := 198
|
||||
@@ -158,10 +162,19 @@ Function SetPallete( nMode )
|
||||
|
||||
// Change 'W' to slightly gray everytime you press F5
|
||||
//
|
||||
aPalette[ 7 ] := RGB( nR, nG, nB )
|
||||
aPalette[ 8 ] := RGB( nR, nG, nB )
|
||||
|
||||
Hb_GtInfo( HB_GTI_PALETTE, aPalette )
|
||||
DispScreen()
|
||||
|
||||
RETURN NIL
|
||||
//----------------------------------------------------------------------//
|
||||
|
||||
FUNCTION SetPaletteIndex()
|
||||
|
||||
Hb_GtInfo( HB_GTI_PALETTE, 8, RGB( 120, 200, 240 ) )
|
||||
DispScreen()
|
||||
|
||||
RETURN NIL
|
||||
|
||||
//----------------------------------------------------------------------//
|
||||
|
||||
Reference in New Issue
Block a user