diff --git a/Notice d'utilisation des signaux_complexes_GL_V9.6.pdf b/Notice d'utilisation des signaux_complexes_GL_V9.7.pdf similarity index 76% rename from Notice d'utilisation des signaux_complexes_GL_V9.6.pdf rename to Notice d'utilisation des signaux_complexes_GL_V9.7.pdf index 9ff76e5..4866a8f 100644 Binary files a/Notice d'utilisation des signaux_complexes_GL_V9.6.pdf and b/Notice d'utilisation des signaux_complexes_GL_V9.7.pdf differ diff --git a/UnitConfig.dfm b/UnitConfig.dfm index 492b4f3..912ea20 100644 --- a/UnitConfig.dfm +++ b/UnitConfig.dfm @@ -1,6 +1,6 @@ object FormConfig: TFormConfig - Left = 251 - Top = 102 + Left = 278 + Top = 106 Hint = 'Modifie la configuration selon les s'#233'lections choisies' BorderStyle = bsDialog Caption = 'Configuration g'#233'n'#233'rale' @@ -1119,9 +1119,6 @@ object FormConfig: TFormConfig Top = 46 Width = 25 Height = 21 - Hint = - 'Mode d'#233'bug au d'#233'marrage (0=sans ; 1=Log d'#233'marrage ; 2=D'#233'marrage ' + - 'par '#233'tape ; 3=Dynamique)' ParentShowHint = False ShowHint = True TabOrder = 1 @@ -3086,26 +3083,13 @@ object FormConfig: TFormConfig 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 + TabOrder = 3 WordWrap = True OnClick = ButtonVoirClick end @@ -3117,7 +3101,7 @@ object FormConfig: TFormConfig ItemHeight = 13 ParentShowHint = False ShowHint = True - TabOrder = 5 + TabOrder = 4 OnChange = ComboBoxVarChange OnDrawItem = ComboBoxVarDrawItem end @@ -3126,7 +3110,7 @@ object FormConfig: TFormConfig Top = 184 Width = 305 Height = 73 - TabOrder = 6 + TabOrder = 5 object LabelEtat: TLabel Left = 240 Top = 4 @@ -3183,6 +3167,19 @@ object FormConfig: TFormConfig TabOrder = 3 OnChange = LabeledEditTrainChange end + object RadioGroupOP: TRadioGroup + Left = 208 + Top = 8 + Width = 89 + Height = 57 + Caption = 'Op'#233'rateur' + Items.Strings = ( + '= '#233'galit'#233 + '> sup'#233'rieur' + '< inf'#233'rieur') + TabOrder = 4 + OnClick = RadioGroupOPClick + end end object ButtonSupLog: TButton Left = 288 @@ -3193,7 +3190,7 @@ object FormConfig: TFormConfig Caption = 'Supprimer' ParentShowHint = False ShowHint = True - TabOrder = 7 + TabOrder = 6 OnClick = ButtonSupLogClick end object ComboBoxFL: TComboBox @@ -3203,7 +3200,7 @@ object FormConfig: TFormConfig Height = 21 Style = csDropDownList ItemHeight = 13 - TabOrder = 8 + TabOrder = 7 OnChange = ComboBoxFLChange end object ButtonEvalue: TButton @@ -3217,7 +3214,7 @@ object FormConfig: TFormConfig Caption = 'Evalue' ParentShowHint = False ShowHint = True - TabOrder = 9 + TabOrder = 8 OnClick = ButtonEvalueClick end object LabeledEditNomLog: TLabeledEdit @@ -3230,7 +3227,7 @@ object FormConfig: TFormConfig EditLabel.Caption = 'Nom de la fonction logique' LabelPosition = lpRight LabelSpacing = 10 - TabOrder = 10 + TabOrder = 9 OnChange = LabeledEditNomLogChange end object ButtonAjOpEnfant: TButton @@ -3242,7 +3239,7 @@ object FormConfig: TFormConfig Caption = 'Ajouter op'#233'rateur' ParentShowHint = False ShowHint = True - TabOrder = 11 + TabOrder = 10 WordWrap = True OnClick = ButtonAjOpEnfantClick end @@ -3256,7 +3253,7 @@ object FormConfig: TFormConfig EditLabel.Caption = 'Num'#233'ro de fonction' LabelPosition = lpRight LabelSpacing = 5 - TabOrder = 12 + TabOrder = 11 OnChange = LabeledEditNumFoncChange end end @@ -3272,7 +3269,9 @@ object FormConfig: TFormConfig '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...') + + 'divers comme l'#39#233'tat des aiguillages, d'#233'tecteurs, boutons TCO, m'#233 + + 'moires etc...') ReadOnly = True TabOrder = 1 end @@ -3436,6 +3435,13 @@ object FormConfig: TFormConfig Font.Style = [fsBold] ParentFont = False end + object Label65: TLabel + Left = 352 + Top = 32 + Width = 240 + Height = 13 + Caption = 'Description des d'#233'tecteurs pour le mode autonome' + end object ListBoxDet: TListBox Left = 0 Top = 56 @@ -3493,6 +3499,7 @@ object FormConfig: TFormConfig LabelPosition = lpLeft LabelSpacing = 80 ParentShowHint = False + ReadOnly = True ShowHint = True TabOrder = 0 OnChange = LEAdrDetChange @@ -4864,9 +4871,6 @@ object FormConfig: TFormConfig Top = 118 Width = 28 Height = 21 - Hint = - 'Temps de filtrage des d'#233'tecteurs qui passent '#224' 0'#39'+#13+'#39'Mode auto' + - 'nome uniquement'#39 EditLabel.Width = 192 EditLabel.Height = 13 EditLabel.Caption = 'Utilisation de l'#39#39'anti timeout Lenz Ethernet' @@ -4881,9 +4885,6 @@ object FormConfig: TFormConfig Top = 142 Width = 28 Height = 21 - Hint = - 'Temps de filtrage des d'#233'tecteurs qui passent '#224' 0'#39'+#13+'#39'Mode auto' + - 'nome uniquement'#39 EditLabel.Width = 230 EditLabel.Height = 13 EditLabel.Caption = 'Facteur de temporisation de t'#233'l'#233'commande CDM' @@ -4898,9 +4899,6 @@ object FormConfig: TFormConfig Top = 166 Width = 28 Height = 21 - Hint = - 'Temps de filtrage des d'#233'tecteurs qui passent '#224' 0'#39'+#13+'#39'Mode auto' + - 'nome uniquement'#39 EditLabel.Width = 177 EditLabel.Height = 13 EditLabel.Caption = 'Nombre maximal d'#39#39#233'l'#233'ments par route' @@ -4915,9 +4913,6 @@ object FormConfig: TFormConfig Top = 190 Width = 44 Height = 21 - Hint = - 'Temps de filtrage des d'#233'tecteurs qui passent '#224' 0'#39'+#13+'#39'Mode auto' + - 'nome uniquement'#39 EditLabel.Width = 124 EditLabel.Height = 13 EditLabel.Caption = 'Nombre maximal de routes' @@ -4965,7 +4960,6 @@ object FormConfig: TFormConfig Top = 41 Width = 28 Height = 21 - Hint = 'Algorithme de localisation des trains' EditLabel.Width = 335 EditLabel.Height = 13 EditLabel.Caption = @@ -5033,7 +5027,6 @@ object FormConfig: TFormConfig Top = 33 Width = 164 Height = 21 - Hint = 'Algorithme de localisation des trains' EditLabel.Width = 99 EditLabel.Height = 26 EditLabel.Caption = 'Chemin Win de CDM (Sans \CDM-Rail)' @@ -5099,6 +5092,22 @@ object FormConfig: TFormConfig TabOrder = 3 end end + object ValueListEditor: TValueListEditor + Left = 312 + Top = 352 + Width = 297 + Height = 105 + Hint = 'Liste de valeurs' + ParentShowHint = False + ShowHint = True + TabOrder = 6 + OnDrawCell = ValueListEditorDrawCell + OnMouseMove = ValueListEditorMouseMove + OnSetEditText = ValueListEditorSetEditText + ColWidths = ( + 150 + 141) + end end end object ButtonEnregistre: TButton @@ -5177,8 +5186,7 @@ object FormConfig: TFormConfig end end object PopupMenuFL: TPopupMenu - Left = 588 - Top = 224 + Left = 804 object M1: TMenuItem Caption = 'Monter' OnClick = M1Click @@ -5360,24 +5368,24 @@ object FormConfig: TFormConfig 0000000080000000000000008000000000000000800000000000000000000000 8000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FF000000FF000000FF00 + 0000FF0000000000000000000000000000000000000000000000000000000000 + 0000FF000000FF000000FF000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000080000000000000008000000000000000800000000000000000000000 80000000000000000000000000000000000000000000000000000000FF000000 FF000000FF000000FF000000FF000000FF000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FF000000FF000000FF00 + 0000FF0000000000000000000000000000000000000000000000000000000000 + 0000FF000000FF000000FF000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000080000000000000008000000000000000800000000000000080000000 80000000000000000000000000000000000000000000000000000000FF000000 FF000000FF000000FF000000FF000000FF000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 + 0000FF000000FF00000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 @@ -5385,6 +5393,7 @@ object FormConfig: TFormConfig 8000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000FF000000FF000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 @@ -5392,8 +5401,7 @@ object FormConfig: TFormConfig 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000FF000000FF0000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000008080000080800000808000008080 @@ -5401,7 +5409,7 @@ object FormConfig: TFormConfig 0000808000008080000080800000808000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000FF000000FF000000FF00000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000008080000080800000808000008080 @@ -5409,67 +5417,67 @@ object FormConfig: TFormConfig 0000808000008080000080800000808000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000008080000000000000000000000000 + 00000000000000000000FF000000FF000000FF000000FF000000000000000000 + 00000000000000000000000000000000000000FFFF0000FFFF0000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF008080000000000000000000000000 0000808000008080000080800000000000000000000000000000808000008080 0000000000000000000000000000808000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000008080000000000000808000008080 + 00000000000000000000FF000000FF00000000000000FF000000FF0000000000 + 00000000000000000000000000000000000000FFFF0000FFFF0000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF008080000000000000808000008080 0000000000008080000000000000808000008080000080800000808000000000 0000808000008080000080800000808000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000FF000000FF0000000000000000000000FF000000FF00 + 00000000000000000000000000000000000000FFFF0000FFFF0000FFFF000000 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000008080000000000000808000008080 + 00000000000000FFFF0000FFFF0000FFFF008080000000000000808000008080 0000000000008080000000000000808000008080000080800000808000000000 0000808000008080000080800000808000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000FF000000FF0000000000000000000000000000000000 + 00000000000000000000000000000000000000FFFF0000FFFF0000FFFF000000 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000008080000000000000808000008080 + 00000000000000FFFF0000FFFF0000FFFF008080000000000000808000008080 0000000000008080000000000000808000008080000080800000808000000000 0000808000008080000080800000808000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000008080000000000000000000000000 + 00000000000000000000FF000000FF0000000000000000000000000000000000 + 00000000000000000000000000000000000000FFFF0000FFFF0000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF008080000000000000000000000000 0000808000008080000080800000000000000000000000000000808000008080 0000000000000000000000000000808000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000000000000000000000000000FF00 + 00000000000000000000FF000000FF0000000000000000000000FF0000000000 + 00000000000000000000000000000000000000FFFF0000FFFF0000FFFF000000 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000008080000080800000808000008080 + 00000000000000FFFF0000FFFF0000FFFF008080000080800000808000008080 0000808000008080000080800000808000008080000080800000808000008080 0000808000008080000080800000808000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000000000000000000000000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000 + 00000000000000000000000000000000000000FFFF0000FFFF0000FFFF000000 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000008080000080800000808000008080 + 00000000000000FFFF0000FFFF0000FFFF008080000080800000808000008080 0000808000008080000080800000808000008080000080800000808000008080 0000808000008080000080800000808000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000FFFF0000FFFF0000FFFF0000FF FF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF FF0000FFFF0000FFFF0000FFFF0000FFFF000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 @@ -5602,11 +5610,11 @@ object FormConfig: TFormConfig 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 - 00000000000000000000000000000000FFFFFFFFFE7FFE7FFB47FFFFFE7FFE7F - F56FFFFFFE7FFE7FF56FC0FFFE7FFE7FF54FC0FFFE7FFE7FFB6FFFFFFE7FFE7F - FFFFFFFFFE7FFE7F0000B6DBFE7FFE0000000000FE7FFE000000B6DBFE7FFE7F - 00000000FE7FFE7F0000B6DBFE7FFE7F0000FFFFFE7FFE7F0000FFFFFE7FFE7F - 0000FFFFFE7FFE7F0000FFFFFE7FFE7F0000FFFFFFFFFFFF0000F837F9FFFFFF + 00000000000000000000000000000000FFFFFFFFFFFFFFFFFB47FFFFFFFF742E + F56FFFFF87F175EEF56FC0FF87F1546AF54FC0FFF3FF25E4FB6FFFFFF9FF742E + FFFFFFFFFCFFFFFF0000B6DBFC7FFFFF00000000FC3F00000000B6DBFC9F0000 + 00000000FCCF00000000B6DBFCFF00000000FFFFFCFF00000000FFFFECDF0000 + 0000FFFFE01F00000000FFFFFFFF00000000FFFFFFFFFFFF0000F837F9FFFFFF 0000F387FCFFFC3F0000E7CFF27FF00F0000E78FF93FE3870000F327FC9FE7E7 0000F87FFE7FCFF30000FE7FFF3FCFF30000FC3FFE7FCFF30000F99FFCFFCFF3 0000F99FF9FFE7E70000F99FF3FFE3C70000FC3FFFFFF00F0000FFFFFFFFFC3F diff --git a/UnitConfig.pas b/UnitConfig.pas index 84d12a9..31e0484 100644 --- a/UnitConfig.pas +++ b/UnitConfig.pas @@ -6,7 +6,7 @@ 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, spin + Grids , unitHorloge, spin, Valedit , Math {$IF CompilerVersion >= 28.0} ,Vcl.Themes, CheckLst, ImgList @@ -429,7 +429,6 @@ type TreeViewL: TTreeView; ButtonAjouteVar: TButton; ComboBoxOperateur: TComboBox; - ButtonAjouteOperateur: TButton; ButtonVoir: TButton; ComboBoxVar: TComboBox; PanelAcc: TPanel; @@ -458,6 +457,9 @@ type LabelFonction: TLabel; LabeledEditNumFonc: TLabeledEdit; LabeledEditTrain: TLabeledEdit; + ValueListEditor: TValueListEditor; + Label65: TLabel; + RadioGroupOP: TRadioGroup; procedure ButtonAppliquerEtFermerClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure ListBoxAigMouseDown(Sender: TObject; Button: TMouseButton; @@ -676,7 +678,6 @@ type 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); @@ -698,6 +699,14 @@ type procedure ButtonAjOpEnfantClick(Sender: TObject); procedure LabeledEditNumFoncChange(Sender: TObject); procedure LabeledEditTrainChange(Sender: TObject); + procedure ValueListEditorSetEditText(Sender: TObject; ACol, + ARow: Integer; const Value: String); + procedure ValueListEditorDrawCell(Sender: TObject; ACol, ARow: Integer; + Rect: TRect; State: TGridDrawState); + procedure ValueListEditorMouseMove(Sender: TObject; Shift: TShiftState; + X, Y: Integer); + procedure Button2Click(Sender: TObject); + procedure RadioGroupOPClick(Sender: TObject); private { Déclarations privées } @@ -712,6 +721,14 @@ type {$IFEND} end; + Tliste = record + Nom : string; + aide : string; + typ : (Simple,PickList,titre); + masque : string; + end; + Tlistes = array[1..19] of Tliste; + const // constantes du fichier de configuration NomConfig='ConfigGenerale.cfg'; @@ -830,13 +847,63 @@ OpNON=3; //------- EtatDCC=4; EtatDet=5; +EtatBoutonTCO=6; +EtatMemoire=7; 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); +NomEtatBoutonTCO='Bouton TCO'; +NomEtatMemoire='Mémoire'; +NomFonc : array[0..7] of string[25]=(NomVar,NomOpET,NomOpOu,NomOpNon,NomEtatDCC,NomEtatDet,NomEtatBoutonTCO,NomEtatMemoire); +oui='Oui'; +non='Non'; + +// liste des paramètres du mode expert de la ValueListEditor +// syntaxe des masques: +// 0 : chiffre 9 : chiffre ou espace # : chiffre ou signe L : lettre ? : lettre ou espace +// A : lettre ou chiffre a : lettre, chiffre ou espace & : tout caractère +Liste : Tlistes = ((nom: 'Seuil du nombre de détecteurs trop distants' ; + aide:'Seuil du nombre de détecteurs trop distants' ; typ: Simple ; masque: '0'), + (nom:'Nombre de cantons présence train avant signal' ; + aide:'Nombre de cantons présence train avant signal';typ : Simple ; masque: '0'), + (nom:'Filtrage des détecteurs (x100ms) mode autonome'; + aide:'Temps de filtrage des détecteurs qui passent à 0'+#13+'Mode autonome uniquement'; typ : Simple ; masque: '0'), + (nom:'Nombre de cantons à réserver en avant du train'; + aide:'Nombre de cantons à réserver en avant du train'; typ : Simple ; masque: '0'), + (nom:'Utilisation de l''anti timeout Ethernet'; + aide:'Utilisation de l''anti timeout Ethernet';typ : PickList), + (nom:'Facteur de Temporisation de télécommande CDM'; + aide:'Facteur de Temporisation de télécommande CDM'; typ:Simple ; masque: '0'), + (nom:'Nombre maximal d''élements par route'; + aide: 'Nombre maximal d''élements par route'; typ:Simple ; masque: '000'), + (nom:'Nombre maximal de routes'; + aide:'Nombre maximal de routes'; typ:Simple ; masque: '00000'), + (nom:'Option demi tour des trains (mode autonome)'; + aide:'Option demi tour des trains (mode autonome)'; typ : Picklist), + (nom:'Algorithme de localisation des trains'; + aide:'Algorithme de localisation des trains'; typ:Simple ; masque: '0'), //10 + (nom:'Nombre maxi d''éléments de recherche d''un signal dans le bon sens'; + aide:'Nombre maxi d''éléments de recherche d''un signal dans le bon sens'; typ:Simple ; masque: '0'), + (nom:'Attendre ACK de la centrale (mode autonome)'; + aide:'Attendre ACK de la centrale (mode autonome)'; typ : Picklist), + (nom:'Méthode de démarrage du serveur de CDM rail'; + aide : 'Méthode de démarrage du serveur de CDM rail'; typ : Picklist), + (nom:'Chemin windows de CDM Rail (sans \CDM-Rail)'; + aide:'Chemin windows de CDM Rail (sans \CDM-Rail)'; typ:Simple ; masque: ''), + (nom:'Affichages de la fenêtre principale'; + aide:'Affichages de la fenêtre principale'; typ:titre ; masque: ''), //15 + (nom:'Evènements signaux'; + aide:'Affiche l''état des signaux lors de leur changement'; typ:PickList ; masque: ''), + (nom:'Réservation/libération des cantons'; + aide:'Affiche les réservations/libération des cantons lors du roulage des trains'; typ:PickList ; masque: ''), + (nom:'Debug roulage'; + aide:'Affiche des messages en mode roulage des trains en mode autonome';typ:PickList ; masque: ''), + (nom:'Localisation trains'; + aide : 'Affiche des messages de localisation des trains' ;typ:PickList ; masque: '')); //19 + var @@ -913,6 +980,8 @@ 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); +procedure compile_id_routes; +procedure genere_informations_BD; implementation @@ -1298,10 +1367,15 @@ var s : string; begin // adresse adresse:=Signaux[i].adresse; + + if adresse=0 then + begin + Affiche('Adresse nulle signal',clRed); + result:=''; + exit; + end; if affevt then Affiche('Encode_sig_feux('+IntToSTR(i)+') : adresse='+IntToSTR(adresse),clyellow); - if adresse=0 then begin encode_signal:='';exit;end; - s:=IntToSTR(adresse)+','; // forme - D=directionnel ajouter 10 aspect:=Signaux[i].aspect; @@ -1373,8 +1447,8 @@ begin end; end; - // décodeur SR - if Signaux[i].decodeur=7 then + // décodeur SR ou LEA + if (Signaux[i].decodeur=7) or (Signaux[i].decodeur=11) then begin s:=s+',SR('; for nc:=1 to 8 do @@ -1910,6 +1984,9 @@ begin 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)+','; + condBouton : s:=s+intToSTR(Tablo_Action[i].TabloCond[j].adresse)+','; + CondMemoireEgal,CondMemoireInf,CondMemoireSup + : s:=s+intToSTR(Tablo_Action[i].TabloCond[j].adresse)+','+intToSTR(Tablo_Action[i].TabloCond[j].etat)+','; end; end; @@ -1933,6 +2010,11 @@ begin ActionFonctionF : s:=s+','+intToSTR(Tablo_Action[i].tabloOp[j].fonctionF)+','+intToSTR(Tablo_Action[i].tabloOp[j].etat)+','+intToSTR(Tablo_Action[i].tabloOp[j].TempoF)+','+Tablo_Action[i].tabloOp[j].train; ActionSon : s:=s+','+Tablo_Action[i].tabloOp[j].train; // nom du fichier ActionTempo : s:=s+','+intToSTR(Tablo_Action[i].tabloOp[j].TempoF); + ActionBoutonTCO : s:=s+','+intToSTR(Tablo_Action[i].tabloOP[j].adresse)+','+intToSTR(Tablo_action[i].TabloOP[j].etat); + ActionAffecteMemoire : s:=s+','+intToSTR(Tablo_Action[i].tabloOP[j].adresse)+','+intToSTR(Tablo_Action[i].tabloOP[j].etat); + ActionIncMemoire: s:=s+','+intToSTR(Tablo_Action[i].tabloOP[j].adresse); + ActionDecMemoire: s:=s+','+intToSTR(Tablo_Action[i].tabloOP[j].adresse); + end; if j0 then Writeln(fichierN,'{'+route_totale_to_string(trains[i].routePref[j])+'}'); end; @@ -2501,6 +2535,7 @@ begin s:=s+'A'+intToSTR(fonction[j,i].adresse)+','; s:=s+'E'+intToSTR(fonction[j,i].etat)+','; s:=s+'V'+','+fonction[j,i].train+','; + s:=s+'O'+intToSTR(fonction[j,i].OpMemoire)+','; Writeln(fichierN,s); end; Writeln(fichierN,'FF'); // marqueur fin de fonction @@ -2704,6 +2739,56 @@ begin end; end; +// trouve les id des routes des trains +procedure compile_id_routes; +var t1,t2,r1,r2,Id,nr : integer; + route1 : tUneroute; +begin + // raz tous les ID de routes + for t1:=1 to nTrains do + begin + nr:=trains[t1].routePref[0,0].adresse; // nombre de routes + for r1:=1 to nr do + begin + trains[t1].routePref[r1,0].pos:=0; + end; + end; + + Id:=1; + // boucle des trains + t1:=1; + while (t1<=nTrains) do + begin + nr:=trains[t1].routePref[0,0].adresse; // nombre de routes + //r1:=routePref[1]; // route 1 du train t + r1:=1; + // boucle des routes + while r1 '; + 2 : s:=s+' < '; + end; + s:=s+intToSTR(fonction[fonc,i].etat); + end; end; result:=s; end; @@ -2785,6 +2891,21 @@ begin begin s:=s+intToSTR(fonction[fonc,i].adresse)+' '+intToSTR(fonction[fonc,i].etat); end; + if typ=EtatBoutonTCO then + begin + s:=s+intToSTR(fonction[fonc,i].adresse)+' '+intToSTR(fonction[fonc,i].etat); + end; + if typ=EtatMemoire then + begin + s:=s+'Mem'+intToSTR(fonction[fonc,i].adresse); + case fonction[fonc,i].opMemoire of + 0 : s:=s+' = '; + 1 : s:=s+' > '; + 2 : s:=s+' < '; + end; + s:=s+intToSTR(fonction[fonc,i].etat); + end; + end; if isOperateur(typ) then @@ -2800,6 +2921,18 @@ begin end; +// génère les informations calculées +procedure genere_informations_BD; +begin + renseigne_TJDs_TCO; + trier_aig; + renseigne_tous_cantons; + trier_cantons; + trier_signaux; + compile_id_routes; +end; + + procedure lit_config; var train,s,sa,SOrigine: string; c : char; @@ -2814,7 +2947,7 @@ var train,s,sa,SOrigine: string; ComptEl,Compt_IT,Num_Element,adr,Nligne,postriple,itl,vers, postjd,postjs,nv,it,Num_Champ,asp,adraig,poscroi,idtrain : integer; - versR : single; + versR : double; function lit_ligne : string ; var esp,l1,l2 : integer; @@ -3417,6 +3550,7 @@ var train,s,sa,SOrigine: string; Val(s,i,erreur);Delete(s,1,erreur); // adresse Tablo_Action[maxtablo_act].adresse:=i; end; + end; @@ -3489,6 +3623,22 @@ var train,s,sa,SOrigine: string; Val(s,i,erreur);Delete(s,1,erreur); // adresse Tablo_Action[maxtablo_act].TabloCond[k].adresse:=i; end; + CondBouton : + begin + Val(s,i,erreur);Delete(s,1,erreur); // numéro de bouton + Tablo_Action[maxtablo_act].TabloCond[k].adresse:=i; + end; + CondMemoireEgal,CondMemoireInf,CondMemoireSup : + begin + Val(s,i,erreur);Delete(s,1,erreur); + Tablo_Action[maxtablo_act].TabloCond[k].adresse:=i; + // si >=9.62 + if CompareValue(versR,9.70)>=0 then //9.70 + begin + Val(s,i,erreur);Delete(s,1,erreur); + Tablo_Action[maxtablo_act].tabloCond[k].etat:=i; + end; + end; end; end; end; @@ -3608,6 +3758,35 @@ var train,s,sa,SOrigine: string; Val(s,i,erreur);Delete(s,1,erreur); Tablo_Action[maxtablo_act].tabloOp[k].TempoF:=i; end; + ActionBoutonTCO : + begin + Val(s,i,erreur);Delete(s,1,erreur); + Tablo_Action[maxtablo_act].tabloOp[k].adresse:=i; + Val(s,i,erreur);Delete(s,1,erreur); + Tablo_Action[maxtablo_act].tabloOp[k].etat:=i; + end; + ActionAffecteMemoire : + begin + Val(s,i,erreur);Delete(s,1,erreur); + Tablo_Action[maxtablo_act].tabloOp[k].adresse:=i; + // v9.7 + // si >=9.62 + if CompareValue(versR,9.70)>=0 then //9.70 + begin + Val(s,i,erreur);Delete(s,1,erreur); + Tablo_Action[maxtablo_act].tabloOp[k].etat:=i; + end; + end; + ActionIncMemoire: + begin + Val(s,i,erreur);Delete(s,1,erreur); + Tablo_Action[maxtablo_act].tabloOp[k].adresse:=i; + end; + ActionDecMemoire: + begin + Val(s,i,erreur);Delete(s,1,erreur); + Tablo_Action[maxtablo_act].tabloOp[k].adresse:=i; + end; else begin if sOrigine<>'' then Affiche('Erreur 83: Action '+intToSTR(j)+' inconnue '+sOrigine,clred); @@ -4094,7 +4273,7 @@ var train,s,sa,SOrigine: string; end; procedure compile_trains; - var i,j,erreur,n : integer; + var i,j,erreur,n,id : integer; r : single; ss : string; lire,trouveNom,sens : boolean; @@ -4359,7 +4538,18 @@ var train,s,sa,SOrigine: string; // sens de la consigne de la route delete(s,1,1); sens:=s[1]='1'; + delete(s,1,1); end; + i:=pos(',',s); + id:=0; + if i<>0 then + begin + // ID de route + delete(s,1,1); + val(s,id,erreur); + delete(s,1,1); + end; + lit_ligne; end; @@ -4371,6 +4561,7 @@ var train,s,sa,SOrigine: string; end; n:=trains[ntrains].RoutePref[0][0].adresse; trains[ntrains].routePref[n,0].talon:=sens; + trains[ntrains].routePref[n,0].pos:=id; compile_route(s); lit_ligne; lire:=false; @@ -4531,7 +4722,7 @@ var train,s,sa,SOrigine: string; i:=pos('"',sOrigine); if i<>0 then delete(sOrigine,i,1); i:=0; - NomFonction[NbreFL+1]:=sOrigine; + NomFonction[NbreFL+1]:=sOrigine; lit_ligne; ligne:=false; repeat // boucle de la fonction @@ -4572,6 +4763,15 @@ var train,s,sa,SOrigine: string; if j<>0 then delete(s,1,2); j:=pos(',',s); Fonction[NbreFL+1,i].train:=copy(s,1,j-1); + if j<>0 then delete(s,1,j); + + j:=pos('O',s); + if j<>0 then + begin + delete(s,1,1); + val(s,v,erreur); + Fonction[NbreFL+1,i].OpMemoire:=v; + end; inc(i); lit_ligne; @@ -5688,21 +5888,18 @@ begin end; readln(fichier,s); // trouver la version avec laquelle le fichier de config a été créé + versR:=0; i:=pos('version',s); if i<>0 then begin delete(s,1,i+7); - val(s,versR,erreur); - if erreur<>0 then - begin - delete(s,erreur,length(s)-erreur+1); - val(s,versR,erreur); - end; + versR:=STRtoFloat(s,FormatSettings) ; end else begin versR:=0; Affiche('Version fichier de configuration inconnue',clred); end; + versR:=roundTo(versR,-2); lit_flux; close(fichier); @@ -5750,20 +5947,13 @@ begin if not(trouve_section_sig) then Affiche('Manque section '+section_sig_ch,clred); if not(trouve_section_branche) then Affiche('Manque section '+section_branches_ch,clred); + genere_informations_BD; + {$IF CompilerVersion >= 28.0} sombre:=false; {$IFEND} end; -// génère les informations calculées -procedure genere_informations_BD; -begin - renseigne_TJDs_TCO; - trier_aig; - renseigne_tous_cantons; - trier_cantons; - trier_signaux; -end; // sauvegarder la config dans le fichier cfg function Sauve_config : boolean; @@ -5829,32 +6019,6 @@ begin changeInterface:=changeInterface or (i<>portinterface); portInterface:=i; - val(EditFiltrDet.Text,i,erreur); - if (i<0) or (i>10) then i:=3; - filtrageDet0:=i; - - val(EditnCantonsRes.Text,i,erreur); - if (i<1) or (i>5) then i:=2; - nCantonsRes:=i; - - val(EditAntiTO.Text,i,erreur); - if (i<0) or (i>1) then i:=0; - AntiTimeoutEthLenz:=i; - - val(EditTempoTC.Text,i,erreur); - if (i<0) or (i>10) then i:=1; - TempoTC:=i; - - val(EditMaxParcours.Text,i,erreur); - MaxParcours:=i; - if MaxParcours<50 then MaxParcours:=50; - if MaxParcours>MaxParcoursTablo then maxParcours:=MaxParcoursTablo; - - val(EditMaxRoutes.Text,i,erreur); - MaxRoutes:=i; - if MaxRoutes<5000 then MaxRoutes:=5000; - if MaxRoutes>MaxRoutesCte then maxRoutes:=MaxRoutesCte; - Val(editTempoAig.Text,i,erreur); if i>3000 then begin labelInfo.Caption:='Temporisation de séquencement incorrecte ';ok:=false;end; Tempo_Aig:=i; @@ -5878,15 +6042,6 @@ begin if erreur<>0 then begin labelInfo.Caption:='Valeur temporisation de réponse interface';ok:=false;end; TimoutMaxInterface:=i; - val(EditNbDetDist.text,i,erreur); - if (erreur<>0) or (i<3) then begin labelInfo.Caption:='Valeur nombre de détecteurs trop distants incorrecte';ok:=false;end; - Nb_Det_Dist:=i; - - val(EditNbCantons.text,i,erreur); - if (erreur<>0) or ((i<3) or (i>5)) then begin labelInfo.Caption:='Valeur cantons signaux de 3 à 5';ok:=false;end; - Nb_cantons_Sig:=i; - formDebug.buttonCP.Caption:='Etat '+intToSTR(Nb_cantons_Sig)+' cantons précédents signal'; - if RadioButton1.checked then Valeur_entete:=0; if RadioButton2.checked then Valeur_entete:=1; case Valeur_entete of @@ -5955,13 +6110,61 @@ begin AvecDemandeAiguillages:=checkPosAig.checked; AvecDemandeInterfaceUSB:=CheckBoxDemarUSB.checked; AvecDemandeInterfaceEth:=CheckBoxDemarEth.checked; + sombre:=CheckBoxSombre.Checked; + + {paramètres experts AffSig:=cbAffSig.Checked; AffRes:=cbRes.checked; DebugRoulage:=cbDebugRoulage.Checked; AffLoc:=cbAffLoc.checked; AvecAck:=cbAck.Checked; Option_DemiTour:=CheckBoxOptionDemiTour.checked; - sombre:=CheckBoxSombre.Checked; + cheminProgrammesCDM:=editchemin.Text; + + val(EditAlgo.Text,i,erreur); + if (i<1) or (i>1) then i:=1; + Algo_localisation:=i; + + val(EditMaxSignalSens.Text,i,erreur); + Max_Signal_Sens:=i; + + val(EditNbDetDist.text,i,erreur); + if (erreur<>0) or (i<3) then begin labelInfo.Caption:='Valeur nombre de détecteurs trop distants incorrecte';ok:=false;end; + Nb_Det_Dist:=i; + + val(EditNbCantons.text,i,erreur); + if (erreur<>0) or ((i<3) or (i>5)) then begin labelInfo.Caption:='Valeur cantons signaux de 3 à 5';ok:=false;end; + Nb_cantons_Sig:=i; + formDebug.buttonCP.Caption:='Etat '+intToSTR(Nb_cantons_Sig)+' cantons précédents signal'; + + val(EditFiltrDet.Text,i,erreur); + if (i<0) or (i>10) then i:=3; + filtrageDet0:=i; + + val(EditnCantonsRes.Text,i,erreur); + if (i<1) or (i>5) then i:=2; + nCantonsRes:=i; + + val(EditAntiTO.Text,i,erreur); + if (i<0) or (i>1) then i:=0; + AntiTimeoutEthLenz:=i; + + val(EditTempoTC.Text,i,erreur); + if (i<0) or (i>10) then i:=1; + TempoTC:=i; + + val(EditMaxParcours.Text,i,erreur); + MaxParcours:=i; + if MaxParcours<50 then MaxParcours:=50; + if MaxParcours>MaxParcoursTablo then maxParcours:=MaxParcoursTablo; + + val(EditMaxRoutes.Text,i,erreur); + MaxRoutes:=i; + if MaxRoutes<5000 then MaxRoutes:=5000; + if MaxRoutes>MaxRoutesCte then maxRoutes:=MaxRoutesCte; + serveurIPCDM_Touche:=radioServeurCDM.ItemIndex=0; + } + protocole:=1; if RadioButtonXpress.Checked then begin @@ -5979,18 +6182,6 @@ begin if checkEnvAigDccpp.Checked then EnvAigDccpp:=1 else EnvAigDccpp:=0; val(EditBase.Text,AdrBaseDetDccpp,erreur); if (AdrBaseDetDccpp<0) or (AdrBaseDetDccpp>2048) then AdrBaseDetDccpp:=513; - - serveurIPCDM_Touche:=radioServeurCDM.ItemIndex=0; - - val(EditAlgo.Text,i,erreur); - if (i<1) or (i>1) then i:=1; - Algo_localisation:=i; - - val(EditMaxSignalSens.Text,i,erreur); - Max_Signal_Sens:=i; - - cheminProgrammesCDM:=editchemin.Text; - end; if change_srv then services_CDM; verifie_panneau_config:=ok; @@ -6041,7 +6232,6 @@ begin clicliste:=false; end; - procedure champs_dec_centrale; var i,nombre : integer; begin @@ -6566,6 +6756,7 @@ begin begin formconfig.TreeViewL.Items[i].Expand(true); end; + formconfig.ButtonAjOpEnfant.enabled:=false; end; // fabrique le tree view depuis la fonction k @@ -6610,18 +6801,6 @@ begin 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; @@ -6637,20 +6816,107 @@ begin // Affiche('ArbreFonc['+intToSTR(i)+','+intToSTR(j)+']='+inttostr(arbreFonc[i,j]),clOrange); end; tout_deployer; + formconfig.ButtonAjOpEnfant.enabled:=false; end; procedure TFormConfig.FormCreate(Sender: TObject); var i,j,x,y,l,k,LongestLength,PixelLength : integer; cs,s,LongestString : string; + tp : tpersistent; begin if AffEvt or (debug=1) then Affiche('Création fenêtre config',clLime); + ValueListEditor.Visible:=true; + + with ValueListEditor do + begin + Left:=1; + Top:=32; + width:=617; + Height:=420; + + TitleCaptions[0]:='Désignation'; + TitleCaptions[1]:='Valeur'; + ColWidths[0]:=450; + + for i:=1 to high(Liste) do + begin + case i of + 1 : values[liste[i].Nom]:=intToSTR(Nb_Det_Dist); // création de l'élément dans la valueListEditor + 2 : values[liste[i].Nom]:=intToSTR(Nb_cantons_Sig); + 3 : values[liste[i].Nom]:=intToSTR(filtrageDet0); + 4 : values[liste[i].Nom]:=intToSTR(nCantonsRes); + 5 : if AntiTimeoutEthLenz=1 then values[liste[i].Nom]:=Oui else values[liste[i].Nom]:=Non; + 6 : values[liste[i].Nom]:=intToSTR(TempoTC); + 7 : values[liste[i].Nom]:=intToSTR(MaxParcours); + 8 : values[liste[i].Nom]:=intToSTR(MaxRoutes); + 9 : if Option_DemiTour then values[liste[i].Nom]:=Oui else values[liste[i].Nom]:=Non; + 10 : values[liste[i].Nom]:=intToSTR(Algo_localisation); + 11 : values[liste[i].Nom]:=intToSTR(Max_Signal_Sens); + 12 : if AvecAck then values[liste[i].Nom]:=Oui else values[liste[i].Nom]:=Non; + 13 : if serveurIPCDM_Touche then values[liste[i].Nom]:='Simulation de touches' else values[liste[i].Nom]:='Ligne de commande'; + 14 : values[liste[i].Nom]:=cheminProgrammesCDM; + 15 : values[liste[i].Nom]:=''; + 16 : if AffSig then values[liste[i].Nom]:=Oui else values[liste[i].Nom]:=Non; + 17 : if AffRes then values[liste[i].Nom]:=Oui else values[liste[i].Nom]:=Non; + 18 : if DebugRoulage then values[liste[i].Nom]:=Oui else values[liste[i].Nom]:=Non; + 19 : if AffLoc then values[liste[i].Nom]:=Oui else values[liste[i].Nom]:=Non; + else values[liste[i].Nom]:='?'; + end; + + if liste[i].typ=Simple then + begin + itemprops[i-1].EditMask:=liste[i].masque; + ItemProps[i-1].EditStyle:=esSimple; + end; + if liste[i].typ=PickList then + begin + ItemProps[i-1].EditStyle:=esPickList; + if i=13 then + begin + ItemProps[i-1].PickList.add('Simulation de touches'); + itemProps[i-1].PickList.add('Ligne de commande'); + end + else + begin + ItemProps[i-1].PickList.add(Oui); + itemProps[i-1].PickList.add(Non); + end; + end; + end; + + + end; + //ValueListEditor.ColWidths[0]:=500; + + { + with ValueListEditor do + begin + ItemProps[0].EditStyle:=esPickList; + ItemProps[0].PickList.add('br1'); + itemProps[0].PickList.add('br2'); // TValueListEditor.OnGetPickList event + + InsertRow('Element','123',true); // ligne 4 + end; + ValueListEditor.ItemProps[1].EditStyle:=esEllipsis; + // For Numeric input, set the TItemProp.EditStyle to esSimple, and set the TItemProp.EditMask and TItemProp.MaxLength as needed. + // You can then convert the user's entered value to an Integer when needed. + with ValueListEditor do + begin + Cells[0,3]:='zim'; + Cells[1,3]:='456'; + itemprops[2].EditStyle:=esSimple; // attention les itemsprops sont décalés d'un index + itemprops[2].EditMask:='###'; + end; + } + + ButtonVoir.Visible:=not(diffusion); LabeledEditTrain.Visible:=not(diffusion); + editDebug.Hint:='Débug au démarrage'+#13+'0=sans'+#13+'1=Log démarrage'+#13+'2=Démarrage par étape'+#13+'3=Dynamique'; TabSheetActionneurs.TabVisible:=not(diffusion); // invisible / visible - TabSheetFonctions.Visible:=AvecLogique; TreeViewL.HideSelection:=false; TreeViewL.Images:=ImageListLogic; @@ -6688,9 +6954,10 @@ begin itemHeight:=18; // hauteur des icones items.add(NomEtatDCC); items.add(NomEtatDet); + items.add(NomEtatBoutonTCO); + items.add(NomEtatMemoire); end; - s:=GetCurrentDir; if not(directoryExists(rep_icones)) then CreateDir(rep_icones); ChDir(s); // revient au rep initial @@ -6710,7 +6977,6 @@ begin Affiche_avert:=false; if affevt then affiche('FormConfig create',clLime); - 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; @@ -6972,7 +7238,6 @@ begin onChange:=formConfig.modif_editT; end; - LbAPnVoie2:=Tlabel.create(formconfig.GroupBoxPNA); with LbAPnVoie2 do begin @@ -7722,11 +7987,12 @@ begin LabeledEditNumFonc.text:=intToSTR(Fonction[1,0].niveau); changeCom:=false; end; + + PageControl.ActivePage:=Formconfig.TabSheetCDM; // force le premier onglet sur la page couleurs_config; end; // décode un morceau d'une chaine d'aiguillage ('P5S') -// // si erreur, B='?' procedure decodeAig(s : string;var adr : integer;var B : char); var erreur,i : integer; @@ -8070,7 +8336,7 @@ begin if tri then begin Label20.Visible:=true; - + ComboBoxAig.ItemIndex:=3; // index de la combobox 0=aiguillage 1=TJD 2=TJS 3=aiguillage triple EditAigTriple.Visible:=true; labelTJD1.Visible:=false; @@ -8131,6 +8397,8 @@ begin result:=s+intToSTR(adr); end; + + // mise à jour des champs du signal d'après le tableau signaux Procedure aff_champs_signaux(index : integer); var j,l,d,p,k,nc,decodeur : integer; @@ -8180,7 +8448,10 @@ begin if j=100 then RadioGroupLEB.Visible:=false else RadioGroupLEB.Visible:=true; RadioGroupLEB.ItemIndex:=signaux[index].BinLin; end; - 7 : ButtonConfigSR.Visible:=true; + 7 : begin + ButtonConfigSR.Visible:=true; + //Aff_label_SR; + end; 5 : ButtonConfigSR.Visible:=true ; // digikeijs 6 : begin EditSpecUni.Visible:=true; @@ -8202,7 +8473,12 @@ begin editSpecUni.ShowHint:=true; EditSpecUni.Visible:=true; EditSpecUni.Text:=IntToSTR(Signaux[index].Na); - end + end; + 11: begin + ButtonConfigSR.Visible:=true; + //Aff_label_LEA; + end; + else labelInfo.Caption:=''; end; @@ -8391,8 +8667,6 @@ end; clicListe:=false; end; - - procedure raz_champs_sig; begin with formconfig do @@ -9010,8 +9284,10 @@ begin 9 : if aspect<>20 then begin result:=false;if aff then Affiche('Erreur 348 : Signal '+intToSTR(Adr)+': Combinaison décodeur '+decodeur[dec]+' et aspect '+aspects[indexAspect]+' incompatibles',clred);end; // B-models 10 : if aspect<>20 then begin result:=false;if aff then Affiche('Erreur 349 : Signal '+intToSTR(Adr)+': Combinaison décodeur '+decodeur[dec]+' et aspect '+aspects[indexAspect]+' incompatibles',clred);end; - end; + // LEA + 11 : if aspect>10 then begin result:=false;if aff then Affiche('Erreur 350 : Signal '+intToSTR(Adr)+': Combinaison décodeur '+decodeur[dec]+' et aspect '+aspects[indexAspect]+' incompatibles',clred);end; // personnalisé + end; if (dec>=NbDecodeurdeBase) then begin // nationalité du décodeur @@ -9968,7 +10244,6 @@ begin // réafficher la liste for i:=1 to maxTablo_act do begin - //s:=encode_act_loc_son(i); s:=encode_actions(i); FormConfig.ListBoxActions.items.Add(s); end; @@ -10104,6 +10379,7 @@ begin j:=dec-NbDecodeurdeBase+1; nc:=decodeur_pers[j].NbreAdr; end; + if dec=11 then nc:=Signaux[i].Na; // LEA nombre_adresses_signal:=nc; end; @@ -10144,6 +10420,8 @@ begin exit; end; Signaux[i].Adresse:=AdrMax+na; + if Signaux[i].Adresse=0 then Signaux[i].Adresse:=1; + Signaux[i].Aspect:=3; Signaux[i].decodeur:=0; Signaux[i].verrouCarre:=false; @@ -11554,12 +11832,12 @@ begin // PN for i:=1 to NbrePN do begin - if tablo_pn[i].TypeCde=1 then + if tablo_pn[i].TypeCde=1 then // par com USB begin - adresse:=tablo_pn[i].AdresseFerme; + adresse:=tablo_pn[i].AdresseFerme; //numéro de périphérique if adresse>NbPeriph then begin - Affiche('Erreur 20 : le PN '+intToSTR(tablo_pn[i].voie[1].ActFerme)+' est lié à un périphérique n°'+intToSTR(adresse)+' COM/USB/Socket inexistant',clred); + Affiche('Erreur 20 : le PN n°'+intToSTR(i)+' est lié à un périphérique n°'+intToSTR(adresse)+' COM/USB/Socket inexistant',clred); ok:=false; end; end; @@ -12751,13 +13029,13 @@ begin begin action:=tCloseAction(caNone); exit; - end; - end; + end; + end; modif_branches:=false; for index:=1 to NbreSignaux do begin - // créer les nouveau checkBox de feux blancs si de nouveaux ont été cochés + // créer les nouveaux checkBox de feux blancs si de nouveaux ont été cochés if Signaux[index].FeuBlanc and (Signaux[index].checkFB=nil) then begin Signaux[index].CheckFB:=TCheckBox.create(Formprinc.ScrollBoxSig); // crée le handle @@ -12792,7 +13070,7 @@ var decodeur : integer; begin clicListe:=true; decodeur:=Signaux[ligneClicSig+1].decodeur; - if decodeur=7 then // SR + if (decodeur=7) or (decodeur=11) then // SR ou LEA begin formSR.showmodal; formSR.close; @@ -12803,10 +13081,10 @@ begin formCDF.close; end; - if decodeur>=11 then + if decodeur>=NbDecodeurdeBase then begin FormConfig.PageControl.ActivePage:=TabSheetDecodeurs; - ComboBoxDecodeurPerso.ItemIndex:=decodeur-11; + ComboBoxDecodeurPerso.ItemIndex:=decodeur-NbDecodeurdeBase; end; ListBoxSig.selected[ligneClicSig]:=true; @@ -13130,7 +13408,12 @@ procedure Maj_icone_train(IImage : Timage;index :integer); var h,l,HautDest,LargDest,y : integer; rd : single; begin - if (index<1) or (index>Ntrains) then exit; + if (index<1) or (index>Ntrains) then + begin + Iimage.Picture:=nil; + exit; + end + else begin // source l:=Trains[index].Icone.width; @@ -15461,7 +15744,7 @@ begin DeclencheurAffiche:=0; // pas de demande d'affichage onglet/op end; procedure Affiche_action; -var i,j,decl :integer; +var i,io,j,decl :integer; s : string; begin // remplir la listbox en fonction des opérations de l'action cliquée @@ -15477,7 +15760,10 @@ begin if j<1 then items.Add(Format('%d%s', [0, 'aucune opération'])) else - items.Add(Format('%d%s', [j-1, s])); // valeur d'index de l'icone dans la ImagelistIcones + begin + io:=Tablo_Action[ligneclicAct+1].tabloOp[i].numoperation; + affecte_operation(io,formConfig.ListBoxOperations); + end; itemHeight:=17; end; end; @@ -15495,11 +15781,11 @@ begin if decl>0 then formConfig.RichEditInfo.Lines.Add(s); end; -procedure TFormConfig.ListBoxActionsMouseDown(Sender: TObject; - Button: TMouseButton; Shift: TShiftState; X, Y: Integer);begin +procedure TFormConfig.ListBoxActionsMouseDown(Sender: TObject;Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin if maxTablo_act<1 then exit; clicliste:=true; - + //Affiche('ListBoxActions mouse down',clYellow); ligneclicAct:=listBoxActions.ItemIndex; if ligneclicAct<0 then begin @@ -15542,17 +15828,20 @@ end; procedure TFormConfig.ButtonTestActionClick(Sender: TObject); begin - if (ligneclicAct<0) then exit; action_relais(ligneclicact+1); // car action est une fonction d'une form... + if (ligneclicAct<0) then exit; + action_relais(ligneclicact+1); // car action est une fonction d'une form... end; procedure TFormConfig.ModifActionClick(Sender: TObject); -begin DeclencheurAffiche:=0; +begin + DeclencheurAffiche:=0; OperationAffiche:=clicaction+1; formModifAction.ShowModal; end; procedure TFormConfig.ListBoxActionsKeyDown(Sender: TObject; var Key: Word; - Shift: TShiftState);begin + Shift: TShiftState); +begin if (maxTablo_act<1) or clicliste then exit; if key=VK_delete then supprime_action; @@ -15591,15 +15880,22 @@ procedure TFormConfig.ListBoxActionsKeyDown(Sender: TObject; var Key: Word; end; procedure TFormConfig.ListBoxOperationsDblClick(Sender: TObject); -var s : string; op,icone : integer;begin if (clicAction<0) or (ligneclicAct<0) or clicliste then exit; +var s : string; + op,i : integer; +const sd=' [dévalidé]'; +begin + if (clicAction<0) or (ligneclicAct<0) or clicliste then exit; Tablo_Action[ligneclicAct+1].tabloOp[clicaction+1].valide:=not(Tablo_Action[ligneclicAct+1].tabloOp[clicaction+1].valide); op:=Tablo_Action[ligneclicact+1].tabloOp[clicaction+1].numoperation; - if op<1 then icone:=0 else icone:=op-1; - s:=operations[op].nom; - if not(Tablo_Action[ligneclicact+1].tabloOp[clicaction+1].valide) then s:=s+' [dévalidé]'; - listBoxOperations.Items[clicaction]:=Format('%d%s', [icone, s]); + s:=ListBoxOperations.Items[clicaction]; + i:=pos(sd,s); + if i<>0 then delete(s,i,length(sd)); + + if not(Tablo_Action[ligneclicact+1].tabloOp[clicaction+1].valide) then s:=s+sd; + + listBoxOperations.Items[clicaction]:=s; ListBoxActions.items[ligneClicAct]:=encode_actions(ligneclicAct+1); end; @@ -16700,6 +16996,37 @@ begin config_modifie:=true; val(LabeledEditEtatAcc.text,v,erreur); + + if (ComboBoxVar.ItemIndex=EtatDCC-EtatDCC) then + begin + if (v<0) or (v>2) then + begin + labelInfo.Caption:='Erreur'; + exit; + end; + end; + + if (ComboBoxVar.ItemIndex=EtatDet-EtatDCC) then + begin + if (v<0) or (v>1) then + begin + labelInfo.Caption:='Erreur'; + exit; + end; + end; + + if (ComboBoxVar.ItemIndex=EtatBoutonTCO-EtatDCC) then + begin + if (v<0) or (v>1) then + begin + labelInfo.Caption:='Erreur'; + exit; + end; + end; + if (ComboBoxVar.ItemIndex=EtatMemoire-EtatDCC) then + begin + end; + labelInfo.Caption:=''; fonction[foncCourante,i].etat:=v; s:=texte_tv(foncCourante,i); node.Text:=s; @@ -16719,6 +17046,12 @@ begin config_modifie:=true; val(LabeledEditDCC.text,v,erreur); + if v<1 then + begin + labelInfo.Caption:='Erreur'; + exit; + end; + labelInfo.Caption:=''; fonction[foncCourante,i].adresse:=v; s:=texte_tv(foncCourante,i); node.Text:=s; @@ -16736,13 +17069,72 @@ begin comboboxVar.canvas.fillrect(rect); // dessine l'icone - imagelistLogic.Draw(comboBoxVar.Canvas,rect.left,rect.top,Index+EtatDCC); //+1 car on commence à 1 + imagelistLogic.Draw(comboBoxVar.Canvas,rect.left,rect.top,Index+EtatDCC); // ecrit le texte comboboxVar.canvas.textout(rect.left+imagelistLogic.width+2,rect.top, comboboxVar.items[index]); end; +procedure maj_champs_variable(i,foncCourante,iNode : integer); +begin + with formconfig do + begin + if i=EtatDCC then + begin + LabelEtat.Visible:=true; + SpinEditEtat.Visible:=true; + RadioGroupOP.Visible:=false; + LabeledEditEtatACC.Visible:=false; + LabeledEditTrain.visible:=false; + PanelAcc.Visible:=true; + LabeledEditDcc.EditLabel.Caption:='Adresse accessoire'; + LabeledEditDCC.Text:=intToSTR(fonction[foncCourante,iNode].adresse); + SpinEditEtat.Value:=fonction[foncCourante,iNode].etat; + end; + + if i=EtatDet then + begin + RadioGroupOP.Visible:=false; + LabelEtat.Visible:=false; + LabeledEditTrain.visible:=true; + SpinEditEtat.Visible:=false; + LabeledEditEtatACC.Visible:=true; + LabeledEditDcc.EditLabel.Caption:='Adresse'; + LabeledEditTrain.Text:=fonction[foncCourante,iNode].train; + LabeledEditEtatAcc.Text:=intToSTR(fonction[foncCourante,iNode].etat); + end; + + if i=EtatBoutonTCO then + begin + RadioGroupOP.Visible:=false; + LabelEtat.Visible:=true; + SpinEditEtat.Visible:=false; + LabeledEditEtatACC.Visible:=true; + LabeledEditTrain.visible:=false; + PanelAcc.Visible:=true; + LabeledEditDCC.Visible:=true; + LabeledEditDcc.EditLabel.Caption:='Numéro de bouton'; + LabeledEditDCC.Text:=intToSTR(fonction[foncCourante,iNode].adresse); + LabeledEditEtatAcc.text:=intToSTR(fonction[foncCourante,iNode].etat); + end; + + if i=EtatMemoire then + begin + RadioGroupOP.Visible:=true; + LabeledEditDCC.Visible:=true; + LabeledEditDcc.EditLabel.Caption:='Numéro de mémoire'; + LabeledEditTrain.visible:=false; + LabeledEditEtatACC.Visible:=true; + SpineditEtat.Visible:=false; + LabelEtat.visible:=false; + LabeledEditDCC.Text:=intToSTR(fonction[foncCourante,iNode].adresse); + LabeledEditEtatAcc.text:=intToSTR(fonction[foncCourante,iNode].etat); + RadioGroupOP.ItemIndex:=fonction[foncCourante,iNode].OpMemoire; + end; + end; +end; + procedure TFormConfig.ComboBoxVarChange(Sender: TObject); var node : tTreenode; i,Fnode,inode : integer; @@ -16755,7 +17147,6 @@ begin 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; @@ -16763,16 +17154,7 @@ begin 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; + Maj_champs_variable(i+EtatDCC,FoncCourante,inode); end; end; @@ -16811,6 +17193,7 @@ begin end; end; + procedure TFormConfig.TreeViewLChange(Sender: TObject; Node: TTreeNode); // cliqué ou sélectionné un node var i,inode,typ : integer; @@ -16821,15 +17204,13 @@ begin i:=node.ImageIndex; inode:=node.AbsoluteIndex; //Affiche('Le node '+intToSTR(iNode)+' est '+node.Text+' image='+intToSTR(node.ImageIndex),clYellow); - if i=foncVar then + if i=foncVar then //racine du treeview 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; @@ -16866,44 +17247,21 @@ begin if isVariable(i) then begin - // autoriser montée descente menu + // autoriser montée descente menu PopupMenuFL.Items[0].Enabled:=true; PopupMenuFL.Items[1].Enabled:=true; - TreeViewL.hint:='état logique'; PanelAcc.Visible:=true; + Maj_champs_variable(i,FoncCourante,Inode); + 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; @@ -17039,59 +17397,9 @@ begin 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; @@ -17117,7 +17425,7 @@ begin if inodetrain then resultat:=false; end; - result:=resultat; exit; end; + + if typ=EtatBoutonTCO then + begin + pos:=BoutonTCO[adr].etat; + result:=(pos=1) and (fonction[k,i].etat=1) or (pos=0) and (fonction[k,i].etat=0); + exit; + end; + + if typ=EtatMemoire then + begin + pos:=memoire[adr]; + case fonction[k,i].OpMemoire of + 0 : result:=pos=fonction[k,i].etat; + 1 : result:=pos>fonction[k,i].etat; + 2 : result:=pos0) or (i<0) then exit; + if (i<3) then labelInfo.Caption:='Valeur nombre de détecteurs trop distants incorrecte' + else Nb_Det_Dist:=i; + end; + 2 : begin + if (erreur<>0) or (i<0) then exit; + if (i<3) or (i>5) then labelInfo.Caption:='Valeur nombre de cantons incorrecte' + else Nb_cantons_sig:=i; + end; + 3 : begin + if (erreur<>0) or (i<0) then exit; + if (i<3) or (i>5) then labelInfo.Caption:='Valeur incorrecte' + else FiltrageDet0:=i; + end; + 4 : begin + if (erreur<>0) or (i<0) then exit; + if (i<1) or (i>5) then labelInfo.Caption:='Valeur incorrecte' + else nCantonsRes:=i; + end; + 5 : begin + if s=lowercase(oui) then AntiTimeOutEthLenz:=1 else AntiTimeOutEthLenz:=0; + end; + 6 : begin + if (erreur<>0) or (i<0) then exit; + if (i<1) or (i>5) then labelInfo.Caption:='Valeur incorrecte' + else TempoTC:=i; + end; + 7 : begin + if (i<50) or (i>MaxParcoursTablo) then begin labelInfo.Caption:='Valeur incorrecte';exit;end; + MaxParcours:=i; + //if MaxParcours<50 then MaxParcours:=50; + //if MaxParcours>MaxParcoursTablo then maxParcours:=MaxParcoursTablo; + //ValueListEditor.onSetEditText:=nil; + //ValueListEditor.Cells[Acol,Arow]:=intToSTR(MaxParcours); + //ValueListEditor.onSetEditText:=ValueListEditorSetEditText; + end; + 8 : begin + if (erreur<>0) or (i<0) then exit; + if (i<1) or (i>5000) then labelInfo.Caption:='Valeur incorrecte' + else MaxRoutes:=i; + if MaxRoutes<5000 then MaxRoutes:=5000; + if MaxRoutes>MaxRoutesCte then maxRoutes:=MaxRoutesCte; + end; + 9 : begin + Option_DemiTour:=s=lowercase(oui); + end; + 10: begin + if (erreur<>0) or (i<0) then exit; + if (i<1) or (i>1) then labelInfo.Caption:='Valeur incorrecte' + else Algo_Localisation:=i; + end; + 11: begin + if (erreur<>0) or (i<0) then exit; + if (i<5) or (i>50) then labelInfo.Caption:='Valeur incorrecte' + else Max_signal_sens:=i; + end; + 12 :begin + AvecAck:=s=lowercase(oui); + end; + 13 : begin + ServeurIPCDM_touche:=s='simulation de touches'; + end; + 14 : begin + if length(s)<4 then labelInfo.Caption:='Valeur incorrecte' + else CheminProgrammesCDM:=s; + end; + 16 : begin + AffSig:=s=lowercase(oui); + end; + 17 : begin + AffRes:=s=lowercase(oui); + end; + 18 : begin + DebugRoulage:=s=lowercase(oui); + end; + 19 : begin + AffLoc:=s=lowercase(oui); + end; + + end; +end; + + +procedure TFormConfig.ValueListEditorDrawCell(Sender: TObject; ACol,ARow: Integer; Rect: TRect; State: TGridDrawState); +var coul : tColor; +begin + with ValueListEditor do + begin + Inc(Rect.Left,2); + Inc(Rect.Top,2); + //DrawText(Canvas.Handle,PChar(Cells[ACol, ARow]),-1,Rect,DT_NOPREFIX or DT_WORDBREAK); + if (Arow=15) or (aRow=0) then Canvas.Font.Style:=[fsBold] else Canvas.Font.Style:=[]; + canvas.TextOut(Rect.left,Rect.Top,Cells[ACol, ARow] ); + end; +end; + +procedure TFormConfig.ValueListEditorMouseMove(Sender: TObject; + Shift: TShiftState; X, Y: Integer); +begin + y:=y div (ValueListEditor.RowHeights[0]+1); + if (y>high(liste)) or (y<1) then exit; + //Affiche('OnMouseMove y='+intToSTR(y),clYellow); + ValueListEditor.hint:=Liste[y].aide; +end; + + + +procedure TFormConfig.Button2Click(Sender: TObject); +begin + ValueListEditor.Cells[1,7]:='hgjg'; +end; + +procedure TFormConfig.RadioGroupOPClick(Sender: TObject); +var node : tTreeNode; + i : integer; s : string; begin if ClicTree then exit; @@ -17601,10 +18064,14 @@ begin config_modifie:=true; - fonction[foncCourante,i].train:=labeledEditTrain.Text; + if (ComboBoxVar.ItemIndex=EtatMemoire-EtatDCC) then + begin + fonction[foncCourante,i].opMemoire:=RadioGroupOP.ItemIndex; + s:=texte_tv(foncCourante,i); + node.Text:=s; + end; end; - end. diff --git a/UnitConfigCellTCO.dfm b/UnitConfigCellTCO.dfm index 4831098..26e10d8 100644 --- a/UnitConfigCellTCO.dfm +++ b/UnitConfigCellTCO.dfm @@ -4,7 +4,7 @@ object FormConfCellTCO: TFormConfCellTCO BorderStyle = bsDialog Caption = 'FormConfCellTCO' ClientHeight = 473 - ClientWidth = 311 + ClientWidth = 571 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText @@ -293,7 +293,7 @@ object FormConfCellTCO: TFormConfCellTCO end object GroupBoxOrientation: TGroupBox Left = 8 - Top = 200 + Top = 160 Width = 273 Height = 57 Caption = 'Orientation du signal' @@ -361,7 +361,7 @@ object FormConfCellTCO: TFormConfCellTCO end object GroupBoxImplantation: TGroupBox Left = 8 - Top = 216 + Top = 224 Width = 273 Height = 57 Caption = 'Implantation du signal' @@ -485,8 +485,8 @@ object FormConfCellTCO: TFormConfCellTCO OnClick = CheckPinvClick end object GroupBoxAction: TGroupBox - Left = 112 - Top = 72 + Left = 352 + Top = 80 Width = 273 Height = 145 Caption = 'Actions' @@ -527,6 +527,9 @@ object FormConfCellTCO: TFormConfCellTCO Top = 118 Width = 33 Height = 21 + Hint = 'Param'#232'tre de l'#39'action' + ParentShowHint = False + ShowHint = True TabOrder = 1 OnChange = EditParam1Change end @@ -558,8 +561,8 @@ object FormConfCellTCO: TFormConfCellTCO OnClick = BitBtnAnnuleClick end object GroupBoxCanton: TGroupBox - Left = 16 - Top = 152 + Left = 360 + Top = 288 Width = 281 Height = 129 Caption = 'Canton' @@ -636,8 +639,8 @@ object FormConfCellTCO: TFormConfCellTCO end end object GroupBoxDet: TGroupBox - Left = 32 - Top = 152 + Left = 376 + Top = 24 Width = 281 Height = 121 Caption = 'Options d'#39'arr'#234't des trains sur le d'#233'tecteur' @@ -659,8 +662,8 @@ object FormConfCellTCO: TFormConfCellTCO object ImageListIcones: TImageList Left = 160 Bitmap = { - 494C01011A001D00040010001000FFFFFFFFFF00FFFFFFFFFFFFFFFF424D3600 - 0000000000003600000028000000400000008000000001002000000000000080 + 494C010121002200040010001000FFFFFFFFFF00FFFFFFFFFFFFFFFF424D3600 + 0000000000003600000028000000400000009000000001002000000000000090 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 @@ -725,41 +728,65 @@ object FormConfCellTCO: TFormConfCellTCO 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000080E0000080E0000080E0000080 + E0000080E0000080E0000080E0000080E0000080E0000080E0000080E0000080 + E0000080E0000080E0000080E0000080E0000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000080E0000080E0000080E0000080 + E0000080E0000080E0000080E00000000000000000000080E0000080E0000080 + E0000080E0000080E0000080E0000080E0000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000080E0000080E0000080E0000080 + E0000080E0000080E00000000000000000000080E0000080E0000080E0000080 + E0000080E0000080E0000080E0000080E0000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000080E0000080E0000080E0000080 + E0000080E00000000000000000000080E0000080E0000080E0000080E0000080 + E0000080E0000080E0000080E0000080E0000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000080E0000080E0000080E0000080 + E00000000000000000000080E0000080E0000080E0000080E0000080E0000080 + E0000080E0000080E0000080E0000080E0000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000080E0000080E0000080E0000080 + E0000080E00000000000000000000080E0000080E0000080E0000080E0000080 + E0000080E0000080E0000080E0000080E0000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000080E0000080E0000080E0000080 + E0000080E0000080E00000000000000000000080E0000080E0000080E0000080 + E0000080E0000080E0000080E0000080E0000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000080E0000080E0000080E0000080 + E0000080E0000080E0000080E00000000000000000000080E0000080E0000080 + E0000080E0000080E0000080E0000080E0000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 @@ -800,6 +827,110 @@ object FormConfCellTCO: TFormConfCellTCO 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 + 000000000000000000000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0000FF + 0000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF000000FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF004080E0004080E0004080E0004080 + E0004080E0004080E0004080E0004080E0004080E0004080E0004080E0004080 + E0004080E0004080E0004080E0004080E0000080E0000080E0000080E0000080 + E0000080E0000080E0000080E0000080E0000080E0000080E0000080E0000080 + E0000080E0000080E0000080E0000080E000FFFFFF00FFFFFF00000000000000 + 0000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0000FF000000FF + 000000FF0000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF000000 + FF000000FF000000FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF004080E0004080E0004080E0004080 + E0004080E0004080E0004080E0004080E0004080E0004080E0004080E0004080 + E0004080E0004080E0004080E0004080E0000080E0000080E0000080E0000080 + E0000080E0000080E00000000000000000000080E0000080E0000080E0000080 + E0000080E0000080E0000080E0000080E000FFFFFF00FFFFFF00000000000000 + 0000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0000FF000000FF000000FF + 000000FF000000FF0000FFFFFF00FFFFFF00FFFFFF00FFFFFF000000FF000000 + FF000000FF000000FF000000FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF004080E0004080E0004080E0000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000004080E0004080E0004080E0000080E0000080E0000080E0000080 + E0000080E0000080E0000080E00000000000000000000080E0000080E0000080 + E0000080E0000080E0000080E0000080E0000000000000000000000000000000 + 00000000000000000000FFFFFF00FFFFFF0000FF000000FF000000FF000000FF + 000000FF000000FF000000FF0000FFFFFF00FFFFFF000000FF000000FF000000 + FF000000FF000000FF000000FF000000FF00FFFFFF00FFFFFF00000000000000 + 0000000000000000000000000000000000004080E0004080E0004080E0000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000004080E0004080E0004080E0000080E0000080E0000080E0000080 + E0000080E0000080E0000080E0000080E00000000000000000000080E0000080 + E0000080E0000080E0000080E0000080E0000000000000000000000000000000 + 00000000000000000000FFFFFF0000FF000000FF000000FF000000FF000000FF + 000000FF000000FF000000FF000000FF00000000FF000000FF000000FF000000 + FF000000FF000000FF000000FF000000FF000000FF00FFFFFF00000000000000 + 0000000000000000000000000000000000004080E0004080E0004080E0004080 + E0004080E0004080E0004080E0004080E0004080E0004080E0004080E0004080 + E0004080E0004080E0004080E0004080E0000080E0000080E0000080E0000080 + E0000080E0000080E0000080E0000080E0000080E00000000000000000000080 + E0000080E0000080E0000080E0000080E000FFFFFF00FFFFFF00000000000000 + 0000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0000FF000000FF000000FF + 000000FF000000FF0000FFFFFF00FFFFFF00FFFFFF00FFFFFF000000FF000000 + FF000000FF000000FF000000FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF004080E0004080E0004080E0000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000004080E0004080E0004080E0000080E0000080E0000080E0000080 + E0000080E0000080E0000080E0000080E00000000000000000000080E0000080 + E0000080E0000080E0000080E0000080E000FFFFFF00FFFFFF00000000000000 + 0000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0000FF000000FF000000FF + 000000FF000000FF0000FFFFFF00FFFFFF00FFFFFF00FFFFFF000000FF000000 + FF000000FF000000FF000000FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF004080E0004080E0004080E0000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000004080E0004080E0004080E0000080E0000080E0000080E0000080 + E0000080E0000080E0000080E00000000000000000000080E0000080E0000080 + E0000080E0000080E0000080E0000080E000FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0000FF000000FF000000FF + 000000FF000000FF0000FFFFFF00FFFFFF00FFFFFF00FFFFFF000000FF000000 + FF000000FF000000FF000000FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF004080E0004080E0004080E0004080 + E0004080E0004080E0004080E0004080E0004080E0004080E0004080E0004080 + E0004080E0004080E0004080E0004080E0000080E0000080E0000080E0000080 + E0000080E0000080E00000000000000000000080E0000080E0000080E0000080 + E0000080E0000080E0000080E0000080E0000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 000000000000008080000000000000000000000000008080000000000000C0C0 C000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 @@ -809,24 +940,24 @@ object FormConfCellTCO: TFormConfCellTCO 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000008080008000000000000000000000000000000000008000000000000000 - 0000800000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 + 00008000000000000000000000000000000000000000FF000000FF000000FF00 + 0000FF0000000000000000000000000000000000000000000000000000000000 + 0000FF000000FF000000FF000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000C0C0 C00000000000C0C0C000000000000000000000000000C0C0C000000000008000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FF000000FF000000FF00 + 0000FF0000000000000000000000000000000000000000000000000000000000 + 0000FF000000FF000000FF000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000C0C0 C00000000000C0C0C00000000000000000000000000000008000000000000000 0000C0C0C0000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 + 0000FF000000FF00000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 @@ -834,7 +965,7 @@ object FormConfCellTCO: TFormConfCellTCO 0000000000000000000000000000000000000000000000000000000000000000 0000000080008080000000000000000000000000800000000000C0C0C0000000 8000808000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000FF000000FF000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 @@ -842,7 +973,7 @@ object FormConfCellTCO: TFormConfCellTCO 0000000000000000000000000000000000000000000000000000000000000000 0000C0C0C00000000000800000000080800000000000C0C0C000000000000000 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000FF000000FF0000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 @@ -850,7 +981,7 @@ object FormConfCellTCO: TFormConfCellTCO 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000808000000000008000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000FF000000FF000000FF00000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 @@ -858,66 +989,66 @@ object FormConfCellTCO: TFormConfCellTCO 0000000000000000000000000000000000000000000000000000000000000000 000000000000C0C0C00000000000800000000000800000000000C0C0C0000000 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000FF000000FF000000FF000000FF000000000000000000 + 000000000000000000000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF0000FF0000FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000080800080000000000000000000000000008000808000000000 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000FF000000FF00000000000000FF000000FF0000000000 + 000000000000000000000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF0000FF000000FF000000FF0000FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000080800080800000000000000000000000808000800000000000 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000FF000000FF0000000000000000000000FF000000FF00 + 000000000000000000000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0000FF000000FF000000FF000000FF000000FF0000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 000000000000C0C0C00080000000000000000000000000008000808000000000 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000FF000000FF0000000000000000000000000000000000 + 000000000000000000000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFF + FF0000FF000000FF000000FF000000FF000000FF000000FF000000FF0000FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000808000000000000000000080000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000FF000000FF0000000000000000000000000000000000 + 000000000000000000000000000000000000FFFFFF00FFFFFF00FFFFFF0000FF + 000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF + 0000FFFFFF00FFFFFF00FFFFFF00FFFFFF000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000000000000000000000000000FF00 + 00000000000000000000FF000000FF0000000000000000000000FF0000000000 + 000000000000000000000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0000FF000000FF000000FF000000FF000000FF0000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000000000000000000000000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000 + 000000000000000000000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0000FF000000FF000000FF000000FF000000FF0000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF000000000000000000000000000000 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 - 00000000000000000000000000000000000000FF000000FF000000FF000000FF + 000000000000000000000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0000FF000000FF000000FF000000FF000000FF0000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0000FF000000FF000000FF000000FF 000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF 000000FF000000FF000000FF000000FF00000000000000000000000000000000 00000000000000FF000000FF000000FF000000FF000000FF000000FF00000000 @@ -1686,16 +1817,20 @@ object FormConfCellTCO: TFormConfCellTCO 0000000000000000000000000000000000008080000080800000808000008080 0000808000008080000080800000808000008080000080800000808000008080 000080800000808000008080000080800000424D3E000000000000003E000000 - 2800000040000000800000000100010000000000000400000000000000000000 - 000000000000000000000000FFFFFF0000000000000000000000000000000000 + 2800000040000000900000000100010000000000800400000000000000000000 + 000000000000000000000000FFFFFF00FFFF000000000000742E000000000000 + 75EE000000000000546A00000000000025E4000000000000742E000000000000 + FFFF000000000000FFFF00000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000FFFFFFFFFFFFFFFF742E742E742E742E + 75EE75EE75EE75EE546A546A546A546A25E425E425E425E4742E742E742E742E + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 00000000000000000000000000000000FFFFFFFF00000000FFFFF82700000000 - FFFFF38700000000FFFFE38F00000000FFBFE38700000000FF9FF30700000000 - C007F03F00000000C003FC7F00000000C001F81F00000000C003F99F00000000 - C007F99F00000000FF9FF99F00000000FFBFFC3F00000000FFFFFFFF00000000 - FFFFFFFF00000000FFFFFFFF000000000000F81FFFFF00000000E007FC3F0000 + 00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFF827FFFF742E + FFFFF38787F175EEFFFFE38F87F1546AFFBFE387F3FF25E4FF9FF307F9FF742E + C007F03FFCFFFFFFC003FC7FFC7FFFFFC001F81FFC3F0000C003F99FFC9F0000 + C007F99FFCCF0000FF9FF99FFCFF0000FFBFFC3FFCFF0000FFFFFFFFECDF0000 + FFFFFFFFE01F0000FFFFFFFFFFFF00000000F81FFFFF00000000E007FC3F0000 0000C003F81F00000000C001F00F000000008001F00F000000000180F00F0000 000003C0F00F0000000007E0F00F0000000007E0F00F0000000003C0F00F0000 00000180F00F000000008001F00F00000000C001F00F00000000C003F00F0000 diff --git a/UnitConfigCellTCO.pas b/UnitConfigCellTCO.pas index d522c34..33b85d2 100644 --- a/UnitConfigCellTCO.pas +++ b/UnitConfigCellTCO.pas @@ -105,7 +105,7 @@ const AcArret_horloge=7; AcInit_horloge=8; AcAff_horloge=9; - + AcBouton_bistable=10; var FormConfCellTCO: TFormConfCellTCO; @@ -120,8 +120,6 @@ uses UnitPrinc,UnitAnalyseSegCDM,UnitConfigTCO,UnitTCO,selection_train; {$R *.dfm} -//https://codes-sources.commentcamarche.net/forum/affich-1015879-ajouter-un-icon-dans-un-listbox - // procédure qui met la bd à jour, et réactualise la cellule, ce qui appelle "select elements" procedure stocke_bd; var Bim,x,y,act : integer; @@ -192,7 +190,8 @@ begin // arreter horloge AcArret_horloge : begin - EditParam1.Visible:=false; EditParam2.Visible:=false; + EditParam1.Visible:=false; + EditParam2.Visible:=false; end; // initialiser horloge AcInit_horloge : @@ -200,6 +199,13 @@ begin EditParam1.Visible:=false; EditParam2.Visible:=false; end; + AcBouton_bistable : + begin + EditParam1.Visible:=true; + EditParam1.Hint:='Numéro de bouton'; + EditParam1.Text:=intToSTR(tco[indexTCO,XclicC,YclicC].Adresse); + EditParam2.Visible:=false; + end; end; end; @@ -660,15 +666,18 @@ end; procedure TFormConfCellTCO.EditAdrElementChange(Sender: TObject); -var Adr,erreur,index,Bimage : integer; +var Adr,erreur,index,Bimage,x,y : integer; begin if clicTCO or not(ConfCellTCO) or actualize then exit; if affevt then Affiche('TFormConfCellTCO.EditAdrElementChange',clyellow); clicTCO:=true; - Bimage:=tco[indexTCOcourant,XclicCell[indexTCOcourant],YclicCell[indexTCOcourant]].BImage; + x:=XclicCell[indexTCOcourant]; + y:=YclicCell[indexTCOcourant]; + + Bimage:=tco[indexTCOcourant,x,y].BImage; if (Bimage=1) or (Bimage=10) or (Bimage=11) or (Bimage=20) then begin - if tco[indexTCOcourant,XclicCell[indexTCOcourant],YclicCell[indexTCOcourant]].buttoir<>0 then + if tco[indexTCOcourant,x,y].buttoir<>0 then begin EditAdrElement.Text:=''; clicTCO:=false; @@ -679,14 +688,14 @@ begin Val(EditAdrElement.Text,Adr,erreur); if (erreur<>0) or (Adr<0) or (Adr>2048) then Adr:=0; - if Adr=0 then tco[indexTCOcourant,XclicCell[indexTCOcourant],YclicCell[indexTCOcourant]].repr:=2; + if Adr=0 then tco[indexTCOcourant,x,y].repr:=2; - tco[indexTCOcourant,XclicCell[indexTCOcourant],YclicCell[indexTCOcourant]].Adresse:=Adr; + tco[indexTCOcourant,x,y].Adresse:=Adr; formTCO[indexTCOcourant].EditAdrElement.Text:=intToSTR(adr); clicTCO:=false; - if tco[indexTCOcourant,XclicCell[indexTCOcourant],YclicCell[indexTCOcourant]].BImage=Id_signal then + if BImage=Id_signal then begin index:=Index_Signal(adr); if index=0 then exit @@ -696,6 +705,17 @@ begin affiche_tco(indexTCOcourant); end; end; + + if (BImage=Id_action) and (ligneclicAction+1=ActionBoutonTCO) then + begin + //if not BoutonTCO[Adr].existe then + begin + boutonTCO[adr].idtco:=indexTCOCourant; + boutonTCO[adr].x:=x; + boutonTCO[adr].y:=y; + end; + end; + if not(selectionaffichee[indexTCOcourant]) then efface_entoure(indexTCOcourant); Affiche_cellule(indexTCOcourant,XclicCell[indexTCOcourant],YclicCell[indexTCOcourant]); if not(selectionaffichee[indexTCOcourant]) then _entoure_cell_clic(indexTCOcourant); @@ -750,6 +770,7 @@ begin //RadioButtonGH.Visible:=not(diffusion); //RadioButtonDB.Visible:=not(diffusion); //RadioButtonDS.Visible:=not(diffusion); + width:=320;Height:=504; with GroupBoxDet do begin left:=16; @@ -839,6 +860,8 @@ begin itemHeight:=16; Items.Add(Format('%d%s', [8, 'Afficher l''horloge'])); itemHeight:=16; + Items.Add(Format('%d%s', [26, 'Bouton bistable'])); + itemHeight:=16; end; // dessine les composants - non utilisé @@ -1196,6 +1219,7 @@ procedure TFormConfCellTCO.EditParam1Change(Sender: TObject); var i,erreur,act : integer; begin act:=ligneclicAction+1; + case act of AcChangeTCO : // afficher TCO n begin @@ -1212,7 +1236,6 @@ begin Affiche_cellule(IndexTCOCourant,XclicCell[indexTCOCourant],YclicCell[indexTCOCourant]); end; - //sortie AcActSortie : begin @@ -1223,6 +1246,16 @@ begin Affiche_cellule(IndexTCOCourant,XclicCell[indexTCOCourant],YclicCell[indexTCOCourant]); end; + // bouton + AcBouton_bistable : + begin + if clicTCO then exit; + val(EditParam1.Text,i,erreur); + if erreur<>0 then exit; + tco[IndexTCOCourant,XclicCell[indexTCOCourant],YclicCell[indexTCOCourant]].adresse:=i; + Affiche_cellule(IndexTCOCourant,XclicCell[indexTCOCourant],YclicCell[indexTCOCourant]); + end; + end; end; @@ -1385,6 +1418,8 @@ begin affiche_tco(indexTCOcourant); end; + + end. diff --git a/UnitIntro.dfm b/UnitIntro.dfm index 1488230..779a2d8 100644 --- a/UnitIntro.dfm +++ b/UnitIntro.dfm @@ -3,8 +3,8 @@ object FormIntro: TFormIntro Top = 150 BorderStyle = bsDialog Caption = 'Introduction de donn'#233'es' - ClientHeight = 95 - ClientWidth = 186 + ClientHeight = 106 + ClientWidth = 188 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText @@ -15,22 +15,41 @@ object FormIntro: TFormIntro PixelsPerInch = 96 TextHeight = 13 object LabeledEditDetAig: TLabeledEdit - Left = 40 + Left = 24 Top = 24 - Width = 121 + Width = 57 Height = 21 EditLabel.Width = 47 EditLabel.Height = 13 EditLabel.Caption = 'D'#233'tecteur' TabOrder = 0 end - object ButtonTrouver: TButton - Left = 56 - Top = 56 - Width = 75 + object ButtonTrCanton: TButton + Left = 112 + Top = 64 + Width = 65 Height = 25 Caption = 'Trouver' TabOrder = 1 - OnClick = ButtonTrouverClick + OnClick = ButtonTrCantonClick + end + object LabeledEditCanton: TLabeledEdit + Left = 24 + Top = 64 + Width = 57 + Height = 21 + EditLabel.Width = 34 + EditLabel.Height = 13 + EditLabel.Caption = 'Canton' + TabOrder = 2 + end + object ButtonTrDet: TButton + Left = 112 + Top = 24 + Width = 65 + Height = 25 + Caption = 'Trouver' + TabOrder = 3 + OnClick = ButtonTrDetClick end end diff --git a/UnitIntro.pas b/UnitIntro.pas index 4628326..53d800c 100644 --- a/UnitIntro.pas +++ b/UnitIntro.pas @@ -9,8 +9,11 @@ uses type TFormIntro = class(TForm) LabeledEditDetAig: TLabeledEdit; - ButtonTrouver: TButton; - procedure ButtonTrouverClick(Sender: TObject); + ButtonTrCanton: TButton; + LabeledEditCanton: TLabeledEdit; + ButtonTrDet: TButton; + procedure ButtonTrCantonClick(Sender: TObject); + procedure ButtonTrDetClick(Sender: TObject); private { Déclarations privées } public @@ -19,17 +22,23 @@ type var FormIntro: TFormIntro; - Achercher : integer; + AchercherDet,AchercherCanton : integer; implementation {$R *.dfm} -procedure TFormIntro.ButtonTrouverClick(Sender: TObject); -var i,erreur : integer; +procedure TFormIntro.ButtonTrCantonClick(Sender: TObject); +var erreur : integer; begin - val(LabeledEditDetAig.text,i,erreur); - Achercher:=i; + val(LabeledEditCanton.text,Acherchercanton,erreur); + close; +end; + +procedure TFormIntro.ButtonTrDetClick(Sender: TObject); +var erreur : integer; +begin + val(LabeledEditDetAig.text,AchercherDet,erreur); close; end; diff --git a/UnitModifAction.dfm b/UnitModifAction.dfm index 8fb8c90..187a437 100644 --- a/UnitModifAction.dfm +++ b/UnitModifAction.dfm @@ -37,20 +37,12 @@ object FormModifAction: TFormModifAction Width = 3 Height = 13 end - object Shape3: TShape - Left = 8 - Top = 408 - Width = 73 - Height = 25 - 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 @@ -68,7 +60,7 @@ object FormModifAction: TFormModifAction Top = 64 Width = 729 Height = 337 - ActivePage = TabSheet1 + ActivePage = TabSheetOp MultiLine = True TabOrder = 1 object TabSheetDecl: TTabSheet @@ -748,7 +740,7 @@ object FormModifAction: TFormModifAction object SpinEditEtatop: TSpinEdit Left = 152 Top = 32 - Width = 33 + Width = 41 Height = 22 MaxValue = 0 MinValue = 0 diff --git a/UnitModifAction.pas b/UnitModifAction.pas index c4e21b8..5861680 100644 --- a/UnitModifAction.pas +++ b/UnitModifAction.pas @@ -86,7 +86,6 @@ type ButtonVoirFonc: TButton; LabelInfoFonc: TLabel; Label2InfoFonction: TLabel; - Shape3: TShape; SpeedButton1: TSpeedButton; procedure FormCreate(Sender: TObject); procedure ListBoxOperDrawItem(Control: TWinControl; Index: Integer; @@ -155,6 +154,7 @@ var ClicDeclenche,ClicAction,ClicCond,DeclencheurAffiche,OperationAffiche : integer; function Info_action(i : integer) : string; +procedure affecte_operation(i : integer;t: TListBox); implementation @@ -163,8 +163,7 @@ uses Unitprinc, UnitConfigCellTCO, UnitConfig; {$R *.dfm} - - +// rend tous les composants invisibles procedure efface_tous_parametres; begin with FormModifAction do @@ -211,18 +210,25 @@ begin end; end; +// ajoute à la listbox t une ligne avec son icone opérations[] +procedure affecte_operation(i : integer;t : tListBox); +begin + if i '+intToSTR(tablo_action[i].tabloCond[op].etat); end; s:=s+#13; @@ -460,6 +473,10 @@ begin r:=nop/10; s:=s+'Temporisation '+intToSTR(nop)+' ('+Format('%.1f', [r])+'s)'#13; end; + ActionBoutonTCO : s:=s+'Change l''état du bouton '+intToSTR(Tablo_Action[i].tabloop[op].adresse)+' à '+intToSTR(Tablo_Action[i].tabloop[op].etat)+#13; + ActionAffecteMemoire : s:=s+'Affectation de la mémoire '+intToSTR(Tablo_Action[i].tabloop[op].adresse)+' à '+intToSTR(Tablo_Action[i].tabloop[op].etat)+#13; + ActionIncMemoire : s:=s+'Incrémentation de la mémoire '+intToSTR(Tablo_Action[i].tabloop[op].adresse)+#13; + ActionDecMemoire : s:=s+'Décrémentation de la mémoire '+intToSTR(Tablo_Action[i].tabloop[op].adresse)+#13; end; end; result:=s; @@ -512,10 +529,18 @@ begin if not(Tablo_Action[index].tabloOp[i].valide) then s:=s+' [dévalidé]'; if act<1 then icone:=0 else icone:=act-1; - items.Add(Format('%d%s', [icone, s])); // valeur d'index de l'icone dans la ImagelistIcones + // listbox de la formmodifAction + if act<=ActionTempo then items.Add(Format('%d%s', [icone, s])); // valeur d'index de l'icone dans la ImagelistIcones + if act=ActionBoutonTCO then items.Add(Format('%d%s', [iconeBouton, s])); + if act=ActionAffecteMemoire then items.Add(Format('%d%s', [iconeActionAffecteMemoire, s])); + if act=ActionIncMemoire then items.Add(Format('%d%s', [iconeActionIncMemoire, s])); + if act=ActionDecMemoire then items.Add(Format('%d%s', [iconeActionDecMemoire, s])); + // listboxOperations de la formConfig - formConfig.ListBoxOperations.Items.add(Format('%d%s', [act-1, s])); + if act<=ActionTempo then formConfig.ListBoxOperations.Items.add(Format('%d%s', [act-1, s])); + if act=ActionBoutonTCO then formConfig.ListBoxOperations.items.Add(Format('%d%s', [IconeBouton, s])); + itemHeight:=17; end; end; @@ -538,6 +563,10 @@ begin condHorl : icone:=IconeLanceHorl; condTrainSig : icone:=IconeDeclSignal; condFonction : icone:=IconeFonction; + condBouton : icone:=IconeBouton; + condMemoireEgal: icone:=IconeCondMemoireEgal; + condMemoireSup: icone:=IconeCondMemoireSup; + condMemoireInf: icone:=IconeCondMemoireinf; end; items.Add(Format('%d%s', [icone, s])); // valeur d'index de l'icone dans la ImagelistIcones @@ -613,6 +642,7 @@ begin with SpinEditEtat do begin text:=intToSTR(Tablo_Action[index].etat); + MaxValue:=0; MaxValue:=2; Hint:='Etat de l''accessoire'+#13+ '0=nul'+#13+ @@ -660,6 +690,7 @@ begin with SpinEditEtat do begin text:=intToSTR(Tablo_Action[index].etat); + MaxValue:=0; MaxValue:=1; Hint:='Etat du détecteur/actionneur'+#13+ '0=désactivé'+#13+ @@ -702,6 +733,7 @@ begin with SpinEditEtat do begin text:=intToSTR(Tablo_Action[index].etat); + MaxValue:=0; MaxValue:=1; Hint:='Etat de la zone de détection'+#13+ '0=désactivé'+#13+ @@ -832,6 +864,7 @@ begin ButtonVoirFonc.Visible:=false; labelEtat2.Visible:=true; SpinEditEtat2.visible:=true; + SpinEditEtat2.MinValue:=0; SpinEditEtat2.MaxValue:=2; end; condHorl : @@ -869,12 +902,30 @@ begin Label2InfoFonction.Visible:=true; Label2InfoFonction.Caption:=NomFonction[Tablo_Action[index].tabloCond[indexCond].adresse]; end; + condBouton : + begin + champ1.Text:=intToSTR(Tablo_Action[index].tabloCond[indexCond].adresse); + champ1.editLabel.Caption:='Numéro de bouton TCO'; + champTrain.Text:=Tablo_Action[index].tabloCond[indexCond].train; + champ1.Visible:=true; + ButtonVoirFonc.Visible:=false; + champTrain.Visible:=false; + Label2InfoFonction.Visible:=false; + end; + condMemoireEgal,CondMemoireInf,CondMemoireSup : + begin + champ1.Text:=intToSTR(Tablo_Action[index].tabloCond[indexCond].adresse); + champ1.editLabel.Caption:='Numéro de mémoire'; + champ1.Visible:=true; + champ2.Text:=intToSTR(Tablo_Action[index].tabloCond[indexCond].etat); + Champ2.EditLabel.Caption:='Valeur'; + Champ2.Visible:=true; + end; end; end; end; - Nb:=Tablo_Action[index].NbOperations; // si pas d'action sélectionnée et que la liste n'est pas nulle, sélectionner la première @@ -971,15 +1022,44 @@ begin LabeledEditTempoF.EditLabel.Caption:='Temporisation (x100 ms)'; LabeledEditTempoF.Text:=intToSTR(Tablo_Action[index].tabloop[indexAction].TempoF); end; + ActionBoutonTCO : + begin + LabeledEditAdresse.Visible:=true; + LabeledEditAdresse.EditLabel.Caption:='Bouton'; + LabeledEditAdresse.text:=intToSTR(Tablo_Action[index].tabloop[indexAction].adresse); + SpinEditEtatOp.Text:=intToSTR(Tablo_Action[index].tabloop[indexAction].etat); + SpinEditEtatOp.Visible:=true; + SpinEditEtatOp.MinValue:=0; + SpinEditEtatOp.MaxValue:=1; + end; + ActionAffecteMemoire : + begin + LabeledEditAdresse.EditLabel.Caption:='Mémoire'; + LabeledEditAdresse.Visible:=true; + LabeledEditAdresse.text:=intToSTR(Tablo_Action[index].tabloop[indexAction].adresse); + SpinEditEtatOp.Text:=intToSTR(Tablo_Action[index].tabloop[indexAction].etat); + SpinEditEtatOp.Visible:=true; + SpinEditEtatOp.MinValue:=-999; + SpinEditEtatOp.MaxValue:=999; + end; + ActionIncMemoire : + begin + LabeledEditAdresse.EditLabel.Caption:='Mémoire'; + LabeledEditAdresse.Visible:=true; + LabeledEditAdresse.text:=intToSTR(Tablo_Action[index].tabloop[indexAction].adresse); + end; + ActionDecMemoire : + begin + LabeledEditAdresse.EditLabel.Caption:='Mémoire'; + LabeledEditAdresse.Visible:=true; + LabeledEditAdresse.text:=intToSTR(Tablo_Action[index].tabloop[indexAction].adresse); + end; end; end; end; clicliste:=false; end; - - - procedure TFormModifAction.FormActivate(Sender: TObject); var i : integer; s : string; @@ -1009,18 +1089,17 @@ begin LabelDecl.Caption:='Liste de déclencheurs de l''action n°'+intToSTR(ComboBoxactions.ItemIndex+1); end; - procedure TFormModifAction.ButtonAppActionClick(Sender: TObject); var indexSrc,IndexDest,i : integer; s : string; begin indexSrc:=listboxOper.ItemIndex; IndexDest:=ListBoxOperations.Itemindex; - if (indexSrc<0) or (ligneclicAct<0) then exit; - + if (indexSrc<0) or (ligneclicAct<0) or (Tablo_Action[ligneClicAct+1].NbOperations<1) then exit; s:=ListBoxOper.Items[indexSrc]; i:=Index_Operation(s); + if i=0 then exit; if (IndexDest<0) then IndexDest:=0; Tablo_Action[ligneClicAct+1].TabloOp[IndexDest+1].numoperation:=i; @@ -1055,11 +1134,8 @@ begin Aff_champs(idbd,nbCond,Nbop); clicAction:=NbOp-1; ListBoxOperations.ItemIndex:=clicAction; - end; - - procedure supprime_operation; var i,indexSrc,idBD,NbOp,NumOp : integer; s : string; @@ -1131,19 +1207,15 @@ begin for i:=1 to Tablo_Action[idBD].NbOperations do begin no:=Tablo_Action[idBD].tabloOp[i].numoperation; - items.Add(Format('%d%s', [no-1, operations[no].nom])); // valeur d'index de l'icone dans la ImagelistIcones + //items.Add(Format('%d%s', [no-1, operations[no].nom])); // valeur d'index de l'icone dans la ImagelistIcones + affecte_operation(no,ListBoxOperations); itemHeight:=17; end; ItemIndex:=indexSrc-1; end; - - //Affiche(intToSTR(ligneClicAct),clyellow); - - end; procedure TFormModifAction.SpinButton1DownClick(Sender: TObject); - var no,i,indexSrc,idBD,idOp : integer; top : Toperation; s : string; @@ -1153,7 +1225,6 @@ begin idBD:=ligneClicAct+1; idop:=indexSrc+1; - no:=Tablo_Action[idBD].NbOperations; if (indexSrc+1>=No) then exit; @@ -1161,7 +1232,6 @@ begin Tablo_Action[idBD].TabloOp[idOp+1]:=Tablo_Action[idBD].TabloOp[idOp]; Tablo_Action[idBD].TabloOp[idOp]:=top; - // réencoder la ligne s:=encode_actions(idBD); // maj combobox @@ -1175,16 +1245,12 @@ begin for i:=1 to Tablo_Action[idBD].NbOperations do begin no:=Tablo_Action[idBD].tabloOp[i].numoperation; - items.Add(Format('%d%s', [no-1, operations[no].nom])); // valeur d'index de l'icone dans la ImagelistIcones + affecte_operation(no,ListBoxOperations); itemHeight:=17; end; ItemIndex:=indexSrc+1; end; - - //Affiche(intToSTR(ligneClicAct),clyellow); - - end; procedure maj_combocactions(i : integer); @@ -1239,6 +1305,7 @@ begin if decl=DeclZoneDet then Tablo_Action[index].adresse2:=i; if decl=DeclFonction then begin + if (i<1) or (i>100) then exit; Tablo_Action[index].adresse:=i; LabelInfoFonc.caption:=NomFonction[i]; end; @@ -1293,7 +1360,6 @@ begin Aff_champs(ligneclicAct+1,1,ClicAction+1); end; - procedure TFormModifAction.LabeledEditAdresseChange(Sender: TObject); var i,erreur,op : integer; begin @@ -1304,6 +1370,10 @@ begin ActionAffTCO : Tablo_Action[ligneclicact+1].tabloOp[clicaction+1].numTCO:=i; ActionAccessoire: Tablo_Action[ligneclicact+1].tabloOp[clicaction+1].adresse:=i; ActionVitesse : Tablo_Action[ligneclicact+1].tabloOp[clicaction+1].vitesse:=i; + ActionBoutonTCO : Tablo_Action[ligneclicact+1].tabloOp[clicaction+1].adresse:=i; + ActionAffecteMemoire : Tablo_Action[ligneclicact+1].tabloOp[clicaction+1].adresse:=i; + ActionIncMemoire : Tablo_Action[ligneclicact+1].tabloOp[clicaction+1].adresse:=i; + ActionDecMemoire : Tablo_Action[ligneclicact+1].tabloOp[clicaction+1].adresse:=i; end; maj_combocactions(ligneclicAct); end; @@ -1379,142 +1449,6 @@ begin maj_combocactions(ligneclicAct); end; -// affiche les champs de l'actionneur PN en fonction de l'index du tableau -{ -procedure aff_champs_PN(i : integer); -var erreur,j,v,periph : integer; - trouve : boolean; - s : string; -begin - - if affevt then affiche('Aff_champs_PN('+intToSTR(i)+')',clyellow); - if i<1 then - begin - clicliste:=false; - exit; - end; - //s:=Uppercase(formModifAction.ListBoxPN.items[i-1]); - if s='' then - begin - clicliste:=false; - exit; - end; - - with formModifAction do - begin - LabelInfo.caption:=''; - raz_champs_pn; - end; - - // actionneur passage à niveau - if s[1]='(' then - begin - champs_type_pn; - // trouver le numéro de périphérique - v:=pos('PN(',s); - delete(s,1,v+2); - val(s,periph,erreur); - { - i:=0; - repeat - inc(i); - trouve:=(Tablo_PN[i].AdresseFerme=adresse); - until trouve or (i>NbrePN); - if not(trouve) then exit;} - { - with formModifAction do - begin - RadioGroupActPN.itemindex:=Tablo_PN[i].TypeCde; - - if Tablo_PN[i].TypeCde=0 then champs_pn_act; - if Tablo_PN[i].TypeCde=1 then champs_pn_comusbSockets; - - if Tablo_PN[i].Pulse=1 then trouve:=true else trouve:=false; - CheckPnPulse.Checked:=trouve; - - // par actionneur - if Tablo_PN[i].actionneur then - begin - RadioButtonSimple.Checked:=true; - RadioButtonZone.Checked:=false; - GroupBoxPNA.Visible:=true; - GroupBoxPNZ.Visible:=false; - EditV1F.text:=intToSTR(Tablo_PN[i].voie[1].ActFerme); - EditV1O.text:=intToSTR(Tablo_PN[i].voie[1].ActOuvre); - v:=Tablo_PN[i].nbvoies; - if v>=2 then - begin - EditV2F.text:=intToSTR(Tablo_PN[i].voie[2].ActFerme); - EditV2O.text:=intToSTR(Tablo_PN[i].voie[2].ActOuvre); - end; - if v>=3 then - begin - EditV3F.text:=intToSTR(Tablo_PN[i].voie[3].ActFerme); - EditV3O.text:=intToSTR(Tablo_PN[i].voie[3].ActOuvre); - end; - if v>=4 then - begin - EditV4F.text:=intToSTR(Tablo_PN[i].voie[4].ActFerme); - EditV4O.text:=intToSTR(Tablo_PN[i].voie[4].ActOuvre); - end; - if v>=5 then - begin - EditV5F.text:=intToSTR(Tablo_PN[i].voie[5].ActFerme); - EditV5O.text:=intToSTR(Tablo_PN[i].voie[5].ActOuvre); - end; - - end - else - begin - // par zone de détecteurs - RadioButtonSimple.Checked:=false; - RadioButtonZone.Checked:=true; - GroupBoxPNA.Visible:=false; - GroupBoxPNZ.Visible:=true; - v:=Tablo_PN[i].nbvoies; - j:=Tablo_PN[i].voie[1].detZ1F;if j<>0 then - begin - EditZdet1V1F.text:=intToSTR(j); - EditZdet2V1F.text:=intToSTR(Tablo_PN[i].voie[1].detZ2F); - EditZdet1V1O.text:=intToSTR(Tablo_PN[i].voie[1].detZ1O); - EditZdet2V1O.text:=intToSTR(Tablo_PN[i].voie[1].detZ2O); - if v>=2 then - begin - EditZdet1V2F.text:=intToSTR(Tablo_PN[i].voie[2].detZ1F); - EditZdet2V2F.text:=intToSTR(Tablo_PN[i].voie[2].detZ2F); - EditZdet1V2O.text:=intToSTR(Tablo_PN[i].voie[2].detZ1O); - EditZdet2V2O.text:=intToSTR(Tablo_PN[i].voie[2].detZ2O); - end; - if v>=3 then - begin - EditZdet1V3F.text:=intToSTR(Tablo_PN[i].voie[3].detZ1F); - EditZdet2V3F.text:=intToSTR(Tablo_PN[i].voie[3].detZ2F); - EditZdet1V3O.text:=intToSTR(Tablo_PN[i].voie[3].detZ1O); - EditZdet2V3O.text:=intToSTR(Tablo_PN[i].voie[3].detZ2O); - end; - if v>=4 then - begin - EditZdet1V4F.text:=intToSTR(Tablo_PN[i].voie[4].detZ1F); - EditZdet2V4F.text:=intToSTR(Tablo_PN[i].voie[4].detZ2F); - EditZdet1V4O.text:=intToSTR(Tablo_PN[i].voie[4].detZ1O); - EditZdet2V4O.text:=intToSTR(Tablo_PN[i].voie[4].detZ2O); - end; - if v>=5 then - begin - EditZdet1V5F.text:=intToSTR(Tablo_PN[i].voie[5].detZ1F); - EditZdet2V5F.text:=intToSTR(Tablo_PN[i].voie[5].detZ2F); - EditZdet1V5O.text:=intToSTR(Tablo_PN[i].voie[5].detZ1O); - EditZdet2V5O.text:=intToSTR(Tablo_PN[i].voie[5].detZ2O); - end; - end; - end; - end; - end; - clicliste:=false; -end; -} - - procedure TFormModifAction.ButtonApplDeclClick(Sender: TObject); var i : integer; begin @@ -1537,8 +1471,6 @@ begin Aff_champs(index,0,0); end; - - procedure TFormModifAction.ComboBoxAccComUSBChange(Sender: TObject); var index : integer; begin @@ -1566,8 +1498,6 @@ begin maj_combocactions(ligneclicAct); end; - - procedure TFormModifAction.ListBoxCondTotDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); var @@ -1626,14 +1556,11 @@ begin if (IndexDest<0) then IndexDest:=0; Tablo_Action[ligneClicAct+1].TabloCond[IndexDest+1].numCondition:=i; - listboxConditions.Items[indexDest]:=ListBoxCondTot.Items[indexSrc]; - clicAction:=ligneclicact; Aff_champs(ligneClicAct+1,indexDest+1,0); end; - procedure TFormModifAction.Champ1Change(Sender: TObject); var cond,i,erreur : integer; begin @@ -1648,6 +1575,9 @@ begin Tablo_Action[ligneclicact+1].tabloCond[cliccond+1].adresse:=i; Label2InfoFonction.caption:=NomFonction[i]; end; + CondBouton : Tablo_Action[ligneclicact+1].tabloCond[cliccond+1].adresse:=i; + CondMemoireEgal,CondMemoireInf,CondMemoireSup + : Tablo_Action[ligneclicact+1].tabloCond[cliccond+1].adresse:=i; end; maj_combocactions(ligneclicAct); end; @@ -1660,6 +1590,8 @@ begin cond:=Tablo_Action[ligneclicact+1].tabloCond[cliccond+1].numcondition; case cond of CondVitTrain : Tablo_Action[ligneclicact+1].tabloCond[cliccond+1].vitmaxi:=i; + CondMemoireEgal,CondMemoireInf,CondMemoireSup + : Tablo_Action[ligneclicact+1].tabloCond[cliccond+1].etat:=i; end; maj_combocactions(ligneclicAct); end; @@ -1794,6 +1726,8 @@ begin case op of ActionAccessoire : Tablo_Action[ligneclicact+1].tabloOp[clicaction+1].etat:=i; ActionFonctionF : Tablo_Action[ligneclicact+1].tabloOp[clicaction+1].etat:=i; + ActionBoutonTCO : Tablo_Action[ligneclicact+1].tabloOp[clicaction+1].etat:=i; + ActionAffecteMemoire : Tablo_Action[ligneclicact+1].tabloOp[clicaction+1].etat:=i; end; maj_combocactions(ligneclicAct); end; @@ -1844,15 +1778,12 @@ begin clicListe:=false; end; - - procedure TFormModifAction.FormClose(Sender: TObject; var Action: TCloseAction); begin Aff_champs(ligneclicAct+1,1,1); end; - procedure TFormModifAction.ButtonFonctionClick(Sender: TObject); begin formModifAction.Close; diff --git a/UnitPrinc.dfm b/UnitPrinc.dfm index 5e102a4..0defcb1 100644 --- a/UnitPrinc.dfm +++ b/UnitPrinc.dfm @@ -20,8 +20,8 @@ object FormPrinc: TFormPrinc OnCreate = FormCreate OnResize = FormResize DesignSize = ( - 1130 - 567) + 1138 + 574) PixelsPerInch = 96 TextHeight = 13 object LabelTitre: TLabel @@ -1445,8 +1445,8 @@ object FormPrinc: TFormPrinc end object StatusBar1: TStatusBar Left = 0 - Top = 545 - Width = 1130 + Top = 552 + Width = 1138 Height = 22 Panels = < item @@ -2093,6 +2093,10 @@ object FormPrinc: TFormPrinc Hint = 'Affiche l'#39#233'tat des d'#233'tecteurs' OnClick = AffEtatDetecteurs end + object Etatdesactionneurs1: TMenuItem + Caption = 'Etat des actionneurs' + OnClick = Etatdesactionneurs1Click + end object Etatdesaiguillages1: TMenuItem Caption = 'Etat des aiguillages' OnClick = Etatdesaiguillages1Click @@ -2241,6 +2245,11 @@ object FormPrinc: TFormPrinc Hint = 'Modifie les variables de configuration' OnClick = ConfigClick end + object Compilerlabasededonnes1: TMenuItem + Caption = 'Compiler la base de donn'#233'es' + Hint = 'Trie les aiguillages, les signaux, analyse les cantons' + OnClick = Compilerlabasededonnes1Click + end object Vrifierlacohrence: TMenuItem Caption = 'V'#233'rifier la coh'#233'rence' Hint = 'V'#233'rifie la coh'#233'rence de la configuration' diff --git a/UnitPrinc.pas b/UnitPrinc.pas index b0fff0d..c5583ef 100644 --- a/UnitPrinc.pas +++ b/UnitPrinc.pas @@ -5,10 +5,10 @@ unit Unitprinc; Delphi 7 : on utilise activeX Tmscomm pour les liaisons série/USB clientSocket et ServeurSocket pour les connexions réseau socket - + Delphi 12 : on utilise AsyncPro pour les liaisons série/USB - ce composant est compilable en 32 et en 64 bits. - client Socket et ServerSocker pour les connexions réseau socket + clientSocket et ServerSocker pour les connexions réseau socket un essai avec IdTCPClient (Indy) est fait avec D7/D12. En D7 nécéssite le fichier Idtcpclient.dcu. En D12 l'event Rx nécessite un thread et ne fonctionne pas bien. C'est ok en D7. @@ -38,9 +38,9 @@ unit Unitprinc; il faut autoriser l'utilisateur: Utilisateurs (nom\utilisateurs) Pilotage des accessoires: - raquette octet sortie - + 2 = vert = aiguillage droit = sortie 2 de l'adresse d'accessoire - - 1 = rouge = aiguillage dévié = sortie 1 de l'adresse d'accessoire + raquette octet sortie anglais NL + + 2 = vert = close = rechts = aiguillage droit = sortie 2 de l'adresse d'accessoire + - 1 = rouge = thrown = afb = aiguillage dévié = sortie 1 de l'adresse d'accessoire ligne de commande en mode administrateur pour valider le socket du pare feu: netsh advfirewall firewall add rule name="cdm rail" dir=in action=allow program="C:\Program Files (x86)\CDM-Rail\cdr.exe" enable=yes @@ -86,14 +86,14 @@ uses ImgList, ScktComp, StrUtils, Menus, ActnList, MMSystem , Buttons, NB30, comObj, activeX //,DateUtils//, PsAPI {$IFDEF AvecIdTCP} - ,IdTCPClient // client socket indy + ,IdTCPClient // client socket indy , ne marche pas bien {$ENDIF} {$IF CompilerVersion >= 28.0} // si delphi>=12 ,Vcl.Themes // pour les thèmes d'affichage (auric etc) ,AdPort, OoMisc // AsyncPro pour COM/USB ,idGlobal // pour utiliser tidBytes {$ELSE} - ,MSCommLib_TLB // TMSComm pour COM/USB + ,MSCommLib_TLB // TMSComm pour COM/USB {$IFEND} ; @@ -273,6 +273,8 @@ type Mesurerlavitessedestrains: TMenuItem; Affichelamesuredesvitesses1: TMenuItem; Button0: TButton; + Etatdesactionneurs1: TMenuItem; + Compilerlabasededonnes1: TMenuItem; procedure FormCreate(Sender: TObject); {$IF CompilerVersion >= 28.0} procedure RecuInterface(Sender: TObject;count : word); @@ -430,6 +432,8 @@ type procedure MesurerlavitessedestrainsClick(Sender: TObject); procedure Affichelamesuredesvitesses1Click(Sender: TObject); procedure Button0Click(Sender: TObject); + procedure Etatdesactionneurs1Click(Sender: TObject); + procedure Compilerlabasededonnes1Click(Sender: TObject); private { Déclarations privées } procedure DoHint(Sender : Tobject); @@ -646,6 +650,10 @@ CondPosAcc=4; CondHorl=5; CondTrainSig=6; CondFonction=7; +CondBouton=8; +CondMemoireEgal=9; +CondMemoireSup=10; +CondMemoireInf=11; // Type d'opération (action) Action0=0; @@ -663,6 +671,10 @@ ActionCdePeriph=11; ActionFonctionF=12; ActionSon=13; ActionTempo=14; +ActionBoutonTCO=15; +ActionAffecteMemoire=16; +ActionIncMemoire=17; +ActionDecMemoire=18; // icones IconeTCO=0; @@ -686,6 +698,13 @@ IconeSignal=22; IconeDeclSignal=23; IconeDroite=24; IconeFonction=25; +IconeBouton=26; +IconeActionAffecteMemoire=27; +IconeActionIncMemoire=28; +IconeActionDecMemoire=29; +IconeCondMemoireEgal=30; +IconeCondMemoireSup=31; +IconeCondMemoireInf=32; type @@ -694,8 +713,8 @@ Tproc=(Ttrouve_actionneurs_aig,TAig_Adj,Tsuivant_alg3,Tindex_signal_det,TAig_ext Tsignal_suivant_det,Tetat_signal_suivant,TAiguille_deviee,Ttest_memoire_zones,TSignal_precedent,tPresTrainPrec, Treserve_canton,Tlibere_canton,Treserve_dereserve_det,Texplore_el); Tinterface = (_interface,periph1,periph2); // interface USB : interface vers centrale, périphérique 1 ou 2 -Taccessoire = (aigP,signal); // aiguillage ou signal pour la procédure pilote_acc TEquipement = (rien,aig,tjd,tjs,triple,det,buttoir,voie,crois,act,sig); // voie uniquement pour le tco +Taccessoire = (aigP,signal); // aiguillage ou signal pour la procédure pilote_acc TBranche = record BType : Tequipement ; // ne prend que les valeurs suivantes: dét aig Buttoir Adresse : integer ; // adresse du détecteur ou de l'aiguillage @@ -706,10 +725,11 @@ Tfonction = 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 + OpMemoire : integer; // opérateur mémoire : 0=égal 1=> 2=< niveau : integer; // niveau : l'indice 0 contient le numéro de fonction modifiable traite : boolean; etatprec : boolean; // sert au front montant - etatactuel : boolean; // etat actuel + etatactuel : boolean; // etat actuel train : string; end; @@ -760,7 +780,7 @@ TSignal = record contrevoie : boolean; // signal de contrevoie (SNCB) Verscontrevoie : boolean; // signal vers contrevoie (SNCB) FeuBlanc : boolean ; // avec checkbox ou pas - decodeur : integer; // type du décodeur // 'rien','DigitalBahn','CDF','LS-DEC-SNCF','LEB','Digikeijs','Unisemaf','SR','Arcomora',LS_DEC_NMBS,Bmodels, puis les perso + decodeur : integer; // type du décodeur // 'rien','DigitalBahn','CDF','LS-DEC-SNCF','LEB','Digikeijs','Unisemaf','SR','Arcomora',LS_DEC_NMBS,Bmodels,LEA puis les perso Adr_det1 : integer; // adresse du détecteur1 sur lequel il est implanté Adr_det2 : integer; // adresse du détecteur2 sur lequel il est implanté (si un signal est pour plusieurs voies) Adr_det3 : integer; // adresse du détecteur3 sur lequel il est implanté (si un signal est pour plusieurs voies) @@ -861,6 +881,17 @@ Taction = record TabloOp : array of Toperation; end; +TelementRoute=record + // l'index 0 contient dans "adresse" le nombre d'éléments et + // dans "talon" (si talon=true : consigne vitesse négative) + // dans "pos" l'id de route + adresse : integer; // adresse de l'élément + typ : tequipement; // type de l'élément + pos : integer; // position pour la route si l'élément est un aiguillage + talon : boolean; // vrai si l'élément est un aiguillage pris en talon pour la route + traite : boolean; // traité ou non par la procédure aig_canton + end; + Tactionneur = record adresse,prox1,prox2 : integer; NumBranche,IndexBranche : integer; @@ -868,13 +899,6 @@ Tactionneur = record 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) - adresse : integer; // adresse de l'élément - typ : tequipement; // type de l'élément - pos : integer; // position pour la route si l'élément est un aiguillage - talon : boolean; // vrai si l'élément est un aiguillage pris en talon pour la route - traite : boolean; // traité ou non par la procédure aig_canton - end; TUneRoute=array[0..MaxParcoursTablo] of TelementRoute; // Une route @@ -914,7 +938,7 @@ var retEtatDet,roulage,init_aig_cours,affevt,placeAffiche,clicComboTrain,clicAdrTrain, fichier_module_cdm,Diffusion,cdmDevant,serveurIPCDM_Touche,avecAckCDM,Stop_Maj_Sig, sombre,serveur_ouvert,pasChgTBV,FpBouge,debugPN,simuInterface,option_demitour, - mesureTrains,avecLogique : boolean; + mesureTrains : boolean; tick,Premier_tick : longint; @@ -1057,14 +1081,16 @@ var record nom : string; index : integer; - famille : integer; // 1=système 2=CDM 3=SC ne sert qu'a filtrer l'affichage par la combobox + famille : integer; // 1=système 2=CDM 3=SC ne sert qu'à 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 + Memoire : array[0..100] of integer; + + Conditions : array[0..12] of record nom : string; index : integer; @@ -1163,7 +1189,7 @@ var route : TuneRoute; // tableau de la route en cours du train NomRoute : array[1..30] of string; // nom de la route sauvegardée NomRouteCour : string; // nom de la route courante - routePref : array[0..30] of TUneroute; // tableau de la route sauvegardée du train + routePref : array[0..30] of TUneroute; // tableau de la route sauvegardée du train. routePref[0,0].adresse est le nombre de routes PointRout : integer; // cantons (via leurs déteceteurs) sur lesquels le train doit d'arrêter DetecteurArret : array[1..NbDetArret] of record @@ -1209,7 +1235,7 @@ var Aig_supprime,Aig_sauve : TAiguillage; BrancheN : array[1..MaxBranches,1..MaxElBranches] of TBranche; chaine_recue : TchaineBIN; - {$IFDEF AvecIdTCP} + {$IFDEF AvecIdTCP} //-----------composant Indy ThreadInterface : TReadingThreadInterface; ThreadPeriph1 : TReadingThreadPeriph1; ThreadPeriph2 : TReadingThreadPeriph2; @@ -1553,18 +1579,23 @@ begin end; //affichage de la fenêtre principale - show; +// show; end; end; procedure fin_preliminaire; var i : integer; + s : string; begin + s:='Début du préliminaire'; + procetape(s); + {$IF CompilerVersion >= 28.0} // en D12, obligé de positionner la fenêtre principale après avoir fixé le style positionne_principal; {$IFEND} + calcul_pos_horloge; if AffHorl then Affiche_horloge; if LanceHorl then Demarre_horloge; @@ -1578,18 +1609,27 @@ begin ajoute_champs_combos(i); end; + s:='Préliminaire 2'; + procetape(s); + if avecTCO then for i:=1 to NbreTco do begin FormTCO[i].Visible:=false; Affiche_Fenetre_TCO(i,avecTCO); end; + + s:='Préliminaire 3'; + procetape(s); + renseigne_tous_cantons; // les cantons doivent être renseignés pour les evts détecteurs renseigne_TJDs_TCO; interface_ou_cdm; // démarrer l'interface , génère les evts détecteurs ; ou cdm formprinc.SetFocus; + s:='Fin du préliminaire'; + procetape(s); end; @@ -2329,6 +2369,11 @@ end; procedure procetape(s : string); begin + if debug=1 then + begin + Affiche(s,clLime); + exit; + end; if debug<>2 then exit; MessageDlg('Etape '+intToSTR(etape)+#13+s,mtInformation,[mbOk],0); inc(etape); @@ -3910,7 +3955,7 @@ procedure Affiche_signaux; var i : integer; begin i:=(Formprinc.ScrollBoxSig.Width div (largImg+5)) -1; - if i=NbreImagePLigne then exit; + if (i=NbreImagePLigne) or (i<=0) then exit; NbreImagePLigne:=i; for i:=1 to NbreSignaux do begin @@ -4670,8 +4715,7 @@ envoie les donn ===========================================================================*} procedure envoi_CDF(adresse : integer); var - combine,aspect,code,i,nombre,c : integer; - AncRalRap,AncJau,jau,RalRap : boolean; + combine,aspect,code,i,nombre: integer; s : string; // envoi les bits 0 à 3 @@ -4868,8 +4912,6 @@ begin jaune_cli : ecrire_3(Signaux[i].SR[10].sortie1); end; - // standard (mode 2 signaux décoché) - //if signaux[i].BinLin=0 then begin case combine of ral_30 : ecrire_3(Signaux[i].SR[11].sortie1); @@ -4880,109 +4922,60 @@ begin exit; end; exit; - { - else - begin - // mode 4 - // spécial Philippe30 : n'est pas standard : mode 2 signaux indépendants sur le décodeur - Ancralrap:=(TestBit(Signaux[i].AncienEtat,ral_30)) or (TestBit(Signaux[i].AncienEtat,ral_60)) or - (TestBit(Signaux[i].AncienEtat,rappel_30)) or (TestBit(Signaux[i].AncienEtat,rappel_60)) ; - // si ancien état du signal=jaune ou jaune cli - Ancjau:=(TestBit(Signaux[i].AncienEtat,jaune)) or (TestBit(Signaux[i].AncienEtat,jaune_cli)) ; - - // si état demandé du signal=ralentissement ou rappel - ralrap:=(TestBit(code,ral_30)) or (TestBit(code,ral_60)) or - (TestBit(code,rappel_30)) or (TestBit(code,rappel_60)) ; - // si état demandé du signal=jaune ou cli - jau:=TestBit(code,jaune) or TestBit(code,jaune_cli) ; - - if (combine=ral_30) and not(TestBit(Signaux[i].AncienEtat,ral_30)) then // si l'ancien état n'était pas au ral 30, allumer le Ral30 - begin // c'est le bit à gauche du groupe de 2 bits qui allume le RR30 - c:=Signaux[i].SR[11].sortie1; // le bit à 1 correspond à l'allumage - ecrire_3(c); // exemple : 0000 0010 soit 2 - end; - if (combine<>ral_30) and (TestBit(Signaux[i].AncienEtat,ral_30)) then // si l'ancien état était au ral 30, éteindre le Ral30 - begin - c:=Signaux[i].SR[11].sortie1; - case c of - $1 : c:=$2; // 01 devient 10 - $2 : c:=$1; // 10 devient 01 - $4 : c:=$8; // 0100 devient 1000 - $8 : c:=$4; // 1000 devient 0100 - $10 : c:=$20; // 01 0000 devient 10 0000 - $20 : c:=$10; // 10 0000 devient 01 0000 - $40 : c:=$80; // 0100 0000 devient 1000 0000 - $80 : c:=$40; // 1000 0000 devient 0100 0000 - end; - ecrire_3(c); - end; - - if (combine=ral_60) and not(TestBit(Signaux[i].AncienEtat,ral_60)) then // si l'ancien état n'était pas au ral 30, allumer le Ral30 - begin - c:=Signaux[i].SR[12].sortie1; // le bit à 1 correspond à l'allumage - ecrire_3(c); // exemple : 0000 0010 soit 2 - end; - if (combine<>ral_60) and (TestBit(Signaux[i].AncienEtat,ral_60)) then // si l'ancien état était au ral 30, éteindre le Ral30 - begin - c:=Signaux[i].SR[12].sortie1; // le bit à 1 correspond à l'allumage - case c of - $1 : c:=$2; // 01 devient 10 - $2 : c:=$1; // 10 devient 01 - $4 : c:=$8; // 0100 devient 1000 - $8 : c:=$4; // 1000 devient 0100 - $10 : c:=$20; // 01 0000 devient 10 0000 - $20 : c:=$10; // 10 0000 devient 01 0000 - $40 : c:=$80; // 0100 0000 devient 1000 0000 - $80 : c:=$40; // 1000 0000 devient 0100 0000 - end; - ecrire_3(c); - end; - - if (combine=rappel_30) and not(TestBit(Signaux[i].AncienEtat,rappel_30)) then // si l'ancien état n'était pas au rappel 30, allumer le Rappel 30 - begin - c:=Signaux[i].SR[13].sortie1; // le bit à 1 correspond à l'allumage - ecrire_3(c); // exemple : 0000 0010 soit 2 - end; - if (combine<>rappel_30) and (TestBit(Signaux[i].AncienEtat,rappel_30)) then // si l'ancien état était au rappel30, l'éteindre - begin - c:=Signaux[i].SR[13].sortie1; - case c of - $1 : c:=$2; // 01 devient 10 - $2 : c:=$1; // 10 devient 01 - $4 : c:=$8; // 0100 devient 1000 - $8 : c:=$4; // 1000 devient 0100 - $10 : c:=$20; // 01 0000 devient 10 0000 - $20 : c:=$10; // 10 0000 devient 01 0000 - $40 : c:=$80; // 0100 0000 devient 1000 0000 - $80 : c:=$40; // 1000 0000 devient 0100 0000 - end; - ecrire_3(c); // éteindre - end; - - if (combine=rappel_60) and not(TestBit(Signaux[i].AncienEtat,rappel_60)) then // si l'ancien état n'était pas au ral 30, allumer le Ral30 - begin // c'est le bit à gauche du groupe de 2 bits qui allume le RR30 - c:=Signaux[i].SR[14].sortie1; // le bit à 1 correspond à l'allumage - ecrire_3(c); // exemple : 0000 0010 soit 2 - end; - if (combine<>rappel_60) and (TestBit(Signaux[i].AncienEtat,rappel_60)) then // si l'ancien état était au ral 30, éteindre le Ral30 - begin - c:=Signaux[i].SR[14].sortie1; // le bit à 1 correspond à l'allumage - case c of - $1 : c:=$2; // 01 devient 10 - $2 : c:=$1; // 10 devient 01 - $4 : c:=$8; // 0100 devient 1000 - $8 : c:=$4; // 1000 devient 0100 - $10 : c:=$20; // 01 0000 devient 10 0000 - $20 : c:=$10; // 10 0000 devient 01 0000 - $40 : c:=$80; // 0100 0000 devient 1000 0000 - $80 : c:=$40; // 1000 0000 devient 0100 0000 - end; - ecrire_3(c); - end; - end; } end; end; +procedure envoi_LEA(adresse:integer); +var + code : word; + index,i,etat,nAdr : integer; + s0,s1 : boolean; + s : string; +begin + index:=Index_Signal(adresse); + if (Signaux[index].AncienEtat<>Signaux[index].EtatSignal) then //; && (stop_cmd==FALSE)) + begin + code:=Signaux[index].EtatSignal; + //code_to_aspect(code,aspect,combine); + s:='Signal LEA: ad'+IntToSTR(adresse)+'='+chaine_signal(adresse); + if AffSig then affiche(s,clOrange); + if Affsignal then afficheDebug(s,clOrange); + if AffDetSig then + begin + s:='Tick='+IntToSTR(tick)+' Signal '+IntToSTR(adresse)+'='+chaine_signal(adresse); + AfficheDebug(s,clyellow); + end; + + etat:=code_to_etat(code); // transforme le motif de bits en état de 1 à 19 + nAdr:=Signaux[index].Na; // nombre d'asdresses du signal + + if index<>0 then + begin + i:=0; + // trouve l'index dans la configuration du signal correspondant à son état demandé + repeat + inc(i); + s0:=Signaux[index].SR[i].sortie0=etat; + s1:=Signaux[index].SR[i].sortie1=etat; + until s1 or s0 or (i=8) or (i=nAdr); + + if s1 then + begin + //affiche('trouvé en sortie1 index '+IntToSTR(i),clyellow); + Pilote_acc(adresse+i-1,1,signal); + end; + if s0 then + begin + //affiche('trouvé en sortie0 index '+IntToSTR(i),clyellow); + Pilote_acc(adresse+i-1,2,signal); + end; + if not(s0) and not(s1) then + Affiche('Erreur 622 : décodeur LEA du signal '+intToSTR(adresse)+': pas trouvé l''état demandé '+chaine_signal(adresse)+' dans sa configuration',clOrange); + end; + end; +end; + + {========================================================================== envoie les données au décodeur SR ===========================================================================*} @@ -5012,31 +5005,6 @@ begin if index<>0 then begin - { - i:=0; - // trouve l'index dans la configuration du signal correspondant à son état demandé - repeat - inc(i); - s0:=etatsDefSR[i]=etat; - s1:=false; - // s1:=Signaux[index].SR[i].sortie1=etat; - // s0:=Signaux[index].SR[i].sortie0=etat; - until s0 or s1 or (i=8) or (i=nAdr); - - if s0 then - begin - affiche('trouvé index '+IntToSTR(i-1),clyellow); - if index mod 2 = 0 then Pilote_acc(adresse+i-1,2,signal) else Pilote_acc(adresse+i-1,1,signal); - end; - if s1 then - begin - affiche('trouvé en sortie1 index '+IntToSTR(i-1),clyellow); - Pilote_acc(adresse+i-1,1,signal); - end; - if not(s0) and not(s1) then - Affiche('Erreur 621 : décodeur SR du signal '+intToSTR(adresse)+' pas trouvé l''état demandé dans sa configuration',clOrange); - } - i:=0; // trouve l'index dans la configuration du signal correspondant à son état demandé repeat @@ -5899,7 +5867,7 @@ begin // doc VB 5 lampes + chiffre + V // marqué recht et Afb dans la doc !! afb:=1; // afb rouge - recht:=2; // recht vert + recht:=2; // recht vert=droit if aspect=rouge then begin pilote_acc(adresse,afb,signal); @@ -6598,74 +6566,99 @@ end; function teste_condition(action : integer) : boolean; var condValide : boolean; - vit,vit1,vit2,it,pa,m1,m2,hc,n,ncond,cond : integer; + vit,vit1,vit2,it,pa,m1,m2,hc,n,ncond,cond,etat : integer; tr : string; begin - // 1 condition - pas de chaînage avec 1 seule condition - condValide:=false; - n:=Tablo_Action[action].NbCond; - for ncond:=1 to n do - begin - cond:=Tablo_Action[action].tabloCond[ncond].numcondition; - case cond of - CondVrai : condValide:=true; - CondFaux : condValide:=false; - CondVitTrain : + // 1 condition - pas de chaînage avec 1 seule condition + condValide:=false; + n:=Tablo_Action[action].NbCond; + for ncond:=1 to n do + begin + cond:=Tablo_Action[action].tabloCond[ncond].numcondition; + case cond of + CondVrai : condValide:=true; + CondFaux : condValide:=false; + CondVitTrain : + begin + tr:=Tablo_Action[action].tabloCond[ncond].train; + vit1:=Tablo_Action[action].tabloCond[ncond].vitmini; + vit2:=Tablo_Action[action].tabloCond[ncond].vitmaxi; + it:=index_train_nom(tr); + if it>0 then begin - tr:=Tablo_Action[action].tabloCond[ncond].train; - vit1:=Tablo_Action[action].tabloCond[ncond].vitmini; - vit2:=Tablo_Action[action].tabloCond[ncond].vitmaxi; - it:=index_train_nom(tr); - if it>0 then - begin - vit:=Trains[it].vitesseCons; - condvalide:=(vit>=vit1) and (vit<=vit2); - end; - end; - CondPosAcc : - begin - vit1:=Tablo_Action[action].tabloCond[ncond].accessoire; - vit2:=Tablo_Action[action].tabloCond[ncond].etat; - it:=index_aig(vit1); - if it>0 then - begin - pa:=aiguillage[it].position; - if pa=const_inconnu then Affiche('Action '+intToSTR(action)+' / condition '+intToSTR(ncond)+' : position accessoire '+intToSTR(vit1)+' inconnue',clred); - condvalide:=pa=vit2; - end else Affiche('Action '+intToSTR(action)+' / condition '+intToSTR(ncond)+' : Aiguillage '+intToSTR(vit1)+' inconnu',clred); - end; - CondHorl : - begin - vit1:=Tablo_Action[action].tabloCond[ncond].HeureMin*60; - vit2:=Tablo_Action[action].tabloCond[ncond].HeureMax*60; - m1:=Tablo_Action[action].tabloCond[ncond].MinuteMin; - m2:=Tablo_Action[action].tabloCond[ncond].MinuteMax; - vit1:=vit1+m1; - vit2:=vit2+m2; - hc:=heure*60+minute; - condValide:=(hc>=vit1) and (hc<=vit2); - end; - condTrainSig : - begin - vit1:=Tablo_Action[action].tabloCond[ncond].adresse; - tr:=Tablo_Action[action].tabloCond[ncond].train; - it:=index_Signal(vit1); - if it=0 then begin Affiche('Action '+intToSTR(action)+' / condition '+intToSTR(ncond)+' signal '+intToSTR(vit1)+' inconnu',clred);exit;end; - 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); + vit:=Trains[it].vitesseCons; + condvalide:=(vit>=vit1) and (vit<=vit2); end; end; + CondPosAcc : + begin + vit1:=Tablo_Action[action].tabloCond[ncond].accessoire; + vit2:=Tablo_Action[action].tabloCond[ncond].etat; + it:=index_aig(vit1); + if it>0 then + begin + pa:=aiguillage[it].position; + if pa=const_inconnu then Affiche('Action '+intToSTR(action)+' / condition '+intToSTR(ncond)+' : position accessoire '+intToSTR(vit1)+' inconnue',clred); + condvalide:=pa=vit2; + end else Affiche('Action '+intToSTR(action)+' / condition '+intToSTR(ncond)+' : Aiguillage '+intToSTR(vit1)+' inconnu',clred); + end; + CondHorl : + begin + vit1:=Tablo_Action[action].tabloCond[ncond].HeureMin*60; + vit2:=Tablo_Action[action].tabloCond[ncond].HeureMax*60; + m1:=Tablo_Action[action].tabloCond[ncond].MinuteMin; + m2:=Tablo_Action[action].tabloCond[ncond].MinuteMax; + vit1:=vit1+m1; + vit2:=vit2+m2; + hc:=heure*60+minute; + condValide:=(hc>=vit1) and (hc<=vit2); + end; + condTrainSig : + begin + vit1:=Tablo_Action[action].tabloCond[ncond].adresse; + tr:=Tablo_Action[action].tabloCond[ncond].train; + it:=index_Signal(vit1); + if it=0 then begin Affiche('Action '+intToSTR(action)+' / condition '+intToSTR(ncond)+' signal '+intToSTR(vit1)+' inconnu',clred);exit;end; + 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; + condBouton : + begin + adr:=Tablo_Action[action].tabloCond[ncond].adresse; // numéro de bouton + condValide:=false; + if (adr>1) or (adr<=100) then condValide:=boutonTCO[adr].etat=1; + end; + condMemoireEgal : + begin + adr:=Tablo_Action[action].tabloCond[ncond].adresse; // numéro de mémoire + etat:=Tablo_Action[action].tabloCond[ncond].etat; + condValide:=false; + if (adr>1) or (adr<=100) then condValide:=memoire[adr]=etat; + end; + condMemoireInf : + begin + adr:=Tablo_Action[action].tabloCond[ncond].adresse; // numéro de mémoire + etat:=Tablo_Action[action].tabloCond[ncond].etat; + condValide:=false; + if (adr>1) or (adr<=100) then condValide:=memoire[adr]1) or (adr<=100) then condValide:=memoire[adr]>etat; + end; end; + end; result:=condValide; end; - - // index signal niveau=0 : (ouvert) 1= ouvert au vert =2 ouvert restreint =3 fermé (carré sémaphore violet) procedure event_Signal(idSignal,niveau : integer); var i : integer; @@ -6757,6 +6750,7 @@ begin 8 : envoi_arcomora(Adr); 9 : envoi_ldt_nmbs(adr); 10 : envoi_b_models(adr); + 11 : envoi_LEA(adr); end; // décodeur personnalisé @@ -6822,12 +6816,11 @@ begin end; end; end; - end; end else - // signal directionel + // signal directionnel begin pilote_direction(Adr,Signaux[i].etatSignal) end; @@ -9224,7 +9217,7 @@ begin TabloParcours[nparcours,idparcours].typ:=det; TabloParcours[nparcours,idparcours].pos:=0; end; - // on a trouvé un détécteur, on change de tableau + // on a trouvé un détecteur, on change de tableau if nparcours>=MaxRoutes then Erreur:=530 else begin @@ -9516,7 +9509,7 @@ begin //Affiche('Aig'+inttostr(adraig)+' pointe droit',clyellow); el1:=adraig;tq1:=typ; // explore droit------------- - if (idparcours>0) and (idparcours<100) then + if (idparcours>0) and (idparcours<100) then begin Tabloparcours[nparcours,idparcours].pos:=const_droit; end; @@ -10811,6 +10804,7 @@ end; // remplit aussi les élements[] rencontrés // stocke les éléments trouvés dans Elements function etat_signal_suivant(Adresse,rang : integer;var AdrSignalsuivant : integer) : integer; +const MaxIt=20; var index,num_signal,etat,AdrSignal,i,j,prec,AdrSuiv,indexSig1,indexSig2,voie1,voie2 : integer; aspect,combine,ia : integer; TypePrec,TypeActuel,typ : TEquipement; @@ -10820,6 +10814,7 @@ begin param1:=adresse; param2:=rang; if ProcPrinc or (NivDebug>=2) then AfficheDebug('Cherche état du signal suivant au '+IntToSTR(adresse),clyellow); + Application.ProcessMessages; i:=Index_Signal(adresse); if (i=0) then begin @@ -10881,7 +10876,7 @@ begin // modif spécial TJD ============== ia:=index_aig(Actuel); - if (aiguillage[ia].modele=tjd) and (aiguillage[ia].EtatTJD=4) then + if (aiguillage[ia].modele=tjd) and (aiguillage[ia].EtatTJD=4) then Prec:=aiguillage[ia].Ddevie else // ================================ @@ -10935,7 +10930,7 @@ begin AdrSignal:=Signaux[indexSig1].Adresse; if (AdrSignal=Adresse) then // si on ne reboucle sur le même signal dont on cherche le suivant begin - AdrSignal:=0;j:=10; // on ne trouve pas de suivant + AdrSignal:=0;j:=MaxIt; // on ne trouve pas de suivant : provoquer la sortie end; if (AdrSignal<>0) then // si l'adresse est <>0 begin @@ -10999,7 +10994,7 @@ begin end else if nivDebug=3 then AfficheDebug('Pas de signal pour le det '+IntToSTR(AdrSuiv),clyellow); end; - until (j>=20) or ((AdrSignal<>0) and (num_signal=rang)); + until (j>=MaxIt) or ((AdrSignal<>0) and (num_signal=rang)); // laisser 20, il peut ne pas y avoir de signal suivant if etat=0 then Signal_Suivant:=0; @@ -11179,8 +11174,6 @@ begin result:=0; end; - - // renvoie vrai si une mémoire de zone est occupée après le signal "adresse" jusqu'au // nombre de signaux suivants défini par NSigMax=1, 2 ou 3.. (=canton) // sort de suite si on trouve un train @@ -11893,7 +11886,6 @@ begin end; end; - // met à jour l'état du signel belge selon l'environnement des aiguillages et des trains procedure signal_belge(AdrSignal : integer;detect : boolean); var adrAig,adr_det,adr_el_suiv,AdrTrainLoc,voie,indexAig,etat,AdrSignalsuivant,AdrTrainRes : integer; @@ -12310,7 +12302,6 @@ begin (BrancheN[branche_trouve,IndexBranche_trouve-1].Adresse=0) and (BrancheN[branche_trouve,IndexBranche_trouve-1].BType=buttoir) ) end; - // renvoie vrai si le signal adresse est dans le sens det1 det2 function signal_sens(adrSig,det1,det2 : integer) : boolean; var i,it,suiv,succ,actuel,ia : integer; @@ -12493,7 +12484,6 @@ begin end; detecteur[j].AdrTrainRes:=0; - for i:=2 to idEl-1 do begin j:=elements[i].adresse; @@ -12520,7 +12510,6 @@ begin Texte_aig_fond(j) ; end; - // --------canton suivant rouge:=signal_rouge(AdrSignalSuivant); if rouge then @@ -12739,8 +12728,6 @@ begin Maj_Signaux(false); end; - - // mode=0 = libère 1=réserve reserve_dereserve_det(detecteur1,detecteur2,adrTrain,i,1); // du détecteur1 au détecteur2 NON INCLUS // résultat : 0 si ok sinon code de défaut @@ -12954,7 +12941,8 @@ end; // appelé depuis calcul_zones sur détecteur à 1 (sauf pour le 1er du train) // le det1 indique d'ou vient le train pour le bon sens du signal // det2 est le détecteur sur lequel se trouve le train -// le train est piloté si on trouve un signal dans le bon sens sur det2 +// le train est piloté si on trouve un signal dans le bon sens sur det2, et on modula sa vitesse +// suivant l'état du signal // it : numéro du train du réseau (pour la couleur) procedure pilote_train(det1,det2,AdrTrain,it : integer); var entree_signal,jauneC,rappel30C,rappel60C,rouge : boolean; @@ -13443,7 +13431,6 @@ begin end; end; - //Affiche('INC det'+intToSTR(detect)+' ='+intToSTR(ncd),clWhite); if (mesure[n].detecteurM=detect) and (mesure[n].vitcons=consigne) and (consigne<>0) and (detect<>0) then begin @@ -13639,7 +13626,7 @@ begin end; end; libere_canton(det1,det3,AdrTrainLoc); // on quitte det3 - event_act(det1,det3,1,''); // évènement détecteur de zone - 1 + event_act(det1,det3,0,''); // évènement détecteur de zone à 0 // affichages Affiche_Evt('1-0 route ok de '+intToSTR(det1)+' à '+IntToSTR(det3),clWhite); if traceListe then AfficheDebug(s,clyellow); @@ -14296,8 +14283,9 @@ begin Formprinc.LabelNbTrains.caption:=IntToSTR(N_trains); // vérifier si le train est démarré avec positionnement dans le canton - j:=1; - repeat + j:=1;trouve:=false; + while (j9000 then @@ -14309,7 +14297,7 @@ begin end; trouve:=((det1=det3) or (det2=det3)) and ((AdrTrainLoc<>0) and (AdrTrainLoc<>9999)); inc(j); - until (j>nCantons) or trouve; + end; if trouve then begin @@ -14742,14 +14730,14 @@ end; // faire l'opération ida de l'action i procedure action_operation(i,ida : integer); -var decl,op,af,access,sortie,t,v,etat : integer; +var decl,op,af,access,sortie,t,v,etat,adr : integer; st,trainDest : string; Ts : TAccessoire; tr : single; begin st:='Action '+Tablo_Action[i].NomAction+' : '; op:=Tablo_Action[i].tabloOp[ida].numoperation; - if Tablo_Action[i].tabloOp[ida].valide then + if Tablo_Action[i].tabloOp[ida].valide then // si l'opération n'est pas inhibée par le double clic begin decl:=Tablo_Action[i].declencheur; if decl=DeclHorloge then @@ -14891,6 +14879,41 @@ begin seq_actions[index_seqAct].indiceOp:=ida+1; end; end; + + //15 action bouton tco + if op=ActionBoutonTCO then + begin + etat:=Tablo_Action[i].tabloop[ida].etat; + adr:=Tablo_Action[i].tabloop[ida].adresse; + Affiche(st+' Bouton TCO '+intToSTR(adr)+' à '+intToSTR(etat),clYellow); + if (adr<=0) or (adr>100) then exit; + BoutonTCO[adr].etat:=etat; + affiche_cellule(BoutonTCO[adr].idtco,BoutonTCO[adr].x,BoutonTCO[adr].y); + end; + + if op=ActionAffecteMemoire then + begin + adr:=Tablo_Action[i].tabloop[ida].adresse; + etat:=Tablo_Action[i].tabloop[ida].etat; + Affiche(st+' Mémoire '+intToSTR(adr)+' à '+intToSTR(etat),clYellow); + if (adr<=0) or (adr>100) then exit; + Memoire[adr]:=etat; + end; + + if op=ActionIncMemoire then + begin + adr:=Tablo_Action[i].tabloop[ida].adresse; + if (adr<=0) or (adr>100) then exit; + inc(Memoire[adr]); + Affiche(st+' Incrémente mémoire '+intToSTR(adr)+' - Nouvelle valeur='+intToSTR(memoire[adr]),clYellow); + end; + if op=ActionDecMemoire then + begin + adr:=Tablo_Action[i].tabloop[ida].adresse; + if (adr<=0) or (adr>100) then exit; + dec(Memoire[adr]); + Affiche(st+' Decrémente mémoire '+intToSTR(adr)+' - Nouvelle valeur='+intToSTR(memoire[adr]),clYellow); + end; end else Affiche(st+operations[op].nom+' dévalidée',clOrange); @@ -14926,7 +14949,7 @@ begin begin if not(Tablo_Action[i].traite) and teste_condition(i) then begin - Affiche('YY test condition',clred); +// Affiche('YY test condition',clred); Tablo_Action[i].traite:=true; action(i); // exécute toutes les opérations de l'actionneur i end @@ -14994,11 +15017,12 @@ begin ancien_actionneur[adr]:=etat; if not(fd) and not(fm) then exit; + + detecteur[adr].Etat:=etat=1; + detecteur[adr].Train:=TrainDecl; end; - detecteur[adr].Etat:=etat=1; - detecteur[adr].Train:=TrainDecl; i:=index_actionneur(adr); actionneur[i].etat:=etat=1; actionneur[i].train:=trainDecl; @@ -15130,8 +15154,8 @@ begin dZ2F:=Tablo_PN[i].voie[v].detZ2F; dZ1O:=Tablo_PN[i].voie[v].detZ1O; dZ2O:=Tablo_PN[i].voie[v].detZ2O; - if debugPN then Affiche('test ouvre '+intToSTR(Adr)+' '+intToSTR(adr2)+' '+intToSTR(etat),clwhite); - if (dZ1O =adr) and (dZ2O=adr2) and (etat=0) then // zone d'ouverture + if debugPN then Affiche('Test ouvre sur evt'+intToSTR(Adr)+' '+intToSTR(adr2)+' '+intToSTR(etat),clwhite); + if (dZ1O=adr) and (dZ2O=adr2) and (etat=0) then // zone d'ouverture begin if Tablo_PN[i].compteur=1 then begin @@ -15157,7 +15181,7 @@ begin end; end; - if debugPN then Affiche('test ferme '+intToSTR(Adr)+' '+intToSTR(adr2)+' '+intToSTR(etat),clwhite); + if debugPN then Affiche('Test ferme '+intToSTR(Adr)+' '+intToSTR(adr2)+' '+intToSTR(etat),clwhite); if (dZ1F=adr) and (dZ2F=adr2) and (etat=1) then // zone de fermeture begin inc(Tablo_PN[i].compteur); @@ -15299,7 +15323,8 @@ begin if not(configNulle) then Maj_Signaux(false); // on ne traite pas les calculs si CDM en envoie plusieurs end; -// calcule la distance incrémentale en mm en fonction du temps en 1/10 et de la vitesse en cran du train d'index i +// calcule la distance incrémentale en mm d'un train qui avance en fonction du temps en 1/10 et de la vitesse en cran du train d'index i +// est appelé par le timer function distance_temps_incr(temps,i : integer) : integer; var adrDet,vitesse,vitesseAbs : integer; vitR,coeff,incr,d : single; @@ -15339,7 +15364,6 @@ begin // Affiche('Vitesse réelle='+intTostr(round(vitR))+' cm/s Temps='+intToSTR(temps),clYellow); end; - // traitement des évènements détecteurs procedure Event_Detecteur(Adresse : integer;etat : boolean;train : string); var dr,i,AdrSuiv,AdrSignal,AdrDetSignal,index,Etat01,AdrPrec,d1,d2,AdrTrain : integer; @@ -15540,8 +15564,6 @@ begin // gérer l'évènement detecteur pour action event_act(Adresse,0,i,train); - - end; end; @@ -15603,7 +15625,7 @@ end; // pos = const_droit=2 ou const_devie=1 procedure Event_Aig(adresse,pos : integer); var s: string; - faire_event,inv,bjd,rf,CondValide : boolean; + faire_event,inv,bjd,rf : boolean; prov,index,i,id,etatact,typ,adr : integer; begin //if AffAigDet then Affiche('Tick='+IntToSTR(tick)+' Event Aig '+intToSTR(adresse)+'='+intToSTR(pos),clorange); @@ -16231,7 +16253,6 @@ begin exit; end; - // o i:=pos('0 then @@ -17039,7 +17060,6 @@ begin end; procedure connecte_interface_ethernet; -var trouve : boolean; begin etat_init_interface:=0; // ouvrir socket vers la centrale @@ -17318,7 +17338,7 @@ begin cdm_lanceLoc:=false; // lancement depuis le répertoire 32 bits d'un OS64 - if cheminProgrammesCDM='' then cheminprogrammesCDM:=cheminProgrammes; + if cheminProgrammesCDM='' then cheminprogrammesCDM:=cheminProgrammes; //cdr -f armentieres.lay -COMIPC repertoire:=CheminProgrammesCDM+'\CDM-Rail'; //Affiche(s,clred); @@ -17723,18 +17743,18 @@ end; function GetAdapterInfo(Lana: AnsiChar): String; var Adapter: TAdapterStatus; - NCB: TNCB; + Ncb: Tncb; begin - FillChar(NCB,SizeOf(NCB),0); - NCB.ncb_command:=Char(NCBRESET); - NCB.ncb_lana_num:=Lana; - if Netbios(@NCB)<>Char(NRC_GOODRET) then + FillChar(Ncb,SizeOf(Ncb),0); + Ncb.ncb_command:=Char(NCBRESET); + Ncb.ncb_lana_num:=Lana; + if Netbios(@Ncb)<>Char(NRC_GOODRET) then begin Result:='mac non trouvée'; Exit; end; - FillChar(NCB,SizeOf(NCB), 0); + FillChar(NCB,SizeOf(Ncb), 0); NCB.ncb_command:=Char(NCBASTAT); NCB.ncb_lana_num:=Lana; NCB.ncb_callname:='*'; @@ -17742,7 +17762,7 @@ begin FillChar(Adapter,SizeOf(Adapter), 0); NCB.ncb_buffer:=@Adapter; NCB.ncb_length:=SizeOf(Adapter); - if Netbios(@NCB)<>Char(NRC_GOODRET) then + if Netbios(@Ncb)<>Char(NRC_GOODRET) then begin Result:='mac non trouvée'; Exit; @@ -17759,9 +17779,9 @@ end; function GetMACAddress: string; var AdapterList: TLanaEnum; - NCB: TNCB; + Ncb: Tncb; begin - FillChar(NCB,SizeOf(NCB),0); + FillChar(Ncb,SizeOf(NCB),0); NCB.ncb_command:=Char(NCBENUM); NCB.ncb_buffer:=@AdapterList; NCB.ncb_length:=SizeOf(AdapterList); @@ -18042,8 +18062,32 @@ begin index:=ActionTempo; famille:=1; // système end; + with operations[15] do + begin + nom:='Changement bouton TCO'; + index:=ActionBoutonTCO; + famille:=1; + end; + with operations[ActionAffectememoire] do + begin + nom:='Affectation mémoire'; + index:=ActionAffecteMemoire; + famille:=1; + end; + with operations[ActionIncMemoire] do + begin + nom:='Incrémentation mémoire'; + index:=ActionIncMemoire; + famille:=1; + end; + with operations[ActionDecMemoire] do + begin + nom:='Décrémentation mémoire'; + index:=ActionDecMemoire; + famille:=1; + end; - NbreOperations:=14; + NbreOperations:=ActionDecMemoire; end; function Index_operation(s : string) : integer; @@ -18116,8 +18160,32 @@ begin index:=CondFonction; famille:=0; end; + with Conditions[CondBouton] do + begin + nom:='Bouton TCO'; + index:=CondFonction; + famille:=0; + end; + with Conditions[CondMemoireEgal] do + begin + nom:='Mémoire égale à'; + index:=CondMemoireEgal; + famille:=0; + end; + with Conditions[CondMemoireInf] do + begin + nom:='Mémoire inférieure à'; + index:=CondMemoireInf; + famille:=0; + end; + with Conditions[CondMemoireSup] do + begin + nom:='Mémoire supérieure à'; + index:=CondMemoireSup; + famille:=0; + end; - if avecLogique then NbreConditions:=CondFonction else NbreConditions:=CondTrainSig; + NbreConditions:=CondMemoireInf; end; procedure init_declencheurs; @@ -18182,8 +18250,7 @@ begin index:=DeclFonction; famille:=0; end; - if avecLogique then Nbredeclencheurs:=DeclFonction - else NbreDeclencheurs:=DeclSignal; + Nbredeclencheurs:=DeclFonction; end; @@ -18205,7 +18272,6 @@ end; procedure interface_ou_cdm; begin // lancer CDM rail et le connecte si on le demande ; à faire après la création des signaux et du tco - if debug=1 then Affiche('Procédure CDM',clLime); procetape('Test CDM et son lancement'); if LanceCDM then Lance_CDM(true); procetape('Fin cdm'); @@ -18339,18 +18405,20 @@ end; // démarrage principal du programme signaux_complexes procedure TFormPrinc.FormCreate(Sender: TObject); var n,t,i,j,index,OrgMilieu : integer; - s : string; + s,vc : string; trouve : boolean; Sr : TSearchRec; tmP,tmA : tMenuItem; begin af:='Client TCP-IP ou USB CDM Rail - Système XpressNet DCC++ Version '+VersionSC+sousVersion; + vc:=''; {$IF CompilerVersion >= 28.0} - af:=af+' D12'; + vc:=' D12'; {$IFEND} {$IFDEF WIN64} // si compilé en 64 bits - af:=af+' x64'; + vc:=vc+' x64'; {$ENDIF} + af:=af+vc; for index:=1 to 10 do begin formTCO[index]:=nil; @@ -18390,6 +18458,7 @@ begin config_modifie:=false; Application.onHint:=doHint; Long_recue:=0; + NbreImagePLigne:=5; // évite division par 0 en cas de non initialisation // box2=CV GroupBoxCV.Left:=633; @@ -18449,7 +18518,6 @@ 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:=true; AffAigDet:=false; Button3.Visible:=not(diffusion); @@ -18457,17 +18525,22 @@ begin FormatSettings.DecimalSeparator:='.'; FenRich.MaxLength:=$7FFFFFF0; - NbDecodeur:=11; + NbDecodeur:=12; NbDecodeurdeBase:=NbDecodeur; Decodeur[0]:='Rien';Decodeur[1]:='Digital Bahn';Decodeur[2]:='CDF';Decodeur[3]:='LS-DEC-SNCF';Decodeur[4]:='LEB'; Decodeur[5]:='Digikeijs 4018';Decodeur[6]:='Unisemaf Paco';Decodeur[7]:='Stéphane Ravaut';Decodeur[8]:='Arcomora'; Decodeur[9]:='LS-DEC-NMBS';Decodeur[10]:='B-models'; + Decodeur[11]:='LEA Ligéa'; // initalisation des actions init_operations; init_conditions; init_declencheurs; - + for i:=1 to 100 do + begin + memoire[i]:=0; + boutonTCO[i].existe:=false; + end; // créer icones des trains et raz champs for i:=1 to Max_Trains do begin @@ -18546,7 +18619,7 @@ begin // création des composants MSComm (USB COM) ----------------- {$IF CompilerVersion >= 28.0} - // D12 + // D12 // composant AsycPro try MSCommUSBInterface:=tApdComPort.Create(formprinc); except @@ -18686,6 +18759,8 @@ begin if OsBits=64 then s:='OS 64 Bits' else s:='OS 32 Bits'; s:=DateToStr(date)+' '+TimeToStr(Time)+' '+s; + s:=s+' SC '+versionSC+' '+vc; + Affiche(s,clLime); With ScrollBoxSig do begin @@ -18789,9 +18864,9 @@ begin Application.ProcessMessages; // Initialisation des images des signaux procetape('Création des signaux'); - + NbreImagePLigne:=(Formprinc.ScrollBoxSig.Width div (largImg+5)) -1; - if NbreImagePLigne=0 then NbreImagePLigne:=1; + if NbreImagePLigne<=0 then NbreImagePLigne:=1; // ajoute les images des signaux dynamiquement for i:=1 to NbreSignaux do @@ -18818,7 +18893,6 @@ begin positionne_principal; {$IFEND} - if debug=1 then Affiche('Création TCO',clLime); procetape('Création des TCO'); for index:=1 to nbreTCO do begin @@ -19079,7 +19153,7 @@ begin end; // appellé sur réception trame train CDM -// vérifie qu'un train +// vérifie qu'un train est dans l'horaire de départ procedure verifie_train_horaire(adresse : integer;train : string;vitesse : integer); var i : integer; sens : boolean; @@ -19107,7 +19181,6 @@ var n,i,j,indexTrain,vitesse : integer; traite,trouve : boolean; train,route : string; begin - // démarrage des trains à l'horaire for i:=1 to MaxHoraire do begin @@ -19223,7 +19296,6 @@ begin end; end; - // --- horloge système if horloge then begin @@ -19977,14 +20049,8 @@ begin deconnecte_usb; end; -procedure TFormPrinc.MenuConnecterEthernetClick(Sender: TObject); +procedure deconnecte_interfaceEth; begin - connecte_interface_ethernet; -end; - -procedure TFormPrinc.MenuDeconnecterEthernetClick(Sender: TObject); -begin - Affiche('Déconnexion interface ethernet',clyellow); {$IFDEF AvecIdTCP} ClientSocketIdInterface.disconnect; {$ELSE} @@ -19992,6 +20058,20 @@ begin {$ENDIF} end; +procedure TFormPrinc.MenuConnecterEthernetClick(Sender: TObject); +begin + deconnecte_interfaceEth; + connecte_interface_ethernet; +end; + + + +procedure TFormPrinc.MenuDeconnecterEthernetClick(Sender: TObject); +begin + Affiche('Déconnexion interface ethernet',clyellow); + deconnecte_interfaceEth; +end; + procedure TFormPrinc.AffEtatDetecteurs(Sender: TObject); var j,adr,adrTrain : integer; c : tcolor; @@ -20030,7 +20110,13 @@ begin end; Affiche('Nombre de détecteurs à 1 :'+intToSTR(NbDet1),clyellow); - Affiche(' ',clYellow); +end; + + +procedure TFormPrinc.Etatdesactionneurs1Click(Sender: TObject); +var j : integer; + s : string; +begin Affiche('Etat des actionneurs',clYellow); for j:=1 to Nactionneurs do begin @@ -21323,7 +21409,6 @@ procedure TFormPrinc.locoClick(Sender: TObject); var i,adr,vit,erreur : integer; s : string; begin - // vitesse et direction 18 pas s:=editAdrTrain.Text; val(s,adr,erreur); if (erreur<>0) or (adr<0) then exit; @@ -22229,8 +22314,8 @@ begin TopEcran:=ecran[e].y0; LeftEcran:=ecran[e].x0; largTCO:=largEcran ; - HautTCO:=(HautEcran div NbTCOE[e]); - + if NbTCOE[e]<>0 then + HautTCO:=(HautEcran div NbTCOE[e]) else HautTCO:=HautEcran; //Affiche(intToSTR(leftEcran),clred); with formtco[i] do @@ -22277,7 +22362,7 @@ begin hautEcran:=ecran[e].haut; TopEcran:=ecran[e].y0; LeftEcran:=ecran[e].x0; - largTCO:=largEcran div NbTCOE[e]; + if NbTCOE[e]<>0 then largTCO:=largEcran div NbTCOE[e] else largTCO:=LargEcran; HautTCO:=HautEcran; with formtco[i] do @@ -22486,7 +22571,7 @@ end; procedure Affiche_Fenetre_TCO(i : integer;laisseOuvert : boolean); var e : integer; begin - if (i<1) or (i>NbreTCO) then exit; + if (i<1) or (i>NbreTCO) or (formTCO[i]=nil) then exit; e:=ecranTCO[i]; if e>10 then e:=10; if e>Screen.MonitorCount then e:=1; @@ -23023,7 +23108,6 @@ begin DeltaFPCY:=OffsetYFC-formprinc.top; DeltaFPCX:=OffsetXFC-formprinc.left; - PosSplitter:=splitterV.Left; AffMemoFenetre:=1; sauve_config; @@ -23047,7 +23131,7 @@ begin end; {$IF CompilerVersion >= 28.0} - // réception COM/USB du périphérique 1 +// réception COM/USB du périphérique 1 avec Asyncpro procedure TFormPrinc.RecuPeriph1(Sender: TObject;Count : Word); var s : string; tablo : array[1..255] of byte; // tableau rx usb @@ -23072,7 +23156,7 @@ begin end; end; -// réception COM/USB du périphérique 2 +// réception COM/USB du périphérique 2 avec asyncpro procedure TFormPrinc.RecuPeriph2(Sender: TObject;count : word); var s : string; tablo : array[1..255] of byte; // tableau rx usb @@ -23096,7 +23180,7 @@ begin end; {$ELSE} -// réception COM/USB du périphérique 1 +// réception COM/USB du périphérique 1 avec TMScomm procedure TFormPrinc.RecuPeriph1(Sender: TObject); var s : string; tablo : array of byte; // tableau rx usb @@ -23124,7 +23208,7 @@ begin end; end; -// réception COM/USB du périphérique 2 +// réception COM/USB du périphérique 2 avec tmsComm procedure TFormPrinc.RecuPeriph2(Sender: TObject); var s : string; tablo : array of byte; // tableau rx usb @@ -23209,7 +23293,6 @@ begin ErrorCode:=0; end; - procedure TFormPrinc.ClientSocketCde2Read(Sender: TObject; Socket: TCustomWinSocket); var s : string; @@ -23373,8 +23456,7 @@ begin end; end; - -// renvoie les poinnts ouverts d'une TJD 4 états en fonction de son état passé en paramètres +// renvoie les 2 points d'entrée et de sortie possibles d'une TJD 4 états en fonction de son état passé en paramètres procedure TJD4(adr1,pos1,adr2,pos2 : integer;var c1,c2 : char); begin if (pos1=const_droit) and (pos2=const_droit) then begin c1:='D';c2:='D';end; @@ -23422,7 +23504,7 @@ end; // 4 si max récursivité // sorties normales: ----- // 5 si rebouclage sur départ -// 6 si rebouclage sur élément déja traité (plus envisagé car c'est possible sur une route qui repasse) +// 6 si rebouclage sur élément déja traité (n'est plus envisagé car c'est possible sur une route qui repasse) // 7 fin exploration aiguillage // 8 fin exploration TJD // -------------- @@ -24530,320 +24612,6 @@ begin result:=8; exit; end; - { - //************************VERSION 2 - begin - if affRouteR then Affiche('Faire traversée directe tjd 4 états '+intToSTR(actuel),clorange); - // faire TJD traversante : on va tout droit - if aiguillage[indexAig].ADroit=prec then // on vient de Adroit - begin - // faire droit droit - tabloroute[nroute,id-1].pos:=const_droit; - tabloroute[nroute,id-1].typ:=tjd; - tabloroute[nroute,id-1].adresse:=actuel; // 28 - - Suivant:=aiguillage[indexAig].Ddroit; // homologue 26 - actuel:=suivant; - TypActuel:=tjd; - tabloroute[nroute,id].pos:=const_droit; - tabloroute[nroute,id].typ:=tjd; - tabloroute[nroute,id].adresse:=Suivant; // 26 - inc(id); - indexAig:=Index_aig(suivant); - suivant:=aiguillage[IndexAig].aDroit; - c:=aiguillage[IndexAig].adroitB; - if ((c='Z') or (c=#0)) and (suivant<>0) then TypSuiv:=det; - if ((c='Z') or (c=#0)) and (suivant=0) then TypSuiv:=buttoir; - if (c='P') or (c='S') or (c='D') then - begin - IndexAig:=index_aig(suivant); - TypSuiv:=aiguillage[indexAig].modele; - end; - end - else - if aiguillage[indexAig].ADevie=prec then // on vient de Adévié - begin - // faire devie dévié - tabloroute[nroute,id-1].pos:=const_devie; - tabloroute[nroute,id-1].typ:=tjd; - tabloroute[nroute,id-1].adresse:=actuel; // 28 - - Suivant:=aiguillage[indexAig].Ddroit; // homologue 26 - actuel:=suivant; - TypActuel:=tjd; - tabloroute[nroute,id].pos:=const_devie; - tabloroute[nroute,id].typ:=tjd; - tabloroute[nroute,id].adresse:=Suivant; // 26 - inc(id); - indexAig:=Index_aig(suivant); - suivant:=aiguillage[IndexAig].aDevie; - c:=aiguillage[IndexAig].aDevieB; - if ((c='Z') or (c=#0)) and (suivant<>0) then TypSuiv:=det; - if ((c='Z') or (c=#0)) and (suivant=0) then TypSuiv:=buttoir; - if (c='P') or (c='S') or (c='D') then - begin - IndexAig:=index_aig(suivant); - TypSuiv:=aiguillage[indexAig].modele; - end; - end - else - begin - Affiche('Anomalie 584 : Route '+intToSTR(nroute)+' Id='+intToSTR(id)+' : pas de résolution de la TJD '+intToSTR(actuel),clred); - if c=#0 then c:=' '; - Affiche('Origine = '+intToSTR(Origine)+c,clred); - Affiche('Inégalité de '+intToSTR(aiguillage[indexAig].ADroit)+' ou '+intToSTR(aiguillage[indexAig].ADevie)+' avec : '+intToSTR(prec),clred); - result:=16; - exit; - end; - r:=explore_El(actuel,typActuel,Suivant,TypSuiv,nroute,id,ir,depart,fin,ctot); - - if affRouteR then - begin - Affiche('Retour de la traversée directe tjd 4 états '+intToSTR(actuel),clorange); - Affiche('Faire traversée courbe tjd 4 états '+intToSTR(actuel),clorange); - end; - - if r=9 then - begin - result:=r; - exit; - end; - if r=10 then - begin - result:=11; - end; - - // faire TJD en mode "courbe" - // reprendre les éléments le la tjd entrante - actuel:=TjdEntre; - - indexaig:=index_aig(actuel); - - dec(id); - if aiguillage[indexAig].ADroit=prec then // on vient de A droit - begin - // faire droit dévié - tabloroute[nroute,id-1].pos:=const_droit; - tabloroute[nroute,id-1].typ:=tjd; - tabloroute[nroute,id-1].adresse:=actuel; // 28 - Suivant:=aiguillage[indexAig].Ddroit; // homologue - actuel:=suivant; - TypActuel:=tjd; - Actuel:=suivant; - typActuel:=tjd; - tabloroute[nroute,id].pos:=const_devie; - tabloroute[nroute,id].typ:=tjd; - tabloroute[nroute,id].adresse:=Suivant; // 26 - inc(id); - indexAig:=Index_aig(suivant); - suivant:=aiguillage[IndexAig].aDevie; - c:=aiguillage[IndexAig].adevieB; - if ((c='Z') or (c=#0)) and (suivant<>0) then TypSuiv:=det; - if ((c='Z') or (c=#0)) and (suivant=0) then TypSuiv:=buttoir; - if (c='P') or (c='S') or (c='D') then - begin - IndexAig:=index_aig(suivant); - TypSuiv:=aiguillage[indexAig].modele; - end; - end - else - if aiguillage[indexAig].ADevie=prec then // on vient de dévié - begin - // faire devie droit - tabloroute[nroute,id-1].pos:=const_devie; - tabloroute[nroute,id-1].typ:=tjd; - tabloroute[nroute,id-1].adresse:=actuel; // 28 - Suivant:=aiguillage[indexAig].Ddroit; // homologue 26 - Actuel:=suivant; - typActuel:=Tjd; - tabloroute[nroute,id].pos:=const_droit; - tabloroute[nroute,id].typ:=tjd; - tabloroute[nroute,id].adresse:=Suivant; // 26 - inc(id); - indexAig:=Index_aig(suivant); - suivant:=aiguillage[IndexAig].aDroit; - c:=aiguillage[IndexAig].aDroitB; - if ((c='Z') or (c=#0)) and (suivant<>0) then TypSuiv:=det; - if ((c='Z') or (c=#0)) and (suivant=0) then TypSuiv:=buttoir; - if (c='P') or (c='S') or (c='D') then - begin - IndexAig:=index_aig(suivant); - TypSuiv:=aiguillage[indexAig].modele; - end; - end - else - begin - Affiche('Anomalie 585 : Route '+intToSTR(nroute)+' Id='+intToSTR(id)+' : pas de résolution de la TJD '+intToSTR(actuel),clred); - if c=#0 then c:=' '; - Affiche('Origine = '+intToSTR(Origine)+c,clred); - Affiche('Inégalité de '+intToSTR(aiguillage[indexAig].ADroit)+' ou '+intToSTR(aiguillage[indexAig].ADevie)+' avec : '+intToSTR(prec),clred); - result:=16; - exit; - end; - r:=explore_El(actuel,typActuel,Suivant,TypSuiv,nroute,id,ir,depart,fin,ctot); - if affRouteR then Affiche('retour de la traversée courbe tjd 4 états '+intToSTR(actuel),clorange); - if r=9 then - begin - result:=r; - exit; - end; - if r=10 then - begin - result:=11; - end; - result:=8; - exit; - end; - } - - //************************VERSION 1 - // faire droit TJD - { - begin - origine:=tabloroute[nroute,id-2].adresse; // d'où on vient - position:=tabloroute[nroute,id-2].pos; // position de l'élément d'ou on vient - indexAig:=index_aig(actuel); // 28: entrée TJD - tjdEntre:=actuel; // mémoriser l'adresse d'entrée de la TJD 4 états - - // TJD d'entrée - tabloroute[nroute,id-1].pos:=const_droit; // faire droit - tabloroute[nroute,id-1].typ:=tjd; - tabloroute[nroute,id-1].adresse:=actuel; // 28 - nEtats:=aiguillage[indexAig].EtatTJD; - - if nEtats=4 then - begin - actuel:=aiguillage[indexAig].Ddroit; // homologue :26 - indexAig2:=index_aig(actuel); - c:='Z'; - if tabloroute[nroute,id-2].typ=aig then - begin - idx:=index_Aig(origine); - if position=0 then c:='P'; - if aiguillage[idx].InversionCDM=1 then - begin - if position=const_droit then c:='S'; - if position=const_devie then c:='D'; - end - else - begin - if position=const_droit then c:='D'; - if position=const_devie then c:='S'; - end; - end; - // condition point d'arrêt : (origine=90) and (actuel=92) - // si le précédent est une TJD, il faudrait distinguer le cas 2 états et 4 états. - if tabloroute[nroute,id-2].typ=tjd then - begin - idx:=index_Aig(origine); - if aiguillage[idx].EtatTJD=4 then - begin - - end; - if position=0 then c:='P'; - if aiguillage[idx].InversionCDM=1 then - begin - if position=const_droit then c:='S'; - if position=const_devie then c:='D'; - end - else - begin - if position=const_droit then c:='D'; - if position=const_devie then c:='S'; - end; - end; - inc(id); - - if (aiguillage[indexAig].ADroit=origine) then //and ((aiguillage[indexAig].ADroitB=c) or (aiguillage[indexAig].ADroitB='P')) then - begin - // on vient de la position droite de l'entrée de la TJD, ce qui détermine l'aiguille de sortie - tabloroute[nroute,id-1].pos:=const_droit; - end - else - if (aiguillage[indexAig].ADevie=origine) then// and ((aiguillage[indexAig].ADevieB=c) or (aiguillage[indexAig].ADevieB='P')) then - begin - // on vient de la position déviée de l'entrée de la TJD, ce qui détermine l'aiguille de sortie - tabloroute[nroute,id-1].pos:=const_devie; - end - else - begin - Affiche('Anomalie 584 : Route '+intToSTR(nroute)+' Id='+intToSTR(id)+' : pas de résolution de la TJD '+intToSTR(actuel),clred); - Affiche('Origine = '+intToSTR(Origine)+c,clred); - end; - // sortie de TJD 4 états - actuel:=aiguillage[indexAig2].Adresse; - tabloroute[nroute,id-1].typ:=tjd; - tabloroute[nroute,id-1].adresse:=actuel; - end; - if nEtats=2 then - begin - indexAig2:=IndexAig; - end; - - //--------------faire droit TJD - tabloroute[nroute,id-1].talon:=false; - if affRouteR then Affiche('Faire droit tjd '+intToSTR(actuel),clorange); - suivant:=aiguillage[indexAig2].ADroit; // 26 sortie TJD, direction droit - c:=aiguillage[indexAig2].AdroitB; - if (c='S') or (c='D') or (c='P') then typSuiv:=aig else TypSuiv:=det; - if typSuiv=aig then - begin - indexAigSuiv:=index_aig(suivant); - TypSuiv:=aiguillage[indexAigSuiv].modele; - end; - if suivant=0 then TypSuiv:=buttoir; - r:=explore_El(actuel,typActuel,Suivant,TypSuiv,nroute,id,ir,depart,fin,ctot); - if affrouteR then affiche('3.Retour explore_el de la tjd '+intToSTR(actuel)+' pos droit :'+intToSTR(r),clCyan); - if r=9 then // demande de sortie - begin - result:=r; - exit; - end; - if r=10 then // trouvé le détecteur de fin - begin - result:=11; - end; - - // faire dévié dévié TJD - if affRouteR then - Affiche('Faire dévié tjd '+intToSTR(actuel),clorange); - //suivant:=aiguillage[indexAig].ADevie; // 28 entrée TJD - suivant:=aiguillage[indexAig2].ADevie; // 26 sortie TJD - c:=aiguillage[indexAig2].AdevieB; - if (c='S') or (c='D') or (c='P') then typSuiv:=aig else TypSuiv:=det; - if typSuiv=aig then - begin - indexAigSuiv:=index_aig(suivant); - TypSuiv:=aiguillage[indexAigSuiv].modele; - end; - if suivant=0 then TypSuiv:=buttoir; - if nEtats=4 then - begin - tabloroute[nroute,id-2].pos:=const_devie; // 28 entrée de la TJD - tabloroute[nroute,id-2].talon:=false; - end; - if nEtats=2 then - begin - tabloroute[nroute,id-1].pos:=const_devie; - tabloroute[nroute,id-1].talon:=false; - end; - - r:=explore_El(actuel,typActuel,Suivant,TypSuiv,nroute,id,ir,depart,fin,ctot); - if affrouteR then affiche('4.Retour explore_el de la tjd '+intToSTR(actuel)+' pos dévié :'+intToSTR(r),clCyan); - if r=9 then // demande sortie - begin - result:=r; - exit; - end; - if r=10 then // trouvé détecteur de fin - begin - result:=11; - end; - - result:=8; - exit; - - end; } end else @@ -25155,8 +24923,6 @@ begin result:=s; end; - - procedure Affiche_routes_brut; var i,j,n,p,nr : integer; s : string; @@ -25231,7 +24997,9 @@ end; procedure TFormPrinc.Button3Click(Sender: TObject); begin - Maj_detecteurs_canton(32,4,544); + if routes_identiques(trains[3].routePref[1],trains[4].routePref[1]) then + Affiche('oui',clred); + end; @@ -25258,5 +25026,10 @@ begin TrackBarVit.Position:=0; end; +procedure TFormPrinc.Compilerlabasededonnes1Click(Sender: TObject); begin + genere_informations_BD; + Affiche('Recompilation des bases de données terminée',clLime); +end; + end. diff --git a/UnitRoute.pas b/UnitRoute.pas index 805ea31..44c5973 100644 --- a/UnitRoute.pas +++ b/UnitRoute.pas @@ -747,8 +747,8 @@ begin // TextOut(Rect.Left, Rect.Top, (Control as TListBox).Items[Index]); //MyBrush.Free; FillRect(Rect); - Font.Color := TColor(ListBoxRoutes.Items.Objects[Index]); - TextOut(Rect.Left + 2, Rect.Top, ListBoxRoutes.Items[Index]); + Font.Color:=TColor(ListBoxRoutes.Items.Objects[Index]); + TextOut(Rect.Left+2, Rect.Top, ListBoxRoutes.Items[Index]); end; end; diff --git a/UnitRouteTrains.dfm b/UnitRouteTrains.dfm index 724078a..bee343b 100644 --- a/UnitRouteTrains.dfm +++ b/UnitRouteTrains.dfm @@ -27,7 +27,7 @@ object FormRouteTrain: TFormRouteTrain TabOrder = 3 object LabelRoute: TLabel Left = 8 - Top = 112 + Top = 120 Width = 71 Height = 13 Caption = 'Route affect'#233'e' @@ -40,16 +40,13 @@ object FormRouteTrain: TFormRouteTrain ParentShowHint = False ShowHint = False end - end - object ComboBoxTrains: TComboBox - Left = 8 - Top = 56 - Width = 241 - Height = 21 - Style = csDropDownList - ItemHeight = 13 - TabOrder = 0 - OnChange = ComboBoxTrainsChange + object LabelID: TLabel + Left = 13 + Top = 96 + Width = 68 + Height = 13 + Caption = 'Id de la route :' + end end object PageControlRoutes: TPageControl Left = 256 @@ -259,6 +256,16 @@ object FormRouteTrain: TFormRouteTrain end end end + object ComboBoxTrains: TComboBox + Left = 8 + Top = 56 + Width = 241 + Height = 21 + Style = csDropDownList + ItemHeight = 13 + TabOrder = 0 + OnChange = ComboBoxTrainsChange + end object ButtonQuitte: TButton Left = 8 Top = 156 diff --git a/UnitRouteTrains.pas b/UnitRouteTrains.pas index d2bdf6e..eb71adf 100644 --- a/UnitRouteTrains.pas +++ b/UnitRouteTrains.pas @@ -7,7 +7,10 @@ interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, - Dialogs, StdCtrls, ExtCtrls, ComCtrls; + Dialogs, StdCtrls, ExtCtrls, ComCtrls, + + unitprinc,UnitConfig,unitTCO,UnitHorloge,unitFicheHoraire,UnitDebug,UnitRoute,selection_train; + type TFormRouteTrain = class(TForm) @@ -35,6 +38,7 @@ type Label1: TLabel; CheckBoxSens: TCheckBox; CheckBoxSIRA: TCheckBox; + LabelID: TLabel; procedure FormActivate(Sender: TObject); procedure ButtonQuitteClick(Sender: TObject); procedure ComboBoxTrainsChange(Sender: TObject); @@ -65,6 +69,7 @@ type { Déclarations publiques } end; + var FormRouteTrain: TFormRouteTrain; IrPref : integer; @@ -72,11 +77,10 @@ var function aig_canton(idTrain,detect : integer) : integer; function demarre_index_train(indexTrain : integer) : boolean; procedure couleurs_routeTrains; +function routes_identiques(route1,route2 : TUneroute) : boolean; implementation -uses unitprinc,UnitConfig,unitTCO,UnitHorloge,unitFicheHoraire,UnitDebug,UnitRoute,selection_train; - {$R *.dfm} // démarre un train si le signal n'est pas au rouge @@ -225,10 +229,28 @@ begin trains[indextrain].TempoDemarre:=i; // démarrage à la vitesse nominale end; +// si les routes route1 et route2 sont identiques, retourne vrai +function routes_identiques(route1,route2 : TUneroute) : boolean; +var n,i : integer; + egal : boolean; +begin + n:=route1[0].adresse; + if n=route2[0].adresse then + begin + i:=1; + repeat + egal:=(route1[i].adresse=route2[i].adresse) and (route1[i].typ=route2[i].typ); + inc(i); + until (i>n) or not(egal); + result:=egal; + end + else result:=false; +end; + // mise à jour des infos de la fenetre : combobox procedure maj_infos(idtrain : integer); -var i,j,indexcanton,det1,det2,PixelLength : integer; +var i,j,PixelLength : integer; s : string; begin formRouteTrain.comboBoxTrains.Clear; @@ -284,7 +306,7 @@ begin PixelLength:=0; for j:=1 to trains[idtrain].routePref[0][0].adresse do begin - s:=IntToSTR(j)+'. '+route_restreinte_to_string(trains[idTrain].routePref[j]); + s:='Id='+intToSTR(trains[idTrain].routePref[j][0].pos)+' '+route_restreinte_to_string(trains[idTrain].routePref[j]); if Canvas.TextWidth(s)+30>PixelLength then PixelLength:=Canvas.TextWidth(s)+30; ListBoxRM.Items.Add(s); end; @@ -681,6 +703,7 @@ begin Trains[indexTrainFr].routePref[i]:=Trains[IndexTrainFr].route; maj_infos(indexTrainFR); + compile_id_routes; Sauve_config; end; @@ -715,7 +738,6 @@ end; procedure TFormRouteTrain.ButtonMClick(Sender: TObject); var n,sens,el1R,el2R,el1,el2,IdCanton,detfin,IdCantonDest,IdCantonOrg : integer; t1,t2,t1R,t2R : tequipement; - trouve : boolean; begin if indexTrainFR<0 then begin labelRoute.caption:='Pas de train';exit;end; @@ -737,7 +759,6 @@ begin end; } - if trains[indexTrainFR].routePref[IrPref][0].adresse<>0 then begin trains[indexTrainFR].route:=trains[indexTrainFR].routePref[IrPref]; // affectation de la route au train @@ -863,8 +884,8 @@ begin tabloRoute[NumRoute]:=trains[indexTrainFR].routePref[IrPref]; Efface_Affiche_route; checkBoxSens.checked:=trains[indexTrainFR].routePref[IrPref][0].talon; + LabelID.caption:='Id de la route : '+intToSTR(trains[indexTrainFR].routePref[IrPref][0].pos); - // si le train de la route est en roulage, ne pas afficher la route car // sinon les index des trains passent à 0 dans les cantons par la fonction zone_tco if trains[indexTrainFR].roulage=0 then affiche_route_tco; @@ -886,14 +907,14 @@ procedure TFormRouteTrain.ButtonSRClick(Sender: TObject); var i,n : integer; s : string; begin - if IrPref<0 then exit; + if IrPref<1 then exit; s:='Voulez-vous supprimer la route sauvegardée n°'+intToSTR(IrPref)+' ?'; if Application.MessageBox(pchar(s),pchar('confirm'), MB_YESNO or MB_DEFBUTTON2 or MB_ICONQUESTION)=idNo then exit; n:=trains[indexTrainFR].routePref[0][0].adresse; // nombre de routes for i:=IrPref to n do - tabloRoute[i]:=tabloRoute[i+1]; + tabloRoute[i]:=tabloRoute[i+1]; trains[indexTrainFR].routePref[0][0].adresse:=n-1; dec(irPref); maj_infos(indexTrainFR); @@ -929,7 +950,7 @@ begin IndexLigneRoute:=IrPref; tabloRoute[NumRoute]:=trains[indexTrainFR].routePref[IrPref]; checkBoxSens.checked:=trains[indexTrainFR].routePref[IrPref][0].talon; - + LabelID.caption:='Id de la route : '+intToSTR(trains[indexTrainFR].routePref[IrPref][0].pos); efface_affiche_route; EditNomRoute.Text:=trains[indexTrainFR].NomRoute[irPref]; end; diff --git a/UnitSR.dfm b/UnitSR.dfm index 2532671..e9a4dae 100644 --- a/UnitSR.dfm +++ b/UnitSR.dfm @@ -490,7 +490,7 @@ object FormSR: TFormSR end object LabelCV31: TLabel Left = 320 - Top = 484 + Top = 476 Width = 20 Height = 13 Caption = 'CV=' diff --git a/UnitSR.pas b/UnitSR.pas index c5b500a..faf14a1 100644 --- a/UnitSR.pas +++ b/UnitSR.pas @@ -154,12 +154,15 @@ begin Lb:=formSR.findComponent(s) as tLabel; Lb.Visible:=i-1<2*nadr; - s:='LabelCV'+intToSTR(i*2-1); - Lb:=formSR.findComponent(s) as tLabel; - Lb.Visible:=i-1<2*nadr; - s:='LabelCV'+intToSTR(i*2); - Lb:=formSR.findComponent(s) as tLabel; - Lb.Visible:=i-1<2*nadr; + if signaux[indexSig].decodeur=7 then + begin + s:='LabelCV'+intToSTR(i*2-1); + Lb:=formSR.findComponent(s) as tLabel; + Lb.Visible:=i-1<2*nadr; + s:='LabelCV'+intToSTR(i*2); + Lb:=formSR.findComponent(s) as tLabel; + Lb.Visible:=i-1<2*nadr; + end; end; for i:=1 to 8 do @@ -546,13 +549,78 @@ begin end; procedure TFormSR.FormActivate(Sender: TObject); -var erreur,etat1,etat2,ne : integer; +const p2d='+ 2 droit'; + m1d='- 1 dévié'; + +var dec,erreur,etat1,etat2,ne : integer; begin Val(FormConfig.EditAdrSig.text,Adr,erreur); indexSig:=index_Signal(Adr); + if IndexSig=0 then LabelErreur.caption:='Erreur 512 : signal '+intToSTR(Adr)+' inexistant' else begin + dec:=signaux[IndexSig].decodeur; + // SR + if dec=7 then + begin + label1.Caption:=p2d; + label2.Caption:=m1d; + label3.Caption:=p2d; + label4.Caption:=m1d; + label5.Caption:=p2d; + label6.Caption:=m1d; + label7.Caption:=p2d; + label8.Caption:=m1d; + label9.Caption:=p2d; + label10.Caption:=m1d; + label11.Caption:=p2d; + label12.Caption:=m1d; + label13.Caption:=p2d; + label14.Caption:=m1d; + label15.Caption:=p2d; + label16.Caption:=m1d; + Caption:='Configuration du décodeur de signal Stéphane Ravaut'; + label303.Visible:=true; + labelCV1.Visible:=true; labelCV2.Visible:=true; labelCV3.Visible:=true; labelCV4.Visible:=true; + labelCV5.Visible:=true; labelCV6.Visible:=true; labelCV7.Visible:=true; labelCV8.Visible:=true; + labelCV9.Visible:=true; labelCV10.Visible:=true; labelCV11.Visible:=true; labelCV12.Visible:=true; + labelCV13.Visible:=true; labelCV14.Visible:=true; labelCV15.Visible:=true; labelCV16.Visible:=true; + labelCV17.Visible:=true; labelCV18.Visible:=true; labelCV19.Visible:=true; labelCV20.Visible:=true; + labelCV21.Visible:=true; labelCV22.Visible:=true; labelCV23.Visible:=true; labelCV24.Visible:=true; + labelCV25.Visible:=true; labelCV26.Visible:=true; labelCV27.Visible:=true; labelCV28.Visible:=true; + labelCV29.Visible:=true; labelCV30.Visible:=true; labelCV31.Visible:=true; labelCV32.Visible:=true; + end; + // LEA + if dec=11 then + begin + FormSR.Caption:='Configuration du décodeur de signal LEA'; + label303.Visible:=false; + labelCV1.Visible:=false; labelCV2.Visible:=false; labelCV3.Visible:=false; labelCV4.Visible:=false; + labelCV5.Visible:=false; labelCV6.Visible:=false; labelCV7.Visible:=false; labelCV8.Visible:=false; + labelCV9.Visible:=false; labelCV10.Visible:=false; labelCV11.Visible:=false; labelCV12.Visible:=false; + labelCV13.Visible:=false; labelCV14.Visible:=false; labelCV15.Visible:=false; labelCV16.Visible:=false; + labelCV17.Visible:=false; labelCV18.Visible:=false; labelCV19.Visible:=false; labelCV20.Visible:=false; + labelCV21.Visible:=false; labelCV22.Visible:=false; labelCV23.Visible:=false; labelCV24.Visible:=false; + labelCV25.Visible:=false; labelCV26.Visible:=false; labelCV27.Visible:=false; labelCV28.Visible:=false; + labelCV29.Visible:=false; labelCV30.Visible:=false; labelCV31.Visible:=false; labelCV32.Visible:=false; + label1.Caption:=m1d; + label2.Caption:=p2d; + label3.Caption:=m1d; + label4.Caption:=p2d; + label5.Caption:=m1d; + label6.Caption:=p2d; + label7.Caption:=m1d; + label8.Caption:=p2d; + label9.Caption:=m1d; + label10.Caption:=p2d; + label11.Caption:=m1d; + label12.Caption:=p2d; + label13.Caption:=m1d; + label14.Caption:=p2d; + label15.Caption:=m1d; + label16.Caption:=p2d; + end; LabelAdrSR1.caption:=intToSTR(Adr); LabelAdrSR2.caption:=intToSTR(Adr+1); LabelAdrSR3.caption:=intToSTR(Adr+2); @@ -579,34 +647,6 @@ begin ComboBoxAdr15.ItemIndex:=Signaux[indexSig].SR[8].sortie1; ComboBoxAdr16.ItemIndex:=Signaux[indexSig].SR[8].sortie0; - { - for i:=1 to 16 do - begin - ComboBoxAdr1.Items[i-1]:=etats[etatsDefSR[i]]; - ComboBoxAdr2.Items[i-1]:=etats[etatsDefSR[i]]; - - ComboBoxAdr3.Items[i-1]:=etats[etatsDefSR[i]]; - ComboBoxAdr4.Items[i-1]:=etats[etatsDefSR[i]]; - - ComboBoxAdr5.Items[i-1]:=etats[etatsDefSR[i]]; - ComboBoxAdr6.Items[i-1]:=etats[etatsDefSR[i]]; - - ComboBoxAdr7.Items[i-1]:=etats[etatsDefSR[i]]; - ComboBoxAdr8.Items[i-1]:=etats[etatsDefSR[i]]; - - ComboBoxAdr9.Items[i-1]:=etats[etatsDefSR[i]]; - ComboBoxAdr10.Items[i-1]:=etats[etatsDefSR[i]]; - - ComboBoxAdr11.Items[i-1]:=etats[etatsDefSR[i]]; - ComboBoxAdr12.Items[i-1]:=etats[etatsDefSR[i]]; - - ComboBoxAdr13.Items[i-1]:=etats[etatsDefSR[i]]; - ComboBoxAdr14.Items[i-1]:=etats[etatsDefSR[i]]; - - ComboBoxAdr15.Items[i-1]:=etats[etatsDefSR[i]]; - ComboBoxAdr16.Items[i-1]:=etats[etatsDefSR[i]]; - end; } - ne:=Signaux[indexSig].Na; // nombre d'états du signal (2 à 19) EditNESignal.Text:=intToSTr(ne); diff --git a/UnitTCO.dfm b/UnitTCO.dfm index 345de04..079e1cd 100644 --- a/UnitTCO.dfm +++ b/UnitTCO.dfm @@ -211,6 +211,102 @@ object FormTCO: TFormTCO FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFF} end + object ImageBt0Bistable: TImage + Left = 672 + Top = 0 + Width = 48 + Height = 48 + Picture.Data = { + 07544269746D6170F6040000424DF60400000000000076000000280000003000 + 000030000000010004000000000080040000C20E0000C20E0000100000000000 + 0000000000000000800000800000008080008000000080008000808000008080 + 8000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFF + FF00BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB88888888888 + 88888888888888888888888888888888888BB888888888888888888888888888 + 8888888888888888888BB8888888888888888888888888888888888888888888 + 888BB8888888888888888888888888888888888888888888888BB88888888888 + 88888888888888888888888888888888888BB888888888888888888888888888 + 8888888888888888888BB8888888888888888888888888888888888888888888 + 888BB8888888888888888888888888888888888888888888888BB88888888880 + 00888888888888888888888888888888888BB800000000000000888888888888 + 8888888880000000088BB8000000000000000888888888888888888880000000 + 088BB8000000000000000008888888888888888880000000088BB88888888880 + 00000000088888888888888888888888888BB888888888888000000000888888 + 8888888888888888888BB8888888888888000000000088888888888888888888 + 888BB8888888888888880000000008888888888888888888888BB88888888888 + 88888000000000088888888888888888888BB888888888888888888000000000 + 0888888888888888888BB8888888888888888888800000000088888888888888 + 888BB88888888888888888888C0000000000888888888888888BB88888888888 + 888888888CCC00000000088888888888888BB88888888888888888888CCC8800 + 0000000888888888888BB88888888888888888888CCC88800000000088888888 + 888BB88888888888888888888CCC88888000000088888888888BB88888888888 + 888888888CCC88888800000088888888888BB88888888888888888888CCC8888 + 8888000888888888888BB88888888888888888888CCC88888888888888888888 + 888BB88888888888888888888CCC88888888888888888888888BB88888888888 + 888888888CCC88888888888888888888888BB88888888888888888888CCC8888 + 8888888888888888888BB88888888888888888888CCC88888888888888888888 + 888BB8888888888888CC88888CCC88888CC8888888888888888BB88888888888 + 88CC88888CCC88888CC8888888888888888BB8888888888888CCCCCCCCCCCCCC + CCC8888888888888888BB8888888888888CCCCCCCCCCCCCCCCC8888888888888 + 888BB8888888888888CCCCCCCCCCCCCCCCC8888888888888888BB88888888888 + 88888888888888888888888888888888888BB888888888888888888888888888 + 8888888888888888888BB8888888888888888888888888888888888888888888 + 888BB8888888888888888888888888888888888888888888888BB88888888888 + 88888888888888888888888888888888888BB888888888888888888888888888 + 8888888888888888888BB8888888888888888888888888888888888888888888 + 888BB8888888888888888888888888888888888888888888888BB88888888888 + 88888888888888888888888888888888888BB888888888888888888888888888 + 8888888888888888888BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB + BBBB} + end + object ImageBt1Bistable: TImage + Left = 672 + Top = 56 + Width = 48 + Height = 48 + Picture.Data = { + 07544269746D6170F6040000424DF60400000000000076000000280000003000 + 000030000000010004000000000080040000C20E0000C20E0000100000000000 + 0000000000000000800000800000008080008000000080008000808000008080 + 8000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFF + FF00BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB88888888888 + 88888888888888888888888888888888888BB888888888888888888888888888 + 8888888888888888888BB8888888888888888888888888888888888888888888 + 888BB8888888888888888888888888888888888888888888888BB88888888888 + 88888888888888888888888888888888888BB888888888888888888888888888 + 8888888888888888888BB8888888888888888888888888888888888888888888 + 888BB8888888888888888888888888888888888888888888888BB88888888800 + 00000000000000000000000000888888888BB800000000000000000000000000 + 0000000000000000088BB8000000000000000000000000000000000000000000 + 088BB8000000000000000000000000000000000000000000088BB88888888800 + 00000000000000000000000000888888888BB8888888888888888888888CCC88 + 8888888888888888888BB8888888888888888888888CCC888888888888888888 + 888BB8888888888888888888888CCC888888888888888888888BB88888888888 + 88888888888CCC888888888888888888888BB8888888888888888888888CCC88 + 8888888888888888888BB8888888888888888888888CCC888888888888888888 + 888BB8888888888888888888888CCC888888888888888888888BB88888888888 + 88888888888CCC888888888888888888888BB8888888888888888888888CCC88 + 8888888888888888888BB8888888888888888888888CCC888888888888888888 + 888BB8888888888888888888888CCC888888888888888888888BB88888888888 + 8888CC88888CCC88888CC88888888888888BB888888888888888CC88888CCC88 + 888CC88888888888888BB888888888888888CCCCCCCCCCCCCCCCC88888888888 + 888BB888888888888888CCCCCCCCCCCCCCCCC88888888888888BB88888888888 + 8888CCCCCCCCCCCCCCCCC88888888888888BB888888888888888888888888888 + 8888888888888888888BB8888888888888888888888888888888888888888888 + 888BB8888888888888888888888888888888888888888888888BB88888888888 + 88888888888888888888888888888888888BB888888888888888888888888888 + 8888888888888888888BB8888888888888888888888888888888888888888888 + 888BB8888888888888888888888888888888888888888888888BB88888888888 + 88888888888888888888888888888888888BB888888888888888888888888888 + 8888888888888888888BB8888888888888888888888888888888888888888888 + 888BB8888888888888888888888888888888888888888888888BB88888888888 + 88888888888888888888888888888888888BB888888888888888888888888888 + 8888888888888888888BB8888888888888888888888888888888888888888888 + 888BB8888888888888888888888888888888888888888888888BB88888888888 + 88888888888888888888888888888888888BB888888888888888888888888888 + 8888888888888888888BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB + BBBB} + end object ScrollBox: TScrollBox Left = 8 Top = 12 @@ -1537,9 +1633,9 @@ object FormTCO: TFormTCO object N8: TMenuItem Caption = '-' end - object rouverunlment1: TMenuItem + object Trouverunlment1: TMenuItem Caption = 'Trouver un '#233'l'#233'ment' - OnClick = rouverunlment1Click + OnClick = Trouverunlment1Click end object DessinerleTCO1: TMenuItem Caption = 'Dessiner le TCO' diff --git a/UnitTCO.pas b/UnitTCO.pas index ebbf6b2..fd2e9fc 100644 --- a/UnitTCO.pas +++ b/UnitTCO.pas @@ -163,7 +163,9 @@ type ImageDrapRouge: TImage; Button1: TButton; Optiondesroutes1: TMenuItem; - rouverunlment1: TMenuItem; + Trouverunlment1: TMenuItem; + ImageBt0Bistable: TImage; + ImageBt1Bistable: TImage; //TimerTCO: TTimer; procedure FormCreate(Sender: TObject); procedure FormActivate(Sender: TObject); @@ -399,7 +401,7 @@ type procedure AffRoutesClick(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Optiondesroutes1Click(Sender: TObject); - procedure rouverunlment1Click(Sender: TObject); private + procedure Trouverunlment1Click(Sender: TObject); { Déclarations privées } function index_TCOMainMenu : integer; public @@ -476,6 +478,7 @@ type trajet : integer; // décrit le trajet ouvert sur la voie (cas d'un croisement ou d'une tjd/S) inverse : boolean; // aiguillage piloté inversé repr : integer; // position de la représentation texte 0 = rien 1=centré 2=Haut 3=Bas 4=réparti 5=double centré + etat : integer; // état du bouton Texte : string; // texte de la cellule Fonte : string; // fonte du texte FontStyle : string; // GSIB (Gras Souligné Italique Barré) @@ -609,6 +612,12 @@ var traceXY : Array[1..50] of record x,y : integer; // en coordonnées grille end; + boutonTCO : array[0..100] of record + etat : integer; // état des boutons du TCO ; l'index est le numéro de bouton + idtco,x,y : integer; + existe : boolean; + end; + rAncien : TRect; OldBmp : TBitMap; PScrollBoxTCO : TScrollBox; @@ -1828,7 +1837,7 @@ begin exit; end; {$I-} - if debug=1 then Affiche('Lecture tco '+intToSTr(indexTCO)+' '+NomfichierTCO[indexTCO],clyellow); + if debug=1 then Affiche('Lecture tco '+intToSTr(indexTCO)+' '+NomfichierTCO[indexTCO],clLime); x:=1;y:=1;NbreCellX[indexTCO]:=0;NbreCellY[indexTCO]:=0; RatioC:=10; Graphisme:=1; trouve_clAllume:=false; @@ -2263,6 +2272,13 @@ begin begin tco[indexTCO,x,y].PiedFeu:=PiedFeu; // quelle action tco[indexTCO,x,y].FeuOriente:=FeuOriente; // paramètre de l'action + if PiedFeu=AcBouton_bistable then + begin + BoutonTCO[Adresse].existe:=true; + BoutonTCO[Adresse].idtco:=IndexTCO; + BoutonTCO[Adresse].x:=x; + BoutonTCO[Adresse].y:=y; + end; end; // 7 texte optionnel @@ -2862,6 +2878,10 @@ begin s:=format('%d',[TCO[indexTCO,x,y].Numcanton]); end else + if (b=id_action) and (tco[indexTCO,x,y].PiedFeu=AcBouton_bistable) then + begin + exit; + end; case repr of 0,1 : yt:=(hauteurCell[indexTCO] div 2)-round(tailleFont*fryGlob[indexTCO]); // au milieu @@ -6616,8 +6636,8 @@ begin end; // action -procedure dessin_Action(indexTCO : integer;Canvas : Tcanvas;x,y,mode: integer); -var x0,y0,xf,yf,act,larg,haut : integer; +procedure dessin_Action(indexTCO : integer;Canvas : Tcanvas;x,y : integer); +var adresse,x0,y0,xf,yf,act,larg,haut,etat : integer; r : Trect; s : string; begin @@ -6713,31 +6733,58 @@ begin AcAff_horloge : begin - if s='' then s:='Aff'+#13+'horl'; + if s='' then s:='Aff'+#13+'horl'; tco[indexTCO,x,y].texte:=s; tco[indexTCO,x,y].TailleFonte:=8; tco[indexTCO,x,y].FontStyle:='G'; end; + + AcBouton_bistable : + begin + adresse:=tco[indexTCO,x,y].Adresse; + if adresse<>0 then + begin + etat:=boutonTCO[adresse].etat; + s:=intToSTR(adresse); + end + else + begin + etat:=0; + s:='?'; + end; + tco[indexTCO,x,y].texte:=s; + tco[indexTCO,x,y].TailleFonte:=8; + tco[indexTCO,x,y].FontStyle:='G'; + if etat=0 then + StretchBlt(Canvas.Handle,x0,y0,larg,haut, + FormTCO[indexTCO].ImageBt0Bistable.canvas.Handle,0,0,48,48,srccopy) + //FormTCO[indexTCO].Image1.canvas.Handle,0,0,48,48,srccopy) + else + StretchBlt(Canvas.Handle,x0,y0,larg,haut, + FormTCO[indexTCO].ImageBt1Bistable.canvas.Handle,0,0,48,48,srccopy); + + + canvas.Brush.color:=$c1c1c1; // couleur de fond du bouton + canvas.Font.color:=clBlack; + canvas.font.Style:=[]; + Canvas.textOut(x0+3,y0+3,s); + //tco[indextco,x,y].repr:=2; + //PImageTCO[indexTCO].Picture.Bitmap.Canvas.Brush.Color:=clred; //$c3c3c3; + //PImageTCO[indexTCO].Picture.Bitmap.Canvas.pen.Color:=clred; + //pen.Color:=clBlue; + //font.Color:=clGreen; + //canvas.Brush.Style := bsClear; + //SetBkMode(PImageTCO[indexTCO].Picture.Bitmap.Canvas.Handle, Transparent); + //PImageTCO[indexTCO].Picture.Bitmap.Canvas.textOut(x0+3,y0+3,s); + //exit; end; - //tf:=(tco[indexTCO,x,y].TailleFonte*LargeurCell[indexTCO]) div 40; - //tf:=(8*LargeurCell[indexTCO]) div 40;; + end; - //Font.Color:=clwhite; - //font.Name:='Arial'; - //texte_reparti(s,indexTCO,x,y,tf); - affiche_texte(indextco,x,y); + //affiche_texte(indextco,x,y); end; - // copier imagelist dans imagetemp2 - { formTCO[indexTCO].ImageListTCO.GetBitmap (0, formTCO[indexTCO].ImageTemp2.Picture.Bitmap); - StretchBlt(pcanvasTCO[indexTCO].Handle,x0,y0,LargeurCell[indexTCO],hauteurCell[indexTCO], // destination avec mise à l'échelle - FormTCO[indexTCO].ImageTemp2.Canvas.Handle,0,0,24,24,srccopy); - - - formTCO[indexTCO].ImageTemp2.Picture.Bitmap.Modified:=true; - } end; @@ -11127,12 +11174,30 @@ begin Id_signal : dessin_Signal(indexTCO,PCanvasTCO,X,Y); Id_Quai : dessin_Quai(indexTCO,PCanvasTCO,X,Y,mode); - Id_action : dessin_Action(indexTCO,PCanvasTCO,X,Y,mode); + Id_action : dessin_Action(indexTCO,PCanvasTCO,X,Y); // les cantons sont affichés dans affiche_cellule car il faut dessiner les trains end; end; +procedure origine_canton(var x,y : integer); +var Bimage : integer; +begin + Bimage:=tco[indexTCOCourant,x,y].BImage; + if isCantonH(Bimage) then + begin + x:=x-(Bimage-Id_cantonH); // revenir à la coordonnée X du début du canton + end + else + if isCantonV(Bimage) then + begin + y:=y-(Bimage-Id_cantonH); // revenir à la coordonnée Y du début du canton + end + else + begin + x:=0;y:=0; + end; +end; // affiche la cellule x et y en cases // index est utilisé pour accéder au tableau du tracé de la fonction zone_tco @@ -12035,6 +12100,7 @@ begin end; end; + //if (idcanton<>0) and not affecte_Loco then Affiche('Pas en mode affecte_loco',clOrange); end; // pour les croisements il faut mettre à jour la variable "trajet" pour l'affichage dans la cellule @@ -12739,7 +12805,7 @@ var i,ir,adresse,But,Bimage,direction,ancienX,ancienY,x,y,xn,yn,Xdet1,yDet1,iter begin if aiguillage[index].EtatTJD=4 then begin - TjdHom:=aiguillage[index].Ddevie; + TjdHom:=aiguillage[index].Ddevie; Index_TjdHom:=index_aig(TjdHom); position2:=aiguillage[Index_TjdHom].position; tjd4(adresse,position,TjdHom,position2,c1,c2); // retourne c1 et C2 @@ -13708,6 +13774,11 @@ begin end; // fonction appellable en modes 1 2 3 10 11 12 +// affiche le tracé de det1 à det2; n°Train n°i (pas son index), adresseTrain, mode=0=éteint =1 allumejaune =2 allume selon index, +// posAig=false : ne tient pas compte de la position des aiguillages pour le tracé (cherche en récursif det2 +// = true : suit le tracé suivant la position des aiguillages jusque det2 +// affecte_loco=true : affecte loco si on rencontre un canton. Si mode=0 çà désaffecte la loco au canton +// =false : ne change pas l'affectation d'un canton rencontré function zone_tco(indexTCO,det1,det2,train,adrTrain,mode: integer;posAig,affecte_loco : boolean) : boolean; overload; begin result:=zone_tco_gx(indexTCO,det1,det,det2,train,adrTrain,mode,posAig,affecte_loco); @@ -13903,7 +13974,7 @@ begin dessin_34(indexTCO,ImagePalette34.canvas,1,1,0); dessin_Quai(indexTCO,ImagePalette51.canvas,1,1,0); //quai - dessin_Action(indexTCO,ImagePalette52.canvas,1,1,0); //action + dessin_Action(indexTCO,ImagePalette52.canvas,1,1); //action dessin_icone_canton(indexTCO,ImagePalette53.canvas,1,1,0); //action @@ -15015,7 +15086,7 @@ begin 33 : dessin_33(indexTCO,FormTCO[indexTCO].ImageTCO.Canvas,XClic,YClic,0); 34 : dessin_34(indexTCO,FormTCO[indexTCO].ImageTCO.Canvas,XClic,YClic,0); id_Quai : dessin_Quai(indexTCO,FormTCO[indexTCO].ImageTCO.Canvas,XClic,YClic,0); - id_action : dessin_Action(indexTCO,FormTCO[indexTCO].ImageTCO.Canvas,XClic,YClic,0); + id_action : dessin_Action(indexTCO,FormTCO[indexTCO].ImageTCO.Canvas,XClic,YClic); id_canton : // autorisé à déposer que sur les icones 1 et 20 @@ -15963,7 +16034,7 @@ end; procedure TFormTCO.ImageTCOMouseDown(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer); var position : Tpoint; Numcanton,xt,yt,bt,indexTCO,i,n,adresse,Bimage,xf,yf,xclic,yclic,el1,el2,senscanton,larg,haut, - indexTrain,idcantonOrg,idcantonDest,AdrTrain,sens : integer; + indexTrain,idcantonOrg,idcantonDest,AdrTrain,sens,etat : integer; tel1,tel2 : tequipement; s : string; presTrain,Horz,Pc,trouve : boolean; @@ -16008,7 +16079,7 @@ begin end; // clic sur canton //if isCanton(Bimage) then - if pc then + if pc then begin IdCantonClic:=index_canton(indexTCO,xclic,yclic); if IdCantonClic>0 then @@ -16288,7 +16359,18 @@ begin Init_Horloge; end; AcAff_horloge : affiche_horloge; + AcBouton_bistable: + begin + + adresse:=tco[indextco,xclic,yclic].Adresse; + if (adresse<=0) or (adresse>100) then exit; + etat:=boutonTCO[adresse].etat; + inc(etat); + if etat=2 then etat:=0; + boutonTCO[adresse].etat:=etat; + dessin_Action(indexTCO,pcanvasTCO[indextco],xclic,yclic); + end; end; end; @@ -18895,11 +18977,23 @@ end; procedure TFormTCO.AffRoutesClick(Sender: TObject); +var x,y,idc : integer; begin with formrouteTrain do begin windowState:=wsNormal; //Maximized;; TabSheetRA.Enabled:=true; + x:=XClicCell[indexTCOCourant]; + y:=YClicCell[indexTCOCourant]; + if isCanton(TCO[indexTcoCourant,x,y].BImage) then + begin + origine_canton(x,y); + if (x<>0) and (y<>0) then + begin + idc:=Index_Canton_numero(tco[indexTCOcourant,x,y].NumCanton); //index canton + indextrainFR:=canton[idc].indexTrain; + end; + end; Show; end; end; @@ -18914,17 +19008,21 @@ begin formRoute.Show; end; -procedure TFormTCO.rouverunlment1Click(Sender: TObject); +procedure TFormTCO.Trouverunlment1Click(Sender: TObject); var x,y : integer; trouve : boolean; begin IndexTCOCourant:=index_TCOMainMenu; + AchercherDet:=0; + AchercherCanton:=0; FormIntro.showmodal; y:=1; repeat x:=1; repeat - trouve:=tco[IndexTCOCourant,x,y].Adresse=Achercher; + if AchercherDet<>0 then trouve:=tco[IndexTCOCourant,x,y].Adresse=AchercherDet; + if AchercherCanton<>0 then + trouve:=tco[IndexTCOCourant,x,y].NumCanton=Acherchercanton; inc(x); until (x>NbreCellX[IndexTCOCourant]) or trouve; inc(y); @@ -18943,5 +19041,11 @@ begin end; end; + + + + + + end. diff --git a/verif_version.dfm b/verif_version.dfm index 4bfcb63..d09a8cc 100644 --- a/verif_version.dfm +++ b/verif_version.dfm @@ -17,10 +17,10 @@ object FormVersion: TFormVersion PixelsPerInch = 96 TextHeight = 20 object Memo1: TMemo - Left = 8 - Top = 8 - Width = 625 - Height = 217 + Left = 0 + Top = 0 + Width = 649 + Height = 233 Color = clNavy Font.Charset = ANSI_CHARSET Font.Color = clYellow diff --git a/verif_version.pas b/verif_version.pas index bd9c9ca..0473c8e 100644 --- a/verif_version.pas +++ b/verif_version.pas @@ -11,7 +11,7 @@ type TFormVersion = class(TForm) Memo1: TMemo; procedure FormCreate(Sender: TObject); - procedure TimerVerifTimer(Sender: TObject); + //procedure TimerVerifTimer(Sender: TObject); private { Déclarations privées } public @@ -21,13 +21,13 @@ type var FormVersion: TFormVersion; Lance_verif : integer; - verifVersion,notificationVersion,essai : boolean; + DebugVV,verifVersion,notificationVersion,essai : boolean; chemin_Dest,chemin_src,date_creation,nombre_tel : string; f : text; Const -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 +VersionSC ='9.7'; // 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; SHCONTCH_AUTORENAME=8; @@ -85,10 +85,13 @@ begin t:=0; Try Fs:=TFileStream.Create(s,fmCreate); //hSession := InternetOpen('MyApp', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0); + if DebugVV then Affiche('TFileStream.Create ok',clLime); hSession:=InternetOpen('MyApp',INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY,nil,nil,0); + if DebugVV then Affiche('InternetOpen ok',clLime); try if Assigned(hSession) then begin + if DebugVV then Affiche('Session assignée',clYellow); hService:=InternetOpenUrl(hSession,PChar(aUrl),nil,0,INTERNET_FLAG_RELOAD,0); i:=getLastError; if i<>0 then @@ -100,7 +103,7 @@ begin end; if Assigned(hService) then try - //Affiche('Service assigné',clLime); + if DebugVV then Affiche('Service assigné',clLime); while True do begin dwBytesRead:=1024; @@ -272,10 +275,13 @@ begin Url:='https://api.github.com/repos/f1iwq2/signaux_complexes_gl/releases/latest'; LocalFile:='page.txt'; trouve_version:=false; + DebugVV:=false; trouve_zip:=false; zone_comm:=false; Ncomm:=0; + if DebugVV then Affiche('Lancement DownloadURL_NOCache',clYellow); if DownloadURL_NOCache(Url,localFile,taille) then + //if true then begin if not(FileExists(localfile)) then begin @@ -285,6 +291,7 @@ begin result:=0; exit; end; + if DebugVV then Affiche('DownloadURL_NOCache passé',clYellow); AssignFile(fichier,LocalFile); reset(fichier); @@ -292,11 +299,17 @@ begin while not(eof(fichier)) and (not(trouve_version) or not(trouve_zip)) do begin readln(fichier,s); + if DebugVV then Affiche(s,clYellow); + s:=utf8Decode(s); //Affiche(s,clyellow); // adresse de téléchargement s3:=extrait_champ('browser_download_url'); - if s3<>'' then trouve_zip:=true; + if s3<>'' then + begin + if DebugVV then affiche('ZIP trouvé',clYellow); + trouve_zip:=true; + end; // nombre de téléchargements nombre_tel:=extrait_champ_simple('download_count'); @@ -306,6 +319,7 @@ begin if date_creation_ang<>'' then begin //Affiche(date_creation_ang,clyellow); + if DebugVV then affiche('Date création trouvé',clYellow); i:=pos('-',date_creation_ang); j:=posex('-',date_creation_ang,i+1); i2:=pos('T',date_creation_ang); @@ -320,12 +334,14 @@ begin if version_p<>'' then begin trouve_version:=true; + if DebugVV then affiche('Version trouvée',clYellow); if not(version_p[1] in ['0'..'9']) then delete(version_p,1,1); end; description:=extrait_champ('body'); if description<>'' then begin + if DebugVV then affiche('Description trouvée',clYellow); //description:=utf8Decode(description); i:=1 ; j:=1; // couper en chaînes et mettre dans comm[] @@ -350,6 +366,7 @@ begin end; end; closefile(fichier); + if DebugVV then affiche('Fermeture du fichier d''échange',clYellow); if trouve_version and trouve_zip then begin @@ -357,10 +374,11 @@ begin //isoler le nom du fichier i:=length(s3); repeat - dec(i); + dec(i); locZip:=s3[i]='/'; until (i=1) or LocZip; nomfichier:=copy(s3,i+1,length(s3)-i); + //affiche(nombre_tel,cllime); //Affiche(s3,clLime); //Affiche(nomfichier,clred); @@ -374,19 +392,9 @@ begin l:=length(s); SV_publie:=s[l]; if Sv_publie in ['0'..'9'] then Sv_Publie:=' ' else begin s:=copy(s,1,l-1);Version_P:=s;end; - val(s,V_publie,erreur); - if erreur<>0 then - begin - Affiche('Erreur 701',clred); - exit; - end; - val(s2,V_utile,erreur); - if erreur<>0 then - begin - Affiche('Erreur 702',clred); - exit; - end; - // + V_Publie:=StrToFloat(s,FormatSettings); + V_utile:=StrToFloat(s2,FormatSettings); + if (V_utile