Ignore:
Timestamp:
Feb 19, 2012, 10:29:55 AM (13 years ago)
Author:
chronos
Message:
  • Modified: Used manual docked forms for better code separation.
  • Modified: Used tabbed layout with PageControl and TabSheets for better usability.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.pas

    r37 r38  
    4949    ImageList1: TImageList;
    5050    MainMenu1: TMainMenu;
    51     MemoMessages: TMemo;
    5251    MemoSource: TMemo;
    5352    MemoTarget: TMemo;
     
    9190    MenuItem9: TMenuItem;
    9291    OpenDialog1: TOpenDialog;
    93     PageControl1: TPageControl;
    94     PageControl2: TPageControl;
    95     PageControl3: TPageControl;
    96     Panel1: TPanel;
     92    PageControlMain: TPageControl;
     93    PageControlRight: TPageControl;
     94    PageControlBottom: TPageControl;
     95    PanelLeft: TPanel;
     96    PanelMemory: TPanel;
     97    PanelCPU: TPanel;
     98    PanelOutput: TPanel;
     99    PanelInput: TPanel;
    97100    PopupMenuTarget: TPopupMenu;
    98101    PopupMenuSource: TPopupMenu;
     
    100103    Splitter1: TSplitter;
    101104    Splitter2: TSplitter;
    102     StatusBar1: TStatusBar;
    103     TabSheet1: TTabSheet;
    104     TabSheet2: TTabSheet;
     105    Splitter3: TSplitter;
     106    Splitter4: TSplitter;
     107    Splitter5: TSplitter;
     108    StatusBarMain: TStatusBar;
     109    TabSheetMessages: TTabSheet;
     110    TabSheetDebug: TTabSheet;
    105111    TabSheetSource: TTabSheet;
    106112    TabSheetTarget: TTabSheet;
    107     ToolBar1: TToolBar;
     113    TimerRefresh: TTimer;
     114    ToolBarMain: TToolBar;
    108115    ToolButton1: TToolButton;
    109116    ToolButton10: TToolButton;
     
    157164    procedure MemoSourceMouseDown(Sender: TObject; Button: TMouseButton;
    158165      Shift: TShiftState; X, Y: Integer);
     166    procedure TimerRefreshTimer(Sender: TObject);
    159167  private
    160168    FCurrentTarget: TTarget;
     
    165173    procedure SetCurrentTarget(AValue: TTarget);
    166174    procedure UpdateToolBarHints;
     175    procedure DockInit;
    167176  public
    168177    Modified: Boolean;
     
    187196
    188197uses
    189   UFormCPU, UApplicationInfo, UFormOptions,
    190   UTargetDelphi, UTargetPHP, UTargetC, UFormTargets;
     198  UFormCPU, UApplicationInfo, UFormOptions, UFormMessages,
     199  UTargetDelphi, UTargetPHP, UTargetC, UFormTargets, UFormOutput, UFormInput,
     200  UFormMemory;
    191201
    192202resourcestring
     
    199209procedure TMainForm.FormShow(Sender: TObject);
    200210begin
    201   PageControl1.TabIndex := 0;
     211  PageControlMain.TabIndex := 0;
    202212  if OpenProjectOnStart and (LastOpenedList.Count > 0) then
    203213    ProjectOpen(LastOpenedList[0])
     
    206216  UpdateToolBarHints;
    207217  UpdateTargetList;
     218  DockInit;
    208219end;
    209220
     
    234245begin
    235246  UpdateStatusBar;
     247end;
     248
     249procedure TMainForm.TimerRefreshTimer(Sender: TObject);
     250begin
     251  FormCPU.Reload;
     252  FormOutput.Reload;
     253  FormMemory.Reload;
    236254end;
    237255
     
    283301  I: Integer;
    284302begin
    285   for I := 0 to ToolBar1.ControlCount - 1 do
    286     ToolBar1.Controls[I].Hint := ToolBar1.Controls[I].Caption;
     303  for I := 0 to ToolBarMain.ControlCount - 1 do
     304    ToolBarMain.Controls[I].Hint := ToolBarMain.Controls[I].Caption;
     305end;
     306
     307procedure TMainForm.DockInit;
     308begin
     309  FormCPU.ManualDock(PanelCPU, nil, alClient);
     310  FormCPU.Align := alClient;
     311  FormCPU.Show;
     312  FormInput.ManualDock(PanelInput, nil, alClient);
     313  FormInput.Align := alClient;
     314  FormInput.Show;
     315  FormOutput.ManualDock(PanelOutput, nil, alClient);
     316  FormOutput.Align := alClient;
     317  FormOutput.Show;
     318  FormMemory.ManualDock(PanelMemory, nil, alClient);
     319  FormMemory.Align := alClient;
     320  FormMemory.Show;
     321  FormMesssages.ManualDock(TabSheetMessages, nil, alClient);
     322  FormMesssages.Align := alClient;
     323  FormMesssages.Show;
    287324end;
    288325
     
    362399procedure TMainForm.UpdateStatusBar;
    363400begin
    364   StatusBar1.Panels[0].Text := IntToStr(MemoSource.CaretPos.X) + ', ' + IntToStr(MemoSource.CaretPos.Y);
     401  StatusBarMain.Panels[0].Text := IntToStr(MemoSource.CaretPos.X) + ', ' + IntToStr(MemoSource.CaretPos.Y);
    365402end;
    366403
     
    403440procedure TMainForm.AProgramRunExecute(Sender: TObject);
    404441begin
    405   InterpreterForm.LastStepCounter := 0;
    406   InterpreterForm.Show;
     442  FormCPU.LastStepCounter := 0;
     443  FormCPU.Show;
    407444  if CurrentTarget is TTargetInterpretter then
    408     TTargetInterpretter(CurrentTarget).Input := InterpreterForm.MemoInput.Lines.Text;
     445    TTargetInterpretter(CurrentTarget).Input := FormInput.MemoInput.Lines.Text;
    409446  if not CurrentTarget.Compiled then AProgramCompile.Execute;
    410447  CurrentTarget.Run;
     
    418455  if Assigned(DebugStep) then begin
    419456    MemoSource.SelStart := DebugStep.SourcePosition;
    420     PageControl1.TabIndex := 0;
     457    PageControlMain.TabIndex := 0;
    421458  end;
    422459end;
     
    429466  if Assigned(DebugStep) then begin
    430467    MemoTarget.SelStart := DebugStep.TargetPosition;
    431     PageControl1.TabIndex := 1;
     468    PageControlMain.TabIndex := 1;
    432469  end;
    433470end;
     
    458495procedure TMainForm.AViewInterpretterExecute(Sender: TObject);
    459496begin
    460   InterpreterForm.Show;
     497  FormCPU.Show;
    461498end;
    462499
     
    573610  MemoSource.SelStart := DebugStep.SourcePosition;
    574611  MemoTarget.SelStart := DebugStep.TargetPosition;
    575   if PageControl1.TabIndex = 0 then MemoSource.SetFocus;
    576   if PageControl1.TabIndex = 1 then MemoTarget.SetFocus;
     612  if PageControlMain.TabIndex = 0 then MemoSource.SetFocus;
     613  if PageControlMain.TabIndex = 1 then MemoTarget.SetFocus;
    577614end;
    578615
Note: See TracChangeset for help on using the changeset viewer.