Ignore:
Timestamp:
Feb 19, 2012, 2:13:49 PM (13 years ago)
Author:
chronos
Message:
  • Modified: Text message handling moved to UTarget unit as field of TTarget.
  • Modified: Messages are displayed as TListVIew rather then TMemo.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.pas

    r39 r40  
    169169    procedure AProjectOpenRecentExecute(Sender: TObject);
    170170    procedure TargetStateChanged(Sender: TObject);
     171    procedure MessagesChanged(Sender: TObject);
    171172    procedure MenuItemTargetClick(Sender: TObject);
    172173    procedure ProjectOpen(FileName: string);
     
    191192  MainForm: TMainForm;
    192193
     194
    193195implementation
    194196
     
    204206  SNumberGeneration = 'Number generation';
    205207  SProgramExited = 'Program exited';
     208  SProgramStarted = 'Program started';
     209  SProgramStopped = 'Program stopped';
     210  SNewProject = 'New project';
    206211
    207212{ TMainForm }
     
    259264  if CurrentTarget.State = rsPaused then
    260265    AProgramShowExecutionPoint.Execute;
     266  if CurrentTarget.State = rsStopped then CurrentTarget.Messages.AddMessage(SProgramStopped);
     267end;
     268
     269procedure TMainForm.MessagesChanged(Sender: TObject);
     270begin
     271  FormMessages.Reload;
    261272end;
    262273
     
    275286procedure TMainForm.ProjectOpen(FileName: string);
    276287begin
     288  AProjectClose.Execute;
    277289  MemoSource.Lines.LoadFromFile(UTF8Decode(FileName));
    278290  LastOpenedList.AddItem(FileName);
     
    292304    TTarget(Targets[I]).OnChangeState := nil;
    293305  FCurrentTarget.OnChangeState := TargetStateChanged;
     306  FCurrentTarget.Messages.OnChange := MessagesChanged;
    294307  UpdateInterface;
    295308end;
     
    317330  FormMemory.Align := alClient;
    318331  FormMemory.Show;
    319   FormMesssages.ManualDock(TabSheetMessages, nil, alClient);
    320   FormMesssages.Align := alClient;
    321   FormMesssages.Show;
     332  FormMessages.ManualDock(TabSheetMessages, nil, alClient);
     333  FormMessages.Align := alClient;
     334  FormMessages.Show;
    322335  PageControlRight.Width := MainForm.Width div 2;
    323336  PageControlBottom.Height := MainForm.Height div 5;
     
    444457  if not CurrentTarget.Compiled then AProgramCompile.Execute;
    445458  CurrentTarget.Run;
     459  CurrentTarget.Messages.AddMessage(SProgramStarted);
    446460end;
    447461
     
    560574begin
    561575  with CurrentTarget do begin
    562     Stop;
     576    AProgramStop.Execute;
    563577    Optimization := coNormal;
    564578    SourceCode := MemoSource.Text;
    565579    ProgramName := ExtractFileNameOnly(ProjectFileName);
     580    CurrentTarget.Messages.AddMessage('Compiling...');
    566581    Compile;
     582    CurrentTarget.Messages.AppendMessage('done');
    567583    MemoTarget.Text := TargetCode;
    568584    UpdateInterface;
     
    645661procedure TMainForm.AProjectCloseExecute(Sender: TObject);
    646662begin
     663  AProgramStop.Execute;
    647664  Modified := False;
    648665  ProjectFileName := '';
     
    653670procedure TMainForm.AProjectNewExecute(Sender: TObject);
    654671begin
    655   ProjectFileName := 'Examples' + DirectorySeparator + 'Project.b';
     672  AProjectClose.Execute;
     673  ProjectFileName := 'Examples' + DirectorySeparator + SNewProject + '.b';
    656674  MemoSource.Clear;
    657675  Modified := False;
Note: See TracChangeset for help on using the changeset viewer.