Changeset 15 for trunk/StudioModules/LDModulePascal
- Timestamp:
- Aug 6, 2012, 2:35:22 PM (12 years ago)
- Location:
- trunk/StudioModules/LDModulePascal
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/StudioModules/LDModulePascal/LDModulePascal.lpk
r8 r15 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> … … 24 24 </Files> 25 25 <Type Value="RunAndDesignTime"/> 26 <RequiredPkgs Count=" 2">26 <RequiredPkgs Count="3"> 27 27 <Item1> 28 <PackageName Value="LD StudioCommon"/>28 <PackageName Value="LDModuleProject"/> 29 29 </Item1> 30 30 <Item2> 31 <PackageName Value="LDStudioCommon"/> 32 </Item2> 33 <Item3> 31 34 <PackageName Value="FCL"/> 32 </Item 2>35 </Item3> 33 36 </RequiredPkgs> 34 37 <UsageOptions> -
trunk/StudioModules/LDModulePascal/ULDModulePascal.pas
r12 r15 6 6 7 7 uses 8 Classes, SysUtils, UModularSystem, USource ;8 Classes, SysUtils, UModularSystem, USource, UProject; 9 9 10 10 type 11 { TProjectTemplateConsoleApp } 12 13 TProjectTemplateConsoleApp = class(TFileTemplate) 14 constructor Create; override; 15 function Execute: TSource; override; 16 end; 17 18 { TProjectTemplateGUIApp } 19 20 TProjectTemplateGUIApp = class(TFileTemplate) 21 constructor Create; override; 22 function Execute: TSource; override; 23 end; 24 25 { TProjectTemplatePackage } 26 27 TProjectTemplatePackage = class(TFileTemplate) 28 constructor Create; override; 29 function Execute: TSource; override; 30 end; 31 32 { TProjectTemplateUnit } 33 34 TProjectTemplateUnit = class(TFileTemplate) 35 constructor Create; override; 36 function Execute: TSource; override; 37 end; 11 38 12 39 { TLDModulePascal } … … 15 42 private 16 43 PasFileType: TSourceType; 44 ProjectTemplateConsoleApp: TProjectTemplateConsoleApp; 45 ProjectTemplateGUIApp: TProjectTemplateGUIApp; 46 ProjectTemplateUnit: TProjectTemplateUnit; 17 47 public 18 48 constructor Create; override; … … 48 78 PasFileType.Title := 'Pascal source'; 49 79 RegisterFileType(PasFileType); 80 ProjectTemplateConsoleApp := TProjectTemplateConsoleApp.Create; 81 RegisterFileTemplate(ProjectTemplateConsoleApp); 82 ProjectTemplateGUIApp := TProjectTemplateGUIApp.Create; 83 RegisterFileTemplate(ProjectTemplateGUIApp); 84 ProjectTemplateUnit := TProjectTemplateUnit.Create; 85 RegisterFileTemplate(ProjectTemplateUnit); 50 86 end; 51 87 inherited Install; … … 56 92 inherited Uninstall; 57 93 with TLDStudioAPI(API) do begin 94 RegisterFileTemplate(ProjectTemplateUnit); 95 FreeAndNil(ProjectTemplateUnit); 96 UnregisterFileTemplate(ProjectTemplateGUIApp); 97 FreeAndNil(ProjectTemplateGUIApp); 98 UnregisterFileTemplate(ProjectTemplateConsoleApp); 99 FreeAndNil(ProjectTemplateConsoleApp); 58 100 UnregisterFileType(PasFileType); 59 PasFileType.Free; 60 end; 101 FreeAndNil(PasFileType); 102 end; 103 end; 104 105 resourcestring 106 SConsoleApplication = 'Console application'; 107 SUnit = 'Unit'; 108 SPackage = 'Package'; 109 SGUIApplication = 'GUI application'; 110 111 { TProjectTemplateUnit } 112 113 constructor TProjectTemplateUnit.Create; 114 begin 115 inherited Create; 116 Name := SUnit; 117 //FileTypeClass := TSourceText; 118 end; 119 120 function TProjectTemplateUnit.Execute: TSource; 121 var 122 NewFile: TSource; 123 begin 124 //inherited InitProject(Project); 125 Result := TSourceText.Create; 126 Result.Name := 'Unit1.pas'; 127 with TSourceText(Result).Content do begin 128 Add('unit Unit1;'); 129 Add(''); 130 Add('interface'); 131 Add(''); 132 Add('implementation'); 133 Add(''); 134 Add('end.'); 135 end; 136 end; 137 138 { TProjectTemplatePackage } 139 140 constructor TProjectTemplatePackage.Create; 141 begin 142 inherited Create; 143 Name := SPackage; 144 end; 145 146 function TProjectTemplatePackage.Execute: TSource; 147 var 148 NewFile: TSourceText; 149 begin 150 { Result := TProject.Create; 151 Result.Name := 'Package1'; 152 NewFile := TSourceText.Create; 153 NewFile.Name := 'Package1.bpl'; 154 with NewFile.Content do begin 155 Add('package Package1;'); 156 Add(''); 157 Add('requires'); 158 Add(' RTL;'); 159 Add(''); 160 Add('end.'); 161 end; 162 TProject(Result).Files.Add(); 163 TProject(Result).MainSource := NewFile; 164 }end; 165 166 { TProjectTemplateGUIApp } 167 168 constructor TProjectTemplateGUIApp.Create; 169 begin 170 inherited Create; 171 Name := SGUIApplication; 172 end; 173 174 function TProjectTemplateGUIApp.Execute: TSource; 175 var 176 NewFile: TProjectFile; 177 begin 178 { inherited InitProject(Project); 179 NewFile := Project.Files.AddFile('Project1.dpr'); 180 with NewFile.Source do begin 181 Add('program Project1;'); 182 Add(''); 183 Add('uses'); 184 Add(' GUI;'); 185 Add(''); 186 Add('var'); 187 Add(' Application: TApplication'); 188 Add('begin'); 189 Add(' Application := TApplication.Create;'); 190 Add(' Application.Run;'); 191 Add(' Application.Free;'); 192 Add('end.'); 193 end; 194 Project.MainSource := NewFile; 195 }end; 196 197 { TProjectTemplateConsoleApp } 198 199 constructor TProjectTemplateConsoleApp.Create; 200 begin 201 inherited Create; 202 Name := SConsoleApplication; 203 end; 204 205 function TProjectTemplateConsoleApp.Execute: TSource; 206 var 207 NewFile: TProjectFile; 208 begin 209 { inherited InitProject(Project); 210 NewFile := Project.Files.AddFile('Project1.dpr'); 211 with NewFile.Source do begin 212 Add('program Project1;'); 213 Add(''); 214 Add('begin'); 215 Add('end.'); 216 end; 217 Project.MainSource := NewFile;} 61 218 end; 62 219
Note:
See TracChangeset
for help on using the changeset viewer.