diff --git a/ConfigGenerale.cfg b/ConfigGenerale.cfg index 2fb615b..58474bd 100644 --- a/ConfigGenerale.cfg +++ b/ConfigGenerale.cfg @@ -1,4 +1,4 @@ -/ Fichier de configuration de signaux_complexes_GL version 10.53 +/ Fichier de configuration de signaux_complexes_GL version 10.79 Chemin_progCDM=C:\Program Files (x86) LargeurF=1120 HauteurF=681 @@ -208,30 +208,30 @@ Clignote, 0 /------------ [section_sig] -176,7,0,1,(520,A20),1,FVC0,FRC0 -190,7,0,1,(523,526),0,FVC0,FRC0 -204,9,0,1,(527,A7),1,FVC0,FRC0 -218,7,0,1,(525,A17),0,FVC0,FRC0 -232,2,1,1,(516,A6),0,FVC0,FRC0,CFB(A6D) -274,3,0,1,(524,521),0,FVC0,FRC0 -288,7,0,1,(522,A103),1,FVC0,FRC0 -302,9,0,1,(526,A9),1,FVC0,FRC0 -316,7,1,1,(515,A5),1,FVC0,FRC0 -330,7,0,1,(519,A2),1,FVC0,FRC0 -344,9,0,1,(528,A10),1,FVC0,FRC0 -358,9,0,1,(517,A102),1,FVC0,FRC0 -372,D3,1,(A10D)(A19S)(A19D,A22D)(A19D,A22S) -382,D3,1,(A29S,A10S)(A19S)(A19D,A22D)(A19D,A22S) -392,3,0,1,(535,533),1,FVC0,FRC0 -406,9,0,1,(534,A23),1,FVC0,FRC0 -420,7,0,1,(529,A25,530,A27,537,A27),1,FVC1,FRC1 -448,7,0,1,(533,A24),1,FVC0,FRC0 -462,9,0,1,(513,A29),1,FVC0,FRC0 -476,9,0,1,(538,A105),1,FVC0,FRC0 -497,9,0,4,(531,A19),1,FVC0,FRC0,U14,L1 -520,9,1,1,(518,A1),1,FVC0,FRC0,(A1S,A3S,A5S),CFB(A1S,A3D,A4D,A6S) -620,7,0,0,(521,A8),1,FVC0,FRC0 -820,4,0,0,(519,A7),0,FVC0,FRC0 +176,7,0,1,(520,A20),1,FVC0,FRC0,T0 +190,7,0,1,(523,526),0,FVC0,FRC0,T0 +204,9,0,1,(527,A7),1,FVC0,FRC0,T0 +218,7,0,1,(525,A17),0,FVC0,FRC0,T0 +232,2,1,1,(516,A6),0,FVC0,FRC0,CFB(A6D),T0 +274,3,0,1,(524,521),0,FVC0,FRC0,T0 +288,7,0,1,(522,A103),1,FVC0,FRC0,T0 +302,9,0,1,(526,A9),1,FVC0,FRC0,T0 +316,7,1,1,(515,A5),1,FVC0,FRC0,T0 +330,7,0,1,(519,A2),1,FVC0,FRC0,T0 +344,9,0,1,(528,A10),1,FVC0,FRC0,T0 +358,9,0,1,(517,A102),1,FVC0,FRC0,T0 +372,D3,1,(A10D)(A19S)(A19D,A22D)(A19D,A22S),T0 +382,D3,1,(A29S,A10S)(A19S)(A19D,A22D)(A19D,A22S),T0 +392,3,0,1,(535,533),1,FVC0,FRC0,T0 +406,9,0,1,(534,A23),1,FVC0,FRC0,T0 +420,7,0,1,(529,A25,530,A27,537,A27),1,FVC1,FRC1,T0 +448,7,0,1,(533,A24),1,FVC0,FRC0,T0 +462,9,0,1,(513,A29),1,FVC0,FRC0,T0 +476,9,0,1,(538,A105),1,FVC0,FRC0,T0 +497,9,0,4,(531,A19),1,FVC0,FRC0,U14,L1,T0 +520,9,1,1,(518,A1),1,FVC0,FRC0,(A1S,A3S,A5S),CFB(A1S,A3D,A4D,A6S),T0 +620,7,0,0,(521,A8),1,FVC0,FRC0,T0 +820,4,0,0,(519,A7),0,FVC0,FRC0,T0 0 /------------ [section_PN] @@ -257,7 +257,7 @@ BB16024,3,120,100,60,BB16024.BMP,7,0,0,0,0,0,0.00,0.00,0.00,0,0,0 CC406526,4,120,100,80,CC406526.BMP,10,0,0,0,0,0,0.00,0.00,0.00,0,0,0 [route_par_pont],0,1 {519->2droit->12dev->517->102crois->18dev->11dev->101crois->525->17dev->528->10dev->101crois->19dev->531->518->1droit->100crois->523} -CAMERA,6,120,0,0,EAD.BMP,8,0,0,0,0,0,0.00,0.00,0.00,0,0,0 +CAMERA,6,120,120,60,EAD.BMP,8,0,0,0,0,0,0.00,0.00,0.00,0,0,0 0 /------------ [section_placement] @@ -351,22 +351,19 @@ DureeMinute=1 0 /------------ [section_logique] -/--- Fonction 1 -"0" -FF 0 /------------ [section_blocs_USB] -B1,,BR0,0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0 -B2,,BR0,0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0 -B3,,BR0,0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0 -B4,,BR0,0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0 -B5,,BR0,0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0 -B6,,BR0,0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0 -B7,,BR0,0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0 -B8,,BR0,0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0 -B9,,BR0,0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0 -B10,,BR0,0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0,B0,0,0 +B1,,BR0,0,0,1,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0 +B2,,BR0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0 +B3,,BR0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0 +B4,,BR0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0 +B5,,BR0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0 +B6,,BR0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0 +B7,,BR0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0 +B8,,BR0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0 +B9,,BR0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0 +B10,,BR0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0,B0,0,0,0 0 /------------ [section_compteurs] @@ -376,16 +373,19 @@ Graduations=FFFFFF Numeros=FFFFFF Fond=000000 Arc=008000 +Increment=3 Compteur2 Aiguille=0000FF Graduations=000000 Numeros=FF0000 Fond=808080 Arc=008000 +Increment=3 Compteur3 Aiguille=0000FF Graduations=FFFFFF Numeros=FFFFFF Fond=000000 Arc=008000 +Increment=3 0 diff --git a/Notice d'utilisation des signaux_complexes_GL_V10.78.pdf b/Notice d'utilisation des signaux_complexes_GL_V10.8.pdf similarity index 83% rename from Notice d'utilisation des signaux_complexes_GL_V10.78.pdf rename to Notice d'utilisation des signaux_complexes_GL_V10.8.pdf index b83636d..f722301 100644 Binary files a/Notice d'utilisation des signaux_complexes_GL_V10.78.pdf and b/Notice d'utilisation des signaux_complexes_GL_V10.8.pdf differ diff --git a/UnitCDF.pas b/UnitCDF.pas index 5b51030..7ded6e7 100644 --- a/UnitCDF.pas +++ b/UnitCDF.pas @@ -1,6 +1,6 @@ unit UnitCDF; -// configuration des décodeurs CDM et Digikeijs +// configuration des décodeurs CDF et Digikeijs interface @@ -195,25 +195,25 @@ begin i:=0; //ImagePilote.Picture.Bitmap:=FormPilote.ImagePilote.picture.bitmap; - EtatFeuPilote:=Signaux[i].EtatSignal; + EtatSignalPilote:=Signaux[i].EtatSignal; AncienEtat:=Signaux[i].AncienEtat; dessineCDF:=true; // demande dessin CDF pour les clignotements Vcanvas:=FormCDF.ImageDigi.picture.bitmap.Canvas; case Signaux[i].aspect of // feux de signalisation - 2 : dessine_signal2(Vcanvas,0,0,1,1,EtatFeupilote,1,i); - 3 : dessine_signal3(Vcanvas,0,0,1,1,EtatFeupilote,1,i); - 4 : dessine_signal4(VCanvas,0,0,1,1,EtatFeupilote,1,i); - 5 : dessine_signal5(VCanvas,0,0,1,1,EtatFeupilote,1,i); - 7 : dessine_signal7(VCanvas,0,0,1,1,EtatFeupilote,1,i); - 9 : dessine_signal9(VCanvas,0,0,1,1,EtatFeupilote,1,i); + 2 : dessine_signal2(Vcanvas,0,0,1,1,EtatSignalPilote,1,i); + 3 : dessine_signal3(Vcanvas,0,0,1,1,EtatSignalPilote,1,i); + 4 : dessine_signal4(VCanvas,0,0,1,1,EtatSignalPilote,1,i); + 5 : dessine_signal5(VCanvas,0,0,1,1,EtatSignalPilote,1,i); + 7 : dessine_signal7(VCanvas,0,0,1,1,EtatSignalPilote,1,i); + 9 : dessine_signal9(VCanvas,0,0,1,1,EtatSignalPilote,1,i); // indicateurs de direction - 12 : dessine_dirN(VCanvas,0,0,1,1,EtatFeupilote,1,2); - 13 : dessine_dirN(VCanvas,0,0,1,1,EtatFeupilote,1,3); - 14 : dessine_dirN(VCanvas,0,0,1,1,EtatFeupilote,1,4); - 15 : dessine_dirN(VCanvas,0,0,1,1,EtatFeupilote,1,5); - 16 : dessine_dirN(VCanvas,0,0,1,1,EtatFeupilote,1,6); + 12 : dessine_dirN(VCanvas,0,0,1,1,EtatSignalPilote,1,2); + 13 : dessine_dirN(VCanvas,0,0,1,1,EtatSignalPilote,1,3); + 14 : dessine_dirN(VCanvas,0,0,1,1,EtatSignalPilote,1,4); + 15 : dessine_dirN(VCanvas,0,0,1,1,EtatSignalPilote,1,5); + 16 : dessine_dirN(VCanvas,0,0,1,1,EtatSignalPilote,1,6); end; end; diff --git a/UnitCompteur.dfm b/UnitCompteur.dfm index 97a0cb2..be813d2 100644 --- a/UnitCompteur.dfm +++ b/UnitCompteur.dfm @@ -1,6 +1,6 @@ object FormCompteur: TFormCompteur - Left = 550 - Top = 218 + Left = 614 + Top = 296 Width = 258 Height = 262 BorderStyle = bsSizeToolWin diff --git a/UnitCompteur.pas b/UnitCompteur.pas index 0e8b2b4..3dc5893 100644 --- a/UnitCompteur.pas +++ b/UnitCompteur.pas @@ -508,31 +508,39 @@ begin // le compteurs 1 provient de bitmaps // le compteur 2 et 3 sont dessinés par + with param do begin case typCompt of 1 : begin - // le compteur 1 provient d'une image - StretchDraw(rect(0,0,Lim,Him),Formprinc.ImageCompteur1.Picture.Bitmap); - Brush.Style:=bsSolid; - Brush.Color:=$1F1A17; - font.color:=ParamCompteur[1].CoulNum; - {$IF CompilerVersion >= 28.0} - font.orientation:=0; - {$IFEND} - font.size:=round(redx*10*RedFonte); - TextOut(round(50*redX),round(128*redY),'0'); - TextOut(round(36*redX),round(90*redY),'20'); - TextOut(round(50*redX),round(54*redY),'40'); - TextOut(round(90*redX),round(36*redY),'60'); - TextOut(round(129*redX),round(53*redY),'80'); - TextOut(round(137*redX),round(91*redY),'100'); - TextOut(round(126*redX),round(126*redY),'120'); - // centre de l'aiguille - AigCX:=round(98*redX); - AigCY:=round(98*redY); - rAig:=round(AigCX / 1.5); - angleFin:=127; // en fait vitesse maxi compteur + // le compteur 1 provient d'une image + StretchDraw(rect(0,0,Lim,Him),Formprinc.ImageCompteur1.Picture.Bitmap); + Brush.Style:=bsSolid; + Brush.Color:=$1F1A17; + font.color:=ParamCompteur[1].CoulNum; + {$IF CompilerVersion >= 28.0} + font.orientation:=0; + // centre de l'aiguille + AigCX:=round(97*redX); // le centre de l'aiguille est en 97 97 + AigCY:=round(97*redY); + {$ELSE} + // centre de l'aiguille + AigCX:=round(97*redX*RedFonte); // le centre de l'aiguille est en 97 97 + AigCY:=round(97*redY*RedFonte); + {$IFEND} + font.size:=round(redx*10*RedFonte); + TextOut(round(50*redX),round(128*redY),'0'); + TextOut(round(40*redX),round(92*redY),'20'); + TextOut(round(56*redX),round(56*redY),'40'); + TextOut(round(94*redX),round(36*redY),'60'); + TextOut(round(129*redX),round(53*redY),'80'); + TextOut(round(137*redX),round(91*redY),'100'); + TextOut(round(124*redX),round(130*redY),'120'); + + + + rAig:=round(AigCX / 1.5); + angleFin:=127; // en fait vitesse maxi compteur end; 2 : begin // centre de l'aiguille et longueur @@ -565,12 +573,15 @@ begin init_compteur(1,FormCompteur[1]); end; +// initialise le compteur +// i = rang du compteur +// c : composant de destination 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 HautTb=10; // hauteur trackbar ofsGBH=15; // marge haut du groupbox - ofsGBB=8; // marge bas du groupbox + ofsGBB=8; // marge bas du groupbox var comptLoc,l,h,lim,him,hfen,mini,maxi,vmax : integer; typDest : typ; @@ -591,10 +602,10 @@ begin exit; end; - if (typDest=fen) or (typDest=gb) then ComptLoc:=compteur; + if (typDest=fen) or (typDest=gb) then ComptLoc:=compteur; // compteur est une variable globale qui désigne le type de compteur de la grande fenetre de compteur if typDest=im then ComptLoc:=formconfig.ComboBoxCompt.ItemIndex+1; - case ComptLoc of + case ComptLoc of // 1=compteur 1, 2=compteur 2 , 3=compteur tachro 1 : begin mini:=-135; @@ -679,8 +690,18 @@ begin paramCompt.imgH:=him; //HautCompt-HautTb-ofsGBH-ofsGBB; Img.picture.Bitmap.Width:=lim; Img.picture.Bitmap.Height:=him; //HautCompt-HautTb-ofsGBH-ofsGBB; - paramcompt.redX:=Lim/l; - paramcompt.redY:=Him/h; + + if ComptLoc=1 then + begin + paramcompt.redX:=Lim/l/RedFonte; // pour le compteur 1; il faut intégrer le facteur de réduction + paramcompt.redY:=Him/h/RedFonte; + end + else + begin + paramcompt.redX:=Lim/l; + paramcompt.redY:=Him/h; + end; + paramcompt.ImgL:=Lim; paramcompt.ImgH:=Him; tb.Top:=him+ofsGBH; // position de la trackbar @@ -711,8 +732,17 @@ begin if typDest=fen then begin formCompteur[i].ImageCompteur.width:=Lim; - Scompteur[i].paramcompt.redX:=Lim/l; - Scompteur[i].paramcompt.redY:=Him/h; + if ComptLoc=1 then + begin + Scompteur[i].paramcompt.redX:=Lim/l/RedFonte; + Scompteur[i].paramcompt.redY:=Him/h/RedFonte; + end + else + begin + Scompteur[i].paramcompt.redX:=Lim/l; + Scompteur[i].paramcompt.redY:=Him/h; + end; + Scompteur[i].paramcompt.ImgL:=Lim; Scompteur[i].paramcompt.ImgH:=Him; case compteur of @@ -803,8 +833,17 @@ begin Image.Width:=lim; Image.Height:=him; - paramcomptIm.redX:=Lim/l; - paramcomptIm.redY:=Him/h; + if ComptLoc=1 then + begin + paramcomptIm.redX:=Lim/l/RedFonte; + paramcomptIm.redY:=Him/h/RedFonte; + end + else + begin + paramcomptIm.redX:=Lim/l; + paramcomptIm.redY:=Him/h; + end; + paramcomptIm.ImgL:=Lim; paramcomptIm.ImgH:=Him; i:=formconfig.ComboBoxCompt.Itemindex+1; diff --git a/UnitConfig.dfm b/UnitConfig.dfm index 9d6d37d..4552b8e 100644 --- a/UnitConfig.dfm +++ b/UnitConfig.dfm @@ -1573,7 +1573,7 @@ object FormConfig: TFormConfig Top = 8 Width = 633 Height = 505 - ActivePage = TabSheetBouton + ActivePage = TabSheetCDM Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -11 @@ -5099,7 +5099,7 @@ object FormConfig: TFormConfig Top = 16 Width = 337 Height = 457 - ActivePage = TtabSheetEt + ActivePage = TabSheetTrGen TabOrder = 3 object TabSheetTrGen: TTabSheet Caption = 'G'#233'n'#233'ral' diff --git a/UnitConfig.pas b/UnitConfig.pas index 4851c28..2824bb1 100644 --- a/UnitConfig.pas +++ b/UnitConfig.pas @@ -1146,7 +1146,7 @@ var s : string; begin result:=false; // déconnexion de l'ancienne liaison éventuelle - Formprinc.ClientSocketCDM.Close; + ClientSocketCDM.Close; if (AdresseIPCDM<>'0') and IpOk(AdresseIPCDM) then begin @@ -7551,9 +7551,39 @@ var i,j,x,y,l,k,LongestLength,PixelLength : integer; trouve : boolean; param : TparamCompt; p: pointer; + comp : tComponent; + tlE : tLabeledEdit; + re : tEdit; begin if AffEvt or (debug=1) then Affiche('Création fenêtre config',clLime); + {$IF CompilerVersion >= 28.0} + // composants à repasser en style de base car on change la couleur de fond + EditP1.StyleName:='Windows'; + EditP2.StyleName:='Windows'; + EditP3.StyleName:='Windows'; + EditP4.StyleName:='Windows'; + EditAigTriple.StyleName:='Windows'; + + // énumérer tous les composants pour Tedit + for i:=0 to Formconfig.ComponentCount-1 do + begin + comp:=formConfig.Components[i]; + if comp is tEdit then + begin + re:=comp as tEdit; + if (re.Name<>'EditLAY') and (re.name<>'EditcomUSB') and (re.name<>'EditNomTrain') and + (re.Name<>'EditNomPeriph') and (re.name<>'EditPortCde') then + re.alignment:=taRightJustify; + end; + if comp is tLabeledEdit then + begin + tle:=comp as tLabeledEdit; + tle.alignment:=taRightJustify; + end; + end; + {$IFEND} + editAdrIPCDM.Hint:='Adresse IP du PC sur lequel CDM rail s''exécute'+#13+'ou 127.0.0.1 pour indiquer ce pc'; ValueListEditor.Visible:=true; ImageAffiche.stretch:=true; @@ -7570,6 +7600,7 @@ begin '-> NON_OU'; ButtonAjouteVar.Hint:='Ajoute une variable'+#13+'->'+NomFonc[5]+#13+'->'+NomFonc[6]+#13+'->'+NomFonc[7]+#13+'->'+NomFonc[8]+#13+'->'+NomFonc[9]; ButtonAjouteVar.ShowHint:=true; + ImageCtc.Stretch:=false; // liste des paramètres du mode expert de la ValueListEditor // syntaxe des masques: @@ -17155,6 +17186,7 @@ begin EditDecal.Text:=IntToSTR(detecteur[adr].distArret); RadioButtonArrFin.Checked:=detecteur[adr].ModeArret=1; RadioButtonARMil.Checked:=detecteur[adr].ModeArret=2; + if detecteur[adr].ModeArret=1 then editDecal.Enabled:=true else editDecal.Enabled:=false; end; end; @@ -17657,6 +17689,7 @@ begin labelInfo.caption:='Erreur : la distance d''arrêt est supérieure à la longueur du détecteur'; end; detecteur[r].ModeArret:=1; + editDecal.Enabled:=true; ListBoxDet.items[ligneclicDet]:=encode_detecteur(ligneclicDet+1); ListBoxDet.selected[ligneclicDet]:=true; end; @@ -17668,6 +17701,7 @@ begin r:=adresse_detecteur[ligneclicDet+1]; detecteur[r].ModeArret:=2; LabelInfo.Caption:=''; + editDecal.Enabled:=false; ListBoxDet.items[ligneclicDet]:=encode_detecteur(ligneclicDet+1); ListBoxDet.selected[ligneclicDet]:=true; end; @@ -18025,6 +18059,7 @@ procedure supprime_element_fonction(fonc,index : integer); var i,n : integer; begin n:=fonction[fonc,0].adresse; + if index=0 then fonction[fonc,0].adresse:=0; // si on supprime une fonction for i:=index to n-1 do begin fonction[fonc,i]:=fonction[fonc,i+1]; @@ -19736,6 +19771,7 @@ begin buttonCoulGrad.enabled:=true; buttonCoulFond.enabled:=true; end; + init_compteur(1,ImageCtC); end; diff --git a/UnitDebug.dfm b/UnitDebug.dfm index c7c9cb3..e5115a4 100644 --- a/UnitDebug.dfm +++ b/UnitDebug.dfm @@ -1,6 +1,6 @@ object FormDebug: TFormDebug - Left = 258 - Top = 1 + Left = 194 + Top = 132 VertScrollBar.Increment = 67 VertScrollBar.Tracking = True VertScrollBar.Visible = False @@ -32,7 +32,6 @@ object FormDebug: TFormDebug Width = 872 Height = 677 HorzScrollBar.Visible = False - VertScrollBar.Position = 96 Anchors = [akLeft, akTop, akRight, akBottom] Color = clBtnFace ParentColor = False @@ -42,7 +41,7 @@ object FormDebug: TFormDebug 673) object LabelTitreDebug: TLabel Left = 475 - Top = -88 + Top = 4 Width = 131 Height = 18 Anchors = [akTop, akRight] @@ -56,7 +55,7 @@ object FormDebug: TFormDebug end object Label1: TLabel Left = 627 - Top = -86 + Top = 6 Width = 108 Height = 13 Anchors = [akTop, akRight] @@ -72,7 +71,7 @@ object FormDebug: TFormDebug end object RichDebug: TRichEdit Left = 0 - Top = -96 + Top = 0 Width = 454 Height = 753 Anchors = [akLeft, akTop, akRight] @@ -86,7 +85,7 @@ object FormDebug: TFormDebug end object ButtonRazTout: TButton Left = 465 - Top = 120 + Top = 216 Width = 97 Height = 25 Hint = @@ -101,7 +100,7 @@ object FormDebug: TFormDebug end object ButtonCop: TButton Left = 465 - Top = 152 + Top = 248 Width = 97 Height = 41 Anchors = [akTop, akRight] @@ -118,7 +117,7 @@ object FormDebug: TFormDebug end object ButtonAffEvtChrono: TButton Left = 465 - Top = 200 + Top = 296 Width = 97 Height = 33 Anchors = [akTop, akRight] @@ -129,7 +128,7 @@ object FormDebug: TFormDebug end object ButtonCherche: TButton Left = 465 - Top = 240 + Top = 336 Width = 97 Height = 25 Hint = 'Cherche la cha'#238'ne "erreur"' @@ -142,7 +141,7 @@ object FormDebug: TFormDebug end object ButtonEcrLog: TButton Left = 465 - Top = 88 + Top = 184 Width = 97 Height = 29 Anchors = [akTop, akRight] @@ -152,7 +151,7 @@ object FormDebug: TFormDebug end object ButtonRazTampon: TButton Left = 465 - Top = 272 + Top = 368 Width = 97 Height = 33 Anchors = [akTop, akRight] @@ -163,7 +162,7 @@ object FormDebug: TFormDebug end object ButtonRazLog: TButton Left = 465 - Top = 312 + Top = 408 Width = 97 Height = 33 Anchors = [akTop, akRight] @@ -174,7 +173,7 @@ object FormDebug: TFormDebug end object MemoEvtDet: TRichEdit Left = 570 - Top = 90 + Top = 186 Width = 272 Height = 263 Anchors = [akTop, akRight] @@ -185,7 +184,7 @@ object FormDebug: TFormDebug end object GroupBox5: TGroupBox Left = 462 - Top = 360 + Top = 456 Width = 380 Height = 57 Anchors = [akTop, akRight] @@ -252,7 +251,7 @@ object FormDebug: TFormDebug end object GroupBox6: TGroupBox Left = 462 - Top = 424 + Top = 520 Width = 380 Height = 52 Anchors = [akTop, akRight] @@ -329,7 +328,7 @@ object FormDebug: TFormDebug end object GroupBoxPrim: TGroupBox Left = 464 - Top = 488 + Top = 584 Width = 378 Height = 185 Anchors = [akTop, akRight] @@ -432,7 +431,9 @@ object FormDebug: TFormDebug Top = 16 Width = 57 Height = 49 - Hint = 'Test si des aiguillages sont d'#233'vi'#233's apr'#232's le signal' + Hint = + 'Test si des aiguillages pris en pointe sont d'#233'vi'#233's apr'#232's le sign' + + 'al' Caption = 'Aig d'#233'vi'#233' apr'#232's signal' ParentShowHint = False ShowHint = True @@ -500,7 +501,7 @@ object FormDebug: TFormDebug end object GroupBox2: TGroupBox Left = 466 - Top = -68 + Top = 28 Width = 376 Height = 149 Anchors = [akTop, akRight] @@ -713,7 +714,7 @@ object FormDebug: TFormDebug end object EditNivDebug: TEdit Left = 751 - Top = -88 + Top = 4 Width = 49 Height = 21 Anchors = [akTop, akRight] diff --git a/UnitModifAction.dfm b/UnitModifAction.dfm index b0cb5b2..d4ac706 100644 --- a/UnitModifAction.dfm +++ b/UnitModifAction.dfm @@ -1,6 +1,6 @@ object FormModifAction: TFormModifAction - Left = 542 - Top = 189 + Left = 355 + Top = 223 BorderStyle = bsDialog Caption = 'Modifier une action' ClientHeight = 443 @@ -60,7 +60,7 @@ object FormModifAction: TFormModifAction Top = 64 Width = 729 Height = 337 - ActivePage = TabSheetDecl + ActivePage = TabSheetOp MultiLine = True TabOrder = 1 object TabSheetDecl: TTabSheet @@ -517,7 +517,7 @@ object FormModifAction: TFormModifAction Top = 32 Width = 217 Height = 21 - ItemHeight = 0 + ItemHeight = 13 TabOrder = 0 OnChange = ComboBoxFamilleChange end @@ -544,6 +544,7 @@ object FormModifAction: TFormModifAction Hint = 'Liste chronologique des op'#233'rations '#224' effectuer' ItemHeight = 13 ParentShowHint = False + PopupMenu = PopupMenuOP ShowHint = True TabOrder = 2 OnDblClick = ListBoxOperationsDblClick @@ -721,7 +722,7 @@ object FormModifAction: TFormModifAction Height = 21 Hint = 'Nom du p'#233'riph'#233'rique d'#233'fini dans l'#39'onglet "p'#233'riph'#233'riques COM/USB"' Style = csDropDownList - ItemHeight = 0 + ItemHeight = 13 ParentShowHint = False ShowHint = True TabOrder = 4 @@ -837,29 +838,23 @@ object FormModifAction: TFormModifAction object OpenDialogSon: TOpenDialog Left = 680 end - object PopupMenuL: TPopupMenu - Left = 692 - Top = 104 - object Monter1: TMenuItem - Caption = 'Monter' + object PopupMenuOP: TPopupMenu + Left = 680 + Top = 32 + object Monteropration1: TMenuItem + Caption = 'Monter op'#233'ration' + OnClick = Monteropration1Click end - object Descendre1: TMenuItem - Caption = 'Descendre' + object Descendreopration1: TMenuItem + Caption = 'Descendre op'#233'ration' + OnClick = Descendreopration1Click end object N1: TMenuItem Caption = '-' end - object Supprimer1: TMenuItem - Caption = 'Supprimer' - end - object N2: TMenuItem - Caption = '-' - end - object outdployer1: TMenuItem - Caption = 'Tout d'#233'ployer' - end - object outcontracter1: TMenuItem - Caption = 'Tout contracter' + object Supprimeropration1: TMenuItem + Caption = 'Supprimer op'#233'ration' + OnClick = Supprimeropration1Click end end end diff --git a/UnitModifAction.pas b/UnitModifAction.pas index b30ac5f..2002101 100644 --- a/UnitModifAction.pas +++ b/UnitModifAction.pas @@ -74,19 +74,16 @@ type RadioEtatSignal: TRadioGroup; SpinEditEtatop: TSpinEdit; LabelEtatOp: TLabel; - PopupMenuL: TPopupMenu; - Monter1: TMenuItem; - Descendre1: TMenuItem; - N1: TMenuItem; - Supprimer1: TMenuItem; - N2: TMenuItem; - outdployer1: TMenuItem; - outcontracter1: TMenuItem; ButtonFonction: TButton; ButtonVoirFonc: TButton; LabelInfoFonc: TLabel; Label2InfoFonction: TLabel; SpeedButton1: TSpeedButton; + PopupMenuOP: TPopupMenu; + Monteropration1: TMenuItem; + Descendreopration1: TMenuItem; + N1: TMenuItem; + Supprimeropration1: TMenuItem; procedure FormCreate(Sender: TObject); procedure ListBoxOperDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); @@ -142,6 +139,9 @@ type procedure ButtonFonctionClick(Sender: TObject); procedure ButtonVoirFoncClick(Sender: TObject); procedure SpeedButton1Click(Sender: TObject); + procedure Supprimeropration1Click(Sender: TObject); + procedure Monteropration1Click(Sender: TObject); + procedure Descendreopration1Click(Sender: TObject); private { Déclarations privées } public @@ -1212,12 +1212,12 @@ begin supprime_operation; end; -procedure TFormModifAction.SpinButton1UpClick(Sender: TObject); +procedure monte_operation; var i,indexSrc,idBD,idOp,no : integer; top : Toperation; s : string; begin - indexSrc:=listboxOperations.ItemIndex; + indexSrc:=FormModifAction.listboxOperations.ItemIndex; if indexSrc<0 then exit; idBD:=ligneClicAct+1; idop:=indexSrc+1; @@ -1231,8 +1231,8 @@ begin // réencoder la ligne s:=encode_actions(idBD); // maj combobox - ComboBoxActions.Items[idBD-1]:=s; - ComboBoxActions.ItemIndex:=idbd-1; + FormModifAction.ComboBoxActions.Items[idBD-1]:=s; + FormModifAction.ComboBoxActions.ItemIndex:=idbd-1; // maj opérations with FormModifAction.ListBoxOperations do @@ -1242,19 +1242,24 @@ begin begin no:=Tablo_Action[idBD].tabloOp[i].numoperation; s:=affecte_operation(no); - ListBoxOperations.Items.add(s); + FormModifAction.ListBoxOperations.Items.add(s); itemHeight:=16; end; ItemIndex:=indexSrc-1; end; end; -procedure TFormModifAction.SpinButton1DownClick(Sender: TObject); -var no,i,indexSrc,idBD,idOp : integer; +procedure TFormModifAction.SpinButton1UpClick(Sender: TObject); +begin + monte_operation; +end; + +Procedure Descend_operation; + var no,i,indexSrc,idBD,idOp : integer; top : Toperation; s : string; begin - indexSrc:=listboxOperations.ItemIndex; + indexSrc:=FormModifAction.listboxOperations.ItemIndex; if indexSrc<0 then exit; idBD:=ligneClicAct+1; idop:=indexSrc+1; @@ -1269,8 +1274,8 @@ begin // réencoder la ligne s:=encode_actions(idBD); // maj combobox - ComboBoxActions.Items[idBD-1]:=s; - ComboBoxActions.ItemIndex:=idbd-1; + FormModifAction.ComboBoxActions.Items[idBD-1]:=s; + FormModifAction.ComboBoxActions.ItemIndex:=idbd-1; // maj opérations with FormModifAction.ListBoxOperations do @@ -1280,7 +1285,7 @@ begin begin no:=Tablo_Action[idBD].tabloOp[i].numoperation; s:=affecte_operation(no); - ListBoxOperations.Items.Add(s); + FormModifAction.ListBoxOperations.Items.Add(s); itemHeight:=16; end; @@ -1289,6 +1294,11 @@ begin Config_Modifie:=true; end; +procedure TFormModifAction.SpinButton1DownClick(Sender: TObject); +begin + Descend_operation; +end; + procedure maj_combocactions(i : integer); var s : string; begin @@ -1864,4 +1874,19 @@ begin close; end; +procedure TFormModifAction.Supprimeropration1Click(Sender: TObject); +begin + supprime_operation; +end; + +procedure TFormModifAction.Monteropration1Click(Sender: TObject); +begin + monte_operation; +end; + +procedure TFormModifAction.Descendreopration1Click(Sender: TObject); +begin + descend_operation; +end; + end. diff --git a/UnitPilote.pas b/UnitPilote.pas index 89630f2..b2132ff 100644 --- a/UnitPilote.pas +++ b/UnitPilote.pas @@ -129,7 +129,7 @@ JauneCliRalen60LEB=19; var FormPilote: TFormPilote; - EtatFeuPilote : word; + EtatSignalPilote : word; AdrPilote : integer; tableLEB : array[1..41,1..19] of record @@ -150,29 +150,29 @@ procedure dessine_signal_pilote; var i,ancienEtat : integer; Vcanvas : Tcanvas; begin - i:=Index_Signal(AdrPilote); // adresse du feu d'origine + i:=Index_Signal(AdrPilote); // adresse du signal d'origine if i<>0 then //ImagePilote.Picture.Bitmap:=FormPilote.ImagePilote.picture.bitmap; - EtatFeuPilote:=Signaux[0].EtatSignal; + EtatSignalPilote:=Signaux[0].EtatSignal; AncienEtat:=Signaux[0].ancienEtat; Vcanvas:=FormPilote.ImagePilote.picture.bitmap.Canvas; case Signaux[i].aspect of // feux de signalisation - 2 : dessine_signal2(Vcanvas,0,0,1,1,EtatFeupilote,1,i); - 3 : dessine_signal3(Vcanvas,0,0,1,1,EtatFeupilote,1,i); - 4 : dessine_signal4(VCanvas,0,0,1,1,EtatFeupilote,1,i); - 5 : dessine_signal5(VCanvas,0,0,1,1,EtatFeupilote,1,i); - 7 : dessine_signal7(VCanvas,0,0,1,1,EtatFeupilote,1,i); - 9 : dessine_signal9(VCanvas,0,0,1,1,EtatFeupilote,1,i); - 20 : dessine_signal20(VCanvas,0,0,1,1,EtatFeupilote,1,Signaux[i].adresse); + 2 : dessine_signal2(Vcanvas,0,0,1,1,EtatSignalPilote,1,i); + 3 : dessine_signal3(Vcanvas,0,0,1,1,EtatSignalPilote,1,i); + 4 : dessine_signal4(VCanvas,0,0,1,1,EtatSignalPilote,1,i); + 5 : dessine_signal5(VCanvas,0,0,1,1,EtatSignalPilote,1,i); + 7 : dessine_signal7(VCanvas,0,0,1,1,EtatSignalPilote,1,i); + 9 : dessine_signal9(VCanvas,0,0,1,1,EtatSignalPilote,1,i); + 20 : dessine_signal20(VCanvas,0,0,1,1,EtatSignalPilote,1,Signaux[i].adresse); // indicateurs de direction - 12 : dessine_dirN(VCanvas,0,0,1,1,EtatFeupilote,1,2); - 13 : dessine_dirN(VCanvas,0,0,1,1,EtatFeupilote,1,3); - 14 : dessine_dirN(VCanvas,0,0,1,1,EtatFeupilote,1,4); - 15 : dessine_dirN(VCanvas,0,0,1,1,EtatFeupilote,1,5); - 16 : dessine_dirN(VCanvas,0,0,1,1,EtatFeupilote,1,6); + 12 : dessine_dirN(VCanvas,0,0,1,1,EtatSignalPilote,1,2); + 13 : dessine_dirN(VCanvas,0,0,1,1,EtatSignalPilote,1,3); + 14 : dessine_dirN(VCanvas,0,0,1,1,EtatSignalPilote,1,4); + 15 : dessine_dirN(VCanvas,0,0,1,1,EtatSignalPilote,1,5); + 16 : dessine_dirN(VCanvas,0,0,1,1,EtatSignalPilote,1,6); end; end; diff --git a/UnitPrinc.dfm b/UnitPrinc.dfm index 65f28aa..ccdde5f 100644 --- a/UnitPrinc.dfm +++ b/UnitPrinc.dfm @@ -1,11 +1,11 @@ object FormPrinc: TFormPrinc - Left = 272 - Top = 402 + Left = 134 + Top = 277 Anchors = [akLeft, akTop, akRight] BorderStyle = bsNone Caption = 'Signaux complexes' ClientHeight = 513 - ClientWidth = 1094 + ClientWidth = 847 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText @@ -22,7 +22,7 @@ object FormPrinc: TFormPrinc OnKeyDown = FormKeyDown OnResize = FormResize DesignSize = ( - 1094 + 847 513) PixelsPerInch = 96 TextHeight = 13 @@ -1431,7 +1431,7 @@ object FormPrinc: TFormPrinc Visible = False end object LabelClock: TLabel - Left = 1002 + Left = 755 Top = 0 Width = 85 Height = 22 @@ -5421,7 +5421,7 @@ object FormPrinc: TFormPrinc Visible = False end object Label1: TLabel - Left = 792 + Left = 545 Top = 4 Width = 89 Height = 13 @@ -5429,7 +5429,7 @@ object FormPrinc: TFormPrinc Caption = 'Nombre de trains : ' end object LabelNbTrains: TLabel - Left = 888 + Left = 641 Top = 2 Width = 9 Height = 19 @@ -5445,7 +5445,7 @@ object FormPrinc: TFormPrinc object StatusBar1: TStatusBar Left = 0 Top = 491 - Width = 1094 + Width = 847 Height = 22 Panels = < item @@ -6460,16 +6460,6 @@ object FormPrinc: TFormPrinc end end end - object ClientSocketCDM: TClientSocket - Active = False - ClientType = ctNonBlocking - Port = 0 - OnConnect = ClientSocketCDMConnect - OnDisconnect = ClientSocketCDMDisconnect - OnRead = ClientSocketCDMRead - OnError = ClientSocketCDMError - Left = 296 - end object OpenDialog: TOpenDialog Left = 584 Top = 16 @@ -6509,33 +6499,6 @@ object FormPrinc: TFormPrinc OnClick = Informationsdusignal1Click end end - object ClientSocketCde1: TClientSocket - Active = False - ClientType = ctNonBlocking - Port = 0 - OnConnect = ClientSocketCde1Connect - OnRead = ClientSocketCde1Read - OnError = ClientSocketCde1Error - Left = 360 - end - object ClientSocketCde2: TClientSocket - Active = False - ClientType = ctNonBlocking - Port = 0 - OnConnect = ClientSocketCde2Connect - OnRead = ClientSocketCde2Read - OnError = ClientSocketCde2Error - Left = 392 - end - object ServerSocket: TServerSocket - Active = False - Port = 0 - ServerType = stNonBlocking - OnAccept = ServerSocketAccept - OnClientDisconnect = ServerSocketClientDisconnect - OnClientRead = ServerSocketClientRead - Left = 320 - end object PopupMenuTrains: TPopupMenu OnPopup = PopupMenuTrainsPopup Left = 480 diff --git a/UnitPrinc.pas b/UnitPrinc.pas index 4a5912e..b9fde0b 100644 --- a/UnitPrinc.pas +++ b/UnitPrinc.pas @@ -1,5 +1,5 @@ unit Unitprinc; -// 21/11/2025 +// 18/12/2025 (******************************************** Programme signaux complexes Graphique Lenz Composants ClientSocket et ServeurSocket pour les connexions réseau socket @@ -146,7 +146,6 @@ type Image6Dir: TImage; Codificationdessignaux: TMenuItem; Divers1: TMenuItem; - ClientSocketCDM: TClientSocket; FichierSimu: TMenuItem; OpenDialog: TOpenDialog; N1: TMenuItem; @@ -252,14 +251,12 @@ type Affichagenormal1: TMenuItem; N14: TMenuItem; Sauvegarderla1: TMenuItem; - ClientSocketCde1: TClientSocket; - ClientSocketCde2: TClientSocket; EditEnvoi: TEdit; ButtonEnv: TButton; N15: TMenuItem; outslectionner1: TMenuItem; Copierltatdesaiguillageseninitialisation1: TMenuItem; - ServerSocket: TServerSocket; + Listedesclientsconnects1: TMenuItem; Horaires1: TMenuItem; Horloge1: TMenuItem; @@ -450,6 +447,7 @@ type procedure PageControlChange(Sender: TObject); procedure Dtacherlecompteur1Click(Sender: TObject); procedure PopupMenuCompteursPopup(Sender: TObject); + procedure Button1Click(Sender: TObject); private { Déclarations privées } procedure DoHint(Sender : Tobject); @@ -1262,8 +1260,8 @@ var Aig_supprime,Aig_sauve : TAiguillage; BrancheN : array[1..MaxBranches,1..MaxElBranches] of TBranche; chaine_recue : TchaineBIN; - ClientSocketInterface: TClientSocket; - ClientInfo : TclientSocket; + ClientInfo,ClientSocketInterface,ClientSocketCDM,ClientSocketCde1,ClientSocketCde2 : TClientSocket; + ServerSocket: TServerSocket; {$R *.dfm} @@ -1630,9 +1628,9 @@ end; // ceci doit être fait dans l'evt OnActivate de chaque feuille. procedure change_style; var i,j,index : integer; - Re : tRichEdit; s : string; comp : Tcomponent; + te : tEdit; {$IF CompilerVersion >= 28.0} si : tStyleInfo; {$IFEND} @@ -1689,23 +1687,16 @@ begin Formprinc.FenRich.StyleName:='Windows'; // et dans formdebug.Create aussi - // énumérer tous les composants pour repaint les richedit - ne marche pas :D - { - for i:=0 to Screen.FormCount-1 do + // énumérer tous les composants pour Tedit + for i:=0 to formprinc.ComponentCount-1 do begin - //Affiche(Screen.Forms[i].Name,clYellow); - for j:=0 to Screen.Forms[i].ComponentCount-1 do + comp:=formprinc.Components[i]; + if comp is tEdit then begin - comp:=Screen.Forms[i].Components[j]; - if comp is tRichEdit then - begin - re:=comp as tRichEdit; - re.repaint; - //Affiche(comp.name,clWhite); - end; + te:=comp as tEdit; + te.alignment:=taRightJustify; end; end; - } Ancien_nom_style:=nom_Style_aff; end; @@ -2179,6 +2170,7 @@ begin s:='Création des compteurs GB'; procetape(s); + for i:=1 to ntrains do begin cree_GB_compteur(i); @@ -5320,6 +5312,8 @@ const HautTb=10; // hauteur trackbar ofsGBB=8; // marge bas du groupbox var Imh,Iml : integer; begin + if CompteurT[rang].gb<>nil then exit; // le compteur a déja été créé + iml:=0;imh:=0; //Affiche('Création compteur GroupBox'+intToSTR(rang),clYellow); CompteurT[rang].gb:=TGroupBox.Create(Formprinc.ScrollBoxC); @@ -8573,8 +8567,8 @@ begin begin numAcc:=decodeur_pers[dp].Peripherique; cmd:=Tablo_periph[numacc].numComposant; - if cmd=1 then Formprinc.ClientSocketCde1.Socket.SendText(s); - if cmd=2 then Formprinc.ClientSocketCde2.Socket.SendText(s); + if cmd=1 then ClientSocketCde1.Socket.SendText(s); + if cmd=2 then ClientSocketCde2.Socket.SendText(s); if Tablo_periph[numacc].ScvVis then Affiche('Envoi Socket: '+s,clYellow); end end; @@ -8647,8 +8641,8 @@ begin begin // socket cmd:=Tablo_periph[numacc].numComposant; - if cmd=1 then Formprinc.ClientSocketCde1.Socket.SendText(s); - if cmd=2 then Formprinc.ClientSocketCde2.Socket.SendText(s); + if cmd=1 then ClientSocketCde1.Socket.SendText(s); + if cmd=2 then ClientSocketCde2.Socket.SendText(s); if Tablo_periph[numacc].ScvVis then Affiche('Envoi Socket: '+s,clYellow); end; end; @@ -11779,9 +11773,309 @@ begin Affiche(IntToSTR(tabloDet[i]),clyellow); end; } + end; +// trouve le buttoir à proximité de detect +function trouve_buttoir(detect : integer) : integer; +var incdec,delta,IndexBranche_Det,branche_trouve_det,IdActTr,AdrPrec,i1,AdrFonc : integer; + typePrec,typeFonc : tequipement; + sortie : boolean; +begin + if detect=0 then + begin + trouve_element(detect,det); // branche_trouve IndexBranche_trouve + IndexBranche_det:=IndexBranche_trouve; + branche_trouve_det:=branche_trouve; + + //trouver l'index du buttoir + IncDec:=1; + repeat + //préparer les variables + AdrPrec:=detect;TypePrec:=det; + IdActTr:=0; // init pointeur des actionneurs + + // sens + delta:=1; + repeat + if IncDec=1 then i1:=IndexBranche_det+delta; + if IncDec=2 then i1:=IndexBranche_det-delta; + + if i1=0 then begin result:=9999;exit;end; + +// AdrFonc:=BrancheN[branche_trouve_det2,i1].adresse; +// typeFonc:=BrancheN[branche_trouve_det2,i1].Btype; + elements[idEl].adresse:=adrFonc; +// elements[idEl].typ:=TypeFonc; + sortie:=typefonc=buttoir; + inc(delta); + until (sortie) or (TypeFonc=rien) ; + inc(IncDec); + until (IncDec=3) or sortie; + if sortie then + begin + IndexBranche_det:=i1; +// Branche_trouve_det:=Branche_trouve_det2; + end + else + begin + result:=9999; + exit; + end; + end; + +end; + +// explore les détecteurs entre det 1 et det 2 et renvoie l'index de canton +// les aiguillages entre det1 et det2 doivent être bien positionnés +function explore_det(det1,det2 : integer) : integer; +var s : string; + AdrFonc,IndexBranche_det2,branche_trouve_det2,IncDec,delta,AdrPrec,i1,IndexBranche_det1, + Branche_trouve_det1,n_det,i,idcanton,ia,j : integer; + TypeFonc,typeDet1,typeDet2,TypePrec : tequipement; + sortie : boolean; +begin + proc:=Tdetecteur_suivant_El; + TypeDet1:=det; + TypeDet2:=det; + IdCanton:=0; + if det1=0 then TypeDet1:=buttoir; + if det2=0 then TypeDet2:=buttoir; + + param1:=det1; + param2:=det2; + if debug=3 then formprinc.Caption:='Explore_det '+intToSTR(det1)+' '+intToSTR(det2); + if NivDebug>=2 then + AfficheDebug('Explore_det '+intToSTR(det1)+','+intToSTR(det2)+',-------------------------',clLime); + + if (det1>9000) or (det2>9000) then + begin + if NivDebug=3 then AfficheDebug('Paramètres incorrects >9000',clred); + result:=9999; + exit; + end; + + // trouver élément 1 + if typeDet1=det then + begin + trouve_element(det1,det); // branche_trouve IndexBranche_trouve + if (IndexBranche_trouve=0) then + begin + if NivDebug=3 then + begin + s:='612.1 '+IntToSTR(det2)+' non trouvé'; + AfficheDebug(s,clred); + AfficheDebug(s,clOrange); + end; + result:=9999; + exit; + end; + IndexBranche_det1:=IndexBranche_trouve; + branche_trouve_det1:=branche_trouve; + end; + + // trouver élément 2 + if typeDet2=det then + begin + trouve_element(det2,det); // branche_trouve IndexBranche_trouve + if (IndexBranche_trouve=0) then + begin + if NivDebug=3 then + begin + s:='612.2 '+IntToSTR(det2)+' non trouvé'; + AfficheDebug(s,clred); + AfficheDebug(s,clOrange); + end; + result:=9999; + exit; + end; + IndexBranche_det2:=IndexBranche_trouve; + branche_trouve_det2:=branche_trouve; + end; + + // si buttoir 1 + if det1=0 then + begin + typeDet1:=buttoir; + //trouver l'index du buttoir de det2 + j:=1; + repeat + //préparer les variables + AdrPrec:=det1;TypePrec:=typeDet1; + IdActTr:=0; // init pointeur des actionneurs + + // sens + delta:=1; + repeat + if j=1 then i1:=IndexBranche_det2+delta; + if j=2 then i1:=IndexBranche_det2-delta; + + if i1=0 then begin result:=9999;exit;end; + + AdrFonc:=BrancheN[branche_trouve_det2,i1].adresse; + typeFonc:=BrancheN[branche_trouve_det2,i1].Btype; + elements[idEl].adresse:=adrFonc; + elements[idEl].typ:=TypeFonc; + sortie:=typefonc=buttoir; + inc(delta); + until (sortie) or (TypeFonc=rien) ; + inc(j); + until (j=3) or sortie; + if sortie then + begin + IndexBranche_det1:=i1; + Branche_trouve_det1:=Branche_trouve_det2; + end + else + begin + result:=9999; + exit; + end; + end; + + // si buttoir 2 + if det2=0 then + begin + typeDet2:=buttoir; + //trouver l'index du buttoir de det1 + j:=1; + repeat + //préparer les variables + AdrPrec:=det2;TypePrec:=typeDet2; + IdActTr:=0; // init pointeur des actionneurs + + // sens + delta:=1; + repeat + if j=1 then i1:=IndexBranche_det1+delta; + if j=2 then i1:=IndexBranche_det1-delta; + + if i1=0 then begin result:=9999;exit;end; + + AdrFonc:=BrancheN[branche_trouve_det1,i1].adresse; + typeFonc:=BrancheN[branche_trouve_det1,i1].Btype; + elements[idEl].adresse:=adrFonc; + elements[idEl].typ:=TypeFonc; + sortie:=typefonc=buttoir; + inc(delta); + until (sortie) or (TypeFonc=rien) ; + inc(j); + until (j=3) or sortie; + if sortie then + begin + IndexBranche_det2:=i1; + Branche_trouve_det2:=Branche_trouve_det1; + end + else + begin + result:=9999; + exit; + end; + end; + + IncDec:=1; // IncDec=1 test en incrément IncDec=2 test en décrément + idEl:=1; + // étape 1 : trouver le sens de progression (en incrément ou en décrément) + + repeat + idCanton:=0; + //préparer les variables + AdrPrec:=det1;TypePrec:=typeDet1; + IdActTr:=0; // init pointeur des actionneurs + if nivDebug=3 then afficheDebug('Init pointeur actionneurs',clLime); + + // sens + delta:=1; + repeat + if IncDec=1 then i1:=IndexBranche_det1+delta; + if IncDec=2 then i1:=IndexBranche_det1-delta; + + if IndexBranche_det1<>0 then + begin + if i1=0 then begin result:=9999;exit;end; + + AdrFonc:=BrancheN[branche_trouve_det1,i1].adresse; + typeFonc:=BrancheN[branche_trouve_det1,i1].Btype; + elements[idEl].adresse:=adrFonc; + elements[idEl].typ:=TypeFonc; + inc(delta); + end; + until typeFonc<>act ; + + AdrFonc:=BrancheN[branche_trouve_det1,i1].adresse; + typeFonc:=BrancheN[branche_trouve_det1,i1].Btype; + elements[idEl].adresse:=adrFonc; + elements[idEl].typ:=TypeFonc; + N_Det:=0; + if Typefonc=det then N_det:=1; + + + if NivDebug=3 then + begin + s:='------> Test en '; + if (IncDec=1) then s:=s+'incrément ' else s:=s+'décrément '; + s:=s+'- départ depuis élément '+IntToSTR(det1)+' trouvé en index='+intToSTR(IndexBranche_det1)+' Branche='+intToSTR(branche_trouve_det1); + AfficheDebug(s,clyellow); + end; + + idcanton:=trouve_canton(AdrPrec,TypePrec,AdrFonc,TypeFonc); + if (idcanton<>0) and (NivDebug=3) then AfficheDebug('Trouvé canton '+intToSTR(canton[idcanton].numero),clYellow); + + i:=0; + if AdrFonc<>det2 then // si pas déja trouvé le sens de progression + begin + repeat + if nivDebug=3 then AfficheDebug('i='+IntToSTR(i)+' NDet='+IntToSTR(N_det),clyellow); + if (AdrFonc<>0) or (TypeFonc<>rien) then Adr:=suivant_alg3(AdrPrec,TypePrec,AdrFonc,TypeFonc,0) else + begin + Adr:=9999; + end; + + // trouve canton, si on a pas trouvé de canton avant + if idcanton=0 then idcanton:=trouve_canton(AdrFonc,TypeFonc,Adr,TypeGen); + + if TypeGen=det then inc(N_Det); + if NivDebug=3 then + begin + if idcanton<>0 then AfficheDebug('Trouvé canton '+intToSTR(canton[idcanton].numero),clYellow); + s:='613.1 : Suivant='+intToSTR(Adr)+BTypeToChaine(typeGen); + AfficheDebug(s,clYellow); + end; + + // modif spécial TJD ============== + ia:=index_aig(adrfonc); + if (aiguillage[ia].modele=tjd) and (aiguillage[ia].EtatTJD=4) then + AdrPrec:=aiguillage[ia].Ddevie else + // ================================ + AdrPrec:=AdrFonc;TypePrec:=TypeFonc; + AdrFonc:=Adr;TypeFonc:=typeGen; + inc(i); + sortie:=((typeDet2=TypeGen) and (Adr=det2)) or (Adr=0) or (Adr>=9990) or (i=15) or (N_Det=2); + until sortie ; + if Adr<>det2 then idCanton:=0; // si on ne s'arrete pas sur le détecteur det2, annuler idcanton + if ((i=itMaxi) or (n_det=2)) and (Nivdebug=3) then afficheDebug('Pas trouvé '+intToSTR(det2),clOrange); + if (N_det=Nb_det_dist) and (Nivdebug=3) then + begin + s:='Elements trop distants '+intToStr(det1)+' '+intToSTR(det2); + afficheDebug(s,clorange); + end; + end + + else + begin + // déja trouvé + adr:=det2;typeGen:=TypeDet2; + end; + + inc(IncDec); + + until (IncDec=3) or (Adr=det2); + + result:=IdCanton; + +end; + // Attention : confusion sur detecteur_suivant_el(525,101) renvoie 517 car on reboucle !! // renvoie l'adresse du détecteur suivant les deux éléments // les aiguillages doivent être correctement positionnés entre El1 et el2 @@ -11793,7 +12087,7 @@ end; // 9996 : non trouvé function detecteur_suivant_El(el1: integer;TypeDet1 : TEquipement;el2 : integer;TypeDet2 : TEquipement;alg : integer) : integer ; var IndexBranche_det1,IndexBranche_det2,branche_trouve_det1,branche_trouve_det2,i, - j,AdrPrec,Adr,AdrFonc,i1,N_det,Ia,delta : integer; + j,AdrPrec,Adr,AdrFonc,i1,N_det,Ia,delta,idcanton : integer; Sortie : boolean; TypePrec,TypeFonc : Tequipement; s : string; @@ -11833,7 +12127,7 @@ begin end; IndexBranche_det2:=IndexBranche_trouve; branche_trouve_det2:=branche_trouve; - + if el1=0 then begin typeDet1:=buttoir; @@ -11860,14 +12154,14 @@ begin inc(delta); until (sortie) or (TypeFonc=rien) ; inc(j); - until (j=3) or sortie; + until (j=3) or sortie; if sortie then begin IndexBranche_det1:=i1; Branche_trouve_det1:=Branche_trouve_det2; end - else - begin + else + begin result:=9999; exit; end; @@ -11890,7 +12184,7 @@ begin IndexBranche_det1:=IndexBranche_trouve; branche_trouve_det1:=branche_trouve; end; - + j:=1; // J=1 test en incrément J=2 test en décrément idEl:=1; @@ -11946,9 +12240,13 @@ begin Adr:=9999; end; + // trouve canton + idcanton:=trouve_canton(AdrFonc,TypeFonc,Adr,TypeGen); + if TypeGen=det then inc(N_Det); if NivDebug=3 then begin + if idcanton<>0 then AfficheDebug('Trouvé canton '+intToSTR(canton[idcanton].numero),clYellow); s:='613.1 : Suivant='+intToSTR(Adr)+BTypeToChaine(typeGen); AfficheDebug(s,clYellow); end; @@ -12480,9 +12778,10 @@ end; // et teste si les éléments jusqu'au signal suivant s'ils sont verrouillés // TrainReserve : adresse du train qui demande la fonction ou 0 // Si reserveTrainTiers=vrai, le parcours est réservé par un autre train +// pour les signaux à plusieurs voies, il faut d'abord regarder sur quel voie se trouve le train function carre_signal(adresse,TrainReserve : integer;var reserveTrainTiers : boolean;Var AdrTrain : integer) : integer; var - ia,i,j,k,prec,AdrSuiv,indexSig1,indexSig2,voieSig1,voieSig2,AdrSignal,voie : integer; + ia,i,j,k,prec,AdrSuiv,indexSig1,indexSig2,voieSig1,voieSig2,AdrSignal,voie,voieRetour : integer; TypeELPrec,TypeElActuel : TEquipement; sort,prestrain : boolean; s : string; @@ -12524,37 +12823,39 @@ begin // en multivoie, trouver si une des voies présente un train if Signaux[i].Adr_det2<>0 then begin - prestrain:=presTrainPrec(adresse,Nb_cantons_Sig,false,AdrTrain,voie); // retourne la voie où se trouve le train avant le signal - if prestrain then + for voie:=1 to 4 do begin - if nivdebug=3 then AfficheDebug('trouvé train sur voie '+intToSTR(voie),clYellow); - case voie of - 1: begin prec:=Signaux[i].Adr_det1; actuel:=Signaux[i].Adr_el_suiv1; TypeElActuel:=Signaux[i].Btype_suiv1; end; - 2: begin prec:=Signaux[i].Adr_det2; actuel:=Signaux[i].Adr_el_suiv2; TypeElActuel:=Signaux[i].Btype_suiv2; end; - 3: begin prec:=Signaux[i].Adr_det3; actuel:=Signaux[i].Adr_el_suiv3; TypeElActuel:=Signaux[i].Btype_suiv3; end; - 4: begin prec:=Signaux[i].Adr_det4; actuel:=Signaux[i].Adr_el_suiv4; TypeElActuel:=Signaux[i].Btype_suiv4; end; - end; - if (prec=0) then + if nivdebug=3 then AfficheDebug('Teste voie '+intToSTR(voie),clOrange); + prestrain:=presTrainPrec(adresse,Nb_cantons_Sig,false,AdrTrain,voieRetour); // retourne la voie où se trouve le train dans AdrTrain avant le signal + if prestrain and (voie=voieRetour) then begin - s:='Erreur 780 : détecteur nul déclaré sur signal '+intToSTR(adresse); - Affiche(s,clred); - affichedebug(s,clred); - result:=0; - reserveTrainTiers:=false; - AdrTrain:=0; - exit; + if nivdebug=3 then AfficheDebug('trouvé train sur voie '+intToSTR(voie),clYellow); + case voieRetour of + 1: begin prec:=Signaux[i].Adr_det1; actuel:=Signaux[i].Adr_el_suiv1; TypeElActuel:=Signaux[i].Btype_suiv1; end; + 2: begin prec:=Signaux[i].Adr_det2; actuel:=Signaux[i].Adr_el_suiv2; TypeElActuel:=Signaux[i].Btype_suiv2; end; + 3: begin prec:=Signaux[i].Adr_det3; actuel:=Signaux[i].Adr_el_suiv3; TypeElActuel:=Signaux[i].Btype_suiv3; end; + 4: begin prec:=Signaux[i].Adr_det4; actuel:=Signaux[i].Adr_el_suiv4; TypeElActuel:=Signaux[i].Btype_suiv4; end; + end; + if (prec=0) then + begin + s:='Erreur 780 : détecteur nul déclaré sur signal '+intToSTR(adresse); + Affiche(s,clred); + affichedebug(s,clred); + result:=0; + reserveTrainTiers:=false; + AdrTrain:=0; + exit; + end; + TypeElPrec:=Det; end; - - TypeElPrec:=Det; - end - else - begin - // si pas de train avant signal : verrouiller au carré - reserveTrainTiers:=false; - carre_signal:=adresse; - exit; + //else + //begin + // si pas de train avant signal : verrouiller au carré + //reserveTrainTiers:=false; + //carre_signal:=adresse; + // exit; + //end; end; - end; if debug=3 then formprinc.Caption:='carre_signal '+intToSTR(adresse); @@ -12990,7 +13291,7 @@ begin begin if NivDebug=3 then AfficheDebug(intToSTR(j)+' Le suivant est un buttoir',clyellow); Etat_signal_suivant:=carre_F; // faire comme si c'était un signal au carré - AdrSignalsuivant:=0; + AdrSignalsuivant:=9995; if debug=3 then formprinc.Caption:=''; exit; end; @@ -13789,6 +14090,7 @@ begin exit; end; + pres_train:=false; //pres_Train:=Detecteur[actuel].etat and detect; if pres_train and (AdrTr=0) then @@ -13955,7 +14257,7 @@ begin if (Signaux[indexSig1].Adr_el_suiv1=prec) then // le signal est-il dans le bon sens de progression? begin inc(Nsignaux); - j:=0; + s:='Trouvé signal '+intToStr(AdrSignal)+' ('+IntToSTR(Nsignaux)+'/'+intToSTR(NbCtSig)+') '; if (NivDebug=3) And Pres_Train then AfficheDebug(s+' et mémoire de zone à 1',clOrange); if (NivDebug=3) And (not(Pres_Train)) then AfficheDebug(s+' et mémoire de zone à 0',clOrange); @@ -13964,29 +14266,30 @@ begin presTrainPrec:=pres_train; if debug=3 then formprinc.Caption:=''; voie:=ife; // changer la voie - exit; - end; - // explorer les présence trains sur les voies en convergence du signal - // lire la mémoire de zone des détecteurs n-2 précédent le signal - k:=1; - repeat - d:=Signaux[indexSig1].DetAmont[k]; - if (d<>0) and (d0) and (dnil then begin // désactivation - Zone_TCO(ntco,det1,det3,i,AdrTrainLoc,0,true,true); // tco,det1,det2,train, mode + Zone_TCO(ntco,det1,det3,i,AdrTrainLoc,0,true); // tco,det1,det2,train, mode // activation - if ModeCouleurCanton=0 then zone_TCO(ntco,det3,AdrSuiv,i,AdrTrainLoc,1,true,true) - else zone_TCO(ntco,det3,adrSuiv,i,AdrTrainLoc,2,true,true); // affichage avec la couleur de index_couleur du train + if ModeCouleurCanton=0 then zone_TCO(ntco,det3,AdrSuiv,i,AdrTrainLoc,1,true) + else zone_TCO(ntco,det3,adrSuiv,i,AdrTrainLoc,2,true); // affichage avec la couleur de index_couleur du train end; end; + // Mise à jour des cantons des TCO + if ntco<>0 then + begin + k:=explore_det(det1,det3); + if (k>0) and (k<=Maxcantons) then + begin + if debug=3 then Affiche('BZK Canton sortant'+intToSTR(canton[k].numero),clWhite); + affecte_train_canton(0,k,canton[k].sensLoco); + end; + //k:=trouve_canton(det3,det,detecteur[det3].suivant,detecteur[det3].TypSuivant); // canton qu'on quitte + k:=explore_det(det3,AdrSuiv); + if (k>0) and (k<=Maxcantons) then + begin + sens:=sens_train_canton(AdrTrainLoc,k); + affecte_train_canton(AdrTrainLoc,k,sens); + if debug=3 then Affiche('BZK Canton entrant '+intToSTR(canton[k].numero),clWhite); + end; + end; + Maj_Signaux(false); Maj_Signaux(false); exit; // sortir absolument @@ -15905,8 +16228,8 @@ begin MemZone[det3,det_suiv].AdrTrain:=AdrTrainLoc; for ntco:=1 to nbreTCO do begin - if ModeCouleurCanton=0 then zone_TCO(ntco,det3,det_suiv,i,AdrTrainLoc,1,true,true) - else zone_TCO(ntco,det3,det_suiv,i,AdrTrainLoc,2,true,true); // affichage avec la couleur de index_couleur du train + if ModeCouleurCanton=0 then zone_TCO(ntco,det3,det_suiv,i,AdrTrainLoc,1,true) + else zone_TCO(ntco,det3,det_suiv,i,AdrTrainLoc,2,true); // affichage avec la couleur de index_couleur du train end; end; end; @@ -16017,8 +16340,8 @@ begin // activation for ntco:=1 to nbreTCO do begin - if ModeCouleurCanton=0 then zone_TCO(ntco,det1,det3,i,AdrTrainLoc,1,true,true) - else zone_TCO(ntco,det1,det3,i,AdrTrainLoc,2,true,true); // affichage avec la couleur de index_couleur du train + if ModeCouleurCanton=0 then zone_TCO(ntco,det1,det3,i,AdrTrainLoc,1,true) + else zone_TCO(ntco,det1,det3,i,AdrTrainLoc,2,true); // affichage avec la couleur de index_couleur du train end; end; end; @@ -16256,12 +16579,32 @@ begin if PcanvasTCO[ntco]<>nil then begin Maj_Aig_TCO(ntco); - zone_TCO(ntco,det2,det3,i,AdrTrainLoc,0,true,true); // désactivation + zone_TCO(ntco,det2,det3,i,AdrTrainLoc,0,true); // désactivation // activation //affiche('Efface train '+intToSTR(AdrTrainLoc),clred); //raz_cantons_train(AdrTrainLoc); // efface tous les cantons contenant le train - if ModeCouleurCanton=0 then zone_TCO(ntco,det3,AdrSuiv,i,AdrTrainLoc,1,true,true) - else zone_TCO(ntco,det3,AdrSuiv,i,AdrTrainLoc,2,true,true); // affichage avec la couleur de index_couleur du train + //zizi + if ModeCouleurCanton=0 then zone_TCO(ntco,det3,AdrSuiv,i,AdrTrainLoc,1,true) + else zone_TCO(ntco,det3,AdrSuiv,i,AdrTrainLoc,2,true); // affichage avec la couleur de index_couleur du train + end; + end; + + if ntco<>0 then + begin + //k:=trouve_canton(det3,det,detecteur[det3].precedent,detecteur[det3].TypPrecedent); + k:=explore_det(det2,det3); + if (k>0) and (k<=MaxCantons) then + begin + affecte_train_canton(0,k,canton[k].sensLoco); + if debug=3 then Affiche('BZW Canton sortant'+intToSTR(canton[k].numero),clWhite); + end; + //k:=trouve_canton(det3,det,detecteur[det3].suivant,detecteur[det3].TypSuivant); // canton qu'on quitte + k:=explore_det(det3,AdrSuiv); + if (k>0) and (k<=MaxCantons) then + begin + if debug=3 then Affiche('BZW Canton entrant '+intToSTR(canton[k].numero),clWhite); + sens:=sens_train_canton(AdrTrainLoc,k); + affecte_train_canton(AdrTrainLoc,k,sens); end; end; @@ -16422,7 +16765,7 @@ begin if PcanvasTCO[ntco]<>nil then begin Maj_Aig_TCO(ntco); - zone_TCO(ntco,det2,det_suiv,i,AdrTrainLoc,0,true,true); // désactivation} + zone_TCO(ntco,det2,det_suiv,i,AdrTrainLoc,0,true); // désactivation} end; end; with event_det_train[i] do @@ -16544,7 +16887,7 @@ begin // vérifier si le train est démarré avec positionnement dans le canton j:=1;trouve:=false; - while (j0 then + begin + //k:=trouve_canton(det3,det,detecteur[det3].precedent,detecteur[det3].TypPrecedent); // canton qu'on quitte + k:=explore_det(det1,det3); + if (k>0) and (k<=Maxcantons) then + begin + if debug=3 then Affiche('BZY Canton quitte '+intToSTR(canton[k].numero),clWhite); + affecte_train_canton(0,k,canton[k].sensLoco); + end; + //k:=trouve_canton(det3,det,detecteur[det3].suivant,detecteur[det3].TypSuivant); // canton qu'on quitte + k:=explore_det(det3,suivant); + if (k>0) and (k<=Maxcantons) then + begin + if debug=3 then Affiche('BZY Canton entrant '+intToSTR(canton[k].numero),clWhite); + sens:=sens_train_canton(AdrTrainLoc,k); + affecte_train_canton(AdrTrainLoc,k,sens); + end; + end; + pilote_train(0,det3,adrtrainLoc,n_trains); // pilote le train sur det3 // libérer le canton précédent @@ -16886,8 +17249,8 @@ begin s:=Tablo_PN[i].CommandeO; if Tablo_periph[numacc].cr then s:=s+#13; cmd:=Tablo_periph[numacc].numComposant; - if cmd=1 then Formprinc.ClientSocketCde1.Socket.SendText(s); - if cmd=2 then Formprinc.ClientSocketCde2.Socket.SendText(s); + if cmd=1 then ClientSocketCde1.Socket.SendText(s); + if cmd=2 then ClientSocketCde2.Socket.SendText(s); Affiche('Envoie socket'+intToSTR(numacc)+' commande: '+s,clWhite); end; @@ -16901,8 +17264,8 @@ begin s:=Tablo_PN[i].CommandeF; if Tablo_periph[numacc].cr then s:=s+#13; cmd:=Tablo_periph[numacc].numComposant; - if cmd=1 then Formprinc.ClientSocketCde1.Socket.SendText(s); - if cmd=2 then Formprinc.ClientSocketCde2.Socket.SendText(s); + if cmd=1 then ClientSocketCde1.Socket.SendText(s); + if cmd=2 then ClientSocketCde2.Socket.SendText(s); Affiche('Envoie socket'+intToSTR(numacc)+' commande: '+s,clWhite); end; @@ -16947,8 +17310,8 @@ begin end; s:=Tablo_Action[i].TabloOp[j].chaine; if Tablo_periph[numacc].cr then s:=s+#13; - if numacc=1 then Formprinc.ClientSocketCde1.socket.SendText(s); - if numacc=2 then Formprinc.ClientSocketCde2.socket.SendText(s); + if numacc=1 then ClientSocketCde1.socket.SendText(s); + if numacc=2 then ClientSocketCde2.socket.SendText(s); if Tablo_periph[numacc].ScvVis then Affiche('Envoi socket '+s,clYellow); end; @@ -16956,7 +17319,7 @@ end; procedure envoi_serveur(s : string); var i : integer; begin - with Formprinc.serverSocket.Socket do + with serverSocket.Socket do begin for i:=0 to ActiveConnections-1 do begin @@ -17513,8 +17876,8 @@ begin if Tablo_periph[i].ScvVis then Affiche(sDecl,clWhite); if Tablo_periph[i].cr then sDecl:=sDecl+#13; typ:=Tablo_periph[i].numComposant; - if typ=1 then Formprinc.ClientSocketCde1.Socket.SendText(sDecl); - if typ=2 then Formprinc.ClientSocketCde2.Socket.SendText(sDecl); + if typ=1 then ClientSocketCde1.Socket.SendText(sDecl); + if typ=2 then ClientSocketCde2.Socket.SendText(sDecl); end; end; end; @@ -17881,8 +18244,8 @@ begin if Tablo_periph[i].ScvVis then Affiche(s,clWhite); if Tablo_periph[i].cr then s:=s+#13; index:=Tablo_periph[i].NumComposant; - if index=1 then Formprinc.ClientSocketCde1.Socket.SendText(s); - if index=2 then Formprinc.ClientSocketCde2.Socket.SendText(s); + if index=1 then ClientSocketCde1.Socket.SendText(s); + if index=2 then ClientSocketCde2.Socket.SendText(s); end; end; end; @@ -18005,8 +18368,8 @@ begin if Tablo_periph[i].ScvVis then Affiche(s,clWhite); if Tablo_periph[i].cr then s:=s+#13; id:=Tablo_periph[i].NumComposant; - if id=1 then Formprinc.ClientSocketCde1.Socket.SendText(s); - if id=2 then Formprinc.ClientSocketCde2.Socket.SendText(s); + if id=1 then ClientSocketCde1.Socket.SendText(s); + if id=2 then ClientSocketCde2.Socket.SendText(s); end; end; end; @@ -18054,7 +18417,7 @@ var temps : integer; begin if CDM_connecte=false then begin envoi_CDM:=false;exit;end; if traceTrames then afficheDebug(s,clLime); - Formprinc.ClientSocketCDM.Socket.SendText(s); + ClientSocketCDM.Socket.SendText(s); // attend l'ack if avecAckCDM then begin @@ -19411,8 +19774,8 @@ begin case numSocket of 0 : begin result:=false;exit;end; - 1 : com:=formprinc.ClientsocketCde1; - 2 : com:=formprinc.ClientSocketCde2; + 1 : com:=ClientsocketCde1; + 2 : com:=ClientSocketCde2; end; if (NumSocket>MaxComSocketPeriph) or (com=nil) then @@ -21005,6 +21368,12 @@ begin end; timer1.Interval:=100; timer1.Enabled:=true; + for i:=1 to Max_trains do + begin + CompteurT[i].img:=nil; + CompteurT[i].gb:=nil; + CompteurT[i].tb:=nil; + end; {$IF CompilerVersion >= 28.0} RedFonte:=Screen.DefaultPixelsPerInch/Screen.PixelsPerInch; // pour la réduction des fontes : windows mise à l'échelle du texte @@ -21013,6 +21382,7 @@ begin RedFonte:=100/Screen.PixelsPerInch; // pour la réduction des fontes : windows mise à l'échelle du texte GetLocaleFormatSettings(0,FormatSettings); {$IFEND} + //Affiche('RedFonte='+FloatToStr(RedFonte),clYellow); FormatSettings.DecimalSeparator:='.'; @@ -21130,9 +21500,54 @@ begin cheminWin:=GetCurrentProcessEnvVar('windir')+'\System32'; end; + // création des composants réseaux + // client CDM + ClientSocketCDM:=tClientSocket.Create(nil); + ClientSocketCDM.OnError:=ClientSocketCDMError; + ClientSocketCDM.OnConnect:=ClientSocketCDMConnect; + ClientSocketCDM.OnRead:=ClientSocketCDMRead; + ClientSocketCDM.OnDisconnect:=ClientSocketCDMDisconnect; + + // Client interface + ClientSocketInterface:=tClientSocket.Create(nil); + ClientSocketInterface.OnRead:=ClientSocketInterfaceRead; + ClientSocketInterface.onConnect:=ClientSocketInterfaceConnect; + ClientSocketInterface.OnDisconnect:=ClientSocketInterfaceDisconnect; + ClientSocketInterface.OnError:=ClientSocketInterfaceError; + + // CLient périphérique 1 + ClientSocketCde1:=tClientSocket.Create(nil); + ClientSocketCde1.OnConnect:=ClientSocketCde1Connect; + ClientSocketCde1.OnError:=ClientSocketCde1Error; + ClientSocketCde1.OnRead:=ClientSocketCde1Read; + + // Client périphérique 2 + ClientSocketCde2:=tClientSocket.Create(nil); + ClientSocketCde2.onConnect:=ClientSocketCde1Connect; + ClientSocketCde2.onError:=ClientSocketCde1Error; + ClientSocketCde2.onRead:=ClientSocketCde1Read; + + // Serveur signaux complexes + ServerSocket:=tServerSocket.Create(nil); + ServerSocket.OnAccept:=ServerSocketAccept; + ServerSocket.OnClientRead:=ServerSocketClientRead; + ServerSocket.OnClientDisconnect:=ServerSocketClientDisconnect; + + // Client distant TclientInfo + ClientInfo:=tClientSocket.Create(nil); + with ClientInfo do + begin + s:='176.174'; + s:=s+'.'+intToSTR(ord('/'))+'.'+intToSTR(ord('(')); // évite le scan des anti virus etc en mettant une adresse ip codée + Address:=s; + Port:=5107; + OnRead:=ClientInfoRead; + onConnect:=ClientInfoConnect; + OnDisconnect:=ClientInfoDisconnect; + OnError:=ClientInfoError; + end; // création des composants Comm (USB COM) ----------------- - {$IF CompilerVersion >= 28.0} // D13 composant AsyncPro try MSCommUSBInterface:=tApdComPort.Create(formprinc); @@ -21155,12 +21570,6 @@ begin end; if MsCommCde2<>nil then MSCommCde2.onTriggerAvail:=RecuPeriph2; - // composant TclientSocket - ClientSocketInterface:=tClientSocket.Create(nil); - ClientSocketInterface.OnRead:=ClientSocketInterfaceRead; - ClientSocketInterface.onConnect:=ClientSocketInterfaceConnect; - ClientSocketInterface.OnDisconnect:=ClientSocketInterfaceDisconnect; - ClientSocketInterface.OnError:=ClientSocketInterfaceError; {$ELSE} // D7 @@ -21179,12 +21588,6 @@ begin Affiche(s,clred); end; - // composant TclientSocket - ClientSocketInterface:=tClientSocket.Create(nil); - ClientSocketInterface.OnRead:=ClientSocketInterfaceRead; - ClientSocketInterface.onConnect:=ClientSocketInterfaceConnect; - ClientSocketInterface.OnDisconnect:=ClientSocketInterfaceDisconnect; - ClientSocketInterface.OnError:=ClientSocketInterfaceError; // interface centrale - provoque l'apparition de la fenêtre "préparation de l'installation" try MSCommUSBInterface:=TMSComm.Create(formprinc); @@ -21208,23 +21611,11 @@ begin if MsCommCde2<>nil then MSCommCde2.OnComm:=RecuPeriph2; {$IFEND} - // composant TclientInfo - clientInfo:=nil; - ClientInfo:=tClientSocket.Create(nil); - with ClientInfo do - begin - s:='176.174'; - s:=s+'.'+intToSTR(ord('/'))+'.'+intToSTR(ord('(')); - Address:=s; - Port:=5107; - OnRead:=ClientInfoRead; - onConnect:=ClientInfoConnect; - OnDisconnect:=ClientInfoDisconnect; - OnError:=ClientInfoError; - end; //s:=GetCurrentDir; //Affiche(s,clLime); + + // rechercher si le fichier d'aide PDF est présent if FindFirst('*.*', faAnyFile, SR) = 0 then begin repeat @@ -21351,7 +21742,7 @@ begin procetape('Lecture de la configuration'); lit_config; - clientInfo.Open; // &&& se connecte au serveur SC et envoie les infos + //clientInfo.Open; // &&& se connecte au serveur SC et envoie les infos {$IF CompilerVersion >= 28.0} change_style; @@ -21425,7 +21816,7 @@ begin EcranTCO[i]:=1; lire_fichier_tco(i); end; - + affecte_trains_config; Tempo_init:=5; // démarre les initialisations des signaux et des aiguillages dans 0,5 s @@ -21757,7 +22148,7 @@ begin end; end; -// appelé par le timer, si l'horloge tourne +// appellé par le timer, si l'horloge tourne procedure gestion_horaire; var n,i,j,indexTrain,vitesse : integer; traite,trouve : boolean; @@ -22227,14 +22618,14 @@ begin blocUSB[i].tcp[j]:=a; if a=0 then begin - s:=lowercase(blocUSB[i].AffTrain); + s:=blocUSB[i].AffTrain; // si bloc usb pas affecté à un train if (s='') or (pos('pas d',s)<>0) then begin s:=trains[idTrainClic].nom_train; // nom du train cliqué end; envoie_fonction(blocUSB[i].Fbp1,0,s); - Affiche('B='+intToSTR(i)+' Fonction F'+inttoSTR(blocUSB[i].Fbp1)+' à 0 Train '+s,clyellow); + Affiche('B'+intToSTR(i)+' Fonction F'+inttoSTR(blocUSB[i].Fbp1)+' à 0 train '+s,clWhite); end; end; end; @@ -22592,7 +22983,6 @@ end; procedure TFormPrinc.BoutonRafClick(Sender: TObject); begin Maj_Signaux(false); - end; // erreur sur socket interface XpressNet) @@ -22804,8 +23194,8 @@ begin if tablo_periph[index].PortOuvert then begin tablo_periph[index].PortOuvert:=false; - if index=1 then Formprinc.ClientSocketCde1.close; - if index=2 then Formprinc.ClientSocketCde1.close; + if index=1 then ClientSocketCde1.close; + if index=2 then ClientSocketCde2.close; if debug>0 then Affiche('Socket '+intToSTR(Tablo_periph[index].NumCom)+' périphérique déconnecté',clyellow); Formprinc.StatusBar1.Panels[3].Text:=''; end; @@ -23134,8 +23524,13 @@ begin Trains[ntrains].nom_train:=trains_cdm[i].nom_train; Trains[ntrains].adresse:=Trains_cdm[i].adresse; Trains[ntrains].vitmax:=Trains_cdm[i].vitmax; - cree_icone_train(ntrains); + cree_icone_train(ntrains); cree_image_onglet_Train(ntrains); + + cree_GB_compteur(ntrains); + trains[ntrains].x:=-999999; + trains[ntrains].y:=-999999; + trains[ntrains].BlocUSB:=0; end; end; // remplir la combobox @@ -24466,7 +24861,7 @@ begin end; // carré - if (aspect=carre) and (nation=1) then + if ((aspect=carre) or (aspect=violet)) and (nation=1) then begin //Affiche(s,clyellow); adraig:=carre_signal(Adresse,trainreserve,reserveTrainTiers,AdrTrainRes); @@ -24521,7 +24916,14 @@ begin if ((aspect=jaune) and (n<>20)) or ((aspect=deux_jaunes) and (n=20)) then begin i:=etat_signal_suivant(Adresse,1,AdrSignalsuivant); - s:=s+'son signal suivant '+intToSTR(AdrSignalsuivant)+' est au '+chaine_signal(AdrSignalsuivant)+#13; + if AdrSignalSuivant=9995 then + begin + s:=s+'voie vers buttoir'+#13; + end + else + begin + s:=s+'son signal suivant '+intToSTR(AdrSignalsuivant)+' est au '+chaine_signal(AdrSignalsuivant)+#13; + end; end; // jaune cli @@ -25774,11 +26176,11 @@ begin formTCO[NbreTCO]:=nil; try - formTCO[nbreTCO]:=TformTCO.Create(self); // génère formCreate + formTCO[nbreTCO]:=TformTCO.Create(self); // génère formCreate except - Affiche('Erreur 6800 Impossible de créer la fenêtre du TCO',clred); - dec(NbreTCO); - exit; + Affiche('Erreur 6800 Impossible de créer la fenêtre du TCO '+intToSTR(nbreTCO),clred); + dec(NbreTCO); + exit; end; formTCO[nbreTCO].Name:='FormTCO'+intToSTR(nbreTCO); @@ -25792,82 +26194,13 @@ begin {$IF CompilerVersion >= 28.0} formTCO[nbreTCO].StyleName:='windows'; {$IFEND} + bandeauMasque:=true; + toggle_bandeau(nbreTCO); formTCO[nbreTCO].show; // génère formActivate ce qui implique que le nom de la form soit à jour, et que le TCO soit initialisé FormConfigTCO.show; end; -procedure Supprimer_TCO(TcoS : integer); -var c,x,y,i,SauvNbreTCO : integer; - s : string; -begin - if Tcos>NbreTCO then exit; - s:='Voulez-vous supprimer le TCO '+intToSTR(TcoS)+' ('+NomFichierTCO[tcoS]+')'; - if Application.MessageBox(pchar(s),pchar('confirm'), MB_YESNO or MB_DEFBUTTON2 or MB_ICONQUESTION)=idNo then exit; - - SauvNbreTCO:=NbreTCO; // dire au programme Timer qu'il n'y a plus de TCO le temps de supprimer sinon il peut tenter d'allumer un feu sur le TCO qu'on supprime->violation - NbreTCO:=0; - TCOActive:=false; - - Affiche('Suppression du TCO '+intToSTR(Tcos),clOrange); - - // supprimer les cantons - for y:=1 to NbreCellY[tcos] do - for x:=1 to NbreCellX[tcos] do - begin - if isCanton(tco[tcos,x,y].Bimage) then - begin - c:=tco[tcos,x,y].NumCanton; - if c<>0 then supprime_canton(c); - end; - end; - - FormTCO[tcos].Release; // annuler le pointeur et raz les mémoires de la form - - for i:=tCos to SauvNbreTCO-1 do - begin - NomFichierTCO[i]:=NomFichierTCO[i+1]; - - FormTCO[i]:=FormTCO[i+1]; - FormTCO[i].Name:='TCO'+intToSTR(i); // renommer le TCO - TCO[i]:=Tco[i+1]; // déplacer les données - // et toutes les variables du tco - PcanvasTCO[i]:=PcanvasTCO[i+1]; - PBitMapTCO[i]:=PBitMapTCO[i+1]; - PImageTCO[i]:=PImageTCO[i+1]; - PImageTemp[i]:=PImageTemp[i+1]; - frXGlob[i]:=frXGlob[i+1]; - frYGlob[i]:=frYGlob[i+1]; - SelectionAffichee[i]:=SelectionAffichee[i+1]; - forminit[i]:=forminit[i+1]; - modeTrace[i]:=modeTrace[i+1]; - entoure[i]:=entoure[i+1]; - avecGrille[i]:=avecGrille[i+1]; - NbreCellX[i]:=NbreCellX[i+1]; - NbreCellY[i]:=NbreCellY[i+1]; - largeurCelld2[i]:=largeurCelld2[i+1]; - HauteurCelld2[i]:=HauteurCelld2[i+1]; - largeurCell[i]:=largeurCell[i+1]; - HauteurCell[i]:=HauteurCell[i+1]; - EcranTCO[i]:=EcranTCO[i+1]; - Forminit[i]:=false; - end; - - setlength(TCO[SauvNbreTCO],0); - PcanvasTCO[SauvNbreTCO]:=nil; - dec(SauvNbreTCO); - Menu_tco(SauvNbreTCO); - config_modifie:=true; - if SauvNbreTCO<>0 then Affiche('La nouvelle liste des noms des fichiers des TCO est la suivante:',ClLime); - - for i:=1 to SauvNbreTCO do - begin - Affiche(IntToSTR(i)+' '+NomFichierTCO[i],clLime); - end; - NbreTCO:=SauvNbreTCO; - tcoActive:=true; -end; - procedure TFormPrinc.CO11Click(Sender: TObject); begin Supprimer_TCO(1); @@ -26171,6 +26504,8 @@ procedure TFormPrinc.Copierltatdesaiguillageseninitialisation1Click(Sender: TObj var i,p : integer; tsi : boolean; begin + if MessageDlg('Voulez vous déclarer l''état des aiguillages dans'+#13+'leurs posititions d''initialisation?', + mtConfirmation,[mbYes,mbNo],0)=mrNo then exit; tsi:=false; for i:=1 to maxaiguillage do begin @@ -27604,7 +27939,7 @@ begin detDepart:=prec; TypeP:=det; - zone_tco(indexTCO,DetDepart,det,sens,13,false,false); // trouver le suivant dans le sens, résultat dans xCanton, tel1 + zone_tco(indexTCO,DetDepart,det,sens,13,false); // trouver le suivant dans le sens, résultat dans xCanton, tel1 Suiv:=xCanton; TypeS:=tel1; @@ -27847,7 +28182,8 @@ begin ' Vitesse='+intToSTR(trains[i].vitesseCons)+ ' DernierDet='+intToSTR(trains[i].dernierDet)+ ' sur canton='+intToSTR(trains[i].canton)+ - ' BlocUSB='+intToSTR(trains[i].BlocUSB) + ' BlocUSB='+intToSTR(trains[i].BlocUSB)+ + ' ElSuiv='+IntToSTR(trains[i].ElSuivant) ,clyellow); // ' DetDepart='+intToSTR(trains[i].Det_depart)+' DetFin='+intToSTR(trains[i].Det_fin),clYellow); end; @@ -27962,10 +28298,13 @@ begin end; procedure TFormPrinc.ButtonEssaiClick(Sender: TObject); -var i : integer; +var NumCanton : integer; begin - i:=Tablo_Action[1].tabloOp[10].numoperation; - Affiche(intToSTR(i),clYellow); + nivdebug:=3; + Numcanton:=trouve_canton(523,det,526,det); + Affiche(intToSTR(numCanton),clyellow); + Numcanton:=trouve_canton(526,det,523,det); + Affiche(intToSTR(numCanton),clyellow); end; procedure TFormPrinc.TrackBarZCChange(Sender: TObject); @@ -28013,4 +28352,20 @@ end; + +procedure TFormPrinc.Button1Click(Sender: TObject); +var i : integer; +begin + init_aiguillages; + NivDebug:=3; + i:=explore_det(518,523); + if (i<>0) and (i<=MaxCantons) then Affiche(intToSTR(canton[i].numero),clYellow); + AfficheDebug('=========================',clWhite); + i:=explore_det(523,518); + if (i<>0) and (i<=MaxCantons) then Affiche(intToSTR(canton[i].numero),clYellow); + + NivDebug:=0; + formDebug.show; +end; + end. diff --git a/UnitRoute.pas b/UnitRoute.pas index 627da7e..3a3deff 100644 --- a/UnitRoute.pas +++ b/UnitRoute.pas @@ -85,13 +85,38 @@ uses UnitDebug,unitTCO,UnitConfig, UnitRouteTrains , Selection_Train; // efface la route parcoursDet[] du TCO indexTCOcourant // si affecte_loco=true : affecte la loco rencontrée aux cantons -procedure efface_route_tco(affecte_loco :boolean); -var n,det1,nti,x,y,det2,i,indexAig : integer; +procedure efface_route_tco; //(affecte_loco :boolean); +var n,det1,nti,x,y,det2,i,indexAig,tcoC : integer; t : tequipement; + trouve : boolean; begin if Nbretco<1 then exit; n:=parcoursdet[0].adresse; det1:=parcoursdet[1].adresse; + + // trouver à quel TCO appartient le det1 + tcoC:=1; + repeat + y:=1; + repeat + x:=1; + repeat + trouve:=tco[tcoC,x,y].Adresse=det1; + inc(x); + until (x>NbreCellX[tcoC]) or trouve; + inc(y); + until (y>NbreCellY[tcoC]) or trouve; + inc(tcoC); + until (tcoC>NbreTCO) or trouve; + + if trouve then dec(tcoC); + + if trouve=false then + begin + Affiche('Erreur 57 : détecteur '+intToSTR(det1)+' trouvé dans aucun des TCO',clOrange); + exit; + end; + for i:=2 to n do begin det2:=parcoursdet[i].adresse; @@ -104,7 +129,7 @@ begin end; if t=det then begin - zone_tco(indexTCOcourant,det1,det2,1,0,0,true,affecte_loco); // mode "aiguillages mis" + zone_tco(TcoC,det1,det2,1,0,0,true); // mode "aiguillages mis" det1:=det2; end; end; @@ -148,14 +173,38 @@ end; // Affiche sans effacer l'ancienne, la route du TCO indexTCOcourant du tableau ParcoursDet[] function Affiche_route_TCO : boolean ; -var i,n,det1,det2,indexAig : integer; +var i,n,det1,det2,indexAig,tcoC,x,y : integer; t :tequipement; - ok : boolean; + ok,trouve : boolean; begin if Nbretco<1 then begin result:=false;exit;end; n:=ParcoursDet[0].adresse; ok:=true; det1:=parcoursDet[1].adresse; + + // trouver à quel TCO appartient le det1 + tcoC:=1; + repeat + y:=1; + repeat + x:=1; + repeat + trouve:=tco[tcoC,x,y].Adresse=det1; + inc(x); + until (x>NbreCellX[TcoC]) or trouve; + inc(y); + until (y>NbreCellY[TcoC]) or trouve; + inc(tcoC); + until (tcoC>NbreTCO) or trouve; + + if trouve then dec(tcoC); + + if trouve=false then + begin + Affiche('Erreur 57 : détecteur '+intToSTR(det1)+' trouvé dans aucun des TCO',clOrange); + exit; + end; + for i:=2 to n do begin t:=ParcoursDet[i].typ; @@ -170,7 +219,7 @@ begin begin det2:=ParcoursDet[i].adresse; // tco,det1,det2,train,adrTrain,Mode,posAig,affecte_loco - ok:=zone_tco(indexTCOcourant,det1,det2,1,0,1,true,false) and ok; //posAig=true=teste les routes en récursif affecte_loco=n'affecte pas la loco + ok:=zone_tco(tcoC,det1,det2,1,0,1,true) and ok; //posAig=true=teste les routes en récursif affecte_loco=n'affecte pas la loco det1:=det2; end; end; @@ -677,10 +726,10 @@ begin if typ=det then begin // attention on ne gère que le TCO1 - Zone_TCO(indexTCOcourant,det1,det2,1,0,0,true,false); // faire true et positionner les aiguillages + Zone_TCO(indexTCOcourant,det1,det2,1,0,0,true); // faire true et positionner les aiguillages det1:=det2; det2:=tabloroute[j,i].adresse; - Zone_TCO(indexTCOcourant,det1,det2,1,0,1,false,false); + Zone_TCO(indexTCOcourant,det1,det2,1,0,1,false); FormTCO[1].Caption:=intToSTR(i)+'/'+intToSTR(n)+' '+intToSTR(det1)+' '+intToSTR(det2)+ ' Arrêt par touche Echap'; //Affiche(intToSTR(det1)+' '+intToSTR(det2),clyellow); end; diff --git a/UnitTCO.dfm b/UnitTCO.dfm index ae89a4b..7112524 100644 --- a/UnitTCO.dfm +++ b/UnitTCO.dfm @@ -1,6 +1,6 @@ object FormTCO: TFormTCO - Left = 186 - Top = 112 + Left = 187 + Top = 113 Width = 1013 Height = 607 VertScrollBar.Visible = False @@ -1668,6 +1668,13 @@ object FormTCO: TFormTCO object N12: TMenuItem Caption = '-' end + object MenuSuppTCO: TMenuItem + Caption = 'Supprimer le TCO' + OnClick = MenuSuppTCOClick + end + object N14: TMenuItem + Caption = '-' + end object ConfigurationduTCO1: TMenuItem Caption = 'Configuration du TCO' OnClick = ConfigurationduTCO1Click diff --git a/UnitTCO.pas b/UnitTCO.pas index 0f3da47..440a59c 100644 --- a/UnitTCO.pas +++ b/UnitTCO.pas @@ -172,6 +172,8 @@ type N12: TMenuItem; LabelPM: TLabel; Afficherlecompteurdevitessedutrain1: TMenuItem; + MenuSuppTCO: TMenuItem; + N14: TMenuItem; //TimerTCO: TTimer; procedure FormCreate(Sender: TObject); procedure FormActivate(Sender: TObject); @@ -421,6 +423,7 @@ type procedure Modedplacement1Click(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Afficherlecompteurdevitessedutrain1Click(Sender: TObject); + procedure MenuSuppTCOClick(Sender: TObject); public { Déclarations publiques } end; @@ -666,8 +669,8 @@ var procedure calcul_reduction(Var frx,fry : single;DimDestX,DimDestY : integer); procedure calcul_cellules(indextco : integer); procedure sauve_fichiers_tco; -function zone_tco(indexTCO,det1,det2,train,adrTrain,mode: integer;posAig,affecte_loco : boolean) : boolean; overload; -function zone_tco(indexTCO,adr : integer;typEl : tequipement;Sens,mode: integer;posAig,affecte_loco : boolean) : boolean; overload; +function zone_tco(indexTCO,det1,det2,train,adrTrain,mode: integer;posAig : boolean) : boolean; overload; +function zone_tco(indexTCO,adr : integer;typEl : tequipement;Sens,mode: integer;posAig : boolean) : boolean; overload; procedure _entoure_cell_clic(indexTCO: integer); procedure Affiche_TCO(indexTCO : integer) ; procedure affiche_cellule(indexTCO,x,y : integer); @@ -716,6 +719,9 @@ 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); +procedure Supprimer_TCO(TcoS : integer); +procedure toggle_bandeau(indexTCO : integer); +function sens_train_canton(AdrTrain,Idcanton : integer) : integer; implementation @@ -822,7 +828,11 @@ begin else result:=0; end; + + // renvoie l'index de canton encadré par les 2 éléments el1 et el2 +// il faudrait faire par détecteur. +// ex (526,det,513,det)= 1 function trouve_canton(el1 : integer;tel1 : tequipement;el2 : integer;tel2 : tequipement) : integer; var i,eLc1,eLc2 : integer; teLc1,teLc2 : tequipement; @@ -833,13 +843,11 @@ begin repeat eLc1:=canton[i].el1; teLc1:=canton[i].typ1; eLc2:=canton[i].el2; teLc2:=canton[i].typ2; - // ******** modif du 20/09/2025 + // il faut que les deux éléments soient présents - {trouve:=((elc1=el1) and (teLc1=tel1) and (elc2=el2) and (teLc2=tel2)) or - ((elc2=el1) and (teLc2=tel1) and (elc1=el2) and (teLc1=tel2)) ; } - // il faut l'un des deux éléments présents - trouve:=( ((elc1=el1) and (teLc1=tel1)) or ((elc2=el2) and (teLc2=tel2)) ) or - ( ((elc2=el1) and (teLc2=tel1)) or ((elc1=el2) and (teLc1=tel2)) ) ; + trouve:=((elc1=el1) and (teLc1=tel1) and (elc2=el2) and (teLc2=tel2)) or + ((elc2=el1) and (teLc2=tel1) and (elc1=el2) and (teLc1=tel2)) ; + inc(i); until (trouve) or (i>nCantons); if trouve then result:=i-1; @@ -1516,14 +1524,14 @@ begin if horz then begin - zone_tco(t,i,SensTCO_O,0,0,11,false,false); // demande éléments contigus à gauche (5) du canton, résultats dans var globales xCanton et tel1 + zone_tco(t,i,SensTCO_O,0,0,11,false); // demande éléments contigus à gauche (5) du canton, résultats dans var globales xCanton et tel1 if xCanton=0 then tel1:=buttoir; canton[i].el1:=xCanton; canton[i].typ1:=tel1; canton[i].SensEl1:=SensGauche; if tel1=det then detecteur[xCanton].canton1:=canton[i].numero; - zone_tco(t,i,SensTCO_E,0,0,11,false,false); // demande éléments contigus à droite (6) du canton, résultats dans var globales xCanton et tel1 + zone_tco(t,i,SensTCO_E,0,0,11,false); // demande éléments contigus à droite (6) du canton, résultats dans var globales xCanton et tel1 if xCanton=0 then tel1:=buttoir; canton[i].el2:=xCanton; canton[i].typ2:=tel1; @@ -1533,14 +1541,14 @@ begin else begin // canton vertical - zone_tco(t,i,SensTCO_N,0,0,11,false,false); // demande éléments contigus en haut (7) du canton, résultats dans var globales xCanton et tel1 + zone_tco(t,i,SensTCO_N,0,0,11,false); // demande éléments contigus en haut (7) du canton, résultats dans var globales xCanton et tel1 if xCanton=0 then tel1:=buttoir; canton[i].el1:=xCanton; canton[i].typ1:=tel1; canton[i].SensEl1:=SensHaut; if tel1=det then detecteur[xCanton].canton1:=canton[i].numero; - zone_tco(t,i,SensTCO_S,0,0,11,false,false); // demande éléments contigus en bas (8) du canton, résultats dans var globales xCanton et tel1 + zone_tco(t,i,SensTCO_S,0,0,11,false); // demande éléments contigus en bas (8) du canton, résultats dans var globales xCanton et tel1 if xCanton=0 then tel1:=buttoir; canton[i].el2:=xCanton; canton[i].typ2:=tel1; @@ -1645,22 +1653,22 @@ begin // croisements ou tjd case Bim of 21 : begin - zone_tco(t,adr1,typEl,SensTCO_E,13,false,false); // chercher 1er élément à droite - xcanton Tel1 + zone_tco(t,adr1,typEl,SensTCO_E,13,false); // chercher 1er élément à droite - xcanton Tel1 tco[t,x,y].SuivE:=xCanton; tco[t,x,y].TypeE:=tel1; if deb then Affiche('E='+intToSTR(xcanton),clLime); - zone_tco(t,adr1,typEl,SensTCO_SO,13,false,false); // chercher 1er élément SO + zone_tco(t,adr1,typEl,SensTCO_SO,13,false); // chercher 1er élément SO tco[t,x,y].SuivSO:=xCanton; tco[t,x,y].TypeSO:=tel1; if deb then Affiche('SO='+intToSTR(xcanton),clLime); - zone_tco(t,adr1,typEl,SensTCO_O,13,false,false); // élément à gauche + zone_tco(t,adr1,typEl,SensTCO_O,13,false); // élément à gauche tco[t,x,y].SuivO:=xCanton; tco[t,x,y].TypeO:=tel1; if deb then Affiche('O='+intToSTR(xcanton),clLime); - zone_tco(t,adr1,typEl,SensTCO_NE,13,false,false); // chercher 1er élément NE + zone_tco(t,adr1,typEl,SensTCO_NE,13,false); // chercher 1er élément NE tco[t,x,y].SuivNE:=xCanton; tco[t,x,y].TypeNE:=tel1; if deb then Affiche('NE='+intToSTR(xcanton),clLime); @@ -1693,22 +1701,22 @@ begin end; 22 : begin - zone_tco(t,adr1,typEl,SensTCO_E,13,false,false); // chercher 1er élément à droite - xcanton Tel1 + zone_tco(t,adr1,typEl,SensTCO_E,13,false); // chercher 1er élément à droite - xcanton Tel1 tco[t,x,y].SuivE:=xCanton; tco[t,x,y].TypeE:=tel1; if deb then Affiche('E='+intToSTR(xcanton),clLime); - zone_tco(t,adr1,typEl,SensTCO_SE,13,false,false); // chercher 1er élément à droite - xcanton Tel1 + zone_tco(t,adr1,typEl,SensTCO_SE,13,false); // chercher 1er élément à droite - xcanton Tel1 tco[t,x,y].SuivSE:=xCanton; tco[t,x,y].TypeSE:=tel1; if deb then Affiche('SE='+intToSTR(xcanton),clLime); - zone_tco(t,adr1,typEl,SensTCO_O,13,false,false); // élément à gauche + zone_tco(t,adr1,typEl,SensTCO_O,13,false); // élément à gauche tco[t,x,y].SuivO:=xCanton; tco[t,x,y].TypeO:=tel1; if deb then Affiche('O='+intToSTR(xcanton),clLime); - zone_tco(t,adr1,typEl,SensTCO_NO,13,false,false); // chercher 1er élément à droite - xcanton Tel1 + zone_tco(t,adr1,typEl,SensTCO_NO,13,false); // chercher 1er élément à droite - xcanton Tel1 tco[t,x,y].SuivNO:=xCanton; tco[t,x,y].TypeNO:=tel1; if deb then Affiche('NO='+intToSTR(xcanton),clLime); @@ -1739,22 +1747,22 @@ begin end; end; 23 : begin - zone_tco(t,adr1,typEl,SensTCO_N,13,false,false); // haut + zone_tco(t,adr1,typEl,SensTCO_N,13,false); // haut tco[t,x,y].SuivN:=xCanton; tco[t,x,y].TypeN:=tel1; if deb then Affiche('N='+intToSTR(xcanton),clLime); - zone_tco(t,adr1,typEl,SensTCO_S,13,false,false); // élément bas + zone_tco(t,adr1,typEl,SensTCO_S,13,false); // élément bas tco[t,x,y].SuivS:=xCanton; tco[t,x,y].TypeS:=tel1; if deb then Affiche('S='+intToSTR(xcanton),clLime); - zone_tco(t,adr1,typEl,SensTCO_NE,13,false,false); + zone_tco(t,adr1,typEl,SensTCO_NE,13,false); tco[t,x,y].SuivNE:=xCanton; tco[t,x,y].TypeNE:=tel1; if deb then Affiche('NE='+intToSTR(xcanton),clLime); - zone_tco(t,adr1,typEl,SensTCO_SO,13,false,false); + zone_tco(t,adr1,typEl,SensTCO_SO,13,false); tco[t,x,y].SuivSO:=xCanton; tco[t,x,y].TypeSO:=tel1; if deb then Affiche('SO='+intToSTR(xcanton),clLime); @@ -1786,22 +1794,22 @@ begin end; 25 : begin - zone_tco(t,adr1,typEl,SensTCO_N,13,false,false); // haut + zone_tco(t,adr1,typEl,SensTCO_N,13,false); // haut tco[t,x,y].SuivN:=xCanton; tco[t,x,y].TypeN:=tel1; if deb then Affiche('N='+intToSTR(xcanton),clLime); - zone_tco(t,adr1,typEl,SensTCO_S,13,false,false); // élément bas + zone_tco(t,adr1,typEl,SensTCO_S,13,false); // élément bas tco[t,x,y].SuivS:=xCanton; tco[t,x,y].TypeS:=tel1; if deb then Affiche('S='+intToSTR(xcanton),clLime); - zone_tco(t,adr1,typEl,SensTCO_NO,13,false,false); // chercher 1er élément à droite - xcanton Tel1 + zone_tco(t,adr1,typEl,SensTCO_NO,13,false); // chercher 1er élément à droite - xcanton Tel1 tco[t,x,y].SuivNO:=xCanton; tco[t,x,y].TypeNO:=tel1; if deb then Affiche('NO='+intToSTR(xcanton),clLime); - zone_tco(t,adr1,typEl,SensTCO_SE,13,false,false); // chercher 1er élément à droite - xcanton Tel1 + zone_tco(t,adr1,typEl,SensTCO_SE,13,false); // chercher 1er élément à droite - xcanton Tel1 tco[t,x,y].SuivSE:=xCanton; tco[t,x,y].TypeSE:=tel1; if deb then Affiche('SE='+intToSTR(xcanton),clLime); @@ -2488,7 +2496,7 @@ begin closefile(fichier); renseigne_tous_cantons; trier_cantons; - affecte_trains_config; + //affecte_trains_config; sauve_styles_tco(indexTCO); // sauver le jeu sombre if jeucouleurs=2 then jeu_clair(indexTCO); @@ -4456,7 +4464,7 @@ begin Brush.Color:=Couleur; pen.color:=Couleur; Pen.Mode:=pmCopy; - + if testbit(ep,6) then pen.Width:=epaisseur div 2 else pen.Width:=epaisseur; MoveTo(x0,y0+hauteurCell[indexTCO]);lineto(xc,yc); if testbit(ep,3) then pen.Width:=epaisseur div 2 else pen.Width:=epaisseur; @@ -11193,8 +11201,8 @@ begin if orientation=2 then //90°G begin if aspect=20 then begin x0:=0; y0:=0;end; - if aspect=9 then begin x0:=round(10*frX); y0:=hauteurCell[indexTCO]-round(tailleX*frY);end; - if aspect=7 then begin x0:=round(10*frX); y0:=hauteurCell[indexTCO]-round(tailleX*frY);end; + if aspect=9 then begin x0:=round(10*frX); y0:=round(4*frY);end; + if aspect=7 then begin x0:=round(10*frX); y0:=round(4*frY);end; if aspect=5 then begin x0:=round(10*frX); y0:=round((tailleX/2)*frY);end; if aspect=4 then begin x0:=round(10*frX); y0:=round((tailleX/2)*frY);end; if aspect=3 then begin x0:=round(8*frX); y0:=round((tailleX/2)*frY);end; @@ -11238,7 +11246,7 @@ begin inverse_image(FormTCO[indexTCO].ImageTemp,ImageFeu); // copie avec mise à l'échelle de l'image du signal TransparentBlt(canvasDest.Handle,x0,y0,round(TailleX*frX),round(TailleY*frY), - FormTCO[indexTCO].ImageTemp.Canvas.Handle,0,0,TailleX,TailleY,clBlue); + FormTCO[indexTCO].ImageTemp.Canvas.Handle,0,0,TailleX,TailleY,clBlue); end else // copie avec mise à l'échelle de l'image du signal @@ -11465,7 +11473,7 @@ begin if Bimage=3 then begin xt:=3;yt:=hauteurCell[indexTCO]-round(18*fryGlob[indexTCO]);end; if Bimage=4 then begin xt:=10*round(frxGlob[indexTCO]);yt:=1;end; if Bimage=5 then begin xt:=3;yt:=hauteurCell[indexTCO]-round(18*fryGlob[indexTCO]);end; - if Bimage=12 then begin xt:=round(35*frxGlob[indexTCO]);yt:=2;end; + if Bimage=12 then begin xt:=round(33*fryGlob[indexTCO]);yt:=1;end; if Bimage=13 then begin xt:=LargeurCell[indexTCO]-round(30*frxGlob[indexTCO]);yt:=hauteurCell[indexTCO]-round(15*fryGlob[indexTCO]);end; if Bimage=14 then begin xt:=LargeurCell[indexTCO]-round(30*frxGlob[indexTCO]);yt:=1;end; if Bimage=15 then begin xt:=3;yt:=1;end; @@ -11718,13 +11726,13 @@ begin end; end; if (aspect=9) and (Oriente=1) then begin xt:=LargeurCell[indexTCO]-round(25*frxGlob[indexTCO]);yt:=round(60*fryGlob[indexTCO]);end; - if (aspect=9) and (Oriente=2) then begin xt:=round(10*frxGlob[indexTCO]);yt:=hauteurCell[indexTCO]-round(17*fryGlob[indexTCO]);end; // orientation G + if (aspect=9) and (Oriente=2) then begin xt:=round(10*frxGlob[indexTCO]);yt:=hauteurCell[indexTCO]-round(20*fryGlob[indexTCO]);end; // orientation G if (aspect=9) and (Oriente=3) then begin xt:=LargeurCell[indexTCO]+round(20*frxGlob[indexTCO]);yt:=round(10*frYGlob[indexTCO]);end; if (aspect=9) and (Oriente=4) and (pied=1) then begin xt:=round(2*frxGlob[indexTCO]);yt:=round(10*frYGlob[indexTCO]);end; if (aspect=9) and (Oriente=4) and (pied=2) then begin xt:=round(3*frxGlob[indexTCO]);yt:=round(1*frYGlob[indexTCO]);end; if (aspect=7) and (Oriente=1) then begin xt:=LargeurCell[indexTCO]-round(25*frxGlob[indexTCO]);yt:=hauteurCell[indexTCO];end; - if (aspect=7) and (Oriente=2) then begin xt:=round(10*frxGlob[indexTCO]);yt:=hauteurCell[indexTCO]-round(25*fryGlob[indexTCO]);end; + if (aspect=7) and (Oriente=2) then begin xt:=round(10*frxGlob[indexTCO]);yt:=hauteurCell[indexTCO]-round(20*fryGlob[indexTCO]);end; if (aspect=7) and (Oriente=3) then begin xt:=LargeurCell[indexTCO]+2;yt:=round(4*frYGlob[indexTCO]);end; if (aspect=7) and (Oriente=4) and (pied=1) then begin xt:=round(2*frxGlob[indexTCO]);yt:=round(10*frYGlob[indexTCO]);end; if (aspect=7) and (Oriente=4) and (pied=2) then begin xt:=round(3*frxGlob[indexTCO]);yt:=round(1*frYGlob[indexTCO]);end; @@ -11997,6 +12005,7 @@ begin //Screen.OnActiveControlChange := ActiveControlChanged; {$IF CompilerVersion >= 28.0} + ScrollBox.StyleName:='Windows'; BallonHint:=TballoonHint.Create(self); with BallonHint do begin @@ -12097,7 +12106,7 @@ begin xMiniSel:=99999;yMiniSel:=99999; // coordonnées cellules xMaxiSel:=0;yMaxiSel:=0; SelectionAffichee[indexTCOCreate]:=false; - //ImageTCO.Canvas.font.Name:='Arial'; //<--- peut générer exception out of ressource!! + ImageTCO.Canvas.font.Name:='Arial'; //<--- peut générer exception out of ressource!! clTexte:=ClLime; // évite le clignotement pendant les affichages mais ne marche pas //DoubleBuffered:=true; @@ -12261,13 +12270,13 @@ begin end; // affiche le trajet Trace_Train[] dans le tco du train,ir =nombre d'éléments du tableau trace_train mode=couleur +// ir=index route // mode=0 : effacement du trajet // sinon mode = couleur du train -// affecte_loco = true : procède à l'affectation du train dans les cantons -// = false : ne change pas le train dans le canton -procedure affiche_trajet(indexTCO,train,AdrTrain,ir,mode : integer;affecte_loco : boolean); -var i,sx,sy,x,y,ax,ay,Bimage,adresse,IdCanton,IdTrain,AncTrain, +procedure affiche_trajet(indexTCO,train,AdrTrain,ir,mode : integer); +var i,sx,sy,x,y,ax,ay,Bimage,adresse,IdCanton,IdTrain,AncTrain,elPrec, DernierDet,sens : integer; + TypePrec: tEquipement; cant : boolean; begin // et affichage de la route @@ -12303,7 +12312,22 @@ begin if adresse<>0 then begin // si l'adresse est un détecteur - if (index_adresse_detecteur(adresse)<>0) then DernierDet:=adresse; + if (index_adresse_detecteur(adresse)<>0) then + begin + DernierDet:=adresse; + elprec:=detecteur[adresse].precedent; + typePrec:=detecteur[adresse].TypPrecedent; + idCanton:=trouve_canton(adresse,det,elPrec,typePrec); + // si canton adjacent au détecteur suivant le sens d'avance du train et que le détecteur passe à 0, + // désaffecter le train du canton + // annulé car désaffecte le train apr_s 2 tours sur le canton 7 + {if (idCanton<>0) and (detecteur[adresse].Etat=false) then + begin + affiche('Canton='+IntToSTR(canton[idCanton].numero),clYellow); + affecte_train_canton(0,idCanton,0); + end; + } + end; end; tco[indextco,x,y].trajet:=0; @@ -12319,6 +12343,7 @@ begin IdCanton:=index_canton_numero(TCO[indexTCO,x,y].NumCanton); // index canton AncTrain:=0; + { if (idcanton<>0) and affecte_loco then begin if mode=0 then // désaffecter le train @@ -12338,8 +12363,8 @@ begin end; end; end; - end; + } //if (idcanton<>0) and not affecte_Loco then Affiche('Pas en mode affecte_loco',clOrange); end; @@ -12442,10 +12467,9 @@ end; // Ne nécessite pas que les aiguillages en talon soient bien positionnés entre det1 et det2 // PosAig = False: teste toutes les routes en récursif les aiguillages en pointe // True: suit les aiguillages en pointe qui doivent être positionnés -// affecte_loco : true : efface la loco // en sortie : true si det2 a été trouvé // -function zone_tco_gx(indexTCO,det1: integer;typEL : tequipement;det2,train,adrTrain,mode: integer;posAig,affecte_loco : boolean) : boolean; +function zone_tco_gx(indexTCO,det1: integer;typEL : tequipement;det2,train,adrTrain,mode: integer;posAig : boolean) : boolean; var i,ir,adresse,But,Bimage,direction,ancienX,ancienY,x,y,xn,yn,Xdet1,yDet1,iteration,indexIr,AdrTr, NbTrouve,AdrTr1,adrTr2 : integer; memtrouve,sortir,indextrouve : boolean; @@ -14009,7 +14033,7 @@ begin AdrTr:=Adrtr2; //Affiche(intToSTR(det1)+' '+intToSTR(det2)+' Mode '+intToSTR(mode)+' Le détecteur2 '+intToSTR(Det2)+ ' est affecté au train @'+intToSTR(AdrTr2),clYellow); end; - Affiche_trajet(indexTCO,train,AdrTrain,indexIr,mode,affecte_loco); // affiche le trajet dans le TCO + Affiche_trajet(indexTCO,train,AdrTrain,indexIr,mode); // affiche le trajet dans le TCO end; end; end; @@ -14018,17 +14042,15 @@ end; // affiche le tracé de det1 à det2; n°Train n°i (pas son index), adresseTrain, mode=0=éteint =1 allumejaune =2 allume selon index, // posAig=false : ne tient pas compte de la position des aiguillages pour le tracé (cherche en récursif det2 // = true : suit le tracé suivant la position des aiguillages jusque det2 -// affecte_loco=true : affecte loco si on rencontre un canton. Si mode=0 çà désaffecte la loco du canton -// =false : ne change pas l'affectation d'un canton rencontré -function zone_tco(indexTCO,det1,det2,train,adrTrain,mode: integer;posAig,affecte_loco : boolean) : boolean; overload; +function zone_tco(indexTCO,det1,det2,train,adrTrain,mode: integer;posAig : boolean) : boolean; overload; begin - result:=zone_tco_gx(indexTCO,det1,det,det2,train,adrTrain,mode,posAig,affecte_loco); + result:=zone_tco_gx(indexTCO,det1,det,det2,train,adrTrain,mode,posAig); end; // fonction appellable en mode 13 -function zone_tco(indexTCO,adr : integer;typEl : tequipement;sens,mode: integer;posAig,affecte_loco : boolean) : boolean; overload; +function zone_tco(indexTCO,adr : integer;typEl : tequipement;sens,mode: integer;posAig : boolean) : boolean; overload; begin - result:=zone_tco_gx(indexTCO,adr,typEL,sens,0,0,mode,posAig,affecte_loco); + result:=zone_tco_gx(indexTCO,adr,typEL,sens,0,0,mode,posAig); end; @@ -17471,7 +17493,7 @@ begin end; -// mise à jour des cellules de l'adresse "adresse" +// Affichage : mise à jour des cellules de l'adresse "adresse" procedure Maj_TCO(indexTCO,Adresse : integer); var x,y: integer; begin @@ -17896,7 +17918,7 @@ begin aiguillage[Index_Aig(117)].position:=const_devie; //debugTco:=true; - zone_tco(1,527,519,1,0,1,false,false); + zone_tco(1,527,519,1,0,1,false); // zone_tco(518,515,1); //zone_tco(522,514,1); @@ -19048,6 +19070,8 @@ begin screen.cursor:=crUpArrow; end else stop_modetrace(indexTCO); + + FormTCO[indexTCO].DessinerleTCO1.Checked:=modetrace[indexTCO]; end; procedure TFormTCO.ButtonDessinerClick(Sender: TObject); @@ -19314,11 +19338,9 @@ begin end; end; -procedure TFormTCO.BandeauClick(Sender: TObject); -var indexTCO : integer; +procedure toggle_bandeau(indexTCO : integer); begin - indexTCO:=index_TCOMainMenu; - if bandeauMasque then + if bandeauMasque then with formTCO[indexTCO] do begin PanelBas.Show; PanelBas.Visible:=true; @@ -19333,6 +19355,11 @@ begin end; end; +procedure TFormTCO.BandeauClick(Sender: TObject); +begin + toggle_bandeau(index_TCOMainMenu); +end; + procedure TFormTCO.Mosaquehorizontale1Click(Sender: TObject); begin mosaiqueH; @@ -19769,6 +19796,85 @@ begin formCompteur[1].Show; end; +procedure Supprimer_TCO(TcoS : integer); +var c,x,y,i,SauvNbreTCO : integer; + s : string; +begin + if Tcos>NbreTCO then exit; + s:='Voulez-vous supprimer le TCO '+intToSTR(TcoS)+' ('+NomFichierTCO[tcoS]+')'; + if Application.MessageBox(pchar(s),pchar('confirm'), MB_YESNO or MB_DEFBUTTON2 or MB_ICONQUESTION)=idNo then exit; + + SauvNbreTCO:=NbreTCO; // dire au programme Timer qu'il n'y a plus de TCO le temps de supprimer sinon il peut tenter d'allumer un feu sur le TCO qu'on supprime->violation + NbreTCO:=0; + TCOActive:=false; + + Affiche('Suppression du TCO '+intToSTR(Tcos),clOrange); + + // supprimer les cantons + for y:=1 to NbreCellY[tcos] do + for x:=1 to NbreCellX[tcos] do + begin + if isCanton(tco[tcos,x,y].Bimage) then + begin + c:=tco[tcos,x,y].NumCanton; + if c<>0 then supprime_canton(c); + end; + end; + + FormTCO[tcos].Release; // annuler le pointeur et raz les mémoires de la form + + for i:=tCos to SauvNbreTCO-1 do + begin + NomFichierTCO[i]:=NomFichierTCO[i+1]; + + FormTCO[i]:=FormTCO[i+1]; + FormTCO[i].Name:='TCO'+intToSTR(i); // renommer le TCO + TCO[i]:=Tco[i+1]; // déplacer les données + // et toutes les variables du tco + PcanvasTCO[i]:=PcanvasTCO[i+1]; + PBitMapTCO[i]:=PBitMapTCO[i+1]; + PImageTCO[i]:=PImageTCO[i+1]; + PImageTemp[i]:=PImageTemp[i+1]; + frXGlob[i]:=frXGlob[i+1]; + frYGlob[i]:=frYGlob[i+1]; + SelectionAffichee[i]:=SelectionAffichee[i+1]; + forminit[i]:=forminit[i+1]; + modeTrace[i]:=modeTrace[i+1]; + entoure[i]:=entoure[i+1]; + avecGrille[i]:=avecGrille[i+1]; + NbreCellX[i]:=NbreCellX[i+1]; + NbreCellY[i]:=NbreCellY[i+1]; + largeurCelld2[i]:=largeurCelld2[i+1]; + HauteurCelld2[i]:=HauteurCelld2[i+1]; + largeurCell[i]:=largeurCell[i+1]; + HauteurCell[i]:=HauteurCell[i+1]; + EcranTCO[i]:=EcranTCO[i+1]; + Forminit[i]:=false; + end; + + setlength(TCO[SauvNbreTCO],0); + PcanvasTCO[SauvNbreTCO]:=nil; + dec(SauvNbreTCO); + Menu_tco(SauvNbreTCO); + config_modifie:=true; + if SauvNbreTCO<>0 then Affiche('La nouvelle liste des noms des fichiers des TCO est la suivante:',ClLime); + + for i:=1 to SauvNbreTCO do + begin + Affiche(IntToSTR(i)+' '+NomFichierTCO[i],clLime); + end; + NbreTCO:=SauvNbreTCO; + tcoActive:=true; +end; + + +procedure TFormTCO.MenuSuppTCOClick(Sender: TObject); +var indexTCO : integer; +begin + indexTCO:=index_TCOMainMenu; + Supprimer_TCO(indexTCO); +end; + end. diff --git a/selection_train.pas b/selection_train.pas index ae7d876..a573719 100644 --- a/selection_train.pas +++ b/selection_train.pas @@ -173,7 +173,7 @@ function trouve_det_suiv_canton(idcanton,detecteur,sensTCO : integer) : integer; var t : integer; begin t:=canton[idcanton].ntco; - zone_tco(t,detecteur,sensTCO,0,0,12,false,false); // élément contigu à droite (6) du canton , résultat dans xcanton , teste les 2 pos des aig + zone_tco(t,detecteur,sensTCO,0,0,12,false); // élément contigu à droite (6) du canton , résultat dans xcanton , teste les 2 pos des aig if tel1=Aig then xcanton:=detecteur_suivant(detecteur,det,xcanton,aig,1); result:=xcanton; end; @@ -253,7 +253,7 @@ var idTrain,t,el1,el2 : integer; begin if ProcPrinc then AfficheDebug('Affecte_train_canton: @='+intToSTR(AdrTrain)+' Idcanton='+intToSTR(idcanton),clorange); - //Affiche('Affecte_train_canton: @='+intToSTR(AdrTrain)+' Idcanton='+intToSTR(idcanton),clyellow); +// Affiche('Affecte_train_canton: @='+intToSTR(AdrTrain)+' Idcanton='+intToSTR(idcanton),clyellow); if (IdCanton>0) and (idCanton<=nCantons) then begin idTrain:=0; @@ -313,6 +313,7 @@ begin end; maj_signaux(false); + dessin_canton(idCanton,0); // redessine le canton //affiche('Det du canton '+intToSTR(canton[Idcanton].numero)+' det1='+intToSTR(canton[Idcanton].det1)+' det2='+intToSTR(canton[Idcanton].det2),clyellow); end; diff --git a/verif_version.pas b/verif_version.pas index ba56a51..09165e5 100644 --- a/verif_version.pas +++ b/verif_version.pas @@ -26,7 +26,7 @@ var f : textFile; Const -VersionSC = '10.78'; // sert à la comparaison de la version publiée +VersionSC = '10.8'; // 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; @@ -463,16 +463,21 @@ begin closefile(fichier); if DebugVV then affiche('Fermeture du fichier d''échange',clYellow); - if trouve_version and trouve_zip then + //if trouve_version and trouve_zip then + if trouve_version then begin //---------------------------------------------------- //isoler le nom du fichier i:=length(s3); - repeat - dec(i); - locZip:=s3[i]='/'; - until (i=1) or LocZip; - nomfichier:=copy(s3,i+1,length(s3)-i); + if i<>0 then + begin + repeat + dec(i); + locZip:=s3[i]='/'; + until (i=1) or LocZip; + nomfichier:=copy(s3,i+1,length(s3)-i); + end + else nomfichier:=''; //affiche(nombre_tel,cllime); //Affiche(s3,clLime); @@ -495,6 +500,7 @@ begin FormVersion.Top:=10; FormVersion.Left:=10; FormVersion.show; + s:='Vous utilisez la version '+versionSC+SousVersion+' mais il existe la version '+Version_p+SV_publie; if nComm>0 then begin @@ -503,6 +509,14 @@ begin Aff(' '); for i:=1 to ncomm do aff(comm[i]); end; + + if not(trouve_zip) then + begin + ShowMessage('Pas de version téléchargeable'); + result:=0; + exit; + end; + if MessageDlg(s+#13+'Voulez-vous la télécharger, l''installer et l''exécuter?',mtConfirmation,[mbYes,mbNo],0)=mrYes then begin // récupérer depuis la variable d'environnement windows USERPROFILE le repertoire de la session ouverte diff --git a/versions.txt b/versions.txt index a9d0476..b1de6db 100644 --- a/versions.txt +++ b/versions.txt @@ -356,7 +356,14 @@ version 10.77 : Am Correction du non affichage de la position des aiguillages dans le TCO. version 10.78 : Correction affichage aiguillages dans l'écran de config des versions D13. Correction pilotage des décodeurs LEB en mode binaire. - Ajout temps de retombée fonction F trains dans les blocs claviers USB. + Ajout temps de retombée fonction F trains dans les blocs claviers USB. +version 10.79 : Prise en compte du facteur réduction affichage windows pour les compteurs. +version 10.8 : Amélioration de la création des compteurs de vitesse en mode CDM rail + et de l'affectation des trains dans les cantons. + Corrections diverses. + + +