From 6a18638c94768c6edb07d79fe545848ba3fbda95 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 2 Jul 2008 16:53:13 +0000 Subject: [PATCH] 2008-07-02 18:52 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * contrib/hbziparch/hbzipcom.cpp * contrib/hbziparch/hbzipnew.cpp ! Two lines commented by mistake now reenabled. Thanks Miguel. * source/rtl/gtwvt/gtwvt.c * Minor naming, formatting. --- harbour/ChangeLog | 10 +++- harbour/contrib/hbziparch/hbzipcom.cpp | 38 ++++++------ harbour/contrib/hbziparch/hbzipnew.cpp | 80 +++++++++++++------------- harbour/source/rtl/gtwvt/gtwvt.c | 41 ++++++------- 4 files changed, 88 insertions(+), 81 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 63a0c6fe41..60e4a54ee6 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,15 @@ 2008-12-31 13:59 UTC+0100 Foo Bar */ +2008-07-02 18:52 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * contrib/hbziparch/hbzipcom.cpp + * contrib/hbziparch/hbzipnew.cpp + ! Two lines commented by mistake now reenabled. + Thanks Miguel. + + * source/rtl/gtwvt/gtwvt.c + * Minor naming, formatting. + 2008-07-02 18:39 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/hbodbc/Makefile * added test for header files in non W32 builds @@ -2610,7 +2619,6 @@ F.e. to save screen size after the user has changed it, or to have a last chance to commit tables, set flags, etc when user (or OS) closed the app window. - ; TODO: Screen interaction is not possible in the callback. ; TOFIX: New TIMER stuff in GTWVT should be replace by a platform neutral solution, which is probably MT. (see also "background events") diff --git a/harbour/contrib/hbziparch/hbzipcom.cpp b/harbour/contrib/hbziparch/hbzipcom.cpp index dbb5f26fd1..72b4e0b901 100644 --- a/harbour/contrib/hbziparch/hbzipcom.cpp +++ b/harbour/contrib/hbziparch/hbzipcom.cpp @@ -147,7 +147,7 @@ int hb_CompressFile( char *szFile, PHB_ITEM pArray, int iCompLevel, PHB_ITEM pBl szZip.SetSegmCallback( &span ); #ifdef HB_OS_WIN_32 - hb_strLower( szFileLower, strlen( szFileLower )) ; + hb_strLower( szFileLower, strlen( szFileLower )); #endif try @@ -184,16 +184,16 @@ int hb_CompressFile( char *szFile, PHB_ITEM pArray, int iCompLevel, PHB_ITEM pBl szZip.SetCallback( &spanac ); } - for ( ulCount = 1; ( ulCount <= hb_arrayLen( pArray ) ) ;ulCount++ ) + for( ulCount = 1; ulCount <= hb_arrayLen( pArray ); ulCount++ ) { - szDummy = ( char * ) hb_arrayGetCPtr( pArray, ulCount ) ; + szDummy = ( char * ) hb_arrayGetCPtr( pArray, ulCount ); dwSize = hb_GetCurrentFileSize( szDummy ); bAdded = FALSE; - szDummyLower = hb_strdup( (char *)szDummy ) ; + szDummyLower = hb_strdup( (char *)szDummy ); #ifdef HB_OS_WIN_32 - hb_strLower( szDummyLower, strlen( szDummyLower )) ; + hb_strLower( szDummyLower, strlen( szDummyLower )); #endif // Prevent adding current archive file ! @@ -217,7 +217,7 @@ int hb_CompressFile( char *szFile, PHB_ITEM pArray, int iCompLevel, PHB_ITEM pBl if ( bPath && !bAdded ) { szZip.AddNewFile( szDummy, iCompLevel, true, CZipArchive::zipsmSafeSmart, 65536 ); - // bAdded = TRUE; + bAdded = TRUE; } else if ( !bDrive && !bPath && !bAdded ) { @@ -228,16 +228,17 @@ int hb_CompressFile( char *szFile, PHB_ITEM pArray, int iCompLevel, PHB_ITEM pBl catch( ... ){} } } - hb_xfree( szDummyLower ) ; + hb_xfree( szDummyLower ); } } - hb_xfree( szFileLower ) ; + + hb_xfree( szFileLower ); + try { - szZip.Close( ); + szZip.Close(); } - - catch ( CZipException ) + catch( CZipException ) { bReturn = FALSE; } @@ -308,9 +309,9 @@ int hb_CmpTdSpan( char *szFile, PHB_ITEM pArray, int iCompLevel, PHB_ITEM pBlock szZip.SetCallback( &spanac ); } - for ( ulCount = 1;( ulCount<= hb_arrayLen( pArray ) ) ;ulCount++ ) + for ( ulCount = 1;( ulCount<= hb_arrayLen( pArray ) );ulCount++ ) { - szDummy = ( char * )hb_arrayGetCPtr( pArray, ulCount ) ; + szDummy = ( char * )hb_arrayGetCPtr( pArray, ulCount ); dwSize = hb_GetCurrentFileSize( szDummy ); bAdded = FALSE; @@ -420,7 +421,7 @@ int hb_CompressFileStd( char *szFile, char *szFiletoCompress, int iCompLevel, PH if( pBlock != NULL ) { - PHB_ITEM FileName=hb_itemPutC( NULL, szFiletoCompress ) ; + PHB_ITEM FileName=hb_itemPutC( NULL, szFiletoCompress ); hb_vmEvalBlockV( pBlock, 1, FileName); @@ -469,7 +470,7 @@ int hb_CompressFileStd( char *szFile, char *szFiletoCompress, int iCompLevel, PH } try { - szZip.Close( ); + szZip.Close(); } catch ( CZipException ) @@ -546,9 +547,9 @@ int hb_CmpTdSpanStd( char *szFile, char * szFiletoCompress, int iCompLevel, PHB_ if( pBlock != NULL ) { - PHB_ITEM FileName=hb_itemPutC( NULL, szFiletoCompress ) ; + PHB_ITEM FileName=hb_itemPutC( NULL, szFiletoCompress ); - hb_vmEvalBlockV( pBlock, 1, FileName); + hb_vmEvalBlockV( pBlock, 1, FileName ); hb_itemRelease( FileName ); @@ -594,9 +595,8 @@ int hb_CmpTdSpanStd( char *szFile, char * szFiletoCompress, int iCompLevel, PHB_ try { - szZip.Close( ); + szZip.Close(); } - catch ( CZipException ) { bReturn = FALSE; diff --git a/harbour/contrib/hbziparch/hbzipnew.cpp b/harbour/contrib/hbziparch/hbzipnew.cpp index 3692baab28..46caa8441d 100644 --- a/harbour/contrib/hbziparch/hbzipnew.cpp +++ b/harbour/contrib/hbziparch/hbzipnew.cpp @@ -60,7 +60,7 @@ class SegmCallback : public CZipSegmCallback { bool Callback( ZIP_SIZE_TYPE iProgress ) { - PHB_ITEM Disk = hb_itemPutNL( NULL, m_uVolumeNeeded ) ; + PHB_ITEM Disk = hb_itemPutNL( NULL, m_uVolumeNeeded ); HB_SYMBOL_UNUSED( iProgress ); @@ -239,11 +239,11 @@ int hb_CmpPkSpan( char *szFile, PHB_ITEM pArray, int iCompLevel, PHB_ITEM pBlock { ULONG ulCount; - const char *szDummy; + const char * szDummy; BOOL bReturn = TRUE; BOOL bAdded; - BOOL bFileExist = hb_fsFile( ( BYTE* )szFile ); + BOOL bFileExist = hb_fsFile( ( BYTE * ) szFile ); CZipString szArchive = szFile; CZipArchive szZip; @@ -264,13 +264,12 @@ int hb_CmpPkSpan( char *szFile, PHB_ITEM pArray, int iCompLevel, PHB_ITEM pBlock bReturn = FALSE; } } - - catch ( CZipException ) + catch( CZipException ) { bReturn = FALSE; } - - catch( ... ){} + catch( ... ) + {} if( ! bReturn ) { @@ -294,44 +293,42 @@ int hb_CmpPkSpan( char *szFile, PHB_ITEM pArray, int iCompLevel, PHB_ITEM pBlock szZip.SetCallback( &spanac ); } - for( ulCount = 1;( ulCount <= hb_arrayLen( pArray ) ); ulCount++ ) + for( ulCount = 1; ulCount <= hb_arrayLen( pArray ); ulCount++ ) { - szDummy = ( char * )hb_arrayGetCPtr( pArray, ulCount ); + szDummy = ( char * ) hb_arrayGetCPtr( pArray, ulCount ); bAdded = FALSE; - if( pBlock != NULL ) + if( pBlock != NULL ) { - PHB_ITEM FileName=hb_itemPutC( NULL, hb_arrayGetCPtr( pArray, ulCount ) ), FilePos=hb_itemPutNI( NULL , ulCount ); + PHB_ITEM FileName = hb_itemPutC( NULL, hb_arrayGetCPtr( pArray, ulCount ) ), FilePos = hb_itemPutNI( NULL, ulCount ); - - hb_vmEvalBlockV( pBlock, 2, FileName,FilePos); + hb_vmEvalBlockV( pBlock, 2, FileName, FilePos ); hb_itemRelease( FileName ); hb_itemRelease( FilePos ); } + try { - if( bPath && !bAdded ) { szZip.AddNewFile( szDummy, iCompLevel, true, CZipArchive::zipsmSafeSmart, 65536 ); - // bAdded = true; + bAdded = true; } else if( !bDrive && !bPath && !bAdded ) { szZip.AddNewFile( szDummy, iCompLevel, false, CZipArchive::zipsmSafeSmart, 65536 ); } - } - catch( ... ){} + catch( ... ) + {} } try { szZip.Close( ); } - - catch ( CZipException ) + catch( CZipException ) { bReturn = FALSE; } @@ -355,7 +352,6 @@ PHB_ITEM hb___GetFileNamesFromZip( char *szFile, BOOL iMode ) } try { - switch( hb_CheckSpanMode( szFile )) { case 0: @@ -375,8 +371,8 @@ PHB_ITEM hb___GetFileNamesFromZip( char *szFile, BOOL iMode ) iReturn = false; } } - - catch ( ... ) { } + catch ( ... ) + {} if( iReturn ) { @@ -385,7 +381,7 @@ PHB_ITEM hb___GetFileNamesFromZip( char *szFile, BOOL iMode ) hbza_ZipArray = hb_itemNew(NULL); hb_arrayNew( hbza_ZipArray, iNumberOfFiles ); time_t theTime; - tm *SzTime; + tm * SzTime; for( ulCount = 0 ; ulCount < ( ULONG ) iNumberOfFiles ; ulCount++ ) { @@ -538,7 +534,7 @@ PHB_ITEM hb___GetFileNamesFromZip( char *szFile, BOOL iMode ) char *hb___CheckFile( char * szFile ) { PHB_FNAME pFileName = hb_fsFNameSplit( szFile ); - char *szZipName = (char*) hb_xgrab( _POSIX_PATH_MAX + 1 ); + char * szZipName = ( char * ) hb_xgrab( _POSIX_PATH_MAX + 1 ); if( ! pFileName->szExtension ) { @@ -547,6 +543,7 @@ char *hb___CheckFile( char * szFile ) hb_fsFNameMerge( szZipName, pFileName ); hb_xfree( pFileName ); + return( szZipName ); } @@ -579,7 +576,7 @@ BOOL hb_IsPassWord( char *szFile ) bReturn = FALSE; } } - catch ( CZipException ) {} + catch( CZipException ) {} if( bReturn ) { @@ -651,7 +648,7 @@ int hb___SetCallbackFunc( PHB_ITEM pFunc ) bool hb_SetCallBack( DWORD iNumber, int, void* pData ) { - PHB_ITEM Disk = hb_itemPutNL( NULL, iNumber ) ; + PHB_ITEM Disk = hb_itemPutNL( NULL, iNumber ); HB_SYMBOL_UNUSED( pData ); @@ -673,7 +670,7 @@ int hb_DeleteSel( char *szFile, PHB_ITEM pArray, BOOL bCase ) try { - switch(hb_CheckSpanMode( szFile )) + switch( hb_CheckSpanMode( szFile ) ) { case 0: szZip.Open( szFile, hbza_pZipI.iReadOnly ? CZipArchive::zipOpenReadOnly : CZipArchive::zipOpen, 0 ); @@ -685,12 +682,12 @@ int hb_DeleteSel( char *szFile, PHB_ITEM pArray, BOOL bCase ) iReturn = false; } } - - catch ( CZipException ) {} + catch( CZipException ) + {} if( iReturn ) { - for( ulCount = 1 ; ( ulCount <= ( ULONG ) hb_arrayLen( pArray ) ) ; ulCount ++ ) + for( ulCount = 1; ulCount <= ( ULONG ) hb_arrayLen( pArray ); ulCount ++ ) { const char *szDummy = ( char * )hb_arrayGetCPtr( pArray, ulCount ); aFiles.Add( szDummy ); @@ -706,11 +703,11 @@ int hb_DeleteSel( char *szFile, PHB_ITEM pArray, BOOL bCase ) int hb_UnzipSel( char *szFile, PHB_ITEM pBlock, BOOL lWithPath, char *szPassWord, const char *pbyBuffer, PHB_ITEM pSelArray, PHB_ITEM pProgress ) { - bool bWithPath = lWithPath?true:false; + bool bWithPath = lWithPath ? true : false; bool iReturn = true; ULONG ulCount; int iCause; - char * szPath = (char*) hb_xgrab( _POSIX_PATH_MAX + 1 ); + char * szPath = ( char * ) hb_xgrab( _POSIX_PATH_MAX + 1 ); BOOL bFreePath = TRUE; BOOL bChange = FALSE; @@ -747,8 +744,8 @@ int hb_UnzipSel( char *szFile, PHB_ITEM pBlock, BOOL lWithPath, char *szPassWord iReturn = false; } } - - catch ( CZipException ) {} + catch( CZipException ) + {} if( iReturn ) { @@ -770,7 +767,8 @@ int hb_UnzipSel( char *szFile, PHB_ITEM pBlock, BOOL lWithPath, char *szPassWord hb_fsChDir((BYTE*)"\\"); szZip.SetRootPath(szPath); } - for( iCause = 1 ; ( iCause <= ( int ) hb_arrayLen( pSelArray ) ) ; iCause ++ ) + + for( iCause = 1; iCause <= ( int ) hb_arrayLen( pSelArray ); iCause++ ) { lpFiletoExtract = hb_arrayGetC( pSelArray, iCause ); ulCount = szZip.FindFile( ( LPCTSTR )lpFiletoExtract, false ); @@ -1078,7 +1076,7 @@ BOOL hb_TransferFilesFromzip( char *szSource, char *szDest, PHB_ITEM pArray ) if( bReturn && bReturn1 ) { - for( ulCount = 1 ; ( ulCount <= ( ULONG ) hb_arrayLen( pArray ) ) ; ulCount++ ) + for( ulCount = 1; ulCount <= ( ULONG ) hb_arrayLen( pArray ); ulCount++ ) { szDummy = ( char * )hb_arrayGetCPtr( pArray, ulCount ); aFiles.Add( szDummy ); @@ -1196,17 +1194,17 @@ int hb_UnzipAll(char *szFile,PHB_ITEM pBlock, BOOL bWithPath,char *szPassWord,ch if( pBlock != NULL ) { - PHB_ITEM FileName=hb_itemPutC( NULL, ( char * )szFileNameInZip ); - PHB_ITEM Pos=hb_itemPutNI(NULL,uiCount) ; + PHB_ITEM FileName = hb_itemPutC( NULL, ( char * ) szFileNameInZip ); + PHB_ITEM Pos = hb_itemPutNI( NULL, uiCount ); - hb_vmEvalBlockV( pBlock, 2, FileName, Pos); + hb_vmEvalBlockV( pBlock, 2, FileName, Pos ); hb_itemRelease( FileName ); hb_itemRelease( Pos ); } - - try { + try + { if(!HB_IS_BLOCK(pProgress)) { szZip.SetPassword(szPassWord); diff --git a/harbour/source/rtl/gtwvt/gtwvt.c b/harbour/source/rtl/gtwvt/gtwvt.c index cb6bd25278..a091cb9904 100644 --- a/harbour/source/rtl/gtwvt/gtwvt.c +++ b/harbour/source/rtl/gtwvt/gtwvt.c @@ -740,13 +740,13 @@ static void hb_gt_wvt_SetMousePos( PHB_GTWVT pWVT, int iRow, int iCol ) static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, LPARAM lParam ) { + static RECT s_rectOld = { 0, 0, 0, 0 }; + static RECT s_rectNew = { 0, 0, 0, 0 }; + POINT xy, colrow; SHORT keyCode = 0; SHORT keyState; - static RECT s_rectOld = { 0, 0, 0, 0 }; - static RECT s_rcNew = { 0, 0, 0, 0 }; - HB_SYMBOL_UNUSED( wParam ); if( ! pWVT->bBeginMarked && ! pWVT->MouseMove && ( message == WM_MOUSEMOVE || message == WM_NCMOUSEMOVE ) ) @@ -774,10 +774,10 @@ static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, L { pWVT->bBeingMarked = TRUE; - s_rcNew.left = xy.x; - s_rcNew.top = xy.y; - s_rcNew.right = xy.x; - s_rcNew.bottom = xy.y; + s_rectNew.left = xy.x; + s_rectNew.top = xy.y; + s_rectNew.right = xy.x; + s_rectNew.bottom = xy.y; s_rectOld.left = 0; s_rectOld.top = 0; @@ -814,10 +814,10 @@ static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, L RECT rect = { 0, 0, 0, 0 }; RECT colrowRC = { 0, 0, 0, 0 }; - rect.left = HB_MIN( s_rcNew.left, s_rcNew.right ); - rect.top = HB_MIN( s_rcNew.top , s_rcNew.bottom ); - rect.right = HB_MAX( s_rcNew.left, s_rcNew.right ); - rect.bottom = HB_MAX( s_rcNew.top , s_rcNew.bottom ); + rect.left = HB_MIN( s_rectNew.left, s_rectNew.right ); + rect.top = HB_MIN( s_rectNew.top , s_rectNew.bottom ); + rect.right = HB_MAX( s_rectNew.left, s_rectNew.right ); + rect.bottom = HB_MAX( s_rectNew.top , s_rectNew.bottom ); colrowRC = hb_gt_wvt_GetColRowFromXYRect( pWVT, rect ); @@ -881,19 +881,19 @@ static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, L { if( pWVT->bBeingMarked ) { - RECT rect = { 0, 0, 0, 0 }; - RECT colrowRC = { 0, 0, 0, 0 }; + RECT rect = { 0, 0, 0, 0 }; + RECT colrowRC = { 0, 0, 0, 0 }; - s_rcNew.right = xy.x; - s_rcNew.bottom = xy.y; + s_rectNew.right = xy.x; + s_rectNew.bottom = xy.y; - rect.left = HB_MIN( s_rcNew.left, s_rcNew.right ); - rect.top = HB_MIN( s_rcNew.top , s_rcNew.bottom ); - rect.right = HB_MAX( s_rcNew.left, s_rcNew.right ); - rect.bottom = HB_MAX( s_rcNew.top , s_rcNew.bottom ); + rect.left = HB_MIN( s_rectNew.left, s_rectNew.right ); + rect.top = HB_MIN( s_rectNew.top , s_rectNew.bottom ); + rect.right = HB_MAX( s_rectNew.left, s_rectNew.right ); + rect.bottom = HB_MAX( s_rectNew.top , s_rectNew.bottom ); colrowRC = hb_gt_wvt_GetColRowFromXYRect( pWVT, rect ); - rect = hb_gt_wvt_GetXYFromColRowRect( pWVT, colrowRC ); + rect = hb_gt_wvt_GetXYFromColRowRect( pWVT, colrowRC ); if( rect.left != s_rectOld.left || rect.top != s_rectOld.top || @@ -927,6 +927,7 @@ static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, L else { keyState = wParam; + switch( keyState ) { case MK_LBUTTON: