Changeset 67 for trunk/Forms
- Timestamp:
- Jan 17, 2015, 4:08:03 PM (10 years ago)
- Location:
- trunk/Forms
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormCPU.pas
r52 r67 34 34 35 35 uses 36 U FormMain, UTargetInterpretter;36 UCore, UTargetInterpretter; 37 37 38 38 {$R *.lfm} … … 45 45 procedure TFormCPU.Reload; 46 46 begin 47 if MainForm.CurrentTarget is TTargetInterpretter then48 with TTargetInterpretter( MainForm.CurrentTarget) do begin47 if Core.CurrentTarget is TTargetInterpretter then 48 with TTargetInterpretter(Core.CurrentTarget) do begin 49 49 LabelProgramPointer.Caption := IntToStr(ProgramIndex); 50 50 LabelMemoryPointer.Caption := IntToStr(MemoryPosition); -
trunk/Forms/UFormInput.pas
r38 r67 31 31 32 32 uses 33 U FormMain, UTargetInterpretter;33 UCore, UTargetInterpretter; 34 34 35 35 procedure TFormInput.MemoInputKeyPress(Sender: TObject; var Key: char); 36 36 begin 37 if MainForm.CurrentTarget is TTargetInterpretter then38 with TTargetInterpretter( MainForm.CurrentTarget) do37 if Core.CurrentTarget is TTargetInterpretter then 38 with TTargetInterpretter(Core.CurrentTarget) do 39 39 Input := Input + Key; 40 40 end; -
trunk/Forms/UFormMain.lfm
r60 r67 1 object MainForm: TMainForm1 object FormMain: TFormMain 2 2 Left = 408 3 3 Height = 586 … … 64 64 object ToolButton5: TToolButton 65 65 Left = 128 66 Height = 22 66 67 Top = 2 67 68 Width = 10 -
trunk/Forms/UFormMain.lrt
r60 r67 1 T MAINFORM.CAPTION=LazFuck2 T MAINFORM.TOOLBUTTONTARGET.HINT=Target select3 T MAINFORM.TOOLBUTTONTARGET.CAPTION=Target select4 T MAINFORM.TABSHEETDEBUG.CAPTION=Debug5 T MAINFORM.TABSHEETSOURCE.CAPTION=Source code6 T MAINFORM.TABSHEETTARGET.CAPTION=Target code7 T MAINFORM.TABSHEETMESSAGES.CAPTION=Messages8 T MAINFORM.MENUITEM1.CAPTION=Project9 T MAINFORM.MENUITEMOPENRECENT.CAPTION=Open recent10 T MAINFORM.MENUITEM5.CAPTION=-11 T MAINFORM.MENUITEM9.CAPTION=Program12 T MAINFORM.MENUITEMTARGET.CAPTION=Target13 T MAINFORM.MENUITEM17.CAPTION=-14 T MAINFORM.MENUITEM24.CAPTION=Tools15 T MAINFORM.MENUITEM18.CAPTION=View16 T MAINFORM.MENUITEM10.CAPTION=Help17 T MAINFORM.APROJECTOPEN.CAPTION=Open18 T MAINFORM.APROJECTSAVE.CAPTION=Save19 T MAINFORM.APROJECTCLOSE.CAPTION=Close20 T MAINFORM.APROJECTSAVEAS.CAPTION=Save as...21 T MAINFORM.APROJECTNEW.CAPTION=New22 T MAINFORM.AEXIT.CAPTION=Exit23 T MAINFORM.APROGRAMCOMPILE.CAPTION=Compile24 T MAINFORM.APROGRAMRUN.CAPTION=Run25 T MAINFORM.AABOUT.CAPTION=About26 T MAINFORM.AHELP.CAPTION=Help27 T MAINFORM.APROGRAMPAUSE.CAPTION=Pause28 T MAINFORM.APROGRAMSTOP.CAPTION=Stop29 T MAINFORM.APROGRAMSTEPINTO.CAPTION=Step into30 T MAINFORM.APROGRAMSTEPOVER.CAPTION=Step over31 T MAINFORM.APROGRAMRUNTOCURSOR.CAPTION=Run to cursor32 T MAINFORM.APROGRAMSTEPOUT.CAPTION=Step out33 T MAINFORM.ABREAKPOINTTOGGLE.CAPTION=Toggle breakpoint34 T MAINFORM.AOPTIONS.CAPTION=Options35 T MAINFORM.AVIEWCOMPILERS.CAPTION=Compilers36 T MAINFORM.ASHOWTARGETPOSITION.CAPTION=Show position in target37 T MAINFORM.ASHOWSOURCEPOSITION.CAPTION=Show position in source38 T MAINFORM.APROGRAMSHOWEXECUTIONPOINT.CAPTION=Show execution point39 T MAINFORM.AVIEWLOG.CAPTION=Log1 TFORMMAIN.CAPTION=LazFuck 2 TFORMMAIN.TOOLBUTTONTARGET.HINT=Target select 3 TFORMMAIN.TOOLBUTTONTARGET.CAPTION=Target select 4 TFORMMAIN.TABSHEETDEBUG.CAPTION=Debug 5 TFORMMAIN.TABSHEETSOURCE.CAPTION=Source code 6 TFORMMAIN.TABSHEETTARGET.CAPTION=Target code 7 TFORMMAIN.TABSHEETMESSAGES.CAPTION=Messages 8 TFORMMAIN.MENUITEM1.CAPTION=Project 9 TFORMMAIN.MENUITEMOPENRECENT.CAPTION=Open recent 10 TFORMMAIN.MENUITEM5.CAPTION=- 11 TFORMMAIN.MENUITEM9.CAPTION=Program 12 TFORMMAIN.MENUITEMTARGET.CAPTION=Target 13 TFORMMAIN.MENUITEM17.CAPTION=- 14 TFORMMAIN.MENUITEM24.CAPTION=Tools 15 TFORMMAIN.MENUITEM18.CAPTION=View 16 TFORMMAIN.MENUITEM10.CAPTION=Help 17 TFORMMAIN.APROJECTOPEN.CAPTION=Open 18 TFORMMAIN.APROJECTSAVE.CAPTION=Save 19 TFORMMAIN.APROJECTCLOSE.CAPTION=Close 20 TFORMMAIN.APROJECTSAVEAS.CAPTION=Save as... 21 TFORMMAIN.APROJECTNEW.CAPTION=New 22 TFORMMAIN.AEXIT.CAPTION=Exit 23 TFORMMAIN.APROGRAMCOMPILE.CAPTION=Compile 24 TFORMMAIN.APROGRAMRUN.CAPTION=Run 25 TFORMMAIN.AABOUT.CAPTION=About 26 TFORMMAIN.AHELP.CAPTION=Help 27 TFORMMAIN.APROGRAMPAUSE.CAPTION=Pause 28 TFORMMAIN.APROGRAMSTOP.CAPTION=Stop 29 TFORMMAIN.APROGRAMSTEPINTO.CAPTION=Step into 30 TFORMMAIN.APROGRAMSTEPOVER.CAPTION=Step over 31 TFORMMAIN.APROGRAMRUNTOCURSOR.CAPTION=Run to cursor 32 TFORMMAIN.APROGRAMSTEPOUT.CAPTION=Step out 33 TFORMMAIN.ABREAKPOINTTOGGLE.CAPTION=Toggle breakpoint 34 TFORMMAIN.AOPTIONS.CAPTION=Options 35 TFORMMAIN.AVIEWCOMPILERS.CAPTION=Compilers 36 TFORMMAIN.ASHOWTARGETPOSITION.CAPTION=Show position in target 37 TFORMMAIN.ASHOWSOURCEPOSITION.CAPTION=Show position in source 38 TFORMMAIN.APROGRAMSHOWEXECUTIONPOINT.CAPTION=Show execution point 39 TFORMMAIN.AVIEWLOG.CAPTION=Log -
trunk/Forms/UFormMain.pas
r65 r67 11 11 type 12 12 13 { T MainForm}14 15 T MainForm= class(TForm)13 { TFormMain } 14 15 TFormMain = class(TForm) 16 16 AViewLog: TAction; 17 17 AProgramShowExecutionPoint: TAction; … … 140 140 procedure TimerRefreshTimer(Sender: TObject); 141 141 private 142 FCurrentTarget: TTarget;143 procedure TargetLogExecute(Lines: TStrings);144 procedure SetCurrentTarget(AValue: TTarget);145 142 procedure AProjectOpenRecentExecute(Sender: TObject); 146 procedure TargetStateChanged(Sender: TObject);147 procedure MessagesChanged(Sender: TObject);148 143 procedure MenuItemTargetClick(Sender: TObject); 149 144 procedure ProjectOpen(FileName: string); … … 152 147 procedure LastOpenedListChange(Sender: TObject); 153 148 public 149 procedure MessagesChanged(Sender: TObject); 150 procedure TargetLogExecute(Lines: TStrings); 151 procedure TargetStateChanged(Sender: TObject); 154 152 procedure LoadFromRegistry(Root: HKEY; Key: string); 155 153 procedure SaveToRegistry(Root: HKEY; Key: string); … … 157 155 procedure UpdateStatusBar; 158 156 procedure UpdateTargetList; 159 property CurrentTarget: TTarget read FCurrentTarget write SetCurrentTarget; 160 end; 161 162 var 163 MainForm: TMainForm; 157 end; 158 159 var 160 FormMain: TFormMain; 164 161 165 162 … … 184 181 SCloseProjectFirst = 'Project need to be closed before it can be openned'; 185 182 186 { TMainForm } 187 188 procedure TMainForm.SetCurrentTarget(AValue: TTarget); 189 var 190 I: Integer; 191 begin 192 if FCurrentTarget = AValue then Exit; 193 FCurrentTarget := AValue; 194 for I := 0 to Core.Targets.Count - 1 do 195 TTarget(Core.Targets[I]).OnChangeState := nil; 196 if Assigned(FCurrentTarget) then begin 197 FCurrentTarget.OnChangeState := TargetStateChanged; 198 FCurrentTarget.OnLog := TargetLogExecute; 199 FCurrentTarget.OptimizationLevel := Core.OptimizationLevel; 200 FCurrentTarget.Messages.OnChange := MessagesChanged; 201 end; 202 UpdateTargetList; 203 UpdateInterface; 204 end; 205 206 procedure TMainForm.FormShow(Sender: TObject); 183 { TFormMain } 184 185 procedure TFormMain.FormShow(Sender: TObject); 207 186 begin 208 187 with Core.ScaleDPI do begin … … 222 201 end; 223 202 224 procedure T MainForm.TimerRefreshTimer(Sender: TObject);203 procedure TFormMain.TimerRefreshTimer(Sender: TObject); 225 204 begin 226 205 FormCPU.Reload; … … 229 208 end; 230 209 231 procedure T MainForm.TargetLogExecute(Lines: TStrings);210 procedure TFormMain.TargetLogExecute(Lines: TStrings); 232 211 begin 233 212 FormLog.Memo1.Lines.AddStrings(Lines); 234 213 end; 235 214 236 procedure T MainForm.TargetStateChanged(Sender: TObject);215 procedure TFormMain.TargetStateChanged(Sender: TObject); 237 216 begin 238 217 UpdateInterface; 239 if C urrentTarget.State = rsPaused then218 if Core.CurrentTarget.State = rsPaused then 240 219 AProgramShowExecutionPoint.Execute; 241 if CurrentTarget.State = rsStopped then CurrentTarget.Messages.AddMessage(SProgramStopped); 242 end; 243 244 procedure TMainForm.MessagesChanged(Sender: TObject); 220 if Core.CurrentTarget.State = rsStopped then 221 Core.CurrentTarget.Messages.AddMessage(SProgramStopped); 222 end; 223 224 procedure TFormMain.MessagesChanged(Sender: TObject); 245 225 begin 246 226 FormMessages.Reload; 247 227 end; 248 228 249 procedure T MainForm.MenuItemTargetClick(Sender: TObject);229 procedure TFormMain.MenuItemTargetClick(Sender: TObject); 250 230 var 251 231 I: Integer; … … 253 233 if Sender is TMenuItem then 254 234 with TMenuItem(Sender) do begin 255 C urrentTarget := TTarget(Core.Targets[MenuIndex]);235 Core.CurrentTarget := TTarget(Core.Targets[MenuIndex]); 256 236 Checked := True; 257 237 for I := 0 to Parent.Count - 1 do … … 260 240 end; 261 241 262 procedure T MainForm.ProjectOpen(FileName: string);242 procedure TFormMain.ProjectOpen(FileName: string); 263 243 begin 264 244 if Core.Project.Openned then … … 268 248 Core.Project.FileName := FileName; 269 249 Core.Project.Openned := True; 270 C urrentTarget.Compiled := False;250 Core.CurrentTarget.Compiled := False; 271 251 UpdateInterface; 272 252 end; 273 253 274 procedure T MainForm.UpdateToolBarHints;254 procedure TFormMain.UpdateToolBarHints; 275 255 var 276 256 I: Integer; … … 280 260 end; 281 261 282 procedure T MainForm.DockInit;262 procedure TFormMain.DockInit; 283 263 begin 284 264 FormSourceCode.ManualDock(TabSheetSource, nil, alClient); … … 303 283 FormMessages.Align := alClient; 304 284 FormMessages.Show; 305 PageControlRight.Width := MainForm.Width div 3;306 PageControlBottom.Height := MainForm.Height div 5;307 end; 308 309 procedure T MainForm.LastOpenedListChange(Sender: TObject);285 PageControlRight.Width := FormMain.Width div 3; 286 PageControlBottom.Height := FormMain.Height div 5; 287 end; 288 289 procedure TFormMain.LastOpenedListChange(Sender: TObject); 310 290 begin 311 291 Core.LastOpenedList.LoadToMenuItem(MenuItemOpenRecent, AProjectOpenRecentExecute); … … 313 293 end; 314 294 315 procedure T MainForm.LoadFromRegistry(Root: HKEY; Key: string);295 procedure TFormMain.LoadFromRegistry(Root: HKEY; Key: string); 316 296 var 317 297 TargetName: string; … … 322 302 OpenKey(Key, True); 323 303 TargetName := ReadStringWithDefault('TargetName', 'Interpretter'); 324 CurrentTarget := Core.Targets.FindByName(TargetName); 325 if not Assigned(CurrentTarget) then CurrentTarget := TTarget(Core.Targets[0]); 304 Core.CurrentTarget := Core.Targets.FindByName(TargetName); 305 if not Assigned(Core.CurrentTarget) then 306 Core.CurrentTarget := TTarget(Core.Targets[0]); 326 307 finally 327 308 Free; … … 329 310 end; 330 311 331 procedure T MainForm.SaveToRegistry(Root: HKEY; Key: string);312 procedure TFormMain.SaveToRegistry(Root: HKEY; Key: string); 332 313 begin 333 314 with TRegistryEx.Create do … … 335 316 RootKey := Root; 336 317 OpenKey(Key, True); 337 WriteString('TargetName', C urrentTarget.Name);318 WriteString('TargetName', Core.CurrentTarget.Name); 338 319 finally 339 320 Free; … … 341 322 end; 342 323 343 procedure T MainForm.UpdateInterface;324 procedure TFormMain.UpdateInterface; 344 325 var 345 326 Title: string; … … 354 335 AProjectClose.Enabled := Core.Project.Openned; 355 336 AProjectSaveAs.Enabled := Core.Project.Openned; 356 AProgramRun.Enabled := (tcRun in C urrentTarget.Capabilities) and357 Core.Project.Openned and (C urrentTarget.State = rsStopped) or (CurrentTarget.State = rsPaused);358 AProgramPause.Enabled := (tcPause in C urrentTarget.Capabilities) and359 Core.Project.Openned and (C urrentTarget.State = rsRunning);360 AProgramStop.Enabled := (tcStop in C urrentTarget.Capabilities) and361 Core.Project.Openned and (C urrentTarget.State <> rsStopped);362 AProgramCompile.Enabled := (tcCompile in C urrentTarget.Capabilities) and337 AProgramRun.Enabled := (tcRun in Core.CurrentTarget.Capabilities) and 338 Core.Project.Openned and (Core.CurrentTarget.State = rsStopped) or (Core.CurrentTarget.State = rsPaused); 339 AProgramPause.Enabled := (tcPause in Core.CurrentTarget.Capabilities) and 340 Core.Project.Openned and (Core.CurrentTarget.State = rsRunning); 341 AProgramStop.Enabled := (tcStop in Core.CurrentTarget.Capabilities) and 342 Core.Project.Openned and (Core.CurrentTarget.State <> rsStopped); 343 AProgramCompile.Enabled := (tcCompile in Core.CurrentTarget.Capabilities) and 363 344 Core.Project.Openned; 364 AProgramStepInto.Enabled := (tcStepInto in C urrentTarget.Capabilities) and365 Core.Project.Openned and ((C urrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped));366 AProgramStepOut.Enabled := (tcStepOut in C urrentTarget.Capabilities) and367 Core.Project.Openned and (C urrentTarget.State = rsPaused);368 AProgramRunToCursor.Enabled := (tcRunToCursor in C urrentTarget.Capabilities) and369 Core.Project.Openned and ((C urrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped));370 AProgramStepOver.Enabled := (tcStepOver in C urrentTarget.Capabilities) and371 Core.Project.Openned and ((C urrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped));372 AProgramShowExecutionPoint.Enabled := (tcPause in C urrentTarget.Capabilities) and373 Core.Project.Openned and (C urrentTarget.State = rsPaused);374 AShowSourcePosition.Enabled := C urrentTarget.Compiled;375 AShowTargetPosition.Enabled := C urrentTarget.Compiled;345 AProgramStepInto.Enabled := (tcStepInto in Core.CurrentTarget.Capabilities) and 346 Core.Project.Openned and ((Core.CurrentTarget.State = rsPaused) or (Core.CurrentTarget.State = rsStopped)); 347 AProgramStepOut.Enabled := (tcStepOut in Core.CurrentTarget.Capabilities) and 348 Core.Project.Openned and (Core.CurrentTarget.State = rsPaused); 349 AProgramRunToCursor.Enabled := (tcRunToCursor in Core.CurrentTarget.Capabilities) and 350 Core.Project.Openned and ((Core.CurrentTarget.State = rsPaused) or (Core.CurrentTarget.State = rsStopped)); 351 AProgramStepOver.Enabled := (tcStepOver in Core.CurrentTarget.Capabilities) and 352 Core.Project.Openned and ((Core.CurrentTarget.State = rsPaused) or (Core.CurrentTarget.State = rsStopped)); 353 AProgramShowExecutionPoint.Enabled := (tcPause in Core.CurrentTarget.Capabilities) and 354 Core.Project.Openned and (Core.CurrentTarget.State = rsPaused); 355 AShowSourcePosition.Enabled := Core.CurrentTarget.Compiled; 356 AShowTargetPosition.Enabled := Core.CurrentTarget.Compiled; 376 357 UpdateStatusBar; 377 358 end; 378 359 379 procedure T MainForm.UpdateStatusBar;360 procedure TFormMain.UpdateStatusBar; 380 361 begin 381 362 StatusBarMain.Panels[0].Text := IntToStr(FormSourceCode.MemoSource.CaretPos.X) + … … 383 364 end; 384 365 385 procedure T MainForm.UpdateTargetList;366 procedure TFormMain.UpdateTargetList; 386 367 var 387 368 I: Integer; 388 369 begin 389 Core.Targets.LoadToMenuItem(MenuItemTarget, MenuItemTargetClick, C urrentTarget);390 Core.Targets.LoadToMenuItem(PopupMenuTargets.Items, MenuItemTargetClick, C urrentTarget);370 Core.Targets.LoadToMenuItem(MenuItemTarget, MenuItemTargetClick, Core.CurrentTarget); 371 Core.Targets.LoadToMenuItem(PopupMenuTargets.Items, MenuItemTargetClick, Core.CurrentTarget); 391 372 392 373 // Update toolbutton 393 I := Core.Targets.IndexOf(C urrentTarget);374 I := Core.Targets.IndexOf(Core.CurrentTarget); 394 375 if I <> -1 then 395 376 with TTarget(Core.Targets[I]) do begin … … 400 381 end; 401 382 402 procedure T MainForm.FormCreate(Sender: TObject);383 procedure TFormMain.FormCreate(Sender: TObject); 403 384 begin 404 385 UpdateTargetList; … … 406 387 end; 407 388 408 procedure T MainForm.FormDestroy(Sender: TObject);389 procedure TFormMain.FormDestroy(Sender: TObject); 409 390 begin 410 391 SaveToRegistry(HKEY(Core.ApplicationInfo.RegistryRoot), Core.ApplicationInfo.RegistryKey); 411 392 end; 412 393 413 procedure T MainForm.AProgramRunExecute(Sender: TObject);414 begin 415 if C urrentTarget is TTargetInterpretter then416 TTargetInterpretter(C urrentTarget).Input := FormInput.MemoInput.Lines.Text;417 if not C urrentTarget.Compiled then AProgramCompile.Execute;418 C urrentTarget.Run;419 C urrentTarget.Messages.AddMessage(SProgramStarted);420 end; 421 422 procedure T MainForm.AShowSourcePositionExecute(Sender: TObject);394 procedure TFormMain.AProgramRunExecute(Sender: TObject); 395 begin 396 if Core.CurrentTarget is TTargetInterpretter then 397 TTargetInterpretter(Core.CurrentTarget).Input := FormInput.MemoInput.Lines.Text; 398 if not Core.CurrentTarget.Compiled then AProgramCompile.Execute; 399 Core.CurrentTarget.Run; 400 Core.CurrentTarget.Messages.AddMessage(SProgramStarted); 401 end; 402 403 procedure TFormMain.AShowSourcePositionExecute(Sender: TObject); 423 404 var 424 405 DebugStep: TDebugStep; 425 406 begin 426 DebugStep := C urrentTarget.DebugSteps.SearchByTargetPos(FormTargetCode.MemoTarget.SelStart);407 DebugStep := Core.CurrentTarget.DebugSteps.SearchByTargetPos(FormTargetCode.MemoTarget.SelStart); 427 408 if Assigned(DebugStep) then begin 428 409 FormSourceCode.MemoSource.SelStart := DebugStep.SourcePosition; … … 431 412 end; 432 413 433 procedure T MainForm.AShowTargetPositionExecute(Sender: TObject);414 procedure TFormMain.AShowTargetPositionExecute(Sender: TObject); 434 415 var 435 416 DebugStep: TDebugStep; 436 417 begin 437 DebugStep := C urrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart);418 DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart); 438 419 if Assigned(DebugStep) then begin 439 420 FormTargetCode.MemoTarget.SelStart := DebugStep.TargetPosition; … … 442 423 end; 443 424 444 procedure T MainForm.AViewCompilersExecute(Sender: TObject);425 procedure TFormMain.AViewCompilersExecute(Sender: TObject); 445 426 begin 446 427 FormCompilers.Show; 447 428 end; 448 429 449 procedure T MainForm.AViewInterpretterExecute(Sender: TObject);430 procedure TFormMain.AViewInterpretterExecute(Sender: TObject); 450 431 begin 451 432 FormCPU.Show; 452 433 end; 453 434 454 procedure T MainForm.AViewLogExecute(Sender: TObject);435 procedure TFormMain.AViewLogExecute(Sender: TObject); 455 436 begin 456 437 FormLog.Show; 457 438 end; 458 439 459 procedure T MainForm.FormCloseQuery(Sender: TObject; var CanClose: boolean);440 procedure TFormMain.FormCloseQuery(Sender: TObject; var CanClose: boolean); 460 441 begin 461 442 if Core.Project.Modified then begin … … 465 446 end; 466 447 467 procedure T MainForm.AExitExecute(Sender: TObject);448 procedure TFormMain.AExitExecute(Sender: TObject); 468 449 begin 469 450 Close; 470 451 end; 471 452 472 procedure T MainForm.AOptionsExecute(Sender: TObject);453 procedure TFormMain.AOptionsExecute(Sender: TObject); 473 454 begin 474 455 OptionsForm.Load; … … 477 458 //OptionsForm.SaveToInterpretter(CurrentTarget); 478 459 OptionsForm.Save; 479 if Assigned(C urrentTarget) then480 C urrentTarget.OptimizationLevel := Core.OptimizationLevel;481 end; 482 end; 483 484 procedure T MainForm.AProgramCompileExecute(Sender: TObject);485 begin 486 with C urrentTarget do begin460 if Assigned(Core.CurrentTarget) then 461 Core.CurrentTarget.OptimizationLevel := Core.OptimizationLevel; 462 end; 463 end; 464 465 procedure TFormMain.AProgramCompileExecute(Sender: TObject); 466 begin 467 with Core.CurrentTarget do begin 487 468 AProgramStop.Execute; 488 469 SourceCode := FormSourceCode.MemoSource.Text; 489 470 ProjectFileName := Core.Project.FileName; 490 471 ProgramName := ExtractFileNameOnly(Core.Project.FileName); 491 C urrentTarget.Messages.AddMessage(SCompileStart);472 Core.CurrentTarget.Messages.AddMessage(SCompileStart); 492 473 Compile; 493 C urrentTarget.Messages.AppendMessage(SDone);474 Core.CurrentTarget.Messages.AppendMessage(SDone); 494 475 FormTargetCode.MemoTarget.Text := TargetCode; 495 476 UpdateInterface; … … 497 478 end; 498 479 499 procedure T MainForm.ABreakpointToggleExecute(Sender: TObject);480 procedure TFormMain.ABreakpointToggleExecute(Sender: TObject); 500 481 var 501 482 DebugStep: TDebugStep; 502 483 BreakPoint: TBreakPoint; 503 484 begin 504 DebugStep := C urrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart);485 DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart); 505 486 if Assigned(DebugStep) then begin 506 BreakPoint := C urrentTarget.BreakPoints.SearchByTargetPos(DebugStep.TargetPosition);487 BreakPoint := Core.CurrentTarget.BreakPoints.SearchByTargetPos(DebugStep.TargetPosition); 507 488 if Assigned(BreakPoint) then 508 C urrentTarget.BreakPoints.Delete(CurrentTarget.BreakPoints.IndexOf(BreakPoint))509 else C urrentTarget.BreakPoints.AddItem(DebugStep.TargetPosition);510 end; 511 end; 512 513 procedure T MainForm.AProgramPauseExecute(Sender: TObject);514 begin 515 C urrentTarget.Pause;516 end; 517 518 procedure T MainForm.AProgramRunToCursorExecute(Sender: TObject);489 Core.CurrentTarget.BreakPoints.Delete(Core.CurrentTarget.BreakPoints.IndexOf(BreakPoint)) 490 else Core.CurrentTarget.BreakPoints.AddItem(DebugStep.TargetPosition); 491 end; 492 end; 493 494 procedure TFormMain.AProgramPauseExecute(Sender: TObject); 495 begin 496 Core.CurrentTarget.Pause; 497 end; 498 499 procedure TFormMain.AProgramRunToCursorExecute(Sender: TObject); 519 500 var 520 501 DebugStep: TDebugStep; 521 502 begin 522 if C urrentTarget.State = rsStopped then begin523 if not C urrentTarget.Compiled then AProgramCompile.Execute;524 DebugStep := C urrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart);525 C urrentTarget.BreakPoints.SetSystem(DebugStep.TargetPosition);503 if Core.CurrentTarget.State = rsStopped then begin 504 if not Core.CurrentTarget.Compiled then AProgramCompile.Execute; 505 DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart); 506 Core.CurrentTarget.BreakPoints.SetSystem(DebugStep.TargetPosition); 526 507 AProgramRun.Execute; 527 508 end else begin 528 DebugStep := C urrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart);529 C urrentTarget.RunToCursor(DebugStep.TargetPosition);530 end; 531 end; 532 533 procedure T MainForm.AProgramShowExecutionPointExecute(Sender: TObject);509 DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart); 510 Core.CurrentTarget.RunToCursor(DebugStep.TargetPosition); 511 end; 512 end; 513 514 procedure TFormMain.AProgramShowExecutionPointExecute(Sender: TObject); 534 515 var 535 516 DebugStep: TDebugStep; 536 517 begin 537 DebugStep := C urrentTarget.DebugSteps.SearchByTargetPos(CurrentTarget.ExecutionPosition);518 DebugStep := Core.CurrentTarget.DebugSteps.SearchByTargetPos(Core.CurrentTarget.ExecutionPosition); 538 519 FormSourceCode.MemoSource.SelStart := DebugStep.SourcePosition; 539 520 FormTargetCode.MemoTarget.SelStart := DebugStep.TargetPosition; … … 542 523 end; 543 524 544 procedure T MainForm.AProgramStepIntoExecute(Sender: TObject);545 begin 546 if C urrentTarget.State = rsStopped then begin547 if not C urrentTarget.Compiled then AProgramCompile.Execute;548 C urrentTarget.BreakPoints.SetSystem(TDebugStep(CurrentTarget.DebugSteps.First).TargetPosition);525 procedure TFormMain.AProgramStepIntoExecute(Sender: TObject); 526 begin 527 if Core.CurrentTarget.State = rsStopped then begin 528 if not Core.CurrentTarget.Compiled then AProgramCompile.Execute; 529 Core.CurrentTarget.BreakPoints.SetSystem(TDebugStep(Core.CurrentTarget.DebugSteps.First).TargetPosition); 549 530 AProgramRun.Execute; 550 end else C urrentTarget.StepInto;551 end; 552 553 procedure T MainForm.AProgramStepOutExecute(Sender: TObject);554 begin 555 C urrentTarget.StepOut;556 end; 557 558 procedure T MainForm.AProgramStepOverExecute(Sender: TObject);559 begin 560 if C urrentTarget.State = rsStopped then begin561 if not C urrentTarget.Compiled then AProgramCompile.Execute;562 C urrentTarget.BreakPoints.SetSystem(TDebugStep(CurrentTarget.DebugSteps.First).TargetPosition);531 end else Core.CurrentTarget.StepInto; 532 end; 533 534 procedure TFormMain.AProgramStepOutExecute(Sender: TObject); 535 begin 536 Core.CurrentTarget.StepOut; 537 end; 538 539 procedure TFormMain.AProgramStepOverExecute(Sender: TObject); 540 begin 541 if Core.CurrentTarget.State = rsStopped then begin 542 if not Core.CurrentTarget.Compiled then AProgramCompile.Execute; 543 Core.CurrentTarget.BreakPoints.SetSystem(TDebugStep(Core.CurrentTarget.DebugSteps.First).TargetPosition); 563 544 AProgramRun.Execute; 564 end else C urrentTarget.StepOver;565 end; 566 567 procedure T MainForm.AProgramStopExecute(Sender: TObject);568 begin 569 C urrentTarget.Stop;570 end; 571 572 procedure T MainForm.AProjectCloseExecute(Sender: TObject);545 end else Core.CurrentTarget.StepOver; 546 end; 547 548 procedure TFormMain.AProgramStopExecute(Sender: TObject); 549 begin 550 Core.CurrentTarget.Stop; 551 end; 552 553 procedure TFormMain.AProjectCloseExecute(Sender: TObject); 573 554 var 574 555 DialogResult: TModalResult; … … 589 570 end; 590 571 591 procedure T MainForm.AProjectNewExecute(Sender: TObject);572 procedure TFormMain.AProjectNewExecute(Sender: TObject); 592 573 begin 593 574 AProjectClose.Execute; … … 596 577 FormSourceCode.MemoSource.Clear; 597 578 Core.Project.Openned := True; 598 C urrentTarget.Compiled := False;579 Core.CurrentTarget.Compiled := False; 599 580 UpdateInterface; 600 581 end; 601 582 602 procedure T MainForm.AProjectOpenRecentExecute(Sender: TObject);583 procedure TFormMain.AProjectOpenRecentExecute(Sender: TObject); 603 584 begin 604 585 AProjectClose.Execute; … … 607 588 end; 608 589 609 procedure T MainForm.AProjectOpenExecute(Sender: TObject);590 procedure TFormMain.AProjectOpenExecute(Sender: TObject); 610 591 begin 611 592 if Core.LastOpenedList.Items.Count > 0 then … … 620 601 end; 621 602 622 procedure T MainForm.AProjectSaveAsExecute(Sender: TObject);603 procedure TFormMain.AProjectSaveAsExecute(Sender: TObject); 623 604 begin 624 605 SaveDialog1.FileName := Core.Project.FileName; … … 632 613 end; 633 614 634 procedure T MainForm.AProjectSaveExecute(Sender: TObject);615 procedure TFormMain.AProjectSaveExecute(Sender: TObject); 635 616 begin 636 617 if Core.Project.Modified and FileExistsUTF8(Core.Project.FileName) then begin -
trunk/Forms/UFormMemory.pas
r61 r67 34 34 35 35 uses 36 U FormMain, UTargetInterpretter;36 UCore, UTargetInterpretter; 37 37 38 38 { TFormMemory } … … 40 40 procedure TFormMemory.Reload; 41 41 begin 42 if MainForm.CurrentTarget is TTargetInterpretter then43 with TTargetInterpretter( MainForm.CurrentTarget) do begin42 if Core.CurrentTarget is TTargetInterpretter then 43 with TTargetInterpretter(Core.CurrentTarget) do begin 44 44 ListViewMemory.Items.Count := Trunc(Length(Memory) / RowSize); 45 45 ListViewMemory.Refresh; … … 52 52 I: Integer; 53 53 begin 54 if MainForm.CurrentTarget is TTargetInterpretter then55 with TTargetInterpretter( MainForm.CurrentTarget) do54 if Core.CurrentTarget is TTargetInterpretter then 55 with TTargetInterpretter(Core.CurrentTarget) do 56 56 if (Item.Index >= 0) and (Item.Index < Trunc(Length(Memory) / RowSize)) then begin 57 57 Item.Caption := IntToHex(Item.Index * RowSize, 8); -
trunk/Forms/UFormMessages.pas
r40 r67 31 31 32 32 uses 33 U FormMain, UTarget;33 UCore, UTarget; 34 34 35 35 { TFormMessages } … … 37 37 procedure TFormMessages.ListView1Data(Sender: TObject; Item: TListItem); 38 38 begin 39 with MainForm.CurrentTarget do39 with Core.CurrentTarget do 40 40 if (Item.Index >= 0) and (Item.Index < Messages.Count) then 41 41 with TMessage(Messages[Item.Index]) do begin … … 52 52 procedure TFormMessages.Reload; 53 53 begin 54 ListView1.Items.Count := MainForm.CurrentTarget.Messages.Count;54 ListView1.Items.Count := Core.CurrentTarget.Messages.Count; 55 55 ListView1.Refresh; 56 56 end; -
trunk/Forms/UFormOptions.lfm
r64 r67 1 1 object OptionsForm: TOptionsForm 2 Left = 4152 Left = 665 3 3 Height = 339 4 Top = 2104 Top = 370 5 5 Width = 468 6 6 Caption = 'Options' -
trunk/Forms/UFormOutput.pas
r38 r67 29 29 30 30 uses 31 U FormMain, UTargetInterpretter;31 UCore, UTargetInterpretter; 32 32 33 33 { TFormOutput } … … 35 35 procedure TFormOutput.Reload; 36 36 begin 37 if MainForm.CurrentTarget is TTargetInterpretter then38 with TTargetInterpretter( MainForm.CurrentTarget) do37 if Core.CurrentTarget is TTargetInterpretter then 38 with TTargetInterpretter(Core.CurrentTarget) do 39 39 MemoOutput.Lines.Text := Output; 40 40 end; -
trunk/Forms/UFormSourceCode.lfm
r61 r67 27 27 end 28 28 object PopupMenuSource: TPopupMenu 29 Images = MainForm.ImageListMain29 Images = FormMain.ImageListMain 30 30 left = 128 31 31 top = 112 32 32 object MenuItem23: TMenuItem 33 Action = MainForm.ABreakpointToggle33 Action = FormMain.ABreakpointToggle 34 34 end 35 35 object MenuItem26: TMenuItem … … 76 76 end 77 77 object MenuItem29: TMenuItem 78 Action = MainForm.AShowTargetPosition78 Action = FormMain.AShowTargetPosition 79 79 Bitmap.Data = { 80 80 36040000424D3604000000000000360000002800000010000000100000000100 … … 281 281 end 282 282 object ActionList1: TActionList 283 Images = MainForm.ImageListMain283 Images = FormMain.ImageListMain 284 284 left = 128 285 285 top = 56 -
trunk/Forms/UFormSourceCode.pas
r61 r67 169 169 begin 170 170 Core.Project.Modified := True; 171 MainForm.CurrentTarget.Compiled := False;172 MainForm.UpdateInterface;171 Core.CurrentTarget.Compiled := False; 172 FormMain.UpdateInterface; 173 173 end; 174 174 … … 185 185 Shift: TShiftState); 186 186 begin 187 MainForm.UpdateStatusBar;187 FormMain.UpdateStatusBar; 188 188 end; 189 189 … … 191 191 Shift: TShiftState; X, Y: Integer); 192 192 begin 193 MainForm.UpdateStatusBar;193 FormMain.UpdateStatusBar; 194 194 end; 195 195
Note:
See TracChangeset
for help on using the changeset viewer.