diff --git a/Notice d'utilisation des signaux_complexes_GL_V1.7.pdf b/Notice d'utilisation des signaux_complexes_GL_V1.74.pdf similarity index 83% rename from Notice d'utilisation des signaux_complexes_GL_V1.7.pdf rename to Notice d'utilisation des signaux_complexes_GL_V1.74.pdf index e454c16..b494be0 100644 Binary files a/Notice d'utilisation des signaux_complexes_GL_V1.7.pdf and b/Notice d'utilisation des signaux_complexes_GL_V1.74.pdf differ diff --git a/UnitConfig.dcu b/UnitConfig.dcu index 085b1af..5bcefda 100644 Binary files a/UnitConfig.dcu and b/UnitConfig.dcu differ diff --git a/UnitConfig.dfm b/UnitConfig.dfm index b533bf8..2ed81da 100644 --- a/UnitConfig.dfm +++ b/UnitConfig.dfm @@ -1,6 +1,6 @@ object FormConfig: TFormConfig - Left = 250 - Top = 200 + Left = 226 + Top = 188 Hint = 'Modifie les fichiers de configuration selon les s'#233'lections chois' + 'ies' @@ -22,10 +22,10 @@ object FormConfig: TFormConfig TextHeight = 13 object LabelInfo: TLabel Left = 601 - Top = 424 - Width = 4 + Top = 432 + Width = 13 Height = 16 - Caption = '-' + Caption = '- ' Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -13 @@ -1365,6 +1365,177 @@ object FormConfig: TFormConfig AAAAAAAAAAAAAAAAAAAA} Visible = False end + object ImageTri: TImage + Left = 624 + Top = 344 + Width = 145 + Height = 65 + Picture.Data = { + 07544269746D617076120000424D761200000000000076000000280000008900 + 000040000000010004000000000000120000120B0000120B0000100000001000 + 000000000000A5A5A500CECECE00FF000000FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333000000033333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333300000003333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333330000000333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333333333333000 + 0000333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333000000033333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333300000003333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333333111111033333330000000333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333111111111103333333000 + 0000333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333331111111111 + 1111120333333000000033333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3311111111111111111000033333300000003333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333311111111111111110000000003333330000000333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333111111111111111110000000001110333333000 + 0000333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333111111111111111110000000011 + 1111111033333000000033333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333333331111111111111111 + 1000000000111111111111103333300000003333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333333333111111 + 1111111111111000000000111111111111111110333330000000333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333111111111111111111110000000001111111111111111111111033333000 + 0000333333333333333333333333333333333333333333333333333333333333 + 3333333333333311111111111111111111100000000001111111111111111111 + 1111111103333000000033333333333333333333333333333333333333333333 + 3333333333333333333333311111111111111111111110000000000011111111 + 1111111111111111111110000333300000003333333333333333333333333333 + 3333333333333333333333333333311111111111111111111111111000000000 + 0001111111111111111111111111111110000000033330000000333333333333 + 3333333333333333333333333333333333311111111111111111111111111111 + 1000000000000111111111111111111111111111111110000000033333333000 + 0000333333333333333333333333333333333331111111111111111111111111 + 1111111111100000000000011111111111111111111111111111111110000000 + 0333333333333000000033333111111111111111111111111111111111111111 + 1111111111111111110000000000000001111111111111111111111111111111 + 1111100000000333333333333333300000003333301111111111111111111111 + 1111111111111111111111110000000000000000000111111111111111111111 + 1111111111111111100000000333333333333333333330000000333330111111 + 1111111111111111111111111111100000000000000000000011111111111111 + 1111111111111111111111111111000000000333333333333333333333333000 + 0000333330111111111111110000000000000000000000000000000011111111 + 1111111111111111111111111111111111111111000000000333333333333333 + 3333333333333000000033333000000000000000000000000000000000000111 + 1111111111111111111111111111111111111111111111111110000000000000 + 0000000000000000000000000033300000003333300000000000000011111111 + 1111111111111111111111111111111111111111111111111111111111111000 + 0000000000000000000000000000000000000000003330000000333330111111 + 1111111111111111111111111111111111111111111111111111111111111111 + 1111111111111111111111111111111111111111111111111111111110333000 + 0000333330111111111111111111111111111111111111111111111111111111 + 1111111111111111111111111111111111111111111111111111111111111111 + 1111111110333000000033333011111111111111111111111111111111111111 + 1111111111111111111111111111111111111111111111111111111111111111 + 1111111111111111111111111033300000003333301111111111111111111111 + 1111111111111111111111111111111111111111111111111111111111111111 + 1111111111111111111111111111111111111111103330000000333330111111 + 1111111111111111111111111111111111111111111111111111111111111111 + 1111111111111111111111111111111111111111111111111111111110333000 + 0000333330111111111111111111111111111111111111111111111111111111 + 1111111111111111111111111111111111111111111111111111111111111111 + 1111111110333000000033333011111111111111111111111111111111111111 + 1111111111111111111111111111111111111111111111111111111111111111 + 1111111111111111111111111033300000003333300000000000000011111111 + 1111111111111111111111111111111111111111111111111111111111111000 + 0000000000000000000000000000000000000000003330000000333330000000 + 0000000000000000000000000000011111111111111111111111111111111111 + 1111111111111111111000000000000000000000000000000000000000333000 + 0000333330111111111111110000000000000000000000000000000011111111 + 1111111111111111111111111111111111111111000000000333333333333333 + 3333333333333000000033333011111111111111111111111111111111111000 + 0000000000000000001111111111111111111111111111111111111111110000 + 0000033333333333333333333333300000003333301111111111111111111111 + 1111111111111111111111110000000000000000000111111111111111111111 + 1111111111111111100000000333333333333333333330000000333330111111 + 1111111111111111111111111111111111111111111111111100000000000000 + 0111111111111111111111111111111111111000000003333333333333333000 + 0000333333333333333333333333333333333331111111111111111111111111 + 1111111111100000000000011111111111111111111111111111111110000000 + 0333333333333000000033333333333333333333333333333333333333333333 + 3331111111111111111111111111111110000000000001111111111111111111 + 1111111111111000000003333333300000003333333333333333333333333333 + 3333333333333333333333333333311111111111111111111111111000000000 + 0001111111111111111111111111111110000000033330000000333333333333 + 3333333333333333333333333333333333333333333333333333333111111111 + 1111111111111000000000001111111111111111111111111111100003333000 + 0000333333333333333333333333333333333333333333333333333333333333 + 3333333333333311111111111111111111100000000001111111111111111111 + 1111111103333000000033333333333333333333333333333333333333333333 + 3333333333333333333333333333333333331111111111111111111100000000 + 0111111111111111111111103333300000003333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333333333111111 + 1111111111111000000000111111111111111110333330000000333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333333111111111111111110000000001111111111111033333000 + 0000333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333111111111111111110000000011 + 1111111033333000000033333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333333331111111 + 1111111111000000000111033333300000003333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333311111111111111110000000003333330000000333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333333333111111111111111110000333333000 + 0000333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333331111111111 + 1111120333333000000033333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333311111111110333333300000003333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333333111111033333330000000333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333333333333000 + 0000333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333000000033333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333300000003333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333330000000333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333333333333000 + 0000333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333000000033333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333300000003333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333330000000333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333333333333000 + 0000} + Visible = False + end + object Label19: TLabel + Left = 104 + Top = 104 + Width = 75 + Height = 13 + Caption = 'Element suivant' + end + object Label20: TLabel + Left = 24 + Top = 160 + Width = 50 + Height = 13 + Caption = 'LabelTrain' + end object ButtonAppliquerEtFermer: TButton Left = 384 Top = 440 @@ -1390,7 +1561,7 @@ object FormConfig: TFormConfig Top = 8 Width = 585 Height = 417 - ActivePage = TabSheet1 + ActivePage = TabSheetCDM Font.Charset = DEFAULT_CHARSET Font.Color = clBackground Font.Height = -11 @@ -1504,14 +1675,14 @@ object FormConfig: TFormConfig Top = 8 Width = 273 Height = 169 - Caption = 'Au d'#233'marrage de CDM Rail : interface ' + Caption = 'Au d'#233'marrage de CDM Rail : serveur' TabOrder = 2 object RadioButton4: TRadioButton Left = 8 Top = 16 Width = 185 Height = 17 - Caption = 'Ne pas d'#233'marrer d'#39'interface' + Caption = 'Ne pas d'#233'marrer de serveur' TabOrder = 0 end object RadioButton5: TRadioButton @@ -1583,19 +1754,12 @@ object FormConfig: TFormConfig Left = 296 Top = 184 Width = 273 - Height = 145 - Caption = 'Au d'#233'marrage de CDM Rail : interface de' + Height = 137 + Caption = 'Au d'#233'marrage de CDM Rail : interface LENZ' TabOrder = 3 - object Label10: TLabel - Left = 8 - Top = 16 - Width = 146 - Height = 13 - Caption = 'r'#233'trosignalisation pour RS Lenz' - end object RadioButton13: TRadioButton Left = 8 - Top = 32 + Top = 24 Width = 209 Height = 17 Caption = 'Automatique' @@ -1603,7 +1767,7 @@ object FormConfig: TFormConfig end object RadioButton14: TRadioButton Left = 8 - Top = 48 + Top = 40 Width = 217 Height = 17 Caption = 'LI-USB' @@ -1611,7 +1775,7 @@ object FormConfig: TFormConfig end object RadioButton15: TRadioButton Left = 8 - Top = 64 + Top = 56 Width = 217 Height = 17 Caption = 'LI-101F' @@ -1619,7 +1783,7 @@ object FormConfig: TFormConfig end object RadioButton16: TRadioButton Left = 8 - Top = 80 + Top = 72 Width = 217 Height = 17 Caption = 'LI-100F' @@ -1627,7 +1791,7 @@ object FormConfig: TFormConfig end object RadioButton17: TRadioButton Left = 8 - Top = 96 + Top = 88 Width = 209 Height = 17 Caption = 'LI-100' @@ -1635,7 +1799,7 @@ object FormConfig: TFormConfig end object RadioButton18: TRadioButton Left = 8 - Top = 112 + Top = 104 Width = 113 Height = 17 Caption = 'Genli' @@ -1683,9 +1847,9 @@ object FormConfig: TFormConfig object CheckServPosTrains: TCheckBox Left = 8 Top = 88 - Width = 121 + Width = 169 Height = 17 - Caption = 'Position des trains' + Caption = 'Position des trains (non utilis'#233')' TabOrder = 3 end object CheckBoxSrvSig: TCheckBox @@ -1693,7 +1857,7 @@ object FormConfig: TFormConfig Top = 40 Width = 113 Height = 17 - Caption = 'Signaux' + Caption = 'Signaux (non utilis'#233')' TabOrder = 4 end end @@ -1949,7 +2113,7 @@ object FormConfig: TFormConfig object MemoAig: TMemo Left = 0 Top = 24 - Width = 249 + Width = 273 Height = 361 Color = clInfoText Font.Charset = DEFAULT_CHARSET @@ -1966,7 +2130,7 @@ object FormConfig: TFormConfig OnDblClick = MemoAigDblClick end object GroupBox11: TGroupBox - Left = 264 + Left = 280 Top = 32 Width = 289 Height = 233 @@ -1986,7 +2150,7 @@ object FormConfig: TFormConfig ParentFont = False end object LabelLigne: TLabel - Left = 88 + Left = 72 Top = 42 Width = 104 Height = 16 @@ -2026,7 +2190,7 @@ object FormConfig: TFormConfig end object LabelBD: TLabel Left = 225 - Top = 176 + Top = 174 Width = 9 Height = 16 Caption = 'D' @@ -2056,6 +2220,19 @@ object FormConfig: TFormConfig Font.Style = [fsBold] ParentFont = False end + object Label18: TLabel + Left = 220 + Top = 198 + Width = 16 + Height = 16 + Caption = 'S2' + Font.Charset = ANSI_CHARSET + Font.Color = clBlack + Font.Height = -13 + Font.Name = 'Arial' + Font.Style = [fsBold] + ParentFont = False + end object GroupBox10: TGroupBox Left = 40 Top = 64 @@ -2090,7 +2267,7 @@ object FormConfig: TFormConfig end object EditDroit_BD: TEdit Left = 240 - Top = 176 + Top = 174 Width = 41 Height = 21 TabOrder = 1 @@ -2128,6 +2305,14 @@ object FormConfig: TFormConfig TabOrder = 5 Text = 'EditPointe' end + object EditDevieS2: TEdit + Left = 240 + Top = 196 + Width = 41 + Height = 21 + TabOrder = 6 + Text = 'EditDevie_HD' + end end object Edit_HG: TEdit Left = 296 @@ -2171,14 +2356,16 @@ object FormConfig: TFormConfig object Label15: TLabel Left = 0 Top = 8 - Width = 253 + Width = 530 Height = 13 - Caption = 'Liste de mod'#233'lisation des signaux du fichier config.cfg' + Caption = + 'Liste de mod'#233'lisation des signaux du fichier config.cfg - clique' + + 'z sur une ligne pour afficher la description du signal' end object MemoSignaux: TMemo Left = 0 Top = 24 - Width = 569 + Width = 289 Height = 361 Color = clInfoText Font.Charset = DEFAULT_CHARSET @@ -2190,6 +2377,62 @@ object FormConfig: TFormConfig ReadOnly = True ScrollBars = ssVertical TabOrder = 0 + OnClick = MemoSignauxClick + end + object GroupBox12: TGroupBox + Left = 304 + Top = 40 + Width = 257 + Height = 257 + Caption = 'Description du signal' + TabOrder = 1 + object ImageSignal: TImage + Left = 8 + Top = 72 + Width = 65 + Height = 137 + end + object LabelAdrSig: TLabel + Left = 13 + Top = 20 + Width = 154 + Height = 19 + Caption = 'Adresse du signal = ' + Font.Charset = ANSI_CHARSET + Font.Color = clBlack + Font.Height = -16 + Font.Name = 'Arial' + Font.Style = [fsBold] + ParentFont = False + end + object LabelDec: TLabel + Left = 80 + Top = 72 + Width = 53 + Height = 13 + Caption = 'D'#233'codeur: ' + end + object LabelDetAss: TLabel + Left = 80 + Top = 88 + Width = 86 + Height = 13 + Caption = 'D'#233'tecteur associ'#233 + end + object LabelElSuiv: TLabel + Left = 80 + Top = 104 + Width = 75 + Height = 13 + Caption = 'Element suivant' + end + object LabelVerrou: TLabel + Left = 80 + Top = 120 + Width = 105 + Height = 13 + Caption = 'Verrouillable au carr'#233' :' + end end end object TabSheet4: TTabSheet @@ -2198,14 +2441,16 @@ object FormConfig: TFormConfig object Label16: TLabel Left = 0 Top = 8 - Width = 272 + Width = 555 Height = 13 - Caption = 'Liste de mod'#233'lisation des actionneurs du fichier config.cfg' + Caption = + 'Liste de mod'#233'lisation des actionneurs du fichier config.cfg - cl' + + 'iquez sur une ligne pour afficher la description de l'#39'action' end object MemoAct: TMemo Left = 0 Top = 24 - Width = 569 + Width = 289 Height = 361 Color = clInfoText Font.Charset = DEFAULT_CHARSET @@ -2217,6 +2462,267 @@ object FormConfig: TFormConfig ReadOnly = True ScrollBars = ssVertical TabOrder = 0 + OnClick = MemoActClick + end + object GroupBox13: TGroupBox + Left = 304 + Top = 32 + Width = 257 + Height = 345 + Caption = 'Description de l'#39'actionneur ' + TabOrder = 1 + object GroupBox14: TGroupBox + Left = 16 + Top = 24 + Width = 225 + Height = 73 + Caption = 'Type d'#39'actionneur ' + TabOrder = 0 + object RadioButtonLoc: TRadioButton + Left = 24 + Top = 24 + Width = 193 + Height = 17 + Caption = 'Fonction F pour locomotive' + TabOrder = 0 + end + object RadioButtonPN: TRadioButton + Left = 24 + Top = 40 + Width = 193 + Height = 17 + Caption = 'Gestion de passage '#224' niveau' + TabOrder = 1 + end + end + object GroupBoxAct: TGroupBox + Left = 16 + Top = 208 + Width = 225 + Height = 129 + Caption = 'Actionneur fonction de locomotive ' + TabOrder = 1 + object LabelActionneur: TLabel + Left = 56 + Top = 44 + Width = 51 + Height = 13 + Caption = 'Actionneur' + end + object LabelTrain: TLabel + Left = 72 + Top = 20 + Width = 24 + Height = 13 + Caption = 'Train' + end + object Labela: TLabel + Left = 144 + Top = 68 + Width = 6 + Height = 13 + Caption = #224 + end + object LabelFonction: TLabel + Left = 56 + Top = 68 + Width = 41 + Height = 13 + Caption = 'Fonction' + end + object LabelTempo: TLabel + Left = 40 + Top = 84 + Width = 55 + Height = 13 + Caption = 'Tempo (ms)' + end + object EditAct: TEdit + Left = 112 + Top = 20 + Width = 49 + Height = 21 + TabOrder = 0 + Text = 'EditAct' + end + object EditTrain: TEdit + Left = 112 + Top = 44 + Width = 121 + Height = 21 + TabOrder = 1 + Text = 'EditTrain' + end + object EditEtat: TEdit + Left = 160 + Top = 68 + Width = 25 + Height = 21 + TabOrder = 2 + Text = 'EditEtat' + end + object EditFonction: TEdit + Left = 112 + Top = 68 + Width = 25 + Height = 21 + TabOrder = 3 + Text = 'EditFonc' + end + object EditTempo: TEdit + Left = 112 + Top = 92 + Width = 33 + Height = 21 + TabOrder = 4 + Text = 'EditTempo' + end + end + object GroupBoxPN: TGroupBox + Left = 16 + Top = 104 + Width = 225 + Height = 193 + Caption = 'Actionneurs gestion passage '#224' niveau' + TabOrder = 2 + object Label21: TLabel + Left = 8 + Top = 28 + Width = 100 + Height = 13 + Caption = 'Adresse de fermeture' + end + object Label22: TLabel + Left = 8 + Top = 52 + 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 EditAdrFerme: TEdit + Left = 120 + Top = 24 + Width = 41 + Height = 21 + TabOrder = 0 + Text = 'EditAdrFerme' + end + object EditAdrOuvre: TEdit + Left = 120 + Top = 48 + Width = 41 + Height = 21 + TabOrder = 1 + Text = 'EditAdrOuvre' + end + object EditCmdFerme: TEdit + Left = 168 + Top = 24 + Width = 25 + Height = 21 + TabOrder = 2 + Text = 'EditCdeFerme' + end + object EditCdeOuvre: TEdit + Left = 168 + Top = 48 + Width = 25 + Height = 21 + TabOrder = 3 + Text = 'EditCdeOuvre' + end + object EditV1F: TEdit + Left = 64 + Top = 112 + Width = 41 + Height = 21 + TabOrder = 4 + Text = 'EditAdrFerme' + 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 + Text = 'EditAdrFerme' + end + object EditV3F: TEdit + Left = 64 + Top = 160 + Width = 41 + Height = 21 + TabOrder = 8 + Text = 'EditAdrFerme' + end + object EditV1O: TEdit + Left = 152 + Top = 112 + Width = 41 + Height = 21 + TabOrder = 9 + Text = 'EditAdrFerme' + end + object EditV2O: TEdit + Left = 152 + Top = 136 + Width = 41 + Height = 21 + TabOrder = 10 + Text = 'EditAdrFerme' + end + object EditV3O: TEdit + Left = 152 + Top = 160 + Width = 41 + Height = 21 + TabOrder = 11 + Text = 'EditAdrFerme' + end + end end end end diff --git a/UnitConfig.pas b/UnitConfig.pas index 9676105..d429209 100644 --- a/UnitConfig.pas +++ b/UnitConfig.pas @@ -38,7 +38,6 @@ type RadioButton11: TRadioButton; RadioButton12: TRadioButton; GroupBox7: TGroupBox; - Label10: TLabel; RadioButton13: TRadioButton; RadioButton14: TRadioButton; RadioButton15: TRadioButton; @@ -108,12 +107,60 @@ type LabelHG: TLabel; EditP1: TEdit; EditP2: TEdit; + ImageTri: TImage; + Label18: TLabel; + EditDevieS2: TEdit; + GroupBox12: TGroupBox; + ImageSignal: TImage; + LabelAdrSig: TLabel; + GroupBox13: TGroupBox; + LabelDec: TLabel; + LabelDetAss: TLabel; + LabelElSuiv: TLabel; + Label19: TLabel; + LabelVerrou: TLabel; + GroupBox14: TGroupBox; + RadioButtonLoc: TRadioButton; + RadioButtonPN: TRadioButton; + Label20: TLabel; + GroupBoxAct: TGroupBox; + LabelActionneur: TLabel; + EditAct: TEdit; + EditTrain: TEdit; + LabelTrain: TLabel; + EditEtat: TEdit; + Labela: TLabel; + EditFonction: TEdit; + LabelFonction: TLabel; + EditTempo: TEdit; + LabelTempo: TLabel; + GroupBoxPN: TGroupBox; + Label21: TLabel; + EditAdrFerme: TEdit; + Label22: TLabel; + EditAdrOuvre: TEdit; + EditCmdFerme: TEdit; + EditCdeOuvre: TEdit; + Label23: TLabel; + LabelV2: TLabel; + LabelV3: TLabel; + EditV1F: TEdit; + Shape1: TShape; + StaticText1: TStaticText; + StaticText2: TStaticText; + EditV2F: TEdit; + EditV3F: TEdit; + EditV1O: TEdit; + EditV2O: TEdit; + EditV3O: TEdit; procedure ButtonAppliquerEtFermerClick(Sender: TObject); procedure Button2Click(Sender: TObject); procedure FormActivate(Sender: TObject); procedure FormCreate(Sender: TObject); procedure MemoAigDblClick(Sender: TObject); procedure MemoAigClick(Sender: TObject); + procedure MemoSignauxClick(Sender: TObject); + procedure MemoActClick(Sender: TObject); private { Déclarations privées } public @@ -121,8 +168,9 @@ type end; -const TitreAig='Description de l''aiguillage '; - +const +TitreAig='Description de l''aiguillage '; + var FormConfig: TFormConfig; AdresseIPCDM,AdresseIP,PortCom,recuCDM : string; @@ -144,22 +192,21 @@ uses UnitDebug,UnitPrinc; function envoi_CDM(s : string) : boolean; var temps : integer; begin - if parsocketCDM=false then begin envoi_CDM:=false;exit;end; + if SocketCDM_connecte=false then begin envoi_CDM:=false;exit;end; //Affiche('Envoi à CDM rail',clRed);Affiche(s,ClGreen); + if trace then affiche(s,clLime); Formprinc.ClientSocketCDM.Socket.SendText(s); // attend l'ack ackCDM:=false;nackCDM:=false; - if ParSocketCDM then + temps:=0; + repeat + inc(temps);Sleep(100); + Application.processMessages; + until ferme or ackCDM or nackCDM or (temps>30); // CDM répond < 1s + //Affiche(IntToSTR(temps),clyellow); + if not(ackCDM) or nack then begin - temps:=0; - repeat - inc(temps);Sleep(100); - Application.processMessages; - until ferme or ackCDM or nackCDM or (temps>10); // CDM répond < 1s - if not(ackCDM) or nack then - begin - Affiche('Pas de réponse de CDM Rail',clRed); - end; + Affiche('Pas de réponse de CDM Rail',clRed); end; envoi_CDM:=ackCDM; end; @@ -216,7 +263,6 @@ begin // déconnexion de l'ancienne liaison éventuelle Formprinc.ClientSocketCDM.Close; // Initialisation de la comm socket CDM - ParSocketCDM:=false; //if CDM_connecte then begin Affiche('CDM déja connecté',Cyan);exit;end; if AdresseIPCDM<>'0' then begin @@ -232,8 +278,9 @@ begin Sleep(50); inc(i); Application.processMessages; - until (i>10) or ParSocketCDM; - if not(ParSocketCDM) then Affiche('Socket CDM non connecté',clOrange); + until (i>10) or SocketCDM_connecte ; + //if i>30 then affiche('Timeout',clred); + if not(SocketCDM_connecte) then Affiche('Socket CDM non connecté',clOrange); // connexion à CDM rail recuCDM:=''; @@ -241,11 +288,11 @@ begin envoi_cdm(s); if pos('_ACK',recuCDM)<>0 then begin - CDM_connecte:=True; Id_CDM:=copy(recuCDM,5,2); // récupère l'ID reçu de CDM, à utiliser dans toutes les futures trames s:='Connecté au serveur CDM rail avec l''ID='+Id_CDM; Affiche(s,clYellow); AfficheDebug(s,clyellow); + CDM_connecte:=true; // demande des services services_CDM; @@ -261,26 +308,19 @@ begin end; end; - - +// teste si une adresse IP V4 est ok function Ipok(s : string) : boolean; -var i,posp,n,octet,erreur : integer; +var i,k,posp,n,octet,erreur : integer; begin - n:=0; - for i:=1 to length(s) do + for k:=1 to 3 do begin - posp:=pos('.',s); - if posp<>0 then - begin - inc(n); - val(s,octet,erreur); - if octet>255 then begin IpOK:=false;exit;end; - delete(s,1,posp); - end; - end; - val(s,octet,erreur); - if octet>255 then begin IpOK:=false;exit;end; - IpOk:=n=3; + i:=pos('.',s); + if i=0 then begin IpOK:=false;exit;end; + val(copy(s,1,i-1),octet,erreur);if (erreur<>0) or (octet>255) then begin IpOK:=false;exit;end; + delete(s,1,i); + end; + val(s,octet,erreur);if (erreur<>0) or (octet>255) then begin IpOK:=false;exit;end; + ipOK:=true; end; // vérifie si ma config de la com série/usb est ok @@ -620,7 +660,7 @@ begin Raz_Acc_signaux:=CheckBoxRazSignaux.checked; if change_srv then services_CDM; - + // générer le fichiers config.cfg et clieng-GL.cfg genere_config2; formConfig.close; @@ -638,6 +678,11 @@ begin labelHG.Visible:=false; EditP1.Visible:=false; EditP2.Visible:=false; + EditDevieS2.Visible:=false; + Label18.Visible:=false; + GroupBoxPN.Visible:=false; + GroupBoxAct.Visible:=false; + Edit_HG.ReadOnly:=true; EditP1.ReadOnly:=true; @@ -723,7 +768,7 @@ begin i:=pos(',',s); if i<>0 then delete(s,i,length(s)-i+1); val(s,adr,erreur); - bis:=pos(s,'B')<>0; + bis:=pos('B',s)<>0; B:=#0; i:=pos('S',s);if i<>0 then B:='S'; i:=pos('P',s);if i<>0 then B:='P'; @@ -732,29 +777,35 @@ end; procedure Aff_champs_aig; var Adresse,Adr2,traite,erreur,ligne,i,j,Nboucle,selpos : integer; - bis,tjd : boolean; + bis,tjd,tri : boolean; s,ss : string; B : char; begin with formConfig.MemoAig do begin ligne:=Perform(EM_LINEFROMCHAR,-1,0); // numéro de la lignée cliquée - s:=Uppercase(Lines[ligne]); + s:=Uppercase(Lines[ligne]); + if s='' then exit; SelStart:=Perform(EM_LINEINDEX,Ligne,0); // début de la sélection SelLength:=Length(s) ; // fin de la sélection SetFocus; end; - - Val(s,Adresse,erreur); - formconfig.LabelAdresse.Caption:=TitreAig+InttoSTr(Adresse); + Val(s,Adresse,erreur); + if adresse=0 then exit; + ss:=TitreAig+InttoSTr(Adresse);if s[erreur]='B' then ss:=ss+'bis'; + formconfig.LabelAdresse.Caption:= ss; + + tjd:=pos('TJD',s)<>0 ; + tri:=pos('TRI',s)<>0 ; with formconfig do begin LabelLigne.caption:=s; ImageAffiche.Picture.Bitmap.TransparentMode:=tmAuto; ImageAffiche.Picture.Bitmap.TransparentColor:=clblue; ImageAffiche.Transparent:=true; - if pos('TJD',s)<>0 then + // tjd + if tjd then begin ImageAffiche.Picture.BitMap:=Imagetjd.Picture.Bitmap; Edit_HG.Visible:=true; @@ -762,6 +813,8 @@ begin labelHG.Visible:=true; EditP1.Visible:=true; EditP2.Visible:=true; + EditDevieS2.Visible:=false; + Label18.Visible:=false; EditPointe_BG.Text:=intToSTR(aiguillage[adresse].ADevie)+aiguillage[adresse].ADevieB; Edit_HG.Text:=intToSTR(aiguillage[adresse].ADroit)+aiguillage[adresse].ADroitB; @@ -771,15 +824,30 @@ begin EditP1.Text:=intToSTR(aiguillage[adresse].APointe); EditP2.Text:=intToSTR(aiguillage[adr2].APointe); - + exit; end - else + else + // aiguillage tri + if tri then + begin + tri:=true; + i:=pos(',',s);delete(s,1,i); + ImageAffiche.Picture.BitMap:=ImageTri.Picture.Bitmap; + EditDevieS2.Visible:=true; + Label18.Visible:=true; + Val(s,Adr2,erreur); + formconfig.LabelAdresse.Caption:=formconfig.LabelAdresse.Caption+','+IntToSTR(Adr2); + end + else + // aiguillage normal begin ImageAffiche.Picture.BitMap:=Imageaig.Picture.Bitmap; Edit_HG.Visible:=false; labelHG.Visible:=false; EditP1.Visible:=false; EditP2.Visible:=false; + EditDevieS2.Visible:=false; + Label18.Visible:=false; tjd:=false; end; end; @@ -787,7 +855,7 @@ begin i:=pos(',',s);Delete(s,1,i); traite:=0;nBoucle:=0; - if not(tjd) then + if not(tjd) then repeat if s<>'' then if s[1]='P' then @@ -824,6 +892,17 @@ begin end; inc(nBoucle); until (traite=3) or (nboucle=3); + + // reste S2 pour le tri à traiter + if tri then + begin + i:=pos('S2-',s); + if i<>0 then + begin + delete(s,i,3); + formconfig.EditDevieS2.text:=s; + end; + end; if s='' then with formconfig do @@ -847,6 +926,173 @@ begin RadioButton60kmh.Checked:=true; end; end; + +Procedure aff_champs_sig; +var i,d, ligne, adresse,erreur : integer; + s,ss : string; +begin + with formConfig.MemoSignaux do + begin + ligne:=Perform(EM_LINEFROMCHAR,-1,0); // numéro de la lignée cliquée + s:=Uppercase(Lines[ligne]); + if s='' then exit; + SelStart:=Perform(EM_LINEINDEX,Ligne,0); // début de la sélection + SelLength:=Length(s) ; // fin de la sélection + SetFocus; + end; + + Val(s,Adresse,erreur); + if adresse=0 then exit; + ss:='Signal '+InttoSTr(Adresse); + formconfig.LabelAdrSig.Caption:= ss; + i:=Index_feu(adresse); + with formconfig.ImageSignal do + begin + Picture.Bitmap.TransparentMode:=tmAuto; + Picture.Bitmap.TransparentColor:=clblue; + Transparent:=true; + Picture.BitMap:=feux[i].Img.Picture.Bitmap; + end; + with formconfig do + begin + d:=feux[i].decodeur; + LabelDec.caption:='Décodeur associé : '+decodeur[d]; + d:=feux[i].aspect; + // signal directionnel + if d<10 then + begin + LabelDetAss.caption:='Détecteur associé : '+IntToSTR(feux[i].Adr_det1); + LabelElSuiv.caption:='Element suivant : '+IntToSTR(feux[i].Adr_el_suiv1); + s:='Verrouillable au carré : '; if feux[i].VerrouCarre then s:=s+'oui' else s:=s+'non'; + LabelVerrou.caption:=s; + end + else + begin + LabelDetAss.caption:=''; + LabelElSuiv.caption:=''; + LabelVerrou.caption:=''; + end; + end; + +end; + +Procedure aff_champs_act; +var i,v, ligne,etatact,erreur, adresse,fonction,tempo : integer; + s,s2,ss : string; + trouve : bool; +begin + with formConfig.MemoAct do + begin + ligne:=Perform(EM_LINEFROMCHAR,-1,0); // numéro de la lignée cliquée + s:=Uppercase(Lines[ligne]); + if s='' then exit; + SelStart:=Perform(EM_LINEINDEX,Ligne,0); // début de la sélection + SelLength:=Length(s) ; // fin de la sélection + SetFocus; + end; + + // actionneur passage à niveau + if s[1]='(' then + begin + with formconfig do + begin + GroupBoxact.Visible:=false; + GroupBoxPN.Top:=104; + GroupBoxPN.Visible:=true; + Visible:=true; + RadioButtonPN.Checked:=true; + RadioButtonLoc.Checked:=false; + end; + // trouver l'index dans le tableau + i:=pos('PN(',s); + delete(s,1,i+2); + val(s,adresse,erreur); + i:=0; + repeat + inc(i); + trouve:=(Tablo_PN[i].AdresseFerme=adresse); + until trouve or (i>NbrePN); + if not(trouve) then exit; + + with formConfig do + begin + EditAdrFerme.text:=IntToSTR(Tablo_PN[i].AdresseFerme); + EditAdrOuvre.text:=IntToSTR(Tablo_PN[i].AdresseOuvre); + if Tablo_PN[i].CommandeFerme=2 then s:='+' else s:='-'; + EditCmdFerme.text:=s; + if Tablo_PN[i].CommandeOuvre=2 then s:='+' else s:='-'; + EditCdeOuvre.text:=s; + 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); + EditV2F.Visible:=true; + EditV2O.Visible:=true; + labelV2.Visible:=true; + end; + if v>=3 then + begin + EditV3F.text:=intToSTR(Tablo_PN[i].voie[3].ActFerme); + EditV3O.text:=intToSTR(Tablo_PN[i].voie[3].ActOuvre); + EditV3F.Visible:=true; + EditV3O.Visible:=true; + labelV3.visible:=true; + end; + if v<3 then + begin + EditV3F.Visible:=false; + EditV3O.Visible:=false; + labelV3.visible:=false; + end; + if v<2 then + begin + EditV2F.Visible:=false; + EditV2O.Visible:=false; + labelV2.visible:=false; + end; + end; + end + else + // actionneur fonction F locomotive + begin + with formconfig do + begin + GroupBoxAct.Top:=104; + GroupBoxact.Visible:=true; + GroupBoxPN.Visible:=false; + formconfig.RadioButtonPN.Checked:=false; + formconfig.RadioButtonLoc.Checked:=true; + end; + // trouver l'index dans le tableau + val(s,adresse,erreur); + i:=0; + repeat + inc(i); + trouve:=(Tablo_actionneur[i].actionneur=adresse); + until trouve or (i>MaxTablo_act); + if not(trouve) then exit; + + s:=Tablo_actionneur[i].train; + etatAct:=Tablo_actionneur[i].etat ; + Adresse:=Tablo_actionneur[i].actionneur; + fonction:=Tablo_actionneur[i].fonction; + s2:=Tablo_actionneur[i].train; + tempo:=tablo_actionneur[i].Tempo; + with formconfig do + begin + EditAct.text:=IntToSTR(Adresse); + EditTrain.Text:=s; + editFonction.Text:=intToSTR(fonction); + editEtat.Text:=intToSTR(etatAct); + editTempo.Text:=intToSTR(tempo); + end; + end; + + ss:='Actionneur '+InttoSTr(Adresse); +end; procedure TFormConfig.MemoAigDblClick(Sender: TObject); begin @@ -858,4 +1104,16 @@ begin Aff_champs_aig end; +procedure TFormConfig.MemoSignauxClick(Sender: TObject); +begin + Aff_champs_sig; +end; + +procedure TFormConfig.MemoActClick(Sender: TObject); +begin + Aff_champs_act; +end; + + + end. diff --git a/UnitConfigTCO.dcu b/UnitConfigTCO.dcu index 99adcd4..5beea9a 100644 Binary files a/UnitConfigTCO.dcu and b/UnitConfigTCO.dcu differ diff --git a/UnitConfigTCO.dfm b/UnitConfigTCO.dfm index 8b26ef3..f7e28f3 100644 --- a/UnitConfigTCO.dfm +++ b/UnitConfigTCO.dfm @@ -44,8 +44,8 @@ object FormConfigTCO: TFormConfigTCO Caption = 'Nombre de cellules en vertical:' end object LabelErreur: TLabel - Left = 35 - Top = 144 + Left = 302 + Top = 248 Width = 3 Height = 13 end @@ -111,7 +111,7 @@ object FormConfigTCO: TFormConfigTCO Left = 256 Top = 8 Width = 353 - Height = 217 + Height = 233 Caption = 'Couleurs ' TabOrder = 7 object Label5: TLabel @@ -184,6 +184,34 @@ object FormConfigTCO: TFormConfigTCO Height = 41 OnClick = ImagecantonClick end + object Label10: TLabel + Left = 48 + Top = 208 + Width = 258 + Height = 13 + Caption = 'Cliquez sur l'#39'ic'#244'ne pour changer la couleur de l'#39#233'l'#233'ment' + end + object ImageTexte: TImage + Left = 296 + Top = 16 + Width = 41 + Height = 41 + OnClick = ImageTexteClick + end + object Label11: TLabel + Left = 197 + Top = 24 + Width = 87 + Height = 13 + Caption = 'Couleur des textes' + end + object Label12: TLabel + Left = 240 + Top = 40 + Width = 42 + Height = 13 + Caption = 'statiques' + end end object Memo1: TMemo Left = 8 diff --git a/UnitConfigTCO.pas b/UnitConfigTCO.pas index 85cee01..8784454 100644 --- a/UnitConfigTCO.pas +++ b/UnitConfigTCO.pas @@ -33,6 +33,10 @@ type Memo1: TMemo; Label9: TLabel; Imagecanton: TImage; + Label10: TLabel; + ImageTexte: TImage; + Label11: TLabel; + Label12: TLabel; procedure ButtonOKClick(Sender: TObject); procedure ButtonDessineClick(Sender: TObject); procedure FormActivate(Sender: TObject); @@ -42,6 +46,7 @@ type procedure ImageDetActClick(Sender: TObject); procedure ImagecantonClick(Sender: TObject); procedure ColorDialog1Show(Sender: TObject); + procedure ImageTexteClick(Sender: TObject); private { Déclarations privées } public @@ -112,7 +117,6 @@ begin canvas.Pen.color:=fond; canvas.Brush.Color:=fond; canvas.Rectangle(0,0,Width,Height); - canvas.Brush.Color:=clAllume; canvas.pen.color:=clAllume; @@ -142,6 +146,19 @@ begin canvas.FillRect(r); end; + //6 texte + with formCOnfigTCO.ImageTexte do + begin + canvas.Pen.color:=fond; + canvas.Brush.Color:=fond; + canvas.Rectangle(0,0,Width,Height); + canvas.Font.color:=clTexte; + canvas.Pen.mode:=pmCopy; + canvas.Textout(5,10,'Voie 1'); + + end; + + end; function verif_config_TCO : boolean; // renvoie true si ok @@ -279,10 +296,22 @@ begin end; end; +procedure TFormConfigTCO.ImageTexteClick(Sender: TObject); +begin + titre_couleur:='Changer la couleur du texte'; + if ColorDialog1.execute then + begin + ClTexte:=ColorDialog1.Color; + dessine_icones; + end; +end; + + // change le titre de la fenêtre de choix des couleurs à son ouverture procedure TFormConfigTCO.ColorDialog1Show(Sender: TObject); begin SetWindowText(ColorDialog1.Handle,pchar(titre_couleur)); end; + end. diff --git a/UnitDebug.dcu b/UnitDebug.dcu index 5a5628d..1f23191 100644 Binary files a/UnitDebug.dcu and b/UnitDebug.dcu differ diff --git a/UnitPilote.dcu b/UnitPilote.dcu index 5942732..f6373d6 100644 Binary files a/UnitPilote.dcu and b/UnitPilote.dcu differ diff --git a/UnitPrinc.dcu b/UnitPrinc.dcu index d4b3b10..6350433 100644 Binary files a/UnitPrinc.dcu and b/UnitPrinc.dcu differ diff --git a/UnitPrinc.dfm b/UnitPrinc.dfm index c5afab0..0acceb1 100644 --- a/UnitPrinc.dfm +++ b/UnitPrinc.dfm @@ -1334,10 +1334,10 @@ object FormPrinc: TFormPrinc 00020000802500000000080000000000000000003F00000011000000} end object Panel1: TPanel - Left = 912 - Top = 0 - Width = 273 - Height = 169 + Left = 904 + Top = 5 + Width = 281 + Height = 129 Anchors = [akTop, akRight] TabOrder = 5 object BoutonRaf: TButton @@ -1349,31 +1349,22 @@ object FormPrinc: TFormPrinc TabOrder = 0 OnClick = BoutonRafClick end - object ButtonAffDebug: TButton - Left = 8 - Top = 48 - Width = 89 - Height = 33 - Caption = 'Affiche debug' - TabOrder = 1 - OnClick = ButtonAffDebugClick - end object BoutVersion: TButton Left = 102 Top = 8 Width = 83 Height = 33 Caption = 'Dem version' - TabOrder = 2 + TabOrder = 1 OnClick = BoutVersionClick end object loco: TButton Left = 190 - Top = 8 - Width = 75 + Top = 88 + Width = 83 Height = 33 Caption = 'loco' - TabOrder = 3 + TabOrder = 2 OnClick = locoClick end object ButtonInfo: TButton @@ -1382,28 +1373,28 @@ object FormPrinc: TFormPrinc Width = 81 Height = 33 Caption = 'Informations' - TabOrder = 4 + TabOrder = 3 OnClick = ButtonInfoClick end object ButtonReprise: TButton Left = 190 Top = 48 - Width = 75 + Width = 83 Height = 33 Hint = 'Relance du bus DCC apr'#232's une '#233'criture d'#39'un CV ou une mise hors t' + 'ension de la centrale' Caption = 'Reprise DCC' - TabOrder = 5 + TabOrder = 4 OnClick = ButtonRepriseClick end object ButtonTest: TButton Left = 8 - Top = 88 + Top = 48 Width = 89 Height = 33 Caption = 'Demande '#233'tat r'#233'trosignalisation' - TabOrder = 6 + TabOrder = 5 WordWrap = True OnClick = ButtonTestClick end @@ -1413,26 +1404,26 @@ object FormPrinc: TFormPrinc Width = 81 Height = 33 Caption = 'Arret simulation' - TabOrder = 7 + TabOrder = 6 Visible = False OnClick = ButtonArretSimuClick end object ButtonAffTCO: TButton - Left = 192 + Left = 8 Top = 88 - Width = 73 + Width = 89 Height = 33 Caption = 'Affiche TCO' - TabOrder = 8 + TabOrder = 7 OnClick = ButtonAffTCOClick end object ButtonLanceCDM: TButton - Left = 8 - Top = 128 - Width = 89 + Left = 192 + Top = 8 + Width = 81 Height = 33 Caption = 'Lance CDM rail' - TabOrder = 9 + TabOrder = 8 OnClick = ButtonLanceCDMClick end end @@ -1577,10 +1568,9 @@ object FormPrinc: TFormPrinc Caption = 'Ouvrir un fichier trames CDM' OnClick = OuvrirunfichiertramesCDM1Click end - object Versions1: TMenuItem - Caption = 'Versions' - Hint = 'Versions' - OnClick = Versions1Click + object Affichefentredebug1: TMenuItem + Caption = 'Affiche fen'#234'tre debug' + OnClick = Affichefentredebug1Click end object N1: TMenuItem Caption = '-' diff --git a/UnitPrinc.pas b/UnitPrinc.pas index 72164f9..32b6f1e 100644 --- a/UnitPrinc.pas +++ b/UnitPrinc.pas @@ -61,7 +61,6 @@ type Image6Dir: TImage; Codificationdesfeux1: TMenuItem; Divers1: TMenuItem; - Versions1: TMenuItem; ChronoDetect: TMenuItem; ClientSocketCDM: TClientSocket; FichierSimu: TMenuItem; @@ -78,7 +77,6 @@ type OuvrirunfichiertramesCDM1: TMenuItem; Panel1: TPanel; BoutonRaf: TButton; - ButtonAffDebug: TButton; BoutVersion: TButton; loco: TButton; ButtonInfo: TButton; @@ -92,6 +90,7 @@ type LabelEtat: TLabel; ButtonAffTCO: TButton; ButtonLanceCDM: TButton; + Affichefentredebug1: TMenuItem; procedure FormCreate(Sender: TObject); procedure MSCommUSBLenzComm(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); @@ -124,13 +123,11 @@ type Socket: TCustomWinSocket); procedure ClientSocketCDMRead(Sender: TObject; Socket: TCustomWinSocket); - procedure ButtonAffDebugClick(Sender: TObject); procedure ConnecterCDMrailClick(Sender: TObject); procedure DeconnecterCDMRailClick(Sender: TObject); procedure ClientSocketCDMDisconnect(Sender: TObject; Socket: TCustomWinSocket); procedure Codificationdesfeux1Click(Sender: TObject); - procedure Versions1Click(Sender: TObject); procedure ClientSocketLenzDisconnect(Sender: TObject; Socket: TCustomWinSocket); procedure ChronoDetectClick(Sender: TObject); @@ -146,6 +143,7 @@ type procedure OuvrirunfichiertramesCDM1Click(Sender: TObject); procedure ButtonAffTCOClick(Sender: TObject); procedure ButtonLanceCDMClick(Sender: TObject); + procedure Affichefentredebug1Click(Sender: TObject); private { Déclarations privées } procedure DoHint(Sender : Tobject); @@ -176,7 +174,8 @@ NbCouleurTrain=8; couleurTrain : array[1..NbCouleurTrain] of Tcolor = (clYellow,clLime,clOrange,clAqua,clFuchsia,clLtGray,clred,clWhite); EtatSign : array[0..13] of string[20] =('carré','sémaphore','sémaphore cli','vert','vert cli','violet', 'blanc','blanc cli','jaune','jaune cli','ral 30','ral 60','rappel 30','rappel 60'); - +decodeur : array[0..6] of string[20] =('rien','digital Bahn','CDF','LDT','LEB','NMRA','Unisemaf'); + type TBranche = record BType : integer ; // 1= détecteur 2= aiguillage 3=bis 4=Buttoir Adresse : integer ; // adresse du détecteur ou de l'aiguillage @@ -228,11 +227,10 @@ var ancien_tablo_signalCplx,EtatsignalCplx : array[0..MaxAcc] of word; TraceListe,clignotant,nack,Maj_feux_cours,configNulle,LanceCDM : boolean; CDMhd : THandle; - branche : array [1..100] of string; FormPrinc: TFormPrinc; - ack,portCommOuvert,trace,AffMem,AfficheDet,CDM_connecte,parSocketCDM, + ack,portCommOuvert,trace,AffMem,AfficheDet,CDM_connecte,SocketCDM_connecte, DebugOuv,Raz_Acc_signaux,AvecInit,AvecTCO,terminal,Srvc_Aig,Srvc_Det,Srvc_Act, Srvc_PosTrain,Srvc_Sig : boolean; tablo : array of byte; // tableau rx usb @@ -257,7 +255,7 @@ var ancien_tablo_signalCplx,EtatsignalCplx : array[0..MaxAcc] of word; actionneur,etat,fonction,tempo : integer; train : string; end; - + KeyInputs: array of TInput; Tablo_PN : array[1..20] of record AdresseFerme : integer; // adresse de pilotage DCC pour la fermeture @@ -311,8 +309,6 @@ var ancien_tablo_signalCplx,EtatsignalCplx : array[0..MaxAcc] of word; VerrouCarre : boolean ; // si vrai, le feu se verrouille au carré si pas de train avant le signal EtatSignal : word ; // comme EtatSignalCplx UniSemaf : integer ; // définition supplémentaire de la cible pour les décodeurs UNISEMAF - // pour TCO - indexTCO : integer ; // index du feu dans le tableau FeuTCO AigDirection : array[1..6] of array of record // pour les signaux directionnels : contient la liste des aiguillages associés Adresse : integer; // 6 feux max associés à un tableau dynamique décrivant les aiguillages posAig : char; @@ -345,6 +341,7 @@ procedure connecte_USB; procedure deconnecte_usb; function IsWow64Process: Boolean; procedure Dessine_feu_mx(CanvasDest : Tcanvas;x,y : integer;FrX,frY : real;adresse : integer;orientation : integer); +procedure pilote_acc(adresse : integer;octet : byte;Acc : TAccessoire); implementation @@ -425,6 +422,8 @@ begin end; // dessine les feux sur une cible à 2 feux +// x,y : offset en pixels du coin supérieur gauche du feu +// frX, frY : facteurs de réduction procedure dessine_feu2(Acanvas : Tcanvas;x,y : integer;frX,frY : real;EtatSignal : word;orientation : integer); var Temp,rayon,xViolet,YViolet,xBlanc,yBlanc, LgImage,HtImage : integer; @@ -1415,7 +1414,6 @@ procedure envoie_fonction_CDM(fonction,etat : integer;train : string); var s : string; begin s:=chaine_CDM_Func(fonction,etat,train); - if trace then affiche(s,clLime); envoi_cdm(s); end; @@ -3207,7 +3205,7 @@ end; // de la proc // pilotage d'un signal procedure envoi_signal(Adr : integer); -var i,adresse,a,aspect,x,y,TailleX,TailleY,Orientation : integer; +var i,adresse,a,aspect,x,y,x0,y0,TailleX,TailleY,Orientation : integer; ImageFeu : TImage; frX,frY : real; begin @@ -3231,13 +3229,14 @@ begin // allume les signaux du feu dans le TCO if AvecTCO then begin - for i:=1 to NbFeuTCO do - begin - adresse:=FeuTCO[i].adresse; // vérifie si le feu existe dans le TCO - if adresse<>0 then - begin - a:=EtatsignalCplx[adresse]; // a = état binaire du feu - aspect:=feuTCO[i].aspect; + for y:=1 to NbreCellY do + for x:=1 to NbreCellX do + begin + if TCO[x,y].Bimage=30 then + begin + adresse:=TCO[x,y].adresse; // vérifie si le feu existe dans le TCO + a:=EtatsignalCplx[adresse]; // a = état binaire du feu + aspect:=TCO[x,y].aspect; case aspect of 2 : ImageFeu:=Formprinc.Image2feux; 3 : ImageFeu:=Formprinc.Image3feux; @@ -3247,25 +3246,26 @@ begin 9 : ImageFeu:=Formprinc.Image9feux; else ImageFeu:=Formprinc.Image3feux; end; - x:=(FeuTCO[i].x-1)*LargeurCell; // coordonnées XY et feu - y:=(FeuTCO[i].y-1)*HauteurCell; + x0:=(tco[x,y].x-1)*LargeurCell; // coordonnées XY du feu + y0:=(tco[x,y].y-1)*HauteurCell; TailleY:=ImageFeu.picture.BitMap.Height; // taille du feu d'origine (verticale) TailleX:=ImageFeu.picture.BitMap.Width; - Orientation:=FeuTCO[i].FeuOriente; + Orientation:=TCO[x,y].FeuOriente; // réduction variable en fonction de la taille des cellules calcul_reduction(frx,fry,round(TailleX*LargeurCell/ZoomMax),round(tailleY*HauteurCell/ZoomMax),TailleX,TailleY); // décalage en X pour mettre la tete du feu alignée sur le bord droit de la cellule pour les feux tournés à 90G if orientation=2 then begin - if aspect=9 then x:=x+round(10*frX); - if aspect=7 then x:=x+round(10*frX); - if aspect=5 then begin x:=x+round(10*frX);y:=y+HauteurCell-round(tailleX*frY); end; - if aspect=4 then begin x:=x+round(10*frX);y:=y+HauteurCell-round(tailleX*frY); end; - if aspect=3 then begin x:=x+round(10*frX);y:=y+HauteurCell-round(tailleX*frY); end; - if aspect=2 then begin x:=x+round(10*frX);y:=y+HauteurCell-round(tailleX*frY); end; + if aspect=9 then x0:=x0+round(10*frX); + if aspect=7 then x0:=x0+round(10*frX); + if aspect=5 then begin x0:=x0+round(10*frX);y0:=y0+HauteurCell-round(tailleX*frY); end; + if aspect=4 then begin x0:=x0+round(10*frX);y0:=y0+HauteurCell-round(tailleX*frY); end; + if aspect=3 then begin x0:=x0+round(10*frX);y0:=y0+HauteurCell-round(tailleX*frY); end; + if aspect=2 then begin x0:=x0+round(10*frX);y0:=y0+HauteurCell-round(tailleX*frY); end; end; - Dessine_feu_mx(PCanvasTCO,x,y,frx,fry,adresse,orientation); + // Dessine_feu_mx(PCanvasTCO,x0,y0,frx,fry,adresse,orientation); + Dessine_feu_mx(PCanvasTCO,tco[x,y].x,tco[x,y].y,frx,fry,adresse,orientation); end; end; end; @@ -4156,6 +4156,7 @@ begin if s[1]='+' then Tablo_PN[NbrePN].CommandeOuvre:=2; if s[1]='-' then Tablo_PN[NbrePN].CommandeOuvre:=1; Delete(s,1,1); // supprime ) + inc(maxTablo_act); i:=0; end; if pos('PN',s)<>0 then i:=0; @@ -6756,6 +6757,22 @@ begin CloseHandle(hSnapShot); end; + +// préparation du tampon pour SendInput +procedure KeybdInput(VKey: Byte; Flags: DWORD); +begin + SetLength(KeyInputs, Length(KeyInputs)+1); + KeyInputs[high(KeyInputs)].Itype := INPUT_KEYBOARD; + with KeyInputs[high(KeyInputs)].ki do + begin + wVk:=VKey; + wScan:=MapVirtualKey(wVk, 0); + dwFlags:=Flags; + end; +end; + + + procedure SendKey(Wnd,VK : Cardinal; Ctrl,Alt,Shift : Boolean); var MC,MA,MS : Boolean; @@ -6771,7 +6788,7 @@ begin if Shift<>MS then keybd_event(VK_SHIFT,0,Byte(MS)*KEYEVENTF_KEYUP,0); // Appui sur les touches - keybd_event(VK,0,0,0); + keybd_event(VK,0,0,0); keybd_event(VK,0,KEYEVENTF_KEYUP,0); // keybd_event(MapVirtualKeyA(VK,0),0,0,0); @@ -6814,7 +6831,7 @@ begin '.' : s:=s+#$6e; '/' : s:=s+#$6f; '_' : s:=s+'{8}'; - // '\' : s:=s+#$e2; + // '\' : s:=s+#$e2; 'a'..'z' : s:=s+Upcase(lay[i]); ' ','A'..'Z',#8..#$D : s:=s+lay[i]; else Affiche('Erreur de conversion VK : '+lay,clred); @@ -6823,111 +6840,138 @@ begin convert_VK:=s; end; -// en sortie si Lance_CDM=true, il a été lancé, sinon il était déja lancé. +// Lance et connecte CDM rail. en sortie si CDM est lancé Lance_CDM=true, function Lance_CDM : boolean; var i : integer; s : string; + cdm_lanceLoc : boolean; begin s:='CDR'; - if (ProcessRunning(s)) then begin Lance_CDM:=false;exit;end; + if (ProcessRunning(s)) then + begin + // CDM déja lancé; + Lance_CDM:=true; + if CDM_connecte then exit; + deconnecte_USB; + connecte_CDM; + exit; + end; Affiche('Lancement de CDM '+lay,clyellow); + cdm_lanceLoc:=false; + // lancement depuis le répertoire 32 bits d'un OS64 if ShellExecute(Formprinc.Handle, 'open',PChar('C:\Program Files (x86)\CDM-Rail\cdr.exe'), - Pchar('-f '+lay), // paramètre + Pchar('-f '+lay), // paramètre PChar('C:\Program Files (x86)\CDM-Rail\') // répertoire - ,SW_SHOWNORMAL)<=32 then - begin - // si çà marche pas essayer depuis l'autre répertoire + ,SW_SHOWNORMAL)>32 then + cdm_lanceLoc:=true; + + if not(cdm_lanceLoc) then + begin + // si çà marche pas essayer depuis le répertoire de base sur un OS32 if ShellExecute(Formprinc.Handle, 'open',PChar('C:\Program Files\CDM-Rail\cdr.exe'), - Pchar('-f '+lay), // paramètre + Pchar('-f '+lay), // paramètre PChar('C:\Program Files\CDM-Rail\') // répertoire - ,SW_SHOWNORMAL)<=32 then - begin - ShowMessage('répertoire CDM rail introuvable'); - Lance_CDM:=false;exit; - end - end - - else + ,SW_SHOWNORMAL)<=32 then + begin + ShowMessage('répertoire CDM rail introuvable'); + lance_CDM:=false;exit; + end; + cdm_lanceLoc:=false; + end; + + if cdm_lanceLoc then begin - Sleep(2000); - Application.ProcessMessages; - // démarre le serveur IP : Alt C , return 2 fois - SendKey(CDMHd,ord('C'),false,true,false); - SendKey(CDMHd,ord('C'),false,false,false); - SendKey(CDMHd,VK_RETURN,false,false,false); // ouvre le menu - Sleep(200); // attend l'ouverture de la fenêtre - SendKey(CDMHd,VK_RETURN,false,false,false); // sélectionne le menu démarre le serveur IP - SendKey(CDMHd,VK_RETURN,false,false,false); // acquitte la fentêtre - Sleep(200); + // On a lancé CDM, déconnecter l'USB + deconnecte_USB; + Affiche('lance les fonctions automatiques de CDM',clyellow); + Sleep(3000); + ProcessRunning(s); // récupérer le handle de CDM + SetForegroundWindow(CDMhd); Application.ProcessMessages; - if false then - begin - // Ouvre le fichier réseau : Alt F , Return, O, return - SendKey(CDMHd,ord('F'),false,true,false); - SendKey(CDMHd,VK_RETURN,false,false,false); - SendKey(CDMHd,ord('O'),false,false,false); - SendKey(CDMHd,VK_RETURN,false,false,false); - Sleep(500); // attendre ouverture de la fenêtre - Application.ProcessMessages; - - // ouvre le fichier réseau + // démarre le serveur IP ------------------------------------ + KeybdInput(VK_MENU,0); // enfonce Alt + KeybdInput(Ord('C'),0); // enfonce C + KeybdInput(Ord('C'),KEYEVENTF_KEYUP); // relache C - Affiche('Ouvre '+Lay,clyellow); - s:=convert_VK(LAY); - Sleep(1000); - for i:=1 to length(s) do - SendKey(CDMHd,ord(s[i]),false,false,false); - SendKey(CDMHd,VK_return,false,false,false); - Sleep(2000); - Application.ProcessMessages; - end; + KeybdInput(VK_MENU,KEYEVENTF_KEYUP); // relache ALT - // Serveur d'interface + KeybdInput(Ord('C'),0); + KeybdInput(Ord('C'),KEYEVENTF_KEYUP); + + KeybdInput(VK_RETURN,0); + KeybdInput(VK_RETURN,KEYEVENTF_KEYUP); + KeybdInput(VK_RETURN,0); + KeybdInput(VK_RETURN,KEYEVENTF_KEYUP); + + i:=SendInput(Length(KeyInputs),KeyInputs[0],SizeOf(KeyInputs[0]));SetLength(KeyInputs,0); // la fenetre serveur démarré est affichée + Sleep(300); + + KeybdInput(VK_RETURN,0); + KeybdInput(VK_RETURN,KEYEVENTF_KEYUP); + SendInput(Length(KeyInputs),KeyInputs[0],SizeOf(KeyInputs[0]));SetLength(KeyInputs,0); //fermer la fenetre + Sleep(500); + + connecte_CDM; + Sleep(400); + Application.processMessages; + + // Serveur d'interface -------------------------------------- if ServeurInterfaceCDM>0 then begin - // ALT I 2 fois , Return - SendKey(CDMHd,ord('I'),false,true,false); // Avec Alt - SendKey(CDMHd,ord('I'),false,false,false); // Sans Alt - SendKey(CDMHd,VK_RETURN,false,false,false); // Ouvre le menu - SendKey(CDMHd,VK_RETURN,false,false,false); // Affiche le serveur d'interfaces - Sleep(100); - - // descendre le curseur n fois + KeybdInput(VK_MENU,0); // enfonce ALT + KeybdInput(Ord('I'),0); // I + KeybdInput(Ord('I'),KEYEVENTF_KEYUP); + + KeybdInput(VK_MENU,KEYEVENTF_KEYUP); // relache ALT + KeybdInput(Ord('I'),0); + KeybdInput(Ord('I'),KEYEVENTF_KEYUP); + + KeybdInput(VK_RETURN,0); + KeybdInput(VK_RETURN,KEYEVENTF_KEYUP); + KeybdInput(VK_RETURN,0); + KeybdInput(VK_RETURN,KEYEVENTF_KEYUP); + SendInput(Length(KeyInputs), KeyInputs[0], SizeOf(KeyInputs[0]));SetLength(KeyInputs,0); // affiche la fenetre d'interface + Sleep(300); + + // descendre le curseur n fois pour sélectionner le serveur for i:=1 to ServeurInterfaceCDM-1 do begin - SendKey(CDMHd,VK_DOWN,false,false,false); + KeybdInput(VK_DOWN, 0); + KeybdInput(VK_DOWN, KEYEVENTF_KEYUP); end; // 2x TAB pour pointer sur OK - SendKey(CDMHd,VK_TAB,false,false,false); - SendKey(CDMHd,VK_TAB,false,false,false); - SendKey(CDMHd,VK_RETURN,false,false,false); - Sleep(100); - - // Rétrosignalisation + KeybdInput(VK_TAB, 0);KeybdInput(VK_TAB, KEYEVENTF_KEYUP); + KeybdInput(VK_TAB, 0);KeybdInput(VK_TAB, KEYEVENTF_KEYUP); + KeybdInput(VK_SPACE, 0);KeybdInput(VK_SPACE, KEYEVENTF_KEYUP); + SendInput(Length(KeyInputs), KeyInputs[0], SizeOf(KeyInputs[0]));SetLength(KeyInputs,0); + Sleep(200); + + // Interface if (ServeurInterfaceCDM=1) or (ServeurInterfaceCDM=7) then begin for i:=1 to ServeurRetroCDM-1 do begin - SendKey(CDMHd,VK_DOWN,false,false,false); + KeybdInput(VK_DOWN,0);KeybdInput(VK_DOWN,KEYEVENTF_KEYUP); + SendInput(Length(KeyInputs),KeyInputs[0],SizeOf(KeyInputs[0]));SetLength(KeyInputs,0); end; - // 3x TAB pour pointer sur OK - SendKey(CDMHd,VK_TAB,false,false,false); - SendKey(CDMHd,VK_TAB,false,false,false); - SendKey(CDMHd,VK_TAB,false,false,false); - SendKey(CDMHd,VK_RETURN,false,false,false); - Sleep(100); + // 2x TAB pour pointer sur OK + KeybdInput(VK_TAB,0);KeybdInput(VK_TAB, KEYEVENTF_KEYUP); + KeybdInput(VK_TAB,0);KeybdInput(VK_TAB, KEYEVENTF_KEYUP); + KeybdInput(VK_SPACE,0);KeybdInput(VK_SPACE, KEYEVENTF_KEYUP); // valide la fenetre d'interface + SendInput(Length(KeyInputs), KeyInputs[0], SizeOf(KeyInputs[0]));SetLength(KeyInputs,0); + + Sleep(200); + KeybdInput(VK_RETURN,0);KeybdInput(VK_RETURN, KEYEVENTF_KEYUP); // valide la fenetre finale + SendInput(Length(KeyInputs), KeyInputs[0], SizeOf(KeyInputs[0]));SetLength(KeyInputs,0); end; - end; - Sleep(100); - SendKey(CDMHd,VK_return,false,false,false); // renvoyer un CR - Lance_CDM:=true; - Application.ProcessMessages; - end; -end; + end; + end; + Lance_CDM:=true; +end; procedure TFormPrinc.FormCreate(Sender: TObject); var @@ -6968,8 +7012,9 @@ begin DebugOuv:=True; AvecInit:=true; //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& - Diffusion:=true; - + Diffusion:=AvecInit; + + Application.processMessages; // créée la fenetre vérification de version FormVersion:=TformVersion.Create(Self); @@ -6984,17 +7029,19 @@ begin // Train[1].index:=0; - // lecture fichier de configuration client_GL.cfg et config.cfg + // lecture fichiers de configuration client_GL.cfg et config.cfg lit_config; - // lancer CDM rail si on le demande + // lancer CDM rail et le connecte si on le demande if LanceCDM then Lance_CDM; ButtonAffTCO.visible:=AvecTCO; + Loco.Visible:=not(Diffusion); - // tenter la liaison vers CDM rail ou vers la centrale Lenz - //Affiche('Test présence CDM',clYellow); - connecte_CDM; - if not(CDM_connecte) then // si CDM est connecté, on n'ouvre pas de liaison vers la centrale + // tenter la liaison vers CDM rail + if not(CDM_connecte) then connecte_CDM; + + // si CDM n'est pas connecté, on ouvre la liaison vers la centrale + if not(CDM_connecte) then begin Affiche('CDM absent - Ouverture liaison vers centrale Lenz',clYellow); // ouverture par USB @@ -7130,7 +7177,7 @@ end; // timer à 100 ms procedure TFormPrinc.Timer1Timer(Sender: TObject); -var index,aspect,i,a,x,y,adresse,TailleX,TailleY,orientation : integer; +var index,aspect,i,a,x,y,x0,y0,Bimage,adresse,TailleX,TailleY,orientation : integer; imageFeu : Timage; frx,fry : real; s : string; @@ -7156,12 +7203,12 @@ begin if temps>0 then dec(temps); - // gestion du clignotant des feux + // gestion du clignotant des feux de la page principale if tempsCli>0 then dec(tempsCli); if tempsCli=0 then begin tempsCli:=5; - clignotant:=not(clignotant); + clignotant:=not(clignotant); // inversion du clignotant //tester chaque feu pour voir s'il y a un code de clignotement for i:=1 to NbreFeux do begin @@ -7170,57 +7217,47 @@ begin if TestBit(a,jaune_cli) or TestBit(a,ral_60) or TestBit(a,rappel_60) or testBit(a,semaphore_cli) or testBit(a,vert_cli) or testbit(a,blanc_cli) then - begin - //Affiche(IntToSTR(adresse),clOrange); - Dessine_feu_mx(Feux[i].Img.Canvas,0,0,1,1,adresse,1); - end; + begin + //Affiche(IntToSTR(adresse),clOrange); + Dessine_feu_mx(Feux[i].Img.Canvas,0,0,1,1,adresse,1); + end; end; // feux du TCO if avecTCO then begin // parcourir les feux du TCO - for i:=1 to NbFeuTCO do + for y:=1 to NbreCellY do + for x:=1 to NbreCellX do begin - adresse:=FeuTCO[i].adresse; - if adresse<>0 then + PcanvasTCO.pen.mode:=pmCOpy; + BImage:=TCO[x,y].bImage; + if Bimage=30 then begin + adresse:=TCO[x,y].adresse; a:=EtatsignalCplx[adresse]; // a = état binaire du feu if TestBit(a,jaune_cli) or TestBit(a,ral_60) or TestBit(a,rappel_60) or testBit(a,semaphore_cli) or testBit(a,vert_cli) or testbit(a,blanc_cli) then begin - aspect:=feuTCO[i].aspect; - case aspect of - 2 : ImageFeu:=Formprinc.Image2feux; - 3 : ImageFeu:=Formprinc.Image3feux; - 4 : ImageFeu:=Formprinc.Image4feux; - 5 : ImageFeu:=Formprinc.Image5feux; - 7 : ImageFeu:=Formprinc.Image7feux; - 9 : ImageFeu:=Formprinc.Image9feux; - else ImageFeu:=Formprinc.Image3feux; - end; - - x:=(FeuTCO[i].x-1)*LargeurCell; // coordonnées XY et feu - y:=(FeuTCO[i].y-1)*HauteurCell; - TailleY:=ImageFeu.picture.BitMap.Height; // taille du feu d'origine (verticale) - TailleX:=ImageFeu.picture.BitMap.Width; - Orientation:=FeuTCO[i].FeuOriente; - // réduction variable en fonction de la taille des cellules - calcul_reduction(frx,fry,round(TailleX*LargeurCell/ZoomMax),round(tailleY*HauteurCell/ZoomMax),TailleX,TailleY); - - // décalage en X pour mettre la tete du feu alignée sur le bord droit de la cellule pour les feux tournés à 90G - if orientation=2 then - begin - if aspect=9 then x:=x+round(10*frX); - if aspect=7 then x:=x+round(10*frX); - if aspect=5 then begin x:=x+round(10*frX);y:=y+HauteurCell-round(tailleX*frY); end; - if aspect=4 then begin x:=x+round(10*frX);y:=y+HauteurCell-round(tailleX*frY); end; - if aspect=3 then begin x:=x+round(10*frX);y:=y+HauteurCell-round(tailleX*frY); end; - if aspect=2 then begin x:=x+round(10*frX);y:=y+HauteurCell-round(tailleX*frY); end; - end; - Dessine_feu_mx(PCanvasTCO,x,y,frx,fry,adresse,orientation); + aspect:=TCO[x,y].aspect; + case aspect of + 2 : ImageFeu:=Formprinc.Image2feux; + 3 : ImageFeu:=Formprinc.Image3feux; + 4 : ImageFeu:=Formprinc.Image4feux; + 5 : ImageFeu:=Formprinc.Image5feux; + 7 : ImageFeu:=Formprinc.Image7feux; + 9 : ImageFeu:=Formprinc.Image9feux; + else ImageFeu:=Formprinc.Image3feux; end; + + TailleY:=ImageFeu.picture.BitMap.Height; // taille du feu d'origine (verticale) + TailleX:=ImageFeu.picture.BitMap.Width; + Orientation:=TCO[x,y].FeuOriente; + // réduction variable en fonction de la taille des cellules + calcul_reduction(frx,fry,round(TailleX*LargeurCell/ZoomMax),round(tailleY*HauteurCell/ZoomMax),TailleX,TailleY); + Dessine_feu_mx(PCanvasTCO,tco[x,y].x,tco[x,y].y,frx,fry,adresse,orientation); + end; end; end; end; @@ -7442,11 +7479,11 @@ end; procedure deconnecte_usb; begin - Ferme:=true; - if portCommOuvert then + if portCommOuvert then begin portCommOuvert:=false; - Formprinc.MSCommUSBLenz.Portopen:=false; + Formprinc.MSCommUSBLenz.Portopen:=false; + Affiche('Port USB déconnecté',clyellow); end; portCommOuvert:=false; @@ -7457,7 +7494,7 @@ begin DeConnecterUSB.enabled:=false; ConnecterCDMRail.enabled:=true; DeConnecterCDMRail.enabled:=false; - end; + end; end; procedure TFormPrinc.DeconnecterUSBClick(Sender: TObject); @@ -7602,7 +7639,7 @@ begin LabelTitre.caption:=titre+' '+s; Affiche(s,clYellow); AfficheDebug(s,clYellow); - parSocketCDM:=True; + SocketCDM_connecte:=True; MenuConnecterUSB.enabled:=false; DeConnecterUSB.enabled:=false; ConnecterCDMRail.enabled:=false; @@ -7810,18 +7847,13 @@ procedure TFormPrinc.ClientSocketCDMRead(Sender: TObject;Socket: TCustomWinSocke s,ss,train : string; traite,sort : boolean; begin - inc(Nbre_recu_cdm); + inc(Nbre_recu_cdm); recuCDM:=ClientSocketCDM.Socket.ReceiveText; if trace then begin Affiche('recu de CDM:',clWhite);Affiche(recuCDM,clWhite);end; Interprete_trameCDM(recuCDM); end; -procedure TFormPrinc.ButtonAffDebugClick(Sender: TObject); -begin - formDebug.show; -end; - procedure TFormPrinc.ConnecterCDMrailClick(Sender: TObject); begin connecte_CDM; @@ -7838,6 +7870,7 @@ begin Affiche('CDM rail déconnecté',Cyan); AfficheDebug('CDM rail déconnecté',Cyan); CDM_connecte:=False; + SocketCDM_connecte:=false; MenuConnecterUSB.enabled:=true; DeConnecterUSB.enabled:=true; ConnecterCDMRail.enabled:=true; @@ -7888,10 +7921,6 @@ begin end; end; -procedure TFormPrinc.Versions1Click(Sender: TObject); -begin - Affiche('Signaux complexes version '+Version,clLime); -end; procedure TFormPrinc.ClientSocketLenzDisconnect(Sender: TObject; Socket: TCustomWinSocket); @@ -8112,9 +8141,9 @@ begin if (maxTablo_act=0) and (NbrePN=0) then begin Affiche('Aucun actionneur déclaré',clYellow); + exit; end; - for i:=1 to maxTablo_act do begin s:=Tablo_actionneur[i].train; @@ -8190,16 +8219,15 @@ end; procedure TFormPrinc.ButtonLanceCDMClick(Sender: TObject); begin - if Lance_CDM then connecte_CDM; + Lance_CDM ; end; +procedure TFormPrinc.Affichefentredebug1Click(Sender: TObject); +begin + formDebug.show; +end; begin - - - - - end. diff --git a/UnitSimule.dcu b/UnitSimule.dcu index 5afbcb1..33ca9cb 100644 Binary files a/UnitSimule.dcu and b/UnitSimule.dcu differ diff --git a/UnitTCO.dcu b/UnitTCO.dcu index 1cdeea3..23968f5 100644 Binary files a/UnitTCO.dcu and b/UnitTCO.dcu differ diff --git a/UnitTCO.dfm b/UnitTCO.dfm index b297272..f4df491 100644 --- a/UnitTCO.dfm +++ b/UnitTCO.dfm @@ -23,7 +23,7 @@ object FormTCO: TFormTCO OnResize = FormResize DesignSize = ( 1123 - 656) + 655) PixelsPerInch = 96 TextHeight = 13 object LabelX: TLabel @@ -123,6 +123,7 @@ object FormTCO: TFormTCO PopupMenu = PopupMenu1 OnClick = ImageTCOClick OnContextPopup = ImageTCOContextPopup + OnDblClick = ImageTCODblClick OnDragOver = ImageTCODragOver OnMouseDown = ImageTCOMouseDown OnMouseMove = ImageTCOMouseMove @@ -870,13 +871,6 @@ object FormTCO: TFormTCO end object PopupMenu1: TPopupMenu Left = 360 - object Annulercouper: TMenuItem - Caption = 'Annuler couper' - OnClick = AnnulercouperClick - end - object N5: TMenuItem - Caption = '-' - end object MenuCouper: TMenuItem Caption = 'Couper' OnClick = MenuCouperClick @@ -889,6 +883,13 @@ object FormTCO: TFormTCO Caption = 'Coller' OnClick = MenuCollerClick end + object N5: TMenuItem + Caption = '-' + end + object Annulercouper: TMenuItem + Caption = 'Annuler couper' + OnClick = AnnulercouperClick + end object N1: TMenuItem Caption = '-' end diff --git a/UnitTCO.pas b/UnitTCO.pas index 7577b01..1f16006 100644 --- a/UnitTCO.pas +++ b/UnitTCO.pas @@ -247,6 +247,7 @@ type procedure EditAdrElementKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure ButtonConstruitClick(Sender: TObject); + procedure ImageTCODblClick(Sender: TObject); private { Déclarations privées } @@ -267,30 +268,24 @@ type TTCO = array[1..MaxCellX] of array[1..MaxCellY] of record BType : integer ; // 1= détecteur 2= aiguillage 3=bis 4=Buttoir Adresse : integer ; // adresse du détecteur ou de l'aiguillage ou du feu - IndexFeu : integer ; // index du feu dans le tableau FeuTCO BImage : integer ; // 0=rien 1=voie 2=aiguillage gauche gauche ... 30=feu mode : integer; // 0=éteint 1=allumé inverse : boolean; // aiguillage piloté inversé Texte : string[30]; - //FeuAspect : integer; // aspect du feu (2 feux...9 feux) - //FeuOriente : integer ; // orientation du feu : 1 vertical en bas / 2 horizontal gauche / 3 horizontal droit + couleurTexte : Tcolor; + // pour les feux seulement PiedFeu : integer; // type de pied au feu - end; - - // Feux du TCO - TfeuTCO = array[1..50] of record - Adresse : integer ; // adresse du feu; - x,y : integer ; // coordonnées pixels - FeuOriente : integer; - PiedFeu : integer; - Aspect : integer; + x,y : integer ; // coordonnées pixels relativés du coin sup gauche pour le décalage par rapport à la cellule + FeuOriente : integer; // orientation du feu : 1 vertical en bas / 2 horizontal gauche / 3 horizontal droit + Aspect : integer; // aspect du feu (2 feux...9 feux) end; var - clAllume,clVoies,Fond,couleurAdresse,clGrille : Tcolor; + clAllume,clVoies,Fond,couleurAdresse,clGrille,cltexte : Tcolor; FormTCO: TFormTCO; - Forminit,sourisclic,SelectionAffichee,TamponAffecte,entoure,Diffusion,TCO_modifie : boolean; + Forminit,sourisclic,SelectionAffichee,TamponAffecte,entoure,Diffusion,TCO_modifie, + piloteAig : boolean; HtImageTCO,LargImageTCO,XclicCell,YclicCell,XminiSel,YminiSel,XCoupe,Ycoupe, XmaxiSel,YmaxiSel,AncienXMiniSel,AncienXMaxiSel ,AncienYMiniSel,AncienYMaxiSel, Xclic,Yclic,XClicCellInserer,YClicCellInserer,Xentoure,Yentoure, @@ -301,8 +296,6 @@ var TamponTCO_Org : record x1,y1,x2,y2 : integer; end; - FeuTCO : TFeuTCO; - NbFeuTCO : integer; rAncien : TRect; PCanvasTCO : Tcanvas; PBitMapTCO : TBitMap; @@ -349,7 +342,7 @@ begin NbreCellX:=28;NbreCellY:=13;LargeurCell:=30;HauteurCell:=30; exit; end; - x:=1;y:=1;NbreCellX:=0;NbreCellY:=0;NbFeuTCO:=0; + x:=1;y:=1;NbreCellX:=0;NbreCellY:=0; // couleurs s:=lit_ligne; @@ -360,9 +353,12 @@ begin val('$'+s,clAllume,erreur); s:=lit_ligne; val('$'+s,clGrille,erreur); + s:=lit_ligne; + + if pos(',',s)=0 then begin val('$'+s,cltexte,erreur);s:=lit_ligne;end; + // taille de la matrice - s:=lit_ligne; Val(s,NbreCellX,erreur); delete(s,1,erreur); Val(s,NbreCellY,erreur); @@ -424,34 +420,30 @@ begin val(copy(s,1,i-1),PiedFeu,erreur); if erreur<>0 then begin closefile(fichier);exit;end; if s[i]=',' then delete(s,1,i) else delete(s,1,i-1); - // si c'est un feu, remplir tableau feux + // si c'est un feu, remplir les paramètres du feu if tco[x,y].Bimage=30 then begin - inc(NbFeuTCO); - //Affiche(intToSTR(tco[x,y].Adresse),clyellow); i:=index_feu(adresse); if i<>0 then begin aspect:=Feux[i].aspect; //Affiche('Feu '+IntToSTR(Adresse)+' aspect='+intToSTR(aspect),clyellow); - Feux[i].indexTCO:=NbFeuTCO; - FeuTCO[NbFeuTCO].Aspect:=aspect; + tco[x,y].Aspect:=aspect; + tco[x,y].FeuOriente:=FeuOriente; + tco[x,y].x:=0; + tco[x,y].y:=0; + TCO[x,y].PiedFeu:=PiedFeu; end; - FeuTCO[NbFeuTCO].Adresse:=adresse; - FeuTCO[NbFeuTCO].FeuOriente:=FeuOriente; - FeuTCO[NbFeuTCO].x:=x; - FeuTCO[NbFeuTCO].y:=y; - FeuTCO[NbFeuTCO].PiedFeu:=PiedFeu; - - TCO[x,y].IndexFeu:=NbFeuTCO; - TCO[x,y].PiedFeu:=PiedFeu; + end; - // texte + // texte optionnel j:=pos(')',s); begin if j>1 then // le , est avant le ) donc il y a un peut-etre un texte - tco[x,y].Texte:=copy(s,1,j-1) + begin + tco[x,y].Texte:=copy(s,1,j-1) ; + end else tco[x,y].Texte:=''; delete(s,1,j); @@ -466,7 +458,7 @@ begin inc(y);x:=1; end; closefile(fichier); - Affiche('Dimensions du tco : '+intToSTR(NbreCellX)+'x'+intToSTR(NbreCellY)+' NbeFeuxTCO='+IntToSTR(NbFeuTCO),clyellow); + Affiche('Dimensions du tco : '+intToSTR(NbreCellX)+'x'+intToSTR(NbreCellY),clyellow); end; @@ -477,11 +469,12 @@ var fichier : textfile; begin AssignFile(fichier,'tco.cfg'); rewrite(fichier); - Writeln(fichier,'/ Couleurs : fond, voies, détecteur_activé, grille'); + Writeln(fichier,'/ Couleurs : fond, voies, détecteur_activé, grille, textes'); Writeln(fichier,IntToHex(fond,6)); Writeln(fichier,IntToHex(ClVoies,6)); Writeln(fichier,IntToHex(ClAllume,6)); Writeln(fichier,IntToHex(ClGrille,6)); + Writeln(fichier,IntToHex(ClTexte,6)); writeln(fichier,'/ Taille de la matrice x,y'); writeln(fichier,IntToSTR(NbreCellX)+','+intToSTR(NbreCellY)); @@ -500,8 +493,7 @@ begin if TCO[x,y].BImage=30 then begin - i:=TCO[x,y].IndexFeu; - s:=s+IntToSTR(FeuTCO[i].FeuOriente)+','+IntToSTR(TCO[x,y].PiedFeu)+','; + s:=s+IntToSTR(TCO[x,y].FeuOriente)+','+IntToSTR(TCO[x,y].PiedFeu)+','; end else s:=s+'0,0,'; // texte @@ -552,6 +544,7 @@ begin with canvas do begin Brush.Color:=Fond; + Pen.Mode:=pmCopy; r:=Rect(x0,y0,x0+LargeurCell,y0+HauteurCell); FillRect(r); @@ -563,7 +556,6 @@ begin begin Brush.Color:=clAllume; pen.color:=clAllume; - Pen.Mode:=pmCopy; jy1:=y0+(HauteurCell div 2)-round(6*frYGlob); // pos Y de la bande sup jy2:=y0+(HauteurCell div 2)+round(6*frYGlob); // pos Y de la bande inf r:=Rect(x0+1,jy1,x0+LargeurCell-1,jy2); @@ -1071,6 +1063,22 @@ begin r:=Rect(x0,y0,x0+LargeurCell,y0+HauteurCell); FillRect(r); + Adr:=TCO[x,y].adresse; + if Adr<>0 then + begin + if detecteur[Adr] then + begin + Brush.Color:=clAllume; + pen.color:=clAllume; + Pen.Mode:=pmCopy; + x1:=x0;y1:=y0+hauteurCell-round(6*FryGlob); + x2:=x0+largeurCell-round(6*FrXGlob);y2:=y0+1; + x3:=x0+largeurCell-1;y3:=y0+round(9*FrYGlob); + x4:=x0+round(9*FrXGlob); y4:=y0+hauteurCell-1; + PolyGon([point(x1,y1),point(x2,y2),point(x3,y3),point(x4,y4)]); + end; + end; + x1:=x0;y1:=y0+hauteurCell-round(3*FryGlob); x2:=x0+largeurCell-round(3*FrXGlob);y2:=y0; x3:=x0+largeurCell;y3:=y0+round(4*FrYGlob); @@ -1081,6 +1089,9 @@ begin pen.color:=couleur; PolyGon([point(x1,y1),point(x2,y2),point(x3,y3),point(x4,y4)]); + + + end; end; @@ -1100,6 +1111,22 @@ begin r:=Rect(x0,y0,x0+LargeurCell,y0+HauteurCell); FillRect(r); + Adr:=TCO[x,y].adresse; + if Adr<>0 then + begin + if detecteur[Adr] then + begin + Brush.Color:=clAllume; + pen.color:=clAllume; + Pen.Mode:=pmCopy; + x1:=x0+round(6*FrXGlob);y1:=y0; + x2:=x0+largeurCell-1;y2:=y0+HauteurCell-round(6*FrYGlob)-1; + x3:=x0+largeurCell-round(8*FrXGlob)-1;y3:=y0+HauteurCell-1; + x4:=x0;y4:=y0+round(8*frYGlob); + PolyGon([point(x1,y1),point(x2,y2),point(x3,y3),point(x4,y4)]); + end; + end; + x1:=x0+round(3*FrXGlob);y1:=y0; x2:=x0+largeurCell;y2:=y0+HauteurCell-round(3*FrYGlob); x3:=x0+largeurCell-round(4*FrXGlob);y3:=y0+HauteurCell; @@ -1609,13 +1636,12 @@ end; // Element 20 procedure TFormTCO.dessin_20(Canvas : Tcanvas;x,y,mode: integer); -var x0,y0,x1,y1,x2,y2,x3,y3,x4,y4,xbv1,xbv2 : integer; +var x0,y0,x1,y1,x2,y2,x3,y3,x4,y4,xbv1,xbv2,adr : integer; r : Trect; begin x0:=(x-1)*LargeurCell; y0:=(y-1)*HauteurCell; - xbv1:=x0+(LargeurCell div 2)-round(3*frXGlob); // pos x de la bande verticale - xbv2:=x0+(LargeurCell div 2)+round(3*frXGlob); // pos x de la bande verticale + with canvas do begin @@ -1623,17 +1649,33 @@ begin r:=Rect(x0,y0,x0+LargeurCell,y0+HauteurCell); FillRect(r); + Adr:=TCO[x,y].adresse; + if Adr<>0 then + begin + if detecteur[Adr] then + begin + Brush.Color:=clAllume; + pen.color:=clAllume; + Pen.Mode:=pmCopy; + xbv1:=x0+(LargeurCell div 2)-round(6*frXGlob); // pos x de la bande verticale + xbv2:=x0+(LargeurCell div 2)+round(6*frXGlob); // pos x de la bande verticale + r:=Rect(xbv1,y0,xbv2,y0+HauteurCell); + FillRect(r); + end; + end; + if mode=1 then couleur:=clAllume else couleur:=clVoies; Brush.COlor:=Couleur; pen.color:=Couleur; Pen.Mode:=pmCopy; - + xbv1:=x0+(LargeurCell div 2)-round(3*frXGlob); // pos x de la bande verticale + xbv2:=x0+(LargeurCell div 2)+round(3*frXGlob); // pos x de la bande verticale r:=Rect(xbv1,y0,xbv2,y0+HauteurCell); FillRect(r); end; end; -// Element 21 +// Element 21 - croisement - TJD procedure TFormTCO.dessin_21(Canvas : Tcanvas;x,y,mode: integer); var x0,y0,x1,y1,x2,y2,x3,y3,x4,y4,jy1,jy2 : integer; r : Trect; @@ -2129,20 +2171,18 @@ end; // Dessine un feu dans le canvas en x,y , dont l'adresse se trouve à la cellule x,y procedure dessin_feu(CanvasDest : Tcanvas;x,y : integer ); -var OffsetX,x0,y0,orientation,adresse,i,aspect,TailleX,TailleY,NbCellDest : integer; +var OffsetX,x0,y0,xp,yp,orientation,adresse,i,aspect,TailleX,TailleY,NbCellDest : integer; ImageFeu : Timage; frX,frY : real; begin - x0:=(x-1)*LargeurCell; - y0:=(y-1)*HauteurCell; + xp:=(x-1)*LargeurCell; + yp:=(y-1)*HauteurCell; Adresse:=TCO[x,y].Adresse; - - i:=TCO[x,y].indexfeu; // index du feu dans le tableau feuTCO - Orientation:=feuTCO[i].FeuOriente; + Orientation:=TCO[x,y].FeuOriente; if Orientation=0 then Orientation:=1; // cas d'un feu non encore renseigné - aspect:=feuTCO[i].aspect; + aspect:=TCO[x,y].aspect; // Affiche(IntToSTR(i)+' '+intToSTR(aspect),clred); offsetX:=0; @@ -2162,27 +2202,43 @@ begin // réduction variable en fonction de la taille des cellules. 50 est le Zoom Maxi calcul_reduction(frx,fry,round(TailleX*LargeurCell/ZoomMax),round(tailleY*HauteurCell/ZoomMax),TailleX,TailleY); + if orientation=3 then + begin + x0:=0;y0:=0; + x0:=x0+xp;y0:=y0+yp; + tco[x,y].x:=x0; + tco[x,y].y:=y0; + end; + // décalage en X pour mettre la tete du feu alignée sur le bord droit de la cellule pour les feux tournés à 90G if orientation=2 then begin - if aspect=9 then x0:=x0+round(10*frX); - if aspect=7 then x0:=x0+round(10*frX); - if aspect=5 then begin x0:=x0+round(10*frX); y0:=y0+HauteurCell-round(tailleX*frY); end; - if aspect=4 then begin x0:=x0+round(10*frX); y0:=y0+HauteurCell-round(tailleX*frY); end; - if aspect=3 then begin x0:=x0+round(10*frX); y0:=y0+HauteurCell-round(tailleX*frY); end; - if aspect=2 then begin x0:=x0+round(10*frX); y0:=y0+HauteurCell-round(tailleX*frY); end; + if aspect=9 then begin x0:=round(10*frX); y0:=HauteurCell-round(tailleX*frY);end; + if aspect=7 then begin x0:=round(10*frX); y0:=HauteurCell-round(tailleX*frY);end; + if aspect=5 then begin x0:=round(10*frX); y0:=HauteurCell-round(tailleX*frY); end; + if aspect=4 then begin x0:=round(10*frX); y0:=HauteurCell-round(tailleX*frY); end; + if aspect=3 then begin x0:=round(10*frX); y0:=HauteurCell-round(tailleX*frY); end; + if aspect=2 then begin x0:=round(10*frX); y0:=HauteurCell-round(tailleX*frY); end; + x0:=x0+xp;y0:=y0+yp; + tco[x,y].x:=x0; + tco[x,y].y:=y0; end; // décalage en X pour mettre rapprocher le feu du le bord droit de la cellule pour les feux verticaux if orientation=1 then begin - if aspect=5 then begin x0:=x0+round(25*frX); y0:=y0+HauteurCell-round(tailleX*frY); end; - if aspect=4 then begin x0:=x0+round(25*frX); y0:=y0+HauteurCell-round(tailleX*frY); end; - if aspect=3 then begin x0:=x0+round(25*frX); y0:=y0+HauteurCell-round(tailleX*frY); end; - if aspect=2 then begin x0:=x0+round(25*frX); y0:=y0+HauteurCell-round(tailleX*frY); end; + if aspect=9 then begin x0:=0; y0:=0; end; + if aspect=7 then begin x0:=0; y0:=0; end; + if aspect=5 then begin x0:=round(25*frX); y0:=HauteurCell-round(tailleY*frY); end; + if aspect=4 then begin x0:=round(25*frX); y0:=HauteurCell-round(tailleY*frY); end; + if aspect=3 then begin x0:=round(25*frX); y0:=HauteurCell-round(tailleY*frY); end; + if aspect=2 then begin x0:=round(25*frX); y0:=HauteurCell-round(tailleY*frY); end; + x0:=x0+xp;y0:=y0+yp; + tco[x,y].x:=x0; + tco[x,y].y:=y0; end; - // orientation verticale + // affichage du feu et du pied - orientation verticale if (Orientation=1) then begin // copie avec mise à l'échelle de l'image du feu @@ -2197,7 +2253,7 @@ begin if aspect=2 then affiche_pied_Vertical2G(x0,y0,frX,frY); end; - // orientation 90°G + // affichage du feu et du pieds - orientation 90°G if Orientation=2 then begin Feu_90G(ImageFeu,x0,y0,frX,frY); // ici on passe l'origine du feu @@ -2213,7 +2269,7 @@ begin end; - // orientation 90°D + // affichage du feu et du pied - orientation 90°D if Orientation=3 then begin Feu_90D(ImageFeu,x0,y0,frX,frY); @@ -2331,19 +2387,17 @@ begin mode:=tco[x,y].mode; // récupérer la position de l'aiguillage - if (bImage>=2) and (btype<=14) then + if (bImage>=2) and (btype<=15) then begin if Adresse<>0 then pos:=Aiguillage[adresse].position else pos:=9; end; - Xorg:=(x-1)*LargeurCell; Yorg:=(y-1)*HauteurCell; s:=IntToSTR(adresse); - i:=Tco[x,y].IndexFeu; - if y>1 then if (tco[x,y-1].Bimage=30) and (FeuTCO[i].FeuOriente=1) then exit; + // pourquoi ? ? if y>1 then if (tco[x,y-1].Bimage=30) and (FeuTCO[i].FeuOriente=1) then exit; case Bimage of // 0 : efface_cellule(PCanvasTCO,x,y,Clyellow,Mode); &&&&&&&&& @@ -2377,7 +2431,7 @@ begin // Affiche(intToSTR( (LargeurCell div 30)+6),clyellow); // affiche le texte des aiguillages - if (BImage>=2) and (BImage<29) and (adresse<>0) then + 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)) and (adresse<>0) then begin if Btype<>3 then s:='A'+s else s:='A'+s+'B'; with PCanvasTCO do @@ -2388,31 +2442,51 @@ begin if Bimage=4 then begin x:=1;y:=1;end; if Bimage=5 then begin x:=1;y:=HauteurCell-round(20*fryGlob);end; if Bimage=12 then begin x:=1;y:=HauteurCell-round(20*frYGlob);end; - if Bimage=22 then begin x:=LargeurCell-round(30*frxGlob);y:=1;end; + if Bimage=21 then begin x:=2;y:=1;end; + if Bimage=22 then begin x:=1;y:=HauteurCell-round(15*frYGlob);end; TextOut(xOrg+x,yOrg+y,s); exit; end; end; // détecteurs - if (BImage=1) and (adresse<>0) then + if ((BImage=1) ) and (adresse<>0) then begin // Adresse de l'élément with PCanvasTCO do begin Brush.Color:=fond; Font.Color:=clWhite; - TextOut(xOrg+round(15*frXGlob),yOrg+round(2*fryGlob),s); + x:=round(15*frXGlob);y:=HauteurCell-round(17*frYGlob); + TextOut(xOrg+x,yOrg+y,s); + exit; + end; + end; + if ((Bimage=10) or (Bimage=20)) and (adresse<>0) then + begin // Adresse de l'élément + with PCanvasTCO do + begin + Brush.Color:=fond; + Font.Color:=clWhite; + TextOut(xOrg+round(2*frXGlob),yOrg+round(2*fryGlob),s); + exit; + end; + end; + if (Bimage=11) and (adresse<>0) then + begin // Adresse de l'élément + with PCanvasTCO do + begin + Brush.Color:=fond; + Font.Color:=clWhite; + TextOut(xOrg+round(28*frXGlob),yOrg+round(2*fryGlob),s); exit; end; end; - // texte des signaux + // adresse des signaux if (BImage=30) and (adresse<>0) then begin - i:=tco[x,y].IndexFeu; - if i=0 then exit; - aspect:=feuTCO[i].aspect; - oriente:=Feutco[i].FeuOriente; + aspect:=TCO[x,y].Aspect; + oriente:=TCO[x,y].FeuOriente; x:=0;y:=0; if (aspect=9) and (Oriente=1) then begin x:=LargeurCell-round(25*frXGlob);y:=2*HauteurCell-round(25*fryGlob);end; if (aspect=9) and (Oriente=2) then begin x:=round(10*frXGlob);y:=HauteurCell-round(17*frYGlob);end; // orientation G @@ -2420,16 +2494,16 @@ begin if (aspect=7) and (Oriente=1) then begin x:=LargeurCell-round(25*frXGlob);y:=2*HauteurCell-round(25*fryGlob);;end; if (aspect=7) and (Oriente=2) then begin x:=round(10*frXGlob);y:=HauteurCell-round(15*frYGlob);end; if (aspect=7) and (Oriente=3) then begin x:=LargeurCell+2;y:=1;end; - if (aspect=5) and (Oriente=1) then begin x:=round(24*frXGlob);y:=1;end; + if (aspect=5) and (Oriente=1) then begin x:=1;y:=1;end; if (aspect=5) and (Oriente=2) then begin x:=round(10*frXGlob);y:=round(2*frYGlob);end; if (aspect=5) and (Oriente=3) then begin x:=round(10*frXGlob);y:=HauteurCell-round(22*frYGlob);end; - if (aspect=4) and (Oriente=1) then begin x:=LargeurCell-18;y:=1;end; + if (aspect=4) and (Oriente=1) then begin x:=1;y:=1;end; if (aspect=4) and (Oriente=2) then begin x:=round(10*frXGlob);y:=round(2*frYGlob);end; if (aspect=4) and (Oriente=3) then begin x:=round(10*frXGlob);y:=HauteurCell-round(22*frYGlob);end; - if (aspect=3) and (Oriente=1) then begin x:=LargeurCell-18;y:=1;end; + if (aspect=3) and (Oriente=1) then begin x:=1;y:=1;end; if (aspect=3) and (Oriente=2) then begin x:=round(10*frXGlob);y:=round(2*frYGlob);end; if (aspect=3) and (Oriente=3) then begin x:=round(10*frXGlob);y:=HauteurCell-round(22*frYGlob);end; - if (aspect=2) and (Oriente=1) then begin x:=LargeurCell-round(18*frXGlob);y:=1;end; // orientation V + if (aspect=2) and (Oriente=1) then begin x:=1;y:=1;end; // orientation V if (aspect=2) and (Oriente=2) then begin x:=round(10*frXGlob);y:=round(2*frYGlob);end; // orientation G if (aspect=2) and (Oriente=3) then begin x:=round(10*frXGlob);y:=HauteurCell-round(22*frYGlob);end; // orientation D with PCanvasTCO do @@ -2459,13 +2533,14 @@ begin r:=Rect(x0,y0,x0+largeurCell,y0+LargeurCell); Rectangle(r); Pen.width:=1; + Pen.Mode:=PmCopy; // FillRect(r); end; end; procedure efface_entoure; begin - if (entoure) then + if (entoure) then begin Entoure_cell(Xentoure,Yentoure); entoure:=false; @@ -2527,11 +2602,14 @@ begin for y:=1 to NbreCellY do for x:=1 to NbreCellX do begin - if TCO[x,y].BImage<>30 then affiche_cellule(x,y); + if TCO[x,y].BImage<>30 then + begin + affiche_cellule(x,y); + end; end; PCanvasTCO.Font.Size:=8; - //afficher les cellules des feux pour que les pieds recouvrent le reste et afficher les textes + //afficher les cellules des feux et les textes pour que les pieds recouvrent le reste et afficher les textes for y:=1 to NbreCellY do for x:=1 to NbreCellX do begin @@ -2541,6 +2619,10 @@ begin begin x0:=(x-1)*Largeurcell; y0:=(y-1)*hauteurcell; + //PCanvasTCO.Brush.Style:=bsSolid; + PCanvasTCO.Brush.Color:=fond; + //PCanvasTCO.pen.color:=clyellow; + PcanvasTCO.Font.Color:=clTexte; PcanvasTCO.Textout(x0+2,y0+1,s); end; end; @@ -2573,6 +2655,7 @@ begin ImageTCO.Canvas.font.Name:='Arial'; clAllume:=clYellow; clVoies:=clOrange; + clTexte:=ClLime; clGrille:=$404040; // évite le clignotement pendant les affichages DoubleBuffered:=true; @@ -2582,10 +2665,11 @@ end; // clic gauche sur image procedure TFormTCO.ImageTCOClick(Sender: TObject); var Position: TPoint; - i ,adresse,Bimage : integer; + i,j ,adresse,Bimage : integer; s : string; menuItem: TmenuItem; begin + //Affiche('1 Clic',clyellow); GetCursorPos(Position); { Menuitem:=TmenuItem.Create(popupMenu1); @@ -2603,24 +2687,23 @@ begin if YclicCell>NbreCellY then exit; Bimage:=tco[XClicCell,YClicCell].Bimage; + // si aiguillage, mettre à jour l'option de pilotage inverse if (bimage=2) or (bimage=3) or (bimage=4) or (bimage=5) or (bimage=12) or (bimage=13) or (bimage=14) or (bimage=15) then begin - CheckPinv.enabled:=true ; - CheckPinv.checked:=TCO[XClicCell,YClicCell].inverse; + CheckPinv.enabled:=true ; + CheckPinv.checked:=TCO[XClicCell,YClicCell].inverse; end - else CheckPinv.enabled:=false; - - if not(selectionaffichee) then _entoure_cell_clic; + else CheckPinv.enabled:=false; if (Bimage=1) or (Bimage=0) then begin s:=Tco[XClicCell,YClicCell].Texte; - EditTexte.Text:=s; + EditTexte.Text:=s; EditTexte.Visible:=true end else EditTexte.Visible:=false; - + LabelX.caption:=IntToSTR(XclicCell); LabelY.caption:=IntToSTR(YclicCell); XclicCellInserer:=XClicCell; @@ -2628,22 +2711,10 @@ begin EditAdrElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].Adresse); EdittypeElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].BType); - EdittypeImage.Text:=IntToSTR(BImage); - if Bimage=30 then //feu - begin - Adresse:=tco[XClicCellInserer,YClicCellInserer].Adresse; - i:=Index_Feu(adresse); - end; - - - //Affiche('XClicCell='+intToSTR(XclicCell)+' '+'YClicCell='+intToSTR(YclicCell),clyellow); - //Affiche('Evt ImageTCOclick',clYellow); + + if not(selectionaffichee) then _entoure_cell_clic; end; - - - - // trouve le détecteur det dans le TCO et renvoie X et Y procedure trouve_det(det : integer;var x,y : integer); @@ -2899,6 +2970,8 @@ begin ImageTemp.Visible:=not(Diffusion); SourisX.Visible:=not(Diffusion); SourisY.Visible:=not(Diffusion); + ButtonConstruit.Visible:=not(Diffusion); + ButtonAfficheBandeau.visible:=false; PScrollBoxTCO:=FormTCO.ScrollBox; @@ -3625,9 +3698,63 @@ end; procedure TFormTCO.MenuCouperClick(Sender: TObject); var Position: TPoint; r : Trect; - x0,y0,x,y,XCell1,YCell1,xCell2,yCell2 : integer; + Adresse,x0,y0,x,y,XCell1,YCell1,xCell2,yCell2,i,j : integer; begin - if not(SelectionAffichee) then exit; + // couper sans sélection : on coupe une seule cellule + if not(SelectionAffichee) then + begin + if tco[XclicCell,YClicCell].Bimage=30 then + begin + // si c'est un feu, le supprimer dans le tableau FeuTCO + + // i:=tco[XclicCell,YClicCell].indexFeuTCO; + // affiche('Index='+IntToSTR(i),clyellow); + // for j:=i+1 to NbfeuTCO do + // begin + // FeuTCO[j-1]:=FeuTco[j]; + // Affiche(IntToSTR(j-1)+'<-'+IntTostr(j),clyellow); + // end; + // dec(NbFeuTCO); + + // mettre à jour l'index dans le tableau des feux + { + for i:=1 to NbfeuTCO do + begin + Adresse:=feuTCO[i].Adresse; + j:=Index_feu(adresse); + feux[j].indexTCO:=i; + end; + + // et remettre à jour les index du tabloTCO + for y:=1 to NbreCellY do + for x:=1 to NbreCellX do + begin + if TCO[x,y].BImage=30 then + begin + Adresse:=TCO[x,y].adresse; + j:=Index_feu(adresse); + TCO[x,y].IndexFeuTCO:=feux[j].indexTCO; + end; + end; + if NbfeuTCO>2 then dec(NbfeuTCO); + } + end; + + tamponTCO[XclicCell,YclicCell]:=tco[XclicCell,YclicCell]; // pour pouvoir faire annuler couper + TamponTCO_org.x1:=XclicCell;TamponTCO_org.y1:=YclicCell; + TamponTCO_org.x2:=XclicCell;TamponTCO_org.y2:=YclicCell; + + tco[XclicCell,YClicCell].BType:=0; + tco[XclicCell,YClicCell].Adresse:=0; + tco[XclicCell,YClicCell].Bimage:=0; + efface_entoure; + efface_cellule(ImageTCO.Canvas,XclicCell,YClicCell,fond,PmCopy); + TamponAffecte:=true; + xCoupe:=XclicCell;yCoupe:=YclicCell; + + Affiche_tco; + exit; + end; TCO_modifie:=true; copier; @@ -3646,16 +3773,18 @@ begin tco[x,y].Adresse:=0; tco[x,y].BImage:=0; //Affiche('Efface cellules '+IntToSTR(X)+' '+intToSTR(y),clyellow); + efface_entoure; efface_cellule(ImageTCO.Canvas,X,Y,fond,PmCopy); if avecGrille then grille; end; end; procedure TFormTCO.AnnulercouperClick(Sender: TObject); -var x,y,Xplace,yplace : integer; +var x,y,Xplace,yplace,i,j,adresse : integer; begin if TamponAffecte then begin + if (xCoupe<>0) and (ycoupe<>0) then begin for y:=TamponTCO_Org.y1 to TamponTCO_Org.y2 do // rectangle de la sélection @@ -3663,8 +3792,17 @@ begin begin xPlace:=xCoupe+x-TamponTCO_Org.x1; // destination yPlace:=yCoupe+y-TamponTCO_Org.y1; - if (xPlace<=NbreCellX) and (yPlace<=NbreCellY) then tco[xPlace,yPlace]:=tamponTCO[x,y]; + if (xPlace<=NbreCellX) and (yPlace<=NbreCellY) then + begin + tco[xPlace,yPlace]:=tamponTCO[x,y]; + if tco[xPlace,yPlace].Bimage=30 then + begin + adresse:=tco[xPlace,yPlace].Adresse; + j:=Index_feu(adresse); + end; + end; end; + end; end; Affiche_TCO; @@ -3703,7 +3841,7 @@ begin Xclic:=position.X; YClic:=position.Y; - // coordonnées grilleg + // coordonnées grille XclicCell:=Xclic div largeurCell + 1; YclicCell:=Yclic div hauteurCell + 1; @@ -3773,6 +3911,8 @@ begin Rectangle(rAncien); end; + if piloteAig then begin SelectionAffichee:=false;piloteAig:=false;SourisClic:=false;exit;end; + r:=Rect(xminiSel+1,YminiSel+1,XmaxiSel+largeurCell,yMaxiSel+hauteurCell); XSel1:=Xminisel div largeurCell + 1; @@ -3804,9 +3944,6 @@ begin end; - - - procedure TFormTCO.ButtonRedessineClick(Sender: TObject); begin Affiche_TCO; @@ -3814,7 +3951,7 @@ end; // changement de l'adresse d'un élément procedure TFormTCO.EditAdrElementChange(Sender: TObject); -var Adr,erreur,i,index : integer; +var Adr,erreur,i,index,aspect : integer; begin Val(EditAdrElement.Text,Adr,erreur); if (erreur<>0) or (Adr<0) or (Adr>2048) then @@ -3826,21 +3963,15 @@ begin tco[XClicCell,YClicCell].Adresse:=Adr; //Affiche('Chgt adresse',clyellow); - // si c'est un feu, mettre à jour le tableau FeuTCO if tco[XClicCell,YClicCell].BImage=30 then begin index:=Index_feu(adr); - if index=0 then - begin - //affiche('Erreur feu inexistant',clred) - exit; - end + if index=0 then exit else begin //Affiche('Feu '+intToSTR(Adr),clyellow); - i:=tco[XClicCell,YClicCell].IndexFeu; - FeuTCO[i].Aspect:=Feux[index].aspect; - FeuTCO[i].Adresse:=Adr; + Aspect:=Feux[index].Aspect; + tco[XClicCell,YClicCell].aspect:=aspect; affiche_tco; //affiche_cellule(XClicCell,YClicCell,pmCopy); end; @@ -3851,7 +3982,9 @@ end; procedure TFormTCO.EditAdrElementKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin - if key=VK_RETURN then affiche_cellule(XClicCell,YClicCell); + if key=VK_RETURN then + efface_entoure; + affiche_cellule(XClicCell,YClicCell); end; procedure TFormTCO.EditTypeImageKeyPress(Sender: TObject; var Key: Char); @@ -3861,7 +3994,7 @@ begin begin Key:=#0; // évite beeping Val(EditTypeImage.Text,Bimage,erreur); - // Affiche(IntToSTR(bimage),clyellow); + //Affiche('Keypressed / Bimage='+IntToSTR(bimage),clyellow); if (erreur<>0) or (Bimage<0) or (Bimage>15) then begin EditTypeImage.text:=intToSTR(tco[XClicCell,YClicCell].BImage); @@ -3871,9 +4004,9 @@ begin tco[XClicCell,YClicCell].Bimage:=Bimage; case Bimage of // aiguillages - 1,2,3,4,13,14,15 : tco[XClicCell,YClicCell].Btype:=2; + 2,3,4,5,12,13,14,15 : tco[XClicCell,YClicCell].Btype:=2; // détecteur ou voie - 5 : tco[XClicCell,YClicCell].Btype:=1; + 1,10,11,20 : tco[XClicCell,YClicCell].Btype:=1; else tco[XClicCell,YClicCell].Btype:=0; end; @@ -3913,7 +4046,6 @@ var i : integer; begin if (x=0) and (y=0) then exit; TCO_modifie:=true; - inc(NbFeuTCO); Xclic:=X;YClic:=Y; XclicCell:=Xclic div largeurCell +1; YclicCell:=Yclic div hauteurCell +1; @@ -3921,12 +4053,10 @@ begin tco[XClicCell,YClicCell].BType:=0; // rien tco[XClicCell,YClicCell].BImage:=10; // image 10 tco[XClicCell,YClicCell].Adresse:=0; - tco[XClicCell,YClicCell].IndexFeu:=NbFeuTCO; - Feutco[NbFeuTCO].FeuOriente:=1; + tco[XClicCell,YClicCell].FeuOriente:=1; _entoure_cell_clic; - FeuTCO[NbFeuTCO].Adresse:=0; - FeuTCO[NbFeuTCO].x:=XClicCell; - FeuTCO[NbFeuTCO].y:=YClicCell; + tco[XClicCell,YClicCell].x:=0; // XClicCell; //?? + tco[XClicCell,YClicCell].y:=0; // YClicCell; //?? EditAdrElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Adresse); EdittypeElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Btype); @@ -3984,10 +4114,12 @@ begin tco[XClicCell,YClicCell].BType:=0; // rien tco[XClicCell,YClicCell].BImage:=30; tco[XClicCell,YClicCell].Adresse:=0; - inc(NbFeuTCO); - tco[XClicCell,YClicCell].indexFeu:=NbFeuTCO; - FeuTco[NbFeuTCO].FeuOriente:=1; - FeuTco[NbFeuTCO].Aspect:=9; + tco[XClicCell,YClicCell].FeuOriente:=1; + tco[XClicCell,YClicCell].Aspect:=9; + tco[XClicCell,YClicCell].x:=0; + tco[XClicCell,YClicCell].y:=0; + + // ne pas convertir l'adresse sinon evt changement du composant et on écrase l'aspect EditAdrElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Adresse); EdittypeElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Btype); EdittypeImage.Text:=IntToSTR(tco[XClicCell,YClicCell].BImage); @@ -4005,7 +4137,7 @@ end; procedure TFormTCO.Tourner90GClick(Sender: TObject); -var BImage,aspect,adresse,index : integer; +var BImage,aspect,adresse : integer; ImageFeu : TImage; frX,frY : real; begin @@ -4014,35 +4146,34 @@ begin TCO_modifie:=true; adresse:=TCO[XClicCell,YClicCell].Adresse; - index:=TCO[XClicCell,YClicCell].indexFeu; // effacement de l'ancien feu - if FeuTCO[index].FeuOriente=3 then + if tco[XClicCell,YClicCell].FeuOriente=3 then begin Efface_Cellule(PCanvasTCO,xClicCell,yClicCell,fond,PmCopy); Efface_Cellule(PCanvasTCO,xClicCell+1,yClicCell,fond,PmCopy); end; - if FeuTCO[index].FeuOriente=2 then + if tco[XClicCell,YClicCell].FeuOriente=2 then begin Efface_Cellule(PCanvasTCO,xClicCell,yClicCell,fond,PmCopy); Efface_Cellule(PCanvasTCO,xClicCell-1,yClicCell,fond,PmCopy); end; // si l'image était verticale, il faut effacer la cellule en bas - if FeuTCO[index].FeuOriente=1 then + if tco[XClicCell,YClicCell].FeuOriente=1 then begin Efface_Cellule(PCanvasTCO,xClicCell,yClicCell,fond,PmCopy); Efface_Cellule(PCanvasTCO,xClicCell,yClicCell+1,fond,PmCopy); end; - FeuTCO[index].FeuOriente:=2; // feu orienté à 90° gauche + tco[XClicCell,YClicCell].FeuOriente:=2; // feu orienté à 90° gauche dessin_feu(PCanvasTCO,XclicCell,YClicCell); end; procedure TFormTCO.Tourner90DClick(Sender: TObject); -var BImage ,aspect,adresse,index : integer; +var BImage ,aspect,adresse : integer; ImageFeu : TImage; frX,frY : real; begin @@ -4051,38 +4182,37 @@ begin TCO_modifie:=true; adresse:=TCO[XClicCell,YClicCell].Adresse; - index:=TCO[XClicCell,YClicCell].indexFeu; - aspect:=FeuTCO[index].aspect; + aspect:=tco[XClicCell,YClicCell].aspect; if aspect=0 then aspect:=9; // ancien feu orienté orienté 90D - if FeuTCO[index].FeuOriente=3 then + if tco[XClicCell,YClicCell].FeuOriente=3 then begin Efface_Cellule(PCanvasTCO,xClicCell,yClicCell,fond,PmCopy); if aspect>=4 then Efface_Cellule(PCanvasTCO,xClicCell+1,yClicCell,fond,PmCopy); end; // ancien feu orienté orienté 90G - if FeuTCO[index].FeuOriente=2 then + if tco[XClicCell,YClicCell].FeuOriente=2 then begin Efface_Cellule(PCanvasTCO,xClicCell,yClicCell,fond,PmCopy); if aspect>=4 then Efface_Cellule(PCanvasTCO,xClicCell+1,yClicCell,fond,PmCopy); end; // si l'image était verticale, il faut effacer la cellule en bas - if FeuTCO[index].FeuOriente=1 then + if tco[XClicCell,YClicCell].FeuOriente=1 then begin Efface_Cellule(PCanvasTCO,xClicCell,yClicCell,fond,PmCopy); Efface_Cellule(PCanvasTCO,xClicCell,yClicCell+1,fond,PmCopy); end; - FeuTCO[index].FeuOriente:=3; // feu orienté à 90° droit + tco[XClicCell,YClicCell].FeuOriente:=3; // feu orienté à 90° droit dessin_feu(PCanvasTCO,XclicCell,YClicCell); end; procedure TFormTCO.Pos_vertClick(Sender: TObject); -var BImage ,aspect,index,Adresse : integer; +var BImage ,aspect,Adresse : integer; ImageFeu : TImage; begin BImage:=TCO[XClicCell,YClicCell].Bimage; @@ -4091,14 +4221,13 @@ begin TCO_modifie:=true; adresse:=TCO[XClicCell,YClicCell].Adresse; - index:=TCO[XClicCell,YClicCell].indexFeu; - aspect:=feuTCO[index].aspect; + aspect:=tco[XClicCell,YClicCell].aspect; if aspect=0 then aspect:=9; // effacement de l'ancien feu // ancien feu orienté orienté 90D - if FeuTCO[index].FeuOriente=3 then + if tco[XClicCell,YClicCell].FeuOriente=3 then begin Efface_Cellule(PCanvasTCO,xClicCell,yClicCell,fond,PmCopy); // si le feu occupe 2 cellules @@ -4106,7 +4235,7 @@ begin end; // ancien feu orienté orienté 90G - if FeuTCO[index].FeuOriente=2 then + if tco[XClicCell,YClicCell].FeuOriente=2 then begin Efface_Cellule(PCanvasTCO,xClicCell,yClicCell,fond,PmCopy); // si le feu occupe 2 cellules @@ -4114,13 +4243,13 @@ begin end; // si l'image était verticale, il faut effacer la cellule en bas - if FeuTCO[index].FeuOriente=1 then + if tco[XClicCell,YClicCell].FeuOriente=1 then begin Efface_Cellule(PCanvasTCO,xClicCell,yClicCell,fond,PmCopy); Efface_Cellule(PCanvasTCO,xClicCell,yClicCell+1,fond,PmCopy); end; - FeuTCO[index].FeuOriente:=1; // feu orienté à 180° + tco[XClicCell,YClicCell].FeuOriente:=1; // feu orienté à 180° dessin_feu(PCanvasTCO,XclicCell,YClicCell); end; @@ -4145,12 +4274,12 @@ var x0,y0 : integer; begin x0:=(XClicCell-1)*LargeurCell; y0:=(YClicCell-1)*HauteurCell; - + PCanvasTCO.Brush.Color:=fond; + PcanvasTCO.Font.Color:=clTexte; PCanvasTCO.TextOut(x0+2,y0+2,EditTexte.Text); Tco[XClicCell,YClicCell].Texte:=EditTexte.Text; TCO_modifie:=true; end; - procedure TFormTCO.ButtonSimuClick(Sender: TObject); begin @@ -4213,9 +4342,69 @@ begin construit_TCO; end; +procedure TFormTCO.ImageTCODblClick(Sender: TObject); +var Bimage,Adresse,aspect,i : integer; + Msgdlg: Tform; + Result : TModalResult; +begin + Bimage:=Tco[xClicCell,yClicCell].BImage; + Adresse:=TCO[xClicCell,yClicCell].Adresse; + + // commande 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) then + begin + Msgdlg:=createMessageDialog('Pilotage de l''aiguillage '+IntToSTR(Adresse), mtCustom,[MbYes,mbNo,MbCancel]); + with Msgdlg do + begin + caption:='Aiguillage'; + BiDiMode := bdRightToLeft; + ( FindComponent('Yes') as TButton).Caption:='droit'; + ( FindComponent('No') as TButton).Caption:='dévié'; + end; + Result:=Msgdlg.ShowModal; + if Result=MrYes then begin efface_entoure;SelectionAffichee:=false;pilote_acc(adresse,2,aig);end; // droit + if Result=MrNo then begin efface_entoure;SelectionAffichee:=false;pilote_acc(adresse,1,aig);end; // dévié + + sourisclic:=false; // évite de générer un cadre de sélection:=false; + piloteAig:=true; + end; + + // commande de signal + if Bimage=30 then + begin + + if adresse=0 then exit; + AdrPilote:=adresse; + i:=Index_feu(adresse); + if i=0 then exit; + TFormPilote.Create(Self); + with formPilote do + begin + show; + ImagePilote.top:=40;ImagePilote.left:=220; + ImagePilote.Parent:=FormPilote; + ImagePilote.Picture.Bitmap.TransparentMode:=tmAuto; + ImagePilote.Picture.Bitmap.TransparentColor:=clblue; + ImagePilote.Transparent:=true; + + ImagePilote.Picture.BitMap:=feux[i].Img.Picture.Bitmap; + LabelTitrePilote.Caption:='Pilotage du signal '+intToSTR(Adresse); + EtatSignalCplx[0]:=EtatSignalCplx[Adresse]; + LabelNbFeux.Visible:=False; + EditNbreFeux.Visible:=false; + GroupBox1.Visible:=true; + GroupBox2.Visible:=true; + sourisclic:=false; // évite de générer un cadre de sélection + end; + end; +end; + begin + + end. diff --git a/verif_version.pas b/verif_version.pas index 5df51ba..8d72b10 100644 --- a/verif_version.pas +++ b/verif_version.pas @@ -23,7 +23,7 @@ var Lance_verif : integer; verifVersion,notificationVersion : boolean; -Const Version='1.71'; //Version='1.2';// sert à la comparaison de la version publiée +Const Version='1.74'; //Version='1.2';// sert à la comparaison de la version publiée implementation diff --git a/versions.txt b/versions.txt index a483657..78cad20 100644 --- a/versions.txt +++ b/versions.txt @@ -16,7 +16,7 @@ Version 1.41 : Gestion des passages Version 1.42 : Correction erreur lecture signaux Version 1.43 : Correction erreur gestion sémaphore Version 1.44 : Gestion trains avec voitures éclairées -Version 1.45 : Rejette les n° d'objets supérieurs aiguillages à la même adresse +Version 1.45 : Rejette les n° d'objets supérieurs aiguillages à la même adresse pour le bug des aiguillages BIS de CDM Version 1.5 : Nouvel algorithme de suivi des trains - Gestion des feux provenant de voies en buttoir Version 1.6 : Implémentation du TCO. Ouverture de CDM rail au démarrage avec LAY à la demande Version 1.7 : Sauvegarde de la configuration dans les fichier client_gl.cfg et config.cfg si modification des paramètres depuis le menu de configuration. @@ -24,4 +24,13 @@ Version 1.7 : Sauvegarde de la configuration dans les fichier client_gl.cfg et version 1.71 : correction d'un bug de la v1.7 sur le protocole COM/USB direct à l'interface version 1.72 : affichage message si configuration erronnée dans la fenêtre de configuration - Démarrage de CDM assuré pour les répertoires Program Files et Program Files (x86) +version 1.73 : Amélioration du couper du TCO - Ajout de détecteurs sur les élements de voies 1 10 11 et 20 pour le TCO + Affichage d'aide sur les éléments décrits dans le panneau de configuration +version 1.74 : Amélioration des affichages du TCO - Pilotage des aiguillages depuis le TCO - Amélioration du séquençage d'ouverture de CDM Rail + + + + + +