Changeset 97 for trunk/Forms/UFormSourceCode.pas
- Timestamp:
- Aug 2, 2018, 3:33:02 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormSourceCode.pas
r88 r97 6 6 7 7 uses 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 Menus, ActnList, strutils; 8 Classes, SysUtils, FileUtil, SynEdit, SynHighlighterIni, Forms, Controls, 9 Graphics, Dialogs, StdCtrls, Menus, ActnList, strutils, SynEditTypes, 10 SynEditHighlighter, SynHighlighterAny, SynHighlighterJava, UBFHighlighter; 10 11 11 12 type … … 23 24 AGenerateNumber: TAction; 24 25 ActionList1: TActionList; 25 MemoSource: TMemo;26 26 MenuItem1: TMenuItem; 27 27 MenuItem2: TMenuItem; … … 36 36 MenuItem6: TMenuItem; 37 37 PopupMenuSource: TPopupMenu; 38 SynEdit1: TSynEdit; 39 SynJavaSyn1: TSynJavaSyn; 38 40 procedure AClearExecute(Sender: TObject); 39 41 procedure ACopyToClipboardExecute(Sender: TObject); … … 44 46 procedure ASelectAllExecute(Sender: TObject); 45 47 procedure AShrinkSourceExecute(Sender: TObject); 48 procedure FormCreate(Sender: TObject); 46 49 procedure MemoSourceChange(Sender: TObject); 47 50 procedure MemoSourceKeyDown(Sender: TObject; var Key: Word; … … 53 56 Shift: TShiftState; X, Y: Integer); 54 57 private 58 BFHighlighter: TSynBrainFuckHl; 55 59 public 56 60 procedure UpdateInterface; 61 procedure UpdateTheme; 57 62 end; 58 63 … … 62 67 63 68 implementation 69 70 {$R *.lfm} 64 71 65 72 uses … … 70 77 SEnterNumber = 'Enter number'; 71 78 72 73 {$R *.lfm}74 79 75 80 { TFormSourceCode } … … 86 91 for I := 0 to Number - 1 do 87 92 NumberText := NumberText + '+'; 88 MemoSource.SelText := NumberText;93 SynEdit1.SelText := NumberText; 89 94 end; 90 95 end; … … 92 97 procedure TFormSourceCode.APasteFromClipboardExecute(Sender: TObject); 93 98 begin 94 MemoSource.PasteFromClipboard;99 SynEdit1.PasteFromClipboard; 95 100 end; 96 101 97 102 procedure TFormSourceCode.ASelectAllExecute(Sender: TObject); 98 103 begin 99 MemoSource.SelectAll;104 SynEdit1.SelectAll; 100 105 end; 101 106 … … 109 114 IndentText = ' '; 110 115 begin 111 Source := MemoSource.Text;116 Source := SynEdit1.Text; 112 117 NewSource := ''; 113 118 Indent := 0; … … 125 130 NewSource := NewSource + Source[I]; 126 131 end; 127 MemoSource.Text := NewSource;132 SynEdit1.Text := NewSource; 128 133 end; 129 134 130 135 procedure TFormSourceCode.ACopyToClipboardExecute(Sender: TObject); 131 136 begin 132 MemoSource.CopyToClipboard;137 SynEdit1.CopyToClipboard; 133 138 end; 134 139 135 140 procedure TFormSourceCode.ACutToClipboardExecute(Sender: TObject); 136 141 begin 137 MemoSource.CutToClipboard;142 SynEdit1.CutToClipboard; 138 143 end; 139 144 140 145 procedure TFormSourceCode.AClearExecute(Sender: TObject); 141 146 begin 142 MemoSource.Clear;147 SynEdit1.Clear; 143 148 end; 144 149 … … 149 154 I: Integer; 150 155 begin 151 Source := MemoSource.Text;156 Source := SynEdit1.Text; 152 157 Pos := 1; 153 158 for I := 1 to Length(Source) do begin … … 158 163 end; 159 164 SetLength(Source, Pos - 1); 160 MemoSource.Text := Source; 165 SynEdit1.Text := Source; 166 end; 167 168 procedure TFormSourceCode.FormCreate(Sender: TObject); 169 begin 170 BFHighlighter := TSynBrainFuckHl.Create(nil); 171 SynEdit1.Highlighter := BFHighlighter; 161 172 end; 162 173 … … 164 175 begin 165 176 177 end; 178 179 procedure TFormSourceCode.UpdateTheme; 180 const 181 clLightBlue = TColor($FF8080); 182 clLightGreen = TColor($80FF80); 183 clLightRed = TColor($8080FF); 184 begin 185 if Core.ThemeManager.Theme.Name = 'Dark' then begin 186 BFHighlighter.IoAttri.Foreground := clWhite; 187 BFHighlighter.LoopAttri.Foreground := clLightRed; 188 BFHighlighter.PointerAttri.Foreground := clLightBlue; 189 BFHighlighter.MemoryAttri.Foreground := clLightGreen; 190 end else begin 191 BFHighlighter.IoAttri.Foreground := clBlack; 192 BFHighlighter.LoopAttri.Foreground := clRed; 193 BFHighlighter.PointerAttri.Foreground := clBlue; 194 BFHighlighter.MemoryAttri.Foreground := clGreen; 195 end; 166 196 end; 167 197
Note:
See TracChangeset
for help on using the changeset viewer.