summaryrefslogtreecommitdiff
path: root/docview/components/richtext
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2011-07-23 22:43:08 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2011-07-23 22:43:08 +0200
commiteb764f92768f38b44e919b3204a03df935be7da6 (patch)
treee26ac8681c0c32a728a69e99b316aca4bf63055f /docview/components/richtext
parent7b06241153769185f08fc6adf60a76dc320b5cfb (diff)
downloadfpGUI-eb764f92768f38b44e919b3204a03df935be7da6.tar.xz
docview: minor code formatting improvements.
Diffstat (limited to 'docview/components/richtext')
-rw-r--r--docview/components/richtext/RichTextLayoutUnit.pas39
-rw-r--r--docview/components/richtext/RichTextView.pas4
2 files changed, 18 insertions, 25 deletions
diff --git a/docview/components/richtext/RichTextLayoutUnit.pas b/docview/components/richtext/RichTextLayoutUnit.pas
index 004c2ef1..d2cd5ee4 100644
--- a/docview/components/richtext/RichTextLayoutUnit.pas
+++ b/docview/components/richtext/RichTextLayoutUnit.pas
@@ -45,14 +45,13 @@ Type
end;
- TTextPosition =
- (
- tpAboveTextArea,
- tpAboveText,
- tpWithinText,
- tpBelowText,
- tpBelowTextArea
- );
+ TTextPosition = (
+ tpAboveTextArea,
+ tpAboveText,
+ tpWithinText,
+ tpBelowText,
+ tpBelowTextArea
+ );
// forward declaration
@@ -84,8 +83,7 @@ Type
const X: longint );
function GetElementWidth( Element: TTextElement ): longint;
// Queries
- Function GetStartX( Style: TTextDrawStyle;
- Line: TLayoutLine ): longint;
+ Function GetStartX( Style: TTextDrawStyle; Line: TLayoutLine ): longint;
Procedure GetXFromOffset( const Offset: longint;
const LineIndex: longint;
Var X: longint );
@@ -112,7 +110,7 @@ Type
// property handlers
Function GetCharIndex( P: PChar ): longint;
Function GetTextEnd: longint;
- Public
+ public
constructor Create(Text: PChar; Images: TfpgImageList; RichTextSettings: TRichTextSettings; FontManager: TCanvasFontManager; AWidth: longint);
destructor Destroy; Override;
function LinkFromIndex( const CharIndexToFind: longint): string;
@@ -122,11 +120,16 @@ Type
property Height: longint read FHeight;
property HorizontalImageScale: double read FHorizontalImageScale;
property VerticalImageScale: double read FVerticalImageScale;
- End;
+ end;
-Implementation
+implementation
+uses
+ SysUtils,
+ ACLStringUtility,
+ nvUtilities,
+ fpg_main;
{ TLayoutLineList }
@@ -168,12 +171,6 @@ end;
{ TRichTextLayout }
-Uses
- SysUtils
- ,ACLStringUtility
- ,nvUtilities
- ,fpg_main
- ;
Function TRichTextLayout.GetTextEnd: longint;
begin
@@ -891,9 +888,7 @@ var
Remainder: longint;
begin
Link := '';
- Result := GetLineFromPosition( YToFind,
- LineIndex,
- Remainder );
+ Result := GetLineFromPosition(YToFind, LineIndex, Remainder);
case Result of
tpAboveText:
begin
diff --git a/docview/components/richtext/RichTextView.pas b/docview/components/richtext/RichTextView.pas
index 0b183ff8..f65d22fb 100644
--- a/docview/components/richtext/RichTextView.pas
+++ b/docview/components/richtext/RichTextView.pas
@@ -1322,9 +1322,7 @@ begin
Line := FLayout.FLines[CursorRow];
LineHeight := Line.Height;
- Y := DrawHeight
- - ( FLayout.GetLinePosition( CursorRow )
- - FVScrollbar.Position );
+ Y := DrawHeight - (FLayout.GetLinePosition(CursorRow) - FVScrollbar.Position);
// Now Y is the top of the line
if Y < 0 then
// off bottom