1 | unit UFormMain;
|
---|
2 |
|
---|
3 | {$mode delphi}{$H+}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
|
---|
9 | Menus, ActnList, ExtCtrls;
|
---|
10 |
|
---|
11 | type
|
---|
12 |
|
---|
13 | { TFormMain }
|
---|
14 |
|
---|
15 | TFormMain = class(TForm)
|
---|
16 | MainMenu1: TMainMenu;
|
---|
17 | MenuItem1: TMenuItem;
|
---|
18 | MenuItem10: TMenuItem;
|
---|
19 | MenuItem11: TMenuItem;
|
---|
20 | MenuItem12: TMenuItem;
|
---|
21 | MenuItem13: TMenuItem;
|
---|
22 | MenuItem14: TMenuItem;
|
---|
23 | MenuItem15: TMenuItem;
|
---|
24 | MenuItem16: TMenuItem;
|
---|
25 | MenuItem17: TMenuItem;
|
---|
26 | MenuItem18: TMenuItem;
|
---|
27 | MenuItem19: TMenuItem;
|
---|
28 | MenuItem20: TMenuItem;
|
---|
29 | MenuItem21: TMenuItem;
|
---|
30 | MenuItemRecentProjectGroup: TMenuItem;
|
---|
31 | MenuItem23: TMenuItem;
|
---|
32 | MenuItem24: TMenuItem;
|
---|
33 | MenuItem25: TMenuItem;
|
---|
34 | MenuItemOpenRecent: TMenuItem;
|
---|
35 | MenuItem2: TMenuItem;
|
---|
36 | MenuItem3: TMenuItem;
|
---|
37 | MenuItem4: TMenuItem;
|
---|
38 | MenuItem5: TMenuItem;
|
---|
39 | MenuItem6: TMenuItem;
|
---|
40 | MenuItem7: TMenuItem;
|
---|
41 | MenuItem8: TMenuItem;
|
---|
42 | MenuItem9: TMenuItem;
|
---|
43 | MenuItemQuit: TMenuItem;
|
---|
44 | MenuItemFile: TMenuItem;
|
---|
45 | StatusBar1: TStatusBar;
|
---|
46 | ToolBarMain: TToolBar;
|
---|
47 | ToolButton1: TToolButton;
|
---|
48 | ToolButton2: TToolButton;
|
---|
49 | ToolButton3: TToolButton;
|
---|
50 | procedure FormActivate(Sender: TObject);
|
---|
51 | procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
---|
52 | procedure FormShow(Sender: TObject);
|
---|
53 | private
|
---|
54 | Initialized: Boolean;
|
---|
55 | public
|
---|
56 | procedure ProjectGroupOpenRecentExecute(Sender: TObject);
|
---|
57 | procedure OpenRecentExecute(Sender: TObject);
|
---|
58 | procedure UpdateInterface;
|
---|
59 | procedure DockInit;
|
---|
60 | end;
|
---|
61 |
|
---|
62 | var
|
---|
63 | FormMain: TFormMain;
|
---|
64 |
|
---|
65 | implementation
|
---|
66 |
|
---|
67 | {$R *.lfm}
|
---|
68 |
|
---|
69 | uses
|
---|
70 | UCore, UFormBrowse, UFormProjectGroup;
|
---|
71 |
|
---|
72 | { TFormMain }
|
---|
73 |
|
---|
74 | procedure TFormMain.FormShow(Sender: TObject);
|
---|
75 | begin
|
---|
76 | DockInit;
|
---|
77 | end;
|
---|
78 |
|
---|
79 | procedure TFormMain.OpenRecentExecute(Sender: TObject);
|
---|
80 | begin
|
---|
81 | Core.ProjectOpen(Core.LastOpenedListProject.Items[TMenuItem(Sender).MenuIndex]);
|
---|
82 | end;
|
---|
83 |
|
---|
84 | procedure TFormMain.ProjectGroupOpenRecentExecute(Sender: TObject);
|
---|
85 | begin
|
---|
86 | Core.ProjectGroupOpen(Core.LastOpenedListProjectGroup.Items[TMenuItem(Sender).MenuIndex]);
|
---|
87 | end;
|
---|
88 |
|
---|
89 | procedure TFormMain.FormActivate(Sender: TObject);
|
---|
90 | begin
|
---|
91 | if not Initialized then begin
|
---|
92 | Initialized := True;
|
---|
93 | Core.Init;
|
---|
94 | end;
|
---|
95 | end;
|
---|
96 |
|
---|
97 | procedure TFormMain.FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
---|
98 | begin
|
---|
99 | Core.Done;
|
---|
100 | end;
|
---|
101 |
|
---|
102 | procedure TFormMain.UpdateInterface;
|
---|
103 | const
|
---|
104 | AppName = 'VCSCommander';
|
---|
105 | var
|
---|
106 | NewCaption: string;
|
---|
107 | begin
|
---|
108 | NewCaption := '';
|
---|
109 | if Assigned(Core.Project) then
|
---|
110 | NewCaption := Core.Project.Directory + ' (' + Core.Project.Backend.Name + ') - ';
|
---|
111 | NewCaption := NewCaption + AppName;
|
---|
112 | Caption := NewCaption;
|
---|
113 | end;
|
---|
114 |
|
---|
115 | procedure TFormMain.DockInit;
|
---|
116 | var
|
---|
117 | NewSplitter: TSplitter;
|
---|
118 | begin
|
---|
119 | FormProjectGroup.ManualDock(Self, nil, alLeft);
|
---|
120 | FormProjectGroup.Align := alLeft;
|
---|
121 | FormProjectGroup.Show;
|
---|
122 | NewSplitter := TSplitter.Create(nil);
|
---|
123 | NewSplitter.ManualDock(Self, nil, alLeft);
|
---|
124 | NewSplitter.Align := alLeft;
|
---|
125 | NewSplitter.Left := FormProjectGroup.Width;
|
---|
126 | NewSplitter.Show;
|
---|
127 | FormBrowse.ManualDock(Self, nil, alClient);
|
---|
128 | FormBrowse.Align := alClient;
|
---|
129 | FormBrowse.Show;
|
---|
130 | end;
|
---|
131 |
|
---|
132 | end.
|
---|
133 |
|
---|