Changeset 54
- Timestamp:
- Jun 26, 2012, 7:41:11 AM (12 years ago)
- Location:
- trunk/IDE
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IDE/Forms/UFormMain.lfm
r53 r54 43 43 Top = 2 44 44 Action = AProjectOpen 45 DropdownMenu = PopupMenu1 46 Style = tbsDropDown 45 47 end 46 48 object ToolButton3: TToolButton 47 Left = 4749 Left = 59 48 50 Top = 2 49 51 Action = AProjectSave 50 52 end 51 53 object ToolButton4: TToolButton 52 Left = 7054 Left = 82 53 55 Top = 2 54 56 Action = AProjectClose 55 57 end 56 58 object ToolButton5: TToolButton 57 Left = 9359 Left = 105 58 60 Top = 2 59 61 Width = 10 … … 61 63 end 62 64 object ToolButton6: TToolButton 63 Left = 1 0365 Left = 115 64 66 Top = 2 65 67 Action = AViewOptions 66 68 end 67 69 object ToolButton7: TToolButton 68 Left = 1 2670 Left = 138 69 71 Top = 2 70 72 Action = ABuild 71 73 end 72 74 object ToolButton8: TToolButton 73 Left = 1 4975 Left = 161 74 76 Top = 2 75 77 Action = ARun 76 78 end 77 79 object ToolButton9: TToolButton 78 Left = 1 7280 Left = 184 79 81 Top = 2 80 82 Action = APause 81 83 end 82 84 object ToolButton10: TToolButton 83 Left = 19585 Left = 207 84 86 Top = 2 85 87 Action = AStop … … 869 871 end 870 872 object ImageList1: TImageList 871 left = 344872 top = 184873 left = 112 874 top = 272 873 875 Bitmap = { 874 876 4C690E0000001000000010000000000000000000000000000000000000000000 … … 1323 1325 } 1324 1326 end 1327 object PopupMenu1: TPopupMenu 1328 left = 196 1329 top = 54 1330 end 1325 1331 end -
trunk/IDE/Forms/UFormMain.pas
r53 r54 88 88 PageControlRight: TPageControl; 89 89 PageControlBottom: TPageControl; 90 PopupMenu1: TPopupMenu; 90 91 SaveDialog1: TSaveDialog; 91 92 Splitter1: TSplitter; … … 144 145 procedure DockInit; 145 146 procedure UpdateMenu; 146 procedure UpdateT oolbar;147 procedure UpdateTitle; 147 148 public 148 149 procedure LoadFromRegistry(Root: HKEY; Key: string); … … 290 291 291 292 procedure TFormMain.UpdateInterface; 292 var293 I: Integer;294 Title: string;295 293 begin 296 294 with Core do begin 297 Title := ApplicationInfo.Name; 298 if Project.FileName <> '' then Title := Project.FileName + ' - ' + Title; 299 if Project.Modified then Title := Title + ' *'; 300 Caption := Title; 301 AProjectClose.Enabled := Project.Active; 302 AProjectSave.Enabled := Project.Active and Project.Modified; 303 AProjectSaveAs.Enabled := Project.Active; 295 UpdateTitle; 296 AProjectClose.Enabled := Assigned(Project); 297 AProjectSave.Enabled := Assigned(Project) and Project.Modified; 298 AProjectSaveAs.Enabled := Assigned(Project); 304 299 (*AProgramRun.Enabled := Project.Active and (BrainFuckInterpreter.State = rsStopped); 305 300 AProgramPause.Enabled := Project.Active and (BrainFuckInterpreter.State = rsRunning); 306 301 AProgramStop.Enabled := Project.Active and (BrainFuckInterpreter.State <> rsStopped);*) 307 ABuild.Enabled := Project.Activeand Assigned(Compiler.Target) and302 ABuild.Enabled := Assigned(Project) and Assigned(Compiler.Target) and 308 303 Assigned(Compiler.Target.Producer); 309 APause.Enabled := Project.Activeand Assigned(Compiler.Target) and304 APause.Enabled := Assigned(Project) and Assigned(Compiler.Target) and 310 305 Assigned(Compiler.Target.Executor) and (Compiler.Target.Executor.State = rsRunning); 311 ARun.Enabled := Project.Activeand Assigned(Compiler.Target) and306 ARun.Enabled := Assigned(Project) and Assigned(Compiler.Target) and 312 307 Assigned(Compiler.Target.Executor) and ((Compiler.Target.Executor.State = rsStopped) or 313 308 (Compiler.Target.Executor.State = rsPaused)); 314 AStop.Enabled := Project.Activeand Assigned(Compiler.Target) and309 AStop.Enabled := Assigned(Project) and Assigned(Compiler.Target) and 315 310 Assigned(Compiler.Target.Executor) and ((Compiler.Target.Executor.State = rsRunning) or 316 311 (Compiler.Target.Executor.State = rsPaused)); 317 AStepIn.Enabled := Project.Activeand Assigned(Compiler.Target) and312 AStepIn.Enabled := Assigned(Project) and Assigned(Compiler.Target) and 318 313 Assigned(Compiler.Target.Executor) and ((Compiler.Target.Executor.State = rsRunning) or 319 314 (Compiler.Target.Executor.State = rsPaused)); … … 324 319 325 320 UpdateMenu; 326 UpdateToolbar;327 321 FormSourceCode.UpdateInterface; 328 322 FormTargetCode.UpdateInterface; … … 443 437 end; 444 438 445 procedure TFormMain.UpdateToolbar; 446 var 447 I: Integer; 448 begin 449 for I := 0 to ToolBar1.ButtonCount - 1 do 450 TToolButton(ToolBar1.Buttons[I]).Hint := TToolButton(ToolBar1.Buttons[I]).Caption; 439 procedure TFormMain.UpdateTitle; 440 var 441 Title: string; 442 begin 443 Title := ApplicationInfo.Name; 444 if Assigned(Core.Project) then begin 445 if Core.Project.FileName <> '' then Title := Core.Project.FileName + ' - ' + Title; 446 if Core.Project.Modified then Title := Title + ' *'; 447 end; 448 Caption := Title; 451 449 end; 452 450 … … 503 501 begin 504 502 //if Project.Modified then ; 505 Core.Project.Active := False;503 FreeAndNil(Core.Project); 506 504 UpdateInterface; 507 505 end; … … 532 530 begin 533 531 if FormProjectNew.ShowModal = mrOk then begin 534 if Assigned(FormProjectNew.ListView1.Selected) then 532 if Assigned(FormProjectNew.ListView1.Selected) then begin 533 Core.ProjectNew; 535 534 TProjectTemplate(FormProjectNew.ListView1.Selected.Data).InitProject(Core.Project); 535 end; 536 536 end; 537 537 UpdateInterface; … … 540 540 procedure TFormMain.AProjectSaveAsExecute(Sender: TObject); 541 541 begin 542 if Assigned(Core.Project) then 542 543 if SaveDialog1.Execute then begin 543 Core.Project.Active := True;544 544 Core.Project.SaveToFile(SaveDialog1.FileName); 545 545 FormSourceCode.Save; -
trunk/IDE/Forms/UFormProject.pas
r53 r54 74 74 BeginUpdate; 75 75 Clear; 76 if Project.Activethen begin76 if Assigned(Project) then begin 77 77 NewNode := AddChild(nil, ExtractFileNameOnly(Project.FileName)); 78 78 UpdateProjectFiles(NewNode, Project.Files); -
trunk/IDE/Forms/UFormSourceCode.pas
r53 r54 40 40 procedure TFormSourceCode.SynEditSourceChange(Sender: TObject); 41 41 begin 42 if Core.Project.Activethen42 if Assigned(Core.Project) then 43 43 ProjectFile.Modified := True; 44 44 end; … … 61 61 procedure TFormSourceCode.UpdateInterface; 62 62 begin 63 SynEditSource.Enabled := Core.Project.Active;64 if not Core.Project.Activethen SynEditSource.ClearAll;63 SynEditSource.Enabled := Assigned(Core.Project); 64 if not Assigned(Core.Project) then SynEditSource.ClearAll; 65 65 end; 66 66 -
trunk/IDE/Forms/UFormTargetCode.pas
r53 r54 48 48 procedure TFormTargetCode.UpdateInterface; 49 49 begin 50 SynEdit1.Enabled := Core.Project.Active;51 if not Core.Project.Activethen SynEdit1.ClearAll;50 SynEdit1.Enabled := Assigned(Core.Project); 51 if not Assigned(Core.Project) then SynEdit1.ClearAll; 52 52 end; 53 53 -
trunk/IDE/Forms/UFormTargetProject.pas
r53 r54 41 41 BeginUpdate; 42 42 Clear; 43 if Project.Activethen begin43 if Assigned(Project) then begin 44 44 NewNode := AddChild(nil, ExtractFileNameOnly(TargetProject.FileName)); 45 45 UpdateProjectFiles(NewNode, TargetProject.Files); -
trunk/IDE/UCore.pas
r53 r54 36 36 procedure ProjectTemplatesInit; 37 37 procedure ProjectOpen(FileName: string); 38 procedure ProjectNew; 38 39 procedure CompilerDebugLog(Text: string); 39 40 procedure LoadFromRegistry(Root: HKEY; Key: string); … … 55 56 procedure TCore.ProjectOpen(FileName: string); 56 57 begin 57 Project .Active := True;58 ProjectNew; 58 59 Project.LoadFromFile(FileName); 59 60 LastOpenedFiles.AddItem(FileName); 60 61 FormMain.UpdateInterface; 62 end; 63 64 procedure TCore.ProjectNew; 65 begin 66 if Assigned(Project) then FreeAndNil(Project); 67 Project := TProject.Create; 68 Project.FileName := SNewProject; 61 69 end; 62 70 … … 97 105 begin 98 106 LastOpenedFiles.LoadToMenuItem(FormMain.MenuItemOpenRecent, 107 FormMain.OpenRecentClick); 108 LastOpenedFiles.LoadToMenuItem(FormMain.PopupMenu1.Items, 99 109 FormMain.OpenRecentClick); 100 110 end; -
trunk/IDE/UProject.pas
r51 r54 75 75 FActive: Boolean; 76 76 FModified: Boolean; 77 function GetActive: Boolean; 78 procedure SetActive(AValue: Boolean); 77 FOnChange: TNotifyEvent; 79 78 procedure SetModified(AValue: Boolean); 80 79 public … … 91 90 constructor Create; 92 91 destructor Destroy; override; 93 property Active: Boolean read GetActive write SetActive;94 92 property Modified: Boolean read FModified write SetModified; 93 property OnChange: TNotifyEvent read FOnChange write FOnChange; 95 94 end; 96 95 … … 100 99 Name: string; 101 100 Description: TStringList; 102 procedure InitProject( Project: TProject); virtual;101 procedure InitProject(var Project: TProject); virtual; 103 102 constructor Create; virtual; 104 103 destructor Destroy; override; … … 111 110 end; 112 111 113 114 implementation115 116 112 resourcestring 117 113 SNewProject = 'New project'; 118 114 115 implementation 116 119 117 { TProjectTemplateList } 120 118 … … 126 124 { TProjectTemplate } 127 125 128 procedure TProjectTemplate.InitProject(Project: TProject); 129 begin 130 Project.Active := False; 131 Project.Active := True; 126 procedure TProjectTemplate.InitProject(var Project: TProject); 127 begin 132 128 Project.FileName := SNewProject; 133 129 end; … … 319 315 { TProject } 320 316 321 function TProject.GetActive: Boolean;322 begin323 Result := FActive;324 end;325 326 procedure TProject.SetActive(AValue: Boolean);327 begin328 if FActive = AValue then Exit;329 FActive := AValue;330 if not FActive then Clear;331 end;332 333 317 procedure TProject.SetModified(AValue: Boolean); 334 318 begin -
trunk/IDE/UProjectTemplates.pas
r51 r54 14 14 TProjectTemplateConsoleApp = class(TProjectTemplate) 15 15 constructor Create; override; 16 procedure InitProject( Project: TProject); override;16 procedure InitProject(var Project: TProject); override; 17 17 end; 18 18 … … 21 21 TProjectTemplateGUIApp = class(TProjectTemplate) 22 22 constructor Create; override; 23 procedure InitProject( Project: TProject); override;23 procedure InitProject(var Project: TProject); override; 24 24 end; 25 25 … … 28 28 TProjectTemplatePackage = class(TProjectTemplate) 29 29 constructor Create; override; 30 procedure InitProject( Project: TProject); override;30 procedure InitProject(var Project: TProject); override; 31 31 end; 32 32 … … 35 35 TProjectTemplateUnit = class(TProjectTemplate) 36 36 constructor Create; override; 37 procedure InitProject( Project: TProject); override;37 procedure InitProject(var Project: TProject); override; 38 38 end; 39 39 … … 49 49 end; 50 50 51 procedure TProjectTemplateUnit.InitProject( Project: TProject);51 procedure TProjectTemplateUnit.InitProject(var Project: TProject); 52 52 var 53 53 NewFile: TProjectFile; … … 75 75 end; 76 76 77 procedure TProjectTemplatePackage.InitProject( Project: TProject);77 procedure TProjectTemplatePackage.InitProject(var Project: TProject); 78 78 var 79 79 NewFile: TProjectFile; … … 100 100 end; 101 101 102 procedure TProjectTemplateGUIApp.InitProject( Project: TProject);102 procedure TProjectTemplateGUIApp.InitProject(var Project: TProject); 103 103 var 104 104 NewFile: TProjectFile; … … 131 131 end; 132 132 133 procedure TProjectTemplateConsoleApp.InitProject( Project: TProject);133 procedure TProjectTemplateConsoleApp.InitProject(var Project: TProject); 134 134 var 135 135 NewFile: TProjectFile;
Note:
See TracChangeset
for help on using the changeset viewer.