Changeset 145 for trunk/Forms


Ignore:
Timestamp:
Jun 5, 2023, 6:44:57 PM (19 months ago)
Author:
chronos
Message:
  • Modified: Remove U prefix from unit names.
  • Modified: Updated Common package.
Location:
trunk/Forms
Files:
39 moved

Legend:

Unmodified
Added
Removed
  • trunk/Forms/FormCPU.lfm

    r144 r145  
    88  ClientWidth = 621
    99  DesignTimePPI = 144
    10   LCLVersion = '2.0.0.4'
     10  OnCreate = FormCreate
     11  LCLVersion = '2.2.6.0'
    1112  object Label4: TLabel
    1213    Left = 12
    13     Height = 25
     14    Height = 26
    1415    Top = 72
    15     Width = 104
     16    Width = 112
    1617    Caption = 'Step counter:'
    1718    ParentColor = False
     
    2021  object Label7: TLabel
    2122    Left = 12
    22     Height = 25
     23    Height = 26
    2324    Top = 108
    24     Width = 54
     25    Width = 57
    2526    Caption = 'Speed:'
    2627    ParentColor = False
     
    2930  object LabelStepSpeed: TLabel
    3031    Left = 288
    31     Height = 25
     32    Height = 26
    3233    Top = 108
    3334    Width = 15
     
    3839  object LabelStepCounter: TLabel
    3940    Left = 288
    40     Height = 25
     41    Height = 26
    4142    Top = 72
    4243    Width = 15
     
    4748  object LabelMemoryPointer: TLabel
    4849    Left = 288
    49     Height = 25
     50    Height = 26
    5051    Top = 36
    5152    Width = 15
     
    5657  object LabelProgramPointer: TLabel
    5758    Left = 288
    58     Height = 25
     59    Height = 26
    5960    Top = 0
    6061    Width = 15
     
    6566  object Label3: TLabel
    6667    Left = 12
    67     Height = 25
     68    Height = 26
    6869    Top = 0
    69     Width = 135
     70    Width = 145
    7071    Caption = 'Program pointer:'
    7172    ParentColor = False
     
    7475  object Label5: TLabel
    7576    Left = 12
    76     Height = 25
     77    Height = 26
    7778    Top = 36
    78     Width = 133
     79    Width = 141
    7980    Caption = 'Memory pointer:'
    8081    ParentColor = False
  • trunk/Forms/FormCPU.pas

    r144 r145  
    1 unit UFormCPU;
     1unit FormCPU;
    22
    33interface
     
    2020    LabelStepCounter: TLabel;
    2121    LabelStepSpeed: TLabel;
    22   private
     22    procedure FormCreate(Sender: TObject);
    2323  public
    2424    LastStepCounter: Integer;
     
    2929  FormCPU: TFormCPU;
    3030
     31
    3132implementation
    3233
    3334uses
    34   UCore, UTargetInterpretter;
     35  Core, TargetInterpretter;
    3536
    3637{$R *.lfm}
     
    4142{ TFormCPU }
    4243
     44procedure TFormCPU.FormCreate(Sender: TObject);
     45begin
     46  Core.Core.Translator.TranslateComponentRecursive(Self);
     47  Core.Core.ThemeManager.UseTheme(Self);
     48end;
     49
    4350procedure TFormCPU.Reload;
    4451begin
    45   if Core.CurrentTarget is TTargetInterpretter then
    46   with TTargetInterpretter(Core.CurrentTarget) do begin
     52  if Core.Core.CurrentTarget is TTargetInterpretter then
     53  with TTargetInterpretter(Core.Core.CurrentTarget) do begin
    4754    LabelProgramPointer.Caption := IntToStr(ProgramIndex);
    4855    LabelMemoryPointer.Caption := IntToStr(MemoryPosition);
  • trunk/Forms/FormCompileMultiple.pas

    r144 r145  
    1 unit UFormCompileMultiple;
     1unit FormCompileMultiple;
    22
    33interface
     
    55uses
    66  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ComCtrls,
    7   UTarget, fgl;
     7  Target, fgl;
    88
    99type
     
    2020    procedure FormDestroy(Sender: TObject);
    2121    procedure FormShow(Sender: TObject);
    22     procedure ListViewTargetsSelectItem(Sender: TObject; Item: TListItem;
    23       Selected: Boolean);
    2422  private
    2523    FTargets: TTargets;
     
    2927  end;
    3028
    31 var
    32   FormCompileMultiple: TFormCompileMultiple;
    33 
    3429
    3530implementation
     
    3833
    3934uses
    40   UCore;
     35  Core;
    4136
    4237procedure TFormCompileMultiple.FormCreate(Sender: TObject);
    4338begin
    44   Core.Translator.TranslateComponentRecursive(Self);
    45   Core.ThemeManager.UseTheme(Self);
     39  Core.Core.Translator.TranslateComponentRecursive(Self);
     40  Core.Core.ThemeManager.UseTheme(Self);
    4641end;
    4742
     
    4944  var CloseAction: TCloseAction);
    5045begin
    51   Core.PersistentForm1.Save(Self);
     46  Core.Core.PersistentForm1.Save(Self);
    5247end;
    5348
     
    6762procedure TFormCompileMultiple.FormShow(Sender: TObject);
    6863begin
    69   Core.PersistentForm1.Load(Self);
     64  Core.Core.PersistentForm1.Load(Self);
    7065  ReloadList;
    71 end;
    72 
    73 procedure TFormCompileMultiple.ListViewTargetsSelectItem(Sender: TObject;
    74   Item: TListItem; Selected: Boolean);
    75 begin
    76 
    7766end;
    7867
  • trunk/Forms/FormInput.pas

    r144 r145  
    1 unit UFormInput;
     1unit FormInput;
    22
    33interface
     
    1414    MemoInput: TMemo;
    1515    procedure MemoInputKeyPress(Sender: TObject; var Key: char);
    16   private
    17     { private declarations }
    18   public
    19     { public declarations }
    2016  end;
    21 
    22 var
    23   FormInput: TFormInput;
    2417
    2518
     
    2922
    3023uses
    31   UCore, UTargetInterpretter;
     24  Core, TargetInterpretter;
    3225
    3326procedure TFormInput.MemoInputKeyPress(Sender: TObject; var Key: char);
    3427begin
    35   if Core.CurrentTarget is TTargetInterpretter then
    36   with TTargetInterpretter(Core.CurrentTarget) do
     28  if Core.Core.CurrentTarget is TTargetInterpretter then
     29  with TTargetInterpretter(Core.Core.CurrentTarget) do
    3730    Input := Input + Key;
    3831end;
  • trunk/Forms/FormLog.pas

    r144 r145  
    1 unit UFormLog;
     1unit FormLog;
    22
    33interface
     
    1313    Memo1: TMemo;
    1414    procedure FormCreate(Sender: TObject);
    15   private
    16     { private declarations }
    17   public
    18     { public declarations }
    1915  end;
    2016
    21 var
    22   FormLog: TFormLog;
    2317
    2418implementation
     
    2721
    2822uses
    29   UCore;
     23  Core;
    3024
    3125{ TFormLog }
     
    3327procedure TFormLog.FormCreate(Sender: TObject);
    3428begin
    35   Core.Translator.TranslateComponentRecursive(Self);
    36   Core.ThemeManager.UseTheme(Self);
     29  Core.Core.Translator.TranslateComponentRecursive(Self);
     30  Core.Core.ThemeManager.UseTheme(Self);
    3731end;
    3832
  • trunk/Forms/FormMain.pas

    r144 r145  
    1 unit UFormMain;
     1unit FormMain;
    22
    33interface
    44
    55uses
    6   Classes, SysUtils, FileUtil, Forms, Controls,
    7   Graphics, Dialogs, Menus, ActnList, ComCtrls, ExtCtrls, UTarget, Registry,
    8   URegistry, LazFileUtils;
     6  Classes, SysUtils, FileUtil, Forms, Controls, FormCPU, FormInput,
     7  Graphics, Dialogs, Menus, ActnList, ComCtrls, ExtCtrls, Target, Registry,
     8  LazFileUtils, FormOptions, FormMessages, FormTargets,
     9  FormOutput, FormMemory, FormSourceCode, FormTargetCode, FormLog,
     10  FormCompileMultiple;
    911
    1012type
     
    144146    procedure TimerRefreshTimer(Sender: TObject);
    145147  private
     148    FormCPU: TFormCPU;
     149    FormInput: TFormInput;
     150    FormLog: TFormLog;
     151    FormMemory: TFormMemory;
     152    FormMessages: TFormMessages;
     153    FormOutput: TFormOutput;
     154    FormSourceCode: TFormSourceCode;
     155    FormTargetCode: TFormTargetCode;
    146156    procedure AProjectOpenRecentExecute(Sender: TObject);
    147157    procedure MenuItemTargetClick(Sender: TObject);
     
    151161    procedure DockInit;
    152162    procedure LastOpenedListChange(Sender: TObject);
     163    procedure CurrentTargetChangeExecute(Sender: TObject);
    153164  public
    154165    procedure MessagesChanged(Sender: TObject);
    155166    procedure TargetLogExecute(Lines: TStrings);
    156167    procedure TargetStateChanged(Sender: TObject);
    157     procedure LoadFromRegistry(Context: TRegistryContext);
    158     procedure SaveToRegistry(Context: TRegistryContext);
    159168    procedure UpdateInterface;
    160169    procedure UpdateStatusBar;
     
    162171  end;
    163172
    164 var
    165   FormMain: TFormMain;
    166 
    167173
    168174implementation
     
    171177
    172178uses
    173   UCore, UFormCPU, UFormOptions, UFormMessages, UFormTargets, UFormOutput, UFormInput,
    174   UFormMemory, UFormSourceCode, UFormTargetCode, UTargetInterpretter, UFormLog,
    175   UBFTarget, UCommon, UFormCompileMultiple;
     179  Core, TargetInterpretter, BFTarget, Common;
    176180
    177181resourcestring
     
    195199procedure TFormMain.FormShow(Sender: TObject);
    196200begin
    197   Core.Init;
    198   LoadFromRegistry(Core.ApplicationInfo.GetRegistryContext);
     201  Core.Core.Init;
    199202  PageControlMain.TabIndex := 0;
    200203  try
    201     if Core.OpenProjectOnStart and (Core.LastOpenedList.Items.Count > 0) and
    202       FileExists(Core.LastOpenedList.Items[0]) then
    203       ProjectOpen(Core.LastOpenedList.Items[0])
     204    if Core.Core.OpenProjectOnStart and (Core.Core.LastOpenedList.Items.Count > 0) and
     205      FileExists(Core.Core.LastOpenedList.Items[0]) then
     206      ProjectOpen(Core.Core.LastOpenedList.Items[0])
    204207      else AProjectNew.Execute;
    205208  finally
     
    209212    UpdateTargetList;
    210213    DockInit;
    211     Core.PersistentForm1.Load(Self, True);
    212     Core.ThemeManager.UseTheme(Self);
     214    Core.Core.PersistentForm1.Load(Self, True);
     215    Core.Core.ThemeManager.UseTheme(Self);
    213216    FormSourceCode.UpdateTheme;
    214217  end;
    215   Core.Messages.OnChange := FormMain.MessagesChanged;
     218  Core.Core.Messages.OnChange := MessagesChanged;
    216219end;
    217220
     
    232235begin
    233236  UpdateInterface;
    234   if Core.CurrentTarget.State = rsPaused then
     237  if Core.Core.CurrentTarget.State = rsPaused then
    235238    AProgramShowExecutionPoint.Execute;
    236   if Core.CurrentTarget.State = rsStopped then
    237     Core.Messages.AddMessage(SProgramStopped);
     239  if Core.Core.CurrentTarget.State = rsStopped then
     240    Core.Core.Messages.AddMessage(SProgramStopped);
    238241end;
    239242
     
    249252  if Sender is TMenuItem then
    250253  with TMenuItem(Sender) do begin
    251     Core.CurrentTarget := TTarget(Core.Targets[MenuIndex]);
     254    Core.Core.CurrentTarget := Core.Core.Targets[MenuIndex];
    252255    Checked := True;
    253256    for I := 0 to Parent.Count - 1 do
     
    258261procedure TFormMain.ProjectOpen(FileName: string);
    259262begin
    260   if Core.Project.Openned then
    261     raise Exception.Create(SCloseProjectFirst);
    262   FormSourceCode.SynEditSource.Lines.LoadFromFile(FileName);
    263   Core.AddItemToLastOpenedList(FileName);
    264   Core.Project.FileName := FileName;
    265   Core.Project.Openned := True;
    266   Core.CurrentTarget.Compiled := False;
     263  with Core.Core do begin
     264    if Project.Openned then
     265      raise Exception.Create(SCloseProjectFirst);
     266    FormSourceCode.SynEditSource.Lines.LoadFromFile(FileName);
     267    AddItemToLastOpenedList(FileName);
     268    Project.FileName := FileName;
     269    Project.Openned := True;
     270    CurrentTarget.Compiled := False;
     271  end;
    267272  UpdateInterface;
    268273end;
     
    292297  DockForm(FormMemory, PanelMemory);
    293298  DockForm(FormMessages, TabSheetMessages);
    294   PageControlRight.Width := FormMain.Width div 3;
    295   PageControlBottom.Height := FormMain.Height div 5;
     299  PageControlRight.Width := Width div 3;
     300  PageControlBottom.Height := Height div 5;
    296301end;
    297302
    298303procedure TFormMain.LastOpenedListChange(Sender: TObject);
    299304begin
    300   Core.LastOpenedList.LoadToMenuItem(MenuItemOpenRecent, AProjectOpenRecentExecute);
    301   Core.LastOpenedList.LoadToMenuItem(PopupMenuRecentFiles.Items, AProjectOpenRecentExecute);
    302 end;
    303 
    304 procedure TFormMain.LoadFromRegistry(Context: TRegistryContext);
    305 var
    306   TargetName: string;
    307 begin
    308   with TRegistryEx.Create do
    309   try
    310     CurrentContext := Context;
    311     TargetName := ReadStringWithDefault('TargetName', 'Interpretter');
    312     Core.CurrentTarget := Core.Targets.FindByName(TargetName);
    313     if not Assigned(Core.CurrentTarget) then
    314       Core.CurrentTarget := TTarget(Core.Targets[0]);
    315     Core.Optimizations.AddSub := ReadBoolWithDefault('OptimizationAddSubEnabled', True);
    316     Core.Optimizations.SetZero := ReadBoolWithDefault('OptimizationSetZeroEnabled', True);
    317     Core.Optimizations.Merge := ReadBoolWithDefault('OptimizationMerge', True);
    318     Core.Optimizations.CopyMultiply := ReadBoolWithDefault('OptimizationCopyMultiplyEnabled', True);
    319     Core.Optimizations.RelativeIndexes := ReadBoolWithDefault('OptimizationRelativeIndexesEnabled', True);
    320   finally
    321     Free;
    322   end;
    323 end;
    324 
    325 procedure TFormMain.SaveToRegistry(Context: TRegistryContext);
    326 begin
    327   with TRegistryEx.Create do
    328   try
    329     CurrentContext := Context;
    330     WriteString('TargetName', Core.CurrentTarget.Name);
    331     WriteBool('OptimizationAddSubEnabled', Core.Optimizations.AddSub);
    332     WriteBool('OptimizationSetZeroEnabled', Core.Optimizations.SetZero);
    333     WriteBool('OptimizationMerge', Core.Optimizations.Merge);
    334     WriteBool('OptimizationCopyMultiplyEnabled', Core.Optimizations.CopyMultiply);
    335     WriteBool('OptimizationRelativeIndexesEnabled', Core.Optimizations.RelativeIndexes);
    336   finally
    337     Free;
    338   end;
     305  Core.Core.LastOpenedList.LoadToMenuItem(MenuItemOpenRecent, AProjectOpenRecentExecute);
     306  Core.Core.LastOpenedList.LoadToMenuItem(PopupMenuRecentFiles.Items, AProjectOpenRecentExecute);
     307end;
     308
     309procedure TFormMain.CurrentTargetChangeExecute(Sender: TObject);
     310begin
     311  UpdateTargetList;
     312  UpdateInterface;
    339313end;
    340314
     
    345319begin
    346320  Title := '';
    347   if Core.Project.FileName <> '' then Title := Core.Project.FileName;
    348   if Core.Project.Modified then Title := Title + ' (' + SChanged + ')';
    349   Title:= Title + ' - ' + Core.ApplicationInfo.AppName;
    350   Caption := Title;
    351   AProjectSave.Enabled := Core.Project.Modified;
    352   FormSourceCode.SynEditSource.Enabled := Core.Project.Openned;
    353   AProjectClose.Enabled := Core.Project.Openned;
    354   AProjectSaveAs.Enabled := Core.Project.Openned;
    355   AProgramRun.Enabled := (tcRun in Core.CurrentTarget.Capabilities) and
    356     Core.Project.Openned and (Core.CurrentTarget.State = rsStopped) or (Core.CurrentTarget.State = rsPaused);
    357   AProgramPause.Enabled := (tcPause in Core.CurrentTarget.Capabilities) and
    358     Core.Project.Openned and (Core.CurrentTarget.State = rsRunning);
    359   AProgramStop.Enabled := (tcStop in Core.CurrentTarget.Capabilities) and
    360     Core.Project.Openned and (Core.CurrentTarget.State <> rsStopped);
    361   AProgramCompile.Enabled := (tcCompile in Core.CurrentTarget.Capabilities) and
    362     Core.Project.Openned;
    363   CanDebug := Core.DebugEnabled and Core.Project.Openned and
    364     ((Core.CurrentTarget.State = rsPaused) or (Core.CurrentTarget.State = rsStopped));
    365   AProgramStepInto.Enabled := CanDebug and (tcStepInto in Core.CurrentTarget.Capabilities);
    366   AProgramStepOut.Enabled := CanDebug and (tcStepOut in Core.CurrentTarget.Capabilities);
    367   AProgramRunToCursor.Enabled := CanDebug and (tcRunToCursor in Core.CurrentTarget.Capabilities);
    368   AProgramStepOver.Enabled := CanDebug and (tcStepOver in Core.CurrentTarget.Capabilities);
    369   AProgramShowExecutionPoint.Enabled := CanDebug and (tcPause in Core.CurrentTarget.Capabilities);
    370   AShowSourcePosition.Enabled := Core.CurrentTarget.Compiled;
    371   AShowTargetPosition.Enabled := Core.CurrentTarget.Compiled;
     321  with Core.Core do begin
     322    if Project.FileName <> '' then Title := Project.FileName;
     323    if Project.Modified then Title := Title + ' (' + SChanged + ')';
     324    Title:= Title + ' - ' + ApplicationInfo.AppName;
     325    Caption := Title;
     326    AProjectSave.Enabled := Project.Modified;
     327    FormSourceCode.SynEditSource.Enabled := Project.Openned;
     328    AProjectClose.Enabled := Project.Openned;
     329    AProjectSaveAs.Enabled := Project.Openned;
     330    AProgramRun.Enabled := (tcRun in CurrentTarget.Capabilities) and
     331      Project.Openned and (CurrentTarget.State = rsStopped) or (CurrentTarget.State = rsPaused);
     332    AProgramPause.Enabled := (tcPause in CurrentTarget.Capabilities) and
     333      Project.Openned and (CurrentTarget.State = rsRunning);
     334    AProgramStop.Enabled := (tcStop in CurrentTarget.Capabilities) and
     335      Project.Openned and (CurrentTarget.State <> rsStopped);
     336    AProgramCompile.Enabled := (tcCompile in CurrentTarget.Capabilities) and
     337      Project.Openned;
     338    CanDebug := DebugEnabled and Project.Openned and
     339      ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped));
     340    AProgramStepInto.Enabled := CanDebug and (tcStepInto in CurrentTarget.Capabilities);
     341    AProgramStepOut.Enabled := CanDebug and (tcStepOut in CurrentTarget.Capabilities);
     342    AProgramRunToCursor.Enabled := CanDebug and (tcRunToCursor in CurrentTarget.Capabilities);
     343    AProgramStepOver.Enabled := CanDebug and (tcStepOver in CurrentTarget.Capabilities);
     344    AProgramShowExecutionPoint.Enabled := CanDebug and (tcPause in CurrentTarget.Capabilities);
     345    AShowSourcePosition.Enabled := CurrentTarget.Compiled;
     346    AShowTargetPosition.Enabled := CurrentTarget.Compiled;
     347  end;
    372348  UpdateStatusBar;
    373349end;
     
    383359  I: Integer;
    384360begin
    385   Core.Targets.LoadToMenuItem(MenuItemTarget, MenuItemTargetClick, Core.CurrentTarget);
    386   Core.Targets.LoadToMenuItem(PopupMenuTargets.Items, MenuItemTargetClick, Core.CurrentTarget);
     361  Core.Core.Targets.LoadToMenuItem(MenuItemTarget, MenuItemTargetClick, Core.Core.CurrentTarget);
     362  Core.Core.Targets.LoadToMenuItem(PopupMenuTargets.Items, MenuItemTargetClick, Core.Core.CurrentTarget);
    387363
    388364  // Update toolbutton
    389   I := Core.Targets.IndexOf(Core.CurrentTarget);
     365  I := Core.Core.Targets.IndexOf(Core.Core.CurrentTarget);
    390366  if I <> -1 then
    391   with TTarget(Core.Targets[I]) do begin
     367  with TTarget(Core.Core.Targets[I]) do begin
    392368    ToolButtonTarget.ImageIndex := ImageIndex;
    393369    ToolButtonTarget.Caption := Name;
     
    398374procedure TFormMain.FormCreate(Sender: TObject);
    399375begin
     376  Core.Core.Translator.TranslateComponentRecursive(Self);
     377  Core.Core.ThemeManager.UseTheme(Self);
     378
     379  FormSourceCode := TFormSourceCode.Create(nil);
     380  FormCPU := TFormCPU.Create(nil);
     381  FormInput := TFormInput.Create(nil);
     382  FormLog := TFormLog.Create(nil);
     383  FormMemory := TFormMemory.Create(nil);
     384  FormMessages := TFormMessages.Create(nil);
     385  FormOutput := TFormOutput.Create(nil);
     386  FormTargetCode := TFormTargetCode.Create(nil);
     387
    400388  UpdateTargetList;
    401   Core.LastOpenedList.OnChange := LastOpenedListChange;
     389  with Core.Core do begin
     390    LastOpenedList.OnChange := LastOpenedListChange;
     391    OnCurrentTargetChange := CurrentTargetChangeExecute;
     392    OnTargetChangeState := TargetStateChanged;
     393    OnTargetLog := TargetLogExecute;
     394  end;
    402395end;
    403396
    404397procedure TFormMain.FormDestroy(Sender: TObject);
    405398begin
    406   SaveToRegistry(Core.ApplicationInfo.GetRegistryContext);
     399  FreeAndNil(FormSourceCode);
     400  FreeAndNil(FormCPU);
     401  FreeAndNil(FormInput);
     402  FreeAndNil(FormLog);
     403  FreeAndNil(FormMemory);
     404  FreeAndNil(FormMessages);
     405  FreeAndNil(FormOutput);
     406  FreeAndNil(FormTargetCode);
    407407end;
    408408
    409409procedure TFormMain.AProgramRunExecute(Sender: TObject);
    410410begin
    411   if Core.CurrentTarget is TTargetInterpretter then
    412     TTargetInterpretter(Core.CurrentTarget).Input := FormInput.MemoInput.Lines.Text;
    413   if not Core.CurrentTarget.Compiled then AProgramCompile.Execute;
    414   Core.CurrentTarget.Run;
    415   Core.Messages.AddMessage(SProgramStarted);
     411  if Core.Core.CurrentTarget is TTargetInterpretter then
     412    TTargetInterpretter(Core.Core.CurrentTarget).Input := FormInput.MemoInput.Lines.Text;
     413  if not Core.Core.CurrentTarget.Compiled then AProgramCompile.Execute;
     414  Core.Core.CurrentTarget.Run;
     415  Core.Core.Messages.AddMessage(SProgramStarted);
    416416end;
    417417
     
    420420  DebugStep: TDebugStep;
    421421begin
    422   DebugStep := Core.CurrentTarget.DebugSteps.SearchByTargetPos(FormTargetCode.SynEditTarget.SelStart - 1);
     422  DebugStep := Core.Core.CurrentTarget.DebugSteps.SearchByTargetPos(FormTargetCode.SynEditTarget.SelStart - 1);
    423423  if Assigned(DebugStep) then begin
    424424    FormSourceCode.SynEditSource.SelStart := DebugStep.SourcePosition + 1;
     
    431431  DebugStep: TDebugStep;
    432432begin
    433   DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.SynEditSource.SelStart - 1);
     433  DebugStep := Core.Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.SynEditSource.SelStart - 1);
    434434  if Assigned(DebugStep) then begin
    435435    FormTargetCode.SynEditTarget.SelStart := DebugStep.TargetPosition + 1;
     
    461461procedure TFormMain.FormClose(Sender: TObject; var CloseAction: TCloseAction);
    462462begin
    463   Core.PersistentForm1.Save(Self);
     463  Core.Core.PersistentForm1.Save(Self);
     464  Application.Terminate;
    464465end;
    465466
    466467procedure TFormMain.FormCloseQuery(Sender: TObject; var CanClose: boolean);
    467468begin
    468   if Core.Project.Modified then begin
     469  if Core.Core.Project.Modified then begin
    469470    AProjectClose.Execute;
    470     if Core.Project.Openned then CanClose := False;
     471    if Core.Core.Project.Openned then CanClose := False;
    471472  end;
    472473end;
     
    478479
    479480procedure TFormMain.AOptionsExecute(Sender: TObject);
     481var
     482  FormOptions: TFormOptions;
    480483begin
    481484  FormOptions := TFormOptions.Create(nil);
     
    484487    if FormOptions.ShowModal = mrOK then begin
    485488      FormOptions.Save;
    486       if Assigned(Core.CurrentTarget) then begin
    487         Core.CurrentTarget.OptimizationLevel := Core.OptimizationLevel;
    488         if Core.CurrentTarget is TBFTarget then begin
    489           TBFTarget(Core.CurrentTarget).CellSize := Core.CellSize;
    490           TBFTarget(Core.CurrentTarget).MemorySize := Core.MemorySize;
     489      if Assigned(Core.Core.CurrentTarget) then begin
     490        Core.Core.CurrentTarget.OptimizationLevel := Core.Core.OptimizationLevel;
     491        if Core.Core.CurrentTarget is TBFTarget then begin
     492          TBFTarget(Core.Core.CurrentTarget).CellSize := Core.Core.CellSize;
     493          TBFTarget(Core.Core.CurrentTarget).MemorySize := Core.Core.MemorySize;
    491494        end;
    492495      end;
    493       Core.ThemeManager.UseTheme(Self);
     496      Core.Core.ThemeManager.UseTheme(Self);
    494497      FormSourceCode.UpdateTheme;
    495       Core.SaveToRegistry(Core.ApplicationInfo.GetRegistryContext);
    496       SaveToRegistry(Core.ApplicationInfo.GetRegistryContext);
     498      Core.Core.SaveToRegistry(Core.Core.ApplicationInfo.GetRegistryContext);
    497499    end;
    498500  finally
     
    503505procedure TFormMain.AProgramCompileExecute(Sender: TObject);
    504506begin
    505   with Core.CurrentTarget do
     507  with Core.Core, CurrentTarget do
    506508  try
    507     Core.Messages.Clear;
     509    Messages.Clear;
    508510    AProgramStop.Execute;
    509511    SourceCode := FormSourceCode.SynEditSource.Text;
    510     ProjectFileName := Core.Project.FileName;
    511     ProgramName := ExtractFileNameOnly(Core.Project.FileName);
    512     if Core.CurrentTarget is TBFTarget then
    513       TBFTarget(Core.CurrentTarget).Optimizations := Core.Optimizations;
    514     DebugEnabled := Core.DebugEnabled;
    515     Core.Messages.AddMessage(SCompileStart);
     512    ProjectFileName := Project.FileName;
     513    ProgramName := ExtractFileNameOnly(Project.FileName);
     514    if CurrentTarget is TBFTarget then
     515      TBFTarget(CurrentTarget).Optimizations := Optimizations;
     516    DebugEnabled := DebugEnabled;
     517    Messages.AddMessage(SCompileStart);
    516518    Application.ProcessMessages;
    517519    Compile;
    518     Core.Messages.AppendMessage(SDone);
     520    Messages.AppendMessage(SDone);
    519521    FormTargetCode.SynEditTarget.Text := TargetCode;
    520     FormTargetCode.SetHighlighter(Core.CurrentTarget.SourceExtension);
     522    FormTargetCode.SetHighlighter(CurrentTarget.SourceExtension);
    521523    UpdateInterface;
    522524  except
     
    533535  with TFormCompileMultiple.Create(nil) do
    534536  try
    535     Targets := Core.Targets;
     537    Targets := Core.Core.Targets;
    536538    if ShowModal = mrOk then begin
    537       Core.Messages.Clear;
     539      Core.Core.Messages.Clear;
    538540      for I := 0 to Targets.Count - 1 do
    539541      with Targets[I] do
     
    542544        AProgramStop.Execute;
    543545        SourceCode := FormSourceCode.SynEditSource.Text;
    544         ProjectFileName := Core.Project.FileName;
    545         ProgramName := ExtractFileNameOnly(Core.Project.FileName);
     546        ProjectFileName := Core.Core.Project.FileName;
     547        ProgramName := ExtractFileNameOnly(Core.Core.Project.FileName);
    546548        if Targets[I] is TBFTarget then
    547           TBFTarget(Targets[I]).Optimizations := Core.Optimizations;
    548         DebugEnabled := Core.DebugEnabled;
    549         Core.Messages.AddMessage(Name + ' ' + SCompileStart);
     549          TBFTarget(Targets[I]).Optimizations := Core.Core.Optimizations;
     550        DebugEnabled := Core.Core.DebugEnabled;
     551        Core.Core.Messages.AddMessage(Name + ' ' + SCompileStart);
    550552        Application.ProcessMessages;
    551553        Compile;
    552         Core.Messages.AppendMessage(SDone);
     554        Core.Core.Messages.AppendMessage(SDone);
    553555        FormTargetCode.SynEditTarget.Text := TargetCode;
    554         FormTargetCode.SetHighlighter(Core.CurrentTarget.SourceExtension);
     556        FormTargetCode.SetHighlighter(Core.Core.CurrentTarget.SourceExtension);
    555557        UpdateInterface;
    556558      except
     
    569571  BreakPoint: TBreakPoint;
    570572begin
    571   DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.SynEditSource.SelStart - 1);
     573  DebugStep := Core.Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.SynEditSource.SelStart - 1);
    572574  if Assigned(DebugStep) then begin
    573     BreakPoint := Core.CurrentTarget.BreakPoints.SearchByTargetPos(DebugStep.ProgramPosition);
     575    BreakPoint := Core.Core.CurrentTarget.BreakPoints.SearchByTargetPos(DebugStep.ProgramPosition);
    574576    if Assigned(BreakPoint) then
    575       Core.CurrentTarget.BreakPoints.Delete(Core.CurrentTarget.BreakPoints.IndexOf(BreakPoint))
    576       else Core.CurrentTarget.BreakPoints.AddItem(DebugStep.ProgramPosition);
     577      Core.Core.CurrentTarget.BreakPoints.Delete(Core.Core.CurrentTarget.BreakPoints.IndexOf(BreakPoint))
     578      else Core.Core.CurrentTarget.BreakPoints.AddItem(DebugStep.ProgramPosition);
    577579  end;
    578580end;
     
    580582procedure TFormMain.AAboutExecute(Sender: TObject);
    581583begin
    582   Core.AboutDialog.Show;
     584  Core.Core.AboutDialog.Show;
    583585end;
    584586
    585587procedure TFormMain.AProgramPauseExecute(Sender: TObject);
    586588begin
    587   Core.CurrentTarget.Pause;
     589  Core.Core.CurrentTarget.Pause;
    588590end;
    589591
     
    592594  DebugStep: TDebugStep;
    593595begin
    594   if Core.CurrentTarget.State = rsStopped then begin
    595     if not Core.CurrentTarget.Compiled then AProgramCompile.Execute;
    596     DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.SynEditSource.SelStart - 1);
    597     Core.CurrentTarget.BreakPoints.SetSystem(DebugStep.ProgramPosition);
     596  if Core.Core.CurrentTarget.State = rsStopped then begin
     597    if not Core.Core.CurrentTarget.Compiled then AProgramCompile.Execute;
     598    DebugStep := Core.Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.SynEditSource.SelStart - 1);
     599    Core.Core.CurrentTarget.BreakPoints.SetSystem(DebugStep.ProgramPosition);
    598600    AProgramRun.Execute;
    599601  end else begin
    600     DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.SynEditSource.SelStart - 1);
    601     Core.CurrentTarget.RunToCursor(DebugStep.ProgramPosition);
     602    DebugStep := Core.Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.SynEditSource.SelStart - 1);
     603    Core.Core.CurrentTarget.RunToCursor(DebugStep.ProgramPosition);
    602604  end;
    603605end;
     
    607609  DebugStep: TDebugStep;
    608610begin
    609   DebugStep := Core.CurrentTarget.DebugSteps.SearchByProgramPos(Core.CurrentTarget.ExecutionPosition);
     611  DebugStep := Core.Core.CurrentTarget.DebugSteps.SearchByProgramPos(
     612    Core.Core.CurrentTarget.ExecutionPosition);
    610613  FormSourceCode.SynEditSource.SelStart := DebugStep.SourcePosition + 1;
    611614  FormTargetCode.SynEditTarget.SelStart := DebugStep.TargetPosition + 1;
     
    616619procedure TFormMain.AProgramStepIntoExecute(Sender: TObject);
    617620begin
    618   if Core.CurrentTarget.State = rsStopped then begin
    619     if not Core.CurrentTarget.Compiled then AProgramCompile.Execute;
    620     Core.CurrentTarget.BreakPoints.SetSystem(Core.CurrentTarget.DebugSteps.First.ProgramPosition);
     621  if Core.Core.CurrentTarget.State = rsStopped then begin
     622    if not Core.Core.CurrentTarget.Compiled then AProgramCompile.Execute;
     623    Core.Core.CurrentTarget.BreakPoints.SetSystem(
     624      Core.Core.CurrentTarget.DebugSteps.First.ProgramPosition);
    621625    AProgramRun.Execute;
    622   end else Core.CurrentTarget.StepInto;
     626  end else Core.Core.CurrentTarget.StepInto;
    623627end;
    624628
    625629procedure TFormMain.AProgramStepOutExecute(Sender: TObject);
    626630begin
    627   Core.CurrentTarget.StepOut;
     631  Core.Core.CurrentTarget.StepOut;
    628632end;
    629633
    630634procedure TFormMain.AProgramStepOverExecute(Sender: TObject);
    631635begin
    632   if Core.CurrentTarget.State = rsStopped then begin
    633     if not Core.CurrentTarget.Compiled then AProgramCompile.Execute;
    634     Core.CurrentTarget.BreakPoints.SetSystem(TDebugStep(Core.CurrentTarget.DebugSteps.First).ProgramPosition);
     636  if Core.Core.CurrentTarget.State = rsStopped then begin
     637    if not Core.Core.CurrentTarget.Compiled then AProgramCompile.Execute;
     638    Core.Core.CurrentTarget.BreakPoints.SetSystem(
     639      TDebugStep(Core.Core.CurrentTarget.DebugSteps.First).ProgramPosition);
    635640    AProgramRun.Execute;
    636   end else Core.CurrentTarget.StepOver;
     641  end else Core.Core.CurrentTarget.StepOver;
    637642end;
    638643
    639644procedure TFormMain.AProgramStopExecute(Sender: TObject);
    640645begin
    641   Core.CurrentTarget.Stop;
     646  Core.Core.CurrentTarget.Stop;
    642647end;
    643648
     
    647652begin
    648653  DialogResult := mrNo;
    649   if Core.Project.Modified then begin
     654  if Core.Core.Project.Modified then begin
    650655    DialogResult := MessageDlg(SUnsavedChanges, SDoYouWantToSaveProject, mtConfirmation, [mbYes, mbNo, mbCancel], 0);
    651656    if DialogResult = mrYes then begin
     
    655660  if (DialogResult = mrNo) or (DialogResult = mrYes) then begin
    656661    AProgramStop.Execute;
    657     Core.Project.Openned := False;
     662    Core.Core.Project.Openned := False;
    658663    FormSourceCode.SynEditSource.Clear;
    659664    UpdateInterface;
     
    664669begin
    665670  AProjectClose.Execute;
    666   if Core.Project.Openned then Exit;
    667   Core.Project.FileName := CombinePaths(Core.DataDir, ExamplesDir + DirectorySeparator + SNewProject + '.b');
     671  if Core.Core.Project.Openned then Exit;
     672  Core.Core.Project.FileName := CombinePaths(Core.Core.DataDir, ExamplesDir + DirectorySeparator + SNewProject + '.b');
    668673  FormSourceCode.SynEditSource.Clear;
    669   Core.Project.Openned := True;
    670   Core.CurrentTarget.Compiled := False;
     674  Core.Core.Project.Openned := True;
     675  Core.Core.CurrentTarget.Compiled := False;
    671676  UpdateInterface;
    672677end;
     
    676681  FileName: string;
    677682begin
    678   FileName := Core.LastOpenedList.Items[TMenuItem(Sender).MenuIndex];
     683  FileName := Core.Core.LastOpenedList.Items[TMenuItem(Sender).MenuIndex];
    679684  if FileExists(FileName) then begin
    680685    AProjectClose.Execute;
    681     if Core.Project.Openned then Exit;
     686    if Core.Core.Project.Openned then Exit;
    682687    ProjectOpen(FileName);
    683688  end else ShowMessage(Format(SFileNotFound, [FileName]));
     
    688693  FileName: string;
    689694begin
    690   if Core.LastOpenedList.Items.Count > 0 then
    691     FileName := Core.LastOpenedList.Items[0]
    692     else FileName := CombinePaths(Core.DataDir, ExamplesDir);
     695  if Core.Core.LastOpenedList.Items.Count > 0 then
     696    FileName := Core.Core.LastOpenedList.Items[0]
     697    else FileName := CombinePaths(Core.Core.DataDir, ExamplesDir);
    693698  OpenDialog1.InitialDir := ExtractFileDir(FileName);
    694699  OpenDialog1.FileName := ExtractFileName(FileName);
    695700  if OpenDialog1.Execute then begin
    696701    AProjectClose.Execute;
    697     if Core.Project.Openned then Exit;
     702    if Core.Core.Project.Openned then Exit;
    698703    ProjectOpen(OpenDialog1.FileName);
    699704  end;
     
    702707procedure TFormMain.AProjectSaveAsExecute(Sender: TObject);
    703708begin
    704   SaveDialog1.InitialDir := ExtractFileDir(Core.Project.FileName);
    705   SaveDialog1.FileName := ExtractFileName(Core.Project.FileName);
     709  SaveDialog1.InitialDir := ExtractFileDir(Core.Core.Project.FileName);
     710  SaveDialog1.FileName := ExtractFileName(Core.Core.Project.FileName);
    706711  if SaveDialog1.Execute then begin
    707712    FormSourceCode.SynEditSource.Lines.SaveToFile(SaveDialog1.FileName);
    708     Core.Project.FileName := SaveDialog1.FileName;
    709     Core.AddItemToLastOpenedList(SaveDialog1.FileName);
    710     Core.Project.Modified := False;
     713    Core.Core.Project.FileName := SaveDialog1.FileName;
     714    Core.Core.AddItemToLastOpenedList(SaveDialog1.FileName);
     715    Core.Core.Project.Modified := False;
    711716    UpdateInterface;
    712717  end;
     
    715720procedure TFormMain.AProjectSaveExecute(Sender: TObject);
    716721begin
    717   if Core.Project.Modified and FileExists(Core.Project.FileName) then begin
    718     FormSourceCode.SynEditSource.Lines.SaveToFile(Core.Project.FileName);
    719     Core.AddItemToLastOpenedList(Core.Project.FileName);
    720     Core.Project.Modified := False;
     722  if Core.Core.Project.Modified and FileExists(Core.Core.Project.FileName) then begin
     723    FormSourceCode.SynEditSource.Lines.SaveToFile(Core.Core.Project.FileName);
     724    Core.Core.AddItemToLastOpenedList(Core.Core.Project.FileName);
     725    Core.Core.Project.Modified := False;
    721726    UpdateInterface;
    722727  end else AProjectSaveAs.Execute;
  • trunk/Forms/FormMemory.lfm

    r144 r145  
    88  ClientWidth = 1039
    99  DesignTimePPI = 144
     10  OnCreate = FormCreate
    1011  LCLVersion = '2.2.6.0'
    1112  object Label6: TLabel
  • trunk/Forms/FormMemory.pas

    r144 r145  
    1 unit UFormMemory;
     1unit FormMemory;
    22
    33interface
     
    1717    Label6: TLabel;
    1818    ListViewMemory: TListView;
     19    procedure FormCreate(Sender: TObject);
    1920    procedure ListViewMemoryData(Sender: TObject; Item: TListItem);
    2021  private
     
    2425  end;
    2526
    26 var
    27   FormMemory: TFormMemory;
    2827
    2928implementation
     
    3231
    3332uses
    34   UCore, UTargetInterpretter;
     33  Core, TargetInterpretter;
    3534
    3635{ TFormMemory }
     
    3837procedure TFormMemory.Reload;
    3938begin
    40   if Core.CurrentTarget is TTargetInterpretter then
    41   with TTargetInterpretter(Core.CurrentTarget) do begin
     39  if Core.Core.CurrentTarget is TTargetInterpretter then
     40  with TTargetInterpretter(Core.Core.CurrentTarget) do begin
    4241    if MemoryChanged then begin
    4342      MemoryChanged := False;
     
    5554  Address: Integer;
    5655begin
    57   if Core.CurrentTarget is TTargetInterpretter then
    58   with TTargetInterpretter(Core.CurrentTarget) do
     56  if Core.Core.CurrentTarget is TTargetInterpretter then
     57  with TTargetInterpretter(Core.Core.CurrentTarget) do
    5958  if (Item.Index >= 0) and (Item.Index <= Trunc((MemoryMaxUsedAddr + 1) / RowSize)) then begin
    6059    Item.Caption := IntToHex(Item.Index * RowSize, 8);
     
    7574end;
    7675
     76procedure TFormMemory.FormCreate(Sender: TObject);
     77begin
     78  Core.Core.Translator.TranslateComponentRecursive(Self);
     79  Core.Core.ThemeManager.UseTheme(Self);
     80end;
     81
    7782end.
    7883
  • trunk/Forms/FormMessages.lfm

    r144 r145  
    99  DesignTimePPI = 144
    1010  OnCreate = FormCreate
    11   LCLVersion = '2.0.0.4'
     11  LCLVersion = '2.2.6.0'
    1212  object ListView1: TListView
    1313    Left = 0
     
    1818    Columns = <   
    1919      item
    20         Width = 710
     20        Width = 723
    2121      end>
    2222    OwnerData = True
  • trunk/Forms/FormMessages.pas

    r144 r145  
    1 unit UFormMessages;
     1unit FormMessages;
    22
    33interface
     
    1515    procedure FormCreate(Sender: TObject);
    1616    procedure ListView1Data(Sender: TObject; Item: TListItem);
    17   private
    18     { private declarations }
    1917  public
    2018    procedure Reload;
    2119  end;
    2220
    23 var
    24   FormMessages: TFormMessages;
    2521
    2622implementation
     
    2925
    3026uses
    31   UCore, UTarget;
     27  Core, Target;
    3228
    3329{ TFormMessages }
     
    3531procedure TFormMessages.ListView1Data(Sender: TObject; Item: TListItem);
    3632begin
    37   with Core do
     33  with Core.Core do
    3834  if (Item.Index >= 0) and (Item.Index < Messages.Count) then
    3935  with Messages[Item.Index] do begin
     
    4541procedure TFormMessages.FormCreate(Sender: TObject);
    4642begin
     43  Core.Core.Translator.TranslateComponentRecursive(Self);
     44  Core.Core.ThemeManager.UseTheme(Self);
    4745end;
    4846
    4947procedure TFormMessages.Reload;
    5048begin
    51   ListView1.Items.Count := Core.Messages.Count;
     49  ListView1.Items.Count := Core.Core.Messages.Count;
    5250  ListView1.Refresh;
    5351end;
  • trunk/Forms/FormOptions.pas

    r144 r145  
    1 unit UFormOptions;
     1unit FormOptions;
    22
    33interface
     
    55uses
    66  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    7   Spin, ComCtrls, ExtCtrls, UTarget, UTheme;
     7  Spin, ComCtrls, ExtCtrls, Target, Theme;
    88
    99type
     
    4747    procedure FormCreate(Sender: TObject);
    4848    procedure FormShow(Sender: TObject);
    49   private
    50     { private declarations }
    5149  public
    5250    procedure UpdateInterface;
     
    5553  end;
    5654
    57 var
    58   FormOptions: TFormOptions;
    5955
    6056implementation
     
    6359
    6460uses
    65   UCore, ULanguages;
     61  Core, Languages;
    6662
    6763{ TFormOptions }
     
    6965procedure TFormOptions.FormShow(Sender: TObject);
    7066begin
    71   Core.PersistentForm1.Load(Self);
     67  Core.Core.PersistentForm1.Load(Self);
    7268end;
    7369
     
    9187procedure TFormOptions.Load;
    9288begin
    93   ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.Translator.Language);
    94   if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0;
    95   ComboBoxTheme.ItemIndex := ComboBoxTheme.Items.IndexOfObject(Core.ThemeManager.Theme);
    96   if ComboBoxTheme.ItemIndex = -1 then ComboBoxTheme.ItemIndex := 0;
    97   CheckBoxReopenLastFile.Checked := Core.OpenProjectOnStart;
    98   CheckBoxOptimizeAddSub.Checked := Core.Optimizations.AddSub;
    99   CheckBoxOptimizeSetZero.Checked := Core.Optimizations.SetZero;
    100   CheckBoxOptimizeMerge.Checked := Core.Optimizations.Merge;
    101   CheckBoxOptimizeRelativeIndexes.Checked := Core.Optimizations.RelativeIndexes;
    102   CheckBoxOptimizeCopyMultiply.Checked := Core.Optimizations.CopyMultiply;
    103   SpinEditDPIX.Value := Core.ScaleDPI1.DPI.X;
    104   SpinEditDPIY.Value := Core.ScaleDPI1.DPI.Y;
    105   CheckBoxDPIAuto.Checked := Core.ScaleDPI1.AutoDetect;
    106   ComboBoxOptimization.ItemIndex := Integer(Core.OptimizationLevel);
    107   SpinEditCellSize.Value := Core.CellSize;
    108   SpinEditMemorySize.Value := Core.MemorySize;
    109   CheckBoxDebugEnabled.Checked := Core.DebugEnabled;
    110   if Core.OptionsFormTabIndex < PageControl1.PageCount then
    111     PageControl1.TabIndex := Core.OptionsFormTabIndex
    112     else PageControl1.TabIndex := 0;
     89  with Core.Core do begin
     90    ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Translator.Language);
     91    if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0;
     92    ComboBoxTheme.ItemIndex := ComboBoxTheme.Items.IndexOfObject(ThemeManager.Theme);
     93    if ComboBoxTheme.ItemIndex = -1 then ComboBoxTheme.ItemIndex := 0;
     94    CheckBoxReopenLastFile.Checked := OpenProjectOnStart;
     95    CheckBoxOptimizeAddSub.Checked := Optimizations.AddSub;
     96    CheckBoxOptimizeSetZero.Checked := Optimizations.SetZero;
     97    CheckBoxOptimizeMerge.Checked := Optimizations.Merge;
     98    CheckBoxOptimizeRelativeIndexes.Checked := Optimizations.RelativeIndexes;
     99    CheckBoxOptimizeCopyMultiply.Checked := Optimizations.CopyMultiply;
     100    SpinEditDPIX.Value := ScaleDPI1.DPI.X;
     101    SpinEditDPIY.Value := ScaleDPI1.DPI.Y;
     102    CheckBoxDPIAuto.Checked := ScaleDPI1.AutoDetect;
     103    ComboBoxOptimization.ItemIndex := Integer(OptimizationLevel);
     104    SpinEditCellSize.Value := CellSize;
     105    SpinEditMemorySize.Value := MemorySize;
     106    CheckBoxDebugEnabled.Checked := DebugEnabled;
     107    if OptionsFormTabIndex < PageControl1.PageCount then
     108      PageControl1.TabIndex := OptionsFormTabIndex
     109      else PageControl1.TabIndex := 0;
     110  end;
    113111  UpdateInterface;
    114112end;
     
    116114procedure TFormOptions.Save;
    117115begin
     116  with Core.Core do begin
    118117  if ComboBoxLanguage.ItemIndex <> -1 then
    119     Core.Translator.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);
     118    Translator.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);
    120119  if ComboBoxTheme.ItemIndex <> -1 then
    121     Core.ThemeManager.Theme := TTheme(ComboBoxTheme.Items.Objects[ComboBoxTheme.ItemIndex]);
    122   Core.OpenProjectOnStart := CheckBoxReopenLastFile.Checked;
    123   Core.ScaleDPI1.DPI := Point(SpinEditDPIX.Value, SpinEditDPIY.Value);
    124   Core.ScaleDPI1.AutoDetect := CheckBoxDPIAuto.Checked;
    125   Core.OptimizationLevel := TCompilerOptimization(ComboBoxOptimization.ItemIndex);
    126   Core.CellSize := SpinEditCellSize.Value;
    127   Core.MemorySize := SpinEditMemorySize.Value;
    128   Core.Optimizations.AddSub := CheckBoxOptimizeAddSub.Checked;
    129   Core.Optimizations.SetZero := CheckBoxOptimizeSetZero.Checked;
    130   Core.Optimizations.Merge := CheckBoxOptimizeMerge.Checked;
    131   Core.Optimizations.RelativeIndexes := CheckBoxOptimizeRelativeIndexes.Checked;
    132   Core.Optimizations.CopyMultiply := CheckBoxOptimizeCopyMultiply.Checked;
    133   Core.DebugEnabled := CheckBoxDebugEnabled.Checked;
    134   Core.OptionsFormTabIndex := PageControl1.TabIndex;
     120    ThemeManager.Theme := TTheme(ComboBoxTheme.Items.Objects[ComboBoxTheme.ItemIndex]);
     121    OpenProjectOnStart := CheckBoxReopenLastFile.Checked;
     122    ScaleDPI1.DPI := Point(SpinEditDPIX.Value, SpinEditDPIY.Value);
     123    ScaleDPI1.AutoDetect := CheckBoxDPIAuto.Checked;
     124    OptimizationLevel := TCompilerOptimization(ComboBoxOptimization.ItemIndex);
     125    CellSize := SpinEditCellSize.Value;
     126    MemorySize := SpinEditMemorySize.Value;
     127    Optimizations.AddSub := CheckBoxOptimizeAddSub.Checked;
     128    Optimizations.SetZero := CheckBoxOptimizeSetZero.Checked;
     129    Optimizations.Merge := CheckBoxOptimizeMerge.Checked;
     130    Optimizations.RelativeIndexes := CheckBoxOptimizeRelativeIndexes.Checked;
     131    Optimizations.CopyMultiply := CheckBoxOptimizeCopyMultiply.Checked;
     132    DebugEnabled := CheckBoxDebugEnabled.Checked;
     133    OptionsFormTabIndex := PageControl1.TabIndex;
     134  end;
    135135end;
    136136
     
    157157  );
    158158begin
    159   Core.PersistentForm1.Save(Self);
     159  Core.Core.PersistentForm1.Save(Self);
    160160end;
    161161
    162162procedure TFormOptions.FormCreate(Sender: TObject);
    163163begin
    164   Core.Translator.TranslateComponentRecursive(Self);
    165   Core.ThemeManager.UseTheme(Self);
    166   Core.ThemeManager.Themes.LoadToStrings(ComboBoxTheme.Items);
    167   Core.Translator.LanguageListToStrings(ComboBoxLanguage.Items);
     164  with Core.Core do begin
     165    Translator.TranslateComponentRecursive(Self);
     166    ThemeManager.UseTheme(Self);
     167    ThemeManager.Themes.LoadToStrings(ComboBoxTheme.Items);
     168    Translator.LanguageListToStrings(ComboBoxLanguage.Items);
     169  end;
    168170  ComboBoxOptimization.Items.Clear;
    169171  ComboBoxOptimization.Items.Add(CompilerOptimizationText[coNone]);
  • trunk/Forms/FormOutput.lfm

    r144 r145  
    88  ClientWidth = 640
    99  DesignTimePPI = 144
     10  OnCreate = FormCreate
    1011  LCLVersion = '2.2.6.0'
    1112  object Label2: TLabel
  • trunk/Forms/FormOutput.pas

    r144 r145  
    1 unit UFormOutput;
     1unit FormOutput;
    22
    33interface
     
    1313    Label2: TLabel;
    1414    MemoOutput: TMemo;
    15   private
    16     { private declarations }
     15    procedure FormCreate(Sender: TObject);
    1716  public
    1817    procedure Reload;
    1918  end;
    20 
    21 var
    22   FormOutput: TFormOutput;
    2319
    2420
     
    2824
    2925uses
    30   UCore, UTargetInterpretter;
     26  Core, TargetInterpretter;
    3127
    3228{ TFormOutput }
    3329
     30procedure TFormOutput.FormCreate(Sender: TObject);
     31begin
     32  Core.Core.Translator.TranslateComponentRecursive(Self);
     33  Core.Core.ThemeManager.UseTheme(Self);
     34end;
     35
    3436procedure TFormOutput.Reload;
    3537begin
    36   if Core.CurrentTarget is TTargetInterpretter then
    37   with TTargetInterpretter(Core.CurrentTarget) do begin
     38  if Core.Core.CurrentTarget is TTargetInterpretter then
     39  with TTargetInterpretter(Core.Core.CurrentTarget) do begin
    3840    if OutputChanged then begin
    3941      OutputChanged := False;
  • trunk/Forms/FormSourceCode.pas

    r144 r145  
    1 unit UFormSourceCode;
     1unit FormSourceCode;
    22
    33interface
     
    66  Classes, SysUtils, FileUtil, SynEdit, SynHighlighterIni, Forms, Controls,
    77  Graphics, Dialogs, Menus, ActnList,
    8   SynEditHighlighter, SynHighlighterAny, SynHighlighterJava, UBFHighlighter;
     8  SynEditHighlighter, SynHighlighterAny, SynHighlighterJava, BFHighlighter;
    99
    1010type
     
    6060  private
    6161    BFHighlighter: TSynBrainFuckHl;
     62    FOnUpdateInterface: TNotifyEvent;
     63    FOnUpdateStatusBar: TNotifyEvent;
    6264  public
    6365    procedure UpdateInterface;
    6466    procedure UpdateTheme;
     67    property OnUpdateStatusBar: TNotifyEvent read FOnUpdateStatusBar
     68      write FOnUpdateStatusBar;
     69    property OnUpdateInterface: TNotifyEvent read FOnUpdateInterface
     70      write FOnUpdateInterface;
    6571  end;
    6672
    67 var
    68   FormSourceCode: TFormSourceCode;
    69 
    7073
    7174implementation
     
    7477
    7578uses
    76   UCore, UFormMain, UBFCodeTools;
     79  Core, BFCodeTools;
    7780
    7881resourcestring
     
    142145procedure TFormSourceCode.FormCreate(Sender: TObject);
    143146begin
     147  Core.Core.Translator.TranslateComponentRecursive(Self);
     148  Core.Core.ThemeManager.UseTheme(Self);
     149
    144150  BFHighlighter := TSynBrainFuckHl.Create(nil);
    145151  SynEditSource.Highlighter := BFHighlighter;
     
    162168  clLightRed = TColor($8080FF);
    163169begin
    164   if Core.ThemeManager.Theme.Name = 'Dark' then begin
     170  if Core.Core.ThemeManager.Theme.Name = 'Dark' then begin
    165171    BFHighlighter.IoAttri.Foreground := clWhite;
    166172    BFHighlighter.LoopAttri.Foreground := clLightRed;
     
    177183procedure TFormSourceCode.MemoSourceChange(Sender: TObject);
    178184begin
    179   Core.Project.Modified := True;
    180   Core.CurrentTarget.Compiled := False;
    181   FormMain.UpdateInterface;
     185  Core.Core.Project.Modified := True;
     186  Core.Core.CurrentTarget.Compiled := False;
     187  if Assigned(FOnUpdateInterface) then
     188    OnUpdateInterface(Self);
    182189end;
    183190
     
    194201  Shift: TShiftState);
    195202begin
    196   FormMain.UpdateStatusBar;
     203  if Assigned(FOnUpdateStatusBar) then
     204    FOnUpdateStatusBar(Self);
    197205end;
    198206
     
    200208  Shift: TShiftState; X, Y: Integer);
    201209begin
    202   FormMain.UpdateStatusBar;
     210  if Assigned(FOnUpdateStatusBar) then
     211    FOnUpdateStatusBar(Self);
    203212end;
    204213
  • trunk/Forms/FormTargetCode.lfm

    r144 r145  
    11object FormTargetCode: TFormTargetCode
    22  Left = 555
    3   Height = 435
     3  Height = 522
    44  Top = 379
    5   Width = 612
     5  Width = 734
    66  Caption = 'Target code'
    7   ClientHeight = 435
    8   ClientWidth = 612
    9   DesignTimePPI = 120
    10   LCLVersion = '2.0.2.0'
     7  ClientHeight = 522
     8  ClientWidth = 734
     9  DesignTimePPI = 144
     10  OnCreate = FormCreate
     11  LCLVersion = '2.2.6.0'
    1112  inline SynEditTarget: TSynEdit
    1213    Left = 0
    13     Height = 435
     14    Height = 522
    1415    Top = 0
    15     Width = 612
     16    Width = 734
    1617    Align = alClient
    17     Font.Height = -13
     18    Font.Height = -16
    1819    Font.Name = 'Courier New'
    1920    Font.Pitch = fpFixed
     
    2324    PopupMenu = PopupMenuTarget
    2425    TabOrder = 0
    25     Gutter.Width = 68
     26    Gutter.Width = 81
    2627    Gutter.MouseActions = <>
    2728    RightGutter.Width = 0
     
    472473    inline SynLeftGutterPartList1: TSynGutterPartList
    473474      object SynGutterMarks1: TSynGutterMarks
    474         Width = 30
     475        Width = 36
    475476        MouseActions = <>
    476477      end
    477478      object SynGutterLineNumber1: TSynGutterLineNumber
    478         Width = 17
     479        Width = 21
    479480        MouseActions = <>
    480481        MarkupInfo.Background = clBtnFace
     
    486487      end
    487488      object SynGutterChanges1: TSynGutterChanges
    488         Width = 5
     489        Width = 6
    489490        MouseActions = <>
    490491        ModifiedColor = 59900
     
    498499      end
    499500      object SynGutterCodeFolding1: TSynGutterCodeFolding
    500         Width = 13
     501        Width = 15
    501502        MouseActions = <>
    502503        MarkupInfo.Background = clNone
     
    509510  object PopupMenuTarget: TPopupMenu
    510511    Images = Core.ImageListMain
    511     left = 84
    512     top = 100
     512    Left = 101
     513    Top = 120
    513514    object MenuItem20: TMenuItem
    514515      Action = AFormatCode
     
    520521  object ActionList1: TActionList
    521522    Images = Core.ImageListMain
    522     left = 199
    523     top = 39
     523    Left = 239
     524    Top = 47
    524525    object AFormatCode: TAction
    525526      Caption = 'Format code'
  • trunk/Forms/FormTargetCode.pas

    r144 r145  
    1 unit UFormTargetCode;
     1unit FormTargetCode;
    22
    33interface
     
    2323    procedure AFormatCodeExecute(Sender: TObject);
    2424    procedure AShrinkCodeExecute(Sender: TObject);
    25   private
    26     { private declarations }
     25    procedure FormCreate(Sender: TObject);
    2726  public
    2827    procedure SetHighlighter(SourceExt: string);
    2928  end;
    3029
    31 var
    32   FormTargetCode: TFormTargetCode;
    3330
    3431implementation
    3532
    3633{$R *.lfm}
     34
     35uses
     36  Core;
    3737
    3838{ TFormTargetCode }
     
    8484end;
    8585
     86procedure TFormTargetCode.FormCreate(Sender: TObject);
     87begin
     88  Core.Core.Translator.TranslateComponentRecursive(Self);
     89  Core.Core.ThemeManager.UseTheme(Self);
     90end;
     91
    8692procedure TFormTargetCode.SetHighlighter(SourceExt: string);
    8793begin
  • trunk/Forms/FormTargetOptions.pas

    r144 r145  
    1 unit UFormTargetOptions;
     1unit FormTargetOptions;
    22
    33interface
     
    55uses
    66  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    7   UTarget;
     7  Target;
    88
    99type
     
    2626    procedure FormCreate(Sender: TObject);
    2727    procedure FormShow(Sender: TObject);
    28   private
    29     { private declarations }
    3028  public
    3129    procedure LoadControls(Target: TTarget);
    3230    procedure SaveControls(Target: TTarget);
    3331  end;
    34 
    35 var
    36   FormTargetOptions: TFormTargetOptions;
    3732
    3833
     
    4237
    4338uses
    44   UCore;
     39  Core;
    4540
    4641{ TFormTargetOptions }
     
    6156  var CloseAction: TCloseAction);
    6257begin
    63   Core.PersistentForm1.Save(Self);
     58  Core.Core.PersistentForm1.Save(Self);
    6459end;
    6560
    6661procedure TFormTargetOptions.FormCreate(Sender: TObject);
    6762begin
    68   Core.Translator.TranslateComponentRecursive(Self);
    69   Core.ThemeManager.UseTheme(Self);
     63  Core.Core.Translator.TranslateComponentRecursive(Self);
     64  Core.Core.ThemeManager.UseTheme(Self);
    7065end;
    7166
    7267procedure TFormTargetOptions.FormShow(Sender: TObject);
    7368begin
    74   Core.PersistentForm1.Load(Self);
     69  Core.Core.PersistentForm1.Load(Self);
    7570end;
    7671
  • trunk/Forms/FormTargets.pas

    r144 r145  
    1 unit UFormTargets;
     1unit FormTargets;
    22
    33interface
     
    1818    procedure ListView1DblClick(Sender: TObject);
    1919    procedure ListView1KeyPress(Sender: TObject; var Key: char);
    20   private
    21     { private declarations }
    2220  public
    2321    procedure ReloadList;
    2422  end;
    2523
    26 var
    27   FormTargets: TFormTargets;
    2824
    2925implementation
     
    3228
    3329uses
    34   UCore, UTarget, UFormTargetOptions;
     30  Core, Target, FormTargetOptions;
    3531
    3632{ TFormTargets }
     
    3834procedure TFormTargets.FormShow(Sender: TObject);
    3935begin
    40   Core.PersistentForm1.Load(Self);
     36  Core.Core.PersistentForm1.Load(Self);
    4137  ReloadList;
    4238end;
     
    4440procedure TFormTargets.FormCreate(Sender: TObject);
    4541begin
    46   Core.Translator.TranslateComponentRecursive(Self);
    47   Core.ThemeManager.UseTheme(Self);
     42  Core.Core.Translator.TranslateComponentRecursive(Self);
     43  Core.Core.ThemeManager.UseTheme(Self);
    4844end;
    4945
     
    5147  );
    5248begin
    53   Core.PersistentForm1.Save(Self);
     49  Core.Core.PersistentForm1.Save(Self);
    5450end;
    5551
    5652procedure TFormTargets.ListView1Data(Sender: TObject; Item: TListItem);
    5753begin
    58   if (Item.Index >= 0) and (Item.Index < Core.Targets.Count) then
    59   with TTarget(Core.Targets[Item.Index]) do begin
     54  if (Item.Index >= 0) and (Item.Index < Core.Core.Targets.Count) then
     55  with TTarget(Core.Core.Targets[Item.Index]) do begin
    6056    Item.Caption := Name;
    61     Item.Data := Core.Targets[Item.Index];
     57    Item.Data := Core.Core.Targets[Item.Index];
    6258    Item.SubItems.Add(ExecutorPath);
    6359    Item.SubItems.Add(CompilerPath);
     
    6662
    6763procedure TFormTargets.ListView1DblClick(Sender: TObject);
     64var
     65  FormTargetOptions: TFormTargetOptions;
    6866begin
    6967  FormTargetOptions := TFormTargetOptions.Create(nil);
     
    8684procedure TFormTargets.ReloadList;
    8785begin
    88   ListView1.Items.Count := Core.Targets.Count;
     86  ListView1.Items.Count := Core.Core.Targets.Count;
    8987  ListView1.Refresh;
    9088end;
Note: See TracChangeset for help on using the changeset viewer.