Changeset 429 for ModularSystem/Demo
- Timestamp:
- Oct 17, 2012, 1:21:41 PM (12 years ago)
- Location:
- ModularSystem/Demo
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
ModularSystem/Demo
- Property svn:ignore
-
old new 5 5 Demo.lps 6 6 Demo 7 heaptrclog.trc
-
- Property svn:ignore
-
ModularSystem/Demo/Demo.lpi
r428 r429 41 41 </Item2> 42 42 </RequiredPackages> 43 <Units Count=" 5">43 <Units Count="6"> 44 44 <Unit0> 45 45 <Filename Value="Demo.lpr"/> … … 70 70 <UnitName Value="UModuleACL"/> 71 71 </Unit4> 72 <Unit5> 73 <Filename Value="ULogForm.pas"/> 74 <IsPartOfProject Value="True"/> 75 <ComponentName Value="LogForm"/> 76 <HasResources Value="True"/> 77 <ResourceBaseClass Value="Form"/> 78 <UnitName Value="ULogForm"/> 79 </Unit5> 72 80 </Units> 73 81 </ProjectOptions> … … 91 99 </CodeGeneration> 92 100 <Linking> 101 <Debugging> 102 <UseHeaptrc Value="True"/> 103 </Debugging> 93 104 <Options> 94 105 <Win32> … … 98 109 </Linking> 99 110 <Other> 111 <CustomOptions Value="-dDEBUG"/> 100 112 <CompilerPath Value="$(CompPath)"/> 101 113 </Other> -
ModularSystem/Demo/Demo.lpr
r394 r429 8 8 {$ENDIF}{$ENDIF} 9 9 Interfaces, // this includes the LCL widgetset 10 Forms, UMainForm, UModuleUser, UModuleBase, UModuleACL ;10 Forms, UMainForm, UModuleUser, UModuleBase, UModuleACL, ULogForm, SysUtils; 11 11 12 12 {$R *.res} 13 13 14 {$IFDEF DEBUG} 15 const 16 HeapTraceLog = 'heaptrclog.trc'; 17 {$ENDIF} 18 14 19 begin 20 {$IFDEF DEBUG} 21 // Heap trace 22 DeleteFile(ExtractFilePath(ParamStr(0)) + HeapTraceLog); 23 SetHeapTraceOutput(ExtractFilePath(ParamStr(0)) + HeapTraceLog); 24 {$ENDIF} 25 15 26 RequireDerivedFormResource := True; 16 27 Application.Initialize; 17 28 Application.CreateForm(TMainForm, MainForm); 29 Application.CreateForm(TLogForm, LogForm); 18 30 Application.Run; 19 31 end. -
ModularSystem/Demo/UMainForm.lfm
r428 r429 1 1 object MainForm: TMainForm 2 Left = 2 833 Height = 3 164 Top = 1 822 Left = 217 3 Height = 308 4 Top = 177 5 5 Width = 649 6 6 Caption = 'Module test' 7 ClientHeight = 3 167 ClientHeight = 308 8 8 ClientWidth = 649 9 9 OnCreate = FormCreate … … 13 13 object ListViewModules: TListView 14 14 Left = 8 15 Height = 2 6515 Height = 257 16 16 Top = 8 17 17 Width = 632 … … 51 51 OwnerData = True 52 52 PopupMenu = PopupMenu1 53 ReadOnly = True 53 54 RowSelect = True 54 55 TabOrder = 0 … … 60 61 Left = 8 61 62 Height = 25 62 Top = 2 8163 Top = 273 63 64 Width = 75 64 65 Action = AModuleInstall … … 69 70 Left = 88 70 71 Height = 25 71 Top = 2 8172 Top = 273 72 73 Width = 75 73 74 Action = AModuleUninstall … … 78 79 Left = 168 79 80 Height = 25 80 Top = 2 8181 Top = 273 81 82 Width = 75 82 83 Action = AModuleUpdate … … 87 88 Left = 248 88 89 Height = 25 89 Top = 2 8190 Top = 273 90 91 Width = 75 91 92 Action = AModuleStart … … 96 97 Left = 328 97 98 Height = 25 98 Top = 2 8199 Top = 273 99 100 Width = 75 100 101 Action = AModuleStop … … 145 146 end 146 147 end 148 object ModuleManager: TModuleManager 149 left = 296 150 top = 72 151 end 147 152 end -
ModularSystem/Demo/UMainForm.pas
r428 r429 1 1 unit UMainForm; 2 2 3 {$mode objfpc}{$H+}3 {$mode delphi}{$H+} 4 4 5 5 interface … … 32 32 MenuItem4: TMenuItem; 33 33 MenuItem5: TMenuItem; 34 ModuleManager: TModuleManager; 34 35 PopupMenu1: TPopupMenu; 35 36 procedure AModuleStartExecute(Sender: TObject); … … 47 48 procedure RegisterModules; 48 49 public 49 ModuleManager: TModuleManager;50 procedure Log(Text: string); 50 51 procedure RefreshList; 51 52 end; … … 63 64 64 65 uses 65 UModuleUser, UModuleBase, UModuleACL ;66 UModuleUser, UModuleBase, UModuleACL, ULogForm; 66 67 67 68 … … 106 107 end; 107 108 109 procedure TMainForm.Log(Text: string); 110 begin 111 LogForm.Memo1.Lines.Add(Text); 112 end; 113 108 114 procedure TMainForm.RefreshList; 109 115 begin … … 116 122 procedure TMainForm.FormCreate(Sender: TObject); 117 123 begin 118 ModuleManager := TModuleManager.Create(nil);119 124 RegisterModules; 120 125 end; … … 220 225 procedure TMainForm.FormDestroy(Sender: TObject); 221 226 begin 222 FreeAndNil(ModuleManager);223 227 end; 224 228 … … 226 230 begin 227 231 RefreshList; 232 LogForm.Show; 228 233 end; 229 234 -
ModularSystem/Demo/UModuleACL.pas
r428 r429 12 12 13 13 TModuleACL = class(TModule) 14 protected 15 procedure DoInstall; override; 16 procedure DoStart; override; 17 procedure DoStop; override; 18 procedure DoUninstall; override; 19 public 14 20 constructor Create(AOwner: TComponent); override; 15 21 destructor Destroy; override; … … 19 25 implementation 20 26 27 uses 28 UMainForm; 29 21 30 { TModuleACL } 31 32 procedure TModuleACL.DoStart; 33 begin 34 MainForm.Log(Identification + ' started'); 35 end; 36 37 procedure TModuleACL.DoStop; 38 begin 39 MainForm.Log(Identification + ' stopped'); 40 end; 41 42 procedure TModuleACL.DoInstall; 43 begin 44 MainForm.Log(Identification + ' installed'); 45 end; 46 47 procedure TModuleACL.DoUninstall; 48 begin 49 MainForm.Log(Identification + ' uninstalled'); 50 end; 22 51 23 52 constructor TModuleACL.Create(AOwner: TComponent); -
ModularSystem/Demo/UModuleBase.pas
r428 r429 9 9 10 10 type 11 12 { TModuleBase } 13 11 14 TModuleBase = class(TModule) 15 protected 16 procedure DoStart; override; 17 procedure DoStop; override; 18 procedure DoInstall; override; 19 procedure DoUninstall; override; 20 public 12 21 constructor Create(AOwner: TComponent); override; 13 22 destructor Destroy; override; … … 17 26 implementation 18 27 28 uses 29 UMainForm; 30 19 31 { TModuleUser } 32 33 procedure TModuleBase.DoStart; 34 begin 35 MainForm.Log(Identification + ' started'); 36 end; 37 38 procedure TModuleBase.DoStop; 39 begin 40 MainForm.Log(Identification + ' stopped'); 41 end; 42 43 procedure TModuleBase.DoInstall; 44 begin 45 MainForm.Log(Identification + ' installed'); 46 end; 47 48 procedure TModuleBase.DoUninstall; 49 begin 50 MainForm.Log(Identification + ' uninstalled'); 51 end; 20 52 21 53 constructor TModuleBase.Create(AOwner: TComponent); -
ModularSystem/Demo/UModuleUser.pas
r428 r429 13 13 14 14 TModuleUser = class(TModule) 15 protected 16 procedure DoInstall; override; 17 procedure DoStart; override; 18 procedure DoStop; override; 19 procedure DoUninstall; override; 20 public 15 21 constructor Create(AOwner: TComponent); override; 16 22 destructor Destroy; override; … … 19 25 implementation 20 26 27 uses 28 UMainForm; 29 21 30 { TModuleUser } 31 32 procedure TModuleUser.DoStart; 33 begin 34 MainForm.Log(Identification + ' started'); 35 end; 36 37 procedure TModuleUser.DoStop; 38 begin 39 MainForm.Log(Identification + ' stopped'); 40 end; 41 42 procedure TModuleUser.DoInstall; 43 begin 44 MainForm.Log(Identification + ' installed'); 45 end; 46 47 procedure TModuleUser.DoUninstall; 48 begin 49 MainForm.Log(Identification + ' uninstalled'); 50 end; 22 51 23 52 constructor TModuleUser.Create(AOwner: TComponent);
Note:
See TracChangeset
for help on using the changeset viewer.