Changeset 429 for ModularSystem/Demo


Ignore:
Timestamp:
Oct 17, 2012, 1:21:41 PM (12 years ago)
Author:
chronos
Message:
Location:
ModularSystem/Demo
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • ModularSystem/Demo

    • Property svn:ignore
      •  

        old new  
        55Demo.lps
        66Demo
         7heaptrclog.trc
  • ModularSystem/Demo/Demo.lpi

    r428 r429  
    4141      </Item2>
    4242    </RequiredPackages>
    43     <Units Count="5">
     43    <Units Count="6">
    4444      <Unit0>
    4545        <Filename Value="Demo.lpr"/>
     
    7070        <UnitName Value="UModuleACL"/>
    7171      </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>
    7280    </Units>
    7381  </ProjectOptions>
     
    9199    </CodeGeneration>
    92100    <Linking>
     101      <Debugging>
     102        <UseHeaptrc Value="True"/>
     103      </Debugging>
    93104      <Options>
    94105        <Win32>
     
    98109    </Linking>
    99110    <Other>
     111      <CustomOptions Value="-dDEBUG"/>
    100112      <CompilerPath Value="$(CompPath)"/>
    101113    </Other>
  • ModularSystem/Demo/Demo.lpr

    r394 r429  
    88  {$ENDIF}{$ENDIF}
    99  Interfaces, // this includes the LCL widgetset
    10   Forms, UMainForm, UModuleUser, UModuleBase, UModuleACL;
     10  Forms, UMainForm, UModuleUser, UModuleBase, UModuleACL, ULogForm, SysUtils;
    1111
    1212{$R *.res}
    1313
     14{$IFDEF DEBUG}
     15const
     16  HeapTraceLog = 'heaptrclog.trc';
     17{$ENDIF}
     18
    1419begin
     20  {$IFDEF DEBUG}
     21  // Heap trace
     22  DeleteFile(ExtractFilePath(ParamStr(0)) + HeapTraceLog);
     23  SetHeapTraceOutput(ExtractFilePath(ParamStr(0)) + HeapTraceLog);
     24  {$ENDIF}
     25
    1526  RequireDerivedFormResource := True;
    1627  Application.Initialize;
    1728  Application.CreateForm(TMainForm, MainForm);
     29  Application.CreateForm(TLogForm, LogForm);
    1830  Application.Run;
    1931end.
  • ModularSystem/Demo/UMainForm.lfm

    r428 r429  
    11object MainForm: TMainForm
    2   Left = 283
    3   Height = 316
    4   Top = 182
     2  Left = 217
     3  Height = 308
     4  Top = 177
    55  Width = 649
    66  Caption = 'Module test'
    7   ClientHeight = 316
     7  ClientHeight = 308
    88  ClientWidth = 649
    99  OnCreate = FormCreate
     
    1313  object ListViewModules: TListView
    1414    Left = 8
    15     Height = 265
     15    Height = 257
    1616    Top = 8
    1717    Width = 632
     
    5151    OwnerData = True
    5252    PopupMenu = PopupMenu1
     53    ReadOnly = True
    5354    RowSelect = True
    5455    TabOrder = 0
     
    6061    Left = 8
    6162    Height = 25
    62     Top = 281
     63    Top = 273
    6364    Width = 75
    6465    Action = AModuleInstall
     
    6970    Left = 88
    7071    Height = 25
    71     Top = 281
     72    Top = 273
    7273    Width = 75
    7374    Action = AModuleUninstall
     
    7879    Left = 168
    7980    Height = 25
    80     Top = 281
     81    Top = 273
    8182    Width = 75
    8283    Action = AModuleUpdate
     
    8788    Left = 248
    8889    Height = 25
    89     Top = 281
     90    Top = 273
    9091    Width = 75
    9192    Action = AModuleStart
     
    9697    Left = 328
    9798    Height = 25
    98     Top = 281
     99    Top = 273
    99100    Width = 75
    100101    Action = AModuleStop
     
    145146    end
    146147  end
     148  object ModuleManager: TModuleManager
     149    left = 296
     150    top = 72
     151  end
    147152end
  • ModularSystem/Demo/UMainForm.pas

    r428 r429  
    11unit UMainForm;
    22
    3 {$mode objfpc}{$H+}
     3{$mode delphi}{$H+}
    44
    55interface
     
    3232    MenuItem4: TMenuItem;
    3333    MenuItem5: TMenuItem;
     34    ModuleManager: TModuleManager;
    3435    PopupMenu1: TPopupMenu;
    3536    procedure AModuleStartExecute(Sender: TObject);
     
    4748    procedure RegisterModules;
    4849  public
    49     ModuleManager: TModuleManager;
     50    procedure Log(Text: string);
    5051    procedure RefreshList;
    5152  end;
     
    6364
    6465uses
    65   UModuleUser, UModuleBase, UModuleACL;
     66  UModuleUser, UModuleBase, UModuleACL, ULogForm;
    6667
    6768
     
    106107end;
    107108
     109procedure TMainForm.Log(Text: string);
     110begin
     111  LogForm.Memo1.Lines.Add(Text);
     112end;
     113
    108114procedure TMainForm.RefreshList;
    109115begin
     
    116122procedure TMainForm.FormCreate(Sender: TObject);
    117123begin
    118   ModuleManager := TModuleManager.Create(nil);
    119124  RegisterModules;
    120125end;
     
    220225procedure TMainForm.FormDestroy(Sender: TObject);
    221226begin
    222   FreeAndNil(ModuleManager);
    223227end;
    224228
     
    226230begin
    227231  RefreshList;
     232  LogForm.Show;
    228233end;
    229234
  • ModularSystem/Demo/UModuleACL.pas

    r428 r429  
    1212
    1313  TModuleACL = class(TModule)
     14  protected
     15    procedure DoInstall; override;
     16    procedure DoStart; override;
     17    procedure DoStop; override;
     18    procedure DoUninstall; override;
     19  public
    1420    constructor Create(AOwner: TComponent); override;
    1521    destructor Destroy; override;
     
    1925implementation
    2026
     27uses
     28  UMainForm;
     29
    2130{ TModuleACL }
     31
     32procedure TModuleACL.DoStart;
     33begin
     34  MainForm.Log(Identification + ' started');
     35end;
     36
     37procedure TModuleACL.DoStop;
     38begin
     39  MainForm.Log(Identification + ' stopped');
     40end;
     41
     42procedure TModuleACL.DoInstall;
     43begin
     44  MainForm.Log(Identification + ' installed');
     45end;
     46
     47procedure TModuleACL.DoUninstall;
     48begin
     49  MainForm.Log(Identification + ' uninstalled');
     50end;
    2251
    2352constructor TModuleACL.Create(AOwner: TComponent);
  • ModularSystem/Demo/UModuleBase.pas

    r428 r429  
    99
    1010type
     11
     12  { TModuleBase }
     13
    1114  TModuleBase = class(TModule)
     15  protected
     16    procedure DoStart; override;
     17    procedure DoStop; override;
     18    procedure DoInstall; override;
     19    procedure DoUninstall; override;
     20  public
    1221    constructor Create(AOwner: TComponent); override;
    1322    destructor Destroy; override;
     
    1726implementation
    1827
     28uses
     29  UMainForm;
     30
    1931{ TModuleUser }
     32
     33procedure TModuleBase.DoStart;
     34begin
     35  MainForm.Log(Identification + ' started');
     36end;
     37
     38procedure TModuleBase.DoStop;
     39begin
     40  MainForm.Log(Identification + ' stopped');
     41end;
     42
     43procedure TModuleBase.DoInstall;
     44begin
     45  MainForm.Log(Identification + ' installed');
     46end;
     47
     48procedure TModuleBase.DoUninstall;
     49begin
     50  MainForm.Log(Identification + ' uninstalled');
     51end;
    2052
    2153constructor TModuleBase.Create(AOwner: TComponent);
  • ModularSystem/Demo/UModuleUser.pas

    r428 r429  
    1313
    1414  TModuleUser = class(TModule)
     15  protected
     16    procedure DoInstall; override;
     17    procedure DoStart; override;
     18    procedure DoStop; override;
     19    procedure DoUninstall; override;
     20  public
    1521    constructor Create(AOwner: TComponent); override;
    1622    destructor Destroy; override;
     
    1925implementation
    2026
     27uses
     28  UMainForm;
     29
    2130{ TModuleUser }
     31
     32procedure TModuleUser.DoStart;
     33begin
     34  MainForm.Log(Identification + ' started');
     35end;
     36
     37procedure TModuleUser.DoStop;
     38begin
     39  MainForm.Log(Identification + ' stopped');
     40end;
     41
     42procedure TModuleUser.DoInstall;
     43begin
     44  MainForm.Log(Identification + ' installed');
     45end;
     46
     47procedure TModuleUser.DoUninstall;
     48begin
     49  MainForm.Log(Identification + ' uninstalled');
     50end;
    2251
    2352constructor TModuleUser.Create(AOwner: TComponent);
Note: See TracChangeset for help on using the changeset viewer.