Changeset 17


Ignore:
Timestamp:
Aug 7, 2012, 2:57:19 PM (12 years ago)
Author:
chronos
Message:
  • Modified: Minor opened files and source management enhancement.
  • Added: Included used packages sources.
Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/StudioModules/LDModuleBasic/UFormSourceCode.pas

    r16 r17  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
    9   SynEdit, SynHighlighterPas;
     9  SynEdit, SynHighlighterPas, USource, ULDModuleBasic;
    1010
    1111type
     
    1818    procedure SynEditSourceChange(Sender: TObject);
    1919  private
    20     FFileName: string;
     20    FSource: TSource;
    2121    FOnChange: TNotifyEvent;
    22     procedure SetFileName(AValue: string);
     22    procedure SetSource(AValue: TSource);
    2323  public
    24     property FileName: string read FFileName write SetFileName;
     24    property Source: TSource read FSource write SetSource;
    2525    procedure Save;
    2626    procedure UpdateInterface;
     
    4545end;
    4646
    47 procedure TFormSourceCode.SetFileName(AValue: string);
     47procedure TFormSourceCode.SetSource(AValue: TSource);
    4848begin
    49   if FFileName = AValue then Exit;
    50   FFileName := AValue;
    51   if FileExistsUTF8(FFileName) then
    52     SynEditSource.Lines.LoadFromFile(FFileName)
     49  if FSource = AValue then Exit;
     50  FSource := AValue;
     51  if Assigned(Source) and (Source is TSourceText) then
     52    SynEditSource.Lines.Text := TSourceText(Source).Content.Text
    5353    else SynEditSource.ClearAll;
    5454end;
  • trunk/StudioModules/LDModuleBasic/ULDModuleBasic.pas

    r16 r17  
    2020  end;
    2121
    22   { TTextFileType }
     22  { TSourceTypeText }
    2323
    24   TTextFileType = class(TSourceType)
     24  TSourceTypeText = class(TSourceType)
    2525    constructor Create; override;
    2626  end;
    2727
    28   { TTextTemplate }
     28  { TTemplateText }
    2929
    30   TTextTemplate = class(TFileTemplate)
     30  TTemplateText = class(TFileTemplate)
    3131    constructor Create; override;
    3232    function Execute: TSource; override;
     
    4444  TLDModuleBasic = class(TModule)
    4545    TextFileType: TSourceType;
    46     TextFileTemplate: TTextTemplate;
     46    TextFileTemplate: TTemplateText;
    4747    constructor Create; override;
    4848    procedure Install; override;
     
    6464
    6565
    66 { TTextTemplate }
     66{ TTemplateText }
    6767
    68 constructor TTextTemplate.Create;
     68constructor TTemplateText.Create;
    6969begin
    7070  inherited Create;
     
    7272end;
    7373
    74 function TTextTemplate.Execute: TSource;
     74function TTemplateText.Execute: TSource;
    7575begin
    7676  Result := TSourceText.Create;
    7777  Result.Name := STextFile;
     78  Result.FileType := TSourceTypeText.Create;
    7879end;
    7980
    80 { TTextFileType }
     81{ TSourceTypeText }
    8182
    82 constructor TTextFileType.Create;
     83constructor TSourceTypeText.Create;
    8384begin
    8485  inherited Create;
    8586  Extension := '.txt';
    8687  Title := STextFile;
    87 //  Form := TSour;
     88  Form := TFormSourceCode;
     89  SourceClass := TSourceText;
    8890end;
    8991
     
    119121    FormSourceCode := TFormSourceCode.Create(nil);
    120122    RegisterForm(FormSourceCode);
    121     TextFileType := TTextFileType.Create;
     123    TextFileType := TSourceTypeText.Create;
    122124    RegisterFileType(TextFileType);
    123     TextFileTemplate := TTextTemplate.Create;
     125    TextFileTemplate := TTemplateText.Create;
    124126    RegisterFileTemplate(TextFileTemplate);
    125127  end;
  • trunk/StudioModules/LDModuleProject/ULDModuleProject.pas

    r16 r17  
    200200  with TLDStudioAPI(API) do begin
    201201    UnregisterFileType(ProjectFileType);
     202    FreeAndNil(ProjectFileType);
    202203    DataModuleProject.SaveToRegistry(RegContext(GetRegistryContext.RootKey,
    203204      GetRegistryContext.Key + '\Project'));
Note: See TracChangeset for help on using the changeset viewer.