Changeset 16 for trunk/StudioPackage


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.
Location:
trunk/StudioPackage
Files:
4 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/StudioPackage/Forms/UFormMain.pas

    r15 r16  
    134134
    135135uses
    136   UFormSourceCode, UFormSettings, UFormModuleList, UFormNewFile, USource;
     136  UFormSettings, UFormModuleList, UFormNewFile, USource;
    137137
    138138{ TFormMain }
  • trunk/StudioPackage/Languages/UDataModule.po

    r15 r16  
    66msgstr ""
    77
    8 #: udatamodule.stextfile
    9 msgid "Text file"
    10 msgstr ""
    11 
  • trunk/StudioPackage/LibreDevelopStudio.lpk

    r15 r16  
    2323      </Other>
    2424    </CompilerOptions>
    25     <Files Count="6">
     25    <Files Count="5">
    2626      <Item1>
    2727        <Filename Value="Forms\UFormMain.pas"/>
     
    3333      </Item2>
    3434      <Item3>
    35         <Filename Value="Forms\UFormSourceCode.pas"/>
    36         <UnitName Value="UFormSourceCode"/>
     35        <Filename Value="Forms\UFormSettings.pas"/>
     36        <UnitName Value="UFormSettings"/>
    3737      </Item3>
    3838      <Item4>
    39         <Filename Value="Forms\UFormSettings.pas"/>
    40         <UnitName Value="UFormSettings"/>
     39        <Filename Value="Forms\UFormModuleList.pas"/>
     40        <UnitName Value="UFormModuleList"/>
    4141      </Item4>
    4242      <Item5>
    43         <Filename Value="Forms\UFormModuleList.pas"/>
    44         <UnitName Value="UFormModuleList"/>
    45       </Item5>
    46       <Item6>
    4743        <Filename Value="Forms\UFormNewFile.pas"/>
    4844        <UnitName Value="UFormNewFile"/>
    49       </Item6>
     45      </Item5>
    5046    </Files>
    5147    <i18n>
     
    5551    </i18n>
    5652    <Type Value="RunAndDesignTime"/>
    57     <RequiredPkgs Count="7">
     53    <RequiredPkgs Count="8">
    5854      <Item1>
    59         <PackageName Value="CoolTranslator"/>
     55        <PackageName Value="LDModuleBasic"/>
    6056      </Item1>
    6157      <Item2>
    62         <PackageName Value="Common"/>
     58        <PackageName Value="CoolTranslator"/>
    6359      </Item2>
    6460      <Item3>
    65         <PackageName Value="LDStudioCommon"/>
     61        <PackageName Value="Common"/>
    6662      </Item3>
    6763      <Item4>
    68         <PackageName Value="synedit"/>
     64        <PackageName Value="LDStudioCommon"/>
    6965      </Item4>
    7066      <Item5>
    71         <PackageName Value="TemplateGenerics"/>
     67        <PackageName Value="synedit"/>
    7268      </Item5>
    7369      <Item6>
    74         <PackageName Value="LCL"/>
     70        <PackageName Value="TemplateGenerics"/>
    7571      </Item6>
    7672      <Item7>
     73        <PackageName Value="LCL"/>
     74      </Item7>
     75      <Item8>
    7776        <PackageName Value="FCL"/>
    78       </Item7>
     77      </Item8>
    7978    </RequiredPkgs>
    8079    <UsageOptions>
  • trunk/StudioPackage/LibreDevelopStudio.pas

    r15 r16  
    88
    99uses
    10   UFormMain, UDataModule, UFormSourceCode, UFormSettings, UFormModuleList,
    11   UFormNewFile, LazarusPackageIntf;
     10  UFormMain, UDataModule, UFormSettings, UFormModuleList, UFormNewFile,
     11  LazarusPackageIntf;
    1212
    1313implementation
  • trunk/StudioPackage/UDataModule.pas

    r15 r16  
    1111
    1212type
    13 
    14   { TTextTemplate }
    15 
    16   TTextTemplate = class(TFileTemplate)
    17     constructor Create; override;
    18   end;
    19 
    20   { TTextFileType }
    21 
    22   TTextFileType = class(TSourceType)
    23     constructor Create; override;
    24   end;
    25 
    2613  { TOpenedFiles }
    2714
     
    3522    procedure OpenFileName(FileName: string);
    3623    procedure OpenFile(Source: TSource);
    37     procedure NewFile;
    3824    property OnChange: TNotifyEvent read FOnChange write FOnChange;
    3925  end;
     
    6551    procedure DataModuleDestroy(Sender: TObject);
    6652  private
    67     TextFileType: TSourceType;
    68     TextFileTemplate: TTextTemplate;
    6953    procedure AutoOpen;
    7054    procedure DockToPageControl(PageControl: TPageControl; Form: TForm);
     
    8872
    8973uses
    90   UFormSourceCode, UFormMain, UFormSettings, UFormModuleList, UFormNewFile;
     74  UFormMain, UFormSettings, UFormModuleList, UFormNewFile, ULDModuleBasic;
    9175
    9276resourcestring
    9377  SNewFile = 'New file';
    94   STextFile = 'Text file';
    95 
    96 { TTextFileType }
    97 
    98 constructor TTextFileType.Create;
    99 begin
    100   inherited Create;
    101   Extension := '.txt';
    102   Title := 'Text file';;
    103 end;
    104 
    105 { TTextTemplate }
    106 
    107 constructor TTextTemplate.Create;
    108 begin
    109   inherited Create;
    110   Name := STextFile;
    111 end;
    112 
    11378
    11479{ TOpenedFiles }
     
    13398procedure TOpenedFiles.OpenFileName(FileName: string);
    13499var
    135   NewFile: TSourceText;
    136 begin
    137   NewFile := TSourceText.Create;
    138   NewFile.Name := FileName;
    139   OpenFile(NewFile);
     100  NewFile: TSource;
     101  FileType: TSourceType;
     102begin
     103  FileType := DataModule1.FileTypes.FindByExt(ExtractFileExt(FileName));
     104  if Assigned(FileType) then begin
     105    NewFile := FileType.SourceClass.Create;
     106    NewFile.Name := FileName;
     107    OpenFile(NewFile);
     108  end;
    140109end;
    141110
     
    143112begin
    144113  AddNew(Source);
    145   Source.Form := TFormSourceCode.Create(nil);
     114  Source.Form := Source.FileType.Form.Create(nil);
    146115  Source.Form.Caption := ExtractFileName(Source.Name);
    147116  Source.Form.Visible := True;
    148117  Selected := Source;
    149   if Assigned(FOnChange) then FOnChange(Self);
    150 end;
    151 
    152 procedure TOpenedFiles.NewFile;
    153 var
    154   NewFile: TSource;
    155 begin
    156   NewFile := TSourceText(AddNew(TSource.Create));
    157   NewFile.Name := SNewFile;
    158   NewFile.Form := TFormSourceCode.Create(nil);
    159   NewFile.Form.Caption := ExtractFileName(NewFile.Name);
    160   NewFile.Form.Visible := True;
    161   Selected := NewFile;
    162118  if Assigned(FOnChange) then FOnChange(Self);
    163119end;
     
    175131  ModuleManager.API := API;
    176132
    177   TextFileType := TTextFileType.Create;
    178   API.RegisterFileType(TextFileType);
    179   TextFileTemplate := TTextTemplate.Create;
    180   API.RegisterFileTemplate(TextFileTemplate);
    181 
    182133  FormMain := TFormMain.Create(nil);
    183134  Application.UpdateMainForm(FormMain);
    184135  OpenedFiles.OnChange := FormMain.OpenedFileChange;
    185   FormSourceCode := TFormSourceCode.Create(nil);
    186136  FormSettings := TFormSettings.Create(nil);
    187137  FormModuleList := TFormModuleList.Create(nil);
     
    301251procedure TDataModule1.DataModuleDestroy(Sender: TObject);
    302252begin
    303   API.UnregisterFileType(TextFileType);
    304   FreeAndNil(TextFileType);
    305   API.UnregisterFileTemplate(TextFileTemplate);
    306   FreeAndNil(TextFileTemplate);
    307 
    308253  SaveToRegistry(RegContext(HKEY(ApplicationInfo1.RegistryRoot), ApplicationInfo1.RegistryKey));
    309254  FreeAndNil(ModuleManager);
    310255  FreeAndNil(FormNewFile);
    311256  FreeAndNil(FormMain);
    312   FreeAndNil(FormSourceCode);
    313257  FreeAndNil(FormSettings);
    314258  FreeAndNil(FormModuleList);
Note: See TracChangeset for help on using the changeset viewer.