diff --git a/Notice avancée pour les signaux complexes GL.pdf b/Notice avancée pour les signaux complexes GL.pdf index 4ef8cf0..afaf4e6 100644 Binary files a/Notice avancée pour les signaux complexes GL.pdf and b/Notice avancée pour les signaux complexes GL.pdf differ diff --git a/Notice d'utilisation des signaux_complexes_GL_V5.73.pdf b/Notice d'utilisation des signaux_complexes_GL_V5.73.pdf new file mode 100644 index 0000000..25bd19b Binary files /dev/null and b/Notice d'utilisation des signaux_complexes_GL_V5.73.pdf differ diff --git a/Signaux_complexes_GL.dpr b/Signaux_complexes_GL.dpr index 4b17209..d3b06af 100644 --- a/Signaux_complexes_GL.dpr +++ b/Signaux_complexes_GL.dpr @@ -14,7 +14,8 @@ uses Unit_Pilote_aig in 'Unit_Pilote_aig.pas' {FormAig}, UnitConfigCellTCO in 'UnitConfigCellTCO.pas' {FormConfCellTCO}, UnitCDF in 'UnitCDF.pas' {FormCDF}, - Unitplace in 'Unitplace.pas' {FormPlace}; + Unitplace in 'Unitplace.pas' {FormPlace}, + UnitPareFeu in 'UnitPareFeu.pas'; {$R *.res} diff --git a/UnitCDF.dcu b/UnitCDF.dcu index 8c8d6c2..69fb7bf 100644 Binary files a/UnitCDF.dcu and b/UnitCDF.dcu differ diff --git a/UnitConfig.dcu b/UnitConfig.dcu index 6bb531b..a268637 100644 Binary files a/UnitConfig.dcu and b/UnitConfig.dcu differ diff --git a/UnitConfig.dfm b/UnitConfig.dfm index 3187bf0..6b79549 100644 --- a/UnitConfig.dfm +++ b/UnitConfig.dfm @@ -1,6 +1,6 @@ object FormConfig: TFormConfig - Left = 243 - Top = 119 + Left = 332 + Top = 149 Hint = 'Modifie la configuration selon les s'#233'lections choisies' BorderStyle = bsDialog Caption = 'Configuration g'#233'n'#233'rale' @@ -31,6 +31,7 @@ object FormConfig: TFormConfig Font.Name = 'Arial Narrow' Font.Style = [] ParentFont = False + WordWrap = True end object Image1: TImage Left = 648 @@ -1570,7 +1571,7 @@ object FormConfig: TFormConfig Top = 8 Width = 633 Height = 505 - ActivePage = TabSheetSig + ActivePage = TabSheetAct Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -11 @@ -1595,8 +1596,8 @@ object FormConfig: TFormConfig Left = 16 Top = 8 Width = 273 - Height = 81 - Caption = 'CDM Rail' + Height = 113 + Caption = 'Socket de comm. CDM Rail <--> Signaux complexes' TabOrder = 0 object Label1: TLabel Left = 14 @@ -1630,10 +1631,24 @@ object FormConfig: TFormConfig TabOrder = 1 Text = 'EditPortCDM' end + object ButtonPFCDM: TButton + Left = 16 + Top = 72 + Width = 241 + Height = 25 + Hint = + 'Ajoute une r'#232'gle d'#39'autorisation de communication du socket vers ' + + 'CDM rail dans le pare-feu' + Caption = 'Ajouter une autorisation au pare-feu windows' + ParentShowHint = False + ShowHint = True + TabOrder = 2 + OnClick = ButtonPFCDMClick + end end object GroupBox5: TGroupBox Left = 16 - Top = 96 + Top = 128 Width = 273 Height = 193 Caption = 'Au d'#233'marrage de Signaux_Complexes ' @@ -1853,9 +1868,9 @@ object FormConfig: TFormConfig end object GroupBox8: TGroupBox Left = 16 - Top = 296 + Top = 328 Width = 273 - Height = 145 + Height = 113 Caption = 'Services CommIP CDM Rail' TabOrder = 4 object Label6: TLabel @@ -1890,16 +1905,16 @@ object FormConfig: TFormConfig TabOrder = 2 end object CheckServPosTrains: TCheckBox - Left = 8 - Top = 96 + Left = 120 + Top = 48 Width = 145 Height = 17 Caption = 'Position trains (non utilis'#233')' TabOrder = 3 end object CheckBoxSrvSig: TCheckBox - Left = 8 - Top = 112 + Left = 120 + Top = 64 Width = 113 Height = 17 Caption = 'Signaux (non utilis'#233')' @@ -3339,9 +3354,9 @@ object FormConfig: TFormConfig object ButtonInsFeu: TButton Left = 144 Top = 32 - Width = 145 + Width = 153 Height = 17 - Caption = 'Ajouter le feu supprim'#233 + Caption = 'Ajouter le signal supprim'#233 TabOrder = 4 OnClick = ButtonInsFeuClick end @@ -3384,416 +3399,8 @@ object FormConfig: TFormConfig Height = 441 Caption = 'Description de l'#39'action' TabOrder = 0 - object GroupBoxPN: TGroupBox - Left = 8 - Top = 16 - Width = 233 - Height = 401 - Caption = 'Action gestion passage '#224' niveau' - ParentShowHint = False - ShowHint = False - TabOrder = 2 - object Label21: TLabel - Left = 8 - Top = 20 - Width = 100 - Height = 13 - Caption = 'Adresse de fermeture' - end - object Label22: TLabel - Left = 8 - Top = 44 - Width = 94 - Height = 13 - Caption = 'Adresse d'#39'ouverture' - end - object Label23: TLabel - Left = 8 - Top = 116 - Width = 30 - Height = 13 - Caption = 'Voie 1' - end - object LabelV2: TLabel - Left = 8 - Top = 140 - Width = 30 - Height = 13 - Caption = 'Voie 2' - end - object LabelV3: TLabel - Left = 8 - Top = 164 - Width = 30 - Height = 13 - Caption = 'Voie 3' - end - object Shape1: TShape - Left = 64 - Top = 105 - Width = 137 - Height = 2 - end - object Label39: TLabel - Left = 8 - Top = 188 - Width = 30 - Height = 13 - Caption = 'Voie 4' - end - object Label45: TLabel - Left = 64 - Top = 216 - Width = 54 - Height = 13 - Caption = 'Zone ferme' - end - object Label46: TLabel - Left = 152 - Top = 216 - Width = 55 - Height = 13 - Caption = 'Zone ouvre' - end - object Label47: TLabel - Left = 8 - Top = 244 - Width = 30 - Height = 13 - Caption = 'Voie 1' - end - object Label48: TLabel - Left = 8 - Top = 268 - Width = 30 - Height = 13 - Caption = 'Voie 2' - end - object Label49: TLabel - Left = 8 - Top = 292 - Width = 30 - Height = 13 - Caption = 'Voie 3' - end - object Label50: TLabel - Left = 8 - Top = 316 - Width = 30 - Height = 13 - Caption = 'Voie 4' - end - object Shape2: TShape - Left = 64 - Top = 233 - Width = 150 - Height = 2 - end - object EditAdrFerme: TEdit - Left = 120 - Top = 16 - Width = 41 - Height = 21 - TabOrder = 0 - OnChange = EditAdrFermeChange - end - object EditAdrOuvre: TEdit - Left = 120 - Top = 40 - Width = 41 - Height = 21 - TabOrder = 1 - OnChange = EditAdrOuvreChange - end - object EditCmdFerme: TEdit - Left = 168 - Top = 16 - Width = 25 - Height = 21 - Hint = 'Commande de fermeture (0 '#224' 2)' - ParentShowHint = False - ShowHint = True - TabOrder = 2 - OnChange = EditCmdFermeChange - end - object EditCdeOuvre: TEdit - Left = 168 - Top = 40 - Width = 25 - Height = 21 - Hint = 'Commande d'#39'ouverture (0 '#224' 2)' - ParentShowHint = False - ShowHint = True - TabOrder = 3 - OnChange = EditCdeOuvreChange - end - object EditV1F: TEdit - Left = 64 - Top = 112 - Width = 41 - Height = 21 - Hint = 'Actionneur 1 fermeture' - ParentShowHint = False - ShowHint = True - TabOrder = 4 - OnChange = EditV1FChange - end - object StaticText1: TStaticText - Left = 64 - Top = 88 - Width = 49 - Height = 17 - Caption = 'Act ferme' - TabOrder = 5 - end - object StaticText2: TStaticText - Left = 152 - Top = 88 - Width = 50 - Height = 17 - Caption = 'Act ouvre' - TabOrder = 6 - end - object EditV2F: TEdit - Left = 64 - Top = 136 - Width = 41 - Height = 21 - TabOrder = 7 - OnChange = EditV2FChange - end - object EditV3F: TEdit - Left = 64 - Top = 160 - Width = 41 - Height = 21 - TabOrder = 8 - OnChange = EditV3FChange - end - object EditV1O: TEdit - Left = 152 - Top = 112 - Width = 41 - Height = 21 - Hint = 'Actionneur 1 ouverture' - ParentShowHint = False - ShowHint = True - TabOrder = 9 - OnChange = EditV1OChange - end - object EditV2O: TEdit - Left = 152 - Top = 136 - Width = 41 - Height = 21 - TabOrder = 10 - OnChange = EditV2OChange - end - object EditV3O: TEdit - Left = 152 - Top = 160 - Width = 41 - Height = 21 - TabOrder = 11 - OnChange = EditV3OChange - end - object EditV4F: TEdit - Left = 64 - Top = 184 - Width = 41 - Height = 21 - TabOrder = 12 - OnChange = EditV4FChange - end - object EditV4O: TEdit - Left = 152 - Top = 184 - Width = 41 - Height = 21 - TabOrder = 13 - OnChange = EditV4OChange - end - object EditZdet1V1F: TEdit - Left = 64 - Top = 240 - Width = 33 - Height = 21 - TabOrder = 14 - OnChange = EditZdet1V1FChange - end - object EditZdet1V1O: TEdit - Left = 152 - Top = 240 - Width = 33 - Height = 21 - Hint = 'D'#233'tecteur 1 zone d'#39'ouverture' - TabOrder = 15 - OnChange = EditZdet1V1OChange - end - object EditZdet2V1F: TEdit - Left = 96 - Top = 240 - Width = 33 - Height = 21 - Hint = 'D'#233'tecteur 2 zone de fermeture' - TabOrder = 16 - OnChange = EditZdet2V1FChange - end - object EditZdet2V1O: TEdit - Left = 184 - Top = 240 - Width = 33 - Height = 21 - Hint = 'D'#233'tecteur 2 zone d'#39'ouverture' - TabOrder = 17 - OnChange = EditZdet2V1OChange - end - object EditZdet1V2F: TEdit - Left = 64 - Top = 264 - Width = 33 - Height = 21 - TabOrder = 18 - OnChange = EditZdet1V2FChange - end - object EditZdet2V2F: TEdit - Left = 96 - Top = 264 - Width = 33 - Height = 21 - Hint = 'D'#233'tecteur 2 zone de fermeture' - TabOrder = 19 - OnChange = EditZdet2V2FChange - end - object EditZdet1V2O: TEdit - Left = 152 - Top = 264 - Width = 33 - Height = 21 - Hint = 'D'#233'tecteur 1 zone d'#39'ouverture' - TabOrder = 20 - OnChange = EditZdet1V2OChange - end - object EditZdet2V2O: TEdit - Left = 184 - Top = 264 - Width = 33 - Height = 21 - Hint = 'D'#233'tecteur 2 zone d'#39'ouverture' - TabOrder = 21 - OnChange = EditZdet2V2OChange - end - object EditZdet1V3F: TEdit - Left = 64 - Top = 288 - Width = 33 - Height = 21 - TabOrder = 22 - OnChange = EditZdet1V3FChange - end - object EditZdet2V3F: TEdit - Left = 96 - Top = 288 - Width = 33 - Height = 21 - Hint = 'D'#233'tecteur 2 zone de fermeture' - TabOrder = 23 - OnChange = EditZdet2V3FChange - end - object EditZdet1V3O: TEdit - Left = 152 - Top = 288 - Width = 33 - Height = 21 - Hint = 'D'#233'tecteur 1 zone d'#39'ouverture' - TabOrder = 24 - OnChange = EditZdet1V3OChange - end - object EditZdet2V3O: TEdit - Left = 184 - Top = 288 - Width = 33 - Height = 21 - Hint = 'D'#233'tecteur 2 zone d'#39'ouverture' - TabOrder = 25 - OnChange = EditZdet2V3OChange - end - object EditZdet1V4F: TEdit - Left = 64 - Top = 312 - Width = 33 - Height = 21 - TabOrder = 26 - OnChange = EditZdet1V4FChange - end - object EditZdet2V4F: TEdit - Left = 96 - Top = 312 - Width = 33 - Height = 21 - Hint = 'D'#233'tecteur 2 zone de fermeture' - TabOrder = 27 - OnChange = EditZdet2V4FChange - end - object EditZdet1V4O: TEdit - Left = 152 - Top = 312 - Width = 33 - Height = 21 - Hint = 'D'#233'tecteur 1 zone d'#39'ouverture' - TabOrder = 28 - OnChange = EditZdet1V4OChange - end - object EditZdet2V4O: TEdit - Left = 184 - Top = 312 - Width = 33 - Height = 21 - Hint = 'D'#233'tecteur 2 zone d'#39'ouverture' - TabOrder = 29 - OnChange = EditZdet2V4OChange - end - object Button1: TButton - Left = 200 - Top = 16 - Width = 27 - Height = 21 - Hint = 'Test de fermeture (mode CDM ou connect'#233' '#224' l'#39'interface)' - Caption = 'test' - ParentShowHint = False - ShowHint = True - TabOrder = 30 - OnClick = Button1Click - end - object Button3: TButton - Left = 200 - Top = 40 - Width = 27 - Height = 21 - Hint = 'Test d'#39'ouverture (mode CDM ou connect'#233' '#224' l'#39'interface)' - Caption = 'test' - ParentShowHint = False - ShowHint = True - TabOrder = 31 - OnClick = Button3Click - end - object CheckPnPulse: TCheckBox - Left = 8 - Top = 64 - Width = 97 - Height = 17 - Hint = - 'Sortie impulsionnelle ou continue (attention peut d'#233'truire les m' + - 'oteurs '#224' bobine)' - Caption = 'Impulsionnel' - ParentShowHint = False - ShowHint = True - TabOrder = 32 - OnClick = CheckPnPulseClick - end - end object GroupBoxRadio: TGroupBox - Left = 56 + Left = 64 Top = 16 Width = 225 Height = 73 @@ -3828,8 +3435,8 @@ object FormConfig: TFormConfig end end object GroupBoxAct: TGroupBox - Left = 64 - Top = 60 + Left = 192 + Top = 28 Width = 233 Height = 341 Caption = 'Action fonction de locomotive ' @@ -3846,7 +3453,7 @@ object FormConfig: TFormConfig Top = 96 Width = 54 Height = 26 - Caption = 'Actionneur D'#233'tecteurZ' + Caption = 'Actionneur D'#233'tecteur' WordWrap = True end object Label30: TLabel @@ -4141,6 +3748,478 @@ object FormConfig: TFormConfig OnClick = ButtonTestActClick end end + object GroupBoxPN: TGroupBox + Left = 8 + Top = 16 + Width = 233 + Height = 401 + Caption = 'Action gestion passage '#224' niveau' + ParentShowHint = False + ShowHint = False + TabOrder = 2 + object Label21: TLabel + Left = 8 + Top = 20 + Width = 100 + Height = 13 + Caption = 'Adresse de fermeture' + end + object Label22: TLabel + Left = 8 + Top = 44 + Width = 94 + Height = 13 + Caption = 'Adresse d'#39'ouverture' + end + object Label23: TLabel + Left = 8 + Top = 116 + Width = 30 + Height = 13 + Caption = 'Voie 1' + end + object LabelV2: TLabel + Left = 8 + Top = 140 + Width = 30 + Height = 13 + Caption = 'Voie 2' + end + object LabelV3: TLabel + Left = 8 + Top = 164 + Width = 30 + Height = 13 + Caption = 'Voie 3' + end + object Shape1: TShape + Left = 64 + Top = 105 + Width = 137 + Height = 2 + end + object Label39: TLabel + Left = 8 + Top = 188 + Width = 30 + Height = 13 + Caption = 'Voie 4' + end + object Label45: TLabel + Left = 64 + Top = 240 + Width = 54 + Height = 13 + Caption = 'Zone ferme' + end + object Label46: TLabel + Left = 152 + Top = 240 + Width = 55 + Height = 13 + Caption = 'Zone ouvre' + end + object Label47: TLabel + Left = 8 + Top = 268 + Width = 30 + Height = 13 + Caption = 'Voie 1' + end + object Label48: TLabel + Left = 8 + Top = 292 + Width = 30 + Height = 13 + Caption = 'Voie 2' + end + object Label49: TLabel + Left = 8 + Top = 316 + Width = 30 + Height = 13 + Caption = 'Voie 3' + end + object Label50: TLabel + Left = 8 + Top = 340 + Width = 30 + Height = 13 + Caption = 'Voie 4' + end + object Shape2: TShape + Left = 64 + Top = 257 + Width = 150 + Height = 2 + end + object Label59: TLabel + Left = 8 + Top = 212 + Width = 30 + Height = 13 + Caption = 'Voie 5' + end + object Label60: TLabel + Left = 8 + Top = 364 + Width = 30 + Height = 13 + Caption = 'Voie 5' + end + object EditAdrFerme: TEdit + Left = 120 + Top = 16 + Width = 41 + Height = 21 + TabOrder = 0 + OnChange = EditAdrFermeChange + end + object EditAdrOuvre: TEdit + Left = 120 + Top = 40 + Width = 41 + Height = 21 + TabOrder = 2 + OnChange = EditAdrOuvreChange + end + object EditCmdFerme: TEdit + Left = 168 + Top = 16 + Width = 25 + Height = 21 + Hint = 'Commande de fermeture (0 '#224' 2)' + ParentShowHint = False + ShowHint = True + TabOrder = 1 + OnChange = EditCmdFermeChange + end + object EditCdeOuvre: TEdit + Left = 168 + Top = 40 + Width = 25 + Height = 21 + Hint = 'Commande d'#39'ouverture (0 '#224' 2)' + ParentShowHint = False + ShowHint = True + TabOrder = 3 + OnChange = EditCdeOuvreChange + end + object EditV1F: TEdit + Left = 64 + Top = 112 + Width = 41 + Height = 21 + Hint = 'Actionneur 1 fermeture' + ParentShowHint = False + ShowHint = True + TabOrder = 4 + OnChange = EditV1FChange + end + object StaticText1: TStaticText + Left = 64 + Top = 88 + Width = 49 + Height = 17 + Caption = 'Act ferme' + TabOrder = 14 + end + object StaticText2: TStaticText + Left = 152 + Top = 88 + Width = 50 + Height = 17 + Caption = 'Act ouvre' + TabOrder = 15 + end + object EditV2F: TEdit + Left = 64 + Top = 136 + Width = 41 + Height = 21 + TabOrder = 6 + OnChange = EditV2FChange + end + object EditV3F: TEdit + Left = 64 + Top = 160 + Width = 41 + Height = 21 + TabOrder = 8 + OnChange = EditV3FChange + end + object EditV1O: TEdit + Left = 152 + Top = 112 + Width = 41 + Height = 21 + Hint = 'Actionneur 1 ouverture' + ParentShowHint = False + ShowHint = True + TabOrder = 5 + OnChange = EditV1OChange + end + object EditV2O: TEdit + Left = 152 + Top = 136 + Width = 41 + Height = 21 + TabOrder = 7 + OnChange = EditV2OChange + end + object EditV3O: TEdit + Left = 152 + Top = 160 + Width = 41 + Height = 21 + TabOrder = 9 + OnChange = EditV3OChange + end + object EditV4F: TEdit + Left = 64 + Top = 184 + Width = 41 + Height = 21 + TabOrder = 10 + OnChange = EditV4FChange + end + object EditV4O: TEdit + Left = 152 + Top = 184 + Width = 41 + Height = 21 + TabOrder = 11 + OnChange = EditV4OChange + end + object EditZdet1V1F: TEdit + Left = 64 + Top = 264 + Width = 33 + Height = 21 + TabOrder = 16 + OnChange = EditZdet1V1FChange + end + object EditZdet1V1O: TEdit + Left = 152 + Top = 264 + Width = 33 + Height = 21 + Hint = 'D'#233'tecteur 1 zone d'#39'ouverture' + TabOrder = 18 + OnChange = EditZdet1V1OChange + end + object EditZdet2V1F: TEdit + Left = 96 + Top = 264 + Width = 33 + Height = 21 + Hint = 'D'#233'tecteur 2 zone de fermeture' + TabOrder = 17 + OnChange = EditZdet2V1FChange + end + object EditZdet2V1O: TEdit + Left = 184 + Top = 264 + Width = 33 + Height = 21 + Hint = 'D'#233'tecteur 2 zone d'#39'ouverture' + TabOrder = 19 + OnChange = EditZdet2V1OChange + end + object EditZdet1V2F: TEdit + Left = 64 + Top = 288 + Width = 33 + Height = 21 + TabOrder = 20 + OnChange = EditZdet1V2FChange + end + object EditZdet2V2F: TEdit + Left = 96 + Top = 288 + Width = 33 + Height = 21 + Hint = 'D'#233'tecteur 2 zone de fermeture' + TabOrder = 21 + OnChange = EditZdet2V2FChange + end + object EditZdet1V2O: TEdit + Left = 152 + Top = 288 + Width = 33 + Height = 21 + Hint = 'D'#233'tecteur 1 zone d'#39'ouverture' + TabOrder = 22 + OnChange = EditZdet1V2OChange + end + object EditZdet2V2O: TEdit + Left = 184 + Top = 288 + Width = 33 + Height = 21 + Hint = 'D'#233'tecteur 2 zone d'#39'ouverture' + TabOrder = 23 + OnChange = EditZdet2V2OChange + end + object EditZdet1V3F: TEdit + Left = 64 + Top = 312 + Width = 33 + Height = 21 + TabOrder = 24 + OnChange = EditZdet1V3FChange + end + object EditZdet2V3F: TEdit + Left = 96 + Top = 312 + Width = 33 + Height = 21 + Hint = 'D'#233'tecteur 2 zone de fermeture' + TabOrder = 25 + OnChange = EditZdet2V3FChange + end + object EditZdet1V3O: TEdit + Left = 152 + Top = 312 + Width = 33 + Height = 21 + Hint = 'D'#233'tecteur 1 zone d'#39'ouverture' + TabOrder = 26 + OnChange = EditZdet1V3OChange + end + object EditZdet2V3O: TEdit + Left = 184 + Top = 312 + Width = 33 + Height = 21 + Hint = 'D'#233'tecteur 2 zone d'#39'ouverture' + TabOrder = 27 + OnChange = EditZdet2V3OChange + end + object EditZdet1V4F: TEdit + Left = 64 + Top = 336 + Width = 33 + Height = 21 + TabOrder = 28 + OnChange = EditZdet1V4FChange + end + object EditZdet2V4F: TEdit + Left = 96 + Top = 336 + Width = 33 + Height = 21 + Hint = 'D'#233'tecteur 2 zone de fermeture' + TabOrder = 29 + end + object EditZdet1V4O: TEdit + Left = 152 + Top = 336 + Width = 33 + Height = 21 + Hint = 'D'#233'tecteur 1 zone d'#39'ouverture' + TabOrder = 30 + OnChange = EditZdet1V4OChange + end + object EditZdet2V4O: TEdit + Left = 184 + Top = 336 + Width = 33 + Height = 21 + Hint = 'D'#233'tecteur 2 zone d'#39'ouverture' + TabOrder = 31 + OnChange = EditZdet2V4OChange + end + object Button1: TButton + Left = 200 + Top = 16 + Width = 27 + Height = 21 + Hint = 'Test de fermeture (mode CDM ou connect'#233' '#224' l'#39'interface)' + Caption = 'test' + ParentShowHint = False + ShowHint = True + TabOrder = 36 + OnClick = Button1Click + end + object Button3: TButton + Left = 200 + Top = 40 + Width = 27 + Height = 21 + Hint = 'Test d'#39'ouverture (mode CDM ou connect'#233' '#224' l'#39'interface)' + Caption = 'test' + ParentShowHint = False + ShowHint = True + TabOrder = 37 + OnClick = Button3Click + end + object CheckPnPulse: TCheckBox + Left = 8 + Top = 64 + Width = 97 + Height = 17 + Hint = + 'Sortie impulsionnelle ou continue (attention peut d'#233'truire les m' + + 'oteurs '#224' bobine)' + Caption = 'Impulsionnel' + ParentShowHint = False + ShowHint = True + TabOrder = 38 + OnClick = CheckPnPulseClick + end + object EditV5F: TEdit + Left = 64 + Top = 208 + Width = 41 + Height = 21 + TabOrder = 12 + OnChange = EditV5FChange + end + object EditV5O: TEdit + Left = 152 + Top = 208 + Width = 41 + Height = 21 + TabOrder = 13 + OnChange = EditV5OChange + end + object EditZdet1V5F: TEdit + Left = 64 + Top = 360 + Width = 33 + Height = 21 + TabOrder = 32 + OnChange = EditZdet1V5FChange + end + object EditZdet2V5F: TEdit + Left = 96 + Top = 360 + Width = 33 + Height = 21 + Hint = 'D'#233'tecteur 2 zone de fermeture' + TabOrder = 33 + OnChange = EditZdet2V5FChange + end + object EditZdet1V5O: TEdit + Left = 152 + Top = 360 + Width = 33 + Height = 21 + Hint = 'D'#233'tecteur 1 zone d'#39'ouverture' + TabOrder = 34 + OnChange = EditZdet1V5OChange + end + object EditZdet2V5O: TEdit + Left = 184 + Top = 360 + Width = 33 + Height = 21 + Hint = 'D'#233'tecteur 2 zone d'#39'ouverture' + TabOrder = 35 + OnChange = EditZdet2V5OChange + end + end end object GroupBox14: TGroupBox Left = 0 diff --git a/UnitConfig.pas b/UnitConfig.pas index f296d4a..df54d83 100644 --- a/UnitConfig.pas +++ b/UnitConfig.pas @@ -5,7 +5,7 @@ interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls , verif_version, jpeg, ComCtrls ,StrUtils, Unitprinc, - MMSystem, Buttons ; + MMSystem, Buttons , UnitPareFeu; type TFormConfig = class(TForm) @@ -324,6 +324,15 @@ type CheckBoxVerifXpressNet: TCheckBox; LabelCrois: TLabel; Image3: TImage; + ButtonPFCDM: TButton; + Label59: TLabel; + EditV5F: TEdit; + EditV5O: TEdit; + EditZdet1V5F: TEdit; + EditZdet2V5F: TEdit; + EditZdet1V5O: TEdit; + EditZdet2V5O: TEdit; + Label60: TLabel; procedure ButtonAppliquerEtFermerClick(Sender: TObject); procedure FormActivate(Sender: TObject); procedure FormCreate(Sender: TObject); @@ -443,7 +452,6 @@ type procedure EditZdet1V3OChange(Sender: TObject); procedure EditZdet2V3OChange(Sender: TObject); procedure EditZdet1V4FChange(Sender: TObject); - procedure EditZdet2V4FChange(Sender: TObject); procedure EditZdet1V4OChange(Sender: TObject); procedure EditZdet2V4OChange(Sender: TObject); procedure Button1Click(Sender: TObject); @@ -472,6 +480,13 @@ type Shift: TShiftState); procedure RichEditTrainsKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); + procedure ButtonPFCDMClick(Sender: TObject); + procedure EditV5FChange(Sender: TObject); + procedure EditV5OChange(Sender: TObject); + procedure EditZdet1V5FChange(Sender: TObject); + procedure EditZdet2V5FChange(Sender: TObject); + procedure EditZdet1V5OChange(Sender: TObject); + procedure EditZdet2V5OChange(Sender: TObject); private { Déclarations privées } public @@ -1317,10 +1332,10 @@ begin case Tablo_Actionneur[i].typdeclenche of 0 : begin - s:=IntToSTR(adresse); if tablo_actionneur[i].det then s:=s+'Z'; + s:=IntToSTR(adresse);// if tablo_actionneur[i].det then s:=s+'Z'; end; // type mémoire de zone - 1 : + 3 : begin s:='Mem['+IntToSTR(adresse)+','+IntToSTR(Tablo_Actionneur[i].adresse2)+']'; end; @@ -1357,7 +1372,7 @@ begin with formconfig do begin NbVoies:=Tablo_PN[i].NbVoies; - if NbVoies>4 then nbVoies:=4; + if NbVoies>5 then nbVoies:=5; s:=''; // par actionneur @@ -1707,7 +1722,7 @@ begin Tablo_actionneur[i].accessoire:=0; Tablo_actionneur[i].sortie:=0; Tablo_actionneur[i].fichierSon:=''; - Tablo_actionneur[i].det:=false; + // Tablo_actionneur[i].det:=false; Tablo_actionneur[i].loco:=false; Tablo_actionneur[i].act:=false; Tablo_actionneur[i].son:=false; @@ -1737,7 +1752,7 @@ begin i:=pos('MEM[',sOrigine); if i>0 then begin - Tablo_actionneur[maxtablo_act].typdeclenche:=1; // type mémoire de zone + Tablo_actionneur[maxtablo_act].typdeclenche:=3; // type mémoire de zone Delete(sa,1,4); val(sa,j,erreur); Tablo_actionneur[maxtablo_act].adresse:=j; @@ -1745,7 +1760,6 @@ begin val(sa,j,erreur); i:=pos(',',sa); Tablo_actionneur[maxtablo_act].adresse2:=j; - Tablo_actionneur[maxTablo_act].det:=true; delete(sa,1,i); s:=sa; // mémo s end; @@ -1757,8 +1771,6 @@ begin Tablo_actionneur[maxtablo_act].typdeclenche:=0; // type actionneur val(sa,j,erreur); Tablo_actionneur[maxtablo_act].adresse:=j; - if erreur<>0 then Tablo_actionneur[maxTablo_act].det:=sa[erreur]='Z' - else Affiche('Erreur actionneur '+sOrigine,clred); delete(sa,1,erreur); s:=sa; end; @@ -1932,7 +1944,7 @@ begin i:=pos(')',s);Delete(S,1,i); i:=pos(',',s);Delete(S,1,i); Tablo_PN[NbrePN].compteur:=0; - until (copy(s,1,2)='PN') or (NbreVoies=4); + until (copy(s,1,2)='PN') or (NbreVoies=5); Tablo_PN[NbrePN].NbVoies:=NbreVoies; Delete(s,1,3); // Supprime PN( @@ -3282,7 +3294,7 @@ begin RadioButton2.checked:=false; if Valeur_entete=0 then RadioButton1.checked:=true; if Valeur_entete=1 then RadioButton2.checked:=true; - LabelInfo.Width:=253;LabelInfo.Height:=25; + LabelInfo.Width:=240;LabelInfo.Height:=25; LabelResult.width:=137;LabelResult.Height:=25; LabelNomSon.top:=16;LabelNomSon.Left:=48; SpeedButtonJoue.Top:=60; SpeedButtonCharger.Top:=60; @@ -4096,7 +4108,6 @@ end; Procedure aff_champs_act(i : integer); var etatact, adresse,sortie,fonction,tempo,access,typ : integer; s,s2,adr : string; - det : boolean; begin if affevt then affiche('Aff_champs_act('+intToSTR(i)+')',clyellow); if i<1 then exit; @@ -4105,7 +4116,6 @@ begin fonction:=Tablo_actionneur[i].fonction; Access:=Tablo_actionneur[i].accessoire; - det:=Tablo_actionneur[i].det; typ:=Tablo_actionneur[i].typdeclenche; // déclencheurs @@ -4116,7 +4126,7 @@ begin begin champs_decl_actdet; end; - 1 : + 3 : begin champs_decl_zones; end; @@ -4127,7 +4137,8 @@ begin end; end; - if det then s2:='Détecteur ' else s2:='Actionneur '; + //if det then s2:='Détecteur ' else s2:='Actionneur '; + s2:='Détecteur ou actionneur '; s2:=s2+intToSTR(Tablo_actionneur[i].adresse); FormConfig.EditAct.Hint:=s2; @@ -4147,7 +4158,7 @@ begin with formconfig do begin champs_type_loco; - adr:=IntToSTR(Adresse); if det then adr:=adr+'Z'; + adr:=IntToSTR(Adresse); //if det then adr:=adr+'Z'; EditAct.text:=adr; EditAct2.Text:=inttostr(Tablo_actionneur[i].adresse2); editEtatActionneur.Text:=IntToSTR(etatAct); @@ -4187,7 +4198,7 @@ begin tempo:=tablo_actionneur[i].Tempo; with formconfig do begin - adr:=IntToSTR(Adresse); if det then adr:=adr+'Z'; + adr:=IntToSTR(Adresse); //if det then adr:=adr+'Z'; EditAct.text:=adr; EditAct2.Text:=inttostr(Tablo_actionneur[i].adresse2); CheckRaz.Checked:=Tablo_actionneur[i].Raz; @@ -4225,7 +4236,7 @@ begin s:=Tablo_actionneur[i].FichierSon; with formconfig do begin - adr:=IntToSTR(Adresse); if det then adr:=adr+'Z'; + adr:=IntToSTR(Adresse); //if det then adr:=adr+'Z'; EditAct.text:=adr; EditAct2.Text:=inttostr(Tablo_actionneur[i].adresse2); //CheckRaz.Checked:=Tablo_actionneur[i].Raz; @@ -4246,10 +4257,12 @@ begin editV2F.Text:='';editV2O.Text:=''; editV3F.Text:='';editV3O.Text:=''; editV4F.Text:='';editV4O.Text:=''; + editV5F.Text:='';editV5O.Text:=''; EditZdet1V1F.text:='';EditZdet2V1F.text:='';EditZdet1V1O.text:='';EditZdet2V1O.text:=''; EditZdet1V2F.text:='';EditZdet2V2F.text:='';EditZdet1V2O.text:='';EditZdet2V2O.text:=''; EditZdet1V3F.text:='';EditZdet2V3F.text:='';EditZdet1V3O.text:='';EditZdet2V3O.text:=''; EditZdet1V4F.text:='';EditZdet2V4F.text:='';EditZdet1V4O.text:='';EditZdet2V4O.text:=''; + EditZdet1V5F.text:='';EditZdet2V5F.text:='';EditZdet1V5O.text:='';EditZdet2V5O.text:=''; end; end; @@ -4315,12 +4328,18 @@ 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 v:=Tablo_PN[i].nbvoies; - j:=Tablo_PN[i].voie[1].detZ1F;if j<>0 then + 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); @@ -4339,7 +4358,7 @@ begin 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; + end; if v>=4 then begin EditZdet1V4F.text:=intToSTR(Tablo_PN[i].voie[4].detZ1F); @@ -4347,6 +4366,14 @@ begin 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; @@ -5294,7 +5321,6 @@ begin end else LabelInfo.caption:=' '; tablo_actionneur[ligneClicAct+1].adresse:=act; - tablo_actionneur[ligneClicAct+1].det:=det; s:=encode_act_loc_son(ligneClicAct+1); RichAct.Lines[ligneClicAct]:=s; end; @@ -5324,7 +5350,6 @@ begin end else LabelInfo.caption:=' '; tablo_actionneur[ligneClicAct+1].adresse2:=det2; - tablo_actionneur[ligneClicAct+1].det:=det; s:=encode_act_loc_son(ligneClicAct+1); RichAct.Lines[ligneClicAct]:=s; end; @@ -5379,7 +5404,7 @@ begin begin Val(s,etat,erreur); typ:=tablo_actionneur[ligneClicAct+1].typdeclenche; - if (erreur<>0) or (etat<0) or ((typ<2) and (etat>1)) or ((typ=2) and (etat>2)) then + if (erreur<>0) or (etat<0) or ((typ<3) and (etat>1)) or ((typ=2) and (etat>2)) then begin if typ<2 then begin LabelInfo.caption:='Erreur état actionneur';exit;end; if typ=2 then begin LabelInfo.caption:='Erreur position aiguillage';exit;end; @@ -5391,7 +5416,7 @@ begin end; end; end; - + procedure TFormConfig.EditTrainDeclChange(Sender: TObject); var s,train : string; begin @@ -6475,9 +6500,9 @@ begin if Application.MessageBox(pchar(s),pchar('confirm'), MB_YESNO or MB_DEFBUTTON2 or MB_ICONQUESTION)=idNo then exit; - FormConfig.ButtonInsFeu.Caption:='Ajouter le feu '+intToSTR(feux[index].adresse)+' supprimé'; + FormConfig.ButtonInsFeu.Caption:='Ajouter le signal '+intToSTR(feux[ligneDeb].adresse)+' supprimé'; clicliste:=true; - Feu_supprime:=feux[index]; // sauvegarde le supprimé + Feu_supprime:=feux[lignedeb]; // sauvegarde le supprimé feu_sauve.adresse:=0; // dévalider sa définition index:=ligneDeb; @@ -7573,10 +7598,10 @@ begin if Application.MessageBox(pchar(s),pchar('confirm'), MB_YESNO or MB_DEFBUTTON2 or MB_ICONQUESTION)=idNo then exit; - FormConfig.ButtonAjSup.Caption:='Ajouter l''aig '+intToSTR(aiguillage[index].adresse)+' supprimé'; + FormConfig.ButtonAjSup.Caption:='Ajouter l''aig '+intToSTR(aiguillage[lignedeb].adresse)+' supprimé'; clicliste:=true; raz_champs_aig; - Aig_supprime:=aiguillage[index]; // sauvegarde le supprimé + Aig_supprime:=aiguillage[lignedeb]; // sauvegarde le supprimé Aig_sauve.adresse:=0; // dévalider sa définition index:=ligneDeb; @@ -8494,7 +8519,7 @@ begin if affevt then affiche('Evt EditV4O Change',clyellow); if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAct then with Formconfig do - begin + begin s:=EditV4O.Text; Val(s,act,erreur); if (erreur<>0) and (s<>'') then @@ -8512,6 +8537,61 @@ begin end; end; +procedure TFormConfig.EditV5FChange(Sender: TObject); +var s : string; + i,act,erreur,NbVoies : integer; + V5valide : boolean; + begin + if clicliste then exit; + if affevt then affiche('Evt EditV5F Change',clyellow); + if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAct then + with Formconfig do + begin + s:=EditV5F.Text; + Val(s,act,erreur); + if (erreur<>0) and (s<>'') then + begin + LabelInfo.caption:='Erreur adresse actionneur voie 4 ferme';exit + end else LabelInfo.caption:=' '; + i:=lignecliqueePN+1; + tablo_PN[i].voie[5].ActFerme:=act; + V5valide:=(EditV4O.text<>'') and (EditV5F.text<>''); + NbVoies:=tablo_PN[i].NbVoies; + if V5Valide and (NbVoies<=4) then tablo_PN[i].NbVoies:=5; + if not(V5Valide) then tablo_PN[i].NbVoies:=4; + s:=encode_act_PN(i); + RichPN.Lines[lignecliqueePN]:=s; + end; +end; + +procedure TFormConfig.EditV5OChange(Sender: TObject); + var s : string; + i,act,erreur,NbVoies : integer; + V5valide : boolean; +begin + if clicliste or (lignecliqueePN<0) then exit; + if affevt then affiche('Evt EditV5O Change',clyellow); + if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAct then + with Formconfig do + begin + s:=EditV5O.Text; + Val(s,act,erreur); + if (erreur<>0) and (s<>'') then + begin + LabelInfo.caption:='Erreur adresse actionneur voie 4 ouvre';exit + end else LabelInfo.caption:=' '; + i:=lignecliqueePN+1; + tablo_PN[i].voie[5].ActOuvre:=act; + V5valide:=(EditV4O.text<>'') and (EditV5F.text<>''); + NbVoies:=tablo_PN[i].NbVoies; + if V5Valide and (NbVoies<=4) then tablo_PN[i].NbVoies:=5; + if not(V5Valide) then tablo_PN[i].NbVoies:=4; + s:=encode_act_PN(i); + RichPN.Lines[lignecliqueePN]:=s; + end; + +end; + procedure TFormConfig.EditLChange(Sender: TObject); var s : string; i, erreur :integer; @@ -8674,7 +8754,7 @@ begin if clicListe then exit; i:=ligneClicAct+1; if AffEvt then Affiche('RadioBoutonZones '+IntToSTR(i),clyellow); - Tablo_Actionneur[i].typdeclenche:=1; + Tablo_Actionneur[i].typdeclenche:=3; LabelActionneur.Caption:='Mémoire de Zone'; EditTrainDecl.Visible:=false; LabelTrain.Visible:=false; @@ -9253,7 +9333,7 @@ begin end; procedure TFormConfig.EditZdet1V4FChange(Sender: TObject); - var s : string; +var s : string; act,erreur,NbVoies,i : integer; V2valide : boolean; begin @@ -9261,7 +9341,7 @@ begin if affevt then affiche('Evt EditZdet1V4F Change',clyellow); if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAct then with Formconfig do - begin + begin s:=EditZdet1V4F.Text; Val(s,act,erreur); if (erreur<>0) and (s<>'') then @@ -9279,31 +9359,60 @@ begin end; end; -procedure TFormConfig.EditZdet2V4FChange(Sender: TObject); -var s : string; + +procedure TFormConfig.EditZdet1V5FChange(Sender: TObject); + var s : string; act,erreur,NbVoies,i : integer; V2valide : boolean; begin if clicliste then exit; - if affevt then affiche('Evt EditZdet2V4F Change',clyellow); + if affevt then affiche('Evt EditZdet1V5F Change',clyellow); if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAct then with Formconfig do - begin - s:=EditZdet2V4F.Text; + begin + s:=EditZdet1V5F.Text; Val(s,act,erreur); if (erreur<>0) and (s<>'') then begin - LabelInfo.caption:='Erreur adresse détecteur voie 4 ferme';exit + LabelInfo.caption:='Erreur adresse détecteur voie 5 ferme';exit end else LabelInfo.caption:=' '; i:=lignecliqueePN+1; - tablo_PN[i].voie[4].detZ2F:=act; - V2valide:=(EditZdet2V4F.text<>''); + tablo_PN[i].voie[5].detZ1F:=act; + V2valide:=(EditZdet1V5F.text<>''); NbVoies:=tablo_PN[i].NbVoies; - if V2Valide and (NbVoies=3) then tablo_PN[i].NbVoies:=4; - if not(V2Valide) then tablo_PN[i].NbVoies:=3; + if V2Valide and (NbVoies=4) then tablo_PN[i].NbVoies:=5; + if not(V2Valide) then tablo_PN[i].NbVoies:=4; s:=encode_act_PN(i); RichPN.Lines[lignecliqueePN]:=s; - end; + end; +end; + +procedure TFormConfig.EditZdet2V5FChange(Sender: TObject); +var s : string; + act,erreur,NbVoies,i : integer; + V2valide : boolean; +begin + if clicliste then exit; + if affevt then affiche('Evt EditZdet2V5F Change',clyellow); + if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAct then + with Formconfig do + begin + s:=EditZdet2V5F.Text; + Val(s,act,erreur); + if (erreur<>0) and (s<>'') then + begin + LabelInfo.caption:='Erreur adresse détecteur voie 5 ferme';exit + end else LabelInfo.caption:=' '; + i:=lignecliqueePN+1; + tablo_PN[i].voie[5].detZ2F:=act; + V2valide:=(EditZdet2V5F.text<>''); + NbVoies:=tablo_PN[i].NbVoies; + if V2Valide and (NbVoies=4) then tablo_PN[i].NbVoies:=5; + if not(V2Valide) then tablo_PN[i].NbVoies:=4; + s:=encode_act_PN(i); + RichPN.Lines[lignecliqueePN]:=s; + end; + end; procedure TFormConfig.EditZdet1V4OChange(Sender: TObject); @@ -9315,7 +9424,7 @@ begin if affevt then affiche('Evt EditZdet1V4O Change',clyellow); if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAct then with Formconfig do - begin + begin s:=EditZdet1V4O.Text; Val(s,act,erreur); if (erreur<>0) and (s<>'') then @@ -9331,11 +9440,38 @@ begin s:=encode_act_PN(i); RichPN.Lines[lignecliqueePN]:=s; end; +end; +procedure TFormConfig.EditZdet1V5OChange(Sender: TObject); +var s : string; + act,erreur,NbVoies,i : integer; + V2valide : boolean; +begin + if clicliste then exit; + if affevt then affiche('Evt EditZdet1V5O Change',clyellow); + if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAct then + with Formconfig do + begin + s:=EditZdet1V5O.Text; + Val(s,act,erreur); + if (erreur<>0) and (s<>'') then + begin + LabelInfo.caption:='Erreur adresse détecteur voie 5 ouvre';exit + end else LabelInfo.caption:=' '; + i:=lignecliqueePN+1; + tablo_PN[i].voie[5].detZ1O:=act; + V2valide:=(EditZdet1V5O.text<>''); + NbVoies:=tablo_PN[i].NbVoies; + if V2Valide and (NbVoies=4) then tablo_PN[i].NbVoies:=5; + if not(V2Valide) then tablo_PN[i].NbVoies:=4; + s:=encode_act_PN(i); + RichPN.Lines[lignecliqueePN]:=s; + end; + end; procedure TFormConfig.EditZdet2V4OChange(Sender: TObject); - var s : string; +var s : string; act,erreur,NbVoies,i : integer; V2valide : boolean; begin @@ -9343,12 +9479,12 @@ begin if affevt then affiche('Evt EditZdet2V4O Change',clyellow); if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAct then with Formconfig do - begin + begin s:=EditZdet2V4O.Text; Val(s,act,erreur); if (erreur<>0) and (s<>'') then begin - LabelInfo.caption:='Erreur adresse détecteur voie 3 ouvre';exit + LabelInfo.caption:='Erreur adresse détecteur voie 4 ouvre';exit end else LabelInfo.caption:=' '; i:=lignecliqueePN+1; tablo_PN[i].voie[4].detZ2O:=act; @@ -9361,6 +9497,33 @@ begin end; end; +procedure TFormConfig.EditZdet2V5OChange(Sender: TObject); +var s : string; + act,erreur,NbVoies,i : integer; + V2valide : boolean; +begin + if clicliste then exit; + if affevt then affiche('Evt EditZdet2V5O Change',clyellow); + if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAct then + with Formconfig do + begin + s:=EditZdet2V5O.Text; + Val(s,act,erreur); + if (erreur<>0) and (s<>'') then + begin + LabelInfo.caption:='Erreur adresse détecteur voie 5 ouvre';exit + end else LabelInfo.caption:=' '; + i:=lignecliqueePN+1; + tablo_PN[i].voie[5].detZ2O:=act; + V2valide:=(EditZdet2V5O.text<>''); + NbVoies:=tablo_PN[i].NbVoies; + if V2Valide and (NbVoies=4) then tablo_PN[i].NbVoies:=5; + if not(V2Valide) then tablo_PN[i].NbVoies:=4; + s:=encode_act_PN(i); + RichPN.Lines[lignecliqueePN]:=s; + end; +end; + procedure TFormConfig.Button1Click(Sender: TObject); var adr,cmd,erreur : integer; ts : Taccessoire; @@ -9899,6 +10062,40 @@ begin clicListe:=false; end; +procedure TFormConfig.ButtonPFCDMClick(Sender: TObject); + var i : integer; + s : string; + r : boolean; +begin + i:=verifie_regle; + if i=0 then + begin + r:=cree_regle; + if r then + begin + s:='La règle d''autorisation CDM rail a été ajoutée dans le pare-feu '; + Affiche(s,clyellow); + i:=verifie_regle; + end; + end; + + if i=0 then s:='La règle d''autorisation CDM rail n''a pas été trouvée dans le pare-feu '; + if i=1 then s:='La règle d''autorisation CDM rail a été trouvée dans le pare-feu mais elle est désactivée'; + if i=2 then s:='La règle d''autorisation CDM rail a été trouvée dans le pare-feu et elle est activée'; + Affiche(s,clyellow); + formconfig.Labelinfo.caption:=s; + activecontrol:=nil; +end; + + + + + + + + + + end. diff --git a/UnitConfigCellTCO.dcu b/UnitConfigCellTCO.dcu index 8c1e0d5..c1a242f 100644 Binary files a/UnitConfigCellTCO.dcu and b/UnitConfigCellTCO.dcu differ diff --git a/UnitConfigCellTCO.dfm b/UnitConfigCellTCO.dfm index b1451f3..8136e93 100644 --- a/UnitConfigCellTCO.dfm +++ b/UnitConfigCellTCO.dfm @@ -141,7 +141,7 @@ object FormConfCellTCO: TFormConfCellTCO ParentShowHint = False ShowHint = True TabOrder = 0 - OnKeyPress = EditTypeImageKeyPress + OnChange = EditTypeImageChange end object GroupBox3: TGroupBox Left = 8 @@ -255,7 +255,7 @@ object FormConfCellTCO: TFormConfCellTCO ParentShowHint = False ShowHint = True TabOrder = 3 - OnKeyPress = EditAdrElementKeyPress + OnChange = EditAdrElementChange end object ButtonFond: TButton Left = 16 diff --git a/UnitConfigCellTCO.pas b/UnitConfigCellTCO.pas index f5cee6d..8e01d19 100644 --- a/UnitConfigCellTCO.pas +++ b/UnitConfigCellTCO.pas @@ -30,7 +30,6 @@ type EditAdrElement: TEdit; ButtonFond: TButton; BitBtnOk: TBitBtn; - procedure EditTypeImageKeyPress(Sender: TObject; var Key: Char); procedure EditAdrElementChange(Sender: TObject); procedure EditTexteCCTCOChange(Sender: TObject); procedure ButtonFonteClick(Sender: TObject); @@ -42,11 +41,11 @@ type procedure RadioButtonHDClick(Sender: TObject); procedure RadioButtonGClick(Sender: TObject); procedure RadioButtonDClick(Sender: TObject); - procedure EditAdrElementKeyPress(Sender: TObject; var Key: Char); procedure ButtonFondClick(Sender: TObject); procedure FormActivate(Sender: TObject); procedure FormKeyPress(Sender: TObject; var Key: Char); procedure BitBtnOkClick(Sender: TObject); + procedure EditTypeImageChange(Sender: TObject); private { Déclarations privées } public @@ -66,6 +65,7 @@ uses UnitPrinc; {$R *.dfm} +// actualise le contenu de la fenetre procedure actualise; var Bimage : integer; oriente,piedFeu : integer; @@ -122,6 +122,8 @@ begin 21: Assign(FormTCO.ImagePalette21.Picture); 22: Assign(FormTCO.ImagePalette22.Picture); 23,31: Assign(FormTCO.ImagePalette31.Picture); + 24: Assign(FormTCO.ImagePalette24.Picture); + 25: Assign(FormTCO.ImagePalette25.Picture); 30: begin With formConfCellTCO.ImagePalette do begin @@ -185,9 +187,14 @@ begin RadioButtonD.Enabled:=false; end; end; - end; + // aiguillage + if ((BImage=2) or (BImage=3) or (BImage=4) or (BImage=5) or (BImage=12) or (BImage=13) or (BImage=14) or + (BImage=15) or (BImage=21) or (BImage=22) or (BImage=24) or (BImage=25)) then + formConfCellTCO.checkPinv.Enabled:=true + else formConfCellTCO.checkPinv.Enabled:=false; + with formConfCellTCO do begin EditTexteCCTCO.Text:=Tco[XClicCell,YClicCell].Texte; @@ -198,35 +205,11 @@ begin end; - -procedure TFormConfCellTCO.EditTypeImageKeyPress(Sender: TObject; var Key: Char); -var Bimage,erreur : integer; -begin - if ord(Key)=VK_RETURN then - begin - Key:=#0; // évite beeping - Val(EditTypeImage.Text,Bimage,erreur); - //Affiche('Keypressed / Bimage='+IntToSTR(bimage),clyellow); - if (erreur<>0) or not(Bimage in[0..23,30,31]) then - begin - EditTypeImage.text:=intToSTR(tco[XClicCell,YClicCell].BImage); - exit; - end; - TCO_modifie:=true; - tco[XClicCell,YClicCell].Bimage:=Bimage; - - if not(selectionaffichee) then efface_entoure; - affiche_cellule(XClicCell,YClicCell); - formTCO.editTypeImage.Text:=editTypeImage.Text; - actualise; - if not(selectionaffichee) then _entoure_cell_clic; - end; -end; - procedure TFormConfCellTCO.EditAdrElementChange(Sender: TObject); var Adr,erreur,index : integer; begin - //Affiche('Chgt adresse',clyellow); + if clicTCO or not(formConfCellTCOAff) or actualize then exit; + if affevt then Affiche('TFormConfCellTCO.EditAdrElementChange',clyellow); Val(EditAdrElement.Text,Adr,erreur); if (erreur<>0) or (Adr<0) or (Adr>2048) then Adr:=0; @@ -234,6 +217,8 @@ begin if Adr=0 then tco[XClicCell,YClicCell].repr:=2; tco[XClicCell,YClicCell].Adresse:=Adr; + formTCO.EditAdrElement.Text:=intToSTR(adr); + if tco[XClicCell,YClicCell].BImage=30 then begin @@ -253,6 +238,7 @@ end; procedure TFormConfCellTCO.EditTexteCCTCOChange(Sender: TObject); begin + if clicTCO or not(formConfCellTCOAff) or actualize then exit; PCanvasTCO.Brush.Color:=clfond; if Tco[XClicCell,YClicCell].texte='' then @@ -278,6 +264,7 @@ var i,x,y : integer; image,imagesrc : Timage; begin // fenetre toujours dessus + if affevt then Affiche('FormConfCellTCO create',clyellow); actualize:=false; formConfCellTCOAff:=true; SetWindowPos(Handle,HWND_TOPMOST,0,0,0,0,SWP_NoMove or SWP_NoSize); @@ -340,6 +327,7 @@ end; procedure TFormConfCellTCO.ComboReprChange(Sender: TObject); begin + if clicTCO or not(formConfCellTCOAff) or actualize then exit; tco[XClicCell,YClicCell].Repr:=comborepr.ItemIndex; efface_entoure;SelectionAffichee:=false; sourisclic:=false; @@ -353,12 +341,14 @@ var Bimage : integer; begin if (xClicCell=0) or (xClicCell>NbreCellX) or (yClicCell=0) or (yClicCell>NbreCelly) then exit; Bimage:=Tco[xClicCell,yClicCell].Bimage; - if (bimage=2) or (bimage=3) or (bimage=4) or (bimage=5) or (bimage=12) or (bimage=13) - or (bimage=14) or (bimage=15) or (bimage=24) then - begin + if (bimage=2) or (bimage=3) or (bimage=4) or (bimage=5) or (bimage=12) or (bimage=13) or + (bimage=14) or (bimage=15) or (bimage=24) + then + begin TCO[xClicCell,yClicCell].inverse:=CheckPinv.checked; + formTCO.CheckPinv.checked:=CheckPinv.checked; TCO_modifie:=true; - end; + end; end; procedure TFormConfCellTCO.RadioButtonVClick(Sender: TObject); @@ -386,31 +376,6 @@ begin signalD; end; - -procedure TFormConfCellTCO.EditAdrElementKeyPress(Sender: TObject; var Key: Char); -var Adr,erreur : integer; -begin - if ord(Key)=VK_RETURN then - begin - Key:=#0; // évite beeping - Val(EditAdrElement.Text,Adr,erreur); - //Affiche('Keypressed / Bimage='+IntToSTR(bimage),clyellow); - if (erreur<>0) then - begin - EditAdrElement.text:=intToSTR(tco[XClicCell,YClicCell].Adresse); - exit; - end; - TCO_modifie:=true; - tco[XClicCell,YClicCell].Adresse:=Adr; - - if not(selectionaffichee) then efface_entoure; - affiche_cellule(XClicCell,YClicCell); - formTCO.EditAdrElement.Text:=EditAdrElement.Text; - actualise; - if not(selectionaffichee) then _entoure_cell_clic; - end; -end; - procedure TFormConfCellTCO.ButtonFondClick(Sender: TObject); begin change_couleur_fond; @@ -418,6 +383,7 @@ end; procedure TFormConfCellTCO.FormActivate(Sender: TObject); begin + if affevt then Affiche('FormConfCellTCO activate',clyellow); if selectionaffichee then ButtonFond.caption:='Couleur de fond de la sélection' else ButtonFond.caption:='Couleur de fond de la cellule'; end; @@ -432,4 +398,23 @@ begin close end; +procedure TFormConfCellTCO.EditTypeImageChange(Sender: TObject); +var Bimage,erreur : integer; +begin + if clicTCO or not(formConfCellTCOAff) or actualize then exit; + if affevt then Affiche('TCO evt editTypeImageKeyPress',clorange); + Val(EditTypeImage.Text,Bimage,erreur); + if (erreur<>0) or not(Bimage in[0..22,24..25,30,31]) then + begin + exit; + end; + TCO_modifie:=true; + tco[XClicCell,YClicCell].Bimage:=Bimage; + FormTCO.EditTypeImage.text:=intToSTR(BImage); + actualise; // pour mise à jour de l'image de la fenetre FormConfCellTCO + efface_entoure; + affiche_cellule(XClicCell,YClicCell); + +end; + end. diff --git a/UnitConfigTCO.dcu b/UnitConfigTCO.dcu index ff295d0..351b065 100644 Binary files a/UnitConfigTCO.dcu and b/UnitConfigTCO.dcu differ diff --git a/UnitPareFeu.dcu b/UnitPareFeu.dcu new file mode 100644 index 0000000..9421f32 Binary files /dev/null and b/UnitPareFeu.dcu differ diff --git a/UnitPareFeu.pas b/UnitPareFeu.pas new file mode 100644 index 0000000..5e3b276 --- /dev/null +++ b/UnitPareFeu.pas @@ -0,0 +1,185 @@ +unit UnitPareFeu; + +interface +function verifie_regle : integer; +function cree_regle : boolean; + +implementation + +uses + SysUtils,ActiveX,ComObj,Variants,UnitPrinc,Graphics,unitConfig; +Const + NET_FW_ACTION_ALLOW = 1; + NET_FW_IP_PROTOCOL_TCP = 6; + NET_FW_IP_PROTOCOL_UDP = 17; + NET_FW_IP_PROTOCOL_ANY = 256; + net_fw_profile2_private=2; + net_fw_profile2_public=4; + net_fw_rule_dir_out=2; + net_fw_rule_dir_in=1; + NET_FW_MODIFY_STATE_OK = 0; + NET_FW_MODIFY_STATE_GP_OVERRIDE = 1; + NET_FW_MODIFY_STATE_INBOUND_BLOCKED = 2; + nom_regle_cdm='CDM rail'; + +// Ajoute une règle à un programme en utilisant Microsoft Windows Firewall APIs. +function AddApplicationRule : boolean; +var + CurrentProfiles,fwPolicy2,RulesObject,NewRule : OleVariant; + s,fichier : string; + r : boolean; +begin + r:=false; + if IsWow64Process then fichier:='C:\Program Files (x86)\CDM-Rail\cdr.exe' else fichier:='C:\Program Files\CDM-Rail\cdr.exe'; + // Crée l'objet FwPolicy2 + fwPolicy2:=CreateOleObject('HNetCfg.FwPolicy2'); + RulesObject:=fwPolicy2.Rules; + CurrentProfiles:= fwPolicy2.CurrentProfileTypes; + //CurrentProfiles:=net_fw_profile2_private or net_fw_profile2_public; + + //Crée l'objet de la règle. + NewRule:=CreateOleObject('HNetCfg.FWRule'); + + NewRule.Name:=nom_regle_cdm; + NewRule.Description:='Autorise le socket de/vers CDM rail'; + + NewRule.Applicationname:=fichier; + NewRule.Protocol:=NET_FW_IP_PROTOCOL_TCP; + //NewRule.LocalPorts := '9999'; // '80,443,4520-4533' sans spécif=tous ports + NewRule.Direction:=net_fw_rule_dir_in; + NewRule.Enabled:=True; + NewRule.Grouping:=''; + NewRule.Profiles:=CurrentProfiles; + NewRule.Action:=NET_FW_ACTION_ALLOW; + + //Ajouter une règle + try + RulesObject.Add(NewRule); + r:=true; + except + begin + s:='Erreur: impossible d''accéder au pare feu windows. Le pare feu est géré par un programme tiers.'; + Affiche(s,clred); + formconfig.Labelinfo.caption:=s; + r:=false; + end; + end; + result:=r; +end; + +function cree_regle : boolean; +var CoResult : Hresult; + s : string; + r : boolean; +begin + r:=false; + try + CoResult:=CoInitializeEx(nil,COINIT_MULTITHREADED); + try + r:=AddApplicationRule; + finally + begin + CoUninitialize; + if r then + begin + s:='Ajout de la règle '+nom_regle_cdm+' dans le pare-feu'; + formconfig.Labelinfo.caption:=s; + Affiche(s,clyellow); + end; + end; + end; + except + on E:EOleException do + begin + Affiche('EOleException '+E.Message+intToSTR(E.ErrorCode),clred); + r:=false; + end; + on E:Exception do + begin + Affiche(E.Classname+':'+E.Message,clred); + r:=false; + end; + end; + result:=r; +end; + + +// vérifie si la règle cdm est dans le parefeu windows +// retour =0 : pas dans le pare feu +// =1 oui mais inactive +// =2 oui et active +function CheckingRuleEnabled : integer; +var + fwPolicy2,RulesObject,rule : OleVariant; + PolicyModifyState,CurrentProfiles : Integer; + bIsEnabled,trouve : Boolean; + oEnum : IEnumvariant; + iValue : LongWord; + s : string; +begin + fwPolicy2:= CreateOleObject('HNetCfg.FwPolicy2'); + RulesObject:=fwPolicy2.Rules; + CurrentProfiles:=fwPolicy2.CurrentProfileTypes; + trouve:=false ; + oEnum:=IUnknown(Rulesobject._NewEnum) as IEnumVariant; + while (oEnum.Next(1,rule,iValue)=0) and not(trouve) do + begin + if (rule.Profiles And CurrentProfiles)<>0 then + begin + s:=rule.Name; + trouve:=s=nom_regle_cdm; + if trouve then + begin + Affiche('Description de l''autorisation socket pour CDM rail dans le pare-feu Windows',clyellow); + Affiche('Nom : ' + s,clLime); + Affiche('Description : ' + rule.Description,clLime); + Affiche('Nom d''application: ' + rule.ApplicationName,clLime); + Affiche('Nom du service: ' + rule.ServiceName,clLime); + bIsEnabled:=rule.enabled; + if bisEnabled then affiche('Activée',clLime) else affiche('désactivée',clLime) ; + if (rule.Protocol=NET_FW_IP_PROTOCOL_TCP) or (rule.Protocol=NET_FW_IP_PROTOCOL_UDP) then + begin + if (rule.Protocol=NET_FW_IP_PROTOCOL_TCP) then Affiche('Protocole : TCP',clLime); + if (rule.Protocol=NET_FW_IP_PROTOCOL_UDP) then Affiche('Protocole : UDP',clLime); + Affiche('Ports locaux : ' + rule.LocalPorts,clLime); + Affiche('Ports distants : ' + rule.RemotePorts,clLime); + Affiche('Adresses locales : ' + rule.LocalAddresses,clLime); + Affiche('Adresses distantes : ' + rule.RemoteAddresses,clLime); + end; + end; + end; + end; + if not(trouve) then + begin + result:=0; + end + else + begin + if bIsEnabled then result:=2 else result:=1; + end; +end; + +function verifie_regle : integer; +var i : integer; +begin + i:=0; + try + CoInitialize(nil); + try + i:=CheckingRuleEnabled; + finally + CoUninitialize; + end; + except + on E:EOleException do + Affiche('EOleException '+E.Message+intToSTR(E.ErrorCode),clred); + on E:Exception do + Affiche(E.Classname+':'+E.Message,clred); + end; + result:=i; +end; + + +begin +end. + diff --git a/UnitPrinc.dcu b/UnitPrinc.dcu index ee97e07..f710e55 100644 Binary files a/UnitPrinc.dcu and b/UnitPrinc.dcu differ diff --git a/UnitPrinc.pas b/UnitPrinc.pas index c4fcce5..f59b792 100644 --- a/UnitPrinc.pas +++ b/UnitPrinc.pas @@ -14,6 +14,9 @@ Unit UnitPrinc; - 1 = aiguillage dévié = sortie 1 de l'adresse d'accessoire vitesse port com lenz=57600 + + ligne de commande en mode administrateur pour valider le socket: + netsh advfirewall firewall add rule name="cdm rail" dir=in action=allow program="C:\Program Files (x86)\CDM-Rail\cdr.exe" enable=yes *) // en mode simulation run: @@ -394,7 +397,7 @@ var Nbre_recu_cdm,Tempo_chgt_feux,Adj1,Adj2,NbrePN,ServeurInterfaceCDM,index_couleur, ServeurRetroCDM,TailleFonte,Nb_Det_Dist,Tdoubleclic,algo_Unisemaf,fA,fB, etape,idEl,avecRoulage,intervalle_courant,filtrageDet0,SauvefiltrageDet0, - TpsTimeoutSL : integer; + TpsTimeoutSL,formatY : integer; ack,portCommOuvert,traceTrames,AffMem,CDM_connecte,dupliqueEvt,affiche_retour_dcc, Raz_Acc_signaux,AvecInit,AvecTCO,terminal,Srvc_Aig,Srvc_Det,Srvc_Act,MasqueBandeauTCO, @@ -477,12 +480,13 @@ var adresse,adresse2, // adresse: adresse de base ; adresse2=cas d'une Zone etat,fonction,tempo,TempoCourante, accessoire,sortie, - typdeclenche : integer; // déclencheur: 0=actioneur 1=MemZone 2=evt aig + typdeclenche : integer; // déclencheur: 0=actioneur/détecteur 2=evt aig 3=MemZone Raz : boolean; - det : boolean; // le déclencheur est un détecteur FichierSon,trainDecl,TrainDest,TrainCourant : string; end; + Ancien_actionneur : array[0..1024] of integer; + KeyInputs: array of TInput; Tablo_PN : array[0..Max_actionneurs] of record @@ -493,7 +497,7 @@ var NbVoies : integer; // Nombre de voies du PN Pulse : integer; // 0=commande maintenue 1=Impulsionnel compteur : integer; // comptage actionneurs fermeture et décomptage actionneurs ouverturef - Voie : array [1..4] of record + Voie : array [1..5] of record ActFerme,ActOuvre : integer ; // actionneurs provoquant la fermeture et l'ouverture detZ1F,detZ2F,detZ1O,detZ2O : integer; // Zones de détection end; @@ -3285,6 +3289,22 @@ begin inverse:=r; end; +// inverse l'ordre des bits dans les deux quartets d'un octet +// ex 0010 1010 devient 0100 0101 +function inverseQuartet(b : byte) : byte; +var r : byte; +begin + r:= ((b and $8) shr 3); // vers bit 0 + r:=r or ((b and $4) shr 1); // vers bit 1 + r:=r or ((b and $2) shl 1); // vers bit 2 + r:=r or ((b and $1) shl 3); // vers bit 3 + r:=r or ((b and $80) shr 3); // vers bit 4 + r:=r or ((b and $40) shr 1); // vers bit 5 + r:=r or ((b and $20) shl 1); // vers bit 6 + r:=r or ((b and $10) shl 3); // vers bit 7 + inverseQuartet:=r; +end; + // envoie les données au décodeur digikeijs 4018 procedure digi_4018(adresse : integer); var @@ -8858,25 +8878,49 @@ end; procedure Event_act(adr,adr2,etat : integer;trainDecl : string); var typ,i,v,va,etatAct,Af,Ao,Access,sortie,dZ1F,dZ2F,dZ1O,dZ2O : integer; s,st,trainDest : string; - presTrain_PN,adresseOk : boolean; + fm,fd,presTrain_PN,adresseOk,etatvalide : boolean; Ts : TAccessoire; begin - // vérifier si l'actionneur en évènement a été déclaré pour réagir - if AffAigDet then AfficheDebug('Tick='+IntToSTR(tick)+' Evt Act '+intToSTR(Adr)+'/'+intToSTR(Adr2)+'='+intToSTR(etat),clyellow); - if adr=0 then exit; + if adr<=0 then exit; //Affiche(intToSTR(adr)+'/'+intToSTR(adr2)+' '+intToSTR(etat),clyellow); + + if adr>1024 then + begin + Affiche('Erreur 81 : reçu adresse actionneur trop grande : '+intToSTR(adr),clred); + exit; + end; + + // Etat actionneur (un état aiguillage peut prendre les valeurs de 1 à 2) + // ancien nouveau + // 0 1 FM + // 0 2 FM + // 1 2 FM + // 2 1 FM + //--------------------- + // 1 0 FD + // 2 0 FD + + fd:=(Ancien_actionneur[adr]>0) and (etat=0); // front descendant + fm:=(Ancien_actionneur[adr]<>etat) and (etat<>0); // front montant + + ancien_actionneur[adr]:=etat; + if not(fd) and not(fm) then exit; + + if AffAigDet then AfficheDebug('Tick='+IntToSTR(tick)+' Evt Act '+intToSTR(Adr)+'/'+intToSTR(Adr2)+'='+intToSTR(etat),clyellow); + + // vérifier si l'actionneur en évènement a été déclaré pour réagir + // dans tableau des actionneurs for i:=1 to maxTablo_act do begin - s:=Tablo_actionneur[i].trainDecl; - etatAct:=Tablo_actionneur[i].etat ; - - typ:=Tablo_actionneur[i].typdeclenche; + etatAct:=Tablo_actionneur[i].etat ; // état à réagir + etatValide:=((etatAct=etat) and fm) or ((etatAct=0) and fd); + typ:=Tablo_actionneur[i].typdeclenche; // déclencheur: 0=actioneur/détecteur 2=evt aig 3=MemZone if typ=0 then begin st:='Détecteur/actionneur '+intToSTR(adr); end; - if typ=1 then + if typ=3 then begin adresseok:=adresseOk and (Tablo_actionneur[i].adresse2=adr2); st:='Mémoire de zone '+intToSTR(adr)+' '+intToStr(adr2); @@ -8890,7 +8934,7 @@ begin ( ((Tablo_actionneur[i].adresse=adr) and (Tablo_actionneur[i].adresse2=adr2) ) and (typ=1) ); // actionneur pour fonction train - if adresseOk and (Tablo_actionneur[i].loco) and ((s=trainDecl) or (s='X') or (trainDecl='X') or (trainDecl='')) and (etatAct=etat) then + if adresseOk and (Tablo_actionneur[i].loco) and ((s=trainDecl) or (s='X') or (trainDecl='X') or (trainDecl='')) and (etatValide) then begin trainDest:=Tablo_actionneur[i].trainDest; // exécution de la fonction F vers CDM @@ -8903,7 +8947,7 @@ begin end; // actionneur pour accessoire - if adresseOk and (Tablo_actionneur[i].act) and ((s=trainDecl) or (s='X') or (trainDecl='X') or (trainDecl='')) and (etatAct=etat) then + if adresseOk and (Tablo_actionneur[i].act) and ((s=trainDecl) or (s='X') or (trainDecl='X') or (trainDecl='')) and (etatValide) then begin access:=Tablo_actionneur[i].accessoire; sortie:=Tablo_actionneur[i].sortie; @@ -8915,7 +8959,7 @@ begin end; // actionneur pour son - if adresseOk and (Tablo_actionneur[i].Son) and ((s=trainDecl) or (s='X') or (trainDecl='X') or (trainDecl='')) and (etatAct=etat) + if adresseOk and (Tablo_actionneur[i].Son) and ((s=trainDecl) or (s='X') or (trainDecl='X') or (trainDecl='')) and (etatValide) then begin if typ<>2 then st:=st+' Train='+trainDecl; @@ -8930,13 +8974,13 @@ begin if Tablo_PN[i].voie[1].actOuvre<>0 then begin // PN par actionneur - if Tablo_PN[i].nbvoies>4 then Tablo_PN[i].nbvoies:=4; + if Tablo_PN[i].nbvoies>5 then Tablo_PN[i].nbvoies:=5; for v:=1 to Tablo_PN[i].nbvoies do begin aF:=Tablo_PN[i].voie[v].actFerme; aO:=Tablo_PN[i].voie[v].actOuvre; - if (aO=adr) and (etat=0) then // actionneur d'ouverture + if (aO=adr) and (fd) then // actionneur d'ouverture sur front descendant begin if tablo_pn[i].compteur=1 then // compteur du nombre de trains sur le PN begin @@ -8947,7 +8991,7 @@ begin if tablo_pn[i].compteur>0 then dec(tablo_pn[i].compteur); end; - if (aF=adr) and (etat=1) then // actionneur de fermeture + if (aF=adr) and (fm) then // actionneur de fermeture sur front montant begin inc(tablo_pn[i].compteur); if tablo_pn[i].compteur=1 then @@ -8964,14 +9008,14 @@ begin begin // PN par zone de détection // Affiche(intToSTR(adr)+'/'+intToSTR(adr2)+' '+intToSTR(etat),clyellow); - if Tablo_PN[i].nbvoies>4 then Tablo_PN[i].nbvoies:=4; + if Tablo_PN[i].nbvoies>5 then Tablo_PN[i].nbvoies:=5; for v:=1 to Tablo_PN[i].nbvoies do begin dZ1F:=Tablo_PN[i].voie[v].detZ1F; dZ2F:=Tablo_PN[i].voie[v].detZ2F; dZ1O:=Tablo_PN[i].voie[v].detZ1O; dZ2O:=Tablo_PN[i].voie[v].detZ2O; - if (dZ1O=adr) and (dZ2O=adr2) and (etat=0) then // zone d'ouverture + if (dZ1O=adr) and (dZ2O=adr2) and (fd) then // zone d'ouverture begin if Tablo_PN[i].compteur=1 then begin @@ -8984,7 +9028,7 @@ begin end; end; - if (dZ1F=adr) and (dZ2F=adr2) and (etat=1) then // zone de fermeture + if (dZ1F=adr) and (dZ2F=adr2) and (fm) then // zone de fermeture begin inc(Tablo_PN[i].compteur); if tablo_pn[i].compteur=1 then @@ -9119,11 +9163,11 @@ begin AdrSuiv:=Feux[i].Adr_el_suiv1; TypeSuiv:=Feux[i].Btype_suiv1; - if AffSignal then AfficheDebug('Pour Feu '+intToSTR(AdrFeu)+' detecteursuivant('+intToSTR(AdrSuiv)+','+BTypeToChaine(typeSuiv)+','+intToSTR(AdrDetFeu)+',1)',clyellow); + if AffSignal then AfficheDebug('Pour signal '+intToSTR(AdrFeu)+' detecteursuivant('+intToSTR(AdrSuiv)+','+BTypeToChaine(typeSuiv)+','+intToSTR(AdrDetFeu)+',1)',clyellow); AdrPrec:=detecteur_suivant(AdrSuiv,typeSuiv,AdrDetFeu,det,1) ; // détecteur précédent le feu, algo 1 if AdrPrec=0 then begin - If traceListe then AfficheDebug('Le feu '+IntToSTR(AdrFeu)+' est précédé d''un buttoir',clyellow); + If traceListe then AfficheDebug('Le signal '+IntToSTR(AdrFeu)+' est précédé d''un buttoir',clyellow); MemZone[0,AdrDetFeu].etat:=true; event_act(0,AdrDetFeu,1,''); // activation zone maj_feu(AdrFeu,false); @@ -9201,63 +9245,64 @@ var s: string; begin if nivDebug=1 then AfficheDebug('Event Aig '+intToSTR(adresse),clorange); index:=index_aig(adresse); - if index=0 then exit; - - // si l'aiguillage est inversé dans CDM et qu'on est en mode autonome ou CDM, inverser sa position - inv:=false; - if (aiguillage[index].inversionCDM=1) and (portCommOuvert or parSocketLenz) then + if index<>0 then begin - prov:=pos; - inv:=true; - if prov=const_droit then pos:=const_devie else pos:=const_droit; - end; - - // ne pas faire l'évaluation si l'ancien état de l'aiguillage est indéterminée (9) - // car le RUN vient de démarrer - faire_event:=aiguillage[index].position<>9; - aiguillage[index].position:=pos; // stockage de la nouvelle position de l'aiguillage - - // ------------- stockage évènement aiguillage dans tampon event_det_tick ------------------------- - if (N_Event_tick>=Max_Event_det_tick) then - begin - N_Event_tick:=0; - Affiche('Raz Evts ',clLime); - end; - - if AffAigDet then - begin - s:='Tick='+IntToSTR(tick)+' Evt Aig '+intToSTR(adresse)+'='+intToSTR(pos); - case pos of - const_droit : s:=s+' droit'; - const_devie : s:=s+' dévié'; - const_inconnu : s:=s+' inconnu'; + // si l'aiguillage est inversé dans CDM et qu'on est en mode autonome ou CDM, inverser sa position + inv:=false; + if (aiguillage[index].inversionCDM=1) and (portCommOuvert or parSocketLenz) then + begin + prov:=pos; + inv:=true; + if prov=const_droit then pos:=const_devie else pos:=const_droit; end; - if inv then s:=s+' INV'; - AfficheDebug(s,clyellow); - FormDebug.MemoEvtDet.lines.add(s) ; + + // ne pas faire l'évaluation si l'ancien état de l'aiguillage est indéterminée (9) + // car le RUN vient de démarrer + faire_event:=aiguillage[index].position<>9; + aiguillage[index].position:=pos; // stockage de la nouvelle position de l'aiguillage + + // ------------- stockage évènement aiguillage dans tampon event_det_tick ------------------------- + if (N_Event_tick>=Max_Event_det_tick) then + begin + N_Event_tick:=0; + Affiche('Raz Evts ',clLime); + end; + + if AffAigDet then + begin + s:='Tick='+IntToSTR(tick)+' Evt Aig '+intToSTR(adresse)+'='+intToSTR(pos); + case pos of + const_droit : s:=s+' droit'; + const_devie : s:=s+' dévié'; + const_inconnu : s:=s+' inconnu'; + end; + if inv then s:=s+' INV'; + AfficheDebug(s,clyellow); + FormDebug.MemoEvtDet.lines.add(s) ; + end; + + + if (n_Event_tick mod 10) =0 then affiche_memoire; + inc(N_Event_tick); + event_det_tick[N_event_tick].tick:=tick; + event_det_tick[N_event_tick].adresse:=adresse; + event_det_tick[N_event_tick].modele:=aig; + event_det_tick[N_event_tick].etat:=pos; + + // Mettre à jour le TCO + if TCOouvert then formTCO.Maj_TCO(Adresse); + + // l'évaluation des routes est à faire selon conditions + if faire_event and not(confignulle) then begin evalue;evalue;end; end; - - if (n_Event_tick mod 10) =0 then affiche_memoire; - inc(N_Event_tick); - event_det_tick[N_event_tick].tick:=tick; - event_det_tick[N_event_tick].adresse:=adresse; - event_det_tick[N_event_tick].modele:=aig; - event_det_tick[N_event_tick].etat:=pos; - - // Mettre à jour le TCO - if TCOouvert then formTCO.Maj_TCO(Adresse); - - // l'évaluation des routes est à faire selon conditions - if faire_event and not(confignulle) then begin evalue;evalue;end; - - // actionneur d'aiguillage + // evt actionneur d'aiguillage for i:=1 to maxTablo_act do begin etatAct:=Tablo_actionneur[i].etat ; adr:=Tablo_actionneur[i].adresse; typ:=Tablo_actionneur[i].typdeclenche; - if (typ=2) and (Adr=adresse) then event_act(Adresse,0,pos,''); + if (typ=2) and (Adr=adresse) then event_act(Adresse,0,pos,''); // évent aig end; end; @@ -9577,6 +9622,7 @@ end; // décodage chaine au protocole DCC (un seul paramètre encadré par < > ) function decode_chaine_retro_dcc(chaineINT : string) : string; var i,j,n,adresse,groupe,rang,valeur,erreur : integer; + b : byte; s : string; begin if length(s)>0 then if chaineINT[1]=#$0D then delete(chaineINT,1,1); @@ -9639,7 +9685,7 @@ begin exit; end; - // détecteur 0 (Q ID) ou réponse à un détecteur si 3 paramètres (Q ID PIN PULLUP) + // détecteur 1 (Q ID) ou réponse à un détecteur si 3 paramètres (Q ID PIN PULLUP) i:=pos('0 then begin @@ -9658,7 +9704,7 @@ begin exit; end; - // détecteur 1 + // détecteur 0 i:=pos('0 then begin @@ -9706,25 +9752,63 @@ begin exit; end; - // y détecteur en hexa + // réponse à la commande + // y détecteurs + // format 0 + // format 3 + // i:=pos('0 then begin delete(chaineINT,1,i+2); - i:=0; - repeat - if chaineINT[1]='0' then valeur:=0 else valeur:=1; - delete(chaineINT,1,1); - Event_detecteur(AdrBaseDetDccpp+i,valeur=1,''); - //affiche(intToSTR(513+i),clyellow); - inc(i); - until (chaineINT[1]='>') or (length(s)=1); + if (formatY=0) or (formatY=-1) then + begin + i:=0; + repeat + if chaineINT[1]='0' then valeur:=0 else valeur:=1; + delete(chaineINT,1,1); + Event_detecteur(AdrBaseDetDccpp+i,valeur=1,''); + //affiche(intToSTR(513+i),clyellow); + inc(i); + until (chaineINT[1]='>') or (length(chaineINT)=1); + end; + + if formatY=1 then + begin + j:=0; + repeat + val('$'+copy(chaineINT,1,2),b,erreur); + delete(chaineINT,1,2); + b:=inverseQuartet(b); + for i:=7 downto 0 do + begin + event_detecteur(AdrBaseDetDccpp+j,testbit(b,i),''); + inc(j); + end; + until length(chaineINT)<=1; + end; + + if formatY=2 then + begin + j:=0; + repeat + val('$'+copy(chaineINT,1,2),b,erreur); + delete(chaineINT,1,2); + for i:=7 downto 0 do + begin + event_detecteur(AdrBaseDetDccpp+j,testbit(b,i),''); + inc(j); + end; + until length(chaineINT)<=1; + end; delete(chaineINT,1,1); result:=chaineINT; + formatY:=-1; exit; end; - // Nok i:=pos('',chaineINT); if i<>0 then @@ -10212,7 +10296,7 @@ begin end; procedure init_dccpp; -var i : integer; +var i,j1,j2,p,n,erreur : integer; s : string; begin if EnvAigDccpp=1 then envoi_aiguillages_DCCpp; // envoi la liste des aiguillages à l'interface DCC++ @@ -10225,6 +10309,14 @@ begin Affiche(s,clLime); affiche_retour_dcc:=true; tps_affiche_retour_dcc:=2; + p:=pos('0 then + begin + j1:=pos(' ',s); + j2:=PosEx(' ',s,j1+1); + val(copy(s,j1+1,1),n,erreur); + val(copy(s,j2+1,length(s)-j2-1),formatY,erreur); + end; envoi(s); sleep(200); end; @@ -10792,12 +10884,11 @@ begin AntiTimeoutEthLenz:=0; Verif_AdrXpressNet:=1; avecRoulage:=0; + formatY:=-1; AvecInit:=true; // &&&& avec initialisation des aiguillages ou pas Diffusion:=AvecInit; // mode diffusion publique - roulage1.visible:=false; - With ScrollBox1 do begin HorzScrollBar.Tracking:=true; @@ -10941,7 +11032,7 @@ begin NbreImagePLigne:=Formprinc.ScrollBox1.Width div (largImg+5); if NbreImagePLigne=0 then NbreImagePLigne:=1; - // ajoute les images des feux dynamiquement + // ajoute les images des signaux dynamiquement for i:=1 to NbreFeux do begin if debug=1 then affiche('Création du signal '+intToSTR(i)+' ----------',clLime); @@ -11059,8 +11150,14 @@ begin // roulage:=true; det_contigu(526,515,i,teq); Affiche(intToSTR(i),clred); } + { formatY:=2; + ‹y 00001010000101000111010000> format 0 + // ‹y 0A0147405801CE..40› format 1 quartets renversés + // ‹y XXXXX......› (hexa pur) format 2 + decode_chaine_retro_dcc(''); } procetape('Terminé !!'); + Maj_feux(false); end; @@ -11187,7 +11284,7 @@ begin end; end; - // feux du TCO + // signaux du TCO if TCOouvert then // évite d'accéder à la variable FormTCO si elle est pas encore ouverte begin // parcourir les feux du TCO @@ -11340,7 +11437,6 @@ begin end; end; end; - end; @@ -12830,7 +12926,7 @@ begin son:=Tablo_actionneur[i].son; typ:=Tablo_actionneur[i].typdeclenche; - if typ=1 then s:='Mem '+intToSTR(adrAct)+' '+inttostr(Tablo_actionneur[i].Adresse2); + if typ=3 then s:='Mem '+intToSTR(adrAct)+' '+inttostr(Tablo_actionneur[i].Adresse2); if typ=0 then s:=intToSTR(adrAct); if typ=2 then s:='Aig '+intToSTR(AdrAct); diff --git a/UnitSR.dcu b/UnitSR.dcu index a564806..00feaba 100644 Binary files a/UnitSR.dcu and b/UnitSR.dcu differ diff --git a/UnitTCO.dcu b/UnitTCO.dcu index 59e6fa1..93fd5b3 100644 Binary files a/UnitTCO.dcu and b/UnitTCO.dcu differ diff --git a/UnitTCO.dfm b/UnitTCO.dfm index 9290fc8..49a161a 100644 --- a/UnitTCO.dfm +++ b/UnitTCO.dfm @@ -1,6 +1,6 @@ object FormTCO: TFormTCO - Left = 217 - Top = 60 + Left = 82 + Top = 129 Width = 1142 Height = 678 VertScrollBar.Visible = False @@ -893,7 +893,6 @@ object FormTCO: TFormTCO ParentFont = False TabOrder = 0 OnChange = EditAdrElementChange - OnKeyDown = EditAdrElementKeyDown end object EditTypeImage: TEdit Left = 144 @@ -907,7 +906,7 @@ object FormTCO: TFormTCO Font.Style = [] ParentFont = False TabOrder = 1 - OnKeyPress = EditTypeImageKeyPress + OnChange = EditTypeImageChange end object ButtonFonte: TButton Left = 8 @@ -1055,6 +1054,10 @@ object FormTCO: TFormTCO object N2: TMenuItem Caption = '-' end + object outslectionner1: TMenuItem + Caption = 'Tout s'#233'lectionner' + OnClick = outslectionner1Click + end object Inserer: TMenuItem Caption = 'Inserer' object LigneDessus: TMenuItem diff --git a/UnitTCO.pas b/UnitTCO.pas index d217fdb..ca1b1b0 100644 --- a/UnitTCO.pas +++ b/UnitTCO.pas @@ -123,6 +123,7 @@ type ImagePalette8: TImage; ImageTemp: TImage; ImageTemp2: TImage; + outslectionner1: TMenuItem; procedure FormCreate(Sender: TObject); procedure FormActivate(Sender: TObject); procedure ImageTCOContextPopup(Sender: TObject; MousePos: TPoint; @@ -169,7 +170,6 @@ type procedure ButtonRedessineClick(Sender: TObject); procedure grille; procedure EditAdrElementChange(Sender: TObject); - procedure EditTypeImageKeyPress(Sender: TObject; var Key: Char); procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Maj_TCO(Adresse : integer); @@ -237,8 +237,6 @@ type Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure ImagePalette22MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - procedure EditAdrElementKeyDown(Sender: TObject; var Key: Word; - Shift: TShiftState); procedure ImageTCODblClick(Sender: TObject); procedure ComboReprChange(Sender: TObject); procedure ImagePalette1DragOver(Sender, Source: TObject; X, Y: Integer; @@ -330,6 +328,8 @@ type State: TDragState; var Accept: Boolean); procedure FormDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean); + procedure EditTypeImageChange(Sender: TObject); + procedure outslectionner1Click(Sender: TObject); private @@ -1635,8 +1635,8 @@ begin r:=Rect(x0,y0,x0+LargeurCell,y0+HauteurCell); FillRect(r); - Adr:=TCO[x,y].adresse; - pen.color:=couleur; + Adr:=TCO[x,y].adresse; + if (Adr<>0) and (detecteur[Adr].etat) then couleur:=clAllume else case mode of @@ -1654,6 +1654,7 @@ begin pen.color:=clvoies; end; Brush.Color:=couleur; + pen.color:=couleur; Pen.Mode:=pmCopy; Pen.Width:=epaisseur; MoveTo(x0+largeurCell,y0);LineTo(x0,y0+hauteurCell); @@ -1677,7 +1678,6 @@ begin FillRect(r); Adr:=TCO[x,y].adresse; - pen.color:=couleur; if (Adr<>0) and (detecteur[Adr].etat) then couleur:=clAllume else case mode of @@ -1694,6 +1694,7 @@ begin moveTo(x0,y0);LineTo(x0+largeurCell,y0+hauteurCell); pen.color:=clvoies; end; + pen.color:=couleur; Brush.Color:=couleur; Pen.Mode:=pmCopy; Pen.Width:=epaisseur; @@ -2631,7 +2632,7 @@ begin end; end; -// Element 25 +// Element 25 croisement procedure dessin_25(Canvas : Tcanvas;x,y,mode: integer); var x0,y0,xf,yf,xc,yc,trajet : integer; r : Trect; @@ -3346,7 +3347,7 @@ begin end; // autres détecteurs - if ((Bimage=7) or (Bimage=8) or (Bimage=9) or (Bimage=10) or (Bimage=17) or (Bimage=20)) and (adresse<>0) then + if ((Bimage=7) or (Bimage=8) or (Bimage=9) or (Bimage=10) or (Bimage=11) or (Bimage=17) or (Bimage=20)) and (adresse<>0) then begin // Adresse de l'élément with PCanvasTCO do begin @@ -5271,7 +5272,6 @@ begin //Affiche('xcliccell='+IntToSTR(XclicCell)+' ycliccell='+IntToSTR(YclicCell),clyellow); if XclicCell>NbreCellX then exit; if YclicCell>NbreCellY then exit; - Bimage:=tco[XClicCell,YClicCell].Bimage; if formConfCellTCOAff then begin @@ -5313,17 +5313,15 @@ begin s:=IntToSTR(XclicCell)+','+IntToSTR(YclicCell); LabelCoord.caption:=s; GroupBox1.Caption:='Configuration cellule '+s; - XclicCellInserer:=XClicCell; YclicCellInserer:=YClicCell; - EditAdrElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].Adresse); EdittypeImage.Text:=IntToSTR(BImage); ComboRepr.ItemIndex:=tco[XClicCell,yClicCell].repr; ShapeCoulFond.Brush.Color:=tco[XClicCell,yClicCell].CouleurFond; if not(selectionaffichee) then _entoure_cell_clic; - actualise; + actualise; // actualise la fenetre de config cellule clicTCO:=false; end; @@ -5334,7 +5332,7 @@ begin Position:=ImageTCO.screenToCLient(Position); Xclic:=position.X; YClic:=position.Y; - // coordonnées grille + // coordonnées grille XclicCell:=Xclic div largeurCell + 1; YclicCell:=Yclic div hauteurCell + 1; LabelCoord.caption:=IntToSTR(XClicCell)+','+IntToSTR(YClicCell); @@ -5342,6 +5340,7 @@ begin YclicCellInserer:=YClicCell; //Entoure_cell(XclicCellInserer,YclicCellInserer); EditAdrElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].Adresse); + EditTypeImage.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].Bimage); end; end; @@ -5450,7 +5449,7 @@ begin tco[XClicCell,YClicCell].Adresse:=Adr; formConfCellTCO.editAdrElement.Text:=intToSTR(Adr); - + tco_Modifie:=true; if tco[XClicCell,YClicCell].BImage=30 then begin index:=Index_feu(adr); @@ -5461,45 +5460,10 @@ begin affiche_tco; end; end; - Affiche_cellule(XclicCell,YclicCell); end; -procedure TFormTCO.EditAdrElementKeyDown(Sender: TObject; var Key: Word; - Shift: TShiftState); -begin - if key=VK_RETURN then - begin - efface_entoure; - affiche_cellule(XClicCell,YClicCell); - end; -end; - -procedure TFormTCO.EditTypeImageKeyPress(Sender: TObject; var Key: Char); -var Bimage,erreur : integer; -begin - if affevt then Affiche('TCC evt editTypeImageKeyPress',clorange); - if actualize then exit; - if ord(Key)=VK_RETURN then - begin - Key:=#0; // évite beeping - Val(EditTypeImage.Text,Bimage,erreur); - //Affiche('Keypressed / Bimage='+IntToSTR(bimage),clyellow); - if (erreur<>0) or not(Bimage in[0..23,30,31]) then - begin - EditTypeImage.text:=intToSTR(tco[XClicCell,YClicCell].BImage); - exit; - end; - TCO_modifie:=true; - tco[XClicCell,YClicCell].Bimage:=Bimage; - formConfCellTCO.EditTypeImage.Text:=intToSTR(Bimage); - actualise; // pour mise à jour de l'image de la fenetre FormConfCellTCO - efface_entoure; - affiche_cellule(XClicCell,YClicCell); - end; -end; - // mise à jour des cellules de l'adresse "adresse" procedure TFormTCO.Maj_TCO(Adresse : integer); var x,y: integer; @@ -5624,57 +5588,24 @@ begin l:=Formprinc.Image9feux.width; //57 h:=Formprinc.Image9feux.height; //105 ImagePalette30.BeginDrag(true); - //ImageTemp:=ImagePalette30; BitBlt(OldBmp.Canvas.Handle,0,0,LargeurCell,HauteurCell,ImageTCO.Canvas.Handle,offsetSourisX,offsetSourisY,SRCCOPY); - // StretchBlt(formTCO.ImageTemp.canvas.Handle,0,0,largeurCell,HauteurCell, // destination avec mise à l'échelle - // formprinc.Image9feux.Canvas.Handle,0,0,l,h,srccopy); - drag:=true; - oldx:=offsetSourisX;oldy:=offsetSourisY; - // debut_drag(ImagePalette30); - - - - //imagePalette30.BeginDrag(true); - //StretchBlt(formTCO.ImageTCO.canvas.Handle,0,0,largeurCell,HauteurCell, // destination avec mise à l'échelle - // formprinc.Image9feux.Canvas.Handle,0,0,l,h,srccopy); - - //Efface_Cellule(formTCO.ImageTCO.canvas,1,1,pmCopy); - - {TransparentBlt(formTCO.ImageTemp.canvas.Handle,0,0,largeurCell,HauteurCell, // destination avec mise à l'échelle //50,50 ok 51,51 nok - formprinc.Image9feux.Canvas.Handle,0,0,50,90,clblue); - formtco.ImageTCO.repaint; - } - with formTCO.ImageTemp2.Canvas do - begin - pen.Color:=clfond; - brush.Color:=clblack; - Rectangle(0,0,91,91); - end; - TransparentBlt(formTCO.ImageTemp2.canvas.Handle,0,0,largeurCell,HauteurCell, // destination avec mise à l'échelle //50,50 ok 51,51 nok - formprinc.Image9feux.Canvas.Handle,0,0,50,90,clblue); - //StretchBlt(formTCO.ImageTemp2.canvas.Handle,0,0,largeurCell,HauteurCell, // destination avec mise à l'échelle - // formprinc.Image9feux.Canvas.Handle,0,0,50,90,srccopy); - formtco.ImageTCO.repaint; - // formTCO.ImageTemp.Canvas.Rectangle(0,0,91,91); - formTCO.ImageTemp:=formTCO.ImageTemp2; - BitBlt(formTCO.ImageTemp.canvas.Handle,0,0,20,20,formTCO.ImageTemp2.canvas.Handle,0,0,SRCCOPY); - - // - { - BitBlt(OldBmp.Canvas.Handle,0,0,LargeurCell,HauteurCell,FormTCO.ImageTCO.Canvas.Handle,offsetSourisX,offsetSourisY,SRCCOPY); - StretchBlt(Vbm.Handle,0,0,largeurCell,HauteurCell, // destination masque avec mise à l'échelle - formprinc.Image9feux.canvas.handle,0,0,l,h,srccopy); //Formprinc.Image9feux.Picture.Bitmap; drag:=true; oldx:=offsetSourisX;oldy:=offsetSourisY; - //https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-bitblt - StretchBlt(formTCO.ImageTCO.canvas.Handle,0,0,largeurCell,HauteurCell, // destination masque avec mise à l'échelle - formprinc.Image9feux.canvas.handle,0,0,l,h,srccopy); //Formprinc.Image9feux.Picture.Bitmap; - } -// TransparentBlt(formTCO.ImageTCO.canvas.Handle,0,0,largeurCell,HauteurCell, -// formprinc.Image9feux.canvas.handle,0,0,l,h,clblue); + with formTCO.ImageTemp2.Canvas do + begin + pen.Color:=clfond; + brush.Color:=clblack; + Rectangle(0,0,91,91); + end; + TransparentBlt(formTCO.ImageTemp2.canvas.Handle,0,0,largeurCell,HauteurCell, // destination avec mise à l'échelle //50,50 ok 51,51 nok + formprinc.Image9feux.Canvas.Handle,0,0,50,90,clblue); - formtco.ImageTCO.repaint; + formtco.ImageTCO.repaint; + formTCO.ImageTemp:=formTCO.ImageTemp2; + BitBlt(formTCO.ImageTemp.canvas.Handle,0,0,20,20,formTCO.ImageTemp2.canvas.Handle,0,0,SRCCOPY); + + formtco.ImageTCO.repaint; end; procedure Tourne90G; @@ -5910,6 +5841,7 @@ begin Adresse:=Tco[xClicCell,yClicCell].Adresse; if adresse=0 then exit; + // double clic sur détecteur : inversion if ((Bimage=1) or (Bimage=20) or (Bimage=10) or (Bimage=11)) and (adresse<>0) then begin detecteur[adresse].etat:=not(detecteur[adresse].etat); @@ -5918,7 +5850,7 @@ begin tjdC:=false; // commande tjd/c - if (Bimage=21) or (Bimage=22) then + if (Bimage=21) or (Bimage=22) or (Bimage=25) then begin i:=Index_aig(Adresse); tjdC:=(aiguillage[i].modele=tjd) or (aiguillage[i].modele=tjs); @@ -6363,14 +6295,14 @@ var oriente,piedFeu : integer; begin //Affiche('on popup',clyellow); - PopUpMenu1.Items[8][0].Caption:='Ligne au dessus de la '+intToSTR(YclicCell); - PopUpMenu1.Items[8][1].Caption:='Ligne en dessous de la '+intToSTR(YclicCell); - PopUpMenu1.Items[8][3].Caption:='Colonne à gauche de la '+intToSTR(XclicCell); - PopUpMenu1.Items[8][4].Caption:='Colonne à droite de la '+intToSTR(XclicCell); - - PopUpMenu1.Items[9][0].Caption:='Ligne '+intToSTR(YclicCell); - PopUpMenu1.Items[9][1].Caption:='Colonne '+intToSTR(XclicCell); - + PopUpMenu1.Items[9][0].Caption:='Ligne au dessus de la '+intToSTR(YclicCell); + PopUpMenu1.Items[9][1].Caption:='Ligne en dessous de la '+intToSTR(YclicCell); + PopUpMenu1.Items[9][3].Caption:='Colonne à gauche de la '+intToSTR(XclicCell); + PopUpMenu1.Items[9][4].Caption:='Colonne à droite de la '+intToSTR(XclicCell); + + PopUpMenu1.Items[10][0].Caption:='Ligne '+intToSTR(YclicCell); + PopUpMenu1.Items[10][1].Caption:='Colonne '+intToSTR(XclicCell); + // grise ou non l'entrée signal du menu if tco[XClicCell,YClicCell].Bimage=30 then begin @@ -6392,8 +6324,8 @@ begin begin PopUpMenu1.Items[6][0].checked:=false; PopUpMenu1.Items[6][1].checked:=true; - PopUpMenu1.Items[6][2].checked:=false; - end; + PopUpMenu1.Items[6][2].checked:=false; + end; PiedFeu:=tco[XClicCell,YClicCell].PiedFeu; if PiedFeu=1 then begin @@ -6765,9 +6697,42 @@ begin accept:=true; end; +procedure TFormTCO.EditTypeImageChange(Sender: TObject); +var Bimage,erreur : integer; +begin + if clicTCO or not(formConfCellTCOAff) then exit; + if affevt then Affiche('TCO evt editTypeImageChange',clorange); + if actualize then exit; + Val(EditTypeImage.Text,Bimage,erreur); + if (erreur<>0) or not(Bimage in[0..22,24..25,30,31]) then + begin + exit; + end; + TCO_modifie:=true; + tco[XClicCell,YClicCell].Bimage:=Bimage; + formConfCellTCO.EditTypeImage.Text:=intToSTR(Bimage); + actualise; // pour mise à jour de l'image de la fenetre FormConfCellTCO + efface_entoure; + affiche_cellule(XClicCell,YClicCell); +end; +procedure TFormTCO.outslectionner1Click(Sender: TObject); +begin + xminiSel:=0; + yminiSel:=0; + xMaxiSel:=(NbreCellX-1)*LargeurCell; + yMaxiSel:=(NbreCellY-1)*HauteurCell; + rAncien:=rect(xminiSel,YminiSel,xmaxiSel+LargeurCell,YMaxiSel+HauteurCell); + + SelectionAffichee:=true; + with imageTCO.Canvas do + begin + Pen.Mode:=PmXor; + Pen.color:=clGrille; + Brush.Color:=clblue; + Rectangle(rAncien); + end; +end; begin - - end. diff --git a/Unitplace.dcu b/Unitplace.dcu index ab03b79..dec2be7 100644 Binary files a/Unitplace.dcu and b/Unitplace.dcu differ diff --git a/Unitplace.dfm b/Unitplace.dfm index 455a337..1dcf1c6 100644 --- a/Unitplace.dfm +++ b/Unitplace.dfm @@ -3,7 +3,7 @@ object FormPlace: TFormPlace Top = 142 BorderStyle = bsDialog Caption = 'Placement des trains' - ClientHeight = 449 + ClientHeight = 485 ClientWidth = 307 Color = clBtnFace Font.Charset = DEFAULT_CHARSET @@ -134,7 +134,7 @@ object FormPlace: TFormPlace end object ButtonSauve: TButton Left = 16 - Top = 376 + Top = 408 Width = 273 Height = 25 Hint = @@ -238,7 +238,7 @@ object FormPlace: TFormPlace end object Button1: TButton Left = 208 - Top = 416 + Top = 448 Width = 81 Height = 25 Caption = 'Config trains' @@ -247,10 +247,13 @@ object FormPlace: TFormPlace end object ButtonArretroutage: TButton Left = 16 - Top = 344 + Top = 376 Width = 273 Height = 25 + Hint = 'Arr'#234't des trains et lib'#232're les r'#233'servations' Caption = 'Arr'#234't du roulage' + ParentShowHint = False + ShowHint = True TabOrder = 11 OnClick = ButtonArretroutageClick end @@ -394,11 +397,23 @@ object FormPlace: TFormPlace end object BitBtn1: TBitBtn Left = 16 - Top = 416 + Top = 448 Width = 73 Height = 25 TabOrder = 24 OnClick = BitBtn1Click Kind = bkClose end + object ButtonArretTrains: TButton + Left = 16 + Top = 344 + Width = 273 + Height = 25 + Hint = 'Arr'#234'te tous les trains' + Caption = 'Arr'#234't des trains' + ParentShowHint = False + ShowHint = True + TabOrder = 25 + OnClick = ButtonArretTrainsClick + end end diff --git a/Unitplace.pas b/Unitplace.pas index 08f348c..4d87237 100644 --- a/Unitplace.pas +++ b/Unitplace.pas @@ -44,6 +44,7 @@ type EditDir6: TEdit; Label5: TLabel; BitBtn1: TBitBtn; + ButtonArretTrains: TButton; procedure ButtonInitAigClick(Sender: TObject); procedure FormActivate(Sender: TObject); procedure ButtonPlaceClick(Sender: TObject); @@ -57,7 +58,6 @@ type procedure ButtonSauveClick(Sender: TObject); procedure FormKeyPress(Sender: TObject; var Key: Char); procedure ButtonLanceRoutageClick(Sender: TObject); - procedure ButtonArretroutageClick(Sender: TObject); procedure CheckInverse1Click(Sender: TObject); procedure CheckInverse2Click(Sender: TObject); procedure CheckInverse3Click(Sender: TObject); @@ -72,6 +72,8 @@ type procedure EditDir6Change(Sender: TObject); procedure FormCreate(Sender: TObject); procedure BitBtn1Click(Sender: TObject); + procedure ButtonArretTrainsClick(Sender: TObject); + procedure ButtonArretroutageClick(Sender: TObject); private { Déclarations privées } public @@ -403,7 +405,7 @@ begin if not(trouve) then Affiche('Pas de train placé',clOrange); end; -procedure TFormPlace.ButtonArretroutageClick(Sender: TObject); +procedure TFormPlace.ButtonArretTrainsClick(Sender: TObject); var i : integer; begin roulage:=false; @@ -539,4 +541,16 @@ begin close; end; +procedure TFormPlace.ButtonArretroutageClick(Sender: TObject); +var i : integer; +begin + roulage:=false; + Affiche('Arrêt du roulage de tous les trains et libération des aiguillages',clorange); + Formprinc.LabelTitre.caption:=titre+' '; + for i:=1 to ntrains do + vitesse_loco('',trains[i].adresse,0,true); + raz_tout; +end; + +begin end. diff --git a/verif_version.dcu b/verif_version.dcu index 82a9e25..96030f4 100644 Binary files a/verif_version.dcu and b/verif_version.dcu differ diff --git a/verif_version.pas b/verif_version.pas index 05a3602..b9f7660 100644 --- a/verif_version.pas +++ b/verif_version.pas @@ -23,7 +23,7 @@ var Lance_verif : integer; verifVersion,notificationVersion : boolean; -Const Version='5.7'; // sert à la comparaison de la version publiée +Const Version='5.73'; // sert à la comparaison de la version publiée SousVersion=' '; // A B C ... en cas d'absence de sous version mettre un espace implementation diff --git a/versions.txt b/versions.txt index 27d00c8..7d5d9d2 100644 --- a/versions.txt +++ b/versions.txt @@ -154,7 +154,8 @@ version 5.6 : Ajout d'affichage d'informations suppl version 5.7 : Glisser-déposer du TCO avec les icônes de placement. Vérification des incompatibilités de placement des icônes du TCO. Gestion des passages à niveau par comptage/décomptage des trains. - - - - +version 5.71 : Gestion des actionneurs sur fronts plutot que sur états. +version 5.72 : Actualisation des réponses/commandes des détecteurs en DCC++. + Correction d'une régression sur les evt actionneurs par aiguillages. +version 5.73 : Ajout d'un bouton d'autorisation pour le pare-feu windows. + Ajout d'une 5ème voie pour la gestion des PN par actionneurs.