Changeset 16
- Timestamp:
- Aug 6, 2012, 3:16:26 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 4 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Studio/LibreDevelopStudio.lpi
r15 r16 33 33 </local> 34 34 </RunParams> 35 <RequiredPackages Count=" 7">35 <RequiredPackages Count="8"> 36 36 <Item1> 37 <PackageName Value="LD StudioCommon"/>37 <PackageName Value="LDModuleBasic"/> 38 38 </Item1> 39 39 <Item2> 40 <PackageName Value="LD ModuleProject"/>40 <PackageName Value="LDStudioCommon"/> 41 41 </Item2> 42 42 <Item3> 43 <PackageName Value="LDModuleP ascal"/>43 <PackageName Value="LDModuleProject"/> 44 44 </Item3> 45 45 <Item4> 46 <PackageName Value="LDModule Brainfuck"/>46 <PackageName Value="LDModulePascal"/> 47 47 </Item4> 48 48 <Item5> 49 <PackageName Value="LDModule Debug"/>49 <PackageName Value="LDModuleBrainfuck"/> 50 50 </Item5> 51 51 <Item6> 52 <PackageName Value="L ibreDevelopStudio"/>52 <PackageName Value="LDModuleDebug"/> 53 53 </Item6> 54 54 <Item7> 55 <PackageName Value="LibreDevelopStudio"/> 56 </Item7> 57 <Item8> 55 58 <PackageName Value="LCL"/> 56 </Item 7>59 </Item8> 57 60 </RequiredPackages> 58 61 <Units Count="2"> -
trunk/Studio/UCore.pas
r15 r16 30 30 uses 31 31 ULDModuleDebug, UFormMain, ULDModuleBrainfuck, UDataModule, ULDModulePascal, 32 ULDModuleProject ;32 ULDModuleProject, ULDModuleBasic; 33 33 34 34 { TCore } … … 51 51 RegisterModule(TLDModuleBrainfuck.Create, True); 52 52 RegisterModule(TLDModuleDebug.Create, True); 53 RegisterModule(TLDModuleBasic.Create, True); 53 54 InstallMarked; 54 55 end; -
trunk/StudioCommon/USource.pas
r15 r16 9 9 10 10 type 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; 28 12 29 13 { TSource } … … 36 20 Modified: Boolean; 37 21 Form: TForm; 22 FileType: TSourceType; 38 23 property Name: string read FName write SetName; 39 24 end; … … 44 29 Items: TListObject; // TListObject<TSource> 45 30 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; 46 51 end; 47 52 … … 84 89 TConvertorClass = class of TConvertor; 85 90 86 { TSourceText }87 88 TSourceText = class(TSource)89 private90 public91 Loaded: Boolean;92 Content: TStringList;93 constructor Create;94 destructor Destroy; override;95 end;96 97 98 91 99 92 implementation … … 107 100 begin 108 101 inherited; 102 SourceClass := TSource; 109 103 end; 110 104 … … 151 145 end; 152 146 147 function TFileTypes.FindByExt(Extension: string): TSourceType; 148 var 149 I: Integer; 150 begin 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; 155 end; 156 153 157 { TConvertor } 154 158 … … 169 173 end; 170 174 171 { TSourceText }172 173 constructor TSourceText.Create;174 begin175 Content := TStringList.Create;176 end;177 178 destructor TSourceText.Destroy;179 begin180 Content.Free;181 inherited Destroy;182 end;183 184 175 end. 185 176 -
trunk/StudioModules/LDModuleBrainfuck/LDModuleBrainfuck.lpk
r7 r16 8 8 <PathDelim Value="\"/> 9 9 <SearchPaths> 10 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS) \"/>10 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> 11 11 </SearchPaths> 12 12 <Other> … … 28 28 </Files> 29 29 <Type Value="RunAndDesignTime"/> 30 <RequiredPkgs Count=" 2">30 <RequiredPkgs Count="3"> 31 31 <Item1> 32 <PackageName Value="LD StudioCommon"/>32 <PackageName Value="LDModuleBasic"/> 33 33 </Item1> 34 34 <Item2> 35 <PackageName Value="LDStudioCommon"/> 36 </Item2> 37 <Item3> 35 38 <PackageName Value="FCL"/> 36 </Item 2>39 </Item3> 37 40 </RequiredPkgs> 38 41 <UsageOptions> -
trunk/StudioModules/LDModuleBrainfuck/UBrainfuckCode.pas
r15 r16 27 27 end; 28 28 29 29 30 implementation 31 32 uses 33 ULDModuleBasic; 30 34 31 35 { TSourceBrainFuck } -
trunk/StudioModules/LDModuleBrainfuck/ULDModuleBrainfuck.pas
r11 r16 39 39 Version := '0.1'; 40 40 License := 'GNU/LGPLv3'; 41 Dependencies.Add('Basic'); 41 42 end; 42 43 -
trunk/StudioModules/LDModulePascal/ULDModulePascal.pas
r15 r16 37 37 end; 38 38 39 { TPascalSourceType } 40 41 TPascalSourceType = class(TSourceType) 42 constructor Create; override; 43 end; 44 39 45 { TLDModulePascal } 40 46 41 47 TLDModulePascal = class(TModule) 42 48 private 43 PasFileType: T SourceType;49 PasFileType: TPascalSourceType; 44 50 ProjectTemplateConsoleApp: TProjectTemplateConsoleApp; 45 51 ProjectTemplateGUIApp: TProjectTemplateGUIApp; … … 55 61 56 62 uses 57 ULDStudioAPI ;63 ULDStudioAPI, ULDModuleBasic; 58 64 59 65 resourcestring 60 66 SPascal = 'Pascal'; 67 68 { TPascalSourceType } 69 70 constructor TPascalSourceType.Create; 71 begin 72 inherited Create; 73 Extension := '.pas'; 74 Title := 'Pascal source'; 75 end; 61 76 62 77 { TLDModulePascal } … … 74 89 begin 75 90 with TLDStudioAPI(API) do begin 76 PasFileType := TSourceType.Create; 77 PasFileType.Extension := '.pas'; 78 PasFileType.Title := 'Pascal source'; 91 PasFileType := TPascalSourceType.Create; 79 92 RegisterFileType(PasFileType); 80 93 ProjectTemplateConsoleApp := TProjectTemplateConsoleApp.Create; … … 125 138 Result := TSourceText.Create; 126 139 Result.Name := 'Unit1.pas'; 127 with TSourceText(Result) .Content do begin140 with TSourceText(Result), Content do begin 128 141 Add('unit Unit1;'); 129 142 Add(''); … … 133 146 Add(''); 134 147 Add('end.'); 148 Loaded := True; 135 149 end; 136 150 end; -
trunk/StudioModules/LDModuleProject/LDModuleProject.lpk
r15 r16 37 37 </i18n> 38 38 <Type Value="RunAndDesignTime"/> 39 <RequiredPkgs Count=" 3">39 <RequiredPkgs Count="4"> 40 40 <Item1> 41 <PackageName Value=" Common"/>41 <PackageName Value="LDModuleBasic"/> 42 42 </Item1> 43 43 <Item2> 44 <PackageName Value=" LDStudioCommon"/>44 <PackageName Value="Common"/> 45 45 </Item2> 46 46 <Item3> 47 <PackageName Value="LDStudioCommon"/> 48 </Item3> 49 <Item4> 47 50 <PackageName Value="FCL"/> 48 </Item 3>51 </Item4> 49 52 </RequiredPkgs> 50 53 <UsageOptions> -
trunk/StudioModules/LDModuleProject/ULDModuleProject.pas
r15 r16 172 172 Version := '0.1'; 173 173 License := 'GNU/LGPLv3'; 174 Dependencies.Add('Basic'); 174 175 end; 175 176 -
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.