source: trunk/UFormMain.pas@ 3

Last change on this file since 3 was 3, checked in by chronos, 7 years ago
  • Added: Rest files for previous commit.
File size: 1.9 KB
Line 
1unit UFormMain;
2
3{$mode Delphi}{$H+}
4
5interface
6
7uses
8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Menus,
9 ActnList, ComCtrls, UKConfig;
10
11type
12
13 { TFormMain }
14
15 TFormMain = class(TForm)
16 AViemSystem: TAction;
17 AOpenDir: TAction;
18 ActionList1: TActionList;
19 ImageList1: TImageList;
20 MainMenu1: TMainMenu;
21 MenuItem1: TMenuItem;
22 MenuItem2: TMenuItem;
23 MenuItem3: TMenuItem;
24 MenuItem4: TMenuItem;
25 StatusBar1: TStatusBar;
26 ToolBar1: TToolBar;
27 ToolButton2: TToolButton;
28 TreeView1: TTreeView;
29 procedure AOpenDirExecute(Sender: TObject);
30 procedure AViemSystemExecute(Sender: TObject);
31 procedure FormCreate(Sender: TObject);
32 procedure FormDestroy(Sender: TObject);
33 procedure FormShow(Sender: TObject);
34 private
35 { private declarations }
36 public
37 Config: TConfigMenu;
38 procedure Reload;
39 end;
40
41var
42 FormMain: TFormMain;
43
44implementation
45
46{$R *.lfm}
47
48{ TFormMain }
49
50procedure TFormMain.FormShow(Sender: TObject);
51begin
52 Config.LoadFromDir('/home/chronos/Stažené/linux-3.14.1', 'x86');
53 Reload;
54end;
55
56procedure TFormMain.Reload;
57var
58 Options: TLoadTreeOptions;
59begin
60 TreeView1.Items.Clear;
61 TreeView1.Items.AddChild(nil, Config.TopNode.GetName);
62 Options := [];
63 if AViemSystem.Checked then Include(Options, toShowSystem);
64 Config.TopNode.LoadTreeNode(TreeView1.TopItem, Options);
65 TreeView1.TopItem.Expanded := True;
66end;
67
68procedure TFormMain.AOpenDirExecute(Sender: TObject);
69var
70 OutDir: string;
71begin
72 if SelectDirectory('Select Linux source directory', Config.BaseDir, OutDir) then begin
73 Config.LoadFromDir(OutDir, 'x86');
74 Reload;
75 end;
76end;
77
78procedure TFormMain.AViemSystemExecute(Sender: TObject);
79begin
80 AViemSystem.Checked := not AViemSystem.Checked;
81 Reload;
82end;
83
84procedure TFormMain.FormCreate(Sender: TObject);
85begin
86 Config := TConfigMenu.Create;
87end;
88
89procedure TFormMain.FormDestroy(Sender: TObject);
90begin
91 FreeAndNil(Config);
92end;
93
94end.
95
Note: See TracBrowser for help on using the repository browser.