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/UFormMemory.pas

    r37 r38  
    66
    77uses
    8   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs;
     8  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
     9  ComCtrls;
     10
     11const
     12  RowSize = 16;
    913
    1014type
    11   TForm3 = class(TForm)
     15
     16  { TFormMemory }
     17
     18  TFormMemory = class(TForm)
     19    Label6: TLabel;
     20    ListViewMemory: TListView;
     21    procedure ListViewMemoryData(Sender: TObject; Item: TListItem);
    1222  private
    1323    { private declarations }
    1424  public
    15     { public declarations }
     25    procedure Reload;
    1626  end;
    1727
    1828var
    19   Form3: TForm3;
     29  FormMemory: TFormMemory;
    2030
    2131implementation
     
    2333{$R *.lfm}
    2434
     35uses
     36  UFormMain, UTargetInterpretter;
     37
     38{ TFormMemory }
     39
     40procedure TFormMemory.Reload;
     41begin
     42  if MainForm.CurrentTarget is TTargetInterpretter then
     43  with TTargetInterpretter(MainForm.CurrentTarget) do begin
     44    ListViewMemory.Items.Count := Trunc(Length(Memory) / RowSize);
     45    ListViewMemory.Refresh;
     46  end;
     47end;
     48
     49procedure TFormMemory.ListViewMemoryData(Sender: TObject; Item: TListItem);
     50var
     51  Row: string;
     52  I: Integer;
     53begin
     54  if MainForm.CurrentTarget is TTargetInterpretter then
     55  with TTargetInterpretter(MainForm.CurrentTarget) do
     56  if (Item.Index >= 0) and (Item.Index < Trunc(Length(Memory) / RowSize)) then begin
     57    Item.Caption := IntToHex(Item.Index * RowSize, 8);
     58    Row := '';
     59    for I := 0 to RowSize - 1 do
     60      Row := Row + ' ' + IntToHex(Memory[Item.Index * RowSize + I], 2);
     61    Item.SubItems.Add(Row);
     62  end;
     63end;
     64
     65
    2566end.
    2667
Note: See TracChangeset for help on using the changeset viewer.