Changeset 16 for trunk/StudioPackage
- Timestamp:
- Aug 6, 2012, 3:16:26 PM (12 years ago)
- Location:
- trunk/StudioPackage
- Files:
-
- 4 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/StudioPackage/Forms/UFormMain.pas
r15 r16 134 134 135 135 uses 136 UFormS ourceCode, UFormSettings, UFormModuleList, UFormNewFile, USource;136 UFormSettings, UFormModuleList, UFormNewFile, USource; 137 137 138 138 { TFormMain } -
trunk/StudioPackage/Languages/UDataModule.po
r15 r16 6 6 msgstr "" 7 7 8 #: udatamodule.stextfile9 msgid "Text file"10 msgstr ""11 -
trunk/StudioPackage/LibreDevelopStudio.lpk
r15 r16 23 23 </Other> 24 24 </CompilerOptions> 25 <Files Count=" 6">25 <Files Count="5"> 26 26 <Item1> 27 27 <Filename Value="Forms\UFormMain.pas"/> … … 33 33 </Item2> 34 34 <Item3> 35 <Filename Value="Forms\UFormS ourceCode.pas"/>36 <UnitName Value="UFormS ourceCode"/>35 <Filename Value="Forms\UFormSettings.pas"/> 36 <UnitName Value="UFormSettings"/> 37 37 </Item3> 38 38 <Item4> 39 <Filename Value="Forms\UForm Settings.pas"/>40 <UnitName Value="UForm Settings"/>39 <Filename Value="Forms\UFormModuleList.pas"/> 40 <UnitName Value="UFormModuleList"/> 41 41 </Item4> 42 42 <Item5> 43 <Filename Value="Forms\UFormModuleList.pas"/>44 <UnitName Value="UFormModuleList"/>45 </Item5>46 <Item6>47 43 <Filename Value="Forms\UFormNewFile.pas"/> 48 44 <UnitName Value="UFormNewFile"/> 49 </Item 6>45 </Item5> 50 46 </Files> 51 47 <i18n> … … 55 51 </i18n> 56 52 <Type Value="RunAndDesignTime"/> 57 <RequiredPkgs Count=" 7">53 <RequiredPkgs Count="8"> 58 54 <Item1> 59 <PackageName Value=" CoolTranslator"/>55 <PackageName Value="LDModuleBasic"/> 60 56 </Item1> 61 57 <Item2> 62 <PackageName Value="Co mmon"/>58 <PackageName Value="CoolTranslator"/> 63 59 </Item2> 64 60 <Item3> 65 <PackageName Value=" LDStudioCommon"/>61 <PackageName Value="Common"/> 66 62 </Item3> 67 63 <Item4> 68 <PackageName Value=" synedit"/>64 <PackageName Value="LDStudioCommon"/> 69 65 </Item4> 70 66 <Item5> 71 <PackageName Value=" TemplateGenerics"/>67 <PackageName Value="synedit"/> 72 68 </Item5> 73 69 <Item6> 74 <PackageName Value=" LCL"/>70 <PackageName Value="TemplateGenerics"/> 75 71 </Item6> 76 72 <Item7> 73 <PackageName Value="LCL"/> 74 </Item7> 75 <Item8> 77 76 <PackageName Value="FCL"/> 78 </Item 7>77 </Item8> 79 78 </RequiredPkgs> 80 79 <UsageOptions> -
trunk/StudioPackage/LibreDevelopStudio.pas
r15 r16 8 8 9 9 uses 10 UFormMain, UDataModule, UFormS ourceCode, UFormSettings, UFormModuleList,11 UFormNewFile,LazarusPackageIntf;10 UFormMain, UDataModule, UFormSettings, UFormModuleList, UFormNewFile, 11 LazarusPackageIntf; 12 12 13 13 implementation -
trunk/StudioPackage/UDataModule.pas
r15 r16 11 11 12 12 type 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 26 13 { TOpenedFiles } 27 14 … … 35 22 procedure OpenFileName(FileName: string); 36 23 procedure OpenFile(Source: TSource); 37 procedure NewFile;38 24 property OnChange: TNotifyEvent read FOnChange write FOnChange; 39 25 end; … … 65 51 procedure DataModuleDestroy(Sender: TObject); 66 52 private 67 TextFileType: TSourceType;68 TextFileTemplate: TTextTemplate;69 53 procedure AutoOpen; 70 54 procedure DockToPageControl(PageControl: TPageControl; Form: TForm); … … 88 72 89 73 uses 90 UForm SourceCode, UFormMain, UFormSettings, UFormModuleList, UFormNewFile;74 UFormMain, UFormSettings, UFormModuleList, UFormNewFile, ULDModuleBasic; 91 75 92 76 resourcestring 93 77 SNewFile = 'New file'; 94 STextFile = 'Text file';95 96 { TTextFileType }97 98 constructor TTextFileType.Create;99 begin100 inherited Create;101 Extension := '.txt';102 Title := 'Text file';;103 end;104 105 { TTextTemplate }106 107 constructor TTextTemplate.Create;108 begin109 inherited Create;110 Name := STextFile;111 end;112 113 78 114 79 { TOpenedFiles } … … 133 98 procedure TOpenedFiles.OpenFileName(FileName: string); 134 99 var 135 NewFile: TSourceText; 136 begin 137 NewFile := TSourceText.Create; 138 NewFile.Name := FileName; 139 OpenFile(NewFile); 100 NewFile: TSource; 101 FileType: TSourceType; 102 begin 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; 140 109 end; 141 110 … … 143 112 begin 144 113 AddNew(Source); 145 Source.Form := TFormSourceCode.Create(nil);114 Source.Form := Source.FileType.Form.Create(nil); 146 115 Source.Form.Caption := ExtractFileName(Source.Name); 147 116 Source.Form.Visible := True; 148 117 Selected := Source; 149 if Assigned(FOnChange) then FOnChange(Self);150 end;151 152 procedure TOpenedFiles.NewFile;153 var154 NewFile: TSource;155 begin156 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;162 118 if Assigned(FOnChange) then FOnChange(Self); 163 119 end; … … 175 131 ModuleManager.API := API; 176 132 177 TextFileType := TTextFileType.Create;178 API.RegisterFileType(TextFileType);179 TextFileTemplate := TTextTemplate.Create;180 API.RegisterFileTemplate(TextFileTemplate);181 182 133 FormMain := TFormMain.Create(nil); 183 134 Application.UpdateMainForm(FormMain); 184 135 OpenedFiles.OnChange := FormMain.OpenedFileChange; 185 FormSourceCode := TFormSourceCode.Create(nil);186 136 FormSettings := TFormSettings.Create(nil); 187 137 FormModuleList := TFormModuleList.Create(nil); … … 301 251 procedure TDataModule1.DataModuleDestroy(Sender: TObject); 302 252 begin 303 API.UnregisterFileType(TextFileType);304 FreeAndNil(TextFileType);305 API.UnregisterFileTemplate(TextFileTemplate);306 FreeAndNil(TextFileTemplate);307 308 253 SaveToRegistry(RegContext(HKEY(ApplicationInfo1.RegistryRoot), ApplicationInfo1.RegistryKey)); 309 254 FreeAndNil(ModuleManager); 310 255 FreeAndNil(FormNewFile); 311 256 FreeAndNil(FormMain); 312 FreeAndNil(FormSourceCode);313 257 FreeAndNil(FormSettings); 314 258 FreeAndNil(FormModuleList);
Note:
See TracChangeset
for help on using the changeset viewer.