diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6aeb17e278..621fa05800 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,17 @@ The license applies to all entries newer than 2009-04-28. */ +2011-06-17 20:27 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbgtinfo.ch + * harbour/src/rtl/gtwvt/gtwvt.c + + added support for HB_GTI_MAXIMIZED + Patch created by Heinz V. Bergen - thank you. + + * harbour/src/common/hbstr.c + % simplified hb_strAt() code and added missing stop condition. + This modification also quite nicely optimized the average speed + of AT() function and $ operator. + 2011-06-17 19:33 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * package/winuni/mpkg_win_uni.bat * package/mpkg_win_nightly.bat diff --git a/harbour/include/hbgtinfo.ch b/harbour/include/hbgtinfo.ch index 262c8e2b22..d60a3b41bd 100644 --- a/harbour/include/hbgtinfo.ch +++ b/harbour/include/hbgtinfo.ch @@ -147,6 +147,8 @@ #define HB_GTI_ONLINE 64 /* Is terminal connected? */ #define HB_GTI_VERSION 65 /* Get terminal version string */ +#define HB_GTI_MAXIMIZED 66 /* Get/Set Window's Maximized status (supported by: GTWVT) */ + /* Font weights */ #define HB_GTI_FONTW_THIN 1 #define HB_GTI_FONTW_NORMAL 2 diff --git a/harbour/src/common/hbstr.c b/harbour/src/common/hbstr.c index 2000813834..31c29197c2 100644 --- a/harbour/src/common/hbstr.c +++ b/harbour/src/common/hbstr.c @@ -89,30 +89,24 @@ HB_SIZE hb_strAt( const char * szSub, HB_SIZE nSubLen, const char * szText, HB_S if( nSubLen > 0 && nLen >= nSubLen ) { HB_SIZE nPos = 0; - HB_SIZE nSubPos = 0; - - while( nPos < nLen && nSubPos < nSubLen ) + nLen -= nSubLen; + do { - if( szText[ nPos ] == szSub[ nSubPos ] ) + if( szText[ nPos ] == *szSub ) { - nSubPos++; - nPos++; + HB_SIZE nSubPos = nSubLen; + do + { + if( --nSubPos == 0 ) + return nPos + 1; + } + while( szText[ nPos + nSubPos ] == szSub[ nSubPos ] ); } - else if( nSubPos ) - { - /* Go back to the first character after the first match, - or else tests like "22345" $ "012223456789" will fail. */ - nPos -= ( nSubPos - 1 ); - nSubPos = 0; - } - else - nPos++; } - - return ( nSubPos < nSubLen ) ? 0 : ( nPos - nSubLen + 1 ); + while( nPos++ < nLen ); } - else - return 0; + + return 0; } HB_BOOL hb_strEmpty( const char * szText, HB_SIZE nLen ) diff --git a/harbour/src/rtl/gtwvt/gtwvt.c b/harbour/src/rtl/gtwvt/gtwvt.c index b16d4591f5..7e0b90ff2c 100644 --- a/harbour/src/rtl/gtwvt/gtwvt.c +++ b/harbour/src/rtl/gtwvt/gtwvt.c @@ -1960,8 +1960,8 @@ static HB_BOOL hb_gt_wvt_CreateConsoleWindow( PHB_GTWVT pWVT ) } else { - ShowWindow( pWVT->hWnd, pWVT->iCmdShow ); - UpdateWindow( pWVT->hWnd ); + ShowWindow( pWVT->hWnd, pWVT->bMaximized ? SW_SHOWMAXIMIZED : pWVT->iCmdShow ); + UpdateWindow( pWVT->hWnd ); } } @@ -2278,6 +2278,24 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) switch( iType ) { + case HB_GTI_MAXIMIZED: + pInfo->pResult = hb_itemPutL( pInfo->pResult, pWVT->bMaximized ); + if( hb_itemType( pInfo->pNewVal ) & HB_IT_LOGICAL ) + { + if( hb_itemGetL( pInfo->pNewVal ) != pWVT->bMaximized && !pWVT->bFullScreen ) + { + if( !pWVT->hWnd ) + pWVT->bMaximized = hb_itemGetL( pInfo->pNewVal ); + else if( pWVT->bMaximized ) + /* Restore Window */ + ShowWindow( pWVT->hWnd, SW_RESTORE ); + else + /* Maximize Window */ + ShowWindow( pWVT->hWnd, SW_SHOWMAXIMIZED ); + } + } + break; + case HB_GTI_ISFULLSCREEN: pInfo->pResult = hb_itemPutL( pInfo->pResult, pWVT->bFullScreen ); if( hb_itemType( pInfo->pNewVal ) & HB_IT_LOGICAL )