diff options
-rw-r--r-- | docview/components/richtext/RichTextLayoutUnit.pas | 39 | ||||
-rw-r--r-- | docview/components/richtext/RichTextView.pas | 4 |
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 |