Ignore:
Timestamp:
Aug 6, 2012, 2:35:22 PM (12 years ago)
Author:
chronos
Message:
  • Added: Registration of new file templates for modules.
  • Added: Program stores last opened file list in registry.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/StudioCommon/USource.pas

    r8 r15  
    66
    77uses
    8   Classes, SysUtils, SpecializedList;
     8  Classes, SysUtils, SpecializedList, Forms;
    99
    1010type
     11
     12  { TSourceType }
     13
    1114  TSourceType = class
    1215    Extension: string;
    1316    Title: string;
     17    Form: TForm;
     18    constructor Create; virtual;
    1419  end;
     20
     21  TFileTypeClass = class of TSourceType;
    1522
    1623  { TFileTypes }
     
    2027  end;
    2128
     29  { TSource }
     30
    2231  TSource = class
    23     Name: string;
     32  private
     33    FName: string;
     34    procedure SetName(AValue: string);
     35  public
     36    Modified: Boolean;
     37    Form: TForm;
     38    property Name: string read FName write SetName;
    2439  end;
    2540
     
    2944    Items: TListObject; // TListObject<TSource>
    3045    Main: TSource;
     46  end;
     47
     48  { TFileTemplate }
     49
     50  TFileTemplate = class
     51  public
     52    Name: string;
     53    Description: TStringList;
     54    FileTypeClass: TSourceType;
     55    constructor Create; virtual;
     56    destructor Destroy; override;
     57    function Execute: TSource; virtual;
     58  end;
     59
     60  TFileTemplates = class(TListObject)
    3161  end;
    3262
     
    5484  TConvertorClass = class of TConvertor;
    5585
     86  { TSourceText }
     87
    5688  TSourceText = class(TSource)
    57     Content: string;
    58     InMemory: Boolean;
     89  private
     90  public
     91    Loaded: Boolean;
     92    Content: TStringList;
     93    constructor Create;
     94    destructor Destroy; override;
    5995  end;
     96
    6097
    6198
     
    64101resourcestring
    65102  SAllFiles = 'All files';
     103
     104{ TSourceType }
     105
     106constructor TSourceType.Create;
     107begin
     108  inherited;
     109end;
     110
     111procedure TSource.SetName(AValue: string);
     112begin
     113  if FName = AValue then Exit;
     114  FName := AValue;
     115  if Assigned(Form) then
     116    Form.Caption := ExtractFileName(FName);
     117end;
     118
     119
     120{ TFileTemplate }
     121
     122constructor TFileTemplate.Create;
     123begin
     124  Description := TStringList.Create;
     125end;
     126
     127destructor TFileTemplate.Destroy;
     128begin
     129  Description.Free;
     130  inherited Destroy;
     131end;
     132
     133function TFileTemplate.Execute: TSource;
     134begin
     135
     136end;
     137
    66138
    67139{ TFileTypes }
     
    97169end;
    98170
     171{ TSourceText }
     172
     173constructor TSourceText.Create;
     174begin
     175  Content := TStringList.Create;
     176end;
     177
     178destructor TSourceText.Destroy;
     179begin
     180  Content.Free;
     181  inherited Destroy;
     182end;
     183
    99184end.
    100185
Note: See TracChangeset for help on using the changeset viewer.