diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c12abfcbf1..512425a80c 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,11 @@ +19990602-11:35 EDT David G. Holm + * source/rtl/console.c + - Added HARBOUR SCROLL() + * source/rtl/gtapi.c + - Added HARBOUR MAXROW() and MAXCOL() + + tests/working/scroll.prg + - New test module to demonstrate scrolling + 19990602-12:00 WIB Andi Jahja + gt.b32 - make file for gt functions + bldgt32.bat - batch file for hbgt.lib @@ -36,6 +44,7 @@ Added: * source/hbpp/buildgcc.bat * source/hbpp/table.c + 19990601-23:50 EDT David G. Holm * makefile.b31 - Made progress on GT API, so put USE_GTAPI back in as default. diff --git a/harbour/source/rtl/console.c b/harbour/source/rtl/console.c index 017319c771..14320bcc03 100644 --- a/harbour/source/rtl/console.c +++ b/harbour/source/rtl/console.c @@ -317,3 +317,25 @@ HARBOUR SETPRC( void ) /* Sets the current printer row and column positions */ } } } + +HARBOUR SCROLL( void ) /* Scrolls a screen region (requires the GT API) */ +{ +#ifdef USE_GTAPI + int top = 0, left = 0, bottom = _gtMaxRow(), right = _gtMaxCol(), + v_scroll = 0, h_scroll = 0; + + if( _pcount() > 0 && _param( 1, IT_NUMERIC ) ) + top = _parni( 1 ); + if( _pcount() > 1 && _param( 2, IT_NUMERIC ) ) + left = _parni( 2 ); + if( _pcount() > 2 && _param( 3, IT_NUMERIC ) ) + bottom = _parni( 3 ); + if( _pcount() > 3 && _param( 4, IT_NUMERIC ) ) + right = _parni( 4 ); + if( _pcount() > 4 && _param( 5, IT_NUMERIC ) ) + v_scroll = _parni( 5 ); + if( _pcount() > 5 && _param( 6, IT_NUMERIC ) ) + h_scroll = _parni( 6 ); + _gtScroll( top, left, bottom, right, v_scroll, h_scroll ); +#endif +} diff --git a/harbour/source/rtl/gtapi.c b/harbour/source/rtl/gtapi.c index addfdae24c..f54c25f855 100644 --- a/harbour/source/rtl/gtapi.c +++ b/harbour/source/rtl/gtapi.c @@ -492,6 +492,16 @@ int _gtScroll(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, SHOR return(0); } +HARBOUR MaxRow( void ) /* Return the maximum screen row number (zero origin) */ +{ + _retni( _gtMaxRow () ); +} + +HARBOUR MaxCol( void ) /* Return the maximum screen column number (zero origin) */ +{ + _retni( _gtMaxCol () ); +} + #ifdef TEST void main(void) { diff --git a/harbour/tests/working/scroll.prg b/harbour/tests/working/scroll.prg new file mode 100644 index 0000000000..4c8362486f --- /dev/null +++ b/harbour/tests/working/scroll.prg @@ -0,0 +1,53 @@ +function main() + + Scroll() + DevPos (MAXROW(), 0) + Qout( "If the GT API was linked in, the rest of the screen should be blank now." ) + Pause() + Scroll() + DevPos (0, 0) + QQOUT("01234567890123456789012345678901") + QOUT ("01234567890123456789012345678901") + QOUT ("01234567890123456789012345678901") + QOUT ("01234567890123456789012345678901") + QOUT ("01234567890123456789012345678901") + QOUT ("01234567890123456789012345678901") + QOUT ("01234567890123456789012345678901") + QOUT ("01234567890123456789012345678901") + QOUT ("01234567890123456789012345678901") + QOUT ("01234567890123456789012345678901") + QOUT ("01234567890123456789012345678901") + QOUT ("01234567890123456789012345678901") + QOUT ("01234567890123456789012345678901") + DevPos (3, 5) + Qqout (" ") + DevPos (4, 5) + Qqout (" This is a test. ") + DevPos (5, 5) + Qqout (" This is only a test. ") + DevPos (6, 5) + Qqout (" Had this been a real ") + DevPos (7, 5) + Qqout (" emergency, you would ") + DevPos (8, 5) + Qqout (" be dead now. ") + DevPos (9, 5) + Qqout (" ") + Pause() + Scroll (1, 1, 11, 30, -2, -5) + pause() + Scroll (1, 1, 11, 30, 2, 5) + pause() + Scroll (1, 1, 11, 30, -5, 2) + pause() + Scroll (1, 1, 11, 30, 7, -12) + pause() + Scroll (1, 1, 11, 30) + pause() + +return nil + +function pause() + DevPos (MAXROW() - 2, 0) + __ACCEPT ("pause: ") +return nil