Changeset 15 for trunk/StudioModules
- Timestamp:
- Aug 6, 2012, 2:35:22 PM (12 years ago)
- Location:
- trunk/StudioModules
- Files:
-
- 9 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/StudioModules/LDModuleBrainfuck/UBrainfuckCode.pas
r7 r15 62 62 TSourceBrainFuck(Output).Code.Clear; 63 63 Index := 0; 64 Code := TSourceText(Input).Content ;64 Code := TSourceText(Input).Content.Text; 65 65 for I := 1 to Length(Code) do begin 66 66 case Code[I] of -
trunk/StudioModules/LDModuleDebug/LDModuleDebug.lpk
r5 r15 39 39 </Item5> 40 40 </Files> 41 <i18n> 42 <EnableI18N Value="True"/> 43 <OutDir Value="Languages"/> 44 <EnableI18NForLFM Value="True"/> 45 </i18n> 41 46 <Type Value="RunAndDesignTime"/> 42 47 <RequiredPkgs Count="3"> -
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 -
trunk/StudioModules/LDModuleProject/LDModuleProject.lpk
r11 r15 31 31 </Item3> 32 32 </Files> 33 <i18n> 34 <EnableI18N Value="True"/> 35 <OutDir Value="Languages"/> 36 <EnableI18NForLFM Value="True"/> 37 </i18n> 33 38 <Type Value="RunAndDesignTime"/> 34 <RequiredPkgs Count=" 2">39 <RequiredPkgs Count="3"> 35 40 <Item1> 36 <PackageName Value=" LDStudioCommon"/>41 <PackageName Value="Common"/> 37 42 </Item1> 38 43 <Item2> 44 <PackageName Value="LDStudioCommon"/> 45 </Item2> 46 <Item3> 39 47 <PackageName Value="FCL"/> 40 </Item 2>48 </Item3> 41 49 </RequiredPkgs> 42 50 <UsageOptions> -
trunk/StudioModules/LDModuleProject/ULDModuleProject.lfm
r12 r15 1 1 object DataModuleProject: TDataModuleProject 2 OnCreate = DataModuleCreate 2 3 OnDestroy = DataModuleDestroy 3 4 OldCreateOrder = False 4 5 Height = 328 5 HorizontalOffset = 2556 VerticalOffset = 756 HorizontalOffset = 390 7 VerticalOffset = 142 7 8 Width = 409 8 9 object ActionList1: TActionList … … 19 20 object AOpenRecent: TAction 20 21 Caption = 'Open recent' 22 OnExecute = AOpenRecentExecute 21 23 end 22 24 object ASave: TAction … … 46 48 Action = AOpen 47 49 end 48 object MenuItem 3: TMenuItem50 object MenuItemOpenRecent: TMenuItem 49 51 Action = AOpenRecent 50 52 end … … 73 75 top = 120 74 76 end 77 object LastOpenedList1: TLastOpenedList 78 MaxCount = 10 79 OnChange = LastOpenedList1Change 80 left = 125 81 top = 64 82 end 75 83 end -
trunk/StudioModules/LDModuleProject/ULDModuleProject.pas
r14 r15 7 7 uses 8 8 Classes, SysUtils, FileUtil, ActnList, Menus, Dialogs, UModularSystem, 9 U Project;9 ULastOpenedList, UProject, URegistry, USource; 10 10 11 11 type … … 22 22 ANew: TAction; 23 23 ActionList1: TActionList; 24 LastOpenedList1: TLastOpenedList; 24 25 MenuItem1: TMenuItem; 25 26 MenuItem2: TMenuItem; 26 MenuItem 3: TMenuItem;27 MenuItemOpenRecent: TMenuItem; 27 28 MenuItem4: TMenuItem; 28 29 MenuItem5: TMenuItem; … … 36 37 procedure ANewExecute(Sender: TObject); 37 38 procedure AOpenExecute(Sender: TObject); 39 procedure AOpenRecentExecute(Sender: TObject); 38 40 procedure AProjectManagerExecute(Sender: TObject); 39 41 procedure ASaveAsExecute(Sender: TObject); 40 42 procedure ASaveExecute(Sender: TObject); 43 procedure DataModuleCreate(Sender: TObject); 41 44 procedure DataModuleDestroy(Sender: TObject); 45 procedure LastOpenedList1Change(Sender: TObject); 42 46 private 43 47 { private declarations } … … 45 49 Project: TProject; 46 50 procedure UpdateInterface; 51 procedure LoadFromRegistry(Context: TRegistryContext); 52 procedure SaveToRegistry(Context: TRegistryContext); 47 53 end; 48 54 … … 51 57 TLDModuleProject = class(TModule) 52 58 private 59 ProjectFileType: TSourceType; 53 60 public 54 61 constructor Create; override; … … 93 100 end; 94 101 102 procedure TDataModuleProject.DataModuleCreate(Sender: TObject); 103 begin 104 105 end; 106 95 107 procedure TDataModuleProject.DataModuleDestroy(Sender: TObject); 96 108 begin 97 109 AClose.Execute; 110 end; 111 112 procedure TDataModuleProject.LastOpenedList1Change(Sender: TObject); 113 begin 114 LastOpenedList1.LoadToMenuItem(MenuItemOpenRecent, AOpenRecentExecute); 98 115 end; 99 116 … … 103 120 ASaveAs.Enabled := Assigned(Project); 104 121 AClose.Enabled := Assigned(Project); 122 end; 123 124 procedure TDataModuleProject.LoadFromRegistry(Context: TRegistryContext); 125 begin 126 LastOpenedList1.LoadFromRegistry(Context.RootKey, Context.Key + '\RecentFile'); 127 end; 128 129 procedure TDataModuleProject.SaveToRegistry(Context: TRegistryContext); 130 begin 131 LastOpenedList1.SaveToRegistry(Context.RootKey, Context.Key + '\RecentFile'); 105 132 end; 106 133 … … 122 149 procedure TDataModuleProject.AOpenExecute(Sender: TObject); 123 150 begin 124 OpenDialog1.FileName := Project.FileName; 151 if Assigned(Project) then 152 OpenDialog1.FileName := Project.FileName; 125 153 if OpenDialog1.Execute then begin 126 154 Project.FileName := OpenDialog1.FileName; … … 128 156 UpdateInterface; 129 157 end; 158 end; 159 160 procedure TDataModuleProject.AOpenRecentExecute(Sender: TObject); 161 begin 162 130 163 end; 131 164 … … 150 183 DataModuleProject.PopupMenu1.Items.Caption := SProject; 151 184 RegisterMainMenuItem(DataModuleProject.PopupMenu1.Items, nil, 1); 185 DataModuleProject.LoadFromRegistry(RegContext(GetRegistryContext.RootKey, 186 GetRegistryContext.Key + '\Project')); 187 DataModuleProject.UpdateInterface; 188 ProjectFileType := TSourceType.Create; 189 ProjectFileType.Extension := '.ldp'; 190 ProjectFileType.Title := 'LibreDevelop project'; 191 RegisterFileType(ProjectFileType); 152 192 end; 153 193 inherited; … … 158 198 inherited; 159 199 with TLDStudioAPI(API) do begin 200 UnregisterFileType(ProjectFileType); 201 DataModuleProject.SaveToRegistry(RegContext(GetRegistryContext.RootKey, 202 GetRegistryContext.Key + '\Project')); 160 203 UnregisterMainMenuItem(DataModuleProject.PopupMenu1.Items); 161 204 FreeAndNil(DataModuleProject); -
trunk/StudioModules/LDModuleProject/UProject.pas
r11 r15 7 7 uses 8 8 Classes, SysUtils, Dialogs, DOM, XMLWrite, XMLRead, FileUtil, 9 SpecializedList ;9 SpecializedList, USource; 10 10 11 11 const … … 71 71 end; 72 72 73 TProject = class 73 TProject = class(TSource) 74 74 private 75 75 FModified: Boolean;
Note:
See TracChangeset
for help on using the changeset viewer.