2011-11-08 12:29 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/src/rtl/gtxwc/gtxwc.h
  * harbour/src/rtl/gtxwc/gtxwc.c
    * minor code cleanup

  * harbour/src/rtl/gttrm/gttrm.c
    + added support for HB_GTI_WINTITLE for XTerm compatible terminals
This commit is contained in:
Przemyslaw Czerpak
2011-11-08 11:29:25 +00:00
parent 52a112c016
commit c779d18252
4 changed files with 70 additions and 7 deletions

View File

@@ -16,6 +16,14 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-11-08 12:29 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/src/rtl/gtxwc/gtxwc.h
* harbour/src/rtl/gtxwc/gtxwc.c
* minor code cleanup
* harbour/src/rtl/gttrm/gttrm.c
+ added support for HB_GTI_WINTITLE for XTerm compatible terminals
2011-11-07 15:23 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbqt/qtgui/hbqtgui.ch
+ Added: QAbstractSpinBox_* constants, extracted by Luiqi Ferraris.

View File

@@ -69,6 +69,7 @@
#include "hbgtcore.h"
#include "hbinit.h"
#include "hbapicdp.h"
#include "hbapistr.h"
#include "hbapiitm.h"
#include "hbapifs.h"
#include "hbdate.h"
@@ -323,6 +324,7 @@ typedef struct _HB_GTTRM
HB_BOOL fPosAnswer;
PHB_CODEPAGE cdpHost;
PHB_CODEPAGE cdpTerm;
PHB_CODEPAGE cdpBox;
PHB_CODEPAGE cdpIn;
@@ -335,6 +337,8 @@ typedef struct _HB_GTTRM
int colors[ 16 ];
char * szTitle;
int iOutBufSize;
int iOutBufIndex;
char * pOutBuf;
@@ -1737,6 +1741,15 @@ static void hb_gt_trm_XtermSetAttributes( PHB_GTTRM pTerm, int iAttr )
}
}
static void hb_gt_trm_XtermSetTitle( PHB_GTTRM pTerm, const char * szTitle )
{
HB_TRACE(HB_TR_DEBUG, ("hb_gt_trm_XtermSetTitle(%p,%s)", pTerm, szTitle));
hb_gt_trm_termOut( pTerm, "\033]0;", 4 );
if( szTitle )
hb_gt_trm_termOut( pTerm, szTitle, strlen( szTitle ) );
hb_gt_trm_termOut( pTerm, "\007", 1 );
}
/*
@@ -2226,6 +2239,17 @@ static void hb_gt_trm_ResetPalette( PHB_GTTRM pTerm )
}
}
static void hb_gt_trm_SetTitle( PHB_GTTRM pTerm, const char * szTitle )
{
HB_TRACE(HB_TR_DEBUG, ("hb_gt_trm_SetTitle(%p,%d)", pTerm, iIndex));
if( pTerm->terminal_type == TERM_XTERM ||
( pTerm->terminal_ext & TERM_PUTTY ) )
{
hb_gt_trm_XtermSetTitle( pTerm, szTitle );
}
}
static void hb_gt_trm_SetKeyTrans( PHB_GTTRM pTerm, PHB_CODEPAGE cdpTerm, PHB_CODEPAGE cdpHost )
{
int i;
@@ -2295,6 +2319,7 @@ static void hb_gt_trm_SetDispTrans( PHB_GTTRM pTerm, PHB_CODEPAGE cdpHost, PHB_C
}
}
pTerm->cdpHost = cdpHost;
pTerm->cdpTerm = cdpTerm;
pTerm->cdpBox = box ? cdpHost : hb_cdpFind( "EN" );
}
@@ -3590,6 +3615,7 @@ static HB_BOOL hb_gt_trm_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
{
PHB_GTTRM pTerm;
const char * szVal;
void * hVal;
int iVal;
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_Info(%p,%d,%p)", pGT, iType, pInfo ) );
@@ -3640,6 +3666,28 @@ static HB_BOOL hb_gt_trm_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
}
break;
case HB_GTI_WINTITLE:
if( pTerm->fUTF8 )
pInfo->pResult = hb_itemPutStrUTF8( pInfo->pResult, pTerm->szTitle );
else
pInfo->pResult = hb_itemPutStr( pInfo->pResult, pTerm->cdpTerm, pTerm->szTitle );
if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING )
{
if( pTerm->fUTF8 )
szVal = hb_itemGetStrUTF8( pInfo->pNewVal, &hVal, NULL );
else
szVal = hb_itemGetStr( pInfo->pNewVal, pTerm->cdpTerm, &hVal, NULL );
if( pTerm->szTitle )
hb_xfree( pTerm->szTitle );
pTerm->szTitle = ( szVal && *szVal ) ? hb_strdup( szVal ) : NULL;
hb_gt_trm_SetTitle( pTerm, pTerm->szTitle );
hb_gt_trm_termFlush( pTerm );
hb_strfree( hVal );
}
break;
case HB_GTI_PALETTE:
if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC )
{

View File

@@ -83,7 +83,8 @@ static const int s_mousePressKeys[ XWC_MAX_BUTTONS ] = { K_LBUTTONDOWN, K_MBU
static const int s_mouseReleaseKeys[ XWC_MAX_BUTTONS ] = { K_LBUTTONUP, K_MBUTTONUP, K_RBUTTONUP };
static const int s_mouseDblPressKeys[ XWC_MAX_BUTTONS ] = { K_LDBLCLK, K_MDBLCLK, K_RDBLCLK , K_MWFORWARD, K_MWBACKWARD };
typedef struct tag_ClipKeyCode {
typedef struct
{
int key;
int alt_key;
int ctrl_key;
@@ -261,7 +262,7 @@ static Atom s_atomText;
static Atom s_atomCompoundText;
typedef struct tag_rect
typedef struct
{
int top;
int left;
@@ -269,7 +270,7 @@ typedef struct tag_rect
int bottom;
} XWC_RECT;
typedef struct tag_modifiers
typedef struct
{
HB_BOOL bCtrl;
HB_BOOL bAlt;
@@ -284,7 +285,7 @@ typedef struct
HB_BOOL set;
} WND_COLORS;
typedef struct tag_x_wnddef
typedef struct
{
PHB_GT pGT;
@@ -345,8 +346,10 @@ typedef struct tag_x_wnddef
using build in font ones */
HB_BOOL fDrawBox;
#ifdef HB_XWC_USE_LOCALE
/* locale set to UTF-8 */
HB_BOOL fUTF8;
#endif
/* CodePage support */
PHB_CODEPAGE hostCDP;
/* PHB_CODEPAGE outCDP; */
@@ -3594,7 +3597,7 @@ static void hb_gt_xwc_RestoreArea( PXWND_DEF wnd,
static void hb_gt_xwc_InvalidateChar( PXWND_DEF wnd,
int left, int top, int right, int bottom )
{
if( wnd->fInvalidChr == HB_FALSE )
if( ! wnd->fInvalidChr )
{
wnd->rInvalidChr.top = top;
wnd->rInvalidChr.left = left;
@@ -4092,10 +4095,11 @@ static void hb_gt_xwc_RequestSelection( PXWND_DEF wnd )
/* *********************************************************************** */
#ifdef HB_XWC_USE_LOCALE
static HB_BOOL hb_gt_xwc_isUTF8( void )
{
HB_BOOL fUTF8 = HB_FALSE;
const char * szLang = getenv( "LANG" );
const char * szLang = setlocale( LC_CTYPE, NULL );
if( szLang )
{
@@ -4111,6 +4115,7 @@ static HB_BOOL hb_gt_xwc_isUTF8( void )
return fUTF8;
}
#endif
/* *********************************************************************** */
@@ -4130,7 +4135,9 @@ static PXWND_DEF hb_gt_xwc_CreateWndDef( PHB_GT pGT )
wnd->fResizable = HB_TRUE;
wnd->fClosable = HB_TRUE;
wnd->fWinResize = HB_FALSE;
#ifdef HB_XWC_USE_LOCALE
wnd->fUTF8 = hb_gt_xwc_isUTF8();
#endif
wnd->hostCDP = hb_vmCDP();
wnd->utf8CDP = hb_cdpFindExt( "UTF8" );
if( wnd->boxCDP == NULL )

View File

@@ -338,7 +338,7 @@ typedef enum
CH_POLY /* character built by polygon */
} XWC_CharType;
typedef struct tag_XWC_CharTrans
typedef struct
{
XWC_CharType type;
union