This commit is contained in:
f1iwq2
2026-02-14 10:24:01 +01:00
parent 7daf7e28aa
commit 3702de2726
15 changed files with 840 additions and 232 deletions
+1 -1
View File
@@ -4794,7 +4794,7 @@ var pt : Tpoint;
canvasI : Tcanvas;
begin
clic:=true;
pt:= formAnalyseCDM.ImageCDM.ScreenToClient(Mouse.CursorPos); // coordonnées par rapport à l'image
pt:=formAnalyseCDM.ImageCDM.ScreenToClient(Mouse.CursorPos); // coordonnées par rapport à l'image
xSouris:=pt.x;
ySouris:=pt.y;
+4 -5
View File
@@ -163,7 +163,7 @@ begin
end;
end;
// change l'aiguille du compteur
// change l'aiguille du compteur "c" en fonction de la vitesse du train "idTrain" dans le composant "comp"
// c : n° de fenetre du compteur idTrain : index du train comp : composant dans lequel se trouve le compteur (form, groupbox ou image)
procedure aiguille_compteur(c,idTrain : integer ; comp : Tcomponent);
var ComptLoc,x1,y1,x2,y2,x3,y3,x4,y4,vitesse,vitesseFin,lim,him : integer;
@@ -279,6 +279,7 @@ begin
end;
end;
// dessine le fond du compteur 2 (graduations et chiffres)
procedure compteur_2(c : integer;bm : tbitmap;var param : tparamcompt);
var n,v,rayon2,rayon3,rayon4,x1,y1,x2,y2,xt,yt,lim,him,rg : integer;
angle,incr,r : single;
@@ -377,6 +378,7 @@ begin
end;
end;
// dessine le fond du compteur tachro
procedure compteur_tachro(c : integer;bm : tbitmap;var param : tparamcompt);
var l,av,n,v,rayon2,rayon3,rayon4,x1,y1,x2,y2,xt,yt,lim,him,rg : integer;
angle,incr,r,a,sinA,cosA : single;
@@ -489,7 +491,7 @@ begin
end;
// dessine dans le FbitMap
// dessine le fond du compteur pour tous les compteurs dans le FbitMap
// le var est obligatoire
// typecompt : type du compteur 1 2 ou 3
procedure dessin_fond_compteur(var param : TparamCompt;i: integer ; Im : tbitmap;typCompt : integer);
@@ -537,8 +539,6 @@ begin
TextOut(round(137*redX),round(91*redY),'100');
TextOut(round(124*redX),round(130*redY),'120');
rAig:=round(AigCX / 1.5);
angleFin:=127; // en fait vitesse maxi compteur
end;
@@ -1021,7 +1021,6 @@ begin
afficherIconeDuTrain1.Checked:=affTrainCompteur;
init_compteur(1,formcompteur[1]);
affiche_train_compteur(1);
end;
procedure TFormCompteur.Vitesseencrans1Click(Sender: TObject);
+73 -7
View File
@@ -1,6 +1,6 @@
object FormConfig: TFormConfig
Left = 404
Top = 164
Left = 254
Top = 172
Hint = 'Modifie la configuration selon les s'#233'lections choisies'
BorderStyle = bsDialog
Caption = 'Configuration g'#233'n'#233'rale'
@@ -1573,7 +1573,7 @@ object FormConfig: TFormConfig
Top = 8
Width = 633
Height = 505
ActivePage = TabSheetSig
ActivePage = TabSheetDet
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -11
@@ -2930,7 +2930,7 @@ object FormConfig: TFormConfig
OnClick = RadioButtonTJD4Click
end
end
object ButtonPropage: TButton
object ButtonPropageAig: TButton
Left = 192
Top = 56
Width = 89
@@ -2943,7 +2943,7 @@ object FormConfig: TFormConfig
ShowHint = True
TabOrder = 9
WordWrap = True
OnClick = ButtonPropageClick
OnClick = ButtonPropageAigClick
end
end
object ButtonNouvAig: TButton
@@ -3346,7 +3346,7 @@ object FormConfig: TFormConfig
Width = 137
Height = 21
Style = csDropDownList
ItemHeight = 13
ItemHeight = 0
TabOrder = 1
OnChange = ComboBoxDecChange
end
@@ -3477,7 +3477,7 @@ object FormConfig: TFormConfig
Width = 137
Height = 21
Style = csDropDownList
ItemHeight = 13
ItemHeight = 0
TabOrder = 2
OnChange = ComboBoxAspChange
end
@@ -3607,6 +3607,21 @@ object FormConfig: TFormConfig
TabOrder = 23
OnChange = EditTempoSigChange
end
object ButtonPropageSig: TButton
Left = 224
Top = 16
Width = 57
Height = 17
Hint =
'Change les adresses dans les TCOs si on a chang'#233' l'#39'adresse d'#39'un ' +
'signal'
Caption = 'Propage'
ParentShowHint = False
ShowHint = True
TabOrder = 24
WordWrap = True
OnClick = ButtonPropageSigClick
end
end
object ButtonNouvSig: TButton
Left = 0
@@ -4568,6 +4583,57 @@ object FormConfig: TFormConfig
OnChange = EditDecalChange
end
end
object GroupBox13: TGroupBox
Left = 336
Top = 272
Width = 265
Height = 137
Caption = 'Changement de l'#39'adresse d'#39'un d'#233'tecteur'
TabOrder = 5
object Label85: TLabel
Left = 16
Top = 24
Width = 92
Height = 13
Caption = 'D'#233'tecteur courant :'
end
object LabelDetCour: TLabel
Left = 208
Top = 24
Width = 3
Height = 13
Caption = '.'
end
object LabeledNvleAdrDet: TLabeledEdit
Left = 200
Top = 48
Width = 40
Height = 21
Hint = 'Nouvelle adresse du d'#233'tecteur'
EditLabel.Width = 145
EditLabel.Height = 13
EditLabel.Caption = 'Nouvelle adresse du d'#233'tecteur'
EditLabel.Layout = tlBottom
LabelPosition = lpLeft
LabelSpacing = 40
ParentShowHint = False
ShowHint = True
TabOrder = 0
end
object ButtonValideDet: TButton
Left = 72
Top = 88
Width = 137
Height = 33
Hint =
'Propage l'#39'adresse du d'#233'tecteur dans les branches, les aiguillage' +
's, les signaux et les TCO'
Caption = 'Valider et propager le d'#233'tecteur'
TabOrder = 1
WordWrap = True
OnClick = ButtonValideDetClick
end
end
end
object TabSheetPN: TTabSheet
Caption = 'PN'
+305 -24
View File
@@ -1,6 +1,6 @@
Unit UnitConfig;
interface
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
@@ -291,7 +291,7 @@ type
ButtonCouleur: TButton;
ColorDialogFond: TColorDialog;
LabelD13: TLabel;
ButtonPropage: TButton;
ButtonPropageAig: TButton;
ButtonPFCDM: TButton;
TabAvance: TTabSheet;
Label39: TLabel;
@@ -516,6 +516,12 @@ type
LabeledEditT: TLabeledEdit;
SpeedButtonLay: TSpeedButton;
MenuListesCopier2: TMenuItem;
ButtonPropageSig: TButton;
GroupBox13: TGroupBox;
LabeledNvleAdrDet: TLabeledEdit;
Label85: TLabel;
LabelDetCour: TLabel;
ButtonValideDet: TButton;
procedure ButtonAppliquerEtFermerClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ListBoxAigMouseDown(Sender: TObject; Button: TMouseButton;
@@ -666,7 +672,7 @@ type
procedure EditDevieS2Change(Sender: TObject);
procedure ButtonCouleurClick(Sender: TObject);
procedure ColorDialogFondShow(Sender: TObject);
procedure ButtonPropageClick(Sender: TObject);
procedure ButtonPropageAigClick(Sender: TObject);
procedure EditAdrAigExit(Sender: TObject);
procedure EditAdrAigChange(Sender: TObject);
procedure FormActivate(Sender: TObject);
@@ -820,6 +826,8 @@ type
procedure LabeledEditTChange(Sender: TObject);
procedure SpeedButtonLayClick(Sender: TObject);
procedure MenuListesCopier2Click(Sender: TObject);
procedure ButtonPropageSigClick(Sender: TObject);
procedure ButtonValideDetClick(Sender: TObject);
private
{ Déclarations privées }
@@ -1641,6 +1649,7 @@ begin
begin
inc(NbreSignaux);
Signaux[i].adresse:=adresse;
Signaux[i].Ancienadresse:=adresse;
Signaux[i].AncienEtat:=$ffff;
Signaux[i].AncienAff:=$ffff;
Signaux[i].Tempo:=0;
@@ -2099,6 +2108,7 @@ begin
condBouton : s:=s+intToSTR(Tablo_Action[i].TabloCond[j].adresse)+',';
CondMemoireEgal,CondMemoireInf,CondMemoireSup
: s:=s+intToSTR(Tablo_Action[i].TabloCond[j].adresse)+','+intToSTR(Tablo_Action[i].TabloCond[j].etat)+',';
CondDetAct : s:=s+intToSTR(Tablo_Action[i].TabloCond[j].adresse)+','+intToSTR(Tablo_Action[i].TabloCond[j].etat)+','+Tablo_Action[i].TabloCond[j].train+',';
end;
end;
@@ -3689,6 +3699,7 @@ const LessThanValue=-1;
procedure compile_actions;
var n,k,l : integer;
fini : boolean;
begin
maxTablo_act:=1;
Nligne:=1;
@@ -3884,6 +3895,16 @@ const LessThanValue=-1;
Tablo_Action[maxtablo_act].tabloCond[k].etat:=i;
end;
end;
condDetAct :
begin
Val(s,i,erreur);Delete(s,1,erreur);
Tablo_Action[maxtablo_act].TabloCond[k].adresse:=i;
Val(s,i,erreur);Delete(s,1,erreur);
Tablo_Action[maxtablo_act].TabloCond[k].etat:=i;
i:=pos(',',s);if i=0 then i:=length(s)+1;
sa:=copy(s,1,i-1);delete(s,1,i);
Tablo_Action[maxtablo_act].TabloCond[k].train:=sa;
end;
end;
end;
end;
@@ -4042,8 +4063,9 @@ const LessThanValue=-1;
end;
end;
inc(maxTablo_act);
end;
until (s='0') or eof(fichier) ;
end
else fini:=true;
until eof(fichier) or fini;
dec(maxTablo_act);
end;
@@ -7969,7 +7991,7 @@ begin
richBranche.HideSelection:=false; // pour pouvoir copier coller la fenetre
//groupBox21.Top:=304;
GroupBox21.Left:=8;
ButtonPropage.Hint:='Change les adresses dans les points de connexions'+#13+
ButtonPropageAig.Hint:='Change les adresses dans les points de connexions'+#13+
'des aiguillages, des branches et des signaux'+#13+
'si on a changé l''adresse d''un aiguillage';
if debug=1 then Affiche('Fin création fenêtre config',clLime);
@@ -9350,9 +9372,9 @@ begin
index:=Index_Aig(Adresse);
AncienAdresse:=aiguillage[index].AncienAdresse;
if adresse<>AncienAdresse then
FormConfig.ButtonPropage.Hint:='Change les adresses '+intToSTR(AncienAdresse)+' dans les points de connexions'+#13+
FormConfig.ButtonPropageAig.Hint:='Change les adresses '+intToSTR(AncienAdresse)+' dans les points de connexions'+#13+
'des aiguillages et des branches par l''adresse '+intToSTR(adresse)
else FormConfig.ButtonPropage.Hint:='Change les adresses dans les points de connexions'+#13+
else FormConfig.ButtonPropageAig.Hint:='Change les adresses dans les points de connexions'+#13+
'des aiguillages, des branches et des signaux'+#13+
'si on a changé l''adresse d''un aiguillage';
clicListe:=false;
@@ -9496,6 +9518,8 @@ begin
begin
checkFVC.Visible:=true; // afficher checkbox feu vert clignotant
checkFRC.Visible:=true; // afficher checkbox feu rouge clignotant
checkFVC.Caption:='Feu vert clignotant';
checkFVC.Hint:='Remplace le feu vert par un feu vert clignotant';
end
else
begin
@@ -9503,6 +9527,14 @@ begin
checkFRC.Visible:=false; // na pas afficher checkbox feu rouge clignotant
end;
if d=2 then
begin
checkFVC.Visible:=true; // afficher checkbox feu vert clignotant
checkFVC.Caption:='Feux rouge/vert';
checkFVC.Hint:='coché : signal rouge/vert'+#13+
'décoché : signal violet/blanc';
end;
if ((d>3) and (d<10)) or (d=20) then CheckVerrouCarre.Visible:=true else CheckVerrouCarre.Visible:=false;
if d=20 then
begin
@@ -11696,7 +11728,7 @@ end;
function verif_coherence : boolean;
var AncAdr,i,j,k,l,Indexaig,adr,adr2,extr,detect,condcarre,nc,index2,SuivAdr,indexTCO,AdrAig,
x,y,extr2,adr3,adr4,index3,det1Br,det2Br,det1index,det2index,adresse,Adresse2,dec,nc2,op,
delta,broft,adresse3 : integer;
delta,broft,adresse3,Sk : integer;
modAig,AncModel,model,km,SuivModel,model2,t1,t2: TEquipement;
c : char;
vitesse : longint;
@@ -12793,6 +12825,7 @@ begin
dec:=Signaux[i].decodeur;
AdrOk:=false;
ok:=false;
Sk:=k;
okSignal:=false;
s:=s+intToSTR(adresse_detecteur[k])+' ';
end;
@@ -12802,6 +12835,7 @@ begin
begin
Affiche('Erreur 14: le signal '+IntToSTR(adresse)+' '+decodeur[dec]+' occupe '+intToSTR(nc)+' adresses de '+intToSTR(adresse)+
' à '+intToSTR(adresse+nc-1)+' et chevauche le(s) détecteur(s) suivant(s)',clred);
s:=s+' car ('+intToSTR(adresse_detecteur[Sk])+'-1 / 2) +1 >='+intToSTR(adresse)+' et <='+intToSTR(adresse+nc-1);
Affiche(s,clred);
end;
end;
@@ -16373,7 +16407,37 @@ begin
SetWindowText(ColorDialogFond.Handle,pchar(scouleur));
end;
procedure TFormConfig.ButtonPropageClick(Sender: TObject);
procedure TFormConfig.ButtonPropageSigClick(Sender: TObject);
var i,x,y,adresse,index,AncienAdresse : integer;
s : string;
begin
adresse:=signaux[ligneclicSig+1].Adresse;
if adresse=0 then exit;
index:=Index_Signal(Adresse);
AncienAdresse:=signaux[index].AncienAdresse;
if Adresse=AncienAdresse then exit;
// TCOs
for i:=1 to NbreTCO do
begin
for y:=1 to NbreCellY[i] do
for x:=1 to NbreCellX[i] do
begin
if tco[i,x,y].Adresse=AncienAdresse then
begin
tco[i,x,y].Adresse:=Adresse;
s:='TCO '+intToSTR(i)+' cellule '+intToSTR(x)+','+intToSTR(y)+' ';
s:=s+'Changement ancienne adresse de signal '+intToSTR(AncienAdresse)+' par nouvelle adresse '+intToSTR(adresse);
Affiche(s,clyellow);
end;
end;
Affiche_TCO(i);
end;
end;
procedure TFormConfig.ButtonPropageAigClick(Sender: TObject);
var x,y,i,adresse,AncienAdresse,AdresseBr,v,erreur : integer;
typ : tEquipement;
s,Nb : string;
@@ -16412,11 +16476,11 @@ begin
end;
end;
if typ=triple then if aiguillage[index].AdrTriple=AncienAdresse then
begin
aiguillage[i].AdrTriple:=adresse;
Affiche('Réaffectation aiguillage '+intToSTR(aiguillage[i].Adresse)+' triple',clyellow);
config_modifie:=true;
end;
begin
aiguillage[i].AdrTriple:=adresse;
Affiche('Réaffectation aiguillage '+intToSTR(aiguillage[i].Adresse)+' triple',clyellow);
config_modifie:=true;
end;
if (typ=tjd) or (typ=tjs) or (typ=crois) then
begin
if aiguillage[i].ADroit=AncienAdresse then
@@ -16456,7 +16520,7 @@ begin
end;
formconfig.ListBoxAig.itemindex:=0;
// branches ----------------------------------
// changer l'aiguillage dans les branches ----------------------------------
for i:=1 to NbreBranches do
begin
Nb:='';v:=0;
@@ -16520,24 +16584,24 @@ begin
Affiche('Changement dans signal '+intToSTR(signaux[i].adresse),clYellow);
config_modifie:=true;
end;
if (signaux[i].Adr_el_suiv2=AncienAdresse) and (signaux[i].Btype_suiv1=aig) then
if (signaux[i].Adr_el_suiv2=AncienAdresse) and (signaux[i].Btype_suiv1=aig) then
begin
signaux[i].Adr_el_suiv2:=adresse;
Affiche('Changement dans signal '+intToSTR(signaux[i].adresse),clYellow);
config_modifie:=true;
end;
if (signaux[i].Adr_el_suiv3=AncienAdresse) and (signaux[i].Btype_suiv1=aig) then
end;
if (signaux[i].Adr_el_suiv3=AncienAdresse) and (signaux[i].Btype_suiv1=aig) then
begin
signaux[i].Adr_el_suiv3:=adresse;
Affiche('Changement dans signal '+intToSTR(signaux[i].adresse),clYellow);
config_modifie:=true;
end;
end;
if (signaux[i].Adr_el_suiv4=AncienAdresse) and (signaux[i].Btype_suiv1=aig) then
begin
signaux[i].Adr_el_suiv4:=adresse;
Affiche('Changement dans signal '+intToSTR(signaux[i].adresse),clYellow);
config_modifie:=true;
end;
end;
end;
// TCOs
@@ -16555,7 +16619,7 @@ begin
Affiche_TCO(i);
end;
ButtonPropage.Hint:='Change les adresses dans les points de connexions'+#13+
ButtonPropageAig.Hint:='Change les adresses dans les points de connexions'+#13+
'des aiguillages, des branches et des signaux'+#13+
'si on a changé l''adresse d''un aiguillage';
clicListe:=false;
@@ -16651,7 +16715,7 @@ begin
index:=Index_Aig(Adresse);
AncienAdresse:=aiguillage[index].AncienAdresse;
if adresse<>AncienAdresse then
ButtonPropage.Hint:='Change les adresses '+intToSTR(AncienAdresse)+' dans les points de connexions'+#13+
ButtonPropageAig.Hint:='Change les adresses '+intToSTR(AncienAdresse)+' dans les points de connexions'+#13+
'des aiguillages et des branches par l''adresse '+intToSTR(adresse);
end;
end;
@@ -17269,6 +17333,7 @@ begin
EditDecal.Text:=IntToSTR(detecteur[adr].distArret);
RadioButtonArrFin.Checked:=detecteur[adr].ModeArret=1;
RadioButtonARMil.Checked:=detecteur[adr].ModeArret=2;
LabelDetCour.Caption:=intToSTR(adr);
if detecteur[adr].ModeArret=1 then editDecal.Enabled:=true else editDecal.Enabled:=false;
end;
end;
@@ -17448,7 +17513,7 @@ begin
ligneclicDet:=lc;
end;
Val(s,Adresse,erreur); // Adresse de l'aguillage
Val(s,Adresse,erreur); // Adresse du détecteur
aff_champs_Detecteurs(lc);
clicliste:=false;
@@ -20096,6 +20161,222 @@ begin
if not(decode_ligne_signal(s,i)) then // décode la chaine et stocke en tableau signal
Affiche('Erreur 59 : définition inccorecte du signal '+intToSTR(i),clred);
end;
end;
procedure TFormConfig.ButtonValideDetClick(Sender: TObject);
var i,erreur,detect,AncienDet,indexDet,v,adresseBr,x,y,longestLength,l,PixelLength : integer;
typ : tEquipement;
s,nb,LongestString : string;
chgt : boolean;
begin
if clicListe then exit;
val(LabeledNvleAdrDet.text,detect,erreur);
if (erreur<>0) or (detect<1) then
begin
labelInfo.caption:='Erreur';
exit;
end;
val(LEAdrDet.text,AncienDet,erreur);
if (erreur<>0) or (AncienDet<1) then
begin
labelInfo.caption:='Erreur';
exit;
end;
if ancienDet=detect then exit;
// vérifier si le nouveau détecteur existe
if detecteur[detect].index<>0 then
begin
LabelInfo.caption:='Le détecteur '+intToSTR(detect)+' existe déja';
exit;
end;
labelInfo.caption:='';
indexDet:=detecteur[AncienDet].index;
detecteur[detect]:=detecteur[ancienDet]; // copier l'ancien dans le nouveau
with detecteur[ancienDet] do
begin
index:=0;
NumBranche:=0;
IndexBranche:=0;
end;
Adresse_detecteur[ligneclicDet+1]:=detect;
trier_detecteurs;
// réafficher la listBox
with ListBoxDet do
begin
clear;
for i:=1 to NDetecteurs do items.add(encode_detecteur(i));
end;
indexDet:=Detecteur[detect].index;
formconfig.ListBoxDet.selected[indexDet-1]:=true;
Affiche('----------------------------------------------------',clWhite);
Affiche('Changement détecteur '+intToSTR(ancienDet)+' par l''adresse '+intToSTR(detect),clwhite);
// changer le détecteur dans les branches chaine ----------------------------------
for i:=1 to NbreBranches do
begin
Nb:='';v:=0;
s:=Branche[i];
repeat
v:=pos(',',s);
if (s[1]<>'A') and (s[1]<>'T') then
begin
val(s,adresseBr,erreur);
if adresseBR=AncienDet then adresseBr:=detect;
Nb:=Nb+intToSTR(adresseBr)+',';
end
else
begin
if v=0 then
Nb:=Nb+s+','
else Nb:=Nb+copy(s,1,v-1)+',';
end;
delete(s,1,v);
until (v=0);
delete(nb,length(nb),1); // supprime la virgule terminale
branche[i]:=nb;
compile_branche(nb,i);
end;
// réafficher les branches
richBranche.Clear;
for i:=1 to NbreBranches do
begin
s:=Branche[i];
RichBranche.Lines.Add(s);
RE_ColorLine(RichBranche,RichBranche.lines.count-1,ClAqua);
end;
// les détecteurs dans aiguillages
// --------- aiguillages -----------
for i:=1 to maxaiguillage do
begin
typ:=aiguillage[i].modele;
if (typ=aig) or (typ=triple) then
begin
if (aiguillage[i].ADroit=AncienDet) and ((aiguillage[i].ADroitB='Z') or (aiguillage[i].ADroitB='')) then
begin
aiguillage[i].ADroit:=detect;
Affiche('Réaffectation '+BTypeToChaine(typ)+' '+intToSTR(aiguillage[i].Adresse)+' droit',clyellow);
config_modifie:=true;
end;
if (aiguillage[i].ADevie=AncienDet) and ((aiguillage[i].ADevieB='Z') or (aiguillage[i].AdevieB='')) then
begin
aiguillage[i].ADevie:=detect;
Affiche('Réaffectation '+BTypeToChaine(typ)+' '+intToSTR(aiguillage[i].Adresse)+' dévié',clyellow);
config_modifie:=true;
end;
if (aiguillage[i].APointe=AncienDet) and ((aiguillage[i].ApointeB='Z') or (aiguillage[i].ApointeB=''))then
begin
aiguillage[i].APointe:=detect;
Affiche('Réaffectation '+BTypeToChaine(typ)+' '+intToSTR(aiguillage[i].Adresse)+' pointe',clyellow);
config_modifie:=true;
end;
end;
if (typ=tjd) or (typ=tjs) or (typ=crois) then
begin
if (aiguillage[i].ADroit=AncienDet) and ((aiguillage[i].ADroitB='Z') or (aiguillage[i].ADroitB='')) then
begin
aiguillage[i].ADroit:=detect;
Affiche('Réaffectation '+BTypeToChaine(typ)+' '+intToSTR(aiguillage[i].Adresse)+' Adroit',clyellow);
config_modifie:=true;
end;
if (aiguillage[i].ADevie=AncienDet) and ((aiguillage[i].ADevieB='Z') or (aiguillage[i].ADevieB='')) then
begin
aiguillage[i].ADevie:=detect;
Affiche('Réaffectation '+BTypeToChaine(typ)+' '+intToSTR(aiguillage[i].Adresse)+' Ddevie',clyellow);
config_modifie:=true;
end;
if (aiguillage[i].DDroit=AncienDet) and ((aiguillage[i].DDroitB='Z') or (aiguillage[i].DDroitB='')) then
begin
aiguillage[i].DDroit:=detect;
Affiche('Réaffectation '+BTypeToChaine(typ)+' '+intToSTR(aiguillage[i].Adresse)+' Ddroit',clyellow);
config_modifie:=true;
end;
if (aiguillage[i].DDevie=AncienDet) and ((aiguillage[i].DdevieB='Z') or (aiguillage[i].dDevieB='')) then
begin
aiguillage[i].DDevie:=detect;
Affiche('Réaffectation '+BTypeToChaine(typ)+' '+intToSTR(aiguillage[i].Adresse)+' Ddevie',clyellow);
config_modifie:=true;
end;
end;
end;
// réaffecte la listebox aiguillages
formconfig.ListBoxAig.Clear;
for i:=1 to MaxAiguillage do
begin
s:=encode_aig(i);
formConfig.ListBoxAig.Items.AddObject(s,Pointer(clYellow));
Aiguillage[i].modifie:=false;
end;
formconfig.ListBoxAig.itemindex:=0;
// dans les signaux
for i:=1 to NbreSignaux do
begin
chgt:=false;
if signaux[i].Adr_det1=AncienDet then begin signaux[i].Adr_det1:=detect;chgt:=true;end;
if signaux[i].Adr_det2=AncienDet then begin signaux[i].Adr_det2:=detect;chgt:=true;end;
if signaux[i].Adr_det3=AncienDet then begin signaux[i].Adr_det3:=detect;chgt:=true;end;
if signaux[i].Adr_det4=AncienDet then begin signaux[i].Adr_det4:=detect;chgt:=true;end;
if (signaux[i].Btype_suiv1=det) and (signaux[i].Adr_el_suiv1=AncienDet) then begin signaux[i].Adr_el_suiv1:=detect;chgt:=true;end;
if (signaux[i].Btype_suiv2=det) and (signaux[i].Adr_el_suiv2=AncienDet) then begin signaux[i].Adr_el_suiv2:=detect;chgt:=true;end;
if (signaux[i].Btype_suiv3=det) and (signaux[i].Adr_el_suiv3=AncienDet) then begin signaux[i].Adr_el_suiv3:=detect;chgt:=true;end;
if (signaux[i].Btype_suiv4=det) and (signaux[i].Adr_el_suiv4=AncienDet) then begin signaux[i].Adr_el_suiv4:=detect;chgt:=true;end;
if chgt then Affiche('Changement détecteur dans signal '+intToSTR(signaux[i].adresse),clYellow);
end;
formconfig.ListBoxSig.Clear;
longestLength:=0;
for i:=1 to NbreSignaux do
begin
s:=encode_signal(i); // encode la ligne depuis le tableau feux
//Affiche(s,clwhite);
if s<>'' then
begin
formconfig.ListBoxSig.Items.Add(s);
// trouver la chaine la plus longue pour la future scrollbar
l:=Length(s);
if l>LongestLength then
begin
LongestString:=s;
LongestLength:=l;
end;
Signaux[i].modifie:=false;
end;
end;
PixelLength:=formconfig.ListboxSig.Canvas.TextWidth(LongestString);
// positionne une scrollbar dans la listbox - pour l'enlever, envoyer 0 dans pixelLength
SendMessage(formconfig.ListBoxSig.Handle,LB_SETHORIZONTALEXTENT,PixelLength,0);
// TCOs
for i:=1 to NbreTCO do
begin
for y:=1 to NbreCellY[i] do
for x:=1 to NbreCellX[i] do
begin
if (tco[i,x,y].Adresse=AncienDet) and (tco[i,x,y].BImage<>Id_Signal) then
begin
tco[i,x,y].Adresse:=detect;
s:='TCO '+intToSTR(i)+' cellule '+intToSTR(x)+','+intToSTR(y)+' ';
s:=s+'Changement adresse '+intToSTR(AncienDet)+' par adresse '+intToSTR(detect);
Affiche(s,clyellow);
end;
end;
Affiche_TCO(i);
end;
end;
+1 -1
View File
@@ -731,7 +731,7 @@ begin
NivDebug:=3;
erreur:=Signal_Precedent(Adr);
NivDebug:=AncDebug;
AfficheDebug('signal précédent='+intToSTR(erreur),clyellow);
AfficheDebug('Signal précédent='+intToSTR(erreur),clyellow);
end;
end.
+45 -6
View File
@@ -60,7 +60,7 @@ object FormModifAction: TFormModifAction
Top = 64
Width = 729
Height = 337
ActivePage = TabSheetOp
ActivePage = TabSheet1
MultiLine = True
TabOrder = 1
object TabSheetDecl: TTabSheet
@@ -255,9 +255,9 @@ object FormModifAction: TFormModifAction
object Label6: TLabel
Left = 258
Top = 8
Width = 118
Width = 124
Height = 13
Caption = 'Condition '#224' observer'
Caption = 'Conditions '#224' observer'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
@@ -265,6 +265,32 @@ object FormModifAction: TFormModifAction
Font.Style = [fsBold]
ParentFont = False
end
object SpeedButtonSupCond: TSpeedButton
Left = 338
Top = 255
Width = 23
Height = 22
Hint = 'Supprime une condition de la liste'
Glyph.Data = {
F6000000424DF600000000000000760000002800000010000000100000000100
04000000000080000000C40E0000C40E00001000000000000000000000000000
8000008000000080800080000000800080008080000080808000C0C0C0000000
FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00FFF9FFFFFFF9
9FFFFF999FFFFF9999FFF99999FFF999999F9999999F9999999FF99999999999
99FFFF99999999999FFFFFF999999999FFFFFFFF9999999FFFFFFFF999999999
FFFFFF99999999999FFFF9999999999999FF9999999F9999999F999999FFF999
999FF9999FFFFF9999FFFF99FFFFFFF99FFFFFFFFFFFFFFFFFFF}
ParentShowHint = False
ShowHint = True
OnClick = SpeedButtonSupCondClick
end
object Label7: TLabel
Left = 240
Top = 258
Width = 93
Height = 13
Caption = 'Supprimer condition'
end
object ListBoxCondTot: TListBox
Left = 0
Top = 60
@@ -279,12 +305,13 @@ object FormModifAction: TFormModifAction
Top = 28
Width = 201
Height = 201
Hint = 'Condition de r'#233'alisation du d'#233'clencheur'
Hint = 'Conditions (chainage en ET) de r'#233'alisation du d'#233'clencheur'
ItemHeight = 13
ParentShowHint = False
ShowHint = True
TabOrder = 1
OnDrawItem = ListBoxConditionsDrawItem
OnKeyDown = ListBoxConditionsKeyDown
OnMouseDown = ListBoxConditionsMouseDown
end
object GroupBox1: TGroupBox
@@ -449,6 +476,18 @@ object FormModifAction: TFormModifAction
TabOrder = 3
OnClick = ButtonAppCondClick
end
object ButtonAjCond: TButton
Left = 128
Top = 276
Width = 75
Height = 25
Hint = 'Ajouter la condition s'#233'lectionn'#233'e dans la liste des conditions'
Caption = 'Ajouter >>>'
ParentShowHint = False
ShowHint = True
TabOrder = 4
OnClick = ButtonAjCondClick
end
end
object TabSheetOp: TTabSheet
Caption = 'Op'#233'rations'
@@ -517,7 +556,7 @@ object FormModifAction: TFormModifAction
Top = 32
Width = 217
Height = 21
ItemHeight = 13
ItemHeight = 0
TabOrder = 0
OnChange = ComboBoxFamilleChange
end
@@ -722,7 +761,7 @@ object FormModifAction: TFormModifAction
Height = 21
Hint = 'Nom du p'#233'riph'#233'rique d'#233'fini dans l'#39'onglet "p'#233'riph'#233'riques COM/USB"'
Style = csDropDownList
ItemHeight = 13
ItemHeight = 0
ParentShowHint = False
ShowHint = True
TabOrder = 4
+205 -24
View File
@@ -84,6 +84,9 @@ type
Descendreopration1: TMenuItem;
N1: TMenuItem;
Supprimeropration1: TMenuItem;
ButtonAjCond: TButton;
SpeedButtonSupCond: TSpeedButton;
Label7: TLabel;
procedure FormCreate(Sender: TObject);
procedure ListBoxOperDrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
@@ -142,6 +145,10 @@ type
procedure Supprimeropration1Click(Sender: TObject);
procedure Monteropration1Click(Sender: TObject);
procedure Descendreopration1Click(Sender: TObject);
procedure ButtonAjCondClick(Sender: TObject);
procedure SpeedButtonSupCondClick(Sender: TObject);
procedure ListBoxConditionsKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Déclarations privées }
public
@@ -286,7 +293,7 @@ begin
CondMemoireEgal : icone:=IconeCondMemoireEgal;
CondMemoireInf : icone:=IconeCondMemoireInf;
CondMemoireSup : icone:=IconeCondMemoireSup;
CondDetAct : Icone:=IconeDet;
end;
ListBoxCondTot.Items.Add(Format('%d%s', [icone, Conditions[i].nom])); // valeur d'index de l'icone dans la ImagelistIcones
ListBoxCondTot.itemHeight:=16; // 16 taille des éléments pour l'icone
@@ -404,7 +411,7 @@ begin
s:=s+'accessoire '+intToSTR(Tablo_Action[i].adresse);
DeclDetAct :
begin
s:=s+'détecteur/Actionneur '+intToSTR(Tablo_Action[i].adresse);
s:=s+'détecteur/Actionneur '+intToSTR(Tablo_Action[i].adresse)+' à '+intToSTR(Tablo_Action[i].etat);
s:=s+' par le train "'+Tablo_Action[i].trainDecl+'"';
end;
DeclZoneDet :
@@ -451,7 +458,7 @@ begin
condMemoireEgal : s:=s+'mémoire '+intToSTR(tablo_action[i].tabloCond[op].adresse)+' à '+intToSTR(tablo_action[i].tabloCond[op].etat);
condMemoireInf : s:=s+'mémoire '+intToSTR(tablo_action[i].tabloCond[op].adresse)+' < '+intToSTR(tablo_action[i].tabloCond[op].etat);
condMemoireSup : s:=s+'mémoire '+intToSTR(tablo_action[i].tabloCond[op].adresse)+' > '+intToSTR(tablo_action[i].tabloCond[op].etat);
condDetAct : s:=s+'det/act '+intToSTR(tablo_action[i].tabloCond[op].adresse)+' à '+intToSTR(tablo_action[i].tabloCond[op].etat)+' train:'+tablo_action[i].tabloCond[op].train;
end;
s:=s+#13;
end;
@@ -677,7 +684,7 @@ end;
// affiche les champs en fonction de l'index du tablo actionneur et de l'index de l'action
procedure Aff_champs(index,IndexCond,IndexAction : integer);
var i,decl,act,cond,icone : integer;
var i,decl,act,cond,icone,adr : integer;
s : string;
begin
if (index<1) then exit;
@@ -751,23 +758,27 @@ begin
for i:=1 to Tablo_Action[index].NbCond do
begin
cond:=Tablo_Action[index].tabloCond[i].numcondition;
s:=conditions[cond].nom;
case cond of
CondVrai : icone:=iconeVrai;
CondFaux : icone:=iconeFaux;
CondVitTrain : icone:=IconeVitTrain;
CondPosAcc : icone:=IconeAccessoire;
condHorl : icone:=IconeLanceHorl;
condTrainSig : icone:=IconeDeclSignal;
condFonction : icone:=IconeFonction;
condBouton : icone:=IconeBouton;
condMemoireEgal: icone:=IconeCondMemoireEgal;
condMemoireSup: icone:=IconeCondMemoireSup;
condMemoireInf: icone:=IconeCondMemoireinf;
end;
items.Add(Format('%d%s', [icone, s])); // valeur d'index de l'icone dans la ImagelistIcones
if (cond<0) or (cond>CondDetAct) then Affiche('Erreur structure conditions',clred)
else
begin
s:=conditions[cond].nom;
case cond of
CondVrai : icone:=iconeVrai;
CondFaux : icone:=iconeFaux;
CondVitTrain : icone:=IconeVitTrain;
CondPosAcc : icone:=IconeAccessoire;
condHorl : icone:=IconeLanceHorl;
condTrainSig : icone:=IconeDeclSignal;
condFonction : icone:=IconeFonction;
condBouton : icone:=IconeBouton;
condMemoireEgal: icone:=IconeCondMemoireEgal;
condMemoireSup: icone:=IconeCondMemoireSup;
condMemoireInf: icone:=IconeCondMemoireinf;
condDetAct: icone:=IconeDet;
end;
items.Add(Format('%d%s', [icone, s])); // valeur d'index de l'icone dans la ImagelistIcones
end;
itemHeight:=16;
end;
if indexCond<>0 then itemIndex:=indexCond-1;
@@ -1016,6 +1027,12 @@ begin
champ1.Visible:=true;
champ2.Visible:=true;
ChampTrain.Visible:=true;
SpinEditHeure1.visible:=false;
SpinEditHeure2.visible:=false;
SpinEditMn1.visible:=false;
SpinEditMn2.visible:=false;
LabelHeureDebut.Visible:=false;
LabelHeureFin.Visible:=false;
end;
CondPosAcc :
begin
@@ -1033,6 +1050,12 @@ begin
SpinEditEtat2.visible:=true;
SpinEditEtat2.MinValue:=0;
SpinEditEtat2.MaxValue:=2;
SpinEditHeure1.visible:=false;
SpinEditHeure2.visible:=false;
SpinEditMn1.visible:=false;
SpinEditMn2.visible:=false;
LabelHeureDebut.Visible:=false;
LabelHeureFin.Visible:=false;
end;
condHorl :
begin
@@ -1055,6 +1078,12 @@ begin
champTrain.Text:=Tablo_Action[index].tabloCond[indexCond].train;
champ1.Visible:=true;
champTrain.Visible:=true;
SpinEditHeure1.visible:=false;
SpinEditHeure2.visible:=false;
SpinEditMn1.visible:=false;
SpinEditMn2.visible:=false;
LabelHeureDebut.Visible:=false;
LabelHeureFin.Visible:=false;
end;
condFonction :
begin
@@ -1064,7 +1093,14 @@ begin
champ1.Visible:=true;
ButtonVoirFonc.Visible:=true;
Label2InfoFonction.Visible:=true;
Label2InfoFonction.Caption:=NomFonction[Tablo_Action[index].tabloCond[indexCond].adresse];
SpinEditHeure1.visible:=false;
SpinEditHeure2.visible:=false;
SpinEditMn1.visible:=false;
SpinEditMn2.visible:=false;
LabelHeureDebut.Visible:=false;
LabelHeureFin.Visible:=false;
Adr:=Tablo_Action[index].tabloCond[indexCond].adresse;
if Adr<100 then Label2InfoFonction.Caption:=NomFonction[adr] else Label2InfoFonction.Caption:='';
end;
condBouton :
begin
@@ -1072,6 +1108,12 @@ begin
champ1.editLabel.Caption:='Numéro de bouton TCO';
champTrain.Text:=Tablo_Action[index].tabloCond[indexCond].train;
champ1.Visible:=true;
SpinEditHeure1.visible:=false;
SpinEditHeure2.visible:=false;
SpinEditMn1.visible:=false;
SpinEditMn2.visible:=false;
LabelHeureDebut.Visible:=false;
LabelHeureFin.Visible:=false;
end;
condMemoireEgal,CondMemoireInf,CondMemoireSup :
begin
@@ -1081,8 +1123,33 @@ begin
champ2.Text:=intToSTR(Tablo_Action[index].tabloCond[indexCond].etat);
Champ2.EditLabel.Caption:='Valeur';
Champ2.Visible:=true;
SpinEditHeure1.visible:=false;
SpinEditHeure2.visible:=false;
SpinEditMn1.visible:=false;
SpinEditMn2.visible:=false;
LabelHeureDebut.Visible:=false;
LabelHeureFin.Visible:=false;
end;
condDetAct :
begin
champ1.Text:=intToSTR(Tablo_Action[index].tabloCond[indexCond].adresse);
champ1.editLabel.Caption:='Adresse';
champ1.Visible:=true;
champ2.Visible:=false;
SpinEditHeure1.visible:=false;
SpinEditHeure2.visible:=false;
SpinEditMn1.visible:=false;
SpinEditMn2.visible:=false;
LabelHeureDebut.Visible:=false;
LabelHeureFin.Visible:=false;
ChampTrain.Visible:=true;
ChampTrain.Text:=Tablo_Action[index].tabloCond[indexCond].train;
SpinEditEtat2.Value:=Tablo_Action[index].tabloCond[indexCond].etat;
SpinEditEtat2.visible:=true;
SpinEditEtat2.hint:='Etat du détecteur/actionneur'+#13+
'0=non activé'+#13+
'1=activé';
end;
end;
end;
end;
@@ -1170,6 +1237,46 @@ begin
ListBoxOperations.ItemIndex:=clicAction;
end;
procedure supprime_condition;
var i,indexSrc,idBD,NbCond,NumCond,NumOp : integer;
s : string;
begin
indexSrc:=formModifaction.listboxConditions.ItemIndex;
if (indexSrc<0) or (formModifaction.listboxConditions.Count=1) then exit;
idBD:=ligneClicAct+1;
NbCond:=Tablo_Action[idBD].NbCond;
if NbCond<1 then exit;
NumCond:=Tablo_Action[idBD].TabloCond[indexSrc+1].numcondition;
// NumOp:=Tablo_Action[idBD].tabloOp[I [indexSrc+1].numcondition;
s:='Voulez vous supprimer la condition '+#13+conditions[NumCond].Nom+' ?';
if Application.MessageBox(pchar(s),pchar('confirm'), MB_YESNO or MB_DEFBUTTON2 or MB_ICONQUESTION)=idNo then exit;
// supprimer
FormModifAction.listboxConditions.Items.Delete(indexSrc);
for i:=IndexSrc+1 to NbCond-1 do
begin
Tablo_Action[idBD].TabloCond[i]:=Tablo_Action[idBD].TabloCond[i+1];
end;
dec(NbCond);
Tablo_Action[idBD].NbCond:=NbCond;
Setlength(Tablo_Action[idBD].tabloCond,NbCond+1);
Aff_champs(idBD,IndexSrc,1); //???
exit;
// réencoder la ligne
s:=encode_actions(idBD);
// maj combobox
FormModifAction.ComboBoxActions.Items[idBD-1]:=s;
FormModifAction.ComboBoxActions.ItemIndex:=idbd-1;
end;
procedure supprime_operation;
var i,indexSrc,idBD,NbOp,NumOp : integer;
s : string;
@@ -1641,12 +1748,14 @@ begin
CondPosAcc : Tablo_Action[ligneclicact+1].tabloCond[cliccond+1].accessoire:=i;
CondTrainSig : Tablo_Action[ligneclicact+1].tabloCond[cliccond+1].adresse:=i;
CondFonction : begin
if i>100 then i:=1;
Tablo_Action[ligneclicact+1].tabloCond[cliccond+1].adresse:=i;
Label2InfoFonction.caption:=NomFonction[i];
end;
CondBouton : Tablo_Action[ligneclicact+1].tabloCond[cliccond+1].adresse:=i;
CondMemoireEgal,CondMemoireInf,CondMemoireSup
: Tablo_Action[ligneclicact+1].tabloCond[cliccond+1].adresse:=i;
CondDetAct : Tablo_Action[ligneclicact+1].tabloCond[cliccond+1].adresse:=i;
end;
maj_combocactions(ligneclicAct);
end;
@@ -1745,6 +1854,7 @@ begin
cond:=Tablo_Action[ligneclicact+1].tabloCond[cliccond+1].numcondition;
case cond of
CondVitTrain,CondTrainSig : Tablo_Action[ligneclicact+1].tabloCond[cliccond+1].train:=ChampTrain.Text;
CondDetAct : Tablo_Action[ligneclicact+1].tabloCond[cliccond+1].train:=ChampTrain.Text;
end;
maj_combocactions(ligneclicAct);
@@ -1764,6 +1874,7 @@ begin
cond:=Tablo_Action[ligneclicact+1].tabloCond[cliccond+1].numcondition;
case cond of
CondPosAcc : Tablo_Action[ligneclicact+1].tabloCond[cliccond+1].etat:=i;
CondDetAct : Tablo_Action[ligneclicact+1].tabloCond[cliccond+1].etat:=i;
end;
maj_combocactions(ligneclicAct);
end;
@@ -1802,8 +1913,8 @@ begin
end;
procedure TFormModifAction.ListBoxOperationsKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
var nb : integer;
var Key: Word; Shift: TShiftState);
var nb : integer;
begin
nb:=Tablo_Action[ligneclicAct+1].NbOperations;
if (nb<1) or clicliste then exit;
@@ -1889,4 +2000,74 @@ begin
descend_operation;
end;
procedure TFormModifAction.ButtonAjCondClick(Sender: TObject);
var indexSrc,idBD,NbOp,NbCond,i : integer;
s : string;
begin
indexSrc:=listboxCondTot.ItemIndex;
if indexSrc<0 then exit;
s:=ListBoxCondTot.Items[IndexSrc];
i:=index_condition(s);
if i=0 then exit;
idBD:=ligneClicAct+1;
NbOp:=Tablo_Action[idBD].NbOperations;
NbCond:=Tablo_Action[idBD].NbCond;
inc(NbCond);
Tablo_Action[idBD].NbCond:=NbCond;
Setlength(Tablo_Action[idBD].TabloCond,NbCond+1);
// le nouveau numéro de condition c'est l'index de la listboxCond
Tablo_Action[idBD].tabloCond[NbCond].numcondition:=i;
Aff_champs(idbd,nbCond,Nbop);
clicCond:=NbCond-1;
ListBoxOperations.ItemIndex:=clicCond;
end;
procedure TFormModifAction.SpeedButtonSupCondClick(Sender: TObject);
begin
supprime_condition;
end;
procedure TFormModifAction.ListBoxConditionsKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
var nb : integer;
begin
nb:=Tablo_Action[ligneclicAct+1].NbCond;
if (nb<1) or clicliste then exit;
if key=VK_delete then supprime_Condition;
if ord(Key)=VK_UP then
begin
begin
if clicCond>0 then
begin
dec(clicCond);
Aff_champs(ligneclicAct+1,ClicCond+1,ClicAction+1);
end;
end;
end;
if ord(Key)=VK_DOWN then
begin
begin
if clicCond<nb-1 then
begin
inc(clicCond);
Aff_champs(ligneclicAct+1,ClicCond+1,ClicAction+1);
end;
end;
end;
if (Shift = [ssCtrl]) and (key = ord('A')) then
begin
ListBoxConditions.SelectAll;
end;
clicListe:=false;
end;
end.
+12 -2
View File
@@ -221,7 +221,12 @@ procedure TFormPilote.RadioVertClick(Sender: TObject);
begin
Raz_combine;
Signaux[0].AncienEtat:=Signaux[0].EtatSignal;
if nation=1 then Maj_Etat_Signal(0,vert) else Maj_Etat_Signal(0,vertB) ;
if nation=1 then
begin
if Signaux[index_Signal(AdrPilote)].checkFV then Maj_Etat_Signal(0,blanc)
else Maj_Etat_Signal(0,vert);
end
else Maj_Etat_Signal(0,vertB) ;
dessine_signal_pilote;
end;
@@ -254,7 +259,12 @@ procedure TFormPilote.RadioRougeClick(Sender: TObject);
begin
Raz_combine;
Signaux[0].AncienEtat:=Signaux[0].EtatSignal;
Maj_Etat_Signal(0,semaphore);
if nation=1 then
begin
if Signaux[index_Signal(AdrPilote)].checkFV then Maj_Etat_Signal(0,violet)
else Maj_Etat_Signal(0,semaphore);
end
else Maj_Etat_Signal(0,vertB) ;
dessine_signal_pilote;
end;
+1 -1
View File
@@ -6310,7 +6310,7 @@ object FormPrinc: TFormPrinc
Top = 200
Width = 393
Height = 265
ActivePage = TabSheetSig
ActivePage = TabSheetTrains
Anchors = []
TabOrder = 5
OnChange = PageControlChange
+130 -143
View File
@@ -379,7 +379,6 @@ type
procedure Demandetataccessoires1Click(Sender: TObject);
procedure LancerCDMrail1Click(Sender: TObject);
procedure TrackBarVitChange(Sender: TObject);
procedure EditVitesseChange(Sender: TObject);
procedure ButtonEnvClick(Sender: TObject);
procedure OpRoulageClick(Sender: TObject);
procedure Demandetatdtecteurs1Click(Sender: TObject);
@@ -461,7 +460,6 @@ type
procedure PageControlChange(Sender: TObject);
procedure Dtacherlecompteur1Click(Sender: TObject);
procedure PopupMenuCompteursPopup(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure TrackBarSigChange(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
private
@@ -482,11 +480,6 @@ type
procedure ImCOnDblclic(Sender : TObject);
procedure ImC0Onclic(Sender : Tobject);
procedure ImTBOnChange(Sender : Tobject);
{$IF CompilerVersion >= 28.0}
procedure DataReceived(const Data: TidBytes);
{$ELSE}
procedure DataReceived(const Data: string);
{$IFEND}
end;
@@ -612,6 +605,7 @@ CondBouton=8;
CondMemoireEgal=9;
CondMemoireSup=10;
CondMemoireInf=11;
CondDetAct=12;
// Type d'opération (action)
Action0=0;
@@ -744,12 +738,12 @@ Taiguillage = record
end;
TtabloDet = array[0..MaxParcoursTablo] of integer;
TSignal = record
adresse, aspect : integer; // adresse du signal, aspect (2 feux..9 feux 12=direction 2 feux .. 16=direction 6 feux) (11=signal belge 1)
adresse,aspect,AncienAdresse : integer; // adresse du signal, aspect (2 feux..9 feux 12=direction 2 feux .. 16=direction 6 feux) (11=signal belge 1)
Img : TImage; // Pointeur sur structure TImage du signal
Lbl : TLabel; // pointeur sur structure Tlabel du signal
checkFB : TCheckBox; // pointeur sur structure Checkbox "demande feu blanc"
checkFR : boolean; // demande feu rouge cli
checkFV : boolean; // demande feu vert cli
checkFV : boolean; // demande feu vert cli ou si signal 2 feux, false=signal violet/blanc ou true=vert/rouge
FeuVertCli : boolean ; // avec checkbox ou pas
FeuRougeCli : boolean ; // avec checkbox ou pas
contrevoie : boolean; // signal de contrevoie (SNCB)
@@ -1165,10 +1159,11 @@ var
train : string;
end;
// exécution des opérations des actions differées par le timer
seq_actions : array[1..30] of
record
indiceAction,IndiceOp, // indice à partir duquel reprendre l'exécution
op,tick : integer; // opération
tick : integer; // opération
end;
Declencheurs : array[0..10] of
@@ -1182,14 +1177,14 @@ var
NomFonction : array[0..100] of string; // nom de la fonction
ArbreFonc : array[0..100,0..100] of integer; // fonction sous forme d'arbre
blocUSB : array[1..10] of record
blocUSB : array[1..10] of record // 10 éléments pour 10 blocs USB
AffTrain : string;
rotatifM,rotatifP,clic,increment : integer;
Bp1,bp2,bp3,bp4,bp5,bp6,bp7,bp8,bp9,bp10 : integer;
Bp1,bp2,bp3,bp4,bp5,bp6,bp7,bp8,bp9,bp10 : integer; // 10 boutons par bloc
Fbp1,fbp2,fbp3,Fbp4,fbp5,fbp6,Fbp7,fbp8,fbp9,Fbp10 : integer; // fonctions F des BP
Fnp1,fnp2,fnp3,Fnp4,fnp5,fnp6,Fnp7,fnp8,fnp9,Fnp10 : integer; // état F des BP
Tbp1,Tbp2,Tbp3,Tbp4,Tbp5,Tbp6,Tbp7,Tbp8,Tbp9,Tbp10 : integer; // temps de retombée de la fonction F
Tcp : array[1..10] of integer; // valeur courante de la tempo de retombée
Tcp : array[1..10] of integer; // valeur courante de la tempo de retombée de la fonction F
end;
Memoire : array[0..MaxMemoires] of integer;
@@ -1366,12 +1361,14 @@ function Signal_precedent(adresse : integer) : integer;
function signal_rouge(adresse : word) : boolean;
function chaine_signal(adresse : word) : string;
function signal_suivant_det(det1,det2 : integer) : integer;
procedure envoi_signauxCplx;
procedure composant(c : tComponent;fond,texte : tColor);
procedure maj_couleurs;
{$IF CompilerVersion < 28.0}
procedure AffTexteIncliBordeTexture(c : TCanvas; x,y : integer; Fonte : tFont;
clBord : TColor; EpBord : integer; PenMode : TPenMode;
texte : string; AngleDD : longint);
{$IFEND}
{$IF CompilerVersion >= 28.0}
procedure change_style;
{$IFEND}
@@ -1398,7 +1395,7 @@ procedure trouve_element(el: integer; TypeEl : TEquipement); overload;
procedure trouve_element_V1(el: integer; TypeEl : TEquipement; Offset,branche_pref,OffsetDsBranche : integer;erreur : boolean;it : integer);
procedure procetape(s : string);
procedure Affiche_routes_brut;
procedure TJD4(adr1,pos1,adr2,pos2 : integer;var c1,c2 : char);
procedure TJD4(pos1,pos2 : integer;var c1,c2 : char);
procedure affecte_trains_config;
procedure Fonction_Loco_Operation_XNet(loco,fonction,etat : integer);
procedure calcul_equations_coeff(indexTrain : integer);
@@ -1736,20 +1733,7 @@ begin
with formprinc do
begin
if (idTrainClic<1) or (idTrainClic>nTrains) then exit;
// Affiche('origine='+intToSTR(origine),clYellow);
{if origine=1 then
begin
// s:=editVitesse.Text;
// val(s,vit,erreur);
//Affiche('vitconsigne1='+intToSTR(vit),clOrange);
if (erreur<>0) or (vit<-128) or (vit>127) then exit;
vitesse_loco(trains[IdTrainClic].nom_train,
idTrainClic,
trains[idTrainClic].adresse,
trains[idTrainClic].vitesseCons, // vit
10,vientde);
end; }
//if origine=2 then
begin
vit:=trains[idTrainUSB].VitesseBlocUSB;
VientDe:=consigneBLocUSB; // ne génère pas event_vitesse
@@ -2140,7 +2124,7 @@ begin
if LanceHorl then Demarre_horloge;
// création des compteurs
if (compteur<0) or (compteur>3) then compteur:=1;
for i:=1 to 1 do
for i:=1 to 1 do // il n'y a qu'une seule fenetre compteurs
begin
formCompteur[i]:=TformCompteur.Create(nil);
with formCompteur[i] do
@@ -2191,11 +2175,10 @@ begin
interface_ou_cdm; // démarrer l'interface , génère les evts détecteurs ; ou cdm
// créer les compteurs après avoir téléchargé la liste des trains de CDM
// créer les compteurs GroupBox après avoir téléchargé la liste des trains de CDM
s:='Création des compteurs GB';
procetape(s);
for i:=1 to ntrains do
begin
cree_GB_compteur(i);
@@ -2205,9 +2188,6 @@ begin
calcul_equations_coeff(i);
end;
s:='Fin du préliminaire';
procetape(s);
formprinc.SetFocus;
menu_selec;
@@ -2229,8 +2209,16 @@ begin
end;
Maj_Signaux(false);
// envoyer les signaux à l'interface
for i:=1 to NbreSignaux do
Signaux[i].AncienEtat:=9999; // pour forcer le pilotage des signaux sur le changement d'état
envoi_signauxCplx;
change_clic_train(1); // sélectionne le train 1
s:='Fin du préliminaire';
procetape(s);
end;
// renvoie une chaine ASCI Hexa affichable à partir d'une chaîne
@@ -2268,7 +2256,7 @@ begin
end;
// procédures liaisons série com usb ------------------------------------------------
// envoie une chaine s à un périphérique COM/USB en fonction du composant comp
// envoie une chaine s à un périphérique COM/USB en fonction du composant AsyncPro tApdComport
// contrôle si le pointeur comp est valide par traitement de l'exception
{$IF CompilerVersion >= 28.0}
procedure envoi_usb_comp(comp : tApdComPort;s : variant);
@@ -3169,6 +3157,7 @@ begin
EndPaint(canvashd,ps);
end;
{$IF CompilerVersion < 28.0}
// Ecrire sur un canvas un texte avec un angle, avec ou sans bordure, monochrome ou à face texturée
// procédure pour Delphi 7
// params : C = Canvas
@@ -3243,6 +3232,7 @@ begin
SelectObject(dc,AncBrush);
DeleteObject(NouvBrush);
end;
{$IFEND}
// inverse une image (miroir horizontal) et la met dans dest
// Utilisé pour les signaux belges, et les trains
@@ -4050,9 +4040,11 @@ procedure dessine_signal2(Acanvas : Tcanvas;x,y : integer;frX,frY : single;EtatS
var Temp,rayon,xViolet,YViolet,xBlanc,yBlanc,
LgImage,HtImage,code,combine : integer;
ech : real;
styleF : boolean;
begin
code_to_aspect(Etatsignal,code,combine);
rayon:=round(DiamFeu*frX);
styleF:=signaux[index].checkFV; // si true : c'est un feu vert / rouge
// récupérer les dimensions de l'image d'origine du signal
with Formprinc.Image2feux.Picture.Bitmap do
@@ -4096,8 +4088,10 @@ begin
cercle(ACanvas,xViolet,yViolet,rayon,clBlack,GrisF);
// allumages
if ((code=blanc_cli) and (clignotant)) or (code=blanc) then cercle(ACanvas,xBlanc,yBlanc,rayon,clBlack,clWhite);
if code=violet then cercle(ACanvas,xViolet,yViolet,rayon,clBlack,clViolet);
if not(styleF) and (((code=blanc_cli) and (clignotant)) or (code=blanc)) then cercle(ACanvas,xBlanc,yBlanc,rayon,clBlack,clWhite);
if styleF and (((code=blanc_cli) and (clignotant)) or (code=blanc)) then cercle(ACanvas,xBlanc,yBlanc,rayon,clBlack,clGreen);
if (code=violet) and not(styleF) then cercle(ACanvas,xViolet,yViolet,rayon,clBlack,clViolet);
if (code=violet) and styleF then cercle(ACanvas,xViolet,yViolet,rayon,clBlack,clRed);
end;
// dessine les feux sur une cible à 3 feux
@@ -4756,7 +4750,12 @@ begin
3 : angle:=900;
4 : angle:=1800;
end;
{$IF CompilerVersion < 28.0}
AffTexteIncliBordeTexture(Acanvas,XTexte,YTexte,Acanvas.Font,clYellow,0,pmcopy,intToSTR(vitesse),angle);
{$ELSE}
font.orientation:=angle;
textout(Xtexte,Ytexte,intToSTr(vitesse));
{$IFEND}
end;
end;
end
@@ -5317,7 +5316,6 @@ begin
begin
Combotrains.ItemIndex:=IdTrainclic-1;
EditAdrTrain.Text:=intToSTR(trains[idTrainClic].adresse);
//Editvitesse.Text:=intToSTR(trains[idTrainClic].vitesseCons);
end;
// affiche le compteur du train cliqué
affiche_train_compteur(1);
@@ -5367,7 +5365,7 @@ begin
formCompteur[1].Show;
end;
// créée une image dynamiquement dans la partie droite pour un nouveau compteur par train
// créée les composants trains dynamiquement dans la partie droite pour un nouveau compteur par train
// rang commence à 1
procedure cree_GB_compteur(rang : integer);
const HautTb=10; // hauteur trackbar
@@ -5444,7 +5442,7 @@ begin
// le compteurT[].FCBitmap sera créé dans init_compteur
// bouton
// bouton RAZ vitesse 0
CompteurT[rang].bouton:=Tbutton.create(CompteurT[rang].gb);
with compteurT[rang].bouton do
begin
@@ -5473,12 +5471,14 @@ begin
ctl3D:=false;
onChange:=formprinc.ImTBOnChange;
end;
// compteur du train type groupbox (gb)
init_compteur(rang,CompteurT[rang].gb);
end;
// cliqué sur image, labelnom ou labelvitesse
// cliqué train
// cliqué sur train
procedure tFormprinc.ImageTrainonclick(Sender : tObject);
var P_component : tComponent;
i : integer;
@@ -5889,7 +5889,7 @@ begin
end;
// ajoute une tache dans le tableau taches[]
// pour pilotage dans le timer. On pilotera une tache par tick timer (1/10ème de s)
// qui seront ensuite traitées par le timer. On pilotera une tache par tick timer (1/10ème de s)
// ttache=ttacheAcc (pilote acc), ttacheVit (vitesse train) , ttacheFF (fonctionF) , ttacheTempo (temporisation)
// temporisation pour le timer avant action
// destinataire (1=CDM 2=XpressNet 3=Dccpp)
@@ -5941,12 +5941,15 @@ end;
// teste la (les) condition(s) d'une action
// action : index de l'action
//zizi
function teste_condition(action : integer) : boolean;
var condValide : boolean;
var condValide,condfinale : boolean;
vit,vit1,vit2,it,pa,m1,m2,hc,n,ncond,cond,etat : integer;
bol : boolean;
tr : string;
begin
// 1 condition - pas de chaînage avec 1 seule condition
// chaînage des conditions en ET
CondFinale:=true;
condValide:=false;
n:=Tablo_Action[action].NbCond;
for ncond:=1 to n do
@@ -5963,7 +5966,7 @@ begin
it:=index_train_nom(tr);
if it>0 then
begin
vit:=Trains[it].vitesseCons;
vit:=Trains[it].vitesseCons;
condvalide:=(vit>=vit1) and (vit<=vit2);
end;
end;
@@ -6031,9 +6034,20 @@ begin
condValide:=false;
if (adr>1) or (adr<=MaxMemoires) then condValide:=memoire[adr]>etat;
end;
condDetAct :
begin
adr:=Tablo_Action[action].tabloCond[ncond].adresse;
etat:=Tablo_Action[action].tabloCond[ncond].etat;
bol:=etat=1;
tr:=Tablo_Action[action].tabloCond[ncond].train;
condValide:=false;
if (adr>1) and (adr<=NbMaxDet) then condValide:=(detecteur[Adr].Etat=bol) and (tr=detecteur[adr].Train);
end;
end;
condFinale:=condFinale and condValide;
end;
result:=condValide;
result:=condFinale;
end;
@@ -6641,8 +6655,6 @@ begin
if (v=adr_loco) then
begin
pasChgTBV:=true; // évite de repositionner la trackbar
//Formprinc.TrackBarVit.Position:=vitesse;
//formprinc.EditVitesse.text:=intToSTR(vitesse);
pasChgTBV:=false;
end;
@@ -8809,7 +8821,7 @@ begin
begin
if teste_condition(i) then
begin
Affiche('ZZ test condition',clRed);
//Affiche('ZZ test condition',clRed);
action(i); // exécute toutes les opérations de l'actionneur i
end
end;
@@ -9019,8 +9031,11 @@ begin
begin
adr:=Signaux[i].adresse;
if not(fermeSC) and (adr<>0) then envoi_signal(adr);
if not modetache then Sleep(25);
Application.processMessages;
if not modetache then
begin
Sleep(25);
Application.processMessages;
end;
end;
end;
@@ -9492,7 +9507,7 @@ end;
// renvoie les adresses des 2 aiguillages adjacents au détecteur "adresse" (avant, après)
// résultat dans var1 et var2
// résultat dans adr1 et adr2
procedure Aig_Adj(adresse : integer;var adr1: integer;var adr2 : integer);
var Branche,IndexBranche,i : integer;
sortie : boolean;
@@ -16160,7 +16175,7 @@ begin
if adrSuiv>NbMaxDet then
begin
if AdrSuiv=9996 then Affiche_evt('La position de l''aiguillage '+intToSTR(AigMal)+' est inconnue',clred);
Affiche_evt('Info 1-0 '+intToSTR(AdrSuiv)+' : pas de suivant detecteur_suivant_el '+intToSTR(det1)+' '+intToSTR(det3),clWhite);
Affiche_evt('Info 1-0 '+intToSTR(AdrSuiv)+' : pas de suiv det_suivant_el '+intToSTR(det1)+' '+intToSTR(det3),clWhite);
MemZone[det1,det3].etat:=FALSE; // dévalide l'ancienne zone
MemZone[det1,det3].train:='';
MemZone[det1,det3].Adrtrain:=0;
@@ -17442,7 +17457,7 @@ var decl,op,af,access,sortie,t,v,etat,adr : integer;
Ts : TAccessoire;
tr : single;
begin
// tablo action n'est pas dynamique, mais Tablo_action[].TabloOp oui
// tablo action n'est pas un tableau dynamique, mais Tablo_action[].TabloOp oui
if length(Tablo_Action[i].tabloOP)-1<ida then exit;
st:='Action '+Tablo_Action[i].NomAction+' op='+intToSTR(ida)+' : ';
op:=Tablo_Action[i].tabloOp[ida].numoperation;
@@ -17545,7 +17560,7 @@ begin
if (op=ActionCdePeriph) then
begin
v:=Tablo_Action[i].TabloOp[ida].periph; // numéro d'accessoire
Affiche(st+' Envoi commande '+Tablo_Action[i].TabloOp[ida].chaine,clYellow);
Affiche(st+' Envoi commande '+Tablo_Action[i].TabloOp[ida].chaine,clYellow);
af:=com_socket(v);
if af=1 then envoi_periph_usb(i,ida); // numéro d'actionneur
if af=2 then envoi_socket_periph_act(i,ida); // numéro d'actionneur
@@ -17557,7 +17572,7 @@ begin
trainDest:=Tablo_Action[i].tabloOp[ida].train ;
etat:=Tablo_Action[i].tabloop[ida].etat;
t:=Tablo_Action[i].tabloop[ida].TempoF;
tr:=Tablo_Action[i].tabloop[ida].TempoF; // pour affichage uniquement
tr:=Tablo_Action[i].tabloop[ida].TempoF/10; // pour affichage uniquement
Affiche(st+' TrainDest='+trainDest+' F'+IntToSTR(Tablo_Action[i].tabloOp[ida].fonctionF)+':'+intToSTR(etat)+' t='+Format('%.1f', [tr])+'s',clyellow);
envoie_fonction(Tablo_Action[i].TabloOp[ida].fonctionF,etat,trainDest);
@@ -17634,6 +17649,7 @@ procedure action(action : integer);
var i,nb : integer;
sort : boolean;
begin
if index_seqAct>0 then if seq_actions[index_seqAct].indiceAction=action then exit; // si l'action est déja en cours d'exécution dans le timer, ne pas la relancer
nb:=Tablo_Action[action].NbOperations;
i:=1;
sort:=false;
@@ -17750,6 +17766,7 @@ begin
if not(fd) and not(fm) then exit;
detecteur[adr].Etat:=etat=1;
detecteur[adr].Train:=TrainDecl;
end;
@@ -18108,7 +18125,6 @@ var dr,i,AdrSuiv,AdrSignal,AdrDetSignal,index,Etat01,AdrPrec,d1,d2,AdrTrain : in
TypeSuiv : tequipement;
s : string;
begin
//Affiche('Event Det '+inTToSTR(adresse)+' '+IntToSTR(etat01)+' '+train,ClCyan);
if adresse>NbMaxDet then
begin
Affiche('Erreur 82 : reçu adresse de détecteur trop grande : '+intToSTR(adresse),clred);
@@ -18144,6 +18160,8 @@ begin
//if (train='') and (s<>'') then train:=s;
if Etat then Etat01:=1 else Etat01:=0;
//Affiche('Event Det '+inTToSTR(adresse)+' '+IntToSTR(etat01)+' '+train,ClCyan);
if traceliste or (debugRoulage and roulage) then Affiche('Event Det '+inTToSTR(adresse)+' '+IntToSTR(etat01),ClCyan);
// vérifier si l'état du détecteur est déja stocké, car on peut reçevoir plusieurs évènements pour le même détecteur dans le même état
// on reçoit un doublon dans deux index consécutifs.
@@ -18205,6 +18223,7 @@ begin
if AdrTrain<>0 then
begin
Maj_detecteurs_canton(i,AdrTrain,Adresse);
train:=detecteur[adresse].train;
end;
end;
inc(i);
@@ -18259,12 +18278,19 @@ begin
if etat then i:=1 else i:=0;
if not(confignulle) then calcul_zones(adresse,true); // *** calcul zones
// gérer l'évènement actionneur pour action
event_act(Adresse,0,i,'');
// gérer l'évènement actionneur pour action sur front montant hors mode CDM
if not(CDM_connecte) then event_act(Adresse,0,i,train);
end;
// gérer l'évènement actionneur pour action sur état à 1 en mode CDM
// car le nom du train est passé au 2eme message du détecteur à 1 comIP , et donc
// le détecteur n'est plus en front montan
if etat and CDM_connecte then
begin
if train<>'_NONE' then event_act(Adresse,0,i,train);
end;
// détection fronts descendants
if ancien_detecteur[Adresse] and not(detecteur[Adresse].etat) and (N_Event_det<Max_event_det) then
begin
// si le FD du détecteur a déjà été stocké à l'index précédent ne pas en tenir compte
@@ -21055,8 +21081,14 @@ begin
index:=CondMemoireSup;
famille:=0;
end;
with Conditions[CondDetAct] do
begin
nom:='Détecteur/actionneur';
index:=CondDetAct;
famille:=0;
end;
NbreConditions:=CondMemoireInf;
NbreConditions:=CondDetAct;
end;
procedure init_declencheurs;
@@ -21221,42 +21253,6 @@ begin
end;
end;
{$IF CompilerVersion >= 28.0}
procedure TFormPrinc.DataReceived(const Data: TidBytes);
var i,l,j,lo : integer;
begin
l:=length(data);
lo:=long_recue; // longueur ancien recu, non encore traité
j:=1;
for i:=lo+1 to lo+l do
begin
chaine_recue[i]:=ord(Data[j]); // mettre recu à la fin
inc(j);
end;
long_recue:=l+lo;
//if traceTrames then afficheDebug('Tick='+intToSTR(tick)+'/Rec '+chaine_hex(data),clWhite);
interprete_reponse;
end;
{$ELSE}
procedure TFormPrinc.DataReceived(const Data: string);
var i,l,j,lo : integer;
begin
l:=length(data);
lo:=long_recue; // longueur ancien recu, non encore traité
j:=1;
for i:=lo+1 to lo+l do
begin
chaine_recue[i]:=ord(Data[j]); // mettre recu à la fin
inc(j);
end;
long_recue:=l+lo;
if traceTrames then afficheDebug('Tick='+intToSTR(tick)+'/Rec '+chaine_hex(data),clWhite);
interprete_reponse;
end;
{$IFEND}
procedure tFormPrinc.ClientInfoError(Sender: TObject; Socket: TCustomWinSocket;ErrorEvent: TErrorEvent; var ErrorCode: Integer);
begin
//Affiche('IE',clyellow);
@@ -21301,13 +21297,14 @@ end;
// démarrage principal du programme signaux_complexes
procedure TFormPrinc.FormCreate(Sender: TObject);
var n,t,i,j,index,OrgMilieu : integer;
var n,t,i,j,index,OrgMilieu,erreur : integer;
s,vc : string;
trouve : boolean;
Sr : TSearchRec;
tmP,tmA : tMenuItem;
begin
menu_deselec;
Etape:=0;
Ancien_Nom_Style:='';
Nom_style_aff:='windows';
af:='Client TCP-IP ou USB CDM Rail - Système XpressNet DCC++ Version '+VersionSC+sousVersion;
@@ -21328,6 +21325,20 @@ begin
FormCompteur[index]:=nil;
end;
debug:=0;
if ParamCount<>0 then
begin
s:=lowercase(ParamSTR(1));
i:=pos('debug=',s);
if i<>0 then
begin
delete(s,1,6);
val(s,debug,erreur);
end;
procetape('Démarrage');
end;
BorderStyle:=bsSizeable;
Caption:=af;
configPrete:=false; // form config prete
@@ -21378,7 +21389,8 @@ begin
GroupBoxTrains.visible:=true;
OffsetXFC:=0;
OffsetYFC:=0;
procetape(''); //0
procetape('Init'); //0
NbreTCO:=0;
N_Trains:=0;
IdActTr:=0;
@@ -21409,7 +21421,7 @@ begin
espY:=15;
etat_init_interface:=0;
Echelle:=0;
debug:=0;
heure:=0;
minute:=0;
seconde:=0;
@@ -21423,7 +21435,7 @@ begin
NbreFL:=0;
compteur:=1;
etape:=1;
affevt:=false;
EvtClicDet:=false;
Algo_localisation:=1; // normal
@@ -21591,7 +21603,9 @@ begin
cheminWin:=GetCurrentProcessEnvVar('windir')+'\System32';
end;
// création des composants réseaux
ProcEtape('Création des composants réseaux socket');
// création des composants réseaux socket
// client CDM
ClientSocketCDM:=tClientSocket.Create(nil);
ClientSocketCDM.OnError:=ClientSocketCDMError;
@@ -21781,12 +21795,13 @@ begin
N_trains:=0;
NumTrameCDM:=0;
protocole:=1;
procetape(''); //1
procetape('Remplissage'); //1
for i:=1 to NbMaxDet do
begin
Ancien_detecteur[i]:=false;
detecteur[i].etat:=false;
detecteur[i].train:='';
detecteur[i].index:=0;
end;
for i:=0 to IdClients do
begin
@@ -21835,9 +21850,10 @@ begin
procetape('Lecture de la configuration');
lit_config;
clientInfo.Open; // &&& se connecte au serveur SC et envoie les infos
//clientInfo.Open; // &&& se connecte au serveur SC et envoie les infos
{$IF CompilerVersion >= 28.0}
procetape('Application des styles');
change_style;
{$IFEND}
init_horloge;
@@ -22336,10 +22352,11 @@ begin
end;
// traite les taches par le timer
// une tache est piloter un accessoire, une vitesse de train ou une fonction F
// une tache consiste à piloter un accessoire, une vitesse de train ou une fonction F
// tableau taches[].typeTache
// [].chaine
// [].tempo
// Pilote 1 tache du tableau suivant la valeur de pointeurTaches
procedure traite_taches;
const affe=false;
var i,j,fonc,sortie,etat :integer;
@@ -22353,7 +22370,6 @@ begin
//if affe then Affiche('Tick='+intToSTR(tick)+' Pointeur de taches='+intToSTR(pointeurTaches),clYellow);
// pilote accessoire
i:=1;
//repeat
with taches[i] do
begin
//if affe then Affiche('Traite adr '+intToSTR(Typetache),clLime);
@@ -22455,10 +22471,7 @@ begin
//affiche('Pointeur='+intToSTR(pointeurtaches),clred);
end;
Affiche('Erreur tache typ='+intTOSTR(taches[1].typeTache)+' t='+intToSTR(taches[1].tempo),clred);
exit;
inc(i);
Affiche('INC',clwhite);
//until (i>pointeurtaches);
end;
// timer à 100 ms
@@ -23898,6 +23911,7 @@ begin
end;
// évènement détecteur. Si det=1, Le nom du train est souvent _NONE
// mais est envoyé une 2eme fois avec le nom du train
// si det=0 le nom du train est toujours _NONE
i:=pos('CMDACC-ST_DT',commandeCDM);
if i<>0 then
@@ -25148,8 +25162,7 @@ begin
Maj_icone_train(Image_Train[IdTrainClic],IdTrainClic,clWhite);
IdTrainClic:=i;
EditAdrTrain.Text:=intToSTR(trains[IdTrainClic].adresse);
//editVitesse.Text:=intToSTR(trains[idTrainClic].vitesseCons);
Maj_icone_train(Image_Train[IdTrainClic],IdTrainClic,$e0e0e0);
change_clic_train(i);
//mise à jour compteur train
affiche_train_compteur(1);
@@ -25262,7 +25275,6 @@ begin
if clicTBFen or clicTBGB then exit;
if affevt then Affiche('Changement TrackBarVit',clyellow);
clicTBTrain:=true;
//EditVitesse.Text:=intToSTR(TrackBarVit.position);
s:=editAdrTrain.Text;
val(s,adr,erreur);
if (erreur<>0) or (adr<0) then
@@ -25271,7 +25283,6 @@ begin
exit;
end;
//if not(portCommOuvert) and not(parSocketLenz) and not(CDM_Connecte) then exit;
//s:=editVitesse.Text;
val(s,vit,erreur);
if (erreur<>0) or (vit<-126) or (vit>126) then
begin
@@ -25293,14 +25304,6 @@ begin
clicTBTrain:=false;
end;
procedure TFormPrinc.EditVitesseChange(Sender: TObject);
//var i,e : integer;
begin
{ if pasChgTBV then exit;
val(EditVitesse.Text,i,e);
if (e=0) and (i>=-127) and (i<=128) then TrackBarVit.position:=i;}
end;
procedure TFormPrinc.ButtonEnvClick(Sender: TObject);
var se,s : string;
begin
@@ -26754,7 +26757,8 @@ begin
end;
// renvoie les 2 points d'entrée et de sortie possibles d'une TJD 4 états en fonction de son état passé en paramètres
procedure TJD4(adr1,pos1,adr2,pos2 : integer;var c1,c2 : char);
// résultat dans C1 et C2
procedure TJD4(pos1,pos2 : integer;var c1,c2 : char);
begin
if (pos1=const_droit) and (pos2=const_droit) then begin c1:='D';c2:='D';end;
if (pos1=const_devie) and (pos2=const_droit) then begin c1:='D';c2:='S';end;
@@ -28427,9 +28431,6 @@ begin
Signaux[2].Img.picture.bitmap.width:=l;
Signaux[2].Img.picture.bitmap.height:=h;
Signaux[2].Img.Canvas.StretchDraw(rect(0,0,l,h),Formprinc.Image7feux.Picture.Bitmap);
// .Bitmap:=Image7feux.Picture.Bitmap;
exit;
@@ -28441,6 +28442,7 @@ begin
Signaux[1].Img.Picture.Bitmap.Modified:=True;
end;
// changement TrackBar zoom compteurs
procedure TFormPrinc.TrackBarZCChange(Sender: TObject);
const maxi=10;
mini=0;
@@ -28459,8 +28461,6 @@ end;
procedure TFormPrinc.Propritsdescompteurs1Click(Sender: TObject);
begin
if affEvt then Affiche('Clic propriétés compteurs',clYellow);
//s:=((Tpopupmenu(Tmenuitem(sender).GetParentMenu).PopupComponent) as TImage).name; // nom du composant, pour récupérer l'index du train (ex: ImageSignal2)
//ligneclicTrain:=extract_int(s)-1; // extraire l'adresse (ex 2)
formconfig.PageControl.ActivePage:=formconfig.TabSheetCompt;
formconfig.showmodal;
formconfig.close;
@@ -28474,7 +28474,7 @@ end;
procedure TFormPrinc.Dtacherlecompteur1Click(Sender: TObject);
begin
change_clic_train(IdTrainClic);
formCompteur[1].Show;
formCompteur[1].Show; // prévu plusieurs fenetres détachables pour les compteurs mais on en utilise qu'une, la 1
end;
procedure TFormPrinc.PopupMenuCompteursPopup(Sender: TObject);
@@ -28484,20 +28484,7 @@ begin
menu.Items[1].caption:='Extraire le compteur du train '+trains[IdTrainClic].nom_train;
end;
procedure TFormPrinc.Button1Click(Sender: TObject);
var i : integer;
begin
init_aiguillages;
NivDebug:=3;
i:=explore_det(518,523);
if (i<>0) and (i<=MaxCantons) then Affiche(intToSTR(canton[i].numero),clYellow);
AfficheDebug('=========================',clWhite);
i:=explore_det(523,518);
if (i<>0) and (i<=MaxCantons) then Affiche(intToSTR(canton[i].numero),clYellow);
NivDebug:=0;
formDebug.show;
end;
procedure TFormPrinc.TrackBarSigChange(Sender: TObject);
begin
+2 -2
View File
@@ -1,6 +1,6 @@
object FormTCO: TFormTCO
Left = 187
Top = 113
Left = 173
Top = 188
Width = 1013
Height = 607
VertScrollBar.Visible = False
+54 -15
View File
@@ -460,6 +460,7 @@ const
maxUndo=30;
ZoomMax=(8191 div MaxCellX)-1; // pour ne pas dépasser un canvas de 8191 pixel maxi
ZoomMin=15;
NomFichier_ch='Nom_fichier';
ClFond_ch='CoulFond';
clVoies_ch='CoulVoies';
clAllume_ch='CoulAllume';
@@ -632,7 +633,7 @@ var
route : array[1..500] of record x,y : integer;
end;
end;
end;
end;
// tracé en mode dessin
traceXY : Array[1..50] of record x,y : integer; // en coordonnées grille
@@ -737,7 +738,7 @@ begin
if c<>0 then
begin
//Affiche('Suppression canton '+intToSTR(c),clorange);
for i:=c to ncantons-1 do // supprime le canton c de la liste
for i:=c to ncantons-1 do // supprime le canton c de la liste des cantons
canton[i]:=canton[i+1];
dec(ncantons);
end;
@@ -1959,6 +1960,15 @@ begin
repeat
s:=lit_ligne;
sa:=uppercase(NomFichier_ch)+'=';
i:=pos(sa,s);
if i<>0 then
begin
inc(nv);
delete(s,i,length(sa)); // nom stocké
s:='';
end;
sa:=uppercase(ClFond_ch)+'=';
i:=pos(sa,s);
if i<>0 then
@@ -2529,6 +2539,7 @@ begin
AssignFile(fichier,nomfichierTCO[i]);
rewrite(fichier);
Writeln(fichier,'/ Définitions TCO version '+versionSC+sousversion);
writeln(fichier,NomFichier_ch+'=',NomFichierTCO[i]);
writeln(fichier,ZoomInit_ch+'=',ZoomInit[i]);
writeln(fichier,XYInit_ch+'=',XInit[i],',',Yinit[i]);
Writeln(fichier,clFond_ch+'='+IntToHex(clfond[i],6));
@@ -11470,16 +11481,44 @@ begin
//Brush.Style:=Bsclear;
xt:=0;yt:=0;
if Bimage=2 then begin xt:=LargeurCell[indexTCO] div 2;yt:=1;end;
if Bimage=3 then begin xt:=3;yt:=hauteurCell[indexTCO]-round(18*fryGlob[indexTCO]);end;
if Bimage=4 then begin xt:=10*round(frxGlob[indexTCO]);yt:=1;end;
if Bimage=5 then begin xt:=3;yt:=hauteurCell[indexTCO]-round(18*fryGlob[indexTCO]);end;
if Bimage=12 then begin xt:=round(33*fryGlob[indexTCO]);yt:=1;end;
if Bimage=2 then begin xt:=round(14*frxGlob[indexTCO]);yt:=1;end;
if Bimage=3 then begin xt:=round(14*frxGlob[indexTCO]);yt:=hauteurCell[indexTCO]-round(18*fryGlob[indexTCO]);end;
if Bimage=4 then begin xt:=round(14*frxGlob[indexTCO]);yt:=1;end;
if Bimage=5 then begin xt:=round(14*frxGlob[indexTCO]);yt:=hauteurCell[indexTCO]-round(18*fryGlob[indexTCO]);end;
if Bimage=12 then begin xt:=round(33*frxGlob[indexTCO]);yt:=1;end;
if Bimage=13 then begin xt:=LargeurCell[indexTCO]-round(30*frxGlob[indexTCO]);yt:=hauteurCell[indexTCO]-round(15*fryGlob[indexTCO]);end;
if Bimage=14 then begin xt:=LargeurCell[indexTCO]-round(30*frxGlob[indexTCO]);yt:=1;end;
if Bimage=15 then begin xt:=3;yt:=1;end;
if Bimage=21 then begin xt:=-round(5*frxGlob[indexTCO]);yt:=0;end;
if Bimage=22 then begin xt:=(LargeurCell[indexTCO] div 2);yt:=-2;end;
if Bimage=15 then
begin
if (repr=3) then // texte bas
begin
xt:=round(25*frxGlob[indexTCO]);yt:=round(37*fryGlob[indexTCO]);
end
else
begin
xt:=3;yt:=1;
end;
end;
if Bimage=21 then
begin
if (repr=3) then // texte bas
begin
xt:=round(24*frxGlob[indexTCO]);yt:=round(36*fryGlob[indexTCO]);
end else
begin
xt:=-round(5*frxGlob[indexTCO]);yt:=0;
end;
end;
if Bimage=22 then
begin
if (repr=3) then
begin
xt:=-5;yt:=round(38*fryGlob[indexTCO]) // texte bas
end else
begin
xt:=(LargeurCell[indexTCO] div 2);yt:=-2; // texte haut
end;
end;
if Bimage=23 then begin xt:=round(33*frxGlob[indexTCO]);yt:=round(35*fryGlob[indexTCO]);end;
if Bimage=24 then begin xt:=LargeurCell[indexTCO]-round(20*frxGlob[indexTCO]);yt:=hauteurCell[indexTCO]-round(15*fryGlob[indexTCO]);end;
if Bimage=25 then begin xt:=round(34*frxGlob[indexTCO]);yt:=round(8*fryGlob[indexTCO]);end;
@@ -12197,7 +12236,7 @@ procedure Erreur_TCO(indexTCO,x,y : integer);
var s : string;
i,adresse : integer;
begin
s:='Erreur 92 TCO - Cellule '+intToSTR(x)+','+intToSTR(y)+' ';
s:='Erreur 92 TCO '+intToSTR(indexTCO)+' - Cellule '+intToSTR(x)+','+intToSTR(y)+' ';
adresse:=tco[indextco,x,y].Adresse;
i:=index_aig(adresse);
if i=0 then s:=s+'aiguillage '+intToSTR(adresse)+' inconnu';
@@ -12869,7 +12908,7 @@ var i,ir,adresse,But,Bimage,direction,ancienX,ancienY,x,y,xn,yn,Xdet1,yDet1,iter
Index_TjdHom:=index_aig(TjdHom); // Index de la TJD homologue
position2:=aiguillage[Index_TjdHom].position; // position de la TJD homologue
tjd4(adresse,position,TjdHom,position2,c1,c2); // retourne c1 et C2
tjd4(position,position2,c1,c2); // retourne c1 et C2
if (ancienY<y) and (ancienX>x) then // on vient du NE
begin
if c1=c2 then // si on traverse la TJD
@@ -13073,7 +13112,7 @@ var i,ir,adresse,But,Bimage,direction,ancienX,ancienY,x,y,xn,yn,Xdet1,yDet1,iter
TjdHom:=aiguillage[index].Ddevie;
Index_TjdHom:=index_aig(TjdHom);
position2:=aiguillage[Index_TjdHom].position;
tjd4(adresse,position,TjdHom,position2,c1,c2); // retourne c1 et C2
tjd4(position,position2,c1,c2); // retourne c1 et C2
if (ancienY<y) and (ancienX<x) then // on vient du NO
begin
if c1=c2 then // si on traverse la TJD
@@ -13279,7 +13318,7 @@ var i,ir,adresse,But,Bimage,direction,ancienX,ancienY,x,y,xn,yn,Xdet1,yDet1,iter
TjdHom:=aiguillage[index].Ddevie;
Index_TjdHom:=index_aig(TjdHom);
position2:=aiguillage[Index_TjdHom].position;
tjd4(adresse,position,TjdHom,position2,c1,c2); // retourne c1 et C2
tjd4(position,position2,c1,c2); // retourne c1 et C2
if (ancienY<y) and (ancienX>x) then // on vient du NE
begin
if c1=c2 then // si on traverse la TJD
@@ -13507,7 +13546,7 @@ var i,ir,adresse,But,Bimage,direction,ancienX,ancienY,x,y,xn,yn,Xdet1,yDet1,iter
TjdHom:=aiguillage[index].Ddevie;
Index_TjdHom:=index_aig(TjdHom);
position2:=aiguillage[Index_TjdHom].position;
tjd4(adresse,position,TjdHom,position2,c1,c2); // retourne c1 et C2
tjd4(position,position2,c1,c2); // retourne c1 et C2
if (ancienY<y) and (ancienX<x) then // on vient du NO
begin
if c1=c2 then // si on traverse la TJD
+1 -1
View File
@@ -26,7 +26,7 @@ var
f : textFile;
Const
VersionSC = '10.82'; // sert à la comparaison de la version publiée
VersionSC = '10.9'; // sert à la comparaison de la version publiée
SousVersion=' '; // A B C ... en cas d'absence de sous version mettre un espace
// pour unzip
SHCONTCH_NOPROGRESSBOX=4;
+6
View File
@@ -364,6 +364,12 @@ version 10.81 : Prise en compte des nouveaux champs d'exportation de CDM pour l'
version 10.82 : Ajout d'une barre de zoom pour la fenetre des signaux.
Ajout commande fonctions F trains pour la télécommande par serveur
Corrections diverses
version 10.9 : Possibilité de déclarer des feux verts/rouge pour les signaux à deux feux.
Création d'un bouton de propagation du changement d'adresse d'un signal
Création d'un bouton de propagation du changement d'adresse d'un détecteur
Création d'une condition "détecteur/actionneur" dans les actions
version 10.91 Possibilité d'ajouter plusieurs conditions dans les actions
Une action ne peuvent être lancée que si la même action précédente est terminée