2012-08-20 11:17 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* harbour/include/hbgtinfo.ch
+ added new hb_gtInfo() action: HB_GTI_UNITRANS
It allows to set translation table for UNICODE characters
* harbour/src/rtl/gtwvt/gtwvt.c
* harbour/src/rtl/gtwvt/gtwvt.h
+ added support for HB_GTI_UNITRANS - due to limited support
for unicode vlaues in MS-Windows raster fonts it's necessary
for some custom fonts.
* harbour/src/rtl/tpersist.prg
+ implemented 2-nd parameter <lIgnoreErrors> in ::LoadFromFile()
and ::LoadFromText() methods
* harbour/src/rtl/cdpapi.c
* indenting
This commit is contained in:
@@ -16,6 +16,24 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2012-08-20 11:17 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
|
||||
* harbour/include/hbgtinfo.ch
|
||||
+ added new hb_gtInfo() action: HB_GTI_UNITRANS
|
||||
It allows to set translation table for UNICODE characters
|
||||
|
||||
* harbour/src/rtl/gtwvt/gtwvt.c
|
||||
* harbour/src/rtl/gtwvt/gtwvt.h
|
||||
+ added support for HB_GTI_UNITRANS - due to limited support
|
||||
for unicode vlaues in MS-Windows raster fonts it's necessary
|
||||
for some custom fonts.
|
||||
|
||||
* harbour/src/rtl/tpersist.prg
|
||||
+ implemented 2-nd parameter <lIgnoreErrors> in ::LoadFromFile()
|
||||
and ::LoadFromText() methods
|
||||
|
||||
* harbour/src/rtl/cdpapi.c
|
||||
* indenting
|
||||
|
||||
2012-08-19 17:34 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
|
||||
* contrib/hbqt/hbmk2_qt.hb
|
||||
! Fixed: the treatment of html compliant ->setToolTip( calls.
|
||||
|
||||
@@ -151,6 +151,8 @@
|
||||
|
||||
#define HB_GTI_FONTATTRIBUTE 67 /* Get/set font attribute */
|
||||
|
||||
#define HB_GTI_UNITRANS 68 /* set translation table for UNICODE characters */
|
||||
|
||||
/* Font weights */
|
||||
#define HB_GTI_FONTW_THIN 1
|
||||
#define HB_GTI_FONTW_NORMAL 2
|
||||
|
||||
@@ -2402,7 +2402,6 @@ HB_WCHAR hb_cdpUpperWC( PHB_CODEPAGE cdp, HB_WCHAR wc )
|
||||
wc = cdp->uniTable->uniCodes[ cdp->upper[ cdp->uniTable->uniTrans[ wc ] ] ];
|
||||
}
|
||||
return wc;
|
||||
|
||||
}
|
||||
else
|
||||
return HB_CDPCHAR_UPPER( cdp, wc );
|
||||
|
||||
@@ -257,6 +257,9 @@ static void hb_gt_wvt_Free( PHB_GTWVT pWVT )
|
||||
#if !defined( UNICODE )
|
||||
if( pWVT->hFontBox && pWVT->hFontBox != pWVT->hFont )
|
||||
DeleteObject( pWVT->hFontBox );
|
||||
#else
|
||||
if( pWVT->wcTrans )
|
||||
hb_itemFreeC( ( char * ) pWVT->wcTrans );
|
||||
#endif
|
||||
if( pWVT->hFont )
|
||||
DeleteObject( pWVT->hFont );
|
||||
@@ -342,6 +345,9 @@ static PHB_GTWVT hb_gt_wvt_New( PHB_GT pGT, HINSTANCE hInstance, int iCmdShow )
|
||||
pWVT->CodePage = OEM_CHARSET; /* GetACP(); - set code page to default system */
|
||||
#if !defined( UNICODE )
|
||||
pWVT->boxCodePage = OEM_CHARSET; /* GetACP(); - set code page to default system */
|
||||
#else
|
||||
pWVT->wcTrans = NULL;
|
||||
pWVT->wcTransLen = 0;
|
||||
#endif
|
||||
|
||||
pWVT->Win9X = hb_iswin9x();
|
||||
@@ -1716,6 +1722,14 @@ static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT )
|
||||
if( ( pWVT->fontAttribute & HB_GTI_FONTA_CTRLCHARS ) == 0 )
|
||||
usChar = hb_cdpGetU16Ctrl( usChar );
|
||||
|
||||
if( pWVT->wcTrans )
|
||||
{
|
||||
if( pWVT->wcTransLen == 0x100 && ( usChar >> 8 ) == 0xFF )
|
||||
usChar &= 0x00FF;
|
||||
if( usChar < pWVT->wcTransLen && pWVT->wcTrans[ usChar ] )
|
||||
usChar = pWVT->wcTrans[ usChar ];
|
||||
}
|
||||
|
||||
/* as long as GTWVT uses only 16 colors we can ignore other bits
|
||||
* and not divide output when it does not change anythings
|
||||
*/
|
||||
@@ -2667,8 +2681,21 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
|
||||
}
|
||||
}
|
||||
break;
|
||||
#else
|
||||
case HB_GTI_UNITRANS:
|
||||
if( pWVT->wcTrans )
|
||||
pInfo->pResult = hb_itemPutCL( pInfo->pResult, ( char * ) pWVT->wcTrans,
|
||||
pWVT->wcTransLen * sizeof( HB_WCHAR ) );
|
||||
if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING )
|
||||
{
|
||||
if( pWVT->wcTrans )
|
||||
hb_itemFreeC( ( char * ) pWVT->wcTrans );
|
||||
pWVT->wcTransLen = hb_itemGetCLen( pInfo->pNewVal ) / sizeof( HB_WCHAR );
|
||||
pWVT->wcTrans = pWVT->wcTransLen == 0 ? NULL :
|
||||
( HB_WCHAR * ) hb_itemGetC( pInfo->pNewVal );
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case HB_GTI_ICONFILE:
|
||||
{
|
||||
if( ( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING ) )
|
||||
|
||||
@@ -163,6 +163,9 @@ typedef struct
|
||||
int CodePage; /* Code page to use for display characters */
|
||||
#if ! defined( UNICODE )
|
||||
int boxCodePage; /* Code page to use for display draw line characters */
|
||||
#else
|
||||
HB_WCHAR * wcTrans; /* unicode character translation table */
|
||||
HB_SIZE wcTransLen; /* size of unicode character translation table */
|
||||
#endif
|
||||
HB_BOOL Win9X; /* Flag to say if running on Win9X not NT/2000/XP */
|
||||
HB_BOOL AltF4Close; /* Can use Alt+F4 to close application */
|
||||
|
||||
@@ -57,19 +57,20 @@ REQUEST ARRAY
|
||||
CREATE CLASS HBPersistent
|
||||
|
||||
METHOD CreateNew() INLINE Self
|
||||
METHOD LoadFromFile( cFileName ) INLINE ::LoadFromText( hb_MemoRead( cFileName ) )
|
||||
METHOD LoadFromText( cObjectText )
|
||||
METHOD LoadFromFile( cFileName, lIgnoreErrors ) INLINE ::LoadFromText( hb_MemoRead( cFileName ), lIgnoreErrors )
|
||||
METHOD LoadFromText( cObjectText, lIgnoreErrors )
|
||||
METHOD SaveToText( cObjectName, nIndent )
|
||||
METHOD SaveToFile( cFileName ) INLINE hb_MemoWrit( cFileName, ::SaveToText() )
|
||||
|
||||
ENDCLASS
|
||||
|
||||
METHOD LoadFromText( cObjectText ) CLASS HBPersistent
|
||||
METHOD LoadFromText( cObjectText, lIgnoreErrors ) CLASS HBPersistent
|
||||
|
||||
LOCAL nPos
|
||||
LOCAL cLine
|
||||
LOCAL lStart := .t.
|
||||
LOCAL aObjects := { Self }
|
||||
LOCAL bError
|
||||
|
||||
PRIVATE oSelf
|
||||
|
||||
@@ -77,51 +78,59 @@ METHOD LoadFromText( cObjectText ) CLASS HBPersistent
|
||||
RETURN .F.
|
||||
ENDIF
|
||||
|
||||
bError := iif( HB_ISLOGICAL( lIgnoreErrors ) .AND. lIgnoreErrors, ;
|
||||
{ |e| break( e ) }, errorBlock() )
|
||||
|
||||
FOR EACH cLine IN hb_ATokens( StrTran( cObjectText, Chr( 13 ) ), Chr( 10 ) )
|
||||
|
||||
cLine := AllTrim( cLine )
|
||||
|
||||
DO CASE
|
||||
CASE Empty( cLine ) .OR. Left( cLine, 2 ) == "//"
|
||||
/* ignore comments and empty lines */
|
||||
BEGIN SEQUENCE WITH bError
|
||||
|
||||
CASE hb_asciiUpper( LTrim( hb_TokenGet( cLine, 1 ) ) ) == "OBJECT"
|
||||
IF lStart
|
||||
lStart := .F.
|
||||
ELSE
|
||||
DO CASE
|
||||
CASE Empty( cLine ) .OR. Left( cLine, 2 ) == "//"
|
||||
/* ignore comments and empty lines */
|
||||
|
||||
CASE hb_asciiUpper( LTrim( hb_TokenGet( cLine, 1 ) ) ) == "OBJECT"
|
||||
IF lStart
|
||||
lStart := .F.
|
||||
ELSE
|
||||
cLine := SubStr( cLine, At( "::", cLine ) )
|
||||
MEMVAR->oSelf := ATail( aObjects )
|
||||
cLine := StrTran( cLine, "::", "oSelf:",, 1 )
|
||||
cLine := StrTran( cLine, " AS ", " := " ) + "():CreateNew()"
|
||||
AAdd( aObjects, &( cLine ) )
|
||||
ENDIF
|
||||
|
||||
CASE hb_asciiUpper( LTrim( hb_TokenGet( cLine, 1 ) ) ) == "ENDOBJECT"
|
||||
ASize( aObjects, Len( aObjects ) - 1 )
|
||||
|
||||
CASE hb_asciiUpper( LTrim( hb_TokenGet( cLine, 1 ) ) ) == "ARRAY"
|
||||
cLine := SubStr( cLine, At( "::", cLine ) )
|
||||
MEMVAR->oSelf := ATail( aObjects )
|
||||
cLine := StrTran( cLine, "::", "oSelf:",, 1 )
|
||||
cLine := StrTran( cLine, " AS ", " := " ) + "():CreateNew()"
|
||||
AAdd( aObjects, &( cLine ) )
|
||||
ENDIF
|
||||
cLine := StrTran( cLine, " LEN ", " := Array( " ) + " )"
|
||||
&( cLine )
|
||||
|
||||
CASE hb_asciiUpper( LTrim( hb_TokenGet( cLine, 1 ) ) ) == "ENDOBJECT"
|
||||
ASize( aObjects, Len( aObjects ) - 1 )
|
||||
IF Empty( aObjects )
|
||||
EXIT
|
||||
ENDIF
|
||||
|
||||
CASE hb_asciiUpper( LTrim( hb_TokenGet( cLine, 1 ) ) ) == "ARRAY"
|
||||
cLine := SubStr( cLine, At( "::", cLine ) )
|
||||
MEMVAR->oSelf := ATail( aObjects )
|
||||
cLine := StrTran( cLine, "::", "oSelf:",, 1 )
|
||||
cLine := StrTran( cLine, " LEN ", " := Array( " ) + " )"
|
||||
&( cLine )
|
||||
|
||||
CASE Left( cLine, 2 ) == "::"
|
||||
/* fix for older versions */
|
||||
nPos := At( "=", cLine )
|
||||
IF nPos > 0
|
||||
IF !( SubStr( cLine, nPos - 1, 1 ) == ":" )
|
||||
cLine := Stuff( cLine, nPos, 0, ":" )
|
||||
CASE Left( cLine, 2 ) == "::"
|
||||
/* fix for older versions */
|
||||
nPos := At( "=", cLine )
|
||||
IF nPos > 0
|
||||
IF !( SubStr( cLine, nPos - 1, 1 ) == ":" )
|
||||
cLine := Stuff( cLine, nPos, 0, ":" )
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
MEMVAR->oSelf := ATail( aObjects )
|
||||
cLine := StrTran( cLine, "::", "oSelf:",, 1 )
|
||||
&( cLine )
|
||||
MEMVAR->oSelf := ATail( aObjects )
|
||||
cLine := StrTran( cLine, "::", "oSelf:",, 1 )
|
||||
&( cLine )
|
||||
|
||||
ENDCASE
|
||||
ENDCASE
|
||||
|
||||
END SEQUENCE
|
||||
|
||||
IF Empty( aObjects )
|
||||
EXIT
|
||||
ENDIF
|
||||
|
||||
NEXT
|
||||
|
||||
|
||||
Reference in New Issue
Block a user