diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 546b6bc7f3..ba6f8bb460 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,20 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2008-10-25 17:55 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * harbour/include/hbgtinfo.ch + + Added HB_GTI_SETPOS_XY + + Added HB_GTI_SETPOS_ROWCOL + + * harbour/rtl/gtwvt/gtwvt.c + ! Updated to honor HB_GTI_SETPOS_XY | HB_GTI_SETPOS_ROWCOL commands. + + * harbour/tests/wvtext.prg + ! Updated to demonstrate HB_GTI_SETPOS_XY|ROWCOL window positioning. + + ; Now every next browser window opens 20x20 pixels away from + previous window, a GT imposed Z-Order. + 2008-10-25 14:49 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * harbour/rtl/gtwvt/gtwvt.h + Added member to HB_GTWVT diff --git a/harbour/include/hbgtinfo.ch b/harbour/include/hbgtinfo.ch index 56e1fb9121..8d46059c49 100644 --- a/harbour/include/hbgtinfo.ch +++ b/harbour/include/hbgtinfo.ch @@ -130,6 +130,8 @@ #define HB_GTI_PALETTE 53 /* Get/Set console colors 1 - 16 given an array of 16 elements containing RGB colors */ #define HB_GTI_RESIZEMODE 54 /* Get/Set console resize mode : HB_GTI_RESIZEMODE_FONT | HB_GTI_RESIZEMODE_ROWS */ +#define HB_GTI_SETPOS_XY 55 /* Get/Set current top-left position coordinates of the window by pixels */ +#define HB_GTI_SETPOS_ROWCOL 56 /* Set current top-left position coordinates of the window by row/cols */ /* Font weights */ #define HB_GTI_FONTW_THIN 1 diff --git a/harbour/source/rtl/gtwvt/gtwvt.c b/harbour/source/rtl/gtwvt/gtwvt.c index fd9764340a..719e26843c 100644 --- a/harbour/source/rtl/gtwvt/gtwvt.c +++ b/harbour/source/rtl/gtwvt/gtwvt.c @@ -1568,7 +1568,7 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara { hb_gt_wvt_FitRows( pWVT ); hb_gt_wvt_AddCharToInputQueue( pWVT, K_HB_RESIZE ); - } + } return 0; case WM_SYSCOMMAND: @@ -1577,9 +1577,9 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara case SC_MAXIMIZE: { pWVT->bMaximized = TRUE; - + if ( pWVT->ResizeMode == HB_GTI_RESIZEMODE_FONT ) - { + { hb_gt_wvt_FitSize( pWVT ); } else @@ -2397,7 +2397,7 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) } } break; - } + } case HB_GTI_RESIZEMODE: { pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->ResizeMode ); @@ -2407,6 +2407,31 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) } break; } + case HB_GTI_SETPOS_XY: + case HB_GTI_SETPOS_ROWCOL: + { + if( ( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC ) && ( hb_itemType( pInfo->pNewVal2 ) & HB_IT_NUMERIC ) ) + { + int x, y; + RECT rect = { 0,0,0,0 }; + GetWindowRect( pWVT->hWnd, &rect ); + + x = hb_itemGetNI( pInfo->pNewVal ); + y = hb_itemGetNI( pInfo->pNewVal2 ); + if ( iType == HB_GTI_SETPOS_ROWCOL ) + { + x *= pWVT->PTEXTSIZE.x; + y *= pWVT->PTEXTSIZE.y; + } + hb_retl( SetWindowPos( pWVT->hWnd, NULL, + x, + y, + rect.right - rect.left, + rect.bottom - rect.top, + SWP_NOSIZE + SWP_NOZORDER ) ); + } + break; + } default: return HB_GTSUPER_INFO( pGT, iType, pInfo ); } @@ -2665,9 +2690,9 @@ static BOOL hb_gt_wvt_SetDispCP( PHB_GT pGT, const char * pszTermCDP, const char { for( i = 0; i < cdpHost->nChars; ++i ) { - pWVT->chrTransTbl[ ( BYTE ) cdpHost->CharsUpper[ i ] ] = + pWVT->chrTransTbl[ ( BYTE ) cdpHost->CharsUpper[ i ] ] = ( BYTE ) cdpTerm->CharsUpper[ i ]; - pWVT->chrTransTbl[ ( BYTE ) cdpHost->CharsLower[ i ] ] = + pWVT->chrTransTbl[ ( BYTE ) cdpHost->CharsLower[ i ] ] = ( BYTE ) cdpTerm->CharsLower[ i ]; } } @@ -2724,9 +2749,9 @@ static BOOL hb_gt_wvt_SetKeyCP( PHB_GT pGT, const char * pszTermCDP, const char { for( i = 0; i < cdpHost->nChars; ++i ) { - pWVT->keyTransTbl[ ( BYTE ) cdpTerm->CharsUpper[ i ] ] = + pWVT->keyTransTbl[ ( BYTE ) cdpTerm->CharsUpper[ i ] ] = ( BYTE ) cdpHost->CharsUpper[ i ]; - pWVT->keyTransTbl[ ( BYTE ) cdpTerm->CharsLower[ i ] ] = + pWVT->keyTransTbl[ ( BYTE ) cdpTerm->CharsLower[ i ] ] = ( BYTE ) cdpHost->CharsLower[ i ]; } } diff --git a/harbour/tests/wvtext.prg b/harbour/tests/wvtext.prg index ee13af5525..5583def662 100644 --- a/harbour/tests/wvtext.prg +++ b/harbour/tests/wvtext.prg @@ -219,7 +219,12 @@ PROCEDURE thFunc() Local aColor := { 'W+/N', 'W+/B', 'W+/G', 'W+/BG', 'W+/N*', 'W+/RB', 'N/W*', 'N/GR*' } static nBrowser := 0 + static nZx := 0 + static nZy := 0 + nBrowser++ + nZx += 20 + nZy += 20 /* allocate own GT driver */ hb_gtReload( 'WVT' ) @@ -243,6 +248,7 @@ PROCEDURE thFunc() SetMode( nRows,nCols ) SetColor( aColor[ nColorIndex ] ) Hb_GtInfo( HB_GTI_WINTITLE, cTitle ) + Hb_GtInfo( HB_GTI_SETPOS_XY, nZx, nZy ) cTitle := 'New Window with '+ltrim( str( MaxRow() ) )+; ' Rows and '+ltrim( str( MaxCol() ) )+' Columns'