source: trunk/Forms/UInstanceOptions.pas

Last change on this file was 9, checked in by chronos, 13 years ago
  • Fixed: Instance compilation on Linux.
File size: 3.0 KB
Line 
1unit UInstanceOptions;
2
3{$mode objfpc}{$H+}
4
5interface
6
7uses
8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
9 ComCtrls, ExtCtrls, DOM, XMLWrite, XMLRead, USource, UInstance,
10 USourceSelection;
11
12type
13
14 { TInstanceOptionsForm }
15
16 TInstanceOptionsForm = class(TForm)
17 Button1: TButton;
18 Button2: TButton;
19 ButtonCancel: TButton;
20 ButtonOk: TButton;
21 Edit1: TEdit;
22 Edit2: TEdit;
23 Edit3: TEdit;
24 Label1: TLabel;
25 Label2: TLabel;
26 Label3: TLabel;
27 procedure Button1Click(Sender: TObject);
28 procedure Button2Click(Sender: TObject);
29 procedure ButtonCancelClick(Sender: TObject);
30 procedure ButtonOkClick(Sender: TObject);
31 procedure FormCreate(Sender: TObject);
32 procedure FormDestroy(Sender: TObject);
33 procedure FormShow(Sender: TObject);
34 private
35 IsNew: Boolean;
36 public
37 Instance: TInstance;
38 FPCSource: TSource;
39 IDESource: TSource;
40 end;
41
42var
43 InstanceOptionsForm: TInstanceOptionsForm;
44
45implementation
46
47{$R *.lfm}
48
49uses
50 UMainForm;
51
52{ TInstanceOptionsForm }
53
54procedure TInstanceOptionsForm.ButtonOkClick(Sender: TObject);
55begin
56 Instance.Name := Edit1.Text;
57 Instance.FPCSource := FPCSource;
58 Instance.IDESource := IDESource;
59end;
60
61procedure TInstanceOptionsForm.ButtonCancelClick(Sender: TObject);
62begin
63 if IsNew then Instance.Free;
64end;
65
66procedure TInstanceOptionsForm.Button1Click(Sender: TObject);
67begin
68 SourceSelectionForm.ProjectType := 'Compiler';
69 if SourceSelectionForm.ShowModal = mrOk then begin
70 if Assigned(SourceSelectionForm.ListView1.Selected) then
71 FPCSource := TSource(SourceSelectionForm.ListView1.Selected.Data)
72 else FPCSource := nil;
73 if Assigned(FPCSource) then
74 Edit2.Text := FPCSource.GetName
75 else Edit2.Text := '';
76 end;
77end;
78
79procedure TInstanceOptionsForm.Button2Click(Sender: TObject);
80begin
81 SourceSelectionForm.ProjectType := 'IDE';
82 if SourceSelectionForm.ShowModal = mrOk then begin
83 if Assigned(SourceSelectionForm.ListView1.Selected) then
84 IDESource := TSource(SourceSelectionForm.ListView1.Selected.Data)
85 else IDESource := nil;
86 if Assigned(IDESource) then
87 Edit3.Text := IDESource.GetName
88 else Edit3.Text := '';
89 end;
90end;
91
92procedure TInstanceOptionsForm.FormCreate(Sender: TObject);
93begin
94end;
95
96procedure TInstanceOptionsForm.FormDestroy(Sender: TObject);
97begin
98end;
99
100procedure TInstanceOptionsForm.FormShow(Sender: TObject);
101begin
102 if not Assigned(Instance) then begin
103 Instance := TInstance.Create;
104 Instance.Id := MainForm.Instances.GetNewId;
105 Instance.Name := 'Instance ' + IntToStr(Instance.Id);
106 IsNew := True;
107 end else IsNew := False;
108
109 Edit1.Text := Instance.Name;
110 FPCSource := Instance.FPCSource;
111 IDESource := Instance.IDESource;
112 if Assigned(FPCSource) then
113 Edit2.Text := FPCSource.GetName
114 else Edit2.Text := '';
115 if Assigned(IDESource) then
116 Edit3.Text := IDESource.GetName
117 else Edit3.Text := '';
118end;
119
120end.
121
Note: See TracBrowser for help on using the repository browser.