diff --git a/UnitConfig.dcu b/UnitConfig.dcu index f7cddae..381caab 100644 Binary files a/UnitConfig.dcu and b/UnitConfig.dcu differ diff --git a/UnitConfig.pas b/UnitConfig.pas index be8a637..118095a 100644 --- a/UnitConfig.pas +++ b/UnitConfig.pas @@ -166,6 +166,7 @@ begin IpOk:=n=3; end; +// vérifie si ma config de la com série/usb est ok function config_com(s : string) : boolean; var sa : string; j,i,erreur : integer; @@ -201,7 +202,7 @@ begin i:=pos(':',sa); val(copy(sa,4,i-1),Numport,erreur); - config_com:=not( (NumPort>9) or (protocole=-1) or (protocole>4) or (i=0) ); + config_com:=not( (copy(sa,1,3)<>'COM') or (NumPort>9) or (protocole=-1) or (protocole>4) or (i=0) ); end; procedure TFormConfig.Button1Click(Sender: TObject); diff --git a/UnitDebug.dcu b/UnitDebug.dcu index 98a2f5b..6194ad7 100644 Binary files a/UnitDebug.dcu and b/UnitDebug.dcu differ diff --git a/UnitDebug.dfm b/UnitDebug.dfm index 47a1ad4..bff58ab 100644 --- a/UnitDebug.dfm +++ b/UnitDebug.dfm @@ -1,11 +1,11 @@ object FormDebug: TFormDebug - Left = 260 - Top = 148 + Left = 217 + Top = 167 BorderStyle = bsSingle Caption = 'Fen'#234'tre de d'#233'bug' ClientHeight = 639 ClientWidth = 789 - Color = clWhite + Color = clWindow TransparentColorValue = clTeal Font.Charset = DEFAULT_CHARSET Font.Color = clWhite @@ -19,8 +19,8 @@ object FormDebug: TFormDebug PixelsPerInch = 96 TextHeight = 13 object Label1: TLabel - Left = 464 - Top = 28 + Left = 616 + Top = 15 Width = 108 Height = 13 Caption = 'Niveau du Debug (0-3)' @@ -35,7 +35,7 @@ object FormDebug: TFormDebug end object Label2: TLabel Left = 448 - Top = 4 + Top = 12 Width = 131 Height = 18 Caption = 'Fen'#234'tre de d'#233'bug' @@ -64,9 +64,9 @@ object FormDebug: TFormDebug WordWrap = True end object EditNivDebug: TEdit - Left = 592 - Top = 20 - Width = 73 + Left = 728 + Top = 12 + Width = 49 Height = 21 Font.Charset = DEFAULT_CHARSET Font.Color = clBlue @@ -223,25 +223,23 @@ object FormDebug: TFormDebug Top = 64 Width = 257 Height = 17 - Caption = 'Affichage des actionneurs' - Color = clWhite + Caption = 'Affichage des '#233'v'#232'vements actionneurs' Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] - ParentColor = False ParentFont = False TabOrder = 13 OnClick = CheckBoxActClick end object SaveDialog: TSaveDialog - Left = 680 - Top = 8 + Left = 760 + Top = 56 end object PopupMenuRE: TPopupMenu - Left = 752 - Top = 16 + Left = 760 + Top = 80 object copier1: TMenuItem Caption = 'copier' OnClick = copier1Click diff --git a/UnitDebug.pas b/UnitDebug.pas index 51ae8da..af0269d 100644 --- a/UnitDebug.pas +++ b/UnitDebug.pas @@ -63,10 +63,12 @@ var 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 ; + detecteur : integer ; + Aiguillage : integer ; + actionneur : integer; + etat : integer ; // état du détecteur de l'aiguillage ou de l'actionneur //train : integer ; - suivant : integer ; // d'ou vient le train + //suivant : integer ; // d'ou vient le train traite : boolean; // traité lors de a recherche d'une route end; @@ -208,9 +210,10 @@ begin for i:=1 to N_Event_tick do begin - for j:=1 to 1100 do + //for j:=1 to 1100 do begin - etat:=event_det_tick[i].detecteur[j]; + j:=event_det_tick[i].detecteur; + etat:=event_det_tick[i].etat; if etat<>-1 then begin s:=IntToSTR(i)+' Tick='+IntToSTR(event_det_tick[i].tick)+' Det='+IntToSTR(j)+'='+intToSTR(etat); @@ -221,7 +224,7 @@ begin 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); + s:=IntToSTR(i)+' Tick='+IntToSTR(event_det_tick[i].tick)+' Aig='+IntToSTR(etat)+'='+intToSTR(event_det_tick[i].etat); AfficheDebug(s,clyellow); end; end; diff --git a/UnitPilote.dcu b/UnitPilote.dcu index f6a417c..75124cd 100644 Binary files a/UnitPilote.dcu and b/UnitPilote.dcu differ diff --git a/UnitPrinc.dcu b/UnitPrinc.dcu index 89d6321..2b6d359 100644 Binary files a/UnitPrinc.dcu and b/UnitPrinc.dcu differ diff --git a/UnitPrinc.dfm b/UnitPrinc.dfm index 487841d..69b5ea2 100644 --- a/UnitPrinc.dfm +++ b/UnitPrinc.dfm @@ -1,6 +1,6 @@ object FormPrinc: TFormPrinc - Left = 84 - Top = 109 + Left = 25 + Top = 101 AutoSize = True BorderStyle = bsSingle Caption = 'Client TCP-IP CDM Rail ou USB - syst'#232'me LENZ' diff --git a/UnitPrinc.pas b/UnitPrinc.pas index 56599a8..2eb7bb8 100644 --- a/UnitPrinc.pas +++ b/UnitPrinc.pas @@ -3581,6 +3581,7 @@ begin delete(s,1,k); //Affiche('s='+s,clyellow); feux[i].VerrouCarre:=s[1]='1'; + delete(s,1,1); // si décodeur UniSemaf (6) champ supplémentaire if Feux[i].decodeur=6 then begin @@ -5036,11 +5037,9 @@ begin if i<2 then exit; Affiche('test si seq 010 sur det '+intToSTR(Adresse),clyellow); etat0_seq1:=false; etat1_seq2:=false; etat0_seq3:=false; - if (event_det_tick[i].detecteur[Adresse]=0) then begin etat0_seq1:=true;end; + if (event_det_tick[i].detecteur=0) then begin etat0_seq1:=true;end; repeat -// if (event_det_tick[i].detecteur[Adresse]=0) then etat0_seq1:=true; - - if (event_det_tick[i].detecteur[Adresse]=1) and etat0_seq1 then begin etat1_seq2:=true;end; + if (event_det_tick[i].detecteur=1) and etat0_seq1 then begin etat1_seq2:=true;end; dec(i); // remonter le temps ... until (i=0) or (etat1_seq2); trouve_seq_chrono_010:=etat1_seq2; @@ -5070,18 +5069,19 @@ begin dec(N_event_det); end; -// trouve adresse d'un détecteur à "etat" avant "index" dans le tableai chrono +// trouve adresse d'un détecteur à "etat" avant "index" dans le tableau chrono function trouve_index_det_chrono(Adr,etat,index : integer) : integer; var i : integer; trouve : boolean; begin + if index<=0 then begin affiche('Erreur 784 index invalide',clred);exit; end; i:=index; if i>N_Event_tick then begin trouve_index_det_chrono:=0;exit; end; inc(i); repeat dec(i); - trouve:=event_det_tick[i].detecteur[Adr]=etat ; - until trouve or (i=0); + trouve:=(event_det_tick[i].etat=etat) and (event_det_tick[i].detecteur=Adr) ; + until (trouve or (i=0)); if trouve then begin trouve_index_det_chrono:=i;exit; @@ -5332,6 +5332,7 @@ begin Adr_El_Suiv:=Feux[i].Adr_el_suiv1; // adresse élément suivant au feu Btype_el_suivant:=Feux[i].Btype_suiv1; + // signal directionnel ? if (modele>10) then begin //Affiche('Signal directionnel '+IntToSTR(AdrFeu),clyellow); @@ -5339,6 +5340,7 @@ begin exit; end; + // signal non directionnel etat:=etat_signal_suivant(AdrFeu,1) ; // état du signal suivant + adresse du signal suivant dans Signal_Suivant // signaux traités spécifiquement @@ -5357,16 +5359,21 @@ begin envoi_LEB(AdrFeu); exit; end; - - + + // signal à 2 feux = carré violet+blanc if (Feux[i].aspect=2) then //or (feux[i].check<>nil) then // si carré violet begin - if carre_signal(AdrFeu) and (Feux[i].aspect=2) then - begin Maj_Etat_Signal(AdrFeu,violet) ; Envoi_signauxCplx; - exit; + // si aiguillage après signal mal positionnées + if carre_signal(AdrFeu) then + begin + Maj_Etat_Signal(AdrFeu,violet); + Envoi_signauxCplx; + exit; end - else if not(carre_signal(AdrFeu)) then //ici ya pas de check and feux[i].check.checked then - begin Maj_Etat_Signal(AdrFeu,blanc);Envoi_signauxCplx; + else + begin + Maj_Etat_Signal(AdrFeu,blanc); + Envoi_signauxCplx; exit; end; end; @@ -5778,7 +5785,7 @@ begin if N_Event_tick>=1 then begin //Affiche('Event_det_tick['+intToSTR(N_event_tick)+'].detecteur['+intToSTR(Adresse)+']='+intToSTr(event_det_tick[N_event_tick].detecteur[Adresse]),clyellow); - if event_det_tick[N_event_tick].detecteur[Adresse]=etat01 then exit; // déja stocké + if (event_det_tick[i].etat=etat01) and (event_det_tick[i].detecteur=Adresse) then exit; // déja stocké end; if Traceliste then AfficheDebug('--------------------- détecteur '+intToSTR(Adresse)+' à '+intToSTR(etat01)+'-----------------------------',clOrange); @@ -5805,7 +5812,8 @@ begin // event_det_tick[N_event_tick].train:=0; event_det_tick[N_event_tick].tick:=tick; - event_det_tick[N_event_tick].detecteur[Adresse]:=etat01; + event_det_tick[N_event_tick].detecteur:=Adresse; + event_det_tick[N_event_tick].etat:=etat01; // Affiche('stockage de '+intToSTR(N_event_tick)+' à '+intToSTR(etat01),clyellow); end; @@ -5857,7 +5865,7 @@ begin inc(N_Event_tick); event_det_tick[N_event_tick].tick:=tick; event_det_tick[N_event_tick].aiguillage:=adresse; - event_det_tick[N_event_tick].position:=pos; + event_det_tick[N_event_tick].etat:=pos; end; exit; @@ -6521,8 +6529,12 @@ begin 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 + //for j:=1 to 1100 do + //event_det_tick[i].detecteur[j]:=-1; // initialiser les détecteurs à -1 + event_det_tick[i].detecteur:=-1; + event_det_tick[i].etat:=-1; + event_det_tick[i].aiguillage:=-1; + event_det_tick[i].actionneur:=-1; event_det_tick[i].traite:=false ; // non traité end; @@ -7266,6 +7278,8 @@ begin Affiche('Version 1.31 : Correction des positions aiguillages triples et TJD',clLime); Affiche('Version 1.4 : Gestion des Fx vers les locomotives par actionneurs',clLime); Affiche('Version 1.41 : Gestion des passages à niveaux par actionneurs',clLime); + Affiche('Version 1.42 : Correction erreur lecture feux',clLime); + end; @@ -7282,14 +7296,15 @@ begin for i:=1 to N_Event_tick do begin - for j:=1 to 1100 do + //for j:=1 to 1100 do begin - etat:=event_det_tick[i].detecteur[j]; + etat:=event_det_tick[i].etat; if etat<>-1 then begin + j:=event_det_tick[i].detecteur; 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); + // s:=s+' Det suiv='+intTostr(event_det_tick[i].suivant); Affiche(s,clyellow); end; end; @@ -7298,7 +7313,7 @@ begin 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); + s:=s+' Aig='+intToSTR(etat)+'='+intToSTR(event_det_tick[i].etat); Affiche(s,clyellow); end; end; diff --git a/UnitSimule.dcu b/UnitSimule.dcu index 57f6b2d..066947c 100644 Binary files a/UnitSimule.dcu and b/UnitSimule.dcu differ diff --git a/UnitTCO.dcu b/UnitTCO.dcu index e5fbaff..34b8b97 100644 Binary files a/UnitTCO.dcu and b/UnitTCO.dcu differ diff --git a/UnitTCO.dfm b/UnitTCO.dfm index aa24be6..60b0f02 100644 --- a/UnitTCO.dfm +++ b/UnitTCO.dfm @@ -1,6 +1,6 @@ object FormTCO: TFormTCO - Left = 337 - Top = 102 + Left = 333 + Top = 121 Width = 928 Height = 681 VertScrollBar.Visible = False @@ -22,7 +22,7 @@ object FormTCO: TFormTCO TextHeight = 13 object LabelX: TLabel Left = 32 - Top = 16 + Top = 14 Width = 53 Height = 19 Caption = 'LabelX' @@ -49,7 +49,7 @@ object FormTCO: TFormTCO end object LabelY: TLabel Left = 120 - Top = 16 + Top = 14 Width = 51 Height = 19 Caption = 'Label1' @@ -61,7 +61,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label1: TLabel - Left = 496 + Left = 776 Top = 8 Width = 32 Height = 13 @@ -348,6 +348,20 @@ object FormTCO: TFormTCO Font.Style = [fsBold] ParentFont = False end + object Label18: TLabel + Left = 200 + Top = 10 + Width = 83 + Height = 13 + Caption = 'Taille des cellules' + end + object Label19: TLabel + Left = 336 + Top = 10 + Width = 5 + Height = 13 + Caption = '/' + end object EditAdrElement: TEdit Left = 200 Top = 480 @@ -441,14 +455,32 @@ object FormTCO: TFormTCO OnClick = Button1Click end object Button2: TButton - Left = 320 - Top = 520 + Left = 792 + Top = 592 Width = 75 Height = 25 Caption = 'Simu Det 0' TabOrder = 7 OnClick = Button2Click end + object EditCellX: TEdit + Left = 296 + Top = 8 + Width = 33 + Height = 21 + TabOrder = 8 + Text = 'EditCellX' + OnKeyPress = EditCellXKeyPress + end + object EditCellY: TEdit + Left = 352 + Top = 8 + Width = 33 + Height = 21 + TabOrder = 9 + Text = 'EditCellY' + OnKeyPress = EditCellYKeyPress + end object PopupMenu1: TPopupMenu Left = 352 Top = 472 diff --git a/UnitTCO.pas b/UnitTCO.pas index bb7a618..fd0b8aa 100644 --- a/UnitTCO.pas +++ b/UnitTCO.pas @@ -65,6 +65,10 @@ type Label16: TLabel; ImageDiag2: TImage; Label17: TLabel; + Label18: TLabel; + EditCellX: TEdit; + EditCellY: TEdit; + Label19: TLabel; procedure FormCreate(Sender: TObject); procedure ImageTCOClick(Sender: TObject); procedure FormActivate(Sender: TObject); @@ -149,6 +153,8 @@ type procedure ImageDiag2EndDrag(Sender, Target: TObject; X, Y: Integer); procedure ImageDiag2MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); + procedure EditCellXKeyPress(Sender: TObject; var Key: Char); + procedure EditCellYKeyPress(Sender: TObject; var Key: Char); private { Déclarations privées } @@ -156,7 +162,7 @@ type { Déclarations publiques } end; - TTCO = array of array of record + TTCO = array[1..100] of array[1..50] 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= @@ -229,8 +235,6 @@ begin 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 @@ -268,9 +272,6 @@ begin 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; @@ -307,15 +308,16 @@ begin With ImageTCO.canvas do begin pen.color:=ClGrille; + // lignes verticales for x:=1 to NbreCellX do begin moveto(x*LargeurCell,1); - LineTo(x*LargeurCell,HtImageTCO); + LineTo(x*LargeurCell,HauteurCell*NbreCelly); end; for y:=1 to NbreCelly do begin moveto(1,y*HauteurCell); - LineTo(LargimageTCO,y*HauteurCell); + LineTo(LargeurCell*NbreCellX,y*HauteurCell); end; end; end; @@ -711,7 +713,7 @@ var x0,y0,x1,y1,x2,y2,x3,y3,x4,y4,jy1,jy2 : integer; begin x0:=(x-1)*LargeurCell; y0:=(y-1)*HauteurCell; - r:=Rect(x0,y0,x0+LargeurCell+1,y0+HauteurCell+1); + r:=Rect(x0,y0,x0+LargeurCell,y0+HauteurCell); with canvas do begin @@ -719,7 +721,7 @@ begin Pen.color:=clLime; Brush.Color:=Fond; Brush.style:=bsSolid; - // rectangle(r); + rectangle(r); fillRect(r); end; end; @@ -786,18 +788,27 @@ begin 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); + else entoure_cell(x,y); end; - if (BImage>=2) then + if (BImage>=2) and (i<>0) 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); + with ImageTCO.Canvas do + begin + font.Size:=5; + Brush.Color:=fond; + Font.Color:=CouleurAdresse; + TextOut(xOrg+1,yOrg+1,s); + end; end; - if (BImage=1) then + if (BImage=1) and (i<>0) 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); + with ImageTCO.Canvas do + begin + font.Size:=5; + Brush.Color:=fond; + Font.Color:=CouleurAdresse; + TextOut(xOrg+1,yOrg+21,s); + end; end; end; @@ -807,8 +818,11 @@ var x,y : integer; s : string; r : Trect; begin - with formTCO.ImageTCO.Canvas do + with ImageTCO.Canvas do begin + Brush.Color:=clWhite; + r:=rect(1,1,ImageTCO.Width,ImageTCO.height); + FillRect(r); Brush.Style:=bsSolid; Brush.Color:=fond; pen.color:=clyellow; @@ -818,6 +832,7 @@ begin for y:=1 to NbreCellY do for x:=1 to NbreCellX do begin + //Affiche(IntToSTR(x),clyellow); affiche_cellule(x,y,PmCopy); end; grille; @@ -827,8 +842,11 @@ end; procedure TFormTCO.FormCreate(Sender: TObject); begin caption:='TCO'; - LargeurCell:=35; - HauteurCell:=35; + LargeurCell:=25; + HauteurCell:=25; + EditCellX.text:=IntToSTR(LargeurCell); + EditCellY.text:=IntToSTR(HauteurCell); + XclicCell:=1; YclicCell:=1; @@ -846,7 +864,7 @@ end; procedure TFormTCO.ImageTCOClick(Sender: TObject); var Position: TPoint; begin - Entoure_cell(XclicCell,YclicCell); + //Entoure_cell(XclicCell,YclicCell); GetCursorPos(Position); Position:=ImageTCO.screenToCLient(Position); @@ -861,7 +879,7 @@ begin LabelY.caption:=IntToSTR(YclicCell); XclicCellInserer:=XClicCell; YclicCellInserer:=YClicCell; - Entoure_cell(XclicCellInserer,YclicCellInserer); + //Entoure_cell(XclicCellInserer,YclicCellInserer); EditAdrElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].Adresse); EdittypeElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].BType); @@ -875,7 +893,6 @@ 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 @@ -921,7 +938,7 @@ procedure TFormTCO.ImageTCOContextPopup(Sender: TObject; MousePos: TPoint; var H var Position: TPoint; begin // efface le carré pointeur - Entoure_cell(XclicCell,YclicCell); + //Entoure_cell(XclicCell,YclicCell); GetCursorPos(Position); Position:=ImageTCO.screenToCLient(Position); @@ -933,7 +950,7 @@ begin label1.caption:='clicContext'; XclicCellInserer:=XClicCell; YclicCellInserer:=YClicCell; - Entoure_cell(XclicCellInserer,YclicCellInserer); + //Entoure_cell(XclicCellInserer,YclicCellInserer); //Affiche('XClicCell='+intToSTR(XclicCell)+' '+'YClicCell='+intToSTR(YclicCell),clyellow); end; @@ -943,11 +960,11 @@ procedure TFormTCO.aiguillageG_PGClick(Sender: TObject); var Position: TPoint; begin // effacer le carré pointeur - Entoure_cell(XclicCell,YclicCell); + //Entoure_cell(XclicCell,YclicCell); // dessine le dessin dessin_AigPG_AG(ImageTCO.canvas,XClicCellInserer,YClicCellInserer,clyellow,pmCopy); // remet le carré pointeur - Entoure_cell(XclicCell,YclicCell); + //Entoure_cell(XclicCell,YclicCell); EditAdrElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].Adresse); EdittypeElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].BType); @@ -959,11 +976,11 @@ procedure TFormTCO.aiguillageD_PDClick(Sender: TObject); var Position: TPoint; begin // effacer le carré pointeur - Entoure_cell(XclicCell,YclicCell); + //Entoure_cell(XclicCell,YclicCell); // dessine le dessin dessin_AigPD_AD(ImageTCO.Canvas,XClicCellInserer,YClicCellInserer,clyellow,pmCopy); // remet le carré pointeur - Entoure_cell(XclicCell,YclicCell); + //Entoure_cell(XclicCell,YclicCell); EditAdrElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].Adresse); EdittypeElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].BType); @@ -975,11 +992,11 @@ procedure TFormTCO.Aiguillagegauchepointedroite1Click(Sender: TObject); var Position: TPoint; begin // effacer le carré pointeur - Entoure_cell(XclicCell,YclicCell); + //Entoure_cell(XclicCell,YclicCell); // dessine le dessin dessin_AigG_PD(ImageTCO.canvas,XClicCellInserer,YClicCellInserer,clyellow,pmCopy); // remet le carré pointeur - Entoure_cell(XclicCell,YclicCell); + //Entoure_cell(XclicCell,YclicCell); EditAdrElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].Adresse); EdittypeElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].BType); @@ -992,11 +1009,11 @@ begin tco[XClicCellInserer,YClicCellInserer].Adresse:=1; tco[XClicCellInserer,YClicCellInserer].Btype:=1; // effacer le carré pointeur - Entoure_cell(XclicCell,YclicCell); + //Entoure_cell(XclicCell,YclicCell); // dessine le dessin dessin_AigD_PG(ImageTCO.canvas,XClicCellInserer,YClicCellInserer,clyellow,pmCopy); // remet le carré pointeur - Entoure_cell(XclicCell,YclicCell); + //Entoure_cell(XclicCell,YclicCell); EditAdrElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].Adresse); EdittypeElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].BType); @@ -1006,7 +1023,7 @@ end; procedure TFormTCO.FormKeyDown(Sender: TObject; var Key: Word;Shift: TShiftState); begin exit; - Entoure_cell(XclicCell,YclicCell); + //Entoure_cell(XclicCell,YclicCell); case Key of VK_right : if XClicCell1 then dec(XClicCell); @@ -1015,7 +1032,7 @@ begin end; LabelX.caption:=IntToSTR(XClicCell); LabelY.caption:=IntToSTR(YClicCell); - Entoure_cell(XclicCell,YclicCell); + //Entoure_cell(XclicCell,YclicCell); EditAdrElement.Text:=IntToSTR(tco[XClicCell,YClicCell].Adresse); EdittypeElement.Text:=IntToSTR(tco[XClicCell,YClicCell].BType); @@ -1025,11 +1042,11 @@ procedure TFormTCO.Elmentdroit1Click(Sender: TObject); var Position: TPoint; begin // effacer le carré pointeur - Entoure_cell(XclicCell,YclicCell); + //Entoure_cell(XclicCell,YclicCell); // dessine le dessin dessin_voie(ImageTCO.canvas,XClicCellInserer,YClicCellInserer,clyellow,pmCopy); // remet le carré pointeur - Entoure_cell(XclicCell,YclicCell); + //Entoure_cell(XclicCell,YclicCell); EditAdrElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].Adresse); EdittypeElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].BType); @@ -1040,11 +1057,11 @@ procedure TFormTCO.Courbegaucheversdroite1Click(Sender: TObject); var Position: TPoint; begin // effacer le carré pointeur - Entoure_cell(XclicCell,YclicCell); + //Entoure_cell(XclicCell,YclicCell); // dessine le dessin dessin_infG(ImageTCO.canvas,XClicCellInserer,YClicCellInserer,clyellow,pmCopy); // remet le carré pointeur - Entoure_cell(XclicCell,YclicCell); + //Entoure_cell(XclicCell,YclicCell); GetCursorPos(Position); end; @@ -1052,11 +1069,11 @@ procedure TFormTCO.Courbedroiteversgauche1Click(Sender: TObject); var Position: TPoint; begin // effacer le carré pointeur - Entoure_cell(XclicCell,YclicCell); + //Entoure_cell(XclicCell,YclicCell); // dessine le dessin dessin_infD(ImageTCO.canvas,XClicCellInserer,YClicCellInserer,clyellow,pmCopy); // remet le carré pointeur - Entoure_cell(XclicCell,YclicCell); + //Entoure_cell(XclicCell,YclicCell); GetCursorPos(Position); end; @@ -1065,11 +1082,11 @@ procedure TFormTCO.CourbeSupD1Click(Sender: TObject); var Position: TPoint; begin // effacer le carré pointeur - Entoure_cell(XclicCell,YclicCell); + //Entoure_cell(XclicCell,YclicCell); // dessine le dessin dessin_SupD(ImageTCO.canvas,XClicCellInserer,YClicCellInserer,clyellow,pmCopy); // remet le carré pointeur - Entoure_cell(XclicCell,YclicCell); + //Entoure_cell(XclicCell,YclicCell); GetCursorPos(Position); end; @@ -1077,11 +1094,11 @@ procedure TFormTCO.CourbeSupG1Click(Sender: TObject); var Position: TPoint; begin // effacer le carré pointeur - Entoure_cell(XclicCell,YclicCell); + //Entoure_cell(XclicCell,YclicCell); // dessine le dessin dessin_SupG(ImageTCO.canvas,XClicCellInserer,YClicCellInserer,clyellow,pmCopy); // remet le carré pointeur - Entoure_cell(XclicCell,YclicCell); + //Entoure_cell(XclicCell,YclicCell); GetCursorPos(Position); end; @@ -1387,13 +1404,14 @@ var Position: TPoint; x0,y0,XSel1,YSel1,XSel2,YSel2 : integer; begin //Affiche('MouseMove',clyellow); + //Affiche(IntToSTR(X),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; @@ -1586,4 +1604,33 @@ begin ImageDiag2.BeginDrag(true); end; + +procedure TFormTCO.EditCellXKeyPress(Sender: TObject; var Key: Char); +var i, erreur : integer; +begin + val(EditCellX.text,i,erreur); + if (erreur=0) and (i>9) and (i<40) then + begin + LargeurCell:=i; + NbreCellX:=FormTCO.ImageTCO.Width div (LargeurCell); + Affiche('NbrecellX='+intToSTR(NbrecellX),clyellow); + Affiche_TCO; + end; + +end; + +procedure TFormTCO.EditCellYKeyPress(Sender: TObject; var Key: Char); +var i,erreur : integer; +begin + val(EditCellY.text,i,erreur); + if (erreur=0) and (i>9) and (i<40) then + begin + HauteurCell:=i; + NbreCellY:=FormTCO.ImageTCO.Height div (LargeurCell); + Affiche('NbrecellY='+intToSTR(NbrecellY),clyellow); + Affiche_TCO; + end; + +end; + end. diff --git a/verif_version.pas b/verif_version.pas index 0ff530d..c9ff221 100644 --- a/verif_version.pas +++ b/verif_version.pas @@ -22,7 +22,7 @@ var FormVersion: TFormVersion; Lance_verif : integer; -Const Version='1.41'; //Version='1.2';// sert à la comparaison de la version publiée +Const Version='1.42'; //Version='1.2';// sert à la comparaison de la version publiée implementation @@ -164,7 +164,7 @@ begin FormVersion.show; s:='Vous utilisez la version '+version+' mais il existe la version '+Version_p; Aff(s); - if MessageDlg(s+' Voulez-vous la télécharger?',mtConfirmation,[mbYes,mbNo],0)=mrYes then + if MessageDlg(s+'. Voulez-vous la télécharger?',mtConfirmation,[mbYes,mbNo],0)=mrYes then begin s:=GetCurrentProcessEnvVar('USERPROFILE')+'\Downloads\Signaux_Complexes_GL.Zip'; Aff('Téléchargement de '+s3+' dans '); diff --git a/versions.txt b/versions.txt index 9342b90..95074f3 100644 --- a/versions.txt +++ b/versions.txt @@ -12,4 +12,5 @@ Version 1.3 : D Configuration statique modifiable dans menu Version 1.31 : Correction des positions aiguillages triples et TJD Version 1.4 : Gestion des Fonctions Fx vers les locomotives par actionneurs -Version 1.41 : Gestion des passages à niveaux par actionneurs \ No newline at end of file +Version 1.41 : Gestion des passages à niveaux par actionneurs +Version 1.42 : Correction erreur lecture signaux