Revision: 4282
http://sourceforge.net/p/gexperts/code/4282
Author: akalwahome
Date: 2024-07-06 20:01:13 +0000 (Sat, 06 Jul 2024)
Log Message:
-----------
File preview now uses SynEdit control with selected editor font and syntax highlighting.
Modified Paths:
--------------
trunk/ExternalSource/FileView.pas
Modified: trunk/ExternalSource/FileView.pas
===================================================================
--- trunk/ExternalSource/FileView.pas 2024-07-06 19:48:54 UTC (rev 4281)
+++ trunk/ExternalSource/FileView.pas 2024-07-06 20:01:13 UTC (rev 4282)
@@ -36,7 +36,8 @@
implementation
uses
- Controls, Forms, Graphics, StdCtrls, SysUtils, GX_OtaUtils, GX_StringList;
+ Controls, Forms, Graphics, StdCtrls, SysUtils,
+ GX_OtaUtils, GX_StringList;
constructor TFileViewer.Create(AOwner: TComponent);
begin
@@ -77,6 +78,7 @@
Gutter.Width := 0;
Visible := False;
end;
+ GxOtaGetEditorFont(FEditor.Font, -1);
{$ENDIF SYNEDIT}
end;
end;
@@ -124,10 +126,11 @@
finally
FreeAndNil(Strings);
end;
- begin
- SetSynEditHighlighter(FEditor, Parser);
- FGXSyntaxParser := Parser;
- end;
+ if Parser > gxpNone then
+ GxOtaGetEditorFont(FEditor.Font, -1);
+
+ SetSynEditHighlighter(FEditor, Parser);
+ FGXSyntaxParser := Parser;
FEditor.Visible := True;
end;
{$ENDIF SYNEDIT}
@@ -174,6 +177,9 @@
{$IFDEF SYNEDIT}
FEditor.Visible := False;
{$ENDIF SYNEDIT}
+// TODO: Use IDE's editor font?
+// FRichEdit.Font.Name := '';
+// FRichEdit.DefAttributes.Name := '';
FRichEdit.Lines.LoadFromFile(FileName);
FRichEdit.Visible := True;
end
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|