File: unit26.pas

package info (click to toggle)
dozzaqueux 3.21-4
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 5,140 kB
  • sloc: pascal: 33,352; xml: 961; makefile: 38; sh: 17
file content (250 lines) | stat: -rwxr-xr-x 7,996 bytes parent folder | download
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
unit Unit26;

{$mode objfpc}{$H+}

interface

uses
 Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  StdCtrls, Buttons,Unit2, Grids,math,UChaines,UnitScaleFont,LCLType;

type

  { Tform26 }

  Tform26 = class(TForm)
    BitBtn2: TBitBtn;
    Label1: TLabel;
    Editformulebrute: TEdit;
    BitBtn1: TBitBtn;
    Label2: TLabel;
    sgreactifs: TStringGrid;
    Label3: TLabel;
    procedure BitBtn1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure sgreactifsMouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
  private
    { Dclarations prives }
    encreation:boolean;
  public
    { Dclarations publiques }
  end;

var
  form26: Tform26;
 largeur_col1_reactifs,largeur_col2_reactifs,largeur_col3_reactifs:integer;
 id9:string;
implementation
uses Unit1, Unit3;


procedure Tform26.BitBtn1Click(Sender: TObject);

var toto:tstringlist; i,didi:integer;
begin
 if editformulebrute.Text='' then exit;
toto:=tstringlist.Create;

for i:=1 to nombre_elements_base do
if (pos(lowercase(editformulebrute.Text),lowercase(tableau_elements_base[i-1].identifiant))<>0) or
 (pos(lowercase(editformulebrute.Text),lowercase(tableau_elements_base[i-1].synonyme))<>0)
then toto.Add(tableau_elements_base[i-1].identifiant);

 for i:=1 to nombre_elements_mineraux do
if (pos(lowercase(editformulebrute.Text),lowercase(tableau_elements_mineraux[i-1].identifiant))<>0) or
 (pos(lowercase(editformulebrute.Text),lowercase(tableau_elements_mineraux[i-1].synonyme))<>0)
then toto.Add(tableau_elements_mineraux[i-1].identifiant);

for i:=1 to nombre_elements_aqueux do
if (pos(lowercase(editformulebrute.Text),lowercase(tableau_elements_aqueux[i-1].identifiant))<>0) or
 (pos(lowercase(editformulebrute.Text),lowercase(tableau_elements_aqueux[i-1].synonyme))<>0)
then toto.Add(tableau_elements_aqueux[i-1].identifiant);

for i:=1 to nombre_elements_organiques do
if (pos(lowercase(editformulebrute.Text),lowercase(tableau_elements_organiques[i-1].identifiant))<>0) or
 (pos(lowercase(editformulebrute.Text),lowercase(tableau_elements_organiques[i-1].synonyme))<>0)
then toto.Add(tableau_elements_organiques[i-1].identifiant);


if toto.Count=0 then begin
application.MessageBox(pchar(rsAucuneEspCeA), pchar(rsAttention2), mb_ok);
exit end;

sgreactifs.RowCount:=1+toto.Count;
for i:=1 to toto.Count do  begin
sgreactifs.Cells[0,i]:=toto[i-1];
case DonneNatureReactif(toto[i-1],didi) of
debase: sgreactifs.Cells[2,i]:=floattostr(
tableau_elements_base[didi-1].masse_molaire);
aqueux: sgreactifs.Cells[2,i]:=floattostr(
tableau_elements_aqueux[didi-1].masse_molaire);
gaz: sgreactifs.Cells[2,i]:=floattostr(
tableau_elements_gazeux[didi-1].masse_molaire);
solide: sgreactifs.Cells[2,i]:=floattostr(
tableau_elements_mineraux[didi-1].masse_molaire);
organique: sgreactifs.Cells[2,i]:=floattostr(
tableau_elements_organiques[didi-1].masse_molaire);
end;
case DonneNatureReactif(toto[i-1],didi) of
debase: sgreactifs.Cells[1,i]:=
tableau_elements_base[didi-1].synonyme;
aqueux: sgreactifs.Cells[1,i]:=
tableau_elements_aqueux[didi-1].synonyme;
gaz: sgreactifs.Cells[1,i]:=
tableau_elements_gazeux[didi-1].synonyme;
solide: sgreactifs.Cells[1,i]:=
tableau_elements_mineraux[didi-1].synonyme;
organique: sgreactifs.Cells[1,i]:=
tableau_elements_organiques[didi-1].synonyme;
end;


sgreactifs.AutoSizeColumns;


  end;
toto.Free;


end;

procedure Tform26.FormCreate(Sender: TObject);
begin
 encreation:=true;
id9:='';
sgreactifs.ColCount:=3;
  sgreactifs.RowCount:=2;
  sgreactifs.Cells[0, 0]:=rsIdentifiant;
  sgreactifs.Cells[2, 0]:=rsMGMol;
  sgreactifs.Cells[1, 0]:=rsSynonyme;
     sgreactifs.AutoSizeColumns;
  Caption := rsRechercheDan;
    Label1.Caption := rsEntrezToutOu ;
     Label3.Caption := rsExemplesThan;
      sgreactifs.Hint := rsPourSLection3;
         BitBtn1.Caption := rsOK2 ;







