Changeset 26 for branches


Ignore:
Timestamp:
Aug 22, 2019, 11:01:15 AM (5 years ago)
Author:
chronos
Message:
  • Added: Reboot button.
  • Added: Check memory leaks.
Location:
branches/topdown
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/topdown

    • Property svn:ignore set to
      lib
      heaptrclog.trc
      OS.exe
      OS.lps
      OS.res
  • branches/topdown/OS.lpi

    r25 r26  
    8888      <SyntaxOptions>
    8989        <SyntaxMode Value="Delphi"/>
     90        <IncludeAssertionCode Value="True"/>
    9091      </SyntaxOptions>
    9192    </Parsing>
     93    <CodeGeneration>
     94      <Checks>
     95        <IOChecks Value="True"/>
     96        <RangeChecks Value="True"/>
     97        <OverflowChecks Value="True"/>
     98        <StackChecks Value="True"/>
     99      </Checks>
     100      <VerifyObjMethodCallValidity Value="True"/>
     101    </CodeGeneration>
    92102    <Linking>
     103      <Debugging>
     104        <UseHeaptrc Value="True"/>
     105      </Debugging>
    93106      <Options>
    94107        <Win32>
  • branches/topdown/OS.lpr

    r25 r26  
    88  {$ENDIF}{$ENDIF}
    99  Interfaces, // this includes the LCL widgetset
    10   Forms, UFormMain, UApps, USystem, UAppCalc, UFormMenu, UAppFileManager
     10  Forms, SysUtils, UFormMain, UApps, USystem, UAppCalc, UFormMenu, UAppFileManager
    1111  { you can add units after this };
    1212
    1313{$R *.res}
    1414
     15{$if declared(UseHeapTrace)}
     16const
     17  HeapTraceLog = 'heaptrclog.trc';
     18{$ENDIF}
     19
    1520begin
     21  {$if declared(UseHeapTrace)}
     22  DeleteFile(ExtractFilePath(ParamStr(0)) + HeapTraceLog);
     23  SetHeapTraceOutput(ExtractFilePath(ParamStr(0)) + HeapTraceLog);
     24  {$ENDIF}
     25
    1626  RequireDerivedFormResource:=True;
    1727  Application.Scaled:=True;
  • branches/topdown/UFormMain.lfm

    r25 r26  
    3434    end
    3535    object PanelTasks: TPanel
    36       Left = 95
     36      Left = 105
    3737      Height = 34
    3838      Top = 1
    39       Width = 304
     39      Width = 294
    4040      Align = alClient
     41      BorderSpacing.Left = 10
    4142      BevelOuter = bvNone
    4243      TabOrder = 1
  • branches/topdown/UFormMain.pas

    r25 r26  
    6565    RemoveControl(Controls[ControlCount - 1]);
    6666  for I := 0 to BaseSystem.Tasks.Count - 1 do
    67   with TTask(BaseSystem.Tasks[I]) do begin
     67  with TTask(BaseSystem.Tasks[I]) do
     68  if not Terminated then begin
    6869    Button := TButton.Create(PanelTasks);
    6970    Button.Align := alLeft;
  • branches/topdown/UFormMenu.lfm

    r25 r26  
    88  ClientWidth = 262
    99  DesignTimePPI = 120
     10  FormStyle = fsStayOnTop
    1011  OnDeactivate = FormDeactivate
    1112  OnShow = FormShow
     
    3536    TabOrder = 1
    3637  end
     38  object ButtonReboot: TButton
     39    Left = 112
     40    Height = 31
     41    Top = 362
     42    Width = 94
     43    Anchors = [akLeft, akBottom]
     44    Caption = 'Reboot'
     45    OnClick = ButtonRebootClick
     46    TabOrder = 2
     47  end
    3748end
  • branches/topdown/UFormMenu.pas

    r25 r26  
    1414  TFormMenu = class(TForm)
    1515    ButtonShutDown: TButton;
     16    ButtonReboot: TButton;
    1617    ListBoxApps: TListBox;
     18    procedure ButtonRebootClick(Sender: TObject);
    1719    procedure ButtonShutDownClick(Sender: TObject);
    1820    procedure FormDeactivate(Sender: TObject);
     
    7173procedure TFormMenu.ButtonShutDownClick(Sender: TObject);
    7274begin
    73   Application.Terminate;
     75  Hide;
     76  BaseSystem.ShutDown;
     77end;
     78
     79procedure TFormMenu.ButtonRebootClick(Sender: TObject);
     80begin
     81  Hide;
     82  BaseSystem.Reboot;
    7483end;
    7584
  • branches/topdown/USystem.pas

    r25 r26  
    3030  TTask = class
    3131    Form: TFormTask;
     32    Terminated: Boolean;
     33    destructor Destroy; override;
    3234  end;
    3335
     
    5961    constructor Create;
    6062    destructor Destroy; override;
     63    procedure ShutDown;
     64    procedure Reboot;
    6165  end;
    6266
     
    6771implementation
    6872
     73{ TTask }
     74
     75destructor TTask.Destroy;
     76begin
     77  Form.Free;
     78  inherited;
     79end;
     80
    6981{ TFormTask }
    7082
    7183procedure TFormTask.Terminate;
    7284begin
    73   BaseSystem.Tasks.Remove(Task);
    74   Task := nil;
     85  Task.Terminated := True;
     86  Visible := False;
    7587  BaseSystem.Tasks.DoOnChange;
    7688end;
     
    137149end;
    138150
     151procedure TSystem.ShutDown;
     152begin
     153  Application.Terminate;
     154end;
     155
     156procedure TSystem.Reboot;
     157begin
     158  Tasks.Clear;
     159  Tasks.DoOnChange;
     160end;
     161
    139162initialization
    140163
Note: See TracChangeset for help on using the changeset viewer.