source: trunk/StudioModules/LDModuleBasic/UFormSourceCode.pas

Last change on this file was 17, checked in by chronos, 12 years ago
  • Modified: Minor opened files and source management enhancement.
  • Added: Included used packages sources.
File size: 1.4 KB
Line 
1unit UFormSourceCode;
2
3{$mode delphi}{$H+}
4
5interface
6
7uses
8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
9 SynEdit, SynHighlighterPas, USource, ULDModuleBasic;
10
11type
12
13 { TFormSourceCode }
14
15 TFormSourceCode = class(TForm)
16 SynEditSource: TSynEdit;
17 SynPasSyn1: TSynPasSyn;
18 procedure SynEditSourceChange(Sender: TObject);
19 private
20 FSource: TSource;
21 FOnChange: TNotifyEvent;
22 procedure SetSource(AValue: TSource);
23 public
24 property Source: TSource read FSource write SetSource;
25 procedure Save;
26 procedure UpdateInterface;
27 property OnChange: TNotifyEvent read FOnChange write FOnChange;
28 end;
29
30var
31 FormSourceCode: TFormSourceCode;
32
33implementation
34
35
36{$R *.lfm}
37
38{ TFormSourceCode }
39
40procedure TFormSourceCode.SynEditSourceChange(Sender: TObject);
41begin
42 Save;
43 if Assigned(FOnChange) then
44 FOnChange(Self);
45end;
46
47procedure TFormSourceCode.SetSource(AValue: TSource);
48begin
49 if FSource = AValue then Exit;
50 FSource := AValue;
51 if Assigned(Source) and (Source is TSourceText) then
52 SynEditSource.Lines.Text := TSourceText(Source).Content.Text
53 else SynEditSource.ClearAll;
54end;
55
56procedure TFormSourceCode.Save;
57begin
58{ if Assigned(ProjectFile) then
59 ProjectFile.Source.Assign(SynEditSource.Lines);}
60end;
61
62procedure TFormSourceCode.UpdateInterface;
63begin
64// SynEditSource.Enabled := Assigned(DataModule1.Project);
65// if not Assigned(DataModule1.Project) then SynEditSource.ClearAll;
66end;
67
68end.
69
Note: See TracBrowser for help on using the repository browser.