Ignore:
Timestamp:
Feb 14, 2012, 7:33:51 AM (13 years ago)
Author:
chronos
Message:
  • Added: Form containing list of supported compiler producers. Path to real compiler can be changed.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/IDE/Forms/UMainForm.pas

    r36 r37  
    1717
    1818type
     19
     20  { TCustomCompiler }
     21
     22  TCustomCompiler = class(TCompiler)
     23    procedure LoadFromRegistry(Root: HKEY; Key: string);
     24    procedure SaveToRegistry(Root: HKEY; Key: string);
     25  end;
     26
    1927  { TMainForm }
    2028
    2129  TMainForm = class(TForm)
    2230    ABuild: TAction;
     31    AViewProducers: TAction;
    2332    AViewCompiledSoruce: TAction;
    2433    AViewCodeTree: TAction;
     
    5867    MenuItem22: TMenuItem;
    5968    MenuItem23: TMenuItem;
     69    MenuItem24: TMenuItem;
    6070    MenuItemAnalyzer: TMenuItem;
    6171    MenuItemProducer: TMenuItem;
     
    102112    procedure AViewMessagesExecute(Sender: TObject);
    103113    procedure AViewOptionsExecute(Sender: TObject);
     114    procedure AViewProducersExecute(Sender: TObject);
    104115    procedure AViewProjectExecute(Sender: TObject);
    105116    procedure AViewSourceEditorExecute(Sender: TObject);
     
    127138    LogParsing: Boolean;
    128139    Project: TProject;
    129     Compiler: TCompiler;
     140    Compiler: TCustomCompiler;
    130141    function GetSource(Name: string; var SourceCode: string): Boolean;
    131142    procedure UpdateInterface;
     
    141152
    142153uses
    143   UMessagesForm, UCodeForm, UProjectManager, UCommon, UAboutForm, UFormOptions;
     154  UMessagesForm, UCodeForm, UProjectManager, UCommon, UAboutForm, UFormOptions,
     155  UCompilersForm;
    144156
    145157resourcestring
    146158  SNewProject = 'New project';
     159
     160{ TCustomCompiler }
     161
     162procedure TCustomCompiler.LoadFromRegistry(Root: HKEY; Key: string);
     163var
     164  I: Integer;
     165begin
     166  with TRegistryEx.Create do
     167    try
     168      RootKey := Root;
     169      for I := 0 to Producers.Count - 1 do
     170      with TProducer(Producers[I]) do begin
     171        OpenKey(Key + '\Producers\' + Name, True);
     172        CompilerPAth := ReadStringWithDefault('CompilerPath', CompilerPath);
     173      end;
     174    finally
     175      Free;
     176    end;
     177end;
     178
     179procedure TCustomCompiler.SaveToRegistry(Root: HKEY; Key: string);
     180var
     181  I: Integer;
     182begin
     183  with TRegistryEx.Create do
     184    try
     185      RootKey := Root;
     186      for I := 0 to Producers.Count - 1 do
     187      with TProducer(Producers[I]) do begin
     188        OpenKey(Key + '\Producers\' + Name, True);
     189        WriteString('CompilerPath', CompilerPath);
     190      end;
     191    finally
     192      Free;
     193    end;
     194end;
    147195
    148196{ TMainForm }
     
    189237begin
    190238  FormOptions.ShowModal;
     239end;
     240
     241procedure TMainForm.AViewProducersExecute(Sender: TObject);
     242begin
     243  FormProducers.Show;
    191244end;
    192245
     
    234287  AProgramPause.Enabled := Project.Active and (BrainFuckInterpreter.State = rsRunning);
    235288  AProgramStop.Enabled := Project.Active and (BrainFuckInterpreter.State <> rsStopped);*)
     289  ABuild.Enabled := Project.Active;
    236290  UpdateMenu;
    237291  CodeForm.UpdateInterface;
     
    259313  CompiledForm.Align := alClient;
    260314  CompiledForm.Show;
     315  PageControlRight.TabIndex := 0;
     316  PageControlBottom.TabIndex := 0;
    261317
    262318  (*ProjectManager.ManualDock(DockPanel, nil, alLeft);
     
    311367      Free;
    312368    end;
    313   LastOpenedFiles.LoadFromRegistry(RegistryRootKey, Key);
     369  LastOpenedFiles.LoadFromRegistry(RegistryRootKey, Key + '\LastOpenedFiles');
     370  Compiler.LoadFromRegistry(RegistryRootKey, Key + '\Compiler');
    314371end;
    315372
     
    330387      Free;
    331388    end;
    332   LastOpenedFiles.SaveToRegistry(RegistryRootKey, Key);
     389  LastOpenedFiles.SaveToRegistry(RegistryRootKey, Key + '\LastOpenedFiles');
    333390  LastOpenedFiles.ReloadMenu;
     391  Compiler.SaveToRegistry(RegistryRootKey, Key + '\Compiler');
    334392end;
    335393
    336394procedure TMainForm.ProjectOpen(FileName: string);
    337395begin
     396  Project.Active := True;
    338397  Project.LoadFromFile(FileName);
    339398  LastOpenedFiles.AddItem(FileName);
    340399  LastOpenedFiles.ReloadMenu;
    341   ProjectManager.UpdateProjectTree;
    342400  UpdateInterface;
    343401end;
     
    393451begin
    394452  DeleteFile(DebugLog1.FileName);
    395   Compiler := TCompiler.Create;
     453  Compiler := TCustomCompiler.Create;
    396454  Project := TProject.Create;
    397455  LastOpenedFiles := TLastOpenedList.Create;
Note: See TracChangeset for help on using the changeset viewer.