2007-11-22 18:33 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/rtl/gtwvt/gtwvt.c
    * declared two functions
         hb_gt_wvt_AddCharToInputQueue() and
         hb_gt_wvt_AddCharToInputQueue()
      as static - they were public by mistake

  * harbour/contrib/gtwvg/wvtcore.c
  * harbour/contrib/gtwvg/gtwvt.c
    * moved hb_wvt_gtDlgProcMLess() and hb_wvt_gtDlgProcModal()
      from gtwvt.c to wvtcore.c
      These both functions are wrong and have to be fixed.
    * farther cleanup:
      - declared some internal functions as static
      - synced some other with GTWVT
      - removed some repeated declarations
This commit is contained in:
Przemyslaw Czerpak
2007-11-22 17:34:11 +00:00
parent 585cdb174c
commit fc1a660dca
4 changed files with 716 additions and 771 deletions

View File

@@ -8,6 +8,23 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2007-11-22 18:33 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/rtl/gtwvt/gtwvt.c
* declared two functions
hb_gt_wvt_AddCharToInputQueue() and
hb_gt_wvt_AddCharToInputQueue()
as static - they were public by mistake
* harbour/contrib/gtwvg/wvtcore.c
* harbour/contrib/gtwvg/gtwvt.c
* moved hb_wvt_gtDlgProcMLess() and hb_wvt_gtDlgProcModal()
from gtwvt.c to wvtcore.c
These both functions are wrong and have to be fixed.
* farther cleanup:
- declared some internal functions as static
- synced some other with GTWVT
- removed some repeated declarations
2007-11-22 14:22 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbwince.h
+ added HB_TCHAR_CONVNREV() macro

File diff suppressed because it is too large Load Diff

View File

