1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
| procedure TFMain.FormClose(Sender: TObject; var Action: TCloseAction);
var
i: integer;
begin
//on sauvegarde les paramètres dasn un fichier xml
XMLdoc.ChildNodes.Clear;
XMLdoc.Version := '1.0';
XMLdoc.Encoding := 'ISO-8859-1';
with XMLdoc.AddChild('MyCalc2') do
begin
with AddChild('Options') do
begin
if Mem = M100 then
AddChild('Storage_registers').Text := 'M100'
else
AddChild('Storage_registers').Text := 'M10';
if Draw = DFix then
AddChild('Number_format').Text := 'Fix'
else if Draw = DSci then
AddChild('Number_format').Text := 'Sci'
else
AddChild('Number_format').Text := 'Eng';
AddChild('Decimals').Text := SysUtils.inttostr(digits);
if Angle = ADegre then
Addchild('Angular_mode').Text := 'Deg'
else if angle = ARadian then
AddChild('Angular_mode').Text := 'Rad'
else
AddChild('Angular_mode').Text := 'Grad';
AddChild('Decimal_separator').Text := decimalSeparator;
Addchild('Digit_group').Text := thousandseparator;
AddChild('Skin_name').Text := skin;
AddChild('Mode').Text := inttostr(ord(Mode));
AddChild('Fn').Text := inttostr(ord(Fn));
end;
decimalseparator:='.';
with AddChild('Memory') do
begin
for i := 0 to 3 do
AddChild('Pile' + SysUtils.inttostr(i)).Text :=
SysUtils.floattostr(Pile[i]);
for i := 0 to 3 do
begin
if PileComplex[i].imaginary < 0 then
AddChild('PileComplex' + SysUtils.inttostr(i)).Text :=
floattostr(PileComplex[i].real) +
floattostr(PileComplex[i].imaginary) + 'i'
else
AddChild('PileComplex' + SysUtils.inttostr(i)).Text :=
floattostr(PileComplex[i].real) + '+' +
floattostr(PileComplex[i].imaginary) + 'i'
end;
for i := 0 to 99 do
AddChild('Mem' + SysUtils.inttostr(i)).Text :=
SysUtils.floattostr(memories[i]);
for i := 0 to 99 do
begin
if memoriescomplex[i].imaginary < 0 then
AddChild('MemComplex' + inttostr(i)).Text :=
floattostr(MemoriesComplex[i].real) +
floattostr(MemoriesComplex[i].imaginary) + 'i'
else
AddChild('MemComplex' + SysUtils.inttostr(i)).Text :=
floattostr(MemoriesComplex[i].real) + '+' +
floattostr(MemoriesComplex[i].imaginary) + 'i'
end;
for i := 1 to 100 do
AddChild('Sec_display' + SysUtils.inttostr(i)).Text := ruban[i];
AddChild('Main_display').Text := EDisplay.Text;
end;
With AddChild('Statistics') do
begin
AddChild('Count').Text := SysUtils.inttostr(StatData.Count);
for i := 0 to StatData.Count - 1 do
begin
AddChild('Data'+inttostr(i)+'X').Text := SysUtils.FloatToStr(Xdata[i]);
AddChild('Data'+inttostr(i)+'Y').Text := SysUtils.FloatToStr(Ydata[i]);
end;
end;
with AddChild('Money_Convertor') do
begin
AddChild('F1From').text := SysUtils.inttostr(Cur1FromIndex);
AddChild('F1To').text := SysUtils.inttostr(Cur1ToIndex);
AddChild('F2From').text := SysUtils.inttostr(Cur2FromIndex);
AddChild('F2To').text := SysUtils.inttostr(Cur2ToIndex);
AddChild('F3From').text := SysUtils.inttostr(Cur3FromIndex);
AddChild('F3To').text := SysUtils.inttostr(Cur3ToIndex);
AddChild('F4From').text := SysUtils.inttostr(Cur4FromIndex);
AddChild('F4To').text := SysUtils.inttostr(Cur4ToIndex);
end;
with AddChild('Custom_Fonction') do
begin
for i := 1 to 36 do
begin
AddChild('Button' + SysUtils.inttostr(i) + 'Caption').Text :=
BCaption[i];
end;
end;
with AddChild('Tracer') do
begin
for i := 0 to 3 do
begin
AddChild('Function' + inttostr(i)).Text := equation[i];
addChild('Color' + inttostr(i)).Text := inttostr(EquationColor[i]);
AddChild('Devirative' + inttostr(i)).Text := derivative[i];
AddChild('EquationCheck' + inttostr(i)).Text :=
booltostr(EquationCheck[i]);
AddChild('DerivativeCheck' + inttostr(i)).Text :=
booltostr(DerivativeCheck[i]);
end;
end;
with AddChild('Timer') do
begin
AddChild('Alarm').Text:=booltostr(Alarm);
AddChild('Alarm_time').Text:=floattostr(AlarmTime);
end;
end;
ForceDirectories(AppDataPath);
XMLdoc.SaveToFile(AppDataPath + 'MyCalc2' + '.xml');
ForceDirectories(AppDataPath + '\Functions\');
//on sauve les fonctions personalisées
for i := 1 to 36 do
begin
if BCode[i] <> nil then
begin
BCode[i].SaveToFile(AppDataPath + '\Functions\' +
'F' + SysUtils.IntToStr(i) + '.txt');
BCode[i].Free;
end;
end;
//on libère les ressources
if assigned(ChronoThread) then
ChronoThread.Terminate;
if assigned(CountDownThread) then
CountDownThread.Terminate;
StatData.Free;
setlength(XData,0);
setlength(YData,0);
setlength(DeltaY,0);
end; |
Partager