summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2013-02-22 12:25:08 +0000
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2013-02-22 12:25:08 +0000
commit596f957ed701d22f32f6e03ad2c31f78ba9c2127 (patch)
tree5fa1e3e21bba94dcd6188a07ea47d2f7ec043257 /examples
parenta5799f99a0b3888aaf5c9f5b6b46701bbf5b4008 (diff)
downloadfpGUI-596f957ed701d22f32f6e03ad2c31f78ba9c2127.tar.xz
maximus: Adds syntax highlighting for hexadecimal numbers
Diffstat (limited to 'examples')
-rw-r--r--examples/apps/ide/src/frm_main.pas20
1 files changed, 19 insertions, 1 deletions
diff --git a/examples/apps/ide/src/frm_main.pas b/examples/apps/ide/src/frm_main.pas
index 0b221f6c..6c1ffb8c 100644
--- a/examples/apps/ide/src/frm_main.pas
+++ b/examples/apps/ide/src/frm_main.pas
@@ -167,7 +167,8 @@ const
cString1 = '''.*''';
cDecimal = '\b(([0-9]+)|([0-9]+\.[0-9]+([Ee][-]?[0-9]+)?))\b';
- cHexidecimal = '\b\$[0-9a-fA-F]*\b';
+ cHexadecimal = '\$[0-9a-fA-F]+';
+
{@VFD_NEWFORM_IMPL}
@@ -762,6 +763,23 @@ begin
until not FRegex.ExecNext;
end;
+ { syntax highlighting for: cHexadecimal }
+ ACanvas.TextColor := clMagenta;
+ FRegex.Expression := cHexadecimal;
+ if FRegex.Exec(ALineText) then
+ begin
+ repeat
+ lMatchPos := FRegex.MatchPos[0];
+ lOffset := FRegex.MatchLen[0];
+ s := FRegex.Match[0];
+ j := Length(s);
+ r.SetRect(ATextRect.Left + (edt.FontWidth * (lMatchPos-1)), ATextRect.Top,
+ (edt.FontWidth *j), ATextRect.Height);
+ ACanvas.FillRectangle(r);
+ ACanvas.DrawText(r, s);
+ until not FRegex.ExecNext;
+ end;
+
{ syntax highlighting for: comments2 }
ACanvas.TextColor := clDarkCyan;
FRegex.Expression := cComments2;