diff --git a/client-GL.cfg b/ConfigGenerale.cfg similarity index 63% rename from client-GL.cfg rename to ConfigGenerale.cfg index f7afb57..70db4d9 100644 --- a/client-GL.cfg +++ b/ConfigGenerale.cfg @@ -1,3 +1,4 @@ +/****************************************** / fichier de configuration de client-GL.log / gily - f1iwq - 2018 /****************************************** @@ -97,46 +98,82 @@ Serveur_interface=1 / 5=LI-100 / 6=GENLI retro=1 -/ -/ -/ Valeurs des initialisations des aiguillages au démarrage ----------------------------------------------- -/ @ aiguillage, position 1=dévié 2=droit, temporisation de manoeuvre en 1/10eme de seconde , -/ 0=pilotage normal 1=pilotage inversé -/ une position différente de 1 ou 2 sera à 1. Une temporisation de 0 sera à 5. -/ la liste doit être terminée par 0,0,0 -[section_init] -1,2,3,0 -2,2,3,0 -3,2,3,0 -4,2,3,0 -5,1,3,0 -6,2,3,0 -7,1,3,0 -8,2,3,0 -9,2,3,0 -10,2,3,0 -11,2,3,0 -12,1,3,0 -13,1,3,0 -14,1,3,0 -15,1,3,0 -16,1,4,0 -17,1,3,0 -18,2,4,0 -19,1,4,0 -20,2,4,0 -21,2,3,0 -22,1,3,0 -23,1,3,0 -24,1,3,0 -25,1,3,0 -26,2,3,0 -27,2,3,0 -28,2,3,0 -29,2,3,0 -30,2,3,0 -31,1,3,0 -32,1,3,0 -0,0,0,0 -/ - +RazSignaux=0 +[section_aig] +1,P518,D523,S3P,V30,I0,INIT(2,3) +2,P12S,D519,S5S,V0,I0,INIT(2,3) +3,P1S,D4P,S5D,V0,I0,INIT(2,3) +4,P3D,D6S,S514,V0,I0,INIT(2,3) +5,P515,D3S,S2S,V0,I0,INIT(1,3) +6,P516,D0,S4D,V0,I0,INIT(2,3) +7,P527,D519,S520,V0,I0,INIT(1,3) +8,P527,D521,S522,V0,I0,INIT(2,3) +9,P526,D513,S515,V60,I0,INIT(2,3) +10,P19P,D29P,S528,V30,I0,INIT(2,3) +11,P18P,D30D,S525,V0,I0,INIT(2,3) +12,P517,D20S,S2P,V0,I0,INIT(1,3) +17,P525,D535,S528,V0,I0,INIT(1,3) +18,P11P,D23P,S517,V0,I0,INIT(2,4) +19,P10P,D22P,S531,V0,I0,INIT(1,4) +20,P520,D21P,S12D,V0,I0,INIT(2,4) +21,P20D,D28D,S28D,V0,I0,INIT(2,3) +22,P19D,D537,S538,V0,I0,INIT(1,3) +23,P18D,D538,S534,V0,I0,INIT(1,3) +24,P538,D32S,S533,V0,I0,INIT(1,3) +25,P31S,D529,S27P,V0,I0,INIT(1,3) +26TJD,D(530,28D),S(529,28S),V0,I0,INIT(2,3),E4 +27,P25S,D530,S537,V0,I0,INIT(2,3) +28TJD,D(21D,26D),S(21S,26S),V0,I0,INIT(2,3),E4 +29,P10D,D513,S30S,V60,I0,INIT(2,3) +30,P524,D11D,S29D,V0,I0,INIT(2,3) +31,P534,D0,S25P,V0,I0,INIT(1,3) +32,P22S,D0,S24D,V0,I0,INIT(1,3) +0 +[section_branches] +A2,A12,517,A18,A11,A30,524,521,A8,527,A7,519,A2 +A7,520,A20,A12 +A1,A3,A4,514,522,A8 +A1,523,526,A9,513,A29,A10,A19,531,518,A1 +A9,515,A5 +A11,525,A17,528,A10 +A17,535,533,A24,538,A23 +A7,520,A20,A21,A28,A26,530,A27,A25,A31,534,A23,A18 +A26,529,A25 +A22,537,A27 +A22,A32,A24 +A6,516,0 +A31,0 +0 +[section_sig] +176,7,0,1,(520,A20),1 +190,7,0,1,(523,526),0 +204,9,0,1,(527,A7),1 +218,7,0,1,(525,A17),0 +232,2,1,1,(516,A6),0 +260,9,1,1,(518,A1),1 +274,3,0,1,(524,521),0 +288,7,0,1,(522,A8),1 +302,9,0,1,(526,A9),1 +316,7,1,1,(515,A5),1 +330,7,0,1,(519,A2),1 +320,9,0,1,(528,A10),1 +344,9,0,1,(517,A18),1 +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 +420,7,0,1,(529,A25,530,A27,537,A27),1 +448,7,0,1,(533,A24),1 +462,9,0,1,(513,A29),1 +476,9,0,1,(538,A23),1 +497,9,0,4,(531,A19),1 +600,7,0,0,(521,A8),1 +1000,9,0,0,(530,A26),1 +1001,9,0,0,(529,A26),1,(A21S,A6D) +0 +[section_act] +815,1,CC406526,F2,400 +813,1,CC406526,A613,2,Z +830,1,ZZ406526,A613,2,Z +(815,830),(820,840),PN(121+,121-) +(850,851),PN(12+,12-) +0 diff --git a/Notice d'utilisation des signaux_complexes_GL_V3.3.pdf b/Notice d'utilisation des signaux_complexes_GL_V3.4.pdf similarity index 71% rename from Notice d'utilisation des signaux_complexes_GL_V3.3.pdf rename to Notice d'utilisation des signaux_complexes_GL_V3.4.pdf index bb14b11..23e4075 100644 Binary files a/Notice d'utilisation des signaux_complexes_GL_V3.3.pdf and b/Notice d'utilisation des signaux_complexes_GL_V3.4.pdf differ diff --git a/UnitConfig.dcu b/UnitConfig.dcu index b1a74f6..9d5eedc 100644 Binary files a/UnitConfig.dcu and b/UnitConfig.dcu differ diff --git a/UnitConfig.dfm b/UnitConfig.dfm index ecdfa2a..f1113b5 100644 --- a/UnitConfig.dfm +++ b/UnitConfig.dfm @@ -1230,8 +1230,8 @@ object FormConfig: TFormConfig Visible = False end object ImageTJD: TImage - Left = 744 - Top = 416 + Left = 736 + Top = 400 Width = 137 Height = 57 Picture.Data = { @@ -1366,9 +1366,9 @@ object FormConfig: TFormConfig Visible = False end object ImageTri: TImage - Left = 744 - Top = 432 - Width = 145 + Left = 736 + Top = 360 + Width = 137 Height = 65 Picture.Data = { 07544269746D617076120000424D761200000000000076000000280000008900 @@ -1536,208 +1536,6 @@ object FormConfig: TFormConfig Height = 13 Caption = 'Verrouillable au carr'#233' :' end - object Image2: TImage - Left = 768 - Top = 440 - Width = 129 - Height = 41 - Picture.Data = { - 07544269746D617006180000424D06180000000000007600000028000000CA00 - 00003A000000010004000000000090170000120B0000120B0000100000000000 - 0000000000000000800000800000008080008000000080008000808000008080 - 8000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFF - FF00CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCC000000CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC000000CCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC000000CCCCC8888887 - 7CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC00 - 0000CCCCC88888888888888887CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCC88887CCCCC000000CCCC48888888888888888888888777CCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCC777888888888887CCCCC000000CCCCC88888888888888888888888 - 8888888888C7777CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCC7C77788888888888888888888887CCCCC000000CCCCC8888888 - 8888888888888888888888888888888888888887CCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCC7C7888888888888888888888888888888888888CCCCC00 - 0000CCCC78888888888888888888888888888888888888888888888888888888 - 88877877C77CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCC7C77777777888888888888888888888888888888888888888 - 888888888CCCCC000000CCCC4000077888888888888888888888888888888888 - 8888888888888888888888888888888888888888888788888C77CC8CCCC8CC8C - C7C8778C78788787888888888888888888888888888888888888888888888888 - 88888888888888888888888884CCCC000000CCCC788877700000000777888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 888888888888888888888888888888888888887774CCCC000000CCCC88888888 - 8878877000000008788888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 888888888888888888888888888888888888888888877770000000070CCCCC00 - 0000CCCC88888888888888888888777000000007778878888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888887770000000077 - 7888888887CCCC000000CCC48888888888888888888888888888888707000000 - 0077077788888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888877777770000 - 00000777888888888888888887CCCC000000CCC4888888888888888888888888 - 8888888888888888770770000000077077777788888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888787707 - 000000000007777788888888888888888888888888CCCC000000CCC788888888 - 8888888888888888888888888888888888888888878887787700700000000000 - 7007707777777787787788788888888887888878778888787787777777700000 - 0000000000000777778888888888888888888888888888888888888887CCCC00 - 0000CCC788888888888888888888888888888888888888888888888888888888 - 8888888888877887777007007000000000000000000000000000000000000000 - 0000000707777777878788888888888888888888888888888888888888888888 - 8888888887CCCC000000CCC78888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888878 - 8888888888888888888888888888888888888888888888888888888888888888 - 88888888888888888888888888CCCC000000CC48888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 888888888888888888888888888888888888888888CCCC000000CC4888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 88888888888888888888888888888888888888888888888888888888887CCC00 - 0000CC7888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 88888888887CCC000000CC788888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 888888888888888888888888887CCC000000CC40377788888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888887CCC000000CCCCCC440040 - 7778888888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 88888888888888888888888888888888888888888888888888888888887CCC00 - 0000CCCCCCCCCCCCCC4400737888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 88877303000CCC000000CCCCCCCCCCCCCCCCCCC4440400777888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 88888888887777000004444CCCCCCC000000CCCCCCCCCCCCCCCCCCCCCCCCCCC4 - 4400307778888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 8888888888888888887773300000444CCCCCCCCCCCCCCC000000CCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCC4404400777888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888877730004404C4CCCCCCCCCCCCCCCCCCCCCCC00 - 0000CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC44400003777888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 888888888888888888888888888888888887730300444CCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCC000000CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCC0000078888888888888888888888888888888888888888888888888888888 - 88888888888888888888888888888888888888888887770044444CCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC000000CCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCC4C40400377788888888888888888888888888888888888888888888 - 888888888888888888888888888888888888888888888888888888888000000C - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC000000CCCCCCCCCCCC - CCCCCCCCCCCCCCCCC44440003777788888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 88888888888887770C44CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC00 - 0000CCCCCCCCCCCCCCCCCCCC4440040037778888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 888888888888888888888888888888888888877744444CCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCC000000CCCCCCCCCCCCC4440003078788888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888773 - 0444CCCCCCCCCCCCCCCCCCCCCCCCCC000000CCCC444000300778788888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 88888888888888888887730400444CCCCCCCCCCCCCCCCC000000CC0377778888 - 8888888888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 888888888888888888888888888888888888888888877300444444CCCCCCCC00 - 0000CC7888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 88887707044CCC000000CC788888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 888888888888888888888888888CCC000000CC48888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888887CCC000000CCC888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 88888888888888888888888888888888888888888888888888888888887CCC00 - 0000CC4788888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 88888888887CCC000000CCC88888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 888888888888888888888888887CCC000000CCC8888888888888888888888888 - 8888888888888888888888888888888888888878787777777770770700707707 - 0000000000700770770777777778778878888888888888888888888888888888 - 888888888888888888888888888888888888888888CCCC000000CCC788888888 - 8888888888888888888888888888888887777770700000000000000000777777 - 7777777777787777777877878877777777770077077070000000000070077777 - 8878888888888888888888888888888888888888888888888888888888CCCC00 - 0000CCC488888888888888888888888888888877077700000000070777777778 - 8888888888888888888888888888888888888888888888888888888888888888 - 8887887777770700000000000707877888888888888888888888888888888888 - 8888888888CCCC000000CCC78888888888888888887777000000000707778788 - 8888888888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888878777700000000700777888888 - 88888888888888888888888887CCCC000000CCC4888888887777000000000077 - 7888888888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 887707700000000007778888888888888888888887CCCC000000CCCC78777000 - 0000777788888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888788777000007778888888888888887CCCC00 - 0000CCCC00077778888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888888888888888887770000007 - 778888888CCCCC000000CCCC7888888888888888888888888888888888888888 - 8888888888888888888888888888888888888888878888788787887877887888 - 8888888888888888888888888888888888888888888888888888888888888888 - 88888888888887700000070784CCCC000000CCCC788888888888888888888888 - 8888888888888888888888888888888878C7CCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC88888888888888888888888888 - 888888888888888888888888888888888888777004CCCC000000CCCC78888888 - 8888888888888888888888888888888777C7CCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCC7777C888888888888888888888888888888888888888888888888CCCCC00 - 0000CCCC4888888888888888888888888777CCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC7788788888888888888888888888888 - 888888888CCCCC000000CCCCC8888888888888887CCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC77CC8 - 8888888888888888888888887CCCCC000000CCCCC88887C7CCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCC777888888888888888887CCCCC000000CCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC7888888888887CCCCC00 - 0000CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CC777888CCCCCC000000CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC000000} - Proportional = True - Visible = False - end object Label29: TLabel Left = 144 Top = 68 @@ -1748,8 +1546,8 @@ object FormConfig: TFormConfig object Label20: TLabel Left = 648 Top = 312 - Width = 170 - Height = 52 + Width = 221 + Height = 39 Caption = 'Les param'#232'tres en vert doivent '#234'tre valid'#233's en appuyant sur la t' + 'ouche ENTREE apr'#232's leur introduction/modification' @@ -1788,6 +1586,7 @@ object FormConfig: TFormConfig Font.Style = [] ParentFont = False TabOrder = 2 + OnChange = PageControlChange object TabSheetCDM: TTabSheet Caption = 'CDM Rail' object GroupBox1: TGroupBox @@ -2436,7 +2235,7 @@ object FormConfig: TFormConfig object GroupBox10: TGroupBox Left = 8 Top = 80 - Width = 273 + Width = 177 Height = 73 Caption = 'Vitesse de franchissement d'#233'vi'#233' :' TabOrder = 0 @@ -2770,6 +2569,32 @@ object FormConfig: TFormConfig 'Non positionn'#233) end end + object GroupBoxEtatTJD: TGroupBox + Left = 192 + Top = 80 + Width = 89 + Height = 73 + Caption = 'Type TJD' + TabOrder = 8 + object RadioButtonTJD2: TRadioButton + Left = 8 + Top = 24 + Width = 65 + Height = 17 + Caption = '2 '#233'tats' + TabOrder = 0 + OnClick = RadioButtonTJD2Click + end + object RadioButtonTJD4: TRadioButton + Left = 8 + Top = 40 + Width = 65 + Height = 17 + Caption = '4 '#233'tats' + TabOrder = 1 + OnClick = RadioButtonTJD4Click + end + end end object RichAig: TRichEdit Left = 0 @@ -3051,7 +2876,7 @@ object FormConfig: TFormConfig Top = 48 Width = 129 Height = 21 - ItemHeight = 13 + ItemHeight = 0 TabOrder = 1 OnChange = ComboBoxDecChange end @@ -3062,7 +2887,6 @@ object FormConfig: TFormConfig Height = 21 TabOrder = 3 OnChange = EditDet1Change - OnKeyPress = EditDet1KeyPress end object EditSuiv1: TEdit Left = 184 @@ -3073,7 +2897,6 @@ object FormConfig: TFormConfig ShowHint = True TabOrder = 4 OnChange = EditSuiv1Change - OnKeyPress = EditSuiv1KeyPress end object EditDet2: TEdit Left = 120 @@ -3082,7 +2905,6 @@ object FormConfig: TFormConfig Height = 21 TabOrder = 5 OnChange = EditDet2Change - OnKeyPress = EditDet2KeyPress end object EditSuiv2: TEdit Left = 184 @@ -3093,7 +2915,6 @@ object FormConfig: TFormConfig ShowHint = True TabOrder = 6 OnChange = EditSuiv2Change - OnKeyPress = EditSuiv2KeyPress end object EditDet3: TEdit Left = 120 @@ -3102,7 +2923,6 @@ object FormConfig: TFormConfig Height = 21 TabOrder = 7 OnChange = EditDet3Change - OnKeyPress = EditDet3KeyPress end object EditSuiv3: TEdit Left = 184 @@ -3113,7 +2933,6 @@ object FormConfig: TFormConfig ShowHint = True TabOrder = 8 OnChange = EditSuiv3Change - OnKeyPress = EditSuiv3KeyPress end object EditDet4: TEdit Left = 120 @@ -3122,7 +2941,6 @@ object FormConfig: TFormConfig Height = 21 TabOrder = 9 OnChange = EditDet4Change - OnKeyPress = EditDet4KeyPress end object EditSuiv4: TEdit Left = 184 @@ -3133,7 +2951,6 @@ object FormConfig: TFormConfig ShowHint = True TabOrder = 10 OnChange = EditSuiv4Change - OnKeyPress = EditSuiv4KeyPress end object CheckVerrouCarre: TCheckBox Left = 120 @@ -3157,7 +2974,6 @@ object FormConfig: TFormConfig TabOrder = 0 Text = ' ' OnChange = EditAdrSigChange - OnKeyPress = EditAdrSigKeyPress end object ComboBoxAsp: TComboBox Left = 144 @@ -3188,7 +3004,6 @@ object FormConfig: TFormConfig TabOrder = 14 Visible = False OnChange = EditSpecUniChange - OnKeyPress = EditSpecUniKeyPress end object Buttonrestaure: TButton Left = 8 @@ -3290,11 +3105,11 @@ object FormConfig: TFormConfig TabOrder = 0 object Label40: TLabel Left = 16 - Top = 328 - Width = 191 + Top = 344 + Width = 222 Height = 26 Caption = - 'Les accessoires ne sont utilisables qu'#39'en mode connect'#233' avec CDM' + + 'Les actionneurs ne sont utilisables qu'#39'en mode connect'#233' avec CDM' + ' Rail' WordWrap = True end @@ -3493,8 +3308,8 @@ object FormConfig: TFormConfig end end object GroupBoxAct: TGroupBox - Left = 40 - Top = 248 + Left = 64 + Top = 112 Width = 225 Height = 225 Caption = 'Actionneur fonction de locomotive ' diff --git a/UnitConfig.pas b/UnitConfig.pas index 83e6e6c..3ca27ef 100644 --- a/UnitConfig.pas +++ b/UnitConfig.pas @@ -140,7 +140,6 @@ type EditDet4: TEdit; EditSuiv4: TEdit; CheckVerrouCarre: TCheckBox; - Image2: TImage; Label28: TLabel; CheckInverse: TCheckBox; RadioButtonAccess: TRadioButton; @@ -231,6 +230,9 @@ type CheckBoxFB: TCheckBox; Label20: TLabel; ButtonConfigSR: TButton; + GroupBoxEtatTJD: TGroupBox; + RadioButtonTJD2: TRadioButton; + RadioButtonTJD4: TRadioButton; procedure ButtonAppliquerEtFermerClick(Sender: TObject); procedure FormActivate(Sender: TObject); procedure FormCreate(Sender: TObject); @@ -294,21 +296,11 @@ type procedure CheckBoxFBClick(Sender: TObject); procedure Button2Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); - procedure EditAdrSigKeyPress(Sender: TObject; var Key: Char); procedure EditP3KeyPress(Sender: TObject; var Key: Char); procedure EditP4KeyPress(Sender: TObject; var Key: Char); procedure EditP1KeyPress(Sender: TObject; var Key: Char); procedure EditP2KeyPress(Sender: TObject; var Key: Char); procedure EditDevieS2KeyPress(Sender: TObject; var Key: Char); - procedure EditDet1KeyPress(Sender: TObject; var Key: Char); - procedure EditSuiv1KeyPress(Sender: TObject; var Key: Char); - procedure EditDet2KeyPress(Sender: TObject; var Key: Char); - procedure EditSuiv2KeyPress(Sender: TObject; var Key: Char); - procedure EditDet3KeyPress(Sender: TObject; var Key: Char); - procedure EditSuiv3KeyPress(Sender: TObject; var Key: Char); - procedure EditDet4KeyPress(Sender: TObject; var Key: Char); - procedure EditSuiv4KeyPress(Sender: TObject; var Key: Char); - procedure EditSpecUniKeyPress(Sender: TObject; var Key: Char); procedure ButtonConfigSRClick(Sender: TObject); procedure EditDet1Change(Sender: TObject); procedure EditSuiv1Change(Sender: TObject); @@ -327,6 +319,9 @@ type procedure EditDevie_HDChange(Sender: TObject); procedure EditTempo10Change(Sender: TObject); procedure Edit_HGChange(Sender: TObject); + procedure PageControlChange(Sender: TObject); + procedure RadioButtonTJD2Click(Sender: TObject); + procedure RadioButtonTJD4Click(Sender: TObject); private { Déclarations privées } public @@ -334,7 +329,8 @@ type end; const -// variables du fichier de configuration "config-gl.cfg" +// variables du fichier de configuration +NomConfig='ConfigGenerale.cfg'; nb_det_dist_ch='nb_det_dist'; IpV4_PC_ch='IpV4_PC'; retro_ch='retro'; @@ -354,7 +350,7 @@ NOTIF_VERSION_ch='NOTIF_VERSION'; verif_version_ch='verif_version'; Fonte_ch='Fonte'; -// variables de config.cfg +// variables de config section_aig_ch='[section_aig]'; section_sig_ch='[section_sig]'; section_act_ch='[section_act]'; @@ -367,8 +363,9 @@ var portCDM,TempoOctet,TimoutMaxInterface,Valeur_entete,Port,protocole,NumPort, LigneCliqueePN,AncLigneCliqueePN,clicMemo, ligneclicAig,AncLigneClicAig,ligneClicSig,AncligneClicSig, - ligneClicBr,AncligneClicBr,ligneClicAct,AncLigneClicAct : integer; - ack_cdm,clicliste,entreeTCO,affevt,config_modifie : boolean; + ligneClicBr,AncligneClicBr,ligneClicAct,AncLigneClicAct,indexfeuclic : integer; + ack_cdm,clicliste,entreeTCO,affevt,config_modifie,clicproprietes : boolean; + fichier : text; function config_com(s : string) : boolean; function envoi_CDM(s : string) : boolean; @@ -376,6 +373,7 @@ procedure connecte_CDM; function place_id(s : string) : string; procedure decodeAig(s : string;var adr : integer;var B : char); function sauve_config : boolean; +procedure lit_config; Procedure aff_champs_sig_feux(index : integer); procedure decode_ligne_feux(chaine_signal : string;i : integer); function verif_coherence : boolean; @@ -384,7 +382,7 @@ function encode_sig_feux(i : integer): string; implementation -uses UnitDebug, UnitTCO, UnitSR; +uses UnitDebug,UnitTCO, UnitSR; {$R *.dfm} @@ -513,14 +511,14 @@ begin // demande des services services_CDM; - // demande les trains + // demande les trains mais on ne l'utilise pas! s:=place_id('C-C-01-0002-DSCTRN-DLOAD|000|'); envoi_CDM(s); end; end else begin - Affiche('La connexion à CDM n''est pas demandée car l''adresse IP est nulle dans config.cfg',cyan); + Affiche('La connexion à CDM n''est pas demandée car l''adresse IP est nulle dans '+NomConfig,cyan); end; end; @@ -574,17 +572,6 @@ begin config_com:=not( (copy(sa,1,3)<>'COM') or (NumPort>9) or (protocole=-1) or (protocole>4) or (i=0) ); end; -// transforme l'aiguillage du tableau init aiguillage en texte -function encode_init_aig(index : integer) : string; -var s : string; -begin - if index=0 then exit; - s:=IntToSTR(aiguillage[index].Adresse)+','; - s:=s+IntToSTR(aiguillage[index].posInit)+','; - s:=s+IntToSTR(aiguillage[index].temps); - encode_init_aig:=s; -end; - // transforme l'aiguillage de la base de données aiguillage en texte function encode_aig(index : integer): string; var s : string; @@ -629,8 +616,8 @@ begin end; end; - // tjd / s - if tjdC or tjsC then + // tjd 2/4 états ou tjs + if (tjdC or tjsC) then begin s:=s+'D('+intToSTR(aiguillage[index].Adroit); c:=aiguillage[index].AdroitB;if c<>'Z' then s:=s+c; @@ -639,6 +626,7 @@ begin c:=aiguillage[index].AdevieB;if c<>'Z' then s:=s+c; s:=s+','+intToSTR(aiguillage[index].DDevie)+aiguillage[index].DDevieB+')'; end; + if tjsC then begin @@ -656,6 +644,11 @@ begin s:=s+IntToSTR(aiguillage[index].posInit)+','; s:=s+IntToSTR(aiguillage[index].temps)+')'; + if tjdC then + begin + if aiguillage[index].EtatTJD=2 then s:=s+',E2' else s:=s+',E4'; + end; + encode_aig:=s; end; @@ -738,7 +731,7 @@ begin end; end; - // déodeur SR + // décodeur SR if feux[i].decodeur=7 then begin s:=s+',SR('; @@ -843,7 +836,7 @@ begin val(sa,asp,erreur); //aspect feux[i].aspect:=asp;Delete(s,1,j); if (asp=0) or (asp=6) or (asp>9) then - Affiche('Fichier config.cfg: configuration aspect ('+intToSTR(asp)+') feu incorrecte à la ligne '+chaine_signal,clRed); + Affiche('Fichier '+NomConfig+' configuration aspect ('+intToSTR(asp)+') feu incorrecte à la ligne '+chaine_signal,clRed); j:=pos(',',s); if j>1 then begin Feux[i].FeuBlanc:=(copy(s,1,j-1))='1';delete(s,1,j);end; j:=pos(',',s); @@ -901,7 +894,12 @@ begin until (fini) or (j>4); end; end; - if (j>4) or (not(multiple)) then begin Affiche('Erreur: fichier de configuration ligne erronnée : '+chaine_signal,clred); closefile(fichier);exit;end; + if (j>4) or (not(multiple)) then + begin + Affiche('Erreur: fichier de configuration ligne erronnée : '+chaine_signal,clred); + closefile(fichier); + exit; + end; k:=pos(',',s); delete(s,1,k); @@ -1035,10 +1033,12 @@ begin encode_act_pn:=s; end; -// modifie les fichiers de config en fonction du paramétrage + +// modifie le fichier de config en fonction du paramétrage +// recopie les commentaires du fichier "fichier" procedure genere_config; var s: string; - fichier,fichierN : text; + fichierN : text; i : integer; continue : boolean; @@ -1057,15 +1057,7 @@ var s: string; end; begin - try - assign(fichier,'client-GL.cfg'); - reset(fichier); - except - Affiche('Fichier client-gl.cfg non trouvé',clred); - exit; - end; - - assign(fichierN,'client-GL.tmp'); + assign(fichierN,'ConfigGenerale.tmp'); rewrite(fichierN); // entête @@ -1147,32 +1139,6 @@ begin // Serveur de rétrosignalisation Lenz de CDM writeln(fichierN,retro_ch+'=',intToSTR(ServeurRetroCDM)); - // [section init] est copié ici - // valeurs des initialisations aiguillages - // n'est plus géré dans config-gl.cfg - {writeln(fichierN,section_init); - for i:=1 to MaxAiguillage do - begin - s:=encode_init_aig(i); - writeln(fichierN,s); - end; - writeln(fichierN,'0,0,0,0'); - } - closefile(fichierN); // config-gl.tmp - closefile(fichier); // config-gl.cfg - - // ----------------config.cfg ---------------------------- - try - assign(fichier,'config.cfg'); - reset(fichier); - except - Affiche('Fichier config.cfg non trouvé',clred); - exit; - end; - - assign(fichierN,'config.tmp'); - rewrite(fichierN); - // entête copie_commentaire; // Raz Signaux @@ -1200,8 +1166,8 @@ begin writeln(fichierN,'0'); writeln(fichierN,section_sig_ch); - // et les feux - for i:=1 to NbreFeux do + // feux + for i:=1 to NbreFeux do begin s:=encode_sig_feux(i); // transformer le tableau feux en ligne @@ -1209,16 +1175,9 @@ begin if s='' then Affiche('Erreur 700 - Encodage du feu index='+IntToSTR(i),clRed); feux[i].modifie:=false; // sauvegarde en cours, on démarque writeln(fichierN,s); - // supprime le graphisme des feux - Feux[i].Img.free; - Feux[i].Lbl.free; - if feux[i].feublanc then begin Feux[i].Check.free;Feux[i].Check:=nil;end; - // et le recréer - cree_image(i); end; writeln(fichierN,'0'); - //copie_commentaire; // Fonctions Fx // actionneurs Train ou accessoire writeln(fichierN,section_act_ch); @@ -1238,15 +1197,925 @@ begin closefile(fichier); closefile(fichierN); - - deletefile('config.cfg'); - deletefile('client-GL.cfg'); - renameFile('config.tmp','config.cfg'); - renameFile('client-GL.tmp','client-GL.cfg'); + deletefile(NomConfig); + renameFile('ConfigGenerale.tmp',NomConfig); end; -// sauvegarder la config dans les fichiers cfg +procedure lit_config; + +var s,sa,chaine,SOrigine: string; + c,paig : char; + tec,tjdC,tjsC,s2,trouve,triC,debugConfig,multiple,fini,finifeux,trouve_NbDetDist,trouve_ipv4_PC,trouve_retro, + trouve_sec_init,trouve_init_aig,trouve_lay,trouve_IPV4_INTERFACE,trouve_PROTOCOLE_SERIE,trouve_INTER_CAR, + trouve_Tempo_maxi,trouve_Entete,trouve_tco,trouve_cdm,trouve_Serveur_interface,trouve_fenetre, + trouve_NOTIF_VERSION,trouve_verif_version,trouve_fonte,trouve_tempo_aig,trouve_raz,trouve_section_aig, + pds,trouve_section_branche,trouve_section_sig,trouve_section_act,fichier_trouve : boolean; + bd,virgule,i_detect,i,erreur,aig2,detect,offset,index, adresse,j,position,temporisation,invers,indexPointe,indexDevie,indexDroit, + ComptEl,Compt_IT,Num_Element,k,modele,adr,adr2,erreur2,l,t,Nligne,postriple,itl, + postjd,postjs,nv,it,Num_Champ,asp,adraig : integer; + + function lit_ligne : string ; + var esp : integer; + begin + repeat + readln(fichier,s); + sOrigine:=s; + s:=uppercase(s); + if length(s)>0 then c:=s[1]; + until ((c<>'/') and (s<>'')) or eof(fichier) ; + // supprime les espaces éventuels + repeat + esp:=pos(' ',s); + if esp<>0 then delete(s,esp,1); + until esp=0; + lit_ligne:=s; + end; + +procedure compile_signaux; +begin + Affiche('Définition des signaux',clyellow); + i:=1;Nligne:=1; + + repeat + inc(Nligne); + s:=lit_ligne; + //affiche(s,clyellow); + if s<>'0' then + begin + decode_ligne_feux(s,i);inc(i); + end; + until (s='0') or eof(fichier); + NbreFeux:=i-1; if NbreFeux<0 then NbreFeux:=0; +end; + +procedure compile_branches; +begin + // branches + NDetecteurs:=0; + Nligne:=1; + i_detect:=1; + i:=1; + Affiche('Définition des branches',clyellow); + + repeat + s:=lit_ligne; + if s<>'0' then + begin + branche[i]:=s; + j:=1;offset:=1; + inc(Nligne); + compile_branche(s,i); + inc(i); + end; + until (s='0') or eof(fichier); + NbreBranches:=i-1; +end; + +procedure compile_actionneurs; +var i : integer; +begin + // raz des actionneurs + for i:=1 to maxTablo_act do + begin + Tablo_actionneur[i].train:=''; + Tablo_actionneur[i].etat:=0; + Tablo_actionneur[i].actionneur:=0; + Tablo_actionneur[i].accessoire:=0; + Tablo_actionneur[i].sortie:=0; + end; + + Affiche('Définition des actionneurs',clyellow); + maxTablo_act:=1; + NbrePN:=0;Nligne:=1; + + // définition des actionneurs + repeat + s:=lit_ligne; + // vérifier si F ou A au 4eme champ + sa:=s; sOrigine:=s; + i:=pos(',',sa); + if i>0 then delete(sa,1,i) else s:='0'; + i:=pos(',',sa); + if i>0 then delete(sa,1,i) else s:='0'; + i:=pos(',',sa); + if i>0 then delete(sa,1,i) else s:='0'; + + inc(Nligne); + + if length(sa)>1 then if (sa[1]='A') then + // -----------------accessoire + begin + Tablo_actionneur[maxtablo_act].act:=true; + Tablo_actionneur[maxtablo_act].loco:=false; + + i:=pos(',',s); + if i<>0 then + begin + val(copy(s,1,i-1),j,erreur); + Tablo_actionneur[maxTablo_act].actionneur:=j; + Delete(s,1,i); + i:=pos(',',s); + if i<>0 then + begin + i:=pos(',',s); + val(copy(s,1,i-1),j,erreur); + Tablo_actionneur[maxTablo_act].etat:=j; + Delete(s,1,i); + + i:=pos(',',s); + Tablo_actionneur[maxTablo_act].train:=copy(s,1,i-1); + Delete(s,1,i); + + i:=pos('A',s); + if i<>0 then + begin + Delete(s,1,1); + val(s,j,erreur); + Tablo_actionneur[maxTablo_act].Accessoire:=j; + + i:=pos(',',s); + if i<>0 then + begin + Delete(S,1,i); + val(s,j,erreur); + Tablo_actionneur[maxTablo_act].sortie:=j; + end; + + i:=pos(',',s); + if i<>0 then + begin + Delete(S,1,i); + Tablo_actionneur[maxTablo_act].RAZ:=s[1]='Z'; + inc(maxTablo_act); + end; + + end; + s:='';i:=0; + end; + end; + + end; + + if length(sa)>1 then if (sa[1]='F') then + // -----------------loco + begin + Tablo_actionneur[maxtablo_act].act:=false; + Tablo_actionneur[maxtablo_act].loco:=true; + // 815,1,CC406526,F2,450 + i:=pos(',',s); + if i<>0 then + begin + val(copy(s,1,i-1),j,erreur); + Tablo_actionneur[maxTablo_act].actionneur:=j; + Delete(s,1,i); + i:=pos(',',s); + if i<>0 then + begin + i:=pos(',',s); + val(copy(s,1,i-1),j,erreur); + Tablo_actionneur[maxTablo_act].etat:=j; + Delete(s,1,i); + + i:=pos(',',s); + Tablo_actionneur[maxTablo_act].train:=copy(s,1,i-1); + Delete(s,1,i); + + i:=pos('F',s); + if i<>0 then + begin + Delete(s,1,1); + val(s,j,erreur); + Tablo_actionneur[maxTablo_act].Fonction:=j; + + i:=pos(',',s); + if i<>0 then + begin + Delete(S,1,i); + val(s,j,erreur); + Tablo_actionneur[maxTablo_act].Tempo:=j; + inc(maxTablo_act); + end; + end; + s:='';i:=0; + end; + end; + end; + + // Passage à niveau + if (pos('PN',s)<>0) then + begin + inc(NbrePN); + NbreVoies:=0; + repeat + inc(NbreVoies); + //Affiche('NbreVoies='+intToSTR(NbreVoies),clyellow); + //SetLength(Tablo_PN[1].Voie,1); + Delete(s,1,1); // supprime ( + val(s,j,erreur); + + Tablo_PN[NbrePN].voie[NbreVoies].ActFerme:=j; + + // Affiche('Ferme='+intToSTR(j),clyellow); + i:=pos(',',s);Delete(S,1,i); + val(s,j,erreur); + Tablo_PN[NbrePN].voie[NbreVoies].ActOuvre:=j; + // Affiche('Ouvre='+intToSTR(j),clyellow); + i:=pos(')',s);Delete(S,1,i); + i:=pos(',',s);Delete(S,1,i); + Tablo_PN[NbrePN].voie[NbreVoies].PresTrain:=false; + until (copy(s,1,2)='PN') or (NbreVoies=10); + + Tablo_PN[NbrePN].NbVoies:=NbreVoies; + Delete(s,1,3); // Supprime PN( + val(s,j,erreur); + Tablo_PN[NbrePN].Adresseferme:=j; + Delete(s,1,erreur-1); + if s[1]='+' then Tablo_PN[NbrePN].CommandeFerme:=2; + if s[1]='-' then Tablo_PN[NbrePN].CommandeFerme:=1; + Delete(s,1,2); // supprime +, + + val(s,j,erreur); + Tablo_PN[NbrePN].AdresseOuvre:=j; + Delete(s,1,erreur-1); + if s[1]='+' then Tablo_PN[NbrePN].CommandeOuvre:=2; + if s[1]='-' then Tablo_PN[NbrePN].CommandeOuvre:=1; + Delete(s,1,1); // supprime ) + i:=0; + end; + if pos('PN',s)<>0 then i:=0; + until (s='0'); + dec(maxTablo_act); +end; + +procedure compile_aiguillages; +begin + Affiche('Définition des aiguillages',clyellow); + maxaiguillage:=0; + Nligne:=1; + + repeat + s:=lit_ligne; + inc(Nligne); + //Affiche(s,ClLime); + //chaine:=s; + if debugconfig then Affiche(s,ClLime); + if (s<>'0') then + begin + inc(maxaiguillage); + virgule:=pos(',',s); + enregistrement:=copy(s,1,virgule-1); // adresse de l'aiguillage [TRI] + delete(s,1,virgule); + postriple:=pos('TRI',enregistrement);triC:=postriple<>0;if triC then delete(enregistrement,postriple,3); + postjd:=pos('TJD',enregistrement);tjdC:=postjd<>0;if tjdC then delete(enregistrement,postjd,3); + postjs:=pos('TJS',enregistrement);tjsC:=postjs<>0;if tjsC then delete(enregistrement,postjs,3); + + // adresse de l'aiguillage + Val(enregistrement,adraig,erreur); // adraig = adresse de l'aiguillage + if erreur<>0 then Affiche('Erreur aiguillage '+intToSTR(adraig)+' ; caractère '+enregistrement[erreur]+' inconnu',clred); + if debugConfig then Affiche('Adresse='+IntToSTR(adraig)+' enregistrement='+Enregistrement,clyellow); + + aiguillage[maxaiguillage].adresse:=adraig; + aiguillage[maxaiguillage].AdroitB:='Z'; aiguillage[maxaiguillage].AdevieB:='Z'; + aiguillage[maxaiguillage].DdroitB:='Z'; aiguillage[maxaiguillage].DdevieB:='Z'; + + aiguillage[maxaiguillage].ApointeB:='Z'; + aiguillage[maxaiguillage].Adevie2B:='Z'; + + if (triC) then aiguillage[maxaiguillage].modele:=triple; + if (tjsC) then + begin + aiguillage[maxaiguillage].modele:=tjs + end; + if (tjdC) then + begin + aiguillage[maxaiguillage].modele:=tjd ; + end; + if not(tjsC) and not(tjdC) and not(triC) then + begin + aiguillage[maxaiguillage].modele:=aig; + end; + //if debugConfig then Affiche(s,clyellow); + + if (triC) then + begin + Val(s,aig2,erreur); // aig = 2eme adresse de l'aiguillage + aiguillage[maxaiguillage].AdrTriple:=aig2; + virgule:=pos(',',s); + delete(s,1,virgule); + end; + ComptEl:=0;Compt_It:=0;Num_element:=Num_element+1; + // préparer l'enregistrement pour la boucle de ligne + + enregistrement:=s; + + Num_Champ:=1; + itl:=0; + repeat // parcoure la ligne + if (debugConfig) then Affiche('boucle de ligne: '+s,clYellow); + if (length(enregistrement)<>0) then + if (enregistrement[1]='P') then + begin + if tjdC then begin affiche('Erreur P interdit dans une TJD : '+sOrigine,clred);closefile(fichier);exit; end; + if debugconfig then Affiche('Section P - enregistrement='+enregistrement,clYellow); + ComptEl:=ComptEl+1; + decodeAig(enregistrement,detect,c); + if c='' then c:='Z'; + aiguillage[maxaiguillage].Apointe:=detect; + aiguillage[maxaiguillage].ApointeB:=c; + + virgule:=pos(',',enregistrement);if virgule=0 then virgule:=length(Enregistrement)+1; + delete(enregistrement,1,virgule); + end; + + if (length(enregistrement)<>0) then // section droite + if (enregistrement[1]='D') then + begin + if debugconfig then Affiche('Section D - enregistrement='+enregistrement,clYellow); + ComptEl:=ComptEl+1; + if tjdC or tjsC then + begin + Delete(Enregistrement,1,2); + decodeAig(Enregistrement,detect,c); + aiguillage[maxaiguillage].Adroit:=detect; + aiguillage[maxaiguillage].AdroitB:=c; + i:=pos(',',Enregistrement);Delete(Enregistrement,1,i); + decodeAig(Enregistrement,detect,c); + aiguillage[maxaiguillage].DDroit:=detect; + aiguillage[maxaiguillage].DdroitB:=c; + i:=pos(')',enregistrement);if i=0 then begin Affiche('Erreur de syntaxe ligne '+SOrigine,clred);closefile(fichier);exit;end; + Delete(enregistrement,1,i+1); + + //Affiche(enregistrement,clBlue); + end + else + begin + decodeAig(enregistrement,detect,c); + if c='' then c:='Z'; + aiguillage[maxaiguillage].Adroit:=detect; + aiguillage[maxaiguillage].AdroitB:=c; + + virgule:=pos(',',enregistrement);if virgule=0 then virgule:=length(enregistrement)+1; + delete(enregistrement,1,virgule); + end; + end; + + if (length(enregistrement)<>0) then + if (enregistrement[1]='S') then + begin + if debugconfig then Affiche('Section S - enregistrement='+enregistrement,clYellow); + ComptEl:=ComptEl+1; + + if tjdC or tjsC then + begin + Delete(enregistrement,1,2); + decodeAig(enregistrement,detect,c); + aiguillage[maxaiguillage].Adevie:=detect; + aiguillage[maxaiguillage].AdevieB:=c; + i:=pos(',',enregistrement);Delete(enregistrement,1,i); + decodeAig(enregistrement,detect,c); + aiguillage[maxaiguillage].DDevie:=detect; + aiguillage[maxaiguillage].DDevieB:=c; + i:=pos(')',enregistrement);if i=0 then begin Affiche('Erreur de syntaxe ligne '+SOrigine,clred);closefile(fichier);exit;end; + Delete(enregistrement,1,i+1); + + //Affiche(enregistrement,clBlue); + end + else + begin + delete(enregistrement,1,1); // supprime le S + i:=pos(',',enregistrement); + if i=0 then i:=length(enregistrement)+1; + s:=copy(enregistrement,1,i-1); // isole la zone S + + erreur:=pos('2-',s); + S2:=erreur<>0; + if (S2) then delete(s,erreur,2); + + erreur:=pos('S2',s); // description d'un rattachement à la branche S2 d'un aiguillage triple + tec:=erreur<>0; // ne supprimer que le 2 + if (tec) then delete(s,erreur+1,1); + + //val(enregistrement,detect,erreur); // extraction de l'adresse + decodeAig(s,detect,c); + //if ((detect=0) and (erreur=0)) then Affiche('Erreur pas d''adresse dans section S: '+s,clred); + //c:='Z'; + //if (erreur<>0) then begin delete(enregistrement,1,erreur-1);c:=enregistrement[1];end; + + if not(S2) and not(tec) then begin aiguillage[maxaiguillage].Adevie:=detect;aiguillage[maxaiguillage].AdevieB:=c;end; + if S2 and not(tec) then begin aiguillage[maxaiguillage].Adevie2:=detect;aiguillage[maxaiguillage].Adevie2B:=c;end; + if S2 and tec then begin aiguillage[maxaiguillage].Adevie2:=detect;aiguillage[maxaiguillage].Adevie2B:='T';end; + + virgule:=pos(',',enregistrement);if virgule=0 then virgule:=length(enregistrement)+1; + delete(enregistrement,1,virgule);; + end; + end; + + // inversion aiguillage + if (length(enregistrement)<>0) then + if (enregistrement[1]='I') then + begin + inc(Num_Champ); + delete(enregistrement,1,1); + Val(enregistrement,adr,erreur); + if (adr<0) or (adr>1) then begin Affiche('Erreur Inversion ; ligne '+sOrigine,clred);end; + //Affiche(intTostr(adr),clblue); + Aiguillage[maxaiguillage].inversionCDM:=adr; + virgule:=pos(',',enregistrement);if virgule=0 then virgule:=length(s)+1; + delete(enregistrement,1,virgule); + end; + + // si vitesse définie + if (length(enregistrement)<>0) then + if enregistrement[1]='V' then + begin + inc(num_champ); + delete(enregistrement,1,1); + Val(enregistrement,adr,erreur); + //Affiche('section vitesse définie aig='+intToSTR(aig)+'/'+intToSTR(adr),clyellow); + aiguillage[maxaiguillage].vitesse:=adr; + virgule:=pos(',',enregistrement);if virgule=0 then virgule:=length(s)+1; + delete(enregistrement,1,virgule); + end; + + // TJS et L + if (length(enregistrement)<>0) then + if enregistrement[1]='L' then + begin + if not(tjsC) then begin Affiche('Erreur paramètre L ligne: '+sOrigine,clred);closefile(fichier);exit;end; + inc(num_champ); + delete(enregistrement,1,1); + Val(enregistrement,adr,erreur); + aiguillage[maxaiguillage].tjsInt:=adr; + c:=enregistrement[erreur]; + if ((c<>'S') and (c<>'D')) then + begin + c:=' ';Affiche('Erreur paramètre L '+sOrigine,clred); + end; + aiguillage[maxaiguillage].tjsIntB:=c; + virgule:=pos(',',enregistrement);if virgule=0 then virgule:=length(enregistrement)+1; + delete(enregistrement,1,virgule); + end; + + // Init aiguillage + i:=pos('INIT(',enregistrement); + if i=1 then + begin + inc(num_champ); + delete(enregistrement,i,i+4); + Val(enregistrement,position,erreur); + i:=pos(',',enregistrement); + if i<>0 then delete(enregistrement,1,i); + Val(enregistrement,j,erreur); + aiguillage[maxaiguillage].temps:=j; + aiguillage[maxaiguillage].posinit:=position; + i:=pos(')',enregistrement); + delete(enregistrement,1,i); + virgule:=pos(',',enregistrement);if virgule=0 then virgule:=length(enregistrement)+1; + delete(enregistrement,1,virgule); + end; + + // nombre d'états de la TJD + if (length(enregistrement)<>0) then + if enregistrement[1]='E' then + begin + inc(num_champ); + delete(enregistrement,1,1); + Val(enregistrement,adr,erreur); + aiguillage[maxaiguillage].EtatTJD:=adr; + virgule:=pos(',',enregistrement);if virgule=0 then virgule:=length(s)+1; + delete(enregistrement,1,virgule); + end; + + inc(itl); + until (enregistrement='') or (itl>3); + if itl>4 then begin Affiche('Erreur 400 ligne '+sOrigine,clred);closefile(fichier);exit;end; + end; + until (sOrigine='0'); +end; + +procedure lit_flux; + + label ici1,ici2,ici3,ici4 ; + var i : integer; + +// début de la procédure lit_config +begin + nv:=0; it:=0; + // taille de fonte + repeat + s:=lit_ligne; + //affiche(s,cllime); + sa:=uppercase(Fonte_ch)+'='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + trouve_fonte:=true; + delete(s,i,length(sa)); + val(s,TailleFonte,erreur); + if (TailleFonte<8) or (tailleFonte>25) then taillefonte:=10; + FormPrinc.FenRich.Font.Size:=TailleFonte; + end; + + // adresse ip et port de CDM + sa:=uppercase(IpV4_PC_ch)+'='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + trouve_ipv4_PC:=true; + delete(s,i,length(sa)); + i:=pos(':',s); + if i<>0 then + begin + adresseIPCDM:=copy(s,1,i-1);Delete(s,1,i); + val(s,portCDM,erreur); + if (portCDM=0) or (portCDM>65535) or (erreur<>0) then affiche('Erreur port CDM : '+s,clred); + end + else affiche('Erreur adresse ip cdm rail '+s,clred); + end; + + // adresse ip et port de la centrale + sa:=uppercase(IPV4_INTERFACE_ch)+'='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + trouve_IPV4_INTERFACE:=true; + delete(s,i,length(sa)); + i:=pos(':',s); + if i<>0 then + begin + adresseIP:=copy(s,1,i-1);Delete(s,1,i);port:=StrToINT(s); + if (adresseIP<>'0') and (port=0) then affiche('Erreur port nul : '+sOrigine,clRed); + end + else begin adresseIP:='0';parSocketLenz:=false;end; + end; + + // configuration du port com + sa:=uppercase(PROTOCOLE_SERIE_ch)+'='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + trouve_PROTOCOLE_SERIE:=true; + delete(s,i,length(sa)); + if not(config_com(s)) then Affiche('Erreur port com mal déclaré : '+s,clred); + portcom:=s; + end; + + // temporisation entre 2 caractères + sa:=uppercase(INTER_CAR_ch)+'='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + delete(s,i,length(sa)); + trouve_INTER_CAR:=true; + val(s,TempoOctet,erreur); + if erreur<>0 then Affiche('Erreur temporisation entre 2 octets',clred); + end; + + // temporisation attente maximale interface + sa:=uppercase(TEMPO_MAXI_ch)+'='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + delete(s,i,length(sa)); + trouve_Tempo_maxi:=true; + val(s,TimoutMaxInterface,erreur); + if erreur<>0 then Affiche('Erreur temporisation maximale interface',clred); + end; + + // entete + sa:=uppercase(ENTETE_ch)+'='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + delete(s,i,length(sa)); + trouve_Entete:=true; + val(s,Valeur_entete,erreur); + entete:=''; + case Valeur_entete of + 0 : begin entete:='';suffixe:='';end; + 1 : begin entete:=#$FF+#$FE;suffixe:='';end; + 2 : begin entete:=#228;suffixe:=#13+#13+#10;end; + end; + if (erreur<>0) or (valeur_entete>2) then Affiche('Erreur déclaration variable '+entete_ch,clred); + end; + + // avec ou sans initialisation des aiguillages + sa:=uppercase(INIT_AIG_ch)+'='; + i:=pos(sa,s); + if i<>0 then + begin + trouve_init_aig:=true; + inc(nv); + delete(s,i,length(sa)); + AvecInitAiguillages:=s='1'; + end; + + // taille de la fenetre + sa:=uppercase(fenetre_ch)+'='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + trouve_fenetre:=true; + delete(s,i,length(sa)); + val(s,fenetre,erreur); + if fenetre=1 then Formprinc.windowState:=wsMaximized; + end; + + // temporisation aiguillages + sa:=uppercase(Tempo_Aig_ch)+'='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + trouve_Tempo_aig:=true; + delete(s,i,length(sa)); + val(s,Tempo_Aig,erreur); + end; + + sa:=uppercase(verif_version_ch)+'='; + i:=pos(sa,s); + if i<>0 then + begin + trouve_verif_version:=true; + inc(nv); + delete(s,i,length(sa)); + // vérification de la version au démarrage + verifVersion:=true; + val(s,i,erreur); + if erreur=0 then verifVersion:=i=1; + end; + + sa:=uppercase(NOTIF_VERSION_ch)+'='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + delete(s,i,length(sa)); + trouve_NOTIF_VERSION:=true; + // vérification de la version au démarrage + val(s,i,erreur); + notificationVersion:=i=1; + end; + + sa:=uppercase(TCO_ch)+'='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + delete(s,i,length(sa)); + trouve_TCO:=true; + // vérification de la version au démarrage + val(s,i,erreur); + AvecTCO:=i=1; + end; + + sa:=uppercase(CDM_ch)+'='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + trouve_CDM:=true; + delete(s,i,length(sa)); + // vérification de la version au démarrage + val(s,i,erreur); + LanceCDM:=i=1; + end; + + sa:=uppercase(LAY_ch)+'='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + trouve_lay:=true; + delete(s,i,length(sa)); + lay:=s; + end; + + sa:=uppercase(SERVEUR_INTERFACE_ch)+'='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + trouve_serveur_interface:=true; + delete(s,i,length(sa)); + val(s,i,erreur); + ServeurInterfaceCDM:=i; + end; + + sa:=uppercase(RETRO_ch)+'='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + trouve_retro:=true; + delete(s,i,length(sa)); + val(s,i,erreur); + ServeurRetroCDM:=i; + end; + + sa:=uppercase(nb_det_dist_ch)+'='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + trouve_NbDetDist:=true; + delete(s,i,length(sa)); + val(s,i,erreur); + if i<2 then begin i:=2;Affiche('Attention '+nb_det_dist_ch+' ramené à '+IntToSTR(i),clOrange); end; + Nb_Det_Dist:=i; + end; + + sa:=uppercase(Raz_signaux_ch)+'='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + trouve_NbDetDist:=true; + delete(s,i,length(sa)); + val(s,i,erreur); + if i>1 then i:=1; + Raz_Acc_signaux:=i=1; + end; + + // section aiguillages + sa:=uppercase(section_aig_ch); + i:=pos(sa,s); + trouve_section_aig:=i<>0; + if trouve_section_aig then compile_aiguillages; + + // section branche + sa:=uppercase(section_branches_ch); + i:=pos(sa,s); + trouve_section_branche:=i<>0; + if trouve_section_branche then compile_branches; + + // section signaux + sa:=uppercase(section_sig_ch); + i:=pos(sa,s); + trouve_section_sig:=i<>0; + if trouve_section_sig then compile_signaux; + + // section actionneurs + sa:=uppercase(section_act_ch); + i:=pos(sa,s); + trouve_section_act:=i<>0; + if trouve_section_act then compile_actionneurs; + + inc(it); + + until (eof(fichier)); + +end; +// procédure lit_config +begin + debugConfig:=false; + trouve_NbDetDist:=false; + trouve_ipv4_PC:=false; + trouve_retro:=false; + trouve_sec_init:=false; + trouve_init_aig:=false; + trouve_tempo_aig:=false; + trouve_INTER_CAR:=false; + trouve_entete:=false; + trouve_IPV4_INTERFACE:=false; + trouve_lay:=false; + trouve_Tempo_maxi:=false; + trouve_PROTOCOLE_SERIE:=false; + trouve_TCO:=false; + trouve_Serveur_interface:=false; + trouve_cdm:=false; + trouve_NOTIF_VERSION:=false; + trouve_fenetre:=false; + trouve_verif_version:=false; + trouve_Fonte:=false; + trouve_Raz:=false; + + Nb_Det_Dist:=3; + // initialisation des aiguillages avec des valeurs par défaut + for i:=1 to MaxAcc do + begin + Aiguillage[i].modele:=rien ; // sans existence + Aiguillage[i].adresse:=0; + Aiguillage[i].position:=const_inconnu; // position inconnue + Aiguillage[i].PosInit:=const_inconnu; // position inconnue + Aiguillage[i].temps:=5 ; + Aiguillage[i].inversionCDM:=0; + end; + for i:=1 to 1024 do + begin + Detecteur[i].etat:=false; + Detecteur[i].train:='0'; + Ancien_detecteur[i]:=false; + end; + + // vérifier si le fichier ConfigGenerale.cfg existe + fichier_trouve:=true; + {$I+} + try + assign(fichier,NomConfig); + reset(fichier); + except + fichier_trouve:=false; + end; + {$I-} + if fichier_trouve then + begin + close(fichier); + end; + + // si pas trouvé le fichier, lire les 2 anciens fichiers et les fusionner + if not(fichier_trouve) then + begin + Affiche('***Traitement de fusion des deux fichiers de config***',clAqua); + + Affiche('Lecture de l''ancien fichier de configuration client-GL.cfg',clyellow); + {$I+} + try + assign(fichier,'client-GL.cfg'); + reset(fichier); + except + Affiche('Fichier client-GL.cfg non trouvé',clred); + exit; + end; + {$I-} + lit_flux; + closeFile(fichier); + + Affiche('Lecture de l''ancien fichier de configuration config.cfg',clyellow); + {$I+} + try + assign(fichier,'config.cfg'); + reset(fichier); + except + Affiche('Fichier config.cfg non trouvé',clred); + exit; + end; + {$I-} + lit_flux; + closeFile(fichier); + // regénérer la config dans le fichier configgenerale.cfg + assign(fichier,'client-gl.cfg'); + reset(fichier); // pour les commentaires + genere_config; + + s:='------------------------------------------------------------------------------------------------------'; + Affiche(s,clAqua); + Affiche('AVERTISSEMENT: les fichiers de configurations ont été fusionnés dans ConfigGenerale.cfg',clAqua); + Affiche('les deux anciens fichiers de configuration ne sont plus utilisés',clAqua); + Affiche(s,clAqua); + end + + else + begin + Affiche('Lecture du fichier de configuration '+NomConfig,clyellow); + {$I+} + try + assign(fichier,NomConfig); + reset(fichier); + except + Affiche('Fichier '+NomConfig+' non trouvé',clred); + exit; + end; + {$I-} + lit_flux; + close(fichier); + end; + + configNulle:=(maxAiguillage=0) and (NbreBranches=0) and (Nbrefeux=0); + if configNulle then Affiche('Fonctionnement en config nulle',ClYellow); + + s:='';//Affiche(intToSTR(Nv),clred); + if not(trouve_NbDetDist) then s:=nb_det_dist_ch; + if not(trouve_ipv4_PC) then s:=IpV4_PC_ch; + if not(trouve_retro) then s:=retro_ch; + if not(trouve_init_aig) then s:=INIT_AIG_ch; + if not(trouve_lay) then s:=LAY_ch; + if not(trouve_INTER_CAR) then s:=INTER_CAR_ch; + if not(trouve_Tempo_maxi) then s:=Tempo_maxi_ch; + if not(trouve_Entete) then s:=Entete_ch; + if not(trouve_TCO) then s:=TCO_ch; + if not(trouve_CDM) then s:=CDM_ch; + if not(trouve_Serveur_interface) then s:=Serveur_interface_ch; + if not(trouve_fenetre) then s:=fenetre_ch; + if not(trouve_tempo_aig) then s:=tempo_aig_ch; + if not(trouve_NOTIF_VERSION) then s:=NOTIF_VERSION_ch; + if not(trouve_verif_version) then s:=verif_version_ch; + if not(trouve_fonte) then s:=fonte_ch; + if s<>'' then affiche('ERREUR: manque variables dans '+NomConfig+' :'+s,clred); + verif_coherence; +end; + + +// sauvegarder la config dans le fichier cfg function Sauve_config : boolean; var i,erreur : integer; s : string; @@ -1378,9 +2247,19 @@ begin end; if change_srv then services_CDM; - // générer le fichiers config.cfg et clieng-GL.cfg + // générer le fichier de config + // ouvrir l'ancien fichier pour copier les commentaires + {$I+} + try + assign(fichier,NomConfig); + reset(fichier); + except + Affiche('Fichier '+NomConfig+' non trouvé',clOrange); + end; + {$I-} + genere_config; - Affiche('Configuration sauvegardée dans les fichiers',clLime); + Affiche('Configuration sauvegardée dans le fichier',clLime); config_modifie:=false; sauve_config:=true; end; @@ -1398,6 +2277,42 @@ begin end; end; +procedure clicListeFeu(lc : integer); +var AncAdresse,adresse,erreur : integer; + s : string; +begin + s:=Uppercase(FormConfig.RichSig.Lines[lc]); // ligne cliquée + if s='' then + begin + RE_ColorLine(Formconfig.RichSig,ligneclicSig,ClAqua); + ligneclicSig:=-1; + exit; + end; + + Feu_Sauve:=feux[lc+1]; // sauvegarde + + AncLigneClicSig:=ligneclicSig; + ligneClicSig:=lc; + + // Mettre en rouge le signal modifié quand on clique sur un autre signal + if AncligneclicSig<>-1 then + begin + val(FormConfig.RichSig.Lines[AncLigneClicSig],AncAdresse,erreur); + if feux[ligneClicSig+1].modifie then RE_ColorLine(Formconfig.RichSig,AncLigneClicSig,ClWhite) else + RE_ColorLine(Formconfig.RichSig,AncLigneClicSig,ClAqua); + end; + + Val(s,Adresse,erreur); // Adresse du signal + if adresse=0 then exit; + + FormConfig.EditAdrSig.Color:=clWindow; + RE_ColorLine(Formconfig.RichSig,ligneClicSig,Clyellow); + + aff_champs_sig_feux(lc+1); // affiche les champs du feu + clicliste:=false; +end; + + procedure TFormConfig.FormActivate(Sender: TObject); var i :integer; s : string; @@ -1418,9 +2333,11 @@ begin LabelTJD2.Visible:=false; EditDevieS2.Visible:=false; Label18.Visible:=false; + Label20.Visible:=false; GroupBoxPN.Visible:=false; GroupBoxAct.Visible:=false; GroupBoxRadio.Visible:=false; + GroupBoxEtatTJD.Visible:=false; EditP1.ReadOnly:=false; EditP2.ReadOnly:=false; @@ -1585,6 +2502,9 @@ begin Perform(EM_SCROLLCARET,0,0); end; + if clicproprietes then clicListeFeu(indexfeuclic); + clicproprietes:=false; + //l'onglet affiché est sélectionné à l'appel de la fiche dans l'unité UnitPrinc clicListe:=false; end; @@ -1656,15 +2576,32 @@ begin ImageAffiche.Picture.Bitmap.TransparentMode:=tmAuto; ImageAffiche.Picture.Bitmap.TransparentColor:=clblue; ImageAffiche.Transparent:=true; + GroupBoxEtatTJD.Visible:=false; + // tjd if tjd or tjs then begin + Label20.Visible:=true; if tjd then begin ComboBoxAig.ItemIndex:=1; EditL.Visible:=false; LabelL.Visible:=false; + GroupBoxEtatTJD.Visible:=true; + if aiguillage[ind].EtatTJD=2 then + begin + RadioButtonTJD2.Checked:=true;RadioButtonTJD4.Checked:=false; + EditP1.Visible:=false;EditP2.Visible:=false;EditP3.Visible:=false;EditP4.Visible:=false; + LabelTJD1.Visible:=false;LabelTJD2.Visible:=false; + end; + if aiguillage[ind].EtatTJD=4 then + begin + RadioButtonTJD2.Checked:=false;RadioButtonTJD4.Checked:=true; + EditP1.Visible:=true;EditP2.Visible:=true;EditP3.Visible:=true;EditP4.Visible:=true; + LabelTJD1.Visible:=true;LabelTJD2.Visible:=true; + end; end; + if tjs then begin ComboBoxAig.ItemIndex:=2; @@ -1676,8 +2613,6 @@ begin ImageAffiche.Picture.BitMap:=Imagetjd.Picture.Bitmap; labelBG.Caption:='S'; Edit_HG.Visible:=true; - labelTJD1.Visible:=true; - LabelTJD2.Visible:=true; EditAigTriple.Visible:=false; Edit_HG.ReadOnly:=false; @@ -1686,10 +2621,7 @@ begin EditDroit_BD.ReadOnly:=false; tjd:=true; labelHG.Visible:=true; - EditP1.Visible:=true; - EditP2.Visible:=true; - EditP3.Visible:=true; - EditP4.Visible:=true; + CheckInverse.Visible:=true; EditDevieS2.Visible:=false; Label18.Visible:=false; @@ -1718,15 +2650,32 @@ begin // milieu bas droit EditP4.Text:=intToSTR(aiguillage[index].Ddroit)+aiguillage[index].DdroitB; - // droit haut - EditDevie_HD.Text:=intToSTR(aiguillage[id2].Adevie)+aiguillage[id2].AdevieB; - EditDevie_HD.Hint:=TypeElAIg_to_char(aiguillage[id2].Adevie,aiguillage[id2].AdevieB); - LabelTJD1.Caption:=IntToSTR(adresse); + if (aiguillage[ind].EtatTJD=4) or tjs then + begin + // droit haut + EditDevie_HD.Text:=intToSTR(aiguillage[id2].Adevie)+aiguillage[id2].AdevieB; + EditDevie_HD.Hint:=TypeElAIg_to_char(aiguillage[id2].Adevie,aiguillage[id2].AdevieB); + LabelTJD1.Caption:=IntToSTR(adresse); - // droit bas - EditDroit_BD.Text:=intToSTR(aiguillage[id2].Adroit)+aiguillage[Id2].AdroitB; - EditDroit_BD.Hint:=TypeElAIg_to_char(aiguillage[id2].ADroit,aiguillage[Id2].AdroitB); - LabelTJD2.Caption:=IntToSTR(adr2); + // droit bas + EditDroit_BD.Text:=intToSTR(aiguillage[id2].Adroit)+aiguillage[Id2].AdroitB; + EditDroit_BD.Hint:=TypeElAIg_to_char(aiguillage[id2].ADroit,aiguillage[Id2].AdroitB); + LabelTJD2.Caption:=IntToSTR(adr2); + end; + + if (aiguillage[ind].EtatTJD=2) and tjd then + begin + // droit haut + EditDevie_HD.Text:=intToSTR(aiguillage[index].Ddevie)+aiguillage[index].DdevieB; + EditDevie_HD.Hint:=TypeElAIg_to_char(aiguillage[index].Ddevie,aiguillage[index].DdevieB); + LabelTJD1.Caption:=IntToSTR(adresse); + + // droit bas + EditDroit_BD.Text:=intToSTR(aiguillage[index].Ddroit)+aiguillage[index].DdroitB; + EditDroit_BD.Hint:=TypeElAIg_to_char(aiguillage[index].Ddroit,aiguillage[index].DdroitB); + LabelTJD2.Caption:=IntToSTR(adresse); + end; + CheckInverse.checked:=aiguillage[Index_Aig(adresse)].inversionCDM=1; @@ -1739,6 +2688,7 @@ begin if not(tjd) and not(tjs) or tri then begin EditL.Visible:=false; + Label20.Visible:=false; LabelL.Visible:=false; ComboBoxAig.ItemIndex:=0; if not(tri) then @@ -2299,12 +3249,21 @@ begin if (modele=tjd) or (modele=tjs) then begin - // TJD/TJS - adr2:=aiguillage[index].DDroit; // adresse homologue - index:=Index_aig(adr2); - if index=0 then exit; - aiguillage[index].Adevie:=adr; - aiguillage[index].AdevieB:=B; + // TJD4/TJS + if aiguillage[index].EtatTJD=4 then + begin + adr2:=aiguillage[index].DDroit; // adresse homologue + index:=Index_aig(adr2); + if index=0 then exit; + aiguillage[index].Adevie:=adr; + aiguillage[index].AdevieB:=B; + end; + if aiguillage[index].EtatTJD=2 then + begin + aiguillage[index].Ddevie:=adr; + aiguillage[index].DdevieB:=B; + end; + s:=encode_aig(index); formconfig.RichAig.Lines[index-1]:=s; RE_ColorLine(Formconfig.RichAig,index-1,ClWhite); @@ -2358,12 +3317,21 @@ begin end; if (modele=tjd) or (modele=tjs) then begin - // TJD/TJS - adr2:=aiguillage[index].DDroit; // adresse homologue - index:=Index_aig(adr2); - if index=0 then exit; - aiguillage[index].Adroit:=adr; - aiguillage[index].AdroitB:=B; + // TJD4/TJS + if aiguillage[index].EtatTJD=4 then + begin + adr2:=aiguillage[index].DDroit; // adresse homologue + index:=Index_aig(adr2); + if index=0 then exit; + aiguillage[index].Adroit:=adr; + aiguillage[index].AdroitB:=B; + end; + // TJD2 + if aiguillage[index].EtatTJD=2 then + begin + aiguillage[index].Ddroit:=adr; + aiguillage[index].DdroitB:=B; + end; s:=encode_aig(index); formconfig.RichAig.Lines[index-1]:=s; RE_ColorLine(Formconfig.RichAig,index-1,ClWhite); @@ -2503,6 +3471,60 @@ begin formconfig.RichAig.Lines[ligneclicAig]:=s; end; +procedure TFormConfig.RadioButtonTJD2Click(Sender: TObject); +var AdrAig,erreur,index,adr2 : integer; + s : string; +begin + if clicliste then exit; + if affevt then affiche('Evt RadioBouton tjd 2 états',clyellow); + s:=formconfig.RichAig.Lines[ligneclicAig]; + Val(s,adrAig,erreur); + if AdrAig=0 then exit; + + EditP1.Visible:=false;EditP2.Visible:=false;EditP3.Visible:=false;EditP4.Visible:=false; + LabelTJD1.Visible:=false;LabelTJD2.Visible:=false; + + index:=Index_Aig(AdrAig); + aiguillage[index].etatTJD:=2; + aiguillage[index].modifie:=true; + s:=encode_aig(index); + formconfig.RichAig.Lines[ligneclicAig]:=s; + + adr2:=aiguillage[index].Ddroit; // adresse homologue + index:=Index_Aig(Adr2); + aiguillage[index].etatTJD:=2; + s:=encode_aig(index); + formconfig.RichAig.Lines[index-1]:=s; +end; + + +procedure TFormConfig.RadioButtonTJD4Click(Sender: TObject); +var AdrAig,erreur,index,adr2 : integer; + s : string; +begin + if clicliste then exit; + if affevt then affiche('Evt RadioBouton tjd 4 états',clyellow); + s:=formconfig.RichAig.Lines[ligneclicAig]; + Val(s,adrAig,erreur); + if AdrAig=0 then exit; + + EditP1.Visible:=true;EditP2.Visible:=true;EditP3.Visible:=true;EditP4.Visible:=true; + LabelTJD1.Visible:=true;LabelTJD2.Visible:=true; + + index:=Index_Aig(AdrAig); + aiguillage[index].etatTJD:=4; + aiguillage[index].modifie:=true; + s:=encode_aig(index); + formconfig.RichAig.Lines[ligneclicAig]:=s; + + adr2:=aiguillage[index].Ddroit; // adresse homologue + index:=Index_Aig(Adr2); + aiguillage[index].etatTJD:=4; + aiguillage[index].modifie:=true; + s:=encode_aig(index); + formconfig.RichAig.Lines[index-1]:=s; +end; + procedure TFormConfig.RadioButton30kmhClick(Sender: TObject); var AdrAig,erreur,index : integer; s : string; @@ -2553,10 +3575,11 @@ begin if affevt then Affiche('Evt ComboBox Decodeur',clOrange); end; + + // cliqué sur liste feux procedure TFormConfig.RichSigMouseDown(Sender: TObject;Button: TMouseButton; Shift: TShiftState; X, Y: Integer); -var lc,AncAdresse,adresse,erreur : integer; - s : string; +var lc : integer; begin clicliste:=true; raz_champs_sig; @@ -2565,36 +3588,9 @@ begin begin lc:=Perform(EM_LINEFROMCHAR,-1,0); // numéro de la lignée cliquée //Affiche('numéro de la ligne cliquée '+intToStr(lc),clyellow); - s:=Uppercase(Lines[lc]); // ligne cliquée - if s='' then - begin - RE_ColorLine(Formconfig.RichSig,ligneclicSig,ClAqua); - ligneclicSig:=-1; - exit; - end; + clicListeFeu(lc); + end; - Feu_Sauve:=feux[lc+1]; // sauvegarde - - AncLigneClicSig:=ligneclicSig; - ligneClicSig:=lc; - - // Mettre en rouge le signal modifié quand on clique sur un autre signal - if AncligneclicSig<>-1 then - begin - val(FormConfig.RichSig.Lines[AncLigneClicSig],AncAdresse,erreur); - if feux[ligneClicSig+1].modifie then RE_ColorLine(Formconfig.RichSig,AncLigneClicSig,ClWhite) else - RE_ColorLine(Formconfig.RichSig,AncLigneClicSig,ClAqua); - end; - end; - - Val(s,Adresse,erreur); // Adresse du signal - if adresse=0 then exit; - - EditAdrSig.Color:=clWindow; - RE_ColorLine(Formconfig.RichSig,ligneClicSig,Clyellow); - - aff_champs_sig_feux(lc+1); // affiche les champs du feu - clicliste:=false; end; procedure Det1; @@ -2619,12 +3615,6 @@ begin end; end; -procedure TFormConfig.EditDet1KeyPress(Sender: TObject; var Key: Char); -begin - if clicliste or (ligneClicSig<0) or (ord(Key)<>VK_RETURN) then exit; - Det1; -end; - procedure TFormConfig.EditDet1Change(Sender: TObject); begin Det1; @@ -2676,11 +3666,6 @@ begin Suiv1; end; -procedure TFormConfig.EditSuiv1KeyPress(Sender: TObject; var Key: Char); -begin - if clicliste or (comboBoxAsp.Itemindex>=6) or (ligneClicSig<0) or (ord(Key)<>VK_RETURN) then exit; - Suiv1; -end; procedure Det2; var s : string; @@ -2709,11 +3694,6 @@ begin det2; end; -procedure TFormConfig.EditDet2KeyPress(Sender: TObject; var Key: Char); -begin - if clicliste or (ligneClicSig<0) or (ord(Key)<>VK_RETURN) then exit; - det2; -end; procedure TFormConfig.CheckVerrouCarreClick(Sender: TObject); var s : string; @@ -2790,13 +3770,6 @@ begin Suiv2; end; -procedure TFormConfig.EditSuiv2KeyPress(Sender: TObject; var Key: Char); - -begin - if clicliste or (comboBoxAsp.Itemindex>=6) or (ligneClicSig<0) or (ord(Key)<>VK_RETURN) then exit; - Suiv2; -end; - procedure det3; var s : string; i,erreur : integer; @@ -2825,11 +3798,6 @@ begin det3; end; -procedure TFormConfig.EditDet3KeyPress(Sender: TObject; var Key: Char); -begin - if clicliste or (ligneClicSig<0) or (ord(Key)<>VK_RETURN) then exit; - det3; -end; procedure Suiv3; var s : string; @@ -2877,12 +3845,6 @@ begin suiv3; end; -procedure TFormConfig.EditSuiv3KeyPress(Sender: TObject; var Key: Char); -begin - if clicliste or (comboBoxAsp.Itemindex>=6) or (ligneClicSig<0) then exit; - suiv3; -end; - procedure det4; var s : string; i,erreur : integer; @@ -2911,12 +3873,6 @@ begin det4; end; -procedure TFormConfig.EditDet4KeyPress(Sender: TObject; var Key: Char); -begin - if clicliste or (ligneClicSig<0) or (ord(Key)<>VK_RETURN) then exit; - det4; -end; - procedure suiv4; var s : string; erreur,i : integer; @@ -2963,12 +3919,6 @@ begin Suiv4; end; -procedure TFormConfig.EditSuiv4KeyPress(Sender: TObject; var Key: Char); -begin - if clicliste or (comboBoxAsp.Itemindex>=6) or (ligneClicSig<0) or (ord(Key)<>VK_RETURN) then exit; - Suiv4; -end; - procedure TFormConfig.EditActChange(Sender: TObject); var s : string; @@ -3203,12 +4153,6 @@ begin AdrSig; end; -procedure TFormConfig.EditAdrSigKeyPress(Sender: TObject; var Key: Char); -begin - if clicliste or (ord(Key)<>VK_RETURN) then exit; - AdrSig; -end; - procedure TFormConfig.EditAdrAigChange(Sender: TObject); var s : string; i,vide,erreur,index,adr2 : integer; @@ -3346,11 +4290,7 @@ begin uni; end; -procedure TFormConfig.EditSpecUniKeyPress(Sender: TObject; var Key: Char); -begin - if clicliste or (ligneClicSig<0) or (ord(Key)<>VK_RETURN) then exit; - uni; -end; + procedure TFormConfig.ButtonrestaureClick(Sender: TObject); var index : integer; @@ -3890,36 +4830,46 @@ var i,index : integer; begin if affevt then affiche('Evt bouton Sup Feu',clyellow); i:=ligneClicSig; - if (i=-1) then exit; + if (i<0) then exit; index:=i+1; // passe en index tableau s:='Voulez-vous supprimer le feu '+IntToSTR(feux[index].adresse)+'?'; if Application.MessageBox(pchar(s),pchar('confirm'), MB_YESNO or MB_DEFBUTTON2 or MB_ICONQUESTION)=idNo then exit; Affiche('Suppression du feu ='+IntToSTR(feux[index].adresse),clOrange); - clicliste:=true; + clicliste:=true; // évite les évènements Edit text Feu_supprime:=feux[index]; // sauvegarde le feu supprimé Feu_sauve.adresse:=0; // dévalider sa définition + Feu_sauve.aspect:=0; // dévalider sa définition + // supprime le feu du tableau - dec(NbreFeux); + ButtonInsFeu.Caption:='Ajouter le feu '+intToSTR(feux[index].adresse)+' supprimé'; feux[index].Img.free; // supprime l'image, ce qui efface le feu du tableau graphique Feux[index].Lbl.Free; // supprime le label, ... if Feux[index].check<>nil then begin Feux[index].check.Free;Feux[index].Check:=nil;end; // supprime le check du feu blanc s'il existait + // décale le tableau de feux et recalcule les positions des images - for i:=index to NbreFeux do + for i:=index to NbreFeux-1 do begin feux[i]:=feux[i+1]; with feux[i].Img do begin Top:=(HtImg+espY+20)*((i-1) div NbreImagePLigne); // détermine les points d'origine Left:=10+ (LargImg+5)*((i-1) mod (NbreImagePLigne)); + Name:='ImageFeu'+IntToSTR(i); + s:='Index='+IntToSTR(i)+' @='+inttostr(feux[i].Adresse)+' Décodeur='+intToSTR(feux[i].Decodeur)+ + ' Adresse détecteur associé='+intToSTR(feux[i].Adr_det1)+ + ' Adresse élement suivant='+intToSTR(feux[i].Adr_el_suiv1); + if feux[i].Btype_suiv1=aig then s:=s+' (aig)'; + Hint:=s; end; with feux[i].Lbl do begin Top:=HtImg+((HtImg+EspY+20)*((i-1) div NbreImagePLigne)); Left:=10+ (LargImg+5)*((i-1) mod (NbreImagePLigne)); + caption:='@'+IntToSTR(Feux[i].adresse); end; if Feux[i].check<>nil then with Feux[i].Check do @@ -3927,8 +4877,11 @@ begin Hint:=intToSTR(i); Top:=HtImg+15+((HtImg+EspY+20)*((i-1) div NbreImagePLigne)); Left:=10+ (LargImg+5)*((i-1) mod (NbreImagePLigne)); - end; + end; + //Affiche('décale feu '+IntToSTR(i)+'<'+intToSTR(i+1),clorange); end; + + dec(NbreFeux); EditAdrSig.Text:=''; EditDet1.Text:='';EditDet2.Text:='';EditDet3.Text:='';EditDet4.Text:=''; @@ -3954,6 +4907,7 @@ begin clicliste:=false; end; +// Ajouter le feu supprimé procedure TFormConfig.ButtonInsFeuClick(Sender: TObject); var s : string; begin @@ -3963,7 +4917,8 @@ begin inc(NbreFeux); feux[NbreFeux]:=Feu_supprime; Feu_Supprime.adresse:=0; // dévalider le feu sauvegardé - cree_image(nbrefeux); + Feu_supprime.aspect:=0; + cree_image(nbrefeux); config_modifie:=true; // réafficher le rechedit s:=encode_Sig_Feux(NbreFeux); @@ -4021,7 +4976,7 @@ begin for Indexaig:=1 to maxaiguillage do begin // tjd ou tjs - if (aiguillage[Indexaig].modele=tjd) or (aiguillage[Indexaig].modele=tjs) then + if ((aiguillage[Indexaig].modele=tjd) and (aiguillage[Indexaig].EtatTJD=4)) or (aiguillage[Indexaig].modele=tjs) then begin if aiguillage[Indexaig].Ddroit<>aiguillage[Indexaig].Ddevie then begin @@ -4099,7 +5054,7 @@ begin begin if aiguillage[Indexaig].AdrTriple=0 then begin - Affiche('Erreur 6.1 : 2ème adresse de l''aiguillage triple '+intToSTR(adr)+' non définie',clred); + Affiche('Erreur 6.1: 2ème adresse de l''aiguillage triple '+intToSTR(adr)+' non définie',clred); ok:=false; end; end; @@ -4107,7 +5062,7 @@ begin begin if adr=aiguillage[i].Adresse then begin - affiche('Erreur 6.2 : aiguillage '+intToSTR(adr)+' défini deux fois',clred); + affiche('Erreur 6.2: aiguillage '+intToSTR(adr)+' défini deux fois',clred); ok:=false; end; end; @@ -4156,7 +5111,7 @@ begin if IndexBranche_trouve=0 then begin ok:=false; - Affiche('Erreur : Détecteur '+intToSTR(i)+' non existant mais associé au signal '+IntToSTR(feux[j].adresse),clred); + Affiche('Erreur 8.1: Détecteur '+intToSTR(i)+' non existant mais associé au signal '+IntToSTR(feux[j].adresse),clred); end; end else @@ -4164,7 +5119,7 @@ begin if feux[j].Aspect<10 then begin ok:=false; - Affiche('Erreur : Adresse de détecteur nul sur signal '+IntToSTR(feux[j].adresse),clred); + Affiche('Erreur 8.2: Adresse de détecteur nul sur signal '+IntToSTR(feux[j].adresse),clred); end; end; @@ -4175,7 +5130,7 @@ begin if IndexBranche_trouve=0 then begin ok:=false; - Affiche('Erreur : Détecteur '+intToSTR(i)+' non existant mais associé au signal '+IntToSTR(feux[j].adresse),clred); + Affiche('Erreur 8.3: Détecteur '+intToSTR(i)+' non existant mais associé au signal '+IntToSTR(feux[j].adresse),clred); end; end; @@ -4186,7 +5141,7 @@ begin if IndexBranche_trouve=0 then begin ok:=false; - Affiche('Erreur : Détecteur '+intToSTR(i)+' non existant mais associé au signal '+IntToSTR(feux[j].adresse),clred); + Affiche('Erreur 8.4: Détecteur '+intToSTR(i)+' non existant mais associé au signal '+IntToSTR(feux[j].adresse),clred); end; end; @@ -4197,7 +5152,7 @@ begin if IndexBranche_trouve=0 then begin ok:=false; - Affiche('Erreur : Détecteur '+intToSTR(i)+' non existant mais associé au signal '+IntToSTR(feux[j].adresse),clred); + Affiche('Erreur 8.5: Détecteur '+intToSTR(i)+' non existant mais associé au signal '+IntToSTR(feux[j].adresse),clred); end; end; @@ -4212,7 +5167,7 @@ begin if IndexBranche_trouve=0 then begin ok:=false; - Affiche('Erreur : Détecteur '+intToSTR(i)+' non existant mais associé au signal '+IntToSTR(feux[j].adresse),clred); + Affiche('Erreur 9.1: Détecteur '+intToSTR(i)+' non existant mais associé au signal '+IntToSTR(feux[j].adresse),clred); end; end; if ((km=aig) or (km=tjs) or (km=tjd) or (km=triple)) then @@ -4221,7 +5176,7 @@ begin if index_aig(i)=0 then begin ok:=false; - Affiche('Erreur : aiguillage '+intToSTR(i)+' non existant mais associé au signal '+IntToSTR(feux[j].adresse),clred); + Affiche('Erreur 9.2: aiguillage '+intToSTR(i)+' non existant mais associé au signal '+IntToSTR(feux[j].adresse),clred); end; end; end; @@ -4237,7 +5192,7 @@ begin if IndexBranche_trouve=0 then begin ok:=false; - Affiche('Erreur : Détecteur '+intToSTR(i)+' non existant mais associé au signal '+IntToSTR(feux[j].adresse),clred); + Affiche('Erreur 9.3: Détecteur '+intToSTR(i)+' non existant mais associé au signal '+IntToSTR(feux[j].adresse),clred); end; end; if ((km=aig) or (km=tjs) or (km=tjd) or (km=triple)) then @@ -4246,7 +5201,7 @@ begin if index_aig(i)=0 then begin ok:=false; - Affiche('Erreur : aiguillage '+intToSTR(i)+' non existant mais associé au signal '+IntToSTR(feux[j].adresse),clred); + Affiche('Erreur 9.4: aiguillage '+intToSTR(i)+' non existant mais associé au signal '+IntToSTR(feux[j].adresse),clred); end; end; end; @@ -4262,7 +5217,7 @@ begin if IndexBranche_trouve=0 then begin ok:=false; - Affiche('Erreur : Détecteur '+intToSTR(i)+' non existant mais associé au signal '+IntToSTR(feux[j].adresse),clred); + Affiche('Erreur 9.5: Détecteur '+intToSTR(i)+' non existant mais associé au signal '+IntToSTR(feux[j].adresse),clred); end; end; if ((km=aig) or (km=tjs) or (km=tjd) or (km=triple)) then @@ -4271,7 +5226,7 @@ begin if index_aig(i)=0 then begin ok:=false; - Affiche('Erreur : aiguillage '+intToSTR(i)+' non existant mais associé au signal '+IntToSTR(feux[j].adresse),clred); + Affiche('Erreur 9.6: aiguillage '+intToSTR(i)+' non existant mais associé au signal '+IntToSTR(feux[j].adresse),clred); end; end; end; @@ -4287,7 +5242,7 @@ begin if IndexBranche_trouve=0 then begin ok:=false; - Affiche('Erreur : Détecteur '+intToSTR(i)+' non existant mais associé au signal '+IntToSTR(feux[j].adresse),clred); + Affiche('Erreur 9.7: Détecteur '+intToSTR(i)+' non existant mais associé au signal '+IntToSTR(feux[j].adresse),clred); end; end; if ((km=aig) or (km=tjs) or (km=tjd) or (km=triple)) then @@ -4296,7 +5251,7 @@ begin if index_aig(i)=0 then begin ok:=false; - Affiche('Erreur : aiguillage '+intToSTR(i)+' non existant mais associé au signal '+IntToSTR(feux[j].adresse),clred); + Affiche('Erreur 9.10: aiguillage '+intToSTR(i)+' non existant mais associé au signal '+IntToSTR(feux[j].adresse),clred); end; end; end; @@ -5267,7 +6222,6 @@ begin end; end; - procedure TFormConfig.ButtonConfigSRClick(Sender: TObject); begin clicListe:=true; @@ -5276,20 +6230,12 @@ begin clicListe:=false; end; +procedure TFormConfig.PageControlChange(Sender: TObject); begin + Label20.Visible:=false; +end; - - - - - - - - - - - - +begin diff --git a/UnitConfigTCO.dcu b/UnitConfigTCO.dcu index ebaf2df..ffa3e36 100644 Binary files a/UnitConfigTCO.dcu and b/UnitConfigTCO.dcu differ diff --git a/UnitConfigTCO.dfm b/UnitConfigTCO.dfm index f7e28f3..7d583f1 100644 --- a/UnitConfigTCO.dfm +++ b/UnitConfigTCO.dfm @@ -4,7 +4,7 @@ object FormConfigTCO: TFormConfigTCO BorderStyle = bsDialog Caption = 'Configuration du TCO' ClientHeight = 264 - ClientWidth = 618 + ClientWidth = 665 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText @@ -31,14 +31,14 @@ object FormConfigTCO: TFormConfigTCO end object Label3: TLabel Left = 16 - Top = 56 + Top = 60 Width = 156 Height = 13 Caption = 'Nombre de cellules en horizontal:' end object Label4: TLabel Left = 16 - Top = 80 + Top = 84 Width = 145 Height = 13 Caption = 'Nombre de cellules en vertical:' @@ -49,8 +49,22 @@ object FormConfigTCO: TFormConfigTCO Width = 3 Height = 13 end + object LabelMaxX: TLabel + Left = 235 + Top = 60 + Width = 53 + Height = 13 + Caption = 'LabelMaxX' + end + object LabelMaxY: TLabel + Left = 235 + Top = 84 + Width = 53 + Height = 13 + Caption = 'LabelMaxY' + end object ButtonOK: TButton - Left = 168 + Left = 216 Top = 224 Width = 75 Height = 25 @@ -108,7 +122,7 @@ object FormConfigTCO: TFormConfigTCO Text = 'EditNbCellY' end object GroupBox1: TGroupBox - Left = 256 + Left = 304 Top = 8 Width = 353 Height = 233 @@ -216,7 +230,7 @@ object FormConfigTCO: TFormConfigTCO object Memo1: TMemo Left = 8 Top = 128 - Width = 241 + Width = 281 Height = 81 BevelInner = bvLowered BevelKind = bkFlat diff --git a/UnitConfigTCO.pas b/UnitConfigTCO.pas index 8784454..b918ec3 100644 --- a/UnitConfigTCO.pas +++ b/UnitConfigTCO.pas @@ -37,6 +37,8 @@ type ImageTexte: TImage; Label11: TLabel; Label12: TLabel; + LabelMaxX: TLabel; + LabelMaxY: TLabel; procedure ButtonOKClick(Sender: TObject); procedure ButtonDessineClick(Sender: TObject); procedure FormActivate(Sender: TObject); @@ -238,6 +240,8 @@ begin EditNbCellX.Text:=IntToSTR(NbreCellX); EditNbCellY.Text:=IntToSTR(NbreCellY); checkDessineGrille.Checked:=AvecGrille; + labelMaxX.caption:='Max='+intToSTR(MaxCellX); + labelMaxY.caption:='Max='+intToSTR(MaxCellY); dessine_icones; end; @@ -314,4 +318,6 @@ begin end; + + end. diff --git a/UnitDebug.dcu b/UnitDebug.dcu index 4cd2f1a..719fb91 100644 Binary files a/UnitDebug.dcu and b/UnitDebug.dcu differ diff --git a/UnitPilote.dcu b/UnitPilote.dcu index 1ade94a..915b8da 100644 Binary files a/UnitPilote.dcu and b/UnitPilote.dcu differ diff --git a/UnitPrinc.dcu b/UnitPrinc.dcu index df80708..3283875 100644 Binary files a/UnitPrinc.dcu and b/UnitPrinc.dcu differ diff --git a/UnitPrinc.dfm b/UnitPrinc.dfm index 7fb96aa..33afb07 100644 --- a/UnitPrinc.dfm +++ b/UnitPrinc.dfm @@ -1,6 +1,6 @@ object FormPrinc: TFormPrinc - Left = 15 - Top = 175 + Left = 60 + Top = 181 Width = 1212 Height = 664 Caption = 'Client TCP-IP CDM Rail ou USB - syst'#232'me LENZ' @@ -1675,12 +1675,5 @@ object FormPrinc: TFormPrinc Caption = 'Propri'#233't'#233's' OnClick = Proprits1Click end - object N7: TMenuItem - Caption = '-' - end - object Nouveaufeu1: TMenuItem - Caption = 'Nouveau feu' - OnClick = Nouveaufeu1Click - end end end diff --git a/UnitPrinc.pas b/UnitPrinc.pas index 623e614..5ff362b 100644 --- a/UnitPrinc.pas +++ b/UnitPrinc.pas @@ -101,8 +101,6 @@ type EditVal: TEdit; PopupMenuFeu: TPopupMenu; Proprits1: TMenuItem; - N7: TMenuItem; - Nouveaufeu1: TMenuItem; N8: TMenuItem; Vrifierlacohrence: TMenuItem; procedure FormCreate(Sender: TObject); @@ -161,8 +159,6 @@ type procedure Apropos1Click(Sender: TObject); procedure ButtonDevieClick(Sender: TObject); procedure Proprits1Click(Sender: TObject); - procedure Nouveaufeu1Click(Sender: TObject); - procedure Nouveaufeu2Click(Sender: TObject); procedure VrifierlacohrenceClick(Sender: TObject); private { Déclarations privées } @@ -170,7 +166,6 @@ type public { Déclarations publiques } Procedure ImageOnClick(Sender : TObject); - procedure ClicImage(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure proc_checkBoxFB(Sender : Tobject); end; @@ -213,9 +208,9 @@ TBranche = record Adresse : integer ; // adresse du détecteur ou de l'aiguillage end; - Taiguillage = record - Adresse : integer; - modele : TEquipement; // 0=n'existe pas 1=aiguillage 2=TJD 3=TJS 4=aiguillage triple +Taiguillage = record + Adresse : integer; // adresse d'accessoire + modele : TEquipement; // rien, aig, tjd ... position, // position actuelle : 1=dévié 2=droit (centrale LENZ) posInit, // position d'initialisation 1=dévié 2=droit 9=non positionné Adrtriple, // 2eme adresse pour un aiguillage triple @@ -244,12 +239,14 @@ TBranche = record // éléments connectés sur la branche déviée 2 (cas d'un aiguillage triple) Adevie2 : integer; Adevie2B : char ; + // états d'une TJD (2 ou 4, 4 par défaut) + EtatTJD : integer; // si modifié en mode config modifie : boolean ; end; - TFeu = record +TFeu = record adresse, aspect : integer; // adresse du feu, aspect (2 feux..9 feux 12=direction 2 feux .. 16=direction 6 feux) Img : TImage; // Pointeur sur structure TImage du feu Lbl : TLabel; // pointeur sur structure Tlabel du feu @@ -282,7 +279,7 @@ TBranche = record posAig : char; end; SR : array[1..8] of record // décodeur Stéphane Ravaut - sortie1,sortie0 : integer; + sortie1,sortie0 : integer; end; end; @@ -320,7 +317,7 @@ var TypeGen : TEquipement; Adresse_detecteur : array[0..60] of integer; // adresses des détecteurs par index - MemZone : array[0..1024,0..1024] of boolean ; // mémoires de zones + MemZone : array[0..1024,0..1024] of boolean ; // mémoires de zones des détecteurs Tablo_actionneur : array[1..100] of record loco,act : boolean; // type loco ou actionneur @@ -350,7 +347,7 @@ var TempoAct,RangActCours,N_Cv,index_simule,NDetecteurs,N_Trains,N_routes : integer; tablo_CV : array [1..255] of integer; couleur : Tcolor; - fichier : text; + tick,Premier_tick : longint; // modélisations des fichiers config branche : array [1..100] of string; @@ -1172,6 +1169,18 @@ begin end; end; +// transforme le type TEquipement en chaine +function BTypeToChaine(BT : TEquipement) : string; +begin + case BT of + det : result:='det'; + aig : result:='aig'; + voie : result:='voie'; + buttoir : result:='but'; + else result:='rien'; + end; +end; + procedure Affiche(s : string;lacouleur : TColor); begin with formprinc do @@ -1233,38 +1242,6 @@ begin end; end; - -// procédure activée quand on clique gauche ou droit sur l'image d'un feu -// le dessin ne fonctionne pas à cause de l'inhéritage (csinheritage) -procedure TFormPrinc.ClicImage(Sender: TObject; - Button: TMouseButton; Shift: TShiftState; X, Y: Integer); -var s : string; - P_image_pilote : Timage; - i,erreur,adresse : integer; -begin - inherited; - P_image_pilote:=Sender as TImage; // récupérer l'objet image de la forme pilote - s:=P_Image_pilote.Hint; - //Affiche(s,clyellow); - i:=pos('@',s); if i<>0 then delete(s,i,1); - i:=pos('=',s); if i<>0 then delete(s,i,1); - i:=pos(' ',s); - if i<>0 then s:=copy(s,1,i-1); - val(s,Adresse,erreur); - if adresse=0 then exit; - i:=Index_feu(Adresse); - - P_image_pilote:=feux[i].Img ; - - with P_image_pilote.Canvas do - begin - Pen.Color:=clblue; - - Canvas.Rectangle(10,10,50,100); - end; - -end; - // procédure activée quand on clique gauche sur l'image d'un feu Procedure TFormprinc.ImageOnClick(Sender : Tobject); var s : string; @@ -1334,10 +1311,10 @@ begin end; // créée une image dynamiquement pour un nouveau feu déclaré dans le fichier de config +// rang commence à 1 procedure cree_image(rang : integer); var TypeFeu,adresse : integer; s : string; - begin TypeFeu:=feux[rang].aspect; if typeFeu<=0 then exit; @@ -1345,19 +1322,20 @@ begin with Feux[rang].Img do begin Parent:=Formprinc.ScrollBox1; // dire que l'image est dans la scrollBox1 - //Name:='ImageFeu'+IntToSTR(rang); // nom de l'image - sert à identifier le composant si on fait clic droit. + Name:='ImageFeu'+IntToSTR(rang); // nom de l'image - sert à identifier le composant si on fait clic droit. Top:=(HtImg+espY+20)*((rang-1) div NbreImagePLigne); // détermine les points d'origine Left:=10+ (LargImg+5)*((rang-1) mod (NbreImagePLigne)); + //Affiche(intToSTR(rang)+' '+intToSTR(left),clorange); width:=57; Height:=105; - s:='@='+inttostr(feux[rang].Adresse)+' Decodeur='+intToSTR(feux[rang].Decodeur)+' Adresse détecteur associé='+intToSTR(feux[rang].Adr_det1)+ + s:='Index='+IntToSTR(rang)+' @='+inttostr(feux[rang].Adresse)+' Décodeur='+intToSTR(feux[rang].Decodeur)+ + ' Adresse détecteur associé='+intToSTR(feux[rang].Adr_det1)+ ' Adresse élement suivant='+intToSTR(feux[rang].Adr_el_suiv1); if feux[rang].Btype_suiv1=aig then s:=s+' (aig)'; Hint:=s; - onClick:=Formprinc.Imageonclick; // procédure clique sur image - //PopUpMenu:=Formprinc.PopupMenuFeu; // affectation popupmenu sur clic droit : ihnibé car pas géré l'aboutissement de la fenetre sur le feu - //OnMouseDown:=Formprinc.ClicImage; // affection pour clic gauche ou droit + onClick:=Formprinc.Imageonclick; // affectation procédure clique sur image + PopUpMenu:=Formprinc.PopupMenuFeu; // affectation popupmenu sur clic droit Picture.Bitmap.TransparentMode:=tmAuto; Picture.Bitmap.TransparentColor:=clblue; @@ -1875,7 +1853,7 @@ envoie les donn ===========================================================================*} procedure envoi_SR(adresse : integer); var - code,aspect,combine : word; + code : word; index,i,etat : integer; s : string; begin @@ -1892,7 +1870,6 @@ begin //Affiche('Code a chercher='+IntToSTR(etat),clyellow); - inc(aspect); if index<>0 then begin i:=0; @@ -2719,893 +2696,7 @@ begin else Verif_Unisemaf:=2; end; -procedure lit_config; -var s,sa,chaine,SOrigine: string; - c,paig : char; - tec,tjdC,tjsC,s2,trouve,triC,debugConfig,multiple,fini,finifeux,trouve_NbDetDist,trouve_ipv4_PC,trouve_retro, - trouve_sec_init,trouve_init_aig,trouve_lay,trouve_IPV4_INTERFACE,trouve_PROTOCOLE_SERIE,trouve_INTER_CAR, - trouve_Tempo_maxi,trouve_Entete,trouve_tco,trouve_cdm,trouve_Serveur_interface,trouve_fenetre, - trouve_NOTIF_VERSION,trouve_verif_version,trouve_fonte,trouve_tempo_aig,trouve_raz,trouve_section_aig, - pds,trouve_section_branche,trouve_section_sig,trouve_section_act,compile_init_cfg : boolean; - bd,virgule,i_detect,i,erreur,aig2,detect,offset,index, adresse,j,position,temporisation,invers,indexPointe,indexDevie,indexDroit, - ComptEl,Compt_IT,Num_Element,k,modele,adr,adr2,erreur2,l,t,Nligne,postriple,itl, - postjd,postjs,nv,it,Num_Champ,asp,adraig : integer; - label ici1,ici2,ici3,ici4 ; - - function lit_ligne : string ; - var esp : integer; - begin - repeat - readln(fichier,s); - sOrigine:=s; - s:=uppercase(s); - if length(s)>0 then c:=s[1]; - until ((c<>'/') and (s<>'')) or eof(fichier) ; - // supprime les espaces éventuels - repeat - esp:=pos(' ',s); - if esp<>0 then delete(s,esp,1); - until esp=0; - lit_ligne:=s; - end; - -begin - compile_init_cfg:=true; - debugConfig:=false; - trouve_NbDetDist:=false; - trouve_ipv4_PC:=false; - trouve_retro:=false; - trouve_sec_init:=false; - trouve_init_aig:=false; - trouve_tempo_aig:=false; - trouve_INTER_CAR:=false; - trouve_entete:=false; - trouve_IPV4_INTERFACE:=false; - trouve_lay:=false; - trouve_Tempo_maxi:=false; - trouve_PROTOCOLE_SERIE:=false; - trouve_TCO:=false; - trouve_Serveur_interface:=false; - trouve_cdm:=false; - trouve_NOTIF_VERSION:=false; - trouve_fenetre:=false; - trouve_verif_version:=false; - trouve_Fonte:=false; - trouve_Raz:=false; - - Nb_Det_Dist:=3; - // initialisation des aiguillages avec des valeurs par défaut - for i:=1 to MaxAcc do - begin - Aiguillage[i].modele:=rien ; // sans existence - Aiguillage[i].adresse:=0; - Aiguillage[i].position:=const_inconnu; // position inconnue - Aiguillage[i].PosInit:=const_inconnu; // position inconnue - Aiguillage[i].temps:=5 ; - Aiguillage[i].inversionCDM:=0; - end; - for i:=1 to 1024 do - begin - Detecteur[i].etat:=false; - Detecteur[i].train:='0'; - Ancien_detecteur[i]:=false; - end; - - Affiche('lecture du fichier de configuration config.cfg',clyellow); - {$I+} - try - assign(fichier,'config.cfg'); - reset(fichier); - except - Affiche('Fichier config.cfg non trouvé',clred); - exit; - end; - {$I-} - s:=''; - - sa:=uppercase(Raz_signaux_ch)+'='; - repeat - s:=lit_ligne; - i:=pos(sa,s); - if i<>0 then - begin - inc(nv); - trouve_Raz:=true; - delete(s,i,length(sa)); - i:=0; - val(s,i,erreur); - if i>1 then i:=1; - Raz_Acc_signaux:=i=1; - end; - until trouve_raz; - reset(fichier); - - if not(trouve_raz) then Affiche('ERREUR: manque variable dans config.cfg : '+Raz_signaux_ch,clred); - if Raz_Acc_signaux then Affiche('Avec Raz commande signaux',clYellow); - - maxaiguillage:=0; - Nligne:=1; - sa:=uppercase(section_aig_ch); - repeat - s:=lit_ligne;i:=0;pds:=false; - if s<>'' then - begin - pds:=(s[1]<>'[') and (pos('D',s)<>0) and (pos('S',s)<>0); - i:=pos(sa,s); - end; - trouve_section_aig:=i<>0; - until trouve_section_aig or pds or eof(fichier); - - if eof(fichier) Then - begin - affiche('Erreur manque nom des sections dans le fichier config.cfg',clRed); - exit; - end; - - if pds and not(trouve_section_aig) then - affiche('Manque nom de section '+section_aig_ch+' dans le fichier config.cfg',clred); - - Affiche('Définition des aiguillages',clyellow); - if pds then goto ici1; - - repeat - s:=lit_ligne; - ici1: - inc(Nligne); - //Affiche(s,ClLime); - //chaine:=s; - if debugconfig then Affiche(s,ClLime); - if (s<>'0') then - begin - inc(maxaiguillage); - virgule:=pos(',',s); - enregistrement:=copy(s,1,virgule-1); // adresse de l'aiguillage [TRI] - delete(s,1,virgule); - postriple:=pos('TRI',enregistrement);triC:=postriple<>0;if triC then delete(enregistrement,postriple,3); - postjd:=pos('TJD',enregistrement);tjdC:=postjd<>0;if tjdC then delete(enregistrement,postjd,3); - postjs:=pos('TJS',enregistrement);tjsC:=postjs<>0;if tjsC then delete(enregistrement,postjs,3); - - // adresse de l'aiguillage - Val(enregistrement,adraig,erreur); // adraig = adresse de l'aiguillage - if erreur<>0 then Affiche('Erreur aiguillage '+intToSTR(adraig)+' ; caractère '+enregistrement[erreur]+' inconnu',clred); - if debugConfig then Affiche('Adresse='+IntToSTR(adraig)+' enregistrement='+Enregistrement,clyellow); - - aiguillage[maxaiguillage].adresse:=adraig; - aiguillage[maxaiguillage].AdroitB:='Z'; aiguillage[maxaiguillage].AdevieB:='Z'; - aiguillage[maxaiguillage].DdroitB:='Z'; aiguillage[maxaiguillage].DdevieB:='Z'; - - aiguillage[maxaiguillage].ApointeB:='Z'; - aiguillage[maxaiguillage].Adevie2B:='Z'; - - if (triC) then aiguillage[maxaiguillage].modele:=triple; - if (tjsC) then - begin - aiguillage[maxaiguillage].modele:=tjs - end; - if (tjdC) then - begin - aiguillage[maxaiguillage].modele:=tjd ; - end; - if not(tjsC) and not(tjdC) and not(triC) then - begin - aiguillage[maxaiguillage].modele:=aig; - end; - //if debugConfig then Affiche(s,clyellow); - - if (triC) then - begin - Val(s,aig2,erreur); // aig = 2eme adresse de l'aiguillage - aiguillage[maxaiguillage].AdrTriple:=aig2; - virgule:=pos(',',s); - delete(s,1,virgule); - end; - ComptEl:=0;Compt_It:=0;Num_element:=Num_element+1; - // préparer l'enregistrement pour la boucle de ligne - - enregistrement:=s; - - Num_Champ:=1; - itl:=0; - repeat // parcoure la ligne - if (debugConfig) then Affiche('boucle de ligne: '+s,clYellow); - if (length(enregistrement)<>0) then - if (enregistrement[1]='P') then - begin - if tjdC then begin affiche('Erreur P interdit dans une TJD : '+sOrigine,clred);closefile(fichier);exit; end; - if debugconfig then Affiche('Section P - enregistrement='+enregistrement,clYellow); - ComptEl:=ComptEl+1; - decodeAig(enregistrement,detect,c); - if c='' then c:='Z'; - aiguillage[maxaiguillage].Apointe:=detect; - aiguillage[maxaiguillage].ApointeB:=c; - - virgule:=pos(',',enregistrement);if virgule=0 then virgule:=length(Enregistrement)+1; - delete(enregistrement,1,virgule); - end; - - if (length(enregistrement)<>0) then // section droite - if (enregistrement[1]='D') then - begin - if debugconfig then Affiche('Section D - enregistrement='+enregistrement,clYellow); - ComptEl:=ComptEl+1; - if tjdC or tjsC then - begin - Delete(Enregistrement,1,2); - decodeAig(Enregistrement,detect,c); - aiguillage[maxaiguillage].Adroit:=detect; - aiguillage[maxaiguillage].AdroitB:=c; - i:=pos(',',Enregistrement);Delete(Enregistrement,1,i); - decodeAig(Enregistrement,detect,c); - aiguillage[maxaiguillage].DDroit:=detect; - aiguillage[maxaiguillage].DdroitB:=c; - i:=pos(')',enregistrement);if i=0 then begin Affiche('Erreur de syntaxe ligne '+SOrigine,clred);closefile(fichier);exit;end; - Delete(enregistrement,1,i+1); - - //Affiche(enregistrement,clBlue); - end - else - begin - decodeAig(enregistrement,detect,c); - if c='' then c:='Z'; - aiguillage[maxaiguillage].Adroit:=detect; - aiguillage[maxaiguillage].AdroitB:=c; - - virgule:=pos(',',enregistrement);if virgule=0 then virgule:=length(enregistrement)+1; - delete(enregistrement,1,virgule); - end; - end; - - if (length(enregistrement)<>0) then - if (enregistrement[1]='S') then - begin - if debugconfig then Affiche('Section S - enregistrement='+enregistrement,clYellow); - ComptEl:=ComptEl+1; - - if tjdC or tjsC then - begin - Delete(enregistrement,1,2); - decodeAig(enregistrement,detect,c); - aiguillage[maxaiguillage].Adevie:=detect; - aiguillage[maxaiguillage].AdevieB:=c; - i:=pos(',',enregistrement);Delete(enregistrement,1,i); - decodeAig(enregistrement,detect,c); - aiguillage[maxaiguillage].DDevie:=detect; - aiguillage[maxaiguillage].DDevieB:=c; - i:=pos(')',enregistrement);if i=0 then begin Affiche('Erreur de syntaxe ligne '+SOrigine,clred);closefile(fichier);exit;end; - Delete(enregistrement,1,i+1); - - //Affiche(enregistrement,clBlue); - end - else - begin - delete(enregistrement,1,1); // supprime le S - i:=pos(',',enregistrement); - if i=0 then i:=length(enregistrement)+1; - s:=copy(enregistrement,1,i-1); // isole la zone S - - erreur:=pos('2-',s); - S2:=erreur<>0; - if (S2) then delete(s,erreur,2); - - erreur:=pos('S2',s); // description d'un rattachement à la branche S2 d'un aiguillage triple - tec:=erreur<>0; // ne supprimer que le 2 - if (tec) then delete(s,erreur+1,1); - - //val(enregistrement,detect,erreur); // extraction de l'adresse - decodeAig(s,detect,c); - //if ((detect=0) and (erreur=0)) then Affiche('Erreur pas d''adresse dans section S: '+s,clred); - //c:='Z'; - //if (erreur<>0) then begin delete(enregistrement,1,erreur-1);c:=enregistrement[1];end; - - if not(S2) and not(tec) then begin aiguillage[maxaiguillage].Adevie:=detect;aiguillage[maxaiguillage].AdevieB:=c;end; - if S2 and not(tec) then begin aiguillage[maxaiguillage].Adevie2:=detect;aiguillage[maxaiguillage].Adevie2B:=c;end; - if S2 and tec then begin aiguillage[maxaiguillage].Adevie2:=detect;aiguillage[maxaiguillage].Adevie2B:='T';end; - - virgule:=pos(',',enregistrement);if virgule=0 then virgule:=length(enregistrement)+1; - delete(enregistrement,1,virgule);; - end; - end; - - // inversion aiguillage - if (length(enregistrement)<>0) then - if (enregistrement[1]='I') then - begin - inc(Num_Champ); - delete(enregistrement,1,1); - Val(enregistrement,adr,erreur); - if (adr<0) or (adr>1) then begin Affiche('Erreur Inversion ; ligne '+sOrigine,clred);end; - //Affiche(intTostr(adr),clblue); - Aiguillage[maxaiguillage].inversionCDM:=adr; - virgule:=pos(',',enregistrement);if virgule=0 then virgule:=length(s)+1; - delete(enregistrement,1,virgule); - end; - - // si vitesse définie - if (length(enregistrement)<>0) then - if enregistrement[1]='V' then - begin - inc(num_champ); - delete(enregistrement,1,1); - Val(enregistrement,adr,erreur); - //Affiche('section vitesse définie aig='+intToSTR(aig)+'/'+intToSTR(adr),clyellow); - aiguillage[maxaiguillage].vitesse:=adr; - virgule:=pos(',',enregistrement);if virgule=0 then virgule:=length(s)+1; - delete(enregistrement,1,virgule); - end; - - // TJS et L - if (length(enregistrement)<>0) then - if enregistrement[1]='L' then - begin - if not(tjsC) then begin Affiche('Erreur paramètre L ligne: '+sOrigine,clred);closefile(fichier);exit;end; - inc(num_champ); - delete(enregistrement,1,1); - Val(enregistrement,adr,erreur); - aiguillage[maxaiguillage].tjsInt:=adr; - c:=enregistrement[erreur]; - if ((c<>'S') and (c<>'D')) then - begin - c:=' ';Affiche('Erreur paramètre L '+sOrigine,clred); - end; - aiguillage[maxaiguillage].tjsIntB:=c; - virgule:=pos(',',enregistrement);if virgule=0 then virgule:=length(enregistrement)+1; - delete(enregistrement,1,virgule); - end; - - // Init aiguillage - i:=pos('INIT(',enregistrement); - if i=1 then - begin - compile_init_cfg:=false; // ne pas compiler la section init du fichier config-gl.cfg - inc(num_champ); - delete(enregistrement,i,i+4); - Val(enregistrement,position,erreur); - i:=pos(',',enregistrement); - if i<>0 then delete(enregistrement,1,i); - Val(enregistrement,j,erreur); - //i:=pos(',',enregistrement); - //if i<>0 then delete(enregistrement,1,i); - //Val(enregistrement,inversion,erreur); - aiguillage[maxaiguillage].temps:=j; - //aiguillage[maxaiguillage].inversion:=inversion; - aiguillage[maxaiguillage].posinit:=position; - i:=pos(')',enregistrement); - delete(enregistrement,1,i); - end; - - inc(itl); - until (enregistrement='') or (itl>3); - if itl>4 then begin Affiche('Erreur 400 ligne '+sOrigine,clred);closefile(fichier);exit;end; - end; - until (sOrigine='0'); - - // branches - NDetecteurs:=0; Nligne:=1; - i_detect:=1; - repeat - sa:=uppercase(section_branches_ch); - s:=lit_ligne; - if length(s)>0 then pds:=(s[1]<>'[') and (pos('A',s)<>0) and (pos(',',s)<>0); - i:=pos(sa,s); - trouve_section_branche:=i<>0; - until trouve_section_branche or pds or eof(fichier); - - if pds and not(trouve_section_branche) then - affiche('Manque nom de section '+section_branches_ch+' dans le fichier config.cfg',clred); - - Affiche('Définition des branches',clyellow); - i:=1; - if pds then goto ici2; - - repeat - s:=lit_ligne; - ici2: - if s<>'0' then - begin - branche[i]:=s; - j:=1;offset:=1; - inc(Nligne); - compile_branche(s,i); - inc(i); - end; - until (s='0') or eof(fichier); - NbreBranches:=i-1; - - // signaux - trouver la section ou une ligne valide feux - repeat - sa:=uppercase(section_sig_ch); - s:=lit_ligne; - if length(s)>0 then pds:=(s[1]<>'[') and (pos('(',s)<>0) and (pos(')',s)<>0); - i:=pos(sa,s); - trouve_section_sig:=i<>0; - until trouve_section_sig or pds or eof(fichier); - - if pds and not(trouve_section_sig) then - affiche('Manque nom de section '+section_sig_ch+' dans le fichier config.cfg',clred); - - Affiche('Définition des Signaux',clyellow); - i:=1;Nligne:=1; - if pds then goto ici3; - - repeat - inc(Nligne); - s:=lit_ligne; - //affiche(s,clyellow); - ici3: - if s<>'0' then - begin - decode_ligne_feux(s,i);inc(i); - end; - until (s='0') or eof(fichier); - NbreFeux:=i-1; if NbreFeux<0 then NbreFeux:=0; - - configNulle:=(maxAiguillage=0) and (NbreBranches=0) and (Nbrefeux=0); - if configNulle then Affiche('Fonctionnement en config nulle',ClYellow); - - // raz des actionneurs - for i:=1 to maxTablo_act do - begin - Tablo_actionneur[i].train:=''; - Tablo_actionneur[i].etat:=0; - Tablo_actionneur[i].actionneur:=0; - Tablo_actionneur[i].accessoire:=0; - Tablo_actionneur[i].sortie:=0; - end; - - // actionneurs ou PN - trouver le section ou une ligne valide feux - repeat - sa:=uppercase(section_act_ch); - s:=lit_ligne; - if length(s)>0 then pds:=(s[1]<>'[') and ((pos('A',s)<>0) or (pos('F',s)<>0) or (pos('PN',s)<>0)); - i:=pos(sa,s); - trouve_section_act:=i<>0; - until trouve_section_act or pds or eof(fichier); - - if pds and not(trouve_section_act) then - affiche('Manque nom de section '+section_act_ch+' dans le fichier config.cfg',clred); - - Affiche('Définition des actionneurs',clyellow); - maxTablo_act:=1; - NbrePN:=0;Nligne:=1; - if pds then goto ici4; - - // définition des actionneurs - repeat - s:=lit_ligne; - ici4: - // vérifier si F ou A au 4eme champ - sa:=s; sOrigine:=s; - i:=pos(',',sa); - if i>0 then delete(sa,1,i) else s:='0'; - i:=pos(',',sa); - if i>0 then delete(sa,1,i) else s:='0'; - i:=pos(',',sa); - if i>0 then delete(sa,1,i) else s:='0'; - - inc(Nligne); - - if length(sa)>1 then if (sa[1]='A') then - // -----------------accessoire - begin - // 815,1,CC406526,A600,1 - //Affiche(IntToSTR(maxtablo_act)+' '+sorigine,clLime); - Tablo_actionneur[maxtablo_act].act:=true; - Tablo_actionneur[maxtablo_act].loco:=false; - - i:=pos(',',s); - if i<>0 then - begin - val(copy(s,1,i-1),j,erreur); - Tablo_actionneur[maxTablo_act].actionneur:=j; - Delete(s,1,i); - i:=pos(',',s); - if i<>0 then - begin - i:=pos(',',s); - val(copy(s,1,i-1),j,erreur); - Tablo_actionneur[maxTablo_act].etat:=j; - Delete(s,1,i); - - i:=pos(',',s); - Tablo_actionneur[maxTablo_act].train:=copy(s,1,i-1); - Delete(s,1,i); - - i:=pos('A',s); - if i<>0 then - begin - Delete(s,1,1); - val(s,j,erreur); - Tablo_actionneur[maxTablo_act].Accessoire:=j; - - i:=pos(',',s); - if i<>0 then - begin - Delete(S,1,i); - val(s,j,erreur); - Tablo_actionneur[maxTablo_act].sortie:=j; - end; - - i:=pos(',',s); - if i<>0 then - begin - Delete(S,1,i); - Tablo_actionneur[maxTablo_act].RAZ:=s[1]='Z'; - inc(maxTablo_act); - end; - - end; - s:='';i:=0; - end; - end; - - end; - - if length(sa)>1 then if (sa[1]='F') then - // -----------------loco - begin - Tablo_actionneur[maxtablo_act].act:=false; - Tablo_actionneur[maxtablo_act].loco:=true; - // 815,1,CC406526,F2,450 - i:=pos(',',s); - if i<>0 then - begin - val(copy(s,1,i-1),j,erreur); - Tablo_actionneur[maxTablo_act].actionneur:=j; - Delete(s,1,i); - i:=pos(',',s); - if i<>0 then - begin - i:=pos(',',s); - val(copy(s,1,i-1),j,erreur); - Tablo_actionneur[maxTablo_act].etat:=j; - Delete(s,1,i); - - i:=pos(',',s); - Tablo_actionneur[maxTablo_act].train:=copy(s,1,i-1); - Delete(s,1,i); - - i:=pos('F',s); - if i<>0 then - begin - Delete(s,1,1); - val(s,j,erreur); - Tablo_actionneur[maxTablo_act].Fonction:=j; - - i:=pos(',',s); - if i<>0 then - begin - Delete(S,1,i); - val(s,j,erreur); - Tablo_actionneur[maxTablo_act].Tempo:=j; - inc(maxTablo_act); - end; - end; - s:='';i:=0; - end; - end; - end; - - // Passage à niveau - // (815,820),(830,810)...,PN(121+,121-) - // (815,809),PN(121+,121-) - if (pos('PN',s)<>0) then - begin - inc(NbrePN); - NbreVoies:=0; - repeat - inc(NbreVoies); - //Affiche('NbreVoies='+intToSTR(NbreVoies),clyellow); - //SetLength(Tablo_PN[1].Voie,1); - Delete(s,1,1); // supprime ( - val(s,j,erreur); - - Tablo_PN[NbrePN].voie[NbreVoies].ActFerme:=j; - - // Affiche('Ferme='+intToSTR(j),clyellow); - i:=pos(',',s);Delete(S,1,i); - val(s,j,erreur); - Tablo_PN[NbrePN].voie[NbreVoies].ActOuvre:=j; - // Affiche('Ouvre='+intToSTR(j),clyellow); - i:=pos(')',s);Delete(S,1,i); - i:=pos(',',s);Delete(S,1,i); - Tablo_PN[NbrePN].voie[NbreVoies].PresTrain:=false; - until (copy(s,1,2)='PN') or (NbreVoies=10); - - Tablo_PN[NbrePN].NbVoies:=NbreVoies; - Delete(s,1,3); // Supprime PN( - val(s,j,erreur); - Tablo_PN[NbrePN].Adresseferme:=j; - Delete(s,1,erreur-1); - if s[1]='+' then Tablo_PN[NbrePN].CommandeFerme:=2; - if s[1]='-' then Tablo_PN[NbrePN].CommandeFerme:=1; - Delete(s,1,2); // supprime +, - - val(s,j,erreur); - Tablo_PN[NbrePN].AdresseOuvre:=j; - Delete(s,1,erreur-1); - if s[1]='+' then Tablo_PN[NbrePN].CommandeOuvre:=2; - if s[1]='-' then Tablo_PN[NbrePN].CommandeOuvre:=1; - Delete(s,1,1); // supprime ) - i:=0; - end; - if pos('PN',s)<>0 then i:=0; - until (s='0'); - dec(maxTablo_act); - - closefile(fichier); - - Affiche('lecture du fichier de configuration client-GL.cfg',clyellow); - {$I+} - try - assign(fichier,'client-GL.cfg'); - reset(fichier); - except - Affiche('Erreur fatale: fichier client-gl.cfg non trouvé',clred); - exit; - end; - {$I-} - nv:=0; it:=0; - {lecture du fichier de configuration} - // taille de fonte - repeat - s:=lit_ligne; - //affiche(s,cllime); - sa:=uppercase(Fonte_ch)+'='; - i:=pos(sa,s); - if i<>0 then - begin - inc(nv); - trouve_fonte:=true; - delete(s,i,length(sa)); - val(s,TailleFonte,erreur); - if (TailleFonte<8) or (tailleFonte>25) then taillefonte:=10; - FormPrinc.FenRich.Font.Size:=TailleFonte; - end; - - // adresse ip et port de CDM - sa:=uppercase(IpV4_PC_ch)+'='; - i:=pos(sa,s); - if i<>0 then - begin - inc(nv); - trouve_ipv4_PC:=true; - delete(s,i,length(sa)); - i:=pos(':',s); - if i<>0 then - begin - adresseIPCDM:=copy(s,1,i-1);Delete(s,1,i); - val(s,portCDM,erreur); - if (portCDM=0) or (portCDM>65535) or (erreur<>0) then affiche('Erreur port CDM : '+s,clred); - end - else affiche('Erreur adresse ip cdm rail '+s,clred); - end; - - // adresse ip et port de la centrale - // AfficheDet:=true; - sa:=uppercase(IPV4_INTERFACE_ch)+'='; - i:=pos(sa,s); - if i<>0 then - begin - inc(nv); - trouve_IPV4_INTERFACE:=true; - delete(s,i,length(sa)); - i:=pos(':',s); - if i<>0 then - begin - adresseIP:=copy(s,1,i-1);Delete(s,1,i);port:=StrToINT(s); - if (adresseIP<>'0') and (port=0) then affiche('Erreur port nul : '+sOrigine,clRed); - end - else begin adresseIP:='0';parSocketLenz:=false;end; - end; - - // configuration du port com - sa:=uppercase(PROTOCOLE_SERIE_ch)+'='; - i:=pos(sa,s); - if i<>0 then - begin - inc(nv); - trouve_PROTOCOLE_SERIE:=true; - delete(s,i,length(sa)); - if not(config_com(s)) then Affiche('Erreur port com mal déclaré : '+s,clred); - portcom:=s; - end; - - // temporisation entre 2 caractères - sa:=uppercase(INTER_CAR_ch)+'='; - i:=pos(sa,s); - if i<>0 then - begin - inc(nv); - delete(s,i,length(sa)); - trouve_INTER_CAR:=true; - val(s,TempoOctet,erreur); - if erreur<>0 then Affiche('Erreur temporisation entre 2 octets',clred); - end; - - // temporisation attente maximale interface - sa:=uppercase(TEMPO_MAXI_ch)+'='; - i:=pos(sa,s); - if i<>0 then - begin - inc(nv); - delete(s,i,length(sa)); - trouve_Tempo_maxi:=true; - val(s,TimoutMaxInterface,erreur); - if erreur<>0 then Affiche('Erreur temporisation maximale interface',clred); - end; - - // entete - sa:=uppercase(ENTETE_ch)+'='; - i:=pos(sa,s); - if i<>0 then - begin - inc(nv); - delete(s,i,length(sa)); - trouve_Entete:=true; - val(s,Valeur_entete,erreur); - entete:=''; - case Valeur_entete of - 0 : begin entete:='';suffixe:='';end; - 1 : begin entete:=#$FF+#$FE;suffixe:='';end; - 2 : begin entete:=#228;suffixe:=#13+#13+#10;end; - end; - if (erreur<>0) or (valeur_entete>2) then Affiche('Erreur déclaration variable '+entete_ch,clred); - end; - - // avec ou sans initialisation des aiguillages - sa:=uppercase(INIT_AIG_ch)+'='; - i:=pos(sa,s); - if i<>0 then - begin - trouve_init_aig:=true; - inc(nv); - delete(s,i,length(sa)); - AvecInitAiguillages:=s='1'; - end; - - // taille de la fenetre - sa:=uppercase(fenetre_ch)+'='; - i:=pos(sa,s); - if i<>0 then - begin - inc(nv); - trouve_fenetre:=true; - delete(s,i,length(sa)); - val(s,fenetre,erreur); - if fenetre=1 then Formprinc.windowState:=wsMaximized; - end; - - // temporisation aiguillages - sa:=uppercase(Tempo_Aig_ch)+'='; - i:=pos(sa,s); - if i<>0 then - begin - inc(nv); - trouve_Tempo_aig:=true; - delete(s,i,length(sa)); - val(s,Tempo_Aig,erreur); - end; - - sa:=uppercase(verif_version_ch)+'='; - i:=pos(sa,s); - if i<>0 then - begin - trouve_verif_version:=true; - inc(nv); - delete(s,i,length(sa)); - // vérification de la version au démarrage - verifVersion:=true; - val(s,i,erreur); - if erreur=0 then verifVersion:=i=1; - end; - - sa:=uppercase(NOTIF_VERSION_ch)+'='; - i:=pos(sa,s); - if i<>0 then - begin - inc(nv); - delete(s,i,length(sa)); - trouve_NOTIF_VERSION:=true; - // vérification de la version au démarrage - val(s,i,erreur); - notificationVersion:=i=1; - end; - - sa:=uppercase(TCO_ch)+'='; - i:=pos(sa,s); - if i<>0 then - begin - inc(nv); - delete(s,i,length(sa)); - trouve_TCO:=true; - // vérification de la version au démarrage - val(s,i,erreur); - AvecTCO:=i=1; - end; - - sa:=uppercase(CDM_ch)+'='; - i:=pos(sa,s); - if i<>0 then - begin - inc(nv); - trouve_CDM:=true; - delete(s,i,length(sa)); - // vérification de la version au démarrage - val(s,i,erreur); - LanceCDM:=i=1; - end; - - sa:=uppercase(LAY_ch)+'='; - i:=pos(sa,s); - if i<>0 then - begin - inc(nv); - trouve_lay:=true; - delete(s,i,length(sa)); - lay:=s; - end; - - sa:=uppercase(SERVEUR_INTERFACE_ch)+'='; - i:=pos(sa,s); - if i<>0 then - begin - inc(nv); - trouve_serveur_interface:=true; - delete(s,i,length(sa)); - val(s,i,erreur); - ServeurInterfaceCDM:=i; - end; - - sa:=uppercase(RETRO_ch)+'='; - i:=pos(sa,s); - if i<>0 then - begin - inc(nv); - trouve_retro:=true; - delete(s,i,length(sa)); - val(s,i,erreur); - ServeurRetroCDM:=i; - end; - - sa:=uppercase(nb_det_dist_ch)+'='; - i:=pos(sa,s); - if i<>0 then - begin - inc(nv); - trouve_NbDetDist:=true; - delete(s,i,length(sa)); - val(s,i,erreur); - if i<2 then begin i:=2;Affiche('Attention '+nb_det_dist_ch+' ramené à '+IntToSTR(i),clOrange); end; - Nb_Det_Dist:=i; - end; - inc(it); - - until ((Nv>=19) and compile_init_cfg) or ((Nv>=18) and not(compile_init_cfg)) or (it>30); - - s:='';//Affiche(intToSTR(Nv),clred); - if not(trouve_NbDetDist) then s:=nb_det_dist_ch; - if not(trouve_ipv4_PC) then s:=IpV4_PC_ch; - if not(trouve_retro) then s:=retro_ch; - if not(trouve_init_aig) then s:=INIT_AIG_ch; - if not(trouve_lay) then s:=LAY_ch; - if not(trouve_INTER_CAR) then s:=INTER_CAR_ch; - if not(trouve_Tempo_maxi) then s:=Tempo_maxi_ch; - if not(trouve_Entete) then s:=Entete_ch; - if not(trouve_TCO) then s:=TCO_ch; - if not(trouve_CDM) then s:=CDM_ch; - if not(trouve_Serveur_interface) then s:=Serveur_interface_ch; - if not(trouve_fenetre) then s:=fenetre_ch; - if not(trouve_tempo_aig) then s:=tempo_aig_ch; - if not(trouve_NOTIF_VERSION) then s:=NOTIF_VERSION_ch; - if not(trouve_verif_version) then s:=verif_version_ch; - if not(trouve_fonte) then s:=fonte_ch; - if s<>'' then affiche('ERREUR: manque variables dans config-gl.cfg '+s,clred); - - closefile(fichier); - verif_coherence; -end; - // front descendant sur un détecteur function detecteur_0(adresse : integer) : boolean; begin @@ -3627,7 +2718,6 @@ var i,adr,Branche : integer ; BT : TEquipement; sort : boolean; begin - //Affiche('cherche'+IntToSTR(el)+'/'+IntToSTR(TypeEl),clred); Branche:=Offset; branche_trouve:=0; IndexBranche_trouve:=0; @@ -3635,7 +2725,6 @@ begin repeat adr:=BrancheN[Branche,i].Adresse; Bt:=BrancheN[Branche,i].BType; - //Affiche(IntToSTR(adr)+'/'+IntToSTR(BType),clred); if ((adr=0) and (Bt=rien)) then begin inc(Branche);i:=0;end; inc(i); sort:=(Branche>NbreBranches) or ((adr=el) and (TypeEL=Bt)); @@ -3644,7 +2733,6 @@ begin begin branche_trouve:=Branche; IndexBranche_trouve:=i-1; - //Affiche('trouvé',clgreen); end else begin s:='Erreur 175 - élément '+intToSTR(el); s:=s+' non trouvé';Affiche(s,clred); @@ -3662,13 +2750,13 @@ end; // 2=arret sur aiguillage en talon mal positionné // 3=arret sur un aiguillage pris en pointe dévié et AdrDevie contient l'adresse de l'aiguillage dévié ainsi que typeGen // code de sortie : élément suivant ou: -// 9999=erreur fatale ou itération trop longue -// 9998= arret sur aiguillage en talon mal positionnée +// 9999: erreur fatale ou itération trop longue +// 9998: arret sur aiguillage en talon mal positionnée // 9997: arrêt sur aiguillage dévié // 9996: arrêt sur position inconnue d'aiguillage function suivant_alg3(prec : integer;typeELprec : TEquipement;actuel : integer;typeElActuel : TEquipement;alg : integer) : integer; var Adr,AdrPrec,indexBranche_prec,branche_trouve_prec,indexBranche_actuel,branche_trouve_actuel, - tjsc1,tjsc2,AdrTjdP,Adr2,N_iteration,index : integer; + tjsc1,tjsc2,AdrTjdP,Adr2,N_iteration,index,NetatTJD : integer; tjscourbe1,tjscourbe2,tjdC,tjsC : boolean; A,Aprec,tjsc1B,tjsc2B: char; Md,BT,BtypePrec,TypeEL : TEquipement; @@ -3698,13 +2786,13 @@ begin recommence: if (TypeELPrec=rien) or (typeElActuel=rien) then begin - s:='Erreur 800 - Types nuls : '+intToSTR(prec)+'/'+intToSTR(BtypeToNUM(TypeElPrec))+' '+IntToSTr(actuel)+'/'+IntToSTR(BtypeToNUM(typeElActuel)) ; + s:='Erreur 800 - Types nuls : '+intToSTR(prec)+'/'+BtypeToChaine(TypeElPrec)+' '+IntToSTr(actuel)+'/'+BtypeToChaine(typeElActuel) ; Affiche(s,clred); AfficheDebug(s,clred); Suivant_alg3:=9999;exit; end; if NivDebug=3 then - AfficheDebug('Alg3 précédent='+intToSTR(prec)+'/'+intToStr(BtypeToNUM(TypeElprec))+' actuel='+intToSTR(actuel)+'/'+IntToSTR(BtypeToNUM(typeElActuel))+' Alg='+intToSTr(alg),clyellow); + AfficheDebug('Alg3 précédent='+intToSTR(prec)+'/'+BtypeToChaine(TypeElprec)+' actuel='+intToSTR(actuel)+'/'+BtypeToChaine(typeElActuel)+' Alg='+intToSTr(alg),clyellow); // trouver les éléments du précédent trouve_element(prec,TypeELPrec,1); // branche_trouve IndexBranche_trouve if IndexBranche_trouve=0 then @@ -3716,7 +2804,6 @@ begin indexBranche_prec:=IndexBranche_trouve; branche_trouve_prec:=branche_trouve; BtypePrec:=BrancheN[branche_trouve_prec,indexBranche_prec].Btype; - // if BTypePrec=2 then aiguillage[index_aig(prec].A trouve_element(actuel,typeElActuel,1); // branche_trouve IndexBranche_trouve if IndexBranche_trouve=0 then @@ -3790,8 +2877,6 @@ begin exit; end; goto recommence; - //Affiche('Erreur 44 - éléments non consécutifs: Prec='+intToSTR(prec)+' Actuel='+intTostr(Actuel),clred); - //if NivDebug=3 then AfficheDebug('Erreur 44 - éléments non consécutifs: Prec='+intToSTR(prec)+' Actuel='+intTostr(Actuel),clred); end; if (Bt=aig) or (Bt=buttoir) then // aiguillage ou buttoir @@ -3915,6 +3000,7 @@ begin tjsc2:=aiguillage[index_aig(AdrTjdP)].tjsint; tjsc1B:=aiguillage[index].tjsintB; tjsc2B:=aiguillage[index_aig(AdrTjdP)].tjsintB; + NetatTJD:=aiguillage[index].etatTJD; if tjsc1<>0 then // si tjs begin tjscourbe1:=(aiguillage[index].tjsintB='S') and (aiguillage[index_aig(tjsc1)].position<>const_droit); @@ -3928,242 +3014,279 @@ begin if NivDebug=3 then begin - s:='137 - TJD '+intToSTR(Adr)+'/'+IntToSTR(AdrTjdP)+' pos='; + s:='137 - TJD '+intToSTR(Adr); + if NetatTJD=4 then s:=s+'/'+IntToSTR(AdrTjdP); + s:=s+' pos='; if aiguillage[index].position=const_droit then s:=s+'droit' - else if aiguillage[index].position=const_devie then s:=s+'dévié' + else if aiguillage[index].position=const_devie then s:=s+'dévié' else s:=s+'inconnu' ; - if aiguillage[index_aig(AdrTJDP)].position=const_droit then s:=s+'/droit' - else if aiguillage[index_aig(AdrTJDP)].position=const_devie then s:=s+'/dévié' - else s:=s+'/inconnu' ; + if NetatTJD=4 then + begin + if aiguillage[index_aig(AdrTJDP)].position=const_droit then s:=s+'/droit' + else if aiguillage[index_aig(AdrTJDP)].position=const_devie then s:=s+'/dévié' + else s:=s+'/inconnu' ; + end; AfficheDebug(s,clyellow); end; // rechercher le port de destination de la tjd Adr2:=0;A:='Z'; - if aiguillage[index].position=const_droit then + if ((NetatTJD=4) or tjsC) then begin - A:=aiguillage[index].DDroitB; - adr2:=aiguillage[index].DDroit; - end; - if aiguillage[index].position=const_devie then - begin - A:=aiguillage[index].DDevieB; - adr2:=aiguillage[index].DDevie; - end; - if nivDebug=3 then Affichedebug('le port de destination de la tjd est '+IntToSTR(adr2)+a,clyellow); - - // extraire l'élément connecté au port de destination de la tjd - if A='S' then - begin - A:=aiguillage[index_aig(adr2)].AdevieB; - adr2:=aiguillage[index_aig(adr2)].Adevie; - //Affichedebug('element connecté:'+inttostr(adr)+A,clred); - end - else - if A='D' then - begin - A:=aiguillage[index_aig(adr2)].AdroitB; - adr2:=aiguillage[index_aig(adr2)].Adroit; - end - else - begin - if aiguillage[index].position<>9 then + if aiguillage[index].position=const_droit then begin - s:='Erreur 1021 TJD '+intToSTR(adr)+' non résolue'; - affichedebug(s,clred); - Affiche(s,clred); - suivant_alg3:=9996; - exit; - end - else + A:=aiguillage[index].DDroitB; + adr2:=aiguillage[index].DDroit; + end; + if aiguillage[index].position=const_devie then begin - if NivDebug=3 then - begin - s:='1022 - Position TJD '+intToSTR(adr)+' non résolue car position inconnue'; - affichedebug(s,clOrange); - end; - suivant_alg3:=9996; + A:=aiguillage[index].DDevieB; + adr2:=aiguillage[index].DDevie; end; end; + if (NetatTJD=2) and tjdC then + begin + if aiguillage[index].position=const_droit then + begin + A:=aiguillage[index].DDroitB; + adr2:=aiguillage[index].DDroit; + end; + if aiguillage[index].position=const_devie then + begin + A:=aiguillage[index].DDevieB; + adr2:=aiguillage[index].DDevie; + end; + end; + if nivDebug=3 then Affichedebug('le port de destination de la tjd '+inttoSTR(NetatTJD)+'états est '+IntToSTR(adr2)+a,clyellow); + // extraire l'élément connecté au port de destination de la tjd 4 états ou tjs + if tjsC or (NetatTJD=4) then + begin + if A='S' then + begin + A:=aiguillage[index_aig(adr2)].AdevieB; + adr2:=aiguillage[index_aig(adr2)].Adevie; + //Affichedebug('element connecté:'+inttostr(adr)+A,clred); + end + else + if A='D' then + begin + A:=aiguillage[index_aig(adr2)].AdroitB; + adr2:=aiguillage[index_aig(adr2)].Adroit; + end + else + begin + if aiguillage[index].position<>9 then + begin + s:='Erreur 1021 TJD '+intToSTR(adr)+' non résolue'; + affichedebug(s,clred); + Affiche(s,clred); + suivant_alg3:=9996; + exit; + end + else + begin + if NivDebug=3 then + begin + s:='1022 - Position TJD '+intToSTR(adr)+' non résolue car position inconnue'; + affichedebug(s,clOrange); + end; + suivant_alg3:=9996; + end; + end; + end; + if nivDebug=3 then AfficheDebug('tjd: '+s+' Suiv='+intToSTR(adr2)+A,clYellow); if A='Z' then typeGen:=det else typeGen:=aig; //TypeEL=(1=détécteur 2=aig suivant_alg3:=adr2; exit; - // determiner la position de la première section de la TJD (4 cas) - // cas 1 : droit droit - if (( aiguillage[index_aig(AdrTJdP)].position=const_droit) and - (aiguillage[index].position=const_droit) and tjdC) then + if (NetatTJD=4) or tjsC then begin - // d'où vient ton sur la tjd - if aiguillage[index].Adroit=prec then + // determiner la position de la première section de la TJD (4 cas) + // cas 1 : droit droit + if (( aiguillage[index_aig(AdrTJdP)].position=const_droit) and + (aiguillage[index].position=const_droit) and tjdC) then begin - A:=aiguillage[index].DdroitB; - Adr:=aiguillage[index].Ddroit; - if A='D' then + // d'où vient ton sur la tjd + if aiguillage[index].Adroit=prec then begin - Adr:=aiguillage[index_aig(AdrTjDP)].Adroit; - A:=aiguillage[index_aig(AdrTjDP)].AdroitB; + A:=aiguillage[index].DdroitB; + Adr:=aiguillage[index].Ddroit; + if A='D' then + begin + Adr:=aiguillage[index_aig(AdrTjDP)].Adroit; + A:=aiguillage[index_aig(AdrTjDP)].AdroitB; + end; + if A='S' then + begin + Adr:=aiguillage[index_aig(AdrTjDP)].Adevie; + A:=aiguillage[index_aig(AdrTjDP)].AdevieB; + end; + if NivDebug=3 then AfficheDebug('cas1.1 tjd: '+s+' Adr='+intToSTR(adr)+A,clYellow); + if A='Z' then typeGen:=det else typeGen:=aig; //TypeEL=(1=détécteur 2=aig + suivant_alg3:=adr; + substitue; + exit; end; - if A='S' then + if aiguillage[index].Adevie=prec then begin - Adr:=aiguillage[index_aig(AdrTjDP)].Adevie; - A:=aiguillage[index_aig(AdrTjDP)].AdevieB; + A:=aiguillage[index_aig(AdrTjdP)].AdroitB; + Adr:=aiguillage[index_aig(AdrTjdP)].Adroit; + if NivDebug=3 then AfficheDebug('cas1.2 tjd: '+s+' Suiv='+intToSTR(adr)+A,clYellow); + if A='Z' then typeGen:=det else typeGen:=aig; //TypeEL=(1=détécteur 2=aig + suivant_alg3:=adr; + substitue; + exit; end; - if NivDebug=3 then AfficheDebug('cas1.1 tjd: '+s+' Adr='+intToSTR(adr)+A,clYellow); - if A='Z' then typeGen:=det else typeGen:=aig; //TypeEL=(1=détécteur 2=aig - suivant_alg3:=adr; - substitue; - exit; + s:='Erreur 1021, TJD '+IntToSTR(Adr)+'/'+IntToSTR(AdrTjdP)+' mal positionnée'; + if nivDebug=3 then AfficheDebug(s,clred); + Affiche(s,clred); + Suivant_alg3:=9998;exit; end; - if aiguillage[index].Adevie=prec then + // cas 2 TJD + if (aiguillage[index].position=const_devie) + and (aiguillage[index_aig(AdrTjdP)].position=const_droit) and tjdC then begin - A:=aiguillage[index_aig(AdrTjdP)].AdroitB; - Adr:=aiguillage[index_aig(AdrTjdP)].Adroit; - if NivDebug=3 then AfficheDebug('cas1.2 tjd: '+s+' Suiv='+intToSTR(adr)+A,clYellow); - if A='Z' then typeGen:=det else typeGen:=aig; //TypeEL=(1=détécteur 2=aig - suivant_alg3:=adr; - substitue; - exit; - end; - s:='Erreur 1021, TJD '+IntToSTR(Adr)+'/'+IntToSTR(AdrTjdP)+' mal positionnée'; - if nivDebug=3 then AfficheDebug(s,clred); - Affiche(s,clred); - Suivant_alg3:=9998;exit; - end; - // cas 2 TJD - if (aiguillage[index].position=const_devie) - and (aiguillage[index_aig(AdrTjdP)].position=const_droit) and tjdC then - begin - if aiguillage[index].Adevie=prec then - begin - A:=aiguillage[index_aig(AdrTjdP)].AdroitB; - Adr:=aiguillage[index_aig(AdrTJDP)].Adroit; - if NivDebug=3 then AfficheDebug('cas2.1 tjd: '+s+' Suiv='+intToSTR(adr)+A,clYellow); - if A='Z' then typeGen:=det else typeGen:=aig; //TypeEL=(1=détécteur 2=aig - substitue; - suivant_alg3:=adr; - exit; - end; - if (aiguillage[index].Adroit=prec) then - begin - A:=aiguillage[index_aig(AdrTJDP)].AdevieB; - Adr:=aiguillage[index_aig(AdrTjdP)].Adevie; - if NivDebug=3 then AfficheDebug('cas2.2 tjd: '+s+' Suiv='+intToSTR(adr)+A,clYellow); + if aiguillage[index].Adevie=prec then + begin + A:=aiguillage[index_aig(AdrTjdP)].AdroitB; + Adr:=aiguillage[index_aig(AdrTJDP)].Adroit; + if NivDebug=3 then AfficheDebug('cas2.1 tjd: '+s+' Suiv='+intToSTR(adr)+A,clYellow); + if A='Z' then typeGen:=det else typeGen:=aig; //TypeEL=(1=détécteur 2=aig + substitue; + suivant_alg3:=adr; + exit; + end; + if (aiguillage[index].Adroit=prec) then + begin + A:=aiguillage[index_aig(AdrTJDP)].AdevieB; + Adr:=aiguillage[index_aig(AdrTjdP)].Adevie; + if NivDebug=3 then AfficheDebug('cas2.2 tjd: '+s+' Suiv='+intToSTR(adr)+A,clYellow); - if A='Z' then typeGen:=det else typeGen:=aig; //TypeEL=(1=détécteur 2=aig - substitue; - suivant_alg3:=adr; - exit; + if A='Z' then typeGen:=det else typeGen:=aig; //TypeEL=(1=détécteur 2=aig + substitue; + suivant_alg3:=adr; + exit; + end; + s:='Erreur 1023, TJD '+IntToSTR(Adr)+'/'+IntToSTR(AdrTjdP)+' mal positionnée'; + if nivDebug=3 then AfficheDebug(s,clred); + Affiche(s,clred); + Suivant_alg3:=9998;exit; end; - s:='Erreur 1023, TJD '+IntToSTR(Adr)+'/'+IntToSTR(AdrTjdP)+' mal positionnée'; - if nivDebug=3 then AfficheDebug(s,clred); - Affiche(s,clred); - Suivant_alg3:=9998;exit; - end; - // cas 3 TJD - if (aiguillage[index].position=const_droit) + // cas 3 TJD + if (aiguillage[index].position=const_droit) and (aiguillage[index_aig(AdrTjdP)].position=const_devie) and tjdC then - begin - // si on vient de - if (aiguillage[index].Adroit=prec) then begin - if NivDebug=3 then AfficheDebug('cas3.1 tjd: '+s,clYellow); - A:=aiguillage[index].DdroitB; - Adr:=aiguillage[index].Ddroit; - if A='D' then + // si on vient de + if (aiguillage[index].Adroit=prec) then begin - Adr:=aiguillage[index_aig(AdrTjDP)].Adroit; - A:=aiguillage[index_aig(AdrTjDP)].AdroitB; - end; - if A='S' then - begin - Adr:=aiguillage[index_aig(AdrTjDP)].Adevie; - A:=aiguillage[index_aig(AdrTjDP)].AdevieB; - end; + if NivDebug=3 then AfficheDebug('cas3.1 tjd: '+s,clYellow); + A:=aiguillage[index].DdroitB; + Adr:=aiguillage[index].Ddroit; + if A='D' then + begin + Adr:=aiguillage[index_aig(AdrTjDP)].Adroit; + A:=aiguillage[index_aig(AdrTjDP)].AdroitB; + end; + if A='S' then + begin + Adr:=aiguillage[index_aig(AdrTjDP)].Adevie; + A:=aiguillage[index_aig(AdrTjDP)].AdevieB; + end; - if A='Z' then typeGen:=det else typeGen:=aig; //TypeEL=(1=détécteur 2=aig - //substitue; - suivant_alg3:=adr; + if A='Z' then typeGen:=det else typeGen:=aig; //TypeEL=(1=détécteur 2=aig + //substitue; + suivant_alg3:=adr; + exit; + end; + // si on vient de + if (aiguillage[index].Adevie=prec) then + begin + A:=aiguillage[index_aig(AdrTJDP)].AdroitB; + Adr:=aiguillage[index_aig(AdrTJDP)].Adroit; + if NivDebug=3 then AfficheDebug('cas3.2 tjd: '+s+' Suiv='+intToSTR(adr)+A,clYellow); + if A='Z' then typeGen:=det else typeGen:=aig; //TypeEL=(1=détécteur 2=aig + substitue; + suivant_alg3:=adr; + exit; + end; + s:='Erreur 1024, TJD '+IntToSTR(Adr)+'/'+IntToSTR(AdrTjdP)+' mal positionnée'; + if nivDebug=3 then AfficheDebug(s,clred); + Affiche(s,clred); + Suivant_alg3:=9998;exit; + end; + // cas 4 tjd + if (aiguillage[index].position=const_devie) + and (aiguillage[index_aig(AdrTjdP)].position=const_devie) then + begin + if aiguillage[index].Adevie=prec then + begin + A:=aiguillage[index_aig(AdrtjdP)].AdevieB; + Adr:=aiguillage[index_aig(AdrtjdP)].Adevie; + if NivDebug=3 then AfficheDebug('cas4.1 tjd: '+s+' Suiv='+intToSTR(adr)+A,clYellow); + if A='Z' then typeGen:=det else typeGen:=aig; //TypeEL=(1=détécteur 2=aig + substitue; + suivant_alg3:=adr; + exit; + end; + if aiguillage[index].Adroit=prec then + begin + A:=aiguillage[index_aig(AdrtjdP)].AdevieB; + Adr:=aiguillage[index_aig(AdrtjdP)].Adevie; + if NivDebug=3 then AfficheDebug('cas4.2 tjd: '+s+' Suiv='+intToSTR(adr)+A,clYellow); + if A='Z' then typeGen:=det else typeGen:=aig; //TypeEL=(1=détécteur 2=aig + substitue; + suivant_alg3:=adr; + exit; + end; + s:='Erreur 1025, TJD '+IntToSTR(Adr)+'/'+IntToSTR(AdrTjdP)+' mal positionnée'; + if nivDebug=3 then AfficheDebug(s,clred); + Affiche(s,clred); + Suivant_alg3:=9998; exit; end; - // si on vient de - if (aiguillage[index].Adevie=prec) then + + // cas TJS prise dans sa position courbe + if ((aiguillage[index].Adevie=Prec) and (aiguillage[index].AdevieB=Aprec) and (aiguillage[index].position<>const_droit) + and (aiguillage[index_aig(AdrTjdP)].position=const_droit) and (tjsC) and tjscourbe1 and tjscourbe2) then begin - A:=aiguillage[index_aig(AdrTJDP)].AdroitB; - Adr:=aiguillage[index_aig(AdrTJDP)].Adroit; - if NivDebug=3 then AfficheDebug('cas3.2 tjd: '+s+' Suiv='+intToSTR(adr)+A,clYellow); - if A='Z' then typeGen:=det else typeGen:=aig; //TypeEL=(1=détécteur 2=aig - substitue; - suivant_alg3:=adr; - exit; - end; - s:='Erreur 1024, TJD '+IntToSTR(Adr)+'/'+IntToSTR(AdrTjdP)+' mal positionnée'; - if nivDebug=3 then AfficheDebug(s,clred); - Affiche(s,clred); - Suivant_alg3:=9998;exit; - end; - // cas 4 tjd - if (aiguillage[index].position=const_devie) - and (aiguillage[index_aig(AdrTjdP)].position=const_devie) then - begin - if aiguillage[index].Adevie=prec then - begin - A:=aiguillage[index_aig(AdrtjdP)].AdevieB; - Adr:=aiguillage[index_aig(AdrtjdP)].Adevie; - if NivDebug=3 then AfficheDebug('cas4.1 tjd: '+s+' Suiv='+intToSTR(adr)+A,clYellow); - if A='Z' then typeGen:=det else typeGen:=aig; //TypeEL=(1=détécteur 2=aig - substitue; - suivant_alg3:=adr; - exit; - end; - if aiguillage[index].Adroit=prec then - begin - A:=aiguillage[index_aig(AdrtjdP)].AdevieB; - Adr:=aiguillage[index_aig(AdrtjdP)].Adevie; - if NivDebug=3 then AfficheDebug('cas4.2 tjd: '+s+' Suiv='+intToSTR(adr)+A,clYellow); + if NivDebug=3 then AfficheDebug('cas tjs en courbe1',clYellow); + A:=aiguillage[index_aig(AdrTjdP)].AdevieB; + Adr:=aiguillage[index_aig(AdrTjdP)].Adevie; if A='Z' then typeGen:=det else typeGen:=aig; //TypeEL=(1=détécteur 2=aig substitue; suivant_alg3:=adr; exit; end; - s:='Erreur 1025, TJD '+IntToSTR(Adr)+'/'+IntToSTR(AdrTjdP)+' mal positionnée'; - if nivDebug=3 then AfficheDebug(s,clred); - Affiche(s,clred); - Suivant_alg3:=9998; - exit; - end; - // cas TJS prise dans sa position courbe - if ((aiguillage[index].Adevie=Prec) and (aiguillage[index].AdevieB=Aprec) and (aiguillage[index].position<>const_droit) - and (aiguillage[index_aig(AdrTjdP)].position=const_droit) and (tjsC) and tjscourbe1 and tjscourbe2) then - begin - if NivDebug=3 then AfficheDebug('cas tjs en courbe1',clYellow); - A:=aiguillage[index_aig(AdrTjdP)].AdevieB; - Adr:=aiguillage[index_aig(AdrTjdP)].Adevie; - if A='Z' then typeGen:=det else typeGen:=aig; //TypeEL=(1=détécteur 2=aig - substitue; - suivant_alg3:=adr; - exit; - end; - // cas 3 TJS prise dans sa 2eme position courbe - if ((aiguillage[index].Adroit=Prec) and (aiguillage[index].AdroitB=Aprec) and (aiguillage[index].position=const_droit) - and (aiguillage[index_aig(AdrTjdP)].position<>const_droit) and (tjsC) and tjscourbe1 and tjscourbe2 ) then - begin - if NivDebug=3 then AfficheDebug('cas1 tjs en courbe 2',clYellow); - A:=aiguillage[index_aig(AdrTjdP)].AdevieB; - Adr:=aiguillage[index_aig(AdrTjdP)].Adevie; - if A='Z' then typeGen:=det else typeGen:=aig; //TypeEL=(1=détécteur 2=aig - suivant_alg3:=adr; - substitue; - exit; - end; - s:='1026 - Erreur fatale - position TJD/S '+IntToSTR(Adr)+'/'+intToSTR(AdrTJDP)+' inconnue'; - Affiche(s,clred); - AfficheDebug(s,clred); - suivant_alg3:=9999;exit; - end; + // cas 3 TJS prise dans sa 2eme position courbe + if ((aiguillage[index].Adroit=Prec) and (aiguillage[index].AdroitB=Aprec) and (aiguillage[index].position=const_droit) + and (aiguillage[index_aig(AdrTjdP)].position<>const_droit) and (tjsC) and tjscourbe1 and tjscourbe2 ) then + begin + if NivDebug=3 then AfficheDebug('cas1 tjs en courbe 2',clYellow); + A:=aiguillage[index_aig(AdrTjdP)].AdevieB; + Adr:=aiguillage[index_aig(AdrTjdP)].Adevie; + if A='Z' then typeGen:=det else typeGen:=aig; //TypeEL=(1=détécteur 2=aig + suivant_alg3:=adr; + substitue; + exit; + end; + s:='1026 - Erreur fatale - position TJD/S '+IntToSTR(Adr)+'/'+intToSTR(AdrTJDP)+' inconnue'; + Affiche(s,clred); + AfficheDebug(s,clred); + suivant_alg3:=9999;exit; + end; + + // TJD à 2 états + if (NetatTJD=2) and tjdC then + begin + Affiche('TJD 2 états',clOrange); + + end; + + end; + if (aiguillage[index].modele=triple) then // aiguillage triple begin Adr2:=aiguillage[index].AdrTriple; @@ -4455,7 +3578,7 @@ begin if NivDebug=3 then begin - s:='Test en '; + s:='------> Test en '; if (j=1) then s:=s+'incrément ' else s:=s+'décrément '; s:=s+'- départ depuis élément '+IntToSTR(el1)+' trouvé en index='+intToSTR(IndexBranche_det1)+' Branche='+intToSTR(branche_trouve_det1); AfficheDebug(s,clyellow); @@ -4956,19 +4079,18 @@ begin if Pres_Train and (NivDebug=3) then Affiche('Présence train de '+intToSTR(prec)+' à '+intToSTR(actuel),clyellow); end else + begin + AdrSuiv:=suivant_alg3(prec,TypePrec,actuel,TypeActuel,1); + if Typegen=det then inc(N_Det); + prec:=actuel;TypePrec:=TypeActuel; + actuel:=AdrSuiv;TypeActuel:=typeGen; + if AdrSuiv>9990 then begin - AdrSuiv:=suivant_alg3(prec,TypePrec,actuel,TypeActuel,1); - if Typegen=det then inc(N_Det); - prec:=actuel;TypePrec:=TypeActuel; - actuel:=AdrSuiv;TypeActuel:=typeGen; - if AdrSuiv>9990 then - begin - test_memoire_zones:=false;exit; - end; + test_memoire_zones:=false;exit; + end; + end; - end; - - if NivDebug=3 then AfficheDebug('132 - suivant='+IntToSTR(adrsuiv)+'/'+IntToSTR(BtypeToNUM(TypeGen)),clYellow); + if NivDebug=3 then AfficheDebug('132 - suivant='+IntToSTR(adrsuiv)+'/'+BtypeToChaine(TypeGen),clYellow); if actuel=0 then begin // si c'est un buttoir @@ -5210,8 +4332,6 @@ var Adr_det,etat,Aig,Adr_El_Suiv, Btype_el_suivant : TEquipement; s : string; begin - - if signalDebug=AdrFeu then AffSignal:=true; if AffSignal then begin @@ -5446,8 +4566,7 @@ begin trouve_element(adr,det,1); // branche_trouve IndexBranche_trouve if Branche_trouve=0 then begin buttoir_adjacent:=false;exit;end; buttoir_adjacent:=( (BrancheN[branche_trouve,IndexBranche_trouve+1].Adresse=0) and (BrancheN[branche_trouve,IndexBranche_trouve+1].BType=buttoir) or - (BrancheN[branche_trouve,IndexBranche_trouve-1].Adresse=0) and (BrancheN[branche_trouve,IndexBranche_trouve-1].BType=buttoir) ) - + (BrancheN[branche_trouve,IndexBranche_trouve-1].Adresse=0) and (BrancheN[branche_trouve,IndexBranche_trouve-1].BType=buttoir) ) end; // calcul des zones depuis le tableau des fronts descendants des évènements détecteurs @@ -5737,7 +4856,7 @@ end; Procedure affiche_memoire; var s: string; begin - s:='Mémoire évènements '+IntToSTR( 100*N_Event_tick div Max_Event_det_tick)+' %'; + s:='Mémoire évènements '+IntToSTR(100*N_Event_tick div Max_Event_det_tick)+' %'; Formprinc.statictext.caption:=s; end; @@ -5797,7 +4916,6 @@ begin if (n_Event_tick mod 10) =0 then affiche_memoire; // Affiche('stockage de '+intToSTR(N_event_tick)+' '+IntToSTR(Adresse)+' à '+intToSTR(etat01),clyellow); - // détection front montant if not(ancien_detecteur[Adresse]) and detecteur[Adresse].etat then begin @@ -6346,60 +5464,57 @@ end; procedure connecte_USB; var i,j : integer; begin - if NumPort<>0 then + if NumPort<>0 then + begin + With Formprinc.MSCommUSBLenz do begin - With Formprinc.MSCommUSBLenz do - begin - i:=pos(':',portCom); - j:=pos(',',PortCom); - j:=posEx(',',PortCom,j+1); - j:=posEx(',',PortCom,j+1); - j:=posEx(',',PortCom,j+1); - - confStCom:=copy(portCom,i+1,j-i-1); - Settings:=ConfStCom; // COMx:vitesse,n,8,1 - Affiche('Demande ouverture COM'+intToSTR(NumPort)+':'+ConfStCom+' protocole '+IntToSTR(protocole),CLYellow); - if protocole>=4 then Handshaking:=0 {0=aucun 1=Xon-Xoff 2=cts 3=RTS-Xon-Xoff 4=5=protocoles "maison"} - else Handshaking:=protocole; - - SThreshold:=1; - RThreshold:=1; - CommPort:=NumPort; - DTREnable:=True; - if protocole=4 then RTSEnable:=True //pour la genli - else RTSenable:=False; + i:=pos(':',portCom); + j:=pos(',',PortCom); + j:=posEx(',',PortCom,j+1); + j:=posEx(',',PortCom,j+1); + j:=posEx(',',PortCom,j+1); + confStCom:=copy(portCom,i+1,j-i-1); + Settings:=ConfStCom; // COMx:vitesse,n,8,1 + Affiche('Demande ouverture COM'+intToSTR(NumPort)+':'+ConfStCom+' protocole '+IntToSTR(protocole),CLYellow); + if protocole>=4 then Handshaking:=0 {0=aucun 1=Xon-Xoff 2=cts 3=RTS-Xon-Xoff 4=5=protocoles "maison"} + else Handshaking:=protocole; + SThreshold:=1; + RThreshold:=1; + CommPort:=NumPort; + DTREnable:=True; + if protocole=4 then RTSEnable:=True //pour la genli + else RTSenable:=False; InputMode:=comInputModeBinary; - end; - portCommOuvert:=true; - try - Formprinc.MSCommUSBLenz.portopen:=true; - except - portCommOuvert:=false; - end; - end - else - begin - portCommOuvert:=false; - Affiche('Port Com nul dans le fichier de configuration',clyellow); - end; - - if portCommOuvert then + end; + portCommOuvert:=true; + try + Formprinc.MSCommUSBLenz.portopen:=true; + except + portCommOuvert:=false; + end; + end + else begin - affiche('port COM'+intToSTR(NumPort)+' ouvert',clGreen); - With Formprinc do - begin - LabelTitre.caption:=titre+' Interface connectée au COM'+IntToSTR(NumPort); - MenuConnecterUSB.enabled:=false; - DeConnecterUSB.enabled:=true; - ConnecterCDMRail.enabled:=false; - DeConnecterCDMRail.enabled:=false; - end; - end - else - begin - Affiche('port COM'+intToSTR(NumPort)+' NON ouvert',clOrange) ; - end; + portCommOuvert:=false; + Affiche('Port Com nul dans le fichier de configuration',clyellow); + end; + if portCommOuvert then + begin + affiche('port COM'+intToSTR(NumPort)+' ouvert',clGreen); + With Formprinc do + begin + LabelTitre.caption:=titre+' Interface connectée au COM'+IntToSTR(NumPort); + MenuConnecterUSB.enabled:=false; + DeConnecterUSB.enabled:=true; + ConnecterCDMRail.enabled:=false; + DeConnecterCDMRail.enabled:=false; + end; + end + else + begin + Affiche('port COM'+intToSTR(NumPort)+' NON ouvert',clOrange) ; + end; end; Function GetWindowFromID(ProcessID : Cardinal): THandle; @@ -6720,7 +5835,7 @@ begin N_trains:=0; Application.HintHidePause:=30000; - // lecture fichiers de configuration client_GL.cfg et config.cfg + // lecture fichiers de configuration lit_config; Application.processMessages; @@ -6828,6 +5943,7 @@ begin //i:=Detecteur_suivant_El(520,1,20,2); // AfficheDebug(IntToSTR(i),clyellow); } + end; @@ -7089,6 +6205,7 @@ begin pilote_acc(adr,const_droit,aigP); s:='accessoire '+IntToSTR(adr)+' droit'; Affiche(s,clyellow); + Self.ActiveControl:=nil; end; procedure TFormPrinc.ButtonDevieClick(Sender: TObject); @@ -7278,8 +6395,7 @@ begin begin adr:=Adresse_detecteur[j]; s:='Dét '+intToSTR(adr)+'='; - if Detecteur[adr].etat then s:=s+'1' else s:=s+'0'; - s:=s+' '+Detecteur[Adr].train; + if Detecteur[adr].etat then s:=s+'1 '+Detecteur[Adr].train else s:=s+'0'; Affiche(s,clYellow); end; end; @@ -7327,6 +6443,7 @@ begin if (aiguillage[i].modele=tjd) then begin s:=s+' TJD:'; + s:=s+intToSTR(aiguillage[i].EtatTJD)+' états '; if aiguillage[i].inversionCDM=1 then s:=s+'(INV) '; end; if aiguillage[i].modele=tjs then @@ -7734,7 +6851,7 @@ begin triple : s:=s+' (aiguillage triple) '; end; if feux[i].decodeur=6 then - s:=s+'Cible unisemaf= '+intToSTR(feux[i].Unisemaf); + s:=s+'Cible unisemaf='+intToSTR(feux[i].Unisemaf); // conditions sur carré l:=1; @@ -7750,13 +6867,16 @@ begin if nc>0 then s:=s+'/'; until (nc<=0) or (l>6); - s:=s+' RV('; - for l:=1 to 8 do + if feux[i].decodeur=7 then begin - s:=s+intToSTR(feux[i].SR[l].sortie1)+','; - s:=s+intToSTR(feux[i].SR[l].sortie0); - if l<8 then s:=s+'/' else s:=s+')'; - end; + s:=s+' SR('; + for l:=1 to 8 do + begin + s:=s+intToSTR(feux[i].SR[l].sortie1)+','; + s:=s+intToSTR(feux[i].SR[l].sortie0); + if l<8 then s:=s+'/' else s:=s+')'; + end; + end; end @@ -8059,7 +7179,7 @@ end; // pour déplacer l'ascenseur de l'affichage automatiquement en bas procedure TFormPrinc.FenRichChange(Sender: TObject); begin - SendMessage(FenRich.handle, WM_VSCROLL, SB_BOTTOM, 0); + SendMessage(FenRich.handle,WM_VSCROLL,SB_BOTTOM, 0); end; procedure TFormPrinc.Copier1Click(Sender: TObject); @@ -8087,44 +7207,27 @@ end; procedure TFormPrinc.Apropos1Click(Sender: TObject); begin Affiche(' ',clyellow); - Affiche('Signaux complexes GL version '+version+sousVersion+' (C) 2020 F1IWQ Gily TDR',clWhite); + Affiche('Signaux complexes GL version '+version+sousVersion+' (C) 2021 F1IWQ Gily TDR',clWhite); Affiche('http://cdmrail.free.fr/ForumCDR/viewtopic.php?f=77&t=3906',clWhite); Affiche('https://github.com/f1iwq2/Signaux_complexes_GL',clWhite); Affiche(' ',clyellow); end; +// cliqué droit sur un feu puis sur le menu propriétés procedure TFormPrinc.Proprits1Click(Sender: TObject); var s: string; index : integer; begin - clicliste:=false; - s:=((Tpopupmenu(Tmenuitem(sender).GetParentMenu).PopupComponent) as TImage).name; // nom du composant, pout récupérer l'index (ex: ImageFeu6) - //Affiche(s,clOrange); // nom de l'image du signal (ex: ImageFeu6) - index:=extract_int(s); // extraire l'index (ex 6) - Tformconfig.create(nil); - formconfig.PageControl.ActivePage:=formconfig.TabSheetSig; - //Affiche(intToSTR(index),clOrange); - ligneClicSig:=index-1; - formconfig.showmodal; - formconfig.close; -end; - -procedure TFormPrinc.Nouveaufeu1Click(Sender: TObject); -var i : integer; -begin - inc(NbreFeux); - i:=NbreFeux; - feux[i].Adresse:=999; - feux[i].Aspect:=3; - feux[i].decodeur:=0; - feux[i].verrouCarre:=false; - cree_image(i); - Affiche('Feu 999 créé',clyellow); -end; - -procedure TFormPrinc.Nouveaufeu2Click(Sender: TObject); -begin - NouveauFeu1Click(Sender); + clicliste:=false; + s:=((Tpopupmenu(Tmenuitem(sender).GetParentMenu).PopupComponent) as TImage).name; // nom du composant, pout récupérer l'index (ex: ImageFeu6) + //Affiche(s,clOrange); // nom de l'image du signal (ex: ImageFeu6) + index:=extract_int(s); // extraire l'index (ex 6) + Tformconfig.create(nil); + formconfig.PageControl.ActivePage:=formconfig.TabSheetSig; + indexfeuclic:=index-1; + clicproprietes:=true; + formconfig.showmodal; + formconfig.close; end; procedure TFormPrinc.VrifierlacohrenceClick(Sender: TObject); diff --git a/UnitSR.dcu b/UnitSR.dcu new file mode 100644 index 0000000..c94537a Binary files /dev/null and b/UnitSR.dcu differ diff --git a/UnitSR.dfm b/UnitSR.dfm new file mode 100644 index 0000000..9f4528e --- /dev/null +++ b/UnitSR.dfm @@ -0,0 +1,664 @@ +object FormSR: TFormSR + Left = 413 + Top = 214 + Width = 491 + Height = 600 + Caption = 'Configuration du d'#233'codeur du signal St'#233'phane Ravaut' + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = False + OnActivate = FormActivate + OnCreate = FormCreate + PixelsPerInch = 96 + TextHeight = 13 + object LabelAdrSR1: TLabel + Left = 24 + Top = 64 + Width = 63 + Height = 13 + Caption = 'LabelAdrSR1' + end + object Label1: TLabel + Left = 120 + Top = 48 + Width = 15 + Height = 13 + Caption = '+ 2' + end + object Label2: TLabel + Left = 120 + Top = 72 + Width = 12 + Height = 13 + Caption = '- 1' + end + object Label3: TLabel + Left = 24 + Top = 24 + Width = 59 + Height = 16 + Caption = 'Adresse' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'MS Sans Serif' + Font.Style = [fsBold] + ParentFont = False + end + object Label4: TLabel + Left = 112 + Top = 24 + Width = 28 + Height = 16 + Caption = 'Etat' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'MS Sans Serif' + Font.Style = [fsBold] + ParentFont = False + end + object Label5: TLabel + Left = 200 + Top = 24 + Width = 49 + Height = 16 + Caption = 'Aspect' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'MS Sans Serif' + Font.Style = [fsBold] + ParentFont = False + end + object Shape1: TShape + Left = 16 + Top = 96 + Width = 409 + Height = 1 + end + object LabelAdrSR2: TLabel + Left = 24 + Top = 120 + Width = 63 + Height = 13 + Caption = 'LabelAdrSR2' + end + object Label7: TLabel + Left = 120 + Top = 104 + Width = 15 + Height = 13 + Caption = '+ 2' + end + object Label8: TLabel + Left = 120 + Top = 128 + Width = 12 + Height = 13 + Caption = '- 1' + end + object Label6: TLabel + Left = 336 + Top = 24 + Width = 21 + Height = 16 + Caption = 'CV' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'MS Sans Serif' + Font.Style = [fsBold] + ParentFont = False + end + object LabelCV1: TLabel + Left = 320 + Top = 48 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object LabelCV2: TLabel + Left = 384 + Top = 48 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object LabelCV3: TLabel + Left = 320 + Top = 72 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object LabelCV4: TLabel + Left = 384 + Top = 72 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object LabelCV5: TLabel + Left = 320 + Top = 110 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object LabelCV6: TLabel + Left = 384 + Top = 110 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object LabelCV7: TLabel + Left = 320 + Top = 134 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object LabelCV8: TLabel + Left = 384 + Top = 134 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object Shape2: TShape + Left = 16 + Top = 160 + Width = 409 + Height = 1 + end + object LabelAdrSR3: TLabel + Left = 24 + Top = 184 + Width = 63 + Height = 13 + Caption = 'LabelAdrSR2' + end + object Label10: TLabel + Left = 120 + Top = 168 + Width = 15 + Height = 13 + Caption = '+ 2' + end + object Label11: TLabel + Left = 120 + Top = 192 + Width = 12 + Height = 13 + Caption = '- 1' + end + object LabelCV9: TLabel + Left = 320 + Top = 172 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object LabelCV10: TLabel + Left = 384 + Top = 172 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object LabelCV11: TLabel + Left = 320 + Top = 196 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object LabelCV12: TLabel + Left = 384 + Top = 196 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object Shape3: TShape + Left = 16 + Top = 216 + Width = 409 + Height = 1 + end + object LabelAdrSR4: TLabel + Left = 24 + Top = 240 + Width = 63 + Height = 13 + Caption = 'LabelAdrSR2' + end + object Label12: TLabel + Left = 120 + Top = 224 + Width = 15 + Height = 13 + Caption = '+ 2' + end + object Label13: TLabel + Left = 120 + Top = 248 + Width = 12 + Height = 13 + Caption = '- 1' + end + object LabelCV13: TLabel + Left = 320 + Top = 228 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object LabelCV14: TLabel + Left = 384 + Top = 228 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object LabelCV15: TLabel + Left = 320 + Top = 252 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object LabelCV16: TLabel + Left = 384 + Top = 252 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object Shape4: TShape + Left = 16 + Top = 272 + Width = 409 + Height = 1 + end + object LabelAdrSR5: TLabel + Left = 24 + Top = 296 + Width = 63 + Height = 13 + Caption = 'LabelAdrSR2' + end + object Label14: TLabel + Left = 120 + Top = 280 + Width = 15 + Height = 13 + Caption = '+ 2' + end + object Label15: TLabel + Left = 120 + Top = 304 + Width = 12 + Height = 13 + Caption = '- 1' + end + object LabelCV17: TLabel + Left = 320 + Top = 284 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object LabelCV18: TLabel + Left = 384 + Top = 284 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object LabelCV19: TLabel + Left = 320 + Top = 308 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object LabelCV20: TLabel + Left = 384 + Top = 308 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object Shape5: TShape + Left = 16 + Top = 328 + Width = 409 + Height = 1 + end + object LabelAdrSR6: TLabel + Left = 24 + Top = 352 + Width = 63 + Height = 13 + Caption = 'LabelAdrSR2' + end + object Label16: TLabel + Left = 120 + Top = 336 + Width = 15 + Height = 13 + Caption = '+ 2' + end + object Label17: TLabel + Left = 120 + Top = 360 + Width = 12 + Height = 13 + Caption = '- 1' + end + object LabelCV21: TLabel + Left = 320 + Top = 340 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object LabelCV22: TLabel + Left = 384 + Top = 340 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object LabelCV23: TLabel + Left = 320 + Top = 364 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object LabelCV24: TLabel + Left = 384 + Top = 364 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object Shape6: TShape + Left = 16 + Top = 384 + Width = 409 + Height = 1 + end + object LabelAdrSR7: TLabel + Left = 24 + Top = 408 + Width = 63 + Height = 13 + Caption = 'LabelAdrSR2' + end + object Label18: TLabel + Left = 120 + Top = 392 + Width = 15 + Height = 13 + Caption = '+ 2' + end + object Label19: TLabel + Left = 120 + Top = 416 + Width = 12 + Height = 13 + Caption = '- 1' + end + object LabelCV25: TLabel + Left = 320 + Top = 396 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object LabelCV26: TLabel + Left = 384 + Top = 396 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object LabelCV27: TLabel + Left = 320 + Top = 420 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object LabelCV28: TLabel + Left = 384 + Top = 420 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object Shape7: TShape + Left = 16 + Top = 448 + Width = 409 + Height = 1 + end + object LabelAdrSR8: TLabel + Left = 24 + Top = 472 + Width = 63 + Height = 13 + Caption = 'LabelAdrSR2' + end + object Label20: TLabel + Left = 120 + Top = 456 + Width = 15 + Height = 13 + Caption = '+ 2' + end + object Label21: TLabel + Left = 120 + Top = 480 + Width = 12 + Height = 13 + Caption = '- 1' + end + object LabelCV29: TLabel + Left = 320 + Top = 460 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object LabelCV30: TLabel + Left = 384 + Top = 460 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object LabelCV31: TLabel + Left = 320 + Top = 484 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object LabelCV32: TLabel + Left = 384 + Top = 484 + Width = 20 + Height = 13 + Caption = 'CV=' + end + object LabelErreur: TLabel + Left = 224 + Top = 528 + Width = 3 + Height = 13 + Caption = ':' + end + object ComboBoxAdr1: TComboBox + Left = 160 + Top = 48 + Width = 145 + Height = 21 + ItemHeight = 13 + TabOrder = 0 + OnChange = ComboBoxAdr1Change + end + object ComboBoxAdr2: TComboBox + Left = 160 + Top = 72 + Width = 145 + Height = 21 + ItemHeight = 13 + TabOrder = 1 + OnChange = ComboBoxAdr2Change + end + object ComboBoxAdr3: TComboBox + Left = 160 + Top = 104 + Width = 145 + Height = 21 + ItemHeight = 13 + TabOrder = 2 + OnChange = ComboBoxAdr3Change + end + object ComboBoxAdr4: TComboBox + Left = 160 + Top = 128 + Width = 145 + Height = 21 + ItemHeight = 13 + TabOrder = 3 + OnChange = ComboBoxAdr4Change + end + object ComboBoxAdr5: TComboBox + Left = 160 + Top = 168 + Width = 145 + Height = 21 + ItemHeight = 13 + TabOrder = 4 + OnChange = ComboBoxAdr5Change + end + object ComboBoxAdr6: TComboBox + Left = 160 + Top = 192 + Width = 145 + Height = 21 + ItemHeight = 13 + TabOrder = 5 + OnChange = ComboBoxAdr6Change + end + object ComboBoxAdr7: TComboBox + Left = 160 + Top = 224 + Width = 145 + Height = 21 + ItemHeight = 13 + TabOrder = 6 + OnChange = ComboBoxAdr7Change + end + object ComboBoxAdr8: TComboBox + Left = 160 + Top = 248 + Width = 145 + Height = 21 + ItemHeight = 13 + TabOrder = 7 + OnChange = ComboBoxAdr8Change + end + object ComboBoxAdr9: TComboBox + Left = 160 + Top = 280 + Width = 145 + Height = 21 + ItemHeight = 13 + TabOrder = 8 + OnChange = ComboBoxAdr9Change + end + object ComboBoxAdr10: TComboBox + Left = 160 + Top = 304 + Width = 145 + Height = 21 + ItemHeight = 13 + TabOrder = 9 + OnChange = ComboBoxAdr10Change + end + object ComboBoxAdr11: TComboBox + Left = 160 + Top = 336 + Width = 145 + Height = 21 + ItemHeight = 13 + TabOrder = 10 + OnChange = ComboBoxAdr11Change + end + object ComboBoxAdr12: TComboBox + Left = 160 + Top = 360 + Width = 145 + Height = 21 + ItemHeight = 13 + TabOrder = 11 + OnChange = ComboBoxAdr12Change + end + object ComboBoxAdr13: TComboBox + Left = 160 + Top = 392 + Width = 145 + Height = 21 + ItemHeight = 13 + TabOrder = 12 + OnChange = ComboBoxAdr13Change + end + object ComboBoxAdr14: TComboBox + Left = 160 + Top = 416 + Width = 145 + Height = 21 + ItemHeight = 13 + TabOrder = 13 + OnChange = ComboBoxAdr14Change + end + object ComboBoxAdr15: TComboBox + Left = 160 + Top = 456 + Width = 145 + Height = 21 + ItemHeight = 13 + TabOrder = 14 + OnChange = ComboBoxAdr15Change + end + object ComboBoxAdr16: TComboBox + Left = 160 + Top = 480 + Width = 145 + Height = 21 + ItemHeight = 13 + TabOrder = 15 + OnChange = ComboBoxAdr16Change + end + object ButtonOK: TButton + Left = 56 + Top = 520 + Width = 75 + Height = 25 + Caption = 'OK' + TabOrder = 16 + OnClick = ButtonOKClick + end +end diff --git a/UnitSR.pas b/UnitSR.pas new file mode 100644 index 0000000..65eeb79 --- /dev/null +++ b/UnitSR.pas @@ -0,0 +1,500 @@ +// Unité pour la configuration du décodeur Stéphane Ravaux + +unit UnitSR; + + +interface + +uses + Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, + Dialogs, StdCtrls, ExtCtrls; + +type + TFormSR = class(TForm) + LabelAdrSR1: TLabel; + ComboBoxAdr1: TComboBox; + Label1: TLabel; + Label2: TLabel; + ComboBoxAdr2: TComboBox; + Label3: TLabel; + Label4: TLabel; + Label5: TLabel; + Shape1: TShape; + LabelAdrSR2: TLabel; + Label7: TLabel; + Label8: TLabel; + Label6: TLabel; + LabelCV1: TLabel; + LabelCV2: TLabel; + LabelCV3: TLabel; + LabelCV4: TLabel; + ComboBoxAdr3: TComboBox; + ComboBoxAdr4: TComboBox; + LabelCV5: TLabel; + LabelCV6: TLabel; + LabelCV7: TLabel; + LabelCV8: TLabel; + Shape2: TShape; + LabelAdrSR3: TLabel; + Label10: TLabel; + Label11: TLabel; + ComboBoxAdr5: TComboBox; + ComboBoxAdr6: TComboBox; + LabelCV9: TLabel; + LabelCV10: TLabel; + LabelCV11: TLabel; + LabelCV12: TLabel; + Shape3: TShape; + LabelAdrSR4: TLabel; + Label12: TLabel; + Label13: TLabel; + ComboBoxAdr7: TComboBox; + ComboBoxAdr8: TComboBox; + LabelCV13: TLabel; + LabelCV14: TLabel; + LabelCV15: TLabel; + LabelCV16: TLabel; + Shape4: TShape; + LabelAdrSR5: TLabel; + Label14: TLabel; + Label15: TLabel; + ComboBoxAdr9: TComboBox; + ComboBoxAdr10: TComboBox; + LabelCV17: TLabel; + LabelCV18: TLabel; + LabelCV19: TLabel; + LabelCV20: TLabel; + Shape5: TShape; + LabelAdrSR6: TLabel; + Label16: TLabel; + Label17: TLabel; + ComboBoxAdr11: TComboBox; + ComboBoxAdr12: TComboBox; + LabelCV21: TLabel; + LabelCV22: TLabel; + LabelCV23: TLabel; + LabelCV24: TLabel; + Shape6: TShape; + LabelAdrSR7: TLabel; + Label18: TLabel; + Label19: TLabel; + LabelCV25: TLabel; + LabelCV26: TLabel; + LabelCV27: TLabel; + LabelCV28: TLabel; + ComboBoxAdr13: TComboBox; + ComboBoxAdr14: TComboBox; + Shape7: TShape; + LabelAdrSR8: TLabel; + Label20: TLabel; + Label21: TLabel; + LabelCV29: TLabel; + LabelCV30: TLabel; + LabelCV31: TLabel; + LabelCV32: TLabel; + ComboBoxAdr15: TComboBox; + ComboBoxAdr16: TComboBox; + ButtonOK: TButton; + LabelErreur: TLabel; + procedure FormActivate(Sender: TObject); + procedure ComboBoxAdr1Change(Sender: TObject); + procedure ComboBoxAdr2Change(Sender: TObject); + procedure ComboBoxAdr3Change(Sender: TObject); + procedure ComboBoxAdr4Change(Sender: TObject); + procedure ComboBoxAdr5Change(Sender: TObject); + procedure ComboBoxAdr6Change(Sender: TObject); + procedure ComboBoxAdr7Change(Sender: TObject); + procedure ComboBoxAdr8Change(Sender: TObject); + procedure ComboBoxAdr9Change(Sender: TObject); + procedure ComboBoxAdr10Change(Sender: TObject); + procedure ComboBoxAdr11Change(Sender: TObject); + procedure ComboBoxAdr12Change(Sender: TObject); + procedure ComboBoxAdr13Change(Sender: TObject); + procedure ComboBoxAdr14Change(Sender: TObject); + procedure ComboBoxAdr15Change(Sender: TObject); + procedure ComboBoxAdr16Change(Sender: TObject); + procedure ButtonOKClick(Sender: TObject); + procedure FormCreate(Sender: TObject); + private + { Déclarations privées } + public + { Déclarations publiques } + end; + +var + FormSR: TFormSR; + Adr,IndexSig : integer; + + +implementation + +uses UnitPrinc, UnitConfig; + + +{$R *.dfm} + +procedure etat_SR(etat : integer;var etat1,etat2 : integer) ; +var i : integer; +begin + // etat1 correspond à l'allumage des leds du 1er cycle clignotant + // etat2 correspond à l'allumage des leds du 2eme cycle clignotant + case etat of + // carré + 1 : begin etat1:=$81;etat2:=$81;end; + // sémaphore+oeilleton + 2 : begin etat1:=$88;etat2:=$88;end; + // sémaphore cli+oeil + 3 : begin etat1:=$88;etat2:=$08;end; + // vert+oeil + 4 : begin etat1:=$0C;etat2:=$0C;end; + // vert cli+oeil + 5 : begin etat1:=$0C;etat2:=$08;end; + // violet + 6 : begin etat1:=$01;etat2:=$01;end; + // blanc + 7 : begin etat1:=$02;etat2:=$02;end; + // blanc cli + 8 : begin etat1:=$02;etat2:=$00;end; + // jaune+oeil + 9 : begin etat1:=$48;etat2:=$48;end; + // jaune cli+oeil + 10 : begin etat1:=$48;etat2:=$08;end; + // ralen 30 (non documenté) + 11 : begin etat1:=$20;etat2:=$20;end; + // ralen 60 (non documenté) + 12 : begin etat1:=$20;etat2:=$00;end; + // ral 60+jaune cli + 13 : begin etat1:=$60;etat2:=$00;end; + // rappel 30 (non documenté) + 14 : begin etat1:=$10;etat2:=$10;end; + // rappel 60 (non documenté) + 15 : begin etat1:=$10;etat2:=$00;end; + // ral 30+jaune+oeil + 16 : begin etat1:=$68;etat2:=$68;end; + // rappel 30+jaune cli+oeil + 17 : begin etat1:=$58;etat2:=$18;end; + // rappel 60+jaune+oeil + 18 : begin etat1:=$58;etat2:=$48;end; + // rappel 60+jaune cli+oeil + 19 : begin etat1:=$58;etat2:=$08;end; + end; +end; + + +procedure TFormSR.FormActivate(Sender: TObject); +var erreur,i,etat1,etat2 : integer; +begin + Val(FormConfig.EditAdrSig.text,Adr,erreur); + indexSig:=index_feu(Adr); + if IndexSig=0 then LabelErreur.caption:='Erreur feu inexistant' + else + begin + LabelAdrSR1.caption:=intToSTR(Adr); + LabelAdrSR2.caption:=intToSTR(Adr+1); + LabelAdrSR3.caption:=intToSTR(Adr+2); + LabelAdrSR4.caption:=intToSTR(Adr+3); + LabelAdrSR5.caption:=intToSTR(Adr+4); + LabelAdrSR6.caption:=intToSTR(Adr+5); + LabelAdrSR7.caption:=intToSTR(Adr+6); + LabelAdrSR8.caption:=intToSTR(Adr+7); + + ComboBoxAdr1.ItemIndex:=feux[indexSig].SR[1].sortie1; + ComboBoxAdr2.ItemIndex:=feux[indexSig].SR[1].sortie0; + ComboBoxAdr3.ItemIndex:=feux[indexSig].SR[2].sortie1; + ComboBoxAdr4.ItemIndex:=feux[indexSig].SR[2].sortie0; + ComboBoxAdr5.ItemIndex:=feux[indexSig].SR[3].sortie1; + ComboBoxAdr6.ItemIndex:=feux[indexSig].SR[3].sortie0; + ComboBoxAdr7.ItemIndex:=feux[indexSig].SR[4].sortie1; + ComboBoxAdr8.ItemIndex:=feux[indexSig].SR[4].sortie0; + ComboBoxAdr9.ItemIndex:=feux[indexSig].SR[5].sortie1; + ComboBoxAdr10.ItemIndex:=feux[indexSig].SR[5].sortie0; + ComboBoxAdr11.ItemIndex:=feux[indexSig].SR[6].sortie1; + ComboBoxAdr12.ItemIndex:=feux[indexSig].SR[6].sortie0; + ComboBoxAdr13.ItemIndex:=feux[indexSig].SR[7].sortie1; + ComboBoxAdr14.ItemIndex:=feux[indexSig].SR[7].sortie0; + ComboBoxAdr15.ItemIndex:=feux[indexSig].SR[8].sortie1; + ComboBoxAdr16.ItemIndex:=feux[indexSig].SR[8].sortie0; + + etat_SR(feux[indexSig].SR[1].sortie1,etat1,etat2); + labelCV1.Caption:='CV='+IntToSTR(etat1); + labelCV2.Caption:='CV='+IntToSTR(etat2); + etat_SR(feux[indexSig].SR[1].sortie0,etat1,etat2); + labelCV3.Caption:='CV='+IntToSTR(etat1); + labelCV4.Caption:='CV='+IntToSTR(etat2); + etat_SR(feux[indexSig].SR[2].sortie1,etat1,etat2); + labelCV5.Caption:='CV='+IntToSTR(etat1); + labelCV6.Caption:='CV='+IntToSTR(etat2); + etat_SR(feux[indexSig].SR[2].sortie0,etat1,etat2); + labelCV7.Caption:='CV='+IntToSTR(etat1); + labelCV8.Caption:='CV='+IntToSTR(etat2); + etat_SR(feux[indexSig].SR[3].sortie1,etat1,etat2); + labelCV9.Caption:='CV='+IntToSTR(etat1); + labelCV10.Caption:='CV='+IntToSTR(etat2); + etat_SR(feux[indexSig].SR[3].sortie0,etat1,etat2); + labelCV11.Caption:='CV='+IntToSTR(etat1); + labelCV12.Caption:='CV='+IntToSTR(etat2); + etat_SR(feux[indexSig].SR[4].sortie1,etat1,etat2); + labelCV13.Caption:='CV='+IntToSTR(etat1); + labelCV14.Caption:='CV='+IntToSTR(etat2); + + etat_SR(feux[indexSig].SR[4].sortie0,etat1,etat2); + labelCV15.Caption:='CV='+IntToSTR(etat1); + labelCV16.Caption:='CV='+IntToSTR(etat2); + + etat_SR(feux[indexSig].SR[5].sortie1,etat1,etat2); + labelCV17.Caption:='CV='+IntToSTR(etat1); + labelCV18.Caption:='CV='+IntToSTR(etat2); + etat_SR(feux[indexSig].SR[5].sortie0,etat1,etat2); + labelCV19.Caption:='CV='+IntToSTR(etat1); + labelCV20.Caption:='CV='+IntToSTR(etat2); + + etat_SR(feux[indexSig].SR[6].sortie1,etat1,etat2); + labelCV21.Caption:='CV='+IntToSTR(etat1); + labelCV22.Caption:='CV='+IntToSTR(etat2); + etat_SR(feux[indexSig].SR[6].sortie0,etat1,etat2); + labelCV23.Caption:='CV='+IntToSTR(etat1); + labelCV24.Caption:='CV='+IntToSTR(etat2); + + etat_SR(feux[indexSig].SR[7].sortie1,etat1,etat2); + labelCV25.Caption:='CV='+IntToSTR(etat1); + labelCV26.Caption:='CV='+IntToSTR(etat2); + etat_SR(feux[indexSig].SR[7].sortie0,etat1,etat2); + labelCV27.Caption:='CV='+IntToSTR(etat1); + labelCV28.Caption:='CV='+IntToSTR(etat2); + + etat_SR(feux[indexSig].SR[8].sortie1,etat1,etat2); + labelCV29.Caption:='CV='+IntToSTR(etat1); + labelCV30.Caption:='CV='+IntToSTR(etat2); + + etat_SR(feux[indexSig].SR[8].sortie0,etat1,etat2); + labelCV31.Caption:='CV='+IntToSTR(etat1); + labelCV32.Caption:='CV='+IntToSTR(etat2); + + end; +end; + + +procedure Maj_DB; +var s : string; +begin + s:=encode_sig_feux(indexSig); + formconfig.RichSig.Lines[indexSig-1]:=s; + aff_champs_sig_feux(indexSig); +end; + +procedure TFormSR.ComboBoxAdr1Change(Sender: TObject); +var etat1,etat2,i : integer; +begin + if Affevt then affiche('ComboBoxAdr1',clyellow); + i:=ComboBoxAdr1.ItemIndex; + etat_SR(i,etat1,etat2); + labelCV1.Caption:='CV='+IntToSTR(etat1); + labelCV2.Caption:='CV='+IntToSTR(etat2); + feux[indexSig].SR[1].sortie1:=i; + maj_db; +end; + +procedure TFormSR.ComboBoxAdr2Change(Sender: TObject); +var etat1,etat2,i : integer; +begin + if Affevt then affiche('ComboBoxAdr2',clyellow); + i:=ComboBoxAdr2.ItemIndex; + etat_SR(i,etat1,etat2); + labelCV3.Caption:='CV='+IntToSTR(etat1); + labelCV4.Caption:='CV='+IntToSTR(etat2); + feux[indexSig].SR[1].sortie0:=i; + maj_db; +end; + +procedure TFormSR.ComboBoxAdr3Change(Sender: TObject); +var etat1,etat2,i : integer; +begin + if Affevt then affiche('ComboBoxAdr3',clyellow); + i:=ComboBoxAdr3.ItemIndex; + etat_SR(i,etat1,etat2); + labelCV5.Caption:='CV='+IntToSTR(etat1); + labelCV6.Caption:='CV='+IntToSTR(etat2); + feux[indexSig].SR[2].sortie1:=i; + maj_db; +end; + +procedure TFormSR.ComboBoxAdr4Change(Sender: TObject); +var etat1,etat2,i : integer; +begin + if Affevt then affiche('ComboBoxAdr4',clyellow); + i:=ComboBoxAdr4.ItemIndex; + etat_SR(i,etat1,etat2); + labelCV7.Caption:='CV='+IntToSTR(etat1); + labelCV8.Caption:='CV='+IntToSTR(etat2); + feux[indexSig].SR[2].sortie0:=i; + maj_db; +end; + +procedure TFormSR.ComboBoxAdr5Change(Sender: TObject); +var etat1,etat2,i : integer; +begin + if Affevt then affiche('ComboBoxAdr5',clyellow); + i:=ComboBoxAdr5.ItemIndex; + etat_SR(i,etat1,etat2); + labelCV9.Caption:='CV='+IntToSTR(etat1); + labelCV10.Caption:='CV='+IntToSTR(etat2); + feux[indexSig].SR[3].sortie1:=i; + maj_db; +end; + +procedure TFormSR.ComboBoxAdr6Change(Sender: TObject); +var etat1,etat2,i : integer; +begin + if Affevt then affiche('ComboBoxAdr6',clyellow); + i:=ComboBoxAdr6.ItemIndex; + etat_SR(i,etat1,etat2); + labelCV11.Caption:='CV='+IntToSTR(etat1); + labelCV12.Caption:='CV='+IntToSTR(etat2); + feux[indexSig].SR[3].sortie0:=i; + maj_db; +end; + +procedure TFormSR.ComboBoxAdr7Change(Sender: TObject); +var etat1,etat2,i : integer; +begin + if Affevt then affiche('ComboBoxAdr7',clyellow); + i:=ComboBoxAdr7.ItemIndex; + etat_SR(i,etat1,etat2); + labelCV13.Caption:='CV='+IntToSTR(etat1); + labelCV14.Caption:='CV='+IntToSTR(etat2); + feux[indexSig].SR[4].sortie1:=i; + maj_db; +end; + +procedure TFormSR.ComboBoxAdr8Change(Sender: TObject); +var etat1,etat2,i : integer; +begin + i:=ComboBoxAdr8.ItemIndex; + etat_SR(i,etat1,etat2); + labelCV15.Caption:='CV='+IntToSTR(etat1); + labelCV16.Caption:='CV='+IntToSTR(etat2); + feux[indexSig].SR[4].sortie0:=i; + maj_db; +end; + +procedure TFormSR.ComboBoxAdr9Change(Sender: TObject); +var etat1,etat2,i : integer; +begin + i:=ComboBoxAdr9.ItemIndex; + etat_SR(i,etat1,etat2); + labelCV17.Caption:='CV='+IntToSTR(etat1); + labelCV18.Caption:='CV='+IntToSTR(etat2); + feux[indexSig].SR[5].sortie1:=i; + maj_db; +end; + +procedure TFormSR.ComboBoxAdr10Change(Sender: TObject); +var etat1,etat2,i : integer; +begin + i:=ComboBoxAdr10.ItemIndex; + etat_SR(i,etat1,etat2); + labelCV19.Caption:='CV='+IntToSTR(etat1); + labelCV20.Caption:='CV='+IntToSTR(etat2); + feux[indexSig].SR[5].sortie0:=i; + maj_db; +end; + +procedure TFormSR.ComboBoxAdr11Change(Sender: TObject); +var etat1,etat2,i : integer; +begin + i:=ComboBoxAdr11.ItemIndex; + etat_SR(i,etat1,etat2); + labelCV21.Caption:='CV='+IntToSTR(etat1); + labelCV22.Caption:='CV='+IntToSTR(etat2); + feux[indexSig].SR[6].sortie1:=i; + maj_db; +end; + +procedure TFormSR.ComboBoxAdr12Change(Sender: TObject); +var etat1,etat2,i : integer; +begin + i:=ComboBoxAdr12.ItemIndex; + etat_SR(i,etat1,etat2); + labelCV23.Caption:='CV='+IntToSTR(etat1); + labelCV24.Caption:='CV='+IntToSTR(etat2); + feux[indexSig].SR[6].sortie0:=i; + maj_db; +end; + +procedure TFormSR.ComboBoxAdr13Change(Sender: TObject); +var etat1,etat2,i : integer; +begin + i:=ComboBoxAdr13.ItemIndex; + etat_SR(i,etat1,etat2); + labelCV25.Caption:='CV='+IntToSTR(etat1); + labelCV26.Caption:='CV='+IntToSTR(etat2); + feux[indexSig].SR[7].sortie1:=i; + maj_db; + +end; + +procedure TFormSR.ComboBoxAdr14Change(Sender: TObject); +var etat1,etat2,i : integer; +begin + i:=ComboBoxAdr14.ItemIndex; + etat_SR(i,etat1,etat2); + labelCV27.Caption:='CV='+IntToSTR(etat1); + labelCV28.Caption:='CV='+IntToSTR(etat2); + feux[indexSig].SR[7].sortie0:=i; + maj_db; +end; + +procedure TFormSR.ComboBoxAdr15Change(Sender: TObject); +var etat1,etat2,i : integer; +begin + i:=ComboBoxAdr15.ItemIndex; + etat_SR(i,etat1,etat2); + labelCV29.Caption:='CV='+IntToSTR(etat1); + labelCV30.Caption:='CV='+IntToSTR(etat2); + feux[indexSig].SR[8].sortie1:=i; + maj_db; + +end; + +procedure TFormSR.ComboBoxAdr16Change(Sender: TObject); +var etat1,etat2,i : integer; +begin + i:=ComboBoxAdr16.ItemIndex; + etat_SR(i,etat1,etat2); + labelCV31.Caption:='CV='+IntToSTR(etat1); + labelCV32.Caption:='CV='+IntToSTR(etat2); + feux[indexSig].SR[8].sortie0:=i; + maj_db; +end; + +procedure TFormSR.ButtonOKClick(Sender: TObject); +begin + close; +end; + +procedure TFormSR.FormCreate(Sender: TObject); +var i : integer; +begin + for i:=0 to 19 do + begin + ComboBoxAdr1.items.add(etats[i]); + ComboBoxAdr2.items.add(etats[i]); + ComboBoxAdr3.items.add(etats[i]); + ComboBoxAdr4.items.add(etats[i]); + ComboBoxAdr5.items.add(etats[i]); + ComboBoxAdr6.items.add(etats[i]); + ComboBoxAdr7.items.add(etats[i]); + ComboBoxAdr8.items.add(etats[i]); + ComboBoxAdr9.items.add(etats[i]); + ComboBoxAdr10.items.add(etats[i]); + ComboBoxAdr11.items.add(etats[i]); + ComboBoxAdr12.items.add(etats[i]); + ComboBoxAdr13.items.add(etats[i]); + ComboBoxAdr14.items.add(etats[i]); + ComboBoxAdr15.items.add(etats[i]); + ComboBoxAdr16.items.add(etats[i]); + end; +end; + +end. + diff --git a/UnitSimule.dcu b/UnitSimule.dcu index 1c8043b..8b01d5d 100644 Binary files a/UnitSimule.dcu and b/UnitSimule.dcu differ diff --git a/UnitTCO.dcu b/UnitTCO.dcu index 18c8fed..fe1f050 100644 Binary files a/UnitTCO.dcu and b/UnitTCO.dcu differ diff --git a/UnitTCO.pas b/UnitTCO.pas index 2b0004d..be46709 100644 --- a/UnitTCO.pas +++ b/UnitTCO.pas @@ -260,7 +260,7 @@ type const ZoomMax=50; - MaxCellX=100;MaxCellY=50; + MaxCellX=150;MaxCellY=70; type diff --git a/VerifVersion.dcu b/VerifVersion.dcu deleted file mode 100644 index 5e258cf..0000000 Binary files a/VerifVersion.dcu and /dev/null differ diff --git a/VerifVersion.pas b/VerifVersion.pas deleted file mode 100644 index ffa9909..0000000 --- a/VerifVersion.pas +++ /dev/null @@ -1,130 +0,0 @@ -unit VerifVersion; - -interface -//procedure verifie_version; - -uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, - Dialogs, StdCtrls , ComCtrls ,WinInet; - -procedure verifie_version; - -implementation - -function GetCurrentProcessEnvVar(const VariableName: string): string; -var - nSize: DWord; -begin - nSize:= 0; - nSize:= GetEnvironmentVariable(PChar(VariableName), nil, nSize); - if nSize = 0 then - begin - result:= ''; - end - else - begin - SetLength(result, nSize - 1); - if GetEnvironmentVariable(PChar(VariableName), PChar(result), nSize) <> nSize - 1 then - raise Exception.Create(SysErrorMessage(GetlastError)) - end; -end; - - -function DownloadURL_NOCache(aUrl: string;s : string): Boolean; -var - hSession: HINTERNET; - hService: HINTERNET; - Fs:TFileStream; - lpBuffer: array[0..1024 + 1] of byte; - dwBytesRead: DWORD; -begin - Result := False; - - Try Fs := TFileStream.Create(s,fmCreate); - hSession := InternetOpen('MyApp', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0); - try - if Assigned(hSession) then - begin - hService := InternetOpenUrl(hSession, PChar(aUrl), nil, 0, INTERNET_FLAG_RELOAD, 0); - if Assigned(hService) then - try - while True do - begin - dwBytesRead := 1024; - InternetReadFile(hService, @lpBuffer, 1024, dwBytesRead); - fs.WriteBuffer(lpBuffer, dwBytesRead); - if dwBytesRead = 0 then break; - end; - Result := True; - finally - InternetCloseHandle(hService); - end; - end; - finally - InternetCloseHandle(hSession); - end; - finally - fs.Free; - end; -end; - - -procedure verifie_version; -var s,s2,Url,LocalFile : string; - trouve : boolean; - fichier : text; - i : integer; - V_publie,V_utile : real; -begin - Url:='http://cdmrail.free.fr/ForumCDR/viewtopic.php?f=77&t=3906#p50499'; - LocalFile:='page.txt'; - trouve:=false; - if DownloadURL_NOCache(Url,localFile) then - begin - AssignFile(fichier,LocalFile); - reset(fichier); - while not(eof(fichier) or trouve) do - begin - readln(fichier,s); - s:=UpperCase(s); - //Affiche(s,clyellow); - i:=pos('VERSION ',s); - trouve:=i<>0; - end; - closefile(fichier); - if trouve then - begin - delete(s,1,i+7); - i:=pos('VERSION ',s); - i:=pos(' ',s); - s:=copy(s,1,i-1); - //Affiche('Version '+s,clgreen); - // changer le . en , - i:=pos('.',s);s[i]:=','; - s2:=version; - i:=pos('.',s2);s2[i]:=','; - - V_publie:=StrToFloat(s); - V_utile:=StrToFloat(s2); - if V_utile',s)+6;i2:=posEx('
',s,i+1); + i:=pos('bold">',s)+6;i2:=posEx('
',s,i+1); i3:=posEx('',s,i+1) ; if i<>6 then begin //Affiche(s,clred); inc(ncomm); + if i3