Changeset 65 for trunk/IDE/Forms/UFormMain.pas
- Timestamp:
- Jul 18, 2012, 10:57:48 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IDE/Forms/UFormMain.pas
r62 r65 7 7 uses 8 8 SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, 9 Registry,ComCtrls, ExtCtrls, SynEdit, SynHighlighterPas,9 ComCtrls, ExtCtrls, SynEdit, SynHighlighterPas, 10 10 UProject, FileUtil, Menus, ActnList, 11 UFormTargetCode, UFormCodeTree, U Registry, UApplicationInfo;11 UFormTargetCode, UFormCodeTree, UGeneralRegistry, UApplicationInfo; 12 12 13 13 type … … 81 81 MenuItem9: TMenuItem; 82 82 MenuItemOpenRecent: TMenuItem; 83 OpenDialog 1: TOpenDialog;83 OpenDialogProject: TOpenDialog; 84 84 PageControlMain: TPageControl; 85 85 PageControlRight: TPageControl; 86 86 PageControlBottom: TPageControl; 87 87 PopupMenu1: TPopupMenu; 88 SaveDialog 1: TSaveDialog;88 SaveDialogProject: TSaveDialog; 89 89 Splitter1: TSplitter; 90 90 Splitter2: TSplitter; … … 146 146 procedure ProducerProcessOutput(Text: string); 147 147 public 148 procedure LoadFromRegistry(Root: HKEY; Key: string);149 procedure SaveToRegistry(Root: HKEY; Key: string);148 procedure LoadFromRegistry(Root: Integer; Key: string); 149 procedure SaveToRegistry(Root: Integer; Key: string); 150 150 procedure OpenRecentClick(Sender: TObject); 151 151 function GetSource(Name: string; var SourceCode: string): Boolean; … … 397 397 end; 398 398 399 procedure TFormMain.LoadFromRegistry(Root: HKEY; Key: string);400 begin 401 with T RegistryEx.Createdo399 procedure TFormMain.LoadFromRegistry(Root: Integer; Key: string); 400 begin 401 with TGeneralRegistry.Create(nil) do 402 402 try 403 RootKey:= Root;403 CurrentRoot := Root; 404 404 OpenKey(Key, True); 405 PageControlRight.Width := ReadIntegerWithDefault('RightPanelWidth', 120); 406 PageControlBottom.Height := ReadIntegerWithDefault('BottomPanelHeight', 100); 405 if ValueExists('RightPanelWidth') then 406 PageControlRight.Width := ReadInteger('RightPanelWidth') 407 else PageControlRight.Width := 150; 408 if ValueExists('BottomPanelHeight') then 409 PageControlBottom.Height := ReadInteger('BottomPanelHeight') 410 else PageControlBottom.Height := 100; 407 411 finally 408 412 Free; … … 410 414 end; 411 415 412 procedure TFormMain.SaveToRegistry(Root: HKEY; Key: string);413 begin 414 with T RegistryEx.Createdo416 procedure TFormMain.SaveToRegistry(Root: Integer; Key: string); 417 begin 418 with TGeneralRegistry.Create(nil) do 415 419 try 416 RootKey:= Root;420 CurrentRoot := Root; 417 421 OpenKey(Key, True); 418 422 WriteInteger('RightPanelWidth', PageControlRight.Width); … … 468 472 begin 469 473 AProjectClose.Execute; 470 Core.SaveToRegistry( HKEY(Core.ApplicationInfo.RegistryRoot), Core.ApplicationInfo.RegistryKey);474 Core.SaveToRegistry(Integer(Core.ApplicationInfo.RegistryRoot), Core.ApplicationInfo.RegistryKey); 471 475 end; 472 476 … … 494 498 procedure TFormMain.FormShow(Sender: TObject); 495 499 begin 496 Core.LoadFromRegistry( HKEY(Core.ApplicationInfo.RegistryRoot), Core.ApplicationInfo.RegistryKey);500 Core.LoadFromRegistry(Integer(Core.ApplicationInfo.RegistryRoot), Core.ApplicationInfo.RegistryKey); 497 501 DockInit; 498 502 Core.ProjectTemplatesInit; … … 503 507 504 508 WindowState := wsMaximized; 509 UpdateInterface; 505 510 end; 506 511 507 512 procedure TFormMain.AProjectOpenExecute(Sender: TObject); 508 513 begin 509 if OpenDialog1.Execute then begin 510 Core.ProjectOpen(OpenDialog1.FileName); 514 if Core.LastOpenedFiles.Items.Count > 0 then 515 OpenDialogProject.FileName := Core.LastOpenedFiles.Items[0] 516 else OpenDialogProject.FileName := ExtractFileDir(Application.ExeName); 517 if OpenDialogProject.Execute then begin 518 Core.ProjectOpen(OpenDialogProject.FileName); 511 519 end; 512 520 end; … … 555 563 procedure TFormMain.AProjectSaveAsExecute(Sender: TObject); 556 564 begin 565 if Core.LastOpenedFiles.Items.Count > 0 then 566 SaveDialogProject.FileName := Core.LastOpenedFiles.Items[0] 567 else SaveDialogProject.FileName := ExtractFileDir(Application.ExeName); 557 568 if Assigned(Core.Project) then 558 if SaveDialog 1.Execute then begin559 Core.Project.SaveToFile(SaveDialog 1.FileName);569 if SaveDialogProject.Execute then begin 570 Core.Project.SaveToFile(SaveDialogProject.FileName); 560 571 FormSourceCode.Save; 561 572 Core.Project.Save; 562 573 UpdateInterface; 563 Core.LastOpenedFiles.AddItem(SaveDialog 1.FileName);574 Core.LastOpenedFiles.AddItem(SaveDialogProject.FileName); 564 575 end; 565 576 end;
Note:
See TracChangeset
for help on using the changeset viewer.