This commit is contained in:
f1iwq2
2023-07-30 14:28:21 +02:00
parent de401c95d7
commit c688f36e4e
11 changed files with 1346 additions and 261 deletions
+167 -17
View File
@@ -1570,8 +1570,8 @@ object FormConfig: TFormConfig
Left = 8 Left = 8
Top = 8 Top = 8
Width = 633 Width = 633
Height = 505 Height = 497
ActivePage = TabSheetSig ActivePage = TabSheetDecodeurs
Font.Charset = DEFAULT_CHARSET Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack Font.Color = clBlack
Font.Height = -11 Font.Height = -11
@@ -3158,7 +3158,7 @@ object FormConfig: TFormConfig
Width = 129 Width = 129
Height = 21 Height = 21
Style = csDropDownList Style = csDropDownList
ItemHeight = 13 ItemHeight = 0
TabOrder = 1 TabOrder = 1
OnChange = ComboBoxDecChange OnChange = ComboBoxDecChange
end end
@@ -3262,22 +3262,9 @@ object FormConfig: TFormConfig
Width = 129 Width = 129
Height = 21 Height = 21
Style = csDropDownList Style = csDropDownList
ItemHeight = 13 ItemHeight = 0
TabOrder = 2 TabOrder = 2
OnChange = ComboBoxAspChange OnChange = ComboBoxAspChange
Items.Strings = (
'2 feux'
'3 feux'
'4 feux'
'5 feux'
'7 feux'
'9 feux'
'Directionnel 2 feux'
'Directionnel 3 feux'
'Directionnel 4 feux'
'Directionnel 5 feux'
'Directionnel 6 feux'
'Signal belge type 1')
end end
object EditSpecUni: TEdit object EditSpecUni: TEdit
Left = 8 Left = 8
@@ -3437,6 +3424,169 @@ object FormConfig: TFormConfig
OnChange = EditTempoFeuChange OnChange = EditTempoFeuChange
end end
end end
object TabSheetDecodeurs: TTabSheet
Caption = 'D'#233'codeurs'
ImageIndex = 8
object Label61: TLabel
Left = 13
Top = 4
Width = 284
Height = 19
Caption = 'D'#233'codeurs personnalis'#233's de signaux'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -16
Font.Name = 'Arial'
Font.Style = [fsBold]
ParentFont = False
end
object Label62: TLabel
Left = 24
Top = 40
Width = 36
Height = 16
Caption = 'Etats'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -13
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
object Label63: TLabel
Left = 160
Top = 24
Width = 73
Height = 32
Caption = 'D'#233'calage d'#39'adresse'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -13
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
WordWrap = True
end
object Label66: TLabel
Left = 256
Top = 40
Width = 50
Height = 16
Caption = 'Sorties'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -13
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
WordWrap = True
end
object GroupBox26: TGroupBox
Left = 376
Top = 64
Width = 241
Height = 393
Caption = 'Commandes'
TabOrder = 0
object Label67: TLabel
Left = 22
Top = 24
Width = 195
Height = 20
Caption = 'Nom du d'#233'codeur personnalis'#233
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -16
Font.Name = 'Arial Narrow'
Font.Style = [fsBold]
ParentFont = False
end
object Label65: TLabel
Left = 19
Top = 96
Width = 126
Height = 39
Alignment = taRightJustify
Caption = 'Nombre d'#39'adresses occup'#233'es par le signal sur le d'#233'codeur:'
WordWrap = True
end
object Label64: TLabel
Left = 64
Top = 160
Width = 105
Height = 13
Caption = 'Signalisation nationale'
end
object Label68: TLabel
Left = 23
Top = 356
Width = 178
Height = 13
Caption = 'Nombre de d'#233'codeurs personnalis'#233's :'
end
object LabelNbDecPers: TLabel
Left = 208
Top = 356
Width = 6
Height = 13
Caption = '0'
end
object ComboBoxDecodeurPerso: TComboBox
Left = 24
Top = 56
Width = 193
Height = 21
ItemHeight = 13
TabOrder = 0
OnChange = ComboBoxDecodeurPersoChange
end
object EditNbreAdr: TEdit
Left = 168
Top = 104
Width = 49
Height = 21
TabOrder = 1
Text = '2'
OnChange = EditNbreAdrChange
end
object ComboBoxNation: TComboBox
Left = 48
Top = 176
Width = 145
Height = 21
ItemHeight = 13
TabOrder = 2
OnChange = ComboBoxNationChange
Items.Strings = (
'Fran'#231'aise'
'Belge')
end
object BoutonNouveau: TButton
Left = 86
Top = 216
Width = 75
Height = 25
Hint = 'Ajouter un nouveau d'#233'codeur personnalis'#233
Caption = 'Nouveau'
ParentShowHint = False
ShowHint = True
TabOrder = 3
OnClick = BoutonNouveauClick
end
object ButtonSup: TButton
Left = 86
Top = 248
Width = 75
Height = 25
Hint = 'Supprimer le d'#233'codeur personnalis'#233
Caption = 'Supprimer'
ParentShowHint = False
ShowHint = True
TabOrder = 4
OnClick = ButtonSupClick
end
end
end
object TabSheetAct: TTabSheet object TabSheetAct: TTabSheet
Caption = 'Actionneurs/D'#233'tecteurs' Caption = 'Actionneurs/D'#233'tecteurs'
ImageIndex = 5 ImageIndex = 5
+741 -27
View File
@@ -340,6 +340,22 @@ type
CheckBoxContreVoie: TCheckBox; CheckBoxContreVoie: TCheckBox;
RadioButtonSpecifique: TRadioButton; RadioButtonSpecifique: TRadioButton;
EditSpecifique: TEdit; EditSpecifique: TEdit;
TabSheetDecodeurs: TTabSheet;
Label61: TLabel;
Label62: TLabel;
Label63: TLabel;
Label66: TLabel;
GroupBox26: TGroupBox;
Label67: TLabel;
ComboBoxDecodeurPerso: TComboBox;
Label65: TLabel;
EditNbreAdr: TEdit;
Label64: TLabel;
ComboBoxNation: TComboBox;
BoutonNouveau: TButton;
ButtonSup: TButton;
Label68: TLabel;
LabelNbDecPers: TLabel;
procedure ButtonAppliquerEtFermerClick(Sender: TObject); procedure ButtonAppliquerEtFermerClick(Sender: TObject);
procedure FormActivate(Sender: TObject); procedure FormActivate(Sender: TObject);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
@@ -506,10 +522,18 @@ type
procedure CheckBoxVersContrevoieClick(Sender: TObject); procedure CheckBoxVersContrevoieClick(Sender: TObject);
procedure CheckBoxContreVoieClick(Sender: TObject); procedure CheckBoxContreVoieClick(Sender: TObject);
procedure EditSpecifiqueChange(Sender: TObject); procedure EditSpecifiqueChange(Sender: TObject);
procedure BoutonNouveauClick(Sender: TObject);
procedure EditNbreAdrChange(Sender: TObject);
procedure ComboBoxDecodeurPersoChange(Sender: TObject);
procedure ButtonSupClick(Sender: TObject);
procedure ComboBoxNationChange(Sender: TObject);
private private
{ Déclarations privées } { Déclarations privées }
public public
{ Déclarations publiques } { Déclarations publiques }
procedure modif_editT(Sender : TObject);
procedure modif_ComboTS(Sender : TObject);
procedure modif_ComboL(Sender : TObject);
end; end;
const const
@@ -564,7 +588,9 @@ section_dccpp_ch='[section_dcc++]';
section_initpp_ch='[init_dcc++]'; section_initpp_ch='[init_dcc++]';
section_trains_ch='[section_trains]'; section_trains_ch='[section_trains]';
section_placement_ch='[section_placement]'; section_placement_ch='[section_placement]';
section_DecPers_ch='[section_decodeurs]';
Nba_ch='NombreAdresses';
nation_ch='Nation';
var var
FormConfig: TFormConfig; FormConfig: TFormConfig;
@@ -575,13 +601,17 @@ var
ligneclicAig,AncLigneClicAig,ligneClicSig,AncligneClicSig,EnvAigDccpp,AdrBaseDetDccpp, ligneclicAig,AncLigneClicAig,ligneClicSig,AncligneClicSig,EnvAigDccpp,AdrBaseDetDccpp,
ligneClicBr,AncligneClicBr,ligneClicAct,AncLigneClicAct,Adressefeuclic,NumTrameCDM, ligneClicBr,AncligneClicBr,ligneClicAct,AncLigneClicAct,Adressefeuclic,NumTrameCDM,
Algo_localisation,Verif_AdrXpressNet,ligneclicTrain,AncligneclicTrain,AntiTimeoutEthLenz, Algo_localisation,Verif_AdrXpressNet,ligneclicTrain,AncligneclicTrain,AntiTimeoutEthLenz,
ligneDCC : integer; ligneDCC,decCourant,ligne_signal : integer;
ack_cdm,clicliste,config_modifie,clicproprietes,confasauver,trouve_MaxPort, ack_cdm,clicliste,config_modifie,clicproprietes,confasauver,trouve_MaxPort,
modif_branches,ConfigPrete,trouve_section_dccpp,trouve_section_trains, modif_branches,ConfigPrete,trouve_section_dccpp,trouve_section_trains,
trouveAvecVerifIconesTCO,Affiche_avert,activ : boolean; trouveAvecVerifIconesTCO,Affiche_avert,activ,trouve_section_dec_pers : boolean;
fichier : text; fichier : text;
EditT : Array[1..10] of Tedit;
ComboL1,ComboL2,ComboTS1,ComboTS2 : Array[1..10] of TComboBox;
ShapeT : array[1..10] of TShape;
function config_com(s : string) : boolean; function config_com(s : string) : boolean;
function envoi_CDM(s : string) : boolean; function envoi_CDM(s : string) : boolean;
procedure connecte_CDM; procedure connecte_CDM;
@@ -634,14 +664,16 @@ begin
place_id:=s; place_id:=s;
end; end;
procedure Maj_Hint_Signal(i : integer); procedure Maj_Hint_Signal(indexFeu : integer);
var s : string; var s : string;
begin begin
// ne pas supprimer le @= qui sert de marqueur pour identifier le feu // ne pas supprimer le @= qui sert de marqueur pour identifier le feu
s:='@='+inttostr(feux[i].Adresse)+' Decodeur='+intToSTR(feux[i].Decodeur)+' Adresse détecteur associé='+intToSTR(feux[i].Adr_det1)+ s:='Index='+IntToSTR(IndexFeu)+' @='+inttostr(feux[IndexFeu].Adresse)+' Décodeur='+decodeur[feux[IndexFeu].Decodeur]+
' Adresse élement suivant='+intToSTR(feux[i].Adr_el_suiv1); ' Adresse détecteur associé='+intToSTR(feux[IndexFeu].Adr_det1)+
if feux[i].Btype_suiv1=aig then s:=s+' (aig)'; ' Adresse élement suivant='+intToSTR(feux[IndexFeu].Adr_el_suiv1);
feux[i].Img.Hint:=s; if feux[IndexFeu].Btype_suiv1=aig then s:=s+' (aig)';
feux[indexFeu].Img.Hint:=s;
end; end;
// demande les services Com-IP à CDM // demande les services Com-IP à CDM
@@ -981,6 +1013,7 @@ begin
s:=s+IntToSTR(feux[i].decodeur)+','; s:=s+IntToSTR(feux[i].decodeur)+',';
// detecteur et élement suivant (4 maxi) // detecteur et élement suivant (4 maxi)
// signal non directionnel
if (aspect<10) or (aspect>=20) then if (aspect<10) or (aspect>=20) then
begin begin
s:=s+'('+IntToSTR(feux[i].Adr_det1)+','+TypeEl_To_char(feux[i].Btype_suiv1)+IntToSTR(feux[i].Adr_el_suiv1); s:=s+'('+IntToSTR(feux[i].Adr_det1)+','+TypeEl_To_char(feux[i].Btype_suiv1)+IntToSTR(feux[i].Adr_el_suiv1);
@@ -1059,7 +1092,7 @@ begin
for j:=1 to NfeuxDir+1 do for j:=1 to NfeuxDir+1 do
begin begin
s:=s+'('; s:=s+'(';
for k:=1 to Length(feux[i].AigDirection[j])-1 do for k:=1 to Length(feux[i].AigDirection[j])-1 do // boum
begin begin
s:=s+'A'+IntToSTR(feux[i].AigDirection[j][k].adresse) + feux[i].AigDirection[j][k].posaig; s:=s+'A'+IntToSTR(feux[i].AigDirection[j][k].adresse) + feux[i].AigDirection[j][k].posaig;
if k<Length(feux[i].AigDirection[j])-1 then s:=s+','; if k<Length(feux[i].AigDirection[j])-1 then s:=s+',';
@@ -1171,7 +1204,7 @@ begin
j:=pos(',',s); j:=pos(',',s);
val(s,Feux[i].decodeur,erreur); val(s,Feux[i].decodeur,erreur);
if (Feux[i].decodeur>NbDecodeur-1) then Affiche('Erreur 677 Ligne '+chaine_signal+' : erreur décodeur inconnu: '+intToSTR(Feux[i].decodeur),clred); if (Feux[i].decodeur>NbDecodeurdeBase+NbreDecPers-1) then Affiche('Erreur 677 Ligne '+chaine_signal+' : erreur décodeur inconnu: '+intToSTR(Feux[i].decodeur),clred);
if j<>0 then delete(s,1,j); if j<>0 then delete(s,1,j);
feux[i].Adr_el_suiv1:=0;feux[i].Adr_el_suiv2:=0;feux[i].Adr_el_suiv3:=0;feux[i].Adr_el_suiv4:=0; feux[i].Adr_el_suiv1:=0;feux[i].Adr_el_suiv2:=0;feux[i].Adr_el_suiv3:=0;feux[i].Adr_el_suiv4:=0;
feux[i].Btype_Suiv1:=rien;feux[i].Btype_Suiv2:=rien;feux[i].Btype_Suiv3:=rien;feux[i].Btype_Suiv4:=rien; feux[i].Btype_Suiv1:=rien;feux[i].Btype_Suiv2:=rien;feux[i].Btype_Suiv3:=rien;feux[i].Btype_Suiv4:=rien;
@@ -1516,7 +1549,7 @@ end;
procedure genere_config; procedure genere_config;
var s: string; var s: string;
fichierN : text; fichierN : text;
i : integer; i,j,n : integer;
begin begin
assign(fichierN,NomConfig); assign(fichierN,NomConfig);
rewrite(fichierN); rewrite(fichierN);
@@ -1658,6 +1691,30 @@ begin
end; end;
writeln(fichierN,'0'); writeln(fichierN,'0');
writeln(fichierN,'/------------');
// décodeurs de signaux personnalisés (sauver avant les signaux pour avoir la liste des décodeurs personnalisés
writeln(fichierN,section_DecPers_ch);
for i:=1 to NbreDecPers do
begin
writeln(fichierN,decodeur_pers[i].nom);
n:=decodeur_pers[i].NbreAdr;
s:='NombreAdresses='+intToSTR(n);
writeln(fichierN,s);
n:=decodeur_pers[i].nation;
s:='Nation='+intToSTR(n);
writeln(fichierN,s);
for j:=1 to decodeur_pers[i].NbreAdr do
begin
s:=intToSTR(decodeur_pers[i].desc[j].etat1)+','+intToSTR(decodeur_pers[i].desc[j].etat2)+','+
intToSTR(decodeur_pers[i].desc[j].offsetAdresse)+','+intToSTR(decodeur_pers[i].desc[j].sortie1)+','+
intToSTR(decodeur_pers[i].desc[j].sortie2);
writeln(fichierN,s);
end;
end;
writeln(fichierN,'0');
writeln(fichierN,'/------------'); writeln(fichierN,'/------------');
writeln(fichierN,section_sig_ch); writeln(fichierN,section_sig_ch);
// feux // feux
@@ -1727,6 +1784,9 @@ begin
end; end;
writeln(fichierN,'0'); writeln(fichierN,'0');
closefile(fichierN); closefile(fichierN);
end; end;
@@ -2351,6 +2411,73 @@ begin
until (sOrigine='0'); until (sOrigine='0');
end; end;
// compile les décodeurs personnalisés
procedure compile_dec_pers;
var nv,i,j,k,l,adr : integer;
begin
Nligne:=1;
nv:=0;
repeat
s:=lit_ligne;
inc(Nligne);
if s<>'0' then
begin
if NbreDecPers<NbreMaxiDecPers then
begin
inc(NbreDecPers);
decodeur_pers[NbreDecPers].nom:=sOrigine;
decodeur[NbDecodeurdeBase+NbreDecPers-1]:=sOrigine;
// nombre d'adresses
s:=lit_ligne;
k:=pos(uppercase(nba_ch)+'=',s);
if k=1 then
begin
delete(s,1,length(nba_ch)+1);
val(s,j,erreur); // ne pas écraser j
decodeur_pers[NbreDecPers].NbreAdr:=j;
end;
// nation
s:=lit_ligne;
k:=pos(uppercase(nation_ch)+'=',s);
if k=1 then
begin
delete(s,1,length(nation_ch)+1);
val(s,k,erreur);
if (k=0) or (k>2) then k:=1;
decodeur_pers[NbreDecPers].Nation:=k;
end;
adr:=1;
repeat
s:=lit_ligne;
k:=pos(',',s);
val(s,l,erreur);
delete(s,1,k);
decodeur_pers[NbreDecPers].desc[adr].etat1:=l;
k:=pos(',',s);
val(s,l,erreur);
delete(s,1,k);
decodeur_pers[NbreDecPers].desc[adr].etat2:=l;
k:=pos(',',s);
val(s,l,erreur);
delete(s,1,k);
decodeur_pers[NbreDecPers].desc[adr].offsetadresse:=l;
k:=pos(',',s);
val(s,l,erreur);
delete(s,1,k);
decodeur_pers[NbreDecPers].desc[adr].sortie1:=l;
k:=pos(',',s);
val(s,l,erreur);
delete(s,1,k);
decodeur_pers[NbreDecPers].desc[adr].sortie2:=l;
s:='';
inc(adr);
until (adr>j);
end;
end;
until eof(fichier) or (s='0');
end;
procedure compile_dccpp; procedure compile_dccpp;
var nv,i : integer; var nv,i : integer;
begin begin
@@ -2455,6 +2582,12 @@ begin
editadrtrain.Text:=inttostr(trains[1].adresse); editadrtrain.Text:=inttostr(trains[1].adresse);
end; end;
until (sOrigine='0') or (ntrains>=Max_Trains); until (sOrigine='0') or (ntrains>=Max_Trains);
for i:=1 to ntrains do
begin
trains[i].x:=-999999;
trains[i].y:=-999999;
end;
end; end;
procedure lit_flux; procedure lit_flux;
@@ -2951,6 +3084,15 @@ begin
compile_trains; compile_trains;
end; end;
// section dédodeurs
sa:=uppercase(section_DecPers_ch);
if pos(sa,s)<>0 then
begin
trouve_section_dec_pers:=true;
compile_dec_pers;
end;
// section placement // section placement
sa:=uppercase(section_placement_ch); sa:=uppercase(section_placement_ch);
if pos(sa,s)<>0 then if pos(sa,s)<>0 then
@@ -3482,6 +3624,7 @@ begin
RadioButtonXpress.Checked:=protocole=1; RadioButtonXpress.Checked:=protocole=1;
RadioButtonDcc.Checked:=protocole=2; RadioButtonDcc.Checked:=protocole=2;
clicListe:=true; // empeche le traitement de l'evt text clicListe:=true; // empeche le traitement de l'evt text
EditDroit_BD.Text:=''; EditDroit_BD.Text:='';
EditPointe_BG.Text:=''; EditPointe_BG.Text:='';
@@ -3532,10 +3675,23 @@ begin
// signaux // signaux
RichSig.clear; RichSig.clear;
ComboBoxDec.items.Clear; ComboBoxDec.items.Clear;
for i:=0 to 11 do
begin
ComboBoxAsp.items.add(Aspects[i]);
end;
// décodeurs de base
for i:=1 to NbDecodeur do for i:=1 to NbDecodeur do
begin begin
ComboBoxDec.items.add(decodeur[i-1]); ComboBoxDec.items.add(decodeur[i-1]);
end; end;
// décodeurs personalisés
for i:=1 to NbreDecPers do
begin
s:=decodeur_pers[i].nom;
formconfig.ComboBoxDec.Items.add(s);
end;
for i:=1 to NbreFeux do for i:=1 to NbreFeux do
begin begin
@@ -3613,14 +3769,83 @@ begin
Lines.Add(Train_tablo(i)); Lines.Add(Train_tablo(i));
end; end;
end; end;
LabelNbDecPers.caption:=intToSTR(NbreDecPers);
//l'onglet affiché est sélectionné à l'appel de la fiche dans l'unité UnitPrinc //l'onglet affiché est sélectionné à l'appel de la fiche dans l'unité UnitPrinc
clicListe:=false; clicListe:=false;
activ:=false; activ:=false;
end; end;
// met à jour le décodeur courant dans le tableau de config
procedure maj_decodeurs;
var nAdr,i,j,a,nation : integer;
begin
begin
// si pas de décodeur courant, on rend invisible toutes les adresses
if decCourant=0 then nAdr:=0 else
begin
formConfig.ComboBoxNation.itemindex:=decodeur_pers[decCourant].nation-1;
nAdr:=decodeur_pers[decCourant].NbreAdr;
FormConfig.EditNbreAdr.Text:=intToSTR(decodeur_pers[decCourant].NbreAdr);
nation:=decodeur_pers[decCourant].nation;
end;
for i:=1 to nAdr do
begin
comboL1[i].Items.Clear;
comboL2[i].Items.Clear;
if nation=1 then
begin
for j:=0 to 20 do
begin
comboL1[i].Items.add(Etats[j]);
comboL2[i].Items.add(Etats[j]);
end;
end
else
for j:=0 to 9 do
begin
begin
comboL1[i].Items.add(EtatSignBelge[j]);
comboL2[i].Items.add(EtatSignBelge[j]);
end;
end;
a:=decodeur_pers[decCourant].desc[i].etat1;
ComboL1[i].itemIndex:=a;
ComboL1[i].Visible:=true;
a:=decodeur_pers[decCourant].desc[i].etat2;
ComboL2[i].Itemindex:=a;
ComboL2[i].Visible:=true;
EditT[i].Text:=intToSTR(decodeur_pers[decCourant].desc[i].offsetAdresse);
EditT[i].Visible:=true;
a:=decodeur_pers[decCourant].desc[i].sortie1;
ComboTS1[i].Itemindex:=a-1;
ComboTS1[i].Visible:=true;
a:=decodeur_pers[decCourant].desc[i].sortie2;
ComboTS2[i].Itemindex:=a-1;
ComboTS2[i].Visible:=true;
ShapeT[i].Visible:=true;
end;
for i:=nADr+1 to 10 do
begin
ComboL1[i].Visible:=false;
ComboL2[i].Visible:=false;
EditT[i].Visible:=false;
ComboTS1[i].Visible:=false;
ComboTS2[i].Visible:=false;
ShapeT[i].Visible:=false;
end;
end;
end;
procedure TFormConfig.FormCreate(Sender: TObject); procedure TFormConfig.FormCreate(Sender: TObject);
var i,j,y : integer;
s : string;
begin begin
if debug=1 then Affiche('Création fenêtre config',clLime); if debug=1 then Affiche('Création fenêtre config',clLime);
clicListe:=true; clicListe:=true;
@@ -3637,6 +3862,119 @@ begin
groupBox21.Top:=304; groupBox21.Top:=304;
GroupBox21.Left:=8; GroupBox21.Left:=8;
if debug=1 then Affiche('Fin création fenêtre config',clLime); if debug=1 then Affiche('Fin création fenêtre config',clLime);
EditNbreAdr.Text:='2';
// création des champs dynamiques de l'onglet décodeurs
for i:=1 to 10 do
begin
y:=i*40+20;
// rectangle
ShapeT[i]:=Tshape.create(FormConfig.TabSheetDecodeurs);
with ShapeT[i] do
begin
name:='Ligne'+intToSTR(i);
left:=5;width:=350; top:=y;height:=42;
brush.Style:=bsSolid;
brush.Color:=clBtnFace;
pen.color:=clBlack;
shape:=stRectangle;
parent:=TabSheetDecodeurs;
end;
ComboL1[i]:=TcomboBox.create(FormConfig.TabSheetDecodeurs);
with ComboL1[i] do
begin
Name:='ComboL1'+intToSTR(i);
text:='';
left:=10;Top:=y;Width:=150;Height:=15;
parent:=TabSheetDecodeurs;
itemIndex:=-1;
for j:=0 to 19 do items.add(etats[j]);
onChange:=formConfig.modif_ComboL;
Style:=csDropDownList;
visible:=false;
end;
ComboL2[i]:=Tcombobox.create(FormConfig.TabSheetDecodeurs);
with ComboL2[i] do
begin
Name:='ComboL2'+intToSTR(i);
text:='';
left:=10;Top:=y+20;Width:=150;Height:=15;
parent:=TabSheetDecodeurs;
itemIndex:=-1;
for j:=0 to 19 do items.add(etats[j]);
onChange:=formConfig.modif_ComboL;
Style:=csDropDownList;
visible:=false;
end;
EditT[i]:=TEdit.create(FormConfig.TabSheetDecodeurs);
with EditT[i] do
begin
Name:='EditT'+intToSTR(i);
left:=180;Top:=y+10;Width:=30;Height:=15;
text:='';
parent:=TabSheetDecodeurs;
visible:=false;
Text:=intToSTR(i-1);
onChange:=formConfig.modif_editT;
end;
ComboTS1[i]:=TComboBox.create(FormConfig.TabSheetDecodeurs);
with ComboTS1[i] do
begin
Name:='ComboTS1'+intToSTR(i);
left:=240;Top:=y;Width:=110;Height:=13;
text:='';
parent:=TabSheetDecodeurs;
itemIndex:=-1;
items.add('- 1 rouge dévié');
items.add('+ 2 vert droit');
if (i-1) mod 2=0 then s:='Sortie 1' else s:='Sortie 2';
Hint:=s;
ShowHint:=true;
visible:=false;
Style:=csDropDownList;
onChange:=formConfig.modif_ComboTS;
end;
ComboTS2[i]:=TComboBox.create(FormConfig.TabSheetDecodeurs);
with ComboTS2[i] do
begin
Name:='ComboBoxTS2'+intToSTR(i);
left:=240;Top:=y+20;Width:=110;Height:=13;
text:='';
parent:=TabSheetDecodeurs;
itemIndex:=-1;
items.add('- 1 rouge dévié');
items.add('+ 2 vert droit');
if (i-1) mod 2=0 then s:='Sortie 1' else s:='Sortie 2';
Hint:=s;
ShowHint:=true;
visible:=false;
Style:=csDropDownList;
onChange:=formConfig.modif_ComboTS;
end;
end;
for i:=1 to NbreDecPers do
begin
s:=decodeur_pers[i].nom;
formconfig.ComboBoxDecodeurPerso.Items.add(s);
end;
if NbreDecPers>0 then
begin
decCourant:=1;
formconfig.ComboBoxDecodeurPerso.ItemIndex:=0;
ComboBoxNation.ItemHeight:=decodeur_pers[decCourant].nation;
end
else formconfig.ComboBoxDecodeurPerso.ItemIndex:=-1;
maj_decodeurs;
end; end;
@@ -4096,7 +4434,7 @@ var i,j,l,d,p,k,nc,decodeur : integer;
s : string; s : string;
begin begin
if Affevt then affiche('Aff_champs_sig_feux('+intToSTR(index)+')',clyellow); if Affevt then affiche('Aff_champs_sig_feux('+intToSTR(index)+')',clyellow);
if index<0 then exit; if index<1 then exit;
clicListe:=true; clicListe:=true;
i:=index; i:=index;
FormConfig.EditAdrSig.text:=InttoSTr(feux[i].adresse); FormConfig.EditAdrSig.text:=InttoSTr(feux[i].adresse);
@@ -4299,6 +4637,9 @@ begin
MemoCarre.Perform(EM_SCROLLCARET,0,0); MemoCarre.Perform(EM_SCROLLCARET,0,0);
end; end;
end; end;
// vérifier les incompatibilités
clicListe:=false; clicListe:=false;
end; end;
@@ -5153,6 +5494,67 @@ begin
formconfig.RichAig.Lines[ligneclicAig]:=s; formconfig.RichAig.Lines[ligneclicAig]:=s;
end; end;
function verif_dec_sig(aff : boolean) : boolean;
var Adr,i,dec,aspect,indexAspect : integer;
begin
result:=true; // ok
for i:=1 to NbreFeux do
begin
dec:=feux[i].decodeur;
aspect:=feux[i].aspect;
case aspect of
2 : indexAspect:=0;
3 : indexAspect:=1;
4 : indexAspect:=2;
5 : indexAspect:=3;
7 : indexAspect:=4;
9 : indexAspect:=5;
12 : indexAspect:=6;
13 : indexAspect:=7;
14 : indexAspect:=8;
15 : indexAspect:=9;
16 : indexAspect:=10;
20 : indexAspect:=11;
end;
Adr:=feux[i].adresse;
//Affiche(IntToSTR(i)+' '+intToSTR(indexAspect)+' '+inttoSTR(dec),clred);
case dec of
// digital bahn
1: if aspect=20 then begin result:=false;if aff then Affiche('Erreur 340 : Signal '+intToSTR(Adr)+': Combinaison décodeur '+decodeur[dec]+' et aspect '+aspects[indexAspect]+' incompatibles',clred);end;
// cdf
2: if (aspect>10) and (aspect<20) then begin result:=false;if aff then Affiche('Erreur 341 : Signal '+intToSTR(Adr)+': Combinaison décodeur '+decodeur[dec]+' et aspect '+aspects[indexAspect]+' incompatibles',clred);end;
// ls dec sncf
3 : if (aspect>10) then begin result:=false;if aff then Affiche('Erreur 342 : Signal '+intToSTR(Adr)+': Combinaison décodeur '+decodeur[dec]+' et aspect '+aspects[indexAspect]+' incompatibles',clred);end;
// LEB
4 : if aspect>10 then begin result:=false;if aff then Affiche('Erreur 343 : Signal '+intToSTR(Adr)+': Combinaison décodeur '+decodeur[dec]+' et aspect '+aspects[indexAspect]+' incompatibles',clred);end;
// dijikeijs
5 : if aspect>10 then begin result:=false;if aff then Affiche('Erreur 344 : Signal '+intToSTR(Adr)+': Combinaison décodeur '+decodeur[dec]+' et aspect '+aspects[indexAspect]+' incompatibles',clred);end;
// paco unisemaf
6 : if aspect>10 then begin result:=false;if aff then Affiche('Erreur 345 : Signal '+intToSTR(Adr)+': Combinaison décodeur '+decodeur[dec]+' et aspect '+aspects[indexAspect]+' incompatibles',clred);end;
// Stéphane ravaux
7 : if aspect>10 then begin result:=false;if aff then Affiche('Erreur 346 : Signal '+intToSTR(Adr)+': Combinaison décodeur '+decodeur[dec]+' et aspect '+aspects[indexAspect]+' incompatibles',clred);end;
// Arcomora
8 : if aspect>10 then begin result:=false;if aff then Affiche('Erreur 347 : Signal '+intToSTR(Adr)+': Combinaison décodeur '+decodeur[dec]+' et aspect '+aspects[indexAspect]+' incompatibles',clred);end;
// LS DEC NMBS
9 : if aspect<>20 then begin result:=false;if aff then Affiche('Erreur 348 : Signal '+intToSTR(Adr)+': Combinaison décodeur '+decodeur[dec]+' et aspect '+aspects[indexAspect]+' incompatibles',clred);end;
// B-models
10 : if aspect<>20 then begin result:=false;if aff then Affiche('Erreur 349 : Signal '+intToSTR(Adr)+': Combinaison décodeur '+decodeur[dec]+' et aspect '+aspects[indexAspect]+' incompatibles',clred);end;
end;
// personnalisé
if (dec>=NbDecodeurdeBase) then
begin
// nationalité du décodeur
if ((decodeur_pers[dec-NbDecodeurdeBase+1].nation=2) and (aspect<>20)) or
((decodeur_pers[dec-NbDecodeurdeBase+1].nation=1) and (aspect=20)) then
begin
result:=false;
if aff then Affiche('Erreur 350 : Signal '+intToSTR(Adr)+': Combinaison décodeur '+decodeur[dec]+' et aspect '+aspects[indexAspect]+' incompatibles',clred);
end;
end;
end;
end;
procedure TFormConfig.ComboBoxDecChange(Sender: TObject); procedure TFormConfig.ComboBoxDecChange(Sender: TObject);
var s: string; var s: string;
i,decodeur : integer; i,decodeur : integer;
@@ -5162,9 +5564,21 @@ begin
if NbreFeux<ligneclicSig+1 then exit; if NbreFeux<ligneclicSig+1 then exit;
i:=ligneclicSig+1; i:=ligneclicSig+1;
if i<1 then exit; if i<1 then
begin
ComboBoxDec.ItemIndex:=-1;
if NbreFeux=0 then s:='Crééz un signal ou ';
s:='sélectionnez un signal dans la liste';
LabelInfo.Caption:=s;
exit;
end;
decodeur:=ComboBoxDec.ItemIndex; decodeur:=ComboBoxDec.ItemIndex;
if decodeur>NbDecodeur+NbreDecPers then exit;
feux[i].decodeur:=decodeur; feux[i].decodeur:=decodeur;
Maj_Hint_Signal(i); Maj_Hint_Signal(i);
case decodeur of case decodeur of
@@ -5187,6 +5601,8 @@ begin
s:=encode_sig_feux(i); s:=encode_sig_feux(i);
formconfig.RichSig.Lines[ligneclicSig]:=s; formconfig.RichSig.Lines[ligneclicSig]:=s;
aff_champs_sig_feux(i); aff_champs_sig_feux(i);
if not(verif_dec_sig(false)) then FormConfig.labelInfo.Caption:='Combinaison décodeur / aspect incompatible';
if affevt then Affiche('Evt ComboBox Decodeur',clOrange); if affevt then Affiche('Evt ComboBox Decodeur',clOrange);
end; end;
@@ -5202,6 +5618,7 @@ begin
begin begin
i:=Selstart; i:=Selstart;
lc:=Perform(EM_LINEFROMCHAR,i,0); // numéro de la lignée cliquée lc:=Perform(EM_LINEFROMCHAR,i,0); // numéro de la lignée cliquée
ligne_signal:=lc;
clicListeSignal(feux[lc+1].adresse); clicListeSignal(feux[lc+1].adresse);
end; end;
@@ -5995,15 +6412,25 @@ begin
else aspect:=i+6; else aspect:=i+6;
end; end;
index:=ligneClicSig+1; // index du feu index:=ligneClicSig+1; // index du feu
if index<1 then exit; if index<1 then
begin
ComboBoxAsp.ItemIndex:=-1;
if NbreFeux=0 then s:='Crééz un signal ou ';
s:='sélectionnez un signal dans la liste';
LabelInfo.Caption:=s;
exit;
end;
if NbreFeux<index then exit; if NbreFeux<index then exit;
//Affiche('Ligne cliquée='+IntToSTR(index),clyellow); //Affiche('Ligne cliquée='+IntToSTR(index),clyellow);
feux[index].aspect:=aspect; feux[index].aspect:=aspect;
s:=encode_sig_feux(index); s:=encode_sig_feux(index);
RichSig.Lines[ligneClicSig]:=s; RichSig.Lines[ligneClicSig]:=s;
aff_champs_sig_feux(index); // redessine les champs et le feu aff_champs_sig_feux(index); // redessine les champs et le feu
if not(verif_dec_sig(false)) then labelInfo.Caption:='Combinaison décodeur / aspect incompatible';
// change l'image du feu dans la feuille graphique principale // change l'image du feu dans la feuille graphique principale
bm:=Select_dessin_feu(feux[index].aspect); bm:=Select_dessin_feu(feux[index].aspect);
if bm=nil then exit; if bm=nil then exit;
@@ -6827,11 +7254,8 @@ begin
Top:=(HtImg+espY+20)*((IndexFeu-1) div NbreImagePLigne); // détermine les points d'origine Top:=(HtImg+espY+20)*((IndexFeu-1) div NbreImagePLigne); // détermine les points d'origine
Left:=10+ (LargImg+5)*((IndexFeu-1) mod (NbreImagePLigne)); Left:=10+ (LargImg+5)*((IndexFeu-1) mod (NbreImagePLigne));
Name:='ImageFeu'+IntToSTR(adresse); Name:='ImageFeu'+IntToSTR(adresse);
s:='Index='+IntToSTR(IndexFeu)+' @='+inttostr(feux[IndexFeu].Adresse)+' Décodeur='+intToSTR(feux[IndexFeu].Decodeur)+ Maj_Hint_Signal(indexFeu);
' Adresse détecteur associé='+intToSTR(feux[IndexFeu].Adr_det1)+
' Adresse élement suivant='+intToSTR(feux[IndexFeu].Adr_el_suiv1);
if feux[IndexFeu].Btype_suiv1=aig then s:=s+' (aig)';
Hint:=s;
end; end;
with feux[IndexFeu].Lbl do with feux[IndexFeu].Lbl do
begin begin
@@ -6980,8 +7404,8 @@ begin
93,94,95,96,97,98,99 : nc:=4; 93,94,95,96,97,98,99 : nc:=4;
end; end;
end; end;
if dec=7 then nc:=8; // sr if dec=7 then nc:=8; // SR
if dec=8 then if dec=8 then // arcomora
begin begin
case x of case x of
3 : nc:=3; 3 : nc:=3;
@@ -6990,11 +7414,12 @@ begin
9 : nc:=5; 9 : nc:=5;
end; end;
end; end;
if dec=9 then nc:=2; if dec=9 then nc:=2; // LS-DEC-NMBS
if dec=10 then nc:=feux[i].Na; if dec=10 then nc:=feux[i].Na; // Bmodels
nombre_adresses_signal:=nc; nombre_adresses_signal:=nc;
end; end;
function verif_coherence : boolean; function verif_coherence : boolean;
var AncAdr,i,j,k,l,Indexaig,adr,adr2,extr,detect,condcarre,nc,index2,SuivAdr, var AncAdr,i,j,k,l,Indexaig,adr,adr2,extr,detect,condcarre,nc,index2,SuivAdr,
x,y,extr2,adr3,index3,det1Br,det2Br,det1index,det2index,adresse,Adresse2,dec,nc2 : integer; x,y,extr2,adr3,index3,det1Br,det2Br,det1index,det2index,adresse,Adresse2,dec,nc2 : integer;
@@ -7821,6 +8246,9 @@ begin
end; end;
end; end;
// vérification des compatibilités des décodeurs de signaux et des aspects
if not(verif_dec_sig(true)) then ok:=false;
verif_coherence:=ok; verif_coherence:=ok;
end; end;
@@ -10543,19 +10971,305 @@ begin
// maj le signal dans la fenetre principale // maj le signal dans la fenetre principale
Feux[ligneClicSig+1].Img.picture.Bitmap:=ImageSIgnal.Picture.Bitmap; // et recopie le feu Feux[ligneClicSig+1].Img.picture.Bitmap:=ImageSIgnal.Picture.Bitmap; // et recopie le feu
adr:=feux[ligneClicSig+1].adresse; adr:=feux[ligneClicSig+1].adresse;
if feux[ligneClicSig+1].contrevoie then Maj_Etat_Signal(adr,clign) else Maj_Etat_Signal(adr,clign or setRaz_F); if feux[ligneClicSig+1].contrevoie then Maj_Etat_Signal(adr,clignote_f or bita1_F) else Maj_Etat_Signal(adr,clignote_F);
dessine_feu_mx(Feux[ligneClicSig+1].Img.Canvas,0,0,1,1,feux[ligneClicSig+1].adresse,1); // dessine les feux du signal dessine_feu_mx(Feux[ligneClicSig+1].Img.Canvas,0,0,1,1,feux[ligneClicSig+1].adresse,1); // dessine les feux du signal
end; end;
end;
// modif editT
procedure Tformconfig.modif_editT(Sender : TObject);
var te : tEdit;
adr,i,erreur :integer;
begin
if deccourant=0 then exit;
te:=Sender as Tedit;
adr:=extract_int(te.name);
val(te.Text,i,erreur);
if erreur<>0 then
begin
labelInfo.caption:='Erreur adresse';
exit;
end;
labelInfo.caption:='';
decodeur_pers[deccourant].desc[adr].offsetAdresse:=i;
end;
// changement combobox choix sorties 1 ou 2
procedure Tformconfig.modif_ComboTS(Sender : TObject);
var co : tComboBox;
i,idx,adresse,erreur : integer;
s : string;
begin
if deccourant=0 then exit;
co:=Sender as TCombobox;
//i:=co.itemIndex;
i:=extract_int(co.name);
s:=intToSTR(i);
idx:=co.itemIndex;
val(s[1],i,erreur); // rang
delete(s,1,1);
val(s,adresse,erreur); // adresse
if i=1 then decodeur_pers[deccourant].desc[adresse].sortie1:=idx+1;
if i=2 then decodeur_pers[deccourant].desc[adresse].sortie2:=idx+1;
end;
// changement combobox Etats
procedure Tformconfig.modif_ComboL(Sender : TObject);
var co : tComboBox;
idx,i,adresse,erreur : integer;
s : string;
begin
if deccourant=0 then exit;
co:=Sender as TCombobox;
//i:=co.itemIndex;
i:=extract_int(co.name);
s:=intToSTR(i);
idx:=co.itemIndex;
val(s[1],i,erreur); // rang
delete(s,1,1);
val(s,adresse,erreur); // adresse
if i=1 then decodeur_pers[deccourant].desc[adresse].etat1:=idx;
if i=2 then decodeur_pers[deccourant].desc[adresse].etat2:=idx;
end; end;
procedure rend_visible;
var i,erreur,nombre : integer;
begin
val(formconfig.EditNbreAdr.Text,nombre,erreur);
if (erreur<>0) or (nombre>10) then exit;
decCourant:=formconfig.ComboBoxDecodeurPerso.ItemIndex+1;
if decCourant<1 then exit;
decodeur_pers[decCourant].nbreAdr:=nombre;
decodeur_pers[decCourant].nom:=formconfig.ComboBoxDecodeurPerso.items[decCourant-1];
maj_decodeurs;
exit;
for i:=1 to nombre do
begin
ComboTS1[i].Visible:=true;
ComboTS2[i].Visible:=true;
EditT[i].visible:=true;
ComboL1[i].Visible:=true;
ComboL2[i].Visible:=true;
end;
for i:=nombre+1 to 10 do
begin
ComboTS1[i].Visible:=false;
ComboTS2[i].Visible:=false;
EditT[i].visible:=false;
ComboL1[i].Visible:=false;
ComboL2[i].Visible:=false;
end;
end;
// nouveau décodeur personnalisé
procedure TFormConfig.BoutonNouveauClick(Sender: TObject);
var s: string;
cb : TcomboBox;
te : Tedit;
i,nombre,erreur,decCourant : integer;
begin
if NbreDecPers>=NbreMaxiDecPers then exit;
inc(NbreDecPers);
s:='Personnalisé '+intToSTR(NbreDecPers);
decodeur_pers[NbreDecPers].nom:=s;
decodeur_pers[NbreDecPers].Nation:=1;
nombre:=4;
decodeur_pers[NbreDecPers].NbreAdr:=nombre;
formconfig.EditNbreAdr.Text:=intToSTR(nombre);
ComboBoxDecodeurPerso.Items.Add(s);
ComboBoxDecodeurPerso.ItemIndex:=NbreDecPers-1;
decCourant:=formconfig.ComboBoxDecodeurPerso.ItemIndex+1;
for i:=1 to Nombre do
begin
editT[i].Text:=IntToSTR(i-1);
decodeur_pers[decCourant].desc[i].offsetAdresse:=i-1;
end;
rend_visible;
// ajouter aux décodeurs personalisés
s:=decodeur_pers[decCourant].nom;
formconfig.ComboBoxDec.Items.add(s);
config_modifie:=true;
// ajouter aux décodeurs
inc(NbDecodeur);
decodeur[NbDecodeur]:=s;
LabelNbDecPers.caption:=intToSTR(NbreDecPers);
//vérifier si le décodeur est utilisé dans les signaux pour changer son hint
for i:=1 to NbreFeux do
begin
if feux[i].decodeur=NbDecodeurdeBase+decCourant-1 then Maj_Hint_Signal(i);
end;
end;
procedure TFormConfig.EditNbreAdrChange(Sender: TObject);
var i,erreur : integer;
begin
val(EditNbreAdr.text,i,erreur);
if (erreur<>0) or (i<1) or (i>10) then
begin
LabelInfo.Caption:='Nombre d''adresses valides de 1 à 10';
exit;
end;
LabelInfo.Caption:='';
rend_visible;
end;
procedure TFormConfig.ComboBoxDecodeurPersoChange(Sender: TObject);
var i,nAdr,a : integer;
s: string;
begin
if affevt then Affiche('Evt ComboBoxDecodeurPerso',clyellow);
a:=ComboBoxDecodeurPerso.ItemIndex;
if a=-1 then
begin
// changement du nom
if decCourant=0 then exit;
s:=ComboBoxDecodeurPerso.Text;
ComboBoxDecodeurPerso.items[decCourant-1]:=s;
decodeur_pers[decCourant].nom:=s;
decodeur[NbDecodeurdeBase+DecCourant-1]:=s;
ComboBoxDec.Items[NbDecodeurdeBase+DecCourant-1]:=s;
//vérifier si le décodeur est utilisé dans les signaux pour changer son hint
for i:=1 to NbreFeux do
begin
if feux[i].decodeur=NbDecodeurdeBase+decCourant-1 then Maj_Hint_Signal(i);
end;
exit;
end;
decCourant:=a+1;
EditNbreAdr.Text:=intToSTR(decodeur_pers[decCourant].NbreAdr);
//Affiche('Décodeur courant = '+intToSTR(decCourant),clyellow);
maj_decodeurs;
end;
// renvoie vrai si chaine est dans le combobox 'combo' et renvoie son index
function trouve_entree_combo(combo : Tcombobox;chaine : string;var index : integer) : boolean;
var i,maxi : integer;
trouve : boolean;
begin
i:=0;
maxi:=combo.items.Count;
repeat
trouve:=combo.Items[i]=chaine;
inc(i);
until trouve or (i=maxi);
result:=trouve;
index:=i-1;
end;
procedure TFormConfig.ButtonSupClick(Sender: TObject);
var s : string;
i,ma,deco,supp : integer;
aff : boolean;
begin
// supprimer des décodeurs personalisés
if decCourant=0 then exit;
s:='Voulez vous supprimer le décodeur personnalisé '#13+decodeur_pers[decCourant].nom+' ?';
if Application.MessageBox(pchar(s),pchar('confirm'), MB_YESNO or MB_DEFBUTTON2 or MB_ICONQUESTION)=idNo then exit;
//supprimer de la liste des décodeurs peronnalisés
s:=decodeur_pers[decCourant].nom;
if trouve_entree_combo(ComboBoxDec,s,i) then ComboBoxDec.Items.Delete(i)
else exit;
supp:=i;
Affiche('Suppression décodeur '+intToSTR(supp-1)+' '+s,clOrange);
//supprimer de la liste des décodeurs si elle est affectée
if trouve_entree_combo(ComboBoxDecodeurPerso,s,i) then ComboBoxDecodeurPerso.Items.Delete(i)
else affiche('Anomalie 1',clred);
//if decCourant>0 then dec(decCourant);
decCourant:=0;
ComboBoxDecodeurPerso.ItemIndex:=-1;
inc(i);
ma:=i;
// et supprimer la base
for i:=ma to NbreDecPers-1 do
begin
decodeur_pers[i]:=decodeur_pers[i+1];
end;
dec(NbreDecPers);
if NbreDecPers=0 then ComboBoxDecodeurPerso.Text:='';
config_modifie:=true;
maj_decodeurs;
// supprimer des décodeurs
decodeur[NbDecodeur]:='';
dec(NbDecodeur);
LabelNbDecPers.caption:=intToSTR(NbreDecPers);
// si le décodeur est attribué aux signaux, les passer en rien
aff:=false;
for i:=1 to NbreFeux do
begin
deco:=feux[i].decodeur;
if deco=supp then
begin
Affiche('Le décodeur du signal '+intToSTR(Feux[i].adresse)+' a été réaffacté à rien',clOrange);
feux[i].decodeur:=0;
if i=ligne_signal+1 then aff_champs_sig_feux(ligne_signal+1);
aff:=true;
end;
if deco>supp then
begin
dec(feux[i].decodeur); // et décrémenter les autres décodeurs personnalisés de rang supérieur
aff:=true;
end;
end;
// réafficher le richedit des signaux
if aff then
begin
richSig.Clear;
for i:=1 to NbreFeux do
begin
s:=encode_sig_feux(i); // encode la ligne depuis le tableau feux
if s<>'' then
begin
RichSig.Lines.Add(s);
RE_ColorLine(RichSig,RichSig.lines.count-1,ClAqua);
Feux[i].modifie:=false;
end;
end;
end;
end;
procedure TFormConfig.ComboBoxNationChange(Sender: TObject);
var nation : integer;
begin
if deccourant=0 then exit;
nation:=ComboBoxNation.itemIndex+1;
decodeur_pers[decCourant].nation:=nation;
maj_decodeurs;
end;
begin
end. end.
+2 -2
View File
@@ -20,8 +20,8 @@ object FormDebug: TFormDebug
OnCreate = FormCreate OnCreate = FormCreate
OnKeyPress = FormKeyPress OnKeyPress = FormKeyPress
DesignSize = ( DesignSize = (
831 839
749) 757)
PixelsPerInch = 96 PixelsPerInch = 96
TextHeight = 13 TextHeight = 13
object Label1: TLabel object Label1: TLabel
+7 -5
View File
@@ -50,10 +50,11 @@ object FormPilote: TFormPilote
Caption = 'Nombre de feux '#224' allumer' Caption = 'Nombre de feux '#224' allumer'
end end
object LabelDec: TLabel object LabelDec: TLabel
Left = 208 Left = 200
Top = 192 Top = 192
Width = 72 Width = 129
Height = 19 Height = 19
Alignment = taCenter
Caption = 'LabelDec' Caption = 'LabelDec'
Font.Charset = ANSI_CHARSET Font.Charset = ANSI_CHARSET
Font.Color = clWindowText Font.Color = clWindowText
@@ -61,6 +62,7 @@ object FormPilote: TFormPilote
Font.Name = 'Arial' Font.Name = 'Arial'
Font.Style = [fsBold] Font.Style = [fsBold]
ParentFont = False ParentFont = False
Layout = tlCenter
end end
object Label1: TLabel object Label1: TLabel
Left = 240 Left = 240
@@ -126,7 +128,7 @@ object FormPilote: TFormPilote
Top = 96 Top = 96
Width = 161 Width = 161
Height = 17 Height = 17
Caption = 'S'#233'maphore clignotant' Caption = 'Rouge cli'
TabOrder = 5 TabOrder = 5
OnClick = RadioRougeCliClick OnClick = RadioRougeCliClick
end end
@@ -239,8 +241,8 @@ object FormPilote: TFormPilote
OnClick = CheckVerrouCarreClick OnClick = CheckVerrouCarreClick
end end
object GroupBox3: TGroupBox object GroupBox3: TGroupBox
Left = 8 Left = 120
Top = 224 Top = 40
Width = 193 Width = 193
Height = 73 Height = 73
Caption = 'Signalisation combin'#233'e' Caption = 'Signalisation combin'#233'e'
+43 -30
View File
@@ -72,43 +72,36 @@ type
const const
carre =0 ; carre_F=1; carre =0 ; carre_F=1;
vert_jaune_H =0 ; vert_jaune_H_F=1; // signal belge
semaphore =1 ; semaphore_F=2; semaphore =1 ; semaphore_F=2;
semaphore_cli =2 ; semaphore_cli_F=4; semaphore_cli =2 ; semaphore_cli_F=4;
vert =3 ; vert_F=8; vert =3 ; vert_F=8;
vert_cli =4 ; vert_cli_F=16; vert_cli =4 ; vert_cli_F=16;
violet =5 ; violet_F=32; violet =5 ; violet_F=32;
vert_jaune_V =5 ; vert_jaune_V_F=32;
blanc =6 ; blanc_F=64; blanc =6 ; blanc_F=64;
rouge_blanc =6 ; rouge_blanc_F=64; // signal belge
blanc_cli =7 ; blanc_cli_F=128; blanc_cli =7 ; blanc_cli_F=128;
jaune =8 ; jaune_F=256; jaune =8 ; jaune_F=256;
deux_jaunes =8 ; deux_jaunes_F=256; // signal belge
jaune_cli =9 ; jaune_cli_F=512; jaune_cli =9 ; jaune_cli_F=512;
ral_30 =10; ral_30_F=1024; ral_30 =10; ral_30_F=1024;
chiffre =10; chiffre_F=1024;
ral_60 =11; ral_60_F=2048; ral_60 =11; ral_60_F=2048;
chevron =11; chevron_F=2048;
rappel_30 =12; rappel_30_F=4096; rappel_30 =12; rappel_30_F=4096;
clign =12 ; clign_F=4096;
rappel_60 =13; rappel_60_F=8192; rappel_60 =13; rappel_60_F=8192;
Disque_D =14; // pour décodeur LDT Disque_D =14; // pour décodeur LDT
ral_60_jaune_cli =15;ral_60_jaune_cli_F=32768; // pour décodeur LDT ral_60_jaune_cli =15;ral_60_jaune_cli_F=32768; // pour décodeur LDT
SetRaz =15;SetRaz_F=32768; // pour belge
aspect8 =16 ; aspect8 =16 ;
// signal belge
// base
vert_jaune_H =0 ; vert_jaune_H_F=1; // signal belge
rouge =1 ; rouge_F=2;
vertB =2 ; vertB_F=4;
vert_jaune_V =3 ; vert_jaune_V_F=8;
rouge_blanc =4 ; rouge_blanc_F=16; // signal belge
deux_jaunes =5 ; deux_jaunes_F=32; // signal belge
// combinée
chiffre =6; chiffre_F=64;
chevron =7; chevron_F=128;
clignote =8; clignote_F=256;
Bita1 =15; Bita1_F=32768; // mise à 1 de bit signal combiné pour belge
var var
FormPilote: TFormPilote; FormPilote: TFormPilote;
@@ -150,9 +143,26 @@ begin
end; end;
end; end;
// renvoie la nation du signal 0
function nation : integer;
var i,dec,asp : integer;
begin
i:=1;
dec:=feux[0].decodeur;
asp:=feux[0].aspect;
if asp=20 then i:=2;
// si décodeur personalisé
if (dec>=NbDecodeurdeBase) and (dec<NbDecodeurdeBase+NbreDecPers) then
begin
if decodeur_pers[dec-NbDecodeurdeBase+1].nation=2 then i:=2;
end;
result:=i;
end;
procedure TFormPilote.RadioVertClick(Sender: TObject); procedure TFormPilote.RadioVertClick(Sender: TObject);
begin begin
Maj_Etat_Signal(0,vert); if nation=1 then Maj_Etat_Signal(0,vert) else Maj_Etat_Signal(0,vertB) ;
dessine_feu_pilote; dessine_feu_pilote;
end; end;
@@ -164,7 +174,7 @@ end;
procedure TFormPilote.RadioJauneClick(Sender: TObject); procedure TFormPilote.RadioJauneClick(Sender: TObject);
begin begin
Maj_Etat_Signal(0,jaune); if nation=1 then Maj_Etat_Signal(0,jaune) else Maj_Etat_Signal(0,deux_jaunes);
dessine_feu_pilote; dessine_feu_pilote;
end; end;
@@ -188,19 +198,19 @@ end;
procedure TFormPilote.RadioCarreClick(Sender: TObject); procedure TFormPilote.RadioCarreClick(Sender: TObject);
begin begin
Maj_Etat_Signal(0,carre); if nation=1 then Maj_Etat_Signal(0,carre) else Maj_Etat_Signal(0,vert_jaune_H);
dessine_feu_pilote; dessine_feu_pilote;
end; end;
procedure TFormPilote.RadioBlancClick(Sender: TObject); procedure TFormPilote.RadioBlancClick(Sender: TObject);
begin begin
Maj_Etat_Signal(0,blanc); if nation=1 then Maj_Etat_Signal(0,blanc) else Maj_Etat_Signal(0,rouge_blanc);
dessine_feu_pilote; dessine_feu_pilote;
end; end;
procedure TFormPilote.RadioVioletClick(Sender: TObject); procedure TFormPilote.RadioVioletClick(Sender: TObject);
begin begin
Maj_Etat_Signal(0,violet); if nation=1 then Maj_Etat_Signal(0,violet) else Maj_Etat_Signal(0,vert_jaune_V);
dessine_feu_pilote; dessine_feu_pilote;
end; end;
@@ -218,7 +228,7 @@ end;
procedure TFormPilote.RadioRalen30Click(Sender: TObject); procedure TFormPilote.RadioRalen30Click(Sender: TObject);
begin begin
Maj_Etat_Signal(0,chevron); Maj_Etat_Signal(0,ral_30);
dessine_feu_pilote; dessine_feu_pilote;
end; end;
@@ -292,6 +302,7 @@ begin
LabelDec.Caption:=decodeur[d]; LabelDec.Caption:=decodeur[d];
feux[0].decodeur:=d; feux[0].decodeur:=d;
feux[0].aspect:=n; feux[0].aspect:=n;
feux[0].contrevoie:=feux[i].contrevoie;
// signal belge // signal belge
if (n=20) then if (n=20) then
begin begin
@@ -313,8 +324,9 @@ begin
groupBox3.Visible:=true; groupBox3.Visible:=true;
end; end;
if n<>20 then if n<>20 then
begin begin
groupBox3.Visible:=false;
Radiocarre.Caption:='Carré'; Radiocarre.Caption:='Carré';
Radioviolet.Caption:='Violet'; Radioviolet.Caption:='Violet';
RadioJauneCli.Caption:='Avertissement clignotant'; RadioJauneCli.Caption:='Avertissement clignotant';
@@ -325,6 +337,7 @@ begin
radioJaunecli.visible:=true; radioJaunecli.visible:=true;
radioRougecli.visible:=true; radioRougecli.visible:=true;
radioBlanccli.visible:=true; radioBlanccli.visible:=true;
end; end;
@@ -383,19 +396,19 @@ end;
procedure TFormPilote.CheckChiffreClick(Sender: TObject); procedure TFormPilote.CheckChiffreClick(Sender: TObject);
begin begin
if checkChiffre.Checked then Maj_Etat_Signal(0,chiffre) else Maj_Etat_Signal(0,chiffre or SetRaz_F); if checkChiffre.Checked then Maj_Etat_Signal_belge(0,chiffre_F or bita1_F) else Maj_Etat_Signal_belge(0,chiffre_F);
dessine_feu_pilote; dessine_feu_pilote;
end; end;
procedure TFormPilote.CheckChevronClick(Sender: TObject); procedure TFormPilote.CheckChevronClick(Sender: TObject);
begin begin
if checkChevron.Checked then Maj_Etat_Signal(0,chevron) else Maj_Etat_Signal(0,chevron or setRaz_F); if checkChevron.Checked then Maj_Etat_Signal(0,chevron_F or bita1_F) else Maj_Etat_Signal(0,chevron_F );
dessine_feu_pilote; dessine_feu_pilote;
end; end;
procedure TFormPilote.CheckClignoteClick(Sender: TObject); procedure TFormPilote.CheckClignoteClick(Sender: TObject);
begin begin
if checkclignote.Checked then Maj_Etat_Signal(0,clign) else Maj_Etat_Signal(0,clign or setRaz_F); if checkclignote.Checked then Maj_Etat_Signal(0,clignote_F or bita1_F) else Maj_Etat_Signal(0,clignote_F );
dessine_feu_pilote; dessine_feu_pilote;
end; end;
+2 -2
View File
@@ -2224,8 +2224,8 @@ object FormPrinc: TFormPrinc
Top = 65528 Top = 65528
end end
object SaveDialog: TSaveDialog object SaveDialog: TSaveDialog
Left = 888 Left = 832
Top = 16 Top = 65528
end end
object PopupMenuFenRich: TPopupMenu object PopupMenuFenRich: TPopupMenu
Left = 208 Left = 208
+369 -162
View File
File diff suppressed because it is too large Load Diff
+1 -4
View File
@@ -5215,7 +5215,7 @@ begin
begin begin
HorzScrollBar.Range:=DimX; HorzScrollBar.Range:=DimX;
HorzScrollBar.Tracking:=true; HorzScrollBar.Tracking:=true;
HorzScrollBar.Smooth:=false; // ne pas mettre true sinon figeage dans W11 si onclique sur la trackbar!! HorzScrollBar.Smooth:=false; // ne pas mettre true sinon figeage dans W11 si on clique sur la trackbar!!
VertScrollBar.Range:=DimY; VertScrollBar.Range:=DimY;
VertScrollBar.Tracking:=true; VertScrollBar.Tracking:=true;
VertScrollBar.Smooth:=false; VertScrollBar.Smooth:=false;
@@ -5243,9 +5243,7 @@ begin
r:=rect(x1,y1,x1+LargeurCell,y1+HauteurCell); r:=rect(x1,y1,x1+LargeurCell,y1+HauteurCell);
FillRect(r); FillRect(r);
end; end;
end; end;
//afficher les cellules sauf les signaux //afficher les cellules sauf les signaux
@@ -5293,7 +5291,6 @@ begin
offsetSourisY:=-10; offsetSourisY:=-10;
offsetSourisX:=-10; offsetSourisX:=-10;
caption:='TCO'; caption:='TCO';
AvecGrille:=true;
TCO_modifie:=false; TCO_modifie:=false;
rangUndo:=1; rangUndo:=1;
XclicCell:=1; XclicCell:=1;
BIN
View File
Binary file not shown.
+3 -1
View File
@@ -170,7 +170,9 @@ version 6.1 : Am
version 6.2 : Déplacement du curseur du TCO avec les touches curseur. version 6.2 : Déplacement du curseur du TCO avec les touches curseur.
Dessin du TCO à la souris. Dessin du TCO à la souris.
version 6.3 : Choix du graphisme du TCO en lignes brisées ou courbes. version 6.3 : Choix du graphisme du TCO en lignes brisées ou courbes.
version 7.0 : Gestion des signaux belges (avec chevron et réduction de vitesse). version 6.4 : Gestion des signaux belges (avec chevron et réduction de vitesse).
version 7.0 : Possibilité de créer des décodeurs spécifiques de signaux.