2009-01-15 13:48 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/vm/set.c
    * do not check for HVM stack existence in ST HVM to avoid compiler
      warning

  * harbour/contrib/hbct/ctextern.ch
    ! removed HB_GT_CTW and HB_GT_CTW_DEFAULT added by mistake
      It caused GPF at HVM startup because CTW was register as
      default GT driver 

  * harbour/contrib/hbbmcdx/bmdbfcdx.c
    ! added missing hbstack.h
    ! fixed accessing RDD node structure

  * harbour/contrib/hbct/ctwin.h
  * harbour/contrib/hbct/ctwin.c
  * harbour/contrib/hbct/ctwfunc.c
    + extended internal CTW API functions to hide/show window, create
      new window without displaying it, selecting window without moving
      it to top level, changing existing window shadow attribute.
    + added support user window levels controlled by user
      (BOTTOM, DEFAULT, TOP)
    + added support for selecting client area (possible to update square)
      in each CT Window
    It's a work in progress and the above modifications will be updated yet.
This commit is contained in:
Przemyslaw Czerpak
2009-01-15 12:45:16 +00:00
parent 86149957de
commit 4967de721b
7 changed files with 445 additions and 80 deletions

View File

@@ -8,6 +8,32 @@
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2009-01-15 13:48 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/vm/set.c
* do not check for HVM stack existence in ST HVM to avoid compiler
warning
* harbour/contrib/hbct/ctextern.ch
! removed HB_GT_CTW and HB_GT_CTW_DEFAULT added by mistake
It caused GPF at HVM startup because CTW was register as
default GT driver
* harbour/contrib/hbbmcdx/bmdbfcdx.c
! added missing hbstack.h
! fixed accessing RDD node structure
* harbour/contrib/hbct/ctwin.h
* harbour/contrib/hbct/ctwin.c
* harbour/contrib/hbct/ctwfunc.c
+ extended internal CTW API functions to hide/show window, create
new window without displaying it, selecting window without moving
it to top level, changing existing window shadow attribute.
+ added support user window levels controlled by user
(BOTTOM, DEFAULT, TOP)
+ added support for selecting client area (possible to update square)
in each CT Window
It's a work in progress and the above modifications will be updated yet.
2009-01-15 04:40 UTC+0200 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt)
* harbour/source/compiler/harbour.yyc
* harbour/source/compiler/harbour.yyh

View File