@@ -113,6 +113,276 @@ HB_FUNC( WVT_CORE )
hb_wvt_wvtCore();
}
//-------------------------------------------------------------------//
//
// Modeless Dialogs Implementation
//
//-------------------------------------------------------------------//
HB_EXPORT BOOL CALLBACK hb_wvt_gtDlgProcMLess( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
int iIndex, iType;
long int bReturn = FALSE ;
PHB_ITEM pFunc = NULL;
PHB_DYNS pDynSym;
iType = (int) NULL;
for ( iIndex = 0; iIndex < WVT_DLGML_MAX; iIndex++ )
{
if ( ( _s->hDlgModeless[ iIndex ] != NULL ) && ( _s->hDlgModeless[ iIndex ] == hDlg ) )
{
if ( _s->pFunc[ iIndex ] != NULL )
{
pFunc = _s->pFunc[ iIndex ];
iType = _s->iType[ iIndex ];
}
break;
}
}
if ( pFunc )
{
switch ( iType )
{
case 1: // Function Name
{
pDynSym = ( PHB_DYNS ) pFunc;
hb_vmPushState();
hb_vmPushSymbol( hb_dynsymSymbol( pDynSym ) );
hb_vmPushNil();
hb_vmPushLong( ( ULONG ) hDlg );
hb_vmPushLong( ( UINT ) message );
hb_vmPushLong( ( ULONG ) wParam );
hb_vmPushLong( ( ULONG ) lParam );
hb_vmDo( 4 );
//bReturn = hb_itemGetNL( hb_stackReturnItem() );
bReturn = hb_parnl( -1 );
hb_vmPopState();
break;
}
case 2: // Block
{
/* eval the codeblock */
//if ( _s->pFunc[ iIndex ]->type == HB_IT_BLOCK )
if ( hb_itemType( _s->pFunc[ iIndex ] ) == HB_IT_BLOCK )
{
PHB_ITEM hihDlg, himessage, hiwParam, hilParam;
PHB_ITEM pReturn;
//hihDlg.type = HB_IT_NIL;
hb_itemPutNL( &hihDlg, (ULONG) hDlg );
//himessage.type = HB_IT_NIL;
hb_itemPutNL( &himessage, (ULONG) message );
//hiwParam.type = HB_IT_NIL;
hb_itemPutNL( &hiwParam, (ULONG) wParam );
//hilParam.type = HB_IT_NIL;
hb_itemPutNL( &hilParam, (ULONG) lParam );
pReturn = hb_itemDo( (PHB_ITEM) _s->pFunc[ iIndex ], 4, &hihDlg, &himessage, &hiwParam, &hilParam );
bReturn = hb_itemGetNL( pReturn );
hb_itemRelease( pReturn );
}
else
{
//internal error: missing codeblock
}
break;
}
}
}
switch( message )
{
case WM_COMMAND:
{
switch( LOWORD( wParam ) )
{
case IDOK:
{
DestroyWindow( hDlg );
bReturn = TRUE;
}
break;
case IDCANCEL:
{
DestroyWindow( hDlg );
bReturn = FALSE;
}
break;
}
}
break;
case WM_CLOSE:
{
DestroyWindow( hDlg );
bReturn = FALSE;
}
break;
case WM_NCDESTROY:
{
if ( _s->pFunc[ iIndex ] != NULL && _s->iType[ iIndex ] == 2 )
{
hb_itemRelease( ( PHB_ITEM ) _s->pFunc[ iIndex ] );
}
_s->hDlgModeless[ iIndex ] = NULL;
_s->pFunc[ iIndex ] = NULL;
_s->iType[ iIndex ] = (int) NULL;
bReturn = FALSE;
}
break;
}
return bReturn;
}
//-------------------------------------------------------------------//
HB_EXPORT BOOL CALLBACK hb_wvt_gtDlgProcModal( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
int iIndex, iType;
long int bReturn = FALSE ;
PHB_ITEM pFunc = NULL;
PHB_DYNS pDynSym;
int iFirst = ( int ) lParam;
if ( iFirst > 0 && iFirst <= WVT_DLGMD_MAX )
{
_s->hDlgModal[ iFirst-1 ] = hDlg ;
SendMessage( hDlg, WM_INITDIALOG, 0, 0 );
return ( bReturn );
}
iType = ( int ) NULL;
for ( iIndex = 0; iIndex < WVT_DLGMD_MAX; iIndex++ )
{
if ( ( _s->hDlgModal[ iIndex ] != NULL ) && ( _s->hDlgModal[ iIndex ] == hDlg ) )
{
if ( _s->pFuncModal[ iIndex ] != NULL )
{
pFunc = _s->pFuncModal[ iIndex ];
iType = _s->iTypeModal[ iIndex ];
}
break;
}
}
if ( pFunc )
{
switch ( iType )
{
case 1: // Function Name
{
pDynSym = ( PHB_DYNS ) pFunc;
hb_vmPushState();
hb_vmPushSymbol( hb_dynsymSymbol( pDynSym ) );
hb_vmPushNil();
hb_vmPushLong( ( ULONG ) hDlg );
hb_vmPushLong( ( UINT ) message );
hb_vmPushLong( ( ULONG ) wParam );
hb_vmPushLong( ( ULONG ) lParam );
hb_vmDo( 4 );
//bReturn = hb_itemGetNL( hb_stackReturnItem() );
bReturn = hb_parnl( -1 );
hb_vmPopState();
break;
}
case 2: // Block
{
/* eval the codeblock */
if ( hb_itemType( _s->pFuncModal[ iIndex ] ) == HB_IT_BLOCK )
{
PHB_ITEM hihDlg, himessage, hiwParam, hilParam;
PHB_ITEM pReturn;
//hihDlg.type = HB_IT_NIL;
hb_itemPutNL( &hihDlg, (ULONG) hDlg );
//himessage.type = HB_IT_NIL;
hb_itemPutNL( &himessage, (ULONG) message );
//hiwParam.type = HB_IT_NIL;
hb_itemPutNL( &hiwParam, (ULONG) wParam );
//hilParam.type = HB_IT_NIL;
hb_itemPutNL( &hilParam, (ULONG) lParam );
pReturn = hb_itemDo( (PHB_ITEM) _s->pFuncModal[ iIndex ], 4, &hihDlg, &himessage, &hiwParam, &hilParam );
bReturn = hb_itemGetNL( pReturn );
hb_itemRelease( pReturn );
}
else
{
//internal error: missing codeblock
}
break;
}
}
}
switch( message )
{
case WM_COMMAND:
{
switch( LOWORD( wParam ) )
{
case IDOK:
{
EndDialog( hDlg, IDOK );
bReturn = TRUE;
}
break;
case IDCANCEL:
{
EndDialog( hDlg, IDCANCEL );
bReturn = FALSE;
}
break;
}
}
break;
case WM_CLOSE:
{
EndDialog( hDlg, IDCANCEL );
bReturn = FALSE;
}
break;
case WM_NCDESTROY:
{
if ( _s->pFuncModal[ iIndex ] != NULL && _s->iTypeModal[ iIndex ] == 2 )
{
hb_itemRelease( ( PHB_ITEM ) _s->pFuncModal[ iIndex ] );
}
_s->hDlgModal[ iIndex ] = NULL;
_s->pFuncModal[ iIndex ] = NULL;
_s->iTypeModal[ iIndex ] = ( int ) NULL;
bReturn = FALSE;
}
break;
}
return bReturn;
}
//-------------------------------------------------------------------//
HB_EXPORT BOOL hb_wvt_DrawImage( HDC hdc, int x1, int y1, int wd, int ht, char * image )

View File

