Changeset 38 for branches


Ignore:
Timestamp:
Jun 30, 2023, 3:36:57 PM (17 months ago)
Author:
chronos
Message:
  • Modified: Code cleanup.
Location:
branches/overos
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/overos/UApplication.pas

    r24 r38  
    11unit UApplication;
    2 
    3 {$mode delphi}
    42
    53interface
    64
    75uses
    8   Classes, SysUtils, fgl, UTypes, UWindow;
     6  Classes, SysUtils, Generics.Collections, UTypes, UWindow;
    97
    108type
     
    1311
    1412  TMessageQueue = class
    15     Messages: TFPGObjectList<TMessage>;
     13    Messages: TObjectList<TMessage>;
    1614    procedure PostMessage(Handle: TObject; Message: TMessage);
    1715    constructor Create;
     
    2826    destructor Destroy; override;
    2927  end;
     28
    3029
    3130implementation
     
    5352destructor TApplication.Destroy;
    5453begin
    55   MessageQueue.Free;
    56   inherited Destroy;
     54  FreeAndNil(MessageQueue);
     55  inherited;
    5756end;
    5857
     
    6766constructor TMessageQueue.Create;
    6867begin
    69   Messages := TFPGObjectList<TMessage>.Create;
    70   Messages.FreeObjects := False;
     68  Messages := TObjectList<TMessage>.Create;
     69  Messages.OwnsObjects := False;
    7170end;
    7271
     
    7776  for I := 0 to Messages.Count - 1 do
    7877    Messages[I].Free;
    79   Messages.Free;
    80   inherited Destroy;
     78  FreeAndNil(Messages);
     79  inherited;
    8180end;
    8281
    8382end.
    8483
    85 
  • branches/overos/UControls.pas

    r22 r38  
    11unit UControls;
    22
    3 {$mode delphi}
    4 
    53interface
    64
    75uses
    8   Classes, SysUtils, UTypes, UGraphics, fgl, UMouse;
     6  Classes, SysUtils, UTypes, UGraphics, Generics.Collections, UMouse;
    97
    108type
     
    2826  public
    2927    Canvas: TCanvas;
    30     Controls: TFPGObjectList<TControl>;
     28    Controls: TObjectList<TControl>;
    3129    procedure MouseButtonDown(Pos: TPosition; Button: TMouseButton); virtual;
    3230    procedure MouseButtonUp(Pos: TPosition; Button: TMouseButton); virtual;
     
    9189  end;
    9290
     91
    9392implementation
    9493
     
    214213constructor TControl.Create;
    215214begin
    216   Controls := TFPGObjectList<TControl>.Create;
    217   Controls.FreeObjects := False;
     215  Controls := TObjectList<TControl>.Create;
     216  Controls.OwnsObjects := False;
    218217  Canvas := TCanvasControl.Create;
    219218  TCanvasControl(Canvas).Control := Self;
     
    227226    Controls[I].Free;
    228227  ParentControl := nil;
    229   Canvas.Free;
    230   Controls.Free;
    231   inherited Destroy;
     228  FreeAndNil(Canvas);
     229  FreeAndNil(Controls);
     230  inherited;
    232231end;
    233232
  • branches/overos/UFormMain.lfm

    r24 r38  
    11object FormMain: TFormMain
    22  Left = 403
    3   Height = 523
     3  Height = 628
    44  Top = 253
    5   Width = 758
     5  Width = 910
    66  Caption = 'OverOS'
    7   ClientHeight = 523
    8   ClientWidth = 758
    9   DesignTimePPI = 120
     7  ClientHeight = 628
     8  ClientWidth = 910
     9  DesignTimePPI = 144
    1010  OnClose = FormClose
    1111  OnResize = FormResize
    1212  OnShow = FormShow
    13   LCLVersion = '1.8.2.0'
     13  LCLVersion = '2.2.6.0'
    1414  object Image1: TImage
    1515    Left = 0
    16     Height = 523
     16    Height = 628
    1717    Top = 0
    18     Width = 758
     18    Width = 910
    1919    Align = alClient
    2020    OnMouseDown = Image1MouseDown
     
    2525    Interval = 10
    2626    OnTimer = Timer1Timer
    27     left = 303
    28     top = 201
     27    Left = 364
     28    Top = 241
    2929  end
    3030end
  • branches/overos/UFormMain.pas

    r24 r38  
    11unit UFormMain;
    2 
    3 {$mode objfpc}{$H+}
    42
    53interface
     
    102100begin
    103101  Timer1.Enabled := False;
    104   App.Free;
    105   System.Free;
     102  FreeAndNil(App);
     103  FreeAndNil(System);
    106104end;
    107105
  • branches/overos/UGraphics.pas

    r22 r38  
    11unit UGraphics;
    2 
    3 {$mode delphi}
    42
    53interface
     
    2523  clGray = $808080;
    2624  clWhite = $ffffff;
     25
    2726
    2827implementation
  • branches/overos/UMouse.pas

    r20 r38  
    11unit UMouse;
    2 
    3 {$mode objfpc}{$H+}
    42
    53interface
  • branches/overos/USystem.pas

    r20 r38  
    11unit USystem;
    2 
    3 {$mode delphi}{$H+}
    42
    53interface
     
    3230destructor TSystem.Destroy;
    3331begin
    34   Screen.Free;
    35   Mouse.Free;
    36   inherited Destroy;
     32  FreeAndNil(Screen);
     33  FreeAndNil(Mouse);
     34  inherited;
    3735end;
    3836
  • branches/overos/UTypes.pas

    r33 r38  
    11unit UTypes;
    2 
    3 {$mode delphi}{$H+}
    42
    53interface
  • branches/overos/UWindow.pas

    r24 r38  
    11unit UWindow;
    22
    3 {$mode delphi}{$H+}
    4 
    53interface
    64
    75uses
    8   Classes, SysUtils, fgl, UTypes, UMouse, UControls, UGraphics;
     6  Classes, SysUtils, Generics.Collections, UTypes, UMouse, UControls, UGraphics;
    97
    108type
     
    9694  public
    9795    Canvas: TCanvas;
    98     Windows: TFPGObjectList<TWindow>;
     96    Windows: TObjectList<TWindow>;
    9997    Size: TSize;
    10098    procedure Paint;
     
    116114begin
    117115  if FWindow = AValue then Exit;
    118   Canvas.Free;
     116  FreeAndNil(Canvas);
    119117  FWindow := AValue;
    120118  Canvas := TCanvasWindow.Create;
     
    173171destructor TTitleBar.Destroy;
    174172begin
    175   ButtonClose.Free;
    176   ButtonMaximize.Free;
    177   ButtonMinimize.Free;
     173  FreeAndNil(ButtonClose);
     174  FreeAndNil(ButtonMaximize);
     175  FreeAndNil(ButtonMinimize);
    178176  inherited;
    179177end;
     
    293291begin
    294292  inherited;
    295   Canvas.Free;
     293  FreeAndNil(Canvas);
    296294  Canvas := TCanvasWindow.Create;
    297295  TCanvasWindow(Canvas).Window := Self;
     
    304302begin
    305303  Visible := False;
    306   TitleBar.Free;
     304  FreeAndNil(TitleBar);
    307305  Screen := nil;
    308   inherited Destroy;
     306  inherited;
    309307end;
    310308
     
    448446constructor TScreen.Create;
    449447begin
    450   Windows := TFPGObjectList<TWindow>.Create;
    451   Windows.FreeObjects := False;
     448  Windows := TObjectList<TWindow>.Create;
     449  Windows.OwnsObjects := False;
    452450  Canvas := TCanvas.Create;
    453451end;
     
    459457  for I := Windows.Count - 1 downto 0 do
    460458    Windows[I].Free;
    461   Windows.Free;
    462   Canvas.Free;
    463   inherited Destroy;
     459  FreeAndNil(Windows);
     460  FreeAndNil(Canvas);
     461  inherited;
    464462end;
    465463
  • branches/overos/overos.lpi

    r33 r38  
    22<CONFIG>
    33  <ProjectOptions>
    4     <Version Value="11"/>
     4    <Version Value="12"/>
    55    <General>
     6      <Flags>
     7        <CompatibilityMode Value="True"/>
     8      </Flags>
    69      <SessionStorage Value="InProjectDir"/>
    7       <MainUnit Value="0"/>
    810      <Title Value="overos"/>
    911      <ResourceType Value="res"/>
     
    136138    <Linking>
    137139      <Debugging>
     140        <DebugInfoType Value="dsDwarf2Set"/>
    138141        <UseHeaptrc Value="True"/>
    139142      </Debugging>
Note: See TracChangeset for help on using the changeset viewer.