2009-01-12 23:35 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/rtl/cdpapi.c
  * harbour/source/rtl/langapi.c
    * increase maximum number of lang and codepage modules from 64 to 128
      (we already have more then 64)

  * harbour/include/hbgtinfo.ch
    + added HB_GTI_BOXCP - it allows to chose CP for given characters put
      by DISPBOX() and similar box drawing functions.

  * harbour/source/rtl/gttrm/gttrm.c
    + added support for HB_GTI_BOXCP. Now it's possible to change the CP
      used for box drawing characters. Before this modification is was
      hardcoded to "EN"
    * use codepage set by HB_SET{DISP|TERM}CP() also for box characters
      if last parameter <lBox> is true
    This functionality (using different CP for box drawing characters)
    is available only if terminal works in Unicode mode (UTF8).
This commit is contained in:
Przemyslaw Czerpak
2009-01-12 22:32:12 +00:00
parent 2f67d77856
commit a152f6391f
5 changed files with 42 additions and 7 deletions

View File

@@ -8,6 +8,25 @@
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2009-01-12 23:35 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/rtl/cdpapi.c
* harbour/source/rtl/langapi.c
* increase maximum number of lang and codepage modules from 64 to 128
(we already have more then 64)
* harbour/include/hbgtinfo.ch
+ added HB_GTI_BOXCP - it allows to chose CP for given characters put
by DISPBOX() and similar box drawing functions.
* harbour/source/rtl/gttrm/gttrm.c
+ added support for HB_GTI_BOXCP. Now it's possible to change the CP
used for box drawing characters. Before this modification is was
hardcoded to "EN"
* use codepage set by HB_SET{DISP|TERM}CP() also for box characters
if last parameter <lBox> is true
This functionality (using different CP for box drawing characters)
is available only if terminal works in Unicode mode (UTF8).
2009-01-12 15:15 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/vm/fm.c
* harbour/include/hbwmain.c

View File

@@ -133,6 +133,8 @@
#define HB_GTI_SETPOS_XY 55 /* Get/Set current top-left position coordinates of the window by pixels */
#define HB_GTI_SETPOS_ROWCOL 56 /* Set current top-left position coordinates of the window by row/cols */
#define HB_GTI_BOXCP 57 /* Codepage used for box drawing */
/* Font weights */
#define HB_GTI_FONTW_THIN 1
#define HB_GTI_FONTW_NORMAL 2

View File

@@ -58,6 +58,8 @@
#include "hbapicdp.h"
#include "hbapierr.h"
#define HB_CDP_MAX_ 128
/* Now we are using only 16bit Unicode values so the maximum size
* of single character encoded in UTF8 is 3 though ISO 10646 Universal
* Character Set (UCS) occupies even a 31-bit code space and to encode
@@ -112,8 +114,6 @@ static HB_CODEPAGE s_en_codepage =
HB_CODEPAGE_ANNOUNCE( EN )
# define HB_CDP_MAX_ 64
static PHB_CODEPAGE s_cdpList[HB_CDP_MAX_] = { &s_en_codepage };
static int utf8Size( USHORT uc )

View File

@@ -323,8 +323,8 @@ typedef struct _HB_GTTRM
#ifndef HB_CDP_SUPPORT_OFF
PHB_CODEPAGE cdpHost;
PHB_CODEPAGE cdpOut;
PHB_CODEPAGE cdpBox;
PHB_CODEPAGE cdpIn;
PHB_CODEPAGE cdpEN;
#endif
BOOL fUTF8;
BYTE keyTransTbl[ 256 ];
@@ -724,8 +724,8 @@ static void hb_gt_trm_termOutTrans( PHB_GTTRM pTerm, BYTE * pStr, int iLen, int
if( pTerm->fUTF8 )
{
if( ( iAttr & ( HB_GTTRM_ATTR_ACSC | HB_GTTRM_ATTR_BOX ) ) &&
pTerm->cdpEN )
cdp = pTerm->cdpEN;
pTerm->cdpBox )
cdp = pTerm->cdpBox;
else if( pTerm->cdpHost )
cdp = pTerm->cdpHost;
else
@@ -2837,7 +2837,7 @@ static void hb_gt_trm_SetTerm( PHB_GTTRM pTerm )
#ifndef HB_CDP_SUPPORT_OFF
pTerm->cdpHost = pTerm->cdpOut = pTerm->cdpIn = NULL;
pTerm->cdpEN = hb_cdpFind( "EN" );
pTerm->cdpBox = hb_cdpFind( "EN" );
#endif
add_efds( pTerm, pTerm->hFilenoStdin, O_RDONLY, NULL, NULL );
init_keys( pTerm );
@@ -3255,6 +3255,8 @@ static BOOL hb_gt_trm_SetDispCP( PHB_GT pGT, const char *pszTermCDP, const char
pTerm->cdpOut = hb_cdpFind( pszTermCDP );
pTerm->cdpHost = hb_cdpFind( pszHostCDP );
if( fBox && pTerm->cdpHost )
pTerm->cdpBox = pTerm->cdpHost;
if( pTerm->cdpOut && pTerm->cdpHost &&
pTerm->cdpHost->nChars &&
@@ -3434,6 +3436,18 @@ static BOOL hb_gt_trm_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
pInfo->pResult = hb_itemPutL( pInfo->pResult, pTerm->fUTF8 );
break;
case HB_GTI_BOXCP:
pInfo->pResult = hb_itemPutC( pInfo->pResult,
pTerm->cdpBox ? pTerm->cdpBox->id : NULL );
szVal = hb_itemGetCPtr( pInfo->pNewVal );
if( szVal && *szVal )
{
PHB_CODEPAGE cdpBox = hb_cdpFind( szVal );
if( cdpBox )
pTerm->cdpBox = cdpBox;
}
break;
case HB_GTI_ESCDELAY:
pInfo->pResult = hb_itemPutNI( pInfo->pResult, pTerm->esc_delay );
if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC )

View File

@@ -206,7 +206,7 @@ HB_LANG_ANNOUNCE( EN )
/* NOTE: This is the maximum number of registered languages, later this can be
made dynamic. */
#define HB_LANG_MAX_ 64
#define HB_LANG_MAX_ 128
#define HB_LANG_ITEM_ID_ID 0
#define HB_LANG_ITEM_ID_NAME 1