Ignore:
Timestamp:
Mar 4, 2012, 9:43:53 AM (13 years ago)
Author:
chronos
Message:
  • Fixed: Selection of target.
File:
1 edited

Legend:

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

    r43 r44  
    143143    LastOpenedFiles: TLastOpenedList;
    144144    procedure CompilerDebugLog(Text: string);
    145     procedure MenuItemAnalyzerClick(Sender: TObject);
    146     procedure MenuItemProducerClick(Sender: TObject);
     145    procedure MenuItemTargetClick(Sender: TObject);
    147146    procedure OpenRecentClick(Sender: TObject);
    148147    procedure DockInit;
     
    152151    procedure UpdateMenu;
    153152  public
    154     SelectedAnalyzerIndex: Integer;
    155     SelectedProducerIndex: Integer;
    156153    ReopenLastOpenedFile: Boolean;
    157154    LogParsing: Boolean;
     
    315312  AProgramPause.Enabled := Project.Active and (BrainFuckInterpreter.State = rsRunning);
    316313  AProgramStop.Enabled := Project.Active and (BrainFuckInterpreter.State <> rsStopped);*)
    317   ABuild.Enabled := Project.Active;
     314  ABuild.Enabled := Project.Active and Assigned(Compiler.Target) and
     315    Assigned(Compiler.Target.Producer);
    318316  UpdateMenu;
    319317  CodeForm.UpdateInterface;
     
    401399      OpenKey(Key, True);
    402400      ReopenLastOpenedFile := ReadBoolWithDefault('ReopenLastOpenedFile', True);
    403       SelectedProducerIndex := ReadIntegerWithDefault('ProducerType', 0);
    404       SelectedAnalyzerIndex := ReadIntegerWithDefault('AnalyzerType', 0);
     401      Compiler.Target := Compiler.Targets.SearchBySysName(ReadStringWithDefault('TargetName', ''));
    405402      LogParsing := ReadBoolWithDefault('LogParsing', False);
    406403      if ValueExists('LanguageCode') then
     
    423420      OpenKey(Key, True);
    424421      WriteBool('ReopenLastOpenedFile', ReopenLastOpenedFile);
    425       WriteInteger('ProducerType', SelectedProducerIndex);
    426       WriteInteger('AnalyzerType', SelectedAnalyzerIndex);
     422      if Assigned(Compiler.Target) then
     423        WriteString('TargetName', Compiler.Target.SysName)
     424        else DeleteValue('TargetName');
    427425      WriteBool('LogParsing', LogParsing);
    428426      if Assigned(CoolTranslator1.Language) and (CoolTranslator1.Language.Code <> '') then
     
    448446end;
    449447
    450 procedure TMainForm.MenuItemAnalyzerClick(Sender: TObject);
     448procedure TMainForm.MenuItemTargetClick(Sender: TObject);
    451449begin
    452450  with TMenuItem(Sender) do begin
    453     SelectedAnalyzerIndex := MenuIndex;
    454     UpdateMenu;
    455   end;
    456 end;
    457 
    458 procedure TMainForm.MenuItemProducerClick(Sender: TObject);
    459 begin
    460   with TMenuItem(Sender) do begin
    461     SelectedProducerIndex := MenuIndex;
    462     UpdateMenu;
     451    Compiler.Target := TTarget(Compiler.Targets[MenuIndex]);
     452    UpdateInterface;
    463453  end;
    464454end;
     
    473463    NewMenuItem := TMenuItem.Create(MenuItemProducer);
    474464    NewMenuItem.Caption := TTarget(Compiler.Targets[I]).Name;
    475     NewMenuItem.OnClick := MenuItemProducerClick;
    476     if I = SelectedProducerIndex then NewMenuItem.Checked := True;
     465    NewMenuItem.OnClick := MenuItemTargetClick;
     466    if Assigned(Compiler.Target) and
     467      (TTarget(Compiler.Targets[I]).SysName = Compiler.Target.SysName) then NewMenuItem.Checked := True;
    477468    MenuItemProducer.Add(NewMenuItem);
    478469  end;
Note: See TracChangeset for help on using the changeset viewer.