repeat last operation when pressing = again

This commit is contained in:
peter 2004-12-06 21:24:53 +00:00
parent cd87bb6665
commit 86861d643a

View File

@ -42,7 +42,9 @@ type
Status: TCalcState; Status: TCalcState;
Number: string[MaxDigits]; Number: string[MaxDigits];
Sign: Char; Sign: Char;
LastOperator,
_Operator: Char; _Operator: Char;
LastR,
Operand: extended; Operand: extended;
Memory: extended; Memory: extended;
DispNumber: extended; DispNumber: extended;
@ -351,10 +353,19 @@ begin
end; end;
'+', '-', '*', '/', '=', '%', #13, '^': '+', '-', '*', '/', '=', '%', #13, '^':
begin begin
if Status = csValid then if (Key[1]='=') and (Status=csFirst) then
begin
Status:=csValid;
R:=LastR;
_Operator:=LastOperator;
end
else
GetDisplay(R);
if (Status = csValid) then
begin begin
Status := csFirst; Status := csFirst;
GetDisplay(R); LastR:=R;
LastOperator:=_Operator;
if Key = '%' then if Key = '%' then
case _Operator of case _Operator of
'+', '-': R := Operand * R / 100; '+', '-': R := Operand * R / 100;
@ -568,7 +579,10 @@ end;
end. end.
{ {
$Log$ $Log$
Revision 1.12 2004-11-08 20:28:25 peter Revision 1.13 2004-12-06 21:24:53 peter
repeat last operation when pressing = again
Revision 1.12 2004/11/08 20:28:25 peter
* Breakpoints are now deleted when removed from source, disabling is * Breakpoints are now deleted when removed from source, disabling is
still possible from the breakpoint list still possible from the breakpoint list
* COMPILER_1_0, FVISION, GABOR defines removed, only support new * COMPILER_1_0, FVISION, GABOR defines removed, only support new