Changeset 40 for trunk/Forms
- Timestamp:
- Feb 19, 2012, 2:13:49 PM (13 years ago)
- Location:
- trunk/Forms
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.pas
r39 r40 169 169 procedure AProjectOpenRecentExecute(Sender: TObject); 170 170 procedure TargetStateChanged(Sender: TObject); 171 procedure MessagesChanged(Sender: TObject); 171 172 procedure MenuItemTargetClick(Sender: TObject); 172 173 procedure ProjectOpen(FileName: string); … … 191 192 MainForm: TMainForm; 192 193 194 193 195 implementation 194 196 … … 204 206 SNumberGeneration = 'Number generation'; 205 207 SProgramExited = 'Program exited'; 208 SProgramStarted = 'Program started'; 209 SProgramStopped = 'Program stopped'; 210 SNewProject = 'New project'; 206 211 207 212 { TMainForm } … … 259 264 if CurrentTarget.State = rsPaused then 260 265 AProgramShowExecutionPoint.Execute; 266 if CurrentTarget.State = rsStopped then CurrentTarget.Messages.AddMessage(SProgramStopped); 267 end; 268 269 procedure TMainForm.MessagesChanged(Sender: TObject); 270 begin 271 FormMessages.Reload; 261 272 end; 262 273 … … 275 286 procedure TMainForm.ProjectOpen(FileName: string); 276 287 begin 288 AProjectClose.Execute; 277 289 MemoSource.Lines.LoadFromFile(UTF8Decode(FileName)); 278 290 LastOpenedList.AddItem(FileName); … … 292 304 TTarget(Targets[I]).OnChangeState := nil; 293 305 FCurrentTarget.OnChangeState := TargetStateChanged; 306 FCurrentTarget.Messages.OnChange := MessagesChanged; 294 307 UpdateInterface; 295 308 end; … … 317 330 FormMemory.Align := alClient; 318 331 FormMemory.Show; 319 FormMess sages.ManualDock(TabSheetMessages, nil, alClient);320 FormMess sages.Align := alClient;321 FormMess sages.Show;332 FormMessages.ManualDock(TabSheetMessages, nil, alClient); 333 FormMessages.Align := alClient; 334 FormMessages.Show; 322 335 PageControlRight.Width := MainForm.Width div 2; 323 336 PageControlBottom.Height := MainForm.Height div 5; … … 444 457 if not CurrentTarget.Compiled then AProgramCompile.Execute; 445 458 CurrentTarget.Run; 459 CurrentTarget.Messages.AddMessage(SProgramStarted); 446 460 end; 447 461 … … 560 574 begin 561 575 with CurrentTarget do begin 562 Stop;576 AProgramStop.Execute; 563 577 Optimization := coNormal; 564 578 SourceCode := MemoSource.Text; 565 579 ProgramName := ExtractFileNameOnly(ProjectFileName); 580 CurrentTarget.Messages.AddMessage('Compiling...'); 566 581 Compile; 582 CurrentTarget.Messages.AppendMessage('done'); 567 583 MemoTarget.Text := TargetCode; 568 584 UpdateInterface; … … 645 661 procedure TMainForm.AProjectCloseExecute(Sender: TObject); 646 662 begin 663 AProgramStop.Execute; 647 664 Modified := False; 648 665 ProjectFileName := ''; … … 653 670 procedure TMainForm.AProjectNewExecute(Sender: TObject); 654 671 begin 655 ProjectFileName := 'Examples' + DirectorySeparator + 'Project.b'; 672 AProjectClose.Execute; 673 ProjectFileName := 'Examples' + DirectorySeparator + SNewProject + '.b'; 656 674 MemoSource.Clear; 657 675 Modified := False; -
trunk/Forms/UFormMessages.lfm
r39 r40 1 object FormMess sages: TFormMesssages1 object FormMessages: TFormMessages 2 2 Left = 256 3 Height = 2 404 Top = 325 Width = 3203 Height = 225 4 Top = 47 5 Width = 492 6 6 Caption = 'Messages' 7 ClientHeight = 240 8 ClientWidth = 320 7 ClientHeight = 225 8 ClientWidth = 492 9 OnCreate = FormCreate 9 10 LCLVersion = '0.9.31' 10 object MemoMessages: TMemo11 object ListView1: TListView 11 12 Left = 0 12 Height = 2 4013 Height = 225 13 14 Top = 0 14 Width = 32015 Width = 492 15 16 Align = alClient 17 Columns = < 18 item 19 Width = 473 20 end> 21 OwnerData = True 22 ReadOnly = True 23 RowSelect = True 24 ShowColumnHeaders = False 16 25 TabOrder = 0 26 ViewStyle = vsReport 27 OnData = ListView1Data 17 28 end 18 29 end -
trunk/Forms/UFormMessages.lrt
r39 r40 1 TFORMMESS SAGES.CAPTION=Messages1 TFORMMESSAGES.CAPTION=Messages -
trunk/Forms/UFormMessages.pas
r38 r40 6 6 7 7 uses 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls; 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 ComCtrls; 9 10 10 11 type 11 12 12 { TFormMess sages }13 { TFormMessages } 13 14 14 TFormMesssages = class(TForm) 15 MemoMessages: TMemo; 15 TFormMessages = class(TForm) 16 ListView1: TListView; 17 procedure FormCreate(Sender: TObject); 18 procedure ListView1Data(Sender: TObject; Item: TListItem); 16 19 private 17 20 { private declarations } 18 21 public 19 { public declarations }22 procedure Reload; 20 23 end; 21 24 22 25 var 23 FormMess sages: TFormMesssages;26 FormMessages: TFormMessages; 24 27 25 28 implementation … … 27 30 {$R *.lfm} 28 31 32 uses 33 UFormMain, UTarget; 34 35 { TFormMessages } 36 37 procedure TFormMessages.ListView1Data(Sender: TObject; Item: TListItem); 38 begin 39 with MainForm.CurrentTarget do 40 if (Item.Index >= 0) and (Item.Index < Messages.Count) then 41 with TMessage(Messages[Item.Index]) do begin 42 Item.Caption := Text; 43 Item.Data := Messages[Item.Index]; 44 end; 45 end; 46 47 procedure TFormMessages.FormCreate(Sender: TObject); 48 begin 49 50 end; 51 52 procedure TFormMessages.Reload; 53 begin 54 ListView1.Items.Count := MainForm.CurrentTarget.Messages.Count; 55 ListView1.Refresh; 56 end; 57 29 58 end. 30 59
Note:
See TracChangeset
for help on using the changeset viewer.