diff --git a/harbour/ChangeLog b/harbour/ChangeLog index fecfdc1ae2..98aa14486e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,14 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-12-07 11:39 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/rtl/gtwvt/gtwvt.h + * harbour/source/rtl/gtwvt/gtwvt.c + * harbour/contrib/hbgtwvg/gtwvt.h + * harbour/contrib/hbgtwvg/gtwvt.c + * moved RGB definition of used colors to terminal window structure, + now each window can use different palette + 2007-12-07 10:43 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbgtcore.h * harbour/source/rtl/hbgtcore.c diff --git a/harbour/contrib/hbgtwvg/gtwvt.c b/harbour/contrib/hbgtwvg/gtwvt.c index b52c1d10d7..19d1c399a5 100644 --- a/harbour/contrib/hbgtwvg/gtwvt.c +++ b/harbour/contrib/hbgtwvg/gtwvt.c @@ -99,25 +99,6 @@ static int s_iCmdShow; static GLOBAL_DATA _s; -static COLORREF _COLORS[] = { - BLACK, - BLUE, - GREEN, - CYAN, - RED, - MAGENTA, - BROWN, - WHITE, - LIGHT_GRAY, - BRIGHT_BLUE, - BRIGHT_GREEN, - BRIGHT_CYAN, - BRIGHT_RED, - BRIGHT_MAGENTA, - YELLOW, - BRIGHT_WHITE -}; - static const int K_Ctrl[] = { K_CTRL_A, K_CTRL_B, K_CTRL_C, K_CTRL_D, K_CTRL_E, K_CTRL_F, K_CTRL_G, @@ -166,8 +147,8 @@ static void hb_wvt_gtCreateObjects( void ) _s.penBlack = CreatePen( PS_SOLID, 0, ( COLORREF ) RGB( 0, 0, 0 ) ); _s.penWhiteDim = CreatePen( PS_SOLID, 0, ( COLORREF ) RGB( 205,205,205 ) ); _s.penDarkGray = CreatePen( PS_SOLID, 0, ( COLORREF ) RGB( 150,150,150 ) ); - _s.penGray = CreatePen( PS_SOLID, 0, ( COLORREF ) _COLORS[ 7 ] ); - _s.penNull = CreatePen( PS_NULL , 0, ( COLORREF ) _COLORS[ 7 ] ); + _s.penGray = CreatePen( PS_SOLID, 0, ( COLORREF ) _s.COLORS[ 7 ] ); + _s.penNull = CreatePen( PS_NULL , 0, ( COLORREF ) _s.COLORS[ 7 ] ); _s.currentPen = CreatePen( PS_SOLID, 0, ( COLORREF ) RGB( 0, 0, 0 ) ); @@ -187,9 +168,9 @@ static void hb_wvt_gtCreateObjects( void ) _s.solidBrush = CreateSolidBrush( RGB( 0,0,0 ) ); //CreateBrushIndirect( &lb ); lb.lbStyle = BS_SOLID; - lb.lbColor = _COLORS[ 7 ]; + lb.lbColor = _s.COLORS[ 7 ]; lb.lbHatch = 0; - _s.wvtWhiteBrush= CreateSolidBrush( _COLORS[ 7 ] ); //CreateBrushIndirect( &lb ); + _s.wvtWhiteBrush= CreateSolidBrush( _s.COLORS[ 7 ] ); //CreateBrushIndirect( &lb ); /* GUI members of global structure */ @@ -255,8 +236,27 @@ static void hb_gt_wvt_InitStatics( PHB_GT pGT ) GetVersionEx( &osvi ); _s.pGT = pGT; + _s.ROWS = WVT_DEFAULT_ROWS; _s.COLS = WVT_DEFAULT_COLS; + + _s.COLORS[ 0] = BLACK; + _s.COLORS[ 1] = BLUE; + _s.COLORS[ 2] = GREEN; + _s.COLORS[ 3] = CYAN; + _s.COLORS[ 4] = RED; + _s.COLORS[ 5] = MAGENTA; + _s.COLORS[ 6] = BROWN; + _s.COLORS[ 7] = WHITE; + _s.COLORS[ 8] = LIGHT_GRAY; + _s.COLORS[ 9] = BRIGHT_BLUE; + _s.COLORS[10] = BRIGHT_GREEN; + _s.COLORS[11] = BRIGHT_CYAN; + _s.COLORS[12] = BRIGHT_RED; + _s.COLORS[13] = BRIGHT_MAGENTA; + _s.COLORS[14] = YELLOW; + _s.COLORS[15] = BRIGHT_WHITE; + _s.CaretExist = FALSE; _s.CaretHidden = FALSE; _s.CaretSize = 4; @@ -1044,9 +1044,9 @@ static BOOL hb_gt_wvt_TextOut( HDC hdc, USHORT col, USHORT row, BYTE attr, LPCTS RECT rClip; /* set foreground color */ - SetTextColor( hdc, _COLORS[ attr & 0x0F ] ); + SetTextColor( hdc, _s.COLORS[ attr & 0x0F ] ); /* set background color */ - SetBkColor( hdc, _COLORS[ ( attr >> 4 ) & 0x0F ] ); + SetBkColor( hdc, _s.COLORS[ ( attr >> 4 ) & 0x0F ] ); SetTextAlign( hdc, TA_LEFT ); @@ -1773,7 +1773,7 @@ int HB_EXPORT hb_wvt_gtSetLastMenuEvent( int iLastMenuEvent ) HB_EXPORT COLORREF hb_wvt_gtGetColorData( int iIndex ) { - return _COLORS[ iIndex ]; + return _s.COLORS[ iIndex ]; } //-------------------------------------------------------------------// @@ -1784,7 +1784,7 @@ HB_EXPORT BOOL hb_wvt_gtSetColorData( int iIndex, COLORREF ulCr ) if( iIndex >= 0 && iIndex < 16 ) { - _COLORS[ iIndex ] = ulCr; + _s.COLORS[ iIndex ] = ulCr; bResult = TRUE; } return bResult; diff --git a/harbour/contrib/hbgtwvg/gtwvt.h b/harbour/contrib/hbgtwvg/gtwvt.h index 9074756c23..f1337955c0 100644 --- a/harbour/contrib/hbgtwvg/gtwvt.h +++ b/harbour/contrib/hbgtwvg/gtwvt.h @@ -98,10 +98,10 @@ #include "hbgfxdef.ch" -#define WVT_CHAR_QUEUE_SIZE 128 -#define WVT_MAX_TITLE_SIZE 128 -#define WVT_MAX_ROWS 256 -#define WVT_MAX_COLS 256 +#define WVT_CHAR_QUEUE_SIZE 128 +#define WVT_MAX_TITLE_SIZE 128 +#define WVT_MAX_ROWS 256 +#define WVT_MAX_COLS 256 #if defined( HB_WINCE ) # define WVT_DEFAULT_ROWS 15 # define WVT_DEFAULT_COLS 50 @@ -191,6 +191,8 @@ typedef struct global_data USHORT ROWS; /* number of displayable rows in window */ USHORT COLS; /* number of displayable columns in window */ + COLORREF COLORS[16]; /* colors */ + BOOL CaretExist; /* TRUE if a caret has been created */ BOOL CaretHidden; /* TRUE if a caret has been hiden */ int CaretSize; /* Size of solid caret */ diff --git a/harbour/source/rtl/gtwvt/gtwvt.c b/harbour/source/rtl/gtwvt/gtwvt.c index f6435b61d8..eacc63eace 100644 --- a/harbour/source/rtl/gtwvt/gtwvt.c +++ b/harbour/source/rtl/gtwvt/gtwvt.c @@ -99,25 +99,6 @@ static int s_iCmdShow; static HB_GTWVT _s; -static const COLORREF _COLORS[16] = { - BLACK, - BLUE, - GREEN, - CYAN, - RED, - MAGENTA, - BROWN, - WHITE, - LIGHT_GRAY, - BRIGHT_BLUE, - BRIGHT_GREEN, - BRIGHT_CYAN, - BRIGHT_RED, - BRIGHT_MAGENTA, - YELLOW, - BRIGHT_WHITE -}; - static const int K_Ctrl[] = { K_CTRL_A, K_CTRL_B, K_CTRL_C, K_CTRL_D, K_CTRL_E, K_CTRL_F, K_CTRL_G, @@ -134,8 +115,27 @@ static void hb_gt_wvt_InitStatics( PHB_GT pGT ) GetVersionEx( &osvi ); _s.pGT = pGT; + _s.ROWS = WVT_DEFAULT_ROWS; _s.COLS = WVT_DEFAULT_COLS; + + _s.COLORS[ 0] = BLACK; + _s.COLORS[ 1] = BLUE; + _s.COLORS[ 2] = GREEN; + _s.COLORS[ 3] = CYAN; + _s.COLORS[ 4] = RED; + _s.COLORS[ 5] = MAGENTA; + _s.COLORS[ 6] = BROWN; + _s.COLORS[ 7] = WHITE; + _s.COLORS[ 8] = LIGHT_GRAY; + _s.COLORS[ 9] = BRIGHT_BLUE; + _s.COLORS[10] = BRIGHT_GREEN; + _s.COLORS[11] = BRIGHT_CYAN; + _s.COLORS[12] = BRIGHT_RED; + _s.COLORS[13] = BRIGHT_MAGENTA; + _s.COLORS[14] = YELLOW; + _s.COLORS[15] = BRIGHT_WHITE; + _s.CaretExist = FALSE; _s.CaretHidden = FALSE; _s.CaretSize = 4; @@ -874,9 +874,9 @@ static BOOL hb_gt_wvt_TextOut( HDC hdc, USHORT col, USHORT row, BYTE attr, LPCTS RECT rClip; /* set foreground color */ - SetTextColor( hdc, _COLORS[ attr & 0x0F ] ); + SetTextColor( hdc, _s.COLORS[ attr & 0x0F ] ); /* set background color */ - SetBkColor( hdc, _COLORS[ ( attr >> 4 ) & 0x0F ] ); + SetBkColor( hdc, _s.COLORS[ ( attr >> 4 ) & 0x0F ] ); SetTextAlign( hdc, TA_LEFT ); diff --git a/harbour/source/rtl/gtwvt/gtwvt.h b/harbour/source/rtl/gtwvt/gtwvt.h index dd2443037f..453dd72d0f 100644 --- a/harbour/source/rtl/gtwvt/gtwvt.h +++ b/harbour/source/rtl/gtwvt/gtwvt.h @@ -73,15 +73,15 @@ #include "hbgfxdef.ch" -#define WVT_CHAR_QUEUE_SIZE 128 -#define WVT_MAX_TITLE_SIZE 128 -#define WVT_MAX_ROWS 256 -#define WVT_MAX_COLS 256 +#define WVT_CHAR_QUEUE_SIZE 128 +#define WVT_MAX_TITLE_SIZE 128 +#define WVT_MAX_ROWS 256 +#define WVT_MAX_COLS 256 #if defined( HB_WINCE ) # define WVT_DEFAULT_ROWS 15 # define WVT_DEFAULT_COLS 50 # define WVT_DEFAULT_FONT_HEIGHT 12 -# define WVT_DEFAULT_FONT_WIDTH 8 +# define WVT_DEFAULT_FONT_WIDTH 8 #else # define WVT_DEFAULT_ROWS 25 # define WVT_DEFAULT_COLS 80 @@ -116,6 +116,8 @@ typedef struct USHORT ROWS; /* number of displayable rows in window */ USHORT COLS; /* number of displayable columns in window */ + COLORREF COLORS[16]; /* colors */ + BOOL CaretExist; /* TRUE if a caret has been created */ BOOL CaretHidden; /* TRUE if a caret has been hiden */ int CaretSize; /* Size of solid caret */