This commit is contained in:
f1iwq2
2025-04-20 20:31:02 +02:00
parent bd591f6008
commit 5fc6af8bb5
20 changed files with 1748 additions and 861 deletions
+2
View File
@@ -75,7 +75,9 @@ object FormAnalyseCDM: TFormAnalyseCDM
ParentShowHint = False
ShowHint = True
OnClick = ImageCDMClick
OnMouseDown = ImageCDMMouseDown
OnMouseMove = ImageCDMMouseMove
OnMouseUp = ImageCDMMouseUp
end
end
object GroupBox1: TGroupBox
+34 -4
View File
@@ -73,6 +73,10 @@ type
Y: Integer);
procedure ButtonAnimeClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure ImageCDMMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure ImageCDMMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Déclarations privées }
public
@@ -164,12 +168,12 @@ type
var Segment : array of Tsegment;
nInter,nPeriph,nSeg,nPort,nligne,XminiCDM,XmaxiCDM,YminiCDM,YmaxiCDM,NAig_CDM,Ndet_CDM,
DernAdrAig,SeqAdrCroisement,nb_det,IndexClic,xAig,yAig,cadre,largeur_voie,dernierSeg,
largeurTrain,HauteurTrain : integer;
largeurTrain,HauteurTrain,xBas,Ybas : integer;
lignes : TStrings;
reducX,reducY,ArcTanHautLargTrain : single;
FormAnalyseCDM: TFormAnalyseCDM;
sBranche,NomModuleCDM : string;
clic,premaff,adr_nulle : boolean;
clic,premaff,adr_nulle,SourisBas : boolean;
Aig_CDM : array[0..NbreMaxiAiguillages] of TAig_CDM;
Det_CDM : array[1..500] of integer;
FWICImage : tBitmap;
@@ -1171,7 +1175,8 @@ begin
// en déduire l'angle A et B
if arcYa<0 then angleA:=360-ArcXa else angleA:=ArcXa;
if arcYb<0 then angleB:=360-ArcXb else angleB:=ArcXb;
if angleA>360 then angleA:=360-angleA;
if AngleA>=360 then AngleA:=360-AngleA;
if AngleB>=360 then AngleB:=360-AngleB;
if abs(angleA-angleB)>180 then
begin
@@ -5493,7 +5498,7 @@ begin
end;
procedure TFormAnalyseCDM.ImageCDMMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var Xs,Ys,i,xt,yt : integer;
var Xs,Ys,i,xt,yt,dx,dy : integer;
trouve : boolean;
begin
xs:=x;ys:=y;
@@ -5514,6 +5519,17 @@ begin
ImageCDM.showHint:=true;
end
else ImageCDM.showhint:=false;
if sourisBas then
begin
dx:=(Xbas-x) div 2;
dy:=(Ybas-y) div 2;
if dx<>0 then
ScrollBox1.HorzScrollBar.Position:=ScrollBox1.HorzScrollBar.Position+dx;
if dy<>0 then
ScrollBox1.VertScrollBar.Position:=ScrollBox1.VertScrollBar.Position+dy;
end;
end;
procedure TFormAnalyseCDM.ButtonAnimeClick(Sender: TObject);
@@ -5549,6 +5565,20 @@ begin
dessine_det(523);
end;
procedure TFormAnalyseCDM.ImageCDMMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
SourisBas:=true;
Xbas:=x;
Ybas:=y;
end;
procedure TFormAnalyseCDM.ImageCDMMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
SourisBas:=false;
end;
end.
+15 -3
View File
@@ -1,7 +1,7 @@
object FormCompteur: TFormCompteur
Left = 550
Top = 218
Width = 227
Width = 258
Height = 262
BorderStyle = bsSizeToolWin
Caption = 'Compteur'
@@ -25,7 +25,7 @@ object FormCompteur: TFormCompteur
Top = 0
Width = 180
Height = 128
PopupMenu = PopupMenu1
PopupMenu = PopupMenuC
end
object Labeltrain: TLabel
Left = 32
@@ -74,7 +74,8 @@ object FormCompteur: TFormCompteur
TabOrder = 1
OnClick = Button0Click
end
object PopupMenu1: TPopupMenu
object PopupMenuC: TPopupMenu
OnPopup = PopupMenuCPopup
Left = 184
Top = 16
object Verrouillerdevant1: TMenuItem
@@ -107,5 +108,16 @@ object FormCompteur: TFormCompteur
Caption = 'Afficher icone du train'
OnClick = Affichericonedutrain1Click
end
object N3: TMenuItem
Caption = '-'
end
object Vitesseencrans1: TMenuItem
Caption = 'Vitesse en crans'
OnClick = Vitesseencrans1Click
end
object Vitesserelle1: TMenuItem
Caption = 'Vitesse r'#233'elle'
OnClick = Vitesserelle1Click
end
end
end
+234 -143
View File
@@ -8,13 +8,13 @@ uses
const
pisur180=pi/180;
NbreCompteurs=10;
NbreCompteurs=1;
type
TFormCompteur = class(TForm)
ImageCompteur: TImage;
TrackBarC: TTrackBar;
PopupMenu1: TPopupMenu;
PopupMenuC: TPopupMenu;
Verrouillerdevant1: TMenuItem;
Dverrouiller1: TMenuItem;
N1: TMenuItem;
@@ -27,6 +27,9 @@ type
N2: TMenuItem;
Affichericonedutrain1: TMenuItem;
ImageTrain: TImage;
N3: TMenuItem;
Vitesseencrans1: TMenuItem;
Vitesserelle1: TMenuItem;
procedure FormActivate(Sender: TObject);
procedure Dverrouiller1Click(Sender: TObject);
procedure Verrouillerdevant1Click(Sender: TObject);
@@ -39,6 +42,9 @@ type
procedure FormResize(Sender: TObject);
procedure Button0Click(Sender: TObject);
procedure Affichericonedutrain1Click(Sender: TObject);
procedure Vitesseencrans1Click(Sender: TObject);
procedure Vitesserelle1Click(Sender: TObject);
procedure PopupMenuCPopup(Sender: TObject);
private
{ Déclarations privées }
protected
@@ -49,20 +55,20 @@ type
end;
type
typ=(rien,fen,gb,im); // un compteur peut être de la fenetre 'formCompteur' (fen), des groupBox de la fenetre principale (gb) ou d'une image (onglet compteurs formConfig)
TTcompteur=array[1..10] of record
typ=(Trien,fen,gb,im); // un compteur peut être de la fenetre 'formCompteur' (fen), des groupBox de la fenetre principale (gb) ou d'une image (onglet compteurs formConfig)
TTcompteur=array[1..1] of record
FcBitMap : Tbitmap;
paramcompt : TparamCompt;
end;
var
formCompteur : array[1..10] of TformCompteur; // il y a 10 fenetres mais on utilise qu'un compteur.
formCompteur : array[1..1] of TformCompteur; // il y a 10 fenetres mais on utilise qu'un compteur.
Scompteur : TTCompteur; // Scompteur : associé à fen
ParamCompteur : array[1..3] of record
coulAig,coulGrad,CoulNum,CoulFond,CoulArc : tcolor;
end;
VerrouilleCompteur,affTrainCompteur : boolean;
VerrouilleCompteur,affTrainCompteur,VitCrans : boolean;
LargeurCompteurs,HauteurCompteurs,LargComptC,HautComptC : integer;
couleurTete : tcolor;
@@ -72,6 +78,8 @@ procedure aiguille_compteur(c,idTrain : integer;comp : Tcomponent);
procedure dessin_fond_compteur(var param : TparamCompt;i: integer ; Im : tbitmap;typCompt : integer);
procedure position_compteur;
procedure affiche_train_compteur(c : integer);
procedure init_compteurs;
function Vr_kmh(v : integer) : integer;
implementation
@@ -143,25 +151,34 @@ begin
affiche_train_compteur(1);
end;
// convertit une vitesse en cm/s en km/h suivant l'échelle
function Vr_kmh(v : integer) : integer;
begin
case echelle of
0 : result:=(v*87*36) div 1000; // H0
1 : result:=(v*160*36) div 1000; // N
2 : result:=(v*220*36) div 1000; // Z
end;
end;
// change l'aiguille du compteur
// c : n° du compteur idTrain : index du train comp : composant dans lequel se trouve le compteur (form, groupbox ou image)
// 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;
angleDeb,AngleFin,sinD,cosD,sinF,cosF : extended ;
angleDeb,AngleFinLoc,sinD,cosD,sinF,cosF : extended ;
canvDest :tcanvas;
param : Tparamcompt;
typDest : typ;
begin
if compteur<1 then exit;
typDest:=rien;
typDest:=Trien;
if comp is tform then typDest:=fen;
if comp is tgroupBox then typDest:=gb;
if comp is tImage then typDest:=im;
if TypDest=rien then
if TypDest=Trien then
begin
Affiche('Anomalie 47',clred);
Affiche('Anomalie 47 c='+intToSTR(c)+' i='+intToSTR(idTrain),clred);
exit;
end;
@@ -198,16 +215,32 @@ begin
canvDest:=formconfig.ImageCtC.Canvas;
end;
if not(VitCrans) then
begin
if trains[idTrain].CoeffV1<>0 then // si le train est étalonné
begin
vitesse:=round(crans_to_Vrcms(vitesse,idTrain)); // vitesse en cm/s
vitesseFin:=round(crans_to_Vrcms(vitesseFin,idTrain)); // vitesse en cms/s
vitesse:=vr_kmh(vitesse);
VitesseFin:=vr_kmh(vitesseFin);
if vitesse>param.AngleFin then vitesse:=param.AngleFin;
if vitesseFin>param.AngleFin then VitesseFin:=param.AngleFin;
end;
end;
with param do
begin
angleDeb:=ComptA*vitesse+comptB;
angleFin:=ComptA*vitesseFin+comptB;
angleFinLoc:=ComptA*vitesseFin+comptB;
lim:=imgL;
Him:=imgH;
end;
sincos(AngleDeb*pisur180,sinD,cosD); // arc vitesse de début
sincos(AngleFin*pisur180,sinF,cosF); // arc vitesse de fin
sincos(AngleFinLoc*pisur180,sinF,cosF); // arc vitesse de fin
with canvDest do
begin
@@ -221,7 +254,7 @@ begin
begin
pen.mode:=pmCopy;
pen.width:=round(4*redX);
if (vitesse<>0) and (angleDeb<>angleFin) then
if (vitesse<>0) and (angleDeb<>angleFinLoc) then
begin
x1:=AigCX - rav;
y1:=AigCY - rav;
@@ -232,7 +265,7 @@ begin
x4:=AigCX + Round(rav*sinF);
y4:=AigCY - Round(rav*cosF);
pen.color:=ParamCompteur[comptloc].coulArc;
if angleDeb>=angleFin then setArcDirection(Handle,AD_COUNTERCLOCKWISE) else setArcDirection(Handle,AD_CLOCKWISE) ;
if angleDeb>=angleFinLoc then setArcDirection(Handle,AD_COUNTERCLOCKWISE) else setArcDirection(Handle,AD_CLOCKWISE) ;
Arc(x1,y1,x2,y2,x3,y3,x4,y4);
end;
@@ -244,13 +277,12 @@ begin
end;
end;
procedure compteur_2(c : integer;bm : tbitmap;param : tparamcompt);
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,angleFin,incr,r : single;
angle,incr,r : single;
s : string;
begin
angle:=10; // angle début des graduations
angleFin:=170; // angle fin des graduations
incr:=2.5; // incrément d'angle en ° des graduations
n:=0;
v:=0;
@@ -259,6 +291,7 @@ begin
with param do
begin
AngleFin:=170; // 170 angle fin des graduations
r:=redx; // réduction
rg:=round(AigCX/1.05); // rayon des graduations
rayon2:=Rg-round(10*r); // rayon de fin des graduations
@@ -281,6 +314,9 @@ begin
font.color:=ParamCompteur[2].CoulNum;
font.size:=round(r*20);
font.style:=[fsbold];
{$IF CompilerVersion >= 28.0}
font.orientation:=0;
{$IFEND}
end;
// dessine le cadran
@@ -333,23 +369,25 @@ begin
end;
inc(n);
angle:=angle+incr; // 18
until angle>AngleFin+incr;
until angle>param.AngleFin+incr;
AngleFin:=130; // en fait vitesse maxi compteur
end;
end;
procedure compteur_tachro(c : integer;bm : tbitmap;param : tparamcompt);
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,angleFin,incr,r,a,sinA,cosA : single;
angle,incr,r,a,sinA,cosA : single;
s : string;
begin
angle:=-40; // angle début des graduations
angleFin:=220; // angle fin des graduations
incr:=2.5; // incrément d'angle en ° des graduations
n:=0;
v:=0;
with param do
begin
angleFin:=220; // angle fin des graduations en km/h
lim:=ImgL;
him:=ImgH;
AigCX:=lim div 2; // centre aiguille
@@ -438,15 +476,11 @@ begin
end;
inc(n);
angle:=angle+incr;
until angle>AngleFin+incr;
until angle>param.AngleFin+incr;
end;
lim:=param.ImgL;
him:=param.ImgH;
// copie l'image du texte "tachro" mise à l'échelle
StretchBlt(bm.Canvas.Handle,round(145*r),round(90*r),round(lim*r),round(him*r),
FormPrinc.ImageTachro.canvas.Handle,0,0,lim,him,srcCopy);
param.AngleFin:=220; // en fait vitesse maxi compteur
exit;
end;
@@ -479,6 +513,9 @@ begin
Brush.Color:=$1F1A17;
font.color:=ParamCompteur[1].CoulNum;
font.size:=round(redx*10);
{$IF CompilerVersion >= 28.0}
font.orientation:=0;
{$IFEND}
TextOut(round(50*redX),round(128*redY),'0');
TextOut(round(36*redX),round(90*redY),'20');
TextOut(round(50*redX),round(54*redY),'40');
@@ -488,8 +525,9 @@ begin
TextOut(round(126*redX),round(126*redY),'120');
// centre de l'aiguille
AigCX:=round(98*redX);
AigCY:=round(96*redY);
AigCY:=round(98*redY);
rAig:=round(AigCX / 1.5);
angleFin:=127; // en fait vitesse maxi compteur
end;
2 : begin
// centre de l'aiguille et longueur
@@ -499,11 +537,11 @@ begin
// le compteur 2 est dessiné
compteur_2(i,im,param);
end;
3 : begin
3 : begin // tachro
// centre de l'aiguille et longueur
AigCX:=lim div 2;
AigCY:=round(200*redY);
rAig:=round(AigCX/1.07);
rAig:=round(AigCX/1.1);
// le compteur tachro est dessiné
compteur_tachro(i,im,param);
end;
@@ -512,6 +550,16 @@ begin
end;
end;
procedure init_compteurs;
var i : integer;
begin
for i:=1 to ntrains do
begin
init_compteur(i,CompteurT[i].gb);
end;
init_compteur(1,FormCompteur[1]);
end;
Procedure Init_compteur(i : integer;c : Tcomponent);
const ofs=30; // décalage entre la taille de l'image et de la fenetre
// compteurs fenetre principale
@@ -528,9 +576,15 @@ begin
if (i<1) or (hautComptC=0) then exit;
//Affiche('Init compteur de vitesse',clYellow);
typDest:=Trien;
if c is tform then typDest:=fen; // si le compteur est la fenetre unique
if c is tGroupBox then typDest:=gb; // si le compteur est le groupBox de la fenetre principale
if c is tImage then typDest:=im; // si le compteur est l'image de l'onglet config compteurs
if typDest=Trien then
begin
Affiche('Anomalie 48 i='+intToSTR(i),clred);
exit;
end;
if (typDest=fen) or (typDest=gb) then ComptLoc:=compteur;
if typDest=im then ComptLoc:=formconfig.ComboBoxCompt.ItemIndex+1;
@@ -547,15 +601,15 @@ begin
2 :
begin
mini:=-80; // le 0 est à mini degrés
maxi:=120; // le vmax est à max degrés
maxi:=120; // le vmax est à max degrés
vmax:=160; // vmax du compteur
l:=400;
h:=215;
end;
3 :
begin
mini:=-130; // le 0 est à mini degrés
maxi:=132; // le vmax est à max degrés
mini:=-130; // le 0 est à mini degrés
maxi:=132; // le vmax est à max degrés
vmax:=210; // vmax du compteur
l:=400;
h:=340;
@@ -595,11 +649,8 @@ begin
Affiche('non traité 6',clred);
end;
if typDest=fen then
begin
formCompteur[i].ImageCompteur.width:=Lim;
end;
if typDest=gb then
// --- traitement par type de compteur
if typDest=gb then // GroupBox de l'onglet compteurs de la page principale
begin
if l>h then
begin
@@ -622,25 +673,6 @@ begin
paramCompt.imgH:=him; //HautCompt-HautTb-ofsGBH-ofsGBB;
Img.picture.Bitmap.Width:=lim;
Img.picture.Bitmap.Height:=him; //HautCompt-HautTb-ofsGBH-ofsGBB;
end;
end;
if typDest=fen then
begin
Scompteur[i].paramcompt.redX:=Lim/l;
Scompteur[i].paramcompt.redY:=Him/h;
Scompteur[i].paramcompt.ImgL:=Lim;
Scompteur[i].paramcompt.ImgH:=Him;
case compteur of
1 : Scompteur[i].paramcompt.rav:=round(70*Scompteur[i].paramcompt.redx); // rayon de l'arc vert
2 : Scompteur[i].paramcompt.rav:=round(100*Scompteur[i].paramcompt.redx);
3 : Scompteur[i].paramcompt.rav:=round(115*Scompteur[i].paramcompt.redx);
end;
end;
if typDest=gb then
begin
with compteurT[i] do
begin
paramcompt.redX:=Lim/l;
paramcompt.redY:=Him/h;
paramcompt.ImgL:=Lim;
@@ -655,70 +687,8 @@ begin
1 : compteurT[i].paramcompt.rav:=round(70*compteurT[i].paramcompt.redx); // rayon de l'arc vert
2 : compteurT[i].paramcompt.rav:=round(100*compteurT[i].paramcompt.redx);
3 : compteurT[i].paramcompt.rav:=round(115*compteurT[i].paramcompt.redx);
end;
end;
if typDest=fen then
with formCompteur[i] do
begin
if VerrouilleCompteur then Left:=formprinc.Left+formprinc.Width-width;
// ajuster hauteur de la fenetre
Hfen:=him+trackBarC.height;
if affTrainCompteur then Hfen:=Hfen+ImageTrain.Height+45 else
Hfen:=Hfen+LabelTrain.Height+40;
height:=hfen;
Scompteur[i].paramcompt.ImgL:=Lim;
Scompteur[i].paramcompt.ImgH:=Him;
with ImageCompteur do
begin
Width:=Lim;
Height:=Him;
Picture.Bitmap.Width:=Lim;
Picture.Bitmap.Height:=Him;
end;
with trackbarC do
begin
top:=him+ImageCompteur.Top;
width:=lim-2;
Left:=0;
visible:=true;
end;
with labelTrain do
begin
top:=trackbarC.Top+TrackBarC.Height;
left:=0;
end;
with button0 do
begin
top:=ImageCompteur.height-button0.height;//trackbarC.Top+TrackBarC.Height;
left:=(lim div 2)-(width div 2);
end;
With ImageTprov do
begin
left:=0;
width:=lim-2;
end;
With ImageTrain do
begin
top:=trackbarC.Top+TrackBarC.Height;
left:=2;
visible:=affTrainCompteur;
end;
// imageC <-- FCBitMap (on écrit les vitesses) <- ImageCompteur (grande)
// créer un bitmap réduit qui sert de référence
Scompteur[i].FCBitMap.Free;
Scompteur[i].fcBitMap:=tbitmap.Create;
with Scompteur[i].FCBitMap do
begin
Width:=lim;
Height:=him;
end;
end;
if typDest=gb then
begin
compteurT[i].FCBitMap.Free;
compteurT[i].fcBitMap:=tbitmap.Create;
with compteurT[i].FCBitMap do
@@ -726,6 +696,87 @@ begin
Width:=lim;
Height:=him;
end;
dessin_fond_compteur(compteurT[i].paramcompt,i,compteurT[i].fcBitmap,compteur);
Aiguille_compteur(i,i,compteurT[i].gb);
end;
// fenetre compteur unique
if typDest=fen then
begin
formCompteur[i].ImageCompteur.width:=Lim;
Scompteur[i].paramcompt.redX:=Lim/l;
Scompteur[i].paramcompt.redY:=Him/h;
Scompteur[i].paramcompt.ImgL:=Lim;
Scompteur[i].paramcompt.ImgH:=Him;
case compteur of
1 : Scompteur[i].paramcompt.rav:=round(70*Scompteur[i].paramcompt.redx); // rayon de l'arc vert
2 : Scompteur[i].paramcompt.rav:=round(100*Scompteur[i].paramcompt.redx);
3 : Scompteur[i].paramcompt.rav:=round(115*Scompteur[i].paramcompt.redx);
end;
with formCompteur[i] do
begin
if VerrouilleCompteur then Left:=formprinc.Left+formprinc.Width-width;
// ajuster hauteur de la fenetre
Hfen:=him+trackBarC.height;
if affTrainCompteur then Hfen:=Hfen+ImageTrain.Height+45 else
Hfen:=Hfen+LabelTrain.Height+40;
height:=hfen;
Scompteur[i].paramcompt.ImgL:=Lim;
Scompteur[i].paramcompt.ImgH:=Him;
with ImageCompteur do
begin
Width:=Lim;
Height:=Him;
Picture.Bitmap.Width:=Lim;
Picture.Bitmap.Height:=Him;
end;
with trackbarC do
begin
top:=him+ImageCompteur.Top;
width:=lim-2;
Left:=0;
visible:=true;
end;
with labelTrain do
begin
top:=trackbarC.Top+TrackBarC.Height;
left:=0;
end;
with button0 do
begin
top:=ImageCompteur.height-button0.height;//trackbarC.Top+TrackBarC.Height;
left:=(lim div 2)-(width div 2);
end;
With ImageTprov do
begin
left:=0;
width:=lim-2;
end;
With ImageTrain do
begin
top:=trackbarC.Top+TrackBarC.Height;
left:=2;
visible:=affTrainCompteur;
end;
// imageC <-- FCBitMap (on écrit les vitesses) <- ImageCompteur (grande)
// créer un bitmap réduit qui sert de référence
Scompteur[i].FCBitMap.Free;
Scompteur[i].fcBitMap:=tbitmap.Create;
with Scompteur[i].FCBitMap do
begin
Width:=lim;
Height:=him;
end;
end;
dessin_fond_compteur(Scompteur[i].paramcompt,i,Scompteur[i].FcBitmap,compteur);
Aiguille_compteur(i,IdTrainClic,formCompteur[i]);
Affiche_train_compteur(i);
end;
// image onglet config compteur
@@ -761,24 +812,9 @@ begin
canv:=formconfig.ImageCtC.Canvas;// Picture.Bitmap.Canvas;
dessin_fond_compteur(paramcomptIm,1,FbmcompC,i);
Aiguille_compteur(1,1,formconfig.ImageCTC);
exit;
//Aiguille_compteur(1,1,formconfig.ImageCTC);
Aiguille_compteur(i,i,formconfig.ImageCTC);
end;
// dessine le fond du compteur dans le FcBitmap (non visible)
if typDest=fen then
begin
dessin_fond_compteur(Scompteur[i].paramcompt,i,Scompteur[i].FcBitmap,compteur);
Aiguille_compteur(i,IdTrainClic,formCompteur[i]);
Affiche_train_compteur(i);
end;
if typDest=gb then
begin
dessin_fond_compteur(compteurT[i].paramcompt,i,compteurT[i].fcBitmap,compteur);
Aiguille_compteur(i,i,compteurT[i].gb);
end;
if typDest=im then Aiguille_compteur(i,i,formconfig.ImageCTC);
end;
// repositionne le compteur principal
@@ -829,7 +865,7 @@ begin
Compteurdevitesse21.checked:=false;
Compteurtachro1.checked:=false;
compteur:=1;
init_compteur(1,formCOmpteur[1]);
init_compteurs;
affiche_train_compteur(1);
aiguille_compteur(1,idTrainClic,formCOmpteur[1]);
end;
@@ -840,7 +876,7 @@ begin
Compteurdevitesse21.checked:=true;
Compteurtachro1.checked:=false;
compteur:=2;
init_compteur(1,formcompteur[1]);
init_compteurs;
affiche_train_compteur(1);
aiguille_compteur(1,idTrainClic,formCompteur[1]);
end;
@@ -851,7 +887,7 @@ begin
Compteurdevitesse21.checked:=false;
Compteurtachro1.checked:=true;
compteur:=3;
init_compteur(1,formcompteur[1]);
init_compteurs;
affiche_train_compteur(1);
aiguille_compteur(1,idTrainClic,formCompteur[1]);
end;
@@ -896,14 +932,14 @@ var s : string;
begin
if clicTBtrain or clicTBGB then exit;
clicTBFen:=true;
//If affevt then
//Affiche('Changement TrackBarcc',clyellow);
tt:=sender as TTrackBar;
f:=tt.Parent as tform;
s:=f.caption; // nom du train=caption de la fenêtre
i:=index_train_nom(s);
vit:=TrackBarC.position;
//If affevt then Affiche('Changement TrackBarcc Vit='+intToSTR(vit),clyellow);
compteurT[i].tb.Position:=vit;
vitesse_loco(s,i,trains[i].adresse,vit,10,0);
clicTBFen:=false;
@@ -915,8 +951,22 @@ begin
end;
procedure TFormCompteur.Button0Click(Sender: TObject);
var i : integer;
tt : tbutton;
f : Tform;
s : string;
begin
clicTBFen:=true;
tt:=sender as TButton;
f:=tt.Parent as tform;
s:=f.caption; // nom du train=caption de la fenêtre
i:=index_train_nom(s);
trains[i].vitesseCons:=0;
compteurT[i].tb.Position:=0;
trackBarC.Position:=0;
//vitesse_loco(s,i,trains[i].adresse,0,10,0);
clicTBFen:=false;
end;
procedure TFormCompteur.Affichericonedutrain1Click(Sender: TObject);
@@ -925,6 +975,47 @@ begin
afficherIconeDuTrain1.Checked:=affTrainCompteur;
init_compteur(1,formcompteur[1]);
affiche_train_compteur(1);
end;
procedure TFormCompteur.Vitesseencrans1Click(Sender: TObject);
begin
Vitesseencrans1.Checked:=true;
Vitesserelle1.checked:=false;
VitCrans:=true;
end;
procedure TFormCompteur.Vitesserelle1Click(Sender: TObject);
begin
Vitesserelle1.Checked:=true;
Vitesseencrans1.Checked:=false;
VitCrans:=false;
end;
procedure TFormCompteur.PopupMenuCPopup(Sender: TObject);
var c : tcomponent;
f : tform;
s : string;
i : integer;
begin
c:=popupmenuC.PopupComponent; // trouver la form parente du popup
c:=c.GetParentComponent;
if c is tform then
begin
f:=c as tform;
s:=f.caption; // train
i:=index_train_nom(s);
if trains[i].CoeffV3=0 then
begin
Vitesseencrans1.enabled:=false;
Vitesserelle1.enabled:=false;
end
else
begin
Vitesseencrans1.enabled:=true;
Vitesserelle1.enabled:=true;
end;
end;
end;
end.
+276 -127
View File
@@ -1,6 +1,6 @@
object FormConfig: TFormConfig
Left = 240
Top = 128
Left = 242
Top = 193
Hint = 'Modifie la configuration selon les s'#233'lections choisies'
BorderStyle = bsDialog
Caption = 'Configuration g'#233'n'#233'rale'
@@ -670,7 +670,7 @@ object FormConfig: TFormConfig
Top = 8
Width = 633
Height = 505
ActivePage = TabSheetAutonome
ActivePage = TabSheetCDM
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -11
@@ -683,9 +683,9 @@ object FormConfig: TFormConfig
Caption = 'CDM Rail'
object Label36: TLabel
Left = 24
Top = 458
Width = 325
Height = 26
Top = 456
Width = 369
Height = 13
Caption =
'Param'#232'tres de connexion et d'#39#233'change avec CDM rail et param'#232'tres' +
' g'#233'n'#233'raux'
@@ -864,8 +864,8 @@ object FormConfig: TFormConfig
object GroupBox6: TGroupBox
Left = 312
Top = 0
Width = 297
Height = 121
Width = 305
Height = 113
Caption = 'Au d'#233'marrage de CDM Rail : interface'
TabOrder = 2
object RadioButtonSS: TRadioButton
@@ -877,15 +877,15 @@ object FormConfig: TFormConfig
TabOrder = 0
end
object RadioButtonXN: TRadioButton
Left = 8
Top = 32
Width = 225
Left = 176
Top = 16
Width = 137
Height = 17
Caption = 'XpressNet (lenz.roco)'
TabOrder = 1
end
object RadioButtonP50: TRadioButton
Left = 184
Left = 8
Top = 32
Width = 97
Height = 17
@@ -893,15 +893,15 @@ object FormConfig: TFormConfig
TabOrder = 2
end
object RadioButtonSP: TRadioButton
Left = 8
Top = 48
Left = 176
Top = 32
Width = 81
Height = 17
Caption = 'Sprog'
TabOrder = 3
end
object RadioButtonHSI: TRadioButton
Left = 184
Left = 8
Top = 48
Width = 113
Height = 17
@@ -909,36 +909,20 @@ object FormConfig: TFormConfig
TabOrder = 4
end
object RadioButtonECOS: TRadioButton
Left = 184
Left = 8
Top = 80
Width = 89
Height = 17
Caption = 'Ecos ESU'
TabOrder = 5
end
object RadioButtonRS: TRadioButton
Left = 184
Top = 64
Width = 73
Height = 17
Caption = 'RS2PC'
TabOrder = 6
end
object RadioButtonDCCpl: TRadioButton
Left = 184
Top = 16
Width = 73
Height = 17
Caption = 'DCC++'
TabOrder = 7
end
object RadioButtonDCCpp: TRadioButton
Left = 8
Top = 80
Left = 176
Top = 64
Width = 89
Height = 17
Caption = 'DCCpp'
TabOrder = 8
TabOrder = 6
end
object RadioButtonFIS88: TRadioButton
Left = 8
@@ -946,21 +930,21 @@ object FormConfig: TFormConfig
Width = 113
Height = 17
Caption = 'FIS88 (S88/S88N)'
TabOrder = 9
TabOrder = 7
end
object RadioButtonDccPlusPlus: TRadioButton
Left = 8
Top = 96
object RadioButtonDSI2: TRadioButton
Left = 176
Top = 48
Width = 105
Height = 17
Caption = 'DCC++'
TabOrder = 10
Caption = 'DSI2'
TabOrder = 8
end
end
object GroupBox7: TGroupBox
Left = 312
Top = 122
Width = 297
Width = 305
Height = 71
Caption = 'Au d'#233'marrage de CDM Rail : interface LENZ / XpressNet'
TabOrder = 3
@@ -1094,7 +1078,7 @@ object FormConfig: TFormConfig
object GroupBoxDivers: TGroupBox
Left = 312
Top = 200
Width = 297
Width = 305
Height = 137
Caption = 'Divers'
TabOrder = 5
@@ -1191,7 +1175,7 @@ object FormConfig: TFormConfig
object GroupBoxStyles: TGroupBox
Left = 312
Top = 344
Width = 297
Width = 305
Height = 113
Caption = 'Styles d'#39'affichage'
TabOrder = 6
@@ -1232,8 +1216,8 @@ object FormConfig: TFormConfig
object Label9: TLabel
Left = 16
Top = 456
Width = 249
Height = 26
Width = 294
Height = 13
Caption = 'Ces param'#232'tres sont utilis'#233's en fonctionnement sans CDM Rail'
WordWrap = True
end
@@ -1502,6 +1486,35 @@ object FormConfig: TFormConfig
TabOrder = 1
end
end
object GroupBox25: TGroupBox
Left = 312
Top = 336
Width = 297
Height = 105
Caption = 'Divers'
TabOrder = 8
object Label82: TLabel
Left = 16
Top = 32
Width = 35
Height = 13
Caption = 'Echelle'
end
object ComboBoxEchelle: TComboBox
Left = 120
Top = 24
Width = 145
Height = 21
Style = csDropDownList
ItemHeight = 13
TabOrder = 0
OnChange = ComboBoxEchelleChange
Items.Strings = (
'H0 1/87'
'N 1/160'
'Z 1/220')
end
end
end
object TabSheetAig: TTabSheet
Caption = 'Aiguillages'
@@ -2237,7 +2250,7 @@ object FormConfig: TFormConfig
object GroupBox12: TGroupBox
Left = 328
Top = 24
Width = 289
Width = 297
Height = 449
Caption = 'Description du signal'
TabOrder = 0
@@ -2412,7 +2425,7 @@ object FormConfig: TFormConfig
Width = 137
Height = 21
Style = csDropDownList
ItemHeight = 13
ItemHeight = 0
TabOrder = 1
OnChange = ComboBoxDecChange
end
@@ -2543,7 +2556,7 @@ object FormConfig: TFormConfig
Width = 137
Height = 21
Style = csDropDownList
ItemHeight = 13
ItemHeight = 0
TabOrder = 2
OnChange = ComboBoxAspChange
end
@@ -2571,7 +2584,7 @@ object FormConfig: TFormConfig
object CheckBoxFB: TCheckBox
Left = 136
Top = 264
Width = 145
Width = 153
Height = 17
Caption = 'Avec demande feu blanc'
TabOrder = 15
@@ -2851,7 +2864,7 @@ object FormConfig: TFormConfig
Top = 56
Width = 193
Height = 21
ItemHeight = 13
ItemHeight = 0
TabOrder = 0
OnChange = ComboBoxDecodeurPersoChange
end
@@ -2870,7 +2883,7 @@ object FormConfig: TFormConfig
Width = 145
Height = 21
Style = csDropDownList
ItemHeight = 13
ItemHeight = 0
TabOrder = 2
OnChange = ComboBoxNationChange
end
@@ -2916,7 +2929,7 @@ object FormConfig: TFormConfig
Width = 193
Height = 21
Style = csDropDownList
ItemHeight = 13
ItemHeight = 0
TabOrder = 6
OnChange = ComboBoxDecCdeChange
end
@@ -2996,20 +3009,6 @@ object FormConfig: TFormConfig
OnDrawItem = ListBoxOperationsDrawItem
OnMouseDown = ListBoxOperationsMouseDown
end
object ButtonModAction: TButton
Left = 344
Top = 272
Width = 75
Height = 25
Hint =
'Modifie l'#39'action : permet d'#39'attribuer un d'#233'clencheur et des op'#233'r' +
'ations'
Caption = 'Modifier'
ParentShowHint = False
ShowHint = True
TabOrder = 2
OnClick = ButtonModActionClick
end
object RichEditInfo: TRichEdit
Left = 16
Top = 240
@@ -3024,7 +3023,7 @@ object FormConfig: TFormConfig
ParentFont = False
ReadOnly = True
ScrollBars = ssVertical
TabOrder = 3
TabOrder = 2
end
object Button1: TButton
Left = 16
@@ -3032,29 +3031,41 @@ object FormConfig: TFormConfig
Width = 65
Height = 17
Caption = 'Nouveau'
TabOrder = 4
TabOrder = 3
OnClick = ButtonNouvAccClick
end
object Button3: TButton
Left = 192
Top = 16
Width = 65
Height = 17
Hint = 'Supprime l'#39'actionneur(s) s'#233'lectionn'#233'(s)'
Caption = 'Supprimer'
ParentShowHint = False
ShowHint = True
TabOrder = 4
OnClick = ButtonSupAccClick
end
object ButtonTestAction: TButton
Left = 504
Top = 368
Width = 83
Height = 25
Caption = 'Test action'
TabOrder = 5
OnClick = ButtonTestActionClick
end
object ButtonMod: TButton
Left = 104
Top = 16
Width = 65
Height = 17
Hint = 'Supprime l'#39'actionneur(s) s'#233'lectionn'#233'(s)'
Caption = 'Supprime'
Caption = 'Modifier'
ParentShowHint = False
ShowHint = True
TabOrder = 5
OnClick = ButtonSupAccClick
end
object ButtonTestAction: TButton
Left = 504
Top = 272
Width = 75
Height = 25
Caption = 'Test action'
TabOrder = 6
OnClick = ButtonTestActionClick
OnClick = ButtonModClick
end
end
end
@@ -3131,7 +3142,7 @@ object FormConfig: TFormConfig
Top = 96
Width = 137
Height = 21
ItemHeight = 13
ItemHeight = 0
TabOrder = 2
OnChange = ComboBoxOperateurChange
OnDrawItem = ComboBoxOperateurDrawItem
@@ -3151,7 +3162,7 @@ object FormConfig: TFormConfig
Top = 96
Width = 161
Height = 21
ItemHeight = 13
ItemHeight = 0
ParentShowHint = False
ShowHint = True
TabOrder = 4
@@ -3252,7 +3263,7 @@ object FormConfig: TFormConfig
Width = 145
Height = 21
Style = csDropDownList
ItemHeight = 13
ItemHeight = 0
TabOrder = 7
OnChange = ComboBoxFLChange
end
@@ -3802,7 +3813,7 @@ object FormConfig: TFormConfig
Height = 21
Hint = 'Nom de l'#39'accessoire 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 = 10
@@ -4149,7 +4160,7 @@ object FormConfig: TFormConfig
Top = 16
Width = 337
Height = 457
ActivePage = TtabSheetEt
ActivePage = TabSheetCourbes
TabOrder = 3
object TabSheetTrGen: TTabSheet
Caption = 'G'#233'n'#233'ral'
@@ -4247,7 +4258,6 @@ object FormConfig: TFormConfig
Top = 120
Width = 41
Height = 21
Hint = 'Vitesse maximale autoris'#233'e par le d'#233'codeur'
ParentShowHint = False
ShowHint = True
TabOrder = 2
@@ -4258,7 +4268,6 @@ object FormConfig: TFormConfig
Top = 72
Width = 41
Height = 21
Hint = 'Vitesse apr'#232's l'#39'avertissement'
ParentShowHint = False
ShowHint = True
TabOrder = 3
@@ -4269,7 +4278,6 @@ object FormConfig: TFormConfig
Top = 96
Width = 41
Height = 21
Hint = 'Vitesse si voie libre'
ParentShowHint = False
ShowHint = True
TabOrder = 4
@@ -4348,8 +4356,8 @@ object FormConfig: TFormConfig
object Label45: TLabel
Left = 50
Top = 40
Width = 160
Height = 39
Width = 192
Height = 26
Alignment = taCenter
Caption =
'Arr'#234't temporis'#233' du train sur routes sur d'#233'tecteurs : (mode auton' +
@@ -4384,13 +4392,14 @@ object FormConfig: TFormConfig
Caption = 'Param'#232'tres de l'#39#233'talonnage '
TabOrder = 0
object LabelEt: TLabel
Left = 16
Left = 8
Top = 24
Width = 201
Width = 294
Height = 39
Caption =
'Les 3 coefficients de vitesse sont issus de la proc'#233'dure d'#39#233'talo' +
'nnage de la mesure du train'
'nnage de la mesure du train (menu roulage / mesurer la vitesse d' +
'es trains)'
WordWrap = True
end
object LabelErreur: TLabel
@@ -4429,41 +4438,50 @@ object FormConfig: TFormConfig
Caption = 'crans'
end
object LabeledEditV1: TLabeledEdit
Left = 224
Top = 64
Width = 41
Left = 136
Top = 72
Width = 33
Height = 21
EditLabel.Width = 171
Hint = 'Coeff=Vitesse en crans / Vitesse r'#233'elle en cm/s'
EditLabel.Width = 102
EditLabel.Height = 13
EditLabel.Caption = 'Coefficient vitesse 1 - lente : 0 crans'
LabelPosition = lpLeft
LabelSpacing = 30
EditLabel.Caption = 'Coeff vitesse 1 - lente'
LabelPosition = lpRight
LabelSpacing = 10
ParentShowHint = False
ShowHint = True
TabOrder = 0
OnChange = LabeledEditV1Change
end
object LabeledEditV2: TLabeledEdit
Left = 224
Top = 88
Width = 41
Left = 136
Top = 96
Width = 33
Height = 21
EditLabel.Width = 147
Hint = 'Coeff=Vitesse en crans / Vitesse r'#233'elle en cm/s'
EditLabel.Width = 122
EditLabel.Height = 13
EditLabel.Caption = 'Coefficient vitesse 2 - moyenne'
LabelPosition = lpLeft
LabelSpacing = 30
EditLabel.Caption = 'Coeff vitesse 2 - moyenne'
LabelPosition = lpRight
LabelSpacing = 10
ParentShowHint = False
ShowHint = True
TabOrder = 1
OnChange = LabeledEditV2Change
end
object LabeledEditV3: TLabeledEdit
Left = 224
Top = 112
Width = 41
Left = 136
Top = 120
Width = 33
Height = 21
EditLabel.Width = 133
Hint = 'Coeff=Vitesse en crans / Vitesse r'#233'elle en cm/s'
EditLabel.Width = 108
EditLabel.Height = 13
EditLabel.Caption = 'Coefficient vitesse 3 - rapide'
LabelPosition = lpLeft
LabelSpacing = 30
EditLabel.Caption = 'Coeff vitesse 3 - rapide'
LabelPosition = lpRight
LabelSpacing = 10
ParentShowHint = False
ShowHint = True
TabOrder = 2
OnChange = LabeledEditV3Change
end
@@ -4487,7 +4505,7 @@ object FormConfig: TFormConfig
end
object LabeledEditCV3: TLabeledEdit
Left = 224
Top = 136
Top = 144
Width = 33
Height = 21
EditLabel.Width = 135
@@ -4500,7 +4518,7 @@ object FormConfig: TFormConfig
end
object LabeledEditCV4: TLabeledEdit
Left = 224
Top = 160
Top = 168
Width = 33
Height = 21
EditLabel.Width = 135
@@ -4513,7 +4531,7 @@ object FormConfig: TFormConfig
end
object LabeledEditCrans: TLabeledEdit
Left = 224
Top = 184
Top = 192
Width = 41
Height = 21
EditLabel.Width = 144
@@ -4540,7 +4558,7 @@ object FormConfig: TFormConfig
end
object ButtonlCV3: TButton
Left = 264
Top = 136
Top = 144
Width = 20
Height = 25
Hint = 'Lire le CV3 de la locomotive plac'#233'e sur la voie de programmation'
@@ -4552,7 +4570,7 @@ object FormConfig: TFormConfig
end
object ButtonlCV4: TButton
Left = 264
Top = 160
Top = 168
Width = 20
Height = 25
Hint = 'Lire le CV4 de la locomotive plac'#233'e sur la voie de programmation'
@@ -4564,7 +4582,7 @@ object FormConfig: TFormConfig
end
object ButtonRepriseDCC: TButton
Left = 288
Top = 144
Top = 152
Width = 25
Height = 25
Hint = 'Repasse la centrale en mode DCC'
@@ -4574,6 +4592,136 @@ object FormConfig: TFormConfig
TabOrder = 10
OnClick = ButtonRepriseDCCClick
end
object LabeledEditVit1: TLabeledEdit
Left = 96
Top = 72
Width = 33
Height = 21
Hint = 'Vitesse en crans du coefficient V1'
EditLabel.Width = 57
EditLabel.Height = 13
EditLabel.Caption = 'Vit 1 (Crans)'
LabelPosition = lpLeft
LabelSpacing = 10
ParentShowHint = False
ShowHint = True
TabOrder = 11
OnChange = LabeledEditVit1Change
end
object LabeledEditVit2: TLabeledEdit
Left = 96
Top = 96
Width = 33
Height = 21
Hint = 'Vitesse en crans du coefficient V2'
EditLabel.Width = 57
EditLabel.Height = 13
EditLabel.Caption = 'Vit 2 (Crans)'
LabelPosition = lpLeft
LabelSpacing = 10
ParentShowHint = False
ShowHint = True
TabOrder = 12
OnChange = LabeledEditVit2Change
end
object LabeledEditVit3: TLabeledEdit
Left = 96
Top = 120
Width = 33
Height = 21
Hint = 'Vitesse en crans du coefficient V3'
EditLabel.Width = 57
EditLabel.Height = 13
EditLabel.Caption = 'Vit 3 (Crans)'
LabelPosition = lpLeft
LabelSpacing = 10
ParentShowHint = False
ShowHint = True
TabOrder = 13
OnChange = LabeledEditVit3Change
end
end
end
object TabSheetCourbes: TTabSheet
Caption = 'Courbe vitesse'
ImageIndex = 3
object GroupBoxCVit: TGroupBox
Left = 0
Top = 8
Width = 321
Height = 409
Caption = 'Courbe de vitesse'
TabOrder = 0
object ImageCourbes: TImage
Left = 48
Top = 32
Width = 257
Height = 281
OnMouseMove = ImageCourbesMouseMove
end
object LabelValeur: TLabel
Left = 48
Top = 364
Width = 4
Height = 13
Caption = #39#39
end
object LabelCran: TLabel
Left = 48
Top = 340
Width = 4
Height = 13
Caption = #39#39
end
object LabelVcms: TLabel
Left = 16
Top = 304
Width = 4
Height = 13
Caption = #39#39
end
object LabelEchelle: TLabel
Left = 48
Top = 384
Width = 216
Height = 13
Caption = 'La vitesse en km/h est calcul'#233'e pour l'#39#233'chelle'
end
object LabelV1Cons: TLabel
Left = 72
Top = 326
Width = 13
Height = 13
Caption = 'V1'
end
object LabelV2Cons: TLabel
Left = 144
Top = 326
Width = 13
Height = 13
Caption = 'V2'
end
object LabelV3Cons: TLabel
Left = 224
Top = 326
Width = 13
Height = 13
Caption = 'V3'
end
object Label83: TLabel
Left = 284
Top = 314
Width = 27
Height = 13
Caption = 'Crans'
end
object Label84: TLabel
Left = 22
Top = 32
Width = 24
Height = 13
Caption = 'cm/s'
end
end
end
end
@@ -4806,9 +4954,9 @@ object FormConfig: TFormConfig
object LabelRC: TLabel
Left = 288
Top = 312
Width = 250
Width = 248
Height = 13
Caption = 'R'#233'f'#233'rences crois'#233'es de l'#39#39'utilisation des p'#233'riph'#233'riques'
Caption = 'R'#233'f'#233'rences crois'#233'es de l'#39'utilisation des p'#233'riph'#233'riques'
end
object LabelNumeroP: TLabel
Left = 8
@@ -5299,7 +5447,7 @@ object FormConfig: TFormConfig
end
object GroupBoxBt: TGroupBox
Left = 312
Top = 200
Top = 192
Width = 260
Height = 121
Caption = 'Bouton'
@@ -5365,24 +5513,24 @@ object FormConfig: TFormConfig
TabOrder = 3
object Label74: TLabel
Left = 8
Top = 32
Top = 64
Width = 81
Height = 13
Caption = 'Affecter au train :'
end
object ComboBoxUSBTr: TComboBox
Left = 96
Top = 28
Top = 60
Width = 153
Height = 21
Style = csDropDownList
ItemHeight = 13
ItemHeight = 0
TabOrder = 0
OnChange = ComboBoxUSBTrChange
end
object LabeledEditNUM: TLabeledEdit
Left = 208
Top = 72
Top = 24
Width = 25
Height = 21
Hint = 'Num'#233'ro de contr'#244'leur clavier USB (1 '#224' 10)'
@@ -5427,6 +5575,7 @@ object FormConfig: TFormConfig
TabOrder = 0
OnDrawCell = ValueListEditorDrawCell
OnMouseMove = ValueListEditorMouseMove
OnSelectCell = ValueListEditorSelectCell
OnSetEditText = ValueListEditorSetEditText
ColWidths = (
150
+385 -112
View File
@@ -38,8 +38,6 @@ type
RadioButtonSP: TRadioButton;
RadioButtonHSI: TRadioButton;
RadioButtonECOS: TRadioButton;
RadioButtonRS: TRadioButton;
RadioButtonDCCpl: TRadioButton;
GroupBox7: TGroupBox;
RadioButton13: TRadioButton;
RadioButton14: TRadioButton;
@@ -303,7 +301,6 @@ type
GroupBox15: TGroupBox;
ListBoxActions: TListBox;
ListBoxOperations: TListBox;
ButtonModAction: TButton;
Label44: TLabel;
Label48: TLabel;
RichEditInfo: TRichEdit;
@@ -435,7 +432,7 @@ type
ComboStyle: TComboBox;
RadioGroupCl: TRadioGroup;
RadioButtonFIS88: TRadioButton;
RadioButtonDccPlusPlus: TRadioButton;
RadioButtonDSI2: TRadioButton;
Memo4: TMemo;
ButtonlCV3: TButton;
ButtonlCV4: TButton;
@@ -493,6 +490,25 @@ type
Label81: TLabel;
Panel2: TPanel;
ImageCtC: TImage;
ButtonMod: TButton;
GroupBox25: TGroupBox;
ComboBoxEchelle: TComboBox;
Label82: TLabel;
TabSheetCourbes: TTabSheet;
GroupBoxCVit: TGroupBox;
ImageCourbes: TImage;
LabelValeur: TLabel;
LabelCran: TLabel;
LabelVcms: TLabel;
LabeledEditVit1: TLabeledEdit;
LabeledEditVit2: TLabeledEdit;
LabeledEditVit3: TLabeledEdit;
LabelEchelle: TLabel;
LabelV1Cons: TLabel;
LabelV2Cons: TLabel;
LabelV3Cons: TLabel;
Label83: TLabel;
Label84: TLabel;
procedure ButtonAppliquerEtFermerClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ListBoxAigMouseDown(Sender: TObject; Button: TMouseButton;
@@ -647,7 +663,6 @@ type
procedure EditAdrAigExit(Sender: TObject);
procedure EditAdrAigChange(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure ButtonModActionClick(Sender: TObject);
procedure ListBoxActionsMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ListBoxOperationsDrawItem(Control: TWinControl;
@@ -783,6 +798,15 @@ type
procedure ButtonCoulNumClick(Sender: TObject);
procedure ButtonCoulFondClick(Sender: TObject);
procedure ButtonCoulArcClick(Sender: TObject);
procedure ButtonModClick(Sender: TObject);
procedure ValueListEditorSelectCell(Sender: TObject; ACol,
ARow: Integer; var CanSelect: Boolean);
procedure ComboBoxEchelleChange(Sender: TObject);
procedure ImageCourbesMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure LabeledEditVit1Change(Sender: TObject);
procedure LabeledEditVit2Change(Sender: TObject);
procedure LabeledEditVit3Change(Sender: TObject);
private
{ Déclarations privées }
@@ -899,6 +923,7 @@ LargCompteur_ch='LargCompteur';
LargComptC_ch='LargCompteurC';
HautComptC_ch='HautCompteurC';
VerrouCompteur_ch='VerrouCompteur';
Echelle_ch='Echelle';
AffIconeTrCompteur_ch='AffIconeTrCompteur';
Onglet_ch='Onglet';
@@ -963,11 +988,11 @@ var
ligneDCC,decCourant,AffMemoFenetre,ligneClicAccPeriph,AncligneClicAccPeriph,ligneCherche,
compt_Ligne,Ecran_SC,Max_Signal_Sens,nCantonsRes,ligneClicActionneur,BoutonBloc,
TempoTC,Nbuttoirs,AncLigneClicActionneur,AncligneclicDet,ligneclicDet,foncCourante,
NbreFL,IdOperateur,NbreBlocsUSB,Onglet : integer;
NbreFL,IdOperateur,NbreBlocsUSB,Onglet,Echelle,ax : integer;
ack_cdm,clicliste,config_modifie,clicproprietesSig,clicproprietesTrains,confasauver,trouve_MaxPort,
modif_branches,ConfigPrete,trouve_section_dccpp,trouve_section_trains,trouve_section_acccomusb,
trouveAvecVerifIconesTCO,Affiche_avert,activ,trouve_section_dec_pers,Z21,AffAigND,
trouveAvecVerifIconesTCO,Affiche_avert,activ,trouve_section_dec_pers,Z21,AffAigND,prem,
PilotageTrainsCDMNom,LanceHorl,AffSig,AffRes,avecAck,affLoc,changeCom,tsbouton,VisuIntercepte,
clicTree : boolean;
@@ -978,6 +1003,8 @@ var
Liste : array[1..22] of Tliste;
ValVitTrain : array[0..127] of integer;
// composants dynamiques voies PN
EditV1F,EditV1O,EditV2F,EditV2O,EditV3F,EditV3O,EditV4F,EditV4O,EditV5F,EditV5O,
EditZdet1V1F,EditZdet2V1F,EditZdet1V1O,EditZdet2V1O,
@@ -1032,6 +1059,8 @@ procedure genere_informations_BD;
function trouve_index_style : integer;
procedure ComboBoxFL_mizajour;
procedure clic_BRM;
function crans_to_Vrcms(v,idTrain : integer) : single;
procedure courbe_train(indexTrain : integer);
implementation
@@ -2267,6 +2296,8 @@ begin
if VerrouilleCompteur then s:='1' else s:='0';
writeln(fichierN,VerrouCompteur_ch+'=',s);
writeln(fichierN,Echelle_ch+'='+intToSTR(Echelle));
if affTrainCompteur then s:='1' else s:='0';
writeln(fichierN,AffIconeTrCompteur_ch+'=',s);
@@ -4700,14 +4731,7 @@ const LessThanValue=-1;
end;
until (sOrigine='0') or (ntrains>=Max_Trains);
for i:=1 to ntrains do
begin
trains[i].canton:=0;
trains[i].x:=-999999;
trains[i].y:=-999999;
trains[i].BlocUSB:=0;
calcul_equations_coeff(i);
end;
if ntrains>1 then
with Formprinc do
begin
@@ -5044,8 +5068,7 @@ const LessThanValue=-1;
end;
procedure compile_compteurs;
var n,id,i : integer;
ss : string;
var n,i : integer;
begin
n:=1;
repeat
@@ -5744,6 +5767,16 @@ const LessThanValue=-1;
VerrouilleCompteur:=i=1;
end;
sa:=uppercase(Echelle_ch)+'=';
i:=pos(sa,s);
if i=1 then
begin
inc(nv);
delete(s,i,length(sa));
val(s,i,erreur);
Echelle:=i;
end;
sa:=uppercase(AffIconeTrCompteur_ch)+'=';
i:=pos(sa,s);
if i=1 then
@@ -6478,11 +6511,10 @@ begin
if RadioButtonp50.Checked then ServeurInterfaceCDM:=2;
if RadioButtonSP.Checked then ServeurInterfaceCDM:=3;
if RadioButtonHSI.Checked then ServeurInterfaceCDM:=4;
if RadioButtonFIS88.Checked then ServeurInterfaceCDM:=5;
if RadioButtonRs.Checked then ServeurInterfaceCDM:=6;
if RadioButtonDccpp.Checked then ServeurInterfaceCDM:=7;
if RadioButtonDSI2.Checked then ServeurInterfaceCDM:=5;
if RadioButtonFIS88.Checked then ServeurInterfaceCDM:=6;
if RadioButtonDCCpp.Checked then ServeurInterfaceCDM:=7;
if RadioButtonEcos.Checked then ServeurInterfaceCDM:=8;
if RadioButtonDccPlusPlus.Checked then ServeurInterfaceCDM:=7;
if RadioButton13.Checked then ServeurRetroCDM:=1;
if RadioButton14.Checked then ServeurRetroCDM:=2;
if RadioButton15.Checked then ServeurRetroCDM:=3;
@@ -7086,7 +7118,7 @@ begin
end;
end;
// déploye tout le treeview courant
// déploye tout le treeview de la fonction courante
Procedure tout_deployer;
var i : integer;
begin
@@ -7179,6 +7211,79 @@ begin
if trouve then result:=i-1 else result:=-1;
end;
// dessine la courbe de vitesse du train
procedure courbe_train(indexTrain : integer);
procedure cord(var x,y : integer);
begin
x:=2*x;
y:=(formConfig.ImageCourbes.Height-y*2);
end;
var x,y,c,vcms : integer ;
begin
prem:=true;
with formConfig.ImageCourbes.Canvas do
begin
Pen.Color := clWhite;
Brush.Color := clWhite;
pen.Mode:=pmCopy;
Rectangle(0,0,formConfig.ImageCourbes.width,formConfig.ImageCourbes.Height);
pen.width:=1;
// dessine les axes en noir
pen.Color:=clblack;
moveTo(0,FormConfig.ImageCourbes.Height); LineTo(0,0);
moveTo(0,FormConfig.ImageCourbes.Height-1); LineTo(formConfig.ImageCourbes.Width,FormConfig.ImageCourbes.Height-1);
// dessine la 1ere vitesse de mesure
pen.color:=clGreen;
x:=trains[indexTrain].ConsV1; y:=0;
cord(x,y); moveTo(x,y);
formConfig.LabelV1Cons.left:=x+formConfig.ImageCourbes.Left-5;
x:=trains[indexTrain].ConsV1; y:=round(crans_to_Vrcms(x,indexTrain));
cord(x,y); LineTo(x,y);
x:=0; y:=round(crans_to_Vrcms(trains[indexTrain].ConsV1,indexTrain));
cord(x,y); LineTo(x,y);
// dessine la 2eme vitesse de mesure
x:=trains[indexTrain].ConsV2; y:=0;
cord(x,y); moveTo(x,y);
formConfig.LabelV2Cons.left:=x+formConfig.ImageCourbes.Left-5;
x:=trains[indexTrain].ConsV2; y:=round(crans_to_Vrcms(x,indexTrain));
cord(x,y); LineTo(x,y);
x:=0; y:=round(crans_to_Vrcms(trains[indexTrain].ConsV2,indexTrain));
cord(x,y); LineTo(x,y);
// dessine la 3eme vitesse de mesure
x:=trains[indexTrain].ConsV3; y:=0;
cord(x,y); moveTo(x,y);
formConfig.LabelV3Cons.left:=x+formConfig.ImageCourbes.Left-5;
x:=trains[indexTrain].ConsV3; y:=round(crans_to_Vrcms(x,indexTrain));
cord(x,y); LineTo(x,y);
x:=0; y:=round(crans_to_Vrcms(trains[indexTrain].ConsV3,indexTrain));
cord(x,y); LineTo(x,y);
moveTo(0,FormConfig.ImageCourbes.Height);
pen.Width:=2;
pen.color:=clred;
for x:=1 to 127 do
begin
vcms:=round(crans_to_Vrcms(x,indexTrain));
c:=x;
ValVitTrain[x]:=vcms;
cord(c,vcms);
lineTo(c,vcms);
end;
end;
with formconfig do
begin
LabelCran.caption:='';
LabelValeur.caption:='';
LabelVcms.Caption:='';
end;
end;
procedure clicListeTrains(index : integer);
var s : string;
i,t : integer;
@@ -7239,24 +7344,14 @@ begin
end;
end;
With LabeledEditV1 do
begin
EditLabel.Caption:='Coefficient vitesse 1 - Lente '+intToSTR(Trains[index].ConsV1)+' crans :';
LabelSpacing:=20;
Text:=FloatToSTRF(Trains[index].coeffV1,ffFixed,5,2,FormatSettings);
end;
With LabeledEditV2 do
begin
EditLabel.Caption:='Coefficient vitesse 2 - Moyenne '+intToSTR(Trains[index].ConsV2)+' crans :';
LabelSpacing:=20;
Text:=FloatToSTRF(Trains[index].coeffV2,ffFixed,5,2,FormatSettings);
end;
With LabeledEditV3 do
begin
EditLabel.Caption:='Coefficient vitesse 3 - Rapide '+intToSTR(Trains[index].ConsV3)+' crans :';
LabelSpacing:=20;
Text:=FloatToSTRF(Trains[index].coeffV3,ffFixed,5,2,FormatSettings);
end;
LabeledEditVit1.text:=intToSTR(Trains[index].ConsV1);
LabeledEditV1.Text:=FloatToSTRF(Trains[index].coeffV1,ffFixed,5,2,FormatSettings);
LabeledEditVit2.text:=intToSTR(Trains[index].ConsV2);
LabeledEditV2.Text:=FloatToSTRF(Trains[index].coeffV2,ffFixed,5,2,FormatSettings);
LabeledEditVit3.text:=intToSTR(Trains[index].ConsV3);
LabeledEditV3.Text:=FloatToSTRF(Trains[index].coeffV3,ffFixed,5,2,FormatSettings);
if Trains[index].coeffV1<>0 then
begin
@@ -7285,6 +7380,9 @@ begin
LabeledEditCV3.Text:=intToSTR(Trains[index].CV3);
LabeledEditCV4.Text:=intToSTR(Trains[index].CV4);
LabeledEditCrans.Text:=intToSTR(Trains[index].crans);
courbe_train(index);
end;
clicListe:=false;
end;
@@ -7312,8 +7410,8 @@ begin
begin
Nom:='1. Seuil du nombre de détecteurs trop distants' ;
aide:='Nombre de détecteurs considérés comme trop distants'+#13+
'Cette valeur dépend de la taille du réseau:'+#13+
'3 pour les petits réseaux jusque 5 ou 6 pour les grands' ;
'Cette valeur dépend de la taille du réseau:'+#13+
'3 pour les petits réseaux jusque 5 ou 6 pour les grands' ;
typ:= Simple ;
masque:= '0'; // 1 chiffre
@@ -7325,8 +7423,8 @@ begin
begin
nom:='2. Nombre de cantons présence train avant signal' ;
aide:='Nombre de cantons à réserver (1 à 5) en avant du train.'+#13+
'Utilisé en mode roulage.'+#13+
'Cette valeur dépend de la taille du réseau.';
'Utilisé en mode roulage.'+#13+
'Cette valeur dépend de la taille du réseau.';
typ:= Simple ;
masque:= '0';
variable:=@Nb_cantons_Sig;
@@ -7357,7 +7455,7 @@ begin
begin
nom:='5. Utilisation de l''anti timeout Ethernet';
aide:='Si 1, envoie un caractère chaque minute à la centrale '+#13+
'pour éviter sa déconnexion (uniquement en Ethernet)';
'pour éviter sa déconnexion (uniquement en Ethernet)';
typ:= PickList;
variable:=@AntiTimeoutEthLenz;
typeVar:=Bool;
@@ -7369,7 +7467,7 @@ begin
begin
nom:='6. Facteur de Temporisation de télécommande CDM';
aide:='Facteur multiplicateur de 1 à 10 pour la temporisation'+#13+
'de la télécommande du démarrage de CDM';
'de la télécommande du démarrage de CDM';
typ:=Simple ;
masque:= '0';
variable:=@TempoTc;
@@ -8450,6 +8548,11 @@ begin
if clicproprietesTrains then clicListeTrains(ligneclicTrain+1);
clicproprietesTrains:=false;
// trains
EditVitRalenti.Hint:='Vitesse après l''avertissement'+#13+'en crans';
EditVitNom.Hint:='Vitesse si voie libre'+#13+'en crans';
EditVitesseMaxi.Hint:='Vitesse maximale autorisée par le décodeur'+#13+'en crans';
i:=1;
RichCdeDCCpp.clear;
repeat
@@ -8595,7 +8698,6 @@ begin
label72.caption:='La rotation de bouton changera la vitesse du train. L''appui sur le bouton stoppe le train.'+#13+
'Les évènements clavier sont interceptés par signaux complexes ce qui ne nécessite pas d''activer la fenêtre';
with GroupBoxBr do
begin
Left:=312;
@@ -8609,7 +8711,7 @@ begin
Left:=312;
top:=170;
Width:=260;
Height:=120;
Height:=140;
Visible:=false;
end;
@@ -8890,10 +8992,7 @@ begin
else
if vitesse=60 then begin RadioButtonSans.checked:=false;RadioButton30kmh.checked:=false;RadioButtonSpecifique.checked:=false;RadioButton60kmh.checked:=true;end
else
begin RadioButtonSans.checked:=false;RadioButton30kmh.checked:=false;RadioButtonSpecifique.checked:=true ;RadioButton60kmh.checked:=false;
end;
begin RadioButtonSans.checked:=false;RadioButton30kmh.checked:=false;RadioButtonSpecifique.checked:=true ;RadioButton60kmh.checked:=false;end;
end;
if croi then
@@ -10771,7 +10870,7 @@ begin
tablo_PN[NbrePN].Pulse:=0;
tablo_PN[NbrePN].actionneur:=true;
for j:=1 to 4 do
for j:=1 to 5 do
begin
tablo_PN[NbrePN].Voie[j].ActFerme:=0;
tablo_PN[NbrePN].Voie[j].ActOuvre:=0;
@@ -13731,11 +13830,7 @@ begin
if not(ok) then action:=tCloseAction(caNone); // si la config est nok, on ferme pas la fenetre
for index:=1 to ntrains do
begin
init_compteur(index,CompteurT[index].gb);
end;
init_compteur(1,FormCompteur[1]);
init_compteurs;
end;
procedure TFormConfig.ButtonConfigSRClick(Sender: TObject);
@@ -14354,8 +14449,7 @@ begin
compteurt[j].lbl.Free;
compteurt[j].bouton.Free;
compteurT[j].gb.free;
compteurt[j].FcBitmap.Free;
compteurT[j].FcBitmap.Free;
end;
if j<ntrains then
begin
@@ -16214,6 +16308,19 @@ begin
change_adr_aig;
end;
procedure affiche_echelle;
var s : string;
begin
s:='La vitesse en km/h est calculée pour l''échelle ';
case echelle of
0 : s:=s+'H0';
1 : s:=s+'N';
2 : s:=s+'Z';
end;
formConfig.LabelEchelle.caption:=s;
end;
procedure TFormConfig.FormActivate(Sender: TObject);
var i : integer;
s : string;
@@ -16246,6 +16353,9 @@ begin
CheckBoxAffMemo.Checked:=AffMemoFenetre=1;
//EditNbCantons.text:=intToSTR(Nb_cantons_Sig);
EditTempoSignal.Text:=IntToSTR(Tempo_Signal);
ComboBoxEchelle.ItemIndex:=echelle;
Affiche_echelle;
//EditNbDetDist.text:=IntToSTR(Nb_Det_dist);
EditAdrIPCDM.text:=adresseIPCDM;
EditPortCDM.Text:=IntToSTR(portCDM);
@@ -16279,11 +16389,11 @@ begin
RadioButtonP50.Checked:=ServeurInterfaceCDM=2; // P50x
RadioButtonSP.Checked:=ServeurInterfaceCDM=3; // Sprog
RadioButtonHSI.Checked:=ServeurInterfaceCDM=4; // hsi88
RadioButtonFIS88.Checked:=ServeurInterfaceCDM=5; // fis88
RadioButtonRS.Checked:=ServeurInterfaceCDM=6; // rs2pc
RadioButtonDccpp.Checked:=ServeurInterfaceCDM=7; // dccpp
RadioButtonEcos.Checked:=ServeurInterfaceCDM=8; // ecos esu
RadioButtonDccplusplus.Checked:=ServeurInterfaceCDM=9; // dcc++
RadioButtonDSI2.Checked:=ServeurInterfaceCDM=5; // Dsi2
RadioButtonFis88.Checked:=ServeurInterfaceCDM=6; // FIS88
RadioButtonDccpp.Checked:=ServeurInterfaceCDM=7; // Dccpp
RadioButtonEcos.Checked:=ServeurInterfaceCDM=8; // Dccpp
RadioButton13.Checked:=ServeurRetroCDM=1; // automatique
RadioButton14.Checked:=ServeurRetroCDM=2; // LI USB
@@ -16375,12 +16485,6 @@ begin
end;
end;
procedure TFormConfig.ButtonModActionClick(Sender: TObject);
begin DeclencheurAffiche:=0; // pas de demande d'affichage onglet/opération
OperationAffiche:=0;
clicaction:=0;
formModifAction.showModal;
end;
procedure Affiche_action;
var i,io,j,decl :integer;
@@ -16511,7 +16615,7 @@ begin
end;
end;
if (Shift = [ssCtrl]) and (key = ord('A')) then
if (Shift=[ssCtrl]) and (key = ord('A')) then
begin
ListBoxActions.SelectAll;
end;
@@ -16993,12 +17097,12 @@ begin
Signaux[ligneClicSig+1].BinLin:=radioGroupLEB.ItemIndex;
end;
procedure TFormConfig.ListBoxActionsDblClick(Sender: TObject);
procedure modif_action;
begin
if maxTablo_act<1 then exit;
clicliste:=true;
ligneclicAct:=listBoxActions.ItemIndex;
ligneclicAct:=formconfig.listBoxActions.ItemIndex;
if ligneclicAct<0 then
begin
clicliste:=false;
@@ -17013,7 +17117,11 @@ begin
OperationAffiche:=0;
clicaction:=0;
formModifAction.showModal;
end;
procedure TFormConfig.ListBoxActionsDblClick(Sender: TObject);
begin
modif_action;
end;
procedure TFormConfig.StringGridArrSelectCell(Sender: TObject; ACol,
@@ -17189,6 +17297,7 @@ begin
ListBoxTrains.items[ligneclicTrain]:=encode_train(ligneclicTrain+1);
ListBoxTrains.selected[ligneclicTrain]:=true;
calcul_equations_coeff(ligneclicTrain+1);
end;
procedure TFormConfig.LabeledEditV2Change(Sender: TObject);
@@ -17216,6 +17325,7 @@ begin
end;
ListBoxTrains.items[ligneclicTrain]:=encode_train(ligneclicTrain+1);
ListBoxTrains.selected[ligneclicTrain]:=true;
calcul_equations_coeff(ligneclicTrain+1);
end;
procedure TFormConfig.LabeledEditV3Change(Sender: TObject);
@@ -17243,10 +17353,10 @@ begin
end;
ListBoxTrains.items[ligneclicTrain]:=encode_train(ligneclicTrain+1);
ListBoxTrains.selected[ligneclicTrain]:=true;
calcul_equations_coeff(ligneclicTrain+1);
end;
procedure TFormConfig.EditDecalChange(Sender: TObject);
var l,r,i,erreur : integer;
begin
@@ -17301,6 +17411,19 @@ begin
ListBoxDet.selected[ligneclicDet]:=true;
end;
// calcul vitesse réelle en cm/s du train IdTrain, de vitesse en crans
function crans_to_Vrcms(v,idTrain : integer) : single;
var coeff : single;
begin
result:=0;
with trains[idTrain] do
begin
if v<consV2 then coeff:=pente1*v+b1
else coeff:=pente2*v+b2;
if coeff<>0 then result:=v/coeff;
end;
end;
procedure calculs;
var vitesse,erreur,distArret : integer;
coeff,vitR,TempsArret : single;
@@ -17309,22 +17432,17 @@ begin
vitesse:=abs(vitesse);
if vitesse>127 then exit;
with trains[ligneclicTrain+1] do
vitR:=crans_to_Vrcms(vitesse,ligneClicTrain+1);
with formconfig.MemoCalc do
begin
if vitesse<consV2 then coeff:=pente1*vitesse+b1
else coeff:=pente2*vitesse+b2;
if coeff<>0 then vitR:=vitesse/coeff;
with formconfig.MemoCalc do
begin
Lines.Clear;
lines.add('Vitesse='+FloatToSTRF(vitR,ffFixed,5,2)+' cm/s');
Lines.Clear;
lines.add('Vitesse='+FloatToSTRF(vitR,ffFixed,5,2)+' cm/s');
TempsArret:=0.896*cv4*Vitesse/128;
Lines.Add('Temps d''arrêt='+FloatToSTRF(TempsArret,ffFixed,5,2)+' s');
TempsArret:=0.896*Trains[ligneClicTrain+1].cv4*Vitesse/128;
Lines.Add('Temps d''arrêt='+FloatToSTRF(TempsArret,ffFixed,5,2)+' s');
distArret:=round(TempsArret*vitR/2.2); // en cm
Lines.Add('Distance approx d''arrêt='+IntToSTR(distArret)+' cm');
end;
distArret:=round(TempsArret*vitR/2.2); // en cm
Lines.Add('Distance approx d''arrêt='+IntToSTR(distArret)+' cm');
end;
end;
@@ -17761,6 +17879,7 @@ begin
LabeledEditDcc.EditLabel.Caption:='Adresse accessoire';
LabeledEditDCC.Text:=intToSTR(fonction[foncCourante,iNode].adresse);
SpinEditEtat.Value:=fonction[foncCourante,iNode].etat;
LabeledEditDCC.text:=intToSTR(fonction[foncCourante,iNode].adresse);
end;
if i=EtatDet then
@@ -17773,6 +17892,7 @@ begin
LabeledEditDcc.EditLabel.Caption:='Adresse';
LabeledEditTrain.Text:=fonction[foncCourante,iNode].train;
LabeledEditEtatAcc.Text:=intToSTR(fonction[foncCourante,iNode].etat);
LabeledEditDCC.text:=intToSTR(fonction[foncCourante,iNode].adresse);
end;
if i=EtatBoutonTCO then
@@ -17870,13 +17990,15 @@ end;
procedure TFormConfig.TreeViewLChange(Sender: TObject; Node: TTreeNode);
// cliqué ou sélectionné un node
var i,inode,typ : integer;
var i,inode,typ,TypAdjAv,TypAdjAp,n : integer;
begin
if Assigned(Node) then
begin
clicTree:=true;
i:=node.ImageIndex;
inode:=node.AbsoluteIndex;
n:=fonction[foncCourante,0].adresse-1;
//Affiche('Le node '+intToSTR(iNode)+' est '+node.Text+' image='+intToSTR(node.ImageIndex),clYellow);
if i=foncVar then //racine du treeview
begin
@@ -17921,9 +18043,25 @@ begin
if isVariable(i) then
begin
// autoriser montée descente menu
PopupMenuFL.Items[0].Enabled:=true;
PopupMenuFL.Items[1].Enabled:=true;
// autoriser montée descente menu que si l'adjacent est une variable
TypAdjAv:=fonction[foncCourante,inode-1].typ;
TypAdjAp:=fonction[foncCourante,inode+1].typ;
if isVariable(TypAdjAv) then
begin
PopupMenuFL.Items[0].Enabled:=true;
end
else
begin
PopupMenuFL.Items[0].Enabled:=false;
end;
if isVariable(TypAdjAp) and (inode+1<=n) then
begin
PopupMenuFL.Items[1].Enabled:=true;
end
else
begin
PopupMenuFL.Items[1].Enabled:=false;
end;
TreeViewL.hint:='état logique';
PanelAcc.Visible:=true;
@@ -17935,13 +18073,12 @@ begin
ComboBoxVar.ItemIndex:=i-EtatDCC;
ButtonAjoutevar.enabled:=true;
ButtonAjOpEnfant.Enabled:=false; // on ne peut pas ajouter d'opérateur sur une variable
end;
end;
clicTree:=false;
end;
// insère une entrée dans le tableau fonction à l'indice index, et remplit niveau et fonc
// insère une entrée dans le tableau fonction à l'indice index, et remplit niveau et fonc
procedure insersion(k,index,niveau,fonc : integer);
var i : integer;
begin
@@ -18006,9 +18143,9 @@ begin
if nodeA.GetPrevSibling <> nil then
// oui le monter
begin
nodeB:=nodeA.GetPrevSibling; // celui du dessus
nodeB:=nodeA.GetPrevSibling; // celui du dessus
idA:=nodeA.AbsoluteIndex; // origine
idB:=nodeB.AbsoluteIndex; // destination
idB:=nodeB.AbsoluteIndex; // destination
fonc:=Fonction[foncCourante,idA]; // sauver le node origine
TreeviewL.Selected.MoveTo(nodeB,naInsert);
nodeB:=treeViewL.Items[idB];
@@ -18212,6 +18349,7 @@ begin
Node.SelectedIndex:=EtatDCC;
NodeOrigine.Expand(true);
end;
// si le node origine est une variable
if isVariable(nodeOrigine.ImageIndex) then
begin
@@ -18220,6 +18358,7 @@ begin
Node.SelectedIndex:=EtatDCC;
NodeOrigine.Expand(true);
end;
config_modifie:=true;
if node=nil then exit;
@@ -18360,9 +18499,9 @@ begin
begin
pos:=memoire[adr];
case fonction[k,i].OpMemoire of
0 : result:=pos=fonction[k,i].etat;
1 : result:=pos>fonction[k,i].etat;
2 : result:=pos<fonction[k,i].etat;
0 : result:=pos=fonction[k,i].etat;
1 : result:=pos>fonction[k,i].etat;
2 : result:=pos<fonction[k,i].etat;
end;
exit;
end;
@@ -18623,13 +18762,11 @@ var i,erreur : integer;
s : string;
p : pointer;
begin
//Affiche('OnSetEditText '+intToSTR(Arow)+' '+Value,clYellow);
// Affiche('OnSetEditText '+intToSTR(Arow)+' '+Value,clYellow);
s:=Lowercase(Value);
val(value,i,erreur);
LabelInfo.caption:='';
ValueListEditor.Hint:=liste[Arow].aide;
p:=liste[Arow].variable;
case Arow of
1 : begin
if (erreur<>0) or (i<0) then exit;
@@ -18747,11 +18884,14 @@ end;
procedure TFormConfig.ValueListEditorMouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
var BarInfo: TScrollInfo;
begin
exit;
y:=y div (ValueListEditor.RowHeights[0]+1);
if (y>high(liste)) or (y<1) then exit;
//Affiche('OnMouseMove y='+intToSTR(y),clYellow);
ValueListEditor.hint:=Liste[y].aide;
// GetScrollInfo(ValueListEditor.Handle,Integer(SB_Vert),BarInfo);
// Affiche('OnMouseMove scrollBar='+intToSTr(barInfo.nPos) ,clYellow);
// ValueListEditor.hint:=Liste[y].aide;
end;
procedure TFormConfig.RadioGroupOPClick(Sender: TObject);
@@ -18888,7 +19028,9 @@ begin
shapeB8.Brush.Color:=clGray;
GroupBoxBt.visible:=true;
GroupBoxBr.visible:=false;
GroupBoxBT.caption:='Bouton n°'+intToSTR(BoutonBloc);
end;
end;
procedure rotatif;
@@ -18937,9 +19079,9 @@ end;
procedure TFormConfig.ShapeB1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
BoutonBloc:=1;
boutons;
ShapeB1.Brush.Color:=clYellow;
BoutonBloc:=1;
LabeledEditCT.Text:=intToSTR(blocUSB[NumBlocUSB].Bp1);
LabeledEditF.Text:=intToSTR(blocUSB[NumBlocUSB].Fbp1);
LabeledEditFn.Text:=intToSTR(blocUSB[NumBlocUSB].Fnp1);
@@ -18948,9 +19090,9 @@ end;
procedure TFormConfig.ShapeB2MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
BoutonBloc:=2;
boutons;
ShapeB2.Brush.Color:=clYellow;
BoutonBloc:=2;
LabeledEditCT.Text:=intToSTR(blocUSB[NumBlocUSB].Bp2);
LabeledEditF.Text:=intToSTR(blocUSB[NumBlocUSB].Fbp2);
LabeledEditFn.Text:=intToSTR(blocUSB[NumBlocUSB].Fnp2);
@@ -18959,9 +19101,9 @@ end;
procedure TFormConfig.ShapeB3MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
BoutonBloc:=3;
boutons;
ShapeB3.Brush.Color:=clYellow;
BoutonBloc:=3;
LabeledEditCT.Text:=intToSTR(blocUSB[NumBlocUSB].Bp3);
LabeledEditF.Text:=intToSTR(blocUSB[NumBlocUSB].Fbp3);
LabeledEditFn.Text:=intToSTR(blocUSB[NumBlocUSB].Fnp3);
@@ -18970,9 +19112,9 @@ end;
procedure TFormConfig.ShapeB4MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
BoutonBloc:=4;
boutons;
ShapeB4.Brush.Color:=clYellow;
BoutonBloc:=4;
LabeledEditCT.Text:=intToSTR(blocUSB[NumBlocUSB].Bp4);
LabeledEditF.Text:=intToSTR(blocUSB[NumBlocUSB].Fbp4);
LabeledEditFn.Text:=intToSTR(blocUSB[NumBlocUSB].Fnp4);
@@ -18981,9 +19123,9 @@ end;
procedure TFormConfig.ShapeB5MousDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
BoutonBloc:=5;
boutons;
ShapeB5.Brush.Color:=clYellow;
BoutonBloc:=5;
LabeledEditCT.Text:=intToSTR(blocUSB[NumBlocUSB].Bp5);
LabeledEditF.Text:=intToSTR(blocUSB[NumBlocUSB].Fbp5);
LabeledEditFn.Text:=intToSTR(blocUSB[NumBlocUSB].Fnp5);
@@ -18992,9 +19134,9 @@ end;
procedure TFormConfig.ShapeB6MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
BoutonBloc:=6;
boutons;
ShapeB6.Brush.Color:=clYellow;
BoutonBloc:=6;
LabeledEditCT.Text:=intToSTR(blocUSB[NumBlocUSB].Bp6);
LabeledEditF.Text:=intToSTR(blocUSB[NumBlocUSB].Fbp6);
LabeledEditFn.Text:=intToSTR(blocUSB[NumBlocUSB].Fnp6);
@@ -19003,9 +19145,9 @@ end;
procedure TFormConfig.ShapeB7MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
BoutonBloc:=7;
boutons;
ShapeB7.Brush.Color:=clYellow;
BoutonBloc:=7;
LabeledEditCT.Text:=intToSTR(blocUSB[NumBlocUSB].Bp7);
LabeledEditF.Text:=intToSTR(blocUSB[NumBlocUSB].Fbp7);
LabeledEditFn.Text:=intToSTR(blocUSB[NumBlocUSB].Fnp7);
@@ -19014,9 +19156,9 @@ end;
procedure TFormConfig.ShapeB8MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
BoutonBloc:=8;
boutons;
ShapeB8.Brush.Color:=clYellow;
BoutonBloc:=8;
LabeledEditCT.Text:=intToSTR(blocUSB[NumBlocUSB].Bp8);
LabeledEditF.Text:=intToSTR(blocUSB[NumBlocUSB].Fbp8);
LabeledEditFn.Text:=intToSTR(blocUSB[NumBlocUSB].Fnp8);
@@ -19258,7 +19400,138 @@ begin
end;
end;
procedure TFormConfig.ButtonModClick(Sender: TObject);
begin
modif_action;
end;
procedure TFormConfig.ValueListEditorSelectCell(Sender: TObject; ACol,
ARow: Integer; var CanSelect: Boolean);
begin
ValueListEditor.Hint:=liste[Arow].aide;
end;
procedure TFormConfig.ComboBoxEchelleChange(Sender: TObject);
begin
// 0 : H0 1/87
// 1 : N 1/160
// 2 : Z 1/220
echelle:=ComboBoxEchelle.ItemIndex; // de 0 à 2
Affiche_echelle;
end;
procedure TFormConfig.ImageCourbesMouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
var i,j,maxi : integer;
s : string;
begin
i:=x div 2;
if (i<0) or (i>127) then exit;
with ImageCourbes.Canvas do
begin
maxi:=ImageCourbes.Height;
pen.Color:=clYellow;
pen.Mode:=pmXor;
pen.width:=1;
if not(prem) then
begin
j:=maxi-(ValVitTrain[ax div 2]*2);
moveTo(0,j);LineTo(ax,j);LineTo(ax,maxi);
end;
j:=maxi-(ValVitTrain[i]*2);
moveTo(0,j);LineTo(x,j);LineTo(x,maxi);
prem:=false;
ax:=x;
end;
s:='Cran '+intToSTR(i)+' : '+intToSTR(ValVitTrain[i])+' cm/s ';
s:=s+intToSTR(Vr_kmh(ValVitTrain[i]))+' km/h';
LabelValeur.caption:=s;
with LabelCran do
begin
Left:=x+ImageCourbes.Left-10;
caption:=intToSTR(i);
end;
with LabelVCMS do
begin
if j>16 then top:=j+ImageCourbes.Top-5;
caption:=intToSTR(ValVitTrain[i]);
end;
end;
procedure TFormConfig.LabeledEditVit1Change(Sender: TObject);
var i,erreur : integer;
begin
if (ligneClicTrain<0) or (clicliste) then exit;
val(labelededitVit1.Text,i,erreur);
if erreur=0 then
begin
LabelErreur.caption:='';
if i<128 then trains[ligneclicTrain+1].ConsV1:=i
else
begin
LabelErreur.caption:='Hors limites';
exit;
end;
end;
ListBoxTrains.items[ligneclicTrain]:=encode_train(ligneclicTrain+1);
ListBoxTrains.selected[ligneclicTrain]:=true;
calcul_equations_coeff(ligneclicTrain+1);
end;
procedure TFormConfig.LabeledEditVit2Change(Sender: TObject);
var i,erreur : integer;
begin
if (ligneClicTrain<0) or (clicliste) then exit;
val(labelededitVit2.Text,i,erreur);
if erreur=0 then
begin
LabelErreur.caption:='';
if i<128 then trains[ligneclicTrain+1].ConsV2:=i
else
begin
LabelErreur.caption:='Hors limites';
exit;
end;
end;
ListBoxTrains.items[ligneclicTrain]:=encode_train(ligneclicTrain+1);
ListBoxTrains.selected[ligneclicTrain]:=true;
calcul_equations_coeff(ligneclicTrain+1);
end;
procedure TFormConfig.LabeledEditVit3Change(Sender: TObject);
var i,erreur : integer;
begin
if (ligneClicTrain<0) or (clicliste) then exit;
val(labelededitVit3.Text,i,erreur);
if erreur=0 then
begin
LabelErreur.caption:='';
if i<128 then trains[ligneclicTrain+1].ConsV3:=i
else
begin
LabelErreur.caption:='Hors limites';
exit;
end;
end;
ListBoxTrains.items[ligneclicTrain]:=encode_train(ligneclicTrain+1);
ListBoxTrains.selected[ligneclicTrain]:=true;
calcul_equations_coeff(ligneclicTrain+1);
end;
end.
+20 -6
View File
@@ -211,7 +211,7 @@ end;
// actualise le contenu de la fenetre et de la zone tco par rapport à la cellule cliquée
procedure actualise(indexTCO : integer);
var i,j,ligne,Adr,Bimage,oriente,piedFeu,act,sens,IdCanton : integer;
var i,j,ligne,Adr,Bimage,oriente,piedFeu,act,sens,IdCanton,x,y,xc,yc : integer;
s : string;
ip : Timage;
r : trect;
@@ -270,7 +270,10 @@ begin
//XclicCell[indexTCO]:=XclicC;
//YclicCell[indexTCO]:=YclicC;
idCanton:=index_canton(indexTCO,xclicC,yclicC);
xc:=xClicC;yc:=yClicC;
origine_canton(xc,yc);
idCanton:=index_canton(indexTCO,xC,yC);
GroupBoxOrientation.visible:=false;
GroupBoxImplantation.visible:=false;
@@ -278,7 +281,7 @@ begin
GroupBoxDet.visible:=false;
GroupBoxCanton.visible:=true;
sens:=tco[indexTCO,xClicC,yClicC].SensCirc;
sens:=tco[indexTCO,xC,yC].SensCirc;
with GroupBoxCanton do
begin
EditTypeImage.Enabled:=false;
@@ -457,7 +460,7 @@ begin
with formConfCellTCO do
begin
CheckBoxEncadre.checked:=tco[indexTCO,XclicC,YclicC].Buttoir=1;
EditTypeImage.Enabled:=true;
GroupBoxOrientation.Visible:=false;
GroupBoxImplantation.Visible:=false;
@@ -630,7 +633,10 @@ begin
with formConfCellTCO do
begin
if isCanton(Bimage) then EditTexteCCTCO.Text:=canton[idcanton].nom
if isCanton(Bimage) then
begin
if idcanton>0 then EditTexteCCTCO.Text:=canton[idcanton].nom;
end
else EditTexteCCTCO.Text:=tco[indexTCO,xclicC,yclicC].Texte;
EditAdrElement.Text:=IntToSTR(tco[indexTCO,XclicCellInserer,YclicCellInserer].Adresse);
ComboRepr.ItemIndex:=tco[indexTCO,XclicC,YclicC].repr;
@@ -659,7 +665,14 @@ begin
i:=index_canton(indexTCO,xclicC,yclicC);
if i>0 then FormConfCellTCO.EditCanton.text:=intToSTR(canton[i].numero);
end
else FormConfCellTCO.LabelNumC.caption:='Elément de canton';
else
begin
FormConfCellTCO.LabelNumC.caption:='Elément de canton';
x:=xClicC;y:=yClicC;
origine_canton(x,y);
i:=tco[indexTCO,x,y].NumCanton;
if i>0 then FormConfCellTCO.EditCanton.text:=intToSTR(i);
end;
end;
actualize:=false;
@@ -1350,6 +1363,7 @@ var idc,x,y,sens : integer;
H : boolean;
begin
Idc:=index_canton(indexTCOcourant,xclicC,yclicC);
//Affiche('IDC='+intToSTR(idc),clYellow);
x:=canton[Idc].x;
y:=canton[Idc].y;
H:=IsCantonH(IndexTCOCourant,x,y);
+16 -15
View File
@@ -1,8 +1,8 @@
object FormFicheHoraire: TFormFicheHoraire
Left = 358
Top = 169
Width = 623
Height = 377
Width = 628
Height = 385
Caption = 'Fiche horaire'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
@@ -15,13 +15,13 @@ object FormFicheHoraire: TFormFicheHoraire
OnActivate = FormActivate
OnCreate = FormCreate
DesignSize = (
607
321)
620
354)
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 24
Top = 272
Left = 104
Top = 313
Width = 310
Height = 13
Anchors = [akLeft, akBottom]
@@ -30,25 +30,26 @@ object FormFicheHoraire: TFormFicheHoraire
'il'
end
object LabelErreur: TLabel
Left = 280
Top = 296
Width = 3
Left = 99
Top = 297
Width = 173
Height = 13
Anchors = [akLeft, akBottom]
Caption = '.'
end
object Label2: TLabel
Left = 288
Top = 320
Left = 104
Top = 329
Width = 296
Height = 13
Anchors = [akLeft, akBottom]
Caption = 'Les horaires sont sauvegard'#233's dans le fichier '#39'FicheHoraire.txt"'
end
object ButtonOk: TButton
Left = 16
Top = 304
Left = 8
Top = 313
Width = 75
Height = 25
Height = 32
Hint = 'Sauvegarde la fiche et ferme la fen'#234'tre'
Anchors = [akLeft, akBottom]
Caption = 'Ok'
@@ -61,7 +62,7 @@ object FormFicheHoraire: TFormFicheHoraire
Left = 8
Top = 16
Width = 601
Height = 233
Height = 273
ColCount = 4
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing]
TabOrder = 1
-1
View File
@@ -217,7 +217,6 @@ begin
PhaseVitesse:=1; // vitesse 1 2 ou 3
DetecteurREF:=0;
mesureTrains:=true;
vitesse_loco('',0,trains[indexTrainMes].adresse,v1,10,ActionVitesse); // ActionVitesse pour ne pas générer d'event_vitesse
+1 -1
View File
@@ -60,7 +60,7 @@ object FormModifAction: TFormModifAction
Top = 64
Width = 729
Height = 337
ActivePage = TabSheetOp
ActivePage = TabSheetDecl
MultiLine = True
TabOrder = 1
object TabSheetDecl: TTabSheet
+13 -13
View File
@@ -421,7 +421,7 @@ begin
begin
s:=s+'Fonction logique '+intToSTR(tablo_action[i].adresse);
end;
DeclClavier : s:=s+'Touche du clavier et/ou bloc USB '+intToSTR(tablo_action[i].adresse);
DeclClavier : s:=s+'Touche '+intToSTR(tablo_action[i].adresse)+' du clavier/bloc USB ';
end;
// conditions
@@ -432,19 +432,19 @@ begin
s:=s+'Condition :';
top:=Tablo_Action[i].tabloCond[op].numcondition;
case top of
CondVrai : s:=s+'toujours vraie ';
CondFaux : s:=s+'toujours fausse ';
CondVitTrain : s:=s+'vitesse train '+Tablo_Action[i].tabloCond[op].train+' '+intToSTR(Tablo_Action[i].tabloCond[op].vitmini)+
CondVrai : s:=s+'toujours vraie ';
CondFaux : s:=s+'toujours fausse ';
CondVitTrain : s:=s+'vitesse train '+Tablo_Action[i].tabloCond[op].train+' '+intToSTR(Tablo_Action[i].tabloCond[op].vitmini)+
' '+intToSTR(Tablo_Action[i].tabloCond[op].vitMaxi);
CondPosAcc : s:=s+' position d''accessoire '+intToSTR(Tablo_Action[i].tabloCond[op].accessoire)+' état '+intToSTR(Tablo_Action[i].tabloCond[op].etat);
CondHorl : s:=s+' horloge '+intToSTR(Tablo_Action[i].tabloCond[op].HeureMin)+'h'+intToSTR(Tablo_Action[i].tabloCond[op].MinuteMin)+' à '+
CondPosAcc : s:=s+' position d''accessoire '+intToSTR(Tablo_Action[i].tabloCond[op].accessoire)+' état '+intToSTR(Tablo_Action[i].tabloCond[op].etat);
CondHorl : s:=s+' horloge '+intToSTR(Tablo_Action[i].tabloCond[op].HeureMin)+'h'+intToSTR(Tablo_Action[i].tabloCond[op].MinuteMin)+' à '+
intToSTR(Tablo_Action[i].tabloCond[op].HeureMax)+'h'+intToSTR(Tablo_Action[i].tabloCond[op].MinuteMax)+' ';
condTrainSig : s:=s+'train '+Tablo_Action[i].tabloCond[op].train+' arrêté au signal '+intToSTR(Tablo_Action[i].tabloCond[op].Adresse);
condFonction : s:=s+'fonction logique '+intToSTR(tablo_action[i].tabloCond[op].adresse);
condBouton : s:=s+'bouton '+intToSTR(tablo_action[i].tabloCond[op].adresse)+' TCO';
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);
condTrainSig : s:=s+'train '+Tablo_Action[i].tabloCond[op].train+' arrêté au signal '+intToSTR(Tablo_Action[i].tabloCond[op].Adresse);
condFonction : s:=s+'fonction logique '+intToSTR(tablo_action[i].tabloCond[op].adresse);
condBouton : s:=s+'bouton '+intToSTR(tablo_action[i].tabloCond[op].adresse)+' TCO';
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);
end;
s:=s+#13;
@@ -632,7 +632,7 @@ begin
begin
EditLabel.Caption:='Mémoire';
Visible:=true;
hint:='Numéro de mémoire';
hint:='Numéro de mémoire de 0 à '+intToSTR(MaxMemoires);
text:=intToSTR(Tablo_Action[index].tabloop[indexAction].adresse);
end;
with SpinEditEtatOp do
+1
View File
@@ -122,6 +122,7 @@ var
iValue : LongWord;
s : string;
begin
BisEnabled:=false;
fwPolicy2:=CreateOleObject('HNetCfg.FwPolicy2');
RulesObject:=fwPolicy2.Rules;
CurrentProfiles:=fwPolicy2.CurrentProfileTypes;
+108 -159
View File
@@ -591,8 +591,8 @@ object FormPrinc: TFormPrinc
Visible = False
end
object Image3feux: TImage
Left = 600
Top = 16
Left = 200
Top = 8
Width = 33
Height = 57
Picture.Data = {
@@ -5421,6 +5421,26 @@ object FormPrinc: TFormPrinc
0000}
Visible = False
end
object Label1: TLabel
Left = 856
Top = 4
Width = 89
Height = 13
Caption = 'Nombre de trains : '
end
object LabelNbTrains: TLabel
Left = 960
Top = 2
Width = 9
Height = 19
Caption = '0'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -16
Font.Name = 'Arial'
Font.Style = [fsBold]
ParentFont = False
end
object StatusBar1: TStatusBar
Left = 0
Top = 596
@@ -5492,8 +5512,8 @@ object FormPrinc: TFormPrinc
OnMouseDown = FenRichMouseDown
end
object GroupBoxAcc: TGroupBox
Left = 425
Top = 5
Left = 433
Top = 29
Width = 265
Height = 52
Anchors = [akTop, akRight]
@@ -5549,10 +5569,10 @@ object FormPrinc: TFormPrinc
end
end
object GroupBoxTrains: TGroupBox
Left = 425
Top = 64
Left = 441
Top = 72
Width = 265
Height = 129
Height = 81
Anchors = [akTop, akRight]
Caption = 'Commande aux trains'
TabOrder = 2
@@ -5563,31 +5583,78 @@ object FormPrinc: TFormPrinc
Height = 13
Caption = 'Adresse train :'
end
object Label5: TLabel
Left = 8
Top = 44
Width = 76
Height = 13
Caption = 'Vitesse train Cr :'
end
object LabelFonction: TLabel
Left = 148
Top = 44
Left = 20
Top = 48
Width = 47
Height = 13
Caption = 'Fonction: '
end
object Label6: TLabel
Left = 228
Top = 44
Left = 116
Top = 48
Width = 9
Height = 13
Caption = #224' '
end
object EditAdrTrain: TEdit
Left = 80
Top = 16
Width = 25
Height = 21
TabOrder = 0
OnChange = EditAdrTrainChange
end
object ComboTrains: TComboBox
Left = 112
Top = 16
Width = 145
Height = 21
Style = csDropDownList
ItemHeight = 13
TabOrder = 1
OnChange = ComboTrainsChange
end
object EditNumFonction: TEdit
Left = 76
Top = 44
Width = 25
Height = 21
Hint = 'Fonction de 0 '#224' 12 ou 28'
TabOrder = 2
end
object ButtonFonction: TButton
Left = 176
Top = 44
Width = 81
Height = 25
Caption = 'Envoi fonction'
TabOrder = 4
WordWrap = True
OnClick = ButtonFonctionClick
end
object EditFonc01: TEdit
Left = 136
Top = 44
Width = 17
Height = 21
TabOrder = 3
end
end
object Panel1: TPanel
Left = 696
Top = 13
Width = 281
Height = 172
Anchors = [akTop, akRight]
TabOrder = 3
DesignSize = (
281
172)
object SBMarcheArretLoco: TSpeedButton
Left = 96
Left = 192
Top = 88
Width = 73
Width = 89
Height = 33
Hint = 'Arr'#234't de tous les trains'
Glyph.Data = {
@@ -5710,129 +5777,6 @@ object FormPrinc: TFormPrinc
Visible = False
OnClick = SBMarcheArretLocoClick
end
object loco: TButton
Left = 6
Top = 88
Width = 83
Height = 33
Hint = 'Envoie la vitesse au train'
Caption = 'Envoi vitesse '#224' loco'
ParentShowHint = False
ShowHint = True
TabOrder = 0
WordWrap = True
OnClick = locoClick
end
object EditAdrTrain: TEdit
Left = 80
Top = 16
Width = 25
Height = 21
TabOrder = 1
OnChange = EditAdrTrainChange
end
object EditVitesse: TEdit
Left = 88
Top = 40
Width = 33
Height = 21
Hint = 'Vitesse du train en crans'
ParentShowHint = False
ShowHint = True
TabOrder = 2
Text = '0'
OnChange = EditVitesseChange
end
object ComboTrains: TComboBox
Left = 112
Top = 16
Width = 145
Height = 21
Style = csDropDownList
ItemHeight = 13
TabOrder = 3
OnChange = ComboTrainsChange
end
object EditNumFonction: TEdit
Left = 196
Top = 40
Width = 25
Height = 21
Hint = 'Fonction de 0 '#224' 12 ou 28'
TabOrder = 4
end
object ButtonFonction: TButton
Left = 176
Top = 88
Width = 81
Height = 33
Caption = 'Envoi fonction '#224' loco'
TabOrder = 6
WordWrap = True
OnClick = ButtonFonctionClick
end
object EditFonc01: TEdit
Left = 240
Top = 40
Width = 17
Height = 21
TabOrder = 5
end
object TrackBarVit: TTrackBar
Left = 16
Top = 64
Width = 233
Height = 21
Hint = 'Vitesse loco en %'
Ctl3D = False
Max = 127
Min = -128
ParentCtl3D = False
ParentShowHint = False
ShowHint = True
TabOrder = 7
OnChange = TrackBarVitChange
end
object Button0: TButton
Left = 124
Top = 48
Width = 17
Height = 17
Caption = '0'
TabOrder = 8
OnClick = Button0Click
end
end
object Panel1: TPanel
Left = 696
Top = -3
Width = 281
Height = 180
Anchors = [akTop, akRight]
TabOrder = 3
DesignSize = (
281
180)
object Label1: TLabel
Left = 152
Top = 136
Width = 89
Height = 13
Caption = 'Nombre de trains : '
end
object LabelNbTrains: TLabel
Left = 256
Top = 132
Width = 9
Height = 19
Caption = '0'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -16
Font.Name = 'Arial'
Font.Style = [fsBold]
ParentFont = False
end
object BoutonRaf: TButton
Left = 8
Top = 8
@@ -5930,7 +5874,7 @@ object FormPrinc: TFormPrinc
OnClick = ButtonCDMClick
end
object EditEnvoi: TEdit
Left = -8
Left = 8
Top = 127
Width = 121
Height = 21
@@ -5939,7 +5883,7 @@ object FormPrinc: TFormPrinc
Text = '<1>'
end
object ButtonEnv: TButton
Left = 1
Left = 9
Top = 88
Width = 88
Height = 33
@@ -5951,10 +5895,10 @@ object FormPrinc: TFormPrinc
end
end
object GroupBoxCV: TGroupBox
Left = 697
Top = 8
Left = 737
Top = 16
Width = 265
Height = 129
Height = 105
Anchors = [akTop, akRight]
Caption = 'Variables CV'
Color = clBtnFace
@@ -5962,7 +5906,7 @@ object FormPrinc: TFormPrinc
TabOrder = 4
object Label3: TLabel
Left = 208
Top = 42
Top = 34
Width = 14
Height = 13
Caption = 'CV'
@@ -5970,7 +5914,7 @@ object FormPrinc: TFormPrinc
end
object LabelVCV: TLabel
Left = 208
Top = 71
Top = 63
Width = 47
Height = 13
Caption = 'Valeur CV'
@@ -5978,7 +5922,7 @@ object FormPrinc: TFormPrinc
end
object ButtonEcrCV: TButton
Left = 8
Top = 24
Top = 16
Width = 153
Height = 33
Hint = 'Ecriture CV en mode direct sur voie de programmation'
@@ -5989,7 +5933,7 @@ object FormPrinc: TFormPrinc
end
object ButtonLitCV: TButton
Left = 8
Top = 80
Top = 64
Width = 153
Height = 33
Hint = 'Lecture CV en mode direct sur voie de programmation'
@@ -6001,14 +5945,14 @@ object FormPrinc: TFormPrinc
end
object EditCV: TEdit
Left = 168
Top = 40
Top = 32
Width = 33
Height = 21
TabOrder = 2
end
object EditVal: TEdit
Left = 168
Top = 68
Top = 60
Width = 33
Height = 21
TabOrder = 3
@@ -6099,8 +6043,8 @@ object FormPrinc: TFormPrinc
end
end
object ButtonEssai: TButton
Left = 504
Top = 8
Left = 312
Top = 16
Width = 75
Height = 25
Caption = 'Essai'
@@ -6115,7 +6059,7 @@ object FormPrinc: TFormPrinc
Top = 8
end
object MainMenu1: TMainMenu
Left = 560
Left = 536
object Afficher1: TMenuItem
Caption = 'Afficher'
object Affichagenormal1: TMenuItem
@@ -6526,8 +6470,8 @@ object FormPrinc: TFormPrinc
Left = 296
end
object OpenDialog: TOpenDialog
Left = 944
Top = 65528
Left = 584
Top = 16
end
object SaveDialog: TSaveDialog
Left = 744
@@ -6606,10 +6550,15 @@ object FormPrinc: TFormPrinc
end
end
object PopupMenuCompteurs: TPopupMenu
OnPopup = PopupMenuCompteursPopup
Left = 848
object Propritsdescompteurs1: TMenuItem
Caption = 'Propri'#233't'#233's des compteurs'
OnClick = Propritsdescompteurs1Click
end
object Dtacherlecompteur1: TMenuItem
Caption = 'D'#233'tacher le compteur'
OnClick = Dtacherlecompteur1Click
end
end
end
+220 -188
View File
@@ -1,5 +1,5 @@
unit Unitprinc;
// 23/03/2025
// 27/03/2025
(********************************************
Programme signaux complexes Graphique Lenz
Composants ClientSocket et ServeurSocket pour les connexions réseau socket
@@ -31,7 +31,7 @@ unit Unitprinc;
Dans projet/option/fiches : fiches disponibles : formtco uniquement
En cas d'erreur interne L1333, supprimer les fichiers DCU du projet ou simplement faire construire
Pour le mode sombre sous Embarcadero, il faut sélectionner:
Pour le mode sombre sous D12, il faut sélectionner:
Projet / Options // Application / manifeste / fichier manifeste : personnaliser
à la sauvegarde, ce champ apparaitra sous "générer automatiquement"
et : décocher "activer les thèmes d'exécution"
@@ -53,7 +53,7 @@ unit Unitprinc;
ligne de commande en mode administrateur pour valider le socket du pare feu:
netsh advfirewall firewall add rule name="cdm rail" dir=in action=allow program="C:\Program Files (x86)\CDM-Rail\cdr.exe" enable=yes
*)
*)
//
// En mode simulation run:
// CDM ne renvoie pas les détecteurs au départ du RUN, ou pendant le RUN
@@ -224,21 +224,14 @@ type
ButtonDevie: TButton;
GroupBoxTrains: TGroupBox;
Label4: TLabel;
Label5: TLabel;
LabelFonction: TLabel;
Label6: TLabel;
SBMarcheArretLoco: TSpeedButton;
loco: TButton;
EditAdrTrain: TEdit;
EditVitesse: TEdit;
ComboTrains: TComboBox;
EditNumFonction: TEdit;
ButtonFonction: TButton;
EditFonc01: TEdit;
TrackBarVit: TTrackBar;
Panel1: TPanel;
Label1: TLabel;
LabelNbTrains: TLabel;
BoutonRaf: TButton;
ButtonArretSimu: TButton;
ButtonAffTCO: TButton;
@@ -284,7 +277,6 @@ type
N18: TMenuItem;
Mesurerlavitessedestrains: TMenuItem;
Affichelamesuredesvitesses1: TMenuItem;
Button0: TButton;
Etatdesactionneurs1: TMenuItem;
Compilerlabasededonnes1: TMenuItem;
PageControl: TPageControl;
@@ -303,6 +295,10 @@ type
TrackBarZC: TTrackBar;
PopupMenuCompteurs: TPopupMenu;
Propritsdescompteurs1: TMenuItem;
Dtacherlecompteur1: TMenuItem;
Label1: TLabel;
LabelNbTrains: TLabel;
SBMarcheArretLoco: TSpeedButton;
procedure FormCreate(Sender: TObject);
{$IF CompilerVersion >= 28.0}
procedure RecuInterface(Sender: TObject;count : word);
@@ -334,7 +330,6 @@ type
procedure DeconnecterUSBClick(Sender: TObject);
procedure MenuConnecterEthernetClick(Sender: TObject);
procedure MenuDeconnecterEthernetClick(Sender: TObject);
procedure locoClick(Sender: TObject);
procedure AffEtatDetecteurs(Sender: TObject);
procedure Etatdesaiguillages1Click(Sender: TObject);
procedure Codificationdesaiguillages1Click(Sender: TObject);
@@ -477,6 +472,8 @@ type
procedure TrackBarZCChange(Sender: TObject);
procedure Propritsdescompteurs1Click(Sender: TObject);
procedure PageControlChange(Sender: TObject);
procedure Dtacherlecompteur1Click(Sender: TObject);
procedure PopupMenuCompteursPopup(Sender: TObject);
private
{ Déclarations privées }
procedure DoHint(Sender : Tobject);
@@ -492,6 +489,7 @@ type
procedure proc_checkBoxFR(Sender : Tobject);
procedure procAide(Sender : Tobject);
procedure ImCOnclic(Sender : TObject);
procedure ImCOnDblclic(Sender : TObject);
procedure ImC0Onclic(Sender : Tobject);
procedure ImTBOnChange(Sender : Tobject);
{$IF CompilerVersion >= 28.0}
@@ -605,6 +603,7 @@ NbMaxDet=2048; // indice maximal de d
NbDetArret=500; // Nombre de détecteurs arret de train
Max_Trains=200; // nombre maximal de train de CDM ou déclarés ou en circulation
MaxZones=250; // nombre de zones de détecteurs activés par les trains
MaxMemoires=100; // Nombre maxi de mémoires
MaxTrainZone=40; // nombre maximal de trains pour le tableau d'historique des zones
Mtd=128; // nombre maxi de détecteurs précédents stockés
Max_event_det=4000; // nombre maximal d'évenements détecteurs
@@ -796,10 +795,10 @@ tagKBDLLHOOKSTRUCT =
// type fonction
Tfonction =
record
typ : integer;
typ : integer; // opOU, EtatDCC, EtatDet ... etc
Indexprec : integer ; // index du niveau précédent d'origine (parent)
adresse,etat : integer; // adresse : l'indice 0 contient le nombre d'éléments
OpMemoire : integer; // opérateur mémoire : 0=égal 1=> 2=<
OpMemoire : integer; // opérateur "mémoire" : 0=égal 1=> 2=<
niveau : integer; // niveau : l'indice 0 contient le numéro de fonction modifiable
traite : boolean;
etatprec : boolean; // sert au front montant
@@ -957,6 +956,7 @@ TparamCompt=record
Rav, // rayon arc vert (consigne vitesse)
ImgL,ImgH : integer; // larg haut image
idTrain : integer;
AngleFin : integer; // angle maxi du compteur
redX,redY,ComptA,ComptB : single;
end;
@@ -1109,7 +1109,7 @@ var
SensAig,NbreRoutes,nbreIti,DetAtrouve,DetDepart,iteration,IdActTr,Long_recue,
prec1,prec2,Eprec,Esuiv,param1,param2,param3,MaxParcours,MaxRoutes,tempoBlocUSB,
IdTrainClic,TempoCombo,RayonCompteur,XcentreCompteur,YCentreCompteur,AigCX,AigCY,
IncrCompteur,tickt2,pointeurTaches : integer;
IncrCompteur,tickt2,pointeurTaches,Nbre_Interfaces_CDM : integer;
ack,portCommOuvert,traceTrames,AffMem,CDM_connecte,dupliqueEvt,affiche_retour_dcc,
Raz_Acc_signaux,AvecTCO,terminal,Srvc_Aig,Srvc_Det,Srvc_Act,MasqueBandeauTCO,
@@ -1125,6 +1125,8 @@ var
Style : array[0..200] of Tstyle;
Interfaces_CDM : array[1..20] of string;
tick,Premier_tick : longint;
// composants de sélection du train
@@ -1160,7 +1162,7 @@ var
AdrTrainRes : integer; // adresse du train qui réserve le détecteur
IndexTrainRoulant : integer; // index du train placé (généré dans calcul_zones_V1F)
Tempo0 : integer; // tempo de retombée à 0 du détecteur (filtrage)
Temps_cour : integer ; // tempo de comptage déecteur à 1 pour mesurer la vitesse du train
Temps_cour : integer; // tempo de comptage déecteur à 1 pour mesurer la vitesse du train
NumBranche,IndexBranche : integer; // où se trouve le détecteur dans les branches
index : integer;
canton1,canton2 : integer; // Numéro (pas index) des deux cantons adjacents (1 ou 2)
@@ -1288,8 +1290,8 @@ var
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
end;
Memoire : array[0..100] of integer;
Memoire : array[0..MaxMemoires] of integer;
Conditions : array[0..12] of
record
@@ -1918,16 +1920,20 @@ begin
with formprinc do
begin
if (idTrainClic<1) or (idTrainClic>nTrains) then exit;
if origine=1 then
// Affiche('origine='+intToSTR(origine),clYellow);
{if origine=1 then
begin
s:=editVitesse.Text;
val(s,vit,erreur);
// 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,vit,10,vientde);
end;
if origine=2 then
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
@@ -2241,11 +2247,13 @@ begin
for i:=1 to ntrains do
begin
n:=trains[i].routePref[0,0].adresse;
if n<>0 then s:='train '+intToSTR(i)+' : '+intToSTR(n)+' routes';
if n<>0 then
begin
s:=' train '+intToSTR(i)+' : '+intToSTR(n)+' routes';
if mode=1 then Affiche(s,clyellow);
if mode=2 then ClientInfo.Socket.SendText(s);
end;
end;
if mode=1 then Affiche(s,clyellow);
if mode=2 then ClientInfo.Socket.SendText(s);
end;
procedure menu_selec;
@@ -2291,6 +2299,8 @@ begin
Compteurdevitesse11.Checked:=compteur=1;
Compteurdevitesse21.Checked:=compteur=2;
Compteurtachro1.Checked:=compteur=3;
Vitesseencrans1.Checked:=true;
Vitesserelle1.checked:=false;
end;
Init_compteur(i,formcompteur[1]);
@@ -2299,7 +2309,6 @@ begin
if AffCompteur then formCompteur[i].Show;
end;
formConfig.listBoxPeriph.clear;
formModifAction.ComboBoxAccComUSB.Clear;
formconfig.ComboBoxPNCom.Clear;
@@ -2334,6 +2343,12 @@ begin
for i:=1 to ntrains do
begin
cree_GB_compteur(i);
trains[i].canton:=0;
trains[i].x:=-999999;
trains[i].y:=-999999;
trains[i].BlocUSB:=0;
calcul_equations_coeff(i);
end;
s:='Fin du préliminaire';
@@ -2341,6 +2356,8 @@ begin
formprinc.SetFocus;
menu_selec;
Maj_Signaux(false);
end;
// renvoie une chaine ASCI Hexa affichable à partir d'une chaîne
@@ -3263,8 +3280,7 @@ end;
// dessine un cercle plein dans le signal dans le canvas
procedure cercle(ACanvas : Tcanvas;x,y,rayon : integer;coulcercle,couleurfond : Tcolor);
var hhpen : hpen;
hdc,canvasHd : hwnd;
var hdc,canvasHd : hwnd;
ps : PAINTSTRUCT ;
begin
//vwhd:=getparent(Acanvas.Handle);
@@ -3280,7 +3296,7 @@ begin
end;
exit;
// avec api windows
// avec api windows
canvasHd:=Acanvas.Handle;
hdc:= BeginPaint(canvasHd, ps);
@@ -5383,7 +5399,7 @@ begin
begin
Combotrains.ItemIndex:=IdTrainclic-1;
EditAdrTrain.Text:=intToSTR(trains[idTrainClic].adresse);
Editvitesse.Text:=intToSTR(trains[idTrainClic].vitesseCons);
//Editvitesse.Text:=intToSTR(trains[idTrainClic].vitesseCons);
end;
// affiche le compteur du train cliqué
affiche_train_compteur(1);
@@ -5423,6 +5439,14 @@ begin
change_clic_train(i);
end;
procedure tformPrinc.ImcOnDblclic(Sender : TObject);
var i : integer;
begin
i:=extract_int((Sender as timage).Name);
change_clic_train(i);
formCompteur[1].Show;
end;
// créée une image dynamiquement dans la partie droite pour un nouveau compteur par train
// rang commence à 1
procedure cree_GB_compteur(rang : integer);
@@ -5486,6 +5510,7 @@ begin
picture.Bitmap.Width:=ImL;
picture.Bitmap.Height:=ImH;
onClick:=formPrinc.ImConclic;
onDblClick:=formPrinc.ImConDblclic;
PopUpMenu:=Formprinc.PopupmenuCompteurs;
//with Picture.Bitmap.canvas do
with canvas do
@@ -6048,28 +6073,28 @@ begin
begin
adr:=Tablo_Action[action].tabloCond[ncond].adresse; // numéro de bouton
condValide:=false;
if (adr>1) or (adr<=100) then condValide:=boutonTCO[adr].etat=1;
if (adr>1) or (adr<=MaxMemoires) then condValide:=boutonTCO[adr].etat=1;
end;
condMemoireEgal :
begin
adr:=Tablo_Action[action].tabloCond[ncond].adresse; // numéro de mémoire
etat:=Tablo_Action[action].tabloCond[ncond].etat;
condValide:=false;
if (adr>1) or (adr<=100) then condValide:=memoire[adr]=etat;
if (adr>1) or (adr<=MaxMemoires) then condValide:=memoire[adr]=etat;
end;
condMemoireInf :
begin
adr:=Tablo_Action[action].tabloCond[ncond].adresse; // numéro de mémoire
etat:=Tablo_Action[action].tabloCond[ncond].etat;
condValide:=false;
if (adr>1) or (adr<=100) then condValide:=memoire[adr]<etat;
if (adr>1) or (adr<=MaxMemoires) then condValide:=memoire[adr]<etat;
end;
condMemoireSup :
begin
adr:=Tablo_Action[action].tabloCond[ncond].adresse; // numéro de mémoire
etat:=Tablo_Action[action].tabloCond[ncond].etat;
condValide:=false;
if (adr>1) or (adr<=100) then condValide:=memoire[adr]>etat;
if (adr>1) or (adr<=MaxMemoires) then condValide:=memoire[adr]>etat;
end;
end;
end;
@@ -6342,11 +6367,11 @@ end;
// fonction hook clavier de bas niveau (LL) appellée par appui ou relache sur une touche
// cette fonction intercepte tous les évènements clavier windows quelque soit la fenetre ou le prog activé.
// cette fonction intercepte tous les évènements clavier (pas les touches de fonctions [hotkeys]) windows quelque soit la fenetre ou le prog activé.
// https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ms644984(v=vs.85)?redirectedfrom=MSDN
// https://learn.microsoft.com/fr-fr/windows/win32/api/winuser/ns-winuser-kbdllhookstruct
function ClavierHookLLProc(Code : integer; WordParam : wparam; LongParam: lparam) : longint;
const LLKHF_UP=$0080;
const LLKHF_UP=$0080; // masque pour touche enfoncée
var
KeyState : TKeyboardState;
NewChar: array[0..1] of Char;
@@ -6481,9 +6506,8 @@ begin
if (fonction<0) or (fonction>28) or (loco<0) or (loco>9999) then exit;
if portCommOuvert or parSocketLenz then
begin
if protocole=1 then
if protocole=1 then // protocole XpressNet
begin
demande_etat_loco(loco); // récupère les états des fonctions Fa=F0 à 4 Fb=F5 à F12 AdrTrain
//Affiche('Train='+IntToSTR(AdrTrain)+' '+IntToHex(fa,2)+' '+IntToHex(fb,2),clyellow);
// en fonction du décodeur, on n'a pas le bon train!!
@@ -6493,8 +6517,8 @@ begin
if fonction<=4 then s:=s+#$20;
if (fonction>=5) and (fonction<=8) then s:=s+#$21;
if (fonction>=9) and (fonction<=12) then s:=s+#$22;
if (fonction>=13) and (fonction<=20) then s:=s+#$23; // 23 non doc
if (fonction>=21) and (fonction<=28) then s:=s+#$28; // 28 non doc
if (fonction>=13) and (fonction<=20) then s:=s+#$23; // rang 23 non documentée
if (fonction>=21) and (fonction<=28) then s:=s+#$28; // rang 28 non documentée
// codification de l'adresse de la loco : doc Xpressnet page 40 (§2.1.15)
if loco<99 then begin Ah:=0;Al:=loco;end
else begin ah:=((loco or $C000) shr 8);al:=loco and 255;end;
@@ -6528,7 +6552,7 @@ begin
//envoi(s);
end;
end;
if protocole=2 then
if protocole=2 then // protocole DCC
begin
c:=0;
if fonction<=4 then
@@ -6556,7 +6580,7 @@ begin
end;
if (fonction>=9) and (fonction<=12) then
begin
b:=160;
b:=160; // 1010 0000
if etat=1 then
case fonction of
9 : b:=b+1;
@@ -6642,8 +6666,6 @@ begin
end;
end;
// envoie une vitesse à une loco par XpressNet/Dcc++ ou par CDM
// index=index du train dans le tableau trains[]
// sens en fonction du sens dans le tableau train ou vitesse positive ou négative
@@ -6676,8 +6698,8 @@ begin
if (v=adr_loco) then
begin
pasChgTBV:=true; // évite de repositionner la trackbar
Formprinc.TrackBarVit.Position:=vitesse;
formprinc.EditVitesse.text:=intToSTR(vitesse);
//Formprinc.TrackBarVit.Position:=vitesse;
//formprinc.EditVitesse.text:=intToSTR(vitesse);
pasChgTBV:=false;
end;
@@ -6714,24 +6736,26 @@ begin
if cdm_connecte then
begin
sc:=false;
// il faut qu'on soit en RUN pour que les vitesses trains soient prises en compte
// il faut qu'on soit en RUN pour que les vitesses des trains soient prises en compte
// pour arrêter un train dans CDM, envoyer une consigne nulle ne suffit pas, il faut envoyer un _STOP
if PilotageTrainsCDMNom then
begin
if vitesse=0 then s:=chaine_CDM_StopTrainST(nom_train)
else
s:=chaine_CDM_vitesseST(vitesse,nom_train) // par nom du train
end
s:=chaine_CDM_vitesseST(vitesse,nom_train) // par nom du train
else
begin
if vitesse=0 then s:=chaine_CDM_StopTrainINT(adr_loco)
else
s:=chaine_CDM_vitesseINT(vitesse,adr_loco); // par adresse du train : ne marche pas toujours!!!
end;
s:=chaine_CDM_vitesseINT(vitesse,adr_loco); // par adresse du train : ne marche pas toujours!!!
//Affiche('COMIP='+s,clWhite);
if modetache then tache(ttacheVit,0,ttDestCDM,s) else // TypeTache,tempo,destinataire,chaine
envoi_CDM(s);
if vitesse=0 then
begin
if PilotageTrainsCDMNom then
s:=chaine_CDM_StopTrainST(nom_train)
else
s:=chaine_CDM_StopTrainINT(adr_loco);
if modetache then tache(ttacheVit,0,ttDestCDM,s) else // TypeTache,tempo,destinataire,chaine
envoi_CDM(s);
end;
end;
// répétition de la consigne dans x s
@@ -9518,7 +9542,7 @@ begin
exit;
end;
//suivant_alg3(adresse,typ,suivant,tsuiv,1);
//suivant_alg3(adresse,typ,suivant,tsuiv,1);
AfficheDebug('cas non prévu - Fin proc trouve_actionneurs',clCyan);
end;
@@ -14845,67 +14869,7 @@ end;
// libère le canton avant detecteur2, qui doit être associé à un signal depuis la direction de detecteur1
// detecteur1->detecteur2
Procedure libere_cantonX(detecteur1,detecteur2 : integer);
var i,j,index,adrSig1: integer;
typ : tEquipement;
begin
if not(roulage) then exit;
proc:=Tlibere_canton;
param1:=detecteur1;
param2:=detecteur2;
if traceliste or ProcPrinc or affres or debugroulage then
affiche('Libère_canton '+intToSTR(detecteur1)+' '+intToSTR(detecteur2),clLime);
if ProcPrinc or traceListe then AfficheDebug('Libère_Canton '+intToSTR(detecteur1)+' '+intToSTR(detecteur2),clLime);
// est-on en limite de canton du detecteur 2 pour le libérer?
adrSig1:=signal_detecteur(detecteur2); // trouve le signal associé au detecteur2
if adrSig1=0 then
begin
if traceliste then affiche('le détecteur '+intToSTR(detecteur2)+' n''est pas pas associé à un signal - pas de libération du canton',clorange);
exit; // pas de signal associé
end;
// ce signal sd2 est il dans le bon sens
i:=signal_suivant_det(detecteur1,detecteur2); // adresse du signal dans le bon sens associé au détecteur
if i<>adrSig1 then
begin
if traceliste then affiche('Le signal '+intToSTR(adrsig1)+' n''est pas dans le bon sens',clOrange);
exit;
end;
if i=0 then exit;
if traceListe then AfficheDebug('Libération canton det '+IntToSTR(detecteur1)+' '+intToSTR(detecteur2)+' : ',clLime);
for i:=1 to idEl-1 do
begin
j:=elements[i].adresse;
typ:=elements[i].typ;
if (typ=Aig) or (typ=tjd) or (typ=tjs) or (typ=crois) or (typ=triple) then
begin
index:=index_aig(j);
if traceListe then Affichedebug_Suivi('A'+intToSTR(j)+' ',clLime);
if debugRoulage then Affiche('Libération aiguillage A'+intToSTR(j),clWhite);
Aiguillage[index].AdrTrain:=0; // libère l'aiguillage
Texte_aig_fond(j);
typ:=aiguillage[index].modele;
if (typ=Tjd) and (aiguillage[index].EtatTJD=4) then
begin
j:=aiguillage[index].Ddroit;// homologue
if debugRoulage then Affiche('Libération aiguillage A'+intToSTR(j),clWhite);
Aiguillage[index_aig(j)].AdrTrain:=0; // libère l'homologue
end;
end;
if (typ=det) then
begin
if traceListe then Affichedebug_Suivi(intToSTR(j)+' ',clLime);
detecteur[j].AdrTrainRes:=0; // libère le détecteur
Texte_aig_fond(j);
end;
end;
Maj_Signaux(false);
end;
// libère le canton avant detecteur2, qui doit être associé à un signal depuis la direction de detecteur1
// detecteur1->detecteur2
Procedure libere_canton(detecteur1,detecteur2,AdrTrain : integer);
Procedure libere_canton(detecteur1,detecteur2,AdrTrain : integer);
var i,j,index,adrSig1,adrSig2,detsig1,detSig2,it,n,id1,id2 : integer;
typ : tEquipement;
trouve1,trouve2 : boolean;
@@ -15747,9 +15711,9 @@ begin
Ecart:=round(abs(vm-moy));
if ecartMin>Ecart then // on choisit le mini de l'écart pour calculer le coeff de vitesse
begin
EcartMin:=Ecart;
// Affiche(intToSTR(consigne)+' '+FloatToSTRF(vm,ffFixed,5,2),clOrange);
case phaseVitesse of
EcartMin:=Ecart;
// Affiche(intToSTR(consigne)+' '+FloatToSTRF(vm,ffFixed,5,2),clOrange);
case phaseVitesse of
1 : begin consV1:=consigne;coeffV1:=consigne/vm;end; // coefficient du train sauvegarde dans train
2 : begin consV2:=consigne;coeffV2:=consigne/vm;end; // coeff = Consigne (crans) / Vitesse en (cm/s)
3 : begin consV3:=consigne;coeffV3:=consigne/vm;calcul_equations_coeff(indexTrain);end;
@@ -17162,7 +17126,7 @@ begin
etat:=Tablo_Action[i].tabloop[ida].etat;
adr:=Tablo_Action[i].tabloop[ida].adresse;
Affiche(st+' Bouton TCO '+intToSTR(adr)+' à '+intToSTR(etat),clYellow);
if (adr<=0) or (adr>100) then exit;
if (adr<=0) or (adr>MaxMemoires) then exit;
BoutonTCO[adr].etat:=etat;
affiche_cellule(BoutonTCO[adr].idtco,BoutonTCO[adr].x,BoutonTCO[adr].y);
end;
@@ -17172,21 +17136,21 @@ begin
adr:=Tablo_Action[i].tabloop[ida].adresse;
etat:=Tablo_Action[i].tabloop[ida].etat;
Affiche(st+' Mémoire '+intToSTR(adr)+' à '+intToSTR(etat),clYellow);
if (adr<=0) or (adr>100) then exit;
if (adr<0) or (adr>MaxMemoires) then exit;
Memoire[adr]:=etat;
end;
if op=ActionIncMemoire then
begin
adr:=Tablo_Action[i].tabloop[ida].adresse;
if (adr<=0) or (adr>100) then exit;
if (adr<0) or (adr>MaxMemoires) then exit;
inc(Memoire[adr]);
Affiche(st+' Incrémente mémoire '+intToSTR(adr)+' - Nouvelle valeur='+intToSTR(memoire[adr]),clYellow);
end;
if op=ActionDecMemoire then
begin
adr:=Tablo_Action[i].tabloop[ida].adresse;
if (adr<=0) or (adr>100) then exit;
if (adr<0) or (adr>MaxMemoires) then exit;
dec(Memoire[adr]);
Affiche(st+' Decrémente mémoire '+intToSTR(adr)+' - Nouvelle valeur='+intToSTR(memoire[adr]),clYellow);
end;
@@ -17210,7 +17174,6 @@ begin
until (i>nb) or sort;
end;
// traite l'évènement vitesse train - appelé depuis réception trame CDM ou vitesse_loco
// stocke la vitesse dans trains[].vitesseCons
procedure Event_vitesse(adr: integer ;train : string;vitesse : integer);
@@ -19397,9 +19360,10 @@ begin
end;
numSocket:= Tablo_periph[index].numComposant;
com:=nil;
case numSocket of
0 : begin result:=false;exit;end;
1 : com:=formprinc.ClientsocketCde1;
2 : com:=formprinc.ClientSocketCde2;
end;
@@ -19738,9 +19702,60 @@ begin
convert_VK:=s;
end;
procedure explore_CDM_DGI(r : string);
var Sr : TSearchRec;
s : string; // zizi
i,j : integer;
begin
r:=r+'\CDM_DGI\';
Nbre_Interfaces_CDM:=0;
i:=0;
if FindFirst(r+'*.*', faAnyFile, SR) = 0 then
begin
repeat
s:=lowercase(sr.Name);
if (s<>'.') and (s<>'..') then
begin
inc(i);
Interfaces_CDM[i]:=s;
end;
until (FindNext(sr)<>0);
FindClose(sr);
end;
Nbre_Interfaces_CDM:=i;
// trier par ordre alpha
for i:=1 to Nbre_Interfaces_CDM-1 do
begin
if Interfaces_CDM[i+1]<Interfaces_CDM[i] then
begin
s:=Interfaces_CDM[i];
Interfaces_CDM[i]:=Interfaces_CDM[i+1];
Interfaces_CDM[i+1]:=s;
end;
end;
// supprimer dummy
i:=1;
repeat
if pos('dummy',Interfaces_CDM[i])<>0 then
begin
for j:=i to Nbre_interfaces_cdm do
begin
Interfaces_CDM[j]:=Interfaces_CDM[j+1];
end;
dec(Nbre_interfaces_cdm);
end;
inc(i);
until i>Nbre_interfaces_cdm;
//for i:=1 to Nbre_Interfaces_CDM do Affiche(interfaces_cdm[i],clYellow);
end;
// Lance et connecte CDM rail si avecsocket=true. en sortie si CDM est lancé Lance_CDM=true,
function Lance_CDM(avecSocket : boolean) : boolean;
var i,retour : integer;
var i,n,retour : integer;
repertoire,s : string;
cdm_lanceLoc : boolean;
begin
@@ -19788,6 +19803,8 @@ begin
exit;
end;
explore_CDM_DGI(repertoire); // explorer le répertoire CDM_DGI
if AvecSocket and cdm_lanceLoc then
begin
Formprinc.caption:=af+' - '+lay;
@@ -19808,7 +19825,7 @@ begin
// démarre le serveur IP de CDM par simulation de touches
if serveurIPCDM_Touche then
begin
// démarre le serveur IP : il faut avoir chargé un réseau sinon le permier menu est fermé------------------------------------
// démarre le serveur IP : il faut avoir chargé un réseau sinon le premier menu est fermé------------------------------------
// prépare le tableau pour sendinput
KeybdInput(VK_MENU,0); // enfonce Alt
KeybdInput(Ord('C'),0); // enfonce C
@@ -19858,7 +19875,20 @@ begin
// la fenêtre interface est ouverte
// descendre le curseur n fois pour sélectionner le serveur
for i:=1 to ServeurInterfaceCDM-1 do
n:=1;
for i:=1 to Nbre_Interfaces_CDM do
begin
if (serveurInterfaceCDM=1) and (pos('xpressnet',interfaces_cdm[i])<>0) then n:=i;
if (serveurInterfaceCDM=2) and (pos('p50x',interfaces_cdm[i])<>0) then n:=i;
if (serveurInterfaceCDM=3) and (pos('sprog',interfaces_cdm[i])<>0) then n:=i;
if (serveurInterfaceCDM=4) and (pos('hsi',interfaces_cdm[i])<>0) then n:=i;
if (serveurInterfaceCDM=5) and (pos('dsi',interfaces_cdm[i])<>0) then n:=i;
if (serveurInterfaceCDM=6) and (pos('fis',interfaces_cdm[i])<>0) then n:=i;
if (serveurInterfaceCDM=7) and (pos('dccpp',interfaces_cdm[i])<>0) then n:=i;
if (serveurInterfaceCDM=8) and (pos('ecos',interfaces_cdm[i])<>0) then n:=i;
end;
for i:=1 to n-1 do
begin
KeybdInput(VK_DOWN,0);
KeybdInput(VK_DOWN,KEYEVENTF_KEYUP);
@@ -20694,7 +20724,6 @@ begin
procetape('Test CDM et son lancement');
if LanceCDM then Lance_CDM(true);
procetape('Fin cdm');
formprinc.Loco.Visible:=true;
// tenter la liaison vers CDM rail
procetape('Test connexion CDM');
@@ -20932,7 +20961,7 @@ begin
DureeMinute:=60;
index_seqAct:=0;
pointeurTaches:=0;
for i:=1 to 50 do
for i:=1 to MaxTaches do
begin
with taches[i] do
begin
@@ -20951,6 +20980,7 @@ begin
roulage:=false;
espY:=15;
etat_init_interface:=0;
Echelle:=0;
debug:=0;
heure:=0;
minute:=0;
@@ -20979,6 +21009,7 @@ begin
option_demitour:=false;
AffCompteur:=false;
debugroulage:=false;
VitCrans:=true;
mesureTrains:=false;
Modesombre:=false;
simuInterface:=false;
@@ -21016,7 +21047,7 @@ begin
init_operations;
init_conditions;
init_declencheurs;
for i:=1 to 100 do
for i:=1 to MaxMemoires do
begin
memoire[i]:=0;
with boutonTCO[i] do
@@ -21238,7 +21269,7 @@ begin
onConnect:=ClientInfoConnect;
OnDisconnect:=ClientInfoDisconnect;
OnError:=ClientInfoError;
Open; //zizi se connecte au serveur SC et envoie les infos
// Open; //zizi se connecte au serveur SC et envoie les infos
end;
//s:=GetCurrentDir;
@@ -21557,13 +21588,23 @@ begin
aiguillage[index_aig(9)].position:=const_droit;
}
procetape('Fin des initialisations');
// vérifier si le fichier de segments existe
fichier_module_CDM:=fileExists(NomModuleCDM);
// sinon reconstituer le nom et revérifier
if not(fichier_module_cdm) then
begin
s:=extractfileName(lay);
i:=pos('.',s);
if i<>0 then
begin
NomModuleCDM:=copy(s,1,i-1)+'_top.cdm';
fichier_module_CDM:=fileExists(NomModuleCDM);
end;
end;
formprinc.ButtonAffAnalyseCDM.Visible:=fichier_module_cdm;
if fichier_module_CDM then
begin
@@ -21834,6 +21875,8 @@ begin
b:=y1-pente*x1;
end;
// calcule les 2 équations de droite des coefficients
// pour les étalonnages des trains
procedure calcul_equations_coeff(indexTrain : integer);
@@ -21843,6 +21886,7 @@ begin
equation_droite(CoeffV1,CoeffV2,ConsV1,ConsV2,pente1,b1);
equation_droite(CoeffV2,CoeffV3,ConsV2,ConsV3,pente2,b2);
end;
courbe_train(indexTrain);
end;
// traite les taches par le timer
@@ -22087,13 +22131,14 @@ begin
if TpsTimeoutSL<=0 then
begin
TpsTimeoutSL:=450; // envoyer caractère toutes les 45 secondes
// indy
{$IFDEF AvecIdTCP}
s:=' ';
{$IF CompilerVersion >= 28.0}
ClientSocketIdInterface.IoHandler.write(RawToBytes(s,1),1);
{$ELSE}
ClientSocketIdInterface.Socket.Send(s,1)
{$IFEND}
{$IF CompilerVersion >= 28.0}
ClientSocketIdInterface.IoHandler.write(RawToBytes(s,1),1);
{$ELSE}
ClientSocketIdInterface.Socket.Send(s,1)
{$IFEND}
{$ELSE}
ClientSocketInterface.Socket.SendText(' ');
{$ENDIF}
@@ -22257,15 +22302,14 @@ begin
// change l'aiguille du compteur de vitesse du train i
with trains[i] do
begin
delta:=vitesseCons-VitesseCompteur;
delta:=vitesseCons-VitesseCompteur; // différence entre la vitesse à atteindre et l'actuelle
if delta<>0 then
begin
//Affiche('Delta '+intToSTR(Delta),clYellow);
a:=abs(delta);
if a>10 then IncrCompteur:=3 else IncrCompteur:=1;
if a<IncrCompteur then
vitesseCompteur:=vitesseCons; //-delta;
if abs(delta)>=IncrCompteur then
if a<IncrCompteur then vitesseCompteur:=vitesseCons;
if a>=IncrCompteur then
if vitesseCompteur<vitesseCons then
begin
inc(vitesseCompteur,IncrCompteur);
@@ -22278,8 +22322,8 @@ begin
end;
//Affiche('Appel '+intToSTR(vitesseCompteur),clYellow);
aiguille_compteur(1,idTrainClic,formCompteur[1]); // else aiguille_compteur(compteur,idTrainClic);
aiguille_compteur(i,i,compteurT[i].gb); // else aiguille_compteur(compteur,idTrainClic);
aiguille_compteur(1,idTrainClic,formCompteur[1]); // fenetre
aiguille_compteur(i,i,compteurT[i].gb); // compteurs des groupbox
end;
// calculer la vitesse instantanée du train en fonction des accel et des décel
@@ -22498,6 +22542,7 @@ begin
MsgSim:=false;
Affiche('Fin de simulation',clCyan);
StatusBar1.Panels[1].text:='';
ButtonArretSimu.Visible:=false;
end;
end;
inc(intervalle_courant);
@@ -24152,6 +24197,7 @@ begin
MsgSim:=false;
StopSimu:=true;
Affiche('Fin de simulation',clCyan);
ButtonArretSimu.Visible:=false;
end;
procedure TFormPrinc.OuvrirunfichiertramesCDM1Click(Sender: TObject);
@@ -24180,6 +24226,7 @@ begin
end;
closeFile(fte);
end;
ButtonArretSimu.Visible:=false;
end;
procedure TFormPrinc.ButtonAffTCOClick(Sender: TObject);
@@ -24203,30 +24250,7 @@ begin
end;
end;
procedure TFormPrinc.locoClick(Sender: TObject);
var i,adr,vit,erreur : integer;
s : string;
begin
consigne_train(1);
exit;
s:=editAdrTrain.Text;
val(s,adr,erreur);
if (erreur<>0) or (adr<0) then exit;
//if not(portCommOuvert) and not(parSocketLenz) and not(CDM_Connecte) then exit;
s:=editVitesse.Text;
val(s,vit,erreur);
if (erreur<>0) or (vit<-128) or (vit>127) then exit;
i:=0;s:='';
if combotrains.itemindex<>-1 then
begin
s:=combotrains.Items[combotrains.itemindex];
i:=index_train_nom(s);
end;
Affiche('Commande vitesse train '+s+' ('+intToSTR(adr)+')',cllime);
vitesse_loco(s,i,adr,vit,10,0);
if s='' then s:=intToSTR(adr);
end;
// pour déplacer l'ascenseur de l'affichage automatiquement en bas
procedure TFormPrinc.FenRichChange(Sender: TObject);
@@ -24648,7 +24672,7 @@ begin
Maj_icone_train(Image_Train[IdTrainClic],IdTrainClic,clWhite);
IdTrainClic:=i;
EditAdrTrain.Text:=intToSTR(trains[IdTrainClic].adresse);
editVitesse.Text:=intToSTR(trains[idTrainClic].vitesseCons);
//editVitesse.Text:=intToSTR(trains[idTrainClic].vitesseCons);
Maj_icone_train(Image_Train[IdTrainClic],IdTrainClic,$e0e0e0);
//mise à jour compteur train
@@ -24773,7 +24797,7 @@ begin
if clicTBFen or clicTBGB then exit;
if affevt then Affiche('Changement TrackBarVit',clyellow);
clicTBTrain:=true;
EditVitesse.Text:=intToSTR(TrackBarVit.position);
//EditVitesse.Text:=intToSTR(TrackBarVit.position);
s:=editAdrTrain.Text;
val(s,adr,erreur);
if (erreur<>0) or (adr<0) then
@@ -24782,7 +24806,7 @@ begin
exit;
end;
//if not(portCommOuvert) and not(parSocketLenz) and not(CDM_Connecte) then exit;
s:=editVitesse.Text;
//s:=editVitesse.Text;
val(s,vit,erreur);
if (erreur<>0) or (vit<-126) or (vit>126) then
begin
@@ -24807,9 +24831,9 @@ end;
procedure TFormPrinc.EditVitesseChange(Sender: TObject);
var i,e : integer;
begin
if pasChgTBV then exit;
{ if pasChgTBV then exit;
val(EditVitesse.Text,i,e);
if (e=0) and (i>=-127) and (i<=128) then TrackBarVit.position:=i;
if (e=0) and (i>=-127) and (i<=128) then TrackBarVit.position:=i;}
end;
procedure TFormPrinc.ButtonEnvClick(Sender: TObject);
@@ -27842,8 +27866,8 @@ begin
' Roulage='+intToSTR(trains[i].roulage)+
' Vitesse='+intToSTR(trains[i].vitesseCons)+
' DernierDet='+intToSTR(trains[i].dernierDet)+
' sur canton '+intToSTR(trains[i].canton)+
' BlocUSB= '+intToSTR(trains[i].BlocUSB)
' sur canton='+intToSTR(trains[i].canton)+
' BlocUSB='+intToSTR(trains[i].BlocUSB)
,clyellow);
// ' DetDepart='+intToSTR(trains[i].Det_depart)+' DetFin='+intToSTR(trains[i].Det_fin),clYellow);
end;
@@ -27879,8 +27903,8 @@ end;
procedure TFormPrinc.Button0Click(Sender: TObject);
begin
EditVitesse.Text:='0';
TrackBarVit.Position:=0;
{ EditVitesse.Text:='0';
TrackBarVit.Position:=0; }
end;
procedure TFormPrinc.Compilerlabasededonnes1Click(Sender: TObject);
@@ -28117,7 +28141,6 @@ procedure TFormPrinc.ButtonEssaiClick(Sender: TObject);
var i : integer;
begin
test_canton(0,518,det,1,aig,i);
end;
procedure TFormPrinc.TrackBarZCChange(Sender: TObject);
@@ -28150,8 +28173,17 @@ begin
onglet:=PageControl.ActivePageIndex;
end;
procedure TFormPrinc.Dtacherlecompteur1Click(Sender: TObject);
begin
change_clic_train(IdTrainClic);
formCompteur[1].Show;
end;
procedure TFormPrinc.PopupMenuCompteursPopup(Sender: TObject);
var menu: TpopUpMenu;
begin
menu:=Sender as tPopUpMenu;
menu.Items[1].caption:='Extraire le compteur du train '+trains[IdTrainClic].nom_train;
end;
end.
+10 -2
View File
@@ -253,6 +253,7 @@ procedure maj_infos(idtrain : integer);
var i,j,PixelLength : integer;
s : string;
begin
if idtrain<1 then exit;
formRouteTrain.comboBoxTrains.Clear;
formRouteTrain.ListBoxRM.Clear;
for i:=1 to NTrains do
@@ -291,7 +292,11 @@ begin
ButtonRouler1tr.caption:='Rouler le train '+trains[idtrain].nom_train;
ButtonRouler1tr.enabled:=true;
end
else LabelRC.Caption:='Pas de route courante affectée au train '+trains[idtrain].nom_train;
else
begin
LabelRC.Caption:='Pas de route courante affectée au train '+trains[idtrain].nom_train;
labelroute.caption:='Pas de route courante affectée au train '+trains[idtrain].nom_train;
end;
j:=trains[idtrain].routePref[0][0].adresse;
TabSheetRM.Caption:='Routes mémorisées ('+intToSTR(j)+')';
@@ -318,7 +323,7 @@ begin
if (trains[idTrain].route[0].adresse=0) and (trains[idTrain].routePref[1][0].adresse=0) then
begin
labelroute.caption:='Pas de route affectée au train '+trains[idtrain].nom_train;
ButtonRouler1tr.caption:=' ';
ButtonRouler1tr.enabled:=false;
end;
@@ -732,6 +737,9 @@ begin
PageControlRoutes.ActivePageIndex:=0;
ButtonM.hint:='Affecter la route à ce train lors de sa sauvegarde et '+#13+'affecter le train au canton dans le sens de démarrage de la route';
couleurs_RouteTrains;
ComboBoxTrains.ItemIndex:=0;
IndexTrainFR:=1;
maj_infos(indexTrainFR);
end;
// choisir cette route mémorisée
+16 -2
View File
@@ -24,8 +24,8 @@ object FormTCO: TFormTCO
OnKeyPress = FormKeyPress
OnMouseWheel = FormMouseWheel
DesignSize = (
997
548)
1005
556)
PixelsPerInch = 96
TextHeight = 13
object LabelZoom: TLabel
@@ -1636,6 +1636,20 @@ object FormTCO: TFormTCO
Hint = 'Dessine le TCO '#224' la souris'
OnClick = DessinerleTCO1Click
end
object N11: TMenuItem
Caption = '-'
end
object Modeslection1: TMenuItem
Caption = 'Mode s'#233'lection'
OnClick = Modeslection1Click
end
object Modedplacement1: TMenuItem
Caption = 'Mode d'#233'placement'
OnClick = Modedplacement1Click
end
object N12: TMenuItem
Caption = '-'
end
object ConfigurationduTCO1: TMenuItem
Caption = 'Configuration du TCO'
OnClick = ConfigurationduTCO1Click
+384 -83
View File
@@ -166,6 +166,10 @@ type
ImageBt0Bistable: TImage;
ImageBt1Bistable: TImage;
Mmoiredezone1: TMenuItem;
N11: TMenuItem;
Modeslection1: TMenuItem;
Modedplacement1: TMenuItem;
N12: TMenuItem;
//TimerTCO: TTimer;
procedure FormCreate(Sender: TObject);
procedure FormActivate(Sender: TObject);
@@ -411,6 +415,8 @@ type
function index_TCOMainMenu : integer;
procedure Mmoiredezone1Click(Sender: TObject);
procedure EditAdrElementExit(Sender: TObject);
procedure Modeslection1Click(Sender: TObject);
procedure Modedplacement1Click(Sender: TObject);
public
{ Déclarations publiques }
end;
@@ -534,7 +540,7 @@ type
det1,det2 : integer; // détecteurs contigus, changement en fonction des aiguillages
SensEl1,SensEl2 : integer;// indique le sens de l'élément par rapport au canton
SensCirc : integer; // sens de la circulation des trains dans canton tous sens=0 Gauche=1 Droit=2 Haut=3 Bas=4
//
// dupliqué dans TCO[].sensCirc
signal : integer; // adresse du signal associé (le canton est avant le signal)
NomTrain : string; // nom du train sur le canton
indexTrain : integer; // index du train sur le canton
@@ -563,14 +569,14 @@ var
couleurAdresse,cltexte,CoulFonte,clCoulGrilleSV,clvoiesSV,
clFoncSV,clGrilleSV,clCoulCantonLibreSV,clCoulCantonOccupeSV : Tcolor;
TamponAffecte,TCO_modifie,prise_N,affPosFil,clicsouris,
TamponAffecte,TCO_modifie,prise_N,affPosFil,clicsouris,modeGlisse,
clicTCO,piloteAig,BandeauMasque,eval_format,sauve_tco,prise_droit,prise_haut,deja_calcule,
prise_bas,prise_gauche,prise_NE,prise_NO,prise_SE,prise_SO,ligneAffiche,colonneAffiche,
TCOActive,TCOCree,ancienok,dbleClicTCO,auto_tcurs,EvtClicDet,SelecBouge,NB : boolean;
HtImageTCO,LargImageTCO,XminiSel,YminiSel,Temposouris,ligne_supprime,JeuCouleurs,
XmaxiSel,YmaxiSel,AncienXMiniSel,AncienXMaxiSel,AncienYMiniSel,AncienYMaxiSel,
Xclic,Yclic,XClicCellInserer,YClicCellInserer,RatioC,ModeCouleurCanton,
Xclic,Yclic,XClicCellInserer,YClicCellInserer,RatioC,ModeCouleurCanton,xSourisClic,ySourisClic,
AncienXClicCell,AncienYClicCell,TCODrag,epaisseur_voies,ASourisx,ASourisy,TpsBougeSouris,
Epaisseur,oldX,oldY,offsetSourisY,offsetSourisX,AvecVerifIconesTCO,indexTrace,IndexTCOCourant,
ancienTraceX,ancienTraceY,rangUndo,NbreTCO,IndexTCOCreate,deltaXrect,deltaYrect,
@@ -705,6 +711,7 @@ procedure Affiche_temps_arret(IdTrain,tps : integer);
procedure titre_fenetre(indexTCO : integer);
function IsVoieDroite(i : integer) : boolean;
function trouve_canton(el1 : integer;tel1 : tequipement;el2 : integer;tel2 : tequipement) : integer;
procedure origine_canton(var x,y : integer);
implementation
@@ -2818,7 +2825,7 @@ end;
// renvoie vrai si l'élément i est un canton V
function IsCantonV(i : integer) : boolean; overload;
begin
result:=((i>=Id_cantonV) and (i<Id_CantonV+9));
result:=((i>=Id_cantonV) and (i<=Id_CantonV+9));
end;
// 2eme forme
@@ -2826,7 +2833,7 @@ function IsCantonV(indexTCO,x,y : integer) : boolean; overload;
var b : integer;
begin
b:=tco[indexTCO,x,y].BImage;
result:=(b>=Id_cantonV) and (b<Id_CantonV+9);
result:=(b>=Id_cantonV) and (b<=Id_CantonV+9);
end;
// renvoie vrai si l'élément i est un aiguillage ou une TJD/S ou un croisement
@@ -2988,7 +2995,7 @@ begin
case repr of
0,1 : yt:=(hauteurCell[indexTCO] div 2)-(round(c.textHeight(s) div 2)); // au milieu Y
2 : yt:=1; // haut
3 : yt:=hauteurCell[indexTCO]-round(2*c.textWidth(s)); // bas
3 : yt:=hauteurCell[indexTCO]-round(c.textHeight(s)); // bas
5 : begin // double centré XY
r.Left:=x0;
r.Top:=y0+3;
@@ -7001,7 +7008,8 @@ begin
NumC:=TCO[indexTCO,x,y].NumCanton; // numéro du canton, pas son index;
i:=index_canton_numero(NumC); // index du canton "piedfeu"
if i=0 then begin Affiche('Erreur 19H : index canton nul en TCO'+intToSTR(indexTCO)+' x='+intToSTR(x)+' y='+intToSTR(y),clred);exit;end;
if i=0 then begin
Affiche('Erreur 19H : index canton nul en TCO'+intToSTR(indexTCO)+' x='+intToSTR(x)+' y='+intToSTR(y),clred);exit;end;
indexTrain:=TCO[IndexTCO,x,y].train;
if (indexTrain<0) or (indexTrain>NTrains) then
@@ -7228,7 +7236,7 @@ begin
i:=TCO[indexTCO,x,y].NumCanton; // numéro du canton
i:=index_canton_numero(i); // index du canton
if i=0 then begin Affiche('Erreur 19V : canton nul',clred);exit;end;
if i=0 then begin Affiche('Erreur 19V : canton nul en TCO'+intToSTR(IndexTCO)+' x='+intToSTR(x)+' y='+intToSTR(y),clred);exit;end;
{
s:=canton[i].nom;
@@ -11320,7 +11328,7 @@ begin
else
if isCantonV(Bimage) then
begin
y:=y-(Bimage-Id_cantonH); // revenir à la coordonnée Y du début du canton
y:=y-(Bimage-Id_cantonV); // revenir à la coordonnée Y du début du canton
end
else
begin
@@ -11454,10 +11462,10 @@ begin
Font.Color:=tco[indextco,x,y].coulFonte;
Font.Name:='Arial';
//Font.Style:=style(tco[indextco,x,y].FontStyle);
xt:=round(4*frxGlob[indexTCO]);
xt:=round(6*frxGlob[indexTCO]);
case repr of
1 : yt:=(hauteurCell[indexTCO] div 2)-round(7*fryGlob[indexTCO]); // milieu
2 : yt:=0; // haut
2 : yt:=2; // haut
3 : yt:=hauteurCell[indexTCO]-round(17*fryGlob[indexTCO]); // bas
end;
@@ -11499,7 +11507,7 @@ begin
font.orientation:=0;
{$IFEND}
TextOut(xOrg+xt,Yorg+yt,s);
end;
end;
end;
if ((Bimage=8) or (Bimage=10) ) and (adresse<>0) then
@@ -11959,6 +11967,9 @@ begin
end;
{$IFEND}
ModeSlection1.checked:=false;
ModeDplacement1.Checked:=true;
modeGlisse:=true;
affPosFil:=true;
visible:=false; // ne s'affiche pas par défaut et évite l'effet fenetre fantome.
ClTexte:=$00FF00;
@@ -14428,6 +14439,8 @@ begin
end;
end;
//Affiche('Nel canton 12='+intToSTR(canton[12].Nelements),clYellow);
supprime_canton(index);
end;
@@ -14469,7 +14482,7 @@ end;
// insère une colonne dans le Tco indexTCO à la colonne "colonne"
procedure insere_colonne(indexTCO,colonne : integer);
var x,y,i,Bim : integer;
var x,y,i,Bim,xx,n,xc,yc : integer;
begin
if NbreCellX[indexTCO]>=MaxCellX then exit;
@@ -14477,16 +14490,36 @@ begin
for i:=1 to nCantons do
begin
x:=canton[i].x;
if x>=colonne then
inc(canton[i].x);
if x>=colonne then inc(canton[i].x);
end;
// copie pour décaler la nouvelle colonne
xc:=0;
// voir si la colonne contient un canton horz, et réajuster son nombre
for y:=1 to NbreCellY[indexTCO] do
begin
if isCantonH(tco[indexTCO,colonne,y].BImage) then
begin
yc:=y;xc:=colonne;
origine_canton(xc,yc);
n:=tco[indexTCO,xc,yc].NumCanton;
if n<>0 then
begin
i:=index_canton_numero(n);
//Affiche('Canton '+intToSTR(n)+' réajusté',clOrange);
if canton[i].Nelements<10 then
begin
inc(canton[i].Nelements);
inc(tco[indexTCO,xc,yc].FeuOriente);
end
end;
end;
end;
// insère la nouvelle colonne
for x:=NbreCellX[indexTCO] downto colonne do
begin
for y:=1 to NbreCellY[indexTCO] do
begin
Bim:=tco[indexTco,x,y].Bimage;
tco[indextco,x+1,y]:=tco[indextco,x,y];
end;
end;
@@ -14500,11 +14533,54 @@ begin
end;
inc(NbreCellX[indexTCO]);
// verifier si les cantons horizontaux: corriger leurs origine y et ses Bimage
for x:=1 to NbreCellX[indexTCO] do
for y:=1 to NbreCellY[indexTCO] do
begin
Bim:=tco[indextco,x,y].BImage;
if Bim=id_CantonH then
begin
i:=tco[indexTCO,x,y].NumCanton;
i:=Index_canton_numero(i);
n:=canton[i].Nelements;
canton[i].x:=x; // origine X
i:=0;
for xx:=x to x+n-1 do // parcourir les Bimage du canton
begin
tco[indexTCO,xx,y].BImage:=Id_CantonH+i;
inc(i);
end;
if isCantonH(tco[indexTCO,x+n,y].BImage) then tco[indexTCO,x+n,y].BImage:=0;
end;
end;
// verifier si les cantons horz: corriger leurs origine y et ses Bimage
for y:=1 to NbreCellY[indexTCO] do
for x:=1 to NbreCellX[indexTCO] do
begin
Bim:=tco[indextco,x,y].BImage;
if Bim=id_CantonH then
begin
i:=tco[indexTCO,x,y].NumCanton;
i:=Index_canton_numero(i);
n:=canton[i].Nelements;
canton[i].x:=x; // origine X
i:=0;
for xx:=x to x+n-1 do // parcourir les Bimage du canton
begin
tco[indexTCO,xx,y].BImage:=Id_CantonH+i;
inc(i);
end;
if isCantonH(tco[indexTCO,x+n,y].BImage) then tco[indexTCO,x+n,y].BImage:=0;
end;
end;
tco_modifie:=true;
end;
procedure insere_ligne(indexTCO,ligne : integer);
var x,y,i,Bim : integer;
var x,y,i,n,yy,xc,yc,Bim : integer;
begin
if NbreCellY[indexTCO]>=MaxCellY then exit;
@@ -14515,13 +14591,34 @@ begin
if y>=ligne then inc(canton[i].y);
end;
yc:=0;
// voir si la ligne contient un canton vertical, réajuster son nombre
for x:=1 to NbreCellX[indexTCO] do
begin
if isCantonV(tco[indexTCO,x,ligne].BImage) then
begin
xc:=x;yc:=ligne;
origine_canton(xc,yc);
n:=tco[indexTCO,xc,yc].NumCanton;
if n<>0 then
begin
i:=index_canton_numero(n);
//Affiche('Canton '+intToSTR(n)+' réajusté',clOrange);
if canton[i].Nelements<10 then
begin
inc(canton[i].Nelements);
inc(tco[indexTCO,xc,yc].FeuOriente);
end
end;
end;
end;
// insère la ligne
for y:=NbreCellY[indexTCO] downto ligne do
for x:=1 to NbreCellX[indexTCO] do
begin
Bim:=tco[indexTco,x,y].Bimage;
tco[indextco,x,y+1]:=tco[indextco,x,y];
end;
end;
// efface la nouvelle ligne
for x:=1 to NbreCellX[indexTCO] do
@@ -14532,11 +14629,83 @@ begin
end;
inc(NbreCellY[indexTCO],1);
// verifier si les cantons verticaux: corriger leurs origine y et ses Bimage
for y:=1 to NbreCellY[indexTCO] do
for x:=1 to NbreCellX[indexTCO] do
begin
Bim:=tco[indextco,x,y].BImage;
if Bim=id_CantonV then
begin
i:=tco[indexTCO,x,y].NumCanton;
i:=Index_canton_numero(i);
n:=canton[i].Nelements;
canton[i].y:=y; // origine Y
i:=0;
for yy:=y to y+n-1 do // parcourir les Bimage du canton
begin
tco[indexTCO,x,yy].BImage:=Id_CantonV+i;
inc(i);
end;
if isCantonV(tco[indexTCO,x,y+n].BImage) then tco[indexTCO,x,y+n].BImage:=0;
end;
end;
tco_modifie:=true;
end;
// crée un canton
// si numéro=0, un numéro sera attribué
// si numéro<>0 ce numéro sera attribué
procedure cree_canton(indexTCO,x,y,numero : integer;Horz : boolean);
var maxi,libre,nc,i : integer;
begin
if numero=0 then
begin
maxi:=0; Libre:=0;
for nc:=1 to nCantons do
begin
if canton[nc].numero>maxi then maxi:=canton[nc].numero; // trouve le numéro maxi de canton
if (nc>=2) and (nc<nCantons) then if canton[nc].numero+1<>canton[nc+1].numero then
begin
libre:=canton[nc].numero+1;
for i:=1 to nCantons do if canton[i].numero=Libre then Libre:=0;
end;
end;
inc(maxi);
if libre<>0 then Maxi:=Libre;
numero:=maxi;
end;
inc(Ncantons);
canton[Ncantons].horizontal:=Horz;
canton[Ncantons].numero:=numero;
canton[Ncantons].Nelements:=3;
canton[Ncantons].x:=x;
canton[Ncantons].y:=y;
canton[Ncantons].nom:='';
canton[Ncantons].Ntco:=indexTCO;
canton[Ncantons].indexTrain:=0;
canton[Ncantons].adresseTrain:=0;
canton[Ncantons].NomTrain:='';
canton[Ncantons].SensLoco:=0;
canton[Ncantons].NumcantonOrg:=0;
canton[Ncantons].NumCantonDest:=0;
canton[Ncantons].bouton:=0;
tco[indextco,x,y].Texte:='';
tco[indexTCO,x,y].FeuOriente:=3; // nbre éléments du canton
tco[indexTCO,x,y].NumCanton:=Numero;
if Horz then for i:=1 to 3 do tco[indextco,x+i-1,y].BImage:=id_cantonH+i-1;
if not(Horz) then for i:=1 to 3 do tco[indextco,x,y+i-1].BImage:=id_cantonV+i-1;
dessin_canton(Ncantons,0);
renseigne_canton(Ncantons);
end;
procedure Annule(indextco : integer);
var x,y,xu,yu,Xplace,yplace,adresse,i : integer;
var x,y,xu,yu,Xplace,n,yplace,adresse,i,Bimage,nc,
Xcanton,Ycanton : integer;
begin
if (TamponTCO_org.numTCO<>indexTCO) then exit;
@@ -14555,6 +14724,27 @@ begin
if (xPlace<=NbreCellX[indexTCO]) and (yPlace<=NbreCellY[indexTCO]) then
begin
Bimage:=tampontco[x,y].BImage;
if (Bimage=Id_cantonH) or (Bimage=Id_cantonV) then
begin
//Affiche('xy='+IntToSTR(x)+','+intToSTR(y)+' Bimage='+intToSTR(Bimage),clYellow);
Xcanton:=x;Ycanton:=y;
origine_canton(Xcanton,Ycanton);
if xcanton=0 then // cas d'un canton supprimé
begin
// reconstituer le canton
n:=TamponTCO[x,y].FeuOriente;
nc:=TamponTCO[x,y].NumCanton;
Cree_canton(indexTCOCourant,x,y,nc,isCantonH(Bimage));
i:=Index_Canton_numero(nc);
canton[i].Nelements:=n;
xcanton:=x;
ycanton:=y;
end;
i:=Index_Canton_numero(tco[indexTCOcourant,xcanton,ycanton].NumCanton);
if i=0 then Affiche('Annule : canton inconnu',clred); //else affiche('Canton '+intToSTR(tco[indexTCOcourant,xcanton,ycanton].NumCanton),clyellow);
end;
tco[indextco,xPlace,yPlace]:=tampontco[x,y];
if tco[indextco,xPlace,yPlace].Bimage=Id_signal then
begin
@@ -15177,6 +15367,7 @@ begin
//affiche('Rang undo='+intToSTR(rangundo),clYellow);
end;
procedure end_Drag(icone,x,y : integer;Sender, Target: TObject);
var s : string;
indexTCO,i,xclic,Yclic,bim,nc,maxi,libre : integer;
@@ -15285,7 +15476,7 @@ begin
canton[Ncantons+1].x:=Xclic;
canton[Ncantons+1].y:=Yclic;
canton[Ncantons+1].Ntco:=indexTCO;
renseigne_canton(Ncantons+1,Bim=1);
renseigne_canton(Ncantons+1,Bim=1);
if (canton[Ncantons+1].typ1<>det) and (canton[Ncantons+1].typ2<>det) then
begin
s:='Un canton doit avoir un détecteur comme élément adjacent';
@@ -15294,44 +15485,7 @@ begin
Affiche_info(indexTCO,x,y,s);
exit;
end;
// pour le numéro de canton,
maxi:=0; Libre:=0;
for nc:=1 to nCantons do
begin
if canton[nc].numero>maxi then maxi:=canton[nc].numero;
if (nc>=2) and (nc<nCantons) then if canton[nc].numero+1<>canton[nc+1].numero then
begin
libre:=canton[nc].numero+1;
for i:=1 to nCantons do if canton[i].numero=Libre then Libre:=0;
end;
end;
inc(maxi);
if libre<>0 then Maxi:=Libre;
inc(Ncantons);
canton[Ncantons].horizontal:=Bim=1;
canton[Ncantons].numero:=Maxi;
canton[Ncantons].Nelements:=3;
canton[Ncantons].x:=Xclic;
canton[Ncantons].y:=Yclic;
canton[Ncantons].nom:='';
canton[Ncantons].Ntco:=indexTCO;
canton[Ncantons].indexTrain:=0;
canton[Ncantons].adresseTrain:=0;
canton[Ncantons].NomTrain:='';
canton[Ncantons].SensLoco:=0;
canton[Ncantons].NumcantonOrg:=0;
canton[Ncantons].NumCantonDest:=0;
canton[Ncantons].bouton:=0;
tco[indextco,XClic,YClic].Texte:='';
tco[indexTCO,XClic,YClic].FeuOriente:=3; // nbre éléments du canton
tco[indexTCO,XClic,YClic].NumCanton:=Maxi;
if Bim=1 then for i:=1 to 3 do tco[indextco,XClic+i-1,YClic].BImage:=id_cantonH+i-1;
if Bim=20 then for i:=1 to 3 do tco[indextco,Xclic,YClic+i-1].BImage:=id_cantonV+i-1;
dessin_canton(Ncantons,0);
renseigne_canton(Ncantons);
cree_canton(IndexTCO,xClic,yClic,0,Bim=1); // 0 = attribuer un nouveau numéro
end;
end;
@@ -15801,7 +15955,7 @@ begin
end;
if dernier then
begin
// NE
// NE
if testbit(tco[indextco,x+1,y-1].liaisons,6) then result:=34 else result:=18;
end;
if not(premier) and not(dernier) then result:=23;
@@ -16001,7 +16155,7 @@ begin
if quadrant=Sud then result:=27;
end;
28 : begin
28 : begin
if quadrant=SudEst then
begin
if premier then result:=28;
@@ -16145,7 +16299,10 @@ begin
if idcantonSelect=0 then exit;
s:='Canton ';
s:=s+intToSTR(canton[IdCantonSelect].numero)+' '+canton[idcantonselect].nom;
s:=s+intToSTR(canton[IdCantonSelect].numero)+' '+canton[idcantonselect].nom+#13;
s:=s+'Origine x='+intToSTR(canton[IdCantonSelect].x)+' y='+intToSTR(canton[IdCantonSelect].y)+
' Long='+intToSTR(canton[IdCantonSelect].Nelements);
s1:=s;
i:=canton[IdCantonSelect].indexTrain;
if (i>0) and (i<=Ntrains) then
@@ -16183,10 +16340,14 @@ var position : Tpoint;
begin
if affEvt then affiche('ImageTCO mouse down',clYellow);
if Tdoubleclic<>0 then exit;
indexTCO:=index_tco(sender);
if indexTCO<1 then exit;
GetCursorPos(Position);
xSourisClic:=x;
ySourisClic:=y;
Position:=ImageTCO.screenToCLient(Position);
larg:=LargeurCell[indextco];
@@ -16224,12 +16385,15 @@ begin
end;
// clic sur canton
//if isCanton(Bimage) then
if pc then
begin
{
IdCantonClic:=index_canton(indexTCO,xclic,yclic);
if IdCantonClic>0 then
begin
s:='Canton '+intToSTR(canton[IdCantonClic].numero)+' '+canton[idcantonClic].nom+#13;
s:=s+'Origine x='+intToSTR(canton[IdCantonClic].x)+' y='+intToSTR(canton[IdCantonClic].y)+#13;
i:=canton[IdCantonClic].indexTrain;
if (i>0) and (i<=Ntrains) then
begin
@@ -16237,7 +16401,7 @@ begin
s:=s+'Adresse='+intToSTR(trains[i].adresse);
end;
ImageTCO.hint:=s;
end;
end; }
end
else
@@ -16469,7 +16633,7 @@ begin
formRoute.Close;
selec_canton(indexTCO);
actualise(indexTCO); // actualise la fenetre de paramétrage
if IdcantonSelect>0 then ImageTCO.Hint:='canton '+intToSTR(canton[IdCantonSelect].numero);
//if IdcantonSelect>0 then ImageTCO.Hint:='canton '+intToSTR(canton[IdCantonSelect].numero);
exit;
end;
end;
@@ -16839,7 +17003,7 @@ end;
procedure TFormTCO.ImageTCOMouseMove(Sender: TObject; Shift: TShiftState;X, Y: Integer);
var r : Trect;
Bim,idTrain,indexTCO,xMiniSelP,yMiniSelP,xMaxiSelP,yMaxiSelP,larg,haut,IdCanton : integer;
Bim,idTrain,indexTCO,dx,dy,xMiniSelP,yMiniSelP,xMaxiSelP,yMaxiSelP,larg,haut,IdCanton : integer;
ok : boolean;
begin
// if affevt then Affiche('ImageTCOMouseMove',clLime);
@@ -16895,6 +17059,15 @@ begin
PimageTCO[indexTCO].Cursor:=crHandPoint;
end
else PimageTCO[indexTCO].Cursor:=CrDefault;
if clicSouris and modeGlisse then
begin
dx:=(xSourisClic-x) div 2;
dy:=(ySourisClic-y) div 2;
if dx<>0 then ScrollBox.HorzScrollBar.Position:=ScrollBox.HorzScrollBar.Position+dx;
if dy<>0 then ScrollBox.VertScrollBar.Position:=ScrollBox.VertScrollBar.Position+dy;
end;
end;
if idcantonselect<>0 then exit;
@@ -18289,7 +18462,7 @@ end;
procedure TFormTCO.SupprimeLigneClick(Sender: TObject);
var x,y,i,indexTCO,n : integer;
var x,y,i,yy,indexTCO,n,xc,yc,Bimage : integer;
c : tcomponent;
begin
c:=popupmenu1.PopupComponent ; // imageTCO
@@ -18321,38 +18494,98 @@ begin
tampontco[x,y]:=tco[indextco,x,y];
end;
// balayer les cantons pour corriger leurs coordonnées
// balayer les cantons pour supprimer canton horizontal
for i:=1 to nCantons do
begin
y:=canton[i].y;
n:=canton[i].numero;
if (canton[i].horizontal) and (y=ligne_Supprime) then
begin
//supprimer le canton
//supprimer le canton horizontal
supprime_remplace_canton(i);
Affiche('canton '+intToSTR(n)+' supprimé',clOrange);
end
else if y>=ligne_Supprime then dec(canton[i].y);
end;
// supression ligne
for y:=YClicCell[indexTCO] to NbreCellY[indexTCO]-1 do
yc:=0;
// voir si la ligne contient un canton vertical, réajuster son nombre
for x:=1 to NbreCellX[indexTCO] do
begin
for x:=1 to NbreCellX[indexTCO] do tco[indextco,x,y]:=tco[indextco,x,y+1];
if isCantonV(tco[indexTCO,x,ligne_supprime].BImage) then
begin
xc:=x;yc:=ligne_Supprime;
origine_canton(xc,yc);
n:=tco[indexTCO,xc,yc].NumCanton;
if n<>0 then
begin
i:=index_canton_numero(n);
if canton[i].Nelements=3 then
begin
Affiche('Le canton '+intToSTR(n)+' est supprimé car il comporte moins de 3 cases',clOrange);
supprime_remplace_canton(i);
end
else
begin
//Affiche('Diminution Canton '+intToSTR(n)+' réajusté',clOrange);
dec(canton[i].Nelements);
dec(tco[indexTCO,xc,yc].FeuOriente);
end;
end;
end;
end;
// décalage TCO sur ligne supprimée
for y:=ligne_supprime to NbreCellY[indexTCO]-1 do
begin
for x:=1 to NbreCellX[indexTCO] do
begin
// ne pas écraser ler 1er élément d'un cantonV car il contient le nombre
if (tco[indexTco,x,y].BImage<>id_cantonV) then tco[indextco,x,y]:=tco[indextco,x,y+1];
end;
end;
// supprimer la dernière ligne du tco
for x:=1 to NbreCellX[indexTCO] do
begin
raz_cellule(indextco,x,NbreCellY[indexTCO]);
tco[indextco,x,NbreCellY[indexTCO]].Couleurfond:=Clfond[IndexTCO];
end;
dec(NbreCellY[indexTCO]);
// décrémenter les coordonnées Y des cantons dont la ligne est supérieure à la ligne supprimée
for i:=1 to nCantons do
begin
y:=canton[i].y;
if y>=ligne_supprime then dec(canton[i].y);
end;
// verifier si les cantons verticaux: corriger leurs origine y et ses Bimage
for y:=1 to NbreCellY[indexTCO] do
for x:=1 to NbreCellX[indexTCO] do
begin
Bimage:=tco[indextco,x,y].BImage;
if Bimage=id_CantonV then
begin
i:=tco[indexTCO,x,y].NumCanton;
i:=Index_canton_numero(i);
n:=canton[i].Nelements;
canton[i].y:=y; // origine Y
i:=0;
for yy:=y to y+n-1 do // parcourir les Bimage du canton
begin
tco[indexTCO,x,yy].BImage:=Id_CantonV+i;
inc(i);
end;
end;
end;
TCO_modifie:=true;
affiche_TCO(indexTCO);
end;
// suppression colonne
procedure TFormTCO.ColonneClick(Sender: TObject);
var x,y,i,indexTCO,n : integer;
var x,y,xx,xc,yc,i,indexTCO,n,Bimage : integer;
c : tcomponent;
begin
c:=popupmenu1.PopupComponent ; // imageTCO
@@ -18376,39 +18609,96 @@ begin
TamponTCO_org.xOrg:=colonne_supprime;
TamponTCO_org.yOrg:=1;
// remplir tampon de sauvegarde
for y:=TamponTCO_Org.y1 to TamponTCO_Org.y2 do
for x:=TamponTCO_Org.x1 to TamponTCO_Org.x2 do
tampontco[x,y]:=tco[indextco,x,y];
// supression colonne
// balayer les cantons pour corriger leurs coordonnées
// balayer les cantons pour supprimer canton verticzl
for i:=1 to nCantons do
begin
x:=canton[i].x;
n:=canton[i].numero;
if (not(canton[i].horizontal)) and (x=colonne_Supprime) then
if not(canton[i].horizontal) and (x=colonne_Supprime) then
begin
//supprimer le canton
//supprimer le canton vertical
supprime_remplace_canton(i);
Affiche('canton '+intToSTR(n)+' supprimé',clOrange);
end
else
if x>=colonne_supprime then dec(canton[i].x);
end;
xc:=0;
// voir si la ligne contient un canton horizontal, réajuster son nombre
for y:=1 to NbreCellY[indexTCO] do
begin
if isCantonH(tco[indexTCO,colonne_supprime,y].BImage) then
begin
yc:=y;xc:=colonne_Supprime;
origine_canton(xc,yc);
n:=tco[indexTCO,xc,yc].NumCanton;
if n<>0 then
begin
i:=index_canton_numero(n);
if canton[i].Nelements=3 then
begin
Affiche('Le canton '+intToSTR(n)+' est supprimé car il comporte moins de 3 cases',clOrange);
supprime_remplace_canton(i);
end
else
begin
//Affiche('Canton '+intToSTR(n)+' réajusté',clOrange);
dec(canton[i].Nelements);
dec(tco[indexTCO,xc,yc].FeuOriente);
end;
end;
end;
end;
// supression colonne
for x:=xClicCell[indexTCO] to NbreCellx[indexTCO]-1 do
begin
for y:=1 to NbreCelly[indexTCO] do
begin
tco[indextco,x,y]:=tco[indextco,x+1,y];
if (tco[indextco,x,y].BImage<>id_cantonH) then tco[indextco,x,y]:=tco[indextco,x+1,y];
end;
end;
// supprimer la dernière colonne du TCO
for y:=1 to NbreCellY[indexTCO] do
begin
raz_cellule(indextco,NbreCellx[indexTCO],y);
tco[indextco,NbreCellx[indexTCO],y].CouleurFond:=Clfond[IndexTCO];
end;
dec(NbreCellX[indexTCO]);
// décrémenter les coordonnées Y des cantons dont la colonne est supérieure à la colonne supprimée
for i:=1 to nCantons do
begin
x:=canton[i].x;
if x>=colonne_supprime then dec(canton[i].x);
end;
// verifier les cantons horizontaux: corriger leurs origine y et ses Bimage
for x:=1 to NbreCellX[indexTCO] do
for y:=1 to NbreCellY[indexTCO] do
begin
Bimage:=tco[indextco,x,y].BImage;
if Bimage=id_CantonH then
begin
i:=tco[indexTCO,x,y].NumCanton;
i:=Index_canton_numero(i);
n:=canton[i].Nelements;
canton[i].x:=x; // origine X
i:=0;
for xx:=x to x+n-1 do // parcourir les Bimage du canton
begin
tco[indexTCO,xx,y].BImage:=Id_CantonH+i;
inc(i);
end;
end;
end;
TCO_modifie:=true;
affiche_TCO(indexTCO);
end;
@@ -19317,8 +19607,19 @@ begin
defocusControl(EditAdrElement,true);
end;
procedure TFormTCO.Modeslection1Click(Sender: TObject);
begin
ModeSlection1.checked:=true;
ModeDplacement1.Checked:=false;
modeGlisse:=false;
end;
procedure TFormTCO.Modedplacement1Click(Sender: TObject);
begin
ModeSlection1.checked:=false;
ModeDplacement1.Checked:=true;
modeGlisse:=true;
end;
end.
+1 -1
View File
@@ -26,7 +26,7 @@ var
f : textFile;
Const
VersionSC = '10.2'; // sert à la comparaison de la version publiée
VersionSC = '10.5'; // 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;
+12 -1
View File
@@ -318,10 +318,21 @@ version 10.0 : Cr
version 10.1 : Correction d'un bug sur l'évolution des trains dans le TCO.
version 10.2 : Ajout de 4 boutons aux claviers USB
Compteurs de vitesses pour chaque train dans un nouvel onglet "compteurs".
Les couleurs des compteurs sont personnalisables.
Les couleurs des compteurs sont personnalisables.
Pilotage des accessoires en mode asynchrone.
Correction bug fonction F bloc USB et pilotage train affecté au bloc
version 10.3 : Améliorations diverses.
Icones de trains supplémentaires.
Correction d'un bug sur les compteurs de vitesse avec CDM.
version 10.4 : Améliorations diverses.
version 10.5 : Correction affichage réseau CDM.
Correction suppression lignes/colonnes dans le TCO pour les cantons.
Création mode "déplacer" et "sélectionner" dans le TCO et le réseau CDM.
Affichage des courbes de vitesses des trains étalonnés.