summaryrefslogtreecommitdiff
path: root/prototypes/textedit
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2010-07-19 17:31:05 +0200
committerGraeme Geldenhuys <graemeg@gmail.com>2010-07-19 17:31:05 +0200
commita9ada0f7341c2c0a54097e2145e374c73618985a (patch)
tree69b5e158cf62a729278be73711768300fb9e5b83 /prototypes/textedit
parentef3a63d6d58709064b95c0432bd6dda8ed665977 (diff)
downloadfpGUI-a9ada0f7341c2c0a54097e2145e374c73618985a.tar.xz
TextEdit: Fixed text selection painting.
* Even if OnDrawLine event handler exists, selection will also be painted. * Stopped using XOR, because the result looks very bad with anti-aliased text.
Diffstat (limited to 'prototypes/textedit')
-rw-r--r--prototypes/textedit/fpg_textedit.pas17
1 files changed, 12 insertions, 5 deletions
diff --git a/prototypes/textedit/fpg_textedit.pas b/prototypes/textedit/fpg_textedit.pas
index 88cd9d17..73c30b47 100644
--- a/prototypes/textedit/fpg_textedit.pas
+++ b/prototypes/textedit/fpg_textedit.pas
@@ -1453,12 +1453,16 @@ begin
if AllowDraw then
begin
Canvas.DrawText(R, S);
+ end;
if FSelected then
begin
+ Canvas.TextColor := clWhite;
+ Canvas.Color := fpgColorToRGB(clSelection);
if (ALineIndex > StartNo) and (ALineIndex < EndNo) then // whole line is selected
begin
R.SetRect(X, Y, UTF8Length(S) * FChrW, FChrH);
- Canvas.XORFillRectangle(fpgColorToRGB(clSelection) xor $FFFFFF, R);
+ Canvas.FillRectangle(R);
+ Canvas.DrawText(R, S);
end
else
begin
@@ -1472,7 +1476,8 @@ begin
else
SS := UTF8Copy(S, Si + 1, Ei - Si);
R.SetRect(X+(Si * FChrW), Y, (UTF8Length(SS) * FChrW), FChrH);
- Canvas.XORFillRectangle(fpgColorToRGB(clSelection) xor $FFFFFF, R);
+ Canvas.FillRectangle(R);
+ Canvas.DrawText(R, SS);
end
else
begin
@@ -1480,7 +1485,8 @@ begin
begin
SS := UTF8Copy(S, Si + 1, UTF8Length(S) - Si);
R.SetRect(X+(Si * FChrW), Y, (UTF8Length(SS) * FChrW), FChrH);
- Canvas.XORFillRectangle(fpgColorToRGB(clSelection) xor $FFFFFF, R);
+ Canvas.FillRectangle(R);
+ Canvas.DrawText(R, SS);
end
else
begin
@@ -1490,13 +1496,14 @@ begin
Ei := UTF8Length(S);
SS := UTF8Copy(S, 1, Ei);
R.SetRect(X, Y, (UTF8Length(SS) * FChrW), FChrH);
- Canvas.XORFillRectangle(fpgColorToRGB(clSelection) xor $FFFFFF, R);
+ Canvas.FillRectangle(R);
+ Canvas.DrawText(R, SS);
end;
end;
end;
end;
end; { if FSelected... }
- end; { if AllowDraw... }
+// end; { if AllowDraw... }
if UTF8Length(S) > FMaxScrollH then
begin