diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 5b8d0f7afb..5d3643bbff 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,20 @@ +19990930-15:20 EDT David G. Holm + + * include/extend.h + + Added hb_setCursor() prototype. + + * source/rtl/console.c + + Added hb_gtSetCursor( SC_NORMAL ) to hb_consoleInitialize(). + + Added hb_setCursor(), which does the grunt work that SETCURSOR + used to do, so that it can be called from SET(). + % SETCURSOR() is now a shell function that calls hb_setCursor(). + + * source/rtl/set.c + ! SET( _SET_CURSOR [, SC_...] ) now calls hb_setCursor(). + + * source/runner/stdalone/external.prg + + Added HB_OSNEWLINE + 19990930-21:00 GMT+1 Victor Szel * include/common.ch rtl/asort.prg diff --git a/harbour/include/extend.h b/harbour/include/extend.h index bd584fb5e8..dae40170cf 100644 --- a/harbour/include/extend.h +++ b/harbour/include/extend.h @@ -387,7 +387,7 @@ extern void hb_consoleRelease( void ); extern char * hb_consoleGetNewLine( void ); extern void hb_outstd( char * pStr, ULONG ulLen ); extern void hb_outerr( char * pStr, ULONG ulLen ); - +extern USHORT hb_setCursor( BOOL bSetCursor, USHORT usNewCursor ); extern void hb_tone( double dFrequency, double dDuration ); extern char * hb_setColor( char * ); diff --git a/harbour/source/rtl/console.c b/harbour/source/rtl/console.c index f18c91d308..3cec8820e3 100644 --- a/harbour/source/rtl/console.c +++ b/harbour/source/rtl/console.c @@ -143,6 +143,7 @@ void hb_consoleInitialize( void ) #ifdef HARBOUR_USE_GTAPI hb_gtInit(); hb_gtGetPos( &s_uiDevRow, &s_uiDevCol ); + hb_gtSetCursor( SC_NORMAL ); #else s_uiDevRow = 0; s_uiDevCol = 0; @@ -1091,19 +1092,28 @@ HARBOUR HB_RESTSCREEN( void ) #endif } +USHORT hb_setCursor( BOOL bSetCursor, USHORT usNewCursor ) +{ + USHORT usPreviousCursor; +#ifdef HARBOUR_USE_GTAPI + hb_gtGetCursor( &usPreviousCursor ); + if( bSetCursor ) + hb_gtSetCursor( usNewCursor ); + +#else + usPreviousCursor = hb_set.HB_SET_CURSOR; + if( bSetCursor ) + hb_set.HB_SET_CURSOR = ( hb_cursor_enum ) usNewCursor; +#endif + return usPreviousCursor; +} + HARBOUR HB_SETCURSOR( void ) { -#ifdef HARBOUR_USE_GTAPI - USHORT usPreviousCursor; - - hb_gtGetCursor( &usPreviousCursor ); - if( hb_pcount() == 1 ) - hb_gtSetCursor( hb_parni( 1 ) ); - - hb_retni( usPreviousCursor ); -#else - hb_retni( SC_NORMAL ); -#endif + if( hb_pcount() == 1 && ISNUM( 1 ) ) + hb_retni( hb_setCursor( TRUE, hb_parni( 1 ) ) ); + else + hb_retni( hb_setCursor( FALSE, 0 ) ); } HARBOUR HB_SETBLINK( void ) diff --git a/harbour/source/rtl/set.c b/harbour/source/rtl/set.c index 9462620f68..14ec080bf2 100644 --- a/harbour/source/rtl/set.c +++ b/harbour/source/rtl/set.c @@ -36,6 +36,8 @@ /* * ChangeLog: * + * V 1.81 David G. Holm Corrected _SET_CURSOR to use the GT API + * when available. * V 1.70 David G. Holm Corrected _SET_COLOR case to only use * '.asString' if 'IS_STRING', otherwise * use "" instead of only if 'IS_NIL'. @@ -736,8 +738,10 @@ HARBOUR HB_SET( void ) if( args > 1 ) hb_set.HB_SET_CONSOLE = set_logical( pArg2 ); break; case HB_SET_CURSOR : - hb_retni( hb_set.HB_SET_CURSOR ); - if( args > 1 ) hb_set.HB_SET_CURSOR = ( HB_cursor_enum ) set_number( pArg2, hb_set.HB_SET_CURSOR ); + if( args >= 2 && IS_NUMERIC( pArg2 ) ) + hb_retni( hb_setCursor( TRUE, hb_itemGetNI( pArg2 ) ) ); + else + hb_retni( hb_setCursor( FALSE, 0 ) ); break; case HB_SET_DATEFORMAT : if( hb_set.HB_SET_DATEFORMAT ) hb_retc( hb_set.HB_SET_DATEFORMAT ); @@ -947,7 +951,7 @@ void hb_setInitialize( void ) hb_set.HB_SET_COLOR[ sizeof( hb_set.HB_SET_COLOR ) - 1 ] = '\0'; hb_set.HB_SET_CONFIRM = FALSE; hb_set.HB_SET_CONSOLE = TRUE; - hb_set.HB_SET_CURSOR = SC_NORMAL; + hb_set.HB_SET_CURSOR = SC_NORMAL; /* Only needed for non-GTAPI */ hb_set.HB_SET_DATEFORMAT = ( char * ) hb_xgrab( 9 ); memcpy( hb_set.HB_SET_DATEFORMAT, "mm/dd/yy", 9 ); hb_set.HB_SET_DEBUG = FALSE; diff --git a/harbour/source/runner/stdalone/external.prg b/harbour/source/runner/stdalone/external.prg index a2ca9a3ed8..478844bae0 100644 --- a/harbour/source/runner/stdalone/external.prg +++ b/harbour/source/runner/stdalone/external.prg @@ -158,6 +158,7 @@ EXTERNAL SETMODE EXTERNAL __ACCEPT EXTERNAL __ACCEPTSTR EXTERNAL __COLORINDEX +EXTERNAL HB_OSNEWLINE // //symbols from file: rtl\copyfile.c //