Changeset 4 for trunk/UCore.pas
- Timestamp:
- Sep 1, 2014, 7:10:03 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UCore.pas
r1 r4 1 1 unit UCore; 2 2 3 {$mode objfpc}{$H+}3 {$mode delphi}{$H+} 4 4 5 5 interface 6 6 7 7 uses 8 Classes, SysUtils, FileUtil; 8 Classes, SysUtils, FileUtil, ActnList, Controls, UVCS, UProject, Forms, 9 Dialogs; 9 10 10 11 type 12 13 { TCore } 14 11 15 TCore = class(TDataModule) 16 AAbout: TAction; 17 AProjectClose: TAction; 18 ActionList1: TActionList; 19 AHelp: TAction; 20 AProjectOpen: TAction; 21 AQuit: TAction; 22 ASettings: TAction; 23 AViewFavorites: TAction; 24 ImageList1: TImageList; 25 OpenDialog1: TOpenDialog; 26 procedure AProjectCloseExecute(Sender: TObject); 27 procedure AProjectOpenExecute(Sender: TObject); 28 procedure AQuitExecute(Sender: TObject); 29 procedure DataModuleCreate(Sender: TObject); 30 procedure DataModuleDestroy(Sender: TObject); 12 31 private 13 { private declarations }32 procedure UpdateInterface; 14 33 public 15 { public declarations }34 Project: TProject; 16 35 end; 17 36 … … 23 42 {$R *.lfm} 24 43 44 uses 45 UFormMain; 46 47 { TCore } 48 49 procedure TCore.AQuitExecute(Sender: TObject); 50 begin 51 Application.Terminate; 52 end; 53 54 procedure TCore.DataModuleCreate(Sender: TObject); 55 begin 56 UpdateInterface; 57 end; 58 59 procedure TCore.DataModuleDestroy(Sender: TObject); 60 begin 61 Project.Free; 62 end; 63 64 procedure TCore.UpdateInterface; 65 begin 66 AProjectClose.Enabled := Assigned(Project); 67 FormMain.UpdateInterface; 68 end; 69 70 procedure TCore.AProjectOpenExecute(Sender: TObject); 71 var 72 Dir: string; 73 OldDir: string; 74 begin 75 if Assigned(Project) then OldDir := Project.Directory 76 else OldDir := ''; 77 if SelectDirectory('Open project', OldDir, Dir) then begin 78 AProjectClose.Execute; 79 Project := TProject.Create; 80 Project.Directory := Dir; 81 UpdateInterface; 82 end; 83 end; 84 85 procedure TCore.AProjectCloseExecute(Sender: TObject); 86 begin 87 FreeAndNil(Project); 88 UpdateInterface; 89 end; 90 25 91 end. 26 92
Note:
See TracChangeset
for help on using the changeset viewer.