2008-06-08 20:12 UTC+0800 Pritpal Bedi (pritpal@vouchcac.com
* harbour/source/rtl/gtwvt/gtwvt.c
* More fixes on resizing. Now appears to be behaving correctly. Please test.
* harbour/tests/wvtext.pr
* Formatting and typos.
This commit is contained in:
@@ -8,6 +8,13 @@
|
||||
2008-12-31 13:59 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
2008-06-08 20:12 UTC+0800 Pritpal Bedi (pritpal@vouchcac.com
|
||||
* harbour/source/rtl/gtwvt/gtwvt.c
|
||||
* More fixes on resizing. Now appears to be behaving correctly. Please test.
|
||||
|
||||
* harbour/tests/wvtext.pr
|
||||
* Formatting and typos.
|
||||
|
||||
2008-06-08 16:03 UTC+0800 Pritpal Bedi (pritpal@vouchcac.com
|
||||
* harbour/source/rtl/gtwvt/gtwvt.c
|
||||
* harbour/source/rtl/gtwvt/gtwvt.h
|
||||
|
||||
@@ -693,11 +693,12 @@ static void hb_gt_wvt_FitSize( PHB_GTWVT pWVT, USHORT mode )
|
||||
{
|
||||
HDC hdc;
|
||||
HFONT hOldFont, hFont;
|
||||
USHORT width, height, maxWidth, maxHeight, fontHeight, fontWidth, n;
|
||||
USHORT fontHeight, fontWidth, n;
|
||||
LONG width, height, maxWidth, maxHeight;
|
||||
SHORT left, top;
|
||||
TEXTMETRIC tm;
|
||||
RECT wi, ci;
|
||||
// char buff[ 100 ];
|
||||
BOOL bValid = TRUE;
|
||||
|
||||
HB_SYMBOL_UNUSED( mode );
|
||||
|
||||
@@ -711,10 +712,10 @@ static void hb_gt_wvt_FitSize( PHB_GTWVT pWVT, USHORT mode )
|
||||
GetClientRect( pWVT->hWnd, &ci );
|
||||
}
|
||||
|
||||
if( ci.left >= 0 && ci.top >= 0 )
|
||||
if( bValid )
|
||||
{
|
||||
maxWidth = ci.right - ci.left;
|
||||
maxHeight = ci.bottom - ci.top ;
|
||||
maxWidth = ci.right - ci.left ;
|
||||
fontHeight = maxHeight / pWVT->ROWS;
|
||||
fontWidth = maxWidth / pWVT->COLS;
|
||||
|
||||
@@ -723,13 +724,13 @@ static void hb_gt_wvt_FitSize( PHB_GTWVT pWVT, USHORT mode )
|
||||
{
|
||||
hdc = GetDC( pWVT->hWnd );
|
||||
hOldFont = ( HFONT ) SelectObject( hdc, hFont );
|
||||
GetTextMetrics( hdc, &tm );
|
||||
SetTextCharacterExtra( hdc, 0 );
|
||||
GetTextMetrics( hdc, &tm );
|
||||
SelectObject( hdc, hOldFont );
|
||||
ReleaseDC( pWVT->hWnd, hdc );
|
||||
|
||||
width = (USHORT) ( tm.tmAveCharWidth * pWVT->COLS );
|
||||
height = (USHORT) ( tm.tmHeight * pWVT->ROWS );
|
||||
width = ( tm.tmAveCharWidth * pWVT->COLS );
|
||||
height = ( tm.tmHeight * pWVT->ROWS );
|
||||
|
||||
if( width <= maxWidth && height <= maxHeight )
|
||||
{
|
||||
@@ -744,13 +745,13 @@ static void hb_gt_wvt_FitSize( PHB_GTWVT pWVT, USHORT mode )
|
||||
pWVT->PTEXTSIZE.x = tm.tmAveCharWidth;
|
||||
pWVT->PTEXTSIZE.y = tm.tmHeight;
|
||||
|
||||
#if defined(HB_WINCE)
|
||||
#if defined(HB_WINCE)
|
||||
pWVT->FixedFont = FALSE;
|
||||
#else
|
||||
#else
|
||||
pWVT->FixedFont = !pWVT->Win9X && pWVT->fontWidth >= 0 &&
|
||||
( tm.tmPitchAndFamily & TMPF_FIXED_PITCH ) == 0 &&
|
||||
( pWVT->PTEXTSIZE.x == tm.tmMaxCharWidth );
|
||||
#endif
|
||||
#endif
|
||||
for( n = 0; n < pWVT->COLS; n++ )
|
||||
{
|
||||
pWVT->FixedSize[ n ] = pWVT->PTEXTSIZE.x;
|
||||
@@ -758,26 +759,22 @@ static void hb_gt_wvt_FitSize( PHB_GTWVT pWVT, USHORT mode )
|
||||
|
||||
if( pWVT->bMaximized )
|
||||
{
|
||||
left = ( ( ci.right - width ) / 2 );
|
||||
top = ( ( ci.bottom - height ) / 2 );
|
||||
left = 0;
|
||||
top = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
left = wi.left;
|
||||
top = wi.top;
|
||||
width += ( USHORT ) ( wi.right - wi.left - ci.right );
|
||||
height += ( USHORT ) ( wi.bottom - wi.top - ci.bottom );
|
||||
left = ( wi.left < 0 ? 0 : wi.left );
|
||||
top = ( wi.top < 0 ? 0 : wi.top );
|
||||
width += ( wi.right - wi.left - ci.right );
|
||||
height += ( wi.bottom - wi.top - ci.bottom );
|
||||
}
|
||||
//sprintf( buff, "%d %d %d %d", left, top, width, height );
|
||||
//OutputDebugString( buff );
|
||||
if( ( left >= 0 ) && ( top >= 0 ) )
|
||||
{
|
||||
hb_gt_wvt_KillCaret( pWVT );
|
||||
hb_gt_wvt_UpdateCaret( pWVT );
|
||||
|
||||
SetWindowPos( pWVT->hWnd, NULL, left, top, width, height, SWP_NOZORDER );
|
||||
HB_GTSELF_EXPOSEAREA( pWVT->pGT, 0, 0, pWVT->ROWS, pWVT->COLS );
|
||||
}
|
||||
hb_gt_wvt_KillCaret( pWVT );
|
||||
hb_gt_wvt_UpdateCaret( pWVT );
|
||||
|
||||
SetWindowPos( pWVT->hWnd, NULL, left, top, width, height, SWP_NOZORDER );
|
||||
HB_GTSELF_EXPOSEAREA( pWVT->pGT, 0, 0, pWVT->ROWS, pWVT->COLS );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,11 +93,6 @@ STATIC FUNCTION DispScreen()
|
||||
|
||||
RETURN NIL
|
||||
|
||||
//----------------------------------------------------------------------//
|
||||
// Comment out this function if you do not want console window be resizable with mouse
|
||||
//
|
||||
//FUNCTION Hb_NoResizeableWindow() ; RETURN NIL
|
||||
|
||||
//----------------------------------------------------------------------//
|
||||
// Comment out this function if you do not want "Mark and Copy" prompt
|
||||
// available in SysMenu at the left of Title Bar of the application window.
|
||||
@@ -113,48 +108,3 @@ FUNCTION HB_GTSYS()
|
||||
RETURN nil
|
||||
|
||||
//----------------------------------------------------------------------//
|
||||
/*
|
||||
Private Sub SetWindowStyle(ByVal hwnd As Long, ByVal _
|
||||
extended_style As Boolean, ByVal style_value As Long, _
|
||||
ByVal new_value As Boolean, ByVal brefresh As Boolean)
|
||||
Dim style_type As Long
|
||||
Dim style As Long
|
||||
|
||||
If extended_style Then
|
||||
style_type = GWL_EXSTYLE
|
||||
Else
|
||||
style_type = GWL_STYLE
|
||||
End If
|
||||
|
||||
' Get the current style.
|
||||
style = GetWindowLong(hwnd, style_type)
|
||||
|
||||
' Add or remove the indicated value.
|
||||
If new_value Then
|
||||
style = style Or style_value
|
||||
Else
|
||||
style = style And Not style_value
|
||||
End If
|
||||
|
||||
' Hide Window if Changing ShowInTaskBar
|
||||
If brefresh Then
|
||||
ShowWindow hwnd, SW_HIDE
|
||||
End If
|
||||
|
||||
' Set the style.
|
||||
SetWindowLong hwnd, style_type, style
|
||||
|
||||
' Show Window if Changing ShowInTaskBar
|
||||
If brefresh Then
|
||||
ShowWindow hwnd, SW_SHOW
|
||||
End If
|
||||
|
||||
' Make the window redraw.
|
||||
SetWindowPos hwnd, 0, 0, 0, 0, 0, _
|
||||
SWP_FRAMECHANGED Or _
|
||||
SWP_NOMOVE Or _
|
||||
SWP_NOSIZE Or _
|
||||
SWP_NOZORDER
|
||||
End Sub
|
||||
*/
|
||||
//----------------------------------------------------------------------//
|
||||
|
||||
Reference in New Issue
Block a user