diff options
Diffstat (limited to 'docview')
-rw-r--r-- | docview/components/richtext/RichTextView.pas | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/docview/components/richtext/RichTextView.pas b/docview/components/richtext/RichTextView.pas index 5272eee3..d5733173 100644 --- a/docview/components/richtext/RichTextView.pas +++ b/docview/components/richtext/RichTextView.pas @@ -206,9 +206,9 @@ Type // Rectangle (GetClientRect) minus scrollbars (if they are enabled) Function GetDrawRect: TfpgRect; // Rectangle minus scrollbars (GetDrawRect), minus extra 2px border all round - Function GetTextAreaRect: TfpgRect; - Function GetTextAreaHeight: longint; - Function GetTextAreaWidth: longint; + function GetTextAreaRect: TfpgRect; + function GetTextAreaHeight: longint; + function GetTextAreaWidth: longint; // Queries procedure GetFirstVisibleLine( Var LineIndex: longint; Var Offset: longint ); @@ -1159,20 +1159,14 @@ begin InflateRect(Result, -2, -2); end; -Function TRichTextView.GetTextAreaHeight: longint; -var - TextArea: TfpgRect; +function TRichTextView.GetTextAreaHeight: longint; begin - TextArea := GetTextAreaRect; - Result := TextArea.Height; + Result := GetTextAreaRect.Height; end; -Function TRichTextView.GetTextAreaWidth: longint; +function TRichTextView.GetTextAreaWidth: longint; begin - Result := Width; - //if FBorderStyle <> bsNone then - dec( Result, 4 ); // borders of component - dec( Result, FScrollBarWidth ); // always allow space for vscrollbar + Result := GetTextAreaRect.Width; end; Procedure TRichTextView.SetupScrollbars; @@ -1180,15 +1174,15 @@ var AvailableWidth: longint; MaxDisplayWidth: longint; AvailableHeight: longint; -Begin +begin + // Reset to defaults + FNeedVScroll := false; + FNeedHScroll := false; + // Calculate used and available width AvailableWidth := GetTextAreaWidth; MaxDisplayWidth := FLayout.Width; - // Defaults - FNeedVScroll := false; - FNeedHScroll := false; - // Horizontal scroll setup if MaxDisplayWidth > AvailableWidth then FNeedHScroll := true; |