diff --git a/ConfigGenerale.cfg b/ConfigGenerale.cfg index 2437f25..45275e6 100644 --- a/ConfigGenerale.cfg +++ b/ConfigGenerale.cfg @@ -1,4 +1,5 @@ -/ Fichier de configuration de signaux_complexes_GL version 8.79 +/ Fichier de configuration de signaux_complexes_GL version 9.6 +Chemin_progCDM= LargeurF=1120 HauteurF=681 OffsetX=128 @@ -6,15 +7,15 @@ OffsetY=28 LargeurFC=250 HauteurFC=250 OffsetXC=998 -OffsetYC=427 -Splitter=531 +OffsetYC=431 +Splitter=533 AvecVerifIconesTCO=0 Algo_localisation=1 Max_Signal_Sens=5 -Mode_reservation=0 -Avec_roulage=1 Debug=0 Mode_Sombre=0 +debugRoulage=0 +AffLoc=0 coul_fond=000040 serveurIPCDM_Touche=0 Port_Serveur=4500 @@ -23,7 +24,7 @@ nCantonsRes=2 AntiTimeoutEthLenz=0 TempoTC=3 Fonte=10 -Style=3 +Style=1 Protocole=1 Verif_AdrXpressNet=1 IpV4_PC=127.0.0.1:9999 @@ -36,14 +37,16 @@ Entete=1 Init_Aig=1 PilotageTrainsCDMNom=1 Init_Dem_Aig=0 -Tempo_Aig=200 +Tempo_Aig=30 +MaxParcours=80 +MaxRoutes=5000 Init_demUSBCOM=0 -Init_demETH=0 +Init_demETH=1 Fenetre=0 Ecran=1 AffMemoFenetre=1 nb_det_dist=3 -verif_version=0 +verif_version=1 notif_version=0 TCO=1 NbreTCO=1 @@ -57,7 +60,7 @@ Nom_fichier_TCO7=TCO7.CFG Nom_fichier_TCO8=TCO8.CFG Nom_fichier_TCO9=TCO9.CFG Nom_fichier_TCO10=TCO10.CFG -MasqueBandeauTCO=0 +MasqueBandeauTCO=1 CDM=0 Lay=RESEAU_GILY_SIGNAL_AJOUTE.LAY NomModuleCDM=reseau_gily_signal_ajoute_top.cdm @@ -68,74 +71,67 @@ RazSignaux=0 AigND=0 Tempo_Feu=100 Nb_cantons_Sig=3 +AffSig=1 +AffRes=0 +AvecAck=0 +Option_demiTour=0 Alg_Unisemaf=1 -ModeResa=0 /------------ [section_aig] -1,P518,D100D,S3P,V30,I0,INIT(1,2),C0 -2,P12S,D519,S100S,V0,I0,INIT(2,2),C0 -3,P1S,D4P,S5D,V0,I0,INIT(2,2),C0 -4,P3D,D6S,S514,V0,I0,INIT(2,2),C0 -5,P515,D3S,S100S,V0,I0,INIT(1,2),C0 -6,P516,D0,S4D,V0,I0,INIT(1,2),C0 -7,P527,D519,S520,V30,I0,INIT(1,2),C0 +1,P518,D100D,S3P,V30,I0,INIT(2,1),C0 +2,P12S,D519,S100S,V0,I0,INIT(2,1),C0 +3,P1S,D4P,S5D,V0,I0,INIT(2,1),C0 +4,P3D,D6S,S514,V0,I0,INIT(2,1),C0 +5,P515,D3S,S100S,V0,I0,INIT(1,1),C0 +6,P516,D0,S4D,V0,I0,INIT(1,1),C0 +7,P527,D519,S520,V30,I0,INIT(1,1),C0 8,P527,D521,S103S,V0,I0,INIT(2,2),C0 9,P526,D103D,S515,V60,I0,INIT(1,2),C0 10,P101S,D29P,S528,V30,I0,INIT(1,2),C0 -11,P18P,D30D,S101D,V0,I0,INIT(2,2),C0 +11,P18P,D30D,S101D,V0,I0,INIT(1,2),C0 12,P517,D20S,S2P,V0,I0,INIT(1,2),C0 -17,P525,D535,S528,V0,I0,INIT(1,4),C0 +17,P525,D535,S528,V0,I0,INIT(1,2),C0 18,P11P,D23P,S102S,V0,I0,INIT(1,2),C0 19,P101S,D102D,S531,V0,I0,INIT(1,2),C0 -20,P520,D21P,S12D,V0,I0,INIT(1,2),C0 +20,P520,D21P,S12D,V0,I0,INIT(2,2),C0 21,P20D,D28S,S28D,V0,I0,INIT(2,2),C0 -22,P102D,D537,S32P,V0,I0,INIT(2,2),C0 -23,P18D,D538,S534,V0,I0,INIT(2,2),C0 +22,P102D,D537,S105D,V0,I0,INIT(2,2),C0 +23,P18D,D105D,S534,V0,I0,INIT(2,2),C0 24,P538,D32S,S533,V0,I0,INIT(1,2),C0 25,P104S,D529,S27P,V0,I0,INIT(2,2),C0 -26TJD,D(530,28D),S(529,28S),V0,I0,INIT(2,2),E4,C0 +26TJD,D(530,28D),S(529,28S),V0,I0,INIT(1,2),E4,C0 27,P25S,D530,S537,V0,I0,INIT(1,2),C0 -28TJD,D(21D,26D),S(21S,26S),V0,I0,INIT(2,2),E4,C0 +28TJD,D(21D,26D),S(21S,26S),V0,I0,INIT(1,2),E4,C0 29,P10D,D513,S30S,V60,I0,INIT(2,2),C0 30,P524,D11D,S29S,V0,I0,INIT(2,2),C0 31,P534,D34D,S104S,V0,I0,INIT(1,2),C0 -32,P22S,D34S,S24D,V0,I0,INIT(1,2),C0 -34,P0,D31D,S32D,V0,I0,INIT(2,2),C0 +32,P105S,D104D,S24D,V0,I0,INIT(1,2),C0 +34,P0,D31D,S104D,V0,I0,INIT(2,2),C0 100CROI,D(1D,523),S(2S,5S),C0 101CROI,D(11S,525),S(19P,10P),C0 102CROI,D(22P,19D),S(517,18S),C0 103CROI,D(513,9D),S(522,8S),C0 -104CROI,D(0,32D),S(25P,31S),C0 +104CROI,D(34S,32D),S(25P,31S),C0 +105CROI,D(32P,22S),S(538,23D),C0 0 /------------ [section_branches] -A2,A12,517,A102,A18,A11,A30,524,521,A8,527,A7,519,A2 -A7,520,A20,A12 +A2,A12,517,A102,A18,A11,A30,524,521,A8,T812,527,T833,T888,A7,T800,519,A2 A1,A3,A4,514,522,A103,A8 -A1,A100,523,526,A9,A103,513,A29,A10,A101,A19,531,518,A1 +A1,A100,T813,523,T801,526,A9,A103,513,A29,A10,A101,A19,531,518,A1 A9,515,A5 A11,A101,525,A17,528,A10 -A17,535,533,A24,538,A23 -A7,520,A20,A21,A28,A26,530,A27,A25,A104,A31,534,A23,A18 -A26,529,A25,A104 +A17,535,533,A24,538,A105,A23 +A7,T899,520,T815,A20,A21,A28,A26,T835,530,A27,A25,A104,A31,534,A23,A18 +A26,T836,529,A25,A104 A22,537,A27,A25 -A22,A32,A24 +A22,A105,A32,A24 A6,516,0 A31,A34,0 0 /------------ [section_decodeurs] / décodeur n°1 -Nom_dec_pers=Personnalise1 -NombreAdresses=4 -Nation=2 -Commande=0 -Periph=0 -1,2,0,1,2 -3,4,1,1,2 -5,9,2,1,2 -7,8,3,1,2 -/ décodeur n°2 Nom_dec_pers=grand NombreAdresses=8 Nation=1 @@ -149,7 +145,7 @@ Periph=0 0,0,0,0,0 0,0,0,0,0 0,0,0,0,0 -/ décodeur n°3 +/ décodeur n°2 Nom_dec_pers=decodeur com NombreAdresses=10 Nation=1 @@ -157,13 +153,13 @@ Commande=1 Periph=1 carré,car sémaphore,sem -sémaphore cli,semcli +rouge cli,semcli vert, vert cli, violet, blanc, blanc cli, -jaune, +avertissement, jaune cli, ralen 30, ralen 60, @@ -174,7 +170,7 @@ rappel 30 + jaune, rappel 30 + jaune cli, rappel 60 + jaune, rappel 60 + jaune cli, -/ décodeur n°4 +/ décodeur n°3 Nom_dec_pers=decodeur USB Belge NombreAdresses=10 Nation=2 @@ -221,21 +217,19 @@ Clignote, 420,7,0,1,(529,A25,530,A27,537,A27),1,FVC1,FRC1 448,7,0,1,(533,A24),1,FVC0,FRC0 462,9,0,1,(513,A29),1,FVC0,FRC0 -476,9,0,1,(538,A23),1,FVC0,FRC0 -497,9,0,4,(531,A19),1,FVC0,FRC0 +476,9,0,1,(538,A105),1,FVC0,FRC0 +497,9,0,4,(531,A19),1,FVC0,FRC0,U14,L1 520,9,1,1,(518,A1),1,FVC0,FRC0,(A1S,A3S,A5S),CFB(A1S,A3D,A4D,A6S) 620,7,0,0,(521,A8),1,FVC0,FRC0 -800,9,0,2,(521,A8),0,FVC0,FRC0,MOT(1,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),NA5 +820,4,0,0,(519,A7),0,FVC0,FRC0 0 /------------ [section_PN] -(516-513,515-516),PN(2,ferme,ouvre,0),1,1 0 /------------ [section_actions] Action 3,D4,800,1,traindecl,B1,C5,12,12,13,45,N3,A10,1,30,traindest,A2,1,A8,1 -Action 5,D1,12,30,B1,C3,162,30,tagadah,N1,A4,1,15,2,Z -klaxon_temporisé,D8,330,0,B1,C6,330,CC406526,N2,A14,1,50,A12,1,4,300,CC406526 +Action 5,D1,12,30,B1,C3,162,30,TGV,N1,A4,1,15,2,Z 0 /------------ [section_dcc++] @@ -247,24 +241,24 @@ AdrBaseDetDccpp=513 0 /------------ [section_trains] -BB25531,1,120,60,50,BB67000.BMP,5,0 -TGV,2,120,80,60,TGV.BMP,6,0 -BB16024,3,120,100,60,BB16024.BMP,7,0 -CC406526,4,120,60,40,CC406526.BMP,10,0 -CAMERA,6,120,0,0,EAD.BMP,8,0 +BB25531,1,120,60,50,BB67000.BMP,5,0,0,0,0,0,0.00,0.00,0.00,0,0,0 +TGV,2,120,80,60,TGV.BMP,6,0,0,0,0,0,0.00,0.00,0.00,0,0,0 +BB16024,3,120,100,60,BB16024.BMP,7,0,0,0,0,0,0.00,0.00,0.00,0,0,0 +CC406526,4,120,100,80,CC406526.BMP,10,0,0,0,0,0,0.00,0.00,0.00,0,0,0 +[route_par_pont],0 +{519->2droit->12dev->517->102crois->18dev->11dev->101crois->525->17dev->528->10dev->101crois->19dev->531->518->1droit->100crois->523} +CAMERA,6,120,0,0,EAD.BMP,8,0,0,0,0,0,0.00,0.00,0.00,0,0,0 0 /------------ [section_placement] BB25531,0,0,0 -TGV,7,1,0 +TGV,0,0,0 BB16024,0,0,0 -CC406526,9,2,0 +CC406526,9,1,0 CAMERA,0,0,0 0 /------------ [section_accCOMUSB] -Socket,0,0,0,0,0,0,0,192.1.2.250:150 -Nouveau ,0,0,0,1,1,0,0,COM15:9600,N,8,1 0 /------------ [section horloge] @@ -278,3 +272,73 @@ RetourHeure=10 RetourMinute=7 DureeMinute=1 0 +/------------ +[section_actionneurs] +800,519,527 +801,523,526 +802,0,0 +803,0,0 +804,0,0 +805,0,0 +806,0,0 +807,0,0 +808,0,0 +810,0,0 +811,0,0 +812,0,0 +813,0,0 +814,0,0 +815,0,0 +816,0,0 +817,0,0 +818,0,0 +819,0,0 +820,0,0 +821,0,0 +822,0,0 +823,0,0 +824,0,0 +825,0,0 +826,0,0 +827,0,0 +828,0,0 +829,0,0 +830,0,0 +831,0,0 +832,0,0 +833,0,0 +834,0,0 +835,0,0 +836,0,0 +837,0,0 +0 +/------------ +[section_detecteurs] +513,43,0,0 +514,18,0,0 +515,67,0,0 +516,150,0,0 +517,60,0,0 +518,56,0,0 +519,66,0,0 +520,73,0,0 +521,85,0,0 +522,120,0,0 +523,84,0,0 +524,67,0,0 +525,153,0,0 +526,84,0,0 +527,84,0,0 +528,150,0,0 +529,77,0,0 +530,90,0,0 +531,28,0,0 +533,127,0,0 +534,92,0,0 +535,134,0,0 +537,115,0,0 +538,93,0,0 +0 +/------------ +[section_logique] +0 diff --git a/Notice d'utilisation des signaux_complexes_GL_V9.5.pdf b/Notice d'utilisation des signaux_complexes_GL_V9.6.pdf similarity index 80% rename from Notice d'utilisation des signaux_complexes_GL_V9.5.pdf rename to Notice d'utilisation des signaux_complexes_GL_V9.6.pdf index 1a57fd7..9ff76e5 100644 Binary files a/Notice d'utilisation des signaux_complexes_GL_V9.5.pdf and b/Notice d'utilisation des signaux_complexes_GL_V9.6.pdf differ diff --git a/UnitConfig.dfm b/UnitConfig.dfm index 3f960c7..492b4f3 100644 --- a/UnitConfig.dfm +++ b/UnitConfig.dfm @@ -1,6 +1,6 @@ object FormConfig: TFormConfig - Left = 414 - Top = 95 + Left = 251 + Top = 102 Hint = 'Modifie la configuration selon les s'#233'lections choisies' BorderStyle = bsDialog Caption = 'Configuration g'#233'n'#233'rale' @@ -665,7 +665,7 @@ object FormConfig: TFormConfig TabOrder = 0 OnClick = ButtonAppliquerEtFermerClick end - object Button2: TButton + object ButtonFSE: TButton Left = 8 Top = 520 Width = 201 @@ -675,14 +675,14 @@ object FormConfig: TFormConfig ParentShowHint = False ShowHint = True TabOrder = 1 - OnClick = Button2Click + OnClick = ButtonFSEClick end object PageControl: TPageControl Left = 8 Top = 8 Width = 633 Height = 505 - ActivePage = TabSheetSig + ActivePage = TabSheetFonctions Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -11 @@ -861,7 +861,7 @@ object FormConfig: TFormConfig Top = 150 Width = 28 Height = 21 - Hint = #39'Num'#233'ro d'#39#39#233'cran sur lequel Signaux_Complexes s'#39'ouvrira' + Hint = 'Num'#233'ro d'#39#233'cran sur lequel Signaux_Complexes s'#39'ouvrira' EditLabel.Width = 173 EditLabel.Height = 13 EditLabel.Caption = 'Ouvrir Signaux_Complexes sur '#233'cran' @@ -1985,8 +1985,8 @@ object FormConfig: TFormConfig OnClick = ButtonAjSupClick end object ListBoxAig: TListBox - Left = 0 - Top = 56 + Left = 8 + Top = 64 Width = 305 Height = 377 Color = clBlack @@ -2362,7 +2362,7 @@ object FormConfig: TFormConfig Width = 137 Height = 21 Style = csDropDownList - ItemHeight = 13 + ItemHeight = 0 TabOrder = 1 OnChange = ComboBoxDecChange end @@ -2493,7 +2493,7 @@ object FormConfig: TFormConfig Width = 137 Height = 21 Style = csDropDownList - ItemHeight = 13 + ItemHeight = 0 TabOrder = 2 OnChange = ComboBoxAspChange end @@ -3008,6 +3008,287 @@ object FormConfig: TFormConfig end end end + object TabSheetFonctions: TTabSheet + Caption = 'Fonctions' + ImageIndex = 14 + object Label63: TLabel + Left = 16 + Top = 16 + Width = 136 + Height = 16 + Caption = 'Fonctions logiques ' + Font.Charset = DEFAULT_CHARSET + Font.Color = clBlack + Font.Height = -13 + Font.Name = 'MS Sans Serif' + Font.Style = [fsBold] + ParentFont = False + end + object LabelFonction: TLabel + Left = 24 + Top = 408 + Width = 41 + Height = 13 + Caption = 'Fonction' + end + object GroupBoxLogique: TGroupBox + Left = 8 + Top = 72 + Width = 609 + Height = 321 + Caption = 'D'#233'clencheur / Condition logique' + TabOrder = 0 + object Label59: TLabel + Left = 288 + Top = 80 + Width = 47 + Height = 13 + Caption = 'Op'#233'rateur' + end + object Label60: TLabel + Left = 440 + Top = 80 + Width = 38 + Height = 13 + Caption = 'Variable' + end + object TreeViewL: TTreeView + Left = 16 + Top = 72 + Width = 265 + Height = 233 + Hint = 'Hint' + Images = ImageListLogic + Indent = 19 + ParentShowHint = False + PopupMenu = PopupMenuFL + ReadOnly = True + ShowHint = True + TabOrder = 0 + OnChange = TreeViewLChange + end + object ButtonAjouteVar: TButton + Left = 456 + Top = 136 + Width = 105 + Height = 25 + Caption = 'Ajouter variable' + TabOrder = 1 + OnClick = ButtonAjouteVarClick + end + object ComboBoxOperateur: TComboBox + Left = 288 + Top = 96 + Width = 137 + Height = 21 + ItemHeight = 13 + TabOrder = 2 + OnChange = ComboBoxOperateurChange + OnDrawItem = ComboBoxOperateurDrawItem + end + object ButtonAjouteOperateur: TButton + Left = 504 + Top = 128 + Width = 105 + Height = 25 + Hint = 'Ajoute un op'#233'rateur au m'#234'me niveau que le parent' + Caption = 'Ajouter op'#233'rateur' + ParentShowHint = False + ShowHint = True + TabOrder = 3 + Visible = False + OnClick = ButtonAjouteOperateurClick + end + object ButtonVoir: TButton + Left = 480 + Top = 280 + Width = 113 + Height = 25 + Caption = 'Affiche structure' + TabOrder = 4 + WordWrap = True + OnClick = ButtonVoirClick + end + object ComboBoxVar: TComboBox + Left = 440 + Top = 96 + Width = 161 + Height = 21 + ItemHeight = 13 + ParentShowHint = False + ShowHint = True + TabOrder = 5 + OnChange = ComboBoxVarChange + OnDrawItem = ComboBoxVarDrawItem + end + object PanelAcc: TPanel + Left = 288 + Top = 184 + Width = 305 + Height = 73 + TabOrder = 6 + object LabelEtat: TLabel + Left = 240 + Top = 4 + Width = 19 + Height = 13 + Caption = 'Etat' + end + object LabeledEditDCC: TLabeledEdit + Left = 40 + Top = 20 + Width = 41 + Height = 21 + EditLabel.Width = 92 + EditLabel.Height = 13 + EditLabel.Caption = 'Adresse accessoire' + TabOrder = 0 + OnChange = LabeledEditDCCChange + end + object LabeledEditEtatAcc: TLabeledEdit + Left = 160 + Top = 20 + Width = 41 + Height = 21 + EditLabel.Width = 19 + EditLabel.Height = 13 + EditLabel.Caption = 'Etat' + TabOrder = 1 + OnChange = LabeledEditEtatAccChange + end + object SpinEditEtat: TSpinEdit + Left = 240 + Top = 19 + Width = 33 + Height = 22 + MaxValue = 2 + MinValue = 0 + TabOrder = 2 + Value = 0 + OnChange = SpinEditEtatChange + end + object LabeledEditTrain: TLabeledEdit + Left = 160 + Top = 44 + Width = 113 + Height = 21 + Hint = 'Nom du train sur le d'#233'tecteur/actionneur' + EditLabel.Width = 24 + EditLabel.Height = 13 + EditLabel.Hint = 'Train sur le d'#233'tecteur ou sur l'#39'actionneur, ou aucun train' + EditLabel.Caption = 'Train' + EditLabel.ParentShowHint = False + EditLabel.ShowHint = True + LabelPosition = lpRight + TabOrder = 3 + OnChange = LabeledEditTrainChange + end + end + object ButtonSupLog: TButton + Left = 288 + Top = 280 + Width = 75 + Height = 25 + Hint = 'Supprime l'#39#233'l'#233'ment s'#233'lectionn'#233' et ses '#233'ventuels enfants' + Caption = 'Supprimer' + ParentShowHint = False + ShowHint = True + TabOrder = 7 + OnClick = ButtonSupLogClick + end + object ComboBoxFL: TComboBox + Left = 16 + Top = 32 + Width = 145 + Height = 21 + Style = csDropDownList + ItemHeight = 13 + TabOrder = 8 + OnChange = ComboBoxFLChange + end + object ButtonEvalue: TButton + Left = 384 + Top = 280 + Width = 75 + Height = 25 + Hint = + 'Evaluation de la fonction en fonction de '#233'tats, et affichage de ' + + 'la fonction en litt'#233'ral' + Caption = 'Evalue' + ParentShowHint = False + ShowHint = True + TabOrder = 9 + OnClick = ButtonEvalueClick + end + object LabeledEditNomLog: TLabeledEdit + Left = 344 + Top = 32 + Width = 121 + Height = 21 + EditLabel.Width = 126 + EditLabel.Height = 13 + EditLabel.Caption = 'Nom de la fonction logique' + LabelPosition = lpRight + LabelSpacing = 10 + TabOrder = 10 + OnChange = LabeledEditNomLogChange + end + object ButtonAjOpEnfant: TButton + Left = 304 + Top = 136 + Width = 105 + Height = 25 + Hint = 'Ajoute un op'#233'rateur ' + Caption = 'Ajouter op'#233'rateur' + ParentShowHint = False + ShowHint = True + TabOrder = 11 + WordWrap = True + OnClick = ButtonAjOpEnfantClick + end + object LabeledEditNumFonc: TLabeledEdit + Left = 184 + Top = 32 + Width = 33 + Height = 21 + EditLabel.Width = 93 + EditLabel.Height = 13 + EditLabel.Caption = 'Num'#233'ro de fonction' + LabelPosition = lpRight + LabelSpacing = 5 + TabOrder = 12 + OnChange = LabeledEditNumFoncChange + end + end + object RichEdit1: TRichEdit + Left = 216 + Top = 16 + Width = 377 + Height = 49 + Lines.Strings = ( + + 'Les fonctions logiques servent de d'#233'clencheurs pour les actions ' + + 'et les ' + + 'conditions. Elles permettent de r'#233'aliser des combinaisons logiqu' + + 'es d'#39#233'lements ' + 'divers comme l'#39#233'tat des aiguillages, d'#233'tecteurs etc...') + ReadOnly = True + TabOrder = 1 + end + object ButtonNouvFL: TButton + Left = 16 + Top = 40 + Width = 75 + Height = 25 + Hint = 'Cr'#233#233'e une fonction logique' + Caption = 'Nouveau' + ParentShowHint = False + ShowHint = True + TabOrder = 2 + OnClick = ButtonNouvFLClick + end + end object TabSheetActionneurs: TTabSheet Caption = 'Actionneurs' ImageIndex = 7 @@ -4089,11 +4370,11 @@ object FormConfig: TFormConfig Top = 64 Width = 41 Height = 21 - EditLabel.Width = 119 + EditLabel.Width = 171 EditLabel.Height = 13 - EditLabel.Caption = 'Vitesse 1 - lente : 0 crans' + EditLabel.Caption = 'Coefficient vitesse 1 - lente : 0 crans' LabelPosition = lpLeft - LabelSpacing = 60 + LabelSpacing = 30 TabOrder = 0 OnChange = LabeledEditV1Change end @@ -4102,11 +4383,11 @@ object FormConfig: TFormConfig Top = 88 Width = 41 Height = 21 - EditLabel.Width = 95 + EditLabel.Width = 147 EditLabel.Height = 13 - EditLabel.Caption = 'Vitesse 2 - moyenne' + EditLabel.Caption = 'Coefficient vitesse 2 - moyenne' LabelPosition = lpLeft - LabelSpacing = 60 + LabelSpacing = 30 TabOrder = 1 OnChange = LabeledEditV2Change end @@ -4115,11 +4396,11 @@ object FormConfig: TFormConfig Top = 112 Width = 41 Height = 21 - EditLabel.Width = 81 + EditLabel.Width = 133 EditLabel.Height = 13 - EditLabel.Caption = 'Vitesse 3 - rapide' + EditLabel.Caption = 'Coefficient vitesse 3 - rapide' LabelPosition = lpLeft - LabelSpacing = 60 + LabelSpacing = 30 TabOrder = 2 OnChange = LabeledEditV3Change end @@ -4895,4 +5176,441 @@ object FormConfig: TFormConfig OnClick = ModifActionClick end end + object PopupMenuFL: TPopupMenu + Left = 588 + Top = 224 + object M1: TMenuItem + Caption = 'Monter' + OnClick = M1Click + end + object Descendre1: TMenuItem + Caption = 'Descendre' + OnClick = Descendre1Click + end + object N4: TMenuItem + Caption = '-' + end + object Supprimer2: TMenuItem + Caption = 'Supprimer' + OnClick = Supprimer2Click + end + object N5: TMenuItem + Caption = '-' + end + object outdployer1: TMenuItem + Caption = 'Tout d'#233'ployer' + OnClick = outdployer1Click + end + object outcontracter1: TMenuItem + Caption = 'Tout contracter' + OnClick = outcontracter1Click + end + end + object ImageListLogic: TImageList + Left = 664 + Top = 72 + Bitmap = { + 494C010108000900040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 + 0000000000003600000028000000400000003000000001002000000000000030 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000800000000000000000000000800000000000000080000000 + 8000000080000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000080000000000000008000000000000000800000000000000000000000 + 8000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000080000000000000008000000000000000800000000000000000000000 + 80000000000000000000000000000000000000000000000000000000FF000000 + FF000000FF000000FF000000FF000000FF000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000080000000000000008000000000000000800000000000000080000000 + 80000000000000000000000000000000000000000000000000000000FF000000 + FF000000FF000000FF000000FF000000FF000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000800000000000000000000000800000000000000000000000 + 8000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008080000080800000808000008080 + 0000808000008080000080800000808000008080000080800000808000008080 + 0000808000008080000080800000808000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008080000080800000808000008080 + 0000808000008080000080800000808000008080000080800000808000008080 + 0000808000008080000080800000808000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008080000000000000000000000000 + 0000808000008080000080800000000000000000000000000000808000008080 + 0000000000000000000000000000808000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008080000000000000808000008080 + 0000000000008080000000000000808000008080000080800000808000000000 + 0000808000008080000080800000808000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008080000000000000808000008080 + 0000000000008080000000000000808000008080000080800000808000000000 + 0000808000008080000080800000808000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008080000000000000808000008080 + 0000000000008080000000000000808000008080000080800000808000000000 + 0000808000008080000080800000808000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008080000000000000000000000000 + 0000808000008080000080800000000000000000000000000000808000008080 + 0000000000000000000000000000808000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008080000080800000808000008080 + 0000808000008080000080800000808000008080000080800000808000008080 + 0000808000008080000080800000808000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008080000080800000808000008080 + 0000808000008080000080800000808000008080000080800000808000008080 + 0000808000008080000080800000808000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000FFFF0000FFFF0000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000FFFF0000FFFF0000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000FFFF0000FFFF0000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 + 0000000000008000000000000000000000000000000000000000000000000000 + 0000800000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000FFFF00000000000000000000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 + 000000000000000000000000000000FFFF000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000008000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000FFFF00000000000000000000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 + 000000000000000000000000000000FFFF000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000FFFF00000000000000000000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF00000000000000000000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000FFFF00000000000000000000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF00000000000000000000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 + 0000000000000000000080000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000FFFF00000000000000000000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF00000000000000000000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 + 0000000000000000000000000000000000008000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000FFFF0000000000000000000000 + 0000000000000000000000FFFF0000FFFF00000000000000000000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 + 0000000000000000000000000000800000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000FFFF0000000000000000000000 + 0000000000000000000000FFFF0000FFFF00000000000000000000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 + 0000000000000000000080000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000FFFF00000000000000000000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF00000000000000000000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000FFFF00000000000000000000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF00000000000000000000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 + 0000000000000000000080000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000FFFF0000000000000000000000 + 000000000000000000000000000000FFFF00000000000000000000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 + 0000000000000000000000000000000000000000000080000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000FFFF0000000000000000000000 + 000000000000000000000000000000FFFF00000000000000000000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000FFFF0000FFFF0000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000FFFF0000FFFF0000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000424D3E000000000000003E000000 + 2800000040000000300000000100010000000000800100000000000000000000 + 000000000000000000000000FFFFFF0000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000FFFFFFFFFE7FFE7FFB47FFFFFE7FFE7F + F56FFFFFFE7FFE7FF56FC0FFFE7FFE7FF54FC0FFFE7FFE7FFB6FFFFFFE7FFE7F + FFFFFFFFFE7FFE7F0000B6DBFE7FFE0000000000FE7FFE000000B6DBFE7FFE7F + 00000000FE7FFE7F0000B6DBFE7FFE7F0000FFFFFE7FFE7F0000FFFFFE7FFE7F + 0000FFFFFE7FFE7F0000FFFFFE7FFE7F0000FFFFFFFFFFFF0000F837F9FFFFFF + 0000F387FCFFFC3F0000E7CFF27FF00F0000E78FF93FE3870000F327FC9FE7E7 + 0000F87FFE7FCFF30000FE7FFF3FCFF30000FC3FFE7FCFF30000F99FFCFFCFF3 + 0000F99FF9FFE7E70000F99FF3FFE3C70000FC3FFFFFF00F0000FFFFFFFFFC3F + 0000FFFFFFFFFFFF0000FFFFFFFFFFFF00000000000000000000000000000000 + 000000000000} + end end diff --git a/UnitConfig.pas b/UnitConfig.pas index 276e939..84d12a9 100644 --- a/UnitConfig.pas +++ b/UnitConfig.pas @@ -6,10 +6,10 @@ uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls , jpeg, ComCtrls ,StrUtils, Unitprinc, MMSystem, Buttons , UnitPareFeu, verif_version, Menus, ClipBrd, - Grids , unitHorloge + Grids , unitHorloge, spin {$IF CompilerVersion >= 28.0} - ,Vcl.Themes, CheckLst + ,Vcl.Themes, CheckLst, ImgList {$IFEND} ; @@ -422,6 +422,42 @@ type LabelNumeroP: TLabel; Prox1: TLabeledEdit; Prox2: TLabeledEdit; + TabSheetFonctions: TTabSheet; + GroupBoxLogique: TGroupBox; + Label59: TLabel; + Label60: TLabel; + TreeViewL: TTreeView; + ButtonAjouteVar: TButton; + ComboBoxOperateur: TComboBox; + ButtonAjouteOperateur: TButton; + ButtonVoir: TButton; + ComboBoxVar: TComboBox; + PanelAcc: TPanel; + LabeledEditDCC: TLabeledEdit; + LabeledEditEtatAcc: TLabeledEdit; + ButtonSupLog: TButton; + PopupMenuFL: TPopupMenu; + M1: TMenuItem; + Descendre1: TMenuItem; + N4: TMenuItem; + Supprimer2: TMenuItem; + N5: TMenuItem; + outdployer1: TMenuItem; + outcontracter1: TMenuItem; + ImageListLogic: TImageList; + Label63: TLabel; + ComboBoxFL: TComboBox; + ButtonFSE: TButton; + RichEdit1: TRichEdit; + ButtonNouvFL: TButton; + ButtonEvalue: TButton; + LabeledEditNomLog: TLabeledEdit; + LabelEtat: TLabel; + SpinEditEtat: TSpinEdit; + ButtonAjOpEnfant: TButton; + LabelFonction: TLabel; + LabeledEditNumFonc: TLabeledEdit; + LabeledEditTrain: TLabeledEdit; procedure ButtonAppliquerEtFermerClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure ListBoxAigMouseDown(Sender: TObject; Button: TMouseButton; @@ -459,7 +495,7 @@ type procedure ComboBoxDDChange(Sender: TObject); procedure EditLChange(Sender: TObject); procedure CheckBoxFBClick(Sender: TObject); - procedure Button2Click(Sender: TObject); + procedure ButtonFSEClick(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure EditP3KeyPress(Sender: TObject; var Key: Char); procedure EditP4KeyPress(Sender: TObject; var Key: Char); @@ -636,6 +672,32 @@ type procedure CbAigClick(Sender: TObject); procedure Prox1Change(Sender: TObject); procedure Prox2Change(Sender: TObject); + procedure ButtonSupLogClick(Sender: TObject); + procedure ComboBoxOperateurDrawItem(Control: TWinControl; + Index: Integer; Rect: TRect; State: TOwnerDrawState); + procedure ButtonAjouteVarClick(Sender: TObject); + procedure ButtonAjouteOperateurClick(Sender: TObject); + procedure ButtonVoirClick(Sender: TObject); + procedure M1Click(Sender: TObject); + procedure Descendre1Click(Sender: TObject); + procedure TreeViewLChange(Sender: TObject; Node: TTreeNode); + procedure outdployer1Click(Sender: TObject); + procedure outcontracter1Click(Sender: TObject); + procedure ComboBoxOperateurChange(Sender: TObject); + procedure ComboBoxVarChange(Sender: TObject); + procedure ComboBoxVarDrawItem(Control: TWinControl; Index: Integer; + Rect: TRect; State: TOwnerDrawState); + procedure LabeledEditDCCChange(Sender: TObject); + procedure LabeledEditEtatAccChange(Sender: TObject); + procedure ButtonNouvFLClick(Sender: TObject); + procedure ComboBoxFLChange(Sender: TObject); + procedure ButtonEvalueClick(Sender: TObject); + procedure Supprimer2Click(Sender: TObject); + procedure LabeledEditNomLogChange(Sender: TObject); + procedure SpinEditEtatChange(Sender: TObject); + procedure ButtonAjOpEnfantClick(Sender: TObject); + procedure LabeledEditNumFoncChange(Sender: TObject); + procedure LabeledEditTrainChange(Sender: TObject); private { Déclarations privées } @@ -755,12 +817,31 @@ section_accCOM_ch='[section_accCOMUSB]'; section_horloge_ch='[section horloge]'; section_actionneurs_ch='[section_actionneurs]'; section_detecteurs_ch='[section_detecteurs]'; +section_logique_ch='[section_logique]'; rep_icones='icones'; +// indice des icones donc des fonctions +FoncVAR=0; +//-------- +OpET=1; +OpOU=2; +OpNON=3; +//------- +EtatDCC=4; +EtatDet=5; +NomVAR='Fonction logique'; +NomOpET='Opérateur ET'; +NomOpOU='Opérateur OU'; +NomOpNON='Opérateur NON'; +NomEtatDCC='Etat DCC'; +NomEtatDet='Etat détect./actionn.'; +NomFonc : array[0..5] of string[25]=(NomVar,NomOpET,NomOpOu,NomOpNon,NomEtatDCC,NomEtatDet); + + var FormConfig: TFormConfig; - AdresseIPCDM,AdresseIP,PortCom,recuCDM,residuCDM,RepConfig : string; //,trainsauve : string; + AdresseIPCDM,AdresseIP,PortCom,recuCDM,residuCDM,RepConfig : string; portCDM,TempoOctet,TimoutMaxInterface,Valeur_entete,PortInterface,prot_serie,NumPort,debug, LigneCliqueePN,AncLigneCliqueePN,clicMemo,Nb_cantons_Sig,protocole,Port,PortServeur, @@ -769,12 +850,14 @@ var Algo_localisation,Verif_AdrXpressNet,ligneclicTrain,AncligneclicTrain,AntiTimeoutEthLenz, ligneDCC,decCourant,AffMemoFenetre,ligneClicAccPeriph,AncligneClicAccPeriph,ligneCherche, compt_Ligne,Style_aff,Ancien_Style,Ecran_SC,Max_Signal_Sens,nCantonsRes,ligneClicActionneur, - TempoTC,Nbuttoirs,AncLigneClicActionneur,AncligneclicDet,ligneclicDet : integer; + TempoTC,Nbuttoirs,AncLigneClicActionneur,AncligneclicDet,ligneclicDet,foncCourante, + NbreFL,IdOperateur : integer; ack_cdm,clicliste,config_modifie,clicproprietes,confasauver,trouve_MaxPort, modif_branches,ConfigPrete,trouve_section_dccpp,trouve_section_trains,trouve_section_acccomusb, trouveAvecVerifIconesTCO,Affiche_avert,activ,trouve_section_dec_pers,Z21,AffAigND, - PilotageTrainsCDMNom,LanceHorl,AffSig,AffRes,avecAck,affLoc : boolean; + PilotageTrainsCDMNom,LanceHorl,AffSig,AffRes,avecAck,affLoc,changeCom, + clicTree : boolean; fichier : text; @@ -828,6 +911,8 @@ function encode_Periph(index : integer) : string; procedure ajoute_champs_combos(i : integer); function verif_trains : boolean; procedure Maj_icone_train(IImage : Timage;index :integer); +function evalue_fonction(NumFonc : integer;var formule : string) : boolean; +procedure fabrique_treeview(k : integer); implementation @@ -1808,6 +1893,7 @@ begin DeclDemarTrain : s:=s+intToSTR(Tablo_Action[i].adresse)+','+Tablo_Action[i].trainDecl+','; DeclArretTrain : s:=s+intToSTR(Tablo_Action[i].adresse)+','+Tablo_Action[i].trainDecl+','; DeclSignal : s:=s+intToSTR(Tablo_Action[i].adresse)+','+intToSTR(Tablo_Action[i].etat)+','; + DeclFonction : s:=s+intToSTR(Tablo_Action[i].adresse)+','; end; // conditions @@ -1823,6 +1909,7 @@ begin condHorl : s:=s+intToSTR(Tablo_Action[i].TabloCond[j].HeureMin)+','+intToSTR(Tablo_Action[i].TabloCond[j].MinuteMin)+','+ intToSTR(Tablo_Action[i].TabloCond[j].HeureMax)+','+intToSTR(Tablo_Action[i].TabloCond[j].MinuteMax)+','; condTrainSig : s:=s+intToSTR(Tablo_Action[i].TabloCond[j].adresse)+','+Tablo_Action[i].TabloCond[j].train+','; + condFonction : s:=s+intToSTR(Tablo_Action[i].TabloCond[j].adresse)+','; end; end; @@ -2399,6 +2486,27 @@ begin end; writeln(fichierN,'0'); + writeln(fichierN,'/------------'); + writeln(fichierN,section_logique_ch); + for j:=1 to NbreFL do + begin + writeln(fichierN,'/--- fonction '+intToSTR(j)); + writeln(FichierN,'"'+NomFonction[j]+'"'); // ajouter les guillemets pour éviter chaine vide + n:=fonction[j,0].adresse; + for i:=0 to n-1 do + begin + s:=intToSTR(i)+','+nomfonc[fonction[j,i].typ]+','; + s:=s+'N'+intToSTR(fonction[j,i].niveau)+','; + s:=s+'T'+intToSTR(fonction[j,i].typ)+','; + s:=s+'A'+intToSTR(fonction[j,i].adresse)+','; + s:=s+'E'+intToSTR(fonction[j,i].etat)+','; + s:=s+'V'+','+fonction[j,i].train+','; + Writeln(fichierN,s); + end; + Writeln(fichierN,'FF'); // marqueur fin de fonction + end; + writeln(fichierN,'0'); + closefile(fichierN); end; @@ -2437,6 +2545,12 @@ begin end; end; end; + for i:=1 to NDetecteurs do + begin + temp:=adresse_detecteur[i]; + detecteur[temp].index:=i; + end; + end; procedure trier_actionneurs; @@ -2600,6 +2714,92 @@ begin result:=c; end; +function isOperateur(typ : integer): boolean; +begin + result:=(typ>=OpET) and (typ<=OpNON); +end; + +function isVariable(typ : integer): boolean; +begin + result:=(typ>=EtatDCC) and (typ<=EtatDet); +end; + +// donne le texte à mettre dans le tree view en fonction de l'index de fonction[] +// attention fonction[].typ doit être à jour +function texte_tv(fonc,i : integer) : string; +var s : string; + etat,typ : integer; +begin + if i=0 then typ:=0 else typ:=fonction[fonc,i].typ; // pour l'indice 0, le type n'est pas significatif + + s:=NomFonc[typ]+' '; + if typ=FoncVar then + begin + s:=NomVar+' '+IntToSTR(fonction[fonc,0].niveau); // delphi 12 n'accepte pas les tableaux de constante avec le 1er indice à 0 (NomFonc) + end; + if isVariable(typ) then + begin + if typ=EtatDCC then + begin + s:=s+intToSTR(fonction[fonc,i].adresse); + etat:=fonction[fonc,i].etat; + case etat of + 1 : s:=s+' dévié '; + 2 : s:=s+' droit '; + else s:=s+' inconnu '; + end; + s:=s+'('+intToSTR(etat)+')'; + end; + if typ=EtatDet then + begin + s:=s+fonction[fonc,i].train+' '+intToSTR(fonction[fonc,i].adresse)+' '+intToSTR(fonction[fonc,i].etat); + end; + end; + result:=s; +end; + +function texte_simple_tv(fonc,i : integer) : string; +var s : string; + etat,typ : integer; +begin + if i=0 then typ:=0 else typ:=fonction[fonc,i].typ; // pour l'indice 0, le type n'est pas significatif + + if typ=FoncVar then + begin + s:=s+IntToSTR(fonction[fonc,0].niveau); + end; + + if isVariable(typ) then + begin + if typ=EtatDCC then + begin + s:=s+intToSTR(fonction[fonc,i].adresse); + etat:=fonction[fonc,i].etat; + case etat of + 1 : s:=s+' dévié '; + 2 : s:=s+' droit '; + else s:=s+' inconnu '; + end; + end; + if typ=EtatDet then + begin + s:=s+intToSTR(fonction[fonc,i].adresse)+' '+intToSTR(fonction[fonc,i].etat); + end; + end; + + if isOperateur(typ) then + begin + case typ of + opET : s:=s+'ET'; + opOU : s:=s+'OU'; + opNON: s:=s+'NON'; + end; + end; + + result:=s; +end; + + procedure lit_config; var train,s,sa,SOrigine: string; c : char; @@ -3212,6 +3412,11 @@ var train,s,sa,SOrigine: string; if (i<0) or (i>1) then i:=0; Tablo_Action[maxtablo_act].Etat:=i; end; + DeclFonction : + begin + Val(s,i,erreur);Delete(s,1,erreur); // adresse + Tablo_Action[maxtablo_act].adresse:=i; + end; end; @@ -3279,6 +3484,11 @@ var train,s,sa,SOrigine: string; else sa:=s; Tablo_Action[maxtablo_act].tabloCond[k].train:=sa; end; + CondFonction : + begin + Val(s,i,erreur);Delete(s,1,erreur); // adresse + Tablo_Action[maxtablo_act].TabloCond[k].adresse:=i; + end; end; end; end; @@ -3866,7 +4076,7 @@ var train,s,sa,SOrigine: string; while s[1]=' ' do begin delete(s,1,1); - end; + end; if ((s[1]='-') or (s[1]='}')) and not bug then begin routePref[j][i].typ:=det;routePref[j][i].pos:=0;end else begin @@ -4307,6 +4517,78 @@ var train,s,sa,SOrigine: string; until (sOrigine='0') or (s=''); end; + procedure compile_fonctions; + var posv,v,i,erreur : integer; + ss : string; + ligne : boolean; + begin + nbreFL:=0; + idOperateur:=0; + lit_ligne; + repeat // boucle des fonctions + i:=pos('"',sOrigine); + if i<>0 then delete(sOrigine,i,1); // supprime les guillemets + i:=pos('"',sOrigine); + if i<>0 then delete(sOrigine,i,1); + i:=0; + NomFonction[NbreFL+1]:=sOrigine; + lit_ligne; + ligne:=false; + repeat // boucle de la fonction + if (s<>'0') and (s<>'') then + begin + posv:=pos(',',s); + // 0,Variables,N0,T0 + ss:=copy(s,1,posv-1); // indice , non compilé + delete(s,1,posv); + + posv:=pos(',',s); + ss:=copy(s,1,posv-1); // texte du type , non compilé + delete(s,1,posv); + + Delete(s,1,1); // supprime N + val(s,v,erreur); + Fonction[NbreFL+1,i].niveau:=v; + Delete(s,1,erreur); + + Delete(s,1,1); // supprime T + val(s,v,erreur); + delete(s,1,erreur); + Fonction[NbreFL+1,i].typ:=v; + inc(idOperateur); + ArbreFonc[idOperateur,0]:=i; + + Delete(s,1,1); // supprime A + val(s,v,erreur); + delete(s,1,erreur); + Fonction[NbreFL+1,i].adresse:=v; + + Delete(s,1,1); // supprime E + val(s,v,erreur); + delete(s,1,erreur); + Fonction[NbreFL+1,i].etat:=v; + + j:=pos('V,',s); + if j<>0 then delete(s,1,2); + j:=pos(',',s); + Fonction[NbreFL+1,i].train:=copy(s,1,j-1); + + inc(i); + lit_ligne; + ligne:=true; + end; + until (s='FF') or (s='0') or (s=''); // fin de fonction + c:='Z'; + if s='FF' then + repeat + readln(fichier,s); + sOrigine:=s; + if length(s)>0 then c:=s[1]; + until (c<>'/') or (s='') or eof(fichier) ; + + if ligne then inc(nbreFL); + until (s='0') or (s='') ; // fin des fonctions + end; procedure compile_horloge; begin @@ -5273,6 +5555,13 @@ var train,s,sa,SOrigine: string; compile_detecteurs; end; + // section fonctions + sa:=uppercase(section_logique_ch); + if pos(sa,s)<>0 then + begin + compile_fonctions; + end; + inc(it); until (eof(fichier)); @@ -5468,7 +5757,6 @@ end; // génère les informations calculées procedure genere_informations_BD; -var tabloDet : TTabloDet; begin renseigne_TJDs_TCO; trier_aig; @@ -6271,13 +6559,137 @@ begin end; end; +Procedure tout_deployer; +var i : integer; +begin + for i:=0 to Formconfig.TreeViewL.Items.Count-1 do + begin + formconfig.TreeViewL.Items[i].Expand(true); + end; +end; + +// fabrique le tree view depuis la fonction k +procedure fabrique_treeview(k : integer); +var n,niveau,niveauPrec,j,i,idVar,typ : integer; + node,nodePrec : Ttreenode; + s : string; +begin + if (k=0) or (k>NbreFL) then exit; + formConfig.TreeViewL.Items.Clear; + nodePrec:=formConfig.TreeViewL.Items.add(nil,texte_tv(k,0)); // Node origine + // niv 0 + idOperateur:=0; + idVar:=0; + n:=fonction[k,0].adresse; + for i:=1 to n-1 do + begin + begin + if i>1 then niveauPrec:=fonction[k,i-1].niveau // niveau précédent attention pour l'indice 0 c'est le numéro de fonction + else NiveauPrec:=1; + niveau:=fonction[k,i].niveau; + + s:=texte_tv(k,i); + + // créer le nouveau node + if niveau>niveauPrec then node:=formconfig.TreeViewL.items.addchild(nodePrec,s); + if niveau=niveauPrec then node:=formconfig.TreeViewL.items.add(nodePrec,s); + if niveaui then Affiche('Erreur 784 : Fonction'+intToSTR(k)+': discordance '+intToSTR(Node.AbsoluteIndex)+' / '+intToSTR(i),clred); + end; + + typ:=fonction[k,i].typ; + + node.ImageIndex:=typ; + node.SelectedIndex:=typ; + + {if isOperateur(typ) then + begin + inc(idOperateur); + idVar:=0; + ArbreFonc[idOperateur,0]:=i; + end; + if isVariable(typ) then + begin + inc(idVar); + ArbreFonc[idOperateur,idVar]:=i; + end;} + + if node.parent<>nil then + begin + fonction[k,i].Indexprec:=node.Parent.AbsoluteIndex; + end + else fonction[k,i].Indexprec:=0; + + nodePrec:=node; + end; + end; + for i:=1 to 5 do + for j:=1 to 4 do + begin + // Affiche('ArbreFonc['+intToSTR(i)+','+intToSTR(j)+']='+inttostr(arbreFonc[i,j]),clOrange); + end; + tout_deployer; +end; + + procedure TFormConfig.FormCreate(Sender: TObject); -var i,j,x,y,l,LongestLength,PixelLength : integer; +var i,j,x,y,l,k,LongestLength,PixelLength : integer; cs,s,LongestString : string; begin if AffEvt or (debug=1) then Affiche('Création fenêtre config',clLime); + ButtonVoir.Visible:=not(diffusion); + LabeledEditTrain.Visible:=not(diffusion); + TabSheetActionneurs.TabVisible:=not(diffusion); // invisible / visible + TabSheetFonctions.Visible:=AvecLogique; + TreeViewL.HideSelection:=false; + TreeViewL.Images:=ImageListLogic; + + with SpinEditEtat do + begin + Top:=19; + Left:=160; + Visible:=false; + text:='1'; + MaxValue:=2; + Hint:='Etat de l''accessoire'+#13+ + '1=dévié'+#13+ + '2=droit'; + ShowHint:=true; + end; + + LabelEtat.Top:=4; + LabelEtat.Left:=160; + LabelEtat.Visible:=false; + + with ComboBoxOperateur do + begin + Style:=csOwnerDrawFixed; + clear; + itemHeight:=18; // hauteur des icones + items.add(nomopET); + items.add(NomOpOU); + //items.add(NomOpNON); + end; + + with ComboBoxVar do + begin + Style:=csOwnerDrawFixed; + clear; + itemHeight:=18; // hauteur des icones + items.add(NomEtatDCC); + items.add(NomEtatDet); + end; + s:=GetCurrentDir; if not(directoryExists(rep_icones)) then CreateDir(rep_icones); @@ -6301,12 +6713,14 @@ begin PageControl.ActivePage:=Formconfig.TabSheetCDM; // force le premier onglet sur la page PageControlTR.ActivePage:=FormConfig.TabSheetTrGen; ButtonImRCDM.Hint:='Importation des actionneurs depuis le fichier '+#13+NomModuleCDM; + foncCourante:=1; Aig_supprime.Adresse:=0; Signal_Supprime.Adresse:=0; Signal_sauve.adresse:=0; AncLigneCliqueePN:=-1; lignecliqueePN:=-1; clicListe:=false; + changeCom:=false; ligneCherche:=0; Compt_ligne:=0; ConfigPrete:=true; @@ -7296,10 +7710,21 @@ begin ligneClicAccPeriph:=-1; AncligneClicAccPeriph:=-1; + fabrique_treeview(1); + ComboBoxFL.Clear; + for i:=1 to NbreFL do ComboBoxFL.Items.Add(NomVAR+' '+IntToSTR(i)); + + if NbreFL<>0 then + begin + changeCom:=true; + ComboBoxFL.ItemIndex:=0; + LabeledEditNomLog.text:=nomFonction[1]; + LabeledEditNumFonc.text:=intToSTR(Fonction[1,0].niveau); + changeCom:=false; + end; couleurs_config; end; - // décode un morceau d'une chaine d'aiguillage ('P5S') // // si erreur, B='?' @@ -8011,6 +8436,7 @@ begin if s='' then begin ligneclicAig:=-1; + clicListe:=false; exit; end; @@ -9806,7 +10232,6 @@ begin // supprimer le signal i Affiche('Supprime signal '+intToSTR(Signaux[i].adresse),clOrange); - formconfig.ListBoxSig.Items.Delete(i-1); Signaux[i].Img.free; // supprime l'image, ce qui efface le signal du tableau graphique @@ -12311,7 +12736,7 @@ begin end; end; -procedure TFormConfig.Button2Click(Sender: TObject); +procedure TFormConfig.ButtonFSEClick(Sender: TObject); begin close; end; @@ -12791,17 +13216,20 @@ begin With LabeledEditV1 do begin - EditLabel.Caption:='Vitesse 1 - Lente '+intToSTR(Trains[index].ConsV1)+' crans :'; + EditLabel.Caption:='Coefficient vitesse 1 - Lente '+intToSTR(Trains[index].ConsV1)+' crans :'; + LabelSpacing:=20; Text:=FloatToSTRF(Trains[index].coeffV1,ffFixed,5,2,FormatSettings); end; With LabeledEditV2 do begin - EditLabel.Caption:='Vitesse 2 - Moyenne '+intToSTR(Trains[index].ConsV2)+' crans :'; + EditLabel.Caption:='Coefficient vitesse 2 - Moyenne '+intToSTR(Trains[index].ConsV2)+' crans :'; + LabelSpacing:=20; Text:=FloatToSTRF(Trains[index].coeffV2,ffFixed,5,2,FormatSettings); end; With LabeledEditV3 do begin - EditLabel.Caption:='Vitesse 3 - Rapide '+intToSTR(Trains[index].ConsV3)+' crans :'; + EditLabel.Caption:='Coefficient vitesse 3 - Rapide '+intToSTR(Trains[index].ConsV3)+' crans :'; + LabelSpacing:=20; Text:=FloatToSTRF(Trains[index].coeffV3,ffFixed,5,2,FormatSettings); end; @@ -13026,7 +13454,6 @@ begin repeat if formconfig.ListBoxTrains.selected[i-1] then begin - for j:=i to ntrains-1 do begin formconfig.ListBoxTrains.selected[j-1]:=formconfig.ListBoxTrains.selected[j]; @@ -16245,6 +16672,937 @@ begin formconfig.ListBoxActionneurs.selected[ligneclicActionneur]:=true; end; +// gestion des fonctions ------------------- +// https://wiki.freepascal.org/TTreeView + +// supprime un élément index d'une fonction fonc dans le tableau fonction[][] +procedure supprime_element_fonction(fonc,index : integer); +var i,n : integer; +begin + n:=fonction[fonc,0].adresse; + for i:=index to n-1 do + begin + fonction[fonc,i]:=fonction[fonc,i+1]; + end; + if fonction[fonc,0].adresse>0 then dec(fonction[fonc,0].adresse); +end; + + +procedure TFormConfig.LabeledEditEtatAccChange(Sender: TObject); +var node : tTreenode; + i,v,erreur : integer; + s : string; +begin + if ClicTree then exit; + node:=TreeViewL.Selected; + if node=nil then exit; + i:=node.AbsoluteIndex; + + config_modifie:=true; + val(LabeledEditEtatAcc.text,v,erreur); + fonction[foncCourante,i].etat:=v; + s:=texte_tv(foncCourante,i); + node.Text:=s; +end; + + +procedure TFormConfig.LabeledEditDCCChange(Sender: TObject); +var node : tTreenode; + i,v,erreur : integer; + s : string; +begin + if clicTree then exit; + + node:=TreeViewL.Selected; + if node=nil then exit; + i:=node.AbsoluteIndex; + + config_modifie:=true; + val(LabeledEditDCC.text,v,erreur); + fonction[foncCourante,i].adresse:=v; + s:=texte_tv(foncCourante,i); + node.Text:=s; +end; + + +procedure TformConfig.outdployer1Click(Sender: TObject); +begin + tout_deployer; +end; + +procedure TFormConfig.ComboBoxVarDrawItem(Control: TWinControl; + Index: Integer; Rect: TRect; State: TOwnerDrawState); +begin + comboboxVar.canvas.fillrect(rect); + + // dessine l'icone + imagelistLogic.Draw(comboBoxVar.Canvas,rect.left,rect.top,Index+EtatDCC); //+1 car on commence à 1 + + // ecrit le texte + comboboxVar.canvas.textout(rect.left+imagelistLogic.width+2,rect.top, + comboboxVar.items[index]); +end; + +procedure TFormConfig.ComboBoxVarChange(Sender: TObject); +var node : tTreenode; + i,Fnode,inode : integer; +begin + if clicListe then exit; + node:=TreeViewL.Selected; + if assigned(node) then + begin + i:=ComboBoxVar.ItemIndex; + inode:=node.AbsoluteIndex; + Fnode:=node.ImageIndex; + // si le node est une fonction logique ET OU NON + //if (Fnode>=EtatDCC) and (Fnode<=EtatDet) and (i+OpNON+1>=EtatDCC) and (i+OpNON+1<=EtatDet) then + if isVariable(Fnode) then //and isVariable(i+opNON) then + begin + fonction[foncCourante,inode].typ:=i+etatDCC; + node.Text:=texte_tv(foncCourante,inode); + node.ImageIndex:=i+etatDCC; + node.SelectedIndex:=i+etatDCC; + + if i+EtatDCC=EtatDet then + begin + LabeledEditTrain.Visible:=true; + LabeledEditDCC.EditLabel.Caption:='Adresse'; + end; + if i+EtatDCC=EtatDCC then + begin + LabeledEditTrain.Visible:=false; + LabeledEditDCC.EditLabel.Caption:='Adresse accessoire'; + end; + + end; + end; +end; + +procedure TFormConfig.ComboBoxOperateurChange(Sender: TObject); +var node : tTreenode; + i,inode,Fnode : integer; +begin + if clicListe then exit; + node:=TreeViewL.Selected; + if assigned(node) then + begin + i:=ComboBoxOperateur.ItemIndex+1; + inode:=node.AbsoluteIndex; + Fnode:=node.ImageIndex; + // si le node est un opérateur ET OU NON + //if (Fnode>=OpET) and (Fnode<=OpNON) and (i>=OpET) and (i<=OpNON) then + if isOperateur(Fnode) and (isOperateur(i)) then + begin + fonction[foncCourante,inode].typ:=i; + node.Text:=texte_tv(foncCourante,inode); + node.ImageIndex:=i; + node.SelectedIndex:=i; + end; + end; +end; + + +procedure TFormConfig.outcontracter1Click(Sender: TObject); +var i : integer; +begin + for i:=0 to TreeViewL.Items.Count-1 do + begin + TreeViewL.Items[i].Collapse(true); + end; +end; + +procedure TFormConfig.TreeViewLChange(Sender: TObject; Node: TTreeNode); +// cliqué ou sélectionné un node +var i,inode,typ : integer; +begin + if Assigned(Node) then + begin + clicTree:=true; + i:=node.ImageIndex; + inode:=node.AbsoluteIndex; + //Affiche('Le node '+intToSTR(iNode)+' est '+node.Text+' image='+intToSTR(node.ImageIndex),clYellow); + if i=foncVar then + begin + + TreeViewL.hint:='Numéro de fonction logique'; + ComboBoxVar.Enabled:=false; + ComboBoxOperateur.Enabled:=false; + LabelEtat.visible:=false; + SpineditEtat.visible:=false; + ButtonAjouteOperateur.Enabled:=false; + ButtonAjOpEnfant.Enabled:=true; + ButtonAjoutevar.enabled:=false; + PanelAcc.Visible:=false; + typ:=fonction[foncCourante,inode+1].typ; + if node.HasChildren then + ButtonAjOpEnfant.Enabled:=false + else + ButtonAjOpEnfant.Enabled:=true; + end + else ButtonAjoutevar.enabled:=true; + + if isOperateur(i) then + begin + // interdire montée descente menu + PopupMenuFL.Items[0].Enabled:=false; + PopupMenuFL.Items[1].Enabled:=false; + + TreeViewL.hint:='Opérateur logique'; + ComboBoxVar.Enabled:=false; + LabelEtat.visible:=false; + SpineditEtat.visible:=false; + LabeledEditEtatAcc.visible:=false; + LabeledEditTrain.visible:=false; + + ComboBoxOperateur.Enabled:=true; + ComboBoxOperateur.ItemIndex:=i-1; + PanelAcc.Visible:=false; + ButtonAjOpEnfant.Enabled:=true; + //if i=1 then ButtonAjOpEnfant.Enabled:=false else ButtonAjOpEnfant.Enabled:=true; + + clicTree:=false; + exit; + end; + + if isVariable(i) then + begin + // autoriser montée descente menu + PopupMenuFL.Items[0].Enabled:=true; + PopupMenuFL.Items[1].Enabled:=true; + + + TreeViewL.hint:='état logique'; + PanelAcc.Visible:=true; + + ComboBoxVar.Enabled:=true; + ComboBoxOperateur.Enabled:=false; + ComboBoxVar.ItemIndex:=i-EtatDCC; + ButtonAjoutevar.enabled:=true; + LabeledEditTrain.visible:=true; + ButtonAjOpEnfant.Enabled:=false; // on ne peut pas ajouter d'opérateur sur une variable + + if i=EtatDCC then + begin + LabelEtat.Visible:=true; + SpinEditEtat.Visible:=true; + LabeledEditEtatACC.Visible:=false; + LabeledEditTrain.visible:=false; + PanelAcc.Visible:=true; + LabeledEditDCC.Text:=intToSTR(fonction[foncCourante,iNode].adresse); + LabeledEditDcc.EditLabel.Caption:='Adresse accessoire'; + SpinEditEtat.Value:=fonction[foncCourante,iNode].etat; + end; + + if i=EtatDet then + begin + LabelEtat.Visible:=false; + LabeledEditTrain.visible:=true; + LabeledEditTrain.Text:=fonction[foncCourante,iNode].train; + SpinEditEtat.Visible:=false; + LabeledEditEtatACC.Visible:=true; + LabeledEditDcc.Text:=intToSTR(fonction[foncCourante,iNode].adresse); + LabeledEditDcc.EditLabel.Caption:='Adresse'; + LabeledEditEtatAcc.Text:=intToSTR(fonction[foncCourante,iNode].etat); + end; + end; + end; + clicTree:=false; +end; + + // insère une entrée dans le tableau fonction à l'indice index, et remplit niveau et fonc +procedure insersion(k,index,niveau,fonc : integer); +var i : integer; +begin + for i:=fonction[k,0].adresse-1 downto index do + begin + fonction[k,i+1]:=fonction[k,i]; + end; + fonction[k,index].niveau:=niveau; + fonction[k,index].typ:=fonc; +end; + +procedure insersion_simple(k,index : integer); +var i : integer; +begin + for i:=fonction[k,0].adresse-1 downto index do + begin + fonction[k,i+1]:=fonction[k,i]; + end; +end; + +procedure TFormConfig.Descendre1Click(Sender: TObject); +var nodeA,nodeB : tTreeNode; + idA,idB : integer; + fonc : Tfonction; +begin + nodeA:=TreeviewL.Selected; + if nodeA<>nil then + // s'assurer que le suivant est un node frère + if nodeA.GetNextSibling <> nil then + // si oui le descendre + // naAdd, naAddFirst, naAddChild, naAddChildFirst, naInsert + // naAdd The new or relocated node becomes the last sibling of the other node. + // naAddFirst The new or relocated node becomes the first sibling of the other node. + // naInsert The new or relocated node becomes the sibling immediately before the other node. + // naAddChild The new or relocated node becomes the last child of the other node. + // naAddChildFirst The new or relocated node becomes the first child of the other node. Non reconnu en D7 + begin + nodeB:=nodeA.GetNextSibling; + {$IF CompilerVersion >= 28.0} // si delphi>=11 + TreeviewL.Selected.MoveTo(nodeB,naAddChildFirst); + {$ELSE} + TreeviewL.Selected.MoveTo(nodeB,naAdd); + {$IFEND} + idA:=nodeA.AbsoluteIndex; + idB:=nodeB.AbsoluteIndex; + fonc:=fonction[foncCourante,iDA]; + fonction[foncCourante,idA]:=fonction[foncCourante,idB]; + fonction[foncCourante,idB]:=fonc; + config_modifie:=true; + end; +end; + +// monter le node +procedure TFormConfig.M1Click(Sender: TObject); +var nodeA,nodeB : tTreeNode; + idA,idB : integer; + fonc : Tfonction; +begin + nodeA:=TreeviewL.Selected; + if(nodeA<>nil) then + // Asssure qu'il y a un node frère au dessus + if nodeA.GetPrevSibling <> nil then + // oui le monter + begin + nodeB:=nodeA.GetPrevSibling; // celui du dessus + idA:=nodeA.AbsoluteIndex; // origine + idB:=nodeB.AbsoluteIndex; // destination + fonc:=Fonction[foncCourante,idA]; // sauver le node origine + TreeviewL.Selected.MoveTo(nodeB,naInsert); + nodeB:=treeViewL.Items[idB]; + + insersion_simple(fonccourante,idB); + // remplir + fonction[foncCourante,idB]:=fonc; + // ajuster le niveau + fonction[foncCourante,idB].niveau:=TreeViewL.items[idB].Level+1; + // ajuster le parent + fonction[foncCourante,idB].Indexprec:=TreeViewL.items[idB].Parent.AbsoluteIndex; + + end; +end; + +procedure TFormConfig.ButtonVoirClick(Sender: TObject); +var i,n : integer; + s : string; +begin +{ Affiche('tableau treeview---------',clOrange); + for i:=0 to TreeViewL.Items.Count-1 do + begin + s:=inttoSTR(i)+' '+TreeViewL.Items[i].Text; + s:=s+' Niveau='; + s:=s+intToSTR(TreeViewL.Items[i].Level); + if TreeViewL.Items[i].IsFirstNode then s:=s+' *'; + if TreeViewL.Items[i].HasChildren then s:=s+' ->'; + Affiche(s,clYellow); + end; +} + Affiche('tableau fonction----------',clOrange); + n:=fonction[foncCourante,0].adresse; + for i:=0 to n-1 do + begin + s:=inttoSTR(i)+' '+NomFonc[fonction[foncCourante,i].typ]; + if i=0 then s:=s+' Nombre='+intToSTR(Fonction[foncCourante,i].adresse)+' Numéro=' + else s:=s+' Niveau='; + s:=s+intToSTR(fonction[foncCourante,i].niveau)+' idParent='+intToSTR(fonction[foncCourante,i].Indexprec); + if i<>0 then s:=s+' adr='+intToSTR(fonction[foncCourante,i].adresse)+' état='+intToSTR(fonction[foncCourante,i].etat); + if fonction[foncCourante,i].train<>'' then s:=s+' '+fonction[foncCourante,i].train; + Affiche(s,clYellow); + end; +end; + + +// trouve le parent d'un opérateur +procedure trouve_parent_OP(k,idNode : integer); +var j,niveau : integer; + node : TTreenode; +begin + niveau:=fonction[k,idnode].niveau; + // remonter au niveau précédent + j:=idNode; + repeat + dec(j); + until (j=0) or (fonction[k,j].niveau=niveau); + node:=formconfig.TreeViewL.Items[j]; + //if node.AbsoluteIndex<>i then Affiche('Erreur 784 : Fonction'+intToSTR(k)+': discordance '+intToSTR(Node.AbsoluteIndex)+' / '+intToSTR(idNode),clred); + if node.Parent<>nil then fonction[k,idNode].Indexprec:=node.Parent.AbsoluteIndex + else fonction[k,idNode].Indexprec:=node.AbsoluteIndex; +end; + +procedure TFormConfig.ButtonAjouteOperateurClick(Sender: TObject); +var node,NodeOrigine : Ttreenode; + n,inode,typ,inodeOrigine : integer; +begin + n:=TreeViewL.Items.Count; + if n>=95 then exit; + // premier + if n=0 then exit; + + nodeOrigine:=TreeViewL.Selected; + if nodeOrigine=nil then exit; + + // on ne peut pas ajouter un opérateur sur Variable ou opérateur sur index 0 ou 1 si il y a déja un enfant opérateur + inodeOrigine:=NodeOrigine.AbsoluteIndex; + typ:=fonction[foncCourante,inodeOrigine+1].typ; + if (inodeOrigine=0) and isOperateur(typ) then exit; + if inodeOrigine=0 then exit; + typ:=fonction[foncCourante,inodeOrigine].typ; + + Node:=TreeViewL.items.Add(nodeOrigine,NomFonc[1]) ; + config_modifie:=true; + + Node.ImageIndex:=1; + Node.SelectedIndex:=1; + NodeOrigine.Expand(true); + + inode:=node.AbsoluteIndex; + + if inode=95 then exit; + // premier + if n=0 then exit; + + nodeOrigine:=TreeViewL.Selected; + if nodeOrigine=nil then exit; + + inodeOrigine:=NodeOrigine.AbsoluteIndex; + + if iNodeOrigine=0 then ButtonAjOpEnfant.Enabled:=false; + + Node:=TreeViewL.items.AddChild(nodeOrigine,NomFonc[1]) ; + config_modifie:=true; + + Node.ImageIndex:=1; + Node.SelectedIndex:=1; + NodeOrigine.Expand(true); + + inode:=node.AbsoluteIndex; + + if inode0 then + begin + for i:=n to NbreFL-1 do + begin + fonction[i]:=fonction[i+1]; + NomFonction[i]:=NomFonction[i+1]; + end; + dec(NbreFL); + formconfig.ComboBoxFL.Clear; + for i:=1 to NbreFL do formconfig.ComboBoxFL.Items.Add(texte_tv(i,0)); + + formConfig.ComboBoxFL.ItemIndex:=-1; + end + else + Affiche('Erreur de suppression',clred); +end; + + + +// supprime un élément du treeview et de fonction[] +// la suppression peut changer les niveaux +procedure supprime_node; +var inode,NivOrigine,Niv : integer; + node,NodeOrigine : TtreeNode; + s : string; +begin + node:=formConfig.TreeViewL.Selected; + if node=nil then exit; + + inode:=node.AbsoluteIndex; + + if node.HasChildren then + begin + s:='Voulez vous supprimer l''élément ['+texte_tv(foncCourante,inode)+'] et ses enfants?'; + if Application.MessageBox(pchar(s),pchar('confirm'), MB_YESNO or MB_DEFBUTTON2 or MB_ICONQUESTION)=idNo then exit; + end; + + config_modifie:=true; + + if node.HasChildren then + begin + NivOrigine:=node.Level; + NodeOrigine:=node; + inode:=NodeOrigine.AbsoluteIndex; + Affiche('1.Supprime '+node.Text+' n='+intToSTR(NivOrigine)+' indexNode'+intToSTR(inode),clred); + Supprime_element_fonction(foncCourante,inode); + + Niv:=nivorigine+1; + while (niv>NivOrigine) and (node<>nil) do + begin + node:=node.GetNext; + if node<>nil then + begin + Niv:=node.Level; + if niv>NivOrigine then + begin + inode:=node.AbsoluteIndex; + Affiche('2.Supprime '+node.Text+' n='+intToSTR(Niv)+' indexNode'+intToSTR(inode),clred); + supprime_element_fonction(foncCourante,inode); + end; + end; + end; + nodeOrigine.delete; + //Affiche('il reste '+intToSTR(fonction[foncCourante,0].adresse),clYellow); + if fonction[foncCourante,0].adresse=0 then supprime_fonction(foncCourante); + exit; + end; + + node.Delete; + supprime_element_fonction(foncCourante,inode); + //Affiche('il reste '+intToSTR(fonction[foncCourante,0].adresse),clYellow); + if fonction[foncCourante,0].adresse=0 then supprime_fonction(foncCourante); +end; + +procedure TFormConfig.ButtonSupLogClick(Sender: TObject); +begin + supprime_node; +end; + +procedure TFormConfig.ButtonAjouteVarClick(Sender: TObject); +var NodeOrigine,node : Ttreenode; + n,j,inode,niveau : integer; +begin + n:=TreeViewL.Items.Count; + if (n=0) or (n>=95) then exit; + + node:=nil; + nodeOrigine:=TreeViewL.Selected; + if nodeOrigine=nil then exit; + + // si le node origine est un opérateur + if isOperateur(nodeOrigine.ImageIndex) then + begin + Node:=TreeViewL.items.AddChild(nodeOrigine,NomEtatDCC); + Node.ImageIndex:=EtatDCC; + Node.SelectedIndex:=EtatDCC; + NodeOrigine.Expand(true); + end; + // si le node origine est une variable + if isVariable(nodeOrigine.ImageIndex) then + begin + Node:=TreeViewL.items.Add(nodeOrigine,NomEtatDCC); + Node.ImageIndex:=EtatDCC; + Node.SelectedIndex:=EtatDCC; + NodeOrigine.Expand(true); + end; + config_modifie:=true; + if node=nil then exit; + + inode:=node.AbsoluteIndex; + // + if inode=100 then exit; + inc(NbreFL,1); + FoncCourante:=NbreFL; // nombre de fonctions + ComboBoxFL.Items.add(NomVAR+' '+intToSTR(NbreFL)); + ComboBoxFL.ItemIndex:=NbreFL-1; + LabeledEditNomLog.Text:=NomFonction[NbreFl]; + fonction[FoncCourante,0].niveau:=NbreFL; + fonction[FoncCourante,0].typ:=FoncVar; // identificateur de fonction + + fonction[foncCourante,0].adresse:=1; // nombre d'éléments + config_modifie:=true; + ButtonAjouteOperateur.enabled:=false; + ButtonAjOpEnfant.enabled:=true; + ButtonAjoutevar.enabled:=false; + + treeViewL.items.Clear; + TreeViewL.Items.add(nil,texte_tv(foncCourante,0)); + + LabeledEditNumFonc.Text:=intToSTR(fonction[FoncCourante,0].niveau); + +end; + +procedure TFormConfig.ComboBoxFLChange(Sender: TObject); +var i : integer; +begin + if changeCom or ClicTree then exit; + if affevt then Affiche('ComboBoxFL change',clyellow); + FoncCourante:=ComboBoxFL.itemIndex+1; + fabrique_treeview(FoncCourante); + + for i:=0 to TreeViewL.Items.Count-1 do + begin + TreeViewL.Items[i].Expand(true); + end; + + changeCom:=true; + LabelFonction.caption:=''; + LabeledEditNomLog.Text:=NomFonction[FoncCourante]; + LabeledEditNumFonc.Text:=intToSTR(fonction[FoncCourante,0].niveau); + changeCom:=false; +end; + +Function Etat_variable(k,i : integer): boolean ; +var pos,j,typ,adr : integer; + resultat : boolean; + train : string; +begin + adr:=fonction[k,i].adresse; + typ:=fonction[k,i].typ; + + if typ=EtatDCC then // si état DCC + begin + j:=index_aig(adr); + pos:=aiguillage[j].position; + result:=(pos=const_droit) and (fonction[k,i].etat=2) or (pos=const_devie) and (fonction[k,i].etat=1); // 1=dévié 2=droit + exit; + end; + + if typ=EtatDet then // si état détecteur / actionneur + begin + resultat:=detecteur[adr].Etat=(fonction[k,i].etat=1); + // ajouter ici si on teste un train sur détecteur + train:=fonction[k,i].train; + if train<>'' then + begin + //Affiche('Eval45 '+intToSTR(adr)+' '+Train,clwhite); + if detecteur[adr].Train<>train then resultat:=false; + end; + + result:=resultat; + exit; + end; +end; + +// donne le suivant de même niveau de même index précédent +function suivant_niveau(k,i : integer) : integer; +var node : Ttreenode; + n,idparent,Niveau : integer; + trouve : boolean; +begin + n:=fonction[k,0].adresse; + Niveau:=fonction[k,i].niveau; + idparent:=fonction[k,i].Indexprec; + repeat + inc(i); + trouve:=(fonction[k,i].niveau=niveau) and (fonction[k,i].IndexPrec=idparent); + until trouve or (i>=n-1); + + if trouve then result:=i else result:=-1; + +end; + +// évalue en récursif une branche d'opérateur de fonction +// k : numéro de fonction ; i : index dans l'arbre de la fonction ; compteur: compteur d'opérande de l'opérateur +function evalue_operateur(k,i,compteur : integer;var formule : string) : boolean; +var j,typ,typOP,niv,niveau,parent,suivant : integer; + debugFonction,resultatOP,resultat : boolean; + node : Ttreenode; + s : string; +begin + debugFonction:=false; + repeat + typ:=fonction[k,i].typ; + niveau:=fonction[k,i].niveau; + niv:=niveau; + fonction[k,i].traite:=true; + if debugFonction then Affiche(IntToSTR(i)+' traité',clyellow); + + if IsVariable(typ) then + begin + typOP:=fonction[k,i-1].typ; // type de l'opérande à l'index précédent + while isVariable(typ) and (niveau=niv) do + begin + if compteur=0 then resultat:=etat_variable(k,i) else // 1er état de la variable + begin + if typOP=opET then resultat:=etat_variable(k,i) and resultat; + if typOP=opOU then resultat:=etat_variable(k,i) or resultat; + end; + if compteur>0 then formule:=formule+', '; + formule:=formule+texte_simple_tv(k,i); + + if debugFonction then + begin + s:='Id='+intToSTR(i)+' '+texte_TV(k,i); + if resultat then s:=s+' 1' else s:=s+' 0'; + Affiche(s,clYellow); + end; + fonction[k,i].traite:=true; + //Affiche(IntToSTR(i)+' traité',clyellow); + + inc(i); + inc(compteur); + typ:=fonction[k,i].typ; + niv:=fonction[k,i].niveau; + end; + // on sort car on vient de rencontrer un niveau inférieur + if niv1 then formule:=formule+', '; + formule:=formule+texte_simple_tv(k,i)+'('; + fonction[k,i].traite:=true; + + inc(i); + resultatOP:=evalue_operateur(k,i,0,formule); //*********************** + dec(i); + + if debugFonction then + begin + s:='-------------Résultat de l''opérateur index '+intToSTR(i)+': '; + if resultatOP then s:=s+'R= 1' else s:=s+'R= 0'; + end; + + parent:=fonction[k,i].Indexprec; + typ:=fonction[k,parent].typ; + if compteur=0 then resultat:=resultatOP else + begin + if typ=opET then resultat:=resultat and resultatOP; + if typ=opOU then resultat:=resultat or resultatOP; + end; + inc(compteur); + if debugFonction then + begin + if resultat then s:=s+'résultat chainé R= 1' else s:=s+'résultat chainé R= 0'; + Affiche(s,clYellow); + end; + + if fonction[k,i].traite then + begin + //il faut le suivant au i de même niveau et de même précédent + suivant:=suivant_niveau(k,i); + if debugFonction then Affiche('Suivant à l''index '+intToSTR(i)+' est '+intToSTR(suivant),clYellow); + if suivant=-1 then + begin + result:=resultat; + if debugFonction then Affiche('Sortie B ',clYellow); + if i<>1 then formule:=formule+')'; // dernier ) + //Affiche(intToSTR(i)+')',clred); + exit; + end; + i:=suivant; + end; + + //suivant:=suivant_niveau(k,i); + if (suivant=-1) and (fonction[k,i].niveau=2) then + begin + result:=resultat; + if debugFonction then Affiche('Sortie finale ',clYellow); + exit; + end; + end; + + until i>=fonction[k,0].adresse; + + result:=resultat; +end; + +// évalue la fonction NumFonc, et renvoie dans s sa formule +function evalue_fonction(NumFonc : integer;var formule : string) : boolean; +var i,nbre : integer; + s : string; +begin + nbre:=fonction[Numfonc,0].adresse; + if nbre<2 then exit; + + for i:=1 to nbre-1 do + begin + fonction[NumFonc,i].traite:=false; + end; + + formule:=''; + + fonction[numFonc,0].etatprec:=fonction[numFonc,0].etatactuel; + fonction[numFonc,0].etatactuel:=evalue_operateur(Numfonc,1,0,formule) ; // pour gérer le front montant + result:=fonction[numFonc,0].etatactuel; +end; + +procedure TFormConfig.ButtonEvalueClick(Sender: TObject); +var s,formule,vf : string; +begin + //s:='Résultat de fonction '+intToSTR(FoncCourante)+' '+NomFonction[FoncCourante]+' : '; + + if evalue_fonction(foncCourante,formule) then vf:='1' else vf:='0'; + + // Affiche(s+vf,clLime); + LabelFonction.caption:=formule+' = '+vf; + //affiche(formule,clorange); +end; + + +// menu +procedure TFormConfig.Supprimer2Click(Sender: TObject); +begin + supprime_node; +end; + +procedure TFormConfig.LabeledEditNomLogChange(Sender: TObject); +begin + if clicListe then exit; + NomFonction[foncCourante]:=LabelededitNomLog.text; +end; + + + +procedure TFormConfig.SpinEditEtatChange(Sender: TObject); +var i,erreur,v : integer; + node : tTreeNode; +begin + if ClicTree then exit; + node:=TreeViewL.Selected; + if node=nil then exit; + i:=node.AbsoluteIndex; + + val(SpinEditEtat.Text,v,erreur); + if (v<1) or (v>2) or (erreur<>0) then + begin + SpinEditEtat.value:=0; + exit; + end; + SpinEditEtat.value:=v; + fonction[foncCourante,i].etat:=v; + node.Text:=texte_tv(foncCourante,i); +end; + +procedure TFormConfig.LabeledEditNumFoncChange(Sender: TObject); +var v,erreur : integer; + s : string; +begin + if clicTree or (foncCourante=0) or changeCom or (TreeViewL=nil) then exit; + if affevt then Affiche('LabeledEditNumFonc Change',clyellow); + config_modifie:=true; + val(LabeledEditNumFonc.text,v,erreur); + if (erreur<>0) or (v<1) then exit; + fonction[foncCourante,0].Niveau:=v; + s:=texte_tv(foncCourante,0); + TreeviewL.Items[0].Text:=s; + ChangeCom:=true; + ComboBoxFL.Items[FoncCourante-1]:=s; + ComboBoxFL.ItemIndex:=FoncCourante-1; + + changeCom:=false; +end; + +procedure TFormConfig.LabeledEditTrainChange(Sender: TObject); +var node : tTreenode; + i,v,erreur : integer; + s : string; +begin + if ClicTree then exit; + node:=TreeViewL.Selected; + if node=nil then exit; + i:=node.AbsoluteIndex; + + config_modifie:=true; + + fonction[foncCourante,i].train:=labeledEditTrain.Text; +end; end. diff --git a/UnitModifAction.dfm b/UnitModifAction.dfm index 309a3e7..8fb8c90 100644 --- a/UnitModifAction.dfm +++ b/UnitModifAction.dfm @@ -37,14 +37,21 @@ object FormModifAction: TFormModifAction Width = 3 Height = 13 end - object ButtonOk: TButton - Left = 16 - Top = 416 - Width = 75 + object Shape3: TShape + Left = 8 + Top = 408 + Width = 73 Height = 25 - Caption = 'Ok' - TabOrder = 0 - OnClick = ButtonOkClick + Brush.Color = clActiveCaption + end + object SpeedButton1: TSpeedButton + Left = 8 + Top = 408 + Width = 73 + Height = 25 + Caption = 'OK' + Flat = True + OnClick = SpeedButton1Click end object ComboBoxActions: TComboBox Left = 88 @@ -53,7 +60,7 @@ object FormModifAction: TFormModifAction Height = 21 Style = csDropDownList ItemHeight = 13 - TabOrder = 1 + TabOrder = 0 OnChange = ComboBoxActionsChange end object PageControlAct: TPageControl @@ -61,9 +68,9 @@ object FormModifAction: TFormModifAction Top = 64 Width = 729 Height = 337 - ActivePage = TabSheetDecl + ActivePage = TabSheet1 MultiLine = True - TabOrder = 2 + TabOrder = 1 object TabSheetDecl: TTabSheet Caption = 'D'#233'clencheur' object LabelDecl: TLabel @@ -131,6 +138,13 @@ object FormModifAction: TFormModifAction Width = 16 Height = 16 end + object LabelInfoFonc: TLabel + Left = 136 + Top = 80 + Width = 68 + Height = 13 + Caption = 'LabelInfoFonc' + end object EditAdr: TEdit Left = 80 Top = 32 @@ -174,7 +188,7 @@ object FormModifAction: TFormModifAction OnChange = SpinEditEtatChange end object RadioEtatSignal: TRadioGroup - Left = 152 + Left = 352 Top = 24 Width = 433 Height = 73 @@ -191,10 +205,19 @@ object FormModifAction: TFormModifAction TabOrder = 4 OnClick = RadioEtatSignalClick end + object ButtonFonction: TButton + Left = 368 + Top = 112 + Width = 89 + Height = 25 + Caption = 'Voir la fonction' + TabOrder = 5 + OnClick = ButtonFonctionClick + end end object RichEditInf: TRichEdit Left = 224 - Top = 216 + Top = 224 Width = 481 Height = 73 ReadOnly = True @@ -212,114 +235,6 @@ object FormModifAction: TFormModifAction TabOrder = 3 OnClick = ButtonApplDeclClick end - object GroupBoxLogique: TGroupBox - Left = 224 - Top = 8 - Width = 489 - Height = 193 - Caption = 'D'#233'clencheur logique' - TabOrder = 4 - Visible = False - object Label7: TLabel - Left = 280 - Top = 16 - Width = 78 - Height = 13 - Caption = 'Fonction logique' - end - object TreeViewL: TTreeView - Left = 16 - Top = 24 - Width = 241 - Height = 145 - Images = ImageListLogic - Indent = 19 - PopupMenu = PopupMenuL - TabOrder = 0 - OnChange = TreeViewLChange - Items.Data = { - 040000001C0000000000000000000000FFFFFFFFFFFFFFFF0000000000000000 - 03456C311C0000000000000000000000FFFFFFFFFFFFFFFF0000000002000000 - 03456C321F0000000000000000000000FFFFFFFFFFFFFFFF0000000000000000 - 06536F7573656C190000000000000000000000FFFFFFFFFFFFFFFF0000000000 - 000000001C0000000000000000000000FFFFFFFFFFFFFFFF0000000000000000 - 03456C33190000000000000000000000FFFFFFFFFFFFFFFF0000000003000000 - 00200000000000000000000000FFFFFFFFFFFFFFFF000000000000000007536F - 7573456C31200000000000000000000000FFFFFFFFFFFFFFFF00000000000000 - 0007536F7573456C32190000000000000000000000FFFFFFFFFFFFFFFF000000 - 000200000000240000000000000000000000FFFFFFFFFFFFFFFF000000000000 - 00000B536F7573536F7573456C31190000000000000000000000FFFFFFFFFFFF - FFFF000000000000000000} - end - object ButtonCreer: TButton - Left = 280 - Top = 56 - Width = 49 - Height = 25 - Caption = 'Cr'#233'er' - TabOrder = 1 - OnClick = ButtonCreerClick - end - object ButtonAjouteVar: TButton - Left = 280 - Top = 120 - Width = 105 - Height = 25 - Caption = 'Ajouter variable' - TabOrder = 2 - OnClick = ButtonAjouteVarClick - end - object BoutonSupprime: TButton - Left = 408 - Top = 120 - Width = 75 - Height = 25 - Hint = 'Supprime la s'#233'lection' - Caption = 'Supprime' - ParentShowHint = False - ShowHint = True - TabOrder = 3 - OnClick = BoutonSupprimeClick - end - object ComboBoxFonction: TComboBox - Left = 280 - Top = 32 - Width = 145 - Height = 21 - ItemHeight = 13 - TabOrder = 4 - OnChange = ComboBoxFonctionChange - OnDrawItem = ComboBoxFonctionDrawItem - end - object ButtonAjouteFonc: TButton - Left = 280 - Top = 88 - Width = 105 - Height = 25 - Caption = 'Ajouter fonction' - TabOrder = 5 - OnClick = ButtonAjouteFoncClick - end - object ButtonVoir: TButton - Left = 336 - Top = 56 - Width = 49 - Height = 25 - Caption = 'Affiche structure' - TabOrder = 6 - WordWrap = True - OnClick = ButtonVoirClick - end - object ButtonSupTout: TButton - Left = 408 - Top = 80 - Width = 75 - Height = 25 - Caption = 'Supprime tout' - TabOrder = 7 - OnClick = ButtonSupToutClick - end - end end object TabSheet1: TTabSheet Caption = 'Conditions' @@ -407,6 +322,13 @@ object FormModifAction: TFormModifAction Height = 13 Caption = 'Etat' end + object Label2InfoFonction: TLabel + Left = 72 + Top = 232 + Width = 68 + Height = 13 + Caption = 'LabelInfoFonc' + end object ChampTrain: TLabeledEdit Left = 24 Top = 184 @@ -498,7 +420,7 @@ object FormModifAction: TFormModifAction OnChange = SpinEditMn2Change end object SpinEditEtat2: TSpinEdit - Left = 96 + Left = 88 Top = 136 Width = 33 Height = 22 @@ -510,6 +432,15 @@ object FormModifAction: TFormModifAction Value = 0 OnChange = SpinEditEtat2Change end + object ButtonVoirFonc: TButton + Left = 128 + Top = 136 + Width = 89 + Height = 25 + Caption = 'Voir la fonction' + TabOrder = 8 + OnClick = ButtonVoirFoncClick + end end object ButtonAppCond: TButton Left = 16 @@ -903,446 +834,35 @@ object FormModifAction: TFormModifAction LabelSpacing = 5 ParentShowHint = False ShowHint = True - TabOrder = 3 + TabOrder = 2 OnChange = LabeledEditNomActChange end object OpenDialogSon: TOpenDialog Left = 680 end - object ImageListLogic: TImageList - Left = 456 - Top = 48 - Bitmap = { - 494C010106000900040010001000FFFFFFFFFF00FFFFFFFFFFFFFFFF424D3600 - 0000000000003600000028000000400000003000000001002000000000000030 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000800000000000000000000000800000000000000080000000 - 8000000080000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000080000000000000008000000000000000800000000000000000000000 - 8000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000080000000000000008000000000000000800000000000000000000000 - 80000000000000000000000000000000000000000000000000000000FF000000 - FF000000FF000000FF000000FF000000FF000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000080000000000000008000000000000000800000000000000080000000 - 80000000000000000000000000000000000000000000000000000000FF000000 - FF000000FF000000FF000000FF000000FF000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000800000000000000000000000800000000000000000000000 - 8000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000008080000080800000808000008080 - 0000808000008080000080800000808000008080000080800000808000008080 - 0000808000008080000080800000808000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000008080000080800000808000008080 - 0000808000008080000080800000808000008080000080800000808000008080 - 0000808000008080000080800000808000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000008080000000000000000000000000 - 0000808000008080000080800000000000000000000000000000808000008080 - 0000000000000000000000000000808000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000008080000000000000808000008080 - 0000000000008080000000000000808000008080000080800000808000000000 - 0000808000008080000080800000808000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000008080000000000000808000008080 - 0000000000008080000000000000808000008080000080800000808000000000 - 0000808000008080000080800000808000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000008080000000000000808000008080 - 0000000000008080000000000000808000008080000080800000808000000000 - 0000808000008080000080800000808000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000008080000000000000000000000000 - 0000808000008080000080800000000000000000000000000000808000008080 - 0000000000000000000000000000808000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000008080000080800000808000008080 - 0000808000008080000080800000808000008080000080800000808000008080 - 0000808000008080000080800000808000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000008080000080800000808000008080 - 0000808000008080000080800000808000008080000080800000808000008080 - 0000808000008080000080800000808000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 00000000000000000000000000000000000000FFFF0000FFFF0000FFFF0000FF - FF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF - FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 00000000000000000000000000000000000000FFFF0000FFFF0000FFFF0000FF - FF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF - FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 00000000000000000000000000000000000000FFFF0000FFFF0000FFFF0000FF - FF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF - FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 - 0000000000008000000000000000000000000000000000000000000000000000 - 0000800000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 00000000000000000000000000000000000000FFFF0000FFFF0000FFFF0000FF - FF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF - FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000008000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 00000000000000000000000000000000000000FFFF0000FFFF0000FFFF0000FF - FF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF - FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 00000000000000000000000000000000000000FFFF0000FFFF000000000000FF - FF0000FFFF000000000000FFFF0000FFFF00000000000000000000FFFF000000 - 000000FFFF000000000000FFFF0000FFFF000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 00000000000000000000000000000000000000FFFF0000FFFF00000000000000 - 000000FFFF000000000000FFFF0000FFFF000000000000FFFF0000FFFF000000 - 0000000000000000000000FFFF0000FFFF000000000000000000000000000000 - 0000000000000000000080000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 00000000000000000000000000000000000000FFFF0000000000000000000000 - 000000FFFF0000FFFF0000000000000000000000000000FFFF0000FFFF000000 - 0000000000000000000000FFFF0000FFFF000000000000000000000000000000 - 0000000000000000000000000000000000008000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 00000000000000000000000000000000000000FFFF000000000000FFFF000000 - 00000000000000FFFF00000000000000000000FFFF0000FFFF0000FFFF000000 - 000000FFFF000000000000FFFF0000FFFF000000000000000000000000000000 - 0000000000000000000000000000800000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000FFFF0000FFFF0000FF - FF000000000000FFFF00000000000000000000FFFF0000FFFF0000FFFF000000 - 0000000000000000000000FFFF0000FFFF000000000000000000000000000000 - 0000000000000000000080000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 00000000000000000000000000000000000000FFFF0000FFFF0000FFFF0000FF - FF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF - FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 00000000000000000000000000000000000000FFFF0000FFFF0000FFFF0000FF - FF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF - FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 - 0000000000000000000080000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 00000000000000000000000000000000000000FFFF0000FFFF0000FFFF0000FF - FF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF - FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 - 0000000000000000000000000000000000000000000080000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 00000000000000000000000000000000000000FFFF0000FFFF0000FFFF0000FF - FF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF - FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 00000000000000000000000000000000000000FFFF0000FFFF0000FFFF0000FF - FF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF - FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 00000000000000000000000000000000000000FFFF0000FFFF0000FFFF0000FF - FF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF - FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 000000000000000000000000000000000000424D3E000000000000003E000000 - 2800000040000000300000000100010000000000800100000000000000000000 - 000000000000000000000000FFFFFF0000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 00000000000000000000000000000000FFFFFFFF00000000FB47FFFF00000000 - F56FFFFF00000000F56FC0FF00000000F54FC0FF00000000FB6FFFFF00000000 - FFFFFFFF000000000000B6DB0000000000000000000000000000B6DB00000000 - 00000000000000000000B6DB000000000000FFFF000000000000FFFF00000000 - 0000FFFF000000000000FFFF000000000000FFFFFFFFFFFF0000F837F9FFFFFF - 0000F387FCFFFC3F0000E7CFF27FF00F0000E78FF93FE3870000F327FC9FE7E7 - 0000F87FFE7FCFF30000FE7FFF3FCFF30000FC3FFE7FCFF30000F99FFCFFCFF3 - 0000F99FF9FFE7E70000F99FF3FFE3C70000FC3FFFFFF00F0000FFFFFFFFFC3F - 0000FFFFFFFFFFFF0000FFFFFFFFFFFF} - end object PopupMenuL: TPopupMenu - Left = 684 - Top = 120 + Left = 692 + Top = 104 object Monter1: TMenuItem Caption = 'Monter' - OnClick = Monter1Click end object Descendre1: TMenuItem Caption = 'Descendre' - OnClick = Descendre1Click end object N1: TMenuItem Caption = '-' end object Supprimer1: TMenuItem Caption = 'Supprimer' - OnClick = Supprimer1Click end object N2: TMenuItem Caption = '-' end object outdployer1: TMenuItem Caption = 'Tout d'#233'ployer' - OnClick = outdployer1Click end object outcontracter1: TMenuItem Caption = 'Tout contracter' - OnClick = outcontracter1Click end end end diff --git a/UnitModifAction.pas b/UnitModifAction.pas index 29babb7..c4e21b8 100644 --- a/UnitModifAction.pas +++ b/UnitModifAction.pas @@ -9,7 +9,6 @@ uses type TFormModifAction = class(TForm) - ButtonOk: TButton; ComboBoxActions: TComboBox; PageControlAct: TPageControl; TabSheetDecl: TTabSheet; @@ -75,17 +74,6 @@ type RadioEtatSignal: TRadioGroup; SpinEditEtatop: TSpinEdit; LabelEtatOp: TLabel; - GroupBoxLogique: TGroupBox; - TreeViewL: TTreeView; - Label7: TLabel; - ButtonCreer: TButton; - ButtonAjouteVar: TButton; - BoutonSupprime: TButton; - ImageListLogic: TImageList; - ComboBoxFonction: TComboBox; - ButtonAjouteFonc: TButton; - ButtonVoir: TButton; - ButtonSupTout: TButton; PopupMenuL: TPopupMenu; Monter1: TMenuItem; Descendre1: TMenuItem; @@ -94,7 +82,12 @@ type N2: TMenuItem; outdployer1: TMenuItem; outcontracter1: TMenuItem; - procedure ButtonOkClick(Sender: TObject); + ButtonFonction: TButton; + ButtonVoirFonc: TButton; + LabelInfoFonc: TLabel; + Label2InfoFonction: TLabel; + Shape3: TShape; + SpeedButton1: TSpeedButton; procedure FormCreate(Sender: TObject); procedure ListBoxOperDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); @@ -147,45 +140,15 @@ type procedure ListBoxOperationsKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure FormClose(Sender: TObject; var Action: TCloseAction); - procedure ButtonCreerClick(Sender: TObject); - procedure BoutonSupprimeClick(Sender: TObject); - procedure ComboBoxFonctionDrawItem(Control: TWinControl; - Index: Integer; Rect: TRect; State: TOwnerDrawState); - procedure ButtonAjouteVarClick(Sender: TObject); - procedure ButtonAjouteFoncClick(Sender: TObject); - procedure ButtonVoirClick(Sender: TObject); - procedure ButtonSupToutClick(Sender: TObject); - procedure Monter1Click(Sender: TObject); - procedure Descendre1Click(Sender: TObject); - procedure Supprimer1Click(Sender: TObject); - procedure TreeViewLChange(Sender: TObject; Node: TTreeNode); - procedure outdployer1Click(Sender: TObject); - procedure outcontracter1Click(Sender: TObject); - procedure ComboBoxFonctionChange(Sender: TObject); + procedure ButtonFonctionClick(Sender: TObject); + procedure ButtonVoirFoncClick(Sender: TObject); + procedure SpeedButton1Click(Sender: TObject); private { Déclarations privées } public { Déclarations publiques } end; -const -// indice des icones donc des fonctions -FoncVAR=0; -//-------- -foncET=1; -foncOU=2; -foncNON=3; -//------- -EtatDCC=4; -EtatDet=5; -NomVAR='Variables'; -NomFoncET='Fonction ET'; -NomFoncOU='Fonction OU'; -NomFoncNON='Fonction NON'; -NomEtatDCC='Etat DCC'; -NomEtatDet='Etat détecteur'; - - var FormModifAction: TFormModifAction; AffParam : boolean; @@ -241,6 +204,10 @@ begin LabelEtat2.Visible:=false; SpinEditEtat2.Visible:=false; ChampTrain.Visible:=false; + ButtonVoirFonc.Visible:=false; + ButtonFonction.Visible:=false; + LabelInfoFonc.Visible:=false; + Label2InfoFonction.visible:=false; end; end; @@ -248,25 +215,13 @@ end; procedure TFormModifAction.FormCreate(Sender: TObject); var i,icone : integer; begin - GroupBoxLogique.Visible:=AvecLogique; - TreeViewL.HideSelection:=false; ListBoxOper.Style:=lbOwnerDrawVariable; // pour afficher des icones ListBoxDeclench.Style:=lbOwnerDrawVariable; ListBoxOperations.Style:=lbOwnerDrawVariable; ListBoxCondTot.Style:=lbOwnerDrawVariable; ListBoxConditions.Style:=lbOwnerDrawVariable; - with ComboBoxFonction do - begin - Style:=csOwnerDrawFixed; - clear; - itemHeight:=18; // hauteur des icones - items.add(nomFoncET); - items.add(NomFoncOU); - items.add(NomFoncNON); - items.add(NomEtatDCC); - items.add(NomEtatDet); - end; + for i:=1 to NbreDeclencheurs do begin @@ -280,7 +235,7 @@ begin DeclDemarTrain : icone:=IconeDemarTrain; DeclArretTrain : icone:=IconeArretTrain; DeclSignal : icone:=IconeSignal; - DeclLogique : icone:=IconeLogique; + DeclFonction : icone:=IconeFonction; end; ListBoxDeclench.Items.Add(Format('%d%s', [icone, declencheurs[i].nom])); // valeur d'index de l'icone dans la ImagelistIcones ListBoxDeclench.itemHeight:=17; @@ -302,6 +257,7 @@ begin CondPosAcc : icone:=IconeAccessoire; condHorl : icone:=IconeLanceHorl; condTrainSig : icone:=IconeDeclSignal; + CondFonction : icone:=IconeFonction; end; ListBoxCondTot.Items.Add(Format('%d%s', [icone, Conditions[i].nom])); // valeur d'index de l'icone dans la ImagelistIcones ListBoxCondTot.itemHeight:=17; // 16 mini taille des éléments pour l'icone @@ -437,9 +393,14 @@ begin 2 : s:=s+' sur ouverture restreinte'; 3 : s:=s+' sur fermeture'; end; - end; + end; + DeclFonction : + begin + s:=s+'Fonction logique '+intToSTR(tablo_action[i].adresse); + end; end; + // conditions s:=s+#13; nop:=Tablo_Action[i].NbCond; @@ -456,6 +417,8 @@ begin CondHorl : s:=s+' horloge '+intToSTR(Tablo_Action[i].tabloCond[op].HeureMin)+'h'+intToSTR(Tablo_Action[i].tabloCond[op].MinuteMin)+' à '+ intToSTR(Tablo_Action[i].tabloCond[op].HeureMax)+'h'+intToSTR(Tablo_Action[i].tabloCond[op].MinuteMax)+' '; condTrainSig : s:=s+'train '+Tablo_Action[i].tabloCond[op].train+' arrêté au signal '+intToSTR(Tablo_Action[i].tabloCond[op].Adresse); + condFonction : s:=s+'Fonction logique '+intToSTR(tablo_action[i].tabloCond[op].adresse); + end; s:=s+#13; end; @@ -559,8 +522,6 @@ begin if indexaction<>0 then itemIndex:=indexaction-1; end; - - // listbox conditions with FormModifAction.ListBoxConditions do begin @@ -576,6 +537,7 @@ begin CondPosAcc : icone:=IconeAccessoire; condHorl : icone:=IconeLanceHorl; condTrainSig : icone:=IconeDeclSignal; + condFonction : icone:=IconeFonction; end; items.Add(Format('%d%s', [icone, s])); // valeur d'index de l'icone dans la ImagelistIcones @@ -593,7 +555,6 @@ begin formConfig.ListBoxActions.Items.add(s); end; - efface_tous_parametres; // déclencheurs @@ -601,12 +562,12 @@ begin case decl of DeclHorloge : begin - GroupBoxLogique.Visible:=false; EditAdr.text:=intToSTR(Tablo_Action[index].heure); EditAdr2.text:=intToSTR(Tablo_Action[index].minute); LabelHeure.visible:=true; LabelAdresse.visible:=true; EditAdr.Visible:=true; + ButtonFonction.Visible:=false; LabelAdresse.Caption:='Heure'; EditAdr.Hint:='Heure du déclencheur'; EditAdr2.Hint:='Minute du déclencheur'; @@ -617,12 +578,12 @@ begin EditTrainDecl.Visible:=false; RichEditInf.Lines.Add('Déclenchement par l''horloge'); ImageIcone.Picture:=nil; + LabelInfoFonc.Visible:=false; formConfCellTCO.ImageListIcones.GetBitmap(IconeHorloge,ImageIcone.Picture.Bitmap); ImageIcone.repaint; end; DeclPeriph : begin - GroupBoxLogique.Visible:=false; EditTrainDecl.Text:=Tablo_Action[index].ordrePeriph; LabelHeure.visible:=false; LabelAdresse.visible:=false; @@ -632,13 +593,14 @@ begin SpinEditEtat.Visible:=false; LabelTrain.Visible:=false; - + ButtonFonction.Visible:=false; EditTrainDecl.Visible:=true; EditTrainDecl.Hint:='Chaîne ASCII'; LabelTrain.visible:=true; LabelTrain.Caption:='Commande du périphérique'; RichEditInf.Lines.Add('Déclenchement par chaîne ASCII depuis un périphérique COM/USB - Socket'); + LabelInfoFonc.Visible:=false; ImageIcone.Picture:=nil; formConfCellTCO.ImageListIcones.GetBitmap(IconePeriph,ImageIcone.Picture.Bitmap); @@ -646,7 +608,6 @@ begin end; DeclAccessoire : begin - GroupBoxLogique.Visible:=false; EditAdr.text:=intToSTR(Tablo_Action[index].adresse); with SpinEditEtat do @@ -667,8 +628,9 @@ begin EditAdr.Hint:='Adresse de l''accessoire sur le bus'; EditAdr.Visible:=true; EditAdr2.Visible:=false; - + ButtonFonction.Visible:=false; LabelEtat.Visible:=true; + LabelInfoFonc.Visible:=false; LabelTrain.Visible:=false; EditTrainDecl.Visible:=false; @@ -680,11 +642,10 @@ begin DeclDetAct : begin - GroupBoxLogique.Visible:=false; EditAdr.text:=intToSTR(Tablo_Action[index].adresse); EditTrainDecl.Visible:=true; EditTrainDecl.Text:=Tablo_Action[index].trainDecl; - + ButtonFonction.Visible:=false; EdittrainDecl.Hint:='Train(s) déclencheur(s) séparés par des virgules pour lesquels la condition s''applique.' +#13+'Mettre X pour tous les trains.'+#13+'Déclenchement par actionneur uniquement'; LabelAdresse.visible:=true; @@ -694,6 +655,7 @@ begin EditAdr2.Visible:=false; LabelAdresse.Caption:='Adresse'; LabelEtat.Visible:=true; + LabelInfoFonc.Visible:=false; with SpinEditEtat do begin @@ -705,7 +667,7 @@ begin ShowHint:=true; visible:=true; end; - + ButtonFonction.Visible:=false; LabelTrain.Visible:=true; LabelTrain.Caption:='Train déclencheur'; s:='Déclenchement par détecteur/actionneur suivant son état et un train, un groupe de trains ou tous les trains.'+#13; @@ -719,7 +681,6 @@ begin DeclZoneDet : begin - GroupBoxLogique.Visible:=false; EditAdr.text:=intToSTR(Tablo_Action[index].adresse); EditAdr2.text:=intToSTR(Tablo_Action[index].adresse2); @@ -732,6 +693,7 @@ begin EditAdr2.Visible:=true; LabelAdresse.Caption:='Adresse'; LabelEtat.Visible:=true; + LabelInfoFonc.Visible:=false; EditTrainDecl.Visible:=true; EdittrainDecl.Hint:='Train(s) déclencheur(s) séparés par des virgules pour lesquels la condition s''applique.' @@ -747,7 +709,7 @@ begin ShowHint:=true; visible:=true; end; - + ButtonFonction.Visible:=false; LabelTrain.Visible:=true; LabelTrain.Caption:='Train déclencheur'; RichEditInf.Lines.Add('Déclenchement par zones de détections contigües suivant son état et un train, un groupe de trains ou tous les trains.'); @@ -758,15 +720,14 @@ begin DeclDemarTrain : begin - GroupBoxLogique.Visible:=false; LabelTrain.visible:=true; EditTrainDecl.Visible:=true; LabelAdresse.Visible:=true; LabelAdresse.caption:='Seuil de vitesse'; EditAdr.Visible:=true; - + ButtonFonction.Visible:=false; EdittrainDecl.Hint:='Train déclencheur unique'; - + LabelInfoFonc.Visible:=false; EditADR.Hint:='Seuil de vitesse de démarrage du train '; EditTrainDecl.Text:=Tablo_Action[index].trainDecl; EditAdr.Text:=IntToSTR(Tablo_Action[index].adresse); @@ -778,45 +739,60 @@ begin DeclArretTrain : begin - GroupBoxLogique.Visible:=false; LabelTrain.visible:=true; EditTrainDecl.Visible:=true; LabelAdresse.Visible:=true; LabelAdresse.caption:='Seuil de vitesse'; EdittrainDecl.Hint:='Train déclencheur unique'; - + ButtonFonction.Visible:=false; EditAdr.Visible:=true; EditADR.Hint:='Seuil de vitesse d''arrêt du train'; EditTrainDecl.Text:=Tablo_Action[index].trainDecl; EditAdr.Text:=IntToSTR(Tablo_Action[index].adresse); RichEditInf.Lines.Add('Déclenchement par arrêt d''un train à un seuil donné'); ImageIcone.Picture:=nil; + LabelInfoFonc.Visible:=false; formConfCellTCO.ImageListIcones.GetBitmap(IconeArretTrain,ImageIcone.Picture.Bitmap); ImageIcone.repaint; end; DeclSignal : begin - GroupBoxLogique.Visible:=false; LabelAdresse.Visible:=true; EditAdr.text:=intToSTR(Tablo_Action[index].adresse); RadioEtatSignal.ItemIndex:=Tablo_Action[index].Etat; LabelAdresse.Caption:='Adresse'; EditAdr.Hint:='Adresse de base du signal'; + ButtonFonction.Visible:=false; EditAdr.Visible:=true; RadioEtatSignal.Visible:=true; RadioEtatSignal.Left:=16; RadioEtatSignal.top:=64; + LabelInfoFonc.Visible:=false; RichEditInf.Lines.Add('Déclenchement par changement d''état d''un signal'); ImageIcone.Picture:=nil; formConfCellTCO.ImageListIcones.GetBitmap(IconeSignal,ImageIcone.Picture.Bitmap); ImageIcone.repaint; end; - DeclLogique : + DeclFonction : begin - GroupBoxLogique.Visible:=true; + LabelAdresse.Visible:=true; // numéro de fonction + LabelAdresse.caption:='Numéro de fonction'; + EditAdr.Visible:=false; + ButtonFonction.Visible:=true; + RadioEtatSignal.visible:=false; + EditAdr2.Visible:=true; // entrée le la fonction + EditAdr2.Text:=IntToSTR(tablo_action[index].adresse); + RadioEtatSignal.Visible:=false; + ImageIcone.Picture:=nil; + formConfCellTCO.ImageListIcones.GetBitmap(IconeFonction,ImageIcone.Picture.Bitmap); + ImageIcone.repaint; + LabelInfoFonc.Visible:=true; + RichEditInf.Lines.Add('Déclenchement par fonction logique'); + LabelInfoFonc.Caption:=NomFonction[index]; end; + end; // conditions @@ -838,6 +814,7 @@ begin ChampTrain.Hint:='Nom du train unique pour la condition'; champ1.Visible:=true; champ2.Visible:=true; + ButtonVoirFonc.Visible:=false; ChampTrain.Visible:=true; end; CondPosAcc : @@ -852,6 +829,7 @@ begin '2=droit'; Champ1.EditLabel.Caption:='Adresse'+#13+'acc'; champ1.Visible:=true; + ButtonVoirFonc.Visible:=false; labelEtat2.Visible:=true; SpinEditEtat2.visible:=true; SpinEditEtat2.MaxValue:=2; @@ -867,6 +845,7 @@ begin SpinEditHeure2.visible:=true; SpinEditMn1.visible:=true; SpinEditMn2.visible:=true; + ButtonVoirFonc.Visible:=false; LabelHeureDebut.Visible:=true; LabelHeureFin.Visible:=true; end; @@ -876,8 +855,21 @@ begin champ1.editLabel.Caption:='Adresse du signal'; champTrain.Text:=Tablo_Action[index].tabloCond[indexCond].train; champ1.Visible:=true; + ButtonVoirFonc.Visible:=false; champTrain.Visible:=true; end; + condFonction : + begin + champ1.Text:=intToSTR(Tablo_Action[index].tabloCond[indexCond].adresse); + champ1.editLabel.Caption:='Numéro de fonction'; + champTrain.Text:=Tablo_Action[index].tabloCond[indexCond].train; + champ1.Visible:=true; + ButtonVoirFonc.Visible:=true; + champTrain.Visible:=false; + Label2InfoFonction.Visible:=true; + Label2InfoFonction.Caption:=NomFonction[Tablo_Action[index].tabloCond[indexCond].adresse]; + end; + end; end; end; @@ -985,10 +977,7 @@ begin clicliste:=false; end; -procedure TFormModifAction.ButtonOkClick(Sender: TObject); -begin - close; -end; + procedure TFormModifAction.FormActivate(Sender: TObject); @@ -1016,7 +1005,7 @@ end; procedure TFormModifAction.ComboBoxActionsChange(Sender: TObject); begin ligneclicAct:=ComboBoxActions.ItemIndex; - Aff_champs(ligneclicAct+1,0,0); + Aff_champs(ligneclicAct+1,1,0); LabelDecl.Caption:='Liste de déclencheurs de l''action n°'+intToSTR(ComboBoxactions.ItemIndex+1); end; @@ -1237,7 +1226,7 @@ begin decl:=Tablo_Action[ligneclicAct+1].declencheur; - if (decl<>DeclZoneDet) and (decl<>DeclHorloge) then exit; + if (decl<>DeclZoneDet) and (decl<>DeclHorloge) and (decl<>DeclFonction) then exit; val(editAdr2.Text,i,erreur); if (i<0) or (erreur<>0) then exit; @@ -1248,6 +1237,11 @@ begin Tablo_Action[index].minute:=i; end; if decl=DeclZoneDet then Tablo_Action[index].adresse2:=i; + if decl=DeclFonction then + begin + Tablo_Action[index].adresse:=i; + LabelInfoFonc.caption:=NomFonction[i]; + end; maj_combocactions(ligneclicAct); end; @@ -1650,6 +1644,10 @@ begin CondVitTrain : Tablo_Action[ligneclicact+1].tabloCond[cliccond+1].vitmini:=i; CondPosAcc : Tablo_Action[ligneclicact+1].tabloCond[cliccond+1].accessoire:=i; CondTrainSig : Tablo_Action[ligneclicact+1].tabloCond[cliccond+1].adresse:=i; + CondFonction : begin + Tablo_Action[ligneclicact+1].tabloCond[cliccond+1].adresse:=i; + Label2InfoFonction.caption:=NomFonction[i]; + end; end; maj_combocactions(ligneclicAct); end; @@ -1854,258 +1852,34 @@ begin Aff_champs(ligneclicAct+1,1,1); end; -procedure TFormModifAction.ButtonCreerClick(Sender: TObject); -var MyTreeNode1, MyTreeNode2: TTreeNode; - i : integer; + +procedure TFormModifAction.ButtonFonctionClick(Sender: TObject); begin - with TreeViewL.Items do - begin - Clear; { Remove any existing nodes. } - mytreenode1:=Add(nil, 'R1'); { Add a root node. } - { Add a child node to the node just added. } - AddChild(MyTreeNode1,NomFoncET); + formModifAction.Close; + formconfig.PageControl.ActivePage:=formconfig.TabSheetFonctions; - {Add another root node} - MyTreeNode2 := Add(MyTreeNode1,NomFoncOU); - {Give MyTreeNode2 to a child. } - AddChild(MyTreeNode2,NomFoncOU); + FoncCourante:=Tablo_Action[ligneClicAct+1].adresse; - {Change MyTreeNode2 to ChildNode2 } - { Add a child node to it. } - MyTreeNode2 := TreeViewL.Items[3]; - AddChild(MyTreeNode2,NomEtatDCC); - - { Add another child to ChildNode2, after ChildNode2a. } - AddChild(MyTreeNode2,NomEtatDet); - - { Add another root node. } - Add(MyTreeNode1, NomFoncOU); - - //AddChild(ParentNode,'Nom'.AsString); - - end; - - TreeViewL.Items[1].ImageIndex:=FoncET; // index de l'image si non sélectionné - TreeViewL.Items[1].SelectedIndex:=FoncET; // index de l'image si sélectionné - - - TreeViewL.Items[2].ImageIndex:=FoncOU; - TreeViewL.Items[2].SelectedIndex:=FoncOU; - - TreeViewL.Items[3].ImageIndex:=FoncNon; - TreeViewL.Items[3].SelectedIndex:=FoncNON; - - TreeViewL.Items[4].ImageIndex:=EtatDCC; - TreeViewL.Items[4].SelectedIndex:=EtatDCC; - - TreeViewL.Items[5].ImageIndex:=EtatDet; - TreeViewL.Items[5].SelectedIndex:=EtatDet; - - - //TreeviewL.Items[1].Item[0].ImageIndex:=2; - //TreeViewL.Items[4].SelectedIndex:=1; + FormConfig.ComboBoxFL.ItemIndex:=FoncCourante-1; + fabrique_treeview(FoncCourante); + formconfig.show; end; -procedure Supprime_node; - // A procedure to recursively delete nodes - procedure DeleteNode(ANode: TTreeNode); - begin - while ANode.HasChildren do - DeleteNode(ANode.GetLastChild); - formModifAction.TreeViewL.Items.Delete(ANode); - end; - +procedure TFormModifAction.ButtonVoirFoncClick(Sender: TObject); begin - if formModifAction.TreeViewL.Selected = nil then exit; + formModifAction.Close; + formconfig.PageControl.ActivePage:=formconfig.TabSheetFonctions; - // If the selected node has child nodes, first ask for confirmation - if formModifAction.TreeviewL.Selected.HasChildren then - if MessageDlg('Delete node and all children?', mtConfirmation, [mbYes,mbNo], 0 ) <> mrYes then - exit; - DeleteNode(formModifAction.TreeViewL.Selected); + FoncCourante:=Tablo_Action[ligneClicAct+1].tablocond[clicCond+1].adresse; + + FormConfig.ComboBoxFL.ItemIndex:=FoncCourante-1; + fabrique_treeview(FoncCourante); + formconfig.show; end; -procedure TFormModifAction.BoutonSupprimeClick(Sender: TObject); -var node : TtreeNode; +procedure TFormModifAction.SpeedButton1Click(Sender: TObject); begin - node:=TreeViewL.Selected; - if Assigned(Node) then node.Delete; -end; - -procedure TFormModifAction.ComboBoxFonctionDrawItem(Control: TWinControl; - Index: Integer; Rect: TRect; State: TOwnerDrawState); -begin - comboboxFonction.canvas.fillrect(rect); - - (* This line draws the actual bitmap*) - imagelistLogic.Draw(comboBoxFonction.Canvas,rect.left,rect.top,Index+1); //+1 car on commence à 1 - - (* This line writes the text after the bitmap*) - comboboxFonction.canvas.textout(rect.left+imagelistLogic.width+2,rect.top, - comboboxFonction.items[index]); -end; - -procedure TFormModifAction.ButtonAjouteVarClick(Sender: TObject); -var NodeOrigine,node : Ttreenode; -begin - if TreeViewL.Items.Count=0 then exit; - - nodeOrigine:=TreeViewL.Selected; - if nodeOrigine=nil then exit; - if (nodeOrigine.ImageIndex>=foncET) and (nodeOrigine.ImageIndex<=FoncNon) then // on ne peut pas rajouter une variable sur une variable ou surle 1er élément - begin - node:=TreeViewL.items.AddChild(nodeOrigine,NomEtatDCC); - Node.ImageIndex:=EtatDCC; - Node.SelectedIndex:=EtatDCC; - NodeOrigine.Expand(true); - end; -end; - -// https://wiki.freepascal.org/TTreeView - -procedure TFormModifAction.ButtonAjouteFoncClick(Sender: TObject); -var node,NodeOrigine : Ttreenode; - n : integer; -begin - // ajoute en fin - n:=TreeViewL.Items.Count; - if n=0 then - begin - Node:=TreeviewL.Items.Add(nil,NomVar); - Node.ImageIndex:=FoncVar; - Node.SelectedIndex:=FoncVar; - exit; - end; - - nodeOrigine:=TreeViewL.Selected; - if nodeOrigine=nil - then exit; - -{ if NodeOrigine.Index=0 then - begin - node:=TreeViewL.items.Add(nodeOrigine,NomFoncET); - end - else } - node:=TreeViewL.items.AddChild(nodeOrigine,NomFoncET); - - Node.ImageIndex:=FoncET; - Node.SelectedIndex:=FoncET; - NodeOrigine.Expand(true); - -end; - -procedure TFormModifAction.ButtonVoirClick(Sender: TObject); -var i : integer; - s : string; -begin - - for i:=0 to TreeViewL.Items.Count-1 do - begin - s:=inttoSTR(i)+' '+TreeViewL.Items[i].Text; - if TreeViewL.Items[i].IsFirstNode then s:=s+' *'; - if TreeViewL.Items[i].HasChildren then s:=s+' ->'; - Affiche(s,clYellow); - TreeViewL.Items[i].Expand(true); - end; - - -end; - -procedure TFormModifAction.ButtonSupToutClick(Sender: TObject); -begin - TreeViewL.Items.clear; -end; - -procedure TFormModifAction.Monter1Click(Sender: TObject); -begin - // Ensure a node is selected - if(TreeviewL.Selected <> nil) then - // Ensure there is a previous sibling node - if TreeviewL.Selected.GetPrevSibling <> nil then - // If we have made it this far, move it UP - TreeviewL.Selected.MoveTo(TreeviewL.Selected.GetPrevSibling, naInsert); -end; - -procedure TFormModifAction.Descendre1Click(Sender: TObject); -begin - // Ensure a node is selected - if(TreeviewL.Selected <> nil) then - // Ensure there is a next sibling node - if TreeviewL.Selected.GetNextSibling <> nil then - // If we have made it this far, move it DOWN - // naAdd, naAddFirst, naAddChild, naAddChildFirst, naInsert - // naAdd The new or relocated node becomes the last sibling of the other node. - // naAddFirst The new or relocated node becomes the first sibling of the other node. - // naInsert The new or relocated node becomes the sibling immediately before the other node. - // naAddChild The new or relocated node becomes the last child of the other node. - // naAddChildFirst The new or relocated node becomes the first child of the other node. - TreeviewL.Selected.MoveTo(TreeviewL.Selected.GetNextSibling, naAdd); -end; - - -procedure TFormModifAction.Supprimer1Click(Sender: TObject); -begin - TreeViewL.Selected.Delete; -end; - - -procedure TFormModifAction.TreeViewLChange(Sender: TObject; - Node: TTreeNode); -begin - if Assigned(Node) then - // if Node.AbsoluteIndex = 1 then - begin - Affiche('Le node est '+node.Text+' id='+intToSTR(node.ImageIndex),clYellow); - ComboBoxFonction.ItemIndex:=node.ImageIndex-1; - end; -end; - -procedure TFormModifAction.outdployer1Click(Sender: TObject); -var i : integer; -begin - for i:=0 to TreeViewL.Items.Count-1 do - begin - Affiche(inttoSTR(i)+' '+TreeViewL.Items[i].Text,clYellow); - TreeViewL.Items[i].Expand(true); - end; -end; - -procedure TFormModifAction.outcontracter1Click(Sender: TObject); -var i : integer; -begin - for i:=0 to TreeViewL.Items.Count-1 do - begin - Affiche(inttoSTR(i)+' '+TreeViewL.Items[i].Text,clYellow); - TreeViewL.Items[i].Collapse(true); - end; -end; - -procedure TFormModifAction.ComboBoxFonctionChange(Sender: TObject); -var node : tTreenode; - i,Fnode : integer; -begin - node:=TreeViewL.Selected; - if assigned(node) then - begin - i:=ComboBoxFonction.ItemIndex+1; - Fnode:=node.ImageIndex; - // si le node est une fonction logique ET OU NON - //if (node.HasChildren) and (i=FoncET) and (Fnode<=FoncNON) and (i>=FoncET) and (i<=FoncNON) then - begin - node.Text:=ComboBoxFonction.Items[i-1]; - node.ImageIndex:=i; - node.SelectedIndex:=i; - end; - { - // si le node n'a pas d'enfant, c'est une variable - if not(node.HasChildren) and (i>=EtatDCC) then - begin - node.Text:=ComboBoxFonction.Items[i]; - node.ImageIndex:=i; - node.SelectedIndex:=i; - end; } - end; + close; end; end. diff --git a/UnitPilote.pas b/UnitPilote.pas index 76ab844..3fe0003 100644 --- a/UnitPilote.pas +++ b/UnitPilote.pas @@ -428,6 +428,7 @@ end; procedure TFormPilote.FormActivate(Sender: TObject); var n,i,d : integer; begin + if fermeSC then exit; // mise à jour du champ décodeur if affevt then affiche('FormPilote activate',clLime); i:=Index_Signal(AdrPilote); diff --git a/UnitPrinc.dfm b/UnitPrinc.dfm index fe891ac..5e102a4 100644 --- a/UnitPrinc.dfm +++ b/UnitPrinc.dfm @@ -1,7 +1,7 @@ object FormPrinc: TFormPrinc - Left = 73 - Top = 187 - Width = 1148 + Left = 103 + Top = 192 + Width = 1146 Height = 625 Anchors = [akLeft, akTop, akRight] Caption = 'SIgnaux complexes' @@ -20,7 +20,7 @@ object FormPrinc: TFormPrinc OnCreate = FormCreate OnResize = FormResize DesignSize = ( - 1132 + 1130 567) PixelsPerInch = 96 TextHeight = 13 @@ -1429,7 +1429,7 @@ object FormPrinc: TFormPrinc Visible = False end object LabelClock: TLabel - Left = 1040 + Left = 1038 Top = 0 Width = 85 Height = 22 @@ -1446,7 +1446,7 @@ object FormPrinc: TFormPrinc object StatusBar1: TStatusBar Left = 0 Top = 545 - Width = 1132 + Width = 1130 Height = 22 Panels = < item diff --git a/UnitPrinc.pas b/UnitPrinc.pas index c4816d8..b0fff0d 100644 --- a/UnitPrinc.pas +++ b/UnitPrinc.pas @@ -76,16 +76,15 @@ unit Unitprinc; //{$R-} // pas de vérification des limites d'index du tableau et des variables -{$DEFINE xAvecIdTCP} // le composant IdTCPClient na pas d'evt receive, il faut le traiter dans un thread +{$DEFINE xAvecIdTCP} // le composant IdTCPClient n'a pas d'evt receive, il faut le traiter dans un thread // il ne marche pas bien en version D12, l'évent RX provoque une violation au démarrage puis plus rien - interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, OleCtrls, ExtCtrls, jpeg, ComCtrls, ShellAPI, TlHelp32, ImgList, ScktComp, StrUtils, Menus, ActnList, MMSystem , - Buttons, NB30, comObj, activeX ,DateUtils, PsAPI + Buttons, NB30, comObj, activeX //,DateUtils//, PsAPI {$IFDEF AvecIdTCP} ,IdTCPClient // client socket indy {$ENDIF} @@ -637,7 +636,7 @@ DeclZoneDet=5; DeclDemarTrain=6; DeclArretTrain=7; DeclSignal=8; -DeclLogique=9; +DeclFonction=9; // conditions CondVrai=1; @@ -646,7 +645,7 @@ CondVitTrain=3; CondPosAcc=4; CondHorl=5; CondTrainSig=6; - +CondFonction=7; // Type d'opération (action) Action0=0; @@ -686,7 +685,7 @@ IconeFaux=15; IconeSignal=22; IconeDeclSignal=23; IconeDroite=24; -IconeLogique=25; +IconeFonction=25; type @@ -702,6 +701,18 @@ TBranche = record Adresse : integer ; // adresse du détecteur ou de l'aiguillage end; +Tfonction = + record + typ : integer; + Indexprec : integer ; // index du niveau précédent d'origine (parent) + adresse,etat : integer; // adresse : l'indice 0 contient le nombre d'éléments + niveau : integer; // niveau : l'indice 0 contient le numéro de fonction modifiable + traite : boolean; + etatprec : boolean; // sert au front montant + etatactuel : boolean; // etat actuel + train : string; + end; + Taiguillage = record Adresse : integer; // adresse de l'aiguillage AncienAdresse : integer; @@ -851,8 +862,10 @@ Taction = record end; Tactionneur = record - adresse,prox1,prox2 : integer; + adresse,prox1,prox2 : integer; NumBranche,IndexBranche : integer; + etat : boolean; + train : string; end; TelementRoute=record // l'index 0 contient le nombre d'éléments dans "adresse" et le sens dans "talon" (si talon=true : consigne vitesse négative) @@ -1002,7 +1015,7 @@ var Tablo_action : array[0..Max_action] of Taction; - Actionneur : array[0..Max_actionneurs] of Tactionneur; + Actionneur : array[0..Max_actionneurs] of Tactionneur; // actionneurs indexés par numéro // décodeurs personnalisés de signaux decodeur_pers : array[1..NbreMaxiDecPers] of @@ -1047,6 +1060,10 @@ var famille : integer; // 1=système 2=CDM 3=SC ne sert qu'a filtrer l'affichage par la combobox end; + Fonction : array[0..100,0..100] of Tfonction; + NomFonction : array[0..100] of string; + ArbreFonc : array[0..100,0..100] of integer; + Conditions : array[0..10] of record nom : string; @@ -3585,6 +3602,19 @@ begin if trouve then result:=i-1 else result:=0; end; +// trouve l'index d'un actionneur par son adresse +function index_actionneur(adr : integer) : integer; +var i : integer; + trouve : boolean; +begin + i:=1; + repeat + trouve:=actionneur[i].adresse=adr; + inc(i); + until trouve or (i>Nactionneurs); + if trouve then result:=i-1 else result:=0; +end; + // trouve l'index d'un train par son nom dans le tableau trains function index_train_nom(nom : string) : integer; var i : integer; @@ -4363,10 +4393,12 @@ procedure vitesse_loco(nom_train :string;index : integer;adr_loco : integer;vite var s : string; v,erreur : integer; begin - if debugRoulage then Affiche('Vitesse train @'+inttostr(adr_loco)+'='+inttostr(vitesse),clLime); - + if (index=0) and (adr_loco=0) then adr_loco:=index_train_nom(nom_train); if (index=0) and (adr_loco<>0) then index:=index_train_adresse(adr_loco); if (s='') and (index<>0) then nom_train:=trains[index].nom_train; + + if debugRoulage then Affiche('Vitesse train @'+inttostr(adr_loco)+'='+inttostr(vitesse),clLime); + // mettre à jour la trackBar si le train sélectionné=editAdrTrain val(Formprinc.EditAdrTrain.Text,v,erreur); if v=adr_loco then @@ -6622,6 +6654,11 @@ begin vit1:=signaux[it].Adr_det1; condValide:=detecteur[vit1].Train=tr; end; + condFonction : + begin + adr:=Tablo_Action[action].tabloCond[ncond].adresse; // numéro de fonction + condValide:=evalue_fonction(adr,tr); + end; end; end; result:=condValide; @@ -6643,6 +6680,7 @@ begin begin if teste_condition(i) then begin + Affiche('ZZ test condition',clRed); action(i); // exécute toutes les opérations de l'actionneur i end end; @@ -6651,21 +6689,37 @@ begin end; end; + procedure arret_train(nom : string;id,adresse : integer); -var s : string; begin - if Cdm_connecte then - begin - s:=chaine_CDM_StopTrainST(nom); - envoi_cdm(s); - end - else - if (portCommOuvert or parSocketLenz) then + if (portCommOuvert or parSocketLenz or Cdm_connecte) then begin + if id=0 then id:=index_train_adresse(adresse); vitesse_loco(nom,id,adr,0,10); + trains[id].TempoArretCour:=0; + trains[id].arret_det:=false; + trains[id].phase_arret:=0; end; end; +procedure stop_trains; +var i,adr : integer; +begin + for i:=1 to Ntrains do + begin + adr:=Trains[i].adresse; + if adr<>0 then + begin + Affiche('Arrêt train @'+intToSTR(adr)+' '+Trains[i].nom_train,clyellow); + vitesse_loco('',i,adr,0,10); + trains[i].TempoArretCour:=0; + trains[i].arret_det:=false; + trains[i].phase_arret:=0; + end; + end; +end; + + // pilotage d'un signal, et mise à jour du graphisme du signal dans les 3 fenetres procedure envoi_signal(Adr : integer); var i,it,index_train,adresse,detect,a,b,aspect,x,y,TailleX,TailleY,Orientation, @@ -7152,7 +7206,6 @@ begin exit; end; - if typeEL=det then begin branche_trouve:=detecteur[el].NumBranche; // le détecteur det se trouve dans @@ -14873,6 +14926,7 @@ begin begin if not(Tablo_Action[i].traite) and teste_condition(i) then begin + Affiche('YY test condition',clred); Tablo_Action[i].traite:=true; action(i); // exécute toutes les opérations de l'actionneur i end @@ -14890,6 +14944,7 @@ begin if not(Tablo_Action[i].traite) and teste_condition(i) then begin Tablo_Action[i].traite:=true; + if not(Diffusion) then Affiche('CCC EventVitesse action',clred); action(i); // exécute toutes les opérations de l'actionneur i end end @@ -14900,18 +14955,17 @@ begin end; -// traitement des évènements actions (detecteurs aussi) +// traitement des évènements actions (détecteurs et mémoire de zone aussi) // autres que horaire et péripériques // adr adr2 : pour mémoire de zone // trainDecl : composé de X, d'un train ou de plusieurs, séparés par + procedure Event_act(adr,adr2,etat : integer;trainDecl : string); var typ,i,v,etatAct,Af,Ao,dZ1F,dZ2F,dZ1O,dZ2O : integer; - sDecl : string; - fm,fd,adresseOk,etatvalide,condValide : boolean; + s,sDecl : string; + Typdet,Typact,rf,fm,fd,adresseOk,etatvalide,condValide : boolean; Ts : TAccessoire; begin if adr<=0 then exit; - if adr>1024 then begin Affiche('Erreur 281 : reçu adresse accessoire trop grande : '+intToSTR(adr),clred); @@ -14928,6 +14982,11 @@ begin // 1 0 FD // 2 0 FD + TypDet:=detecteur[adr].index<>0; + if not typDet then TypAct:=true; // TypAct:=index_actionneur(adr)<>0; + + // normalement il faut différencier les actionneurs des détecteurs + // les actionneurs sont stockés par index if (adr2=0) then begin fd:=(Ancien_actionneur[adr]>0) and (etat=0); // front descendant (FD) @@ -14937,9 +14996,20 @@ begin if not(fd) and not(fm) then exit; end; + + detecteur[adr].Etat:=etat=1; + detecteur[adr].Train:=TrainDecl; + i:=index_actionneur(adr); + actionneur[i].etat:=etat=1; + actionneur[i].train:=trainDecl; + if AffAigDet and (adr2=0) then AfficheDebug('Tick='+IntToSTR(tick)+' Evt Act='+intToSTR(Adr)+'='+intToSTR(etat)+' Train='+trainDecl,clyellow); + //Affiche('Tick='+IntToSTR(tick)+' Evt Act='+intToSTR(Adr)+'='+intToSTR(etat)+'/'+intToSTR(Adr2)+' Train='+trainDecl,clyellow); + //if fm then affiche('Front montant',clred); + //if fd then affiche('Front desc',clLime); + // vérifier si l'actionneur en évènement a été déclaré pour réagir - // dans tableau des actionneurs + // dans tableau des actions i:=1; repeat @@ -14948,6 +15018,23 @@ begin etatValide:=((etatAct=etat) and fm) or ((etatAct=0) and fd); // front montant ou descendant typ:=Tablo_Action[i].declencheur; + // fonction. Attention l'évaluation de la fonction est prise sur sur front montant. + // Or à chaque evt détecteur actionneur , elle est réévaluée. + if (typ=DeclFonction) and (Adr2=0) then + begin + condvalide:=teste_condition(i); + if condValide then + begin + //Affiche('Eval 10 action '+intToSTR(i),clwhite); + rf:=evalue_fonction(tablo_action[i].adresse,s); + if rf and not(fonction[tablo_action[i].adresse,0].etatprec) then + begin + if not(Diffusion) then Affiche('AAA EventAct '+intToSTR(i)+' fonction adr='+intToSTR(adr)+' état'+' '+intToSTR(etat),clred); + action(i); // exécute toutes les opérations de l'actionneur i + end; + end; + end; + // si déclencheur par adresse adresseok:=( ((Tablo_Action[i].adresse=adr) and (adr2=0) ) and ((typ=declDetAct) or (typ=DeclAccessoire)) ) or ( ((Tablo_Action[i].adresse=adr) and (Tablo_Action[i].adresse2=adr2) and ((typ=DeclZoneDet) ))); @@ -14963,6 +15050,7 @@ begin if adresseok and condValide and etatValide then begin //Affiche('Action dans EventAct',clred); + if not(Diffusion) then Affiche('BBB Action '+intToSTR(i),clred); action(i); // exécute toutes les opérations de l'actionneur i end; inc(i); @@ -15515,7 +15603,7 @@ end; // pos = const_droit=2 ou const_devie=1 procedure Event_Aig(adresse,pos : integer); var s: string; - faire_event,inv,bjd : boolean; + faire_event,inv,bjd,rf,CondValide : boolean; prov,index,i,id,etatact,typ,adr : integer; begin //if AffAigDet then Affiche('Tick='+IntToSTR(tick)+' Event Aig '+intToSTR(adresse)+'='+intToSTR(pos),clorange); @@ -15579,7 +15667,9 @@ begin etatAct:=Tablo_Action[i].etat ; adr:=Tablo_Action[i].adresse; typ:=Tablo_Action[i].declencheur; - if (typ=DeclAccessoire) and (Adr=adresse) then event_act(Adresse,0,pos,''); // évent aig + rf:=false; + + if ((typ=DeclAccessoire) and (Adr=adresse)) or (typ=declFonction) then event_act(Adresse,0,pos,''); // évent aig end; // pour services aux périphériques @@ -18020,7 +18110,14 @@ begin index:=CondTrainSig; famille:=0; end; - NbreConditions:=CondTrainSig; + with Conditions[CondFonction] do + begin + nom:='Fonction logique'; + index:=CondFonction; + famille:=0; + end; + + if avecLogique then NbreConditions:=CondFonction else NbreConditions:=CondTrainSig; end; procedure init_declencheurs; @@ -18079,14 +18176,15 @@ begin index:=DeclSignal; famille:=2; end; - with declencheurs[DeclLogique] do + with declencheurs[DeclFonction] do begin - nom:='Logique'; - index:=DeclLogique; + nom:='Fonction logique'; + index:=DeclFonction; famille:=0; end; - if avecLogique then Nbredeclencheurs:=DeclLogique + if avecLogique then Nbredeclencheurs:=DeclFonction else NbreDeclencheurs:=DeclSignal; + end; function Index_Declencheur(s : string) : integer; @@ -18326,6 +18424,7 @@ begin heure:=0; minute:=0; seconde:=0; + NbreFL:=0; etape:=1; affevt:=false; EvtClicDet:=false; @@ -18350,7 +18449,7 @@ begin MaxParcours:=100; // Nombre maxi d'éléments d'une route MaxRoutes:=1000; // nombre maxi de routes Diffusion:=true; // &&&& mode diffusion publique + debug mise au point etc - avecLogique:=false; + avecLogique:=true; AffAigDet:=false; Button3.Visible:=not(diffusion); @@ -19116,7 +19215,7 @@ begin dec(index_seqAct); a:=j; repeat - //Affiche('Faire action '+intToSTR(i)+' op '+intToSTR(a),clLime); + Affiche('Faire action séquencée'+intToSTR(i)+' op '+intToSTR(a),clLime); Action_operation(i,a); faire:=(Tablo_Action[i].TabloOp[a].numoperation=ActionTempo); inc(a); @@ -19618,7 +19717,7 @@ begin if pilote_acc(adr,const_droit,aigP) then begin - s:='accessoire '+IntToSTR(adr)+' droit'; + s:='Accessoire '+IntToSTR(adr)+' droit'; Affiche(s,clyellow); end; Self.ActiveControl:=nil; @@ -19637,7 +19736,7 @@ begin if pilote_acc(adr,const_devie,aigP) then begin - s:='accessoire '+IntToSTR(adr)+' dévié'; + s:='Accessoire '+IntToSTR(adr)+' dévié'; Affiche(s,clyellow); end; Self.ActiveControl:=nil; @@ -19930,6 +20029,19 @@ begin Affiche(s,c); end; Affiche('Nombre de détecteurs à 1 :'+intToSTR(NbDet1),clyellow); + + Affiche(' ',clYellow); + Affiche('Etat des actionneurs',clYellow); + for j:=1 to Nactionneurs do + begin + // if detecteur[j].index<>0 then + // if actionneur[j].etat then + s:='Act '+intToSTR(j)+' '+intToSTR(actionneur[j].adresse)+' '; + if actionneur[j].etat then s:=s+'1' else s:=s+'0'; + s:=s+actionneur[j].train; + Affiche(s,clyellow); + end; + end; // trouve l'index du détecteur de. Si pas trouvé, renvoie 0 @@ -20519,7 +20631,7 @@ begin ss:=copy(commandeCDM,i+4,l-i-4); val(ss,adr2,erreur); Delete(commandeCDM,i,l-i+1); - end; + end; i:=posEx('STATE=',commandeCDM,1);l:=posEx(';',commandeCDM,i); if (i<>0) and (l<>0) then @@ -20571,7 +20683,7 @@ begin train:=ss; Delete(commandeCDM,i,l-i+1); end; - + i:=posEx('STATE=',commandeCDM,1);l:=posEx(';',commandeCDM,i); if i<>0 then begin @@ -20579,7 +20691,7 @@ begin val(ss,etat,erreur); Delete(commandeCDM,i,l-i+1); end; - + if AffAigDet then AfficheDebug('Actionneur AD='+intToSTR(adr)+' Nom='+nom+' Train='+train+' Etat='+IntToSTR(etat),clyellow); Event_act(adr,0,etat,train); // déclenche évent actionneur end; @@ -21943,23 +22055,6 @@ begin Affiche_tco(i); end; -procedure stop_trains; -var i,adr : integer; -begin - for i:=1 to Ntrains do - begin - adr:=Trains[i].adresse; - if adr<>0 then - begin - Affiche('Arrêt train @'+intToSTR(adr)+' '+Trains[i].nom_train,clyellow); - vitesse_loco('',i,adr,0,10); - trains[i].TempoArretCour:=0; - trains[i].arret_det:=false; - trains[i].phase_arret:=0; - - end; - end; -end; procedure TFormPrinc.SBMarcheArretLocoClick(Sender: TObject); begin @@ -23258,9 +23353,19 @@ begin intToSTR(canton[i].y)+' Nel='+intToSTR(canton[i].Nelements)+' '+canton[i].nom+ ' IndexTrain='+intToSTR(Canton[i].indexTrain)+' train='+Canton[i].NomTrain+ ' El contigu1='+intToSTR(canton[i].el1); - if canton[i].typ1=aig then s:=s+' Aig' else s:=s+' Det'; + + case canton[i].typ1 of + det : s:=s+' Det'; + buttoir : s:=s+' But'; + else s:=s+' Aig'; + end; + s:=s+' El contigu2='+intToSTR(canton[i].el2); - if canton[i].typ2=aig then s:=s+' Aig' else s:=s+' Det'; + case canton[i].typ2 of + det : s:=s+' Det'; + buttoir : s:=s+' But'; + else s:=s+' Aig'; + end; if canton[i].NumcantonOrg<>0 then s:=s+' CantonDépart='+intToSTR(canton[i].NumcantonOrg); if canton[i].NumcantonDest<>0 then s:=s+' CantonArrivée='+intToSTR(canton[i].NumcantonDest); @@ -25126,8 +25231,7 @@ end; procedure TFormPrinc.Button3Click(Sender: TObject); begin - event_det_train[1].NbEl:=0; - + Maj_detecteurs_canton(32,4,544); end; diff --git a/UnitRoute.pas b/UnitRoute.pas index 78e2e3d..805ea31 100644 --- a/UnitRoute.pas +++ b/UnitRoute.pas @@ -558,7 +558,7 @@ procedure TFormRoute.ListBoxRoutesKeyDown(Sender: TObject; var Key: Word; var s : string; erreur : integer; begin - if indexLigneRoute<0 then exit; + if (indexLigneRoute<0) or (ListBoxRoutes.Count=0) then exit; if (ord(Key)=VK_UP) and (Indexligneroute>0) then begin dec(IndexligneRoute); diff --git a/UnitTCO.pas b/UnitTCO.pas index 6611199..ebbf6b2 100644 --- a/UnitTCO.pas +++ b/UnitTCO.pas @@ -1457,12 +1457,14 @@ begin if horz then begin zone_tco(t,i,SensTCO_O,0,0,11,false,false); // demande éléments contigus à gauche (5) du canton, résultats dans var globales xCanton et tel1 + if xCanton=0 then tel1:=buttoir; canton[i].el1:=xCanton; canton[i].typ1:=tel1; canton[i].SensEl1:=SensGauche; if tel1=det then detecteur[xCanton].canton1:=canton[i].numero; zone_tco(t,i,SensTCO_E,0,0,11,false,false); // demande éléments contigus à droite (6) du canton, résultats dans var globales xCanton et tel1 + if xCanton=0 then tel1:=buttoir; canton[i].el2:=xCanton; canton[i].typ2:=tel1; canton[i].SensEl2:=SensDroit; @@ -1471,12 +1473,14 @@ begin else begin zone_tco(t,i,SensTCO_N,0,0,11,false,false); // demande éléments contigus en haut (7) du canton, résultats dans var globales xCanton et tel1 + if xCanton=0 then tel1:=buttoir; canton[i].el1:=xCanton; canton[i].typ1:=tel1; canton[i].SensEl1:=SensHaut; if tel1=det then detecteur[xCanton].canton1:=canton[i].numero; zone_tco(t,i,SensTCO_S,0,0,11,false,false); // demande éléments contigus en bas (8) du canton, résultats dans var globales xCanton et tel1 + if xCanton=0 then tel1:=buttoir; canton[i].el2:=xCanton; canton[i].typ2:=tel1; canton[i].SensEl2:=SensBas; @@ -1484,9 +1488,9 @@ begin end; n:=canton[i].Nelements; - if horz then for j:=0 to n-1 do tco[t,x+j,y].BImage:=Id_cantonH+j +{ if horz then for j:=0 to n-1 do tco[t,x+j,y].BImage:=Id_cantonH+j else for j:=0 to n-1 do tco[t,x,y+j].BImage:=Id_cantonV+j; - + } if (canton[i].el1=canton[i].el2) and (canton[i].typ1=det) and (canton[i].typ2=det) then begin Affiche('Erreur 210 : Le canton '+intToSTR(canton[i].numero)+' dans le tco '+intToSTR(t)+' dispose de deux détecteurs contigus d''adresses identiques: '+intToSTR(canton[i].el1),clred); @@ -15020,15 +15024,15 @@ begin if ((bim<>1) and (bim<>20)) or (Ncantons>=MaxCantons) then begin Affiche_TCO(indexTCO); - s:='Un canton doit être déposé sur un élément horizontal ou vertical d''au moins 3 cases'; - formTCO[indexTCO].Caption:=s; - Affiche_TCO(indexTCO); - FormInfo.LabelInfo.caption:=s; - FormInfo.Top:=Y+20; - FormInfo.Left:=X+50; - FormInfo.Show; - exit; - end; + s:='Un canton doit être déposé sur un élément horizontal ou vertical d''au moins 3 cases'; + formTCO[indexTCO].Caption:=s; + Affiche_TCO(indexTCO); + FormInfo.LabelInfo.caption:=s; + FormInfo.Top:=Y+20; + FormInfo.Left:=X+50; + FormInfo.Show; + exit; + end; for i:=0 to 2 do begin @@ -15067,7 +15071,7 @@ begin canton[Ncantons+1].x:=Xclic; canton[Ncantons+1].y:=Yclic; canton[Ncantons+1].Ntco:=indexTCO; - renseigne_canton(Ncantons+1,Bim=1); + renseigne_canton(Ncantons+1,Bim=1); if (canton[Ncantons+1].typ1<>det) and (canton[Ncantons+1].typ2<>det) then begin s:='Un canton doit avoir un détecteur comme élément adjacent'; diff --git a/verif_version.pas b/verif_version.pas index 521b03d..bd9c9ca 100644 --- a/verif_version.pas +++ b/verif_version.pas @@ -26,7 +26,7 @@ var f : text; Const -VersionSC ='9.5'; // sert à la comparaison de la version publiée +VersionSC ='9.6'; // sert à la comparaison de la version publiée SousVersion=' '; // A B C ... en cas d'absence de sous version mettre un espace // pour unzip SHCONTCH_NOPROGRESSBOX=4; diff --git a/versions.txt b/versions.txt index 2d99971..16b02ff 100644 --- a/versions.txt +++ b/versions.txt @@ -288,4 +288,6 @@ version 9.42 : Affiche des exclusions dans la fen Correction décodeur SR pour aspects combinés. version 9.5 : Etalonnage des vitesses des locomotives pour le mode autonome pour arret précis sur détecteurs à distance souhaitée. - +version 9.6 : Fonctions logiques sur position d'accessoires, de détecteurs et d'actionneurs + intégrables dans les déclencheurs et les conditions des actions. +