From 8e16af8da6a240e1c5b18bf377fbfb93eff90950 Mon Sep 17 00:00:00 2001 From: Ryszard Glab Date: Sat, 20 May 2000 12:42:32 +0000 Subject: [PATCH] ChangeLog 20000520-14:45 GMT+1 --- harbour/ChangeLog | 10 +++++++ harbour/source/rtl/gtcrs/gtcrs.c | 43 +++++++++++++++++++++++++++-- harbour/source/rtl/gtcrs/kbdcrs.c | 2 +- harbour/source/rtl/gtcrs/mousecrs.c | 2 +- 4 files changed, 52 insertions(+), 5 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 8fe29363a8..c5b2d999d5 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,13 @@ +20000520-14:45 GMT+1 Ryszard Glab + + *source/rtl/gtcrs/gtcrs.c + * fixed hb_gt_SetAttribute() to work with plain curses library + (thanks to Marek Paliwoda) + + *source/rtl/gtcrs/kbdcrs.c + *source/rtl/gtcrs/mousecrs.c + * fixed a module description + 20000519-23:50 GMT-3 Luiz Rafael Culik *makefile.bc makefile.vc diff --git a/harbour/source/rtl/gtcrs/gtcrs.c b/harbour/source/rtl/gtcrs/gtcrs.c index 37cb3a4139..5a3a5f52c1 100644 --- a/harbour/source/rtl/gtcrs/gtcrs.c +++ b/harbour/source/rtl/gtcrs/gtcrs.c @@ -366,17 +366,54 @@ void hb_gt_SetAttribute( USHORT uiTop, USHORT uiRight, BYTE byAttr ) { - int Count = uiRight - uiLeft + 1; + +#if (defined(M_UNIX) || defined(hpux)) && !defined(NCURSES_VERSION) int newAttr = s_attribmap_table[ byAttr ]; + int dx; + chtype c; +#else + attr_t newAttr = (attr_t)s_attribmap_table[ byAttr ]; + int Count = uiRight - uiLeft + 1; short newColor; + newColor = PAIR_NUMBER( (newAttr & A_COLOR) ); +#endif + HB_TRACE(HB_TR_DEBUG, ("hb_gt_SetAttribute(%hu, %hu, %hu, %hu, %d)", uiTop, uiLeft, uiBottom, uiRight, (int) byAttr)); - newColor = PAIR_NUMBER( newAttr ); - newAttr &= A_ATTRIBUTES; /* extract attributes only */ + newAttr &= A_ATTRIBUTES; /* extract attributes only */ + while( uiTop <= uiBottom ) + /* + this is an emulation of the mvchgat() function + for those curses which are not compatible with + XSI curses (like SCO curses and HPUX curses) + */ + #if (defined(M_UNIX) || defined(hpux)) && !defined(NCURSES_VERSION) + { + for ( dx=uiLeft; dx<=uiRight; dx++ ) + { + c = mvinch( uiTop, dx ); + /* extract character only (remember about alternate chars) */ + c &= (A_CHARTEXT | A_ALTCHARSET); + /* set new attribute */ + c |= newAttr; + if (addch(c) == ERR) + /* QUESTION : should we indicate any error here ? */ + return; + } + uiTop++; + } + #else + /* + we are assuming here that we compile Harbour + with XSI compatible curses (like ncurses) + */ mvchgat( uiTop++, uiLeft, Count, newAttr, newColor, NULL ); + #endif + if( s_uiDispCount == 0 ) + /* QUESTION : should we indicate any error here ? */ refresh(); } diff --git a/harbour/source/rtl/gtcrs/kbdcrs.c b/harbour/source/rtl/gtcrs/kbdcrs.c index dee93d1570..f7695c048e 100644 --- a/harbour/source/rtl/gtcrs/kbdcrs.c +++ b/harbour/source/rtl/gtcrs/kbdcrs.c @@ -4,7 +4,7 @@ /* * Harbour Project source code: - * Video subsystem based on ncurses. + * Keyboard subsystem based on ncurses. * * Copyright 2000 Ryszard Glab * www - http://www.harbour-project.org diff --git a/harbour/source/rtl/gtcrs/mousecrs.c b/harbour/source/rtl/gtcrs/mousecrs.c index b812709592..0af508ffad 100644 --- a/harbour/source/rtl/gtcrs/mousecrs.c +++ b/harbour/source/rtl/gtcrs/mousecrs.c @@ -4,7 +4,7 @@ /* * Harbour Project source code: - * Mouse subsystem for plain ANSI C stream IO (stub) + * Mouse subsystem based on ncurses * * Copyright 1999 Victor Szakats * www - http://www.harbour-project.org