@@ -91,15 +91,13 @@
#include "hbapierr.h"
#include "hbapilng.h"
#include "hbvm.h"
#include "hbstack.h"
#include "hbset.h"
#include "hbbmcdx.h"
#include "hbmath.h"
#include "rddsys.ch"
#include "hbregex.h"
#define CDXNODE_DATA( p ) ( ( LPDBFDATA ) ( p )->lpvCargo )
#define CDXAREA_DATA( p ) CDXNODE_DATA( SELF_RDDNODE( p ) )
#ifndef HB_CDP_SUPPORT_OFF
/* for nation sorting support */
#include "hbapicdp.h"
@@ -7653,14 +7651,14 @@ static ERRCODE hb_cdxOpen( CDXAREAP pArea, LPDBOPENINFO pOpenInfo )
}
/* open (production) structural index */
if( CDXAREA_DATA( pArea )->fStrictStruct ? pArea->fHasTags : hb_setGetAutOpen() )
if( DBFAREA_DATA( pArea )->fStrictStruct ? pArea->fHasTags : hb_setGetAutOpen() )
{
char szFileName[ _POSIX_PATH_MAX + 1 ];
pArea->fHasTags = FALSE;
hb_cdxCreateFName( pArea, NULL, NULL, szFileName, NULL );
if ( hb_spFile( ( BYTE * ) szFileName, NULL ) ||
CDXAREA_DATA( pArea )->fStrictStruct )
DBFAREA_DATA( pArea )->fStrictStruct )
{
DBORDERINFO pOrderInfo;
@@ -7870,7 +7868,7 @@ static ERRCODE hb_cdxOrderListClear( CDXAREAP pArea )
if ( FAST_GOCOLD( ( AREAP ) pArea ) == FAILURE )
return FAILURE;
hb_cdxOrdListClear( pArea, !( CDXAREA_DATA( pArea )->fStrictStruct ?
hb_cdxOrdListClear( pArea, !( DBFAREA_DATA( pArea )->fStrictStruct ?
pArea->fHasTags : hb_setGetAutOpen() ), NULL );
pArea->uiTag = 0;
@@ -7893,7 +7891,7 @@ static ERRCODE hb_cdxOrderListDelete( CDXAREAP pArea, LPDBORDERINFO pOrderInfo )
hb_cdxCreateFName( pArea, hb_itemGetCPtr( pOrderInfo->atomBagName ), &fProd,
szFileName, szTagName );
if( fProd && ( CDXAREA_DATA( pArea )->fStrictStruct ?
if( fProd && ( DBFAREA_DATA( pArea )->fStrictStruct ?
pArea->fHasTags : hb_setGetAutOpen() ) )
pIndex = NULL;
else
@@ -8171,7 +8169,7 @@ static ERRCODE hb_cdxOrderCreate( CDXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo
if ( !pArea->lpdbOrdCondInfo ||
( pArea->lpdbOrdCondInfo->fAll && !pArea->lpdbOrdCondInfo->fAdditive ) )
hb_cdxOrdListClear( pArea, !( CDXAREA_DATA( pArea )->fStrictStruct ?
hb_cdxOrdListClear( pArea, !( DBFAREA_DATA( pArea )->fStrictStruct ?
pArea->fHasTags : hb_setGetAutOpen() ), NULL );
pIndex = hb_cdxFindBag( pArea, szFileName );
@@ -8290,7 +8288,7 @@ static ERRCODE hb_cdxOrderCreate( CDXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo
if ( pArea->lpdbOrdCondInfo && ( !pArea->lpdbOrdCondInfo->fAll &&
!pArea->lpdbOrdCondInfo->fAdditive ) )
{
hb_cdxOrdListClear( pArea, !( CDXAREA_DATA( pArea )->fStrictStruct ?
hb_cdxOrdListClear( pArea, !( DBFAREA_DATA( pArea )->fStrictStruct ?
pArea->fHasTags : hb_setGetAutOpen() ), NULL );
}
hb_cdxIndexUnLockWrite( pIndex );
@@ -8299,7 +8297,7 @@ static ERRCODE hb_cdxOrderCreate( CDXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo
{
pArea->fHasTags = TRUE;
if ( !pArea->fReadonly && ( pArea->dbfHeader.bHasTags & 0x01 ) == 0 &&
( hb_setGetAutOpen() || CDXAREA_DATA( pArea )->fStrictStruct ) )
( hb_setGetAutOpen() || DBFAREA_DATA( pArea )->fStrictStruct ) )
SELF_WRITEDBHEADER( ( AREAP ) pArea );
}
else
@@ -8367,7 +8365,7 @@ static ERRCODE hb_cdxOrderDestroy( CDXAREAP pArea, LPDBORDERINFO pOrderInfo )
pArea->fHasTags = FALSE;
if ( !pArea->fReadonly && ( pArea->dbfHeader.bHasTags & 0x01 ) != 0 &&
( hb_setGetAutOpen() ||
CDXAREA_DATA( pArea )->fStrictStruct ) )
DBFAREA_DATA( pArea )->fStrictStruct ) )
SELF_WRITEDBHEADER( ( AREAP ) pArea );
}
}
@@ -9296,7 +9294,7 @@ static ERRCODE hb_cdxRddInfo( LPRDDNODE pRDD, USHORT uiIndex, ULONG ulConnect, P
HB_TRACE(HB_TR_DEBUG, ("hb_cdxRddInfo(%p, %hu, %lu, %p)", pRDD, uiIndex, ulConnect, pItem));
pData = ( LPDBFDATA ) pRDD->lpvCargo;
pData = DBFNODE_DATA( pRDD );
switch( uiIndex )
{

View File

@@ -194,8 +194,6 @@ EXTERNAL GETPREC
EXTERNAL GETSECRET
EXTERNAL GETVOLINFO
EXTERNAL _HB_CTDSPTIME
EXTERNAL HB_GT_CTW
EXTERNAL HB_GT_CTW_DEFAULT
EXTERNAL INFINITY
EXTERNAL INVERTATTR
EXTERNAL INVERTWIN

View File

@@ -151,15 +151,19 @@ HB_FUNC( WOPEN )
{
int iColor;
iColor = hb_ctColorParam( 6, 0 ); /* Harbour extension */
/* 6-th (color) and 7-th (lVisible) parameters are Harbour extensions */
iColor = hb_ctColorParam( 6, -1 ); /* Harbour extension */
hb_retni( hb_ctwCreateWindow( hb_parni( 1 ), hb_parni( 2 ),
hb_parni( 3 ), hb_parni( 4 ),
hb_parl( 5 ), iColor ) );
hb_parl( 5 ), iColor,
!ISLOG( 7 ) || hb_parl( 7 ) ) );
}
HB_FUNC( WCLOSE )
{
hb_retni( hb_ctwCloseWindow( hb_ctwCurrentWindow() ) );
/* 1-st parameter (window handle) is Harbour extension */
hb_retni( hb_ctwCloseWindow( ISNUM( 1 ) ? hb_parni( 1 ) :
hb_ctwCurrentWindow() ) );
}
HB_FUNC( WACLOSE )
@@ -169,7 +173,9 @@ HB_FUNC( WACLOSE )
HB_FUNC( WSELECT )
{
hb_retni( ISNUM( 1 ) ? hb_ctwSelectWindow( hb_parni( 1 ) ) :
/* 2-nd parameter (fBringToTop) is Harbour extension */
hb_retni( ISNUM( 1 ) ? hb_ctwSelectWindow( hb_parni( 1 ),
!ISLOG( 2 ) || hb_parl( 2 ) ) :
hb_ctwCurrentWindow() );
}
@@ -219,11 +225,11 @@ HB_FUNC( WBOX )
{
szBoxBuf[ 8 ] = ( char ) hb_gtGetClearChar();
}
szBoxBuf[ 9 ] = '0';
szBoxBuf[ 9 ] = '\0';
szBox = szBoxBuf;
}
iColor = hb_ctColorParam( 2, 0 ); /* Harbour extension */
iColor = hb_ctColorParam( 2, -1 ); /* Harbour extension */
hb_retni( hb_ctwAddWindowBox( hb_ctwCurrentWindow(), szBox, iColor ) );
}
@@ -356,3 +362,38 @@ HB_FUNC( HBCT_MAXCOL ) /* Return the maximum screen/window column number (zero o
else
hb_retni( hb_gtMaxCol() );
}
/* Temporary Harbour extensions to test some extended CTW functionality
*/
/* Harbour extension */
HB_FUNC( WHIDE )
{
hb_ctwVisible( ISNUM( 1 ) ? hb_parni( 1 ) : hb_ctwCurrentWindow(),
HB_CTW_HIDDEN );
}
/* Harbour extension */
HB_FUNC( WSHOW )
{
hb_ctwVisible( ISNUM( 1 ) ? hb_parni( 1 ) : hb_ctwCurrentWindow(),
HB_CTW_VISIBLE );
}
/* Harbour extension */
HB_FUNC( WSHADOW )
{
int iAttr;
iAttr = ISNUM( 1 ) ? hb_parni( 1 ) : -2;
hb_retni( hb_ctwSetWindowShadow( hb_ctwCurrentWindow(), iAttr ) );
}
/* Harbour extension */
HB_FUNC( WLEVEL )
{
int iLevel;
iLevel = ISNUM( 1 ) ? hb_parni( 1 ) : HB_CTW_UNDEF;
hb_retni( hb_ctwSetWindowLevel( hb_ctwCurrentWindow(), iLevel ) );
}

View File

@@ -79,6 +79,7 @@ typedef struct
int iHandle;
BOOL fHidden;
int iLevel;
int iShadowAttr;
int iCursorStyle;
@@ -91,6 +92,12 @@ typedef struct
int iBottomMargin;
int iRightMargin;
BOOL fClip;
int iCliTop;
int iCliLeft;
int iCliBottom;
int iCliRight;
int iHeight;
int iWidth;
@@ -335,40 +342,157 @@ static int hb_ctw_CurrentWindow( PHB_GTCTW pCTW )
return pCTW->iCurrWindow;
}
static int hb_ctw_SelectWindow( PHB_GTCTW pCTW, int iWindow )
static int hb_ctw_SelectWindow( PHB_GTCTW pCTW, int iWindow, BOOL fToTop )
{
HB_TRACE(HB_TR_DEBUG, ("hb_ctw_SelectWindow(%p,%d)", pCTW, iWindow));
HB_TRACE(HB_TR_DEBUG, ("hb_ctw_SelectWindow(%p,%d,%d)", pCTW, iWindow, fToTop));
if( iWindow == 0 )
pCTW->iCurrWindow = iWindow;
else if( iWindow != pCTW->iCurrWindow &&
iWindow > 0 && iWindow <= pCTW->iMaxWindow &&
pCTW->iCurrWindow = 0;
else if( iWindow > 0 && iWindow <= pCTW->iMaxWindow &&
pCTW->windows[ iWindow ] != NULL )
{
pCTW->iCurrWindow = iWindow;
if( iWindow != pCTW->windowStack[ pCTW->iOpenWindows - 1 ] )
if( fToTop )
{
int i;
int i, iPos;
for( i = 0; i < pCTW->iOpenWindows; ++i )
/* update window level */
i = pCTW->iOpenWindows - 1;
while( i >= 0 && pCTW->windowStack[ i ] != iWindow )
--i;
if( i >= 0 && i < pCTW->iOpenWindows - 1 )
{
if( pCTW->windowStack[ i ] == iWindow )
break;
iPos = i;
while( i < pCTW->iOpenWindows - 1 &&
pCTW->windows[ pCTW->windowStack[ i + 1 ] ]->iLevel <=
pCTW->windows[ iWindow ]->iLevel )
{
pCTW->windowStack[ i ] = pCTW->windowStack[ i + 1 ];
++i;
}
pCTW->windowStack[ i ] = iWindow;
if( iPos != i && !pCTW->windows[ iWindow ]->fHidden )
{
/* INFO: CT effectively calls hb_ctw_RemapAllWindows() here */
if( i < pCTW->iOpenWindows - 1 )
hb_ctw_RemapAllWindows( pCTW );
else
hb_ctw_WindowMap( pCTW, iWindow, TRUE );
}
}
while( i < pCTW->iOpenWindows - 1 )
{
pCTW->windowStack[ i ] = pCTW->windowStack[ i + 1 ];
++i;
}
pCTW->windowStack[ pCTW->iOpenWindows - 1 ] = iWindow;
/* INFO: CT effectively calls hb_ctw_RemapAllWindows() here */
hb_ctw_WindowMap( pCTW, iWindow, TRUE );
}
}
return pCTW->iCurrWindow;
}
static int hb_ctw_Visible( PHB_GTCTW pCTW, int iWindow, int iVisible )
{
int iResult = HB_CTW_UNDEF;
HB_TRACE(HB_TR_DEBUG, ("hb_ctw_Visible(%p,%d,%d)", pCTW, iWindow, iVisible));
if( iWindow == 0 )
iResult = HB_CTW_VISIBLE;
else if( iWindow > 0 && iWindow <= pCTW->iMaxWindow &&
pCTW->windows[ iWindow ] != NULL )
{
PHB_CT_WND pWnd = pCTW->windows[ iWindow ];
iResult = pWnd->fHidden ? HB_CTW_HIDDEN : HB_CTW_VISIBLE;
if( iVisible != HB_CTW_UNDEF &&
pWnd->fHidden != ( iVisible == HB_CTW_HIDDEN ) )
{
pWnd->fHidden = ( iVisible == HB_CTW_HIDDEN );
hb_ctw_RemapAllWindows( pCTW );
}
}
return iResult;
}
static int hb_ctw_SetWindowLevel( PHB_GTCTW pCTW, int iWindow, int iLevel )
{
int iResult = -1, iPos, i;
BOOL fToTop;
HB_TRACE(HB_TR_DEBUG, ("hb_ctw_SetWindowLevel(%p,%d,%d)", pCTW, iWindow, iLevel));
if( iWindow > 0 && iWindow <= pCTW->iMaxWindow &&
pCTW->windows[ iWindow ] != NULL )
{
PHB_CT_WND pWnd = pCTW->windows[ iWindow ];
iResult = pWnd->iLevel;
if( iLevel >= HB_CTW_BOTTOM && iLevel <= HB_CTW_TOP &&
pWnd->iLevel != iLevel )
{
/* update window level */
fToTop = pWnd->iLevel < iLevel;
pWnd->iLevel = iLevel;
i = pCTW->iOpenWindows - 1;
if( i > 0 )
{
while( i >= 0 && pCTW->windowStack[ i ] != iWindow )
--i;
if( i >= 0 )
{
iPos = i;
if( fToTop )
{
while( i < pCTW->iOpenWindows - 1 && pWnd->iLevel >=
pCTW->windows[ pCTW->windowStack[ i + 1 ] ]->iLevel )
{
pCTW->windowStack[ i ] = pCTW->windowStack[ i + 1 ];
++i;
}
pCTW->windowStack[ i ] = iWindow;
}
else
{
while( i > 0 && pWnd->iLevel <=
pCTW->windows[ pCTW->windowStack[ i - 1 ] ]->iLevel )
{
pCTW->windowStack[ i ] = pCTW->windowStack[ i - 1 ];
--i;
}
pCTW->windowStack[ i ] = iWindow;
}
if( !pWnd->fHidden && iPos != i )
hb_ctw_RemapAllWindows( pCTW );
}
}
}
}
return iResult;
}
static int hb_ctw_SetWindowShadow( PHB_GTCTW pCTW, int iWindow, int iAttr )
{
int iResult = -1;
HB_TRACE(HB_TR_DEBUG, ("hb_ctw_SetWindowShadow(%p,%d,%d)", pCTW, iWindow, iAttr));
if( iWindow > 0 && iWindow <= pCTW->iMaxWindow &&
pCTW->windows[ iWindow ] != NULL )
{
PHB_CT_WND pWnd = pCTW->windows[ iWindow ];
iResult = pWnd->iShadowAttr;
if( iAttr >= -1 && pWnd->iShadowAttr != iAttr )
{
pWnd->iShadowAttr = iAttr;
if( !pWnd->fHidden )
hb_ctw_RemapAllWindows( pCTW );
}
}
return iResult;
}
static int hb_ctw_MaxWindow( PHB_GTCTW pCTW )
{
int i, iMaxHandle = 0;
@@ -384,7 +508,7 @@ static int hb_ctw_MaxWindow( PHB_GTCTW pCTW )
return iMaxHandle;
}
static int hb_ctw_CreateWindow( PHB_GTCTW pCTW, int iTop, int iLeft, int iBottom, int iRight, BOOL fClear, int iColor )
static int hb_ctw_CreateWindow( PHB_GTCTW pCTW, int iTop, int iLeft, int iBottom, int iRight, BOOL fClear, int iColor, BOOL fVisible )
{
PHB_CT_WND pWnd;
BYTE bAttr, bColor;
@@ -392,7 +516,7 @@ static int hb_ctw_CreateWindow( PHB_GTCTW pCTW, int iTop, int iLeft, int iBottom
int iRow, iCol, iHeight, iWidth, iTmp;
long lIndex;
HB_TRACE(HB_TR_DEBUG, ("hb_ctw_CreateWindow(%p,%d,%d,%d,%d,%d,%d)", pCTW, iTop, iLeft, iBottom, iRight, (int) fClear, iColor));
HB_TRACE(HB_TR_DEBUG, ("hb_ctw_CreateWindow(%p,%d,%d,%d,%d,%d,%d,%d)", pCTW, iTop, iLeft, iBottom, iRight, (int) fClear, iColor, (int) fVisible));
if( pCTW->iOpenWindows == pCTW->iMaxWindow )
{
@@ -461,7 +585,8 @@ static int hb_ctw_CreateWindow( PHB_GTCTW pCTW, int iTop, int iLeft, int iBottom
pWnd = ( PHB_CT_WND ) hb_xgrab( sizeof( HB_CT_WND ) );
memset( pWnd, 0, sizeof( HB_CT_WND ) );
pWnd->fHidden = FALSE;
pWnd->fHidden = !fVisible;
pWnd->iLevel = HB_CTW_DEFAULT;
pWnd->iShadowAttr = pCTW->iShadowAttr;
pWnd->iCursorStyle = HB_GTSELF_GETCURSORSTYLE( pCTW->pGT );
@@ -478,7 +603,7 @@ static int hb_ctw_CreateWindow( PHB_GTCTW pCTW, int iTop, int iLeft, int iBottom
if( pWnd->iShadowAttr >= 0 )
fClear = TRUE;
bAttr = 0;
bColor = iColor ? ( BYTE ) iColor : ( BYTE ) HB_GTSELF_GETCOLOR( pCTW->pGT );
bColor = iColor >= 0 ? ( BYTE ) iColor : ( BYTE ) HB_GTSELF_GETCOLOR( pCTW->pGT );
usChar = ( USHORT ) HB_GTSELF_GETCLEARCHAR( pCTW->pGT );
lIndex = 0;
@@ -507,10 +632,23 @@ static int hb_ctw_CreateWindow( PHB_GTCTW pCTW, int iTop, int iLeft, int iBottom
pWnd->iHandle = iTmp;
pCTW->windows[ pWnd->iHandle ] = pWnd;
pCTW->windowStack[ pCTW->iOpenWindows++ ] = pWnd->iHandle;
/* update window level */
iTmp = pCTW->iOpenWindows++;
while( iTmp > 0 && pCTW->windows[ pCTW->windowStack[ iTmp - 1 ] ]->iLevel >
pWnd->iLevel )
{
pCTW->windowStack[ iTmp ] = pCTW->windowStack[ iTmp - 1 ];
--iTmp;
}
pCTW->windowStack[ iTmp ] = pWnd->iHandle;
pCTW->iCurrWindow = pWnd->iHandle;
hb_ctw_WindowMap( pCTW, pWnd->iHandle, TRUE );
if( !pWnd->fHidden )
{
if( iTmp < pCTW->iOpenWindows - 1 )
hb_ctw_RemapAllWindows( pCTW );
else
hb_ctw_WindowMap( pCTW, pWnd->iHandle, TRUE );
}
return pWnd->iHandle;
}
@@ -684,6 +822,46 @@ static int hb_ctw_ChangeMargins( PHB_GTCTW pCTW, int iWindow, int iTop, int iLef
return -1;
}
static int hb_ctw_SetWindowClip( PHB_GTCTW pCTW, int iWindow, int iTop, int iLeft, int iBottom, int iRight )
{
HB_TRACE(HB_TR_DEBUG, ("hb_ctw_SetWindowClip(%p,%d,%d,%d,%d,%d)", pCTW, iWindow, iTop, iLeft, iBottom, iRight));
if( iWindow > 0 && iWindow <= pCTW->iOpenWindows )
{
PHB_CT_WND pWnd = pCTW->windows[ iWindow ];
if( pWnd )
{
if( iTop < 0 )
iTop = 0;
if( iLeft < 0 )
iLeft = 0;
if( iBottom >= pWnd->iHeight )
iBottom = pWnd->iHeight - 1;
if( iRight >= pWnd->iWidth )
iRight = pWnd->iWidth - 1;
if( iTop > iBottom || iLeft > iRight ||
( iTop == 0 && iLeft == 0 &&
iBottom == pWnd->iHeight - 1 && iRight == pWnd->iWidth -1 ) )
{
pWnd->fClip = FALSE;
}
else
{
pWnd->fClip = TRUE;
pWnd->iCliTop = iTop;
pWnd->iCliLeft = iLeft;
pWnd->iCliBottom = iBottom;
pWnd->iCliRight = iRight;
}
return iWindow;
}
}
return -1;
}
static int hb_ctw_GetWindowCords( PHB_GTCTW pCTW, int iWindow, BOOL fCenter, int * piTop, int * piLeft, int * piBottom, int * piRight )
{
HB_TRACE(HB_TR_DEBUG, ("hb_ctw_GetWindowCords(%p,%d,%d,%p,%p,%p,%p)", pCTW, iWindow, (int) fCenter, piTop, piLeft, piBottom, piRight));
@@ -779,7 +957,7 @@ static int hb_ctw_AddWindowBox( PHB_GTCTW pCTW, int iWindow, BYTE * szBox, int i
if( iMaxRow > 1 && iMaxCol > 1 )
{
if( iColor == 0 )
if( iColor < 0 )
iColor = HB_GTSELF_GETCOLOR( pCTW->pGT );
HB_GTSELF_BOX( pCTW->pGT, 0, 0, iMaxRow, iMaxCol, szBox, ( BYTE ) iColor );
if( iWindow > 0 && iWindow <= pCTW->iOpenWindows &&
@@ -797,6 +975,39 @@ static int hb_ctw_AddWindowBox( PHB_GTCTW pCTW, int iWindow, BYTE * szBox, int i
return -1;
}
static int hb_ctw_SwapWindows( PHB_GTCTW pCTW, int iWindow1, int iWindow2 )
{
HB_TRACE(HB_TR_DEBUG, ("hb_ctw_AddWindowBox(%p,%d,%d)", pCTW, iWindow1, iWindow2));
if( iWindow1 > 0 && iWindow1 <= pCTW->iOpenWindows &&
pCTW->windows[ iWindow1 ] != NULL &&
iWindow2 > 0 && iWindow2 <= pCTW->iOpenWindows &&
pCTW->windows[ iWindow2 ] != NULL )
{
PHB_CT_WND pWnd;
int iLevel;
BOOL fHidden;
pWnd = pCTW->windows[ iWindow1 ];
pCTW->windows[ iWindow1 ] = pCTW->windows[ iWindow2 ];
pCTW->windows[ iWindow2 ] = pWnd;
iLevel = pWnd->iLevel;
pWnd->iLevel = pCTW->windows[ iWindow1 ]->iLevel;
pCTW->windows[ iWindow1 ]->iLevel = iLevel;
fHidden = pWnd->fHidden;
pWnd->fHidden = pCTW->windows[ iWindow1 ]->fHidden;
pCTW->windows[ iWindow1 ]->fHidden = fHidden;
if( !fHidden || !pWnd->fHidden )
hb_ctw_RemapAllWindows( pCTW );
return iWindow1;
}
return -1;
}
/* ********************************************************************** */
static void hb_ctw_Init( PHB_GTCTW pCTW )
@@ -1257,19 +1468,28 @@ static void hb_ctw_gt_GetScrCursor( PHB_GT pGT, int * piRow, int * piCol, int *
HB_TRACE(HB_TR_DEBUG, ("hb_ctw_gt_GetScrCursor(%p,%p,%p,%p)", pGT, piRow, piCol, piStyle));
HB_GTSUPER_GETSCRCURSOR( pGT, piRow, piCol, piStyle );
pCTW = HB_GTCTW_GET( pGT );
HB_GTSUPER_GETSCRCURSOR( pGT, piRow, piCol, piStyle );
if( pCTW->iCurrWindow > 0 )
{
PHB_CT_WND pWnd = pCTW->windows[ pCTW->iCurrWindow ];
*piRow += pWnd->iFirstRow +
pWnd->iTopMargin;
*piCol += pWnd->iFirstCol +
pWnd->iLeftMargin;
if( *piStyle != SC_NONE &&
( *piRow < pCTW->iBoardTop || *piRow > pCTW->iBoardBottom ||
*piCol < pCTW->iBoardLeft || *piCol > pCTW->iBoardRight ) )
*piStyle = SC_NONE;
if( *piStyle != SC_NONE )
{
if( *piRow < pCTW->iBoardTop || *piRow > pCTW->iBoardBottom ||
*piCol < pCTW->iBoardLeft || *piCol > pCTW->iBoardRight )
*piStyle = SC_NONE;
else
{
long lIndex = ( long ) *piRow * pCTW->iMapWidth + *piCol;
if( pCTW->pWindowMap[ lIndex ] != pCTW->iCurrWindow )
*piStyle = SC_NONE;
}
}
}
}
@@ -1282,19 +1502,14 @@ static BOOL hb_ctw_gt_GetScrChar( PHB_GT pGT, int iRow, int iCol,
HB_TRACE(HB_TR_DEBUG, ("hb_ctw_gt_GetScrChar(%p,%d,%d,%p,%p,%p)", pGT, iRow, iCol, pbColor, pbAttr, pusChar));
pCTW = HB_GTCTW_GET( pGT );
iWindow = pCTW->iCurrWindow;
iShadow = 0;
if( pCTW->iOpenWindows > 0 )
iWindow = iShadow = 0;
if( pCTW->iOpenWindows > 0 &&
iRow >= pCTW->iBoardTop && iRow <= pCTW->iBoardBottom &&
iCol >= pCTW->iBoardLeft && iCol <= pCTW->iBoardRight )
{
if( iRow < pCTW->iBoardTop || iRow > pCTW->iBoardBottom ||
iCol < pCTW->iBoardLeft || iCol > pCTW->iBoardRight )
iWindow = 0;
else
{
long lIndex = ( long ) iRow * pCTW->iMapWidth + iCol;
iWindow = pCTW->pWindowMap[ lIndex ];
iShadow = pCTW->pShadowMap[ lIndex ];
}
long lIndex = ( long ) iRow * pCTW->iMapWidth + iCol;
iWindow = pCTW->pWindowMap[ lIndex ];
iShadow = pCTW->pShadowMap[ lIndex ];
}
if( iWindow > 0 )
@@ -1414,6 +1629,10 @@ static BOOL hb_ctw_gt_PutChar( PHB_GT pGT, int iRow, int iCol,
iWndHeight = pWnd->iWidth;
iWndWidth = pWnd->iWidth;
}
else if( pWnd->fClip &&
( iRow < pWnd->iCliTop || iCol < pWnd->iCliLeft ||
iRow > pWnd->iCliBottom || iCol > pWnd->iCliRight ) )
return TRUE;
else
{
iWndRow = iRow + pWnd->iTopMargin;
@@ -1423,9 +1642,8 @@ static BOOL hb_ctw_gt_PutChar( PHB_GT pGT, int iRow, int iCol,
iWndHeight = pWnd->iHeight - pWnd->iBottomMargin;
iWndWidth = pWnd->iWidth - pWnd->iRightMargin;
}
if( iWndCol >= 0 && iWndRow >= 0 &&
iWndRow < iWndHeight &&
iWndCol < iWndWidth )
if( iWndRow >= 0 && iWndCol >= 0 &&
iWndRow < iWndHeight && iWndCol < iWndWidth )
{
long lIndex = ( long ) iWndRow * pWnd->iWidth + iWndCol;
@@ -1488,7 +1706,7 @@ static BOOL hb_ctw_gt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
{
BOOL fResult;
hb_ctw_SelectWindow( HB_GTCTW_GET( pGT ), 0 );
hb_ctw_SelectWindow( HB_GTCTW_GET( pGT ), 0, TRUE );
fResult = HB_GTSUPER_INFO( pGT, iType, pInfo );
if( fResult && hb_arrayLen( pInfo->pResult ) >= 8 )
@@ -1500,7 +1718,7 @@ static BOOL hb_ctw_gt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
BOOL fResult;
int iWindow = HB_GTCTW_GET( pGT )->iCurrWindow;
hb_ctw_SelectWindow( HB_GTCTW_GET( pGT ), 0 );
hb_ctw_SelectWindow( HB_GTCTW_GET( pGT ), 0, TRUE );
fResult = HB_GTSUPER_INFO( pGT, iType, pInfo );
if( fResult && hb_arrayLen( pInfo->pResult ) >= 8 )
hb_arraySetNI( pInfo->pResult, 8, iWindow );
@@ -1510,11 +1728,11 @@ static BOOL hb_ctw_gt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
{
BOOL fResult;
hb_ctw_SelectWindow( HB_GTCTW_GET( pGT ), 0 );
hb_ctw_SelectWindow( HB_GTCTW_GET( pGT ), 0, TRUE );
fResult = HB_GTSUPER_INFO( pGT, iType, pInfo );
if( fResult && hb_arrayLen( pInfo->pNewVal ) >= 8 )
hb_ctw_SelectWindow( HB_GTCTW_GET( pGT ),
hb_arrayGetNI( pInfo->pNewVal, 8 ) );
hb_arrayGetNI( pInfo->pNewVal, 8 ), TRUE );
return fResult;
}
default:
@@ -1597,9 +1815,9 @@ static int hb_ctw_gt_Alert( PHB_GT pGT, PHB_ITEM pMessage, PHB_ITEM pOptions,
iLeft = ( iCols - ulWidth - 4 ) >> 1;
iBottom = iTop + iLines + 3;
iRight = iLeft + ulWidth + 3;
if( iClrNorm == 0 )
if( iClrNorm <= 0 )
iClrNorm = 79;
if( iClrHigh == 0 )
if( iClrHigh <= 0 )
iClrHigh = 31;
iDspCount = HB_GTSELF_DISPCOUNT( pGT );
@@ -1607,7 +1825,7 @@ static int hb_ctw_gt_Alert( PHB_GT pGT, PHB_ITEM pMessage, PHB_ITEM pOptions,
HB_GTSELF_DISPBEGIN( pGT );
iPrevWnd = hb_ctw_CurrentWindow( pCTW );
iWnd = hb_ctw_CreateWindow( pCTW, iTop, iLeft, iBottom, iRight, TRUE, iClrNorm );
iWnd = hb_ctw_CreateWindow( pCTW, iTop, iLeft, iBottom, iRight, TRUE, iClrNorm, TRUE );
hb_ctw_AddWindowBox( pCTW, iWnd, ( BYTE * ) _B_SINGLE, iClrNorm );
HB_GTSELF_SETCURSORSTYLE( pGT, SC_NONE );
ulLast = 0;
@@ -1713,7 +1931,7 @@ static int hb_ctw_gt_Alert( PHB_GT pGT, PHB_ITEM pMessage, PHB_ITEM pOptions,
}
hb_ctw_CloseWindow( pCTW, iWnd );
hb_ctw_SelectWindow( pCTW, iPrevWnd );
hb_ctw_SelectWindow( pCTW, iPrevWnd, TRUE );
HB_GTSELF_REFRESH( pGT );
while( HB_GTSELF_DISPCOUNT( pGT ) < iDspCount )
@@ -1811,13 +2029,13 @@ int hb_ctwSetBorderMode( int iTop, int iLeft, int iBottom, int iRight )
return iResult;
}
int hb_ctwCreateWindow( int iTop, int iLeft, int iBottom, int iRight, BOOL fClear, int iColor )
int hb_ctwCreateWindow( int iTop, int iLeft, int iBottom, int iRight, BOOL fClear, int iColor, BOOL fVisible )
{
int iResult = -1;
PHB_GTCTW pCTW = hb_ctw_base();
if( pCTW )
{
iResult = hb_ctw_CreateWindow( pCTW, iTop, iLeft, iBottom, iRight, fClear, iColor );
iResult = hb_ctw_CreateWindow( pCTW, iTop, iLeft, iBottom, iRight, fClear, iColor, fVisible );
HB_GTSELF_FLUSH( pCTW->pGT );
hb_gt_BaseFree( pCTW->pGT );
}
@@ -1862,13 +2080,52 @@ int hb_ctwCurrentWindow( void )
return iResult;
}
int hb_ctwSelectWindow( int iWindow )
int hb_ctwSelectWindow( int iWindow, BOOL fToTop )
{
int iResult = 0;
PHB_GTCTW pCTW = hb_ctw_base();
if( pCTW )
{
iResult = hb_ctw_SelectWindow( pCTW, iWindow );
iResult = hb_ctw_SelectWindow( pCTW, iWindow, fToTop );
HB_GTSELF_FLUSH( pCTW->pGT );
hb_gt_BaseFree( pCTW->pGT );
}
return iResult;
}
int hb_ctwVisible( int iWindow, int iVisible )
{
int iResult = HB_CTW_UNDEF;
PHB_GTCTW pCTW = hb_ctw_base();
if( pCTW )
{
iResult = hb_ctw_Visible( pCTW, iWindow, iVisible );
HB_GTSELF_FLUSH( pCTW->pGT );
hb_gt_BaseFree( pCTW->pGT );
}
return iResult;
}
int hb_ctwSetWindowLevel( int iWindow, int iLevel )
{
int iResult = HB_CTW_UNDEF;
PHB_GTCTW pCTW = hb_ctw_base();
if( pCTW )
{
iResult = hb_ctw_SetWindowLevel( pCTW, iWindow, iLevel );
HB_GTSELF_FLUSH( pCTW->pGT );
hb_gt_BaseFree( pCTW->pGT );
}
return iResult;
}
int hb_ctwSetWindowShadow( int iWindow, int iAttr )
{
int iResult = HB_CTW_UNDEF;
PHB_GTCTW pCTW = hb_ctw_base();
if( pCTW )
{
iResult = hb_ctw_SetWindowShadow( pCTW, iWindow, iAttr );
HB_GTSELF_FLUSH( pCTW->pGT );
hb_gt_BaseFree( pCTW->pGT );
}
@@ -1899,6 +2156,19 @@ int hb_ctwChangeMargins( int iWindow, int iTop, int iLeft, int iBottom, int iRi
return iResult;
}
int hb_ctwSetWindowClip( int iWindow, int iTop, int iLeft, int iBottom, int iRight )
{
int iResult = -1;
PHB_GTCTW pCTW = hb_ctw_base();
if( pCTW )
{
iResult = hb_ctw_SetWindowClip( pCTW, iWindow, iTop, iLeft, iBottom, iRight );
HB_GTSELF_FLUSH( pCTW->pGT );
hb_gt_BaseFree( pCTW->pGT );
}
return iResult;
}
int hb_ctwGetWindowCords( int iWindow, BOOL fCenter, int * piTop, int * piLeft, int * piBottom, int * piRight )
{
int iResult = -1;
@@ -1930,6 +2200,7 @@ int hb_ctwMoveWindow( int iWindow, int iRow, int iCol )
if( pCTW )
{
iResult = hb_ctw_MoveWindow( pCTW, iWindow, iRow, iCol );
HB_GTSELF_FLUSH( pCTW->pGT );
hb_gt_BaseFree( pCTW->pGT );
}
return iResult;
@@ -1942,6 +2213,7 @@ int hb_ctwCenterWindow( int iWindow, BOOL fCenter )
if( pCTW )
{
iResult = hb_ctw_CenterWindow( pCTW, iWindow, fCenter );
HB_GTSELF_FLUSH( pCTW->pGT );
hb_gt_BaseFree( pCTW->pGT );
}
return iResult;
@@ -1960,6 +2232,19 @@ int hb_ctwAddWindowBox( int iWindow, BYTE * szBox, int iColor )
return iResult;
}
int hb_ctwSwapWindows( int iWindow1, int iWindow2 )
{
int iResult = -1;
PHB_GTCTW pCTW = hb_ctw_base();
if( pCTW )
{
iResult = hb_ctw_SwapWindows( pCTW, iWindow1, iWindow2 );
HB_GTSELF_FLUSH( pCTW->pGT );
hb_gt_BaseFree( pCTW->pGT );
}
return iResult;
}
int hb_ctwLastKey( void )
{
/* keyread() in CT3 uses 64512 bytes length buffer

View File

@@ -53,6 +53,14 @@
#ifndef HB_CTWIN_H_
#define HB_CTWIN_H_
#define HB_CTW_UNDEF -1
#define HB_CTW_HIDDEN 0
#define HB_CTW_VISIBLE 1
#define HB_CTW_BOTTOM 0
#define HB_CTW_DEFAULT 1
#define HB_CTW_TOP 2
HB_EXTERN_BEGIN
extern BOOL hb_ctwInit( void );
@@ -61,18 +69,23 @@ extern int hb_ctwSetMoveMode( int iMode );
extern int hb_ctwSetMoveStep( int iVertical, int iHorizontal );
extern int hb_ctwSetWindowBoard( int iTop, int iLeft, int iBottom, int iRight );
extern int hb_ctwSetBorderMode( int iTop, int iLeft, int iBottom, int iRight );
extern int hb_ctwCreateWindow( int iTop, int iLeft, int iBottom, int iRight, BOOL fClear, int iColor );
extern int hb_ctwCreateWindow( int iTop, int iLeft, int iBottom, int iRight, BOOL fClear, int iColor, BOOL fVisible );
extern int hb_ctwCloseAllWindows( void );
extern int hb_ctwCloseWindow( int iWindow );
extern int hb_ctwCurrentWindow( void );
extern int hb_ctwSelectWindow( int iWindow );
extern int hb_ctwSelectWindow( int iWindow, BOOL fToTop );
extern int hb_ctwVisible( int iWindow, int iVisible );
extern int hb_ctwSetWindowShadow( int iWindow, int iAttr );
extern int hb_ctwSetWindowLevel( int iWindow, int iLevel );
extern int hb_ctwMaxWindow( void );
extern int hb_ctwChangeMargins( int iWindow, int iTop, int iLeft, int iBottom, int iRight );
extern int hb_ctwSetWindowClip( int iWindow, int iTop, int iLeft, int iBottom, int iRight );
extern int hb_ctwGetWindowCords( int iWindow, BOOL fCenter, int * piTop, int * piLeft, int * piBottom, int * piRight );
extern int hb_ctwGetFormatCords( int iWindow, BOOL fRelative, int * piTop, int * piLeft, int * piBottom, int * piRight );
extern int hb_ctwMoveWindow( int iWindow, int iRow, int iCol );
extern int hb_ctwCenterWindow( int iWindow, BOOL fCenter );
extern int hb_ctwAddWindowBox( int iWindow, BYTE * szBox, int iColor );
extern int hb_ctwSwapWindows( int iWindow1, int iWindow2 );
extern int hb_ctwLastKey( void );
HB_EXTERN_END

View File

@@ -2597,7 +2597,9 @@ BYTE * hb_osEncode( BYTE * szFileName, BOOL * pfFree )
{
*pfFree = FALSE;
#if defined( HB_MT_VM )
if( hb_stackId() )
#endif
{
BOOL bCPConv = hb_setGetOSCODEPAGE() && hb_setGetOSCODEPAGE()[ 0 ];
@@ -2621,7 +2623,9 @@ BYTE * hb_osDecode( BYTE * szFileName, BOOL * pfFree )
{
*pfFree = FALSE;
#if defined( HB_MT_VM )
if( hb_stackId() )
#endif
{
BOOL bCPConv = hb_setGetOSCODEPAGE() && hb_setGetOSCODEPAGE()[ 0 ];