- Timestamp:
- Jun 26, 2012, 7:23:47 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IDE/Forms/UFormMain.lfm
r52 r53 1323 1323 } 1324 1324 end 1325 object DebugLog1: TDebugLog1326 WriteToFileEnable = False1327 FileName = 'DebugLog.txt'1328 MaxCount = 1001329 left = 3441330 top = 881331 end1332 object CoolTranslator1: TCoolTranslator1333 POFilesFolder = 'Languages'1334 left = 3441335 top = 1361336 end1337 1325 end -
trunk/IDE/Forms/UFormMain.pas
r52 r53 16 16 17 17 type 18 19 { TCustomCompiler }20 21 TCustomCompiler = class(TCompiler)22 procedure LoadFromRegistry(Root: HKEY; Key: string);23 procedure SaveToRegistry(Root: HKEY; Key: string);24 end;25 18 26 19 { TFormMain } … … 54 47 AProjectClose: TAction; 55 48 ActionList1: TActionList; 56 CoolTranslator1: TCoolTranslator;57 DebugLog1: TDebugLog;58 49 ImageList1: TImageList; 59 50 MainMenu: TMainMenu; … … 150 141 procedure FormDestroy(Sender: TObject); 151 142 private 152 LastOpenedFiles: TLastOpenedList;153 procedure ProjectTemplatesInit;154 procedure CompilerDebugLog(Text: string);155 143 procedure MenuItemTargetClick(Sender: TObject); 156 procedure OpenRecentClick(Sender: TObject);157 procedure LastOpenedFilesChange(Sender: TObject);158 144 procedure DockInit; 159 procedure LoadFromRegistry(Root: HKEY; Key: string);160 procedure SaveToRegistry(Root: HKEY; Key: string);161 procedure ProjectOpen(FileName: string);162 145 procedure UpdateMenu; 163 146 procedure UpdateToolbar; 164 147 public 165 ReopenLastOpenedFile: Boolean; 166 LogParsing: Boolean; 167 Project: TProject; 168 ProjectTemplates: TProjectTemplateList; 169 TargetProject: TProject; 170 Compiler: TCustomCompiler; 148 procedure LoadFromRegistry(Root: HKEY; Key: string); 149 procedure SaveToRegistry(Root: HKEY; Key: string); 150 procedure OpenRecentClick(Sender: TObject); 171 151 function GetSource(Name: string; var SourceCode: string): Boolean; 172 152 procedure UpdateInterface; … … 182 162 183 163 uses 184 U FormMessages, UFormSourceCode, UFormProject, UCommon, UFormAbout, UFormOptions,164 UCore, UFormMessages, UFormSourceCode, UFormProject, UCommon, UFormAbout, UFormOptions, 185 165 UFormTargets, UTarget, UAnalyzer, UProducer, UExecutor, UFormProjectNew, 186 166 UProjectTemplates, UFormTargetProject; … … 189 169 SNewProject = 'New project'; 190 170 191 { TCustomCompiler }192 193 procedure TCustomCompiler.LoadFromRegistry(Root: HKEY; Key: string);194 var195 I: Integer;196 begin197 with TRegistryEx.Create do198 try199 RootKey := Root;200 for I := 0 to Targets.Count - 1 do201 with TTarget(Targets[I]) do begin202 OpenKey(Key + '\Targets\' + Name, True);203 if ValueExists('CompilerPath') then204 Producer.CompilerPath := ReadStringWithDefault('CompilerPath', Producer.CompilerPath);205 end;206 if ValueExists('SelectedTarget') then207 Target := Targets.SearchBySysName(ReadString('SelectedTarget'))208 else Target := nil;209 finally210 Free;211 end;212 end;213 214 procedure TCustomCompiler.SaveToRegistry(Root: HKEY; Key: string);215 var216 I: Integer;217 begin218 with TRegistryEx.Create do219 try220 RootKey := Root;221 for I := 0 to Targets.Count - 1 do222 with TTarget(Targets[I]) do begin223 OpenKey(Key + '\Targets\' + Name, True);224 if Assigned(Producer) then begin225 if Producer.CompilerPath <> '' then WriteString('CompilerPath', Producer.CompilerPath)226 else DeleteValue('CompilerPath');227 end;228 end;229 if Assigned(Target) then WriteString('SelectedTarget', Target.SysName)230 else DeleteValue('SelectedTarget');231 finally232 Free;233 end;234 end;235 236 171 { TFormMain } 237 172 … … 239 174 begin 240 175 FormSourceCode.Save; 241 242 // Compile project file176 with Core do begin 177 // Compile project file 243 178 Compiler.Init; 244 179 … … 262 197 FormProject.TreeViewProjectChange(Self, FormProject.TreeViewProject.Selected); 263 198 FormMessages.Reload; 199 end; 264 200 end; 265 201 266 202 procedure TFormMain.AResetExecute(Sender: TObject); 267 203 begin 268 Co mpiler.Target.Executor.Reset;204 Core.Compiler.Target.Executor.Reset; 269 205 end; 270 206 … … 272 208 begin 273 209 ABuildExecute(Self); 274 Co mpiler.Target.Executor.Run;210 Core.Compiler.Target.Executor.Run; 275 211 end; 276 212 277 213 procedure TFormMain.ARunToCursorExecute(Sender: TObject); 278 214 begin 279 Co mpiler.Target.Executor.RunToCursor(0); // determine position215 Core.Compiler.Target.Executor.RunToCursor(0); // determine position 280 216 end; 281 217 282 218 procedure TFormMain.AStepInExecute(Sender: TObject); 283 219 begin 284 Co mpiler.Target.Executor.StepIn;220 Core.Compiler.Target.Executor.StepIn; 285 221 end; 286 222 287 223 procedure TFormMain.AStepOutExecute(Sender: TObject); 288 224 begin 289 Co mpiler.Target.Executor.StepOut;225 Core.Compiler.Target.Executor.StepOut; 290 226 end; 291 227 292 228 procedure TFormMain.AStepOverExecute(Sender: TObject); 293 229 begin 294 Co mpiler.Target.Executor.StepOver;230 Core.Compiler.Target.Executor.StepOver; 295 231 end; 296 232 297 233 procedure TFormMain.AStopExecute(Sender: TObject); 298 234 begin 299 Co mpiler.Target.Executor.Stop;235 Core.Compiler.Target.Executor.Stop; 300 236 end; 301 237 … … 340 276 F: TFileStream; 341 277 begin 342 FileName := ExtractFileDir( Project.FileName) + Name + '.pas';278 FileName := ExtractFileDir(Core.Project.FileName) + Name + '.pas'; 343 279 if FileExists(FileName) then 344 280 try … … 358 294 Title: string; 359 295 begin 296 with Core do begin 360 297 Title := ApplicationInfo.Name; 361 298 if Project.FileName <> '' then Title := Project.FileName + ' - ' + Title; … … 384 321 AStepOver.Enabled := AStepIn.Enabled; 385 322 ARunToCursor.Enabled := AStepIn.Enabled; 323 end; 386 324 387 325 UpdateMenu; … … 460 398 RootKey := Root; 461 399 OpenKey(Key, True); 462 ReopenLastOpenedFile := ReadBoolWithDefault('ReopenLastOpenedFile', True);463 Compiler.Target := Compiler.Targets.SearchBySysName(ReadStringWithDefault('TargetName', ''));464 LogParsing := ReadBoolWithDefault('LogParsing', False);465 if ValueExists('LanguageCode') then466 CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(ReadStringWithDefault('LanguageCode', ''))467 else CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode('');468 400 PageControlRight.Width := ReadIntegerWithDefault('RightPanelWidth', 120); 469 401 PageControlBottom.Height := ReadIntegerWithDefault('BottomPanelHeight', 100); … … 471 403 Free; 472 404 end; 473 LastOpenedFiles.LoadFromRegistry(RegistryRootKey, Key + '\LastOpenedFiles');474 Compiler.LoadFromRegistry(RegistryRootKey, Key + '\Compiler');475 405 end; 476 406 … … 481 411 RootKey := Root; 482 412 OpenKey(Key, True); 483 WriteBool('ReopenLastOpenedFile', ReopenLastOpenedFile);484 if Assigned(Compiler.Target) then485 WriteString('TargetName', Compiler.Target.SysName)486 else DeleteValue('TargetName');487 WriteBool('LogParsing', LogParsing);488 if Assigned(CoolTranslator1.Language) and (CoolTranslator1.Language.Code <> '') then489 WriteString('LanguageCode', CoolTranslator1.Language.Code)490 else DeleteValue('LanguageCode');491 413 WriteInteger('RightPanelWidth', PageControlRight.Width); 492 414 WriteInteger('BottomPanelHeight', PageControlBottom.Height); … … 494 416 Free; 495 417 end; 496 LastOpenedFiles.SaveToRegistry(RegistryRootKey, Key + '\LastOpenedFiles');497 Compiler.SaveToRegistry(RegistryRootKey, Key + '\Compiler');498 end;499 500 procedure TFormMain.ProjectOpen(FileName: string);501 begin502 Project.Active := True;503 Project.LoadFromFile(FileName);504 LastOpenedFiles.AddItem(FileName);505 UpdateInterface;506 418 end; 507 419 … … 509 421 begin 510 422 with TMenuItem(Sender) do begin 511 Co mpiler.Target := TTarget(Compiler.Targets[MenuIndex]);423 Core.Compiler.Target := TTarget(Core.Compiler.Targets[MenuIndex]); 512 424 UpdateInterface; 513 425 end; … … 520 432 begin 521 433 MenuItemProducer.Clear; 434 with Core do 522 435 for I := 0 to Compiler.Targets.Count - 1 do begin 523 436 NewMenuItem := TMenuItem.Create(MenuItemProducer); … … 541 454 begin 542 455 AProjectClose.Execute; 543 SaveToRegistry(RegistryRootKey, ApplicationInfo.RegistryKey);456 Core.SaveToRegistry(RegistryRootKey, ApplicationInfo.RegistryKey); 544 457 end; 545 458 … … 548 461 I: Integer; 549 462 begin 550 DeleteFile(DebugLog1.FileName);551 Compiler := TCustomCompiler.Create;552 Project := TProject.Create;553 ProjectTemplates := TProjectTemplateList.Create;554 TargetProject := TProject.Create;555 LastOpenedFiles := TLastOpenedList.Create(nil);556 LastOpenedFiles.OnChange := LastOpenedFilesChange;557 LastOpenedFiles.ClickAction := OpenRecentClick;558 463 end; 559 464 560 465 procedure TFormMain.FormDestroy(Sender: TObject); 561 466 begin 562 ProjectTemplates.Free;563 LastOpenedFiles.Free;564 TargetProject.Free;565 Project.Free;566 Compiler.Free;567 end;568 569 procedure TFormMain.ProjectTemplatesInit;570 begin571 ProjectTemplates.AddTemplate(TProjectTemplateConsoleApp.Create);572 ProjectTemplates.AddTemplate(TProjectTemplateGUIApp.Create);573 ProjectTemplates.AddTemplate(TProjectTemplatePackage.Create);574 ProjectTemplates.AddTemplate(TProjectTemplateUnit.Create);575 end;576 577 procedure TFormMain.CompilerDebugLog(Text: string);578 begin579 DebugLog1.Add('', Text);580 467 end; 581 468 … … 583 470 begin 584 471 if Sender is TMenuItem then 585 ProjectOpen(StringReplace(TMenuItem(Sender).Caption, '&', '', [rfReplaceAll])); 586 end; 587 588 procedure TFormMain.LastOpenedFilesChange(Sender: TObject); 589 begin 590 LastOpenedFiles.LoadToMenuItem(MenuItemOpenRecent); 472 Core.ProjectOpen(StringReplace(TMenuItem(Sender).Caption, '&', '', [rfReplaceAll])); 591 473 end; 592 474 … … 595 477 NewProjectFile: TProjectFile; 596 478 begin 597 LoadFromRegistry(RegistryRootKey, ApplicationInfo.RegistryKey);479 Core.LoadFromRegistry(RegistryRootKey, ApplicationInfo.RegistryKey); 598 480 DockInit; 599 ProjectTemplatesInit;600 601 if ReopenLastOpenedFile and (LastOpenedFiles.Items.Count > 0) then begin602 ProjectOpen(LastOpenedFiles.Items[0]);481 Core.ProjectTemplatesInit; 482 483 if Core.ReopenLastOpenedFile and (Core.LastOpenedFiles.Items.Count > 0) then begin 484 Core.ProjectOpen(Core.LastOpenedFiles.Items[0]); 603 485 end; 604 486 … … 614 496 begin 615 497 if OpenDialog1.Execute then begin 616 ProjectOpen(OpenDialog1.FileName);498 Core.ProjectOpen(OpenDialog1.FileName); 617 499 end; 618 500 end; … … 621 503 begin 622 504 //if Project.Modified then ; 623 Project.Active := False;505 Core.Project.Active := False; 624 506 UpdateInterface; 625 507 end; … … 642 524 procedure TFormMain.APauseExecute(Sender: TObject); 643 525 begin 644 Co mpiler.Target.Executor.Pause;526 Core.Compiler.Target.Executor.Pause; 645 527 end; 646 528 … … 651 533 if FormProjectNew.ShowModal = mrOk then begin 652 534 if Assigned(FormProjectNew.ListView1.Selected) then 653 TProjectTemplate(FormProjectNew.ListView1.Selected.Data).InitProject( Project);535 TProjectTemplate(FormProjectNew.ListView1.Selected.Data).InitProject(Core.Project); 654 536 end; 655 537 UpdateInterface; … … 659 541 begin 660 542 if SaveDialog1.Execute then begin 661 Project.Active := True;662 Project.SaveToFile(SaveDialog1.FileName);543 Core.Project.Active := True; 544 Core.Project.SaveToFile(SaveDialog1.FileName); 663 545 FormSourceCode.Save; 664 Project.Save;546 Core.Project.Save; 665 547 UpdateInterface; 666 LastOpenedFiles.AddItem(SaveDialog1.FileName);548 Core.LastOpenedFiles.AddItem(SaveDialog1.FileName); 667 549 end; 668 550 end; … … 671 553 begin 672 554 FormSourceCode.Save; 673 if not FileExistsUTF8( Project.FileName) then AProjectSaveAs.Execute674 else Project.SaveToFile(Project.FileName);555 if not FileExistsUTF8(Core.Project.FileName) then AProjectSaveAs.Execute 556 else Core.Project.SaveToFile(Core.Project.FileName); 675 557 end; 676 558 -
trunk/IDE/Forms/UFormMessages.pas
r47 r53 34 34 35 35 uses 36 U FormMain, UFormSourceCode;36 UCore, UFormMain, UFormSourceCode; 37 37 38 38 { TFormMessages } … … 52 52 procedure TFormMessages.ListView1Data(Sender: TObject; Item: TListItem); 53 53 begin 54 with FormMain, FormSourceCode do54 with Core, FormMain, FormSourceCode do 55 55 with TErrorMessage(Compiler.ErrorMessages[Item.Index]) do begin 56 56 Item.Caption := FileName; … … 67 67 P: TPoint; 68 68 begin 69 with FormMain, FormSourceCode do69 with Core, FormSourceCode do 70 70 if Assigned(ListView1.Selected) then 71 71 with TErrorMessage(ListView1.Selected.Data) do begin … … 81 81 procedure TFormMessages.Reload; 82 82 begin 83 ListView1.Items.Count := FormMain.Compiler.ErrorMessages.Count;83 ListView1.Items.Count := Core.Compiler.ErrorMessages.Count; 84 84 ListView1.Refresh; 85 85 end; -
trunk/IDE/Forms/UFormOptions.pas
r45 r53 34 34 35 35 uses 36 U FormMain, ULanguages;36 UCore, UFormMain, ULanguages; 37 37 38 38 { TFormOptions } … … 41 41 begin 42 42 if ComboBoxLanguage.ItemIndex <> -1 then 43 FormMain.CoolTranslator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);44 FormMain.ReopenLastOpenedFile := CheckBoxReopenProject.Checked;43 Core.CoolTranslator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]); 44 Core.ReopenLastOpenedFile := CheckBoxReopenProject.Checked; 45 45 end; 46 46 47 47 procedure TFormOptions.FormShow(Sender: TObject); 48 48 begin 49 FormMain.CoolTranslator1.LanguageListToStrings(ComboBoxLanguage.Items);50 ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject( FormMain.CoolTranslator1.Language);49 Core.CoolTranslator1.LanguageListToStrings(ComboBoxLanguage.Items); 50 ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.CoolTranslator1.Language); 51 51 if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0; 52 CheckBoxReopenProject.Checked := FormMain.ReopenLastOpenedFile;52 CheckBoxReopenProject.Checked := Core.ReopenLastOpenedFile; 53 53 end; 54 54 -
trunk/IDE/Forms/UFormProject.pas
r47 r53 29 29 30 30 uses 31 U FormMain, UFormSourceCode, UFormTargetCode, UFormCodeTree;31 UCore, UFormMain, UFormSourceCode, UFormTargetCode, UFormCodeTree; 32 32 33 33 { TFormProject } … … 71 71 NewNode: TTreeNode; 72 72 begin 73 with FormMain, TreeViewProject, Items do begin73 with Core, TreeViewProject, Items do begin 74 74 BeginUpdate; 75 75 Clear; -
trunk/IDE/Forms/UFormProjectNew.pas
r48 r53 35 35 36 36 uses 37 U FormMain, UProject;37 UCore, UFormMain, UProject; 38 38 39 39 {$R *.lfm} … … 66 66 ListView1.BeginUpdate; 67 67 ListView1.Items.Clear; 68 with FormMaindo68 with Core do 69 69 for I := 0 to ProjectTemplates.Count - 1 do 70 70 with TProjectTemplate(ProjectTemplates[I]) do begin -
trunk/IDE/Forms/UFormSourceCode.lfm
r45 r53 7 7 ClientHeight = 426 8 8 ClientWidth = 535 9 LCLVersion = ' 0.9.31'9 LCLVersion = '1.1' 10 10 inline SynEditSource: TSynEdit 11 11 Left = 0 -
trunk/IDE/Forms/UFormSourceCode.pas
r46 r53 32 32 33 33 uses 34 UFormMain ;34 UFormMain, UCore; 35 35 36 36 {$R *.lfm} … … 40 40 procedure TFormSourceCode.SynEditSourceChange(Sender: TObject); 41 41 begin 42 if FormMain.Project.Active then42 if Core.Project.Active then 43 43 ProjectFile.Modified := True; 44 44 end; … … 61 61 procedure TFormSourceCode.UpdateInterface; 62 62 begin 63 SynEditSource.Enabled := FormMain.Project.Active;64 if not FormMain.Project.Active then SynEditSource.ClearAll;63 SynEditSource.Enabled := Core.Project.Active; 64 if not Core.Project.Active then SynEditSource.ClearAll; 65 65 end; 66 66 -
trunk/IDE/Forms/UFormTargetCode.pas
r49 r53 35 35 36 36 uses 37 U FormMain;37 UCore; 38 38 39 39 procedure TFormTargetCode.SetProjectFile(AValue: TProjectFile); … … 48 48 procedure TFormTargetCode.UpdateInterface; 49 49 begin 50 SynEdit1.Enabled := FormMain.Project.Active;51 if not FormMain.Project.Active then SynEdit1.ClearAll;50 SynEdit1.Enabled := Core.Project.Active; 51 if not Core.Project.Active then SynEdit1.ClearAll; 52 52 end; 53 53 -
trunk/IDE/Forms/UFormTargetProject.lfm
r49 r53 7 7 ClientHeight = 240 8 8 ClientWidth = 320 9 LCLVersion = ' 0.9.31'9 LCLVersion = '1.1' 10 10 object TreeViewProject: TTreeView 11 11 Left = 0 … … 14 14 Width = 320 15 15 Align = alClient 16 DefaultItemHeight = 16 16 17 ReadOnly = True 17 18 TabOrder = 0 -
trunk/IDE/Forms/UFormTargetProject.pas
r49 r53 32 32 33 33 uses 34 U FormMain, UFormTargetCode;34 UCore, UFormMain, UFormTargetCode; 35 35 36 36 procedure TFormTargetProject.UpdateProjectTree; … … 38 38 NewNode: TTreeNode; 39 39 begin 40 with FormMain, TreeViewProject, Items do begin40 with Core, FormMain, TreeViewProject, Items do begin 41 41 BeginUpdate; 42 42 Clear; -
trunk/IDE/Forms/UFormTargets.pas
r45 r53 31 31 32 32 uses 33 U FormMain, UCompiler, UFormCompilerSettings, UProducer, UTarget;33 UCore, UFormMain, UCompiler, UFormCompilerSettings, UProducer, UTarget; 34 34 35 35 resourcestring … … 46 46 procedure TFormTargets.ListView1Data(Sender: TObject; Item: TListItem); 47 47 begin 48 if (Item.Index >= 0) and (Item.Index < FormMain.Compiler.Targets.Count) then49 with TTarget( FormMain.Compiler.Targets[Item.Index]) do begin48 if (Item.Index >= 0) and (Item.Index < Core.Compiler.Targets.Count) then 49 with TTarget(Core.Compiler.Targets[Item.Index]) do begin 50 50 Item.Caption := Name; 51 Item.Data := FormMain.Compiler.Targets[Item.Index];51 Item.Data := Core.Compiler.Targets[Item.Index]; 52 52 //Item.SubItems.Add(Producer.CompilerPath); 53 53 end; … … 66 66 procedure TFormTargets.ReloadList; 67 67 begin 68 ListView1.Items.Count := FormMain.Compiler.Targets.Count;68 ListView1.Items.Count := Core.Compiler.Targets.Count; 69 69 ListView1.Refresh; 70 70 end; -
trunk/IDE/Transpascal.lpi
r52 r53 106 106 </Item7> 107 107 </RequiredPackages> 108 <Units Count="1 7">108 <Units Count="18"> 109 109 <Unit0> 110 110 <Filename Value="Transpascal.lpr"/> … … 141 141 <IsPartOfProject Value="True"/> 142 142 <ComponentName Value="FormSourceCode"/> 143 <HasResources Value="True"/> 143 144 <ResourceBaseClass Value="Form"/> 144 145 <UnitName Value="UFormSourceCode"/> … … 221 222 <UnitName Value="UFormTargetProject"/> 222 223 </Unit16> 224 <Unit17> 225 <Filename Value="UCore.pas"/> 226 <IsPartOfProject Value="True"/> 227 <ComponentName Value="Core"/> 228 <HasResources Value="True"/> 229 <ResourceBaseClass Value="DataModule"/> 230 <UnitName Value="UCore"/> 231 </Unit17> 223 232 </Units> 224 233 </ProjectOptions> -
trunk/IDE/Transpascal.lpr
r49 r53 13 13 UFormTargetCode, UFormCodeTree, TemplateGenerics, CoolTranslator, Common, 14 14 UFormAbout, UFormOptions, UFormTargets, UFormCompilerSettings, 15 UFormProjectNew, UProjectTemplates, UFormTargetProject ;15 UFormProjectNew, UProjectTemplates, UFormTargetProject, UCore; 16 16 17 17 {$R *.res} … … 43 43 Application.CreateForm(TFormProjectNew, FormProjectNew); 44 44 Application.CreateForm(TFormTargetProject, FormTargetProject); 45 Application.CreateForm(TCore, Core); 45 46 Application.Run; 46 47 end. -
trunk/IDE/UApplicationInfo.pas
r52 r53 53 53 Name := 'Transpascal IDE'; 54 54 Identification := 1; 55 ReleaseDate := EncodeDate(2012, 6, 2 5);55 ReleaseDate := EncodeDate(2012, 6, 26); 56 56 MajorVersion := 0; 57 57 MinorVersion := 1;
Note:
See TracChangeset
for help on using the changeset viewer.