root / UFMenu.pas @ 3
Historique | Voir | Annoter | Télécharger (35,615 ko)
1 |
unit UFMenu;
|
---|---|
2 |
|
3 |
{$WARN UNIT_PLATFORM OFF}
|
4 |
|
5 |
interface
|
6 |
|
7 |
uses
|
8 |
Windows, Forms, Classes, Controls, Dialogs, Graphics, StdCtrls, Buttons, |
9 |
ExtCtrls, ComCtrls, Menus, XPMan, IdBaseComponent, IdComponent, |
10 |
IdTCPConnection, IdTCPClient, IdHTTP, IdIOHandler, IdIOHandlerSocket, |
11 |
IdIOHandlerStack, IdSSL, IdSSLOpenSSL; |
12 |
|
13 |
type
|
14 |
TFMenu = class (TForm)
|
15 |
StatusLine : TStatusBar ; |
16 |
IBackground: TImage; |
17 |
MainMenu: TMainMenu; |
18 |
MFile: TMenuItem; |
19 |
MLicense: TMenuItem; |
20 |
MConfig: TMenuItem; |
21 |
MFolder: TMenuItem; |
22 |
N11: TMenuItem; |
23 |
MExit: TMenuItem; |
24 |
MAliments: TMenuItem; |
25 |
MMatiere: TMenuItem; |
26 |
N21: TMenuItem; |
27 |
MAliment: TMenuItem; |
28 |
MTarif: TMenuItem; |
29 |
N22: TMenuItem; |
30 |
MImpExp: TMenuItem; |
31 |
MTruie: TMenuItem; |
32 |
MSeqAliT: TMenuItem; |
33 |
MRationT: TMenuItem; |
34 |
MLogeT: TMenuItem; |
35 |
MProfilT: TMenuItem; |
36 |
N31: TMenuItem; |
37 |
MSimulT: TMenuItem; |
38 |
N32: TMenuItem; |
39 |
MBesGest: TMenuItem; |
40 |
MBesGestT: TMenuItem; |
41 |
MBesGestE: TMenuItem; |
42 |
MBesLact: TMenuItem; |
43 |
MBesLactT: TMenuItem; |
44 |
MBesLactE: TMenuItem; |
45 |
MPorc: TMenuItem; |
46 |
MSeqAliP: TMenuItem; |
47 |
MRationP: TMenuItem; |
48 |
MProfilP: TMenuItem; |
49 |
N41: TMenuItem; |
50 |
MSimulP: TMenuItem; |
51 |
MWindow: TMenuItem; |
52 |
MCascade: TMenuItem; |
53 |
MTileHorizontal: TMenuItem; |
54 |
MTileVertical: TMenuItem; |
55 |
MMinimizeAll: TMenuItem; |
56 |
MRetoreAll: TMenuItem; |
57 |
MArrange: TMenuItem; |
58 |
MHelp: TMenuItem; |
59 |
MContents: TMenuItem; |
60 |
N61: TMenuItem; |
61 |
MIntro: TMenuItem; |
62 |
N62: TMenuItem; |
63 |
MWeb: TMenuItem; |
64 |
MAbout: TMenuItem; |
65 |
ILogo: TImage; |
66 |
XPManifestStyle: TXPManifest; |
67 |
MUpdate: TMenuItem; |
68 |
IdHTTPCheckVersion: TIdHTTP; |
69 |
MDataset: TMenuItem; |
70 |
IdSSL: TIdSSLIOHandlerSocketOpenSSL; |
71 |
procedure FormShow(Sender: TObject);
|
72 |
procedure FormClose(Sender: TObject; var Action: TCloseAction); |
73 |
procedure MConfigClick(Sender: TObject);
|
74 |
procedure MExitClick(Sender: TObject);
|
75 |
procedure MMatiereClick(Sender: TObject);
|
76 |
procedure MAlimentClick(Sender: TObject);
|
77 |
procedure MTarifClick(Sender: TObject);
|
78 |
procedure MImpExpClick(Sender: TObject);
|
79 |
procedure MSeqAliTClick(Sender: TObject);
|
80 |
procedure MRationTClick(Sender: TObject);
|
81 |
procedure MLogeTClick(Sender: TObject);
|
82 |
procedure MProfilTClick(Sender: TObject);
|
83 |
procedure MSimulTClick(Sender: TObject);
|
84 |
procedure MSeqAliPClick(Sender: TObject);
|
85 |
procedure MRationPClick(Sender: TObject);
|
86 |
procedure MProfilPClick(Sender: TObject);
|
87 |
procedure MSimulPClick(Sender: TObject);
|
88 |
procedure WindowCascade(Sender: TObject);
|
89 |
procedure MTileHorizontalClick(Sender: TObject);
|
90 |
procedure MTileVerticalClick(Sender: TObject);
|
91 |
procedure MMinimizeAllClick(Sender: TObject);
|
92 |
procedure MRetoreAllClick(Sender: TObject);
|
93 |
procedure MArrangeClick(Sender: TObject);
|
94 |
procedure HelpContentsClick(Sender: TObject);
|
95 |
procedure HelpIndexClick(Sender: TObject);
|
96 |
procedure MAboutClick(Sender: TObject);
|
97 |
procedure MBesGestTClick(Sender: TObject);
|
98 |
procedure MBesGestEClick(Sender: TObject);
|
99 |
procedure MBesLactTClick(Sender: TObject);
|
100 |
procedure MBesLactEClick(Sender: TObject);
|
101 |
procedure FormResize(Sender: TObject);
|
102 |
procedure MLicenseClick(Sender: TObject);
|
103 |
procedure MFolderClick(Sender: TObject);
|
104 |
procedure MIntroClick(Sender: TObject);
|
105 |
procedure FormCreate(Sender: TObject);
|
106 |
procedure MWebClick(Sender: TObject);
|
107 |
procedure MHelpSearchClick(Sender: TObject);
|
108 |
procedure FormDestroy(Sender: TObject);
|
109 |
procedure MUpdateClick(Sender: TObject);
|
110 |
procedure MDatasetClick(Sender: TObject);
|
111 |
private
|
112 |
{ Private declarations }
|
113 |
procedure VerifyData;
|
114 |
public
|
115 |
{ Public declarations }
|
116 |
end ;
|
117 |
|
118 |
var
|
119 |
FMenu : TFMenu ; |
120 |
|
121 |
implementation
|
122 |
|
123 |
uses
|
124 |
FileCtrl, Math, Messages, ShellAPI, SysUtils, gnugettext, UVariables, |
125 |
UStrings, UInit, UUtil, UFindRec, UFLicense, UFConfig, {UFInraAfz,}
|
126 |
UFMatiere, UFAliment, UFTarif, UFImpExp, UFSeqAliT, UFRationT, UFLogeT, |
127 |
UFProfilT, UFSimulT, UFBesGestT, UFBesGestE, UFBesLactT, UFBesLactE, |
128 |
UFSeqAliP, UFRationP, UFProfilP, UFSimulP, UFIntro, UFAbout, UFError, |
129 |
UFWarning; |
130 |
|
131 |
{$r *.dfm}
|
132 |
|
133 |
var
|
134 |
OldWndProc: Pointer; |
135 |
WndMsg: DWORD; |
136 |
|
137 |
function NewWndProc(WindowHandle: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT stdcall; |
138 |
begin
|
139 |
if Msg = WndMsg
|
140 |
then // Appel par une autre instance : restauration |
141 |
begin
|
142 |
Result := SendMessage(Application.Handle, WM_SYSCOMMAND, SC_RESTORE, 0);
|
143 |
SetForegroundWindow(Application.Handle); |
144 |
Exit; |
145 |
end;
|
146 |
if WParam = VK_F1
|
147 |
then // F1 = Help |
148 |
Result := HtmlHelp(Application.Handle, PChar(Application.CurrentHelpFile), HH_HELP_CONTEXT, FMenu.HelpContext) |
149 |
else
|
150 |
Result := CallWindowProc(OldWndProc, WindowHandle, Msg, WParam, LParam); |
151 |
end;
|
152 |
|
153 |
procedure TFMenu.FormCreate(Sender: TObject);
|
154 |
begin
|
155 |
WndMsg := RegisterWindowMessage('InraPorc');
|
156 |
OldWndProc := Pointer(SetWindowLong(Handle, GWL_WNDPROC, Longint(@NewWndProc))); |
157 |
if Screen.Fonts.IndexOf('Arial Unicode MS') <> -1 |
158 |
then
|
159 |
begin
|
160 |
Font.Name := 'Arial Unicode MS';
|
161 |
StatusLine.Font.Name := 'Arial Unicode MS';
|
162 |
end;
|
163 |
TranslateComponent(Self); |
164 |
Constraints.MinHeight := Min(768, Screen.WorkAreaHeight);
|
165 |
Constraints.MinWidth := Min(1024, Screen.WorkAreaWidth);
|
166 |
end;
|
167 |
|
168 |
procedure TFMenu.FormDestroy(Sender: TObject);
|
169 |
begin
|
170 |
SetWindowLong(Handle, GWL_WNDPROC, Longint(OldWndProc)); |
171 |
end;
|
172 |
|
173 |
procedure TFMenu.FormShow(Sender: TObject);
|
174 |
var
|
175 |
CurrentVersion: string;
|
176 |
begin
|
177 |
// Recherche automatique de mises-?-jours
|
178 |
if CheckForUpdates then |
179 |
begin
|
180 |
IdHTTPCheckVersion.ConnectTimeout := 10000;
|
181 |
try
|
182 |
CurrentVersion := IdHTTPCheckVersion.Get(URL_HTTPS + 'CheckVersion.php');
|
183 |
if Length(CurrentVersion) = 7 then |
184 |
if CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, PChar(CurrentVersion), Length(CurrentVersion), PChar(VersionString), Length(VersionString)) = CSTR_GREATER_THAN then |
185 |
begin
|
186 |
if Copy(LanguageCode, 1, 2) = 'fr' |
187 |
then // Fran?ais |
188 |
ShellExecute(Handle, 'open', PChar(URL_HTTPS + 'history_fr.php'), nil, nil, SW_SHOWNORMAL) |
189 |
else // Anglais |
190 |
ShellExecute(Handle, 'open', PChar(URL_HTTPS + 'history_en.php'), nil, nil, SW_SHOWNORMAL); |
191 |
if MessageDlg(Format(MsgUpdateFound, [CurrentVersion]), mtConfirmation, [mbYes, mbNo], 0) = mrYes then |
192 |
ShellExecute(Handle, 'open', PChar(URL_HTTPS + Format('Downloads/%s/InraPorcSetup.exe', [CurrentVersion])), nil, nil, SW_SHOWNORMAL); |
193 |
end;
|
194 |
except
|
195 |
end;
|
196 |
end;
|
197 |
// Initialisation du contr?le des fen?tres MDI
|
198 |
NumWinMatiere := -1;
|
199 |
NumWinAliment := -1;
|
200 |
NumWinTarif := -1;
|
201 |
NumWinImpExp := -1;
|
202 |
NumWinSeqAliT := -1;
|
203 |
NumWinRationT := -1;
|
204 |
NumWinLogeT := -1;
|
205 |
NumWinProfilT := -1;
|
206 |
NumWinSimulT := -1;
|
207 |
NumWinBesGestT := -1;
|
208 |
NumWinBesGestE := -1;
|
209 |
NumWinBesLactT := -1;
|
210 |
NumWinBesLactE := -1;
|
211 |
NumWinSeqAliP := -1;
|
212 |
NumWinRationP := -1;
|
213 |
NumWinProfilP := -1;
|
214 |
NumWinSimulP := -1;
|
215 |
// Taille et position de la fen?tre principale
|
216 |
SetBounds(MainLeft, MainTop, MainWidth, MainHeight); |
217 |
FormResize(nil);
|
218 |
if FileExists(Logo)
|
219 |
then
|
220 |
ILogo.Picture.LoadFromFile(Logo); |
221 |
if DataFolderExists
|
222 |
then
|
223 |
VerifyData |
224 |
else
|
225 |
begin
|
226 |
MAliments.Enabled := False; |
227 |
MTruie.Enabled := False; |
228 |
MPorc.Enabled := False; |
229 |
end;
|
230 |
end;
|
231 |
|
232 |
procedure TFMenu.FormClose(Sender: TObject; var Action: TCloseAction); |
233 |
var
|
234 |
i: Integer; |
235 |
begin
|
236 |
if MDIChildCount > 0 |
237 |
then
|
238 |
for i := MDIChildCount - 1 downto 0 do |
239 |
MDIChildren[i].Close; |
240 |
FreeData ; |
241 |
// FreeLicense;
|
242 |
// FreeRegistry;
|
243 |
end;
|
244 |
|
245 |
procedure TFMenu.FormResize(Sender: TObject);
|
246 |
var
|
247 |
{BorderSize,} TextSize: Integer;
|
248 |
begin
|
249 |
MImpExp.Enabled := IsComplete ; |
250 |
// Licence
|
251 |
if IsEducation and (Length (Course) > 0) |
252 |
then
|
253 |
StatusLine.Panels[1].Text := Format('%s (%s)', [Course, Company]) |
254 |
else
|
255 |
if IsComplete or IsEducation |
256 |
then
|
257 |
StatusLine.Panels[1].Text := Format('%s %s (%s)', [FirstName, LastName, Company]) |
258 |
else
|
259 |
if IsEvaluation
|
260 |
then
|
261 |
StatusLine.Panels[1].Text := StrEvaluation
|
262 |
else
|
263 |
StatusLine.Panels[1].Text := StrReadOnly;
|
264 |
// BorderSize := Width - ClientWidth;
|
265 |
TextSize := StatusLine.Canvas.TextWidth(StatusLine.Panels[1].Text);
|
266 |
with StatusLine do |
267 |
Panels[0].Width := ClientWidth - TextSize - 24; |
268 |
end;
|
269 |
|
270 |
procedure TFMenu.VerifyData;
|
271 |
const
|
272 |
SEP = ' ';
|
273 |
var
|
274 |
i, j, ErrorCount: Integer; |
275 |
ErrorInraAfz, ok: Boolean; |
276 |
begin
|
277 |
if (not FileExists(NFicRationP) and FileExists(NFicRationPold)) |
278 |
or (not FileExists(NFicProfilP) and FileExists(NFicProfilPold)) |
279 |
then // L'ancien jeu de donn?es n'a pas ?t? converti |
280 |
Exit; |
281 |
ErrorCount := 0;
|
282 |
ErrorInraAfz := FALSE; |
283 |
FError := TFError.Create(Self); |
284 |
FError.MErrors.Lines.Add(MAliments.Caption); |
285 |
// Mati?re premi?re
|
286 |
FError.MErrors.Lines.Add(SEP + MMatiere.Caption); |
287 |
if not FileExists(NFicMatInraAfz) |
288 |
then
|
289 |
FError.MErrors.Lines.Add(SEP + SEP + Format(MsgFileNotFound, [NFicMatInraAfz])); |
290 |
if not FileExists(NFicMatiere) |
291 |
then
|
292 |
begin
|
293 |
Inc(ErrorCount); |
294 |
FError.MErrors.Lines.Add(SEP + SEP + Format(MsgFileNotFound, [NFicMatiere])); |
295 |
end;
|
296 |
// Aliment
|
297 |
FError.MErrors.Lines.Add(SEP + MAliment.Caption); |
298 |
if not FileExists(NFicAliment) |
299 |
then
|
300 |
begin
|
301 |
Inc(ErrorCount); |
302 |
FError.MErrors.Lines.Add(SEP + SEP + Format(MsgFileNotFound, [NFicAliment])); |
303 |
end;
|
304 |
if ListAliment.Count > 0 |
305 |
then
|
306 |
for i := 0 to ListAliment.Count - 1 do |
307 |
begin
|
308 |
PAliment := ListAliment[i]; |
309 |
if (PAliment.MP.NbMat < 0) or (PAliment.MP.NbMat > MAX_MP) |
310 |
then // Bug lors de l'importation (correction du 1/3/2007) |
311 |
PAliment.MP.NbMat := 0;
|
312 |
if PAliment.MP.NbMat > 0 |
313 |
then
|
314 |
for j := 0 to PAliment.MP.NbMat - 1 do |
315 |
if (PAliment.MP.NumMat[j] <> 0) and not MatiereFound(PAliment.MP.NumMat[j]) |
316 |
then
|
317 |
begin
|
318 |
Inc(ErrorCount); |
319 |
if PAliment.MP.NumMat[j] < 0 |
320 |
then
|
321 |
ErrorInraAfz := TRUE; |
322 |
FError.MErrors.Lines.Add(SEP + SEP + Format('%s - %s %d', [PAliment.Nom, MMatiere.Caption, PAliment.MP.NumMat[j]]));
|
323 |
PAliment.MP.NumMat[j] := 0;
|
324 |
end;
|
325 |
end;
|
326 |
FError.MErrors.Lines.Add(MTruie.Caption); |
327 |
// S?quence alimentaire truie
|
328 |
FError.MErrors.Lines.Add(SEP + MSeqAliT.Caption); |
329 |
if not FileExists(NFicSeqAliT) |
330 |
then
|
331 |
begin
|
332 |
Inc(ErrorCount); |
333 |
FError.MErrors.Lines.Add(SEP + SEP + Format(MsgFileNotFound, [NFicSeqAliT])); |
334 |
end;
|
335 |
if ListSeqAliT.Count > 0 |
336 |
then
|
337 |
for i := 0 to ListSeqAliT.Count - 1 do |
338 |
begin
|
339 |
PSeqAliT := ListSeqAliT[i]; |
340 |
for j := 1 to PSeqAliT.NbRuleGest do |
341 |
begin
|
342 |
if (PSeqAliT.RuleGest[j].NumAli1 <> -1) and not AlimentFound(PSeqAliT.RuleGest[j].NumAli1) |
343 |
then
|
344 |
begin
|
345 |
Inc(ErrorCount); |
346 |
FError.MErrors.Lines.Add(SEP + SEP + Format('%s - %s %d', [PSeqAliT.Nom, MAliment.Caption, PSeqAliT.RuleGest[j].NumAli1]));
|
347 |
PSeqAliT.RuleGest[j].NumAli1 := -1;
|
348 |
end;
|
349 |
if (PSeqAliT.RuleGest[j].NumAli2 <> -1) and not AlimentFound(PSeqAliT.RuleGest[j].NumAli2) |
350 |
then
|
351 |
begin
|
352 |
Inc(ErrorCount); |
353 |
FError.MErrors.Lines.Add(SEP + SEP + Format('%s - %s %d', [PSeqAliT.Nom, MAliment.Caption, PSeqAliT.RuleGest[j].NumAli2]));
|
354 |
PSeqAliT.RuleGest[j].NumAli2 := -1;
|
355 |
end;
|
356 |
end;
|
357 |
for j := 1 to PSeqAliT.NbRuleLact do |
358 |
begin
|
359 |
if (PSeqAliT.RuleLact[j].NumAli1 <> -1) and not AlimentFound(PSeqAliT.RuleLact[j].NumAli1) |
360 |
then
|
361 |
begin
|
362 |
Inc(ErrorCount); |
363 |
FError.MErrors.Lines.Add(SEP + SEP + Format('%s - %s %d', [PSeqAliT.Nom, MAliment.Caption, PSeqAliT.RuleLact[j].NumAli1]));
|
364 |
PSeqAliT.RuleLact[j].NumAli1 := -1;
|
365 |
end;
|
366 |
if (PSeqAliT.RuleLact[j].NumAli2 <> -1) and not AlimentFound(PSeqAliT.RuleLact[j].NumAli2) |
367 |
then
|
368 |
begin
|
369 |
Inc(ErrorCount); |
370 |
FError.MErrors.Lines.Add(SEP + SEP + Format('%s - %s %d', [PSeqAliT.Nom, MAliment.Caption, PSeqAliT.RuleLact[j].NumAli2]));
|
371 |
PSeqAliT.RuleLact[j].NumAli2 := -1;
|
372 |
end;
|
373 |
end;
|
374 |
for j := 1 to PSeqAliT.NbRuleISSF do |
375 |
begin
|
376 |
if (PSeqAliT.RuleISSF[j].NumAli1 <> -1) and not AlimentFound(PSeqAliT.RuleISSF[j].NumAli1) |
377 |
then
|
378 |
begin
|
379 |
Inc(ErrorCount); |
380 |
FError.MErrors.Lines.Add(SEP + SEP + Format('%s - %s %d', [PSeqAliT.Nom, MAliment.Caption, PSeqAliT.RuleISSF[j].NumAli1]));
|
381 |
PSeqAliT.RuleISSF[j].NumAli1 := -1;
|
382 |
end;
|
383 |
if (PSeqAliT.RuleISSF[j].NumAli2 <> -1) and not AlimentFound(PSeqAliT.RuleISSF[j].NumAli2) |
384 |
then
|
385 |
begin
|
386 |
Inc(ErrorCount); |
387 |
FError.MErrors.Lines.Add(SEP + SEP + Format('%s - %s %d', [PSeqAliT.Nom, MAliment.Caption, PSeqAliT.RuleISSF[j].NumAli2]));
|
388 |
PSeqAliT.RuleISSF[j].NumAli2 := -1;
|
389 |
end;
|
390 |
end;
|
391 |
end;
|
392 |
// Plan de rationnement truie
|
393 |
FError.MErrors.Lines.Add(SEP + MRationT.Caption); |
394 |
if not FileExists(NFicRationT) |
395 |
then
|
396 |
begin
|
397 |
Inc(ErrorCount); |
398 |
FError.MErrors.Lines.Add(SEP + SEP + Format(MsgFileNotFound, [NFicRationT])); |
399 |
end;
|
400 |
// Logement truie
|
401 |
FError.MErrors.Lines.Add(SEP + MLogeT.Caption); |
402 |
if not FileExists(NFicLogeT) |
403 |
then
|
404 |
begin
|
405 |
Inc(ErrorCount); |
406 |
FError.MErrors.Lines.Add(SEP + SEP + Format(MsgFileNotFound, [NFicLogeT])); |
407 |
end;
|
408 |
// Profil truie
|
409 |
FError.MErrors.Lines.Add(SEP + MProfilT.Caption); |
410 |
if not FileExists(NFicProfilT) |
411 |
then
|
412 |
begin
|
413 |
Inc(ErrorCount); |
414 |
FError.MErrors.Lines.Add(SEP + SEP + Format(MsgFileNotFound, [NFicProfilT])); |
415 |
end;
|
416 |
if ListProfilT.Count > 0 |
417 |
then
|
418 |
for i := 0 to ListProfilT.Count - 1 do |
419 |
begin
|
420 |
PProfilT := ListProfilT[i]; |
421 |
if (PProfilT.SeqAli <> -1) and not SeqAliTFound(PProfilT.SeqAli) |
422 |
then
|
423 |
begin
|
424 |
Inc(ErrorCount); |
425 |
FError.MErrors.Lines.Add(SEP + SEP + Format('%s - %s %d', [PProfilT.Nom, MSeqAliT.Caption, PProfilT.SeqAli]));
|
426 |
PProfilT.SeqAli := -1;
|
427 |
end;
|
428 |
if (PProfilT.Loge <> -1) and not LogeTFound(PProfilT.Loge) |
429 |
then
|
430 |
begin
|
431 |
Inc(ErrorCount); |
432 |
FError.MErrors.Lines.Add(SEP + SEP + Format('%s - %s %d', [PProfilT.Nom, MLogeT.Caption, PProfilT.Loge]));
|
433 |
PProfilT.Loge := -1;
|
434 |
end;
|
435 |
end ;
|
436 |
// Simulation truie
|
437 |
FError.MErrors.Lines.Add(SEP + MSimulT.Caption); |
438 |
if not FileExists(NFicSimulT) |
439 |
then
|
440 |
begin
|
441 |
Inc(ErrorCount); |
442 |
FError.MErrors.Lines.Add(SEP + SEP + Format(MsgFileNotFound, [NFicSimulT])); |
443 |
end;
|
444 |
if ListSimulT.Count > 0 |
445 |
then
|
446 |
for i := 0 to ListSimulT.Count - 1 do |
447 |
begin
|
448 |
PSimulT := ListSimulT[i]; |
449 |
if (PSimulT.Profil <> -1) and not ProfilTFound(PSimulT.Profil) |
450 |
then
|
451 |
begin
|
452 |
Inc(ErrorCount); |
453 |
FError.MErrors.Lines.Add(SEP + SEP + Format('%s - %s %d', [PSimulT.Nom, MProfilT.Caption, PSimulT.Profil]));
|
454 |
PSimulT.Profil := -1;
|
455 |
end;
|
456 |
if (PSimulT.Logement <> -1) and not LogeTFound(PSimulT.Logement) |
457 |
then
|
458 |
begin
|
459 |
Inc(ErrorCount); |
460 |
FError.MErrors.Lines.Add(SEP + SEP + Format('%s - %s %d', [PSimulT.Nom, MLogeT.Caption, PSimulT.Logement]));
|
461 |
PSimulT.Logement := -1;
|
462 |
end;
|
463 |
for j := 1 to NB_CYCLES do |
464 |
if (PSimulT.SeqAli[j] <> -1) and not SeqAliTFound(PSimulT.SeqAli[j]) |
465 |
then
|
466 |
if (j < PSimulT.StadeInit div 3) or (j > PSimulT.StadeFin div 3) |
467 |
then // Port?e masqu?e => correction silencieuse |
468 |
PSimulT.SeqAli[j] := -1
|
469 |
else
|
470 |
begin
|
471 |
Inc(ErrorCount); |
472 |
FError.MErrors.Lines.Add(SEP + SEP + Format('%s - %s %d', [PSimulT.Nom, MSeqAliT.Caption, PSimulT.SeqAli[j]]));
|
473 |
PSimulT.SeqAli[j] := -1;
|
474 |
end;
|
475 |
for j := 1 to NB_CYCLES do |
476 |
if (PSimulT.Ration[j] <> -1) and not RationTFound(PSimulT.Ration[j]) |
477 |
then
|
478 |
if (j < PSimulT.StadeInit div 3) or (j > PSimulT.StadeFin div 3) |
479 |
then // Port?e masqu?e => correction silencieuse |
480 |
PSimulT.Ration[j] := -1
|
481 |
else
|
482 |
begin
|
483 |
Inc(ErrorCount); |
484 |
FError.MErrors.Lines.Add(SEP + SEP + Format('%s - %s %d', [PSimulT.Nom, MRationT.Caption, PSimulT.Ration[j]]));
|
485 |
PSimulT.Ration[j] := -1;
|
486 |
end;
|
487 |
end ;
|
488 |
FError.MErrors.Lines.Add(MPorc.Caption); |
489 |
// S?quence alimentaire porc
|
490 |
FError.MErrors.Lines.Add(SEP + MSeqAliP.Caption); |
491 |
if not FileExists(NFicSeqAliP) |
492 |
then
|
493 |
begin
|
494 |
Inc(ErrorCount); |
495 |
FError.MErrors.Lines.Add(SEP + SEP + Format(MsgFileNotFound, [NFicSeqAliP])); |
496 |
end;
|
497 |
if ListSeqAliP.Count > 0 |
498 |
then
|
499 |
for i := 0 to ListSeqAliP.Count - 1 do |
500 |
begin
|
501 |
PSeqAliP := ListSeqAliP[i]; |
502 |
for j := 1 to PSeqAliP.NbRule do |
503 |
begin
|
504 |
if (PSeqAliP.Rule[j].NumAli1 <> -1) and not AlimentFound(PSeqAliP.Rule[j].NumAli1) |
505 |
then
|
506 |
begin
|
507 |
Inc(ErrorCount); |
508 |
FError.MErrors.Lines.Add(SEP + SEP + Format('%s - %s %d', [PSeqAliP.Nom, MAliment.Caption, PSeqAliP.Rule[j].NumAli1]));
|
509 |
PSeqAliP.Rule[j].NumAli1 := -1;
|
510 |
end;
|
511 |
if (PSeqAliP.Rule[j].NumAli2 <> -1) and not AlimentFound(PSeqAliP.Rule[j].NumAli2) |
512 |
then
|
513 |
begin
|
514 |
Inc(ErrorCount); |
515 |
FError.MErrors.Lines.Add(SEP + SEP + Format('%s - %s %d', [PSeqAliP.Nom, MAliment.Caption, PSeqAliP.Rule[j].NumAli2]));
|
516 |
PSeqAliP.Rule[j].NumAli2 := -1;
|
517 |
end;
|
518 |
end;
|
519 |
end;
|
520 |
// Plan de rationnement porc
|
521 |
FError.MErrors.Lines.Add(SEP + MRationP.Caption); |
522 |
if not FileExists(NFicRationP) |
523 |
then
|
524 |
begin
|
525 |
Inc(ErrorCount); |
526 |
FError.MErrors.Lines.Add(SEP + SEP + Format(MsgFileNotFound, [NFicRationP])); |
527 |
end;
|
528 |
// Profil porc
|
529 |
FError.MErrors.Lines.Add(SEP + MProfilP.Caption); |
530 |
if not FileExists(NFicProfilP) |
531 |
then
|
532 |
begin
|
533 |
Inc(ErrorCount); |
534 |
FError.MErrors.Lines.Add(SEP + SEP + Format(MsgFileNotFound, [NFicProfilP])); |
535 |
end;
|
536 |
if ListProfilP.Count > 0 |
537 |
then
|
538 |
for i := 0 to ListProfilP.Count - 1 do |
539 |
begin
|
540 |
PProfilP := ListProfilP[i]; |
541 |
if (PProfilP.SeqAli <> -1) and not SeqAliPFound(PProfilP.SeqAli) |
542 |
then
|
543 |
begin
|
544 |
Inc(ErrorCount); |
545 |
FError.MErrors.Lines.Add(SEP + SEP + Format('%s - %s %d', [PProfilP.Nom, MSeqAliP.Caption, PProfilP.SeqAli]));
|
546 |
PProfilP.SeqAli := -1;
|
547 |
end;
|
548 |
end ;
|
549 |
// Simulation porc
|
550 |
FError.MErrors.Lines.Add(SEP + MSimulP.Caption); |
551 |
if not FileExists(NFicSimulP) |
552 |
then
|
553 |
begin
|
554 |
Inc(ErrorCount); |
555 |
FError.MErrors.Lines.Add(SEP + SEP + Format(MsgFileNotFound, [NFicSimulP])); |
556 |
end;
|
557 |
if ListSimulP.Count > 0 |
558 |
then
|
559 |
for i := 0 to ListSimulP.Count - 1 do |
560 |
begin
|
561 |
PSimulP := ListSimulP[i]; |
562 |
if (PSimulP.Profil <> -1) and not ProfilPFound(PSimulP.Profil) |
563 |
then
|
564 |
begin
|
565 |
Inc(ErrorCount); |
566 |
FError.MErrors.Lines.Add(SEP + SEP + Format('%s - %s %d', [PSimulP.Nom, MProfilP.Caption, PSimulP.Profil]));
|
567 |
PSimulP.Profil := -1;
|
568 |
end;
|
569 |
if (PSimulP.SeqAli <> -1) and not SeqAliPFound(PSimulP.SeqAli) |
570 |
then
|
571 |
begin
|
572 |
Inc(ErrorCount); |
573 |
FError.MErrors.Lines.Add(SEP + SEP + Format('%s - %s %d', [PSimulP.Nom, MSeqAliP.Caption, PSimulP.SeqAli]));
|
574 |
PSimulP.SeqAli := -1;
|
575 |
end;
|
576 |
if (PSimulP.Ration <> -1) and not RationPFound(PSimulP.Ration) |
577 |
then
|
578 |
begin
|
579 |
Inc(ErrorCount); |
580 |
FError.MErrors.Lines.Add(SEP + SEP + Format('%s - %s %d', [PSimulP.Nom, MRationP.Caption, PSimulP.Ration]));
|
581 |
PSimulP.Ration := -1;
|
582 |
end;
|
583 |
end ;
|
584 |
// Traitement des erreurs
|
585 |
ok := ErrorCount = 0;
|
586 |
if not ok |
587 |
then
|
588 |
if ErrorInraAfz
|
589 |
then
|
590 |
begin
|
591 |
FWarning := TFWarning.Create (Self) ; |
592 |
with FWarning do |
593 |
begin
|
594 |
Msg := 'InraAfz';
|
595 |
CBDisplay.Visible := FALSE; |
596 |
ShowModal; |
597 |
Release; |
598 |
end;
|
599 |
end
|
600 |
else
|
601 |
ok := FError.ShowModal = mrYes; |
602 |
MAliments.Enabled := ok; |
603 |
MTruie.Enabled := ok; |
604 |
MPorc.Enabled := ok; |
605 |
end;
|
606 |
|
607 |
// "Menu Fichier"
|
608 |
|
609 |
procedure TFMenu.MLicenseClick(Sender: TObject);
|
610 |
begin
|
611 |
FLicense := TFLicense.Create(Self); |
612 |
FLicense.ShowModal; |
613 |
FLicense.Release; |
614 |
// Adaptation taille StatusLine
|
615 |
FormResize(nil);
|
616 |
end;
|
617 |
|
618 |
procedure TFMenu.MConfigClick(Sender: TObject);
|
619 |
var
|
620 |
i, typ, mat, typmat, typali: Integer; |
621 |
// rec: PRecMatiere;
|
622 |
FileName: String;
|
623 |
begin
|
624 |
FConfig := TFConfig.Create(Self); |
625 |
if FConfig.ShowModal <> mrOK
|
626 |
then // chargement de la configuration |
627 |
LoadConfig |
628 |
else
|
629 |
if ConfigChanged
|
630 |
then
|
631 |
begin
|
632 |
if NewFolder <> Folder
|
633 |
then // Changement du dossier de donn?es par d?faut |
634 |
begin
|
635 |
Folder := NewFolder; |
636 |
// Fermeture de toutes les fen?tres enfants
|
637 |
if MDIChildCount > 0 |
638 |
then
|
639 |
for i := MDIChildCount - 1 downto 0 do |
640 |
MDIChildren[i].Close; |
641 |
// Changement de r?pertoire
|
642 |
SetCurrentDir(Folder); |
643 |
// Rechargement des donn?es
|
644 |
LoadData; |
645 |
VerifyData; |
646 |
if ((LicenseType = 0) or (LicenseType = 1)) and TooMuchRecords |
647 |
then // Trop d'enregistrements |
648 |
MessageDlg(MsgTooMuchRecords, mtWarning, [mbOk], 0);
|
649 |
// Adaptation taille StatusLine
|
650 |
FormResize(nil);
|
651 |
end;
|
652 |
if NewLogo <> Logo
|
653 |
then // Changement du logo |
654 |
begin
|
655 |
Logo := NewLogo; |
656 |
if FileExists(Logo)
|
657 |
then
|
658 |
ILogo.Picture.LoadFromFile(Logo) |
659 |
else
|
660 |
ILogo.Picture.LoadFromFile('');
|
661 |
InvalidateRect(ClientHandle, nil, TRUE);
|
662 |
end;
|
663 |
{
|
664 |
if NewLanguageExt <> LanguageExt
|
665 |
then // Changement de la langue
|
666 |
begin
|
667 |
LanguageExt := NewLanguageExt;
|
668 |
MessageDlg(MsgLang, mtWarning, [mbOk], 0);
|
669 |
end;
|
670 |
}
|
671 |
if NewLanguageCode <> LanguageCode
|
672 |
then // Changement de la langue |
673 |
begin
|
674 |
mat := -1;
|
675 |
typ := -1;
|
676 |
typmat := -1;
|
677 |
typali := -1;
|
678 |
if NumWinMatiere <> -1 |
679 |
then // Composition mati?re premi?re |
680 |
if FMatiere.CBMatiere.ItemIndex <> -1 |
681 |
then // Sauvegarder la position courante |
682 |
mat := FindNumMatiere(FMatiere.CBMatiere.Text); |
683 |
if NumWinAliment <> -1 |
684 |
then // Composition aliment |
685 |
typ := FAliment.CBType.ItemIndex; |
686 |
if NumWinImpExp <> -1 |
687 |
then // Import / export |
688 |
begin
|
689 |
typmat := FImpExp.CBTypeMat.ItemIndex; |
690 |
typali := FImpExp.CBTypeAli.ItemIndex; |
691 |
end;
|
692 |
LanguageCode := NewLanguageCode; |
693 |
UseLanguage(LanguageCode); |
694 |
RetranslateComponent(Self); |
695 |
if MDIChildCount > 0 |
696 |
then // Traduction des fen?tres MDI ouvertes |
697 |
for i := MDIChildCount - 1 downto 0 do |
698 |
RetranslateComponent(MDIChildren[i]); |
699 |
// R?affichage des enregistrements pour prendre en compte la traduction
|
700 |
if NumWinMatiere <> -1 |
701 |
then // Composition mati?re premi?re |
702 |
begin
|
703 |
StringsMatiere(FMatiere.CBMatiere.Items, 0, TRUE, TRUE);
|
704 |
if mat <> -1 |
705 |
then // Res?lectionner l'enregistrement courant |
706 |
FMatiere.CBMatiere.ItemIndex := FMatiere.CBMatiere.Items.IndexOf(FindNomMatiere(mat)); |
707 |
FMatiere.CBMatiereChange(nil);
|
708 |
end;
|
709 |
if NumWinAliment <> -1 |
710 |
then // Composition aliment |
711 |
begin
|
712 |
FAliment.CBType.ItemIndex := typ; |
713 |
FAliment.CBTypeChange(nil);
|
714 |
FAliment.CBAlimentChange(nil);
|
715 |
end;
|
716 |
if NumWinImpExp <> -1 |
717 |
then // Import / export |
718 |
begin
|
719 |
FImpExp.CBTypeMat.ItemIndex := typmat; |
720 |
FImpExp.CBTypeMatChange(nil);
|
721 |
FImpExp.CBTypeAli.ItemIndex := typali; |
722 |
FImpExp.CBTypeAliChange(nil);
|
723 |
end;
|
724 |
if NumWinSeqAliT <> -1 |
725 |
then // S?quence alimentaire truie |
726 |
FSeqAliT.CBSeqAliChange(nil);
|
727 |
if NumWinRationT <> -1 |
728 |
then // Plan de rationnement truie |
729 |
FRationT.CBRationChange(nil);
|
730 |
if NumWinLogeT <> -1 |
731 |
then // Logement truie |
732 |
FLogeT.CBLogeChange(nil);
|
733 |
if NumWinProfilT <> -1 |
734 |
then // Profil truie |
735 |
FProfilT.CBProfilChange(nil);
|
736 |
if NumWinSimulT <> -1 |
737 |
then // Simulation truie |
738 |
FSimulT.CBSimulChange(nil);
|
739 |
{
|
740 |
if NumWinBesGestT <> -1
|
741 |
then // Besoin gestation truie
|
742 |
begin
|
743 |
FBesGestT.CBLoge.Clear;
|
744 |
FBesGestT.CBLoge.Items.Add(StrSaisieManuelle);
|
745 |
if ListLogeT.Count > 0
|
746 |
then
|
747 |
for i := 0 to ListLogeT.Count - 1 do
|
748 |
begin
|
749 |
PLogeT := ListLogeT[i];
|
750 |
if LogeTValid(PLogeT)
|
751 |
then
|
752 |
FBesGestT.CBLoge.Items.Add(PLogeT.Nom);
|
753 |
end;
|
754 |
FBesGestT.CBLoge.ItemIndex := 0;
|
755 |
FBesGestT.CBLogeChange(nil);
|
756 |
FBesGestT.CBProfilChange(nil);
|
757 |
end;
|
758 |
if NumWinBesGestE <> -1
|
759 |
then // Besoin gestation ?levage
|
760 |
FBesGestE.CBProfilChange(nil);
|
761 |
if NumWinBesLactT <> -1
|
762 |
then // Besoin lactation truie
|
763 |
FBesLactT.CBProfilChange(nil);
|
764 |
if NumWinBesLactE <> -1
|
765 |
then // Besoin lactation ?levage
|
766 |
FBesLactE.CBProfilChange(nil);
|
767 |
}
|
768 |
if NumWinSeqAliP <> -1 |
769 |
then // S?quence alimentaire porc |
770 |
FSeqAliP.CBSeqAliChange(nil);
|
771 |
if NumWinRationP <> -1 |
772 |
then // Plan de rationnement porc |
773 |
FRationP.CBRationChange(nil);
|
774 |
if NumWinProfilP <> -1 |
775 |
then // Profil porc |
776 |
FProfilP.CBProfilChange(nil);
|
777 |
if NumWinSimulP <> -1 |
778 |
then // Simulation porc |
779 |
FSimulP.CBSimulChange(nil);
|
780 |
FormResize(nil);
|
781 |
// Aide
|
782 |
if Copy(LanguageCode, 1, 2) = 'fr' |
783 |
then // Fran?ais |
784 |
FileName := ChangeFileExt(Application.ExeName, '_fr.chm')
|
785 |
else // Anglais |
786 |
FileName := ChangeFileExt(Application.ExeName, '_en.chm');
|
787 |
if FileExists(FileName)
|
788 |
then
|
789 |
Application.HelpFile := FileName; |
790 |
end;
|
791 |
SaveConfig; |
792 |
if NumWinMatiere <> -1 |
793 |
then // Composition mati?re premi?re : Mode d'expression |
794 |
begin
|
795 |
FMatiere.AjustCaption; |
796 |
FMatiere.AjustDecimals; |
797 |
FMatiere.IdxMatiere := -1; // Eviter la sauvegarde automatique |
798 |
FMatiere.CBMatiereChange(nil); // R?afficher l'enregistrement |
799 |
end ;
|
800 |
if NumWinAliment <> -1 |
801 |
then // Composition aliment : Mode d'expression |
802 |
begin
|
803 |
FAliment.AjustCaption; |
804 |
FAliment.AjustDecimals; |
805 |
FAliment.IdxAliment := -1; // Eviter la sauvegarde automatique |
806 |
FAliment.CBAlimentChange(nil); // R?afficher l'enregistrement |
807 |
end ;
|
808 |
if NumWinProfilP <> -1 |
809 |
then // ProfilP : Caract?ristiques de la carcasse |
810 |
FProfilP.PCChange(nil); // Recalculer les simulations |
811 |
if NumWinImpExp <> -1 |
812 |
then // Import / Export : Mode d'expression |
813 |
FImpExp.DisplayConfig; |
814 |
end;
|
815 |
FConfig.Release; |
816 |
end;
|
817 |
|
818 |
procedure TFMenu.MDatasetClick(Sender: TObject);
|
819 |
var
|
820 |
FileName: String;
|
821 |
begin
|
822 |
FileName := ExtractFilePath(Application.ExeName) + 'InstData.exe';
|
823 |
if FileExists(FileName)
|
824 |
then
|
825 |
ShellExecute(Handle, 'open', PChar(FileName), nil, nil, SW_SHOWNORMAL); |
826 |
end;
|
827 |
|
828 |
procedure TFMenu.MFolderClick(Sender: TObject);
|
829 |
var
|
830 |
i: Integer; |
831 |
NewDir: String;
|
832 |
begin
|
833 |
// Fermeture de toutes les fen?tres enfants
|
834 |
if MDIChildCount > 0 |
835 |
then
|
836 |
for i := MDIChildCount - 1 downto 0 do |
837 |
MDIChildren[i].Close; |
838 |
// Changement de r?pertoire
|
839 |
NewDir := GetCurrentDir; |
840 |
if SelectDirectory(StrSelectDir, '', NewDir) |
841 |
and DirectoryExists(NewDir)
|
842 |
and (NewDir <> GetCurrentDir)
|
843 |
then
|
844 |
begin
|
845 |
SetCurrentDir(NewDir); |
846 |
// Rechargement des donn?es
|
847 |
LoadData; |
848 |
VerifyData; |
849 |
end;
|
850 |
if ((LicenseType = 0) or (LicenseType = 1)) and TooMuchRecords |
851 |
then // Trop d'enregistrements |
852 |
MessageDlg(MsgTooMuchRecords, mtWarning, [mbOk], 0);
|
853 |
FormResize(nil);
|
854 |
end;
|
855 |
|
856 |
procedure TFMenu.MExitClick(Sender: TObject);
|
857 |
begin
|
858 |
Close; |
859 |
end;
|
860 |
|
861 |
// Menu "Aliment"
|
862 |
|
863 |
procedure TFMenu.MMatiereClick(Sender: TObject);
|
864 |
begin
|
865 |
if NumWinMatiere < 0 |
866 |
then // Cr?ation |
867 |
begin
|
868 |
NumWinMatiere := MDIChildCount; |
869 |
FMatiere := TFMatiere.Create(Self); |
870 |
FMatiere.Show; |
871 |
end
|
872 |
else // Mise au premier plan |
873 |
FMatiere.BringToFront; |
874 |
end;
|
875 |
|
876 |
procedure TFMenu.MAlimentClick(Sender: TObject);
|
877 |
begin
|
878 |
if NumWinAliment < 0 |
879 |
then // Cr?ation |
880 |
begin
|
881 |
NumWinAliment := MDIChildCount; |
882 |
FAliment := TFAliment.Create(Self); |
883 |
FAliment.Show; |
884 |
end
|
885 |
else // Mise au premier plan |
886 |
FAliment.BringToFront; |
887 |
end;
|
888 |
|
889 |
procedure TFMenu.MTarifClick(Sender: TObject);
|
890 |
begin
|
891 |
if NumWinTarif < 0 |
892 |
then // Cr?ation |
893 |
begin
|
894 |
NumWinTarif := MDIChildCount; |
895 |
FTarif := TFTarif.Create(Self); |
896 |
FTarif.Show; |
897 |
end
|
898 |
else // Mise au premier plan |
899 |
FTarif.BringToFront; |
900 |
end;
|
901 |
|
902 |
procedure TFMenu.MImpExpClick(Sender: TObject);
|
903 |
begin
|
904 |
if NumWinImpExp < 0 |
905 |
then // Cr?ation |
906 |
begin
|
907 |
NumWinImpExp := MDIChildCount; |
908 |
FImpExp := TFImpExp.Create(Self); |
909 |
FImpExp.Show; |
910 |
end
|
911 |
else // Mise au premier plan |
912 |
FImpExp.BringToFront; |
913 |
end;
|
914 |
|
915 |
// Menu "Truie reproductrice"
|
916 |
|
917 |
procedure TFMenu.MSeqAliTClick(Sender: TObject);
|
918 |
begin
|
919 |
if NumWinSeqAliT < 0 |
920 |
then // Cr?ation |
921 |
begin
|
922 |
NumWinSeqAliT := MDIChildCount; |
923 |
FSeqAliT := TFSeqAliT.Create(Self); |
924 |
FSeqAliT.Show; |
925 |
end
|
926 |
else // Mise au premier plan |
927 |
FSeqAliT.BringToFront; |
928 |
end;
|
929 |
|
930 |
procedure TFMenu.MRationTClick(Sender: TObject);
|
931 |
begin
|
932 |
if NumWinRationT < 0 |
933 |
then // Cr?ation |
934 |
begin
|
935 |
NumWinRationT := MDIChildCount; |
936 |
FRationT := TFRationT.Create(Self); |
937 |
FRationT.Show; |
938 |
end
|
939 |
else // Mise au premier plan |
940 |
FRationT.BringToFront; |
941 |
end;
|
942 |
|
943 |
procedure TFMenu.MLogeTClick(Sender: TObject);
|
944 |
begin
|
945 |
if NumWinLogeT < 0 |
946 |
then // Cr?ation |
947 |
begin
|
948 |
NumWinLogeT := MDIChildCount; |
949 |
FLogeT := TFLogeT.Create(Self); |
950 |
FLogeT.Show; |
951 |
end
|
952 |
else // Mise au premier plan |
953 |
FLogeT.BringToFront; |
954 |
end;
|
955 |
|
956 |
procedure TFMenu.MProfilTClick(Sender: TObject);
|
957 |
begin
|
958 |
if NumWinProfilT < 0 |
959 |
then // Cr?ation |
960 |
begin
|
961 |
NumWinProfilT := MDIChildCount; |
962 |
FProfilT := TFProfilT.Create(Self); |
963 |
FProfilT.Show; |
964 |
end
|
965 |
else // Mise au premier plan |
966 |
FProfilT.BringToFront; |
967 |
end;
|
968 |
|
969 |
procedure TFMenu.MSimulTClick(Sender: TObject);
|
970 |
begin
|
971 |
if NumWinSimulT < 0 |
972 |
then // Cr?ation |
973 |
begin
|
974 |
NumWinSimulT := MDIChildCount; |
975 |
FSimulT := TFSimulT.Create(Self); |
976 |
FSimulT.Show; |
977 |
end
|
978 |
else // Mise au premier plan |
979 |
FSimulT.BringToFront; |
980 |
end;
|
981 |
|
982 |
procedure TFMenu.MBesGestTClick(Sender: TObject);
|
983 |
begin
|
984 |
if NumWinBesGestT < 0 |
985 |
then // Cr?ation |
986 |
begin
|
987 |
NumWinBesGestT := MDIChildCount; |
988 |
FBesGestT := TFBesGestT.Create(Self); |
989 |
FBesGestT.Show; |
990 |
end
|
991 |
else // Mise au premier plan |
992 |
FBesGestT.BringToFront; |
993 |
end;
|
994 |
|
995 |
procedure TFMenu.MBesGestEClick(Sender: TObject);
|
996 |
begin
|
997 |
if NumWinBesGestE < 0 |
998 |
then // Cr?ation |
999 |
begin
|
1000 |
NumWinBesGestE := MDIChildCount; |
1001 |
FBesGestE := TFBesGestE.Create(Self); |
1002 |
FBesGestE.Show; |
1003 |
end
|
1004 |
else // Mise au premier plan |
1005 |
FBesGestE.BringToFront; |
1006 |
end;
|
1007 |
|
1008 |
procedure TFMenu.MBesLactTClick(Sender: TObject);
|
1009 |
begin
|
1010 |
if NumWinBesLactT < 0 |
1011 |
then // Cr?ation |
1012 |
begin
|
1013 |
NumWinBesLactT := MDIChildCount; |
1014 |
FBesLactT := TFBesLactT.Create(Self); |
1015 |
FBesLactT.Show; |
1016 |
end
|
1017 |
else // Mise au premier plan |
1018 |
FBesLactT.BringToFront; |
1019 |
end;
|
1020 |
|
1021 |
procedure TFMenu.MBesLactEClick(Sender: TObject);
|
1022 |
begin
|
1023 |
if NumWinBesLactE < 0 |
1024 |
then // Cr?ation |
1025 |
begin
|
1026 |
NumWinBesLactE := MDIChildCount; |
1027 |
FBesLactE := TFBesLactE.Create(Self); |
1028 |
FBesLactE.Show; |
1029 |
end
|
1030 |
else // Mise au premier plan |
1031 |
FBesLactE.BringToFront; |
1032 |
end;
|
1033 |
|
1034 |
// Menu "Porc croissance"
|
1035 |
|
1036 |
procedure TFMenu.MSeqAliPClick(Sender: TObject);
|
1037 |
begin
|
1038 |
if NumWinSeqAliP < 0 |
1039 |
then // Cr?ation |
1040 |
begin
|
1041 |
NumWinSeqAliP := MDIChildCount; |
1042 |
FSeqAliP := TFSeqAliP.Create(Self); |
1043 |
FSeqAliP.Show; |
1044 |
end
|
1045 |
else // Mise au premier plan |
1046 |
FSeqAliP.BringToFront; |
1047 |
end;
|
1048 |
|
1049 |
procedure TFMenu.MRationPClick(Sender: TObject);
|
1050 |
begin
|
1051 |
if NumWinRationP < 0 |
1052 |
then // Cr?ation |
1053 |
begin
|
1054 |
NumWinRationP := MDIChildCount; |
1055 |
FRationP := TFRationP.Create(Self); |
1056 |
FRationP.Show; |
1057 |
end
|
1058 |
else // Mise au premier plan |
1059 |
FRationP.BringToFront; |
1060 |
end;
|
1061 |
|
1062 |
procedure TFMenu.MProfilPClick(Sender: TObject);
|
1063 |
begin
|
1064 |
if NumWinProfilP < 0 |
1065 |
then // Cr?ation |
1066 |
begin
|
1067 |
NumWinProfilP := MDIChildCount; |
1068 |
FProfilP := TFProfilP.Create(Self); |
1069 |
FProfilP.Show; |
1070 |
end
|
1071 |
else // Mise au premier plan |
1072 |
FProfilP.BringToFront; |
1073 |
end;
|
1074 |
|
1075 |
procedure TFMenu.MSimulPClick(Sender: TObject);
|
1076 |
begin
|
1077 |
if NumWinSimulP < 0 |
1078 |
then // Cr?ation |
1079 |
begin
|
1080 |
NumWinSimulP := MDIChildCount; |
1081 |
FSimulP := TFSimulP.Create(Self); |
1082 |
FSimulP.Show; |
1083 |
end
|
1084 |
else // Mise au premier plan |
1085 |
FSimulP.BringToFront; |
1086 |
end;
|
1087 |
|
1088 |
// Menu "Fen?tre"
|
1089 |
|
1090 |
procedure TFMenu.WindowCascade(Sender: TObject);
|
1091 |
begin
|
1092 |
Cascade; |
1093 |
end;
|
1094 |
|
1095 |
procedure TFMenu.MTileHorizontalClick(Sender: TObject);
|
1096 |
begin
|
1097 |
TileMode := tbHorizontal; |
1098 |
Tile; |
1099 |
end;
|
1100 |
|
1101 |
procedure TFMenu.MTileVerticalClick(Sender: TObject);
|
1102 |
begin
|
1103 |
TileMode := tbVertical; |
1104 |
Tile; |
1105 |
end;
|
1106 |
|
1107 |
procedure TFMenu.MMinimizeAllClick(Sender: TObject);
|
1108 |
var
|
1109 |
i: Integer; |
1110 |
begin
|
1111 |
if MDIChildCount > 0 |
1112 |
then
|
1113 |
for i := MDIChildCount - 1 downto 0 do |
1114 |
MDIChildren[i].WindowState := wsMinimized; |
1115 |
end;
|
1116 |
|
1117 |
procedure TFMenu.MRetoreAllClick(Sender: TObject);
|
1118 |
var
|
1119 |
i: Integer; |
1120 |
begin
|
1121 |
if MDIChildCount > 0 |
1122 |
then
|
1123 |
for i := MDIChildCount - 1 downto 0 do |
1124 |
MDIChildren[i].WindowState := wsNormal; |
1125 |
end;
|
1126 |
|
1127 |
procedure TFMenu.MArrangeClick(Sender: TObject);
|
1128 |
begin
|
1129 |
ArrangeIcons; |
1130 |
end;
|
1131 |
|
1132 |
// Menu "Aide"
|
1133 |
|
1134 |
procedure TFMenu.HelpContentsClick(Sender: TObject);
|
1135 |
begin
|
1136 |
// Application.HelpCommand(HELP_CONTENTS, 0);
|
1137 |
// HtmlHelp(Application.Handle, PChar(Application.CurrentHelpFile), HH_DISPLAY_TOC, 0);
|
1138 |
Application.HelpShowTableOfContents; |
1139 |
end;
|
1140 |
|
1141 |
procedure TFMenu.HelpIndexClick(Sender: TObject);
|
1142 |
begin
|
1143 |
// Application.HelpCommand(HELP_INDEX, 0);
|
1144 |
HtmlHelp(Application.Handle, PChar(Application.CurrentHelpFile), HH_DISPLAY_INDEX, 0);
|
1145 |
end;
|
1146 |
|
1147 |
procedure TFMenu.MHelpSearchClick(Sender: TObject);
|
1148 |
var
|
1149 |
q: THH_Fts_Query; |
1150 |
begin
|
1151 |
// Application.HelpCommand(HELP_FINDER, 0);
|
1152 |
with q do |
1153 |
begin //D?finition de la requ?te |
1154 |
cbStruct := SizeOf(q); // Taille de la requ?te
|
1155 |
fUniCodeStrings := False; // Mettre ? true si toute la cha?ne recherch?e est de type Unicode
|
1156 |
pszSearchQuery := nil; // Cha?ne recherch?e |
1157 |
iProximity := -1; // Recherche en respectant les mots similaires |
1158 |
fStemmedSearch := False; // Mettre ? true pour rechercher dans les r?sultats pr?c?dents
|
1159 |
fTitleOnly := False; // Mettre ? true si la recherche se fait uniquement sur les titres de rubriques
|
1160 |
fExecute := True; // Mettre ? true pour ex?cuter la requ?te
|
1161 |
pszWindow := nil; // Type de fen?tre ? afficher, ici c'est celle par d?faut |
1162 |
end;
|
1163 |
HtmlHelp(Application.Handle, PChar(Application.CurrentHelpFile), HH_DISPLAY_SEARCH, DWORD(@q)); |
1164 |
end;
|
1165 |
|
1166 |
procedure TFMenu.MIntroClick(Sender: TObject);
|
1167 |
begin
|
1168 |
FIntro := TFIntro.Create(Self); |
1169 |
FIntro.BBOk.Visible := False; |
1170 |
FIntro.BBCancel.Visible := False; |
1171 |
FIntro.BBClose.Visible := True; |
1172 |
FIntro.ShowModal; |
1173 |
FIntro.Release; |
1174 |
end;
|
1175 |
|
1176 |
procedure TFMenu.MWebClick(Sender: TObject);
|
1177 |
begin
|
1178 |
ShellExecute(Handle, 'open', PChar(URL_HTTPS), nil, nil, SW_SHOWNORMAL); |
1179 |
end;
|
1180 |
|
1181 |
procedure TFMenu.MUpdateClick(Sender: TObject);
|
1182 |
var
|
1183 |
UpdateURL: string;
|
1184 |
begin
|
1185 |
if Copy(LanguageCode, 1, 2) = 'fr' |
1186 |
then // Fran?ais |
1187 |
UpdateURL := URL_HTTPS + 'update_fr.php?version=' + VersionString
|
1188 |
else // Anglais |
1189 |
UpdateURL := URL_HTTPS + 'update_en.php?version=' + VersionString;
|
1190 |
ShellExecute(Handle, 'open', PChar(UpdateURL), nil, nil, SW_SHOWNORMAL); |
1191 |
end;
|
1192 |
|
1193 |
procedure TFMenu.MAboutClick(Sender: TObject);
|
1194 |
begin
|
1195 |
FAbout := TFAbout.Create(Self); |
1196 |
FAbout.ShowModal; |
1197 |
FAbout.Release; |
1198 |
end;
|
1199 |
|
1200 |
end.
|