Changeset 67 for trunk/Forms


Ignore:
Timestamp:
Jan 17, 2015, 4:08:03 PM (10 years ago)
Author:
chronos
Message:
Location:
trunk/Forms
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormCPU.pas

    r52 r67  
    3434
    3535uses
    36   UFormMain, UTargetInterpretter;
     36  UCore, UTargetInterpretter;
    3737
    3838{$R *.lfm}
     
    4545procedure TFormCPU.Reload;
    4646begin
    47   if MainForm.CurrentTarget is TTargetInterpretter then
    48   with TTargetInterpretter(MainForm.CurrentTarget) do begin
     47  if Core.CurrentTarget is TTargetInterpretter then
     48  with TTargetInterpretter(Core.CurrentTarget) do begin
    4949    LabelProgramPointer.Caption := IntToStr(ProgramIndex);
    5050    LabelMemoryPointer.Caption := IntToStr(MemoryPosition);
  • trunk/Forms/UFormInput.pas

    r38 r67  
    3131
    3232uses
    33   UFormMain, UTargetInterpretter;
     33  UCore, UTargetInterpretter;
    3434
    3535procedure TFormInput.MemoInputKeyPress(Sender: TObject; var Key: char);
    3636begin
    37   if MainForm.CurrentTarget is TTargetInterpretter then
    38   with TTargetInterpretter(MainForm.CurrentTarget) do
     37  if Core.CurrentTarget is TTargetInterpretter then
     38  with TTargetInterpretter(Core.CurrentTarget) do
    3939    Input := Input + Key;
    4040end;
  • trunk/Forms/UFormMain.lfm

    r60 r67  
    1 object MainForm: TMainForm
     1object FormMain: TFormMain
    22  Left = 408
    33  Height = 586
     
    6464    object ToolButton5: TToolButton
    6565      Left = 128
     66      Height = 22
    6667      Top = 2
    6768      Width = 10
  • trunk/Forms/UFormMain.lrt

    r60 r67  
    1 TMAINFORM.CAPTION=LazFuck
    2 TMAINFORM.TOOLBUTTONTARGET.HINT=Target select
    3 TMAINFORM.TOOLBUTTONTARGET.CAPTION=Target select
    4 TMAINFORM.TABSHEETDEBUG.CAPTION=Debug
    5 TMAINFORM.TABSHEETSOURCE.CAPTION=Source code
    6 TMAINFORM.TABSHEETTARGET.CAPTION=Target code
    7 TMAINFORM.TABSHEETMESSAGES.CAPTION=Messages
    8 TMAINFORM.MENUITEM1.CAPTION=Project
    9 TMAINFORM.MENUITEMOPENRECENT.CAPTION=Open recent
    10 TMAINFORM.MENUITEM5.CAPTION=-
    11 TMAINFORM.MENUITEM9.CAPTION=Program
    12 TMAINFORM.MENUITEMTARGET.CAPTION=Target
    13 TMAINFORM.MENUITEM17.CAPTION=-
    14 TMAINFORM.MENUITEM24.CAPTION=Tools
    15 TMAINFORM.MENUITEM18.CAPTION=View
    16 TMAINFORM.MENUITEM10.CAPTION=Help
    17 TMAINFORM.APROJECTOPEN.CAPTION=Open
    18 TMAINFORM.APROJECTSAVE.CAPTION=Save
    19 TMAINFORM.APROJECTCLOSE.CAPTION=Close
    20 TMAINFORM.APROJECTSAVEAS.CAPTION=Save as...
    21 TMAINFORM.APROJECTNEW.CAPTION=New
    22 TMAINFORM.AEXIT.CAPTION=Exit
    23 TMAINFORM.APROGRAMCOMPILE.CAPTION=Compile
    24 TMAINFORM.APROGRAMRUN.CAPTION=Run
    25 TMAINFORM.AABOUT.CAPTION=About
    26 TMAINFORM.AHELP.CAPTION=Help
    27 TMAINFORM.APROGRAMPAUSE.CAPTION=Pause
    28 TMAINFORM.APROGRAMSTOP.CAPTION=Stop
    29 TMAINFORM.APROGRAMSTEPINTO.CAPTION=Step into
    30 TMAINFORM.APROGRAMSTEPOVER.CAPTION=Step over
    31 TMAINFORM.APROGRAMRUNTOCURSOR.CAPTION=Run to cursor
    32 TMAINFORM.APROGRAMSTEPOUT.CAPTION=Step out
    33 TMAINFORM.ABREAKPOINTTOGGLE.CAPTION=Toggle breakpoint
    34 TMAINFORM.AOPTIONS.CAPTION=Options
    35 TMAINFORM.AVIEWCOMPILERS.CAPTION=Compilers
    36 TMAINFORM.ASHOWTARGETPOSITION.CAPTION=Show position in target
    37 TMAINFORM.ASHOWSOURCEPOSITION.CAPTION=Show position in source
    38 TMAINFORM.APROGRAMSHOWEXECUTIONPOINT.CAPTION=Show execution point
    39 TMAINFORM.AVIEWLOG.CAPTION=Log
     1TFORMMAIN.CAPTION=LazFuck
     2TFORMMAIN.TOOLBUTTONTARGET.HINT=Target select
     3TFORMMAIN.TOOLBUTTONTARGET.CAPTION=Target select
     4TFORMMAIN.TABSHEETDEBUG.CAPTION=Debug
     5TFORMMAIN.TABSHEETSOURCE.CAPTION=Source code
     6TFORMMAIN.TABSHEETTARGET.CAPTION=Target code
     7TFORMMAIN.TABSHEETMESSAGES.CAPTION=Messages
     8TFORMMAIN.MENUITEM1.CAPTION=Project
     9TFORMMAIN.MENUITEMOPENRECENT.CAPTION=Open recent
     10TFORMMAIN.MENUITEM5.CAPTION=-
     11TFORMMAIN.MENUITEM9.CAPTION=Program
     12TFORMMAIN.MENUITEMTARGET.CAPTION=Target
     13TFORMMAIN.MENUITEM17.CAPTION=-
     14TFORMMAIN.MENUITEM24.CAPTION=Tools
     15TFORMMAIN.MENUITEM18.CAPTION=View
     16TFORMMAIN.MENUITEM10.CAPTION=Help
     17TFORMMAIN.APROJECTOPEN.CAPTION=Open
     18TFORMMAIN.APROJECTSAVE.CAPTION=Save
     19TFORMMAIN.APROJECTCLOSE.CAPTION=Close
     20TFORMMAIN.APROJECTSAVEAS.CAPTION=Save as...
     21TFORMMAIN.APROJECTNEW.CAPTION=New
     22TFORMMAIN.AEXIT.CAPTION=Exit
     23TFORMMAIN.APROGRAMCOMPILE.CAPTION=Compile
     24TFORMMAIN.APROGRAMRUN.CAPTION=Run
     25TFORMMAIN.AABOUT.CAPTION=About
     26TFORMMAIN.AHELP.CAPTION=Help
     27TFORMMAIN.APROGRAMPAUSE.CAPTION=Pause
     28TFORMMAIN.APROGRAMSTOP.CAPTION=Stop
     29TFORMMAIN.APROGRAMSTEPINTO.CAPTION=Step into
     30TFORMMAIN.APROGRAMSTEPOVER.CAPTION=Step over
     31TFORMMAIN.APROGRAMRUNTOCURSOR.CAPTION=Run to cursor
     32TFORMMAIN.APROGRAMSTEPOUT.CAPTION=Step out
     33TFORMMAIN.ABREAKPOINTTOGGLE.CAPTION=Toggle breakpoint
     34TFORMMAIN.AOPTIONS.CAPTION=Options
     35TFORMMAIN.AVIEWCOMPILERS.CAPTION=Compilers
     36TFORMMAIN.ASHOWTARGETPOSITION.CAPTION=Show position in target
     37TFORMMAIN.ASHOWSOURCEPOSITION.CAPTION=Show position in source
     38TFORMMAIN.APROGRAMSHOWEXECUTIONPOINT.CAPTION=Show execution point
     39TFORMMAIN.AVIEWLOG.CAPTION=Log
  • trunk/Forms/UFormMain.pas

    r65 r67  
    1111type
    1212
    13   { TMainForm }
    14 
    15   TMainForm = class(TForm)
     13  { TFormMain }
     14
     15  TFormMain = class(TForm)
    1616    AViewLog: TAction;
    1717    AProgramShowExecutionPoint: TAction;
     
    140140    procedure TimerRefreshTimer(Sender: TObject);
    141141  private
    142     FCurrentTarget: TTarget;
    143     procedure TargetLogExecute(Lines: TStrings);
    144     procedure SetCurrentTarget(AValue: TTarget);
    145142    procedure AProjectOpenRecentExecute(Sender: TObject);
    146     procedure TargetStateChanged(Sender: TObject);
    147     procedure MessagesChanged(Sender: TObject);
    148143    procedure MenuItemTargetClick(Sender: TObject);
    149144    procedure ProjectOpen(FileName: string);
     
    152147    procedure LastOpenedListChange(Sender: TObject);
    153148  public
     149    procedure MessagesChanged(Sender: TObject);
     150    procedure TargetLogExecute(Lines: TStrings);
     151    procedure TargetStateChanged(Sender: TObject);
    154152    procedure LoadFromRegistry(Root: HKEY; Key: string);
    155153    procedure SaveToRegistry(Root: HKEY; Key: string);
     
    157155    procedure UpdateStatusBar;
    158156    procedure UpdateTargetList;
    159     property CurrentTarget: TTarget read FCurrentTarget write SetCurrentTarget;
    160   end;
    161 
    162 var
    163   MainForm: TMainForm;
     157  end;
     158
     159var
     160  FormMain: TFormMain;
    164161
    165162
     
    184181  SCloseProjectFirst = 'Project need to be closed before it can be openned';
    185182
    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
     185procedure TFormMain.FormShow(Sender: TObject);
    207186begin
    208187  with Core.ScaleDPI do begin
     
    222201end;
    223202
    224 procedure TMainForm.TimerRefreshTimer(Sender: TObject);
     203procedure TFormMain.TimerRefreshTimer(Sender: TObject);
    225204begin
    226205  FormCPU.Reload;
     
    229208end;
    230209
    231 procedure TMainForm.TargetLogExecute(Lines: TStrings);
     210procedure TFormMain.TargetLogExecute(Lines: TStrings);
    232211begin
    233212  FormLog.Memo1.Lines.AddStrings(Lines);
    234213end;
    235214
    236 procedure TMainForm.TargetStateChanged(Sender: TObject);
     215procedure TFormMain.TargetStateChanged(Sender: TObject);
    237216begin
    238217  UpdateInterface;
    239   if CurrentTarget.State = rsPaused then
     218  if Core.CurrentTarget.State = rsPaused then
    240219    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);
     222end;
     223
     224procedure TFormMain.MessagesChanged(Sender: TObject);
    245225begin
    246226  FormMessages.Reload;
    247227end;
    248228
    249 procedure TMainForm.MenuItemTargetClick(Sender: TObject);
     229procedure TFormMain.MenuItemTargetClick(Sender: TObject);
    250230var
    251231  I: Integer;
     
    253233  if Sender is TMenuItem then
    254234  with TMenuItem(Sender) do begin
    255     CurrentTarget := TTarget(Core.Targets[MenuIndex]);
     235    Core.CurrentTarget := TTarget(Core.Targets[MenuIndex]);
    256236    Checked := True;
    257237    for I := 0 to Parent.Count - 1 do
     
    260240end;
    261241
    262 procedure TMainForm.ProjectOpen(FileName: string);
     242procedure TFormMain.ProjectOpen(FileName: string);
    263243begin
    264244  if Core.Project.Openned then
     
    268248  Core.Project.FileName := FileName;
    269249  Core.Project.Openned := True;
    270   CurrentTarget.Compiled := False;
     250  Core.CurrentTarget.Compiled := False;
    271251  UpdateInterface;
    272252end;
    273253
    274 procedure TMainForm.UpdateToolBarHints;
     254procedure TFormMain.UpdateToolBarHints;
    275255var
    276256  I: Integer;
     
    280260end;
    281261
    282 procedure TMainForm.DockInit;
     262procedure TFormMain.DockInit;
    283263begin
    284264  FormSourceCode.ManualDock(TabSheetSource, nil, alClient);
     
    303283  FormMessages.Align := alClient;
    304284  FormMessages.Show;
    305   PageControlRight.Width := MainForm.Width div 3;
    306   PageControlBottom.Height := MainForm.Height div 5;
    307 end;
    308 
    309 procedure TMainForm.LastOpenedListChange(Sender: TObject);
     285  PageControlRight.Width := FormMain.Width div 3;
     286  PageControlBottom.Height := FormMain.Height div 5;
     287end;
     288
     289procedure TFormMain.LastOpenedListChange(Sender: TObject);
    310290begin
    311291  Core.LastOpenedList.LoadToMenuItem(MenuItemOpenRecent, AProjectOpenRecentExecute);
     
    313293end;
    314294
    315 procedure TMainForm.LoadFromRegistry(Root: HKEY; Key: string);
     295procedure TFormMain.LoadFromRegistry(Root: HKEY; Key: string);
    316296var
    317297  TargetName: string;
     
    322302    OpenKey(Key, True);
    323303    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]);
    326307  finally
    327308    Free;
     
    329310end;
    330311
    331 procedure TMainForm.SaveToRegistry(Root: HKEY; Key: string);
     312procedure TFormMain.SaveToRegistry(Root: HKEY; Key: string);
    332313begin
    333314  with TRegistryEx.Create do
     
    335316    RootKey := Root;
    336317    OpenKey(Key, True);
    337     WriteString('TargetName', CurrentTarget.Name);
     318    WriteString('TargetName', Core.CurrentTarget.Name);
    338319  finally
    339320    Free;
     
    341322end;
    342323
    343 procedure TMainForm.UpdateInterface;
     324procedure TFormMain.UpdateInterface;
    344325var
    345326  Title: string;
     
    354335  AProjectClose.Enabled := Core.Project.Openned;
    355336  AProjectSaveAs.Enabled := Core.Project.Openned;
    356   AProgramRun.Enabled := (tcRun in CurrentTarget.Capabilities) and
    357     Core.Project.Openned and (CurrentTarget.State = rsStopped) or (CurrentTarget.State = rsPaused);
    358   AProgramPause.Enabled := (tcPause in CurrentTarget.Capabilities) and
    359     Core.Project.Openned and (CurrentTarget.State = rsRunning);
    360   AProgramStop.Enabled := (tcStop in CurrentTarget.Capabilities) and
    361     Core.Project.Openned and (CurrentTarget.State <> rsStopped);
    362   AProgramCompile.Enabled := (tcCompile in CurrentTarget.Capabilities) and
     337  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
    363344    Core.Project.Openned;
    364   AProgramStepInto.Enabled := (tcStepInto in CurrentTarget.Capabilities) and
    365     Core.Project.Openned and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped));
    366   AProgramStepOut.Enabled := (tcStepOut in CurrentTarget.Capabilities) and
    367     Core.Project.Openned and (CurrentTarget.State = rsPaused);
    368   AProgramRunToCursor.Enabled := (tcRunToCursor in CurrentTarget.Capabilities) and
    369     Core.Project.Openned and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped));
    370   AProgramStepOver.Enabled := (tcStepOver in CurrentTarget.Capabilities) and
    371     Core.Project.Openned and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped));
    372   AProgramShowExecutionPoint.Enabled := (tcPause in CurrentTarget.Capabilities) and
    373     Core.Project.Openned and (CurrentTarget.State = rsPaused);
    374   AShowSourcePosition.Enabled := CurrentTarget.Compiled;
    375   AShowTargetPosition.Enabled := CurrentTarget.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;
    376357  UpdateStatusBar;
    377358end;
    378359
    379 procedure TMainForm.UpdateStatusBar;
     360procedure TFormMain.UpdateStatusBar;
    380361begin
    381362  StatusBarMain.Panels[0].Text := IntToStr(FormSourceCode.MemoSource.CaretPos.X) +
     
    383364end;
    384365
    385 procedure TMainForm.UpdateTargetList;
     366procedure TFormMain.UpdateTargetList;
    386367var
    387368  I: Integer;
    388369begin
    389   Core.Targets.LoadToMenuItem(MenuItemTarget, MenuItemTargetClick, CurrentTarget);
    390   Core.Targets.LoadToMenuItem(PopupMenuTargets.Items, MenuItemTargetClick, CurrentTarget);
     370  Core.Targets.LoadToMenuItem(MenuItemTarget, MenuItemTargetClick, Core.CurrentTarget);
     371  Core.Targets.LoadToMenuItem(PopupMenuTargets.Items, MenuItemTargetClick, Core.CurrentTarget);
    391372
    392373  // Update toolbutton
    393   I := Core.Targets.IndexOf(CurrentTarget);
     374  I := Core.Targets.IndexOf(Core.CurrentTarget);
    394375  if I <> -1 then
    395376  with TTarget(Core.Targets[I]) do begin
     
    400381end;
    401382
    402 procedure TMainForm.FormCreate(Sender: TObject);
     383procedure TFormMain.FormCreate(Sender: TObject);
    403384begin
    404385  UpdateTargetList;
     
    406387end;
    407388
    408 procedure TMainForm.FormDestroy(Sender: TObject);
     389procedure TFormMain.FormDestroy(Sender: TObject);
    409390begin
    410391  SaveToRegistry(HKEY(Core.ApplicationInfo.RegistryRoot), Core.ApplicationInfo.RegistryKey);
    411392end;
    412393
    413 procedure TMainForm.AProgramRunExecute(Sender: TObject);
    414 begin
    415   if CurrentTarget is TTargetInterpretter then
    416     TTargetInterpretter(CurrentTarget).Input := FormInput.MemoInput.Lines.Text;
    417   if not CurrentTarget.Compiled then AProgramCompile.Execute;
    418   CurrentTarget.Run;
    419   CurrentTarget.Messages.AddMessage(SProgramStarted);
    420 end;
    421 
    422 procedure TMainForm.AShowSourcePositionExecute(Sender: TObject);
     394procedure TFormMain.AProgramRunExecute(Sender: TObject);
     395begin
     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);
     401end;
     402
     403procedure TFormMain.AShowSourcePositionExecute(Sender: TObject);
    423404var
    424405  DebugStep: TDebugStep;
    425406begin
    426   DebugStep := CurrentTarget.DebugSteps.SearchByTargetPos(FormTargetCode.MemoTarget.SelStart);
     407  DebugStep := Core.CurrentTarget.DebugSteps.SearchByTargetPos(FormTargetCode.MemoTarget.SelStart);
    427408  if Assigned(DebugStep) then begin
    428409    FormSourceCode.MemoSource.SelStart := DebugStep.SourcePosition;
     
    431412end;
    432413
    433 procedure TMainForm.AShowTargetPositionExecute(Sender: TObject);
     414procedure TFormMain.AShowTargetPositionExecute(Sender: TObject);
    434415var
    435416  DebugStep: TDebugStep;
    436417begin
    437   DebugStep := CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart);
     418  DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart);
    438419  if Assigned(DebugStep) then begin
    439420    FormTargetCode.MemoTarget.SelStart := DebugStep.TargetPosition;
     
    442423end;
    443424
    444 procedure TMainForm.AViewCompilersExecute(Sender: TObject);
     425procedure TFormMain.AViewCompilersExecute(Sender: TObject);
    445426begin
    446427  FormCompilers.Show;
    447428end;
    448429
    449 procedure TMainForm.AViewInterpretterExecute(Sender: TObject);
     430procedure TFormMain.AViewInterpretterExecute(Sender: TObject);
    450431begin
    451432  FormCPU.Show;
    452433end;
    453434
    454 procedure TMainForm.AViewLogExecute(Sender: TObject);
     435procedure TFormMain.AViewLogExecute(Sender: TObject);
    455436begin
    456437  FormLog.Show;
    457438end;
    458439
    459 procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: boolean);
     440procedure TFormMain.FormCloseQuery(Sender: TObject; var CanClose: boolean);
    460441begin
    461442  if Core.Project.Modified then begin
     
    465446end;
    466447
    467 procedure TMainForm.AExitExecute(Sender: TObject);
     448procedure TFormMain.AExitExecute(Sender: TObject);
    468449begin
    469450  Close;
    470451end;
    471452
    472 procedure TMainForm.AOptionsExecute(Sender: TObject);
     453procedure TFormMain.AOptionsExecute(Sender: TObject);
    473454begin
    474455  OptionsForm.Load;
     
    477458    //OptionsForm.SaveToInterpretter(CurrentTarget);
    478459    OptionsForm.Save;
    479     if Assigned(CurrentTarget) then
    480       CurrentTarget.OptimizationLevel := Core.OptimizationLevel;
    481   end;
    482 end;
    483 
    484 procedure TMainForm.AProgramCompileExecute(Sender: TObject);
    485 begin
    486   with CurrentTarget do begin
     460    if Assigned(Core.CurrentTarget) then
     461      Core.CurrentTarget.OptimizationLevel := Core.OptimizationLevel;
     462  end;
     463end;
     464
     465procedure TFormMain.AProgramCompileExecute(Sender: TObject);
     466begin
     467  with Core.CurrentTarget do begin
    487468    AProgramStop.Execute;
    488469    SourceCode := FormSourceCode.MemoSource.Text;
    489470    ProjectFileName := Core.Project.FileName;
    490471    ProgramName := ExtractFileNameOnly(Core.Project.FileName);
    491     CurrentTarget.Messages.AddMessage(SCompileStart);
     472    Core.CurrentTarget.Messages.AddMessage(SCompileStart);
    492473    Compile;
    493     CurrentTarget.Messages.AppendMessage(SDone);
     474    Core.CurrentTarget.Messages.AppendMessage(SDone);
    494475    FormTargetCode.MemoTarget.Text := TargetCode;
    495476    UpdateInterface;
     
    497478end;
    498479
    499 procedure TMainForm.ABreakpointToggleExecute(Sender: TObject);
     480procedure TFormMain.ABreakpointToggleExecute(Sender: TObject);
    500481var
    501482  DebugStep: TDebugStep;
    502483  BreakPoint: TBreakPoint;
    503484begin
    504   DebugStep := CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart);
     485  DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart);
    505486  if Assigned(DebugStep) then begin
    506     BreakPoint := CurrentTarget.BreakPoints.SearchByTargetPos(DebugStep.TargetPosition);
     487    BreakPoint := Core.CurrentTarget.BreakPoints.SearchByTargetPos(DebugStep.TargetPosition);
    507488    if Assigned(BreakPoint) then
    508       CurrentTarget.BreakPoints.Delete(CurrentTarget.BreakPoints.IndexOf(BreakPoint))
    509       else CurrentTarget.BreakPoints.AddItem(DebugStep.TargetPosition);
    510   end;
    511 end;
    512 
    513 procedure TMainForm.AProgramPauseExecute(Sender: TObject);
    514 begin
    515   CurrentTarget.Pause;
    516 end;
    517 
    518 procedure TMainForm.AProgramRunToCursorExecute(Sender: TObject);
     489      Core.CurrentTarget.BreakPoints.Delete(Core.CurrentTarget.BreakPoints.IndexOf(BreakPoint))
     490      else Core.CurrentTarget.BreakPoints.AddItem(DebugStep.TargetPosition);
     491  end;
     492end;
     493
     494procedure TFormMain.AProgramPauseExecute(Sender: TObject);
     495begin
     496  Core.CurrentTarget.Pause;
     497end;
     498
     499procedure TFormMain.AProgramRunToCursorExecute(Sender: TObject);
    519500var
    520501  DebugStep: TDebugStep;
    521502begin
    522   if CurrentTarget.State = rsStopped then begin
    523     if not CurrentTarget.Compiled then AProgramCompile.Execute;
    524     DebugStep := CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart);
    525     CurrentTarget.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);
    526507    AProgramRun.Execute;
    527508  end else begin
    528     DebugStep := CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart);
    529     CurrentTarget.RunToCursor(DebugStep.TargetPosition);
    530   end;
    531 end;
    532 
    533 procedure TMainForm.AProgramShowExecutionPointExecute(Sender: TObject);
     509    DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart);
     510    Core.CurrentTarget.RunToCursor(DebugStep.TargetPosition);
     511  end;
     512end;
     513
     514procedure TFormMain.AProgramShowExecutionPointExecute(Sender: TObject);
    534515var
    535516  DebugStep: TDebugStep;
    536517begin
    537   DebugStep := CurrentTarget.DebugSteps.SearchByTargetPos(CurrentTarget.ExecutionPosition);
     518  DebugStep := Core.CurrentTarget.DebugSteps.SearchByTargetPos(Core.CurrentTarget.ExecutionPosition);
    538519  FormSourceCode.MemoSource.SelStart := DebugStep.SourcePosition;
    539520  FormTargetCode.MemoTarget.SelStart := DebugStep.TargetPosition;
     
    542523end;
    543524
    544 procedure TMainForm.AProgramStepIntoExecute(Sender: TObject);
    545 begin
    546   if CurrentTarget.State = rsStopped then begin
    547     if not CurrentTarget.Compiled then AProgramCompile.Execute;
    548     CurrentTarget.BreakPoints.SetSystem(TDebugStep(CurrentTarget.DebugSteps.First).TargetPosition);
     525procedure TFormMain.AProgramStepIntoExecute(Sender: TObject);
     526begin
     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);
    549530    AProgramRun.Execute;
    550   end else CurrentTarget.StepInto;
    551 end;
    552 
    553 procedure TMainForm.AProgramStepOutExecute(Sender: TObject);
    554 begin
    555   CurrentTarget.StepOut;
    556 end;
    557 
    558 procedure TMainForm.AProgramStepOverExecute(Sender: TObject);
    559 begin
    560   if CurrentTarget.State = rsStopped then begin
    561     if not CurrentTarget.Compiled then AProgramCompile.Execute;
    562     CurrentTarget.BreakPoints.SetSystem(TDebugStep(CurrentTarget.DebugSteps.First).TargetPosition);
     531  end else Core.CurrentTarget.StepInto;
     532end;
     533
     534procedure TFormMain.AProgramStepOutExecute(Sender: TObject);
     535begin
     536  Core.CurrentTarget.StepOut;
     537end;
     538
     539procedure TFormMain.AProgramStepOverExecute(Sender: TObject);
     540begin
     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);
    563544    AProgramRun.Execute;
    564   end else CurrentTarget.StepOver;
    565 end;
    566 
    567 procedure TMainForm.AProgramStopExecute(Sender: TObject);
    568 begin
    569   CurrentTarget.Stop;
    570 end;
    571 
    572 procedure TMainForm.AProjectCloseExecute(Sender: TObject);
     545  end else Core.CurrentTarget.StepOver;
     546end;
     547
     548procedure TFormMain.AProgramStopExecute(Sender: TObject);
     549begin
     550  Core.CurrentTarget.Stop;
     551end;
     552
     553procedure TFormMain.AProjectCloseExecute(Sender: TObject);
    573554var
    574555  DialogResult: TModalResult;
     
    589570end;
    590571
    591 procedure TMainForm.AProjectNewExecute(Sender: TObject);
     572procedure TFormMain.AProjectNewExecute(Sender: TObject);
    592573begin
    593574  AProjectClose.Execute;
     
    596577  FormSourceCode.MemoSource.Clear;
    597578  Core.Project.Openned := True;
    598   CurrentTarget.Compiled := False;
     579  Core.CurrentTarget.Compiled := False;
    599580  UpdateInterface;
    600581end;
    601582
    602 procedure TMainForm.AProjectOpenRecentExecute(Sender: TObject);
     583procedure TFormMain.AProjectOpenRecentExecute(Sender: TObject);
    603584begin
    604585  AProjectClose.Execute;
     
    607588end;
    608589
    609 procedure TMainForm.AProjectOpenExecute(Sender: TObject);
     590procedure TFormMain.AProjectOpenExecute(Sender: TObject);
    610591begin
    611592  if Core.LastOpenedList.Items.Count > 0 then
     
    620601end;
    621602
    622 procedure TMainForm.AProjectSaveAsExecute(Sender: TObject);
     603procedure TFormMain.AProjectSaveAsExecute(Sender: TObject);
    623604begin
    624605  SaveDialog1.FileName := Core.Project.FileName;
     
    632613end;
    633614
    634 procedure TMainForm.AProjectSaveExecute(Sender: TObject);
     615procedure TFormMain.AProjectSaveExecute(Sender: TObject);
    635616begin
    636617  if Core.Project.Modified and FileExistsUTF8(Core.Project.FileName) then begin
  • trunk/Forms/UFormMemory.pas

    r61 r67  
    3434
    3535uses
    36   UFormMain, UTargetInterpretter;
     36  UCore, UTargetInterpretter;
    3737
    3838{ TFormMemory }
     
    4040procedure TFormMemory.Reload;
    4141begin
    42   if MainForm.CurrentTarget is TTargetInterpretter then
    43   with TTargetInterpretter(MainForm.CurrentTarget) do begin
     42  if Core.CurrentTarget is TTargetInterpretter then
     43  with TTargetInterpretter(Core.CurrentTarget) do begin
    4444    ListViewMemory.Items.Count := Trunc(Length(Memory) / RowSize);
    4545    ListViewMemory.Refresh;
     
    5252  I: Integer;
    5353begin
    54   if MainForm.CurrentTarget is TTargetInterpretter then
    55   with TTargetInterpretter(MainForm.CurrentTarget) do
     54  if Core.CurrentTarget is TTargetInterpretter then
     55  with TTargetInterpretter(Core.CurrentTarget) do
    5656  if (Item.Index >= 0) and (Item.Index < Trunc(Length(Memory) / RowSize)) then begin
    5757    Item.Caption := IntToHex(Item.Index * RowSize, 8);
  • trunk/Forms/UFormMessages.pas

    r40 r67  
    3131
    3232uses
    33   UFormMain, UTarget;
     33  UCore, UTarget;
    3434
    3535{ TFormMessages }
     
    3737procedure TFormMessages.ListView1Data(Sender: TObject; Item: TListItem);
    3838begin
    39   with MainForm.CurrentTarget do
     39  with Core.CurrentTarget do
    4040  if (Item.Index >= 0) and (Item.Index < Messages.Count) then
    4141  with TMessage(Messages[Item.Index]) do begin
     
    5252procedure TFormMessages.Reload;
    5353begin
    54   ListView1.Items.Count := MainForm.CurrentTarget.Messages.Count;
     54  ListView1.Items.Count := Core.CurrentTarget.Messages.Count;
    5555  ListView1.Refresh;
    5656end;
  • trunk/Forms/UFormOptions.lfm

    r64 r67  
    11object OptionsForm: TOptionsForm
    2   Left = 415
     2  Left = 665
    33  Height = 339
    4   Top = 210
     4  Top = 370
    55  Width = 468
    66  Caption = 'Options'
  • trunk/Forms/UFormOutput.pas

    r38 r67  
    2929
    3030uses
    31   UFormMain, UTargetInterpretter;
     31  UCore, UTargetInterpretter;
    3232
    3333{ TFormOutput }
     
    3535procedure TFormOutput.Reload;
    3636begin
    37   if MainForm.CurrentTarget is TTargetInterpretter then
    38   with TTargetInterpretter(MainForm.CurrentTarget) do
     37  if Core.CurrentTarget is TTargetInterpretter then
     38  with TTargetInterpretter(Core.CurrentTarget) do
    3939    MemoOutput.Lines.Text := Output;
    4040end;
  • trunk/Forms/UFormSourceCode.lfm

    r61 r67  
    2727  end
    2828  object PopupMenuSource: TPopupMenu
    29     Images = MainForm.ImageListMain
     29    Images = FormMain.ImageListMain
    3030    left = 128
    3131    top = 112
    3232    object MenuItem23: TMenuItem
    33       Action = MainForm.ABreakpointToggle
     33      Action = FormMain.ABreakpointToggle
    3434    end
    3535    object MenuItem26: TMenuItem
     
    7676    end
    7777    object MenuItem29: TMenuItem
    78       Action = MainForm.AShowTargetPosition
     78      Action = FormMain.AShowTargetPosition
    7979      Bitmap.Data = {
    8080        36040000424D3604000000000000360000002800000010000000100000000100
     
    281281  end
    282282  object ActionList1: TActionList
    283     Images = MainForm.ImageListMain
     283    Images = FormMain.ImageListMain
    284284    left = 128
    285285    top = 56
  • trunk/Forms/UFormSourceCode.pas

    r61 r67  
    169169begin
    170170  Core.Project.Modified := True;
    171   MainForm.CurrentTarget.Compiled := False;
    172   MainForm.UpdateInterface;
     171  Core.CurrentTarget.Compiled := False;
     172  FormMain.UpdateInterface;
    173173end;
    174174
     
    185185  Shift: TShiftState);
    186186begin
    187   MainForm.UpdateStatusBar;
     187  FormMain.UpdateStatusBar;
    188188end;
    189189
     
    191191  Shift: TShiftState; X, Y: Integer);
    192192begin
    193   MainForm.UpdateStatusBar;
     193  FormMain.UpdateStatusBar;
    194194end;
    195195
Note: See TracChangeset for help on using the changeset viewer.