Changeset 106 for trunk/Forms/UFormTargetCode.pas
- Timestamp:
- May 6, 2019, 11:03:00 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormTargetCode.pas
r91 r106 6 6 7 7 uses 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 Menus, ActnList, strutils; 8 Classes, SysUtils, FileUtil, SynEdit, SynHighlighterAny, SynHighlighterPas, 9 SynHighlighterCpp, SynHighlighterPHP, SynHighlighterJava, 10 SynHighlighterPython, Forms, Controls, Graphics, Dialogs, StdCtrls, Menus, 11 ActnList, strutils; 10 12 11 13 type … … 17 19 AFormatCode: TAction; 18 20 ActionList1: TActionList; 19 MemoTarget: TMemo;20 21 MenuItem1: TMenuItem; 21 22 MenuItem20: TMenuItem; 22 23 PopupMenuTarget: TPopupMenu; 24 SynEditTarget: TSynEdit; 23 25 procedure AFormatCodeExecute(Sender: TObject); 24 26 procedure AShrinkCodeExecute(Sender: TObject); … … 26 28 { private declarations } 27 29 public 28 { public declarations }30 procedure SetHighlighter(SourceExt: string); 29 31 end; 30 32 … … 47 49 IndentText = ' '; 48 50 begin 49 Source := MemoTarget.Text;51 Source := SynEditTarget.Text; 50 52 NewSource := ''; 51 53 Indent := 0; … … 63 65 NewSource := NewSource + Source[I]; 64 66 end; 65 MemoTarget.Text := NewSource;67 SynEditTarget.Text := NewSource; 66 68 end; 67 69 … … 72 74 I: Integer; 73 75 begin 74 Source := MemoTarget.Text;76 Source := SynEditTarget.Text; 75 77 Pos := 1; 76 78 for I := 1 to Length(Source) do begin … … 81 83 end; 82 84 SetLength(Source, Pos - 1); 83 MemoTarget.Text := Source; 85 SynEditTarget.Text := Source; 86 end; 87 88 procedure TFormTargetCode.SetHighlighter(SourceExt: string); 89 begin 90 if Assigned(SynEditTarget.Highlighter) then 91 SynEditTarget.Highlighter.Free; 92 if SourceExt = '.pas' then SynEditTarget.Highlighter := TSynPasSyn.Create(nil) 93 else if SourceExt = '.c' then SynEditTarget.Highlighter := TSynCppSyn.Create(nil) 94 else if SourceExt = '.php' then SynEditTarget.Highlighter := TSynPhpSyn.Create(nil) 95 else if SourceExt = '.java' then SynEditTarget.Highlighter := TSynJavaSyn.Create(nil) 96 else if SourceExt = '.py' then SynEditTarget.Highlighter := TSynPythonSyn.Create(nil); 84 97 end; 85 98
Note:
See TracChangeset
for help on using the changeset viewer.