6 ConstantsClass
, CustomViewClass
, FloatEditClass
, FunctionsClass
,
7 HardwareClass
, ResourcesClass
, TagEditClass
, TypesClass
,
14 TStackView
= class(TCustomView
)
16 pFloatEdit
: TFLoatEdit
;
18 function pGetWidth
: Integer; virtual;
19 procedure pCustomKeyDown(Sender
: TObject
; var Key
: Word; Shift
: TShiftState
); virtual;
20 procedure pOnState(Sender
: TObject
); virtual;
21 procedure pSetWidth(Width
: Integer); virtual;
23 constructor CreateStackView(AOwner
: TComponent
; Hw
: THardware
); virtual;
24 procedure ChangeStack(Line
: Integer); virtual;
25 procedure ChangeTag(Line
: Integer); virtual;
26 property Width read pGetWidth write pSetWidth
;
31 // ************************************************************************** //
32 // * TStackView implementation * //
33 // ************************************************************************** //
35 function TStackView
.pGetWidth
: Integer;
37 Result
:= inherited Width
;
40 procedure TStackView
.pCustomKeyDown(Sender
: TObject
; var Key
: Word;
45 lselect
:= Selection
.TopLeft
;
47 KEY_RETURN
, KEY_SPACE
:
49 1: ChangeTag(lselect
.Y
);
50 2: ChangeStack(lselect
.Y
);
55 procedure TStackView
.pOnState(Sender
: TObject
);
59 with Hardware
.State
.FPUState
do
62 Changes
[1, i
] := not CompareStateTag(Hardware
, i
);
63 Changes
[2, i
] := not CompareStateStack(Hardware
, i
);
64 Changes
[0, i
] := Changes
[1, i
] or Changes
[2, i
];
65 Cells
[0, i
] := DESC_STACKS
[i
];
66 Cells
[1, i
] := DESC_TAG
[GetTag(Hardware
.State
, i
)];
67 Cells
[2, i
] := CustomFloatToStr(@ST
[i
], SizeOf(ST
[i
]));
71 procedure TStackView
.pSetWidth(Width
: Integer);
73 inherited Width
:= Width
;
74 ColWidths
[0] := Canvas
.TextWidth(Cells
[0, 0] + ' ');
75 ColWidths
[1] := Canvas
.TextWidth(DESC_TAG
[DESC_TAG_LONGEST
] + ' ');
76 ColWidths
[2] := ClientWidth
- ColWidths
[1] - ColWidths
[0];
79 constructor TStackView
.CreateStackView(AOwner
: TComponent
; Hw
: THardware
);
81 inherited CreateView(AOwner
, Hw
);
84 OnKeyDown
:= pCustomKeyDown
;
86 pFloatEdit
:= TFLoatEdit
.Create(AOwner
);
87 pTagEdit
:= TTagEdit
.Create(AOwner
);
88 PopupMenu
:= TPopupMenu
.Create(Self
);
91 Items
.Add(TMenuItem
.Create(PopupMenu
));
92 with Items
[Items
.Count
- 1] do
94 Caption
:= FL_EDIT_MODIFY
;
95 OnClick
:= OnDblClick
;
102 procedure TStackView
.ChangeStack(Line
: Integer);
105 lstate
: THardwareState
;
108 lstate
:= Hardware
.State
;
109 pFloatEdit
.Caption
:= FL_EDIT_MODIFY
+ DESC_STACKS
[Line
];
110 with lstate
.FPUState
do
111 if pFloatEdit
.ShowBox(@ST
[Line
], SizeOf(ST
[Line
]), lcheck
) then
114 case FloatType(@ST
[Line
], SizeOf(ST
[Line
])) of
115 -1: SetTag(lstate
, Line
, 2);
116 0: SetTag(lstate
, Line
, 1);
117 1: SetTag(lstate
, Line
, 0);
119 Hardware
.State
:= lstate
;
123 procedure TStackView
.ChangeTag(Line
: Integer);
126 lstate
: THardwareState
;
128 lstate
:= Hardware
.State
;
129 pTagEdit
.Caption
:= FL_EDIT_MODIFY
+ DESC_STACKS
[Line
] + ' Tag';
130 ltag
:= GetTag(lstate
, Line
);
131 if pTagEdit
.ShowBox(ltag
) then
133 SetTag(lstate
, Line
, ltag
);
134 Hardware
.State
:= lstate
;