From 79e4baee47de1faaa82a1818b4694d84542ab71a Mon Sep 17 00:00:00 2001 From: "David G. Holm" Date: Tue, 28 Nov 2000 22:07:05 +0000 Subject: [PATCH] See ChangeLog entry 2000-11-28 17:15 UTC-0400 David G. Holm --- harbour/ChangeLog | 11 ++++++++++ harbour/include/hbapigt.h | 11 ++++++++++ harbour/source/rtl/oldbox.c | 40 ++++++++++++++++++++++++++++++------- harbour/tests/boxtest.prg | 24 +++++++++++++++++----- 4 files changed, 74 insertions(+), 12 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index dd9fcdbf79..00fc139674 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,14 @@ +2000-11-28 17:15 UTC-0400 David G. Holm + * include/hbapigt.h + + Added non-DOS definitions of box drawing characters and strings. + * source/rtl/oldbox.c + % Changed to use same method to test and use numeric parameters as + that used by source/rtl/box.c. + * tests/boxtest.prg + + Added display of box drawing statement used following each box + draw, along with a wait for user input. Removed comment about + the first __BOX() call not doing anything, because it does... + 2000-11-28 11:40 UTC+0800 Brian Hays * contrib/rdd_ads/ads1.c * fixed retrieval of logical values diff --git a/harbour/include/hbapigt.h b/harbour/include/hbapigt.h index c0ad668502..420d6c7eab 100644 --- a/harbour/include/hbapigt.h +++ b/harbour/include/hbapigt.h @@ -75,6 +75,7 @@ extern "C" { #define HB_CLR_MAX_ HB_CLR_UNSELECTED /* strings for borders (same as box.ch, but defined for use by C) */ +#ifdef HB_OS_DOS /*01234567*/ #define _B_SINGLE "ÚÄ¿³ÙÄÀ³" #define _B_DOUBLE "ÉÍ»º¼ÍȺ" @@ -84,6 +85,16 @@ extern "C" { #define HB_B_SINGLE_H 'Ä' #define HB_B_DOUBLE_V 'º' #define HB_B_DOUBLE_H 'Í' +#else +#define _B_SINGLE "\xda\xc4\xbf\xb3\xd9\xc4\xc0\xb3" +#define _B_DOUBLE "\xc9\xcd\xbb\xba\xbc\xcd\xc8\xba" +#define _B_SINGLE_DOUBLE "\xd6\xc4\xb7\xba\xbd\xc4\xd3\xba" +#define _B_DOUBLE_SINGLE "\xd5\xcd\xb8\xb3\xbe\xcd\xd4\xb3" +#define HB_B_SINGLE_V '\xb3' +#define HB_B_SINGLE_H '\xc4' +#define HB_B_DOUBLE_V '\xb3' +#define HB_B_DOUBLE_H '\xc4' +#endif /* Used to tell hb_gt_SetPos() when the cursor position is being set. Before or after text is or was displayed. diff --git a/harbour/source/rtl/oldbox.c b/harbour/source/rtl/oldbox.c index f0593f2138..8757a27bdd 100644 --- a/harbour/source/rtl/oldbox.c +++ b/harbour/source/rtl/oldbox.c @@ -33,27 +33,53 @@ * */ +#include "hbapi.h" #include "hbapigt.h" +#include "hbapiitm.h" #ifdef HB_C52_UNDOC HB_FUNC( __BOX ) { - if( ISNUM( 1 ) && ISNUM( 2 ) && ISNUM( 3 ) && ISNUM( 4 ) ) - hb_gtBox( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), - ( BYTE * ) ( ISCHAR( 5 ) ? hb_parc( 5 ) : " " ) ); + PHB_ITEM pTop = hb_param( 1, HB_IT_NUMERIC ); + PHB_ITEM pLeft = hb_param( 2, HB_IT_NUMERIC ); + PHB_ITEM pBottom = hb_param( 3, HB_IT_NUMERIC ); + PHB_ITEM pRight = hb_param( 4, HB_IT_NUMERIC ); + + if( pTop && pLeft && pBottom && pRight ) + hb_gtBox( hb_itemGetNI( pTop ), + hb_itemGetNI( pLeft), + hb_itemGetNI( pBottom ), + hb_itemGetNI( pRight ), + ( BYTE * ) ( ISCHAR( 5 ) ? hb_parc( 5 ) : " " ) ); } HB_FUNC( __BOXD ) { - if( ISNUM( 1 ) && ISNUM( 2 ) && ISNUM( 3 ) && ISNUM( 4 ) ) - hb_gtBoxD( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ) ); + PHB_ITEM pTop = hb_param( 1, HB_IT_NUMERIC ); + PHB_ITEM pLeft = hb_param( 2, HB_IT_NUMERIC ); + PHB_ITEM pBottom = hb_param( 3, HB_IT_NUMERIC ); + PHB_ITEM pRight = hb_param( 4, HB_IT_NUMERIC ); + + if( pTop && pLeft && pBottom && pRight ) + hb_gtBoxD( hb_itemGetNI( pTop ), + hb_itemGetNI( pLeft), + hb_itemGetNI( pBottom ), + hb_itemGetNI( pRight ) ); } HB_FUNC( __BOXS ) { - if( ISNUM( 1 ) && ISNUM( 2 ) && ISNUM( 3 ) && ISNUM( 4 ) ) - hb_gtBoxS( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ) ); + PHB_ITEM pTop = hb_param( 1, HB_IT_NUMERIC ); + PHB_ITEM pLeft = hb_param( 2, HB_IT_NUMERIC ); + PHB_ITEM pBottom = hb_param( 3, HB_IT_NUMERIC ); + PHB_ITEM pRight = hb_param( 4, HB_IT_NUMERIC ); + + if( pTop && pLeft && pBottom && pRight ) + hb_gtBoxS( hb_itemGetNI( pTop ), + hb_itemGetNI( pLeft), + hb_itemGetNI( pBottom ), + hb_itemGetNI( pRight ) ); } #endif diff --git a/harbour/tests/boxtest.prg b/harbour/tests/boxtest.prg index 891c0a1675..4627465edc 100644 --- a/harbour/tests/boxtest.prg +++ b/harbour/tests/boxtest.prg @@ -7,11 +7,25 @@ function main() CLS @ 0, 0, 15, 50 BOX " " COLOR "W+/B" - __BOX( 1, 1, 5, 7 ) // This does nothing - __BOX( 1, 1, 5, 7, "" ) - __BOXD( 2, 2, 6, 8 ) - __BOXS( 3, 3, 7, 9 ) + MESSAGE( [@ 0, 0, 15, 50 BOX " " COLOR "W+/B"] ) - DevPos( 12, 1 ) + __BOX( 1, 1, 5, 7 ) + MESSAGE( [__BOX( 1, 1, 5, 7 )] ) + + __BOX( 1, 1, 5, 7, "X" ) + MESSAGE( [__BOX( 1, 1, 5, 7, "X" )] ) + + __BOXD( 2, 2, 6, 8 ) + MESSAGE( [__BOXD( 2, 2, 6, 8 )] ) + + __BOXS( 3, 3, 7, 9 ) + MESSAGE( [__BOXS( 3, 3, 7, 9 )] ) return nil + +procedure MESSAGE( cText ) + @ 16,0 CLEAR TO 16,79 + @ 16,0 SAY cText + OUTSTD( CHR( 7 ) ) + INKEY( 0 ) +return \ No newline at end of file