1 | unit UMainForm;
|
---|
2 |
|
---|
3 | {$mode objfpc}{$H+}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Menus,
|
---|
9 | ActnList, ExtCtrls, ComCtrls, StdCtrls, UCDClient, UCDLayout,
|
---|
10 | UToolPaletteForm, UObjectInspectorForm, UProjectManagerForm, UStructureForm,
|
---|
11 | UMessagesForm, UCallStackForm, ULocalVariablesForm, UToDoListForm,
|
---|
12 | UWatchListForm, UThreadStatusForm, USourceEditorForm, UCDWindowList,
|
---|
13 | UCDCustomize, UComponentTree, UCDConjoinForm, UCDManager,
|
---|
14 | UCDMaster, UCDCommon;
|
---|
15 |
|
---|
16 | const
|
---|
17 | DefaultLayoutName = 'Default Layout';
|
---|
18 | DockLayoutFileName = 'Layout.xml';
|
---|
19 |
|
---|
20 | type
|
---|
21 |
|
---|
22 | { TMainForm }
|
---|
23 |
|
---|
24 | TMainForm = class(TForm)
|
---|
25 | published
|
---|
26 | AResetDefaultLayout: TAction;
|
---|
27 | AViewComponentTree: TAction;
|
---|
28 | AExit: TAction;
|
---|
29 | ANewFile: TAction;
|
---|
30 | ACustomizeDocking: TAction;
|
---|
31 | ADesktopSave: TAction;
|
---|
32 | AViewThreadStatus: TAction;
|
---|
33 | AViewWatchList: TAction;
|
---|
34 | AViewToDoList: TAction;
|
---|
35 | AViewLocalVariables: TAction;
|
---|
36 | AViewCallStack: TAction;
|
---|
37 | AViewMessages: TAction;
|
---|
38 | AViewStructure: TAction;
|
---|
39 | AViewToolPalette: TAction;
|
---|
40 | AViewProjectManager: TAction;
|
---|
41 | AViewObjectInspector: TAction;
|
---|
42 | AViewWindowList: TAction;
|
---|
43 | ComboBox1: TComboBox;
|
---|
44 | CoolDockClient1: TCDClient;
|
---|
45 | CoolDockCustomize1: TCDCustomize;
|
---|
46 | CoolDockLayoutList1: TCDLayoutList;
|
---|
47 | CoolDockMaster1: TCDMaster;
|
---|
48 | CoolDockWindowList1: TCDWindowList;
|
---|
49 | ImageList1: TImageList;
|
---|
50 | Label1: TLabel;
|
---|
51 | MenuItem11: TMenuItem;
|
---|
52 | MenuItem10: TMenuItem;
|
---|
53 | MenuItem12: TMenuItem;
|
---|
54 | MenuItem13: TMenuItem;
|
---|
55 | MenuItem14: TMenuItem;
|
---|
56 | MenuItem15: TMenuItem;
|
---|
57 | MenuItem16: TMenuItem;
|
---|
58 | MenuItem17: TMenuItem;
|
---|
59 | MenuItem18: TMenuItem;
|
---|
60 | MenuItem19: TMenuItem;
|
---|
61 | MenuItem20: TMenuItem;
|
---|
62 | MenuItem21: TMenuItem;
|
---|
63 | MenuItem22: TMenuItem;
|
---|
64 | MenuItem23: TMenuItem;
|
---|
65 | MenuItem24: TMenuItem;
|
---|
66 | MenuItem25: TMenuItem;
|
---|
67 | MenuItem26: TMenuItem;
|
---|
68 | MenuItem27: TMenuItem;
|
---|
69 | MenuItem28: TMenuItem;
|
---|
70 | MenuItem9: TMenuItem;
|
---|
71 | MenuItem8: TMenuItem;
|
---|
72 | MenuItem7: TMenuItem;
|
---|
73 | MenuItem6: TMenuItem;
|
---|
74 | MenuItem5: TMenuItem;
|
---|
75 | MenuItem4: TMenuItem;
|
---|
76 | MenuItem3: TMenuItem;
|
---|
77 | MenuItem2: TMenuItem;
|
---|
78 | ActionList1: TActionList;
|
---|
79 | MenuItem1: TMenuItem;
|
---|
80 | MainMenu1: TMainMenu;
|
---|
81 | DockPanel: TPanel;
|
---|
82 | ToolBar1: TToolBar;
|
---|
83 | ToolButton1: TToolButton;
|
---|
84 | procedure ACustomizeDockingExecute(Sender: TObject);
|
---|
85 | procedure ADesktopSaveExecute(Sender: TObject);
|
---|
86 | procedure AExitExecute(Sender: TObject);
|
---|
87 | procedure ANewFileExecute(Sender: TObject);
|
---|
88 | procedure AResetDefaultLayoutExecute(Sender: TObject);
|
---|
89 | procedure AViewComponentTreeExecute(Sender: TObject);
|
---|
90 | procedure AViewThreadStatusExecute(Sender: TObject);
|
---|
91 | procedure AViewCallStackExecute(Sender: TObject);
|
---|
92 | procedure AViewLocalVariablesExecute(Sender: TObject);
|
---|
93 | procedure AViewMessagesExecute(Sender: TObject);
|
---|
94 | procedure AViewObjectInspectorExecute(Sender: TObject);
|
---|
95 | procedure AViewProjectManagerExecute(Sender: TObject);
|
---|
96 | procedure AViewStructureExecute(Sender: TObject);
|
---|
97 | procedure AViewToDoListExecute(Sender: TObject);
|
---|
98 | procedure AViewToolPaletteExecute(Sender: TObject);
|
---|
99 | procedure AViewWatchListExecute(Sender: TObject);
|
---|
100 | procedure AViewWindowListExecute(Sender: TObject);
|
---|
101 | procedure ComboBox1Select(Sender: TObject);
|
---|
102 | procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
---|
103 | procedure FormShow(Sender: TObject);
|
---|
104 | public
|
---|
105 | NewFileIndex: Integer;
|
---|
106 | SourceCodeContainer: TCDConjoinForm;
|
---|
107 | procedure InitDefaultDockLayout;
|
---|
108 | end;
|
---|
109 |
|
---|
110 | var
|
---|
111 | MainForm: TMainForm;
|
---|
112 |
|
---|
113 | implementation
|
---|
114 |
|
---|
115 | {$R *.lfm}
|
---|
116 |
|
---|
117 | { TMainForm }
|
---|
118 |
|
---|
119 | procedure TMainForm.AViewToolPaletteExecute(Sender: TObject);
|
---|
120 | begin
|
---|
121 | ToolPaletteForm.Show;
|
---|
122 | end;
|
---|
123 |
|
---|
124 | procedure TMainForm.AViewWatchListExecute(Sender: TObject);
|
---|
125 | begin
|
---|
126 | WatchListForm.Show;
|
---|
127 | end;
|
---|
128 |
|
---|
129 | procedure TMainForm.AViewWindowListExecute(Sender: TObject);
|
---|
130 | begin
|
---|
131 | CoolDockWindowList1.Execute;
|
---|
132 | end;
|
---|
133 |
|
---|
134 | procedure TMainForm.ComboBox1Select(Sender: TObject);
|
---|
135 | begin
|
---|
136 | if (ComboBox1.ItemIndex <> - 1) and (ComboBox1.ItemIndex < CoolDockLayoutList1.Items.Count) then
|
---|
137 | TCDLayout(CoolDockLayoutList1.Items[ComboBox1.ItemIndex]).Restore;
|
---|
138 | end;
|
---|
139 |
|
---|
140 | procedure TMainForm.FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
---|
141 | begin
|
---|
142 | CoolDockLayoutList1.SaveToFile(DockLayoutFileName);
|
---|
143 | end;
|
---|
144 |
|
---|
145 | procedure TMainForm.FormShow(Sender: TObject);
|
---|
146 | begin
|
---|
147 | with CoolDockLayoutList1 do begin
|
---|
148 | if FileExistsUTF8(DockLayoutFileName) then
|
---|
149 | LoadFromFile(DockLayoutFileName);
|
---|
150 | InitDefaultDockLayout;
|
---|
151 | PopulateStringList(ComboBox1.Items);
|
---|
152 | end;
|
---|
153 | end;
|
---|
154 |
|
---|
155 | procedure TMainForm.InitDefaultDockLayout;
|
---|
156 | var
|
---|
157 | NewContainer1: TCDConjoinForm;
|
---|
158 | NewContainer2: TCDConjoinForm;
|
---|
159 | DefaultLayout: TCDLayout;
|
---|
160 | begin
|
---|
161 | DefaultLayout := CoolDockLayoutList1.FindByName(DefaultLayoutName);
|
---|
162 | if not Assigned(DefaultLayout) then begin
|
---|
163 | NewContainer1 := TCDManager(DockPanel.DockManager).CreateConjoinForm;
|
---|
164 | TCDManager(NewContainer1.DockManager).DockStyle := dsPopupTabs;
|
---|
165 | TCDManager(NewContainer1.DockManager).HeaderPos := hpLeft;
|
---|
166 | NewContainer1.Visible := True;
|
---|
167 |
|
---|
168 | StructureForm.ManualDock(NewContainer1, nil, alTop);
|
---|
169 | StructureForm.Show;
|
---|
170 | ObjectInspectorForm.ManualDock(NewContainer1, nil, alTop);
|
---|
171 | ObjectInspectorForm.Show;
|
---|
172 |
|
---|
173 | NewContainer2 := TCDManager(DockPanel.DockManager).CreateConjoinForm;
|
---|
174 | TCDManager(NewContainer2.DockManager).DockStyle := dsPopupTabs;
|
---|
175 | TCDManager(NewContainer2.DockManager).HeaderPos := hpRight;
|
---|
176 | NewContainer2.Visible := True;
|
---|
177 |
|
---|
178 | ProjectManagerForm.ManualDock(NewContainer2, nil, alTop);
|
---|
179 | ProjectManagerForm.Show;
|
---|
180 | ToolPaletteForm.ManualDock(NewContainer2, nil, alTop);
|
---|
181 | ToolPaletteForm.Show;
|
---|
182 |
|
---|
183 | SourceCodeContainer := TCDManager(DockPanel.DockManager).CreateConjoinForm;
|
---|
184 | TCDManager(SourceCodeContainer.DockManager).DockStyle := dsTabs;
|
---|
185 | TCDManager(SourceCodeContainer.DockManager).HeaderPos := hpTop;
|
---|
186 | SourceCodeContainer.Visible := True;
|
---|
187 |
|
---|
188 | //NewContainer1.ManualDock(DockPanel);
|
---|
189 | NewContainer1.Show;
|
---|
190 | SourceCodeContainer.ManualDock(DockPanel);
|
---|
191 | SourceCodeContainer.Show;
|
---|
192 | //NewContainer2.ManualDock(DockPanel);
|
---|
193 | NewContainer2.Show;
|
---|
194 |
|
---|
195 | DefaultLayout := TCDLayout.Create;
|
---|
196 | DefaultLayout.Name := DefaultLayoutName;
|
---|
197 | CoolDockLayoutList1.Items.Add(DefaultLayout);
|
---|
198 | DefaultLayout.Store;
|
---|
199 | end;
|
---|
200 | end;
|
---|
201 |
|
---|
202 | procedure TMainForm.AViewProjectManagerExecute(Sender: TObject);
|
---|
203 | begin
|
---|
204 | ProjectManagerForm.Show;
|
---|
205 | end;
|
---|
206 |
|
---|
207 | procedure TMainForm.AViewStructureExecute(Sender: TObject);
|
---|
208 | begin
|
---|
209 | StructureForm.Show;
|
---|
210 | end;
|
---|
211 |
|
---|
212 | procedure TMainForm.AViewToDoListExecute(Sender: TObject);
|
---|
213 | begin
|
---|
214 | ToDoListForm.Show;
|
---|
215 | end;
|
---|
216 |
|
---|
217 | procedure TMainForm.AViewObjectInspectorExecute(Sender: TObject);
|
---|
218 | begin
|
---|
219 | ObjectInspectorForm.Show;
|
---|
220 | end;
|
---|
221 |
|
---|
222 | procedure TMainForm.AViewCallStackExecute(Sender: TObject);
|
---|
223 | begin
|
---|
224 | CallStackForm.Show;
|
---|
225 | end;
|
---|
226 |
|
---|
227 | procedure TMainForm.AViewThreadStatusExecute(Sender: TObject);
|
---|
228 | begin
|
---|
229 | ThreadStatusForm.Show;
|
---|
230 | end;
|
---|
231 |
|
---|
232 | procedure TMainForm.ADesktopSaveExecute(Sender: TObject);
|
---|
233 | var
|
---|
234 | NewLayout: TCDLayout;
|
---|
235 | begin
|
---|
236 | if ComboBox1.Text <> '' then begin
|
---|
237 | if ComboBox1.Items.IndexOf(ComboBox1.Text) = -1 then begin
|
---|
238 | NewLayout := TCDLayout.Create;
|
---|
239 | NewLayout.Name := ComboBox1.Text;
|
---|
240 | NewLayout.Store;
|
---|
241 | CoolDockLayoutList1.Items.Add(NewLayout);
|
---|
242 | end else
|
---|
243 | TCDLayout(CoolDockLayoutList1.Items[ComboBox1.Items.IndexOf(ComboBox1.Text)]).Store;
|
---|
244 | CoolDockLayoutList1.SaveToFile(DockLayoutFileName);
|
---|
245 | CoolDockLayoutList1.PopulateStringList(ComboBox1.Items);
|
---|
246 | end else ShowMessage('Enter layout name');
|
---|
247 | end;
|
---|
248 |
|
---|
249 | procedure TMainForm.AExitExecute(Sender: TObject);
|
---|
250 | begin
|
---|
251 | Close;
|
---|
252 | end;
|
---|
253 |
|
---|
254 | procedure TMainForm.ANewFileExecute(Sender: TObject);
|
---|
255 | var
|
---|
256 | NewFile: TSourceEditorForm;
|
---|
257 | begin
|
---|
258 | Application.CreateForm(TSourceEditorForm, NewFile);
|
---|
259 | //NewFile := TSourceEditorForm.Create(nil);
|
---|
260 | Inc(NewFileIndex);
|
---|
261 | NewFile.Caption := 'Unit ' + IntToStr(NewFileIndex);
|
---|
262 | NewFile.ManualDock(SourceCodeContainer);
|
---|
263 | NewFile.Show;
|
---|
264 | end;
|
---|
265 |
|
---|
266 | procedure TMainForm.AResetDefaultLayoutExecute(Sender: TObject);
|
---|
267 | var
|
---|
268 | DefaultLayout: TCDLayout;
|
---|
269 | begin
|
---|
270 | DefaultLayout := CoolDockLayoutList1.FindByName(DefaultLayoutName);
|
---|
271 | if Assigned(DefaultLayout) then
|
---|
272 | CoolDockLayoutList1.Items.Remove(DefaultLayout);
|
---|
273 | InitDefaultDockLayout;
|
---|
274 | end;
|
---|
275 |
|
---|
276 | procedure TMainForm.AViewComponentTreeExecute(Sender: TObject);
|
---|
277 | begin
|
---|
278 | ComponentTree.Show;
|
---|
279 | end;
|
---|
280 |
|
---|
281 | procedure TMainForm.ACustomizeDockingExecute(Sender: TObject);
|
---|
282 | begin
|
---|
283 | CoolDockCustomize1.Execute;
|
---|
284 | CoolDockLayoutList1.PopulateStringList(ComboBox1.Items);
|
---|
285 | end;
|
---|
286 |
|
---|
287 | procedure TMainForm.AViewLocalVariablesExecute(Sender: TObject);
|
---|
288 | begin
|
---|
289 | LocalVariablesForm.Show;
|
---|
290 | end;
|
---|
291 |
|
---|
292 | procedure TMainForm.AViewMessagesExecute(Sender: TObject);
|
---|
293 | begin
|
---|
294 | MessagesForm.Show;
|
---|
295 | end;
|
---|
296 |
|
---|
297 | end.
|
---|
298 |
|
---|