@@ -89,7 +89,7 @@
static HB_GT_FUNCS SuperTable;
#define HB_GTSUPER (&SuperTable)
static TCHAR szAppName[] = TEXT( "Harbour WVT" );
static const TCHAR s_szAppName[] = TEXT( "Harbour WVT" );
static HANDLE s_hInstance;
static HANDLE s_hPrevInstance;
@@ -342,7 +342,7 @@ static RECT hb_gt_wvt_GetColRowFromXYRect( RECT xy )
return colrow;
}
POINT HB_EXPORT hb_gt_wvt_GetXYFromColRow( USHORT col, USHORT row )
static POINT hb_gt_wvt_GetXYFromColRow( USHORT col, USHORT row )
{
POINT xy;
@@ -367,7 +367,7 @@ static RECT hb_gt_wvt_GetXYFromColRowRect( RECT colrow )
/*
* functions for handling the input queues for the mouse and keyboard
*/
void HB_EXPORT hb_gt_wvt_AddCharToInputQueue( int iKey )
static void hb_gt_wvt_AddCharToInputQueue( int iKey )
{
int iPos = _s.keyPointerIn;
@@ -1218,16 +1218,16 @@ static HWND hb_gt_wvt_CreateWindow( HINSTANCE hInstance, HINSTANCE hPrevInstance
wndclass.hCursor = LoadCursor( NULL, IDC_ARROW );
wndclass.hbrBackground = NULL;
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = szAppName;
wndclass.lpszClassName = s_szAppName;
if ( ! RegisterClass( &wndclass ) )
{
MessageBox( NULL, TEXT( "Failed to register class." ),
szAppName, MB_ICONERROR );
s_szAppName, MB_ICONERROR );
return 0;
}
hWnd = CreateWindow( szAppName, /* classname */
hWnd = CreateWindow( s_szAppName, /* classname */
TEXT( "HARBOUR_WVT" ), /* window name */
WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX, /* style */
0, /* x */
@@ -1329,7 +1329,7 @@ static void hb_gt_wvt_Exit( void )
DestroyWindow( _s.hWnd );
_s.hWnd = NULL;
}
UnregisterClass( szAppName, ( HINSTANCE ) s_hInstance );
UnregisterClass( s_szAppName, ( HINSTANCE ) s_hInstance );
}
static BOOL hb_gt_wvt_SetMode( int iRow, int iCol )
@@ -1403,7 +1403,6 @@ static void hb_gt_wvt_Tone( double dFrequency, double dDuration )
hb_gt_w32_Tone( dFrequency, dDuration );
}
/* *********************************************************************** */
static BOOL hb_gt_wvt_mouse_IsPresent( void )
@@ -1864,25 +1863,25 @@ static BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable )
{
HB_TRACE(HB_TR_DEBUG, ("hb_gt_FuncInit(%p)", pFuncTable));
pFuncTable->Init = hb_gt_wvt_Init;
pFuncTable->Exit = hb_gt_wvt_Exit;
pFuncTable->SetMode = hb_gt_wvt_SetMode;
pFuncTable->Redraw = hb_gt_wvt_Redraw;
pFuncTable->Refresh = hb_gt_wvt_Refresh;
pFuncTable->Version = hb_gt_wvt_Version;
pFuncTable->Tone = hb_gt_wvt_Tone;
pFuncTable->Info = hb_gt_wvt_Info;
pFuncTable->SetDispCP = hb_gt_wvt_SetDispCP;
pFuncTable->SetKeyCP = hb_gt_wvt_SetKeyCP;
pFuncTable->Init = hb_gt_wvt_Init;
pFuncTable->Exit = hb_gt_wvt_Exit;
pFuncTable->SetMode = hb_gt_wvt_SetMode;
pFuncTable->Redraw = hb_gt_wvt_Redraw;
pFuncTable->Refresh = hb_gt_wvt_Refresh;
pFuncTable->Version = hb_gt_wvt_Version;
pFuncTable->Tone = hb_gt_wvt_Tone;
pFuncTable->Info = hb_gt_wvt_Info;
pFuncTable->SetDispCP = hb_gt_wvt_SetDispCP;
pFuncTable->SetKeyCP = hb_gt_wvt_SetKeyCP;
pFuncTable->ReadKey = hb_gt_wvt_ReadKey;
pFuncTable->ReadKey = hb_gt_wvt_ReadKey;
pFuncTable->MouseIsPresent = hb_gt_wvt_mouse_IsPresent;
pFuncTable->MouseGetPos = hb_gt_wvt_mouse_GetPos;
pFuncTable->MouseButtonState = hb_gt_wvt_mouse_ButtonState;
pFuncTable->MouseCountButton = hb_gt_wvt_mouse_CountButton;
pFuncTable->MouseIsPresent = hb_gt_wvt_mouse_IsPresent;
pFuncTable->MouseGetPos = hb_gt_wvt_mouse_GetPos;
pFuncTable->MouseButtonState = hb_gt_wvt_mouse_ButtonState;
pFuncTable->MouseCountButton = hb_gt_wvt_mouse_CountButton;
// pFuncTable->GfxPrimitive = hb_gt_wvt_gfx_Primitive;
// pFuncTable->GfxPrimitive = hb_gt_wvt_gfx_Primitive;
return TRUE;
}