From ac818364937f9e73d61e5e1e796dbd684aa0bf4f Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Thu, 23 Aug 2007 12:30:23 +0000 Subject: [PATCH] 2007-08-23 14:30 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbgtcore.h * harbour/source/rtl/hbgtcore.c + added new GT method: SEMICOLD() * harbour/source/rtl/gtxwc/gtxwc.c * use SEMICOLD() for late console window initialization * harbour/source/rtl/gttrm/gttrm.c * use SEMICOLD() to not erase startup screen contnts. Now applications which uses GTTRM and only simple QOUT()/QQOUT() output will work like with GTSTD. It means that in *nixes we can use GTTRM as default GT driver for all Harbour utilities. * harbour/make_gcc.sh * harbour/make_tgz.sh * harbour/harbour.spec * changed default GT driver for *nixes from to GTSTD to GTTRM --- harbour/ChangeLog | 19 ++++++++++++++ harbour/harbour.spec | 4 +-- harbour/include/hbgtcore.h | 3 +++ harbour/make_gcc.sh | 2 +- harbour/make_gnu.sh | 19 ++++++++------ harbour/make_tgz.sh | 3 ++- harbour/source/rtl/gttrm/gttrm.c | 45 +++++++++++++++++++++++++++++--- harbour/source/rtl/gtxwc/gtxwc.c | 6 +++++ harbour/source/rtl/hbgtcore.c | 20 ++++++++++++++ 9 files changed, 105 insertions(+), 16 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 0799a04ccc..9935046dec 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,25 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-08-23 14:30 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbgtcore.h + * harbour/source/rtl/hbgtcore.c + + added new GT method: SEMICOLD() + + * harbour/source/rtl/gtxwc/gtxwc.c + * use SEMICOLD() for late console window initialization + + * harbour/source/rtl/gttrm/gttrm.c + * use SEMICOLD() to not erase startup screen contnts. + Now applications which uses GTTRM and only simple QOUT()/QQOUT() + output will work like with GTSTD. It means that in *nixes we can + use GTTRM as default GT driver for all Harbour utilities. + + * harbour/make_gcc.sh + * harbour/make_tgz.sh + * harbour/harbour.spec + * changed default GT driver for *nixes from to GTSTD to GTTRM + 2007-08-23 02:55 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/config/darwin/gcc.cf * harbour/config/darwin/global.cf diff --git a/harbour/harbour.spec b/harbour/harbour.spec index 4446b13ac5..14a136f98d 100644 --- a/harbour/harbour.spec +++ b/harbour/harbour.spec @@ -25,7 +25,7 @@ # --without gpl - do not build libs which needs GPL 3-rd party code # --without nf - do not build nanforum lib # --without x11 - do not build GTXWC -# --without gpm - build GTSLN and GTCRS without GPM support +# --without gpm - build GTTRM, GTSLN and GTCRS without GPM support # --without gtsln - do not build GTSLN ###################################################################### @@ -72,7 +72,7 @@ %define hb_cflag export C_USR="-O3 -DHB_FM_STATISTICS_OFF" %define hb_lflag export L_USR="${CC_L_USR} %{?_with_static:-static}" %define hb_mt export HB_MT=no -%define hb_gt export HB_GT_LIB=gtcrs +%define hb_gt export HB_GT_LIB=gttrm %define hb_defgt export HB_GT_DEFAULT="${HB_GT_DEFAULT}" %define hb_gpm export HB_GPM_MOUSE=%{!?_without_gpm:yes} %define hb_sln export HB_WITHOUT_GTSLN=%{?_without_gtsln:yes} diff --git a/harbour/include/hbgtcore.h b/harbour/include/hbgtcore.h index b826d5171d..83492dc9dc 100644 --- a/harbour/include/hbgtcore.h +++ b/harbour/include/hbgtcore.h @@ -116,6 +116,7 @@ typedef struct BOOL (* Resize ) ( int, int ); BOOL (* SetMode) ( int, int ); void (* GetSize) ( int *, int * ); + void (* SemiCold) ( void ); void (* ColdArea) ( int, int, int, int ); void (* ExposeArea) ( int, int, int, int ); void (* ScrollArea) ( int, int, int, int, BYTE, BYTE, int, int ); @@ -365,6 +366,7 @@ extern void hb_gt_VertLine( int iCol, int iTop, int iBottom, BYTE bChar, BYTE extern BOOL hb_gt_SetMode( int iRows, int iCols ); extern BOOL hb_gt_Resize( int iRows, int iCols ); extern void hb_gt_GetSize( int * piRows, int * piCols ); +extern void hb_gt_SemiCold( void ); extern void hb_gt_ColdArea( int iTop, int iLeft, int iBottom, int iRight ); extern void hb_gt_ExposeArea( int iTop, int iLeft, int iBottom, int iRight ); extern void hb_gt_ScrollArea( int iTop, int iLeft, int iBottom, int iRight, BYTE bColor, BYTE bChar, int iRows, int iCols ); @@ -471,6 +473,7 @@ extern void hb_gt_WhoCares( void * pCargo ); #define HB_GTSUPER_SETMODE(r,c) (HB_GTSUPER)->SetMode(r,c) #define HB_GTSUPER_RESIZE(r,c) (HB_GTSUPER)->Resize(r,c) #define HB_GTSUPER_GETSIZE(pr,pc) (HB_GTSUPER)->GetSize(pr,pc) +#define HB_GTSUPER_SEMICOLD() (HB_GTSUPER)->SemiCold() #define HB_GTSUPER_COLDAREA(t,l,b,r) (HB_GTSUPER)->ColdArea(t,l,b,r) #define HB_GTSUPER_EXPOSEAREA(t,l,b,r) (HB_GTSUPER)->ExposeArea(t,l,b,r) #define HB_GTSUPER_SCROLLAREA(t,l,b,r,m,u,v,h) (HB_GTSUPER)->ScrollArea(t,l,b,r,m,u,v,h) diff --git a/harbour/make_gcc.sh b/harbour/make_gcc.sh index 7d81f57cfb..970b90f353 100755 --- a/harbour/make_gcc.sh +++ b/harbour/make_gcc.sh @@ -31,7 +31,7 @@ if [ -z "$HB_GT_LIB" ]; then w32) HB_GT_LIB="gtwin" ;; dos) HB_GT_LIB="gtdos" ;; os2) HB_GT_LIB="gtos2" ;; - *) HB_GT_LIB="gtstd" ;; + *) HB_GT_LIB="gttrm" ;; esac export HB_GT_LIB fi diff --git a/harbour/make_gnu.sh b/harbour/make_gnu.sh index 30bf3e2e6f..37ab2d814a 100755 --- a/harbour/make_gnu.sh +++ b/harbour/make_gnu.sh @@ -43,7 +43,7 @@ if [ -z "$HB_GT_LIB" ]; then w32) HB_GT_LIB="gtwin" ;; dos) HB_GT_LIB="gtdos" ;; os2) HB_GT_LIB="gtos2" ;; - *) HB_GT_LIB="gtstd" ;; + *) HB_GT_LIB="gttrm" ;; esac export HB_GT_LIB fi @@ -147,11 +147,11 @@ if [ -z "$HB_ARCHITECTURE" ] || [ -z "$HB_COMPILER" ]; then echo " - dos (HB_GT_LIB=gtdos by default)" echo " - w32 (HB_GT_LIB=gtw32 by default)" echo " - os2 (HB_GT_LIB=gtos2 by default)" - echo " - linux (HB_GT_LIB=gtstd by default)" - echo " - bsd (HB_GT_LIB=gtstd by default)" - echo " - darwin (HB_GT_LIB=gtstd by default)" - echo " - sunos (HB_GT_LIB=gtstd by default)" - echo " - hpux (HB_GT_LIB=gtstd by default)" + echo " - linux (HB_GT_LIB=gttrm by default)" + echo " - bsd (HB_GT_LIB=gttrm by default)" + echo " - darwin (HB_GT_LIB=gttrm by default)" + echo " - sunos (HB_GT_LIB=gttrm by default)" + echo " - hpux (HB_GT_LIB=gttrm by default)" echo read echo " HB_COMPILER:" @@ -175,15 +175,18 @@ if [ -z "$HB_ARCHITECTURE" ] || [ -z "$HB_COMPILER" ]; then echo read echo " HB_GT_LIB:" - echo " - gtstd (Standard streaming) (for all architectures)" + echo " - gtstd (TTY streaming) (for all architectures)" + echo " - gtcgi (Standard streaming) (for all architectures)" + echo " - gtpca (PC ANSI console) (for all architectures)" echo " - gtdos (DOS console) (for dos architecture)" echo " - gtwin (Win32 console) (for w32 architecture)" echo " - gtwvt (Win32 win console) (for w32 architecture)" echo " - gtos2 (OS/2 console) (for os2 architecture)" - echo " - gtpca (PC ANSI console) (for all architectures)" echo " - gtcrs (Curses console) (for *nixes, w32 architectures)" echo " - gtsln (Slang console) (for *nixes, w32 architectures)" + echo " - gttrm (Terminal console) (for *nixes architecture)" echo " - gtxwc (XWindow console) (for *nixes architecture)" + echo " - gtalleg (Allegro console) (for all architectures)" echo echo " - Use these optional envvars to configure the make process" echo " when using the 'all' target:" diff --git a/harbour/make_tgz.sh b/harbour/make_tgz.sh index ad92c8e272..e026f4415e 100755 --- a/harbour/make_tgz.sh +++ b/harbour/make_tgz.sh @@ -58,7 +58,8 @@ if [ -z "$HB_GT_LIB" ]; then case "$HB_ARCHITECTURE" in w32) HB_GT_LIB="gtwin" ;; dos) HB_GT_LIB="gtdos" ;; - *) HB_GT_LIB="gtcrs" ;; + os2) HB_GT_LIB="gtos2" ;; + *) HB_GT_LIB="gttrm" ;; esac export HB_GT_LIB fi diff --git a/harbour/source/rtl/gttrm/gttrm.c b/harbour/source/rtl/gttrm/gttrm.c index d1bc721a4b..2e257207ed 100644 --- a/harbour/source/rtl/gttrm/gttrm.c +++ b/harbour/source/rtl/gttrm/gttrm.c @@ -1766,8 +1766,8 @@ static BOOL hb_gt_trm_AnsiGetCursorPos( int * iRow, int * iCol ) #endif if( s_termState.fPosAnswer ) { - *iRow = y; - *iCol = x; + *iRow = y - 1; + *iCol = x - 1; } else { @@ -2010,11 +2010,16 @@ static BOOL hb_trm_isUTF8( void ) if( s_termState.fPosAnswer ) { int iRow = 0, iCol = 0; + BOOL fSize; hb_gt_trm_termOut( ( BYTE * ) "\r\303\255", 3 ); hb_gt_trm_termFlush(); - if( s_termState.GetCursorPos( &iRow, &iCol ) ) - return iCol == 2; + fSize = s_termState.GetCursorPos( &iRow, &iCol ); + hb_gt_trm_termOut( ( BYTE * ) "\r \r", 4 ); + hb_gt_trm_termFlush(); + s_termState.iCol = 0; + if( fSize ) + return iCol == 1; } szLang = getenv( "LANG" ); return szLang && strstr( szLang, "UTF-8" ) != NULL; @@ -2857,6 +2862,8 @@ static void hb_gt_trm_Init( FHANDLE hFilenoStdin, FHANDLE hFilenoStdout, FHANDLE s_termState.fUTF8 = hb_trm_isUTF8(); hb_gt_trm_SetKeyTrans( NULL, NULL ); hb_gt_trm_SetDispTrans( NULL, NULL, 0 ); + if( s_termState.fStdoutTTY ) + hb_gt_SemiCold(); } static void hb_gt_trm_Exit( void ) @@ -3053,9 +3060,38 @@ static BOOL hb_gt_trm_Resume( void ) hb_gt_GetSize( &iHeight, &iWidth ); hb_gt_ExposeArea( 0, 0, iHeight, iWidth ); + hb_gt_Refresh(); + return TRUE; } +static void hb_gt_trm_Scroll( int iTop, int iLeft, int iBottom, int iRight, + BYTE bColor, BYTE bChar, int iRows, int iCols ) +{ + int iHeight, iWidth; + + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Scroll(%d,%d,%d,%d,%d,%d,%d,%d)", iTop, iLeft, iBottom, iRight, bColor, bChar, iRows, iCols ) ); + + /* Provide some basic scroll support for full screen */ + if( iCols == 0 && iRows > 0 && iTop == 0 && iLeft == 0 ) + { + hb_gt_GetSize( &iHeight, &iWidth ); + if( iBottom >= iHeight - 1 && iRight >= iWidth - 1 && + s_termState.iRow == iHeight - 1 ) + { + /* scroll up the internal screen buffer */ + HB_GTSUPER_SCROLLUP( iRows, bColor, bChar ); + /* update our internal row position */ + do + hb_gt_trm_termOut( ( BYTE * ) "\n", 1 ); + while( --iRows > 0 ); + return; + } + } + + HB_GTSUPER_SCROLL( iTop, iLeft, iBottom, iRight, bColor, bChar, iRows, iCols ); +} + static BOOL hb_gt_trm_SetMode( int iRows, int iCols ) { HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_SetMode(%d, %d)", iRows, iCols ) ); @@ -3296,6 +3332,7 @@ static BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) pFuncTable->Exit = hb_gt_trm_Exit; pFuncTable->Redraw = hb_gt_trm_Redraw; pFuncTable->Refresh = hb_gt_trm_Refresh; + pFuncTable->Scroll = hb_gt_trm_Scroll; pFuncTable->Version = hb_gt_trm_Version; pFuncTable->Suspend = hb_gt_trm_Suspend; pFuncTable->Resume = hb_gt_trm_Resume; diff --git a/harbour/source/rtl/gtxwc/gtxwc.c b/harbour/source/rtl/gtxwc/gtxwc.c index a612c70061..c4a759a019 100644 --- a/harbour/source/rtl/gtxwc/gtxwc.c +++ b/harbour/source/rtl/gtxwc/gtxwc.c @@ -3329,6 +3329,7 @@ static void hb_gt_xwc_Init( FHANDLE hFilenoStdin, FHANDLE hFilenoStdout, FHANDLE HB_GTSUPER_INIT( hFilenoStdin, hFilenoStdout, hFilenoStderr ); HB_GTSUPER_RESIZE( s_wnd->rows, s_wnd->cols ); + hb_gt_SemiCold(); /* For immediate connection to XSarver and screen Window show */ /* hb_gt_xwc_Initialize( s_wnd ); */ @@ -3914,6 +3915,7 @@ static void hb_gt_xwc_Redraw( int iRow, int iCol, int iSize ) iRow + s_wnd->fontHeight - 1 ); #endif } +#if 0 else if( !s_wnd->fData ) { BYTE bDefColor = hb_gt_GetColor(); @@ -3931,6 +3933,10 @@ static void hb_gt_xwc_Redraw( int iRow, int iCol, int iSize ) } } } +#else + else + s_wnd->fData = TRUE; +#endif } } diff --git a/harbour/source/rtl/hbgtcore.c b/harbour/source/rtl/hbgtcore.c index 7b8458631e..69dba03caa 100644 --- a/harbour/source/rtl/hbgtcore.c +++ b/harbour/source/rtl/hbgtcore.c @@ -2050,6 +2050,17 @@ static void hb_gt_def_GetSize( int * piRows, int * piCols ) } } +void hb_gt_def_SemiCold( void ) +{ + if( s_curGT ) + { + int i; + for( i = 0; i < s_curGT->iHeight; ++i ) + s_curGT->pLines[ i ] = FALSE; + s_curGT->fRefresh = FALSE; + } +} + static void hb_gt_def_ColdArea( int iTop, int iLeft, int iBottom, int iRight ) { if( s_curGT ) @@ -2080,6 +2091,8 @@ static void hb_gt_def_ColdArea( int iTop, int iLeft, int iBottom, int iRight ) ~HB_GT_ATTR_REFRESH ); } } + if( iLeft == 0 && iRight == s_curGT->iWidth - 1 ) + s_curGT->pLines[ iTop ] = FALSE; ++iTop; } } @@ -2477,6 +2490,7 @@ static HB_GT_FUNCS gtCoreFunc = Resize : hb_gt_def_Resize , SetMode : hb_gt_def_SetMode , GetSize : hb_gt_def_GetSize , + SemiCold : hb_gt_def_SemiCold , ColdArea : hb_gt_def_ColdArea , ExposeArea : hb_gt_def_ExposeArea , ScrollArea : hb_gt_def_ScrollArea , @@ -2584,6 +2598,7 @@ static HB_GT_FUNCS gtCoreFunc = hb_gt_def_Resize , hb_gt_def_SetMode , hb_gt_def_GetSize , + hb_gt_def_SemiCold , hb_gt_def_ColdArea , hb_gt_def_ExposeArea , hb_gt_def_ScrollArea , @@ -2984,6 +2999,11 @@ void hb_gt_GetSize( int * piRows, int * piCols ) gtCoreFunc.GetSize( piRows, piCols ); } +void hb_gt_SemiCold( void ) +{ + gtCoreFunc.SemiCold(); +} + void hb_gt_ColdArea( int iTop, int iLeft, int iBottom, int iRight ) { gtCoreFunc.ColdArea( iTop, iLeft, iBottom, iRight );