V1.72
This commit is contained in:
BIN
UnitConfig.dcu
BIN
UnitConfig.dcu
Binary file not shown.
2764
UnitConfig.dfm
2764
UnitConfig.dfm
File diff suppressed because it is too large
Load Diff
184
UnitConfig.pas
184
UnitConfig.pas
@@ -4,7 +4,7 @@ interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, ExtCtrls, StdCtrls , verif_version, jpeg, ComCtrls ;
|
||||
Dialogs, ExtCtrls, StdCtrls , verif_version, jpeg, ComCtrls ,StrUtils ;
|
||||
|
||||
type
|
||||
TFormConfig = class(TForm)
|
||||
@@ -88,10 +88,32 @@ type
|
||||
Memo4: TMemo;
|
||||
GroupBox9: TGroupBox;
|
||||
CheckBoxRazSignaux: TCheckBox;
|
||||
GroupBox11: TGroupBox;
|
||||
LabelAdresse: TLabel;
|
||||
GroupBox10: TGroupBox;
|
||||
RadioButtonsans: TRadioButton;
|
||||
RadioButton30kmh: TRadioButton;
|
||||
RadioButton60kmh: TRadioButton;
|
||||
EditDroit_BD: TEdit;
|
||||
EditDevie_HD: TEdit;
|
||||
EditPointe_BG: TEdit;
|
||||
LabelLigne: TLabel;
|
||||
LabelBG: TLabel;
|
||||
LabelHD: TLabel;
|
||||
LabelBD: TLabel;
|
||||
ImageAig: TImage;
|
||||
ImageAffiche: TImage;
|
||||
ImageTJD: TImage;
|
||||
Edit_HG: TEdit;
|
||||
LabelHG: TLabel;
|
||||
EditP1: TEdit;
|
||||
EditP2: TEdit;
|
||||
procedure ButtonAppliquerEtFermerClick(Sender: TObject);
|
||||
procedure Button2Click(Sender: TObject);
|
||||
procedure FormActivate(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure MemoAigDblClick(Sender: TObject);
|
||||
procedure MemoAigClick(Sender: TObject);
|
||||
private
|
||||
{ Déclarations privées }
|
||||
public
|
||||
@@ -99,6 +121,8 @@ type
|
||||
|
||||
end;
|
||||
|
||||
const TitreAig='Description de l''aiguillage ';
|
||||
|
||||
var
|
||||
FormConfig: TFormConfig;
|
||||
AdresseIPCDM,AdresseIP,PortCom,recuCDM : string;
|
||||
@@ -108,6 +132,7 @@ function config_com(s : string) : boolean;
|
||||
function envoi_CDM(s : string) : boolean;
|
||||
procedure connecte_CDM;
|
||||
function place_id(s : string) : string;
|
||||
procedure decodeAig(s : string;var adr : integer;var B : char;var bis : boolean);
|
||||
|
||||
implementation
|
||||
|
||||
@@ -502,7 +527,7 @@ begin
|
||||
|
||||
// contrôle adresse IP interface
|
||||
s:=EditIPLenz.text;
|
||||
if not(IpOk(s)) then begin labelInfo.Caption:='Adresse IP Lenz incorrecte';exit;end;
|
||||
if not(IpOk(s)) and (s<>'0') then begin labelInfo.Caption:='Adresse IP Lenz incorrecte';exit;end;
|
||||
changeInterface:=s<>AdresseIP;
|
||||
AdresseIP:=s;
|
||||
|
||||
@@ -609,6 +634,19 @@ end;
|
||||
procedure TFormConfig.FormActivate(Sender: TObject);
|
||||
var i : integer;
|
||||
begin
|
||||
Edit_HG.Visible:=false;
|
||||
labelHG.Visible:=false;
|
||||
EditP1.Visible:=false;
|
||||
EditP2.Visible:=false;
|
||||
|
||||
Edit_HG.ReadOnly:=true;
|
||||
EditP1.ReadOnly:=true;
|
||||
EditP2.ReadOnly:=true;
|
||||
EditPointe_BG.ReadOnly:=true;
|
||||
EditDevie_HD.ReadOnly:=true;
|
||||
EditDroit_BD.ReadOnly:=true;
|
||||
|
||||
|
||||
EditAdrIPCDM.text:=adresseIPCDM;
|
||||
EditPortCDM.Text:=IntToSTR(portCDM);
|
||||
EditIPLenz.text:=AdresseIP;
|
||||
@@ -652,6 +690,11 @@ begin
|
||||
CheckServPosTrains.checked:=Srvc_PosTrain;
|
||||
CheckBoxRazSignaux.checked:=Raz_Acc_signaux;
|
||||
|
||||
EditDroit_BD.Text:='';
|
||||
EditPointe_BG.Text:='';
|
||||
EditDevie_HD.Text:='';
|
||||
|
||||
|
||||
end;
|
||||
|
||||
|
||||
@@ -672,10 +715,147 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure decodeAig(s : string;var adr : integer;var B : char;var bis : boolean);
|
||||
var erreur,i : integer;
|
||||
begin
|
||||
if (s[1]='P') or (s[1]='S') or (s[1]='D') then delete(s,1,1);
|
||||
// supprimer le champ suivant éventuel
|
||||
i:=pos(',',s);
|
||||
if i<>0 then delete(s,i,length(s)-i+1);
|
||||
val(s,adr,erreur);
|
||||
bis:=pos(s,'B')<>0;
|
||||
B:=#0;
|
||||
i:=pos('S',s);if i<>0 then B:='S';
|
||||
i:=pos('P',s);if i<>0 then B:='P';
|
||||
i:=pos('D',s);if i<>0 then B:='D';
|
||||
end;
|
||||
|
||||
procedure Aff_champs_aig;
|
||||
var Adresse,Adr2,traite,erreur,ligne,i,j,Nboucle,selpos : integer;
|
||||
bis,tjd : boolean;
|
||||
s,ss : string;
|
||||
B : char;
|
||||
begin
|
||||
with formConfig.MemoAig do
|
||||
begin
|
||||
ligne:=Perform(EM_LINEFROMCHAR,-1,0); // numéro de la lignée cliquée
|
||||
s:=Uppercase(Lines[ligne]);
|
||||
SelStart:=Perform(EM_LINEINDEX,Ligne,0); // début de la sélection
|
||||
SelLength:=Length(s) ; // fin de la sélection
|
||||
SetFocus;
|
||||
end;
|
||||
|
||||
Val(s,Adresse,erreur);
|
||||
formconfig.LabelAdresse.Caption:=TitreAig+InttoSTr(Adresse);
|
||||
|
||||
with formconfig do
|
||||
begin
|
||||
LabelLigne.caption:=s;
|
||||
ImageAffiche.Picture.Bitmap.TransparentMode:=tmAuto;
|
||||
ImageAffiche.Picture.Bitmap.TransparentColor:=clblue;
|
||||
ImageAffiche.Transparent:=true;
|
||||
if pos('TJD',s)<>0 then
|
||||
begin
|
||||
ImageAffiche.Picture.BitMap:=Imagetjd.Picture.Bitmap;
|
||||
Edit_HG.Visible:=true;
|
||||
tjd:=true;
|
||||
labelHG.Visible:=true;
|
||||
EditP1.Visible:=true;
|
||||
EditP2.Visible:=true;
|
||||
EditPointe_BG.Text:=intToSTR(aiguillage[adresse].ADevie)+aiguillage[adresse].ADevieB;
|
||||
Edit_HG.Text:=intToSTR(aiguillage[adresse].ADroit)+aiguillage[adresse].ADroitB;
|
||||
|
||||
Adr2:=aiguillage[adresse].Apointe;
|
||||
EditDevie_HD.Text:=intToSTR(aiguillage[adr2].ADevie)+aiguillage[adr2].ADevieB;
|
||||
EditDroit_BD.Text:=intToSTR(aiguillage[adr2].ADroit)+aiguillage[adr2].ADroitB;
|
||||
|
||||
EditP1.Text:=intToSTR(aiguillage[adresse].APointe);
|
||||
EditP2.Text:=intToSTR(aiguillage[adr2].APointe);
|
||||
|
||||
end
|
||||
else
|
||||
begin
|
||||
ImageAffiche.Picture.BitMap:=Imageaig.Picture.Bitmap;
|
||||
Edit_HG.Visible:=false;
|
||||
labelHG.Visible:=false;
|
||||
EditP1.Visible:=false;
|
||||
EditP2.Visible:=false;
|
||||
tjd:=false;
|
||||
end;
|
||||
end;
|
||||
// affiche(s,clOrange);
|
||||
|
||||
i:=pos(',',s);Delete(s,1,i);
|
||||
traite:=0;nBoucle:=0;
|
||||
if not(tjd) then
|
||||
repeat
|
||||
if s<>'' then
|
||||
if s[1]='P' then
|
||||
begin
|
||||
decodeAig(s,adresse,B,bis);
|
||||
ss:=intToSTR(Adresse);
|
||||
if bis then ss:=ss+'B';
|
||||
formconfig.EditPointe_BG.Text:=ss+B;
|
||||
i:=pos(',',s);if i=0 then i:=length(s)+1;
|
||||
Delete(s,1,i);
|
||||
inc(traite);
|
||||
end;
|
||||
if s<>'' then
|
||||
if s[1]='S' then
|
||||
begin
|
||||
decodeAig(s,adresse,B,bis);
|
||||
ss:=intToSTR(Adresse);
|
||||
if bis then ss:=ss+'B';
|
||||
formconfig.EditDevie_HD.Text:=ss+B;
|
||||
i:=pos(',',s);if i=0 then i:=length(s)+1;
|
||||
Delete(s,1,i);
|
||||
inc(traite);
|
||||
end;
|
||||
if s<>'' then
|
||||
if s[1]='D' then
|
||||
begin
|
||||
decodeAig(s,adresse,B,bis);
|
||||
ss:=intToSTR(Adresse);
|
||||
if bis then ss:=ss+'B';
|
||||
formconfig.EditDroit_BD.Text:=ss+B;
|
||||
i:=pos(',',s);if i=0 then i:=length(s)+1;
|
||||
Delete(s,1,i);
|
||||
inc(traite);
|
||||
end;
|
||||
inc(nBoucle);
|
||||
until (traite=3) or (nboucle=3);
|
||||
|
||||
if s='' then
|
||||
with formconfig do
|
||||
begin
|
||||
RadioButtonsans.Checked:=true;
|
||||
RadioButton30kmh.Checked:=false;
|
||||
RadioButton60kmh.Checked:=false;
|
||||
end;
|
||||
if s='30' then
|
||||
with formconfig do
|
||||
begin
|
||||
RadioButtonsans.Checked:=false;
|
||||
RadioButton30kmh.Checked:=true;
|
||||
RadioButton60kmh.Checked:=false;
|
||||
end;
|
||||
if s='60' then
|
||||
with formconfig do
|
||||
begin
|
||||
RadioButtonsans.Checked:=false;
|
||||
RadioButton30kmh.Checked:=false;
|
||||
RadioButton60kmh.Checked:=true;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TFormConfig.MemoAigDblClick(Sender: TObject);
|
||||
begin
|
||||
Aff_champs_aig;
|
||||
end;
|
||||
|
||||
procedure TFormConfig.MemoAigClick(Sender: TObject);
|
||||
begin
|
||||
Aff_champs_aig
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
BIN
UnitPrinc.dcu
BIN
UnitPrinc.dcu
Binary file not shown.
@@ -3364,7 +3364,7 @@ end;
|
||||
// if (i<>0) and traceDet then Affiche('Détecteur trouvé en branche '+intToSTR(NBranche)+' index='+IntToSTR(i),clYellow);
|
||||
branche_trouve:=NBranche;
|
||||
IndexBranche_trouve:=i;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure lit_config;
|
||||
@@ -3605,6 +3605,39 @@ begin
|
||||
|
||||
repeat // parcoure la ligne
|
||||
if (debugConfig) then Affiche('boucle de ligne: '+s,clYellow);
|
||||
|
||||
if (length(enregistrement)<>0) then
|
||||
if (enregistrement[1]='P') then
|
||||
begin
|
||||
if debugconfig then Affiche('Section P - enregistrement='+enregistrement,clYellow);
|
||||
ComptEl:=ComptEl+1;
|
||||
decodeAig(enregistrement,detect,c,bisBool);
|
||||
if c='' then c:='Z';
|
||||
if (bis=1) and (bisBool=false) then
|
||||
begin
|
||||
aiguillageB[aig].ApointeBis:=0;
|
||||
aiguillageB[aig].Apointe:=detect;
|
||||
aiguillageB[aig].ApointeB:=c;
|
||||
end;
|
||||
if (bis=0) and (bisBool=true) then
|
||||
begin
|
||||
aiguillage[aig].ApointeBis:=1;
|
||||
aiguillage[aig].Apointe:=detect;
|
||||
aiguillage[aig].ApointeB:=c;
|
||||
end;
|
||||
if (bis=0) and (bisBool=false) then
|
||||
begin
|
||||
aiguillage[aig].ApointeBis:=0;
|
||||
aiguillage[aig].Apointe:=detect;
|
||||
aiguillage[aig].ApointeB:=c;
|
||||
end;
|
||||
if (bis=1) and (bisBool=true) then
|
||||
begin
|
||||
aiguillageB[aig].ApointeBis:=1;
|
||||
aiguillageB[aig].Apointe:=detect;
|
||||
aiguillageB[aig].ApointeB:=c;
|
||||
end;
|
||||
|
||||
|
||||
virgule:=pos(',',s);if virgule=0 then virgule:=length(s)+1;
|
||||
enregistrement:=copy(s,1,virgule-1);
|
||||
@@ -3627,6 +3660,7 @@ begin
|
||||
if (debugConfig) then affiche('connecté a aiguillage BIS'+s,clYellow);
|
||||
end;
|
||||
if bis=0 then aiguillage[aig].ApointeB:=enregistrement[1] else aiguillageB[aig].ApointeB:=enregistrement[1];
|
||||
delete(enregistrement,1,1);
|
||||
Num_element:=Num_element+1;
|
||||
end;
|
||||
virgule:=pos(',',s);if virgule=0 then virgule:=length(s)+1;
|
||||
@@ -3634,6 +3668,36 @@ begin
|
||||
delete(s,1,virgule);
|
||||
}
|
||||
end;
|
||||
|
||||
if (length(enregistrement)<>0) then // section droite
|
||||
if (enregistrement[1]='D') then
|
||||
begin
|
||||
if debugconfig then Affiche('Section D - enregistrement='+enregistrement,clYellow);
|
||||
ComptEl:=ComptEl+1;
|
||||
decodeAig(enregistrement,detect,c,bisBool);
|
||||
if c='' then c:='Z';
|
||||
if (bis=1) and (bisBool=false) then
|
||||
begin
|
||||
aiguillageB[aig].AdroitBis:=0;
|
||||
aiguillageB[aig].Adroit:=detect;
|
||||
aiguillageB[aig].AdroitB:=c;
|
||||
end;
|
||||
if (bis=0) and (bisBool=true) then
|
||||
begin
|
||||
aiguillage[aig].AdroitBis:=1;
|
||||
aiguillage[aig].Adroit:=detect;
|
||||
aiguillage[aig].AdroitB:=c;
|
||||
end;
|
||||
if (bis=0) and (bisBool=false) then
|
||||
begin
|
||||
aiguillage[aig].AdroitBis:=0;
|
||||
aiguillage[aig].Adroit:=detect;
|
||||
aiguillage[aig].AdroitB:=c;
|
||||
end;
|
||||
if (bis=1) and (bisBool=true) then
|
||||
begin
|
||||
aiguillageB[aig].AdroitBis:=1;
|
||||
aiguillageB[aig].Adroit:=detect;
|
||||
aiguillageB[aig].AdroitB:=c;
|
||||
end;
|
||||
virgule:=pos(',',s);if virgule=0 then virgule:=length(s)+1;
|
||||
@@ -3660,7 +3724,7 @@ begin
|
||||
if bis=0 then aiguillage[aig].AdroitB:=enregistrement[1] else aiguillageB[aig].AdroitB:=enregistrement[1];
|
||||
delete(enregistrement,1,1);
|
||||
if (debugConfig) then affiche('connecté a aiguillage BIS'+s,clYellow);
|
||||
end;
|
||||
end;
|
||||
delete(enregistrement,1,1);
|
||||
Num_element:=Num_element+1;
|
||||
end;
|
||||
@@ -6696,13 +6760,6 @@ procedure SendKey(Wnd,VK : Cardinal; Ctrl,Alt,Shift : Boolean);
|
||||
end;
|
||||
until (Process32Next(hSnapShot,ProcessEntry32)=false);
|
||||
CloseHandle(hSnapShot);
|
||||
end;
|
||||
|
||||
procedure SendKey(Wnd,VK : Cardinal; Ctrl,Alt,Shift : Boolean);
|
||||
var
|
||||
MC,MA,MS : Boolean;
|
||||
begin
|
||||
// Met la fenetre de destination en arrière
|
||||
end;
|
||||
|
||||
procedure SendKey(Wnd,VK : Cardinal; Ctrl,Alt,Shift : Boolean);
|
||||
@@ -6720,7 +6777,7 @@ begin
|
||||
if Shift<>MS then keybd_event(VK_SHIFT,0,Byte(MS)*KEYEVENTF_KEYUP,0);
|
||||
|
||||
// Appui sur les touches
|
||||
keybd_event(VK,0,0,0);
|
||||
keybd_event(VK,0,0,0);
|
||||
keybd_event(VK,0,KEYEVENTF_KEYUP,0);
|
||||
|
||||
// keybd_event(MapVirtualKeyA(VK,0),0,0,0);
|
||||
@@ -6780,10 +6837,18 @@ begin
|
||||
s:='CDR';
|
||||
if (ProcessRunning(s)) then begin Lance_CDM:=false;exit;end;
|
||||
|
||||
Affiche('Lancement de CDM '+lay,clyellow);
|
||||
if ShellExecute(Formprinc.Handle,
|
||||
'open',PChar('C:\Program Files (x86)\CDM-Rail\cdr.exe'),
|
||||
Pchar('-f '+lay), // paramètre
|
||||
PChar('C:\Program Files (x86)\CDM-Rail\') // répertoire
|
||||
,SW_SHOWNORMAL)<=32 then
|
||||
begin
|
||||
// si çà marche pas essayer depuis l'autre répertoire
|
||||
if ShellExecute(Formprinc.Handle,
|
||||
if ShellExecute(Formprinc.Handle,
|
||||
'open',PChar('C:\Program Files\CDM-Rail\cdr.exe'),
|
||||
Pchar('-f '+lay), // paramètre
|
||||
PChar('C:\Program Files\CDM-Rail\') // répertoire
|
||||
,SW_SHOWNORMAL)<=32 then
|
||||
begin
|
||||
ShowMessage('répertoire CDM rail introuvable');
|
||||
|
||||
@@ -21,4 +21,7 @@ Version 1.5 : Nouvel algorithme de suivi des trains - Gestion des feux provenan
|
||||
Version 1.6 : Implémentation du TCO. Ouverture de CDM rail au démarrage avec LAY à la demande
|
||||
Version 1.7 : Sauvegarde de la configuration dans les fichier client_gl.cfg et config.cfg si modification des paramètres depuis le menu de configuration.
|
||||
Feu violet disponible sur signaux à 5, 7 et 9 feux.
|
||||
version 1.71 : correction d'un bug de la v1.7 sur le protocole COM/USB direct à l'interface
|
||||
version 1.72 : affichage message si configuration erronnée dans la fenêtre de configuration - Démarrage de CDM assuré pour les répertoires
|
||||
Program Files et Program Files (x86)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user