end;

procedure Tform26.FormShow(Sender: TObject);
begin
   if encreation then begin scalefont(self); encreation:=false; end;

end;

procedure Tform26.sgreactifsMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var  i,coco,roro:integer;
deja_entre:boolean;
repmode:integer;
label 555,666;
  begin
sgreactifs.MouseToCell(x,y,coco,roro);
if ((roro>0)   and (roro<=sgreactifs.rowcount-1) and
(coco>=0) and (coco<=sgreactifs.ColCount-1)
and( sgreactifs.Cells[0,roro]<>'') and
(form1.stringgridreactifs_becher.cells[1,1]<>''))  then
begin
deja_entre:=false;
for i:=1 to form1.stringgridreactifs_becher.RowCount-1 do
deja_entre:=deja_entre or
(form1.stringgridreactifs_becher.cells[1,i]=sgreactifs.Cells[0,roro]);
if deja_entre then begin
application.messagebox(pchar(rsVousAvezDJEn), pchar(rsQueNenni),
mb_ok);
exit;
end;
666: saisienombremole:=tsaisienombremole.create(self); 
with saisienombremole
do begin
if screen.width>width then left:=(screen.width-width) div 2 else left:=0;
if screen.height>height then top:=(screen.height-height) div 2 else top:=0;
end;
saisienombremole.Label1.Caption:=Format(rsPourLEspCeVe66, [sgreactifs.Cells[0,
  roro]]);
repmode:=saisienombremole.ShowModal;
if repmode=mrcancel then exit;
if repmode=mrretry then goto 666;
form1.stringgridreactifs_becher.RowCount:=
form1.stringgridreactifs_becher.RowCount+1;
etape:=choisir_becher;
form1.stringgridreactifs_becher.cells[1,form1.stringgridreactifs_becher.RowCount-1]:=
sgreactifs.Cells[0,roro];
form1.stringgridreactifs_becher.cells[0,form1.stringgridreactifs_becher.RowCount-1]:=
rsSupprimer;

if Unit3.nono>0 then
form1.stringgridreactifs_becher.cells[2,form1.stringgridreactifs_becher.RowCount-1]:=
floattostr(Unit3.nono/volume_becher) else
if unit3.mama>0 then
form1.stringgridreactifs_becher.cells[2,form1.stringgridreactifs_becher.RowCount-1]:=
floattostr(unit3.mama/strtofloat(sgreactifs.Cells[2,roro])/
volume_becher)else
 if unit3.nono1>0 then
form1.stringgridreactifs_becher.cells[2,form1.stringgridreactifs_becher.RowCount-1]:=
floattostr(Unit3.nono1) else
 if unit3.mama1>0 then
form1.stringgridreactifs_becher.cells[2,form1.stringgridreactifs_becher.RowCount-1]:=
floattostr(unit3.mama1/strtofloat(sgreactifs.Cells[2,roro]));


  form1.stringgridreactifs_becher.AutoSizeColumns;
 modalresult:=mrok;
close;
end;

if ((roro>0) and (roro<=sgreactifs.rowcount) and
 (sgreactifs.Cells[0,roro]<>'') and
(form1.stringgridreactifs_becher.cells[1,1]=''))  then  begin
555: saisienombremole:=tsaisienombremole.create(self); 
with saisienombremole
do begin
if screen.width>width then left:=(screen.width-width) div 2 else left:=0;
if screen.height>height then top:=(screen.height-height) div 2 else top:=0;
end;
saisienombremole.Label1.Caption:=Format(rsPourLEspCeVe67, [sgreactifs.Cells[0,
  roro]]);
repmode:=saisienombremole.ShowModal;
if repmode=mrcancel then exit;
if repmode=mrretry then goto 555;
form1.stringgridreactifs_becher.cells[1,1]:=
sgreactifs.Cells[0,roro];
form1.stringgridreactifs_becher.cells[0,1]:=
rsSupprimer;
if Unit3.nono>0 then
form1.stringgridreactifs_becher.cells[2,form1.stringgridreactifs_becher.RowCount-1]:=
floattostr(Unit3.nono/volume_becher) else
if unit3.mama>0 then
form1.stringgridreactifs_becher.cells[2,form1.stringgridreactifs_becher.RowCount-1]:=
floattostr(unit3.mama/strtofloat(sgreactifs.Cells[2,roro])/
volume_becher)else
 if unit3.nono1>0 then
form1.stringgridreactifs_becher.cells[2,form1.stringgridreactifs_becher.RowCount-1]:=
floattostr(Unit3.nono1) else
 if unit3.mama1>0 then
form1.stringgridreactifs_becher.cells[2,form1.stringgridreactifs_becher.RowCount-1]:=
floattostr(unit3.mama1/strtofloat(sgreactifs.Cells[2,roro]));



  form1.stringgridreactifs_becher.AutoSizeColumns;

  modalresult:=mrok;
close;
end;


end;
initialization
  {$I unit26.lrs}

end.