Changeset 16 for trunk/StudioCommon


Ignore:
Timestamp:
Aug 6, 2012, 3:16:26 PM (12 years ago)
Author:
chronos
Message:
  • Modified: Definition of text source file moved to new package Basic.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/StudioCommon/USource.pas

    r15 r16  
    99
    1010type
    11 
    12   { TSourceType }
    13 
    14   TSourceType = class
    15     Extension: string;
    16     Title: string;
    17     Form: TForm;
    18     constructor Create; virtual;
    19   end;
    20 
    21   TFileTypeClass = class of TSourceType;
    22 
    23   { TFileTypes }
    24 
    25   TFileTypes = class(TListObject)
    26     function GetDialogFilter: string;
    27   end;
     11  TSourceType = class;
    2812
    2913  { TSource }
     
    3620    Modified: Boolean;
    3721    Form: TForm;
     22    FileType: TSourceType;
    3823    property Name: string read FName write SetName;
    3924  end;
     
    4429    Items: TListObject; // TListObject<TSource>
    4530    Main: TSource;
     31  end;
     32
     33
     34  { TSourceType }
     35
     36  TSourceType = class
     37    Extension: string;
     38    Title: string;
     39    Form: TFormClass;
     40    SourceClass: TSourceClass;
     41    constructor Create; virtual;
     42  end;
     43
     44  TFileTypeClass = class of TSourceType;
     45
     46  { TFileTypes }
     47
     48  TFileTypes = class(TListObject)
     49    function GetDialogFilter: string;
     50    function FindByExt(Extension: string): TSourceType;
    4651  end;
    4752
     
    8489  TConvertorClass = class of TConvertor;
    8590
    86   { TSourceText }
    87 
    88   TSourceText = class(TSource)
    89   private
    90   public
    91     Loaded: Boolean;
    92     Content: TStringList;
    93     constructor Create;
    94     destructor Destroy; override;
    95   end;
    96 
    97 
    9891
    9992implementation
     
    107100begin
    108101  inherited;
     102  SourceClass := TSource;
    109103end;
    110104
     
    151145end;
    152146
     147function TFileTypes.FindByExt(Extension: string): TSourceType;
     148var
     149  I: Integer;
     150begin
     151  I := 0;
     152  while (I < count) and (TSourceType(Items[I]).Extension <> Extension) do Inc(I);
     153  if I < Count then Result := TSourceType(Items[I])
     154    else Result := nil;
     155end;
     156
    153157{ TConvertor }
    154158
     
    169173end;
    170174
    171 { TSourceText }
    172 
    173 constructor TSourceText.Create;
    174 begin
    175   Content := TStringList.Create;
    176 end;
    177 
    178 destructor TSourceText.Destroy;
    179 begin
    180   Content.Free;
    181   inherited Destroy;
    182 end;
    183 
    184175end.
    185176
Note: See TracChangeset for help on using the changeset viewer.