2009-12-23 05:36 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/src/rtl/gtwin/gtwin.c
    ! applied a little bit modified the patch from Jacek Potempa for
      setmode() in GTWIN - many thanks. Please test.
This commit is contained in:
Przemyslaw Czerpak
2009-12-23 04:37:00 +00:00
parent fd83ae6f35
commit bb05aaa0e0
2 changed files with 50 additions and 4 deletions

View File

@@ -17,6 +17,11 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-12-23 05:36 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/src/rtl/gtwin/gtwin.c
! applied a little bit modified the patch from Jacek Potempa for
setmode() in GTWIN - many thanks. Please test.
2009-12-23 02:59 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* utils/hbmk2/hbmk2.pt_BR.po
! Restored stripped accents while saving the file with Windows-1250 CP

View File

@@ -865,24 +865,65 @@ static BOOL hb_gt_win_SetMode( PHB_GT pGT, int iRows, int iCols )
srWin.Bottom = ( SHORT ) ( iRows - 1 );
srWin.Right = ( SHORT ) ( iCols - 1 );
/* if the current buffer is larger than what we want, resize the */
/* console window first, then the buffer */
if( ( DWORD ) _GetScreenWidth() * _GetScreenHeight() > ( DWORD ) iCols * iRows )
if( ( int ) _GetScreenWidth() >= iCols &&
( int ) _GetScreenHeight() >= iRows )
{
/* the new dimensions do not exceed the current buffer dimensions so
* we can safely resize the console window first, then the buffer
*/
if( SetConsoleWindowInfo( s_HOutput, TRUE, &srWin ) )
{
SetConsoleScreenBufferSize( s_HOutput, coBuf );
fRet = TRUE;
}
}
else
else if( ( int ) _GetScreenWidth() <= iCols &&
( int ) _GetScreenHeight() <= iRows )
{
/* none of the current buffer dimensions is larger then the
* new dimensions so we can safely enlarge the buffer to new
* dimensions then adjust the console window dimensions
*/
if( SetConsoleScreenBufferSize( s_HOutput, coBuf ) )
{
SetConsoleWindowInfo( s_HOutput, TRUE, &srWin );
fRet = TRUE;
}
}
else
{
/* one of the new dimensions is smaller and second larger then the
* current buffer dimensions. Windows API needs to keep the buffer
* dimensions not smaller then console window size and there is
* no single API call which allow to change both buffer and console
* window dimensions. It means that we have to resize one of the
* above objects in two steps. We can temporary enlarge the buffer
* dimensions or reduce the console window dimensions.
* To reduce the possibility that we will exploit some WIN API
* limits for the maximum buffer size instead of enlarging it we
* decrease the one of console window dimensions which is larger
* then the corresponding new one.
*/
if( ( int ) _GetScreenWidth() < iCols )
srWin.Right = ( SHORT ) ( _GetScreenWidth() - 1 );
else
srWin.Bottom = ( SHORT ) ( _GetScreenHeight() - 1 );
if( SetConsoleWindowInfo( s_HOutput, TRUE, &srWin ) )
{
/* now we can safely set the new buffer dimensions because
* none of them is smaller then corresponding dimensions of
* just reduced console window and then we set final console
* window size.
*/
if( SetConsoleScreenBufferSize( s_HOutput, coBuf ) )
{
srWin.Bottom = ( SHORT ) ( iRows - 1 );
srWin.Right = ( SHORT ) ( iCols - 1 );
SetConsoleWindowInfo( s_HOutput, TRUE, &srWin );
}
fRet = TRUE;
}
}
if( fRet )
hb_gt_win_xInitScreenParam( pGT );