summaryrefslogtreecommitdiff
path: root/docview/components/richtext
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2010-02-23 20:32:09 +0200
committerGraeme Geldenhuys <graemeg@gmail.com>2010-02-23 20:32:09 +0200
commit02ed974023c3d2979b6868aeb038433338d3ed20 (patch)
tree0d85e6aea17a782f44c4122c1f0705bc85d369c1 /docview/components/richtext
parent74067b219ad0fc4d5937778fe7ac62cdb6b33ff7 (diff)
downloadfpGUI-02ed974023c3d2979b6868aeb038433338d3ed20.tar.xz
docview: content doesn't disappear as soon as it reaches the top/bottom edge
lines at top and bottom of richview component are now painted even if they are only partially visible. They don't suddenly disappear any more.
Diffstat (limited to 'docview/components/richtext')
-rw-r--r--docview/components/richtext/RichTextDisplayUnit.pas12
1 files changed, 8 insertions, 4 deletions
diff --git a/docview/components/richtext/RichTextDisplayUnit.pas b/docview/components/richtext/RichTextDisplayUnit.pas
index 5d16ab54..360deee5 100644
--- a/docview/components/richtext/RichTextDisplayUnit.pas
+++ b/docview/components/richtext/RichTextDisplayUnit.pas
@@ -304,17 +304,21 @@ ProfileEvent('DEBUG: DrawRichTextLayout >>>');
Y := StartPoint.Y + Layout.FRichTextSettings.Margins.Top;
LineIndex := 0;
+ // debug only to show Margins.
+ //FontManager.Canvas.Color:= clBlue;
+ //FontManager.Canvas.DrawLine(0, y, 300, y);
+
repeat
Line := Layout.FLines^[ LineIndex ];
- BottomOfLine := Y {+ Line.Height} + 1; // bottom pixel row is top + height + 1
+ BottomOfLine := Y;
if // the line is in the range to be drawn
( LineIndex >= StartLine )
and ( LineIndex <= EndLine )
// and the line is within the cliprect
- and ( BottomOfLine < FontManager.Canvas.GetClipRect.Bottom )
- and ( Y >= FontManager.Canvas.GetClipRect.Top ) then
+ and ( BottomOfLine < FontManager.Canvas.GetClipRect.Bottom ) // -> so we can see partial lines at bottom scroll into the screen
+ and ( Y >= FontManager.Canvas.GetClipRect.Top - Line.Height) then // -> so we can see partial lines at top scroll off the screen
begin
// draw it. First decided whether selection is started or not.
DrawRichTextLine( FontManager,
@@ -322,7 +326,7 @@ ProfileEvent('DEBUG: DrawRichTextLayout >>>');
SelectionStart,
SelectionEnd,
Line,
- Point( StartPoint.X, BottomOfLine ) );
+ Point(StartPoint.X, Y) );
end;
inc( Y, Line.Height );