2008-06-13 09:12 UTC+0800 Pritpal Bedi (pritpal@vouchcac.com
* harbour/source/rtl/gtwvt/gtwvt.c
* harbour/include/hbgtinfo.ch
+ Added functionality to change Palette.
Hb_GtInfo( HB_GTI_PALETTE, aNewPalette ) -> aOldPalette
<aNewPalette> must be of 16 elements containg RGB colors.
* harbour/tests/wvtext.prg
* Updated to demonstrate palette info.
; TODO : Hb_GtInfo( HB_GTI_PALETTEBYINDEX, nIndex[, nNewRGB ] ) -> nOldRGB
Needs deeper modifications in GT core. Needs additional parameter
in core setup. Will commit today.
This commit is contained in:
@@ -8,6 +8,19 @@
|
||||
2008-12-31 13:59 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
2008-06-13 09:12 UTC+0800 Pritpal Bedi (pritpal@vouchcac.com
|
||||
* harbour/source/rtl/gtwvt/gtwvt.c
|
||||
* harbour/include/hbgtinfo.ch
|
||||
+ Added functionality to change Palette.
|
||||
Hb_GtInfo( HB_GTI_PALETTE, aNewPalette ) -> aOldPalette
|
||||
<aNewPalette> must be of 16 elements containg RGB colors.
|
||||
|
||||
* harbour/tests/wvtext.prg
|
||||
* Updated to demonstrate palette info.
|
||||
; TODO : Hb_GtInfo( HB_GTI_PALETTEBYINDEX, nIndex[, nNewRGB ] ) -> nOldRGB
|
||||
Needs deeper modifications in GT core. Needs additional parameter
|
||||
in core setup. Will commit today.
|
||||
|
||||
2008-06-12 17:57 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
|
||||
* contrib/hbmisc/strfmt.c
|
||||
+ contrib/hbmisc/tests/tsstrfmt.prg
|
||||
|
||||
@@ -125,6 +125,7 @@
|
||||
/* Additional constants to enhance GT */
|
||||
#define HB_GTI_NOTIFIERBLOCK 51 /* This optional codeblock gets called whenever certain events occur. See HB_GTE_* */
|
||||
#define HB_GTI_SCREENSIZE 52 /* Get/Set height/width of application window in pixels */
|
||||
#define HB_GTI_PALETTE 53 /* Get/Set console colors 1 - 16 given an array of 16 elements containing RGB colors */
|
||||
|
||||
/* Font weights */
|
||||
#define HB_GTI_FONTW_THIN 1
|
||||
|
||||
@@ -1703,6 +1703,19 @@ static BOOL hb_gt_wvt_SetMode( PHB_GT pGT, int iRow, int iCol )
|
||||
|
||||
/* ********************************************************************** */
|
||||
|
||||
static BOOL hb_gt_wvt_PutChar( PHB_GT pGT, int iRow, int iCol,
|
||||
BYTE bColor, BYTE bAttr, USHORT usChar )
|
||||
{
|
||||
if( HB_GTSUPER_PUTCHAR( pGT, iRow, iCol, bColor, bAttr, usChar ) )
|
||||
{
|
||||
HB_GTSELF_TOUCHCELL( pGT, iRow, iCol );
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* ********************************************************************** */
|
||||
|
||||
static char * hb_gt_wvt_Version( PHB_GT pGT, int iType )
|
||||
{
|
||||
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Version(%p,%d)", pGT, iType ) );
|
||||
@@ -2204,6 +2217,28 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HB_GTI_PALETTE:
|
||||
{
|
||||
int i;
|
||||
|
||||
if( !pInfo->pResult )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
for( i = 0; i < 16; i++ )
|
||||
pWVT->COLORS[ i ] = hb_arrayGetNL( pInfo->pNewVal, i );
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return HB_GTSUPER_INFO( pGT, iType, pInfo );
|
||||
}
|
||||
@@ -2491,7 +2526,7 @@ static BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable )
|
||||
pFuncTable->Info = hb_gt_wvt_Info;
|
||||
pFuncTable->SetDispCP = hb_gt_wvt_SetDispCP;
|
||||
pFuncTable->SetKeyCP = hb_gt_wvt_SetKeyCP;
|
||||
|
||||
pFuncTable->PutChar = hb_gt_wvt_PutChar;
|
||||
pFuncTable->ReadKey = hb_gt_wvt_ReadKey;
|
||||
|
||||
pFuncTable->MouseIsPresent = hb_gt_wvt_mouse_IsPresent;
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#include 'hbgtinfo.ch'
|
||||
#include 'inkey.ch'
|
||||
|
||||
#define RGB(r,g,b) ( r + ( g * 256 ) + ( b * 256 * 256 ) )
|
||||
|
||||
//----------------------------------------------------------------------//
|
||||
|
||||
FUNCTION Main()
|
||||
@@ -62,6 +64,12 @@ FUNCTION Main()
|
||||
lClose := Hb_GtInfo( HB_GTI_CLOSABLE )
|
||||
hb_GtInfo( HB_GTI_CLOSABLE, !lClose )
|
||||
|
||||
CASE nKey == K_F5
|
||||
SetPallete( 1 )
|
||||
|
||||
CASE nKey == K_F6
|
||||
SetPallete( 0 )
|
||||
|
||||
ENDCASE
|
||||
ENDDO
|
||||
|
||||
@@ -89,33 +97,38 @@ STATIC FUNCTION MyNotifier( nEvent, ... )
|
||||
//----------------------------------------------------------------------//
|
||||
|
||||
STATIC FUNCTION DispScreen()
|
||||
Local nRow := 18, nCol := 28
|
||||
Local cColor := 'N/W*'
|
||||
Local nRow := 15, nCol := 28
|
||||
Local cColor := 'N/W'
|
||||
Local nMaxCol := MaxCol()+1
|
||||
|
||||
DispBegin()
|
||||
|
||||
CLS
|
||||
DispOutAt( 0, 0,padc( 'Harbour GT - New Features', maxcol()+1 ), 'N/GR*' )
|
||||
|
||||
// Contributed by Massimo Belgrano
|
||||
DispOutAt( 2, 0, padc( "______ __ ______________________ ",nMaxCol ), 'W+/W' )
|
||||
DispOutAt( 3, 0, padc( "___ / / /_____ __________ /___________ _________ __ ____/____/",nMaxCol ), 'W+/W' )
|
||||
DispOutAt( 3, 0, padc( "___ / / /_____ ___________ /___________ _________ __ ____/____/",nMaxCol ), 'W+/W' )
|
||||
DispOutAt( 4, 0, padc( "__ /_/ /_ __ `/_ ___/_ __ \ __ \ / / /_ ___/ _ / __ __/ ",nMaxCol ), 'W+/W' )
|
||||
DispOutAt( 5, 0, padc( "_ __ / / /_/ /_ / _ /_/ / /_/ / /_/ /_ / / /_/ / _ / ",nMaxCol ), 'W+/W' )
|
||||
DispOutAt( 6, 0, padc( "/_/ /_/ \__,_/ /_/ /_.___/\____/\__,_/ /_/ \____/ /_/ ",nMaxCol ), 'W+/W' )
|
||||
|
||||
DispOutAt( nRow+0, nCol, '< F2 MarkCopy Toggle >', cColor )
|
||||
DispOutAt( nRow+1, nCol, '< F3 Resize Toggle >', cColor )
|
||||
DispOutAt( nRow+2, nCol, '< F4 Closable Toggle >', cColor )
|
||||
DispOutAt( nRow+3, nCol, '< Click Other Window >', cColor )
|
||||
DispOutAt( nRow+4, nCol, '< Click X Button >', cColor )
|
||||
DispOutAt( ++nRow, nCol, '< F2 MarkCopy Toggle >', cColor )
|
||||
DispOutAt( ++nRow, nCol, '< F3 Resize Toggle >', cColor )
|
||||
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, '< Click Other Window >', cColor )
|
||||
DispOutAt( ++nRow, nCol, '< Click X Button >', cColor )
|
||||
|
||||
DispOutAt( maxrow(), 0, Space( maxcol()+1 ), "N/G*" )
|
||||
|
||||
DispOutAt( 0, 0 , "TL", "N/GR*" )
|
||||
DispOutAt( 0, MaxCol() - 1 , "TR", "N/GR*" )
|
||||
DispOutAt( MaxRow(), 0 , "BL", "N/G*" )
|
||||
DispOutAt( MaxRow(), MaxCol() - 1, "BR", "N/G*" )
|
||||
DispOutAt( MaxRow(), 0 , "BL", "N/G*" )
|
||||
DispOutAt( MaxRow(), MaxCol() - 1, "BR", "N/G*" )
|
||||
|
||||
DispEnd()
|
||||
RETURN NIL
|
||||
|
||||
//----------------------------------------------------------------------//
|
||||
@@ -131,8 +144,24 @@ PROCEDURE HB_GT_WVT_DEFAULT()
|
||||
RETURN
|
||||
|
||||
//----------------------------------------------------------------------//
|
||||
?"______ __ ______________________ "
|
||||
?"___ / / /_____ __________ /___________ _________ __ ____/____/"
|
||||
?"__ /_/ /_ __ `/_ ___/_ __ \ __ \ / / /_ ___/ _ / __ __/ "
|
||||
?"_ __ / / /_/ /_ / _ /_/ / /_/ / /_/ /_ / / /_/ / _ / "
|
||||
?"/_/ /_/ \__,_/ /_/ /_.___/\____/\__,_/ /_/ \____/ /_/ "
|
||||
|
||||
Function SetPallete( nMode )
|
||||
Local aPalette := Hb_GtInfo( HB_GTI_PALETTE )
|
||||
|
||||
static nR := 198
|
||||
static nG := 198
|
||||
static nB := 198
|
||||
|
||||
nR += if( nMode == 0, -5, 5 )
|
||||
nG += if( nMode == 0, -5, 5 )
|
||||
nB += if( nMode == 0, -5, 5 )
|
||||
|
||||
// Change 'W' to slightly gray everytime you press F5
|
||||
//
|
||||
aPalette[ 7 ] := RGB( nR, nG, nB )
|
||||
|
||||
Hb_GtInfo( HB_GTI_PALETTE, aPalette )
|
||||
DispScreen()
|
||||
|
||||
RETURN NIL
|
||||
//----------------------------------------------------------------------//
|
||||
|
||||
Reference in New Issue
Block a user