diff --git a/Notice d'utilisation des signaux_complexes_GL_V8.6.pdf b/Notice d'utilisation des signaux_complexes_GL_V8.7.pdf similarity index 77% rename from Notice d'utilisation des signaux_complexes_GL_V8.6.pdf rename to Notice d'utilisation des signaux_complexes_GL_V8.7.pdf index 932de91..0ebdbf6 100644 Binary files a/Notice d'utilisation des signaux_complexes_GL_V8.6.pdf and b/Notice d'utilisation des signaux_complexes_GL_V8.7.pdf differ diff --git a/Signaux_complexes_GL.cfg b/Signaux_complexes_GL.cfg index 8d97c47..bcc5ab2 100644 --- a/Signaux_complexes_GL.cfg +++ b/Signaux_complexes_GL.cfg @@ -14,8 +14,8 @@ -$N+ -$O- -$P+ --$Q- --$R- +-$Q+ +-$R+ -$S- -$T- -$U- diff --git a/Signaux_complexes_GL.dof b/Signaux_complexes_GL.dof index d194579..da70fe3 100644 --- a/Signaux_complexes_GL.dof +++ b/Signaux_complexes_GL.dof @@ -17,8 +17,8 @@ M=0 N=1 O=0 P=1 -Q=0 -R=0 +Q=1 +R=1 S=0 T=0 U=0 @@ -130,3 +130,5 @@ OriginalFilename= ProductName= ProductVersion=8.1.0.0 Comments= +[Excluded Packages] +c:\program files (x86)\borland\delphi7\Projects\Bpl\DsgnCPort8.bpl=ComPort Library diff --git a/Signaux_complexes_GL.dpr b/Signaux_complexes_GL.dpr index f042365..6009071 100644 --- a/Signaux_complexes_GL.dpr +++ b/Signaux_complexes_GL.dpr @@ -21,7 +21,8 @@ uses MSCommLib_TLB in 'MSCommLib_TLB.pas', UnitHorloge in 'UnitHorloge.pas' {FormHorloge}, UnitFicheHoraire in 'UnitFicheHoraire.pas' {FormFicheHoraire}, - UnitClock in 'UnitClock.pas' {FormClock}; + UnitClock in 'UnitClock.pas' {FormClock}, + UnitModifAction in 'UnitModifAction.pas' {FormModifAction}; {$R *.res} @@ -46,6 +47,7 @@ begin Application.CreateForm(TFormVersion, FormVersion); Application.CreateForm(TFormClock, FormClock); Application.CreateForm(TFormHorloge, FormHorloge); + Application.CreateForm(TFormModifAction, FormModifAction); fin_preliminaire; Application.Run; end. diff --git a/Signaux_complexes_GL.map b/Signaux_complexes_GL.map index 17e2dfb..f8f1dea 100644 --- a/Signaux_complexes_GL.map +++ b/Signaux_complexes_GL.map @@ -1,108 +1,110 @@ Start Length Name Class - 0001:00000000 00186E4CH .text CODE - 0002:00000000 00002D10H .data DATA - 0002:00002D10 045EDA31H .bss BSS + 0001:00000000 001C19ACH .text CODE + 0002:00000000 00002D30H .data DATA + 0002:00002D30 045EEF79H .bss BSS Detailed map of segments - 0001:00000000 00005EFF C=CODE S=.text G=(none) M=System ACBP=A9 - 0001:00005F00 00000140 C=CODE S=.text G=(none) M=SysInit ACBP=A9 - 0001:00006040 00000108 C=CODE S=.text G=(none) M=Types ACBP=A9 - 0001:00006148 00000F20 C=CODE S=.text G=(none) M=Windows ACBP=A9 - 0001:00007068 00000038 C=CODE S=.text G=(none) M=Messages ACBP=A9 - 0001:000070A0 00000338 C=CODE S=.text G=(none) M=SysConst ACBP=A9 - 0001:000073D8 00006F74 C=CODE S=.text G=(none) M=SysUtils ACBP=A9 - 0001:0000E34C 0000081B C=CODE S=.text G=(none) M=VarUtils ACBP=A9 - 0001:0000EB68 0000804E C=CODE S=.text G=(none) M=Variants ACBP=A9 - 0001:00016BB8 000001A0 C=CODE S=.text G=(none) M=RTLConsts ACBP=A9 - 0001:00016D58 0000083C C=CODE S=.text G=(none) M=TypInfo ACBP=A9 - 0001:00017594 00000358 C=CODE S=.text G=(none) M=ActiveX ACBP=A9 - 0001:000178EC 0000A7EA C=CODE S=.text G=(none) M=Classes ACBP=A9 - 0001:000220D8 00000370 C=CODE S=.text G=(none) M=Consts ACBP=A9 - 0001:00022448 00009BFB C=CODE S=.text G=(none) M=Graphics ACBP=A9 - 0001:0002C044 00000124 C=CODE S=.text G=(none) M=Math ACBP=A9 - 0001:0002C168 000002B8 C=CODE S=.text G=(none) M=Contnrs ACBP=A9 - 0001:0002C420 00000198 C=CODE S=.text G=(none) M=CommCtrl ACBP=A9 - 0001:0002C5B8 00000787 C=CODE S=.text G=(none) M=MultiMon ACBP=A9 - 0001:0002CD40 00000038 C=CODE S=.text G=(none) M=Imm ACBP=A9 - 0001:0002CD78 00000FF8 C=CODE S=.text G=(none) M=HelpIntfs ACBP=A9 - 0001:0002DD70 00000058 C=CODE S=.text G=(none) M=WinSpool ACBP=A9 - 0001:0002DDC8 000010C8 C=CODE S=.text G=(none) M=Printers ACBP=A9 - 0001:0002EE90 0000031F C=CODE S=.text G=(none) M=FlatSB ACBP=A9 - 0001:0002F1B0 000003F0 C=CODE S=.text G=(none) M=SyncObjs ACBP=A9 - 0001:0002F5A0 000009BB C=CODE S=.text G=(none) M=UxTheme ACBP=A9 - 0001:0002FF5C 00000038 C=CODE S=.text G=(none) M=RichEdit ACBP=A9 - 0001:0002FF94 00000038 C=CODE S=.text G=(none) M=ToolWin ACBP=A9 - 0001:0002FFCC 00000040 C=CODE S=.text G=(none) M=ShellAPI ACBP=A9 - 0001:0003000C 00000038 C=CODE S=.text G=(none) M=RegStr ACBP=A9 - 0001:00030044 00000058 C=CODE S=.text G=(none) M=WinInet ACBP=A9 - 0001:0003009C 00000038 C=CODE S=.text G=(none) M=UrlMon ACBP=A9 - 0001:000300D4 0000006C C=CODE S=.text G=(none) M=ShlObj ACBP=A9 - 0001:00030140 00000060 C=CODE S=.text G=(none) M=CommDlg ACBP=A9 - 0001:000301A0 00000038 C=CODE S=.text G=(none) M=Dlgs ACBP=A9 - 0001:000301D8 000036D1 C=CODE S=.text G=(none) M=Dialogs ACBP=A9 - 0001:000338AC 00004ADA C=CODE S=.text G=(none) M=ExtCtrls ACBP=A9 - 0001:00038388 00000090 C=CODE S=.text G=(none) M=ComStrs ACBP=A9 - 0001:00038418 000007A0 C=CODE S=.text G=(none) M=Clipbrd ACBP=A9 - 0001:00038BB8 00000128 C=CODE S=.text G=(none) M=StrUtils ACBP=A9 - 0001:00038CE0 00003821 C=CODE S=.text G=(none) M=Buttons ACBP=A9 - 0001:0003C504 00000038 C=CODE S=.text G=(none) M=ExtDlgs ACBP=A9 - 0001:0003C53C 00000068 C=CODE S=.text G=(none) M=IniFiles ACBP=A9 - 0001:0003C5A4 00000068 C=CODE S=.text G=(none) M=Registry ACBP=A9 - 0001:0003C60C 0000006C C=CODE S=.text G=(none) M=Mapi ACBP=A9 - 0001:0003C678 00000058 C=CODE S=.text G=(none) M=ExtActns ACBP=A9 - 0001:0003C6D0 00000038 C=CODE S=.text G=(none) M=ListActns ACBP=A9 - 0001:0003C708 00009948 C=CODE S=.text G=(none) M=ComCtrls ACBP=A9 - 0001:00046050 00000EA0 C=CODE S=.text G=(none) M=Themes ACBP=A9 - 0001:00046EF0 0000C698 C=CODE S=.text G=(none) M=StdCtrls ACBP=A9 - 0001:00053588 00000168 C=CODE S=.text G=(none) M=StdActns ACBP=A9 - 0001:000536F0 00000D1F C=CODE S=.text G=(none) M=WinHelpViewer ACBP=A9 - 0001:00054410 00011403 C=CODE S=.text G=(none) M=Controls ACBP=A9 - 0001:00065814 00001292 C=CODE S=.text G=(none) M=ActnList ACBP=A9 - 0001:00066AA8 00001C04 C=CODE S=.text G=(none) M=ImgList ACBP=A9 - 0001:000686AC 000066E1 C=CODE S=.text G=(none) M=Menus ACBP=A9 - 0001:0006ED90 0000CF8C C=CODE S=.text G=(none) M=Forms ACBP=A9 - 0001:0007BD1C 00000050 C=CODE S=.text G=(none) M=JConsts ACBP=A9 - 0001:0007BD6C 000133EC C=CODE S=.text G=(none) M=jpeg ACBP=A9 - 0001:0008F158 00000060 C=CODE S=.text G=(none) M=ComConst ACBP=A9 - 0001:0008F1B8 00001259 C=CODE S=.text G=(none) M=ComObj ACBP=A9 - 0001:00090414 00000038 C=CODE S=.text G=(none) M=StdVCL ACBP=A9 - 0001:0009044C 00001793 C=CODE S=.text G=(none) M=AxCtrls ACBP=A9 - 0001:00091BE0 00000060 C=CODE S=.text G=(none) M=OleConst ACBP=A9 - 0001:00091C40 00003519 C=CODE S=.text G=(none) M=OleCtrls ACBP=A9 - 0001:0009515C 00000314 C=CODE S=.text G=(none) M=TlHelp32 ACBP=A9 - 0001:00095470 00000128 C=CODE S=.text G=(none) M=WinSock ACBP=A9 - 0001:00095598 00003A78 C=CODE S=.text G=(none) M=ScktComp ACBP=A9 - 0001:00099010 000008EA C=CODE S=.text G=(none) M=OleServer ACBP=A9 - 0001:000998FC 00000598 C=CODE S=.text G=(none) M=MSCommLib_TLB ACBP=A9 - 0001:00099E94 00000040 C=CODE S=.text G=(none) M=MMSystem ACBP=A9 - 0001:00099ED4 00000038 C=CODE S=.text G=(none) M=Nb30 ACBP=A9 - 0001:00099F0C 00000038 C=CODE S=.text G=(none) M=DateUtils ACBP=A9 - 0001:00099F44 00000A18 C=CODE S=.text G=(none) M=MaskUtils ACBP=A9 - 0001:0009A95C 00002108 C=CODE S=.text G=(none) M=Mask ACBP=A9 - 0001:0009CA64 000092A4 C=CODE S=.text G=(none) M=Grids ACBP=A9 - 0001:000A5D08 00001820 C=CODE S=.text G=(none) M=UnitPilote ACBP=A9 - 0001:000A7528 0000057C C=CODE S=.text G=(none) M=Importation ACBP=A9 - 0001:000A7AA4 000147B4 C=CODE S=.text G=(none) M=UnitAnalyseSegCDM ACBP=A9 - 0001:000BC258 000028F7 C=CODE S=.text G=(none) M=UnitConfigTCO ACBP=A9 - 0001:000BEB50 00000C64 C=CODE S=.text G=(none) M=Unit_Pilote_aig ACBP=A9 - 0001:000BF7B4 000041E0 C=CODE S=.text G=(none) M=UnitConfigCellTCO ACBP=A9 - 0001:000C3994 00001050 C=CODE S=.text G=(none) M=UnitFicheHoraire ACBP=A9 - 0001:000C49E4 00001548 C=CODE S=.text G=(none) M=UnitClock ACBP=A9 - 0001:000C5F2C 00032638 C=CODE S=.text G=(none) M=UnitTCO ACBP=A9 - 0001:000F8564 00003410 C=CODE S=.text G=(none) M=UnitSR ACBP=A9 - 0001:000FB974 000027BC C=CODE S=.text G=(none) M=UnitCDF ACBP=A9 - 0001:000FE130 00000E5C C=CODE S=.text G=(none) M=UnitHorloge ACBP=A9 - 0001:000FEF8C 0000233F C=CODE S=.text G=(none) M=verif_version ACBP=A9 - 0001:001012CC 000011D0 C=CODE S=.text G=(none) M=UnitPareFeu ACBP=A9 - 0001:0010249C 00000DC8 C=CODE S=.text G=(none) M=UnitSimule ACBP=A9 - 0001:00103264 00002A50 C=CODE S=.text G=(none) M=Unitplace ACBP=A9 - 0001:00105CB4 0003E8A8 C=CODE S=.text G=(none) M=UnitPrinc ACBP=A9 - 0001:0014455C 0003F6BC C=CODE S=.text G=(none) M=UnitConfig ACBP=A9 - 0001:00183C18 00002D08 C=CODE S=.text G=(none) M=UnitDebug ACBP=A9 - 0001:00186920 0000052C C=CODE S=.text G=(none) M=Signaux_complexes_GL ACBP=A9 + 0001:00000000 00005F3F C=CODE S=.text G=(none) M=System ACBP=A9 + 0001:00005F40 00000140 C=CODE S=.text G=(none) M=SysInit ACBP=A9 + 0001:00006080 00000108 C=CODE S=.text G=(none) M=Types ACBP=A9 + 0001:00006188 00000F20 C=CODE S=.text G=(none) M=Windows ACBP=A9 + 0001:000070A8 00000038 C=CODE S=.text G=(none) M=Messages ACBP=A9 + 0001:000070E0 00000338 C=CODE S=.text G=(none) M=SysConst ACBP=A9 + 0001:00007418 00006F74 C=CODE S=.text G=(none) M=SysUtils ACBP=A9 + 0001:0000E38C 0000081B C=CODE S=.text G=(none) M=VarUtils ACBP=A9 + 0001:0000EBA8 0000804E C=CODE S=.text G=(none) M=Variants ACBP=A9 + 0001:00016BF8 000001A0 C=CODE S=.text G=(none) M=RTLConsts ACBP=A9 + 0001:00016D98 0000083C C=CODE S=.text G=(none) M=TypInfo ACBP=A9 + 0001:000175D4 00000358 C=CODE S=.text G=(none) M=ActiveX ACBP=A9 + 0001:0001792C 0000A7FE C=CODE S=.text G=(none) M=Classes ACBP=A9 + 0001:0002212C 00000370 C=CODE S=.text G=(none) M=Consts ACBP=A9 + 0001:0002249C 00009BFB C=CODE S=.text G=(none) M=Graphics ACBP=A9 + 0001:0002C098 00000124 C=CODE S=.text G=(none) M=Math ACBP=A9 + 0001:0002C1BC 000002B8 C=CODE S=.text G=(none) M=Contnrs ACBP=A9 + 0001:0002C474 00000198 C=CODE S=.text G=(none) M=CommCtrl ACBP=A9 + 0001:0002C60C 00000787 C=CODE S=.text G=(none) M=MultiMon ACBP=A9 + 0001:0002CD94 00000038 C=CODE S=.text G=(none) M=Imm ACBP=A9 + 0001:0002CDCC 00000FF8 C=CODE S=.text G=(none) M=HelpIntfs ACBP=A9 + 0001:0002DDC4 00000058 C=CODE S=.text G=(none) M=WinSpool ACBP=A9 + 0001:0002DE1C 000010C8 C=CODE S=.text G=(none) M=Printers ACBP=A9 + 0001:0002EEE4 0000031F C=CODE S=.text G=(none) M=FlatSB ACBP=A9 + 0001:0002F204 000003F0 C=CODE S=.text G=(none) M=SyncObjs ACBP=A9 + 0001:0002F5F4 000009BB C=CODE S=.text G=(none) M=UxTheme ACBP=A9 + 0001:0002FFB0 00000038 C=CODE S=.text G=(none) M=RichEdit ACBP=A9 + 0001:0002FFE8 00000038 C=CODE S=.text G=(none) M=ToolWin ACBP=A9 + 0001:00030020 00000040 C=CODE S=.text G=(none) M=ShellAPI ACBP=A9 + 0001:00030060 00000038 C=CODE S=.text G=(none) M=RegStr ACBP=A9 + 0001:00030098 00000058 C=CODE S=.text G=(none) M=WinInet ACBP=A9 + 0001:000300F0 00000038 C=CODE S=.text G=(none) M=UrlMon ACBP=A9 + 0001:00030128 0000006C C=CODE S=.text G=(none) M=ShlObj ACBP=A9 + 0001:00030194 00000060 C=CODE S=.text G=(none) M=CommDlg ACBP=A9 + 0001:000301F4 00000038 C=CODE S=.text G=(none) M=Dlgs ACBP=A9 + 0001:0003022C 000036D1 C=CODE S=.text G=(none) M=Dialogs ACBP=A9 + 0001:00033900 0000602A C=CODE S=.text G=(none) M=ExtCtrls ACBP=A9 + 0001:0003992C 00000090 C=CODE S=.text G=(none) M=ComStrs ACBP=A9 + 0001:000399BC 000007A0 C=CODE S=.text G=(none) M=Clipbrd ACBP=A9 + 0001:0003A15C 00000128 C=CODE S=.text G=(none) M=StrUtils ACBP=A9 + 0001:0003A284 00003821 C=CODE S=.text G=(none) M=Buttons ACBP=A9 + 0001:0003DAA8 00000038 C=CODE S=.text G=(none) M=ExtDlgs ACBP=A9 + 0001:0003DAE0 00000068 C=CODE S=.text G=(none) M=IniFiles ACBP=A9 + 0001:0003DB48 00000068 C=CODE S=.text G=(none) M=Registry ACBP=A9 + 0001:0003DBB0 0000006C C=CODE S=.text G=(none) M=Mapi ACBP=A9 + 0001:0003DC1C 00000058 C=CODE S=.text G=(none) M=ExtActns ACBP=A9 + 0001:0003DC74 00000038 C=CODE S=.text G=(none) M=ListActns ACBP=A9 + 0001:0003DCAC 00009948 C=CODE S=.text G=(none) M=ComCtrls ACBP=A9 + 0001:000475F4 00000EA0 C=CODE S=.text G=(none) M=Themes ACBP=A9 + 0001:00048494 0000C698 C=CODE S=.text G=(none) M=StdCtrls ACBP=A9 + 0001:00054B2C 00000168 C=CODE S=.text G=(none) M=StdActns ACBP=A9 + 0001:00054C94 00000D1F C=CODE S=.text G=(none) M=WinHelpViewer ACBP=A9 + 0001:000559B4 00011403 C=CODE S=.text G=(none) M=Controls ACBP=A9 + 0001:00066DB8 00001292 C=CODE S=.text G=(none) M=ActnList ACBP=A9 + 0001:0006804C 00001C04 C=CODE S=.text G=(none) M=ImgList ACBP=A9 + 0001:00069C50 000066E1 C=CODE S=.text G=(none) M=Menus ACBP=A9 + 0001:00070334 0000CF8C C=CODE S=.text G=(none) M=Forms ACBP=A9 + 0001:0007D2C0 00000050 C=CODE S=.text G=(none) M=JConsts ACBP=A9 + 0001:0007D310 000133EC C=CODE S=.text G=(none) M=jpeg ACBP=A9 + 0001:000906FC 00000060 C=CODE S=.text G=(none) M=ComConst ACBP=A9 + 0001:0009075C 00001259 C=CODE S=.text G=(none) M=ComObj ACBP=A9 + 0001:000919B8 00000038 C=CODE S=.text G=(none) M=StdVCL ACBP=A9 + 0001:000919F0 00001793 C=CODE S=.text G=(none) M=AxCtrls ACBP=A9 + 0001:00093184 00000060 C=CODE S=.text G=(none) M=OleConst ACBP=A9 + 0001:000931E4 00003519 C=CODE S=.text G=(none) M=OleCtrls ACBP=A9 + 0001:00096700 00000314 C=CODE S=.text G=(none) M=TlHelp32 ACBP=A9 + 0001:00096A14 00000128 C=CODE S=.text G=(none) M=WinSock ACBP=A9 + 0001:00096B3C 00003A78 C=CODE S=.text G=(none) M=ScktComp ACBP=A9 + 0001:0009A5B4 000008EA C=CODE S=.text G=(none) M=OleServer ACBP=A9 + 0001:0009AEA0 000005A0 C=CODE S=.text G=(none) M=MSCommLib_TLB ACBP=A9 + 0001:0009B440 00000040 C=CODE S=.text G=(none) M=MMSystem ACBP=A9 + 0001:0009B480 00000038 C=CODE S=.text G=(none) M=Nb30 ACBP=A9 + 0001:0009B4B8 00000038 C=CODE S=.text G=(none) M=DateUtils ACBP=A9 + 0001:0009B4F0 00000A18 C=CODE S=.text G=(none) M=MaskUtils ACBP=A9 + 0001:0009BF08 00002108 C=CODE S=.text G=(none) M=Mask ACBP=A9 + 0001:0009E010 000092A4 C=CODE S=.text G=(none) M=Grids ACBP=A9 + 0001:000A72B4 00001BFC C=CODE S=.text G=(none) M=Spin ACBP=A9 + 0001:000A8EB0 00001988 C=CODE S=.text G=(none) M=UnitPilote ACBP=A9 + 0001:000AA838 0000057C C=CODE S=.text G=(none) M=Importation ACBP=A9 + 0001:000AADB4 00019484 C=CODE S=.text G=(none) M=UnitAnalyseSegCDM ACBP=A9 + 0001:000C4238 00002E3F C=CODE S=.text G=(none) M=UnitConfigTCO ACBP=A9 + 0001:000C7078 00000D78 C=CODE S=.text G=(none) M=Unit_Pilote_aig ACBP=A9 + 0001:000C7DF0 000054E8 C=CODE S=.text G=(none) M=UnitConfigCellTCO ACBP=A9 + 0001:000CD2D8 000011D0 C=CODE S=.text G=(none) M=UnitFicheHoraire ACBP=A9 + 0001:000CE4A8 000017D4 C=CODE S=.text G=(none) M=UnitClock ACBP=A9 + 0001:000CFC7C 000471B0 C=CODE S=.text G=(none) M=UnitTCO ACBP=A9 + 0001:00116E2C 000039DC C=CODE S=.text G=(none) M=UnitSR ACBP=A9 + 0001:0011A808 00002BF8 C=CODE S=.text G=(none) M=UnitCDF ACBP=A9 + 0001:0011D400 00005DC8 C=CODE S=.text G=(none) M=UnitModifAction ACBP=A9 + 0001:001231C8 00046AD8 C=CODE S=.text G=(none) M=UnitConfig ACBP=A9 + 0001:00169CA0 00000E78 C=CODE S=.text G=(none) M=UnitHorloge ACBP=A9 + 0001:0016AB18 000024FF C=CODE S=.text G=(none) M=verif_version ACBP=A9 + 0001:0016D018 000011D0 C=CODE S=.text G=(none) M=UnitPareFeu ACBP=A9 + 0001:0016E1E8 00000F6C C=CODE S=.text G=(none) M=UnitSimule ACBP=A9 + 0001:0016F154 00002E60 C=CODE S=.text G=(none) M=Unitplace ACBP=A9 + 0001:00171FB4 0004C52C C=CODE S=.text G=(none) M=UnitPrinc ACBP=A9 + 0001:001BE4E0 00002F78 C=CODE S=.text G=(none) M=UnitDebug ACBP=A9 + 0001:001C1458 00000554 C=CODE S=.text G=(none) M=Signaux_complexes_GL ACBP=A9 0002:00000000 000000CC C=DATA S=.data G=DGROUP M=System ACBP=A9 0002:000000CC 00000020 C=DATA S=.data G=DGROUP M=SysInit ACBP=A9 0002:000000EC 00000254 C=DATA S=.data G=DGROUP M=SysUtils ACBP=A9 @@ -211,31 +213,34 @@ Detailed map of segments 0002:00003E5C 00000004 C=BSS S=.bss G=DGROUP M=MaskUtils ACBP=A9 0002:00003E60 00000004 C=BSS S=.bss G=DGROUP M=Mask ACBP=A9 0002:00003E64 00000004 C=BSS S=.bss G=DGROUP M=Grids ACBP=A9 - 0002:00003E68 00000010 C=BSS S=.bss G=DGROUP M=UnitPilote ACBP=A9 - 0002:00003E78 00000010 C=BSS S=.bss G=DGROUP M=Importation ACBP=A9 - 0002:00003E88 000148B0 C=BSS S=.bss G=DGROUP M=UnitAnalyseSegCDM ACBP=A9 - 0002:00018738 00000014 C=BSS S=.bss G=DGROUP M=UnitConfigTCO ACBP=A9 - 0002:0001874C 00000014 C=BSS S=.bss G=DGROUP M=Unit_Pilote_aig ACBP=A9 - 0002:00018760 00000020 C=BSS S=.bss G=DGROUP M=UnitConfigCellTCO ACBP=A9 - 0002:00018780 00000288 C=BSS S=.bss G=DGROUP M=UnitFicheHoraire ACBP=A9 - 0002:00018A08 00000034 C=BSS S=.bss G=DGROUP M=UnitClock ACBP=A9 - 0002:00018A3C 0041870C C=BSS S=.bss G=DGROUP M=UnitTCO ACBP=A9 - 0002:00431148 00000010 C=BSS S=.bss G=DGROUP M=UnitSR ACBP=A9 - 0002:00431158 00000014 C=BSS S=.bss G=DGROUP M=UnitCDF ACBP=A9 - 0002:0043116C 00000038 C=BSS S=.bss G=DGROUP M=UnitHorloge ACBP=A9 - 0002:004311A4 000001EC C=BSS S=.bss G=DGROUP M=verif_version ACBP=A9 - 0002:00431390 00000004 C=BSS S=.bss G=DGROUP M=UnitPareFeu ACBP=A9 - 0002:00431394 0000000C C=BSS S=.bss G=DGROUP M=UnitSimule ACBP=A9 - 0002:004313A0 00000008 C=BSS S=.bss G=DGROUP M=Unitplace ACBP=A9 - 0002:004313A8 041BF0E0 C=BSS S=.bss G=DGROUP M=UnitPrinc ACBP=A9 - 0002:045F0488 0000057C C=BSS S=.bss G=DGROUP M=UnitConfig ACBP=A9 - 0002:045F0A04 0000002C C=BSS S=.bss G=DGROUP M=UnitDebug ACBP=A9 + 0002:00003E68 00000004 C=BSS S=.bss G=DGROUP M=Spin ACBP=A9 + 0002:00003E6C 00000010 C=BSS S=.bss G=DGROUP M=UnitPilote ACBP=A9 + 0002:00003E7C 00000010 C=BSS S=.bss G=DGROUP M=Importation ACBP=A9 + 0002:00003E8C 000148B0 C=BSS S=.bss G=DGROUP M=UnitAnalyseSegCDM ACBP=A9 + 0002:0001873C 00000014 C=BSS S=.bss G=DGROUP M=UnitConfigTCO ACBP=A9 + 0002:00018750 00000014 C=BSS S=.bss G=DGROUP M=Unit_Pilote_aig ACBP=A9 + 0002:00018764 00000020 C=BSS S=.bss G=DGROUP M=UnitConfigCellTCO ACBP=A9 + 0002:00018784 00001908 C=BSS S=.bss G=DGROUP M=UnitFicheHoraire ACBP=A9 + 0002:0001A08C 00000034 C=BSS S=.bss G=DGROUP M=UnitClock ACBP=A9 + 0002:0001A0C0 0041870C C=BSS S=.bss G=DGROUP M=UnitTCO ACBP=A9 + 0002:004327CC 00000010 C=BSS S=.bss G=DGROUP M=UnitSR ACBP=A9 + 0002:004327DC 00000014 C=BSS S=.bss G=DGROUP M=UnitCDF ACBP=A9 + 0002:004327F0 00000018 C=BSS S=.bss G=DGROUP M=UnitModifAction ACBP=A9 + 0002:00432808 0000057C C=BSS S=.bss G=DGROUP M=UnitConfig ACBP=A9 + 0002:00432D84 00000038 C=BSS S=.bss G=DGROUP M=UnitHorloge ACBP=A9 + 0002:00432DBC 000001EC C=BSS S=.bss G=DGROUP M=verif_version ACBP=A9 + 0002:00432FA8 00000004 C=BSS S=.bss G=DGROUP M=UnitPareFeu ACBP=A9 + 0002:00432FAC 0000000C C=BSS S=.bss G=DGROUP M=UnitSimule ACBP=A9 + 0002:00432FB8 00000008 C=BSS S=.bss G=DGROUP M=Unitplace ACBP=A9 + 0002:00432FC0 041BEF8C C=BSS S=.bss G=DGROUP M=UnitPrinc ACBP=A9 + 0002:045F1F4C 0000002C C=BSS S=.bss G=DGROUP M=UnitDebug ACBP=A9 Bound resource files c:\program files (x86)\borland\delphi7\Lib\Buttons.res c:\program files (x86)\borland\delphi7\Lib\ExtDlgs.res c:\program files (x86)\borland\delphi7\Lib\Controls.res +c:\program files (x86)\borland\delphi7\Lib\SPIN.RES UnitPilote.dfm Importation.dfm UnitAnalyseSegCDM.dfm @@ -247,15 +252,16 @@ UnitClock.dfm UnitTCO.dfm UnitSR.dfm UnitCDF.dfm +UnitModifAction.dfm +UnitConfig.dfm UnitHorloge.dfm verif_version.dfm UnitSimule.dfm Unitplace.dfm UnitPrinc.dfm -UnitConfig.dfm UnitDebug.dfm Signaux_complexes_GL.res Signaux_complexes_GL.drf -Program entry point at 0001:00186C50 +Program entry point at 0001:001C1798 diff --git a/UnitClock.dfm b/UnitClock.dfm index 6df4325..83f5138 100644 --- a/UnitClock.dfm +++ b/UnitClock.dfm @@ -1,8 +1,8 @@ object FormClock: TFormClock - Left = 965 - Top = 184 - Width = 291 - Height = 293 + Left = 923 + Top = 433 + Width = 250 + Height = 250 Caption = 'Horloge' Color = clBtnFace Font.Charset = DEFAULT_CHARSET @@ -15,13 +15,13 @@ object FormClock: TFormClock OnCreate = FormCreate OnResize = FormResize DesignSize = ( - 275 - 254) + 234 + 212) PixelsPerInch = 96 TextHeight = 13 object BitBtnMarHor: TBitBtn Left = 10 - Top = 230 + Top = 187 Width = 25 Height = 25 Hint = 'Lance l'#39'horloge' @@ -33,7 +33,7 @@ object FormClock: TFormClock end object BitBtnArrHorl: TBitBtn Left = 40 - Top = 230 + Top = 187 Width = 25 Height = 25 Hint = 'Arr'#234'te l'#39'horloge' @@ -45,7 +45,7 @@ object FormClock: TFormClock end object BitBtnInitHor: TBitBtn Left = 72 - Top = 230 + Top = 187 Width = 25 Height = 25 Hint = 'Initialiser l'#39'horloge' @@ -57,7 +57,7 @@ object FormClock: TFormClock end object ButtonParametres: TButton Left = 102 - Top = 230 + Top = 187 Width = 25 Height = 25 Hint = 'Param'#233'trage' @@ -70,7 +70,7 @@ object FormClock: TFormClock end object ButtonGH: TButton Left = 134 - Top = 230 + Top = 187 Width = 25 Height = 25 Hint = 'Grille horaire' diff --git a/UnitClock.pas b/UnitClock.pas index 63e4449..fe7fd32 100644 --- a/UnitClock.pas +++ b/UnitClock.pas @@ -342,18 +342,23 @@ begin begin LargeurFC:=250; HauteurFC:=250; - OffsetXFC:=(formprinc.top+formPrinc.height)-FormClock.height-20; - OffsetYFC:=(formprinc.left+formPrinc.width)-formClock.width; + formclock.width:=LargeurFC; + formclock.height:=HauteurFC; end; - formclock.top:=OffsetYFC; - formclock.left:=OffsetXFC; - formclock.width:=LargeurFC; - formclock.height:=HauteurFC; + + OffsetYFC:=(formprinc.top+formPrinc.height)-FormClock.height-32; + OffsetXFC:=(formprinc.left+formPrinc.width)-formClock.width; + // écart entre fenetre principale et clock DeltaFPCY:=OffsetYFC-formprinc.top; DeltaFPCX:=OffsetXFC-formprinc.left; + + formclock.top:=OffsetYFC; + formclock.left:=OffsetXFC; + end; + procedure TFormClock.FormCreate(Sender: TObject); begin // inits @@ -462,6 +467,8 @@ begin end; + + procedure TFormClock.ButtonGHClick(Sender: TObject); begin formFicheHoraire.showModal; diff --git a/UnitConfig.dfm b/UnitConfig.dfm index 293f578..2e71bf1 100644 --- a/UnitConfig.dfm +++ b/UnitConfig.dfm @@ -1,6 +1,6 @@ object FormConfig: TFormConfig - Left = 258 - Top = 206 + Left = 220 + Top = 130 Hint = 'Modifie la configuration selon les s'#233'lections choisies' BorderStyle = bsDialog Caption = 'Configuration g'#233'n'#233'rale' @@ -681,7 +681,7 @@ object FormConfig: TFormConfig Top = 8 Width = 633 Height = 505 - ActivePage = TabSheetAct + ActivePage = TabSheet1 Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -11 @@ -2840,17 +2840,17 @@ object FormConfig: TFormConfig end end end - object TabSheetAct: TTabSheet - Caption = 'Actionneurs/D'#233'tecteurs' - ImageIndex = 5 - object Label16: TLabel + object TabSheet1: TTabSheet + Caption = 'Actions' + ImageIndex = 6 + object Label44: TLabel Left = 0 - Top = 4 - Width = 562 + Top = 12 + Width = 537 Height = 13 Caption = - 'Liste de mod'#233'lisation des actionneurs - cliquez sur une ligne po' + - 'ur afficher la description de l'#39'action' + 'Liste de mod'#233'lisation des actions - cliquez sur une ligne pour a' + + 'fficher la description de l'#39'action' Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -11 @@ -2858,6 +2858,121 @@ object FormConfig: TFormConfig Font.Style = [fsBold] ParentFont = False end + object GroupBox15: TGroupBox + Left = 0 + Top = 32 + Width = 609 + Height = 425 + Caption = 'Actions' + TabOrder = 0 + object Label48: TLabel + Left = 352 + Top = 16 + Width = 149 + Height = 13 + Caption = 'Op'#233'rations r'#233'alis'#233'es par l'#39'action' + end + object ListBoxActions: TListBox + Left = 16 + Top = 40 + Width = 305 + Height = 193 + Color = clBlack + Font.Charset = DEFAULT_CHARSET + Font.Color = clAqua + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ItemHeight = 13 + MultiSelect = True + ParentFont = False + PopupMenu = PopupMenuListes + TabOrder = 0 + OnKeyDown = ListBoxActionsKeyDown + OnMouseDown = ListBoxActionsMouseDown + end + object ListBoxOperations: TListBox + Left = 336 + Top = 40 + Width = 249 + Height = 193 + Hint = 'Double clic pour valider/d'#233'valider une action' + Style = lbOwnerDrawVariable + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ItemHeight = 13 + ParentFont = False + ParentShowHint = False + PopupMenu = PopupMenuActions + ShowHint = True + TabOrder = 1 + OnDblClick = ListBoxOperationsDblClick + OnDrawItem = ListBoxOperationsDrawItem + OnMouseDown = ListBoxOperationsMouseDown + end + object ButtonModAction: TButton + Left = 344 + Top = 272 + Width = 75 + Height = 25 + Caption = 'Modifier' + TabOrder = 2 + OnClick = ButtonModActionClick + end + object RichEditInfo: TRichEdit + Left = 16 + Top = 240 + Width = 305 + Height = 185 + Color = clBlack + Font.Charset = DEFAULT_CHARSET + Font.Color = clYellow + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + ReadOnly = True + ScrollBars = ssVertical + TabOrder = 3 + end + object Button1: TButton + Left = 16 + Top = 16 + Width = 65 + Height = 17 + Caption = 'Nouveau' + TabOrder = 4 + OnClick = ButtonNouvAccClick + end + object Button3: TButton + Left = 104 + Top = 16 + Width = 65 + Height = 17 + Hint = 'Supprime l'#39'actionneur(s) s'#233'lectionn'#233'(s)' + Caption = 'Supprime' + ParentShowHint = False + ShowHint = True + TabOrder = 5 + OnClick = ButtonSupAccClick + end + object ButtonTestAction: TButton + Left = 504 + Top = 272 + Width = 75 + Height = 25 + Caption = 'Test action' + TabOrder = 6 + OnClick = ButtonTestActionClick + end + end + end + object TabSheetPN: TTabSheet + Caption = 'PN' + ImageIndex = 6 object GroupBox13: TGroupBox Left = 352 Top = 24 @@ -2865,417 +2980,31 @@ object FormConfig: TFormConfig Height = 441 Caption = 'Description de l'#39'action' TabOrder = 0 - object GroupBoxRadio: TGroupBox - Left = 8 - Top = 16 - Width = 249 - Height = 105 - Caption = 'Type d'#39'action' - TabOrder = 0 - object RadioButtonLoc: TRadioButton - Left = 24 - Top = 16 - Width = 193 - Height = 17 - Caption = 'Fonction F pour locomotive' - TabOrder = 0 - OnClick = RadioButtonLocClick - end - object RadioButtonAccess: TRadioButton - Left = 24 - Top = 32 - Width = 161 - Height = 17 - Caption = 'Accessoire' - TabOrder = 1 - OnClick = RadioButtonAccessClick - end - object RadioButtonSon: TRadioButton - Left = 24 - Top = 48 - Width = 161 - Height = 17 - Caption = 'Son' - TabOrder = 2 - OnClick = RadioButtonSonClick - end - object RadioButtonCde: TRadioButton - Left = 24 - Top = 64 - Width = 177 - Height = 17 - Caption = 'Commande COM/USB/Socket' - TabOrder = 3 - OnClick = RadioButtonCdeClick - end - object RadioButtonVit: TRadioButton - Left = 24 - Top = 80 - Width = 145 - Height = 17 - Caption = 'Vitesse de locomotive' - TabOrder = 4 - OnClick = RadioButtonVitClick - end - end - object GroupBoxAct: TGroupBox - Left = 8 - Top = 120 - Width = 249 - Height = 321 - Caption = 'Action fonction de locomotive ' - TabOrder = 1 - object GroupBox18: TGroupBox - Left = 8 - Top = 16 - Width = 233 - Height = 145 - Caption = 'D'#233'clencheur ' - TabOrder = 0 - object LabelActionneur: TLabel - Left = 8 - Top = 88 - Width = 54 - Height = 26 - Caption = 'Actionneur D'#233'tecteur' - WordWrap = True - end - object Label30: TLabel - Left = 168 - Top = 96 - Width = 6 - Height = 13 - Caption = #224 - end - object LabelTrain: TLabel - Left = 8 - Top = 118 - Width = 60 - Height = 13 - Caption = 'Train(s) D'#233'cl' - end - object EditAct: TEdit - Left = 72 - Top = 92 - Width = 41 - Height = 21 - ParentShowHint = False - ShowHint = True - TabOrder = 0 - OnChange = EditActChange - end - object EditEtatActionneur: TEdit - Left = 184 - Top = 92 - Width = 17 - Height = 21 - Hint = 'Etat '#224' ou 1' - ParentShowHint = False - ShowHint = True - TabOrder = 1 - OnChange = EditEtatActionneurChange - end - object EditTrainDecl: TEdit - Left = 72 - Top = 116 - Width = 153 - Height = 21 - Hint = - 'Train(s) d'#233'clencheur(s) s'#233'par'#233's par des virgules pour lequel la ' + - 'condition s'#39'applique (mettre X pour tous les trains) #13 d'#233'clenc' + - 'hement par actionneur uniquement' - ParentShowHint = False - ShowHint = True - TabOrder = 2 - OnChange = EditTrainDeclChange - end - object RadioButtonActDet: TRadioButton - Left = 16 - Top = 16 - Width = 161 - Height = 17 - Caption = 'Actionneur/D'#233'tecteur' - TabOrder = 3 - OnClick = RadioButtonActDetClick - end - object RadioButtonZones: TRadioButton - Left = 16 - Top = 32 - Width = 161 - Height = 17 - Caption = 'Zones de d'#233'tection' - TabOrder = 4 - OnClick = RadioButtonZonesClick - end - object EditAct2: TEdit - Left = 120 - Top = 92 - Width = 41 - Height = 21 - ParentShowHint = False - ShowHint = True - TabOrder = 5 - OnChange = EditAct2Change - end - object RadioButtonAig: TRadioButton - Left = 16 - Top = 48 - Width = 145 - Height = 17 - Caption = 'Ev'#232'nement aiguillage' - TabOrder = 6 - OnClick = RadioButtonAigClick - end - object RadioButtonHorl: TRadioButton - Left = 16 - Top = 64 - Width = 113 - Height = 17 - Caption = 'Horloge' - TabOrder = 7 - OnClick = RadioButtonHorlClick - end - end - object GroupBox19: TGroupBox - Left = 8 - Top = 168 - Width = 233 - Height = 137 - Caption = 'Destinataire de l'#39'action ' - TabOrder = 1 - object LabelTempo: TLabel - Left = 48 - Top = 44 - Width = 55 - Height = 13 - Caption = 'Tempo (ms)' - end - object LabelFonction: TLabel - Left = 8 - Top = 18 - Width = 80 - Height = 13 - BiDiMode = bdLeftToRight - Caption = 'Action : Fonction' - ParentBiDiMode = False - end - object Labela: TLabel - Left = 152 - Top = 20 - Width = 6 - Height = 13 - Caption = #224 - end - object LabelNomSon: TLabel - Left = 0 - Top = 56 - Width = 91 - Height = 13 - Caption = 'Nom du fichier son:' - end - object SpeedButtonJoue: TSpeedButton - Left = 56 - Top = 88 - Width = 41 - Height = 33 - Hint = 'Joue le son' - Flat = True - Glyph.Data = { - 4E010000424D4E010000000000003E0000002800000022000000220000000100 - 010000000000100100000000000000000000020000000000000000000000FFFF - FF00FFFFFFFFC0000000FFFFFFFFC0000000FFFFFFFFC0000000C0000000C000 - 0000800000004000000000000000000000001FFFFFFE000000003FFFFFFF0000 - 00003FFFFFFF000000003FFFFFFF000000003FF8FFFF000000003FF03FFF0000 - 00003FF00FFF000000003FF303FF000000003FF3C0FF000000003FF3F07F0000 - 00003FF3FC7F000000003FF3FC7F000000003FF3E07F000000003FF381FF0000 - 00003FF207FF000000003FF01FFF000000003FF07FFF000000003FF9FFFF0000 - 00003FFFFFFF000000003FFFFFFF000000003FFFFFFF000000001FFFFFFE0000 - 000000000000000000008000000040000000C0000000C0000000FFFFFFFFC000 - 0000FFFFFFFFC0000000FFFFFFFFC0000000} - ParentShowHint = False - ShowHint = True - OnClick = SpeedButtonJoueClick - end - object SpeedButtonCharger: TSpeedButton - Left = 120 - Top = 88 - Width = 25 - Height = 34 - Hint = 'Ouvre un fichier son WAV' - Flat = True - Glyph.Data = { - BA060000424DBA06000000000000360400002800000019000000170000000100 - 0800000000008402000000000000000000000001000000000000000000000000 - 80000080000000808000800000008000800080800000C0C0C000C0DCC000F0CA - A6000020400000206000002080000020A0000020C0000020E000004000000040 - 20000040400000406000004080000040A0000040C0000040E000006000000060 - 20000060400000606000006080000060A0000060C0000060E000008000000080 - 20000080400000806000008080000080A0000080C0000080E00000A0000000A0 - 200000A0400000A0600000A0800000A0A00000A0C00000A0E00000C0000000C0 - 200000C0400000C0600000C0800000C0A00000C0C00000C0E00000E0000000E0 - 200000E0400000E0600000E0800000E0A00000E0C00000E0E000400000004000 - 20004000400040006000400080004000A0004000C0004000E000402000004020 - 20004020400040206000402080004020A0004020C0004020E000404000004040 - 20004040400040406000404080004040A0004040C0004040E000406000004060 - 20004060400040606000406080004060A0004060C0004060E000408000004080 - 20004080400040806000408080004080A0004080C0004080E00040A0000040A0 - 200040A0400040A0600040A0800040A0A00040A0C00040A0E00040C0000040C0 - 200040C0400040C0600040C0800040C0A00040C0C00040C0E00040E0000040E0 - 200040E0400040E0600040E0800040E0A00040E0C00040E0E000800000008000 - 20008000400080006000800080008000A0008000C0008000E000802000008020 - 20008020400080206000802080008020A0008020C0008020E000804000008040 - 20008040400080406000804080008040A0008040C0008040E000806000008060 - 20008060400080606000806080008060A0008060C0008060E000808000008080 - 20008080400080806000808080008080A0008080C0008080E00080A0000080A0 - 200080A0400080A0600080A0800080A0A00080A0C00080A0E00080C0000080C0 - 200080C0400080C0600080C0800080C0A00080C0C00080C0E00080E0000080E0 - 200080E0400080E0600080E0800080E0A00080E0C00080E0E000C0000000C000 - 2000C0004000C0006000C0008000C000A000C000C000C000E000C0200000C020 - 2000C0204000C0206000C0208000C020A000C020C000C020E000C0400000C040 - 2000C0404000C0406000C0408000C040A000C040C000C040E000C0600000C060 - 2000C0604000C0606000C0608000C060A000C060C000C060E000C0800000C080 - 2000C0804000C0806000C0808000C080A000C080C000C080E000C0A00000C0A0 - 2000C0A04000C0A06000C0A08000C0A0A000C0A0C000C0A0E000C0C00000C0C0 - 2000C0C04000C0C06000C0C08000C0C0A000F0FBFF00A4A0A000808080000000 - FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00FFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000FF0A0A00FFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000FF272727271C120A00FFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFF000000FF27BF7F77776F2727271D130A0000FFFFFF - FFFFFFFFFFFFFF000000FF26F6BFBFBF7F7F7F77776F2F27271D130A0000FFFF - FFFFFF000000FF2F6FF6BFBFBFBFBF7F7F7F7F7F7F6F2F2F270AFFFFFFFFFF00 - 0000FF2727F6BFBFBFBFBFBF7F7F7F7F7F7F7F7F7726FFFFFFFFFF000000FF27 - 6FF6BFBFBFBFBFBFBF7F7F7F7F7F7F7F7F2F00FFFFFFFF000000FF27BF6FF6BF - BFBFBFBFBFBF7F7F7F7F7F7F7F771CFFFFFFFF000000FF27BF27F6BFBFBFBFBF - BFBFBF7F7F7F7F7F7FBF2F00FFFFFF000000FF27BF2FF6BFBFBFBFBFBFBFBFBF - 7F7F7F7F7FBF7713FFFFFF000000FF277F376FF6BFBFBFBFBFBFBFBFBF7F7F7F - 7F7FBF2F00FFFF000000FF277F3727F6BFBFBFBFBFBFBFBFBFBF7F7F7F7FBF77 - 0AFFFF000000FF277F372F27276FF6F6F6F6F6BFBFBFBFBF7F7F7FBF2700FF00 - 0000FF277F37373737372F2F27276F77BFBFBFBFBFBFBFBF6F0AFF000000FF27 - 7F373737373737373737372F2F276F6F7777777F7F1DFF000000FF277F373737 - 3737373737373737373737372F6F2F272727FF000000FF277F37373737373737 - 3737373737373737377FBF270A0AFF000000FF277F373737373737377FBFBFBF - BFBFBFBFBFF6270AFFFFFF000000FF277F373737373737372666272727272727 - 272752FFFFFFFF000000FF27BFBFBFBFBFBFBFBF25FFFFFFFFFFFFFFFFFFFFFF - FFFFFF000000FF266F2727272727276F13FFFFFFFFFFFFFFFFFFFFFFFFFFFF00 - 0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000} - ParentShowHint = False - ShowHint = True - OnClick = SpeedButtonChargerClick - end - object Label42: TLabel - Left = 16 - Top = 68 - Width = 49 - Height = 13 - Caption = 'Train Dest' - end - object EditTempo: TEdit - Left = 112 - Top = 38 - Width = 41 - Height = 21 - TabOrder = 0 - OnChange = EditTempoChange - end - object CheckRAZ: TCheckBox - Left = 40 - Top = 56 - Width = 145 - Height = 17 - Caption = 'Remise '#224' 0 apr'#232's pilotage' - TabOrder = 1 - OnClick = CheckRAZClick - end - object EditFonctionAccess: TEdit - Left = 112 - Top = 14 - Width = 33 - Height = 21 - Hint = 'Num'#233'ro de fonction du d'#233'codeur du train (0 '#224' 12 ou 28)' - ParentShowHint = False - ShowHint = True - TabOrder = 2 - OnChange = EditFonctionAccessChange - end - object EditEtatFoncSortie: TEdit - Left = 168 - Top = 14 - Width = 25 - Height = 21 - TabOrder = 3 - OnChange = EditEtatFoncSortieChange - end - object EditSon: TEdit - Left = 16 - Top = 88 - Width = 161 - Height = 21 - TabOrder = 4 - OnChange = EditSonChange - end - object EditTrainDest: TEdit - Left = 80 - Top = 64 - Width = 129 - Height = 21 - Hint = 'Train destinataire de la fonction F' - ParentShowHint = False - ShowHint = True - TabOrder = 5 - OnChange = EditTrainDestChange - end - object ComboBoxAccComUSB: TComboBox - Left = 16 - Top = 80 - Width = 201 - Height = 21 - Hint = 'Nom de l'#39'accessoire d'#233'fini dans l'#39'onglet "p'#233'riph'#233'riques COM/USB"' - Style = csDropDownList - ItemHeight = 13 - ParentShowHint = False - ShowHint = True - TabOrder = 6 - OnChange = ComboBoxAccComUSBChange - end - end - object ButtonTestAct: TButton - Left = 16 - Top = 294 - Width = 89 - Height = 20 - Hint = 'Test de l'#39'actionneur/d'#233'tecteur en mode RUN' - Caption = 'Test actionneur' - ParentShowHint = False - ShowHint = True - TabOrder = 2 - OnClick = ButtonTestActClick - end - end object GroupBoxPNA: TGroupBox - Left = 96 - Top = 64 - Width = 169 + Left = 8 + Top = 224 + Width = 249 Height = 121 Caption = 'Actionneurs PN simples' - TabOrder = 2 + TabOrder = 0 end object GroupBoxPNZ: TGroupBox - Left = 192 - Top = 88 - Width = 169 + Left = 8 + Top = 352 + Width = 249 Height = 65 Caption = 'Zones de d'#233'tection' - TabOrder = 3 + TabOrder = 1 end object GroupBoxPN: TGroupBox - Left = 144 + Left = 8 Top = 24 Width = 249 Height = 193 Caption = 'Action gestion passage '#224' niveau' ParentShowHint = False ShowHint = False - TabOrder = 4 + TabOrder = 2 object Label21: TLabel Left = 8 Top = 84 @@ -3393,7 +3122,7 @@ object FormConfig: TFormConfig object RadioGroupActPN: TRadioGroup Left = 8 Top = 16 - Width = 217 + Width = 233 Height = 57 Hint = 'action par accessoire DCC ou commande COM/USB' Caption = 'Type d'#39'action' @@ -3406,13 +3135,13 @@ object FormConfig: TFormConfig OnClick = RadioGroupActPNClick end object ComboBoxPNCom: TComboBox - Left = 72 + Left = 80 Top = 128 Width = 145 Height = 21 Hint = 'Nom de l'#39'accessoire d'#233'fini dans l'#39'onglet "p'#233'riph'#233'riques COM/USB"' Style = csDropDownList - ItemHeight = 13 + ItemHeight = 0 ParentShowHint = False ShowHint = True TabOrder = 10 @@ -3420,61 +3149,13 @@ object FormConfig: TFormConfig end end end - object GroupBox14: TGroupBox - Left = 0 - Top = 24 - Width = 345 - Height = 233 - Caption = 'Actionneurs/d'#233'tecteurs locomotives ou accessoires' - TabOrder = 1 - object ButtonNouvAcc: TButton - Left = 8 - Top = 24 - Width = 65 - Height = 17 - Caption = 'Nouveau' - TabOrder = 0 - OnClick = ButtonNouvAccClick - end - object ButtonSupAcc: TButton - Left = 80 - Top = 24 - Width = 65 - Height = 17 - Hint = 'Supprime l'#39'actionneur(s) s'#233'lectionn'#233'(s)' - Caption = 'Supprime' - ParentShowHint = False - ShowHint = True - TabOrder = 1 - OnClick = ButtonSupAccClick - end - object ListBoxAct: TListBox - Left = 8 - Top = 48 - Width = 329 - Height = 161 - Color = clBlack - Font.Charset = DEFAULT_CHARSET - Font.Color = clAqua - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [] - ItemHeight = 13 - MultiSelect = True - ParentFont = False - PopupMenu = PopupMenuListes - TabOrder = 2 - OnKeyDown = ListBoxActKeyDown - OnMouseDown = ListBoxActMouseDown - end - end object GroupBox17: TGroupBox Left = 0 - Top = 272 + Top = 16 Width = 345 - Height = 193 + Height = 449 Caption = 'Actionneurs/d'#233'tecteurs passage '#224' niveau' - TabOrder = 2 + TabOrder = 1 object ButtonNouvPN: TButton Left = 8 Top = 24 @@ -3500,7 +3181,7 @@ object FormConfig: TFormConfig Left = 8 Top = 48 Width = 329 - Height = 137 + Height = 345 Color = clBlack Font.Charset = DEFAULT_CHARSET Font.Color = clAqua @@ -3519,7 +3200,7 @@ object FormConfig: TFormConfig end object TabSheetDccpp: TTabSheet Caption = 'DCC++' - ImageIndex = 6 + ImageIndex = 7 ParentShowHint = False ShowHint = False object Label10: TLabel @@ -4274,4 +3955,11 @@ object FormConfig: TFormConfig Left = 696 Top = 376 end + object PopupMenuActions: TPopupMenu + Left = 768 + object ModifAction: TMenuItem + Caption = 'Modifier l'#39'action' + OnClick = ModifActionClick + end + end end diff --git a/UnitConfig.pas b/UnitConfig.pas index 0045f65..4c5ec84 100644 --- a/UnitConfig.pas +++ b/UnitConfig.pas @@ -76,8 +76,7 @@ type Label14: TLabel; TabSheetSig: TTabSheet; Label15: TLabel; - TabSheetAct: TTabSheet; - Label16: TLabel; + TabSheetPN: TTabSheet; CheckBoxSrvSig: TCheckBox; Memo1: TMemo; Memo2: TMemo; @@ -99,9 +98,6 @@ type LabelDec: TLabel; LabelDetAss: TLabel; LabelElSuiv: TLabel; - GroupBoxRadio: TGroupBox; - RadioButtonLoc: TRadioButton; - GroupBoxAct: TGroupBox; Label17: TLabel; MemoCarre: TMemo; ListBoxAig: TListBox; @@ -120,7 +116,6 @@ type EditSuiv4: TEdit; CheckVerrouCarre: TCheckBox; CheckInverse: TCheckBox; - RadioButtonAccess: TRadioButton; CheckFenEt: TCheckBox; GroupBoxDivers: TGroupBox; CheckBoxInitAig: TCheckBox; @@ -152,30 +147,12 @@ type EditSpecUni: TEdit; LabelUni: TLabel; Buttonrestaure: TButton; - GroupBox14: TGroupBox; - ButtonNouvAcc: TButton; - ButtonSupAcc: TButton; GroupBox17: TGroupBox; ButtonNouvPN: TButton; ButtonSupPN: TButton; ButtonNouvFeu: TButton; ButtonSupFeu: TButton; ButtonInsFeu: TButton; - GroupBox18: TGroupBox; - EditAct: TEdit; - LabelActionneur: TLabel; - EditEtatActionneur: TEdit; - Label30: TLabel; - LabelTrain: TLabel; - EditTrainDecl: TEdit; - GroupBox19: TGroupBox; - LabelTempo: TLabel; - EditTempo: TEdit; - CheckRAZ: TCheckBox; - LabelFonction: TLabel; - EditFonctionAccess: TEdit; - Labela: TLabel; - EditEtatFoncSortie: TEdit; ButtonNouvAig: TButton; BoutSupAig: TButton; ButtonAjSup: TButton; @@ -202,23 +179,12 @@ type GroupBoxEtatTJD: TGroupBox; RadioButtonTJD2: TRadioButton; RadioButtonTJD4: TRadioButton; - RadioButtonSon: TRadioButton; - EditSon: TEdit; - LabelNomSon: TLabel; - SpeedButtonJoue: TSpeedButton; CheckBoxRazSignaux: TCheckBox; EditTempoFeu: TEdit; Label35: TLabel; Label36: TLabel; - ButtonTestAct: TButton; - RadioButtonActDet: TRadioButton; - RadioButtonZones: TRadioButton; - EditAct2: TEdit; OpenDialogSon: TOpenDialog; - SpeedButtonCharger: TSpeedButton; LabelNumBranche: TLabel; - EditTrainDest: TEdit; - Label42: TLabel; Label43: TLabel; CheckBandeauTCO: TCheckBox; CheckPosAig: TCheckBox; @@ -231,7 +197,6 @@ type CheckFVC: TCheckBox; CheckFRC: TCheckBox; Label40: TLabel; - RadioButtonAig: TRadioButton; GroupBox22: TGroupBox; RadioButtonDCC: TRadioButton; RadioButtonXpress: TRadioButton; @@ -294,7 +259,6 @@ type Label69: TLabel; LabelCrois: TLabel; ListBoxSig: TListBox; - ListBoxAct: TListBox; ListBoxPN: TListBox; PopupMenuListes: TPopupMenu; Slectionnertout1: TMenuItem; @@ -304,7 +268,6 @@ type N2: TMenuItem; outcopierentatquetexte1: TMenuItem; CheckBoxAffMemo: TCheckBox; - RadioButtonCde: TRadioButton; TabSheetPeriph: TTabSheet; ListBoxPeriph: TListBox; ButtonAjAccCom: TButton; @@ -312,7 +275,6 @@ type GroupBoxDesc: TGroupBox; Label71: TLabel; EditNomPeriph: TEdit; - ComboBoxAccComUSB: TComboBox; Label73: TLabel; LabelInfoAcc: TLabel; ButtonOuvreCom: TButton; @@ -357,8 +319,19 @@ type Label31: TLabel; Label39: TLabel; CheckBoxMsgAigInc: TCheckBox; - RadioButtonHorl: TRadioButton; - RadioButtonVit: TRadioButton; + TabSheet1: TTabSheet; + GroupBox15: TGroupBox; + ListBoxActions: TListBox; + ListBoxOperations: TListBox; + ButtonModAction: TButton; + Label44: TLabel; + Label48: TLabel; + RichEditInfo: TRichEdit; + Button1: TButton; + Button3: TButton; + ButtonTestAction: TButton; + PopupMenuActions: TPopupMenu; + ModifAction: TMenuItem; procedure ButtonAppliquerEtFermerClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure ListBoxAigMouseDown(Sender: TObject; Button: TMouseButton; @@ -368,20 +341,9 @@ type procedure RadioButton60kmhClick(Sender: TObject); procedure ComboBoxDecChange(Sender: TObject); procedure CheckVerrouCarreClick(Sender: TObject); - procedure EditActChange(Sender: TObject); - procedure EditEtatActionneurChange(Sender: TObject); - procedure EditTrainDeclChange(Sender: TObject); - procedure EditFonctionAccessChange(Sender: TObject); - procedure EditEtatFoncSortieChange(Sender: TObject); - procedure EditTempoChange(Sender: TObject); - procedure CheckRAZClick(Sender: TObject); procedure CheckInverseClick(Sender: TObject); procedure ComboBoxAspChange(Sender: TObject); procedure ButtonrestaureClick(Sender: TObject); - procedure RadioButtonLocClick(Sender: TObject); - procedure RadioButtonAccessClick(Sender: TObject); - procedure RichPNMouseDown(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); procedure EditAdrFermeChange(Sender: TObject); procedure EditCdeFermeChange(Sender: TObject); procedure EditAdrOuvreChange(Sender: TObject); @@ -432,18 +394,9 @@ type procedure PageControlChange(Sender: TObject); procedure RadioButtonTJD2Click(Sender: TObject); procedure RadioButtonTJD4Click(Sender: TObject); - procedure RadioButtonSonClick(Sender: TObject); - procedure EditSonChange(Sender: TObject); - procedure SpeedButtonJoueClick(Sender: TObject); procedure EditTempoFeuChange(Sender: TObject); - procedure ButtonTestActClick(Sender: TObject); - procedure RadioButtonActDetClick(Sender: TObject); - procedure RadioButtonZonesClick(Sender: TObject); - procedure EditAct2Change(Sender: TObject); - procedure SpeedButtonChargerClick(Sender: TObject); procedure RichBrancheKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); - procedure EditTrainDestChange(Sender: TObject); procedure ListBoxAigKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure ButtonEnregistreClick(Sender: TObject); @@ -452,7 +405,6 @@ type procedure CheckPnPulseClick(Sender: TObject); procedure CheckFVCClick(Sender: TObject); procedure CheckFRCClick(Sender: TObject); - procedure RadioButtonAigClick(Sender: TObject); procedure ButtonEnvClick(Sender: TObject); procedure EditBaseChange(Sender: TObject); procedure RichCdeDccppChange(Sender: TObject); @@ -467,8 +419,6 @@ type procedure EditVitNomChange(Sender: TObject); procedure EditVitRalentiChange(Sender: TObject); procedure CheckBoxVerifXpressNetClick(Sender: TObject); - procedure RichPNKeyDown(Sender: TObject; var Key: Word; - Shift: TShiftState); procedure ListBoxTrainsKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure ButtonPFCDMClick(Sender: TObject); @@ -496,10 +446,6 @@ type Shift: TShiftState; X, Y: Integer); procedure ListBoxSigKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); - procedure ListBoxActMouseDown(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); - procedure ListBoxActKeyDown(Sender: TObject; var Key: Word; - Shift: TShiftState); procedure ListBoxPNMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure ListBoxPNKeyDown(Sender: TObject; var Key: Word; @@ -508,15 +454,13 @@ type procedure Supprimer1Click(Sender: TObject); procedure Nouveau1Click(Sender: TObject); procedure outcopierentatquetexte1Click(Sender: TObject); - procedure RadioButtonCdeClick(Sender: TObject); procedure ButtonOuvreComClick(Sender: TObject); procedure ButtonAjAccComClick(Sender: TObject); procedure EditNomPeriphChange(Sender: TObject); procedure ListBoxPeriphMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - procedure ComboBoxAccComUSBChange(Sender: TObject); procedure ButtonSupAccComClick(Sender: TObject); - procedure ListBoxPeriphKeyDown(Sender: TObject; var Key: Word; + procedure ListBoxPeriphKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure RadioButtonSimpleClick(Sender: TObject); procedure RadioButtonZoneClick(Sender: TObject); @@ -544,8 +488,18 @@ type procedure EditAdrAigExit(Sender: TObject); procedure EditAdrAigChange(Sender: TObject); procedure FormActivate(Sender: TObject); - procedure RadioButtonHorlClick(Sender: TObject); - procedure RadioButtonVitClick(Sender: TObject); + procedure ButtonModActionClick(Sender: TObject); + procedure ListBoxActionsMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); + procedure ListBoxOperationsDrawItem(Control: TWinControl; + Index: Integer; Rect: TRect; State: TOwnerDrawState); + procedure ListBoxOperationsMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); + procedure ButtonTestActionClick(Sender: TObject); + procedure ModifActionClick(Sender: TObject); + procedure ListBoxActionsKeyDown(Sender: TObject; var Key: Word; + Shift: TShiftState); + procedure ListBoxOperationsDblClick(Sender: TObject); private { Déclarations privées } @@ -649,6 +603,8 @@ relanceHorl_init_ch='relanceHorl_init'; section_aig_ch='[section_aig]'; section_sig_ch='[section_sig]'; section_act_ch='[section_act]'; +section_actV2_ch='[section_actions]'; +section_PN_ch='[section_PN]'; section_branches_ch='[section_branches]'; section_dccpp_ch='[section_dcc++]'; section_initpp_ch='[init_dcc++]'; @@ -729,10 +685,15 @@ function decodeDCC(s : string) : string; function encode_aig(index : integer): string; function Ipok(s : string) : boolean; procedure couleurs_config; +function encode_actions(i : integer) : string; +function encode_act_pn(i : integer) : string; +function encode_Periph(index : integer) : string; +procedure ajoute_champs_combos(i : integer); implementation -uses UnitDebug,UnitTCO, UnitSR, UnitCDF,UnitAnalyseSegCDM, unitPilote, unitclock; +uses UnitDebug,UnitTCO, UnitSR, UnitCDF,UnitAnalyseSegCDM, unitPilote, unitclock, + UnitModifAction, UnitConfigCellTCO; {$R *.dfm} @@ -846,8 +807,6 @@ begin envoi_CDM(s); sleep(10); Application.ProcessMessages; - SauvefiltrageDet0:=filtrageDet0; // en mode cdm,filtrage détecteur à 0 - filtrageDet0:=0; result:=true; end else @@ -1630,8 +1589,63 @@ begin end; end; +// transforme l'action en chaine +function encode_actions(i : integer) : string; +var s : string; + decl,action,Nb,j: integer; +begin + if (i<1) or (i>maxTablo_act) then + begin + encode_actions:=''; + exit; + end; + + s:=Tablo_Actionneur[i].NomAction+','; + + decl:=Tablo_Actionneur[i].declencheur; + + s:=s+'D'+intToSTR(decl)+','; + case decl of + declHorloge : s:=s+intToSTR(Tablo_Actionneur[i].heure)+','+intToSTR(Tablo_Actionneur[i].minute)+','; + declPeriph : s:=s+intToSTR(Tablo_Actionneur[i].NumPeriph)+','+Tablo_Actionneur[i].ordrePeriph+','; + DeclAccessoire : s:=s+intToSTR(Tablo_Actionneur[i].adresse)+','+intToSTR(Tablo_Actionneur[i].etat)+','; + DeclDetAct : s:=s+intToSTR(Tablo_Actionneur[i].adresse)+','+intToSTR(Tablo_Actionneur[i].etat)+','+Tablo_Actionneur[i].trainDecl+','; + DeclZoneDet : s:=s+intToSTR(Tablo_Actionneur[i].adresse)+','+intToSTR(Tablo_Actionneur[i].adresse2)+','+intToSTR(Tablo_Actionneur[i].etat)+','+Tablo_Actionneur[i].trainDecl+','; + end; + + Nb:=Tablo_Actionneur[i].NbOperations; + s:=s+'N'+intToSTR(nb)+','; + + for j:=1 to Nb do + begin + action:=Tablo_Actionneur[i].TabloOp[j].numoperation; + s:=s+'A'+intToSTR(action); + if Tablo_Actionneur[i].TabloOp[j].valide then s:=s+',1' else s:=s+',0'; + case action of + ActionAffTCO : s:=s+','+intToSTR(Tablo_Actionneur[i].tabloOp[j].NumTCO); + ActionAccessoire: begin + s:=s+','+intToSTR(Tablo_Actionneur[i].tabloOp[j].adresse)+','+intToSTR(Tablo_Actionneur[i].tabloOp[j].etat)+','; + if tablo_Actionneur[i].tabloOp[j].zero then s:=s+'Z' else s:=s+'S'; + end; + + ActionVitesse : s:=s+','+intToSTR(Tablo_Actionneur[i].tabloOp[j].vitesse)+','+Tablo_Actionneur[i].tabloOp[j].train; + ActionCdePeriph : s:=s+','+intToSTR(Tablo_Actionneur[i].tabloOp[j].periph)+','+Tablo_Actionneur[i].tabloOp[j].chaine; + ActionFonctionF : s:=s+','+intToSTR(Tablo_Actionneur[i].tabloOp[j].fonctionF)+','+intToSTR(Tablo_Actionneur[i].tabloOp[j].TempoF)+','+Tablo_Actionneur[i].tabloOp[j].train; + ActionSon : s:=s+','+Tablo_Actionneur[i].tabloOp[j].train; // nom du fichier + ActionTempo : s:=s+','+intToSTR(Tablo_Actionneur[i].tabloOp[j].TempoF); + end; + + if j'' then writeln(fichierN,s); end; + } writeln(fichierN,'/------------'); - // actionneurs PN + writeln(fichierN,section_PN_ch); + // PN for i:=1 to NbrePN do begin s:=encode_act_pn(i); @@ -2019,6 +2038,16 @@ begin end; writeln(fichierN,'0'); + writeln(fichierN,'/------------'); + // actionnneurs V2 + writeln(fichierN,section_actV2_ch); + for i:=1 to maxTablo_act do + begin + s:=encode_actions(i); + if s<>'' then writeln(fichierN,s); + end; + writeln(fichierN,'0'); + writeln(fichierN,'/------------'); writeln(fichierN,section_dccpp_ch); writeln(fichierN,EnvAigDccpp_ch+'=',EnvAigDccpp); @@ -2291,51 +2320,162 @@ var s,sa,SOrigine: string; NbreBranches:=i-1; end; + procedure compile_pn;// Passage à niveau + begin + repeat + s:=lit_ligne; + s:=sOrigine; + if s<>'0' then + begin + if pos('PN',uppercase(s))<>0 then + begin + //if k>0 then Tablo_actionneur[maxTablo_act].TabloOp[k].numoperation:=ActionPN; + inc(NbrePN); + NbreVoies:=0; + repeat + inc(NbreVoies); + Delete(s,1,1); // supprime ( + // déterminer si il y a un - avant le ) + j:=pos(')',s); + i:=pos('-',s); + if (i0) then + begin + // zone de détection + Tablo_PN[NbrePN].actionneur:=false; + val(s,j,erreur); + Tablo_PN[NbrePN].voie[NbreVoies].detZ1F:=j; + delete(s,1,erreur); + + val(s,j,erreur); + Tablo_PN[NbrePN].voie[NbreVoies].detZ2F:=j; + delete(s,1,erreur); + + val(s,j,erreur); + Tablo_PN[NbrePN].voie[NbreVoies].detZ1O:=j; + delete(s,1,erreur); + + val(s,j,erreur); + Tablo_PN[NbrePN].voie[NbreVoies].detZ2O:=j; + end + else + begin + // actionneurs + Tablo_PN[NbrePN].actionneur:=true; + val(s,j,erreur); + Tablo_PN[NbrePN].voie[NbreVoies].ActFerme:=j; + // Affiche('Ferme='+intToSTR(j),clyellow); + i:=pos(',',s); + Delete(S,1,i); + val(s,j,erreur); + Tablo_PN[NbrePN].voie[NbreVoies].ActOuvre:=j; + // Affiche('Ouvre='+intToSTR(j),clyellow); + end; + + i:=pos(')',s);Delete(S,1,i); + i:=pos(',',s);Delete(S,1,i); + Tablo_PN[NbrePN].compteur:=0; + until (copy(s,1,2)='PN') or (NbreVoies=5); + + Tablo_PN[NbrePN].NbVoies:=NbreVoies; + Delete(s,1,3); // Supprime PN( + val(s,j,erreur); + Tablo_PN[NbrePN].Adresseferme:=j; // adresse ferme ou numéro accessoire + Delete(s,1,erreur); + // prendre le 4 paramètre (commande ACC ou COMUSB + i:=pos(',',s); + i:=posEx(',',s,i+1); + i:=posEx(',',s,i+1); + i:=posEx(',',s,i+1); + val(copy(s,i+1,1),asp,erreur); + if asp=0 then // S peut peut être un nombre ou une chaine + begin + val(s,j,erreur); + Tablo_PN[NbrePN].CommandeFerme:=j; + j:=pos(',',s); + Delete(s,1,j); // supprime séparateurs + + val(s,j,erreur); + Tablo_PN[NbrePN].AdresseOuvre:=j; + Delete(s,1,erreur); + val(s,j,erreur); + Tablo_PN[NbrePN].CommandeOuvre:=j; + end + else + begin + // commande usb + i:=pos(',',s); + Tablo_PN[NbrePN].CommandeF:=copy(s,1,i-1); + delete(s,1,i); + i:=pos(',',s); + Tablo_PN[NbrePN].CommandeO:=copy(s,1,i-1); + delete(s,1,i); + end; + j:=pos(')',s); + Delete(s,1,j); // supprime séparateurs + if length(s)>0 then + begin + // champ impulsion nouvelle syntaxe + if s[1]=',' then delete(s,1,1); + val(s,i,erreur); + Tablo_PN[NbrePN].Pulse:=i; + if erreur<>0 then + begin + delete(s,1,erreur); + val(s,i,erreur); + Tablo_PN[NbrePN].TypeCde:=i; + end; + s:=''; + end; + end; + end; + until s='0'; + end; + + // anciens procedure compile_actionneurs; var i : integer; begin + NbrePN:=0; + confasauver:=true; // raz des actionneurs for i:=1 to Max_actionneurs do begin Tablo_actionneur[i].trainDecl:=''; - Tablo_actionneur[i].trainDest:=''; Tablo_actionneur[i].etat:=0; Tablo_actionneur[i].adresse:=0; Tablo_actionneur[i].adresse2:=0; - Tablo_Actionneur[i].typdeclenche:=0; - Tablo_actionneur[i].accessoire:=0; - Tablo_actionneur[i].sortie:=0; - Tablo_actionneur[i].fichierSon:=''; - Tablo_actionneur[i].loco:=false; - Tablo_actionneur[i].act:=false; - Tablo_actionneur[i].son:=false; - Tablo_actionneur[i].periph:=false; + Tablo_actionneur[i].trainDecl:=''; + Tablo_actionneur[i].declencheur:=0; end; maxTablo_act:=1; - NbrePN:=0;Nligne:=1; + Nligne:=1; - // définition des actionneurs + // définition des actionneurs et des PN intégrés anciens repeat s:=lit_ligne; - if (s<>'0') and (s<>'') then + if (s<>'0') and (s<>'') then begin + if (s[1]<>'(') then + begin + // premier champ type de déclencheur-------------------- // nombre = actionneur/détecteur // MEM = zone // Aaiguillage = aiguillage s:=sOrigine; // travailler en min/maj + Tablo_actionneur[maxtablo_act].NomAction:='Action '+intToSTR(maxtablo_act); // évènement actionneur par horloge if (upcase(s[1])='H') then begin - Tablo_actionneur[maxtablo_act].typdeclenche:=1; // type horloge + Tablo_actionneur[maxtablo_act].declencheur:=DeclHorloge; Delete(s,1,1); val(s,j,erreur); - Tablo_actionneur[maxtablo_act].adresse:=j; //heure + Tablo_actionneur[maxtablo_act].heure:=j; //heure delete(s,1,erreur); val(s,j,erreur); - Tablo_actionneur[maxtablo_act].adresse2:=j; // minute + Tablo_actionneur[maxtablo_act].minute:=j; // minute delete(s,1,erreur); i:=pos(',',s); delete(s,1,i); @@ -2344,10 +2484,10 @@ var s,sa,SOrigine: string; end else - // évènement actionneur par aiguillage + // évènement actionneur par accessoire if (upcase(s[1])='A') then begin - Tablo_actionneur[maxtablo_act].typdeclenche:=2; // type aiguillage + Tablo_actionneur[maxtablo_act].declencheur:=DeclAccessoire; Delete(s,1,1); val(s,j,erreur); Tablo_actionneur[maxtablo_act].adresse:=j; @@ -2362,7 +2502,7 @@ var s,sa,SOrigine: string; else if upcase(s[1])='M' then //MEM[ begin - Tablo_actionneur[maxtablo_act].typdeclenche:=3; // type mémoire de zone + Tablo_actionneur[maxtablo_act].declencheur:=DeclZoneDet; Delete(s,1,4); val(s,j,erreur); Tablo_actionneur[maxtablo_act].adresse:=j; @@ -2382,7 +2522,7 @@ var s,sa,SOrigine: string; if (s[1]<>'(') then begin // nombre - Tablo_actionneur[maxtablo_act].typdeclenche:=0; // type actionneur 0=actionneur/détecteur + Tablo_actionneur[maxtablo_act].declencheur:=DeclDetAct; val(s,j,erreur); Tablo_actionneur[maxtablo_act].adresse:=j; delete(s,1,erreur); @@ -2398,25 +2538,25 @@ var s,sa,SOrigine: string; // A,etat,X // "fichierson" // ACCnum + setlength(tablo_actionneur[maxtablo_act].TabloOp,2); + tablo_actionneur[maxtablo_act].NbOperations:=1; + tablo_actionneur[maxtablo_act].TabloOp[1].valide:=true; + if upcase(s[1])='F' then begin // -----------------fonction loco - Tablo_actionneur[maxtablo_act].act:=false; - Tablo_actionneur[maxtablo_act].loco:=true; - Tablo_actionneur[maxtablo_act].son:=false; - Tablo_actionneur[maxtablo_act].periph:=false; - Tablo_actionneur[maxtablo_act].vit:=false; + Tablo_actionneur[maxTablo_act].TabloOp[1].numoperation:=ActionFonctionF; delete(s,1,1); val(s,j,erreur); - Tablo_actionneur[maxTablo_act].fonction:=j; + Tablo_actionneur[maxTablo_act].TabloOp[1].fonctionF:=j; Delete(s,1,erreur); val(s,j,erreur); - Tablo_actionneur[maxTablo_act].tempo:=j; + Tablo_actionneur[maxTablo_act].TabloOp[1].TempoF:=j div 100; Delete(s,1,erreur); - Tablo_actionneur[maxTablo_act].trainDest:=s; + Tablo_actionneur[maxTablo_act].TabloOp[1].train:=s; inc(maxTablo_act); end @@ -2425,21 +2565,17 @@ var s,sa,SOrigine: string; if upcase(s[1])='V' then begin // -----------------vitesse - Tablo_actionneur[maxtablo_act].act:=false; - Tablo_actionneur[maxtablo_act].loco:=false; - Tablo_actionneur[maxtablo_act].son:=false; - Tablo_actionneur[maxtablo_act].periph:=false; - Tablo_actionneur[maxtablo_act].vit:=true; + Tablo_actionneur[maxTablo_act].TabloOp[1].numoperation:=ActionVitesse; delete(s,1,1); i:=pos(',',s); if i=0 then sa:=s; sa:=copy(s,1,i-1); - val(sa,j,erreur); - Tablo_actionneur[maxTablo_act].fonction:=j; + val(sa,j,erreur); + Tablo_actionneur[maxTablo_act].TabloOp[1].vitesse:=j; Delete(s,1,i); - Tablo_actionneur[maxTablo_act].trainDest:=s; + Tablo_actionneur[maxTablo_act].TabloOp[1].train:=s; inc(maxTablo_act); end @@ -2448,18 +2584,14 @@ var s,sa,SOrigine: string; if uppercase(copy(s,1,3))='ACC' then begin // -----------------fonction commande périphérique com usb - Tablo_actionneur[maxtablo_act].act:=false; - Tablo_actionneur[maxtablo_act].loco:=false; - Tablo_actionneur[maxtablo_act].son:=false; - Tablo_actionneur[maxtablo_act].periph:=true; - Tablo_actionneur[maxtablo_act].vit:=false; + Tablo_actionneur[maxTablo_act].TabloOp[1].numoperation:=ActionCdePeriph; delete(s,1,3); val(s,j,erreur); - Tablo_actionneur[maxTablo_act].fonction:=j; // numéro d'accessoire + Tablo_actionneur[maxTablo_act].TabloOp[1].periph:=j; Delete(s,1,erreur); - Tablo_actionneur[maxTablo_act].trainDest:=s; + Tablo_actionneur[maxTablo_act].TabloOp[1].chaine:=s; { @@ -2477,49 +2609,43 @@ var s,sa,SOrigine: string; if s[1]='"' then begin // -----------------son - Tablo_actionneur[maxtablo_act].act:=false; - Tablo_actionneur[maxtablo_act].son:=true; - Tablo_actionneur[maxtablo_act].loco:=false; - Tablo_actionneur[maxtablo_act].periph:=false; - Tablo_actionneur[maxtablo_act].vit:=false; + Tablo_actionneur[maxTablo_act].TabloOp[1].numoperation:=ActionSon; + delete(s,1,1); i:=pos('"',s); s:=copy(s,1,i-1); - Tablo_actionneur[maxtablo_act].FichierSon:=s; + Tablo_actionneur[maxTablo_act].TabloOp[1].train:=s; s:=''; inc(maxTablo_act); end else - // périphérique + // accessoire if length(s)>0 then if (upcase(s[1])='A') and (upcase(s[2])<>'C') then begin - Tablo_actionneur[maxtablo_act].act:=true; - Tablo_actionneur[maxtablo_act].son:=false; - Tablo_actionneur[maxtablo_act].loco:=false; - Tablo_actionneur[maxtablo_act].periph:=false; - Tablo_actionneur[maxtablo_act].vit:=false; + Tablo_actionneur[maxTablo_act].TabloOp[1].numoperation:=ActionAccessoire; delete(s,1,1); val(s,j,erreur); - Tablo_actionneur[maxTablo_act].accessoire:=j; + Tablo_actionneur[maxTablo_act].TabloOp[1].adresse:=j; delete(s,1,erreur); val(s,j,erreur); - Tablo_actionneur[maxTablo_act].sortie:=j; + Tablo_actionneur[maxTablo_act].TabloOp[1].etat:=j; Delete(s,1,erreur); - Tablo_actionneur[maxTablo_act].RAZ:=s[1]='Z'; + Tablo_actionneur[maxTablo_act].TabloOp[1].zero:=s[1]='Z'; inc(maxTablo_act); s:=''; end; inc(Nligne); - - // Passage à niveau + end; + // Passage à niveau----------------------------------------- if (pos('PN',s)<>0) then begin + s:=sOrigine; inc(NbrePN); NbreVoies:=0; repeat @@ -2555,7 +2681,7 @@ var s,sa,SOrigine: string; Tablo_PN[NbrePN].voie[NbreVoies].ActFerme:=j; // Affiche('Ferme='+intToSTR(j),clyellow); i:=pos(',',s); - Delete(S,1,i); + Delete(S,1,i); val(s,j,erreur); Tablo_PN[NbrePN].voie[NbreVoies].ActOuvre:=j; // Affiche('Ouvre='+intToSTR(j),clyellow); @@ -2564,7 +2690,7 @@ var s,sa,SOrigine: string; i:=pos(')',s);Delete(S,1,i); i:=pos(',',s);Delete(S,1,i); Tablo_PN[NbrePN].compteur:=0; - until (copy(s,1,2)='PN') or (NbreVoies=5); + until (uppercase(copy(s,1,2))='PN') or (NbreVoies=5); Tablo_PN[NbrePN].NbVoies:=NbreVoies; Delete(s,1,3); // Supprime PN( @@ -2622,6 +2748,194 @@ var s,sa,SOrigine: string; end; until (s='0') or eof(fichier) ; dec(maxTablo_act); + + end; + + // nouveaux + procedure compile_actions; + var n,k,l : integer; + begin + maxTablo_act:=1; + Nligne:=1; + + // définition des actions + repeat + s:=lit_ligne; + s:=sOrigine; + if (s<>'0') and (s<>'') then + begin + i:=pos(',',s); + sa:=copy(s,1,i-1); + if sa='' then sa:='Action '+intToSTR(maxtablo_act); + Tablo_actionneur[maxtablo_act].NomAction:=sa; + Delete(s,1,i); + // déclencheur + delete(s,1,1); + Val(s,n,erreur); + Tablo_actionneur[maxtablo_act].declencheur:=n; + Delete(s,1,erreur); + case n of + Declhorloge : + begin + Val(s,i,erreur);Delete(s,1,erreur); + Tablo_actionneur[maxtablo_act].heure:=i; + Val(s,i,erreur);Delete(s,1,erreur); + Tablo_actionneur[maxtablo_act].minute:=i; + end; + DeclPeriph : + begin + Val(s,i,erreur);Delete(s,1,erreur); + Tablo_actionneur[maxtablo_act].NumPeriph:=i; + i:=pos(',',s); + sa:=copy(s,1,i-1);delete(s,1,i); + Tablo_actionneur[maxtablo_act].ordrePeriph:=sa; + end; + DeclAccessoire : + begin + Val(s,i,erreur);Delete(s,1,erreur); + Tablo_actionneur[maxtablo_act].adresse:=i; + Val(s,i,erreur);Delete(s,1,erreur); + Tablo_actionneur[maxtablo_act].etat:=i; + end; + DeclDetAct : + begin + Val(s,i,erreur);Delete(s,1,erreur); + Tablo_actionneur[maxtablo_act].adresse:=i; + Val(s,i,erreur);Delete(s,1,erreur); + Tablo_actionneur[maxtablo_act].etat:=i; + i:=pos(',',s); + sa:=copy(s,1,i-1);delete(s,1,i); + Tablo_actionneur[maxtablo_act].trainDecl:=sa; + end; + DeclZoneDet : + begin + Val(s,i,erreur);Delete(s,1,erreur); + Tablo_actionneur[maxtablo_act].adresse:=i; + Val(s,i,erreur);Delete(s,1,erreur); + Tablo_actionneur[maxtablo_act].adresse2:=i; + Val(s,i,erreur);Delete(s,1,erreur); + Tablo_actionneur[maxtablo_act].etat:=i; + i:=pos(',',s); + sa:=copy(s,1,i-1);delete(s,1,i); + Tablo_actionneur[maxtablo_act].trainDecl:=sa; + end; + end; + + // nombre d'actions + delete(s,1,1); + Val(s,n,erreur); + Tablo_actionneur[maxtablo_act].NbOperations:=n; + Delete(s,1,erreur); + + setlength(Tablo_actionneur[maxtablo_act].TabloOp,n+1); + for k:=1 to n do + begin + delete(s,1,1); + val(s,j,erreur); delete(s,1,erreur); + // numéro de l'opération + if (j<0) or (j>NbreOperations) then + begin + Affiche('Action '+intToSTR(maxtablo_act)+' dans opération n°'+intToSTR(k)+' : op inconnue :'+intToSTR(j),clred); + end; + Tablo_actionneur[maxtablo_act].tabloOP[k].numoperation:=j; + val(s,l,erreur); delete(s,1,erreur); + // état validé ou dévalidé + Tablo_actionneur[maxtablo_act].tabloOP[k].valide:=l=1; + // paramètres des opérations + case j of + ActionAffTCO : + begin + Val(s,i,erreur); + Tablo_actionneur[maxtablo_act].tabloOp[k].NumTCO:=i; + end; + ActionAffSC : begin end; + ActionAffCDM : begin end; + + ActionAccessoire : + begin + Val(s,i,erreur);Delete(s,1,erreur); + Tablo_actionneur[maxtablo_act].tabloOp[k].adresse:=i; + Val(s,i,erreur);Delete(s,1,erreur); + Tablo_actionneur[maxtablo_act].tabloOp[k].etat:=i; + i:=pos(',',s); + if i<>0 then + begin + sa:=copy(s,1,i-1);delete(s,1,i); + end + else sa:=s; + Tablo_actionneur[maxtablo_act].tabloOp[k].zero:=sa='Z'; + delete(s,1,1); + end; + ActionArretTrains : begin end; + ActionLanceHorl : begin end; + ActionArretHorl : begin end; + ActionInitHorl : begin end; + ActionAffHorl : begin end; + ActionVitesse : + begin + Val(s,i,erreur);Delete(s,1,erreur); + Tablo_actionneur[maxtablo_act].tabloOp[k].vitesse:=i; + i:=pos(',',s); + if i<>0 then + begin + sa:=copy(s,1,i-1);delete(s,1,i); + end + else sa:=s; + Tablo_actionneur[maxtablo_act].tabloOp[k].train:=sa; + end; + ActionCdePeriph : + begin + Val(s,i,erreur);Delete(s,1,erreur); + + Tablo_actionneur[maxtablo_act].tabloOp[k].periph:=i; + i:=pos(',',s); + if i<>0 then + begin + sa:=copy(s,1,i-1);delete(s,1,i); + end + else sa:=s; + Tablo_actionneur[maxtablo_act].tabloOp[k].chaine:=sa; + end; + ActionFonctionF : + begin + Val(s,i,erreur);Delete(s,1,erreur); + Tablo_actionneur[maxtablo_act].tabloOp[k].fonctionF:=i; + Val(s,i,erreur);Delete(s,1,erreur); + Tablo_actionneur[maxtablo_act].tabloOp[k].TempoF:=i; + i:=pos(',',s); + if i<>0 then + begin + sa:=copy(s,1,i-1);delete(s,1,i); + end + else sa:=s; + Tablo_actionneur[maxtablo_act].tabloOp[k].train:=sa; + end; + ActionSon : + begin + i:=pos(',',s); + if i<>0 then + begin + sa:=copy(s,1,i-1);delete(s,1,i); + end + else sa:=s; + Tablo_actionneur[maxtablo_act].tabloOp[k].train:=sa; + end; + actionTempo : + begin + Val(s,i,erreur);Delete(s,1,erreur); + Tablo_actionneur[maxtablo_act].tabloOp[k].TempoF:=i; + end; + else + begin + if sOrigine<>'' then Affiche('Erreur 83: Action '+intToSTR(j)+' inconnue '+sOrigine,clred); + Tablo_actionneur[maxtablo_act].TabloOp[k].numoperation:=0; + end; + end; + end; + inc(maxTablo_act); + end; + until (s='0') or eof(fichier) ; + dec(maxTablo_act); end; procedure compile_aiguillages; @@ -2632,7 +2946,7 @@ var s,sa,SOrigine: string; repeat s:=lit_ligne; inc(Nligne); - //Affiche(s,ClLime); + //Affiche(s,ClLime); //chaine:=s; if debugconfig then Affiche(s,ClLime); if (s<>'0') then @@ -3975,7 +4289,7 @@ var s,sa,SOrigine: string; trier_sig; end; - // section actionneurs + // section anciens actionneurs sa:=uppercase(section_act_ch); if pos(sa,s)<>0 then begin @@ -3983,6 +4297,22 @@ var s,sa,SOrigine: string; compile_actionneurs; end; + // section PN + sa:=uppercase(section_PN_ch); + if pos(sa,s)<>0 then + begin + compile_PN; + end; + + + // section actionneurs + sa:=uppercase(section_actV2_ch); + if pos(sa,s)<>0 then + begin + compile_actions; + end; + + // section dcc++ sa:=uppercase(section_dccpp_ch); if pos(sa,s)<>0 then @@ -4729,10 +5059,10 @@ begin if j=2 then s:=Tablo_periph[i].nom+' ('+Tablo_periph[i].protocole+')'; With formconfig do begin - ComboBoxAccComUSB.Items.Add(s); - ComboBoxPNCom.Items.Add(s); + ComboBoxPNCom.Items.Add(s); ComboBoxDecCde.Items.Add(s); end; + formModifAction.ComboBoxAccComUSB.Items.Add(s); end; @@ -4741,9 +5071,9 @@ procedure fabrique_combos_periph; var i : integer; s : string; begin + formModifAction.ComboBoxAccComUSB.clear; with FormConfig.ListBoxPeriph,FormConfig do begin - ComboBoxAccComUSB.Clear; ComboBoxPNCom.clear; ComboBoxDecCde.clear; for i:=0 to Count-1 do @@ -4757,7 +5087,7 @@ end; // met à jour le nom d'un champ d'index i dans les combos des périphériques procedure maj_champs_combos(i: integer); -var j,n : integer; +var op,j,n : integer; s : string; begin s:=Tablo_periph[i].nom; @@ -4776,17 +5106,21 @@ begin if j=2 then s:=s+' ('+Tablo_periph[i].protocole+')'; with formconfig do begin - n:=comboBoxACCComUSB.Items.Count; + n:=formModifAction.comboBoxACCComUSB.Items.Count; if n=0 then exit; if nmaxTablo_act ; i:=1; @@ -5018,6 +5355,7 @@ begin Aig_supprime.Adresse:=0; Signal_Supprime.Adresse:=0; Signal_sauve.adresse:=0; + AncLigneCliqueePN:=-1; clicListe:=false; ligneCherche:=0; Compt_ligne:=0; @@ -5198,22 +5536,21 @@ begin end; end; - - GroupBoxPN.Top:=16; + GroupBoxPN.Top:=20; // composants onglet passage à niveau with GroupBoxPNA do begin Left:=8; top:=GroupBoxPN.Top+GroupBoxPN.Height+5; - width:=240; + width:=GroupBoxPN.Width; height:=200; - visible:=false; + visible:=true; end; with GroupBoxPNZ do begin Left:=8; top:=GroupBoxPN.Top+GroupBoxPN.Height+5; - width:=240; + width:=GroupBoxPN.Width; height:=200; visible:=false; end; @@ -5756,19 +6093,30 @@ begin comboBoxNation.Items.add('Française'); comboBoxNation.Items.add('Belge'); - EdittrainDecl.Hint:='Train(s) déclencheur(s) séparés par des virgules pour lesquels la condition s''applique.' - +#13+'Mettre X pour tous les trains.'+#13+'Déclenchement par actionneur uniquement'; - // actionneurs Train ou accessoire - ListBoxAct.Clear; + + // actionneurs actions + ListBoxActions.Clear; + longestLength:=0; for i:=1 to maxTablo_act do begin - s:=encode_act_loc_son(i); + s:=encode_actions(i); if s<>'' then begin - ListBoxAct.Items.Add(s); + ListBoxActions.Items.add(s); + // trouver la chaine la plus longue pour la future scrollbar + l:=Length(s); + if l>LongestLength then + begin + LongestString:=s; + LongestLength:=l; + end; end; end; + PixelLength:=ListBoxActions.Canvas.TextWidth(LongestString)+GetSystemMetrics(SM_CXFRAME); + // positionne une scrollbar dans la listbox - pour l'enlever, envoyer 0 dans pixelLength + // marche pas!! + SendMessage(ListBoxActions.Handle,LB_SETHORIZONTALEXTENT,PixelLength,0); // actionneurs PN ListBoxPN.Clear; @@ -5792,9 +6140,6 @@ begin // positionne une scrollbar dans la listbox - pour l'enlever, envoyer 0 dans pixelLength SendMessage(ListBoxPN.Handle,LB_SETHORIZONTALEXTENT,PixelLength,0); - GroupBoxRadio.Visible:=false; - GroupBoxAct.Visible:=false; - GroupBoxPN.Visible:=false; if clicproprietes then clicListeSignal(IndexSignalClic); clicproprietes:=false; @@ -5819,18 +6164,7 @@ begin for i:=1 to ntrains do items.Add(Train_tablo(i)); end; - // périphériques - with listBoxPeriph do - begin - clear; - formConfig.ComboBoxAccComUSB.Clear; - formconfig.ComboBoxPNCom.Clear; - for i:=1 to NbPeriph do - begin - items.Add(encode_Periph(i)); - ajoute_champs_combos(i); - end; - end; + // composants dynamiques car on ne peut plus ajouter de composants en mode conception! // onglet périphériques COM/USB/Socket @@ -6313,7 +6647,7 @@ end; // renvoie les utilisateurs des périphériques en fonction de la sélection du périphérique function utilisateurs_peripheriques : string; -var i,j,n : integer; +var i,j,n,op : integer; s : string; begin n:=0; @@ -6321,16 +6655,19 @@ begin s:=s+'------------------------'+#13; for i:=1 to maxTablo_act do begin - if tablo_actionneur[i].periph then + for op:=1 to tablo_actionneur[i].NbOperations do begin - for j:=0 to NbPeriph-1 do + if tablo_actionneur[i].tabloOp[op].numoperation=ActionCdePeriph then begin - if formconfig.ListBoxPeriph.selected[j] then - if tablo_actionneur[i].fonction=j+1 then - begin - inc(n); - s:=s+'Le périphérique '+intToSTR(j+1)+' est utilisé par l''actionneur '+intToSTR(tablo_actionneur[i].adresse)+#13; - end; + for j:=0 to NbPeriph-1 do + begin + if formconfig.ListBoxPeriph.selected[j] then + if tablo_actionneur[i].TabloOp[op].periph=j+1 then + begin + inc(n); + s:=s+'Le périphérique '+intToSTR(j+1)+' est utilisé par l''actionneur '+intToSTR(tablo_actionneur[i].adresse)+#13; + end; + end; end; end; end; @@ -6653,322 +6990,6 @@ begin clicListe:=false; end; -procedure champs_type_pn; -begin - with formconfig do - begin - GroupBoxPN.width:=GroupBox13.width-15; - RadioGroupActPN.Width:=GroupBoxPN.Width-15; - GroupBoxPNA.width:=GroupBox13.Width-15; - GroupBoxPNZ.width:=GroupBox13.Width-15; - - ButtonTestFerme.Left:=215; - ButtonTestOuvre.Left:=215; - - GroupBoxRadio.Visible:=false; - GroupBoxAct.Visible:=false; - GroupBoxPN.Top:=16; - GroupBoxPN.Left:=8; - GroupBoxPNA.Visible:=true; - GroupBoxPN.Visible:=true; - Visible:=true; - RadioButtonLoc.Checked:=false; - RadioButtonAccess.Checked:=false; - RadioButtonSon.Checked:=false; - EditSon.Visible:=false; - SpeedButtonJoue.Visible:=false; - SpeedButtonCharger.Visible:=false; - - LabelNomSon.Visible:=false; - end; -end; - -procedure positionne; -begin - with formconfig do - begin - GroupBoxRadio.Visible:=true; - GroupBoxRadio.top:=16; - GroupBoxRadio.Left:=8; - GroupBoxRadio.Width:=GroupBox13.width-15; - - GroupBox13.Width:=266; - - GroupBoxAct.Top:=GroupBoxRadio.Top+GroupBoxRadio.Height+8; - GroupBoxAct.Left:=8; - GroupBoxAct.Height:=310; - GroupBoxAct.Width:=GroupBox13.width-15; - - GroupBox18.Top:=16; - GroupBox18.Width:=GroupBoxAct.Width-15; - GroupBox18.Height:=150; - - GroupBox19.Top:=GroupBox18.Top+GroupBox18.Height+8; - GroupBox19.Left:=8; - GroupBox19.Width:=GroupBoxAct.Width-15; - GroupBox19.Height:=96; - ButtonTestAct.Top:=GroupBox19.Top+GroupBox19.Height+8; - - end; -end; - -procedure champs_type_vit; -begin - with formconfig do - begin - positionne; - CheckRaz.Visible:=false; - ComboBoxAccComUSB.Visible:=false; - GroupBoxAct.Caption:='Action pour vitesse locomotive'; - - editTrainDest.Hint:='Train(s) destinataire(s) de la vitesse'; - LabelTempo.Visible:=true; EditTempo.visible:=true; editEtatFoncSortie.visible:=false;LabelA.Visible:=false; - LabelFonction.visible:=true; - LabelFonction.caption:='Vitesse'; - EditFonctionAccess.Hint:='Une vitesse positive ou négative contrôle le sens'+#13+ - 'Une vitesse nulle arrête le train'; - - RadioButtonLoc.Checked:=false; - RadioButtonAccess.Checked:=false; - RadioButtonSon.Checked:=false; - RadioButtonCde.Checked:=false; - RadioButtonVit.Checked:=true; - - EditFonctionAccess.Top:=14; - LabelFonction.Top:=18; - - editTempo.Visible:=false; - labelTempo.visible:=false; - GroupBoxAct.Visible:=true; - GroupBoxPN.Visible:=false; - GroupBoxPNA.Visible:=false; - GroupBoxPNZ.Visible:=false; - EditSon.Visible:=false; - SpeedButtonJoue.Visible:=false; - SpeedButtonCharger.Visible:=false; - EditFonctionAccess.Visible:=true; - LabelNomSon.Visible:=false; - editTrainDest.Visible:=true; - label42.Visible:=true; - Label42.caption:='Train dest'; - end; -end; - -procedure champs_type_loco; -begin - with formconfig do - begin - positionne; - CheckRaz.Visible:=false; - ComboBoxAccComUSB.Visible:=false; - GroupBoxAct.Caption:='Action pour fonction F de locomotive'; - EditFonctionAccess.Hint:='Numéro de fonction du décodeur du train (0 à 12 ou 28)'; - editTrainDest.Hint:='Train(s) destinataire(s) de la fonction F'; - LabelTempo.Visible:=true; EditTempo.visible:=true; editEtatFoncSortie.visible:=false;LabelA.Visible:=false; - LabelFonction.visible:=true; - LabelFonction.caption:='Action : Fonction'; - RadioButtonLoc.Checked:=true; - RadioButtonAccess.Checked:=false; - RadioButtonSon.Checked:=false; - RadioButtonCde.Checked:=false; - RadioButtonVit.Checked:=false; - EditFonctionAccess.Top:=14; - LabelFonction.Top:=18; - - GroupBoxAct.Visible:=true; - GroupBoxPN.Visible:=false; - GroupBoxPNA.Visible:=false; - GroupBoxPNZ.Visible:=false; - EditSon.Visible:=false; - SpeedButtonJoue.Visible:=false; - SpeedButtonCharger.Visible:=false; - EditFonctionAccess.Visible:=true; - LabelNomSon.Visible:=false; - editTrainDest.Visible:=true; - label42.Visible:=true; - Label42.caption:='Train dest'; - end; -end; - -procedure champs_type_periph; -begin - with formconfig do - begin - positionne; - editTrainDest.Hint:='Commande ASCII'; - EditFonctionAccess.visible:=false; - ComboBoxAccComUSB.Visible:=true; - CheckRaz.Visible:=false; - GroupBoxAct.Caption:='Action pour commande sur COM/USB'; - LabelTempo.Visible:=true; EditTempo.visible:=true; editEtatFoncSortie.visible:=false;LabelA.Visible:=false; - LabelFonction.visible:=true; - LabelFonction.caption:='Périphérique COM/USB/Socket'; - LabelFonction.Top:=18; - ComboBoxAccComUSB.Top:=32; - - RadioButtonLoc.Checked:=false; - RadioButtonAccess.Checked:=false; - RadioButtonSon.Checked:=false; - RadioButtonCde.Checked:=true; - RadioButtonVit.Checked:=false; - GroupBoxAct.Visible:=true; - GroupBoxPN.Visible:=false; - GroupBoxPNA.Visible:=false; - GroupBoxPNZ.Visible:=false; - EditSon.Visible:=false; - SpeedButtonJoue.Visible:=false; - SpeedButtonCharger.Visible:=false; - - LabelNomSon.Visible:=false; - LabelTempo.Visible:=false; - editTrainDest.Visible:=true; - EditTempo.Visible:=false; - label42.Visible:=true; - Label42.caption:='Commande'; - end; -end; - -procedure champs_type_act; -begin - with formconfig do - begin - positionne; - ComboBoxAccComUSB.Visible:=false; - GroupBoxAct.Caption:='Action pour accessoire'; - CheckRaz.Visible:=true; - - LabelTempo.Visible:=false; EditTempo.visible:=false;editEtatFoncSortie.visible:=true;LabelA.Visible:=true; - LabelFonction.visible:=true; - LabelFonction.caption:='Action : Accessoire'; - RadioButtonLoc.Checked:=false; - RadioButtonSon.checked:=false; - RadioButtonAccess.Checked:=true; - RadioButtonVit.Checked:=false; - GroupBoxAct.Visible:=true; - GroupBoxPN.Visible:=false; - GroupBoxPNA.Visible:=false; - GroupBoxPNZ.Visible:=false; - - EditFonctionAccess.Top:=14; - LabelFonction.Top:=18; - EditSon.Visible:=false; - SpeedButtonJoue.Visible:=false; - SpeedButtonCharger.Visible:=false; - EditFonctionAccess.Visible:=true; - LabelNomSon.Visible:=false; - editTrainDest.Visible:=false; - label42.Visible:=false; - end; -end; - -procedure champs_type_son; -begin - with formconfig do - begin - Positionne; - GroupBoxAct.Caption:='Action pour son'; - CheckRaz.Visible:=true; - ComboBoxAccComUSB.Visible:=false; - LabelTempo.Visible:=false; EditTempo.visible:=false; - EditFonctionAccess.Top:=14; - LabelFonction.Top:=18; - editEtatFoncSortie.visible:=false; - LabelA.Visible:=false; - LabelFonction.visible:=false; - EditFonctionAccess.Visible:=false; - CheckRaz.Visible:=false; - EditSon.Visible:=true; - SpeedButtonJoue.Visible:=true; - SpeedButtonCharger.Visible:=true; - LabelNomSon.Visible:=true; - - RadioButtonLoc.Checked:=false; - RadioButtonAccess.Checked:=false; - RadioButtonSon.checked:=true; - RadioButtonCde.Checked:=false; - RadioButtonVit.Checked:=false; - - GroupBoxAct.Visible:=true; - GroupBoxPN.Visible:=false; - GroupBoxPNA.Visible:=false; - GroupBoxPNZ.Visible:=false; - editTrainDest.Visible:=false; - label42.Visible:=false; - end; -end; - -procedure champs_decl_horloge; -begin - with formconfig do - begin - EditTrainDecl.Visible:=false; - LabelTrain.Visible:=true; - radioButtonActDet.Checked:=false; - radioButtonZones.Checked:=false; - radioButtonAig.Checked:=false; - radioButtonHorl.Checked:=true; - editact2.Visible:=true; - LabelActionneur.Caption:='Heure'+#13+'Minute'; - EditEtatActionneur.visible:=false; - EditAct.Hint:='Heure '; - EditAct2.Hint:='Minute'; - Label30.visible:=false; - LabelTrain.Visible:=false; - end; -end; - -procedure champs_decl_actdet; -begin - with formconfig do - begin - EditTrainDecl.Visible:=true ; - LabelTrain.Visible:=true ; - radioButtonActDet.Checked:=true; - radioButtonZones.Checked:=false; - radioButtonAig.Checked:=false; - radioButtonHorl.Checked:=false; - editact2.Visible:=false; - LabelActionneur.Caption:='Actionneur Détecteur'; - EditEtatActionneur.Hint:='0 ou 1'; - EditAct.Hint:='Actionneur/Détecteur '; - end; -end; - -procedure champs_decl_zones; -begin - with formconfig do - begin - radioButtonActDet.Checked:=false; - radioButtonZones.Checked:=true; - radioButtonAig.Checked:=false; - radioButtonHorl.Checked:=false; - EditTrainDecl.Visible:=false; - LabelTrain.Visible:=false; - editact2.Visible:=true; - LabelActionneur.Caption:='Mémoire de Zone'; - EditEtatActionneur.Hint:='0 ou 1'; - EditAct.Hint:='Détecteur '; - end; -end; - -procedure champs_decl_aig; -begin - with formconfig do - begin - radioButtonActDet.Checked:=false; - radioButtonZones.Checked:=false; - radioButtonAig.Checked:=true; - radioButtonHorl.Checked:=false; - EditAct2.Visible:=false; - EditTrainDecl.Visible:=false; - LabelTrain.Visible:=false; - editEtatActionneur.Visible:=true; - editact2.Visible:=false; - LabelActionneur.Caption:='Aiguillage'; - EditEtatActionneur.Hint:='1 ou S=dévié 2 ou D=droit'; - EditAct.Hint:='Aiguillage '; - end; -end; // transforme une chaine "élément" en une chaine affichable pour le hint // ex chaine_element("A32")=aiguillage 32 @@ -7232,170 +7253,6 @@ end; clicListe:=false; end; - -// mise à jour des champs graphiques des actionneurs d'après l'index du tableau -Procedure aff_champs_act(i : integer); -var j,adresse,sortie,fonction,tempo,access,typ : integer; - trainDecl,s,s2,adr : string; -begin - if affevt then affiche('Aff_champs_act('+intToSTR(i)+')',clyellow); - if i<1 then exit; - s:=Uppercase(FormConfig.ListBoxAct.Items[i-1]); - if s='' then exit; - - fonction:=Tablo_actionneur[i].fonction; - Access:=Tablo_actionneur[i].accessoire; - typ:=Tablo_actionneur[i].typdeclenche; - - trainDecl:=Tablo_actionneur[i].traindecl; - - for j:=1 to length(trainDecl) do - if trainDecl[j]='+' then trainDecl[j]:=','; - - // déclencheurs - with formconfig do - begin - case typ of - 0 : // act det - begin - champs_decl_actdet; - editAct.Text:=intToSTR(Tablo_actionneur[i].adresse); - editEtatActionneur.Text:=intToSTR(Tablo_actionneur[i].etat); - editEtatFoncSortie.Text:=intToSTR(Tablo_actionneur[i].sortie); - EditTrainDecl.Text:=TrainDecl; - end; - 1 : begin - champs_decl_horloge; - EditAct.text:=intToSTR(tablo_actionneur[i].adresse); - EditAct2.text:=intToSTR(tablo_actionneur[i].adresse2); - end; - 3 : champs_decl_zones; - 2 : begin - editEtatActionneur.Text:=intToSTR(Tablo_actionneur[i].etat); - editAct.text:=intToSTR(Tablo_actionneur[i].adresse); - champs_decl_aig; - end; - end; - end; - - s2:=FormConfig.EditAct.Hint; - FormConfig.EditAct.Hint:=s2+intToSTR(Tablo_actionneur[i].adresse); - - // Actionneur fonction F loco - if Tablo_actionneur[i].loco then - begin - champs_type_loco; - formconfig.editAct2.Text:=IntToSTR(Tablo_actionneur[i].adresse2); - - Adresse:=Tablo_actionneur[i].adresse; - //s2:=Tablo_actionneur[i].trainDecl; - //trainsauve:=s2; - tempo:=tablo_actionneur[i].Tempo; - - with formconfig do - begin - champs_type_loco; - adr:=IntToSTR(Adresse); //if det then adr:=adr+'Z'; - EditAct.text:=adr; - EditAct2.Text:=inttostr(Tablo_actionneur[i].adresse2); - editEtatActionneur.Text:=IntToSTR(Tablo_actionneur[i].etat); - EditTrainDecl.Text:=trainDecl; - EditTrainDest.Text:=Tablo_actionneur[i].trainDest; - editFonctionAccess.Text:=intToSTR(fonction); - editTempo.Text:=intToSTR(tempo); - end; - end; - - // Actionneur accessoire - if Tablo_actionneur[i].act then - begin - champs_type_act; - Adresse:=Tablo_actionneur[i].adresse; - sortie:=Tablo_actionneur[i].sortie; - //s2:=Tablo_actionneur[i].trainDecl; - //trainsauve:=s2; - tempo:=tablo_actionneur[i].Tempo; - with formconfig do - begin - adr:=IntToSTR(Adresse); //if det then adr:=adr+'Z'; - EditAct.text:=adr; - EditAct2.Text:=inttostr(Tablo_actionneur[i].adresse2); - CheckRaz.Checked:=Tablo_actionneur[i].Raz; - //EditTrainDecl.Text:=s2; - EditTrainDecl.Text:=trainDecl; - EditEtatActionneur.Text:=IntToSTR(Tablo_actionneur[i].etat); - editFonctionAccess.Text:=intToSTR(Access); - editEtatFoncSortie.Text:=intToSTR(sortie); - editTempo.Text:=intToSTR(tempo); - end; - end; - - // Actionneur son - if Tablo_actionneur[i].son then - begin - champs_type_son; - if typ=0 then with formconfig do - begin - radioButtonActDet.Checked:=true; - radioButtonZones.Checked:=false; - editAct2.Visible:=false; - LabelActionneur.Caption:='Actionneur Détecteur'; - end; - if typ=1 then with formconfig do - begin - radioButtonActDet.Checked:=false; - radioButtonZones.Checked:=true; - editAct2.Visible:=true; - LabelActionneur.Caption:='Mémoire de Zone'; - end; - - Adresse:=Tablo_actionneur[i].adresse; - s2:=Tablo_actionneur[i].trainDecl; - //trainsauve:=s2; - s:=Tablo_actionneur[i].FichierSon; - with formconfig do - begin - adr:=IntToSTR(Adresse); //if det then adr:=adr+'Z'; - EditAct.text:=adr; - EditAct2.Text:=inttostr(Tablo_actionneur[i].adresse2); - //CheckRaz.Checked:=Tablo_actionneur[i].Raz; - //EditTrainDecl.Text:=s2; - EditTrainDecl.Text:=trainDecl; - EditSon.Text:=s; - EditEtatActionneur.Text:=IntToSTR(Tablo_actionneur[i].etat); - end; - end; - - // périphérique - if Tablo_actionneur[i].periph then - begin - champs_type_periph; - with formConfig do - begin - ComboBoxAccComUSB.ItemIndex:=Tablo_actionneur[i].fonction-1; - EditAct.text:=inttostr(Tablo_actionneur[i].adresse); - EditAct2.Text:=inttostr(Tablo_actionneur[i].adresse2); - EditEtatFoncSortie.Text:=intToSTR(Tablo_actionneur[i].etat); - EditTrainDest.text:=Tablo_actionneur[i].TrainDest; - EditTrainDecl.Text:=trainDecl; - end; - end; - - // vitesse - if Tablo_actionneur[i].vit then - begin - champs_type_vit; - with formConfig do - begin - // EditAct.text:=inttostr(Tablo_actionneur[i].adresse); - // EditTrainDecl.Text:=trainDecl; - EditTrainDest.Text:=Tablo_actionneur[i].trainDest; - editFonctionAccess.Text:=intToSTR(fonction); - end; - end; - -end; - procedure raz_champs_pn; begin with formconfig do @@ -7472,158 +7329,10 @@ begin EditCdeFerme.Text:=Tablo_PN[lignecliqueePN+1].CommandeF; EditCdeOuvre.Text:=Tablo_PN[lignecliqueePN+1].CommandeO; ComboBoxPnCom.ItemIndex:=Tablo_PN[lignecliqueePN+1].AdresseFerme-1; + end; end; -// affiche les champs de l'actionneur PN en fonction de l'index du tableau -procedure aff_champs_PN(i : integer); -var erreur,j,v,periph : integer; - trouve : boolean; - s : string; -begin - - if affevt then affiche('Aff_champs_PN('+intToSTR(i)+')',clyellow); - if i<1 then - begin - clicliste:=false; - exit; - end; - s:=Uppercase(FormConfig.ListBoxPN.items[i-1]); - if s='' then - begin - clicliste:=false; - exit; - end; - - with formconfig do - begin - LabelInfo.caption:=''; - raz_champs_pn; - end; - - // actionneur passage à niveau - if s[1]='(' then - begin - champs_type_pn; - // trouver le numéro de périphérique - v:=pos('PN(',s); - delete(s,1,v+2); - val(s,periph,erreur); - { - i:=0; - repeat - inc(i); - trouve:=(Tablo_PN[i].AdresseFerme=adresse); - until trouve or (i>NbrePN); - if not(trouve) then exit;} - - with formConfig do - begin - RadioGroupActPN.itemindex:=Tablo_PN[i].TypeCde; - - if Tablo_PN[i].TypeCde=0 then champs_pn_act; - if Tablo_PN[i].TypeCde=1 then champs_pn_comusbSockets; - - if Tablo_PN[i].Pulse=1 then trouve:=true else trouve:=false; - CheckPnPulse.Checked:=trouve; - - // par actionneur - if Tablo_PN[i].actionneur then - begin - RadioButtonSimple.Checked:=true; - RadioButtonZone.Checked:=false; - GroupBoxPNA.Visible:=true; - GroupBoxPNZ.Visible:=false; - EditV1F.text:=intToSTR(Tablo_PN[i].voie[1].ActFerme); - EditV1O.text:=intToSTR(Tablo_PN[i].voie[1].ActOuvre); - v:=Tablo_PN[i].nbvoies; - if v>=2 then - begin - EditV2F.text:=intToSTR(Tablo_PN[i].voie[2].ActFerme); - EditV2O.text:=intToSTR(Tablo_PN[i].voie[2].ActOuvre); - end; - if v>=3 then - begin - EditV3F.text:=intToSTR(Tablo_PN[i].voie[3].ActFerme); - EditV3O.text:=intToSTR(Tablo_PN[i].voie[3].ActOuvre); - end; - if v>=4 then - begin - EditV4F.text:=intToSTR(Tablo_PN[i].voie[4].ActFerme); - EditV4O.text:=intToSTR(Tablo_PN[i].voie[4].ActOuvre); - end; - if v>=5 then - begin - EditV5F.text:=intToSTR(Tablo_PN[i].voie[5].ActFerme); - EditV5O.text:=intToSTR(Tablo_PN[i].voie[5].ActOuvre); - end; - - end - else - begin - // par zone de détecteurs - RadioButtonSimple.Checked:=false; - RadioButtonZone.Checked:=true; - GroupBoxPNA.Visible:=false; - GroupBoxPNZ.Visible:=true; - v:=Tablo_PN[i].nbvoies; - j:=Tablo_PN[i].voie[1].detZ1F;if j<>0 then - begin - EditZdet1V1F.text:=intToSTR(j); - EditZdet2V1F.text:=intToSTR(Tablo_PN[i].voie[1].detZ2F); - EditZdet1V1O.text:=intToSTR(Tablo_PN[i].voie[1].detZ1O); - EditZdet2V1O.text:=intToSTR(Tablo_PN[i].voie[1].detZ2O); - if v>=2 then - begin - EditZdet1V2F.text:=intToSTR(Tablo_PN[i].voie[2].detZ1F); - EditZdet2V2F.text:=intToSTR(Tablo_PN[i].voie[2].detZ2F); - EditZdet1V2O.text:=intToSTR(Tablo_PN[i].voie[2].detZ1O); - EditZdet2V2O.text:=intToSTR(Tablo_PN[i].voie[2].detZ2O); - end; - if v>=3 then - begin - EditZdet1V3F.text:=intToSTR(Tablo_PN[i].voie[3].detZ1F); - EditZdet2V3F.text:=intToSTR(Tablo_PN[i].voie[3].detZ2F); - EditZdet1V3O.text:=intToSTR(Tablo_PN[i].voie[3].detZ1O); - EditZdet2V3O.text:=intToSTR(Tablo_PN[i].voie[3].detZ2O); - end; - if v>=4 then - begin - EditZdet1V4F.text:=intToSTR(Tablo_PN[i].voie[4].detZ1F); - EditZdet2V4F.text:=intToSTR(Tablo_PN[i].voie[4].detZ2F); - EditZdet1V4O.text:=intToSTR(Tablo_PN[i].voie[4].detZ1O); - EditZdet2V4O.text:=intToSTR(Tablo_PN[i].voie[4].detZ2O); - end; - if v>=5 then - begin - EditZdet1V5F.text:=intToSTR(Tablo_PN[i].voie[5].detZ1F); - EditZdet2V5F.text:=intToSTR(Tablo_PN[i].voie[5].detZ2F); - EditZdet1V5O.text:=intToSTR(Tablo_PN[i].voie[5].detZ1O); - EditZdet2V5O.text:=intToSTR(Tablo_PN[i].voie[5].detZ2O); - end; - end; - end; - end; - end; - clicliste:=false; -end; - -procedure raz_champs_act; -begin - with formConfig do - begin - editAct.Text:='';EditAct2.Text:=''; - EditEtatActionneur.Text:=''; - EditTrainDecl.Text:=''; - EditFonctionAccess.Text:=''; - EditEtatFoncSortie.Text:=''; - EditTempo.Text:=''; - CheckRaz.Checked:=false; - editson.Text:=''; - EditTrainDest.text:=''; - end; -end; - procedure raz_champs_aig; begin with formConfig do @@ -8657,373 +8366,6 @@ begin Suiv4; end; -procedure TFormConfig.EditActChange(Sender: TObject); -var s,s2 : string; - typ,act,erreur,det2,suiv : integer; - elsuiv : tEquipement; - de : boolean; -begin - if clicliste or (ligneclicAct<0) then exit; - if affevt then affiche('Evt Edit act Change',clyellow); - if ligneClicAct<0 then exit; - if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAct then - with Formconfig do - begin - s:=EditAct.Text; - if radioButtonLoc.Checked or RadioButtonAccess.Checked or RadioButtonSon.Checked or radioButtonCde.checked or RadioButtonVit.checked then - begin - Val(s,act,erreur); - if (s='') or (act<1) then exit; - typ:=Tablo_Actionneur[ligneClicAct+1].typdeclenche; - - // 0=actionneur/détecteur 1=horloge 2=evt aig 3=MemZone - if (typ=3) or (typ=0) then s2:='Actionneur/Détecteur '; - if (typ=2) then s2:='Aiguillage '; - if (typ=1) then s2:='heure '; - - EditAct.Hint:=s2+intToSTR(act); - - if typ=1 then - begin - if (act<0) or (act>23) or (erreur<>0) then - begin - LabelInfo.caption:='Erreur heure'; - exit; - end; - end; - - de:=pos('Z',s)<>0; // si détecteur - if de then delete(s,erreur,1); - Val(s,act,erreur); - if erreur<>0 then - begin - LabelInfo.caption:='Erreur adresse actionneur'; - exit; - end; - - - LabelInfo.caption:=' '; - tablo_actionneur[ligneClicAct+1].adresse:=act; - s:=encode_act_loc_son(ligneClicAct+1); - ListBoxAct.Items[ligneClicAct]:=s; - ListBoxAct.Selected[ligneClicAct]:=true; - - // vérifier si les détecteurs sont contigus si on est en zone - if Tablo_Actionneur[ligneClicAct+1].typdeclenche=3 then - begin - Val(EditAct2.Text,det2,erreur); - if erreur<>0 then exit; - det_contigu(act,det2,suiv,elSuiv); - if (suiv=0) or (suiv>9995) then LabelInfo.Caption:='Les détecteurs '+intToSTR(act)+' et '+intToSTR(det2)+' ne sont pas contigus' - else LabelInfo.Caption:=''; - end - else LabelInfo.Caption:=''; - end; - end; -end; - -procedure TFormConfig.EditAct2Change(Sender: TObject); -var s : string; - det1,det2,erreur,suiv : integer; - elSuiv : Tequipement; -begin - if clicliste or (ligneclicAct<0) then exit; - if affevt then affiche('Evt Edit act2 Change',clyellow); - if ligneClicAct<0 then exit; - if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAct then - with Formconfig do - begin - s:=EditAct2.Text; - //if radioButtonLoc.Checked or RadioButtonAccess.Checked or RadioButtonSon.Checked then - begin - Val(s,det2,erreur); - if (s='') or (det2<1) then exit; - - if tablo_actionneur[ligneClicAct+1].typdeclenche=1 then - begin - if (det2<0) or (det2>60) or (erreur<>0) then - begin - LabelInfo.caption:='Erreur minute'; - exit; - end; - end; - - if erreur<>0 then - begin - LabelInfo.caption:='Erreur adresse détecteur'; - exit - end; - LabelInfo.caption:=' '; - - tablo_actionneur[ligneClicAct+1].adresse2:=det2; - s:=encode_act_loc_son(ligneClicAct+1); - ListBoxAct.Items[ligneClicAct]:=s; - - // vérifier si les détecteurs sont contigus si on est en zone - if Tablo_Actionneur[ligneClicAct+1].typdeclenche=3 then - begin - Val(EditAct.Text,det1,erreur); - if (erreur<>0) or (det1<1) then exit; - det_contigu(det1,det2,suiv,elSuiv); - if (suiv=0) or (suiv>9995) then LabelInfo.Caption:='Les détecteurs '+intToSTR(det1)+' et '+intToSTR(det2)+' ne sont pas contigus' - else LabelInfo.Caption:=''; - end; - end; - end; -end; - -procedure TFormConfig.ListBoxActMouseDown(Sender: TObject; - Button: TMouseButton; Shift: TShiftState; X, Y: Integer); -var i : integer; -begin - clicliste:=true; - if maxTablo_act<1 then exit; - LabelInfo.caption:=''; - raz_champs_act; - - // dévalider la liste des PN (autre tableau) - // for i:=0 to maxTablo_act-2 do formconfig.ListBoxAct.selected[i]:=false; - for i:=0 to ListBoxPN.items.Count-1 do formconfig.ListBoxPN.selected[i]:=false; - - ligneclicAct:=listBoxAct.ItemIndex; - if ligneclicAct<0 then exit; - // désactiver la ligne PN - - Aff_champs_Act(ligneClicAct+1); - - - clicliste:=false; -end; - -procedure TFormConfig.EditEtatActionneurChange(Sender: TObject); -var s : string; - etat,erreur,typ : integer; -begin - if clicliste then exit; - if affevt then affiche('Evt EditEtatActionneur Change',clyellow); - if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAct then - with Formconfig do - begin - s:=upperCase(EditEtatActionneur.Text); - if radioButtonLoc.Checked or RadioButtonAccess.Checked or RadioButtonSon.Checked or RadioButtonCde.Checked or RadioButtonVit.checked then - begin - typ:=tablo_actionneur[ligneClicAct+1].typdeclenche; - if (typ=2) and (s<>'') then // aiguillage - begin - if s[1]='S' then s:='1'; - if s[1]='D' then s:='2'; - end; - - Val(s,etat,erreur); - - // act det memzone - if (typ=0) or (typ=1) or (typ=3) then - begin - if (etat<0) or (etat>1) then begin LabelInfo.caption:='Erreur état actionneur/détecteur';exit;end; - end; - // aig - if (typ=2) then - begin - if (etat<1) or (etat>2) then begin LabelInfo.caption:='Erreur position aiguillage';exit;end; - end; - - LabelInfo.caption:=' '; - - tablo_actionneur[ligneClicAct+1].etat:=etat; - s:=encode_act_loc_son(ligneClicAct+1); - ListBoxAct.Items[ligneClicAct]:=s; - ListBoxAct.Selected[ligneClicAct]:=true; - end; - end; -end; - -procedure TFormConfig.EditTrainDeclChange(Sender: TObject); -var s,train : string; - i : integer; -begin - if clicliste or (ligneclicAct<0) then exit; - if affevt then affiche('Evt Edit TrainDecl Change',clyellow); - if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAct then - with Formconfig do - begin - train:=EditTrainDecl.Text; - // remplacer les , par des + pour le stockage - for i:=1 to length(train) do - begin - if train[i]=',' then train[i]:='+'; - end; - if train='' then - begin - LabelInfo.caption:='Erreur train';exit - end else LabelInfo.caption:=' '; - - tablo_actionneur[ligneClicAct+1].trainDecl:=train; - s:=encode_act_loc_son(ligneClicAct+1); - ListBoxAct.Items[ligneClicAct]:=s; - ListBoxAct.Selected[ligneClicAct]:=true; - end; -end; - -procedure TFormConfig.EditTrainDestChange(Sender: TObject); -var s,train : string; -begin - if clicliste or (ligneclicAct<0) then exit; - if affevt then affiche('Evt Edit TrainDest Change',clyellow); - if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAct then - with Formconfig do - begin - if radioButtonLoc.Checked or RadioButtonCde.Checked or RadioButtonVit.checked then - begin - train:=EditTrainDest.Text; - if train='' then - begin - LabelInfo.caption:='Erreur train';exit - end else LabelInfo.caption:=' '; - - tablo_actionneur[ligneClicAct+1].trainDest:=train; - s:=encode_act_loc_son(ligneClicAct+1); - ListBoxAct.Items[ligneClicAct]:=s; - ListBoxAct.Selected[ligneClicAct]:=true; - end; - end; -end; - - -procedure TFormConfig.EditSonChange(Sender: TObject); -var s,fichier : string; -begin - if clicliste or (ligneclicAct<0) then exit; - if affevt then affiche('Evt Edit NomFichier Change',clyellow); - if ligneClicAct<0 then exit; - if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAct then - with Formconfig do - begin - if radioButtonLoc.Checked or RadioButtonAccess.Checked or RadioButtonSon.Checked then - begin - fichier:=EditSon.Text; - if fichier='' then - begin - LabelInfo.caption:='Nom fichier vide';exit - end else LabelInfo.caption:=' '; - - tablo_actionneur[ligneClicAct+1].fichierSon:=fichier; - s:=encode_act_loc_son(ligneClicAct+1); - ListBoxAct.Items[ligneClicAct]:=s; - ListBoxAct.Selected[ligneClicAct]:=true; - end; - end; -end; - -procedure TFormConfig.EditFonctionAccessChange(Sender: TObject); -var s : string; - fonction,erreur : integer; -begin - if clicliste or (ligneclicAct<0) then exit; - if affevt then affiche('Evt Edit fonctionAccess Change',clyellow); - if ligneClicAct<0 then exit; - if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAct then - with Formconfig do - begin - s:=EditFonctionAccess.Text; - if radioButtonLoc.Checked or RadioButtonAccess.Checked or RadioButtonCde.Checked or RadioButtonVit.checked then - begin - LabelInfo.caption:=' '; - Val(s,fonction,erreur); - if RadioButtonVit.checked then - begin - if (erreur<>0) or (abs(fonction)>127) then - begin - LabelInfo.caption:='Erreur vitesse';exit; - end; - end - else - if (erreur<>0) or (fonction<1) then - begin - LabelInfo.caption:='Erreur fonction actionneur';exit - end; - - if radioButtonLoc.Checked or RadioButtonVit.checked then tablo_actionneur[ligneClicAct+1].fonction:=fonction; - if RadioButtonAccess.Checked then Tablo_Actionneur[ligneClicAct+1].accessoire:=fonction; - - s:=encode_act_loc_son(ligneClicAct+1); - ListBoxAct.Items[ligneClicAct]:=s; - ListBoxAct.Selected[ligneClicAct]:=true; - end; - end; -end; - -procedure TFormConfig.EditEtatFoncSortieChange(Sender: TObject); -var s : string; - Etat,erreur : integer; -begin - if clicliste or (ligneclicAct<0) then exit; - if affevt then affiche('Evt Edit FoncSortie Change',clyellow); - if ligneClicAct<0 then exit; - if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAct then - with Formconfig do - begin - s:=EditEtatFoncSortie.Text; - if radioButtonAccess.Checked then - begin - Val(s,etat,erreur); - if (erreur<>0) or (etat<0) or (etat>2) then - begin - LabelInfo.caption:='Erreur Etat actionneur';exit - end else LabelInfo.caption:=' '; - - tablo_actionneur[ligneClicAct+1].sortie:=etat; - s:=encode_act_loc_son(ligneClicAct+1); - ListBoxAct.Items[ligneClicAct]:=s; - ListBoxAct.Selected[ligneClicAct]:=true; - end; - end; -end; - -procedure TFormConfig.EditTempoChange(Sender: TObject); -var s : string; - tempo,erreur : integer; -begin - if clicliste or (ligneclicAct<0) then exit; - if affevt then affiche('Evt TempoChange',clyellow); - if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAct then - with Formconfig do - begin - s:=EditTempo.Text; - if radioButtonLoc.Checked then - begin - Val(s,tempo,erreur); - if (erreur<>0) or (tempo<0) then - begin - LabelInfo.caption:='Erreur Tempo actionneur';exit - end else LabelInfo.caption:=' '; - - tablo_actionneur[ligneClicAct+1].tempo:=tempo; - s:=encode_act_loc_son(ligneClicAct+1); - ListBoxAct.Items[ligneClicAct]:=s; - ListBoxAct.Selected[ligneClicAct]:=true; - end; - end; -end; - -procedure TFormConfig.CheckRAZClick(Sender: TObject); - var s : string; -begin - if clicliste or (ligneclicAct<0) then exit; - if affevt then affiche('Evt CheckRaz Change',clyellow); - if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAct then - with Formconfig do - begin - if radioButtonAccess.Checked then - begin - tablo_actionneur[ligneClicAct+1].raz:=CheckRAZ.checked; - s:=encode_act_loc_son(ligneClicAct+1); - ListBoxAct.Items[ligneClicAct]:=s; - ListBoxAct.Selected[ligneClicAct]:=true; - end; - end; -end; - - procedure TFormConfig.ComboBoxAspChange(Sender: TObject); var indexTCO,x,y,i,index,aspect,adresseFeu : integer; s : string; @@ -9141,219 +8483,12 @@ begin end; end; -procedure TFormConfig.RadioButtonLocClick(Sender: TObject); -var champ,j,i,erreur : integer; - train,s : string; -begin - // rendre visible le groupbox Actionneur fonction F loco - if clicListe or (ligneclicAct<0) then exit; - i:=ligneClicAct+1; - if AffEvt then Affiche('RadioLoc '+IntToSTR(i),clyellow); - - Tablo_Actionneur[i].loco:=true; - Tablo_Actionneur[i].Act:=false; - Tablo_Actionneur[i].Son:=false; - Tablo_Actionneur[i].periph:=false; - Tablo_Actionneur[i].vit:=false; - champs_type_loco; - - val(editact.Text,champ,erreur); - Tablo_actionneur[i].adresse:=champ ; - val(editEtatActionneur.Text,champ,erreur); - Tablo_actionneur[i].etat:=champ; - train:=EditTrainDecl.Text; - for j:=1 to length(train) do if train[j]=',' then train[j]:='+'; - Tablo_actionneur[i].trainDecl:=train; - val(editFonctionAccess.Text,champ,erreur); - Tablo_actionneur[i].fonction:=champ; - val(editEtatFoncSortie.Text,champ,erreur); - Tablo_actionneur[i].sortie:=champ; - val(editTempo.Text,champ,erreur); - Tablo_actionneur[i].tempo:=champ; - tablo_actionneur[i].Raz:=checkRaz.checked; - s:=encode_act_loc_son(i); - ListBoxAct.Items[ligneClicAct]:=s; - ListBoxAct.Selected[ligneClicAct]:=true; -end; - -procedure TFormConfig.RadioButtonAccessClick(Sender: TObject); -var champ,i,j,erreur : integer; - train,s : string; -begin - // rendre visible le groupbox Actionneur fonction F loco - if clicListe or (ligneclicAct<0) then exit; - i:=ligneClicAct+1; - if AffEvt then Affiche('RadioAccessoire '+IntToSTR(i),clyellow); - - Tablo_Actionneur[i].loco:=false; - Tablo_Actionneur[i].Act:=true; - Tablo_Actionneur[i].Son:=false; - Tablo_Actionneur[i].periph:=false; - Tablo_Actionneur[i].vit:=false; - champs_type_act; - - val(editact.Text,champ,erreur); - Tablo_actionneur[i].adresse:=champ ; - val(editEtatActionneur.Text,champ,erreur); - Tablo_actionneur[i].etat:=champ; - train:=EditTrainDecl.Text; - for j:=1 to length(train) do if train[j]=',' then train[j]:='+'; - Tablo_actionneur[i].trainDecl:=train; - val(editFonctionAccess.Text,champ,erreur); - Tablo_actionneur[i].fonction:=champ; - val(editEtatFoncSortie.Text,champ,erreur); - Tablo_actionneur[i].sortie:=champ; - val(editTempo.Text,champ,erreur); - Tablo_actionneur[i].tempo:=champ; - tablo_actionneur[i].Raz:=checkRaz.checked; - s:=encode_act_loc_son(i); - ListBoxAct.Items[ligneClicAct]:=s; - ListBoxAct.Selected[ligneClicAct]:=true; -end; - - -procedure TFormConfig.RadioButtonSonClick(Sender: TObject); -var j, champ,i,erreur : integer; - s,train : string; -begin - // rendre visible le groupbox Actionneur fonction F loco - if clicListe or (ligneclicAct<0) then exit; - i:=ligneClicAct+1; - if AffEvt then Affiche('RadioSon '+IntToSTR(i),clyellow); - - Tablo_Actionneur[i].loco:=false; - Tablo_Actionneur[i].Act:=false; - Tablo_Actionneur[i].Son:=true; - Tablo_Actionneur[i].periph:=false; - Tablo_Actionneur[i].vit:=false; - - champs_type_son; - - val(editact.Text,champ,erreur); - Tablo_actionneur[i].adresse:=champ ; - val(editEtatActionneur.Text,champ,erreur); - Tablo_actionneur[i].etat:=champ; - train:=EditTrainDecl.Text; - for j:=1 to length(train) do if train[j]=',' then train[j]:='+'; - Tablo_actionneur[i].trainDecl:=train; - val(editFonctionAccess.Text,champ,erreur); - Tablo_actionneur[i].fonction:=champ; - val(editEtatFoncSortie.Text,champ,erreur); - Tablo_actionneur[i].sortie:=champ; - val(editTempo.Text,champ,erreur); - Tablo_actionneur[i].tempo:=champ; - tablo_actionneur[i].Raz:=checkRaz.checked; - s:=encode_act_loc_son(i); - ListBoxAct.Items[ligneClicAct]:=s; - ListBoxAct.Selected[ligneClicAct]:=true; -end; - -procedure TFormConfig.RadioButtonCdeClick(Sender: TObject); -var j,champ,i,erreur : integer; - s,train : string; -begin - if clicListe or (ligneclicAct<0) then exit; - i:=ligneClicAct+1; - if AffEvt then Affiche('RadioCde '+IntToSTR(i),clyellow); - Tablo_Actionneur[i].loco:=false; - Tablo_Actionneur[i].Act:=false; - Tablo_Actionneur[i].Son:=false; - Tablo_Actionneur[i].periph:=true; - Tablo_Actionneur[i].vit:=false; - - champs_type_periph; - - val(editact.Text,champ,erreur); - Tablo_actionneur[i].adresse:=champ ; - val(editEtatActionneur.Text,champ,erreur); - Tablo_actionneur[i].etat:=champ; - train:=EditTrainDecl.Text; - for j:=1 to length(train) do if train[j]=',' then train[j]:='+'; - tablo_actionneur[i].TrainDecl:=train; - - - val(editFonctionAccess.Text,champ,erreur); - Tablo_actionneur[i].fonction:=champ; - //val(editEtatFoncSortie.Text,champ,erreur); - //Tablo_actionneur[i].sortie:=champ; - //val(editTempo.Text,champ,erreur); - //Tablo_actionneur[i].tempo:=champ; - tablo_actionneur[i].TrainDest:=editTrainDest.Text; - - - s:=encode_act_loc_son(i); - ListBoxAct.Items[ligneClicAct]:=s; - ListBoxAct.Selected[ligneClicAct]:=true; -end; - -procedure TFormConfig.RadioButtonVitClick(Sender: TObject); -var j,champ,i,erreur : integer; - s,train : string; -begin - if clicListe or (ligneclicAct<0) then exit; - i:=ligneClicAct+1; - if AffEvt then Affiche('RadioVit '+IntToSTR(i),clyellow); - Tablo_Actionneur[i].loco:=false; - Tablo_Actionneur[i].Act:=false; - Tablo_Actionneur[i].Son:=false; - Tablo_Actionneur[i].periph:=false; - Tablo_Actionneur[i].vit:=true; - - champs_type_vit; - - val(editact.Text,champ,erreur); - Tablo_actionneur[i].adresse:=champ ; - val(editEtatActionneur.Text,champ,erreur); - Tablo_actionneur[i].etat:=champ; - train:=EditTrainDecl.Text; - for j:=1 to length(train) do if train[j]=',' then train[j]:='+'; - tablo_actionneur[i].TrainDecl:=train; - - - val(editFonctionAccess.Text,champ,erreur); // vitesse - Tablo_actionneur[i].fonction:=champ; - tablo_actionneur[i].TrainDest:=editTrainDest.Text; - - s:=encode_act_loc_son(i); - ListBoxAct.Items[ligneClicAct]:=s; - ListBoxAct.Selected[ligneClicAct]:=true; - -end; - - -procedure TFormConfig.RichPNMouseDown(Sender: TObject; - Button: TMouseButton; Shift: TShiftState; X, Y: Integer); -var ligne : integer; -begin - clicliste:=true; - - // désactive la sélection des actionneurs - ligneclicAct:=-1; - - with ListBoxPN do - begin - if ligne=Max_actionneurs then + begin + Affiche('Nombre maximal d''actionneurs atteint',clred); + exit; + end; + clicliste:=true; + inc(maxTablo_act); + + with formconfig.ListBoxActions do + for i:=0 to items.Count-1 do Selected[i]:=false; + + // désactiver la ligne PN + lignecliqueePN:=-1; + + Tablo_actionneur[maxtablo_act].NomAction:='ACTION'+intToSTR(maxtablo_act); + + SetLength(Tablo_actionneur[maxtablo_act].TabloOp,2); + + s:=encode_actions(MaxTablo_act); + with formconfig.listBoxActions do + begin + items.add(s); + Selected[maxTablo_act-1]:=true; + SetFocus; + perform(WM_VSCROLL,SB_BOTTOM,0); + end; + + formconfig.LabelInfo.caption:=''; + LigneClicAct:=MaxTablo_act-1; + AncligneClicAct:=ligneClicAct; + FormConfig.RichEditInfo.clear; + formconfig.ListBoxOperations.Clear; + + clicliste:=false; + config_modifie:=true; +end; +{ procedure ajoute_actionneur; var s: string; i : integer; @@ -9473,10 +8647,13 @@ begin Tablo_actionneur[maxtablo_act].act:=false; Tablo_actionneur[maxtablo_act].loco:=true; - s:=encode_act_loc_son(MaxTablo_act); + SetLength(Tablo_actionneur[maxtablo_act].TabloOp,2); + + Tablo_actionneur[maxtablo_act].NbOperations:=1; // ajouter et scroller en fin - with formconfig.listBoxAct do + s:=encode_act_loc_son(MaxTablo_act); + with formconfig.listBoxActions do begin items.add(s); Selected[maxTablo_act-1]:=true; @@ -9484,6 +8661,14 @@ begin perform(WM_VSCROLL,SB_BOTTOM,0); end; + s:=encode_actions(MaxTablo_act); + with formconfig.listBoxAct do + begin + items.add(s); + Selected[maxTablo_act-1]:=true; + perform(WM_VSCROLL,SB_BOTTOM,0); + end; + formconfig.GroupBoxRadio.Visible:=true; formconfig.LabelInfo.caption:=''; LigneClicAct:=MaxTablo_act-1; @@ -9491,11 +8676,145 @@ begin Aff_champs_Act(maxTablo_act); clicliste:=false; config_modifie:=true; -end; +end; } + procedure TFormConfig.ButtonNouvAccClick(Sender: TObject); begin - ajoute_actionneur; + ajoute_action; +end; + +// affiche les champs de l'actionneur PN en fonction de l'index du tableau +procedure aff_champs_PN(i : integer); +var erreur,j,v,periph : integer; + trouve : boolean; + s : string; +begin + + if affevt then affiche('Aff_champs_PN('+intToSTR(i)+')',clyellow); + if i<1 then + begin + clicliste:=false; + exit; + end; + s:=Uppercase(FormConfig.ListBoxPN.items[i-1]); + if s='' then + begin + clicliste:=false; + exit; + end; + + with formconfig do + begin + LabelInfo.caption:=''; + raz_champs_pn; + end; + + // actionneur passage à niveau + if s[1]='(' then + begin + //champs_type_pn; + // trouver le numéro de périphérique + v:=pos('PN(',s); + delete(s,1,v+2); + val(s,periph,erreur); + { + i:=0; + repeat + inc(i); + trouve:=(Tablo_PN[i].AdresseFerme=adresse); + until trouve or (i>NbrePN); + if not(trouve) then exit;} + + with formConfig do + begin + RadioGroupActPN.itemindex:=Tablo_PN[i].TypeCde; + + if Tablo_PN[i].TypeCde=0 then champs_pn_act; + if Tablo_PN[i].TypeCde=1 then champs_pn_comusbSockets; + + if Tablo_PN[i].Pulse=1 then trouve:=true else trouve:=false; + CheckPnPulse.Checked:=trouve; + + // par actionneur + if Tablo_PN[i].actionneur then + begin + RadioButtonSimple.Checked:=true; + RadioButtonZone.Checked:=false; + GroupBoxPNA.Visible:=true; + GroupBoxPNZ.Visible:=false; + EditV1F.text:=intToSTR(Tablo_PN[i].voie[1].ActFerme); + EditV1O.text:=intToSTR(Tablo_PN[i].voie[1].ActOuvre); + v:=Tablo_PN[i].nbvoies; + if v>=2 then + begin + EditV2F.text:=intToSTR(Tablo_PN[i].voie[2].ActFerme); + EditV2O.text:=intToSTR(Tablo_PN[i].voie[2].ActOuvre); + end; + if v>=3 then + begin + EditV3F.text:=intToSTR(Tablo_PN[i].voie[3].ActFerme); + EditV3O.text:=intToSTR(Tablo_PN[i].voie[3].ActOuvre); + end; + if v>=4 then + begin + EditV4F.text:=intToSTR(Tablo_PN[i].voie[4].ActFerme); + EditV4O.text:=intToSTR(Tablo_PN[i].voie[4].ActOuvre); + end; + if v>=5 then + begin + EditV5F.text:=intToSTR(Tablo_PN[i].voie[5].ActFerme); + EditV5O.text:=intToSTR(Tablo_PN[i].voie[5].ActOuvre); + end; + + end + else + begin + // par zone de détecteurs + RadioButtonSimple.Checked:=false; + RadioButtonZone.Checked:=true; + GroupBoxPNA.Visible:=false; + GroupBoxPNZ.Visible:=true; + v:=Tablo_PN[i].nbvoies; + j:=Tablo_PN[i].voie[1].detZ1F;if j<>0 then + begin + EditZdet1V1F.text:=intToSTR(j); + EditZdet2V1F.text:=intToSTR(Tablo_PN[i].voie[1].detZ2F); + EditZdet1V1O.text:=intToSTR(Tablo_PN[i].voie[1].detZ1O); + EditZdet2V1O.text:=intToSTR(Tablo_PN[i].voie[1].detZ2O); + if v>=2 then + begin + EditZdet1V2F.text:=intToSTR(Tablo_PN[i].voie[2].detZ1F); + EditZdet2V2F.text:=intToSTR(Tablo_PN[i].voie[2].detZ2F); + EditZdet1V2O.text:=intToSTR(Tablo_PN[i].voie[2].detZ1O); + EditZdet2V2O.text:=intToSTR(Tablo_PN[i].voie[2].detZ2O); + end; + if v>=3 then + begin + EditZdet1V3F.text:=intToSTR(Tablo_PN[i].voie[3].detZ1F); + EditZdet2V3F.text:=intToSTR(Tablo_PN[i].voie[3].detZ2F); + EditZdet1V3O.text:=intToSTR(Tablo_PN[i].voie[3].detZ1O); + EditZdet2V3O.text:=intToSTR(Tablo_PN[i].voie[3].detZ2O); + end; + if v>=4 then + begin + EditZdet1V4F.text:=intToSTR(Tablo_PN[i].voie[4].detZ1F); + EditZdet2V4F.text:=intToSTR(Tablo_PN[i].voie[4].detZ2F); + EditZdet1V4O.text:=intToSTR(Tablo_PN[i].voie[4].detZ1O); + EditZdet2V4O.text:=intToSTR(Tablo_PN[i].voie[4].detZ2O); + end; + if v>=5 then + begin + EditZdet1V5F.text:=intToSTR(Tablo_PN[i].voie[5].detZ1F); + EditZdet2V5F.text:=intToSTR(Tablo_PN[i].voie[5].detZ2F); + EditZdet1V5O.text:=intToSTR(Tablo_PN[i].voie[5].detZ1O); + EditZdet2V5O.text:=intToSTR(Tablo_PN[i].voie[5].detZ2O); + end; + end; + end; + end; + end; + clicliste:=false; end; @@ -9516,8 +8835,6 @@ begin with formconfig.ListBoxPN do for i:=0 to items.Count-1 do Selected[i]:=false; - with formconfig.ListBoxAct do - for i:=0 to items.Count-1 do Selected[i]:=false; ligneclicAct:=-1; raz_champs_pn; @@ -9527,6 +8844,7 @@ begin tablo_PN[NbrePN].CommandeOuvre:=0; tablo_PN[NbrePN].NbVoies:=1; tablo_PN[NbrePN].Pulse:=0; + tablo_PN[NbrePN].actionneur:=true; for j:=1 to 4 do begin @@ -9558,7 +8876,6 @@ begin RadioButtonSimple.Checked:=true; RadioButtonZone.Checked:=false; - GroupBoxRadio.Visible:=false; LabelInfo.caption:=''; end; LigneCliqueePN:=NbrePN-1; @@ -9574,8 +8891,7 @@ begin ajoute_pn; end; - -procedure supprime_act; +procedure supprime_action; var i,j,n : integer; ss,s: string; begin @@ -9583,16 +8899,16 @@ begin n:=0; for i:=0 to maxTablo_act-1 do begin - if formconfig.ListBoxAct.selected[i] then + if formconfig.ListBoxActions.selected[i] then begin - ss:=ss+intToSTR(Tablo_actionneur[i+1].adresse)+' '; + ss:=ss+Tablo_actionneur[i+1].NomAction+' '; inc(n); end; end; if ss='' then exit; s:='Voulez-vous supprimer '; - if n=1 then s:=s+' l''actionneur ' else s:=s+' les actionneurs '; + if n=1 then s:=s+' l''action ' else s:=s+' les actions '; s:=s+ss+' ?'; if Application.MessageBox(pchar(s),pchar('confirm'), MB_YESNO or MB_DEFBUTTON2 or MB_ICONQUESTION)=idNo then exit; @@ -9603,12 +8919,12 @@ begin n:=0; i:=1; repeat - if formconfig.ListBoxAct.selected[i-1] then + if formconfig.ListBoxActions.selected[i-1] then begin for j:=i to maxTablo_act-1 do begin - formconfig.ListBoxAct.selected[j-1]:=formconfig.ListBoxAct.selected[j]; + formconfig.ListBoxActions.selected[j-1]:=formconfig.ListBoxActions.selected[j]; tablo_actionneur[j]:=tablo_actionneur[j+1]; end; dec(maxTablo_act); @@ -9618,14 +8934,14 @@ begin until i>maxTablo_act; config_modifie:=true; - FormConfig.ListBoxAct.Clear; - raz_champs_act; + FormConfig.ListBoxActions.Clear; // réafficher la liste for i:=1 to maxTablo_act do begin - s:=encode_act_loc_son(i); - FormConfig.ListBoxAct.items.Add(s); + //s:=encode_act_loc_son(i); + s:=encode_actions(i); + FormConfig.ListBoxActions.items.Add(s); end; ligneclicAct:=-1; AncligneclicAct:=-1; @@ -9635,7 +8951,7 @@ end; procedure TFormConfig.ButtonSupAccClick(Sender: TObject); begin if affevt then affiche('Evt bouton Sup acc',clyellow); - supprime_act; + supprime_action; end; procedure supprime_pn; @@ -9650,7 +8966,7 @@ begin begin if formconfig.ListBoxPN.selected[i] then begin - if tablo_PN[i+1].Voie[1].ActFerme<>0 then ss:=ss+intToSTR(tablo_PN[i+1].Voie[1].ActFerme) + if tablo_PN[i+1].Voie[1].ActFerme<>0 then ss:=ss+intToSTR(tablo_PN[i+1].Voie[1].ActFerme)+' ' else ss:=ss+intToSTR(tablo_PN[i+1].Voie[1].detZ1F)+' '; inc(n); end; @@ -10029,7 +9345,7 @@ end; function verif_coherence : boolean; var AncAdr,i,j,k,l,Indexaig,adr,adr2,extr,detect,condcarre,nc,index2,SuivAdr,indexTCO,AdrAig, - x,y,extr2,adr3,index3,det1Br,det2Br,det1index,det2index,adresse,Adresse2,dec,nc2 : integer; + x,y,extr2,adr3,index3,det1Br,det2Br,det1index,det2index,adresse,Adresse2,dec,nc2,op : integer; modAig,AncModel,model,km,SuivModel,model2: TEquipement; c : char; vitesse : longint; @@ -10945,35 +10261,38 @@ begin end; end; - // actionneurs + // actions for i:=1 to maxTablo_act do begin - if Tablo_actionneur[i].act then + for op:=1 to tablo_actionneur[i].NbOperations do begin - adresse:=Tablo_actionneur[i].accessoire; - for k:=1 to NDetecteurs do + if Tablo_actionneur[i].tabloOp[op].numoperation=ActionAccessoire then begin - adr:=((adresse_detecteur[k]-1) div 2) +1; // transforme l'adresse du détecteur en accessoire (ex 513 devient 257) - - if (adresse=adr) then + adresse:=Tablo_actionneur[i].tabloOp[op].adresse; + for k:=1 to NDetecteurs do begin - AdrOk:=false; - ok:=false; - Affiche('Erreur 15: l''actionneur '+IntToSTR(Tablo_actionneur[i].adresse)+' enclenche l''accessoire '+intToSTR(adresse),clred); - Affiche('et chevauche le détecteur '+intToStr(adresse_detecteur[k])+' interdit en XpressNet',clred); - end; - end; - end; + adr:=((adresse_detecteur[k]-1) div 2) +1; // transforme l'adresse du détecteur en accessoire (ex 513 devient 257) - if Tablo_actionneur[i].periph then - begin - j:=Tablo_actionneur[i].fonction; - if j>10 then begin Affiche('Erreur 15.1 pilotage actionneur '+intToSTR(Tablo_actionneur[i].adresse),clred);ok:=false;end; - if j=0 then begin Affiche('Erreur 15.2 L''actionneur '+intToSTR(Tablo_actionneur[i].adresse)+' n''a pas d''accessoire COM/USB d''affecté',clRed);ok:=false;end; - if (j>0) and (j<11) and (Tablo_periph[j].NumCom=0) then - begin - Affiche('Erreur 15.3 L''actionneur '+intToSTR(Tablo_actionneur[i].adresse)+' n''a pas d''accessoire COM/USB d''affecté',clRed); - ok:=false; + if (adresse=adr) then + begin + AdrOk:=false; + ok:=false; + Affiche('Erreur 15: l''action '+IntToSTR(Tablo_actionneur[i].adresse)+' enclenche l''accessoire '+intToSTR(adresse),clred); + Affiche('et chevauche le détecteur '+intToStr(adresse_detecteur[k])+' interdit en XpressNet',clred); + end; + end; + + if Tablo_actionneur[i].tabloop[op].NumOperation=ActionCdePeriph then + begin + j:=Tablo_actionneur[i].tabloOp[op].periph; + if j>10 then begin Affiche('Erreur 15.1 pilotage action '+intToSTR(Tablo_actionneur[i].adresse),clred);ok:=false;end; + if j=0 then begin Affiche('Erreur 15.2 L''action '+intToSTR(Tablo_actionneur[i].adresse)+' n''a pas d''accessoire COM/USB d''affecté',clRed);ok:=false;end; + if (j>0) and (j<11) and (Tablo_periph[j].NumCom=0) then + begin + Affiche('Erreur 15.3 L''action '+intToSTR(Tablo_actionneur[i].adresse)+' n''a pas d''accessoire COM/USB d''affecté',clRed); + ok:=false; + end; + end; end; end; end; @@ -10994,17 +10313,20 @@ begin // actionneurs for i:=1 to maxTablo_act do begin - if tablo_actionneur[i].periph then + for op:=1 to tablo_actionneur[i].NbOperations do begin - adresse:=tablo_actionneur[i].fonction; - if adresse>NbPeriph then + if tablo_actionneur[i].TabloOp[op].numoperation=ActionCdePeriph then begin - Affiche('Erreur 18 : l''actionneur '+intToSTR(tablo_actionneur[i].adresse)+' est lié à un périphérique n°'+intToSTR(adresse)+' COM/USB/Socket inexistant',clred); - ok:=false; + adresse:=tablo_actionneur[i].TabloOp[op].periph; + if adresse>NbPeriph then + begin + Affiche('Erreur 18 : l''action '+intToSTR(tablo_actionneur[i].adresse)+' est liée à un périphérique n°'+intToSTR(adresse)+' COM/USB/Socket inexistant',clred); + ok:=false; + end; end; end; - if Tablo_actionneur[i].typdeclenche=3 then // si actionneur de zone + if Tablo_actionneur[i].declencheur=DeclZoneDet then // si actionneur de zone begin adresse:=Tablo_actionneur[i].Adresse; adresse2:=Tablo_actionneur[i].Adresse2; @@ -11013,7 +10335,7 @@ begin if (suivant=0) or (suivant>9995) then begin ok:=false; - s:='Erreur 19: l''actionneur '+IntToSTR(Tablo_actionneur[i].adresse)+' est enclenché par les détecteurs '+intToSTR(adresse)+' ' +intToSTR(adresse2)+' qui ne sont pas contigus'; + s:='Erreur 19: l''action '+IntToSTR(Tablo_actionneur[i].adresse)+' est enclenchée par les détecteurs '+intToSTR(adresse)+' ' +intToSTR(adresse2)+' qui ne sont pas contigus'; Affiche(s,clred); end; end; @@ -12274,199 +11596,11 @@ procedure TFormConfig.PageControlChange(Sender: TObject); begin Label20.Visible:=false; LabelInfo.caption:=''; - if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAct then label40.Visible:=true + if FormConfig.PageControl.ActivePage=FormConfig.TabSheetPN then label40.Visible:=true else label40.Visible:=false; end; -procedure TFormConfig.SpeedButtonJoueClick(Sender: TObject); -begin - if (ligneclicAct<0) then exit; - if PlaySound(pchar(EditSon.Text),0,SND_ASYNC)=false then labelInfo.Caption:='Erreur'; -end; - - -procedure TFormConfig.ButtonTestActClick(Sender: TObject); -Var Adr,adr2,erreur,etat : integer; -begin - if (ligneclicAct<0) then exit; - etat:=0; - val(EditEtatActionneur.Text,Etat,erreur); - val(EditAct.Text,Adr,erreur); - val(EditAct2.Text,Adr2,erreur); - Ancien_actionneur[adr]:=0; - Event_act(adr,adr2,etat,'',false); -end; - -procedure TFormConfig.RadioButtonActDetClick(Sender: TObject); -var i,j,champ,erreur : integer; - s,train : string; -begin - if clicListe or (ligneclicAct<0) then exit; - i:=ligneClicAct+1; - if AffEvt then Affiche('RadioBoutonActDet '+IntToSTR(i),clyellow); - Tablo_Actionneur[i].typdeclenche:=0; - Label30.Visible:=true; - EditEtatActionneur.Visible:=true; - LabelActionneur.Caption:='Actionneur Détecteur'; - editAct2.Visible:=false; - EditTrainDecl.Visible:=true; - LabelTrain.Visible:=true; - EditEtatActionneur.Hint:='Etat 0 ou 1'; - //Tablo_Actionneur[i].trainDecl:=trainSauve; - //EditTrainDecl.Text:=trainSauve; - - train:=Tablo_Actionneur[i].trainDecl; - for j:=1 to length(train) do if train[j]=',' then train[j]:='+'; - EditTrainDecl.text:=train; - - - val(editact.Text,champ,erreur); - Tablo_actionneur[i].adresse:=champ ; - val(editEtatActionneur.Text,champ,erreur); - Tablo_actionneur[i].etat:=champ; - Tablo_actionneur[i].trainDecl:=EditTrainDecl.Text; - val(editFonctionAccess.Text,champ,erreur); - Tablo_actionneur[i].fonction:=champ; - val(editEtatFoncSortie.Text,champ,erreur); - Tablo_actionneur[i].sortie:=champ; - val(editTempo.Text,champ,erreur); - Tablo_actionneur[i].tempo:=champ; - tablo_actionneur[i].Raz:=checkRaz.checked; - s:=encode_act_loc_son(i); - ListBoxAct.Items[ligneClicAct]:=s; - ListBoxAct.Selected[ligneClicAct]:=true; - - EditAct.Hint:='Actionneur/Détecteur '+intToSTR(Tablo_actionneur[i].adresse); - -end; - - -procedure TFormConfig.RadioButtonZonesClick(Sender: TObject); -var i,champ,erreur : integer; - s : string; -begin - if clicListe or (ligneclicAct<0) then exit; - i:=ligneClicAct+1; - if AffEvt then Affiche('RadioBoutonZones '+IntToSTR(i),clyellow); - Tablo_Actionneur[i].typdeclenche:=3; - Label30.Visible:=true; - EditEtatActionneur.Visible:=true; - LabelActionneur.Caption:='Mémoire de Zone'; - EditTrainDecl.Visible:=false; - LabelTrain.Visible:=false; - editAct2.Visible:=true; - //editact.Text:=intToSTR(Tablo_actionneur[i].adresse2); - - EditEtatActionneur.Hint:='Etat 0 ou 1'; -// Tablo_actionneur[i].trainDecl:='X'; - val(editact.Text,champ,erreur); - Tablo_actionneur[i].adresse:=champ ; - val(editEtatActionneur.Text,champ,erreur); - Tablo_actionneur[i].etat:=champ; - val(editFonctionAccess.Text,champ,erreur); - Tablo_actionneur[i].fonction:=champ; - val(editEtatFoncSortie.Text,champ,erreur); - Tablo_actionneur[i].sortie:=champ; - val(editTempo.Text,champ,erreur); - Tablo_actionneur[i].tempo:=champ; - tablo_actionneur[i].Raz:=checkRaz.checked; - s:=encode_act_loc_son(i); - ListBoxAct.Items[ligneClicAct]:=s; - ListBoxAct.Selected[ligneClicAct]:=true; - - EditAct.Hint:='Actionneur/Détecteur '+intToSTR(Tablo_actionneur[i].adresse); - -end; - -procedure TFormConfig.RadioButtonAigClick(Sender: TObject); -var i,champ,erreur : integer; - s : string; -begin - if clicListe or (ligneclicAct<0) then exit; - i:=ligneClicAct+1; - if AffEvt then Affiche('RadioBoutonAig '+IntToSTR(i),clyellow); - Tablo_Actionneur[i].typdeclenche:=2; - LabelActionneur.Caption:='Aiguillage'; - EditTrainDecl.Visible:=false; - LabelTrain.Visible:=false; - editAct2.Visible:=false; - Label30.Visible:=true; - EditEtatActionneur.Visible:=true; - //editact.Text:=intToSTR(Tablo_actionneur[i].adresse2); - - EditEtatActionneur.Hint:='1 ou S=dévié 2 ou D=droit'; - //Tablo_actionneur[i].trainDecl:='X'; - val(editact.Text,champ,erreur); - Tablo_actionneur[i].adresse:=champ ; - val(editEtatActionneur.Text,champ,erreur); - Tablo_actionneur[i].etat:=champ; - val(editFonctionAccess.Text,champ,erreur); - Tablo_actionneur[i].fonction:=champ; - val(editEtatFoncSortie.Text,champ,erreur); - Tablo_actionneur[i].sortie:=champ; - val(editTempo.Text,champ,erreur); - Tablo_actionneur[i].tempo:=champ; - tablo_actionneur[i].Raz:=checkRaz.checked; - s:=encode_act_loc_son(i); - ListBoxAct.Items[ligneClicAct]:=s; - ListBoxAct.Selected[ligneClicAct]:=true; - EditAct.Hint:='Aiguillage '+intToSTR(Tablo_actionneur[i].adresse); -end; - -procedure TFormConfig.RadioButtonHorlClick(Sender: TObject); -var i,champ,erreur : integer; - s : string; -begin - if clicListe or (ligneclicAct<0) then exit; - i:=ligneClicAct+1; - if AffEvt then Affiche('RadioBoutonHorl '+IntToSTR(i),clyellow); - Tablo_Actionneur[i].typdeclenche:=1; - LabelActionneur.Caption:='Heure'+#13+'Minute'; - EditTrainDecl.Visible:=false; - LabelTrain.Visible:=false; - editAct2.Visible:=true; - Label30.Visible:=false; - EditEtatActionneur.Visible:=false; - - //editact.Text:=intToSTR(Tablo_actionneur[i].adresse2); - - //EditEtatActionneur.Hint:='1 ou S=dévié 2 ou D=droit'; - //Tablo_actionneur[i].trainDecl:='X'; - val(editact.Text,champ,erreur); - Tablo_actionneur[i].adresse:=champ ; - val(editEtatActionneur.Text,champ,erreur); - Tablo_actionneur[i].etat:=champ; - val(editFonctionAccess.Text,champ,erreur); - Tablo_actionneur[i].fonction:=champ; - val(editEtatFoncSortie.Text,champ,erreur); - Tablo_actionneur[i].sortie:=champ; - val(editTempo.Text,champ,erreur); - Tablo_actionneur[i].tempo:=champ; - tablo_actionneur[i].Raz:=checkRaz.checked; - s:=encode_act_loc_son(i); - ListBoxAct.Items[ligneClicAct]:=s; - ListBoxAct.Selected[ligneClicAct]:=true; - EditAct.Hint:='heure'; - EditAct2.Hint:='minute'; -end; - -procedure TFormConfig.SpeedButtonChargerClick(Sender: TObject); -var s: string; -begin - if (ligneclicAct<0) then exit; - s:=GetCurrentDir; - OpenDialogSon.InitialDir:=s; - OpenDialogSon.DefaultExt:='wav'; - OpenDialogSon.Title:='Ouvrir un fichier son'; - OpenDialogSon.Filter:='Fichiers wav (*.wav)|*.wav|Tous fichiers (*.*)|*.*'; - if openDialogSon.Execute then - begin - s:=openDialogSon.FileName; - editson.Text:=s; - end; -end; - procedure TFormConfig.RichBrancheKeyDown(Sender: TObject; var Key: Word;Shift: TShiftState); var lc,curseur,i : integer; begin @@ -12654,7 +11788,6 @@ var i : integer; begin if clicliste or (lignecliqueePN<0) then exit; if affevt then affiche('Evt CheckPnPulse Change',clyellow); - if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAct then with Formconfig do begin if CheckPnPulse.Checked then i:=1 else i:=0; @@ -12998,101 +12131,6 @@ procedure TFormConfig.CheckBoxVerifXpressNetClick(Sender: TObject); end; -procedure TFormConfig.ListBoxActKeyDown(Sender: TObject; var Key: Word; - Shift: TShiftState); -begin - if key=VK_delete then supprime_act; - - if ord(Key)=VK_UP then - begin - if clicListe then exit; - clicListe:=true; - if affevt then affiche('Evt RichAct keyup',clyellow); - with Formconfig.listBoxAct do - begin - if ligneclicAct>0 then - begin - dec(ligneclicAct); - if AncligneClicAct<>ligneClicAct then - begin - AncligneClicAct:=ligneClicAct; - aff_champs_Act(ligneclicAct+1); - end; - end; - end; - end; - - if ord(Key)=VK_DOWN then - begin - if clicListe then exit; - clicListe:=true; - if affevt then affiche('Evt RichAct keydown',clyellow); - with Formconfig.ListBoxAct do - begin - if ligneclicActligneClicAct then - begin - AncligneClicAct:=ligneClicAct; - aff_champs_Act(ligneClicAct+1); - end; - end; - end; - end; - - if (Shift = [ssCtrl]) and (key = ord('A')) then ListBoxAct.SelectAll; - - clicListe:=false; -end; - -procedure TFormConfig.RichPNKeyDown(Sender: TObject; var Key: Word; - Shift: TShiftState); -var lc : integer; -begin - if ord(Key)=VK_DELETE then supprime_pn; - if ord(Key)=VK_UP then - begin - if clicListe then exit; - clicListe:=true; - if affevt then affiche('Evt RichPN keyup',clyellow); - with Formconfig.ListBoxPN do - begin - if lc>0 then - begin - dec(lc); - AncLigneCliqueePN:=LigneCliqueePN; - LigneCliqueePN:=lc; - if AncLigneCliqueePN<>LigneCliqueePN then - begin - aff_champs_PN(lc+1); - end; - end; - end; - end; - - if ord(Key)=VK_DOWN then - begin - if clicListe then exit; - clicListe:=true; - if affevt then affiche('Evt RichPN keydown',clyellow); - with Formconfig.ListBoxPN do - begin - if lcLigneCliqueePN then - begin - aff_champs_PN(lc+1); - end; - end; - end; - end; - clicListe:=false; -end; - procedure TFormConfig.ListBoxTrainsKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin @@ -13368,7 +12406,6 @@ begin ferme:=pos('f',s)<>0; // champ ferme if clicliste or (lignecliqueePN<0) then exit; if affevt then affiche('Evt EditVXX Change',clyellow); - if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAct then with Formconfig do begin Val(sb,act,erreur); @@ -13432,7 +12469,6 @@ begin begin if clicliste or (lignecliqueePN<0) then exit; if affevt then affiche('Evt EditZdetXVX Change',clyellow); - if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAct then with Formconfig do begin i:=pos('det1',s);if i<>0 then begin numdet:=1;delete(s,1,i+3);end; @@ -13916,20 +12952,25 @@ end; procedure TFormConfig.ListBoxPNMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); -var i : integer; begin clicliste:=true; LabelInfo.caption:=''; raz_champs_PN; - if nbrePN<1 then exit; - for i:=0 to ListBoxAct.items.Count-1 do ListBoxAct.selected[i]:=false; + if nbrePN<1 then + begin + clicListe:=false; + exit; + end; + AnclignecliqueePN:=lignecliqueePN; lignecliqueePN:=listBoxPN.ItemIndex; - if lignecliqueePN<0 then exit; - // désactiver la ligne act + if lignecliqueePN<0 then + begin + clicLIste:=false; + exit; + end; - if NbrePN<1 then exit; Aff_champs_PN(lignecliqueePN+1); clicliste:=false; end; @@ -13937,7 +12978,7 @@ end; procedure TFormConfig.ListBoxPNKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin - if key=VK_delete then supprime_act; + if key=VK_delete then supprime_PN; if ord(Key)=VK_UP then begin @@ -13949,7 +12990,7 @@ begin if lignecliqueePN>0 then begin dec(lignecliqueePN); - if AnclignecliqueePN<>lignecliqueePN then + //if AnclignecliqueePN<>lignecliqueePN then begin AnclignecliqueePN:=lignecliqueePN; aff_champs_PN(lignecliqueePN+1); @@ -13965,10 +13006,10 @@ begin if affevt then affiche('Evt PN keydown',clyellow); with Formconfig.ListBoxPN do begin - if lignecliqueePNlignecliqueePN then + //if AnclignecliqueePN<>lignecliqueePN then begin AnclignecliqueePN:=lignecliqueePN; aff_champs_PN(lignecliqueePN+1); @@ -14045,7 +13086,7 @@ var ss,s : string; config_modifie:=true; FormConfig.ListBoxPeriph.Clear; //supprimer les champs des combos - formConfig.ComboBoxAccComUSB.Clear; + formModifAction.ComboBoxAccComUSB.Clear; formconfig.ComboBoxPNCom.Clear; formConfig.comboBoxDecCde.Clear; @@ -14103,7 +13144,7 @@ begin AncligneClicAccPeriph:=ligneClicAccPeriph; Aff_champs_accPeriph_tablo(i); s:='Nouveau périphérique'; - formConfig.ComboBoxAccComUSB.Items.Add(s); + formModifAction.ComboBoxAccComUSB.Items.Add(s); formconfig.ComboBoxPNCom.Items.Add(s); formconfig.ComboBoxDecCde.Items.Add(s); @@ -14121,7 +13162,7 @@ var tl: TListBox; begin tl:=(Tpopupmenu(Tmenuitem(sender).GetParentMenu).PopupComponent) as TlistBox ; s:=tl.name; - if s='ListBoxAct' then supprime_act; + if s='ListBoxActions' then supprime_action; if s='ListBoxPN' then supprime_PN; if s='ListBoxSig' then supprime_sig; if s='ListBoxAig' then supprime_aig; @@ -14136,7 +13177,7 @@ var tl: TListBox; begin tl:=(Tpopupmenu(Tmenuitem(sender).GetParentMenu).PopupComponent) as TlistBox ; s:=tl.name; - if s='ListBoxAct' then ajoute_actionneur; + if s='ListBoxActions' then ajoute_action; if s='ListBoxPN' then ajoute_PN; if s='ListBoxSig' then ajoute_signal; if s='ListBoxAig' then ajoute_aiguillage; @@ -14243,17 +13284,8 @@ begin end; -procedure TFormConfig.ComboBoxAccComUSBChange(Sender: TObject); - var s : string; - begin - if clicliste or (ligneClicAct<0) then exit; - if affevt then affiche('Evt Edit port Change',clyellow); - Tablo_Actionneur[ligneClicAct+1].fonction:=ComboBoxAccComUSB.ItemIndex+1; - s:=encode_act_loc_son(ligneClicAct+1); - ListBoxAct.Items[ligneClicAct]:=s; - ListBoxAct.Selected[ligneClicAct]:=true; -end; - + + procedure TFormConfig.ButtonSupAccComClick(Sender: TObject); begin supprime_periph; @@ -14339,7 +13371,6 @@ var s : string; begin if clicliste or (lignecliqueePN<0) then exit; if affevt then affiche('Evt radio',clyellow); - if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAct then begin if RadioGroupActPN.itemindex=0 then begin @@ -14491,7 +13522,6 @@ begin // réaffiche les champs qui contiennent les 3 combobox de périphériques maj_decodeurs; - aff_champs_Act(ligneclicAct+1); Aff_champs_PN(lignecliqueePN+1); config_modifie:=true; @@ -14543,7 +13573,7 @@ begin // réaffiche les champs qui contiennent les 3 combobox de périphériques maj_decodeurs; - aff_champs_Act(ligneclicAct+1); + //aff_champs_Act(ligneclicAct+1); Aff_champs_PN(lignecliqueePN+1); config_modifie:=true; @@ -14984,9 +14014,6 @@ begin if Valeur_entete=1 then RadioButton2.checked:=true; LabelInfo.Width:=240;LabelInfo.Height:=65;LabelInfo.AutoSize:=false; LabelResult.width:=137;LabelResult.Height:=25; - LabelNomSon.top:=16;LabelNomSon.Left:=48; - SpeedButtonJoue.Top:=60; SpeedButtonCharger.Top:=60; - EditSon.Top:=38;EditSon.Left:=16; CheckBoxResa.Checked:=AvecResa; CheckVerifVersion.Checked:=verifVersion; @@ -15073,8 +14100,171 @@ end; - + procedure TFormConfig.ButtonModActionClick(Sender: TObject); + begin + DeclencheurAffiche:=0; // pas de demande d'affichage onglet/opération + OperationAffiche:=0; + formModifAction.showModal; +end; + +procedure Affiche_action; +var i,j,decl :integer; + s : string; +begin + // remplir la listbox en fonction des opérations de l'action cliquée + with FormConfig.ListBoxOperations do + begin + clear; + for i:=1 to Tablo_Actionneur[ligneclicAct+1].NbOperations do + begin + j:=Tablo_Actionneur[ligneclicAct+1].tabloOp[i].numoperation; + s:=operations[j].nom; + if not(Tablo_Actionneur[ligneclicact+1].tabloOp[i].valide) then s:=s+' [dévalidé]'; + + if j<1 then + items.Add(Format('%d%s', [0, 'aucune opération'])) + else + items.Add(Format('%d%s', [j-1, s])); // valeur d'index de l'icone dans la ImagelistIcones + itemHeight:=17; + end; + end; - end. + formConfig.RichEditInfo.clear; + decl:=Tablo_Actionneur[ligneclicAct+1].declencheur; + if decl>Nbredeclencheurs then + begin + clicListe:=false; + exit; + end; + + s:=Info_action(ligneclicAct+1); + + if decl>0 then formConfig.RichEditInfo.Lines.Add(s); +end; + +procedure TFormConfig.ListBoxActionsMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin + if maxTablo_act<1 then exit; + clicliste:=true; +// raz_champs_act; + + // dévalider la liste des PN (autre tableau) + // for i:=0 to maxTablo_act-2 do formconfig.ListBoxAct.selected[i]:=false; + //for i:=0 to ListBoxPN.items.Count-1 do formconfig.ListBoxPN.selected[i]:=false; + + ligneclicAct:=listBoxActions.ItemIndex; + if ligneclicAct<0 then + begin + clicliste:=false; + exit; + end; + + Affiche_action; + + ClicAction:=-1; + + clicliste:=false; +end; + +procedure TFormConfig.ListBoxOperationsDrawItem(Control: TWinControl; + Index: Integer; Rect: TRect; State: TOwnerDrawState); +var + i,erreur: Integer; + ItemText: string; +begin + with ListBoxOperations do + begin + ItemText:=Items[index]; + val(ItemText,i,erreur); + Delete(ItemText,1,erreur-1); + Canvas.Fillrect(Rect); + formConfCellTCO.ImageListIcones.Draw(Canvas, Rect.Left, Rect.Top, i); + Canvas.Textout(Rect.Left + formConfCellTCO.ImageListIcones.Width + 2, Rect.Top, ItemText); + end; +end; + +procedure TFormConfig.ListBoxOperationsMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin + ClicAction:=ListBoxOperations.ItemIndex; +end; + +procedure action_relais(i : integer); +begin + action(i); +end; + +procedure TFormConfig.ButtonTestActionClick(Sender: TObject); +begin + if (ligneclicAct<0) then exit; + action_relais(ligneclicact+1); // car action est une fonction d'une form... +end; + +procedure TFormConfig.ModifActionClick(Sender: TObject); + begin + DeclencheurAffiche:=0; + OperationAffiche:=clicaction+1; + formModifAction.ShowModal; +end; + +procedure TFormConfig.ListBoxActionsKeyDown(Sender: TObject; var Key: Word; + Shift: TShiftState); +begin + if (maxTablo_act<1) or clicliste then exit; + if key=VK_delete then supprime_action; + + if ord(Key)=VK_UP then + begin + clicListe:=true; + with ListBoxActions.Items do + begin + if ligneClicAct>0 then + begin + dec(ligneClicAct); + affiche_action; + end; + end; + end; + + if ord(Key)=VK_DOWN then + begin + if clicListe then exit; + clicListe:=true; + with Formconfig.ListBoxactions.Items do + begin + if ligneClicAct0) then Event_Act(det,0,1,'',false); + if (erreur=0) and (det>0) then Event_Act(det,0,1,''); end; procedure TFormDebug.ButtonSimuAct0Click(Sender: TObject); var det,erreur : integer; begin val(EditSimuDet.Text,det,erreur); - if (erreur=0) and (det>0) then Event_Act(det,0,0,'',false); + if (erreur=0) and (det>0) then Event_Act(det,0,0,''); end; procedure TFormDebug.ButtonRazToutClick(Sender: TObject); @@ -715,4 +716,16 @@ begin NivDebug:=AncDebug; end; +procedure TFormDebug.ButtonSigPrecClick(Sender: TObject); +var Adr,erreur,ancDebug : integer; +begin + Val(EditSigSuiv.Text,Adr,erreur); + if (erreur<>0) or (Adr<1) then exit; + ancdebug:=NivDebug; + NivDebug:=3; + erreur:=Signal_Precedent(Adr); + NivDebug:=AncDebug; + AfficheDebug('signal précédent='+intToSTR(erreur),clyellow); +end; + end. diff --git a/UnitFicheHoraire.dfm b/UnitFicheHoraire.dfm index e1e607b..70abdf9 100644 --- a/UnitFicheHoraire.dfm +++ b/UnitFicheHoraire.dfm @@ -12,6 +12,7 @@ object FormFicheHoraire: TFormFicheHoraire Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = False + Position = poScreenCenter OnActivate = FormActivate OnCreate = FormCreate PixelsPerInch = 96 diff --git a/UnitFicheHoraire.pas b/UnitFicheHoraire.pas index e93f660..f4d2d11 100644 --- a/UnitFicheHoraire.pas +++ b/UnitFicheHoraire.pas @@ -24,7 +24,7 @@ type end; const - MaxHoraire=20; + MaxHoraire=200; var FormFicheHoraire: TFormFicheHoraire; @@ -106,7 +106,7 @@ begin Hint:='Grille horaire'; ShowHint:=true; ColCount:=6; - RowCount:=14; + RowCount:=MaxHoraire+1; Options := stringGridFO.Options + [goEditing]; ColWidths[0]:=30; ColWidths[1]:=200; @@ -116,7 +116,7 @@ begin ColWidths[5]:=60; Cells[0,0]:='Ligne'; - Cells[1,0]:='Nom train'; + Cells[1,0]:='Nom du train'; Cells[2,0]:='Départ'; Cells[3,0]:='Vitesse'+#13+'démarrage'; Cells[4,0]:='Sens'+#13+'(N/R)'; diff --git a/UnitHorloge.dfm b/UnitHorloge.dfm index 4d65fae..e9052a1 100644 --- a/UnitHorloge.dfm +++ b/UnitHorloge.dfm @@ -362,7 +362,7 @@ object FormHorloge: TFormHorloge object LabelErreur: TLabel Left = 288 Top = 192 - Width = 3 + Width = 113 Height = 13 Caption = '.' end @@ -375,7 +375,7 @@ object FormHorloge: TFormHorloge TabOrder = 0 object RadioButtonHS: TRadioButton Left = 32 - Top = 24 + Top = 16 Width = 113 Height = 17 Hint = 'Horloge window, non comprimable' @@ -387,7 +387,7 @@ object FormHorloge: TFormHorloge end object RadioButtonHI: TRadioButton Left = 32 - Top = 40 + Top = 32 Width = 113 Height = 17 Hint = 'Horloge de Signaux_Complexes, comprimable' @@ -472,14 +472,14 @@ object FormHorloge: TFormHorloge Caption = 'Initialisation de l'#39'horloge interne' TabOrder = 3 object Label3: TLabel - Left = 70 + Left = 38 Top = 28 Width = 49 Height = 13 Caption = 'Initialiser '#224 end object Label4: TLabel - Left = 152 + Left = 144 Top = 26 Width = 6 Height = 13 @@ -499,18 +499,6 @@ object FormHorloge: TFormHorloge Height = 13 Caption = 'h' end - object EditHInit: TEdit - Left = 128 - Top = 24 - Width = 25 - Height = 21 - Hint = 'Heure de d'#233'marrage de l'#39'horloge interne' - ParentShowHint = False - ShowHint = True - TabOrder = 0 - Text = '00' - OnChange = EditHInithange - end object EditMInit: TEdit Left = 160 Top = 24 @@ -519,7 +507,7 @@ object FormHorloge: TFormHorloge Hint = 'Heure de d'#233'marrage de l'#39'horloge interne' ParentShowHint = False ShowHint = True - TabOrder = 1 + TabOrder = 0 Text = '00' OnChange = EditMInitChange end @@ -529,7 +517,7 @@ object FormHorloge: TFormHorloge Width = 59 Height = 25 Caption = 'Initialiser' - TabOrder = 2 + TabOrder = 1 OnClick = ButtonInitClick end object EditRetourHeure: TEdit @@ -540,7 +528,7 @@ object FormHorloge: TFormHorloge Hint = 'Heure '#224' laquelle l'#39'horloge reprend sa valeur initiale' ParentShowHint = False ShowHint = True - TabOrder = 3 + TabOrder = 2 Text = '00' OnChange = EditRetourHeureChange end @@ -552,7 +540,7 @@ object FormHorloge: TFormHorloge Hint = 'Heure '#224' laquelle l'#39'horloge reprend sa valeur initiale' ParentShowHint = False ShowHint = True - TabOrder = 4 + TabOrder = 3 Text = '00' OnChange = EditRetourMinuteChange end @@ -562,9 +550,20 @@ object FormHorloge: TFormHorloge Width = 241 Height = 17 Caption = 'Red'#233'marrer l'#39'horloge au retour '#224' l'#39'initialisation' - TabOrder = 5 + TabOrder = 4 OnClick = CheckBoxRedemarreClick end + object SpinEditHInit: TSpinEdit + Left = 104 + Top = 24 + Width = 38 + Height = 22 + MaxValue = 23 + MinValue = 0 + TabOrder = 5 + Value = 0 + OnChange = SpinEditHInitChange + end end object ButtonS: TButton Left = 206 @@ -580,7 +579,7 @@ object FormHorloge: TFormHorloge end object ButtonAh: TButton Left = 312 - Top = 200 + Top = 224 Width = 75 Height = 33 Caption = 'Afficher l'#39'horloge' diff --git a/UnitHorloge.pas b/UnitHorloge.pas index f1fb81e..450a930 100644 --- a/UnitHorloge.pas +++ b/UnitHorloge.pas @@ -4,7 +4,7 @@ interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, - Dialogs, StdCtrls,unitPrinc, ComCtrls, jpeg, ExtCtrls ; + Dialogs, StdCtrls,unitPrinc, ComCtrls, jpeg, ExtCtrls, Spin ; type TFormHorloge = class(TForm) @@ -17,7 +17,6 @@ type ButtonOk: TButton; GroupBox3: TGroupBox; Label3: TLabel; - EditHInit: TEdit; EditMInit: TEdit; Label4: TLabel; TrackBarTemps: TTrackBar; @@ -34,11 +33,11 @@ type CheckBoxRedemarre: TCheckBox; ButtonAh: TButton; CheckBoxAffiche: TCheckBox; + SpinEditHInit: TSpinEdit; procedure ButtonOkClick(Sender: TObject); procedure FormActivate(Sender: TObject); procedure TrackBarTempsChange(Sender: TObject); procedure ButtonInitClick(Sender: TObject); - procedure EditHInithange(Sender: TObject); procedure EditMInitChange(Sender: TObject); procedure RadioButtonHSClick(Sender: TObject); procedure RadioButtonHIClick(Sender: TObject); @@ -50,6 +49,7 @@ type procedure CheckBoxRedemarreClick(Sender: TObject); procedure ButtonAhClick(Sender: TObject); procedure CheckBoxAfficheClick(Sender: TObject); + procedure SpinEditHInitChange(Sender: TObject); private { Déclarations privées } public @@ -77,7 +77,7 @@ begin begin GroupBox3.Enabled:=true; GroupBox2.Enabled:=true; - editHinit.Enabled:=true; + SpinEditHinit.Enabled:=true; editMinit.Enabled:=true; ButtonInit.Enabled:=true; TrackBarTemps.Enabled:=true; @@ -92,7 +92,7 @@ begin begin GroupBox3.Enabled:=false; GroupBox2.Enabled:=false; - editHinit.Enabled:=false; + SpinEditHinit.Enabled:=false; editMinit.Enabled:=false; ButtonInit.Enabled:=false; TrackBarTemps.Enabled:=false; @@ -157,19 +157,7 @@ begin init_horloge; end; -procedure TFormHorloge.EditHInithange(Sender: TObject); -var i,erreur : integer; -begin - val(editHInit.Text,i,erreur); - if (erreur<>0) or (i<0) or (i>23) then - begin - LabelErreur.Caption:='Erreur heure'; - exit; - end; - LabelErreur.Caption:=''; - HeureInit:=i; - config_modifie:=true; -end; + procedure TFormHorloge.EditMInitChange(Sender: TObject); var i,erreur : integer; @@ -264,7 +252,7 @@ begin CheckBoxAffiche.checked:=AffHorl; CheckBoxRedemarre.Checked:=relanceHorl_init; TrackBarTemps.position:=DureeMinute; - EditHInit.Text:=intToSTR(HeureInit); + SpinEditHInit.Text:=intToSTR(HeureInit); EditMInit.Text:=intToSTR(MinuteInit); EditRetourHeure.Text:=intToSTR(RetourHeure); EditRetourMinute.Text:=intToSTR(RetourMinute); @@ -295,4 +283,19 @@ begin AffHorl:=CheckBoxAffiche.checked; end; +procedure TFormHorloge.SpinEditHInitChange(Sender: TObject); +var i,erreur : integer; +begin + val(spinEditHInit.Text,i,erreur); + if (erreur<>0) or (i<0) or (i>23) then + begin + LabelErreur.Caption:='Erreur heure'; + exit; + end; + LabelErreur.Caption:=''; + HeureInit:=i; + config_modifie:=true; + +end; + end. diff --git a/UnitModifAction.dfm b/UnitModifAction.dfm new file mode 100644 index 0000000..1e02561 --- /dev/null +++ b/UnitModifAction.dfm @@ -0,0 +1,559 @@ +object FormModifAction: TFormModifAction + Left = 309 + Top = 112 + BorderStyle = bsDialog + Caption = 'Modifier une action' + ClientHeight = 443 + ClientWidth = 744 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = False + Position = poScreenCenter + OnActivate = FormActivate + OnCreate = FormCreate + PixelsPerInch = 96 + TextHeight = 13 + object Label5: TLabel + Left = 16 + Top = 10 + Width = 62 + Height = 16 + Caption = 'Action(s)' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'MS Sans Serif' + Font.Style = [fsBold] + ParentFont = False + end + object LabelInfo: TLabel + Left = 316 + Top = 416 + Width = 237 + Height = 13 + end + object ButtonOk: TButton + Left = 16 + Top = 416 + Width = 75 + Height = 25 + Caption = 'Ok' + TabOrder = 0 + OnClick = ButtonOkClick + end + object ComboBoxActions: TComboBox + Left = 88 + Top = 8 + Width = 585 + Height = 21 + Style = csDropDownList + ItemHeight = 13 + TabOrder = 1 + OnChange = ComboBoxActionsChange + end + object PageControlAct: TPageControl + Left = 8 + Top = 64 + Width = 729 + Height = 337 + ActivePage = TabSheetOp + MultiLine = True + TabOrder = 2 + object TabSheetDecl: TTabSheet + Caption = 'D'#233'clencheur' + object LabelDecl: TLabel + Left = 16 + Top = 24 + Width = 193 + Height = 13 + Caption = 'Liste de d'#233'clencheurs disponibles' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [fsBold] + ParentFont = False + end + object ListBoxDeclench: TListBox + Left = 16 + Top = 60 + Width = 185 + Height = 185 + ItemHeight = 13 + TabOrder = 0 + OnDrawItem = ListBoxDeclenchDrawItem + end + object GroupBoxDecl: TGroupBox + Left = 224 + Top = 52 + Width = 481 + Height = 149 + Caption = 'Param'#232'tres du d'#233'clencheur ' + TabOrder = 1 + object LabelAdresse: TLabel + Left = 16 + Top = 36 + Width = 38 + Height = 13 + Caption = 'Adresse' + end + object LabelTrain: TLabel + Left = 8 + Top = 112 + Width = 86 + Height = 13 + Caption = 'Train d'#233'clencheur' + WordWrap = True + end + object LabelEtat: TLabel + Left = 32 + Top = 72 + Width = 19 + Height = 13 + Caption = 'Etat' + end + object Labelheure: TLabel + Left = 120 + Top = 36 + Width = 6 + Height = 13 + Caption = 'h' + end + object ImageIcone: TImage + Left = 304 + Top = 24 + Width = 16 + Height = 16 + end + object EditAdr: TEdit + Left = 80 + Top = 32 + Width = 33 + Height = 21 + Hint = 'Adresse' + ParentShowHint = False + ShowHint = True + TabOrder = 0 + OnChange = EditAdrChange + end + object EditAdr2: TEdit + Left = 136 + Top = 32 + Width = 33 + Height = 21 + ParentShowHint = False + ShowHint = True + TabOrder = 1 + OnChange = EditAdr2Change + end + object EditTrainDecl: TEdit + Left = 120 + Top = 112 + Width = 241 + Height = 21 + ParentShowHint = False + ShowHint = True + TabOrder = 2 + OnChange = EditTrainDeclChange + end + object SpinEditEtat: TSpinEdit + Left = 80 + Top = 68 + Width = 33 + Height = 22 + MaxValue = 2 + MinValue = 0 + TabOrder = 3 + Value = 0 + OnChange = SpinEditEtatChange + end + end + object RichEditInf: TRichEdit + Left = 224 + Top = 216 + Width = 481 + Height = 49 + TabOrder = 2 + end + object ButtonApplDecl: TButton + Left = 16 + Top = 256 + Width = 75 + Height = 25 + Hint = 'Application du d'#233'clencheur '#224' l'#39'action s'#233'lectionn'#233'e' + Caption = 'Appliquer' + ParentShowHint = False + ShowHint = True + TabOrder = 3 + OnClick = ButtonApplDeclClick + end + end + object TabSheetOp: TTabSheet + Caption = 'Op'#233'rations' + ImageIndex = 1 + object Shape1: TShape + Left = 216 + Top = 8 + Width = 3 + Height = 293 + Brush.Color = clBlack + end + object Label3: TLabel + Left = 258 + Top = 8 + Width = 157 + Height = 13 + Caption = 'Liste d'#39'op'#233'rations '#224' r'#233'aliser' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [fsBold] + ParentFont = False + end + object Label2: TLabel + Left = 32 + Top = 8 + Width = 67 + Height = 13 + Caption = 'Liste d'#39'actions' + end + object SpeedButtonSupprime: TSpeedButton + Left = 338 + Top = 255 + Width = 23 + Height = 22 + Hint = 'Supprime une op'#233'ration de la liste' + Glyph.Data = { + F6000000424DF600000000000000760000002800000010000000100000000100 + 04000000000080000000C40E0000C40E00001000000000000000000000000000 + 8000008000000080800080000000800080008080000080808000C0C0C0000000 + FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00FFF9FFFFFFF9 + 9FFFFF999FFFFF9999FFF99999FFF999999F9999999F9999999FF99999999999 + 99FFFF99999999999FFFFFF999999999FFFFFFFF9999999FFFFFFFF999999999 + FFFFFF99999999999FFFF9999999999999FF9999999F9999999F999999FFF999 + 999FF9999FFFFF9999FFFF99FFFFFFF99FFFFFFFFFFFFFFFFFFF} + ParentShowHint = False + ShowHint = True + OnClick = SpeedButtonSupprimeClick + end + object Label1: TLabel + Left = 240 + Top = 258 + Width = 94 + Height = 13 + Caption = 'Supprimer op'#233'ration' + end + object ComboBoxFamille: TComboBox + Left = 0 + Top = 32 + Width = 209 + Height = 21 + ItemHeight = 13 + TabOrder = 0 + OnChange = ComboBoxFamilleChange + end + object ListBoxOper: TListBox + Left = 0 + Top = 64 + Width = 201 + Height = 193 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ItemHeight = 13 + ParentFont = False + TabOrder = 1 + OnDrawItem = ListBoxOperDrawItem + end + object ListBoxOperations: TListBox + Left = 232 + Top = 28 + Width = 217 + Height = 201 + Hint = 'Liste chronologique des op'#233'rations '#224' effectuer' + ItemHeight = 13 + ParentShowHint = False + ShowHint = True + TabOrder = 2 + OnDblClick = ListBoxOperationsDblClick + OnDrawItem = ListBoxOperationsDrawItem + OnMouseDown = ListBoxOperationsMouseDown + end + object GroupBoxParam: TGroupBox + Left = 464 + Top = 32 + Width = 249 + Height = 265 + Caption = 'Param'#232'tres de l'#39'op'#233'ration' + TabOrder = 3 + object SpeedButtonCharger: TSpeedButton + Left = 128 + Top = 216 + Width = 25 + Height = 34 + Hint = 'Ouvre un fichier son WAV' + Flat = True + Glyph.Data = { + BA060000424DBA06000000000000360400002800000019000000170000000100 + 0800000000008402000000000000000000000001000000000000000000000000 + 80000080000000808000800000008000800080800000C0C0C000C0DCC000F0CA + A6000020400000206000002080000020A0000020C0000020E000004000000040 + 20000040400000406000004080000040A0000040C0000040E000006000000060 + 20000060400000606000006080000060A0000060C0000060E000008000000080 + 20000080400000806000008080000080A0000080C0000080E00000A0000000A0 + 200000A0400000A0600000A0800000A0A00000A0C00000A0E00000C0000000C0 + 200000C0400000C0600000C0800000C0A00000C0C00000C0E00000E0000000E0 + 200000E0400000E0600000E0800000E0A00000E0C00000E0E000400000004000 + 20004000400040006000400080004000A0004000C0004000E000402000004020 + 20004020400040206000402080004020A0004020C0004020E000404000004040 + 20004040400040406000404080004040A0004040C0004040E000406000004060 + 20004060400040606000406080004060A0004060C0004060E000408000004080 + 20004080400040806000408080004080A0004080C0004080E00040A0000040A0 + 200040A0400040A0600040A0800040A0A00040A0C00040A0E00040C0000040C0 + 200040C0400040C0600040C0800040C0A00040C0C00040C0E00040E0000040E0 + 200040E0400040E0600040E0800040E0A00040E0C00040E0E000800000008000 + 20008000400080006000800080008000A0008000C0008000E000802000008020 + 20008020400080206000802080008020A0008020C0008020E000804000008040 + 20008040400080406000804080008040A0008040C0008040E000806000008060 + 20008060400080606000806080008060A0008060C0008060E000808000008080 + 20008080400080806000808080008080A0008080C0008080E00080A0000080A0 + 200080A0400080A0600080A0800080A0A00080A0C00080A0E00080C0000080C0 + 200080C0400080C0600080C0800080C0A00080C0C00080C0E00080E0000080E0 + 200080E0400080E0600080E0800080E0A00080E0C00080E0E000C0000000C000 + 2000C0004000C0006000C0008000C000A000C000C000C000E000C0200000C020 + 2000C0204000C0206000C0208000C020A000C020C000C020E000C0400000C040 + 2000C0404000C0406000C0408000C040A000C040C000C040E000C0600000C060 + 2000C0604000C0606000C0608000C060A000C060C000C060E000C0800000C080 + 2000C0804000C0806000C0808000C080A000C080C000C080E000C0A00000C0A0 + 2000C0A04000C0A06000C0A08000C0A0A000C0A0C000C0A0E000C0C00000C0C0 + 2000C0C04000C0C06000C0C08000C0C0A000F0FBFF00A4A0A000808080000000 + FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00FFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000FF0A0A00FFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000FF272727271C120A00FFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF000000FF27BF7F77776F2727271D130A0000FFFFFF + FFFFFFFFFFFFFF000000FF26F6BFBFBF7F7F7F77776F2F27271D130A0000FFFF + FFFFFF000000FF2F6FF6BFBFBFBFBF7F7F7F7F7F7F6F2F2F270AFFFFFFFFFF00 + 0000FF2727F6BFBFBFBFBFBF7F7F7F7F7F7F7F7F7726FFFFFFFFFF000000FF27 + 6FF6BFBFBFBFBFBFBF7F7F7F7F7F7F7F7F2F00FFFFFFFF000000FF27BF6FF6BF + BFBFBFBFBFBF7F7F7F7F7F7F7F771CFFFFFFFF000000FF27BF27F6BFBFBFBFBF + BFBFBF7F7F7F7F7F7FBF2F00FFFFFF000000FF27BF2FF6BFBFBFBFBFBFBFBFBF + 7F7F7F7F7FBF7713FFFFFF000000FF277F376FF6BFBFBFBFBFBFBFBFBF7F7F7F + 7F7FBF2F00FFFF000000FF277F3727F6BFBFBFBFBFBFBFBFBFBF7F7F7F7FBF77 + 0AFFFF000000FF277F372F27276FF6F6F6F6F6BFBFBFBFBF7F7F7FBF2700FF00 + 0000FF277F37373737372F2F27276F77BFBFBFBFBFBFBFBF6F0AFF000000FF27 + 7F373737373737373737372F2F276F6F7777777F7F1DFF000000FF277F373737 + 3737373737373737373737372F6F2F272727FF000000FF277F37373737373737 + 3737373737373737377FBF270A0AFF000000FF277F373737373737377FBFBFBF + BFBFBFBFBFF6270AFFFFFF000000FF277F373737373737372666272727272727 + 272752FFFFFFFF000000FF27BFBFBFBFBFBFBFBF25FFFFFFFFFFFFFFFFFFFFFF + FFFFFF000000FF266F2727272727276F13FFFFFFFFFFFFFFFFFFFFFFFFFFFF00 + 0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000} + ParentShowHint = False + ShowHint = True + OnClick = SpeedButtonChargerClick + end + object SpeedButtonJoue: TSpeedButton + Left = 56 + Top = 216 + Width = 41 + Height = 33 + Hint = 'Joue le son' + Flat = True + Glyph.Data = { + 4E010000424D4E010000000000003E0000002800000022000000220000000100 + 010000000000100100000000000000000000020000000000000000000000FFFF + FF00FFFFFFFFC0000000FFFFFFFFC0000000FFFFFFFFC0000000C0000000C000 + 0000800000004000000000000000000000001FFFFFFE000000003FFFFFFF0000 + 00003FFFFFFF000000003FFFFFFF000000003FF8FFFF000000003FF03FFF0000 + 00003FF00FFF000000003FF303FF000000003FF3C0FF000000003FF3F07F0000 + 00003FF3FC7F000000003FF3FC7F000000003FF3E07F000000003FF381FF0000 + 00003FF207FF000000003FF01FFF000000003FF07FFF000000003FF9FFFF0000 + 00003FFFFFFF000000003FFFFFFF000000003FFFFFFF000000001FFFFFFE0000 + 000000000000000000008000000040000000C0000000C0000000FFFFFFFFC000 + 0000FFFFFFFFC0000000FFFFFFFFC0000000} + ParentShowHint = False + ShowHint = True + OnClick = SpeedButtonJoueClick + end + object LabelPeriph: TLabel + Left = 24 + Top = 128 + Width = 62 + Height = 13 + Caption = 'P'#233'riph'#233'rique:' + end + object LabeledEditTrain: TLabeledEdit + Left = 24 + Top = 184 + Width = 161 + Height = 21 + Hint = 'train' + EditLabel.Width = 24 + EditLabel.Height = 13 + EditLabel.Caption = 'Train' + ParentShowHint = False + ShowHint = True + TabOrder = 0 + OnChange = LabeledEditTrainChange + end + object LabeledEditAdresse: TLabeledEdit + Left = 64 + Top = 32 + Width = 41 + Height = 21 + EditLabel.Width = 38 + EditLabel.Height = 13 + EditLabel.Caption = 'Adresse' + LabelPosition = lpLeft + LabelSpacing = 10 + TabOrder = 1 + OnChange = LabeledEditAdresseChange + end + object LabeledEditFonctionF: TLabeledEdit + Left = 144 + Top = 56 + Width = 41 + Height = 21 + EditLabel.Width = 47 + EditLabel.Height = 13 + EditLabel.Caption = 'FonctionF' + LabelPosition = lpLeft + LabelSpacing = 10 + TabOrder = 2 + OnChange = LabeledEditFonctionFChange + end + object LabeledEditEtat: TLabeledEdit + Left = 144 + Top = 32 + Width = 25 + Height = 21 + EditLabel.Width = 19 + EditLabel.Height = 13 + EditLabel.Caption = 'Etat' + LabelPosition = lpLeft + LabelSpacing = 10 + TabOrder = 3 + OnChange = LabeledEditEtatChange + end + object CheckBoxRAZ: TCheckBox + Left = 24 + Top = 104 + Width = 145 + Height = 17 + Caption = 'Remise '#224' 0 apr'#232's pilotage' + TabOrder = 4 + OnClick = CheckBoxRAZClick + end + object ComboBoxAccComUSB: TComboBox + Left = 24 + Top = 144 + Width = 201 + Height = 21 + Hint = 'Nom de l'#39'accessoire d'#233'fini dans l'#39'onglet "p'#233'riph'#233'riques COM/USB"' + Style = csDropDownList + ItemHeight = 13 + ParentShowHint = False + ShowHint = True + TabOrder = 5 + OnChange = ComboBoxAccComUSBChange + end + object LabeledEditTempoF: TLabeledEdit + Left = 144 + Top = 80 + Width = 33 + Height = 21 + EditLabel.Width = 72 + EditLabel.Height = 13 + EditLabel.Caption = 'Tempo x100ms' + LabelPosition = lpLeft + LabelSpacing = 10 + TabOrder = 6 + OnChange = LabeledEditTempoFChange + end + end + object ButtonAjouter: TButton + Left = 128 + Top = 276 + Width = 75 + Height = 25 + Hint = + 'Ajouter l'#39'action s'#233'lectionn'#233'e dans la liste des op'#233'rations '#224' r'#233'a' + + 'liser' + Caption = 'Ajouter >>>' + ParentShowHint = False + ShowHint = True + TabOrder = 4 + OnClick = ButtonAjouterClick + end + object ButtonAppAction: TButton + Left = 16 + Top = 276 + Width = 75 + Height = 25 + Hint = + 'Mise '#224' jour du champ d'#39'action vers le champ de la liste d'#39'op'#233'ra' + + 'tions '#224' r'#233'aliser' + Caption = 'Appliquer >>>' + ParentShowHint = False + ShowHint = True + TabOrder = 5 + OnClick = ButtonAppActionClick + end + object SpinButton1: TSpinButton + Left = 400 + Top = 248 + Width = 33 + Height = 41 + Hint = 'Change l'#39'ordre d'#39'ex'#233'cution des op'#233'rations' + DownGlyph.Data = { + 0E010000424D0E01000000000000360000002800000009000000060000000100 + 200000000000D800000000000000000000000000000000000000008080000080 + 8000008080000080800000808000008080000080800000808000008080000080 + 8000008080000080800000808000000000000080800000808000008080000080 + 8000008080000080800000808000000000000000000000000000008080000080 + 8000008080000080800000808000000000000000000000000000000000000000 + 0000008080000080800000808000000000000000000000000000000000000000 + 0000000000000000000000808000008080000080800000808000008080000080 + 800000808000008080000080800000808000} + ParentShowHint = False + ShowHint = True + TabOrder = 6 + UpGlyph.Data = { + 0E010000424D0E01000000000000360000002800000009000000060000000100 + 200000000000D800000000000000000000000000000000000000008080000080 + 8000008080000080800000808000008080000080800000808000008080000080 + 8000000000000000000000000000000000000000000000000000000000000080 + 8000008080000080800000000000000000000000000000000000000000000080 + 8000008080000080800000808000008080000000000000000000000000000080 + 8000008080000080800000808000008080000080800000808000000000000080 + 8000008080000080800000808000008080000080800000808000008080000080 + 800000808000008080000080800000808000} + OnDownClick = SpinButton1DownClick + OnUpClick = SpinButton1UpClick + end + end + end + object LabeledEditNomAct: TLabeledEdit + Left = 88 + Top = 36 + Width = 225 + Height = 21 + EditLabel.Width = 73 + EditLabel.Height = 13 + EditLabel.Caption = 'Nom de l'#39'action' + LabelPosition = lpLeft + LabelSpacing = 5 + TabOrder = 3 + OnChange = LabeledEditNomActChange + end + object OpenDialogSon: TOpenDialog + Left = 680 + end +end diff --git a/UnitModifAction.pas b/UnitModifAction.pas new file mode 100644 index 0000000..095003c --- /dev/null +++ b/UnitModifAction.pas @@ -0,0 +1,1219 @@ +unit UnitModifAction; + +interface + +uses + Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, + Dialogs, StdCtrls, ComCtrls, Buttons, ExtCtrls, Spin , MMSystem; + +type + TFormModifAction = class(TForm) + ButtonOk: TButton; + ComboBoxActions: TComboBox; + PageControlAct: TPageControl; + TabSheetDecl: TTabSheet; + TabSheetOp: TTabSheet; + ListBoxDeclench: TListBox; + GroupBoxDecl: TGroupBox; + LabelAdresse: TLabel; + LabelTrain: TLabel; + EditAdr: TEdit; + EditAdr2: TEdit; + EditTrainDecl: TEdit; + ComboBoxFamille: TComboBox; + ListBoxOper: TListBox; + Shape1: TShape; + ListBoxOperations: TListBox; + LabelDecl: TLabel; + Label3: TLabel; + GroupBoxParam: TGroupBox; + ButtonAjouter: TButton; + ButtonAppAction: TButton; + Label2: TLabel; + SpeedButtonSupprime: TSpeedButton; + LabelEtat: TLabel; + SpinEditEtat: TSpinEdit; + SpinButton1: TSpinButton; + Labelheure: TLabel; + LabeledEditTrain: TLabeledEdit; + OpenDialogSon: TOpenDialog; + SpeedButtonCharger: TSpeedButton; + SpeedButtonJoue: TSpeedButton; + LabeledEditAdresse: TLabeledEdit; + LabeledEditFonctionF: TLabeledEdit; + LabeledEditEtat: TLabeledEdit; + CheckBoxRAZ: TCheckBox; + Label5: TLabel; + RichEditInf: TRichEdit; + ButtonApplDecl: TButton; + LabeledEditNomAct: TLabeledEdit; + Label1: TLabel; + ComboBoxAccComUSB: TComboBox; + LabeledEditTempoF: TLabeledEdit; + ImageIcone: TImage; + LabelPeriph: TLabel; + LabelInfo: TLabel; + procedure ButtonOkClick(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure ListBoxOperDrawItem(Control: TWinControl; Index: Integer; + Rect: TRect; State: TOwnerDrawState); + procedure ListBoxDeclenchDrawItem(Control: TWinControl; Index: Integer; + Rect: TRect; State: TOwnerDrawState); + procedure ComboBoxFamilleChange(Sender: TObject); + procedure FormActivate(Sender: TObject); + procedure ComboBoxActionsChange(Sender: TObject); + procedure ListBoxOperationsDrawItem(Control: TWinControl; + Index: Integer; Rect: TRect; State: TOwnerDrawState); + procedure ButtonAppActionClick(Sender: TObject); + procedure ButtonAjouterClick(Sender: TObject); + procedure SpeedButtonSupprimeClick(Sender: TObject); + procedure SpinButton1UpClick(Sender: TObject); + procedure SpinButton1DownClick(Sender: TObject); + procedure EditAdrChange(Sender: TObject); + procedure EditAdr2Change(Sender: TObject); + procedure SpinEditEtatChange(Sender: TObject); + procedure EditTrainDeclChange(Sender: TObject); + procedure ListBoxOperationsMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); + procedure LabeledEditAdresseChange(Sender: TObject); + procedure LabeledEditFonctionFChange(Sender: TObject); + procedure LabeledEditTrainChange(Sender: TObject); + procedure SpeedButtonJoueClick(Sender: TObject); + procedure SpeedButtonChargerClick(Sender: TObject); + procedure CheckBoxRAZClick(Sender: TObject); + procedure LabeledEditEtatChange(Sender: TObject); + procedure ButtonApplDeclClick(Sender: TObject); + procedure LabeledEditNomActChange(Sender: TObject); + procedure ComboBoxAccComUSBChange(Sender: TObject); + procedure LabeledEditTempoFChange(Sender: TObject); + procedure ListBoxOperationsDblClick(Sender: TObject); + private + { Déclarations privées } + public + { Déclarations publiques } + end; + +var + FormModifAction: TFormModifAction; + AffParam : boolean; + ClicDeclenche,ClicAction,DeclencheurAffiche,OperationAffiche : integer; + +function Info_action(i : integer) : string; + +implementation + +uses Unitprinc, UnitConfigCellTCO, UnitConfig; + + +{$R *.dfm} + + + +procedure efface_tous_parametres; +begin + with FormModifAction do + begin + LabelAdresse.Visible:=false; + SpinEditEtat.Visible:=false; + EditAdr.visible:=false; + LabelHeure.Visible:=false; + EditAdr2.Visible:=false; + LabelTrain.Visible:=false; + EditTrainDecl.Visible:=false; + LabelPeriph.Visible:=false; + LabelEtat.Visible:=false; + LabeledEditTempoF.Visible:=false; + LabeledEditTrain.Visible:=false; + SpeedButtonJoue.visible:=false; + SpeedButtonCharger.visible:=false; + LabeledEditFonctionF.Visible:=false; + LabeledEditAdresse.Visible:=false; + LabeledEditEtat.visible:=false; + checkBoxRaz.Visible:=false; + GroupBoxParam.Visible:=true; + RichEditInf.clear; + ComboBoxAccComUSB.visible:=false; + end; +end; + + +procedure TFormModifAction.FormCreate(Sender: TObject); +var i,icone : integer; +begin + ListBoxOper.Style:=lbOwnerDrawVariable; // pour afficher des icones + ListBoxDeclench.Style:=lbOwnerDrawVariable; + ListBoxOperations.Style:=lbOwnerDrawVariable; + for i:=1 to NbreOperations do + begin + ListBoxOper.Items.Add(Format('%d%s', [i-1, operations[i].nom])); // valeur d'index de l'icone dans la ImagelistIcones + ListBoxOper.itemHeight:=17; // 16 mini taille des éléments pour l'icone + end; + for i:=1 to NbreDeclencheurs do + begin + icone:=0; + case i of + DeclHorloge : icone:=iconeHorloge; + DeclPeriph : icone:=iconePeriph; + DeclAccessoire: icone:=IconeAccessoire; + DeclDetAct: icone:=IconeDet; + DeclZoneDet: icone:=IconeZoneDet; + end; + ListBoxDeclench.Items.Add(Format('%d%s', [icone, declencheurs[i].nom])); // valeur d'index de l'icone dans la ImagelistIcones + ListBoxDeclench.itemHeight:=17; + end; + + with ComboBoxFamille do + begin + items.Add('Tous'); + items.Add('Système'); + items.Add('Pilotage'); + items.Add('Trains'); + itemIndex:=0; + end; + + EdittrainDecl.Hint:='Train(s) déclencheur(s) séparés par des virgules pour lesquels la condition s''applique.' + +#13+'Mettre X pour tous les trains.'+#13+'Déclenchement par actionneur uniquement'; + + ListBoxOperations.Hint:='Liste chronologique des opérations à effectuer'+#13+ + 'Double clic pour valider/dévalider une action'; + + Efface_tous_parametres; + PageControlAct.ActivePage:=TabSheetDecl; +end; + +procedure TFormModifAction.ListBoxOperDrawItem(Control: TWinControl; + Index: Integer; Rect: TRect; State: TOwnerDrawState); +var + i,erreur: Integer; + ItemText: string; +begin + with ListBoxOper do + begin + ItemText:=Items[index]; + val(ItemText,i,erreur); + Delete(ItemText,1,erreur-1); + Canvas.Fillrect(Rect); + formConfCellTCO.ImageListIcones.Draw(Canvas, Rect.Left, Rect.Top, i); + Canvas.Textout(Rect.Left + formConfCellTCO.ImageListIcones.Width + 2, Rect.Top, ItemText); + end; + +end; + +procedure TFormModifAction.ListBoxDeclenchDrawItem(Control: TWinControl; + Index: Integer; Rect: TRect; State: TOwnerDrawState); +var + i,erreur: Integer; + ItemText: string; +begin + with ListBoxDeclench do + begin + ItemText:=Items[index]; + val(ItemText,i,erreur); + Delete(ItemText,1,erreur-1); + Canvas.Fillrect(Rect); + formConfCellTCO.ImageListIcones.Draw(Canvas, Rect.Left, Rect.Top, i); + Canvas.Textout(Rect.Left + formConfCellTCO.ImageListIcones.Width + 2, Rect.Top, ItemText); + end; +end; + +procedure TFormModifAction.ListBoxOperationsDrawItem(Control: TWinControl; + Index: Integer; Rect: TRect; State: TOwnerDrawState); +var + i,erreur: Integer; + ItemText: string; +begin + //Affiche('Evt ListBoxOperationsDrawItem',clyellow); + with ListBoxOperations do + begin + ItemText:=Items[index]; + val(ItemText,i,erreur); + Delete(ItemText,1,erreur-1); + Canvas.Fillrect(Rect); + formConfCellTCO.ImageListIcones.Draw(Canvas, Rect.Left, Rect.Top, i); + Canvas.Textout(Rect.Left + formConfCellTCO.ImageListIcones.Width + 2, Rect.Top, ItemText); + end; + +end; + +procedure TFormModifAction.ComboBoxFamilleChange(Sender: TObject); +var i,n,famille : integer; + s : string; +begin + ListBoxOper.Clear; + famille:=ComboBoxFamille.ItemIndex; // famille=0=afficher tous + + for i:=1 to NbreOperations do + begin + if (operations[i].famille=famille) or (famille=0) then + begin + s:=operations[i].nom; + n:=Index_Operation(s); + ListBoxOper.Items.Add(Format('%d%s', [n-1, s])); // valeur d'index de l'icone dans la ImagelistIcones + end; + end; +end; + +function Info_action(i : integer) : string; +var nop,op,top,decl : integer; + r : double; + s :string; +begin + decl:=Tablo_Actionneur[i].declencheur; + s:='Le déclencheur '; + case decl of + DeclHorloge : + begin // affiche XX + s:=s+'Horloge à '+format('%.2d',[Tablo_Actionneur[i].heure])+'h'+format('%.2d',[Tablo_Actionneur[i].minute]); + end; + DeclPeriph : + begin + s:=s+'Périphérique : '+Tablo_Actionneur[i].ordrePeriph; + end; + DeclAccessoire : + begin + s:=s+'Accessoire '+intToSTR(Tablo_Actionneur[i].adresse); + end; + DeclDetAct : + begin + s:=s+'Détecteur/Actionneur '+intToSTR(Tablo_Actionneur[i].adresse); + s:=s+' par le train "'+Tablo_Actionneur[i].trainDecl+'"'; + end; + DeclZoneDet : + begin + s:=s+'Zone détection '+intToSTR(Tablo_Actionneur[i].adresse)+' '+intToSTR(Tablo_Actionneur[i].adresse2); + end; + end; + nop:=Tablo_Actionneur[i].NbOperations; + + if nop=0 then s:=s+' ne déclenche aucune opération'+#13; + if nop=1 then s:=s+' déclenche 1 opération '+#13; + if nop>1 then s:=s+' déclenche '+intToSTR(nop)+' opérations:'+#13; + + s:=s+'--------------------'+#13; + + for op:=1 to nop do + begin + top:=Tablo_Actionneur[i].tabloop[op].numoperation; + case top of + ActionAffTCO : s:=s+'Affiche TCO '+intToSTR(Tablo_Actionneur[i].tabloop[op].NumTCO)+#13; + ActionAffSC : s:=s+'Affiche signaux_complexes'+#13; + ActionAffCDM : s:=s+'Affiche CDM rail'+#13; + ActionAccessoire : + begin + s:=s+'Pilote l''accessoire '+intToSTR(Tablo_Actionneur[i].tabloop[op].adresse)+ + ' à '+intToSTR(Tablo_Actionneur[i].tabloop[op].etat); + if Tablo_Actionneur[i].tabloop[op].zero then s:=s+' impulsionnel'+#13 else s:=s+' maintenu'+#13; + end; + ActionArretTRains : s:=s+'Arrêt des trains'+#13; + ActionLanceHorl : s:=s+'Lance l''horloge'+#13; + ActionArretHorl : s:=s+'Arrête l''horloge'+#13; + ActionInitHorl : s:=s+'Initialise l''horloge'+#13; + ActionAffHorl : s:=s+'Affiche l''horloge'+#13; + ActionVitesse : s:=s+'Modifie la vitesse du train '+Tablo_Actionneur[i].tabloop[op].train+' à '+intToSTR(Tablo_Actionneur[i].tabloop[op].vitesse)+#13; + ActionCdePeriph : s:=s+'Pilote le périphérique '+intToSTR(Tablo_Actionneur[i].tabloop[op].periph)+' chaîne : '+Tablo_Actionneur[i].tabloop[op].chaine+#13; + ActionFonctionF : s:=s+'Fonction F'+intToSTR(Tablo_Actionneur[i].tabloop[op].fonctionF)+' train dest='+Tablo_Actionneur[i].tabloop[op].train+#13; + ActionSon : s:=s+'Son '+Tablo_Actionneur[i].tabloop[op].train+#13; + ActionTempo : + begin + nop:=Tablo_Actionneur[i].tabloop[op].tempoF; + r:=nop/10; + s:=s+'Temporisation '+intToSTR(nop)+' ('+Format('%.1f', [r])+'s)'#13; + end; + end; + end; + result:=s; +end; + + + +// affiche les champs en fonction de l'index du tablo actionneur et de l'index de l'action +procedure Aff_champs(index,IndexAction : integer); +var i,decl,act,Nb,icone : integer; + s : string; +begin + if (index<1) or clicListe then exit; + clicliste:=true; + // Affiche('Aff_champs('+intToSTR(index)+','+intToSTR(indexAction)+')',clYellow); + decl:=Tablo_Actionneur[index].declencheur; + formModifAction.ListBoxDeclench.ItemIndex:=decl-1; + + // comboboxActions + s:=encode_actions(index); + with formModifAction.ComboBoxActions do + begin + Items[index-1]:=s; + ItemIndex:=index-1; + end; + + with formconfig.ListBoxActions do + begin + items[index-1]:=s; + end; + + s:=Info_action(ligneclicAct+1); + with formConfig.RichEditInfo do + begin + clear; + Lines.Add(s); + end; + + + FormModifAction.LabeledEditNomAct.Text:=Tablo_Actionneur[index].NomAction; + + // ListBox opérations + with FormModifAction.ListBoxOperations do + begin + clear; + formConfig.ListBoxOperations.Clear; + for i:=1 to Tablo_Actionneur[index].NbOperations do + begin + act:=Tablo_Actionneur[index].tabloOp[i].numoperation; + s:=operations[act].nom; + if not(Tablo_Actionneur[index].tabloOp[i].valide) then s:=s+' [dévalidé]'; + if act<1 then icone:=0 else icone:=act-1; + + items.Add(Format('%d%s', [icone, s])); // valeur d'index de l'icone dans la ImagelistIcones + + // listboxOperations de la formConfig + formConfig.ListBoxOperations.Items.add(Format('%d%s', [act-1, s])); + itemHeight:=17; + end; + if indexaction<>0 then itemIndex:=indexaction-1; + end; + + // listBoxActions de la formConfig + FormConfig.ListBoxActions.Clear; + for i:=1 to maxTablo_act do + begin + s:=encode_actions(i); + formConfig.ListBoxActions.Items.add(s); + end; + + + efface_tous_parametres; + + with FormModifAction do + case decl of + DeclHorloge : + begin + EditAdr.text:=intToSTR(Tablo_Actionneur[index].heure); + EditAdr2.text:=intToSTR(Tablo_Actionneur[index].minute); + LabelHeure.visible:=true; + LabelAdresse.visible:=true; + EditAdr.Visible:=true; + LabelAdresse.Caption:='Heure'; + EditAdr.Hint:='Heure du déclencheur'; + EditAdr2.Hint:='Minute du déclencheur'; + EditAdr2.Visible:=true; + LabelEtat.Visible:=false; + SpinEditEtat.Visible:=false; + LabelTrain.Visible:=false; + EditTrainDecl.Visible:=false; + RichEditInf.Lines.Add('Déclenchement par l''horloge'); + ImageIcone.Picture:=nil; + formConfCellTCO.ImageListIcones.GetBitmap(IconeHorloge,ImageIcone.Picture.Bitmap); + ImageIcone.repaint; + end; + DeclPeriph : + begin + EditTrainDecl.Text:=Tablo_Actionneur[index].ordrePeriph; + LabelHeure.visible:=false; + LabelAdresse.visible:=false; + EditAdr.Visible:=false; + EditAdr2.Visible:=false; + LabelEtat.Visible:=false; + + SpinEditEtat.Visible:=false; + LabelTrain.Visible:=false; + + EditTrainDecl.Visible:=true; + EditTrainDecl.Hint:='Chaîne ASCII'; + + LabelTrain.visible:=true; + LabelTrain.Caption:='Commande du périphérique'; + RichEditInf.Lines.Add('Déclenchement par chaîne ASCII depuis un périphérique COM/USB - Socket'); + + ImageIcone.Picture:=nil; + formConfCellTCO.ImageListIcones.GetBitmap(IconePeriph,ImageIcone.Picture.Bitmap); + ImageIcone.repaint; + end; + DeclAccessoire : + begin + EditAdr.text:=intToSTR(Tablo_Actionneur[index].adresse); + + with SpinEditEtat do + begin + text:=intToSTR(Tablo_Actionneur[index].etat); + MaxValue:=2; + Hint:='Etat de l''accessoire'+#13+ + '0=nul'+#13+ + '1=devié'+#13+ + '2=droit'; + ShowHint:=true; + visible:=true; + end; + + LabelHeure.visible:=false; + LabelAdresse.caption:='Adresse'; + LabelAdresse.visible:=true; + EditAdr.Hint:='Adresse du déclencheur'; + EditAdr.Visible:=true; + EditAdr2.Visible:=false; + + LabelEtat.Visible:=true; + + LabelTrain.Visible:=false; + EditTrainDecl.Visible:=false; + RichEditInf.Lines.Add('Accessoire sur le bus DCC (aiguillage)'); + ImageIcone.Picture:=nil; + formConfCellTCO.ImageListIcones.GetBitmap(IconeAccessoire,ImageIcone.Picture.Bitmap); + ImageIcone.repaint; + end; + + DeclDetAct : + begin + EditAdr.text:=intToSTR(Tablo_Actionneur[index].adresse); + EditTrainDecl.Visible:=true; + EditTrainDecl.Text:=Tablo_Actionneur[index].trainDecl; + EdittrainDecl.Hint:='Train(s) déclencheur(s) séparés par des virgules pour lesquels la condition s''applique.' + +#13+'Mettre X pour tous les trains.'+#13+'Déclenchement par actionneur uniquement'; + LabelAdresse.visible:=true; + EditAdr.Visible:=true; + EditAdr.Hint:='Adresse du déclencheur'; + LabelHeure.visible:=false; + EditAdr2.Visible:=false; + LabelAdresse.Caption:='Adresse'; + LabelEtat.Visible:=true; + + with SpinEditEtat do + begin + text:=intToSTR(Tablo_Actionneur[index].etat); + MaxValue:=1; + Hint:='Etat du détecteur/actionneur'+#13+ + '0=désactivé'+#13+ + '1=activé'; + ShowHint:=true; + visible:=true; + end; + + LabelTrain.Visible:=true; + LabelTrain.Caption:='Train déclencheur'; + + RichEditInf.Lines.Add('Déclenchement par détecteur/actionneur suivant son état et un train, un groupe de trains ou tous les trains.'); + ImageIcone.Picture:=nil; + formConfCellTCO.ImageListIcones.GetBitmap(IconeDet,ImageIcone.Picture.Bitmap); + ImageIcone.repaint; + end; + + DeclZoneDet : + begin + EditAdr.text:=intToSTR(Tablo_Actionneur[index].adresse); + EditAdr2.text:=intToSTR(Tablo_Actionneur[index].adresse2); + + EditTrainDecl.Text:=Tablo_Actionneur[index].trainDecl; + EditAdr.Hint:='Adresse1 de la zone de détection du déclencheur'; + EditAdr2.Hint:='Adresse2 de la zone de détection du déclencheur'; + LabelAdresse.visible:=true; + EditAdr.Visible:=true; + LabelHeure.visible:=false; + EditAdr2.Visible:=true; + LabelAdresse.Caption:='Adresse'; + LabelEtat.Visible:=true; + + EditTrainDecl.Visible:=true; + EdittrainDecl.Hint:='Train(s) déclencheur(s) séparés par des virgules pour lesquels la condition s''applique.' + +#13+'Mettre X pour tous les trains.'+#13+'Mode autonome uniquement'; + + with SpinEditEtat do + begin + text:=intToSTR(Tablo_Actionneur[index].etat); + MaxValue:=1; + Hint:='Etat de la zone de détection'+#13+ + '0=désactivé'+#13+ + '1=activé'; + ShowHint:=true; + visible:=true; + end; + + LabelTrain.Visible:=true; + LabelTrain.Caption:='Train déclencheur'; + RichEditInf.Lines.Add('Déclenchement par zones de détections contigües suivant son état et un train, un groupe de trains ou tous les trains.'); + ImageIcone.Picture:=nil; + formConfCellTCO.ImageListIcones.GetBitmap(IconeZoneDet,ImageIcone.Picture.Bitmap); + ImageIcone.repaint; + end; + end; + + + if indexAction=0 then + begin + Clicliste:=false; + exit; + end; + + Nb:=Tablo_Actionneur[index].NbOperations; + if Nb>=indexAction then + begin + + Act:=Tablo_actionneur[index].tabloop[indexAction].numoperation; + + with formModifAction do + begin + + case Act of + ActionAffTCO : + begin + LabeledEditAdresse.Visible:=true; + LabeledEditAdresse.EditLabel.Caption:='TCO n°'; + LabeledEditAdresse.Text:=intToSTR(Tablo_actionneur[index].tabloop[indexAction].NumTCO); + end; + ActionAccessoire : + begin + LabeledEditAdresse.EditLabel.Caption:='Adresse'; + LabeledEditAdresse.visible:=true; + LabeledEditEtat.visible:=true; + checkBoxRaz.Visible:=true; + LabeledEditAdresse.Text:=intToSTR(Tablo_actionneur[index].tabloop[indexAction].adresse); + LabeledEditEtat.Text:=intToSTR(Tablo_actionneur[index].tabloop[indexAction].etat); + checkBoxRAZ.Checked:=Tablo_actionneur[index].tabloop[indexAction].zero; + end; + ActionVitesse : + begin + LabeledEditAdresse.EditLabel.Caption:='Vitesse'; + LabeledEditAdresse.visible:=true; + LabeledEditTrain.Visible:=true; + LabeledEditTrain.EditLabel.Caption:='Train destinataire'; + LabeledEditTrain.hint:='Nom unique du train'; + LabeledEditAdresse.Text:=intToSTR(Tablo_actionneur[index].tabloop[indexAction].vitesse); + LabeledEditTrain.Text:=Tablo_actionneur[index].tabloop[indexAction].train; + end; + ActionCdePeriph : + begin + LabeledEditTrain.Visible:=true; + ComboBoxAccComUSB.Visible:=true; + LabelPeriph.Visible:=true; + LabeledEditTrain.EditLabel.Caption:='Commande'; + LabeledEditTrain.Text:=Tablo_actionneur[index].tabloop[indexAction].chaine; + ComboBoxAccComUSB.itemIndex:=Tablo_actionneur[index].tabloop[indexAction].periph-1; + end; + ActionFonctionF : + begin + LabeledEditFonctionF.Visible:=true; + LabeledEditTempoF.Visible:=true; + LabeledEditTrain.EditLabel.Caption:='Train destinataire'; + LabeledEditFonctionF.EditLabel.Caption:='Fonction F'; + LabeledEditTrain.Visible:=true; + LabeledEditTrain.hint:='Nom unique du train'; + LabeledEditFonctionF.Text:=intToSTR(Tablo_actionneur[index].tabloop[indexAction].fonctionF); + LabeledEditTempoF.Text:=intToSTR(Tablo_actionneur[index].tabloop[indexAction].TempoF); + LabeledEditTrain.Text:=Tablo_actionneur[index].tabloop[indexAction].train; + end; + ActionSon : + begin + LabeledEditTrain.Visible:=true; + SpeedButtonJoue.Visible:=true; + SpeedButtonCharger.Visible:=true; + LabeledEditTrain.EditLabel.Caption:='Son'; + LabeledEditTrain.Hint:='fichier son'; + LabeledEditTrain.Text:=Tablo_actionneur[index].tabloop[indexAction].train; + end; + ActionTempo : + begin + LabeledEditTempoF.Visible:=true; + LabeledEditTempoF.EditLabel.Caption:='Temporisation (x100 ms)'; + LabeledEditTempoF.Text:=intToSTR(Tablo_actionneur[index].tabloop[indexAction].TempoF); + end; + + end; + end; + end; + clicliste:=false; +end; + +procedure TFormModifAction.ButtonOkClick(Sender: TObject); +begin + Aff_champs(ligneclicAct+1,1); + close; +end; + + +procedure TFormModifAction.FormActivate(Sender: TObject); +var i : integer; + s : string; +begin + + ComboBoxActions.Clear; + for i:=1 to maxTablo_act do + begin + s:=encode_actions(i); + if s<>'' then ComboBoxActions.Items.Add(s); + end; + //ligneclicACt:=0; + ComboBoxActions.ItemIndex:=ligneclicAct; + LabelDecl.Caption:='Liste de déclencheurs de l''action n°'+intToSTR(ComboBoxactions.ItemIndex+1); + Aff_champs(ligneclicAct+1,ClicAction+1); + + if OperationAffiche<>0 then + begin + PageControlAct.ActivePage:=TabSheetOp; + end; +end; + +procedure TFormModifAction.ComboBoxActionsChange(Sender: TObject); +begin + ligneclicAct:=ComboBoxActions.ItemIndex; + Aff_champs(ligneclicAct+1,0); + LabelDecl.Caption:='Liste de déclencheurs de l''action n°'+intToSTR(ComboBoxactions.ItemIndex+1); +end; + + +procedure TFormModifAction.ButtonAppActionClick(Sender: TObject); +var indexSrc,IndexDest,i : integer; + s : string; +begin + indexSrc:=listboxOper.ItemIndex; + IndexDest:=ListBoxOperations.Itemindex; + if (indexSrc<0) or (ligneclicAct<0) then exit; + + + s:=ListBoxOper.Items[indexSrc]; + i:=Index_Operation(s); + + if (IndexDest<0) then IndexDest:=0; + Tablo_Actionneur[ligneClicAct+1].TabloOp[IndexDest+1].numoperation:=i; + + listboxoperations.Items[indexDest]:=ListBoxOper.Items[indexSrc]; + + Aff_champs(ligneClicAct+1,indexDest+1); +end; + +procedure TFormModifAction.ButtonAjouterClick(Sender: TObject); +var indexSrc,idBD,NbOp,i : integer; + s : string; +begin + indexSrc:=listboxOper.ItemIndex; + if indexSrc<0 then exit; + + s:=ListBoxOper.Items[IndexSrc]; + i:=index_operation(s); + if i=0 then exit; + + idBD:=ligneClicAct+1; + NbOp:=Tablo_Actionneur[idBD].NbOperations; + inc(NbOp); + Tablo_Actionneur[idBD].NbOperations:=NbOp; + Setlength(Tablo_Actionneur[idBD].tabloOp,NbOp+1); + // le nouveau numéro d'opération c'est l'index de la listboxOper + Tablo_Actionneur[idBD].tabloOp[NbOp].numoperation:=i; + Tablo_Actionneur[idBD].tabloOp[NbOp].valide:=true; + + Aff_champs(idbd,Nbop); + clicAction:=NbOp-1; + ListBoxOperations.ItemIndex:=clicAction; + +end; + +procedure TFormModifAction.SpeedButtonSupprimeClick(Sender: TObject); +var i,indexSrc,idBD,NbOp,NumOp,res : integer; + s : string; +begin + indexSrc:=listboxOperations.ItemIndex; + if indexSrc<0 then exit; + + idBD:=ligneClicAct+1; + NbOp:=Tablo_Actionneur[idBD].NbOperations; + if NbOp<1 then exit; + + NumOp:=Tablo_Actionneur[idBD].TabloOp[indexSrc+1].numoperation; + s:='Voulez vous supprimer l''action '+#13+operations[NumOp].Nom+' ?'; + res:=MessageDlg(s,mtConfirmation,[mbYes,mbNo],0); + if res=mrNo then exit;; + + // supprimer + listboxoperations.Items.Delete(indexSrc); + for i:=IndexSrc+1 to NbOp-1 do + begin + Tablo_Actionneur[idBD].TabloOp[i]:=Tablo_Actionneur[idBD].TabloOp[i+1]; + end; + + dec(NbOp); + Tablo_Actionneur[idBD].NbOperations:=NbOp; + Setlength(Tablo_Actionneur[idBD].tabloOp,NbOp+1); + + Aff_champs(idBD,IndexSrc+1); + exit; + + + + // réencoder la ligne + s:=encode_actions(idBD); + // maj combobox + ComboBoxActions.Items[idBD-1]:=s; + ComboBoxActions.ItemIndex:=idbd-1; +end; + +procedure TFormModifAction.SpinButton1UpClick(Sender: TObject); +var i,indexSrc,idBD,idOp,no : integer; + top : Toperation; + s : string; +begin + indexSrc:=listboxOperations.ItemIndex; + if indexSrc<0 then exit; + idBD:=ligneClicAct+1; + idop:=indexSrc+1; + + + if (indexSrc<1) then exit; + top:=Tablo_Actionneur[idBD].TabloOp[idOp-1]; + Tablo_Actionneur[idBD].TabloOp[idOp-1]:=Tablo_Actionneur[idBD].TabloOp[idOp]; + Tablo_Actionneur[idBD].TabloOp[idOp]:=top; + + // réencoder la ligne + s:=encode_actions(idBD); + // maj combobox + ComboBoxActions.Items[idBD-1]:=s; + ComboBoxActions.ItemIndex:=idbd-1; + + // maj opérations + with FormModifAction.ListBoxOperations do + begin + clear; + for i:=1 to Tablo_Actionneur[idBD].NbOperations do + begin + no:=Tablo_Actionneur[idBD].tabloOp[i].numoperation; + items.Add(Format('%d%s', [no-1, operations[no].nom])); // valeur d'index de l'icone dans la ImagelistIcones + itemHeight:=17; + end; + ItemIndex:=indexSrc-1; + end; + + //Affiche(intToSTR(ligneClicAct),clyellow); + + +end; + +procedure TFormModifAction.SpinButton1DownClick(Sender: TObject); + +var no,i,indexSrc,idBD,idOp : integer; + top : Toperation; + s : string; +begin + indexSrc:=listboxOperations.ItemIndex; + if indexSrc<0 then exit; + idBD:=ligneClicAct+1; + idop:=indexSrc+1; + + + no:=Tablo_Actionneur[idBD].NbOperations; + + if (indexSrc+1>=No) then exit; + top:=Tablo_Actionneur[idBD].TabloOp[idOp+1]; + Tablo_Actionneur[idBD].TabloOp[idOp+1]:=Tablo_Actionneur[idBD].TabloOp[idOp]; + Tablo_Actionneur[idBD].TabloOp[idOp]:=top; + + + // réencoder la ligne + s:=encode_actions(idBD); + // maj combobox + ComboBoxActions.Items[idBD-1]:=s; + ComboBoxActions.ItemIndex:=idbd-1; + + // maj opérations + with FormModifAction.ListBoxOperations do + begin + clear; + for i:=1 to Tablo_Actionneur[idBD].NbOperations do + begin + no:=Tablo_Actionneur[idBD].tabloOp[i].numoperation; + items.Add(Format('%d%s', [no-1, operations[no].nom])); // valeur d'index de l'icone dans la ImagelistIcones + itemHeight:=17; + end; + + ItemIndex:=indexSrc+1; + end; + + //Affiche(intToSTR(ligneClicAct),clyellow); + + +end; + +procedure maj_combocactions(i : integer); +var s : string; +begin + s:=encode_actions(i+1); + with formModifAction do + begin + ComboBoxActions.Items[i]:=s; + ComboBoxActions.ItemIndex:=ligneClicAct; + end; +end; + +procedure TFormModifAction.EditAdrChange(Sender: TObject); +var decl,index,i,erreur : integer; +begin + if (ligneclicAct<0) or clicliste then exit; + index:=ligneclicAct+1; + if affevt then Affiche('EditAdrChange',clyellow); + + decl:=Tablo_actionneur[ligneclicAct+1].declencheur; + val(editAdr.Text,i,erreur); + if (i<0) or (erreur<>0) then exit; + + if decl=DeclHorloge then + begin + if (i>23) then exit; + Tablo_actionneur[index].heure:=i; + end + else Tablo_actionneur[index].adresse:=i; + maj_combocactions(ligneclicAct); +end; + +procedure TFormModifAction.EditAdr2Change(Sender: TObject); +var decl,index,i,erreur : integer; +begin + if (ligneclicAct<0) or clicliste then exit; + index:=ligneclicAct+1; + + decl:=Tablo_actionneur[ligneclicAct+1].declencheur; + + if (decl<>DeclZoneDet) and (decl<>DeclHorloge) then exit; + + val(editAdr2.Text,i,erreur); + if (i<0) or (erreur<>0) then exit; + + if decl=DeclHorloge then + begin + if (i>59) then exit; + Tablo_actionneur[index].minute:=i; + end; + if decl=DeclZoneDet then Tablo_actionneur[index].adresse2:=i; + maj_combocactions(ligneclicAct); +end; + +procedure TFormModifAction.SpinEditEtatChange(Sender: TObject); +var decl,index,i,erreur : integer; +begin + if (ligneclicAct<0) or clicliste then exit; + index:=ligneclicAct+1; + + decl:=Tablo_actionneur[ligneclicAct+1].declencheur; + if (decl<>declAccessoire) and (decl<>DeclDetAct) and (decl<>DeclZoneDet) then exit; + + val(SpinEditEtat.Text,i,erreur); + if (i<0) or (i>2) or (erreur<>0) then exit; + Tablo_actionneur[index].etat:=i; + + maj_combocactions(ligneclicAct); +end; + +procedure TFormModifAction.EditTrainDeclChange(Sender: TObject); +var decl,index : integer; +begin + if (ligneclicAct<0) or clicliste then exit; + if affevt then Affiche('EditTrainDeclChange',clyellow); + index:=ligneclicAct+1; + + decl:=Tablo_actionneur[ligneclicAct+1].declencheur; + if (decl<>declDetAct) and (decl<>DeclZoneDet) and (decl<>DeclPeriph) then exit; + + if (decl=declDetAct) or (decl=DeclZoneDet) then Tablo_actionneur[index].trainDecl:=EditTrainDecl.text; + if decl=DeclPeriph then Tablo_actionneur[index].ordrePeriph:=EditTrainDecl.text; + + maj_combocactions(ligneclicAct); +end; + +procedure TFormModifAction.ListBoxOperationsMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin + //Affiche('Clic ListBoxOperations',clyellow); + ClicAction:=ListBoxOperations.itemindex; + if ClicAction<0 then exit; + Aff_champs(ligneclicAct+1,ClicAction+1); +end; + + +procedure TFormModifAction.LabeledEditAdresseChange(Sender: TObject); +var i,erreur,op : integer; +begin + if (ligneclicAct<0) or clicliste then exit; + val(LabeledEditAdresse.Text,i,erreur); + op:=Tablo_actionneur[ligneclicact+1].tabloOp[clicaction+1].numoperation; + case op of + ActionAffTCO : Tablo_actionneur[ligneclicact+1].tabloOp[clicaction+1].numTCO:=i; + ActionAccessoire: Tablo_actionneur[ligneclicact+1].tabloOp[clicaction+1].adresse:=i; + ActionVitesse : Tablo_actionneur[ligneclicact+1].tabloOp[clicaction+1].vitesse:=i; + end; + maj_combocactions(ligneclicAct); +end; + +procedure TFormModifAction.LabeledEditFonctionFChange(Sender: TObject); +var i,erreur,op : integer; +begin + if clicAction<0 then exit; + if (ligneclicAct<0) or clicliste then exit; + val(LabeledEditFonctionF.Text,i,erreur); + op:=Tablo_actionneur[ligneclicact+1].tabloOp[clicaction+1].numoperation; + case op of + ActionFonctionF : Tablo_actionneur[ligneclicact+1].tabloOp[clicaction+1].FonctionF:=i; + ActionTempo : Tablo_actionneur[ligneclicact+1].tabloOp[clicaction+1].TempoF:=i; + end; + maj_combocactions(ligneclicAct); +end; + +procedure TFormModifAction.LabeledEditTrainChange(Sender: TObject); +var op : integer; + s : string; +begin + if (clicAction<0) or clicListe then exit; + op:=Tablo_actionneur[ligneclicact+1].tabloOp[clicaction+1].numoperation; + if (op=ActionFonctionF) or (op=ActionVitesse) or (op=ActionSon) then + begin + s:=LabeledEditTrain.Text; + if pos(',',s)<>0 then + begin + labelInfo.Caption:='Les noms de trains multiples ne sont pas autorisés ici'; + exit; + end; + labelInfo.Caption:=''; + Tablo_actionneur[ligneclicact+1].tabloOp[clicaction+1].train:=s; + end; + if op=ActionCdePeriph then Tablo_actionneur[ligneclicact+1].tabloOp[clicaction+1].chaine:=LabeledEditTrain.Text; + maj_combocactions(ligneclicact); +end; + +procedure TFormModifAction.SpeedButtonJoueClick(Sender: TObject); +begin + if (ligneclicAct<0) then exit; + if PlaySound(pchar(LabeledEditTrain.Text),0,SND_ASYNC)=false then labelInfo.Caption:='Erreur'; +end; + +procedure TFormModifAction.SpeedButtonChargerClick(Sender: TObject); +var s: string; + op : integer; +begin + if (ligneclicAct<0) or (clicAction<0) then exit; + + s:=GetCurrentDir; + OpenDialogSon.InitialDir:=s; + OpenDialogSon.DefaultExt:='wav'; + OpenDialogSon.Title:='Ouvrir un fichier son'; + OpenDialogSon.Filter:='Fichiers wav (*.wav)|*.wav|Tous fichiers (*.*)|*.*'; + if openDialogSon.Execute then + begin + s:=openDialogSon.FileName; + LabeledEditTrain.Text:=s; + op:=Tablo_actionneur[ligneclicact+1].tabloOp[clicaction+1].numoperation; + if op=ActionSon then Tablo_actionneur[ligneclicact+1].tabloOp[clicaction+1].train:=s; + end; + maj_combocactions(ligneclicAct); +end; + +procedure TFormModifAction.CheckBoxRAZClick(Sender: TObject); +var op : integer; +begin + if clicAction<0 then exit; + op:=Tablo_actionneur[ligneclicact+1].tabloOp[clicaction+1].numoperation; + if (op=ActionAccessoire) then Tablo_actionneur[ligneclicact+1].tabloOp[clicaction+1].zero:=CheckBoxRaz.Checked; + maj_combocactions(ligneclicAct); +end; + +procedure TFormModifAction.LabeledEditEtatChange(Sender: TObject); +var i,erreur,op : integer; +begin + if (ligneclicAct<0) or clicliste then exit; + val(LabeledEditEtat.Text,i,erreur); + op:=Tablo_actionneur[ligneclicact+1].tabloOp[clicaction+1].numoperation; + case op of + ActionAccessoire : Tablo_actionneur[ligneclicact+1].tabloOp[clicaction+1].etat:=i; + end; + maj_combocactions(ligneclicAct); +end; + +// affiche les champs de l'actionneur PN en fonction de l'index du tableau +{ +procedure aff_champs_PN(i : integer); +var erreur,j,v,periph : integer; + trouve : boolean; + s : string; +begin + + if affevt then affiche('Aff_champs_PN('+intToSTR(i)+')',clyellow); + if i<1 then + begin + clicliste:=false; + exit; + end; + //s:=Uppercase(formModifAction.ListBoxPN.items[i-1]); + if s='' then + begin + clicliste:=false; + exit; + end; + + with formModifAction do + begin + LabelInfo.caption:=''; + raz_champs_pn; + end; + + // actionneur passage à niveau + if s[1]='(' then + begin + champs_type_pn; + // trouver le numéro de périphérique + v:=pos('PN(',s); + delete(s,1,v+2); + val(s,periph,erreur); + { + i:=0; + repeat + inc(i); + trouve:=(Tablo_PN[i].AdresseFerme=adresse); + until trouve or (i>NbrePN); + if not(trouve) then exit;} + { + with formModifAction do + begin + RadioGroupActPN.itemindex:=Tablo_PN[i].TypeCde; + + if Tablo_PN[i].TypeCde=0 then champs_pn_act; + if Tablo_PN[i].TypeCde=1 then champs_pn_comusbSockets; + + if Tablo_PN[i].Pulse=1 then trouve:=true else trouve:=false; + CheckPnPulse.Checked:=trouve; + + // par actionneur + if Tablo_PN[i].actionneur then + begin + RadioButtonSimple.Checked:=true; + RadioButtonZone.Checked:=false; + GroupBoxPNA.Visible:=true; + GroupBoxPNZ.Visible:=false; + EditV1F.text:=intToSTR(Tablo_PN[i].voie[1].ActFerme); + EditV1O.text:=intToSTR(Tablo_PN[i].voie[1].ActOuvre); + v:=Tablo_PN[i].nbvoies; + if v>=2 then + begin + EditV2F.text:=intToSTR(Tablo_PN[i].voie[2].ActFerme); + EditV2O.text:=intToSTR(Tablo_PN[i].voie[2].ActOuvre); + end; + if v>=3 then + begin + EditV3F.text:=intToSTR(Tablo_PN[i].voie[3].ActFerme); + EditV3O.text:=intToSTR(Tablo_PN[i].voie[3].ActOuvre); + end; + if v>=4 then + begin + EditV4F.text:=intToSTR(Tablo_PN[i].voie[4].ActFerme); + EditV4O.text:=intToSTR(Tablo_PN[i].voie[4].ActOuvre); + end; + if v>=5 then + begin + EditV5F.text:=intToSTR(Tablo_PN[i].voie[5].ActFerme); + EditV5O.text:=intToSTR(Tablo_PN[i].voie[5].ActOuvre); + end; + + end + else + begin + // par zone de détecteurs + RadioButtonSimple.Checked:=false; + RadioButtonZone.Checked:=true; + GroupBoxPNA.Visible:=false; + GroupBoxPNZ.Visible:=true; + v:=Tablo_PN[i].nbvoies; + j:=Tablo_PN[i].voie[1].detZ1F;if j<>0 then + begin + EditZdet1V1F.text:=intToSTR(j); + EditZdet2V1F.text:=intToSTR(Tablo_PN[i].voie[1].detZ2F); + EditZdet1V1O.text:=intToSTR(Tablo_PN[i].voie[1].detZ1O); + EditZdet2V1O.text:=intToSTR(Tablo_PN[i].voie[1].detZ2O); + if v>=2 then + begin + EditZdet1V2F.text:=intToSTR(Tablo_PN[i].voie[2].detZ1F); + EditZdet2V2F.text:=intToSTR(Tablo_PN[i].voie[2].detZ2F); + EditZdet1V2O.text:=intToSTR(Tablo_PN[i].voie[2].detZ1O); + EditZdet2V2O.text:=intToSTR(Tablo_PN[i].voie[2].detZ2O); + end; + if v>=3 then + begin + EditZdet1V3F.text:=intToSTR(Tablo_PN[i].voie[3].detZ1F); + EditZdet2V3F.text:=intToSTR(Tablo_PN[i].voie[3].detZ2F); + EditZdet1V3O.text:=intToSTR(Tablo_PN[i].voie[3].detZ1O); + EditZdet2V3O.text:=intToSTR(Tablo_PN[i].voie[3].detZ2O); + end; + if v>=4 then + begin + EditZdet1V4F.text:=intToSTR(Tablo_PN[i].voie[4].detZ1F); + EditZdet2V4F.text:=intToSTR(Tablo_PN[i].voie[4].detZ2F); + EditZdet1V4O.text:=intToSTR(Tablo_PN[i].voie[4].detZ1O); + EditZdet2V4O.text:=intToSTR(Tablo_PN[i].voie[4].detZ2O); + end; + if v>=5 then + begin + EditZdet1V5F.text:=intToSTR(Tablo_PN[i].voie[5].detZ1F); + EditZdet2V5F.text:=intToSTR(Tablo_PN[i].voie[5].detZ2F); + EditZdet1V5O.text:=intToSTR(Tablo_PN[i].voie[5].detZ1O); + EditZdet2V5O.text:=intToSTR(Tablo_PN[i].voie[5].detZ2O); + end; + end; + end; + end; + end; + clicliste:=false; +end; + } + + +procedure TFormModifAction.ButtonApplDeclClick(Sender: TObject); +var i : integer; +begin + ClicDeclenche:=ListBoxdeclench.itemindex; + if clicDeclenche<0 then exit; + i:=Clicdeclenche+1; + Tablo_actionneur[ligneclicAct+1].declencheur:=i; + Aff_champs(ligneclicAct+1,0); + +end; + +procedure TFormModifAction.LabeledEditNomActChange(Sender: TObject); +var index : integer; +begin + if (ligneclicAct<0) or clicliste then exit; + index:=ligneclicAct+1; + + Tablo_actionneur[index].NomAction:=LabeledEditNomAct.text; + + Aff_champs(index,0); +end; + + + +procedure TFormModifAction.ComboBoxAccComUSBChange(Sender: TObject); +var index : integer; +begin + if (ligneclicAct<0) or clicliste then exit; + index:=ligneclicAct+1; + if affevt then affiche('Evt ComboBox Change',clyellow); + Tablo_Actionneur[ligneClicAct+1].TabloOp[clicaction+1].periph:=formModifAction.ComboBoxAccComUSB.ItemIndex+1; + Aff_champs(index,clicaction+1); +end; + +procedure TFormModifAction.LabeledEditTempoFChange(Sender: TObject); +var i,erreur : integer; +begin + if clicAction<0 then exit; + if (ligneclicAct<0) or clicliste then exit; + val(LabeledEditTempoF.Text,i,erreur); + Tablo_actionneur[ligneclicact+1].tabloOp[clicaction+1].TempoF:=i; + maj_combocactions(ligneclicAct); +end; + +procedure TFormModifAction.ListBoxOperationsDblClick(Sender: TObject); +begin + if (clicAction<0) or (ligneclicAct<0) or clicliste then exit; + Tablo_Actionneur[ligneclicAct+1].tabloOp[clicaction+1].valide:=not(Tablo_Actionneur[ligneclicAct+1].tabloOp[clicaction+1].valide); + maj_combocactions(ligneclicAct); +end; + +end. diff --git a/UnitPrinc.dfm b/UnitPrinc.dfm index 862ad16..ef680fb 100644 --- a/UnitPrinc.dfm +++ b/UnitPrinc.dfm @@ -1,6 +1,6 @@ object FormPrinc: TFormPrinc - Left = 128 - Top = 170 + Left = 134 + Top = 114 Width = 1148 Height = 624 Anchors = [akLeft, akTop, akRight] @@ -21,7 +21,7 @@ object FormPrinc: TFormPrinc OnResize = FormResize DesignSize = ( 1132 - 565) + 566) PixelsPerInch = 96 TextHeight = 13 object LabelTitre: TLabel @@ -1445,7 +1445,7 @@ object FormPrinc: TFormPrinc end object StatusBar1: TStatusBar Left = 0 - Top = 543 + Top = 544 Width = 1132 Height = 22 Panels = < @@ -1986,8 +1986,8 @@ object FormPrinc: TFormPrinc end end object GroupBoxCV: TGroupBox - Left = 513 - Top = 120 + Left = 585 + Top = 72 Width = 265 Height = 129 Anchors = [akTop, akRight] @@ -2120,10 +2120,6 @@ object FormPrinc: TFormPrinc Caption = 'Codification des signaux' OnClick = CodificationdessignauxClick end - object Codificationdesactionneurs1: TMenuItem - Caption = 'Codification des actionneurs' - OnClick = Codificationdesactionneurs1Click - end object N5: TMenuItem Caption = '-' end diff --git a/UnitPrinc.pas b/UnitPrinc.pas index d8bc35b..3c66748 100644 --- a/UnitPrinc.pas +++ b/UnitPrinc.pas @@ -1,5 +1,5 @@ Unit UnitPrinc; -// 12/03/24 +// 05/04/2024 22h (******************************************** Programme signaux complexes Graphique Lenz Delphi 7 + activeX Tmscomm + clientSocket @@ -34,12 +34,15 @@ Unit UnitPrinc; // il ne renvoie pas non plus le nom des trains sur les actionneurs // les noms des trains sont bien renvoyés sur les détecteurs à 1 // -// En mode RUN: +// En mode RUN CDM avec train: // CDM renvoie le nom des trains sur les actionneurs à 1, jamais à 0 // et quelquefois (pas toujours!) sur les détecteurs à 1, jamais à 0 // Au début du RUN, CDM renvoie les états des détecteurs et en mélangé les aiguillages et on en reçoit les états. // Puis on reçoit la position des trains qui bougent. Si un train parqué ne bouge pas, on ne reçoit rien de ce train. // +// En mode RUN TCO CDM (sans trains) : une commande de vitesse à un train n'est pas transmise +// sur le réseau. +// // En simulation: // CDM Rail ne renvoie pas les états des aiguillages en début de simu // Les aiguillages sont renvoyés quand on clique dessus @@ -52,7 +55,7 @@ Unit UnitPrinc; // // Notes pour compilation sous Embarcadero : -------------------------------------------------- // Pour compilation avec Rad Studio (Delphi11): Projet / Options // Application / Apparence / -// Embarcadero technologies / carbon ou Auric +// Embarcadero technologies / carbon ou Auric / et choisir le sytle par défaut : windows // // Pour le mode sombre sous embarcadero, il faut sélectionner: // Projet / Options // Application / manifeste / fichier manifeste : personnaliser @@ -67,7 +70,7 @@ uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, OleCtrls, ExtCtrls, jpeg, ComCtrls, ShellAPI, TlHelp32, ImgList, ScktComp, StrUtils, Menus, ActnList, MSCommLib_TLB, MMSystem , - Buttons, NB30, comObj, activeX ,DateUtils + Buttons, NB30, comObj, activeX ,DateUtils {$IF CompilerVersion >= 28.0} // si delphi>=11 ,Vcl.Themes {$IFEND} @@ -116,7 +119,6 @@ type N5: TMenuItem; Quitter1: TMenuItem; Config: TMenuItem; - Codificationdesactionneurs1: TMenuItem; OuvrirunfichiertramesCDM1: TMenuItem; Affichefentredebug1: TMenuItem; PopupMenuFenRich: TPopupMenu; @@ -282,7 +284,6 @@ type procedure Quitter1Click(Sender: TObject); procedure ConfigClick(Sender: TObject); procedure ButtonLitCVClick(Sender: TObject); - procedure Codificationdesactionneurs1Click(Sender: TObject); procedure ButtonArretSimuClick(Sender: TObject); procedure OuvrirunfichiertramesCDM1Click(Sender: TObject); procedure ButtonAffTCOClick(Sender: TObject); @@ -385,7 +386,7 @@ type procedure Validationdeshoraires1Click(Sender: TObject); procedure Ini1Click(Sender: TObject); procedure Afficherlhorloge1Click(Sender: TObject); - private + private { Déclarations privées } procedure DoHint(Sender : Tobject); procedure WindowPosChanging(var Msg: TWMWindowPosMsg); message WM_WINDOWPOSCHANGING; @@ -471,7 +472,44 @@ EtatSignBelge: array[0..9] of string[30]= // dir6 feux 10 16 // belge 11 20 +// Type de déclencheurs +Decl0=0; +DeclHorloge=1; +DeclPeriph=2; +DeclAccessoire=3; +DeclDetAct=4; +DeclZoneDet=5; +// Type d'opération (action) +Action0=0; +ActionAffTCO=1; +ActionAffSC=2; +ActionAffCDM=3; +ActionAccessoire=4; +ActionArretTrains=5; +ActionLanceHorl=6; +ActionArretHorl=7; +ActionInitHorl=8; +ActionAffHorl=9; +ActionVitesse=10; +ActionCdePeriph=11; +ActionFonctionF=12; +ActionSon=13; +ActionTempo=14; + +// icones +IconeTCO=0; +IconeSC=1; +IconeCDM=2; +IconeAccessoire=3; +IconeStopTrains=4; +IconeLanceHorl=5; +IconeArretHorl=6; +IconeInitHorl=7; +IconeHorloge=8; +IconePeriph=10; //usb +IconeDet=17; +IconeZoneDet=18; type @@ -580,7 +618,48 @@ TPeripherique = record protocole,tamponRX : string; // protocole COM ou socket, tanpon de réception end; +TPn = record + AdresseFerme : integer; // adresse de pilotage DCC pour la fermeture ou numéro de périphérique pour pilotage usb + commandeFerme : integer; // commande de fermeture (1 ou 2) + AdresseOuvre : integer; // adresse de pilotage DCC pour l'ouverture + commandeOuvre : integer; // commande d'ouverture (1 ou 2) + NbVoies : integer; // Nombre de voies du PN + Pulse : integer; // 0=commande maintenue 1=Impulsionnel + TypeCde : integer; // 0=par accessoire / 1=par COMUSB ou sockets + commandeF,CommandeO : string; // commande pour com/usb ou socket + compteur : integer; // comptage actionneurs fermeture et décomptage actionneurs ouverture + actionneur : boolean; // =vrai par actionneur sinon pae zone + Voie : array [1..5] of record + ActFerme,ActOuvre : integer ; // actionneurs provoquant la fermeture et l'ouverture + detZ1F,detZ2F,detZ1O,detZ2O : integer; // Zones de détection + end; + end; + +Toperation = record + numoperation,heure,minute, + adresse, + etat,NumTCO, + TempoCourante, // valeur courante de la tempoF + vitesse, + periph, + fonctionF,TempoF : integer; + zero,valide : boolean; + chaine : string; + train,traincourant : string; + end; + +Tactionneur = + record + // action + NbOperations,declencheur,vitesse, + heure,minute,NumPeriph, + adresse,etat,adresse2 : integer; // adresse: adresse de base ou heure ; adresse2=cas d'une Zone ou minute + trainDecl,ordrePeriph,NomAction : string; + TabloOp : array of Toperation; + end; + var + maxaiguillage,detecteur_chgt,Temps,Tempo_init,Suivant,ntrains,MaxPortCom, N_Cv,index_simule,NDetecteurs,N_Trains,N_routes,espY,Tps_affiche_retour_dcc, NbreImagePligne,NbreBranches,Index2_aig,branche_det,ntrains_cdm, @@ -589,10 +668,10 @@ var NombreImages,signalCpx,branche_trouve,Indexbranche_trouve,Actuel,Signal_suivant, Nbre_recu_cdm,Tempo_chgt_feux,Adj1,Adj2,NbrePN,ServeurInterfaceCDM,index_couleur, ServeurRetroCDM,TailleFonte,Nb_Det_Dist,Tdoubleclic,algo_Unisemaf,fA,fB, - etape,idEl,avecRoulage,intervalle_courant,filtrageDet0,SauvefiltrageDet0, + etape,idEl,avecRoulage,intervalle_courant,filtrageDet0, TpsTimeoutSL,formatY,OsBits,NbreDecPers,NbDecodeur,NbDecodeurdeBase, LargeurF,HauteurF,OffsetXF,OffsetYF,PosSplitter,NbPeriph,NbPeriph_COMUSB,NbPeriph_Socket, - AigMal,AncMinute,axFP,ayFP : integer; + AigMal,AncMinute,axFP,ayFP,NbreOperations,NbreDeclencheurs,index_seqAct : integer; ack,portCommOuvert,traceTrames,AffMem,CDM_connecte,dupliqueEvt,affiche_retour_dcc, Raz_Acc_signaux,AvecInit,AvecTCO,terminal,Srvc_Aig,Srvc_Det,Srvc_Act,MasqueBandeauTCO, @@ -674,20 +753,7 @@ var AdrTrain : integer; end; - Tablo_actionneur : array[0..Max_actionneurs] of - record - loco,act,son,periph,vit : boolean; // destinataire loco acessoire son ou périphérique ou vitesse train - adresse,adresse2, // adresse: adresse de base ou heure ; adresse2=cas d'une Zone ou minute - etat, - fonction, // fonction F de train ou périphérique ou vitesse train - tempo,TempoCourante, - accessoire,sortie, - typdeclenche : integer; // déclencheur: 0=actionneur/détecteur 1=Horloge 2=evt aig 3=MemZone - Raz : boolean; - FichierSon,trainDecl, - TrainDest, // train destinataire ou Commande au périphérique - TrainCourant : string; - end; + Tablo_actionneur : array[0..Max_actionneurs] of Tactionneur; // décodeurs personnalisés de signaux decodeur_pers : array[1..NbreMaxiDecPers] of @@ -709,23 +775,7 @@ var Ancien_actionneur : array[0..MaxAcc] of integer; KeyInputs: array of TInput; - Tablo_PN : array[0..Max_actionneurs] of - record - AdresseFerme : integer; // adresse de pilotage DCC pour la fermeture ou numéro de périphérique pour pilotage usb - commandeFerme : integer; // commande de fermeture (1 ou 2) - AdresseOuvre : integer; // adresse de pilotage DCC pour l'ouverture - commandeOuvre : integer; // commande d'ouverture (1 ou 2) - NbVoies : integer; // Nombre de voies du PN - Pulse : integer; // 0=commande maintenue 1=Impulsionnel - TypeCde : integer; // 0=par accessoire / 1=par COMUSB ou sockets - commandeF,CommandeO : string; // commande pour com/usb ou socket - compteur : integer; // comptage actionneurs fermeture et décomptage actionneurs ouverture - actionneur : boolean; // =vrai par actionneur sinon pae zone - Voie : array [1..5] of record - ActFerme,ActOuvre : integer ; // actionneurs provoquant la fermeture et l'ouverture - detZ1F,detZ2F,detZ1O,detZ2O : integer; // Zones de détection - end; - end; + Tablo_PN : array[0..Max_actionneurs] of TPn; Tablo_Simule : array[0..Max_Simule] of record @@ -735,6 +785,28 @@ var train : string; end; + seq_actionneurs : array[1..30] of + record + indiceAction,IndiceOp, // indice à partir duquel reprendre l'exécution + op,tick // opération + : integer; + + end; + + Declencheurs : array[0..10] of + record + nom : string; + index : integer; + famille : integer; // 1=système 2=CDM 3=SC ne sert qu'a filtrer l'affichage par la combobox + end; + + operations : array[0..20] of + record + nom : string; + index : integer; + famille : integer; + end; + tablo_CV : array [1..255] of integer; couleur,Couleurfond : Tcolor; @@ -847,7 +919,7 @@ function PresTrainPrec(Adresse,NbCtSig : integer;detect : boolean;var AdrTr,voie function cond_carre(adresse : integer) : boolean; function carre_signal(adresse,TrainReserve : integer;var reserveTrainTiers : boolean;Var AdrTrain : integer) : integer; procedure Event_Detecteur(Adresse : integer;etat : boolean;train : string); -procedure Event_act(adr,adr2,etat : integer;trainDecl : string;hor : boolean); +procedure Event_act(adr,adr2,etat : integer;trainDecl : string); function verif_UniSemaf(adresse,UniSem : integer) : integer; function Select_dessin_Signal(TypeSignal : integer) : TBitmap; procedure cree_image(rang : integer); @@ -900,12 +972,17 @@ function Aiguille_deviee(adresse : integer) : integer ; function envoi_CDM(s : string) : boolean; function place_id(s : string) : string; procedure fin_preliminaire; +function Index_operation(s : string) : integer; +function Lance_CDM(avecSocket : boolean) : boolean; +procedure action(action : integer); +function Signal_precedent(adresse : integer) : integer; implementation uses UnitDebug, UnitPilote, UnitSimule, UnitTCO, UnitConfig, Unitplace, verif_version , UnitCDF, UnitAnalyseSegCDM, UnitConfigCellTCO, - UnitConfigTCO,UnitSR, UnitHorloge, UnitFicheHoraire, UnitClock; + UnitConfigTCO,UnitSR, UnitHorloge, UnitFicheHoraire, UnitClock, + UnitModifAction; { procedure menu_interface(MA : TMA); @@ -1036,18 +1113,30 @@ begin procedure fin_preliminaire; +var i : integer; begin {$IF CompilerVersion >= 28.0} // en D11, obligé de positionner la fenêtre principale après avoir fixé le style positionne_principal; {$IFEND} - calcul_pos_horloge; if (versionSC<>'8.53') then begin if AffHorl then Affiche_horloge; if LanceHorl then Demarre_horloge; end; + + + formConfig.listBoxPeriph.clear; + formModifAction.ComboBoxAccComUSB.Clear; + formconfig.ComboBoxPNCom.Clear; + for i:=1 to NbPeriph do + begin + formconfig.listBoxPeriph.items.Add(encode_Periph(i)); + ajoute_champs_combos(i); + end; + + formprinc.SetFocus; end; @@ -8350,6 +8439,7 @@ end; // renvoie l'état du signal suivant du signal "adresse". Si renvoie 0, pas trouvé le signal suivant. +// les aiguillages en pointe doivent être positionnés // adresse : adresse du signal // rang=1 pour signal suivant, 2 pour signal suivant le 1, etc // retour dans AdrSignalsuivant : adresse du signal suivant @@ -8414,7 +8504,11 @@ begin else begin AdrSuiv:=suivant_alg3(prec,TypePrec,actuel,TypeActuel,1); // 1 = - if Nivdebug=3 then AfficheDebug('Suivant='+intToSTR(AdrSuiv),clyellow); + if Nivdebug=3 then + begin + if AdrSuiv=9996 then AfficheDebug('position aiguillage inconnue',clorange) else + AfficheDebug('Suivant='+intToSTR(AdrSuiv),clyellow); + end; prec:=actuel;TypePrec:=TypeActuel; actuel:=AdrSuiv;TypeActuel:=typeGen; @@ -8872,6 +8966,7 @@ end; // renvoie l'adresse du signal précédent au signal "adresse" // remplit aussi les élements[] rencontrés +// les positions des aiguillages pris en pointe doivent être connus function Signal_precedent(adresse : integer) : integer; var AdrSuiv,prec,ife,actuel,i,j,ifd,index, @@ -8944,6 +9039,8 @@ begin begin if (nivDebug=3) then begin + if adrSuiv=9996 then AfficheDebug('Position aiguillage inconnue',clOrange) + else if (AdrSuiv>9990) then AfficheDebug('Erreur 41: Alg3='+intToSTR(AdrSuiv)+' Anomalie',clYellow); if AdrSuiv=0 then AfficheDebug('Buttoir',clyellow); end; @@ -10234,7 +10331,7 @@ begin if det4<9990 then reserve_canton(AdrSuiv,det4,AdrTrainLoc,i,nCantonsRes) // réserve canton suivant après maj signaux else Affiche_evt('Réservation canton après '+intToSTR(det3)+' '+intToSTR(ADrSuiv)+' impossible (pos? aig)',clOrange); - event_act(det1,det3,1,'',false); // évènement détecteur de zone - 1 + event_act(det1,det3,1,''); // évènement détecteur de zone - 1 // affichages Affiche_Evt('1-0 route ok de '+intToSTR(det1)+' à '+IntToSTR(det3),clWhite); @@ -10337,7 +10434,7 @@ begin end; pilote_train(det1,det3,adrtrainLoc,i); // pilote le train sur det3 - event_act(det1,det3,1,'',false); // activation zone - 2 + event_act(det1,det3,1,''); // activation zone - 2 maj_signaux(false); // actualiser le signal du det3 j:=signal_detecteur(det3); @@ -10462,8 +10559,8 @@ begin end; end; - event_act(det2,det3,0,'',false); // désactivation zone - event_act(det3,AdrSuiv,1,'',false); // activation zone + event_act(det2,det3,0,''); // désactivation zone + event_act(det3,AdrSuiv,1,''); // activation zone end else begin @@ -11011,12 +11108,12 @@ begin end; -// envoie une chaine de caractères du tablo actionneur index i -procedure envoi_periph_usb(i : integer); +// envoie une chaine de caractères du tablo actionneur index i : index action , j : index opération +procedure envoi_periph_usb(i,j : integer); var numacc,v,cmd : integer; s : string; begin - numacc:=Tablo_actionneur[i].fonction; // numéro de périphérique + numacc:=Tablo_actionneur[i].TabloOp[j].periph; // numéro de périphérique if (numAcc>NbMaxi_Periph) or (numacc=0) then begin Affiche('Erreur 58 : numéro de périphérique hors limite '+intToSTR(i),clred); @@ -11026,11 +11123,11 @@ begin if v=0 then exit; if tablo_periph[numacc].PortOuvert then begin - s:=Tablo_actionneur[i].trainDest; + s:=Tablo_actionneur[i].TabloOp[j].chaine; if Tablo_periph[numacc].cr then s:=s+#13; cmd:=Tablo_periph[numacc].numComposant; - if numacc=1 then envoi_usb_comp(MSCommCde1,s); - if numacc=2 then envoi_usb_comp(MSCommCde2,s); + if cmd=1 then envoi_usb_comp(MSCommCde1,s); + if cmd=2 then envoi_usb_comp(MSCommCde2,s); if Tablo_periph[numacc].ScvVis then Affiche('Envoi COM'+intToSTR(v)+': '+s,clYellow); end @@ -11038,18 +11135,18 @@ begin end; // envoi le texte traindest de l'accessoire sur le socket de l'actionneur i -procedure envoi_socket_periph_act(i : integer); +procedure envoi_socket_periph_act(i,j : integer); var v,numacc : integer; s : string; begin - v:=Tablo_actionneur[i].fonction; // numéro de périphérique + v:=Tablo_actionneur[i].tabloOp[j].periph; // numéro de périphérique numacc:=Tablo_periph[v].numComposant; //numéro de composant if (numAcc>NbMaxi_Periph) or (numacc=0) then begin Affiche('Erreur 59 : numéro de périphérique hors limite',clred); exit; end; - s:=Tablo_actionneur[i].trainDest; + s:=Tablo_actionneur[i].TabloOp[j].chaine; if Tablo_periph[numacc].cr then s:=s+#13; if numacc=1 then Formprinc.ClientSocketCde1.socket.SendText(s); if numacc=2 then Formprinc.ClientSocketCde2.socket.SendText(s); @@ -11092,33 +11189,195 @@ begin result:=trouve; end; -// traitement des évènements actionneurs (detecteurs aussi) + +// faire l'opération ida de l'action i +procedure action_operation(i,ida : integer); +var decl,op,af,access,sortie,t,v,etat : integer; + st,trainDest : string; + Ts : TAccessoire; + tr : double; +begin + st:='Action '+Tablo_actionneur[i].NomAction+' : '; + op:=Tablo_actionneur[i].tabloOp[ida].numoperation; + if Tablo_actionneur[i].tabloOp[ida].valide then + begin + decl:=Tablo_actionneur[i].declencheur; + if decl=DeclHorloge then + begin + st:=st+'Horaire '+format('%.2dh%.2d',[t,v]); + t:=Tablo_actionneur[i].heure; + v:=Tablo_actionneur[i].minute; + end; + + // 1 : affiche TCO + if (op=ActionAffTCO) then + begin + af:=Tablo_actionneur[i].tabloOp[ida].NumTCO; + Affiche(st+' Affiche TCO'+intToSTR(af),clyellow); + Affiche_Fenetre_TCO(af,true); + end; + + if (op=ActionAffSC) then + begin + Affiche(st+' Affiche SC',clyellow); + with FormPrinc do + begin + windowState:=wsNormal; //Maximized; + show; + BringToFront; + end; + end; + + if (op=ActionAffCDM) then + begin + if CDMhd<>0 then + begin // afficher CDM rail + Affiche(st+' Affiche CDM',clyellow); + ShowWindow(CDMhd,SW_MAXIMIZE); + SetForegroundWindow(CDMhd); // met CDM en premier plan + SetActiveWindow(CdmHd); + end; + end; + + // 4 : accessoire + if (op=ActionAccessoire) then + begin + access:=Tablo_actionneur[i].tabloOp[ida].adresse; + sortie:=Tablo_actionneur[i].tabloOp[ida].etat; + Affiche(st+' Accessoire '+IntToSTR(access)+':'+intToSTR(sortie),clyellow); + // exécution la fonction accessoire vers CDM + if Tablo_actionneur[i].tabloOp[ida].zero then Ts:=aigP else Ts:=signal; + pilote_acc(access,sortie,Ts); + end; + + // 5 : arret des trains + if (op=actionArretTrains) then + begin + Affiche(st+' Arrêt de tous les trains',clYellow); + for t:=1 to ntrains do vitesse_loco(trains[t].nom_train,t,trains[t].adresse,0,true); + end; + + // 6 : Lance Horloge + if op=ActionLanceHorl then + begin + Affiche(st+' Lancement horloge',clyellow); + Demarre_horloge; + end; + + // 7 : Arret Horloge + if op=ActionArretHorl then + begin + Affiche(st+' Arret horloge',clyellow); + horloge:=false; + end; + + // 8 : init Horloge + if op=ActionInitHorl then + begin + Affiche(st+' Init horloge',clyellow); + Init_horloge; + end; + + // 9 : Affiche Horloge + if op=ActionAffHorl then + begin + Affiche(st+' Affiche horloge',clyellow); + Affiche_horloge; + end; + + // 10: vitesse + if (op=ActionVitesse) then + begin + traindest:=Tablo_actionneur[i].tabloOp[ida].train; + Affiche(st+' Vitesse train='+trainDest+' à '+IntToSTR(Tablo_actionneur[i].tabloOp[ida].vitesse),clyellow); + vitesse_loco(trainDest,0,0,Tablo_actionneur[i].tabloOp[ida].vitesse,true); + end; + + // 11 : commande COM/USB socket + if (op=ActionCdePeriph) then + begin + v:=tablo_actionneur[i].TabloOp[ida].periph; // numéro d'accessoire + Affiche(st+' Envoi commande',clYellow); + af:=com_socket(v); + if af=1 then envoi_periph_usb(i,ida); // numéro d'actionneur + if af=2 then envoi_socket_periph_act(i,ida); // numéro d'actionneur + end; + + // 12 actionneur pour fonction train + if (op=ActionFonctionF) then + begin + trainDest:=Tablo_actionneur[i].tabloOp[ida].train; + // exécution de la fonction F vers CDM + etat:=tablo_actionneur[i].tabloop[ida].TempoF; + tr:=etat/10; + Affiche(st+' TrainDest='+trainDest+' F'+IntToSTR(Tablo_actionneur[i].tabloOp[ida].fonctionF)+' t='+Format('%.1f', [tr])+'s',clyellow); + envoie_fonction_CDM(Tablo_actionneur[i].TabloOp[ida].fonctionF,etat,trainDest); + tablo_actionneur[i].tabloOp[ida].TrainCourant:=trainDest; // pour mémoriser le train pour la retombée de la fonction + tablo_actionneur[i].TabloOp[ida].TempoCourante:=etat; + end; + + // 13 : son + if (op=ActionSon) then //and ( test_train_decl(sDecl,trainDecl) or (sDecl='X') or (trainDecl='X') or (trainDecl='')) and (etatValide) then + begin + Affiche(st+' son '+Tablo_actionneur[i].tabloop[ida].chaine,clyellow); + PlaySound(pchar(Tablo_actionneur[i].tabloop[ida].train),0,SND_ASYNC); + end; + + // 14 : tempo + if op=ActionTempo then + begin + etat:=tablo_actionneur[i].tabloop[ida].TempoF; + tr:=etat/10; + Affiche(st+' Tempo '+Format('%.1f', [tr])+'s',clyellow); + tablo_actionneur[i].TabloOp[ida].TempoCourante:=etat; + // si on a une tempo, passer la main au timer pour toutes les actions suivantes. + if (idanb) or sort; +end; + +// traitement des évènements actions (detecteurs aussi) +// autres que horaire et péripériques // adr adr2 : pour mémoire de zone // trainDecl : composé de X, d'un train ou de plusieurs, séparés par + -// hor : si évt horaire -procedure Event_act(adr,adr2,etat : integer;trainDecl : string;hor : boolean); -var typ,i,v,etatAct,Af,Ao,Access,sortie,dZ1F,dZ2F,dZ1O,dZ2O : integer; - sDecl,st,trainDest : string; +procedure Event_act(adr,adr2,etat : integer;trainDecl : string); +var typ,i,v,etatAct,Af,Ao,dZ1F,dZ2F,dZ1O,dZ2O : integer; + sDecl : string; fm,fd,adresseOk,etatvalide : boolean; Ts : TAccessoire; begin if adr<=0 then exit; - if debugPN then - begin - if (adr=539) and (adr2=529) then - affiche('CAS OUVRE',clred); - if (adr=528) and (adr2=522) then - affiche('CAS FERME',clred); - end; - if debugPN then Affiche(intToSTR(adr)+'/'+intToSTR(adr2)+' '+intToSTR(etat)+' '+TrainDecl,clyellow); if adr>1024 then begin - Affiche('Erreur 81 : reçu adresse actionneur trop grande : '+intToSTR(adr),clred); + Affiche('Erreur 81 : reçu adresse accessoire trop grande : '+intToSTR(adr),clred); exit; end; - // Etat actionneur (un état aiguillage peut prendre les valeurs de 1 à 2) + // Etat accessoire (un état aiguillage peut prendre les valeurs de 1 à 2) // ancien nouveau // 0 1 FM // 0 2 FM @@ -11128,7 +11387,7 @@ begin // 1 0 FD // 2 0 FD - if not(hor) and (adr2=0) then + if (adr2=0) then begin fd:=(Ancien_actionneur[adr]>0) and (etat=0); // front descendant (FD) fm:=(Ancien_actionneur[adr]<>etat) and (etat<>0); // front montant (FM) @@ -11140,92 +11399,48 @@ begin if AffAigDet and (adr2=0) then AfficheDebug('Tick='+IntToSTR(tick)+' Evt Act='+intToSTR(Adr)+'='+intToSTR(etat)+' Train='+trainDecl,clyellow); // vérifier si l'actionneur en évènement a été déclaré pour réagir // dans tableau des actionneurs - for i:=1 to maxTablo_act do - begin + + i:=1; + repeat sDecl:=Tablo_actionneur[i].trainDecl; etatAct:=Tablo_actionneur[i].etat ; // état à réagir etatValide:=((etatAct=etat) and fm) or ((etatAct=0) and fd); // front montant ou descendant - typ:=Tablo_actionneur[i].typdeclenche; // déclencheur: 0=actioneur/détecteur 2=evt aig 3=MemZone - if typ=0 then + typ:=Tablo_actionneur[i].declencheur; + + { + if typ=DeclDetAct then begin st:='Détecteur/actionneur '+intToSTR(adr); end; - if typ=1 then + + if typ=DeclAccessoire then begin - st:='Horaire '+format('%.2dh%.2d',[adr,adr2]); - etatvalide:=true; // valider systématiquement l'état valide en actionneur horaire + st:='Accessoire '+intToSTR(adr); end; - if typ=2 then - begin - st:='Aiguillage '+intToSTR(adr); - end; - if typ=3 then + if typ=DeclZoneDet then begin adresseok:=adresseOk and (Tablo_actionneur[i].adresse2=adr2); st:='Mémoire de zone '+intToSTR(adr)+' '+intToStr(adr2); - end; + end; } - adresseok:=( ((Tablo_actionneur[i].adresse=adr) and (adr2=0) ) and ((typ=0) or (typ=2)) ) or - ( ((Tablo_actionneur[i].adresse=adr) and (Tablo_actionneur[i].adresse2=adr2) and ((typ=3) or (typ=1))) ) ; + // si déclencheur par adresse + adresseok:=( ((Tablo_actionneur[i].adresse=adr) and (adr2=0) ) and ((typ=declDetAct) or (typ=DeclAccessoire)) ) or + ( ((Tablo_actionneur[i].adresse=adr) and (Tablo_actionneur[i].adresse2=adr2) and ((typ=DeclZoneDet) ))); - // actionneur pour fonction train - if adresseOk and (Tablo_actionneur[i].loco) and ( test_train_decl(sDecl,trainDecl) or (sDecl='X') or (trainDecl='X') or (trainDecl='')) and (etatValide) then + adresseok:=adresseok and + ( + // par train + ((typ=DeclDetAct) or (typ=DeclZoneDet)) and test_train_decl(sDecl,trainDecl) or (sDecl='X') or (trainDecl='X') or (trainDecl='') + ) ; + + if adresseok and etatValide then begin - trainDest:=Tablo_actionneur[i].trainDest; - // exécution de la fonction F vers CDM - if (trainDest='X') or (trainDest='') then traindest:=traindecl; - //if (trainDest='X') then traindest:=sDecl; - Affiche(st+' TrainDecl='+trainDecl+' TrainDest='+trainDest+' F'+IntToSTR(Tablo_actionneur[i].fonction)+':'+intToSTR(etat),clyellow); - envoie_fonction_CDM(Tablo_actionneur[i].fonction,etat,trainDest); - tablo_actionneur[i].TrainCourant:=trainDest; // pour mémoriser le train pour la retombée de la fonction - tablo_actionneur[i].TempoCourante:=tablo_actionneur[i].Tempo div 100; + //Affiche('Action dans EventAct',clred); + action(i); // exécute toutes les opérations de l'actionneur i end; - - // pour vitesse - if adresseOk and (Tablo_actionneur[i].vit) and ( test_train_decl(sDecl,trainDecl) or (sDecl='X') or (trainDecl='X') or (trainDecl='')) and (etatValide) then - begin - trainDest:=Tablo_actionneur[i].trainDest; - // exécution de la fonction F vers CDM - if (trainDest='X') or (trainDest='') then traindest:=traindecl; - //if (trainDest='X') then traindest:=sDecl; - Affiche(st+' TrainDecl='+trainDecl+' TrainDest='+trainDest+' V'+IntToSTR(Tablo_actionneur[i].fonction),clyellow); - - vitesse_loco(trainDest,0,0,Tablo_actionneur[i].fonction,true); - end; - - - // actionneur pour accessoire - if adresseOk and (Tablo_actionneur[i].act) and ( test_train_decl(sDecl,trainDecl) or (sDecl='X') or (trainDecl='X') or (trainDecl='')) and (etatValide) then - begin - access:=Tablo_actionneur[i].accessoire; - sortie:=Tablo_actionneur[i].sortie; - - Affiche(st+' Train='+trainDecl+' Accessoire '+IntToSTR(access)+':'+intToSTR(sortie),clyellow); - // exécution la fonction accessoire vers CDM - if Tablo_actionneur[i].RAZ then Ts:=aigP else Ts:=signal; - pilote_acc(access,sortie,Ts); // sans RAZ - end; - - // actionneur pour son - if adresseOk and (Tablo_actionneur[i].Son) and ( test_train_decl(sDecl,trainDecl) or (sDecl='X') or (trainDecl='X') or (trainDecl='')) and (etatValide) then - begin - if typ<>2 then st:=st+' Train='+trainDecl; - Affiche(st+' son '+Tablo_actionneur[i].FichierSon,clyellow); - PlaySound(pchar(Tablo_actionneur[i].FichierSon),0,SND_ASYNC); - end; - - // commande COM/USB socket - if adresseOK and (Tablo_actionneur[i].periph) and ( test_train_decl(sDecl,trainDecl) or (sDecl='X') or (trainDecl='X') or (trainDecl='')) and (etatValide) then - begin - trainDest:=Tablo_actionneur[i].trainDest; - v:=tablo_actionneur[i].fonction; // numéro d'accessoire - Affiche(st+' TrainDecl='+trainDecl+' Envoi commande '+TrainDest,clWhite); - af:=com_socket(v); - if af=1 then envoi_periph_usb(i); // numéro d'actionneur - if af=2 then envoi_socket_periph_act(i); // numéro d'actionneur - end; - end; + inc(i); + until (i>maxTablo_act); // dans le tableau des PN for i:=1 to NbrePN do @@ -11389,6 +11604,73 @@ begin Envoi_serveur('A'+intToSTR(adr)+','+intToSTR(etat)+','+trainDecl); end; +// télécommande de signaux complexes par les clients ou les périphériques +function telecommande(s : string) : boolean; +var adresse,i,erreur : integer; + sa : string; +begin + result:=false; + sa:=s; + s:=uppercase(s); + // --- commandes sans paramètres + if pos('',s)<>0 then + begin + Lance_CDM(true); + result:=true; + end; + if pos('',s)<>0 then + begin + if cdmHd=0 then exit; + if not(cdmDevant) then ShowWindow(CDMhd,SW_MINIMIZE) else ShowWindow(CDMhd,SW_MAXIMIZE); + cdmDevant:=not(cdmDevant); + result:=true; + end; + if pos('',s)<>0 then + begin + with formprinc do + begin + windowState:=wsNormal; //Maximized; + show; + BringToFront; + end; + result:=true; + end; + + // --- commandes avec paramètres + if copy(s,1,4)='0) and (i<=10) and (formTCO[i]<>nil) then + begin + formTCO[i].windowState:=wsNormal; //Maximized; + formTCO[i].show; + formTCO[i].BringToFront; + end; + result:=true; + end; + if copy(s,1,4)='0 then + if (filtrageDet0<>0) and not(CDM_connecte) and (i_simule=0) then begin dr:=detecteur[adresse].tempo0; if (detecteur[Adresse].etat and not(etat)) and (dr=0) then @@ -11445,6 +11727,7 @@ begin s:=detecteur[adresse].train; if (train='') and (s<>'') then train:=s; if Etat then Etat01:=1 else Etat01:=0; + //Affiche('Event Det '+inTToSTR(adresse)+' '+IntToSTR(etat01),Cyan); // vérifier si l'état du détecteur est déja stocké, car on peut reçevoir plusieurs évènements pour le même détecteur dans le même état // on reçoit un doublon dans deux index consécutifs. @@ -11519,7 +11802,7 @@ begin begin If traceListe then AfficheDebug('Le signal '+IntToSTR(AdrSignal)+' est précédé d''un buttoir',clyellow); MemZone[0,AdrDetSignal].etat:=true; - event_act(0,AdrDetSignal,1,'',false); // activation zone + event_act(0,AdrDetSignal,1,''); // activation zone Maj_Signal_P(AdrSignal,false); end; end; @@ -11528,7 +11811,7 @@ begin // gérer l'évènement actionneur pour action if etat then i:=1 else i:=0; if not(confignulle) then calcul_zones(adresse,true); - event_act(Adresse,0,i,'',false); + event_act(Adresse,0,i,''); end; // détection fronts descendants @@ -11563,7 +11846,7 @@ begin // gérer l'évènement detecteur pour action if etat then i:=1 else i:=0; if not(confignulle) then calcul_zones(adresse,false); - event_act(Adresse,0,i,train,false); + event_act(Adresse,0,i,train); end; end; @@ -11686,36 +11969,27 @@ begin begin etatAct:=Tablo_actionneur[i].etat ; adr:=Tablo_actionneur[i].adresse; - typ:=Tablo_actionneur[i].typdeclenche; - if (typ=2) and (Adr=adresse) then event_act(Adresse,0,pos,'',false); // évent aig + typ:=Tablo_actionneur[i].declencheur; + if (typ=DeclAccessoire) and (Adr=adresse) then event_act(Adresse,0,pos,''); // évent aig end; - // pour périphériques + // pour services aux périphériques for i:=1 to NbPeriph do begin - // envoyer event act à accessoire - typ:=com_socket(i); - if typ=1 then + if Tablo_periph[i].ScvAig then begin - if tablo_periph[i].portOuvert then + // envoyer event act à accessoire + typ:=com_socket(i); + if typ=1 then begin - if Tablo_periph[i].ScvAig then - begin - s:='T'+intToSTR(adresse)+','+intToSTR(pos); - if Tablo_periph[i].ScvVis then Affiche(s,clWhite); - if Tablo_periph[i].cr then s:=s+#13; - id:=Tablo_periph[i].NumComposant; - //jeans if id=1 then envoi_usb(periph1,s); - // if id=2 then envoi_usb(periph2,s); - if id=1 then envoi_usb_comp(MSCommCde1,s); - if id=2 then envoi_usb_comp(MSCommCde2,s); - - end; + s:='T'+intToSTR(adresse)+','+intToSTR(pos); + if Tablo_periph[i].ScvVis then Affiche(s,clWhite); + if Tablo_periph[i].cr then s:=s+#13; + id:=Tablo_periph[i].NumComposant; + if id=1 then envoi_usb_comp(MSCommCde1,s); + if id=2 then envoi_usb_comp(MSCommCde2,s); end; - end; - if typ=2 then - begin - if Tablo_periph[i].ScvAig then + if typ=2 then begin s:='T'+intToSTR(adresse)+','+intToSTR(pos); if Tablo_periph[i].ScvVis then Affiche(s,clWhite); @@ -12797,7 +13071,6 @@ begin Affiche('CDM rail déconnecté',clCyan); AfficheDebug('CDM rail déconnecté',clCyan); Formprinc.StatusBar1.Panels[2].text:=''; - filtrageDet0:=SauvefiltrageDet0; end; end; @@ -13953,6 +14226,170 @@ begin if i<=32 then Affiche('Impossible d''afficher l''aide '+FichierAide,clred); end; +procedure init_operations; +begin + with operations[0] do + begin + nom:='Pas d''opération'; + index:=Action0; // 0 + famille:=0; + end; + + with operations[1] do + begin + nom:='Affiche TCO'; + index:=ActionAffTCO; // 1 + famille:=1; // systeme + end; + with operations[2] do + begin + nom:='Affiche Signaux Complexes'; + index:=ActionAffSC; + famille:=1; // système + end; + with operations[3] do + begin + nom:='Affiche CDM'; + index:=ActionAffCDM; + famille:=1; // système + end; + with operations[4] do + begin + nom:='Commande d''accessoire'; + index:=ActionAccessoire; + famille:=2; // pilotage + end; + with operations[5] do + begin + nom:='Arrêter tous les trains'; + index:=ActionArretTrains; + famille:=3; // trains + end; + with operations[6] do + begin + nom:='Démarre horloge'; + index:=ActionLanceHorl; + famille:=1; // système + end; + with operations[7] do + begin + nom:='Arrête horloge'; + index:=ActionArretHorl; + famille:=1; // système + end; + with operations[8] do + begin + nom:='Initialise l''horloge'; + index:=ActionInitHorl; + famille:=1; // système + end; + with operations[9] do + begin + nom:='Affiche Horloge'; + index:=ActionAffHorl; + famille:=1; // système + end; + with operations[10] do + begin + nom:='Vitesse train'; + index:=ActionVitesse; + famille:=3; // trains + end; + with operations[11] do + begin + nom:='Commande périphérique COMUSB/Socket'; + index:=ActionCdePeriph; + famille:=2; // pilotage + end; + with operations[12] do + begin + nom:='Fonction F vers train'; + index:=ActionFonctionF; + famille:=3; // trains + end; + with operations[13] do + begin + nom:='Jouer son'; + index:=ActionSon; + famille:=1; // système + end; + with operations[14] do + begin + nom:='Temporisation'; + index:=ActionTempo; + famille:=1; // système + end; + + NbreOperations:=14; +end; + +function Index_operation(s : string) : integer; +var i : integer; + trouve : boolean; +begin + i:=1; + result:=0; + repeat + trouve:=pos(operations[i].nom,s)<>0; + inc(i); + until trouve or (i>NbreOperations); + if trouve then result:=i-1; +end; + +procedure init_declencheurs; +begin + with declencheurs[Decl0] do + begin + nom:='Declencheur0'; + index:=Decl0; + famille:=0; // système + end; + with declencheurs[DeclHorloge] do + begin + nom:='Horloge'; + index:=DeclHorloge; + famille:=1; // système + end; + with declencheurs[DeclPeriph] do + begin + nom:='Periphérique COMUSB/Socket'; + index:=DeclPeriph; + famille:=2; // pilotage + end; + with declencheurs[DeclAccessoire] do + begin + nom:='Accessoire'; + index:=DeclAccessoire; + famille:=2; // pilotage + end; + with declencheurs[DeclDetAct] do + begin + nom:='Détecteur/actionneur'; + index:=DeclDetAct; + famille:=2; // pilotage + end; + with declencheurs[DeclZoneDet] do + begin + nom:='Zones de détection'; + index:=DeclZoneDet; + famille:=2; + end; + Nbredeclencheurs:=5; +end; + +function Index_Declencheur(s : string) : integer; +var i : integer; + trouve : boolean; +begin + i:=0; + result:=0; + repeat + trouve:=Declencheurs[i].nom=s; + inc(i); + until trouve or (i>NbreOperations); + if trouve then result:=i-1; +end; + // démarrage principal du programme signaux_complexes procedure TFormPrinc.FormCreate(Sender: TObject); var n,t,i,index,OrgMilieu : integer; @@ -14014,7 +14451,8 @@ begin GroupBoxAcc.Left:=633; GroupBoxTrains.visible:=true; ScrollBoxSig.Left:=633; - + OffsetXFC:=0; + OffsetYFC:=0; procetape(''); //0 NbreTCO:=0; N_Trains:=0; @@ -14024,6 +14462,7 @@ begin debugtrames:=false; horlogeInterne:=true; DureeMinute:=60; + index_seqAct:=0; ProcPrinc:=false; algo_Unisemaf:=1; NbPeriph:=0; @@ -14061,6 +14500,9 @@ begin Decodeur[5]:='Digikeijs 4018';Decodeur[6]:='Unisemaf Paco';Decodeur[7]:='Stéphane Ravaut';Decodeur[8]:='Arcomora'; Decodeur[9]:='LS-DEC-NMBS';Decodeur[10]:='B-models'; + init_operations; + init_declencheurs; + if versionSC='8.53' then begin Horaires1.enabled:=false; @@ -14608,12 +15050,12 @@ begin // évènements actionneurs horaires for i:=1 to maxTablo_act do begin - if Tablo_actionneur[i].typdeclenche=1 then + if Tablo_actionneur[i].declencheur=DeclHorloge then begin // affiche(intToSTR(Tablo_Actionneur[i].adresse)+' '+Tablo_Actionneur[i].,clLime); - if (Tablo_Actionneur[i].adresse=heure) and (Tablo_Actionneur[i].adresse2=minute) then + if (Tablo_Actionneur[i].heure=heure) and (Tablo_Actionneur[i].minute=minute) then begin - event_act(heure,minute,1,'',true); + action(i); end; end; end; @@ -14621,7 +15063,7 @@ end; // timer à 100 ms procedure TFormPrinc.Timer1Timer(Sender: TObject); -var vitesse,i,a,adresse,TailleX,TailleY,orientation,indexTCO,x,y,Bimage,aspect : integer; +var n,vitesse,i,j,a,adresse,TailleX,TailleY,orientation,indexTCO,x,y,Bimage,aspect : integer; imageSignal : Timage; frx,fry : real; faire : boolean; @@ -14630,6 +15072,27 @@ var vitesse,i,a,adresse,TailleX,TailleY,orientation,indexTCO,x,y,Bimage,aspect : begin inc(tick); + // séquencement des actionneurs après tempo + if index_seqAct>0 then + begin + if seq_actionneurs[index_seqAct].tick=tick then + begin + i:=seq_actionneurs[index_seqAct].indiceAction; + j:=seq_actionneurs[index_seqAct].IndiceOp; + n:=tablo_actionneur[i].NbOperations; + dec(index_seqAct); + a:=j; + repeat + //Affiche('Faire action '+intToSTR(i)+' op '+intToSTR(a),clLime); + Action_operation(i,a); + faire:=(tablo_actionneur[i].TabloOp[a].numoperation=ActionTempo); + inc(a); + until (a>n) or faire; + + end; + end; + + // --- horloge système if horloge then begin @@ -14836,15 +15299,30 @@ begin // tempo retombée actionneur for i:=1 to maxTablo_act do begin - if Tablo_actionneur[i].TempoCourante<>0 then + n:=Tablo_actionneur[i].NbOperations; + for j:=1 to n do begin - dec(Tablo_actionneur[i].TempoCourante); - if Tablo_actionneur[i].TempoCourante=0 then + a:=Tablo_actionneur[i].TabloOp[j].TempoCourante; + if a<>0 then begin - A:=Tablo_actionneur[i].adresse; - s:=Tablo_actionneur[i].trainCourant; - Affiche('Actionneur '+intToSTR(a)+' TrainDest='+s+' F'+IntToSTR(Tablo_actionneur[i].fonction)+':0',clyellow); - envoie_fonction_CDM(Tablo_actionneur[i].fonction,0,s); + dec(a); + Tablo_actionneur[i].TabloOp[j].TempoCourante:=a; + if a=0 then + begin + x:=Tablo_actionneur[i].TabloOp[j].numoperation; + case x of + actionFonctionF : + begin + s:=Tablo_actionneur[i].tabloOp[j].trainCourant; + Affiche('Action TrainDest='+s+' F'+IntToSTR(Tablo_actionneur[i].TabloOP[j].fonctionF)+':0',clyellow); + envoie_fonction_CDM(Tablo_actionneur[i].tabloOP[j].fonctionF,0,s); + end; + actionTempo : + begin + Affiche('Fin temporisation action '+intToSTR(i)+' Op '+intToSTR(j)+' '+Tablo_actionneur[i].NomAction,clYellow); + end; + end; + end; end; end; end; @@ -14927,7 +15405,7 @@ begin if Tablo_simule[I_simule].modele=act then begin s:='Simu '+intToSTR(I_simule)+' Tick='+IntToSTR(tick)+' act='+intToSTR(Tablo_simule[i_simule].adresse)+'='+IntToSTR(Tablo_simule[i_simule].etat); - Event_Act(Tablo_simule[i_simule].adresse,0,Tablo_simule[i_simule].etat, Tablo_simule[i_simule].train,false); + Event_Act(Tablo_simule[i_simule].adresse,0,Tablo_simule[i_simule].etat, Tablo_simule[i_simule].train); StatusBar1.Panels[1].text:=s; //Affiche(s,clyellow); end; @@ -14947,7 +15425,6 @@ begin Index_Simule:=0; // fin de simulation I_Simule:=0; MsgSim:=false; - filtrageDet0:=SauvefiltrageDet0; Affiche('Fin de simulation',clCyan); StatusBar1.Panels[1].text:=''; end; @@ -15927,7 +16404,7 @@ begin end; if AffAigDet then AfficheDebug('Actionneur AD='+intToSTR(adr)+' Nom='+nom+' Train='+train+' Etat='+IntToSTR(etat),clyellow); - Event_act(adr,0,etat,train,false); // déclenche évent actionneur + Event_act(adr,0,etat,train); // déclenche évent actionneur end; // évènement position des trains @@ -16488,9 +16965,9 @@ begin end; end; +{ procedure TFormPrinc.Codificationdesactionneurs1Click(Sender: TObject); -var i,typ,adract,etatAct,fonction,v,acc,sortie : integer; - loc,act,son,periph : boolean; +var i,decl,adract,etatAct,fonction,v,acc,sortie : integer; s,s2 : string; begin if (maxTablo_act=0) and (NbrePN=0) then @@ -16509,17 +16986,14 @@ begin acc:=Tablo_actionneur[i].accessoire; sortie:=Tablo_actionneur[i].sortie; fonction:=Tablo_actionneur[i].fonction; - loc:=Tablo_actionneur[i].loco; - act:=Tablo_actionneur[i].act; - son:=Tablo_actionneur[i].son; - periph:=Tablo_actionneur[i].periph; - typ:=Tablo_actionneur[i].typdeclenche; + + decl:=Tablo_actionneur[i].typdeclenche; - if typ=3 then s:='Mem '+intToSTR(adrAct)+' '+inttostr(Tablo_actionneur[i].Adresse2); - if typ=0 then s:=intToSTR(adrAct); - if typ=2 then s:='Aig '+intToSTR(AdrAct); + if decl=DeclZoneDet then s:='Mem '+intToSTR(adrAct)+' '+inttostr(Tablo_actionneur[i].Adresse2); + if decl=DeclDetAct then s:=intToSTR(adrAct); + if Decl=DeclAccessoire then s:='Acc '+intToSTR(AdrAct); - if loc then + if Decl=Action then s:='FonctionF Déclencheur='+s+' :'+intToSTR(etatAct)+' TrainDécl='+s2+' TrainDest='+Tablo_actionneur[i].TrainDest+' F'+IntToSTR(fonction)+ ' Temporisation='+intToSTR(tablo_actionneur[i].Tempo); if act then @@ -16567,14 +17041,13 @@ begin Affiche(s,clyellow); end; end; -end; +end; } procedure TFormPrinc.ButtonArretSimuClick(Sender: TObject); begin Index_Simule:=0; // fin de simulation I_Simule:=0; MsgSim:=false; - filtrageDet0:=SauvefiltrageDet0; StopSimu:=true; Affiche('Fin de simulation',clCyan); end; @@ -18332,14 +18805,8 @@ begin FenRich.Width:=GrandPanel.Width-Panel1.Width-GroupBoxAcc.Width-25; splitterV.Left:=FenRich.left+FenRich.Width-5; positionne_elements(splitterV.Left); - FormClock.Width:=250; - FormClock.Height:=250; - OffsetYFC:=(formprinc.top+formPrinc.height)-250-20; - OffsetXFC:=(formprinc.left+formPrinc.width)-250; - FormClock.top:=OffsetYFC; - FormClock.left:=OffsetXFC; - DeltaFPCY:=OffsetYFC-formprinc.top; - DeltaFPCX:=OffsetXFC-formprinc.left; + LargeurFC:=0; + calcul_pos_horloge; end; procedure TFormPrinc.Sauvegarderla1Click(Sender: TObject); @@ -18383,60 +18850,6 @@ begin end; -// télécommande de signaux complexes par les clients -function telecommande(s : string) : boolean; -var adresse,i,erreur : integer; -begin - result:=false; - s:=uppercase(s); - // --- commandes sans paramètres - if pos('',s)<>0 then - begin - Lance_CDM(true); - result:=true; - end; - if pos('',s)<>0 then - begin - if cdmHd=0 then exit; - if not(cdmDevant) then ShowWindow(CDMhd,SW_MINIMIZE) else ShowWindow(CDMhd,SW_MAXIMIZE); - cdmDevant:=not(cdmDevant); - result:=true; - end; - if pos('',s)<>0 then - begin - with formprinc do - begin - windowState:=wsNormal; //Maximized; - show; - BringToFront; - end; - result:=true; - end; - - // --- commandes avec paramètres - if copy(s,1,4)='0) and (i<=10) and (formTCO[i]<>nil) then - begin - formTCO[i].windowState:=wsNormal; //Maximized; - formTCO[i].show; - formTCO[i].BringToFront; - end; - result:=true; - end; - if copy(s,1,4)='#31) and (c<#128) then tablo_periph[1].tamponrx:=tablo_periph[1].tamponrx+c;; @@ -18682,6 +19096,7 @@ end; + end. diff --git a/UnitSimule.pas b/UnitSimule.pas index 7f86f48..d4d25a5 100644 --- a/UnitSimule.pas +++ b/UnitSimule.pas @@ -145,8 +145,6 @@ begin closeFile(fte); formprinc.ButtonArretSimu.Visible:=true; i_simule:=1; - SauvefiltrageDet0:=filtrageDet0; - filtrageDet0:=0; FormSimulation.Close; Affiche('Fichier simulation : '+Nomfichier ,clyellow); end; diff --git a/UnitTCO.pas b/UnitTCO.pas index 3dba802..484ec32 100644 --- a/UnitTCO.pas +++ b/UnitTCO.pas @@ -9256,10 +9256,11 @@ begin end; // allume ou éteint (mode=0 ou 1) la voie du train "train", zone de det1 à det2 sur le TCO +// train est l'index du train qui a été créé par le roulage (tableau event_det_train[train] ) // det1 et det2 doivent être consécutifs sur le TCO, mais peuvent être séparés par des aiguillages // si mode=0 : éteint // =1 : couleur détecteur allumé -// =2 : couleur de l'index train +// =2 : couleur de l'index train // Ne nécessite pas que les aiguillages aoient bien positionnés entre det1 et det2 // procédure récursive quand on passe par un aiguillage en pointe pour explorer les éléments opposés procedure zone_tco(indexTCO,det1,det2,train,mode: integer); diff --git a/Unitplace.pas b/Unitplace.pas index f08f0a6..01d58b7 100644 --- a/Unitplace.pas +++ b/Unitplace.pas @@ -457,9 +457,8 @@ end; procedure TFormPlace.ButtonLanceRoutageClick(Sender: TObject); -var vitesse,a,i,j,id,adrDet,AdrTrain : integer; +var i,j,adrDet,AdrTrain : integer; trouve,demarre : boolean; - var s: string; begin if cdm_connecte then begin @@ -467,8 +466,6 @@ begin exit; end; - - trouve:=false; // explorer les détecteurs pour lancer les trains si le détecteur est affecté à un train for i:=1 to NDetecteurs do diff --git a/verif_version.pas b/verif_version.pas index 8a8c990..6e8198f 100644 --- a/verif_version.pas +++ b/verif_version.pas @@ -26,7 +26,7 @@ var chemin_Dest,chemin_src,date_creation,nombre_tel : string; f : text; -Const VersionSC ='8.6'; // sert à la comparaison de la version publiée +Const VersionSC ='8.7'; // sert à la comparaison de la version publiée SousVersion=' '; // A B C ... en cas d'absence de sous version mettre un espace // pour unzip SHCONTCH_NOPROGRESSBOX = 4; @@ -149,11 +149,8 @@ end; // dézipe copie les fichiers et lance la nouvelle version // s : chemin et fichier à déziper procedure dezipe_copie_lance(s : string); -var fichier,nomPDF : string; - dirList : tStrings; - SR : TSearchRec; - nombre,i,attributes : integer; - pdf,ok : boolean; +var + i : integer; begin // Vérifier si répertoire dest existe diff --git a/versions.txt b/versions.txt index f53f20e..0f3c8b1 100644 --- a/versions.txt +++ b/versions.txt @@ -248,5 +248,7 @@ version 8.54 : Ajout du choix de pilotage des trains par CDM par adresse ou par version 8.6 : Gestion des démarrages des trains sur horaire, en fonction d'une horloge paramétrable. Amélioration de l'importation du réseau depuis CDM Rail. Création d'actionneurs "horloge" et "vitesse train". +version 8.7 : les actionneurs deviennent les actions, et un déclencheur peut déclencher plusieurs opérations +