summaryrefslogtreecommitdiff
path: root/docview/components
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2010-02-24 00:19:33 +0200
committerGraeme Geldenhuys <graemeg@gmail.com>2010-02-24 00:19:33 +0200
commit24bc55d1741fd6354ee6e0391c2777604be7a27e (patch)
tree15352c9807f432f4a757897f35ad0b1afb847ce5 /docview/components
parent7729cc2a27021b1e3e378283d7111d7ecedd05be (diff)
downloadfpGUI-24bc55d1741fd6354ee6e0391c2777604be7a27e.tar.xz
docview: GetTextAreaWidth implementation fix
Also some minor code formatting changes.
Diffstat (limited to 'docview/components')
-rw-r--r--docview/components/richtext/RichTextView.pas30
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;