diff --git a/Signaux_complexes_GL.dof b/Signaux_complexes_GL.dof index f8b9493..490e277 100644 --- a/Signaux_complexes_GL.dof +++ b/Signaux_complexes_GL.dof @@ -95,7 +95,7 @@ UnitOutputDir= PackageDLLOutputDir= PackageDCPOutputDir= SearchPath= -Packages= +Packages=vcl;rtl;vclx;VclSmp;vclshlctrls Conditionals= DebugSourceDirs= UsePackages=0 diff --git a/UnitConfig.dcu b/UnitConfig.dcu index 3aecf08..28df7a7 100644 Binary files a/UnitConfig.dcu and b/UnitConfig.dcu differ diff --git a/UnitDebug.dcu b/UnitDebug.dcu index 6df5e91..98a2f5b 100644 Binary files a/UnitDebug.dcu and b/UnitDebug.dcu differ diff --git a/UnitDebug.dfm b/UnitDebug.dfm index af01fdf..486e8e5 100644 --- a/UnitDebug.dfm +++ b/UnitDebug.dfm @@ -1,6 +1,6 @@ object FormDebug: TFormDebug - Left = 302 - Top = 166 + Left = 286 + Top = 39 BorderStyle = bsSingle Caption = 'Fen'#234'tre de d'#233'bug' ClientHeight = 639 @@ -98,7 +98,7 @@ object FormDebug: TFormDebug end object ButtonEcrLog: TButton Left = 448 - Top = 560 + Top = 504 Width = 97 Height = 29 Caption = 'Sauvegarder le log' @@ -131,8 +131,8 @@ object FormDebug: TFormDebug OnClick = CheckAffSigClick end object ButtonRazTampon: TButton - Left = 448 - Top = 520 + Left = 688 + Top = 592 Width = 97 Height = 33 Caption = 'Raz Tampon Ev'#232'nements' @@ -142,7 +142,7 @@ object FormDebug: TFormDebug end object ButtonCherche: TButton Left = 448 - Top = 480 + Top = 464 Width = 97 Height = 33 Caption = 'Chercher erreurs' @@ -151,10 +151,10 @@ object FormDebug: TFormDebug end object ButtonAffEvtChrono: TButton Left = 448 - Top = 440 + Top = 424 Width = 97 Height = 33 - Caption = 'Affiche Evts chrono d'#233'tecteurs' + Caption = 'Affiche Evts d'#233'tecteurs et aig' TabOrder = 7 WordWrap = True OnClick = ButtonAffEvtChronoClick @@ -207,7 +207,7 @@ object FormDebug: TFormDebug end object ButtonCop: TButton Left = 448 - Top = 384 + Top = 368 Width = 97 Height = 49 Caption = 'Copie fen'#234'te principale dans debug' @@ -221,11 +221,29 @@ object FormDebug: TFormDebug Width = 225 Height = 241 HideScrollBars = False + PopupMenu = PopupMenuRE ScrollBars = ssVertical TabOrder = 12 end + object ButtonRazLog: TButton + Left = 448 + Top = 544 + Width = 97 + Height = 25 + Caption = 'Raz Tampon Log' + TabOrder = 13 + OnClick = ButtonRazLogClick + end object SaveDialog: TSaveDialog Left = 680 Top = 8 end + object PopupMenuRE: TPopupMenu + Left = 752 + Top = 16 + object copier1: TMenuItem + Caption = 'copier' + OnClick = copier1Click + end + end end diff --git a/UnitDebug.pas b/UnitDebug.pas index 44ebbc3..6a16342 100644 --- a/UnitDebug.pas +++ b/UnitDebug.pas @@ -4,7 +4,7 @@ interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, - Dialogs, StdCtrls , ComCtrls; + Dialogs, StdCtrls , ComCtrls, Menus; type TFormDebug = class(TForm) @@ -25,6 +25,9 @@ type CheckTrame: TCheckBox; ButtonCop: TButton; RichEdit: TRichEdit; + PopupMenuRE: TPopupMenu; + copier1: TMenuItem; + ButtonRazLog: TButton; procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormCreate(Sender: TObject); procedure ButtonEcrLogClick(Sender: TObject); @@ -37,6 +40,8 @@ type procedure CheckBoxTraceLIsteClick(Sender: TObject); procedure CheckTrameClick(Sender: TObject); procedure ButtonCopClick(Sender: TObject); + procedure copier1Click(Sender: TObject); + procedure ButtonRazLogClick(Sender: TObject); private { Déclarations privées } public @@ -44,7 +49,7 @@ type end; Const Max_Event_det_tick = 10000; - + var FormDebug: TFormDebug; NivDebug : integer; @@ -54,11 +59,12 @@ var // tick 1/10s,détecteur N_Event_tick : integer ; // dernier index - // tableau des évènements détecteurs + // tableau des évènements détecteurs et aiguillages event_det_tick : array[0..Max_Event_det_tick] of record tick : longint; detecteur : array[1..1100] of integer; // état du détecteur [...] + Aiguillage,position : integer ; //train : integer ; suivant : integer ; // d'ou vient le train traite : boolean; // traité lors de a recherche d'une route @@ -198,18 +204,26 @@ end; procedure TFormDebug.ButtonAffEvtChronoClick(Sender: TObject); var i,j,etat : integer; s : string; - trouve : boolean; begin for i:=1 to N_Event_tick do begin - s:=IntToSTR(i)+' Tick='+IntToSTR(event_det_tick[i].tick)+' Det='; - trouve:=false; + for j:=1 to 1100 do begin etat:=event_det_tick[i].detecteur[j]; - if etat<>-1 then begin s:=s+IntToSTR(j)+'='+intToSTR(etat);trouve:=true;end; + if etat<>-1 then + begin + s:=IntToSTR(i)+' Tick='+IntToSTR(event_det_tick[i].tick)+' Det='+IntToSTR(j)+'='+intToSTR(etat); + AfficheDebug(s,clyellow); + end; + end; + + etat:=event_det_tick[i].aiguillage; + if etat<>-1 then + begin + s:=IntToSTR(i)+' Tick='+IntToSTR(event_det_tick[i].tick)+' Aig='+IntToSTR(etat)+'='+intToSTR(event_det_tick[i].position); + AfficheDebug(s,clyellow); end; - if trouve then AfficheDebug(s,clyellow); end; end; @@ -236,4 +250,16 @@ end; +procedure TFormDebug.copier1Click(Sender: TObject); +begin + RichEdit.SelectAll; + RichEdit.CopyToClipboard; + RichEdit.SetFocus; +end; + +procedure TFormDebug.ButtonRazLogClick(Sender: TObject); +begin + MemoDebug.Clear; +end; + end. diff --git a/UnitPrinc.dcu b/UnitPrinc.dcu index 656b011..a04593e 100644 Binary files a/UnitPrinc.dcu and b/UnitPrinc.dcu differ diff --git a/UnitPrinc.dfm b/UnitPrinc.dfm index 8fdb643..507a294 100644 --- a/UnitPrinc.dfm +++ b/UnitPrinc.dfm @@ -1,6 +1,6 @@ object FormPrinc: TFormPrinc - Left = 47 - Top = 193 + Left = 64 + Top = 170 AutoSize = True BorderStyle = bsSingle Caption = 'Client TCP-IP CDM Rail ou USB - syst'#232'me LENZ' @@ -597,7 +597,7 @@ object FormPrinc: TFormPrinc Visible = False end object Image3feux: TImage - Left = 616 + Left = 600 Top = 8 Width = 33 Height = 57 @@ -1200,14 +1200,14 @@ object FormPrinc: TFormPrinc end object Label1: TLabel Left = 656 - Top = 116 + Top = 148 Width = 89 Height = 13 Caption = 'Nombre de trains : ' end object LabelNbTrains: TLabel Left = 760 - Top = 112 + Top = 144 Width = 9 Height = 19 Caption = '0' @@ -1255,9 +1255,9 @@ object FormPrinc: TFormPrinc end object ScrollBox1: TScrollBox Left = 648 - Top = 136 + Top = 168 Width = 537 - Height = 437 + Height = 405 Color = clWhite ParentColor = False TabOrder = 3 @@ -1266,7 +1266,7 @@ object FormPrinc: TFormPrinc Left = 656 Top = 8 Width = 249 - Height = 97 + Height = 129 Caption = 'Commande d'#39'accessoires' TabOrder = 4 object Label2: TLabel @@ -1295,7 +1295,7 @@ object FormPrinc: TFormPrinc Top = 32 Width = 57 Height = 21 - Hint = 'Adresse accessoire' + Hint = 'Adresse accessoire ou de CV' TabOrder = 0 Text = '1' end @@ -1331,6 +1331,17 @@ object FormPrinc: TFormPrinc WordWrap = True OnClick = ButtonEcrCVClick end + object ButtonLitCV: TButton + Left = 8 + Top = 96 + Width = 225 + Height = 25 + Hint = 'Lecture CV en mode direct sur voie de programmation' + Caption = 'Lecture CV - 1 '#224' 255 par le bus XpressNet' + Enabled = False + TabOrder = 4 + OnClick = ButtonLitCVClick + end end object ButtonTest: TButton Left = 912 @@ -1399,33 +1410,14 @@ object FormPrinc: TFormPrinc TabOrder = 11 OnClick = ButtonRepriseClick end - object EditGenli: TEdit - Left = 880 - Top = 160 - Width = 121 - Height = 21 - TabOrder = 12 - Visible = False - end - object Button1: TButton - Left = 1064 - Top = 216 - Width = 113 - Height = 25 - Caption = 'Envoi vers Genli' - TabOrder = 13 - Visible = False - OnClick = Button1Click - end object Button2: TButton Left = 992 Top = 96 Width = 97 Height = 25 Caption = 'Demande '#233'tat CTS' - TabOrder = 14 + TabOrder = 12 Visible = False - OnClick = Button2Click end object Timer1: TTimer Interval = 100 @@ -1454,7 +1446,7 @@ object FormPrinc: TFormPrinc OnClick = AffEtatDetecteurs end object ChronoDetect: TMenuItem - Caption = 'Chronologie des d'#233'tecteurs' + Caption = 'Chronologie des d'#233'tecteurs et aiguillages' Hint = 'Affiche la chronologie des d'#233'tecteurs' OnClick = ChronoDetectClick end @@ -1547,13 +1539,6 @@ object FormPrinc: TFormPrinc ' sur la voie de programmation' OnClick = LireunfichierdeCV1Click end - object LireunaccessoireversunfichierdeCV1: TMenuItem - Caption = 'Lire un accessoire vers un fichier de CV' - Hint = - 'Lire les CV d'#39'un accessoire branch'#233' sur la voie de programmation' + - ' vers un fichier' - OnClick = LireunaccessoireversunfichierdeCV1Click - end end end object ClientSocketCDM: TClientSocket diff --git a/UnitPrinc.pas b/UnitPrinc.pas index d6aae00..4511891 100644 --- a/UnitPrinc.pas +++ b/UnitPrinc.pas @@ -78,16 +78,14 @@ type OpenDialog: TOpenDialog; N1: TMenuItem; LireunfichierdeCV1: TMenuItem; - LireunaccessoireversunfichierdeCV1: TMenuItem; SaveDialog: TSaveDialog; N5: TMenuItem; Quitter1: TMenuItem; - EditGenli: TEdit; - Button1: TButton; Button2: TButton; Config: TMenuItem; Label1: TLabel; LabelNbTrains: TLabel; + ButtonLitCV: TButton; procedure FormCreate(Sender: TObject); procedure MSCommUSBLenzComm(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); @@ -134,11 +132,9 @@ type procedure ButtonEcrCVClick(Sender: TObject); procedure ButtonRepriseClick(Sender: TObject); procedure LireunfichierdeCV1Click(Sender: TObject); - procedure LireunaccessoireversunfichierdeCV1Click(Sender: TObject); procedure Quitter1Click(Sender: TObject); - procedure Button1Click(Sender: TObject); - procedure Button2Click(Sender: TObject); procedure ConfigClick(Sender: TObject); + procedure ButtonLitCVClick(Sender: TObject); private { Déclarations privées } @@ -156,7 +152,10 @@ tempoFeu = 100; MaxAcc = 2048; LargImg=50;HtImg=91; const_droit=2;const_devieD=1; // positions transmises par la centrale LENZ -const_devieG=3; +const_devieG_CDM=3; // positions transmises par cdm +const_devieD_CDM=2; // positions transmises par cdm +const_droit_CDM=0; // positions transmises par cdm + MaxElParcours=4000; @@ -171,7 +170,7 @@ type TBranche = record Taiguillage = record modele : integer; // 0=n'existe pas 1=aiguillage 2=TJD 3=TJS 4=aiguillage triple position, // position actuelle : 1=dévié 2=droit - Adrtriple, + Adrtriple, // 2eme adresse pour un aiguillage triple temps, // temps de pilotage (durée de l'impulsion en x 100 ms) inversion : integer; // pilotage inversé 0=normal 1=inversé vitesse : integer; // vitesse de franchissement de l"aiguillage en position déviée (60 ou 90) @@ -205,9 +204,9 @@ TMA = (valide,devalide); var ancien_tablo_signalCplx,EtatsignalCplx : array[0..MaxAcc] of word; AvecInitAiguillages,tempsCli,combine,NbreFeux,pasreponse,AdrDevie,precedent , NombreImages,signalCpx,branche_trouve,Indexbranche_trouve,Actuel,Signal_suivant, - Nbre_recu_cdm,Tempo_chgt_feux,Adj1,Adj2,protocole : integer; + Nbre_recu_cdm,Tempo_chgt_feux,Adj1,Adj2 : integer; Hors_tension2,traceSign,TraceZone,Ferme,parSocket,ackCdm, - NackCDM,MsgSim : boolean; + NackCDM,MsgSim,succes,recu_cv, TraceListe,clignotant,nack,Maj_feux_cours : boolean; branche : array [1..100] of string; @@ -219,8 +218,9 @@ const GrisF=$414141; clOrange=$0077FF; Feu_X=50;Feu_Y=91; + Max_Simule=1000; couleurTrain : array[1..8] of Tcolor = (clYellow,clLime,clOrange,clAqua,clFuchsia,clLtGray,clred,clWhite); - + var FormPrinc: TFormPrinc; ack,portCommOuvert,trace,AffMem,AfficheDet,CDM_connecte,parSocketCDM, @@ -240,11 +240,12 @@ var route : array[1..2000] of record Mem1,Mem2 : integer; end; - end; - Tablo_Simule : array[0..200] of + end; + + Tablo_Simule : array[0..Max_Simule] of record tick : longint; - Detecteur,etat : integer ; + Detecteur,Aiguillage,etat : integer ; end; Route : array[1..2000] of record Mem1,Mem2 : integer; @@ -3719,6 +3720,8 @@ begin Adr:=actuel; Btype:=BrancheN[branche_trouve_actuel,indexBranche_actuel].Btype; + //Affiche('Btype='+intToSTR(Btype)+' Actuel='+inTToSTR(actuel),clyellow); + if Btype=1 then // l'élément actuel est un détecteur begin // on part de l'actuel pour retomber sur le précédent @@ -3967,10 +3970,11 @@ begin if (aiguillage[Adr].modele=2) or (aiguillage[Adr].modele=3) then // TJD ou TJS begin - AdrTjdP:=aiguillage[Adr].Apointe; + // récupérer les élements de la TJD/S + AdrTjdP:=aiguillage[Adr].Apointe; // 2eme adresse de la TJD/S tjd:=aiguillage[Adr].modele=2; tjs:=aiguillage[Adr].modele=3; - tjsc1:=aiguillage[Adr].tjsint; // adresses de la courbe de la TJD + tjsc1:=aiguillage[Adr].tjsint; // adresses de la courbe de la TJS tjsc2:=aiguillage[AdrTjdP].tjsint; tjsc1B:=aiguillage[Adr].tjsintB; tjsc2B:=aiguillage[AdrTjdP].tjsintB; @@ -4122,43 +4126,108 @@ begin AfficheDebug('139 - Erreur fatale - Aucun cas TJD/S : adr='+IntToSTR(Adr)+' '+intToSTR(AdrTJDP)+' prec='+IntTOSTR(prec),clred); suivant_alg3:=9999;exit; end; + if (aiguillage[Adr].modele=4) then // aiguillage triple begin - // aiguillage triple pris en pointe - Adr2:=aiguillage[Adr].AdrTriple; - // attention la lecture d'un aiguillage triple est différente suivant la connexion avec CDM - // ou avec l'interface - if ( CDM_connecte and (aiguillage[Adr].position=const_droit) ) or - ( not(CDM_connecte) and (aiguillage[Adr].position=const_droit) and (aiguillage[Adr2].position=const_droit) ) then - begin - if NivDebug=3 then AfficheDebug('Aiguillage triple droit',clYellow); - typeGen:=aiguillage[Adr].AdroitBis+1; - //TSuiv=aiguillage[Adr].AdroitB; - Adr:=aiguillage[Adr].Adroit; - end; - if ( CDM_connecte and (aiguillage[Adr].position=const_devieG) ) or - ( not(CDM_connecte) and (aiguillage[Adr].position<>const_droit) and (aiguillage[Adr2].position=const_droit) ) then - begin - if NivDebug=3 then AfficheDebug('Aiguillage triple dévié1 (gauche)',clYellow); - typeGen:=aiguillage[Adr].AdevieBis+1; - //TSuiv=aiguillage[Adr].AdevieB; - Adr:=aiguillage[Adr].Adevie; - end; - if ( CDM_connecte and (aiguillage[Adr].position=const_devieG) ) or - ( not(CDM_connecte) and (aiguillage[Adr].position=const_droit) and (aiguillage[Adr2].position<>const_droit) ) then - begin - if NivDebug=3 then AfficheDebug('Aiguillage triple dévié2 (droit)',clYellow); - typeGen:=aiguillage[Adr].Adevie2Bis+1; - //TSuiv=aiguillage[Adr].Adevie2B; - Adr:=aiguillage[Adr].Adevie2; - end; - if ((aiguillage[Adr].position<>const_droit) and (aiguillage[Adr2].position<>const_droit) ) then - begin - AfficheDebug('Aiguillage triple '+IntToSTR(Adr)+' : configuration des aiguilles interdite',clYellow); - Affiche('Aiguillage triple : '+IntToSTR(Adr)+' configuration des aiguilles interdite',clRed); - //TSuiv='Z'; - suivant_alg3:=9999;exit; // pour échappement - end; + Adr2:=aiguillage[Adr].AdrTriple; + if (aiguillage[adr].Apointe=prec) then + begin + // aiguillage triple pris en pointe + //Affiche('position='+intToSTR(aiguillage[Adr].position),clyellow); + if (aiguillage[Adr].position=const_droit) and (aiguillage[Adr2].position=const_droit) then + begin + if NivDebug=3 then AfficheDebug('Aiguillage triple pris en pointe droit',clYellow); + typeGen:=aiguillage[Adr].AdroitBis+1; + A:=aiguillage[Adr].AdroitB; + Adr:=aiguillage[Adr].Adroit; + if A='Z' then TypeEl:=1 else TypeEL:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) + if Abis=1 then TypeEl:=3; + trouve_element(Adr,TypeEl); // branche_trouve IndexBranche_trouve + typeGen:=BrancheN[branche_trouve,IndexBranche_trouve].BType; + suivant_alg3:=adr;exit; + end; + if (aiguillage[Adr].position<>const_droit) and (aiguillage[Adr2].position=const_droit) then + begin + if NivDebug=3 then AfficheDebug('Aiguillage triple dévié1 (à gauche)',clYellow); + typeGen:=aiguillage[Adr].AdevieBis+1; + A:=aiguillage[Adr].AdevieB; + Adr:=aiguillage[Adr].Adevie; + if A='Z' then TypeEl:=1 else TypeEL:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) + if Abis=1 then TypeEl:=3; + trouve_element(Adr,TypeEl); // branche_trouve IndexBranche_trouve + typeGen:=BrancheN[branche_trouve,IndexBranche_trouve].BType; + suivant_alg3:=adr;exit; + end; + if (aiguillage[Adr].position=const_droit) and (aiguillage[Adr2].position<>const_droit) then + begin + if NivDebug=3 then AfficheDebug('Aiguillage triple dévié2 (à droite)',clYellow); + typeGen:=aiguillage[Adr].Adevie2Bis+1; + A:=aiguillage[Adr].Adevie2B; + Adr:=aiguillage[Adr].Adevie2; + if A='Z' then TypeEl:=1 else TypeEL:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) + if Abis=1 then TypeEl:=3; + trouve_element(Adr,TypeEl); // branche_trouve IndexBranche_trouve + typeGen:=BrancheN[branche_trouve,IndexBranche_trouve].BType; + suivant_alg3:=adr;exit; + end; + begin + s:='Aiguillage triple '+IntToSTR(Adr)+' : configuration des aiguilles interdite'; + if CDM_connecte then s:=s+': '+IntToSTR(aiguillage[Adr].position); + AfficheDebug(s,clYellow); + Affiche(s,clRed); + suivant_alg3:=9999;exit; // pour échappement + end; + end + else + begin + if NivDebug=3 then AfficheDebug('Aiguillage triple pris en talon',clyellow); + if alg=2 then // on demande d'arreter si l'aiguillage en talon est mal positionné + begin + if (aiguillage[adr].position=const_droit) and (aiguillage[adr2].position=const_droit) then + begin + if prec<>aiguillage[Adr].Adroit then + begin + if NivDebug=3 then AfficheDebug('135.3 - Aiguillage '+intToSTR(adr)+'triple mal positionné',clyellow); + suivant_alg3:=9998;exit; + end + else + begin + if NivDebug=3 then AfficheDebug('135.4 - Aiguillage '+intToSTR(adr)+'triple bien positionné',clyellow); + end; + end; + if (aiguillage[adr].position<>const_droit) and (aiguillage[adr2].position=const_droit) then + begin + if prec<>aiguillage[Adr].Adevie then + begin + if NivDebug=3 then AfficheDebug('135.3 - Aiguillage '+intToSTR(adr)+'triple mal positionné',clyellow); + suivant_alg3:=9998;exit; + end + else + begin + if NivDebug=3 then AfficheDebug('135.4 - Aiguillage '+intToSTR(adr)+'triple bien positionné',clyellow); + end; + end; + if (aiguillage[adr].position=const_droit) and (aiguillage[adr2].position<>const_droit) then + begin + if prec<>aiguillage[Adr].Adevie2 then + begin + if NivDebug=3 then AfficheDebug('135.3 - Aiguillage '+intToSTR(adr)+'triple mal positionné',clyellow); + suivant_alg3:=9998;exit; + end + else + begin + if NivDebug=3 then AfficheDebug('135.4 - Aiguillage '+intToSTR(adr)+'triple bien positionné',clyellow); + end; + end; + end; + A:=aiguillage[Adr].ApointeB; + Adr:=aiguillage[Adr].Apointe; + if A='Z' then TypeEl:=1 else TypeEL:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) + if Abis=1 then TypeEl:=3; + trouve_element(Adr,TypeEl); // branche_trouve IndexBranche_trouve + typeGen:=BrancheN[branche_trouve,IndexBranche_trouve].BType; + suivant_alg3:=Adr;exit; + end; end; end; suivant_alg3:=adr; @@ -5122,8 +5191,6 @@ begin // signaux traités spécifiquement if (AdrFeu=201) then begin - //sprintf(Affiche,"Aiguille 27=%d \r\n",aiguillage[27].position);Display(Affiche); - // sprintf(Affiche,"Aiguille 31=%d \r\n",aiguillage[31].position);Display(Affiche); if ((aiguillage[28].position<>const_droit) and (aiguillage[29].position<>const_droit) and (aiguillage[31].position=2)) then // attention spécial Maj_Etat_Signal(AdrFeu,blanc) else Maj_Etat_Signal(AdrFeu,violet); @@ -5508,7 +5575,7 @@ begin ancien_detecteur[Adresse]:=detecteur[Adresse]; detecteur[Adresse]:=etat; detecteur_chgt:=Adresse; - + // mise a jour du tableau evt de fronts descendants if ancien_detecteur[Adresse] and not(detecteur[Adresse]) and (N_Event_det<20) then begin @@ -5517,7 +5584,7 @@ begin event_det[N_event_det]:=Adresse; calcul_zones; // en avant les calculs end; - + // stocke les changements d'état des détecteurs dans le tableau chronologique if (N_Event_tick255 then Affiche('Erreur Recu CV>255',clRed) + cvLoc:=ord(chaineINT[1]); + //Affiche('Réception CV'+IntToSTR(cvLoc)+' à '+IntToSTR(ord(chaineINT[2])),clyellow); + if cvLoc>255 then Affiche('Erreur Recu CV>255',clRed) else begin - tablo_cv[cv]:=ord(chaineINT[2]); + tablo_cv[cvLoc]:=ord(chaineINT[2]); inc(N_Cv); // nombre de CV recus end; + recu_cv:=true; + delete(chaineInt,1,3); decode_chaine_retro:=chaineINT; exit; end; @@ -6067,7 +6147,7 @@ begin begin With Formprinc.MSCommUSBLenz do begin - Affiche('Demande ouverture com'+intToSTR(nuMPort)+':'+ConfStCom+','+IntToSTR(protocole),CLYellow); + Affiche('Demande ouverture com'+intToSTR(nuMPort)+':'+ConfStCom+' protocole '+IntToSTR(protocole),CLYellow); Settings:=ConfStCom; // COMx:vitesse,n,8,1 if protocole>=4 then Handshaking:=0 {0=aucun 1=Xon-Xoff 2=cts 3=RTS-Xon-Xoff 4=5=protocoles "maison"} else Handshaking:=protocole; @@ -6168,8 +6248,8 @@ begin //créée la fenêtre TCO FormTCO:=TformTCO.Create(Self); FormTCO.show; - construit_TCO; - affiche_TCO; + //construit_TCO; + //affiche_TCO; //Formprinc.Hide; end; @@ -6203,14 +6283,14 @@ begin begin ButtonEcrCV.Enabled:=true; LireunfichierdeCV1.enabled:=true; - LireunaccessoireversunfichierdeCV1.Enabled:=true; + ButtonLitCV.Enabled:=true; end else With Formprinc do begin ButtonEcrCV.Enabled:=false; + ButtonLitCV.Enabled:=false; LireunfichierdeCV1.enabled:=false; - LireunaccessoireversunfichierdeCV1.Enabled:=false; end ; // Initialisation des images des signaux @@ -6226,6 +6306,7 @@ begin // initialisation de la chronologie des évènements détecteurs for i:=0 to Max_Event_det_tick do begin + event_det_tick[i].aiguillage:=-1; for j:=1 to 1100 do event_det_tick[i].detecteur[j]:=-1; // initialiser les détecteurs à -1 event_det_tick[i].traite:=false ; // non traité @@ -6236,14 +6317,13 @@ begin N_Event_tick:=0 ; // dernier index NombreImages:=0; - + // énumération des ports USB //EnumerateDevices; //for i:=1 to NumLine do //begin // if pos('Ports',Line[i])<>0 then Affiche(Line[i],clyellow); //end; - //essai // event_det[1]:=527; // event_det[2]:=520; @@ -6253,11 +6333,10 @@ begin //traceDet:=true; // calcul_zones; //maj_feu(201); - //etat_signal_suivant(201,1); - //Aiguille_deviee(462); - //NivDebug:=3; - //formdebug.Show; +// formdebug.Show; //AfficheDet:=true; + //NivDebug:=3; + //Aiguille_deviee(462); //aiguillageB[1].Position:=1; //i:=suivant_alg3(553,1,1,3,1); //Affichedebug(intToSTr(i),clred); @@ -6275,10 +6354,8 @@ begin //Affiche(' Adj1='+intToStr(Adj1)+' Adj2='+intToStr(Adj2),clyellow); //trace:=true; //TraceListe:=true; - //interprete_reponse(#$FF+#$FD+#$46+#$43+#$40+#$41+#$40+#$40+#$49+#$4D); Affiche('Fin des initialisations',clyellow); - //Menu_interface(valide); //s:=#$f0; //s:=checksum(s); @@ -6408,14 +6485,25 @@ begin //simulation - if index_simule<>0 then + if index_simule<>0 then begin if not(MsgSim) then begin Affiche('Simulation en cours ',Cyan);MsgSim:=true;end; while tick=Tablo_simule[i_simule+1].tick do begin inc(I_simule); - Affiche('Simulation tick='+IntToSTR(tick)+' det='+intToSTR(Tablo_simule[i_simule].detecteur)+'='+IntToSTR(Tablo_simule[i_simule].etat),Cyan); - Event_Detecteur(Tablo_simule[i_simule].detecteur, Tablo_simule[i_simule].etat=1); // créer évt détecteur + // evt détecteur ? + if Tablo_simule[i_simule].detecteur<>0 then + begin + Affiche('Simulation tick='+IntToSTR(tick)+' det='+intToSTR(Tablo_simule[i_simule].detecteur)+'='+IntToSTR(Tablo_simule[i_simule].etat),Cyan); + Event_Detecteur(Tablo_simule[i_simule].detecteur, Tablo_simule[i_simule].etat=1); // créer évt détecteur + end; + // evt aiguillage ? + if Tablo_simule[i_simule].aiguillage<>0 then + begin + Affiche('Simulation tick='+IntToSTR(tick)+' aig='+intToSTR(Tablo_simule[i_simule].aiguillage)+'='+IntToSTR(Tablo_simule[i_simule].etat),Cyan); + Event_Aig(Tablo_simule[i_simule].Aiguillage, Tablo_simule[i_simule].etat); // créer évt aiguillage + end; + end; if i_Simule>=Index_simule then begin @@ -6441,7 +6529,19 @@ procedure TFormPrinc.ButtonCommandeClick(Sender: TObject); var adr,valeur,erreur : integer; begin val(EditAdresse.text,adr,erreur); + if (erreur<>0) or (adr<1) or (adr>2048) then + begin + EditAdresse.text:='1'; + exit; + end; + val(EditVal.Text,valeur,erreur); + if (erreur<>0) or (valeur<0) or (valeur>255) then + begin + EditVal.text:='1'; + exit; + end; + pilote_acc(adr,valeur,aig); end; @@ -6595,7 +6695,6 @@ begin ClientSocketLenz.Close; end; - function cde_cdm(s : string) : string; var i : integer; begin @@ -6603,8 +6702,6 @@ begin cde_cdm:='0'+IntToSTR(i)+s; end; - - procedure TFormPrinc.locoClick(Sender: TObject); begin // vitesse et direction 18 pas @@ -6626,16 +6723,23 @@ begin end; procedure TFormPrinc.Etatdesaiguillages1Click(Sender: TObject); -var i : integer; +var i,j,model : integer; s : string; begin Affiche('les positions des aiguillages BIS sont les mêmes que leurs homologues non bis',Cyan); for i:=1 to MaxAcc do begin - if aiguillage[i].modele<>0 then + model:=aiguillage[i].modele ; + if model<>0 then begin s:='Aiguillage '+IntToSTR(i)+' : '+intToSTR(aiguillage[i].position); if aiguillage[i].position=1 then s:=s+' (dévié)' else s:=s+' (droit)'; + if model=4 then + begin + j:=aiguillage[i].AdrTriple; + s:=s+' Aig '+IntToSTR(j)+': '+intToSTR(aiguillage[j].position); + if aiguillage[j].position=1 then s:=s+' (dévié)' else s:=s+' (droit)'; + end; Affiche(s,clWhite); end; end; @@ -6696,8 +6800,8 @@ begin AfficheDebug('Lenz connecté ',clYellow); parSocket:=True; ButtonEcrCV.Enabled:=true; + ButtonLitCV.Enabled:=true; LireunfichierdeCV1.enabled:=true; - LireunaccessoireversunfichierdeCV1.Enabled:=true; LabelTitre.caption:=titre+' Interface connectée par Ethernet'; end; @@ -6717,7 +6821,7 @@ end; // réception d'un message de CDM rail procedure TFormPrinc.ClientSocketCDMRead(Sender: TObject;Socket: TCustomWinSocket); - var i,j,k,erreur, adr,adr2,etat,etataig : integer ; + var i,j,k,erreur, adr,adr2,etat,etataig,etatAig2 : integer ; s,ss : string; traite,sort : boolean; begin @@ -6756,14 +6860,50 @@ begin exit; end; val(ss,etat,erreur); + // Affiche('Aiguillage CDM'+intToSTR(adr)+'='+IntToStr(etat),clLime); + // conversion en position : + // CDM: 0=droit 1=droite 3=gauche + // logiciel : 1=dévié 2=droit + + // aiguillage normal + if aiguillage[adr].modele=1 then + begin + if etat=0 then etatAig:=2 else etatAig:=1; + aiguillage[adr].position:=etatAig; + aiguillageB[adr].position:=etatAig; + Event_Aig(adr,etatAig); + end; + // TJD TJS + if (aiguillage[adr].modele=2) or (aiguillage[adr].modele=3) then + begin + adr2:=aiguillage[adr].Apointe; // 2eme adresse de la TJD + case etat of + 1 : begin etatAig:=1;EtatAig2:=2;end; + 4 : begin etatAig:=1;EtatAig2:=1;end; + 5 : begin etatAig:=2;EtatAig2:=1;end; + 0 : begin etatAig:=2;EtatAig2:=2;end; + end; + aiguillage[adr].position:=etatAig;aiguillage[adr2].position:=etatAig2; + Event_Aig(adr,etatAig); + Event_Aig(adr2,etatAig2); + end; + if aiguillage[adr].modele=4 then // aiguillage triple + begin + // état de l'aiguillage 1 + if (etat=0) or (etat=2) then etatAig:=2; + if etat=3 then etatAig:=1; + aiguillage[adr].Position:=etatAig; + // état de l'aiguillage 2 + adr2:=aiguillage[adr].AdrTriple; + if (etat=0) or (etat=3) then etatAig2:=2; + if etat=2 then etatAig2:=1; + aiguillage[adr2].Position:=etatAig2; + Event_Aig(adr,etatAig); + Event_Aig(adr2,etatAig2); + end; - // conversion en position : 1=dévié (CDM envoie 2 ou 1) 2=droit (CDM envoie 0) - if etat=0 then etatAig:=2 else etatAig:=1; - aiguillage[adr].position:=etatAig; - aiguillageB[adr].position:=etatAig; - Event_Aig(adr); Tempo_chgt_feux:=10; // demander la mise à jour des feux - //Affiche('Aiguillage '+intToSTR(adr)+'='+IntToStr(etatAig),clYellow); + //Affiche(recuCDM,CLOrange); //if length(recuCDM)>80 then Affiche(copy(recuCDM,80,length(recuCDM)-80),clOrange); end; @@ -6874,7 +7014,7 @@ begin Affiche('Version 1.3 : Décodeur Unisemaf fonctionnel - Lecture/écriture des CV',clLime); Affiche(' Protocoles variables de l''interface',clLime); Affiche(' Configuration statique modifiable dans menu',clLime); - + Affiche('Version 1.31 : Correction des positions aiguillages triples et TJD',clLime); end; procedure TFormPrinc.ClientSocketLenzDisconnect(Sender: TObject; @@ -6886,25 +7026,29 @@ end; procedure TFormPrinc.ChronoDetectClick(Sender: TObject); var i,j,etat : integer; s : string; - trouve : boolean; begin for i:=1 to N_Event_tick do begin - s:=IntToSTR(i)+' Tick='+IntToSTR(event_det_tick[i].tick)+' Det='; - trouve:=false; + for j:=1 to 1100 do begin etat:=event_det_tick[i].detecteur[j]; if etat<>-1 then begin - s:=s+IntToSTR(j)+'='+intToSTR(etat); - //s:=s+' Train n°'+intTostr(event_det_tick[i].Train); + s:=IntToSTR(i)+' Tick='+IntToSTR(event_det_tick[i].tick); + s:=s+' Det='+IntToSTR(j)+'='+intToSTR(etat); s:=s+' Det suiv='+intTostr(event_det_tick[i].suivant); - - trouve:=true; + Affiche(s,clyellow); end; end; - if trouve then Affiche(s,clyellow); + + etat:=event_det_tick[i].aiguillage; + if etat<>-1 then + begin + s:=IntToSTR(i)+' Tick='+IntToSTR(event_det_tick[i].tick); + s:=s+' Aig='+intToSTR(etat)+'='+intToSTR(event_det_tick[i].position); + Affiche(s,clyellow); + end; end; end; @@ -6922,8 +7066,19 @@ var adr,valeur,erreur : integer; begin // doc XpressNet page 55 val(EditAdresse.text,adr,erreur); + if (erreur<>0) or (Adr>255) or (Adr<0) then + begin + EditAdresse.Text:='1'; + exit; + end; + val(EditVal.Text,valeur,erreur); - if (Adr>255) or (valeur>255) then exit; + if (erreur<>0) or (valeur<0) or (valeur>255) then + begin + EditAdresse.text:='1'; + exit; + end; + //s:=#$ff+#$fe+#$23+#$1e+Char(adr)+Char(valeur); //CV de 512 à 767 V3.4 //s:=#$ff+#$fe+#$23+#$1d+Char(adr)+Char(valeur); //CV de 256 à 511 V3.4 s:=#$23+#$16+Char(adr)+Char(valeur); //CV de 1 à 256 @@ -6996,7 +7151,7 @@ begin Lire_fichier_CV; end; -procedure TFormPrinc.LireunaccessoireversunfichierdeCV1Click(Sender: TObject); +procedure TFormPrinc.ButtonLitCVClick(Sender: TObject); var s,sa: string; fte : textfile; i,cv,valeur,erreur : integer; @@ -7005,66 +7160,56 @@ begin //s:='C:\Program Files (x86)\Borland\Delphi7\Projects\Signaux_complexes_GL'; N_Cv:=0; // nombre de CV recus à 0 sa:=''; - //for cv:=1 to 255 do + Affiche('Lecture CV',clyellow); + + val(EditAdresse.Text,cv,erreur); + if (erreur<>0) or (cv>255) or (cv<0) then begin - cv:=3; - trace:=true; - //s:=#$ff+#$fe+#$22+#$15+Char(cv); //CV de 1 à 256 (V3.0) - s:=#$22+#$18+Char(cv); //CV de 1 à 255 + 1024 (V3.6) - s:=checksum(s); - // envoi(s); // envoi de la trame et attente Ack, la premiere trame fait passer la centrale en mode programmation (service) - envoi_ss_ack(s); - Tempo(1); + EditAdresse.Text:='1'; + exit; + end; + //trace:=true; - s:=#$21+#$10+Char(cv); // demande d'envoi du résultat du mode service - s:=checksum(s); - //envoi(s); - envoi_ss_ack(s); - Tempo(1); - // attente de la réponse de la centrale - tablo_CV[cv]:=0; - i:=0; - repeat - Tempo(2); // attend 200 ms - inc(i); - // N_cv:=cv; - until (N_cv=cv) or (i>4); - if (i>4) then - begin - Affiche('Erreur attente trop longue CV',clred); - exit; - end; - //tablo_cv[cv]:=123; - sa:=sa+'Cv'+IntToSTR(cv)+'='+IntToSTR(Tablo_cv[cv])+' '; - if cv mod 9=0 then - begin - Affiche(sa,clyellow);sa:=''; - end; - end; - Affiche(sa,clyellow);sa:=''; + s:=#$22+#$15+Char(cv); //CV de 1 à 256 (V3.0) + //s:=#$22+#$18+Char(cv); //CV de 1 à 255 + 1024 (V3.6) + s:=checksum(s); + // envoi de la trame : fait passer la centrale en mode programmation (service) + envoi_ss_ack(s); - with FormPrinc.SaveDialog do + // attendre la trame 01 04 05 (env 1s) + succes:=false;i:=0; + repeat + Application.processMessages; + Sleep(100); + inc(i); + until succes or (i>20); + + if succes then begin - InitialDir:=s; - title:='Ecrire un nom de fichier dans lequel sauvegarder les CV'; - DefaultExt:='txt'; - Filter:='Fichiers texte (*.txt)|*.txt|Tous fichiers (*.*)|*.*'; - - if Execute then + recu_cv:=false; + //Affiche('reçu trame succes',clyellow); + s:=#$21+#$10; // demande d'envoi du résultat du mode service + s:=checksum(s); + //envoi(s); + envoi_ss_ack(s); + Tempo(1); + // attente de la réponse de la centrale + i:=0; + repeat + Tempo(2); // attend 200 ms + inc(i); + until recu_cv or (i>4); + if (i>4) then begin - s:=FileName; - assignFile(fte,s); - rewrite(fte); - Writeln(fte,'cv valeur'); - for cv:=1 to 255 do - begin - s:=IntToSTR(cv)+' '+intToSTR(tablo_CV[cv]); - Writeln(fte,s); - end; - closeFile(fte); + Affiche('Erreur attente trop longue CV',clred); + exit; end; - end; + sa:=sa+'Cv'+IntToSTR(cv)+'='+IntToSTR(Tablo_cv[cv])+' '; + Affiche(sa,clyellow);sa:=''; + end + else + Affiche('Pas de réponse de l''interface',clOrange); end; @@ -7073,25 +7218,6 @@ begin close; end; -procedure TFormPrinc.Button1Click(Sender: TObject); -var s : string; -begin - s:=EditGenli.text; //+#13+#10+#10; - terminal:=true; - if portCommOuvert then - begin - Affiche('Envoi a genli de '+ EditGenli.text,clorange); - envoi_ss_ack(s); - end; -end; - -procedure TFormPrinc.Button2Click(Sender: TObject); -begin - if MSCommUSBLenz.CTSHolding=true then Affiche('CTS=1',Clyellow) - else Affiche('CTS=0',clyellow); - -end; - procedure TFormPrinc.ConfigClick(Sender: TObject); begin Tformconfig.create(self); @@ -7100,5 +7226,7 @@ begin end; +begin end. + diff --git a/UnitSimule.dcu b/UnitSimule.dcu index eb6085e..57f6b2d 100644 Binary files a/UnitSimule.dcu and b/UnitSimule.dcu differ diff --git a/UnitSimule.dfm b/UnitSimule.dfm index 6a78e85..0015063 100644 --- a/UnitSimule.dfm +++ b/UnitSimule.dfm @@ -46,14 +46,6 @@ object FormSimulation: TFormSimulation Text = '1' OnKeyPress = EditIntervalleKeyPress end - object CheckBoxRapide: TCheckBox - Left = 56 - Top = 56 - Width = 97 - Height = 17 - Caption = 'Mode rapide' - TabOrder = 2 - end object OpenDialog: TOpenDialog Left = 48 Top = 96 diff --git a/UnitSimule.pas b/UnitSimule.pas index c6b5a59..d58f4c1 100644 --- a/UnitSimule.pas +++ b/UnitSimule.pas @@ -12,7 +12,6 @@ type OpenDialog: TOpenDialog; EditIntervalle: TEdit; Label1: TLabel; - CheckBoxRapide: TCheckBox; procedure ButtonChargeClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure EditIntervalleKeyPress(Sender: TObject; var Key: Char); @@ -49,44 +48,69 @@ begin index_simule:=1; repeat readln(fte,s); + i:=pos('Tick=',s); - - if i<>0 then - begin + if i<>0 then + begin Delete(s,1,i+4); val(s,k,erreur); if intervalle<>0 then k:=Index_Simule*Intervalle*10+tick+80 else // démarre dans 8s k:=Index_Simule+tick+80 ; Tablo_simule[index_simule].tick:=k; + + // détecteur? i:=pos('Det=',s); - if i<>0 then - begin + if i<>0 then + begin Delete(s,1,i+3); val(s,k,erreur); Tablo_simule[index_simule].detecteur:=k; i:=pos('=',s); - if i<>0 then - begin + if i<>0 then + begin Delete(s,1,i); val(s,k,erreur); Tablo_simule[index_simule].etat:=k; - s:='Tick='+intToSTR(Tablo_simule[index_simule].tick)+ + s:=IntToSTR(Index_simule)+' Tick='+intToSTR(Tablo_simule[index_simule].tick)+ ' Detecteur='+intToSTR(Tablo_simule[index_simule].detecteur)+ '='+intToSTR(Tablo_simule[index_simule].etat); Affiche(s,ClLime); - - inc(index_simule); + + inc(index_simule); end; - end; + end; + + // aiguillage? + i:=pos('Aig=',s); + if i<>0 then + begin + Delete(s,1,i+3); + val(s,k,erreur); + Tablo_simule[index_simule].aiguillage:=k; + i:=pos('=',s); + if i<>0 then + begin + Delete(s,1,i); + val(s,k,erreur); + Tablo_simule[index_simule].etat:=k; + + s:=IntToSTR(Index_simule)+' Tick='+intToSTR(Tablo_simule[index_simule].tick)+ + ' Aiguillage='+intToSTR(Tablo_simule[index_simule].aiguillage)+ + '='+intToSTR(Tablo_simule[index_simule].etat); + Affiche(s,ClLime); + + inc(index_simule); + end; + end; end; - sortie:=eof(fte) or (index_simule>199); + sortie:=eof(fte) or (index_simule>Max_Simule); until sortie ; + if index_simule>Max_Simule then Affiche('Tableau maximal atteint',clred); Affiche('Intervalle='+intToSTR(intervalle),clyellow); dec(index_simule); closeFile(fte); FormSimulation.Close; - end; end; @@ -102,7 +126,7 @@ procedure TFormSimulation.EditIntervalleKeyPress(Sender: TObject;var Key: Char); var erreur : integer; begin Val(EditIntervalle.Text,intervalle,erreur); - if (intervalle<0) then Intervalle:=1; + if (intervalle<0) then Intervalle:=1; end; end. diff --git a/UnitTCO.dcu b/UnitTCO.dcu index 7182d51..e5fbaff 100644 Binary files a/UnitTCO.dcu and b/UnitTCO.dcu differ diff --git a/UnitTCO.dfm b/UnitTCO.dfm index 686da2e..aa24be6 100644 --- a/UnitTCO.dfm +++ b/UnitTCO.dfm @@ -1,10 +1,12 @@ object FormTCO: TFormTCO - Left = 267 - Top = 203 + Left = 337 + Top = 102 Width = 928 - Height = 590 + Height = 681 + VertScrollBar.Visible = False Caption = 'FormTCO' Color = clBtnFace + DragMode = dmAutomatic Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 @@ -12,9 +14,9 @@ object FormTCO: TFormTCO Font.Style = [] KeyPreview = True OldCreateOrder = False - Position = poDefault OnActivate = FormActivate OnCreate = FormCreate + OnDockOver = FormDockOver OnKeyDown = FormKeyDown PixelsPerInch = 96 TextHeight = 13 @@ -65,21 +67,341 @@ object FormTCO: TFormTCO Height = 13 Caption = 'Label1' end - object Button1: TButton - Left = 320 - Top = 16 - Width = 75 + object Label4: TLabel + Left = 24 + Top = 480 + Width = 175 Height = 25 - Caption = 'Button1' + Caption = 'Adresse de l'#39#233'l'#233'ment: ' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -21 + Font.Name = 'Arial Narrow' + Font.Style = [] + ParentFont = False + end + object Label5: TLabel + Left = 24 + Top = 512 + Width = 150 + Height = 25 + Caption = 'Type de l'#39#233'l'#233'ment: ' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -21 + Font.Name = 'Arial Narrow' + Font.Style = [] + ParentFont = False + end + object ImagePalette1: TImage + Left = 440 + Top = 480 + Width = 41 + Height = 41 + DragMode = dmAutomatic + OnEndDrag = ImagePalette1EndDrag + OnMouseDown = ImagePalette1MouseDown + end + object ImagePalette2: TImage + Left = 512 + Top = 480 + Width = 41 + Height = 41 + DragMode = dmAutomatic + OnEndDrag = ImagePalette2EndDrag + OnMouseDown = ImagePalette2MouseDown + end + object ImagePalette3: TImage + Left = 584 + Top = 480 + Width = 41 + Height = 41 + DragMode = dmAutomatic + OnEndDrag = ImagePalette3EndDrag + OnMouseDown = ImagePalette3MouseDown + end + object ImagePalette4: TImage + Left = 656 + Top = 480 + Width = 41 + Height = 41 + DragMode = dmAutomatic + OnEndDrag = ImagePalette4EndDrag + OnMouseDown = ImagePalette4MouseDown + end + object ImagePaletteDroit: TImage + Left = 440 + Top = 528 + Width = 41 + Height = 41 + DragMode = dmAutomatic + OnEndDrag = ImagePaletteDroitEndDrag + OnMouseDown = ImagePaletteDroitMouseDown + end + object ImageSupG: TImage + Left = 512 + Top = 528 + Width = 41 + Height = 41 + DragMode = dmAutomatic + OnEndDrag = ImageSupGEndDrag + OnMouseDown = ImageSupGMouseDown + end + object ImageSupD: TImage + Left = 584 + Top = 528 + Width = 41 + Height = 41 + DragMode = dmAutomatic + OnEndDrag = ImageSupDEndDrag + OnMouseDown = ImageSupDMouseDown + end + object ImageInfD: TImage + Left = 656 + Top = 528 + Width = 41 + Height = 41 + DragMode = dmAutomatic + OnEndDrag = ImageInfDEndDrag + OnMouseDown = ImageInfDMouseDown + end + object ImageInfG: TImage + Left = 728 + Top = 528 + Width = 41 + Height = 41 + DragMode = dmAutomatic + OnEndDrag = ImageInfGEndDrag + OnMouseDown = ImageInfGMouseDown + end + object Label6: TLabel + Left = 424 + Top = 488 + Width = 9 + Height = 19 + Caption = '1' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'Arial' + Font.Style = [fsBold] + ParentFont = False + end + object Label7: TLabel + Left = 496 + Top = 488 + Width = 9 + Height = 19 + Caption = '2' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'Arial' + Font.Style = [fsBold] + ParentFont = False + end + object Label8: TLabel + Left = 568 + Top = 488 + Width = 9 + Height = 19 + Caption = '3' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'Arial' + Font.Style = [fsBold] + ParentFont = False + end + object Label9: TLabel + Left = 640 + Top = 488 + Width = 9 + Height = 19 + Caption = '4' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'Arial' + Font.Style = [fsBold] + ParentFont = False + end + object Label10: TLabel + Left = 424 + Top = 536 + Width = 9 + Height = 19 + Caption = '5' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'Arial' + Font.Style = [fsBold] + ParentFont = False + end + object Label11: TLabel + Left = 496 + Top = 536 + Width = 9 + Height = 19 + Caption = '6' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'Arial' + Font.Style = [fsBold] + ParentFont = False + end + object Label12: TLabel + Left = 568 + Top = 536 + Width = 9 + Height = 19 + Caption = '7' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'Arial' + Font.Style = [fsBold] + ParentFont = False + end + object Label13: TLabel + Left = 640 + Top = 536 + Width = 9 + Height = 19 + Caption = '8' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'Arial' + Font.Style = [fsBold] + ParentFont = False + end + object Label14: TLabel + Left = 712 + Top = 536 + Width = 9 + Height = 19 + Caption = '9' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'Arial' + Font.Style = [fsBold] + ParentFont = False + end + object Label15: TLabel + Left = 24 + Top = 544 + Width = 158 + Height = 25 + Caption = 'Image de l'#39#233'l'#233'ment: ' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -21 + Font.Name = 'Arial Narrow' + Font.Style = [] + ParentFont = False + end + object ImageDiag1: TImage + Left = 440 + Top = 576 + Width = 41 + Height = 41 + DragMode = dmAutomatic + OnEndDrag = ImageDiag1EndDrag + OnMouseDown = ImageDiag1MouseDown + end + object Label16: TLabel + Left = 416 + Top = 584 + Width = 18 + Height = 19 + Caption = '10' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'Arial' + Font.Style = [fsBold] + ParentFont = False + end + object ImageDiag2: TImage + Left = 512 + Top = 576 + Width = 41 + Height = 41 + DragMode = dmAutomatic + OnEndDrag = ImageDiag2EndDrag + OnMouseDown = ImageDiag2MouseDown + end + object Label17: TLabel + Left = 488 + Top = 584 + Width = 17 + Height = 19 + Caption = '11' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'Arial' + Font.Style = [fsBold] + ParentFont = False + end + object EditAdrElement: TEdit + Left = 200 + Top = 480 + Width = 89 + Height = 33 + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -21 + Font.Name = 'Arial Narrow' + Font.Style = [] + ParentFont = False + TabOrder = 1 + OnChange = EditAdrElementChange + end + object EditTypeElement: TEdit + Left = 200 + Top = 512 + Width = 89 + Height = 33 + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -21 + Font.Name = 'Arial Narrow' + Font.Style = [] + ParentFont = False + ReadOnly = True TabOrder = 0 - OnClick = Button1Click + Text = 'EditTypeElement' + end + object ButtonSauveTCO: TButton + Left = 784 + Top = 480 + Width = 91 + Height = 33 + Caption = 'Sauvegarder TCO' + TabOrder = 2 + WordWrap = True + OnClick = ButtonSauveTCOClick + end + object ButtonRedessine: TButton + Left = 784 + Top = 520 + Width = 89 + Height = 33 + Caption = 'Redessine' + TabOrder = 3 + OnClick = ButtonRedessineClick end object ScrollBox: TScrollBox Left = 16 Top = 40 Width = 865 Height = 433 - TabOrder = 1 + TabOrder = 4 object ImageTCO: TImage Left = 0 Top = 0 @@ -88,13 +410,59 @@ object FormTCO: TFormTCO PopupMenu = PopupMenu1 OnClick = ImageTCOClick OnContextPopup = ImageTCOContextPopup + OnDragOver = ImageTCODragOver + OnMouseDown = ImageTCOMouseDown + OnMouseMove = ImageTCOMouseMove + OnMouseUp = ImageTCOMouseUp end end + object EditTypeImage: TEdit + Left = 200 + Top = 552 + Width = 89 + Height = 33 + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -21 + Font.Name = 'Arial Narrow' + Font.Style = [] + ParentFont = False + TabOrder = 5 + Text = 'EditTypeImage' + OnKeyPress = EditTypeImageKeyPress + end + object Button1: TButton + Left = 784 + Top = 560 + Width = 89 + Height = 25 + Caption = 'Simu det 1' + TabOrder = 6 + OnClick = Button1Click + end + object Button2: TButton + Left = 320 + Top = 520 + Width = 75 + Height = 25 + Caption = 'Simu Det 0' + TabOrder = 7 + OnClick = Button2Click + end object PopupMenu1: TPopupMenu - Left = 568 - Top = 296 - object Position1: TMenuItem - Caption = 'Position' + Left = 352 + Top = 472 + object MenuCouper: TMenuItem + Caption = 'Couper' + OnClick = MenuCouperClick + end + object MenuCopier: TMenuItem + Caption = 'Copier' + OnClick = MenuCopierClick + end + object MenuColler: TMenuItem + Caption = 'Coller' + OnClick = MenuCollerClick end object N1: TMenuItem Caption = '-' @@ -109,6 +477,43 @@ object FormTCO: TFormTCO Caption = 'Aiguillage droit ; pointe '#224' droite' OnClick = aiguillageD_PDClick end + object N2: TMenuItem + Caption = '-' + end + object Aiguillagegauchepointedroite1: TMenuItem + Caption = 'Aiguillage gauche ; pointe '#224' droite' + OnClick = Aiguillagegauchepointedroite1Click + end + object Aiguillagedroitpointegauche1: TMenuItem + Caption = 'Aiguillage droit : pointe '#224' gauche' + OnClick = Aiguillagedroitpointegauche1Click + end + object N3: TMenuItem + Caption = '-' + end + object Elmentdroit1: TMenuItem + Caption = 'El'#233'ment droit' + OnClick = Elmentdroit1Click + end + object N4: TMenuItem + Caption = '-' + end + object Courbegaucheversdroite1: TMenuItem + Caption = 'Courbe infD' + OnClick = Courbegaucheversdroite1Click + end + object Courbedroiteversgauche1: TMenuItem + Caption = 'Courbe infG' + OnClick = Courbedroiteversgauche1Click + end + object CourbeSupD1: TMenuItem + Caption = 'Courbe SupD' + OnClick = CourbeSupD1Click + end + object CourbeSupG1: TMenuItem + Caption = 'Courbe SupG' + OnClick = CourbeSupG1Click + end end end end diff --git a/UnitTCO.pas b/UnitTCO.pas index 891f9e6..bb7a618 100644 --- a/UnitTCO.pas +++ b/UnitTCO.pas @@ -8,77 +8,306 @@ uses type TFormTCO = class(TForm) - Button1: TButton; LabelX: TLabel; Label2: TLabel; Label3: TLabel; LabelY: TLabel; - ScrollBox: TScrollBox; - ImageTCO: TImage; PopupMenu1: TPopupMenu; - Position1: TMenuItem; + MenuCouper: TMenuItem; N1: TMenuItem; Insrer1: TMenuItem; aiguillageG_PG: TMenuItem; Label1: TLabel; aiguillageD_PD: TMenuItem; + N2: TMenuItem; + Aiguillagegauchepointedroite1: TMenuItem; + Aiguillagedroitpointegauche1: TMenuItem; + N3: TMenuItem; + Elmentdroit1: TMenuItem; + N4: TMenuItem; + Courbegaucheversdroite1: TMenuItem; + Courbedroiteversgauche1: TMenuItem; + CourbeSupD1: TMenuItem; + CourbeSupG1: TMenuItem; + Label4: TLabel; + EditAdrElement: TEdit; + Label5: TLabel; + EditTypeElement: TEdit; + ImagePalette1: TImage; + ImagePalette2: TImage; + ImagePalette3: TImage; + ImagePalette4: TImage; + ImagePaletteDroit: TImage; + ImageSupG: TImage; + ImageSupD: TImage; + ImageInfD: TImage; + ImageInfG: TImage; + ButtonSauveTCO: TButton; + Label6: TLabel; + Label7: TLabel; + Label8: TLabel; + Label9: TLabel; + Label10: TLabel; + Label11: TLabel; + Label12: TLabel; + Label13: TLabel; + Label14: TLabel; + MenuCopier: TMenuItem; + MenuColler: TMenuItem; + ButtonRedessine: TButton; + ScrollBox: TScrollBox; + ImageTCO: TImage; + Label15: TLabel; + EditTypeImage: TEdit; + Button1: TButton; + Button2: TButton; + ImageDiag1: TImage; + Label16: TLabel; + ImageDiag2: TImage; + Label17: TLabel; procedure FormCreate(Sender: TObject); - procedure Button1Click(Sender: TObject); procedure ImageTCOClick(Sender: TObject); procedure FormActivate(Sender: TObject); procedure ImageTCOContextPopup(Sender: TObject; MousePos: TPoint; var Handled: Boolean); procedure aiguillageG_PGClick(Sender: TObject); - procedure dessin_AigPG_AG(x,y : integer;couleur : Tcolor); - procedure dessin_AigPD_AD(x,y : integer;couleur : Tcolor); - procedure dessin_cbgd(x,y : integer;couleur : Tcolor); - procedure dessin_cdbas(x,y : integer;couleur : Tcolor); + procedure dessin_AigPG_AG(Canvas : Tcanvas;x,y : integer;couleur : Tcolor;Mode : TPenMode); + procedure dessin_AigPD_AD(Canvas : Tcanvas;x,y : integer;couleur : Tcolor;Mode : TPenMode); + procedure dessin_Diag1(Canvas : Tcanvas;x,y : integer;couleur : Tcolor;Mode : TPenMode); + procedure dessin_Diag2(Canvas : Tcanvas;x,y : integer;couleur : Tcolor;Mode : TPenMode); + procedure dessin_infG(Canvas : Tcanvas;x,y : integer;couleur : Tcolor;Mode : TPenMode); + procedure dessin_infD(Canvas : Tcanvas;x,y : integer;couleur : Tcolor;Mode : TPenMode); procedure Entoure_cell(x,y : integer); - procedure FormKeyDown(Sender: TObject; var Key: Word; - Shift: TShiftState); + procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure aiguillageD_PDClick(Sender: TObject); + procedure Aiguillagegauchepointedroite1Click(Sender: TObject); + procedure dessin_AigG_PD(canvas : Tcanvas;X,Y : integer; couleur : Tcolor;Mode : TPenMode); + procedure Elmentdroit1Click(Sender: TObject); + procedure dessin_voie(Canvas : Tcanvas;x,y : integer;couleur : TColor;Mode : TPenMode); + procedure Courbegaucheversdroite1Click(Sender: TObject); + procedure Courbedroiteversgauche1Click(Sender: TObject); + procedure Aiguillagedroitpointegauche1Click(Sender: TObject); + procedure dessin_AigD_PG(Canvas : Tcanvas;x,y : integer; couleur : Tcolor;Mode : TPenMode); + procedure CourbeSupD1Click(Sender: TObject); + procedure dessin_SupD(Canvas : Tcanvas;x,y : integer; couleur : Tcolor;Mode : TPenMode); + procedure CourbeSupG1Click(Sender: TObject); + procedure dessin_SupG(Canvas : Tcanvas;x,y : integer; couleur : Tcolor;Mode : TPenMode); + procedure ImageTCODragOver(Sender, Source: TObject; X, Y: Integer; + State: TDragState; var Accept: Boolean); + procedure FormDockOver(Sender: TObject; Source: TDragDockObject; X,Y: Integer; State: TDragState; var Accept: Boolean); + procedure ImagePalette1MouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + procedure ImagePalette1EndDrag(Sender, Target: TObject; X, Y: Integer); + procedure ImagePalette2EndDrag(Sender, Target: TObject; X, Y: Integer); + procedure ImagePalette2MouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + procedure ImagePalette3EndDrag(Sender, Target: TObject; X, Y: Integer); + procedure ImagePalette3MouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + procedure ImagePalette4EndDrag(Sender, Target: TObject; X, Y: Integer); + procedure ImagePalette4MouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + procedure ImagePaletteDroitEndDrag(Sender, Target: TObject; X, + Y: Integer); + procedure ImagePaletteDroitMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); + procedure ImageSupGEndDrag(Sender, Target: TObject; X, Y: Integer); + procedure ImageSupGMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + procedure ImageSupDEndDrag(Sender, Target: TObject; X, Y: Integer); + procedure ImageSupDMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + procedure ImageInfDEndDrag(Sender, Target: TObject; X, Y: Integer); + procedure ImageInfDMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + procedure ImageInfGMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + procedure ImageInfGEndDrag(Sender, Target: TObject; X, Y: Integer); + procedure ButtonSauveTCOClick(Sender: TObject); + procedure MenuCouperClick(Sender: TObject); + procedure ImageTCOMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + procedure ImageTCOMouseMove(Sender: TObject; Shift: TShiftState; X, + Y: Integer); + procedure ImageTCOMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + procedure EffaceCellule(Canvas : Tcanvas;x,y : integer; couleur : Tcolor;Mode : TPenMode); + procedure MenuCopierClick(Sender: TObject); + procedure MenuCollerClick(Sender: TObject); + procedure ButtonRedessineClick(Sender: TObject); + procedure Affiche_TCO; + procedure affiche_cellule(x,y : integer;mode : TPenMode); + procedure grille; + procedure EditAdrElementChange(Sender: TObject); + procedure EditTypeImageKeyPress(Sender: TObject; var Key: Char); + procedure Button1Click(Sender: TObject); + procedure Button2Click(Sender: TObject); + procedure Maj_TCO(Adresse : integer;etat : boolean); + procedure ImageDiag1EndDrag(Sender, Target: TObject; X, Y: Integer); + procedure ImageDiag1MouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + procedure ImageDiag2EndDrag(Sender, Target: TObject; X, Y: Integer); + procedure ImageDiag2MouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + private { Déclarations privées } public { Déclarations publiques } end; - + TTCO = array of array of record + BType : integer ; // 1= détecteur 2= aiguillage 3=bis 4=Buttoir + Adresse : integer ; // adresse du détecteur ou de l'aiguillage + BImage : integer ; // 0=rien 1=voie 2= + end; + +const + clGrille=$707070; + var + Fond,couleurAdresse : Tcolor; FormTCO: TFormTCO; - Forminit : boolean; - NbreCellX,NbreCellY,HtImageTCO,LargImageTCO,XclicCell,YclicCell : integer; + Forminit,sourisclic,SelectionAffichee,TamponAffecte : boolean; + NbreCellX,NbreCellY,HtImageTCO,LargImageTCO,XclicCell,YclicCell,XminiSel,YminiSel, + XmaxiSel,YmaxiSel,AncienXMiniSel,AncienXMaxiSel ,AncienYMiniSel,AncienYMaxiSel, LargeurCell,HauteurCell,Xclic,Yclic,XClicCellInserer,YClicCellInserer : integer; - tco : array[1..20,1..20] of Tbranche; + + TamponTCO,tco : TTco ; + TamponTCO_Org : record + x1,y1,x2,y2 : integer; + end; + rAncien : TRect; procedure construit_TCO; -procedure affiche_TCO; - + implementation {$R *.dfm} +procedure lire_fichier_tco; +var fichier : textfile; + s : string; + x,y,i,valeur,erreur : integer; -procedure grille; + function lit_ligne : string ; + var c : char; + begin + repeat + readln(fichier,s); + s:=uppercase(s); + //Affiche(s,clWhite); + if length(s)>0 then c:=s[1]; + until ((c<>'/') and (s<>'')) or eof(fichier) ; + lit_ligne:=s; + end; + +begin + try + assignFile(fichier,'tco.cfg'); + reset(fichier); + except + exit; + end; + + x:=1;y:=1;NbreCellX:=0;NbreCellY:=0; + + //Faire une passe pour lire la taille de la matrice + while not eof(fichier) do + begin + s:=lit_ligne; + if s[1]<>'/' then + begin + inc(NbreCellY); NbreCellX:=0; + repeat + i:=pos(')',s); + if i=0 then begin closefile(fichier);exit;end; + delete(s,1,i); + inc(NbreCellX); + until s=''; + end; + end; + reset(fichier); + setlength(tco,NbreCellX+1,NbreCellY+1); + setlength(Tampontco,NbreCellX+1,NbreCellY+1); + + // 2eme passe : lire le fichier + while not eof(fichier) do + begin + s:=lit_ligne; + if s[1]<>'/' then + begin + repeat + i:=pos('(',s); + if i=0 then begin closefile(fichier);exit;end; + delete(s,i,1); + + i:=pos(',',s); + if i=0 then begin closefile(fichier);exit;end; + val(copy(s,1,i-1),valeur,erreur);if erreur<>0 then begin closefile(fichier);exit;end; + tco[x,y].BType:=valeur; + delete(s,1,i); + + i:=pos(',',s); + if i=0 then begin closefile(fichier);exit;end; + val(copy(s,1,i-1),valeur,erreur);if erreur<>0 then begin closefile(fichier);exit;end; + tco[x,y].adresse:=valeur; + delete(s,1,i); + + i:=pos(')',s); + if i=0 then begin closefile(fichier);exit;end; + val(copy(s,1,i-1),valeur,erreur);if erreur<>0 then begin closefile(fichier);exit;end; + tco[x,y].Bimage:=valeur; + delete(s,1,i); + inc(x); + + until s=''; + end; + inc(y);x:=1; + end; + closefile(fichier); + Affiche('Dimensions du tco : '+intToSTR(NbreCellX)+'x'+intToSTR(NbreCellY),clyellow); + // adapter l'image au nombre de cellules + FormTCO.ImageTCO.Width:=NbreCellX*LargeurCell+2; + FormTCO.ImageTCO.Height:=NbreCellY*HauteurCell+2; +end; + +procedure sauve_fichier_tco; +var fichier : textfile; + s : string; + x,y,erreur : integer; +begin + AssignFile(fichier,'tco.cfg'); + rewrite(fichier); + writeln(fichier,'/type(0=rien 1=voie/détecteur 2=aig 3=aigBis , adresse , image=1 à 10 '); + writeln(fichier,'/Dalle TCO'); + for y:=1 to NbreCellY do + begin + s:=''; + for x:=1 to NbreCellX do + begin + s:=s+'('+IntToSTR(TCO[x,y].BType)+','+Format('%.*d',[3,TCO[x,y].Adresse])+','+IntToSTR(TCO[x,y].BImage)+')'; + end; + writeln(fichier,s); + end; + closefile(fichier); + Affiche('TCO sauvegardé',clyellow); +end; + + +procedure TformTCO.grille; var x,y : integer; r : Trect; begin HtImageTCO:=FormTCO.ImageTCO.Height; HtImageTCO:=FormTCO.ImageTCO.Height; LargImageTCO:=FormTCO.ImageTCO.Width; - - With FormTCO.ImageTCO.canvas do - begin - Brush.Style:=bsSolid; - Brush.Color:=clBlack; - pen.color:=clyellow; - r:=rect(1,1,LargImageTCO,HtImageTco); - FillRect(r); - - pen.color:=$707070; - for x:=1 to NbreCellx do + With ImageTCO.canvas do + begin + pen.color:=ClGrille; + for x:=1 to NbreCellX do begin moveto(x*LargeurCell,1); LineTo(x*LargeurCell,HtImageTCO); @@ -92,105 +321,128 @@ begin end; // élément de voie horizontale -procedure dessin_voie(x,y : integer); -var x1,y1 : integer; - r : Trect; -begin - with FormTCO.ImageTCO.Canvas do - begin - x1:=x*LargeurCell; - y1:=y*HauteurCell; - end; - with formTCO.ImageTCO.canvas do - begin - r:=Rect(x1,y1+(HauteurCell div 2)-3,x1+LargeurCell,y1 + (HauteurCell div 2)+3); - Brush.COlor:=ClRed; - FillRect(r); - end; -end; - -// aiguillage pointe à gauche, aiguillage gauche -procedure TFormTCO.dessin_AigPG_AG(x,y : integer;couleur : Tcolor); -var x0,y0,x1,y1,x2,y2,x3,y3,x4,y4,jy1,jy2 : integer; +procedure TFormTCO.dessin_voie(Canvas : Tcanvas;x,y : integer;couleur : TColor;Mode : TPenMode); +var Adr, x0,y0,x1,y1,x2,y2,x3,y3,x4,y4,jy1,jy2 : integer; r : Trect; + s : string; begin x0:=(x-1)*LargeurCell; y0:=(y-1)*HauteurCell; - with ImageTCO.canvas do + with canvas do begin - Brush.Color:=couleur; - pen.color:=couleur; - Pen.Mode:=PmCopy; - jy1:=y0+(HauteurCell div 2)-3; // pos Y de la bande sup - jy2:=y0+(HauteurCell div 2)+3; // pos Y de la bande inf - - - r:=Rect(x0,jy1,x0+LargeurCell,jy2); + Brush.Color:=Fond; + r:=Rect(x0,y0,x0+LargeurCell,y0+HauteurCell); FillRect(r); - //brush.color:=clblue; - x1:=x0+(largeurCell div 2); - y1:=jy1; + // bande blanche + if (x<=NbreCellX) and (y<=NbreCellY) then + begin + Adr:=TCO[x,y].Adresse; + if Detecteur[Adr] then + begin + Brush.Color:=clWhite; + pen.color:=couleur; + Pen.Mode:=Mode; + jy1:=y0+(HauteurCell div 2)-6; // pos Y de la bande sup + jy2:=y0+(HauteurCell div 2)+6; // pos Y de la bande inf + r:=Rect(x0,jy1,x0+LargeurCell,jy2); + FillRect(r); + end; + end; + + Brush.Color:=couleur; + pen.color:=couleur; + jy1:=y0+(HauteurCell div 2)-3; // pos Y de la bande sup + jy2:=y0+(HauteurCell div 2)+3; // pos Y de la bande inf + r:=Rect(x0,jy1,x0+LargeurCell,jy2); + FillRect(r); + end; +end; + +// élément 10 +procedure TformTCO.dessin_Diag1(Canvas : Tcanvas;x,y : integer;couleur : Tcolor;Mode : TPenMode); +var Adr, x0,y0,x1,y1,x2,y2,x3,y3,x4,y4,jy1,jy2 : integer; + r : Trect; + s : string; +begin + x0:=(x-1)*LargeurCell; + y0:=(y-1)*HauteurCell; + + with canvas do + begin + Brush.Color:=Fond; + r:=Rect(x0,y0,x0+LargeurCell,y0+HauteurCell); + FillRect(r); + + x1:=x0; + y1:=y0+hauteurCell-3; x2:=x0+largeurCell-3; y2:=y0; x3:=x0+largeurCell; - y3:=y0+3; - x4:=x0+(largeurCell div 2)+7; - y4:=jy1; - Polygon([point(x1,y1),Point(x2,y2),Point(x3+2,y3-2),Point(x4+2,y4-2)]); + y3:=y0+4; + x4:=x0+4; + y4:=y0+hauteurCell; + Brush.Color:=couleur; + pen.color:=couleur; + + PolyGon([point(x1,y1),point(x2,y2),point(x3,y3),point(x4,y4)]); end; -end; +end; -// aiguillage pointe à droite, aiguillage droit -procedure TFormTCO.dessin_AigPD_AD(x,y : integer;couleur : Tcolor); -var x0,y0,x1,y1,x2,y2,x3,y3,x4,y4,jy1,jy2 : integer; +// élément 11 +procedure TformTCO.dessin_Diag2(Canvas : Tcanvas;x,y : integer;couleur : Tcolor;Mode : TPenMode); +var Adr, x0,y0,x1,y1,x2,y2,x3,y3,x4,y4,jy1,jy2 : integer; r : Trect; + s : string; begin x0:=(x-1)*LargeurCell; y0:=(y-1)*HauteurCell; - with ImageTCO.canvas do + with canvas do begin - Brush.COlor:=couleur; - Pen.Mode:=PmCopy; - pen.color:=couleur; - - jy1:=y0+(HauteurCell div 2)-3; // pos Y de la bande sup - jy2:=y0+(HauteurCell div 2)+3; // pos Y de la bande inf - - - r:=Rect(x0,jy1,x0+LargeurCell,jy2); + Brush.Color:=Fond; + r:=Rect(x0,y0,x0+LargeurCell,y0+HauteurCell); FillRect(r); - //brush.color:=clblue; - x1:=x0+(largeurCell div 2); y1:=jy1; - x2:=x0+3; y2:=y0; - x3:=x0; y3:=y0+3; - x4:=x0+(largeurCell div 2); y4:=jy2; - Polygon([point(x1,y1),Point(x2,y2),Point(x3,y3),Point(x4-1,y4-1)]); + x1:=x0+3; + y1:=y0; + x2:=x0+largeurCell; + y2:=y0+HauteurCell-3; + x3:=x0+largeurCell-4; + y3:=y0+HauteurCell; + x4:=x0; + y4:=y0+4; + Brush.Color:=couleur; + pen.color:=couleur; + + PolyGon([point(x1,y1),point(x2,y2),point(x3,y3),point(x4,y4)]); end; -end; +end; // courbe bas gauche vers droit -procedure TFormTCO.dessin_cbgd(x,y : integer;couleur : Tcolor); +procedure TFormTCO.dessin_infG(Canvas : Tcanvas;x,y : integer;couleur : Tcolor;Mode : TPenMode); var jy1,jy2,x0,y0,i,x1,y1,x2,y2,x3,y3,x4,y4 : integer; r : Trect; begin x0:=(x-1)*LargeurCell; y0:=(y-1)*HauteurCell; - with ImageTCO.canvas do + with canvas do begin + Brush.Color:=Fond; + r:=Rect(x0,y0,x0+LargeurCell,y0+HauteurCell); + FillRect(r); + Brush.COlor:=Couleur; pen.color:=Couleur; - Pen.Mode:=PmCopy; - + Pen.Mode:=Mode; + jy1:=y0+(HauteurCell div 2)-3; // pos Y de la bande sup jy2:=y0+(HauteurCell div 2)+3; // pos Y de la bande inf - r:=Rect(x0+(largeurCell div 2),jy1,x0+LargeurCell,jy2); + r:=Rect(x0+(largeurCell div 2),jy1,x0+LargeurCell,jy2); FillRect(r); // brush.color:=clblue; @@ -203,22 +455,25 @@ begin x4:=x0+3; y4:=y0+HauteurCell; Polygon([point(x1-2,y1+2),Point(x2,y2),Point(x3,y3),Point(x4-2,y4+2)]); - end; end; // courbe: droit vers bas -\ -procedure TFormTCO.dessin_cdbas(x,y : integer;couleur : Tcolor); +procedure TFormTCO.dessin_infD(Canvas : Tcanvas;x,y : integer;couleur : Tcolor;Mode : TPenMode); var jy1,jy2,x0,y0,i,x1,y1,x2,y2,x3,y3,x4,y4 : integer; r : Trect; begin x0:=(x-1)*LargeurCell; y0:=(y-1)*HauteurCell; - with ImageTCO.canvas do + with canvas do begin + Brush.Color:=Fond; + r:=Rect(x0,y0,x0+LargeurCell,y0+HauteurCell); + FillRect(r); + Brush.COlor:=Couleur; - Pen.Mode:=PmCopy; + Pen.Mode:=Mode; pen.color:=Couleur; jy1:=y0+(HauteurCell div 2)-3; // pos Y de la bande sup @@ -236,10 +491,239 @@ begin x4:=x0+(LargeurCell div 2); y4:=jy2; Polygon([point(x1,y1),Point(x2,y2),Point(x3,y3),Point(x4,y4)]); + end; +end; + + +procedure TformTCO.dessin_SupD(Canvas : Tcanvas;x,y : integer; couleur : Tcolor;Mode : TPenMode); +var x0,y0,x1,y1,x2,y2,x3,y3,x4,y4,jy1,jy2 : integer; + r : Trect; +begin + x0:=(x-1)*LargeurCell; + y0:=(y-1)*HauteurCell; + with canvas do + begin + Brush.Color:=Fond; + r:=Rect(x0,y0,x0+LargeurCell,y0+HauteurCell); + FillRect(r); + + Brush.COlor:=Couleur; + pen.color:=Couleur; + Pen.Mode:=Mode; + + jy1:=y0+(HauteurCell div 2)-3; // pos Y de la bande sup + jy2:=y0+(HauteurCell div 2)+3; // pos Y de la bande inf + r:=Rect(x0,jy1,x0+(LargeurCell div 2),jy2); + FillRect(r); + + // brush.color:=clblue; + x1:=x0+(LargeurCell div 2); + y1:=jy1; + x2:=x0+LargeurCell-2; + y2:=y0; + x3:=x0+LargeurCell; + y3:=y0+2; + x4:=x0+(LargeurCell div 2); + y4:=jy2-2; + Polygon([point(x1-2,y1+2),Point(x2,y2),Point(x3,y3),Point(x4,y4)]); + end; +end; + +// coin supérieur gauche +procedure TformTCO.dessin_SupG(Canvas : Tcanvas;x,y : integer; couleur : Tcolor;Mode : TPenMode); +var x0,y0,x1,y1,x2,y2,x3,y3,x4,y4,jy1,jy2 : integer; + r : Trect; +begin + x0:=(x-1)*LargeurCell; + y0:=(y-1)*HauteurCell; + with canvas do + begin + Brush.Color:=Fond; + r:=Rect(x0,y0,x0+LargeurCell,y0+HauteurCell); + FillRect(r); + + Brush.COlor:=Couleur; + pen.color:=Couleur; + Pen.Mode:=Mode; + + jy1:=y0+(HauteurCell div 2)-3; // pos Y de la bande sup + jy2:=y0+(HauteurCell div 2)+3; // pos Y de la bande inf + r:=Rect(x0+(LargeurCell div 2),jy1,x0+LargeurCell,jy2); + FillRect(r); + + // brush.color:=clblue; + x1:=x0+(LargeurCell div 2); + y1:=jy2-2; + x2:=x0; + y2:=y0; + x3:=x0+3; + y3:=y0; + x4:=x0+(LargeurCell div 2); + y4:=jy1; + Polygon([point(x1,y1),Point(x2,y2),Point(x3,y3),Point(x4,y4)]); + end; +end; + +// aiguillage pointe à gauche, aiguillage gauche +procedure TFormTCO.dessin_AigPG_AG(Canvas : Tcanvas;x,y : integer;couleur : Tcolor;Mode : TPenMode); +var x0,y0,x1,y1,x2,y2,x3,y3,x4,y4,jy1,jy2 : integer; + r : Trect; + s : string; +begin + x0:=(x-1)*LargeurCell; + y0:=(y-1)*HauteurCell; + + with canvas do + begin + Brush.Color:=Fond; + r:=Rect(x0,y0,x0+LargeurCell,y0+HauteurCell); + FillRect(r); + + Brush.Color:=couleur; + pen.color:=couleur; + Pen.Mode:=Mode; + jy1:=y0+(HauteurCell div 2)-3; // pos Y de la bande sup + jy2:=y0+(HauteurCell div 2)+3; // pos Y de la bande inf + + r:=Rect(x0,jy1,x0+LargeurCell,jy2); + FillRect(r); + + //brush.color:=clblue; + x1:=x0+(largeurCell div 2); + y1:=jy1; + x2:=x0+largeurCell-3; + y2:=y0; + x3:=x0+largeurCell; + y3:=y0+3; + x4:=x0+(largeurCell div 2)+7; + y4:=jy1; + Polygon([point(x1,y1),Point(x2,y2),Point(x3+2,y3-2),Point(x4+2,y4-2)]); + end; +end; + + +// aiguillage pointe à droite, aiguillage droit +procedure TFormTCO.dessin_AigPD_AD(Canvas : Tcanvas;x,y : integer;couleur : Tcolor;Mode : TPenMode); +var x0,y0,x1,y1,x2,y2,x3,y3,x4,y4,jy1,jy2 : integer; + r : Trect; + s : string; +begin + x0:=(x-1)*LargeurCell; + y0:=(y-1)*HauteurCell; + + with canvas do + begin + Brush.Color:=Fond; + r:=Rect(x0,y0,x0+LargeurCell,y0+HauteurCell); + FillRect(r); + + Brush.COlor:=couleur; + Pen.Mode:=Mode; + pen.color:=couleur; + + jy1:=y0+(HauteurCell div 2)-3; // pos Y de la bande sup + jy2:=y0+(HauteurCell div 2)+3; // pos Y de la bande inf + + r:=Rect(x0,jy1,x0+LargeurCell,jy2); + //FillRect(r); + Rectangle(r); + //brush.color:=clblue; + x1:=x0+(largeurCell div 2); y1:=jy1; + x2:=x0+3; y2:=y0; + x3:=x0; y3:=y0+3; + x4:=x0+(largeurCell div 2); y4:=jy2-1; + Polygon([point(x1,y1),Point(x2,y2),Point(x3,y3),Point(x4-1,y4-1)]); + end; +end; + +procedure TformTCO.dessin_AigG_PD(canvas : Tcanvas;x,y : integer; couleur : Tcolor;Mode : TPenMode); +var x0,y0,x1,y1,x2,y2,x3,y3,x4,y4,jy1,jy2 : integer; + r : Trect; + s : string; +begin + x0:=(x-1)*LargeurCell; + y0:=(y-1)*HauteurCell; + + with canvas do + begin + Brush.Color:=Fond; + r:=Rect(x0,y0,x0+LargeurCell,y0+HauteurCell); + FillRect(r); + + Brush.COlor:=couleur; + Pen.Mode:=Mode; + pen.color:=couleur; + + // bande horizontale + jy1:=y0+(HauteurCell div 2)-3; // pos Y de la bande sup + jy2:=y0+(HauteurCell div 2)+3; // pos Y de la bande inf + r:=Rect(x0,jy1,x0+LargeurCell,jy2); + FillRect(r); + + // déviation + x1:=x0+(largeurCell div 2); y1:=jy1+1; + x2:=x0;y2:=y0+HauteurCell-2; + x3:=x0+1;y3:=y0+HauteurCell; + x4:=x1;y4:=jy2; + Polygon([point(x1,y1),Point(x2,y2),Point(x3,y3),Point(x4-1,y4-1)]); + end; +end; + + +procedure TformTCO.dessin_AigD_PG(Canvas : Tcanvas;x,y : integer; couleur : Tcolor;Mode : TPenMode); +var x0,y0,x1,y1,x2,y2,x3,y3,x4,y4,jy1,jy2 : integer; + r : Trect; + s : string; +begin + x0:=(x-1)*LargeurCell; + y0:=(y-1)*HauteurCell; + + with canvas do + begin + Brush.Color:=Fond; + r:=Rect(x0,y0,x0+LargeurCell,y0+HauteurCell); + FillRect(r); + + Brush.Color:=couleur; + Pen.Mode:=Mode; + pen.color:=couleur; + + // bande horizontale + jy1:=y0+(HauteurCell div 2)-3; // pos Y de la bande sup + jy2:=y0+(HauteurCell div 2)+3; // pos Y de la bande inf + r:=Rect(x0,jy1,x0+LargeurCell,jy2); + FillRect(r); + + // déviation + x1:=x0+(largeurCell div 2); y1:=jy1+1; + x2:=x0+largeurCell;y2:=y0+HauteurCell-2; + x3:=x0+largeurCell-3;y3:=y0+HauteurCell; + x4:=x0+(largeurCell div 2);y4:=jy2; + Polygon([point(x1,y1),Point(x2,y2),Point(x3,y3),Point(x4-1,y4-1)]); + end; end; +procedure TFormTCO.EffaceCellule(Canvas : Tcanvas;x,y : integer; couleur : Tcolor;Mode : TPenMode); +var x0,y0,x1,y1,x2,y2,x3,y3,x4,y4,jy1,jy2 : integer; + r : TRect; +begin + x0:=(x-1)*LargeurCell; + y0:=(y-1)*HauteurCell; + r:=Rect(x0,y0,x0+LargeurCell+1,y0+HauteurCell+1); + + with canvas do + begin + Pen.Mode:=mode; + Pen.color:=clLime; + Brush.Color:=Fond; + Brush.style:=bsSolid; + // rectangle(r); + fillRect(r); + end; +end; + // transforme les branches en TCO // à voir, trop compliqué. Il faudra dessiner son TCO soit meme procedure construit_TCO; @@ -247,7 +731,7 @@ var x,y,i,j,Max,indexMax : integer; begin // étape 0 Raz du TCO for y:=1 to 20 do - for x:=1 to 20 do + for x:=1 to 20 do begin TCO[x,y].Adresse:=0; TCO[x,y].Btype:=0; @@ -268,59 +752,95 @@ begin // stocker cette branche au milieu du TCO (en 5) for i:=1 to Max do begin - TCO[i,5].Adresse:=BrancheN[IndexMax,i].Adresse; + TCO[i,5].Adresse:=BrancheN[IndexMax,i].Adresse; TCO[i,5].Btype:=BrancheN[IndexMax,i].Btype; end; end; -procedure Affiche_TCO ; -var i,j,x,y,xOrg,Yorg,btype : integer; + +// affiche la cellule. x et y en cases +procedure TformTCO.affiche_cellule(x,y : integer;mode : TPenMode); +var Xorg,Yorg,i,btype,Bimage : integer; s : string; +begin + i:=tco[x,y].Adresse; + btype:=tco[x,y].Btype; + BImage:=tco[x,y].BImage; + Xorg:=(x-1)*LargeurCell; + Yorg:=(y-1)*HauteurCell; + s:=IntToSTR(i); + if Btype=2 then s:='A'+s; + if Btype=3 then s:='A'+s+'B'; + + case Bimage of + // ne pas passer la forme ds le paremètre canvas, çà ne s'afficherapas + 0 : effacecellule(ImageTCO.Canvas,x,y,Clyellow,Mode); + 1 : dessin_AigPD_AD(ImageTCO.Canvas,X,Y,Clyellow,Mode); + 2 : dessin_AigG_PD(ImageTCO.Canvas,X,Y,Clyellow,mode); + 3 : dessin_AigPG_AG(ImageTCO.Canvas,X,Y,Clyellow,mode); + 4 : dessin_AigD_PG(ImageTCO.Canvas,X,Y,Clyellow,Mode); + 5 : dessin_voie(ImageTCO.Canvas,X,Y,Clyellow,Mode); + 6 : dessin_SupG(ImageTCO.Canvas,X,Y,Clyellow,Mode); + 7 : dessin_SupD(ImageTCO.Canvas,X,Y,Clyellow,Mode); + 8 : dessin_infD(ImageTCO.Canvas,X,Y,Clyellow,Mode); + 9 : dessin_infG(ImageTCO.Canvas,X,Y,Clyellow,mode); + 10 : dessin_Diag1(ImageTCO.Canvas,X,Y,Clyellow,mode); + 11 : dessin_Diag2(ImageTCO.Canvas,X,Y,Clyellow,mode); + end; + if (BImage>=2) then + begin // Adresse de l'élément + ImageTCO.Canvas.Brush.Color:=fond; + ImageTCO.Canvas.Font.Color:=CouleurAdresse; + ImageTCO.Canvas.TextOut(xOrg+1,yOrg+1,s); + end; + if (BImage=1) then + begin // Adresse de l'élément + ImageTCO.Canvas.Brush.Color:=fond; + ImageTCO.Canvas.Font.Color:=CouleurAdresse; + ImageTCO.Canvas.TextOut(xOrg+1,yOrg+21,s); + end; +end; + +// affiche le tco suivant le tableau TCO +procedure TformTCO.Affiche_TCO ; +var x,y : integer; + s : string; + r : Trect; begin with formTCO.ImageTCO.Canvas do begin - Brush.color:=ClBlack; - font.color:=clWhite; + Brush.Style:=bsSolid; + Brush.Color:=fond; + pen.color:=clyellow; + r:=rect(1,1,NbreCellX*LargeurCell,NbreCelly*HauteurCell); + FillRect(r); end; - for y:=1 to 10 do - for x:=1 to 20 do + for y:=1 to NbreCellY do + for x:=1 to NbreCellX do begin - i:=tco[x,y].Adresse; - btype:=tco[x,y].Btype; - with formTCO.ImageTCO.Canvas do - begin - Xorg:=(x-1)*LargeurCell; - Yorg:=(y-1)*HauteurCell; - - s:=IntToSTR(i); - if Btype=2 then s:='A'+s; - if Btype=3 then s:='A'+s+'B'; - - if i<>0 then Textout(Xorg+2,Yorg+2,s); - end; - end; + affiche_cellule(x,y,PmCopy); + end; + grille; end; procedure TFormTCO.FormCreate(Sender: TObject); begin caption:='TCO'; - NbreCellX:=20; - NbreCellY:=10; LargeurCell:=35; HauteurCell:=35; + XclicCell:=1; YclicCell:=1; - KeyPreview:=true; // valide les évènements clavier - // grille; - // Entoure_cell(XclicCell,YclicCell); + KeyPreview:=false; // invalide les évènements clavier + fond:=$202050; + couleurAdresse:=Cyan; + xMiniSel:=999;yMiniSel:=999; + xMaxiSel:=0;yMaxiSel:=0; + SelectionAffichee:=false; end; -procedure TFormTCO.Button1Click(Sender: TObject); -begin - repaint; -end; // clic gauche sur image procedure TFormTCO.ImageTCOClick(Sender: TObject); @@ -328,23 +848,34 @@ var Position: TPoint; begin Entoure_cell(XclicCell,YclicCell); GetCursorPos(Position); - + Position:=ImageTCO.screenToCLient(Position); Xclic:=position.X;YClic:=position.Y; XclicCell:=Xclic div largeurCell +1; YclicCell:=Yclic div hauteurCell +1; + if XclicCell>NbreCellX then exit; + if YclicCell>NbreCellY then exit; + + LabelX.caption:=IntToSTR(XclicCell); LabelY.caption:=IntToSTR(YclicCell); - label1.caption:='clicContext'; XclicCellInserer:=XClicCell; YclicCellInserer:=YClicCell; Entoure_cell(XclicCellInserer,YclicCellInserer); + + EditAdrElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].Adresse); + EdittypeElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].BType); + EdittypeImage.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].BImage); + + //Affiche('XClicCell='+intToSTR(XclicCell)+' '+'YClicCell='+intToSTR(YclicCell),clyellow); + //Affiche('Evt ImageTCOclick',clYellow); end; procedure TformTCO.Entoure_cell(x,y : integer); var r : Trect; x0,y0 : integer; begin + exit; x0:=(x-1)*LargeurCell+1; y0:=(y-1)*HauteurCell+1; with ImageTCO.canvas do @@ -367,19 +898,22 @@ begin if not(Forminit) then begin FormInit:=true; - grille; - Entoure_cell(XclicCell,YclicCell); - end; - { - dessin_voie(3,3); - dessin_voie(10,4); - dessin_AigPG_AG(7,6,clyellow); - dessin_AigPD_AD(12,6,clyellow); + // dessiner les icônes + dessin_AigPD_AD(ImagePalette1.Canvas,1,1,clyellow,pmCopy); + dessin_AigG_PD(ImagePalette2.Canvas,1,1,clyellow,pmCopy); + dessin_AigPG_AG(ImagePalette3.Canvas,1,1,clyellow,pmCopy); + dessin_AigD_PG(ImagePalette4.Canvas,1,1,clyellow,pmCopy); + dessin_voie(ImagePaletteDroit.canvas,1,1,Clyellow,pmCopy); + dessin_SupG(ImageSupG.canvas,1,1,Clyellow,pmCopy); + dessin_SupD(ImageSupD.canvas,1,1,Clyellow,pmCopy); + dessin_InfD(ImageInfD.canvas,1,1,Clyellow,pmCopy); + dessin_infG(ImageInfG.canvas,1,1,Clyellow,pmCopy); + dessin_Diag1(ImageDiag1.Canvas,1,1,Clyellow,pmCopy); + dessin_Diag2(ImageDiag2.Canvas,1,1,Clyellow,pmCopy); + lire_fichier_tco; + Affiche_tco; + end; - dessin_cbgd(8,5,clyellow); - dessin_voie(9,5);dessin_voie(10,5); - dessin_cdbas(11,5,clyellow); } - //formprinc.Hide; end; // evt qui se produit quand on clic droit dans l'image @@ -389,52 +923,90 @@ begin // efface le carré pointeur Entoure_cell(XclicCell,YclicCell); GetCursorPos(Position); - + Position:=ImageTCO.screenToCLient(Position); Xclic:=position.X;YClic:=position.Y; XclicCell:=Xclic div largeurCell +1; YclicCell:=Yclic div hauteurCell +1; - LabelX.caption:=IntToSTR(XclicCell); + LabelX.caption:=IntToSTR(XclicCell); LabelY.caption:=IntToSTR(YclicCell); label1.caption:='clicContext'; XclicCellInserer:=XClicCell; YclicCellInserer:=YClicCell; Entoure_cell(XclicCellInserer,YclicCellInserer); + + //Affiche('XClicCell='+intToSTR(XclicCell)+' '+'YClicCell='+intToSTR(YclicCell),clyellow); end; // menu droit "clic aiguillage G PG" procedure TFormTCO.aiguillageG_PGClick(Sender: TObject); var Position: TPoint; begin - // effacer le carré pointeur + // effacer le carré pointeur Entoure_cell(XclicCell,YclicCell); - GetCursorPos(Position); // dessine le dessin - dessin_AigPG_AG(XClicCellInserer,YClicCellInserer,clyellow); + dessin_AigPG_AG(ImageTCO.canvas,XClicCellInserer,YClicCellInserer,clyellow,pmCopy); // remet le carré pointeur Entoure_cell(XclicCell,YclicCell); - GetCursorPos(Position); + + EditAdrElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].Adresse); + EdittypeElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].BType); + end; // menu droit "clic aiguillage D PD" procedure TFormTCO.aiguillageD_PDClick(Sender: TObject); var Position: TPoint; begin - // effacer le carré pointeur + // effacer le carré pointeur Entoure_cell(XclicCell,YclicCell); - GetCursorPos(Position); // dessine le dessin - dessin_AigPD_AD(XClicCellInserer,YClicCellInserer,clyellow); + dessin_AigPD_AD(ImageTCO.Canvas,XClicCellInserer,YClicCellInserer,clyellow,pmCopy); // remet le carré pointeur Entoure_cell(XclicCell,YclicCell); - GetCursorPos(Position); + + EditAdrElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].Adresse); + EdittypeElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].BType); + end; +procedure TFormTCO.Aiguillagegauchepointedroite1Click(Sender: TObject); +var Position: TPoint; +begin + // effacer le carré pointeur + Entoure_cell(XclicCell,YclicCell); + // dessine le dessin + dessin_AigG_PD(ImageTCO.canvas,XClicCellInserer,YClicCellInserer,clyellow,pmCopy); + // remet le carré pointeur + Entoure_cell(XclicCell,YclicCell); + + EditAdrElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].Adresse); + EdittypeElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].BType); + +end; + +procedure TFormTCO.Aiguillagedroitpointegauche1Click(Sender: TObject); +var Position: TPoint; +begin + tco[XClicCellInserer,YClicCellInserer].Adresse:=1; + tco[XClicCellInserer,YClicCellInserer].Btype:=1; + // effacer le carré pointeur + Entoure_cell(XclicCell,YclicCell); + // dessine le dessin + dessin_AigD_PG(ImageTCO.canvas,XClicCellInserer,YClicCellInserer,clyellow,pmCopy); + // remet le carré pointeur + Entoure_cell(XclicCell,YclicCell); + + EditAdrElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].Adresse); + EdittypeElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].BType); + +end; procedure TFormTCO.FormKeyDown(Sender: TObject; var Key: Word;Shift: TShiftState); begin - Entoure_cell(XclicCell,YclicCell); + exit; + Entoure_cell(XclicCell,YclicCell); case Key of VK_right : if XClicCell1 then dec(XClicCell); @@ -444,6 +1016,574 @@ begin LabelX.caption:=IntToSTR(XClicCell); LabelY.caption:=IntToSTR(YClicCell); Entoure_cell(XclicCell,YclicCell); + EditAdrElement.Text:=IntToSTR(tco[XClicCell,YClicCell].Adresse); + EdittypeElement.Text:=IntToSTR(tco[XClicCell,YClicCell].BType); + +end; + +procedure TFormTCO.Elmentdroit1Click(Sender: TObject); +var Position: TPoint; +begin + // effacer le carré pointeur + Entoure_cell(XclicCell,YclicCell); + // dessine le dessin + dessin_voie(ImageTCO.canvas,XClicCellInserer,YClicCellInserer,clyellow,pmCopy); + // remet le carré pointeur + Entoure_cell(XclicCell,YclicCell); + + EditAdrElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].Adresse); + EdittypeElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].BType); + +end; + +procedure TFormTCO.Courbegaucheversdroite1Click(Sender: TObject); +var Position: TPoint; +begin + // effacer le carré pointeur + Entoure_cell(XclicCell,YclicCell); + // dessine le dessin + dessin_infG(ImageTCO.canvas,XClicCellInserer,YClicCellInserer,clyellow,pmCopy); + // remet le carré pointeur + Entoure_cell(XclicCell,YclicCell); + GetCursorPos(Position); +end; + +procedure TFormTCO.Courbedroiteversgauche1Click(Sender: TObject); +var Position: TPoint; +begin + // effacer le carré pointeur + Entoure_cell(XclicCell,YclicCell); + // dessine le dessin + dessin_infD(ImageTCO.canvas,XClicCellInserer,YClicCellInserer,clyellow,pmCopy); + // remet le carré pointeur + Entoure_cell(XclicCell,YclicCell); + GetCursorPos(Position); +end; + + +procedure TFormTCO.CourbeSupD1Click(Sender: TObject); +var Position: TPoint; +begin + // effacer le carré pointeur + Entoure_cell(XclicCell,YclicCell); + // dessine le dessin + dessin_SupD(ImageTCO.canvas,XClicCellInserer,YClicCellInserer,clyellow,pmCopy); + // remet le carré pointeur + Entoure_cell(XclicCell,YclicCell); + GetCursorPos(Position); +end; + +procedure TFormTCO.CourbeSupG1Click(Sender: TObject); +var Position: TPoint; +begin + // effacer le carré pointeur + Entoure_cell(XclicCell,YclicCell); + // dessine le dessin + dessin_SupG(ImageTCO.canvas,XClicCellInserer,YClicCellInserer,clyellow,pmCopy); + // remet le carré pointeur + Entoure_cell(XclicCell,YclicCell); + GetCursorPos(Position); + +end; + +procedure TFormTCO.ImageTCODragOver(Sender, Source: TObject; X, Y: Integer; + State: TDragState; var Accept: Boolean); +begin + Accept:=source is TImage; +end; + + + +procedure TFormTCO.FormDockOver(Sender: TObject; Source: TDragDockObject; + X, Y: Integer; State: TDragState; var Accept: Boolean); +begin + accept:=true; +end; + +procedure TFormTCO.ImagePalette1MouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin + ImagePalette1.BeginDrag(true); +end; + +procedure TFormTCO.ImagePalette1EndDrag(Sender, Target: TObject; X, + Y: Integer); +begin + if (x=0) and (y=0) then exit; + Xclic:=X;YClic:=Y; + XclicCell:=Xclic div largeurCell +1; + YclicCell:=Yclic div hauteurCell +1; + dessin_AigPD_AD(ImageTCO.Canvas,XClicCell,YClicCell,Clyellow,pmCopy); + tco[XClicCell,YClicCell].BType:=2; // aiguillage + tco[XClicCell,YClicCell].BImage:=1; // image 1 + + EditAdrElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Adresse); + EdittypeElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Btype); + EdittypeImage.Text:=IntToSTR(tco[XClicCell,YClicCell].BImage); +end; + + + +procedure TFormTCO.ImagePalette2EndDrag(Sender, Target: TObject; X, + Y: Integer); +begin + if (x=0) and (y=0) then exit; + Xclic:=X;YClic:=Y; + XclicCell:=Xclic div largeurCell +1; + YclicCell:=Yclic div hauteurCell +1; + dessin_AigG_PD(ImageTCO.Canvas,XClicCell,YClicCell,Clyellow,pmCopy); + tco[XClicCell,YClicCell].BType:=2; // aiguillage + tco[XClicCell,YClicCell].BImage:=2; // image 2 + + EditAdrElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Adresse); + EdittypeElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Btype); + EdittypeImage.Text:=IntToSTR(tco[XClicCell,YClicCell].BImage); +end; + +procedure TFormTCO.ImagePalette2MouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin + ImagePalette2.BeginDrag(true); +end; + +procedure TFormTCO.ImagePalette3EndDrag(Sender, Target: TObject; X,Y: Integer); +begin + if (x=0) and (y=0) then exit; + Xclic:=X;YClic:=Y; + XclicCell:=Xclic div largeurCell +1; + YclicCell:=Yclic div hauteurCell +1; + dessin_AigPG_AG(ImageTCO.Canvas,XClicCell,YClicCell,Clyellow,pmCopy); + tco[XClicCell,YClicCell].BType:=2; // aiguillage + tco[XClicCell,YClicCell].BImage:=3; // image 3 + + EditAdrElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Adresse); + EdittypeElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Btype); + EdittypeImage.Text:=IntToSTR(tco[XClicCell,YClicCell].BImage); +end; + +procedure TFormTCO.ImagePalette3MouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin + ImagePalette3.BeginDrag(true); +end; + +procedure TFormTCO.ImagePalette4EndDrag(Sender, Target: TObject; X,Y: Integer); +begin + if (x=0) and (y=0) then exit; + Xclic:=X;YClic:=Y; + XclicCell:=Xclic div largeurCell +1; + YclicCell:=Yclic div hauteurCell +1; + dessin_AigD_PG(ImageTCO.Canvas,XClicCell,YClicCell,Clyellow,pmCopy); + tco[XClicCell,YClicCell].BType:=2; // aiguillage + tco[XClicCell,YClicCell].BImage:=4; // image 4 + + EditAdrElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Adresse); + EdittypeElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Btype); + EdittypeImage.Text:=IntToSTR(tco[XClicCell,YClicCell].BImage); +end; + +procedure TFormTCO.ImagePalette4MouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin + ImagePalette4.BeginDrag(true); +end; + +procedure TFormTCO.ImagePaletteDroitEndDrag(Sender, Target: TObject; X, + Y: Integer); +begin + if (x=0) and (y=0) then exit; + Xclic:=X;YClic:=Y; + XclicCell:=Xclic div largeurCell +1; + YclicCell:=Yclic div hauteurCell +1; + dessin_voie(ImageTCO.Canvas,XClicCell,YClicCell,Clyellow,pmCopy); + tco[XClicCell,YClicCell].BType:=1; // voie + tco[XClicCell,YClicCell].BImage:=5; // image 5 + tco[XClicCell,YClicCell].Adresse:=0; + + EditAdrElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Adresse); + EdittypeElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Btype); + EdittypeImage.Text:=IntToSTR(tco[XClicCell,YClicCell].BImage); +end; + +procedure TFormTCO.ImagePaletteDroitMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin + ImagePaletteDroit.BeginDrag(true); +end; + +procedure TFormTCO.ImageSupGEndDrag(Sender, Target: TObject; X,Y: Integer); +begin + if (x=0) and (y=0) then exit; + Xclic:=X;YClic:=Y; + XclicCell:=Xclic div largeurCell +1; + YclicCell:=Yclic div hauteurCell +1; + dessin_SupG(ImageTCO.Canvas,XClicCell,YClicCell,Clyellow,pmCopy); + tco[XClicCell,YClicCell].BType:=0; // rien + tco[XClicCell,YClicCell].BImage:=6; // image 6 + tco[XClicCell,YClicCell].Adresse:=0; + + EditAdrElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Adresse); + EdittypeElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Btype); + EdittypeImage.Text:=IntToSTR(tco[XClicCell,YClicCell].BImage); +end; + +procedure TFormTCO.ImageSupGMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin + ImageSupG.BeginDrag(true); +end; + +procedure TFormTCO.ImageSupDEndDrag(Sender, Target: TObject; X, + Y: Integer); +begin + if (x=0) and (y=0) then exit; + Xclic:=X;YClic:=Y; + XclicCell:=Xclic div largeurCell +1; + YclicCell:=Yclic div hauteurCell +1; + dessin_SupD(ImageTCO.Canvas,XClicCell,YClicCell,Clyellow,pmCopy); + tco[XClicCell,YClicCell].BType:=0; // rien + tco[XClicCell,YClicCell].BImage:=7; // image 7 + tco[XClicCell,YClicCell].Adresse:=0; + + EditAdrElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Adresse); + EdittypeElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Btype); + EdittypeImage.Text:=IntToSTR(tco[XClicCell,YClicCell].BImage); +end; + +procedure TFormTCO.ImageSupDMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin + ImageSupD.BeginDrag(true); +end; + +procedure TFormTCO.ImageInfDEndDrag(Sender, Target: TObject; X, + Y: Integer); +begin + if (x=0) and (y=0) then exit; + Xclic:=X;YClic:=Y; + XclicCell:=Xclic div largeurCell +1; + YclicCell:=Yclic div hauteurCell +1; + dessin_infD(ImageTCO.Canvas,XClicCell,YClicCell,Clyellow,pmCopy); + tco[XClicCell,YClicCell].BType:=0; // rien + tco[XClicCell,YClicCell].BImage:=8; // image 8 + tco[XClicCell,YClicCell].Adresse:=0; + + EditAdrElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Adresse); + EdittypeElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Btype); + EdittypeImage.Text:=IntToSTR(tco[XClicCell,YClicCell].BImage); +end; + +procedure TFormTCO.ImageInfDMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin + ImageInfD.BeginDrag(true); +end; + +procedure TFormTCO.ImageInfGMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin + ImageInfG.BeginDrag(true); +end; + +procedure TFormTCO.ImageInfGEndDrag(Sender, Target: TObject; X, + Y: Integer); +begin + if (x=0) and (y=0) then exit; + Xclic:=X;YClic:=Y; + XclicCell:=Xclic div largeurCell +1; + YclicCell:=Yclic div hauteurCell +1; + dessin_infG(ImageTCO.Canvas,XClicCell,YClicCell,Clyellow,pmCopy); + tco[XClicCell,YClicCell].BType:=0; // rien + tco[XClicCell,YClicCell].BImage:=9; // image 9 + tco[XClicCell,YClicCell].Adresse:=0; // rien + + EditAdrElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Adresse); + EdittypeElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Btype); + EdittypeImage.Text:=IntToSTR(tco[XClicCell,YClicCell].BImage); +end; + +procedure TFormTCO.ButtonSauveTCOClick(Sender: TObject); +begin + sauve_fichier_tco; +end; + +procedure copier; +var x,y : integer; +begin + if SelectionAffichee then + begin + TamponTCO_Org.x1:=XminiSel div LargeurCell +1; + TamponTCO_Org.x2:=XmaxiSel div LargeurCell +1; + TamponTCO_Org.y1:=yminiSel div LargeurCell +1; + TamponTCO_Org.y2:=ymaxiSel div LargeurCell +1; + + + + for y:=TamponTCO_Org.y1 to TamponTCO_Org.y2 do + for x:=TamponTCO_Org.x1 to TamponTCO_Org.x2 do + tamponTCO[x,y]:=tco[x,y]; + TamponAffecte:=true; + end; + +end; + +// supprimer la sélection +procedure TFormTCO.MenuCouperClick(Sender: TObject); +var Position: TPoint; + r : Trect; + x0,y0,x,y,XCell1,YCell1,xCell2,yCell2 : integer; +begin + if not(SelectionAffichee) then exit; + + copier; + + SelectionAffichee:=false; + + xCell1:=XminiSel div LargeurCell +1; + xCell2:=XmaxiSel div LargeurCell +1; + yCell1:=yminiSel div LargeurCell +1; + yCell2:=ymaxiSel div LargeurCell +1; + + for y:=yCell1 to yCell2 do + for x:=xCell1 to xCell2 do + begin + tco[x,y].BType:=0; + tco[x,y].Adresse:=0; + tco[x,y].BImage:=0; + effacecellule(ImageTCO.Canvas,X,Y,Clyellow,PmCopy); + end; + +end; + +procedure TFormTCO.ImageTCOMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); +begin + if button=mbLeft then + begin + xMiniSel:=999;yMiniSel:=999; + xMaxiSel:=0;yMaxiSel:=0; + sourisclic:=true; + + if SelectionAffichee then + begin + with imageTCO.Canvas do + begin + Pen.Mode:=PmXor; + Pen.color:=clGrille; + Brush.Color:=clblue; + //FillRect(r); + Rectangle(rAncien); + end; + SelectionAffichee:=false; + end; + + end; + + +end; + +procedure TFormTCO.ImageTCOMouseMove(Sender: TObject; Shift: TShiftState;X, Y: Integer); +var Position: TPoint; + r : Trect; + x0,y0,XSel1,YSel1,XSel2,YSel2 : integer; +begin + //Affiche('MouseMove',clyellow); + if not(sourisclic) then exit; + //Affiche('MouseMove',clyellow); + GetCursorPos(Position); + Position:=ImageTCO.screenToCLient(Position); + Xclic:=position.X; + YClic:=position.Y; + + // coordonnées grilleg + XclicCell:=Xclic div largeurCell + 1; + YclicCell:=Yclic div hauteurCell + 1; + + if XclicCell>NbreCellX then exit; + if YclicCell>NbreCellY then exit; + + //Affiche('X='+IntToSTR(XClicCell)+' Y='+intToSTR(YclicCell),clyellow); + + x0:=(XclicCell-1)*LargeurCell; + y0:=(YclicCell-1)*HauteurCell; + //Affiche('X0='+IntToSTR(x0)+' Y0='+intToSTR(y0),clyellow); + + AncienXMiniSel:=xMiniSel; + AncienYMiniSel:=YminiSel; + AncienXmaxiSel:=XmaxiSel; + AncienYMaxiSel:=YmaxiSel; + + if xMiniSel>x0 then XminiSel:=X0; + if yMiniSel>y0 then yminiSel:=y0; + if xMaxiSel0) or (Adr<0) or (Adr>2048) then + begin + EditAdrElement.text:=intToSTR(tco[XClicCell,YClicCell].Adresse); + exit; + end; + tco[XClicCell,YClicCell].Adresse:=Adr; + affiche_cellule(XClicCell,YClicCell,pmCopy); +end; + + +procedure TFormTCO.EditTypeImageKeyPress(Sender: TObject; var Key: Char); +var Bimage,erreur : integer; +begin + if ord(Key) = VK_RETURN then + begin + Key := #0; // prevent beeping + Val(EditTypeImage.Text,Bimage,erreur); + Affiche(IntToSTR(bimage),clyellow); + if (erreur<>0) or (Bimage<0) or (Bimage>9) then + begin + EditTypeElement.text:=intToSTR(tco[XClicCell,YClicCell].Btype); + exit; + end; + tco[XClicCell,YClicCell].Bimage:=Bimage; + affiche_cellule(XClicCell,YClicCell,pmCopy); + end; +end; + +procedure TFormTCO.Maj_TCO(Adresse : integer;etat : boolean); +var x,y : integer; +begin + for y:=1 to NbreCellY do + for x:=1 to NbreCellX do + begin + if tco[x,y].Adresse=Adresse then + affiche_cellule(x,y,PmCopy); + end; +end; + +procedure TFormTCO.Button1Click(Sender: TObject); +begin + Detecteur[513]:=true; + Maj_tco(513,true); +end; + +procedure TFormTCO.Button2Click(Sender: TObject); +begin + Detecteur[513]:=false; + Maj_tco(513,false); +end; + + + +procedure TFormTCO.ImageDiag1EndDrag(Sender, Target: TObject; X, Y: Integer); +begin + if (x=0) and (y=0) then exit; + Xclic:=X;YClic:=Y; + XclicCell:=Xclic div largeurCell +1; + YclicCell:=Yclic div hauteurCell +1; + dessin_Diag1(ImageTCO.Canvas,XClicCell,YClicCell,Clyellow,pmCopy); + tco[XClicCell,YClicCell].BType:=0; // rien + tco[XClicCell,YClicCell].BImage:=10; // image 10 + tco[XClicCell,YClicCell].Adresse:=0; + + EditAdrElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Adresse); + EdittypeElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Btype); + EdittypeImage.Text:=IntToSTR(tco[XClicCell,YClicCell].BImage); +end; + +procedure TFormTCO.ImageDiag1MouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin + ImageDiag1.BeginDrag(true); +end; + +procedure TFormTCO.ImageDiag2EndDrag(Sender, Target: TObject; X, + Y: Integer); +begin + if (x=0) and (y=0) then exit; + Xclic:=X;YClic:=Y; + XclicCell:=Xclic div largeurCell +1; + YclicCell:=Yclic div hauteurCell +1; + dessin_Diag2(ImageTCO.Canvas,XClicCell,YClicCell,Clyellow,pmCopy); + tco[XClicCell,YClicCell].BType:=0; // rien + tco[XClicCell,YClicCell].BImage:=11; + tco[XClicCell,YClicCell].Adresse:=0; + + EditAdrElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Adresse); + EdittypeElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Btype); + EdittypeImage.Text:=IntToSTR(tco[XClicCell,YClicCell].BImage); +end; + +procedure TFormTCO.ImageDiag2MouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin + ImageDiag2.BeginDrag(true); end; end. diff --git a/configcapde.cfg b/configcapde.cfg deleted file mode 100644 index 15fd99f..0000000 --- a/configcapde.cfg +++ /dev/null @@ -1,112 +0,0 @@ -/****************************************** -/ fichier de configuration de signaux complexes -/ cap de bouheyre avec signaux - 2018 -/**************************************** -/ Sans Log=0 / Avec Log=1 : génère un fichier log -Log=0 -/ Affichage du débug du calcul des routes, et enregistrement dans le log si la variable précédente est à 1 -TraceDet=0 -/ si 1 envoie un 0 après le pilotage des décodeurs LEB -RazSignaux=0 -/ -/ modélisation des aiguillages : détermine les éléments connectés aux 3 branches des aiguilles (Pointe, Droit, Dévié (S) -/ adresse d'aiguillage[B],P=élément vers pointe D=élément vers Droit, S=élément vers dévié -/ B pour adresse d'aiguillage déja utilisée -/ Elément = détecteur (valeur uniquement numérique) ou aiguillage (adresse [TRI,TJS,TJD]+branche de connexion (P S ou D) -/ Exemples : 1,P518,D523,S3P signifie : définition de l'aiguillage @1 : sur pointe relié au détecteur 518 -/ sur Droit relié au détecteur 518 -/ sur Dévié, relié à l'aiguillage 3 en pointe -/ Voir la documentation des signaux complexes pour une description complete -/ S'il n'y a pas de détecteur connecté à une branche d'aiguillage, mettre 0. -1,P2P,D3P,S1BS -1B,P553,D16P,S1S -2,P1P,D4P,S2BS -2B,P521,D16D,S2S -3,P1D,D522,S5BP -4,P2D,D554,S6BP -5,P9P,S15P,D5BS -5B,P3S,S5D,D545 -6,P10P,S546,D6BS -6B,P4S,D545,S6D -7,P15S,D566,S565 -8,P20P,D566,S565 -9,P5P,D530,S17P -10,P6P,D530,S18P -13,P17S,D563,S564 -14,P18S,D563,S564 -15,P5S,D546,S7P -16,P1BD,S16BS,D2BD -16B,P0,S16S,D557 -17,P9S,D531,S13P -18,P10S,D562,S14P -20,P8P,D547,S0 -21,P25P,S537,D23S -22,P24P,S561,D25S -23,P569,S21D,D538 -24,P22P,S26P,D513 -25,P21P,S22D,D570 -26,P24S,S515,D514 -28,P30P,S29P,D570 -29,P28S,D516,S31P -30,P28P,D32S,S539 -31TRI,27,P28S,D518,S0,S2-517 -32,P571,D538,S30D -0 -// -/ modélisation du réseau par branche -/ 1 ligne par branche - le sens de parcours de la description n'a pas d'importance. -/ Chaque ligne (branche) doit comporter au moins un détecteur et au moins aiguillage -/ @ détecteur A=@aiguillage -/ chaque ligne doit commencer par un aiguillage et se terminer par un aiguillage -/ Terminer par les brances par 0 -/ Exemple : 519 est un détecteur - A2 est l'aiguillage 2 - A1B est l'aiguillage 1bis -/ -/ rouge - jaune -A20,547,561,A22,A24,A26,515,518,A31,A29,A28,A30,539,522,A3,A1,A2,A4,A6B,545,A5B,A3 -A26,514,517,A31 -A26,515,518,A31 -A24,513,516,A29 -/grande boucle extérieure départ de couche rouge: de 569 à 569 -A23,538,A32,571,553,A1B,A16,A2B,521,569,A23 -/ grande boucle intérieure -A21,A25,570,A28 -A4,554,537,A21 -/ couche jaune -A10,530,A9,A5,A15,546,A6 -A18,562,531,A17 -A14,563,A13 -A14,564,A13 -/ -A7,565,A8 -A7,566,A8 -A16B,557,0 -0 -/ -/ liste des signaux -/ la liste doit être terminée par une adresse à 0 -/ forme : 2=2 feux(carré violet/blanc) / 3=3 feux / 4=4 feux (carré) / 5=5 feux (carré + blanc) -/ 7=7 feux (carré+blanc + ralentissement / 9=9 feux (blanc ou violet + rappel ralentissement) -/ type de décodeur : 0=feu virtuel 1=digital Bahn 2=CDF 3=LDT 4=LEB -/ l'énumération des détecteurs ne nécessite pas de parenthèses si il est seul, mais il faut des parenthèses si -/ le signal concerne plusieurs voies (donc détecteurs) -/ Notation de chaque ligne: -/ adresse de base du signal, forme, réserve, type de décodeur [, (détecteur,..detecteur , élément suivant ..) , -/ avec ou sans demande de verrouillage du feu au carré (0 ou 1)] -161,4,0,4,(538,A32),0 -169,9,0,4,(539,A30),0, -177,9,0,4,(569,A23),0 -185,4,0,4,(570,A25),0 -193,4,0,4,(516,A29),0 -201,2,0,4,(517,31TRI,518,31TRI),0 -209,9,0,4,(561,547),0 -217,2,0,4,(514,A26,515,A26),0 -225,9,0,4,(516,A29),0 -233,4,0,4,(547,A20),0 -1001,3,0,0,(537,554),0 -1003,3,0,0,(553,A1B),0 -1005,3,0,0,(571,553),0 -1007,3,0,0,(554,A4),0 -1009,3,0,0,(522,539),0 -1011,3,0,0,(521,569),0 -1013,3,0,0,(565,A7),0 -0 diff --git a/tco.cfg b/tco.cfg new file mode 100644 index 0000000..0333397 --- /dev/null +++ b/tco.cfg @@ -0,0 +1,12 @@ +/type(0=rien 1=voie/détecteur 2=aig 3=aigBis , adresse , image=1 à 10 +/Dalle TCO +(2,123,1)(2,100,1)(1,513,5)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0) +(2,124,2)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0) +(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,8)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0) +(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,9)(1,000,5)(2,000,1)(1,000,5)(0,000,8)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0) +(2,007,0)(1,520,0)(2,020,0)(2,021,0)(2,028,0)(2,026,0)(0,000,10)(2,027,0)(2,025,0)(2,031,0)(1,534,0)(2,023,0)(0,000,11)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0) +(0,000,0)(0,000,0)(0,000,0)(0,000,0)(1,000,5)(2,000,3)(1,000,5)(1,000,5)(1,000,5)(1,000,5)(1,000,5)(1,000,5)(1,000,5)(2,000,1)(1,000,5)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0) +(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0) +(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0) +(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0) +(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0)(0,000,0) diff --git a/verif_version.dcu b/verif_version.dcu index ce95b77..bdccaf4 100644 Binary files a/verif_version.dcu and b/verif_version.dcu differ diff --git a/verif_version.pas b/verif_version.pas index 96516c1..443f5d3 100644 --- a/verif_version.pas +++ b/verif_version.pas @@ -22,7 +22,7 @@ var FormVersion: TFormVersion; Lance_verif : integer; -Const Version='1.3'; //Version='1.2';// sert à la comparaison de la version publiée +Const Version='1.31'; //Version='1.2';// sert à la comparaison de la version publiée implementation @@ -105,7 +105,8 @@ var s,s2,s3,Version_p,Url,LocalFile : string; V_publie,V_utile : real; begin //Affiche('vérifie version',clLime); - Url:='http://cdmrail.free.fr/ForumCDR/viewtopic.php?f=77&t=3906#p50499'; + // exit ;//&&&&&&&&&&&&&&&&&& + Url:='http://cdmrail.free.fr/ForumCDR/viewtopic.php?f=77&t=3906#p50499'; LocalFile:='page.txt'; trouve_version:=false; trouve_zip:=false; diff --git a/versions.txt b/versions.txt new file mode 100644 index 0000000..bed3b76 --- /dev/null +++ b/versions.txt @@ -0,0 +1,13 @@ +Version 1.0 : première version +Version 1.01 : gestion des trajectoires vers les buttoirs +Version 1.02 : vérification automatique des versions +Version 1.1 : gestion des tableaux indicateurs de direction + gestion du décodeur de signaux Unisemaf Paco (expérimental) + changement dynamique des feux en cliquant sur son image +Version 1.11 : compatibilité pour la rétrosignalisation XpressNet tiers (genli) + verrouillages routes pour trains consécutifs +Version 1.2 : Renforcement de l'algorithme de suivi des trains +Version 1.3 : Décodeur Unisemaf fonctionnel - Lecture/écriture des CV + Protocoles variables de l'interface + Configuration statique modifiable dans menu +Version 1.31 : Correction gestion aiguillage triple