diff --git a/Notice d'utilisation des signaux_complexes_GL_V4.6.pdf b/Notice d'utilisation des signaux_complexes_GL_V4.7.pdf similarity index 77% rename from Notice d'utilisation des signaux_complexes_GL_V4.6.pdf rename to Notice d'utilisation des signaux_complexes_GL_V4.7.pdf index b3c0c3d..7fffbe7 100644 Binary files a/Notice d'utilisation des signaux_complexes_GL_V4.6.pdf and b/Notice d'utilisation des signaux_complexes_GL_V4.7.pdf differ diff --git a/Signaux_complexes_GL.dpr b/Signaux_complexes_GL.dpr index 91aa10c..68c324d 100644 --- a/Signaux_complexes_GL.dpr +++ b/Signaux_complexes_GL.dpr @@ -11,7 +11,8 @@ uses UnitConfig in 'UnitConfig.pas' {FormConfig}, UnitConfigTCO in 'UnitConfigTCO.pas' {FormConfigTCO}, UnitSR in 'UnitSR.pas' {FormSR}, - Unit_Pilote_aig in 'Unit_Pilote_aig.pas' {FormAig}; + Unit_Pilote_aig in 'Unit_Pilote_aig.pas' {FormAig}, + UnitConfigCellTCO in 'UnitConfigCellTCO.pas' {FormConfCellTCO}; {$R *.res} @@ -26,5 +27,6 @@ begin Application.CreateForm(TFormVersion, FormVersion); Application.CreateForm(TFormSR, FormSR); Application.CreateForm(TFormAig, FormAig); + Application.CreateForm(TFormConfCellTCO, FormConfCellTCO); Application.Run; end. diff --git a/UnitConfig.dcu b/UnitConfig.dcu index 7d909e7..ea90d16 100644 Binary files a/UnitConfig.dcu and b/UnitConfig.dcu differ diff --git a/UnitConfig.dfm b/UnitConfig.dfm index 74a59e6..521e6cb 100644 --- a/UnitConfig.dfm +++ b/UnitConfig.dfm @@ -1580,7 +1580,7 @@ object FormConfig: TFormConfig Top = 8 Width = 633 Height = 497 - ActivePage = TabSheetAct + ActivePage = TabSheetAutonome Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -11 @@ -3002,7 +3002,7 @@ object FormConfig: TFormConfig Top = 48 Width = 129 Height = 21 - ItemHeight = 13 + ItemHeight = 0 TabOrder = 1 OnChange = ComboBoxDecChange end diff --git a/UnitConfig.pas b/UnitConfig.pas index 3ae98ce..21a26d3 100644 --- a/UnitConfig.pas +++ b/UnitConfig.pas @@ -454,7 +454,7 @@ var LigneCliqueePN,AncLigneCliqueePN,clicMemo,Nb_cantons_Sig, ligneclicAig,AncLigneClicAig,ligneClicSig,AncligneClicSig, ligneClicBr,AncligneClicBr,ligneClicAct,AncLigneClicAct,Adressefeuclic,NumTrameCDM : integer; - ack_cdm,clicliste,entreeTCO,affevt,config_modifie,clicproprietes,confasauver, + ack_cdm,clicliste,affevt,config_modifie,clicproprietes,confasauver, modif_branches : boolean; fichier : text; @@ -2722,7 +2722,6 @@ begin CheckLanceCDM.Checked:=LanceCDM; CheckAvecTCO.checked:=avecTCO; CheckBandeauTCO.Checked:=MasqueBandeauTCO; - entreeTCO:=avecTCO; EditNomLay.Text:=Lay; RadioButton4.Checked:=ServeurInterfaceCDM=0; RadioButton5.Checked:=ServeurInterfaceCDM=1; @@ -4988,7 +4987,7 @@ begin Feux[index].Img.picture.Bitmap:=Select_dessin_feu(feux[index].aspect); dessine_feu_mx(Feux[index].Img.Canvas,0,0,1,1,feux[index].adresse,1); // dessine les feux du signal // et dans le TCO - if avecTCO then + if formTCO.Showing then begin for y:=1 to NbreCellY do for x:=1 to NbreCellX do @@ -7684,15 +7683,6 @@ begin ok:=verifie_panneau_config; - // TCO - if avectco and not(entreeTCO) then - begin - //créée la fenêtre TCO non modale - FormTCO:=TformTCO.Create(nil); - FormTCO.show; - FormPrinc.ButtonAffTCO.Visible:=true; - end; - if not(ok) then action:=tCloseAction(caNone); // si la config est nok, on ferme pas la fenetre end; diff --git a/UnitConfigCellTCO.dcu b/UnitConfigCellTCO.dcu new file mode 100644 index 0000000..a2120db Binary files /dev/null and b/UnitConfigCellTCO.dcu differ diff --git a/UnitConfigCellTCO.dfm b/UnitConfigCellTCO.dfm new file mode 100644 index 0000000..3b86775 --- /dev/null +++ b/UnitConfigCellTCO.dfm @@ -0,0 +1,279 @@ +object FormConfCellTCO: TFormConfCellTCO + Left = 211 + Top = 228 + BorderStyle = bsDialog + Caption = 'FormConfCellTCO' + ClientHeight = 375 + ClientWidth = 251 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = False + OnCreate = FormCreate + PixelsPerInch = 96 + TextHeight = 13 + object ButtonOk: TButton + Left = 168 + Top = 344 + Width = 75 + Height = 25 + Caption = 'Ok' + TabOrder = 0 + OnClick = ButtonOkClick + end + object GroupBox1: TGroupBox + Left = 8 + Top = 240 + Width = 233 + Height = 97 + Caption = 'Texte' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + TabOrder = 1 + object Label1: TLabel + Left = 8 + Top = 41 + Width = 79 + Height = 16 + Caption = 'Position du texte:' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Arial Narrow' + Font.Style = [] + ParentFont = False + end + object ComboRepr: TComboBox + Left = 8 + Top = 60 + Width = 89 + Height = 24 + ItemHeight = 16 + TabOrder = 0 + OnChange = ComboReprChange + Items.Strings = ( + 'Sans' + 'Centrale' + 'Haut' + 'Bas') + end + object ButtonFonte: TButton + Left = 112 + Top = 56 + Width = 81 + Height = 25 + Caption = 'Fonte' + TabOrder = 1 + OnClick = ButtonFonteClick + end + object EditTexte: TEdit + Left = 8 + Top = 16 + Width = 209 + Height = 24 + TabOrder = 2 + OnChange = EditTexteChange + end + end + object GroupBox2: TGroupBox + Left = 8 + Top = 8 + Width = 233 + Height = 225 + Caption = 'El'#233'ment' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + TabOrder = 2 + object Label15: TLabel + Left = 8 + Top = 22 + Width = 93 + Height = 16 + Caption = 'Image de l'#39#233'l'#233'ment: ' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Arial Narrow' + Font.Style = [] + ParentFont = False + end + object ImagePalette: TImage + Left = 112 + Top = 24 + Width = 41 + Height = 41 + Hint = 'Voie pouvant porter un d'#233'tecteur' + DragMode = dmAutomatic + ParentShowHint = False + ShowHint = True + Stretch = True + end + object Label2: TLabel + Left = 168 + Top = 22 + Width = 48 + Height = 16 + Caption = 'Adresse : ' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Arial Narrow' + Font.Style = [] + ParentFont = False + end + object EditTypeImage: TEdit + Left = 40 + Top = 48 + Width = 33 + Height = 21 + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -9 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + TabOrder = 0 + OnKeyPress = EditTypeImageKeyPress + end + object GroupBox3: TGroupBox + Left = 8 + Top = 80 + Width = 209 + Height = 73 + Caption = 'Orientation du signal' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + TabOrder = 1 + object RadioButtonHG: TRadioButton + Left = 16 + Top = 16 + Width = 169 + Height = 17 + Caption = 'Horizontal gauche' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + TabOrder = 0 + OnClick = RadioButtonHGClick + end + object RadioButtonV: TRadioButton + Left = 16 + Top = 48 + Width = 169 + Height = 17 + Caption = 'Vertical' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + TabOrder = 1 + OnClick = RadioButtonVClick + end + object RadioButtonHD: TRadioButton + Left = 16 + Top = 32 + Width = 169 + Height = 17 + Caption = 'Horizontal droit' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + TabOrder = 2 + OnClick = RadioButtonHDClick + end + end + object GroupBox4: TGroupBox + Left = 8 + Top = 160 + Width = 209 + Height = 57 + Caption = 'Implantation du signal' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + TabOrder = 2 + object RadioButtonG: TRadioButton + Left = 16 + Top = 16 + Width = 113 + Height = 17 + Caption = #224' gauche de la voie' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + TabOrder = 0 + OnClick = RadioButtonGClick + end + object RadioButtonD: TRadioButton + Left = 16 + Top = 32 + Width = 113 + Height = 17 + Caption = #224' droite de la voie' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + TabOrder = 1 + OnClick = RadioButtonDClick + end + end + object EditAdrElement: TEdit + Left = 176 + Top = 48 + Width = 33 + Height = 24 + TabOrder = 3 + OnKeyPress = EditAdrElementKeyPress + end + end + object CheckPinv: TCheckBox + Left = 8 + Top = 352 + Width = 129 + Height = 17 + Hint = 'Cocher si l'#39'aiguillage est repr'#233'sent'#233' invers'#233 + Caption = 'aiguillage invers'#233 + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -9 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + ParentShowHint = False + ShowHint = True + TabOrder = 3 + OnClick = CheckPinvClick + end +end diff --git a/UnitConfigCellTCO.pas b/UnitConfigCellTCO.pas new file mode 100644 index 0000000..3c8c564 --- /dev/null +++ b/UnitConfigCellTCO.pas @@ -0,0 +1,409 @@ +unit UnitConfigCellTCO; + +interface + +uses + Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, + Dialogs, StdCtrls, UnitTCO, ExtCtrls; + +type + TFormConfCellTCO = class(TForm) + ButtonOk: TButton; + GroupBox1: TGroupBox; + ComboRepr: TComboBox; + Label1: TLabel; + ButtonFonte: TButton; + EditTexte: TEdit; + GroupBox2: TGroupBox; + Label15: TLabel; + EditTypeImage: TEdit; + ImagePalette: TImage; + CheckPinv: TCheckBox; + Label2: TLabel; + GroupBox3: TGroupBox; + RadioButtonHG: TRadioButton; + RadioButtonV: TRadioButton; + RadioButtonHD: TRadioButton; + GroupBox4: TGroupBox; + RadioButtonG: TRadioButton; + RadioButtonD: TRadioButton; + EditAdrElement: TEdit; + procedure ButtonOkClick(Sender: TObject); + procedure EditTypeImageKeyPress(Sender: TObject; var Key: Char); + procedure EditAdrElementChange(Sender: TObject); + procedure EditTexteChange(Sender: TObject); + procedure ButtonFonteClick(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure ComboReprChange(Sender: TObject); + procedure CheckPinvClick(Sender: TObject); + procedure RadioButtonVClick(Sender: TObject); + procedure RadioButtonHGClick(Sender: TObject); + procedure RadioButtonHDClick(Sender: TObject); + procedure RadioButtonGClick(Sender: TObject); + procedure RadioButtonDClick(Sender: TObject); + procedure EditAdrElementKeyPress(Sender: TObject; var Key: Char); + private + { Déclarations privées } + public + { Déclarations publiques } + end; + +var + FormConfCellTCO: TFormConfCellTCO; + actualize : boolean; + +procedure actualise; + +implementation + + +uses UnitPrinc; + +{$R *.dfm} + +procedure actualise; +var Bimage : integer; + oriente,piedFeu : integer; +begin + actualize:=true; // évite les évènemebts parasites + FormConfCellTCO.caption:='Propriétés de la cellule '+IntToSTR(XClicCell)+','+intToSTR(YClicCell); + Bimage:=TCO[XClicCell,YClicCell].Bimage; + formConfCellTCO.EditTypeImage.Text:=intToSTR(Bimage); + + if Bimage<30 then + With formConfCellTCO.ImagePalette do + begin + Height:=FormTCO.ImagePalette1.Picture.Height; + Width:=FormTCO.ImagePalette1.Picture.Width; + Transparent:=false; + end; + + if Bimage<>30 then + with formConfCellTCO do + begin + RadioButtonV.Enabled:=false; + RadioButtonHG.Enabled:=false; + RadioButtonHD.Enabled:=false; + RadioButtonG.Enabled:=false; + RadioButtonD.Enabled:=false; + end; + + with formConfCellTCO.ImagePalette.Picture do + case Bimage of + 1: Assign(FormTCO.ImagePalette1.Picture); + 2: Assign(FormTCO.ImagePalette2.Picture); + 3: Assign(FormTCO.ImagePalette3.Picture); + 4: Assign(FormTCO.ImagePalette4.Picture); + 5: Assign(FormTCO.ImagePalette5.Picture); + 6: Assign(FormTCO.ImagePalette6.Picture); + 7: Assign(FormTCO.ImagePalette7.Picture); + 8: Assign(FormTCO.ImagePalette8.Picture); + 9: Assign(FormTCO.ImagePalette9.Picture); + 10: Assign(FormTCO.ImagePalette10.Picture); + 11: Assign(FormTCO.ImagePalette11.Picture); + 12: Assign(FormTCO.ImagePalette12.Picture); + 13: Assign(FormTCO.ImagePalette13.Picture); + 14: Assign(FormTCO.ImagePalette14.Picture); + 15: Assign(FormTCO.ImagePalette15.Picture); + 16: Assign(FormTCO.ImagePalette16.Picture); + 17: Assign(FormTCO.ImagePalette17.Picture); + 18: Assign(FormTCO.ImagePalette18.Picture); + 19: Assign(FormTCO.ImagePalette19.Picture); + 20: Assign(FormTCO.ImagePalette20.Picture); + 21: Assign(FormTCO.ImagePalette21.Picture); + 22: Assign(FormTCO.ImagePalette22.Picture); + 23: Assign(FormTCO.ImagePalette23.Picture); + 30: begin + With formConfCellTCO.ImagePalette do + begin + Height:=FormTCO.ImagePalette30.Height; + Width:=FormTCO.ImagePalette30.Width; + + Picture.Assign(FormTCO.ImagePalette30.Picture); + Picture.Bitmap.TransparentMode:=tmAuto; + Picture.Bitmap.TransparentColor:=clblue; + Transparent:=true; + end; + with formconfCellTCO do + begin + RadioButtonV.Enabled:=true; + RadioButtonHG.Enabled:=true; + RadioButtonHD.Enabled:=true; + RadioButtonG.Enabled:=true; + RadioButtonD.Enabled:=true; + oriente:=tco[XClicCell,YClicCell].Feuoriente; + if oriente=1 then + begin + RadioButtonV.checked:=true; + RadioButtonHG.checked:=false; + RadioButtonHD.checked:=false; + end; + if oriente=2 then + begin + RadioButtonV.checked:=false; + RadioButtonHG.checked:=true; + RadioButtonHD.checked:=false; + end; + if oriente=3 then + begin + RadioButtonV.checked:=false; + RadioButtonHG.checked:=false; + RadioButtonHD.checked:=true; + end; + + PiedFeu:=tco[XClicCell,YClicCell].PiedFeu; + if PiedFeu=1 then + begin + RadioButtonG.checked:=true; + RadioButtonD.checked:=false; + end; + if PiedFeu=2 then + begin + RadioButtonG.checked:=false; + RadioButtonD.checked:=true; + end; + end; + end + else + begin + with formConfCellTCO do + begin + ImagePalette.Picture:=nil; + RadioButtonV.Enabled:=false; + RadioButtonHG.Enabled:=false; + RadioButtonHD.Enabled:=false; + RadioButtonG.Enabled:=false; + RadioButtonD.Enabled:=false; + end; + end; + + end; + + with formConfCellTCO do + begin + EditTexte.Text:=Tco[XClicCell,YClicCell].Texte; + EditAdrElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].Adresse); + ComboRepr.ItemIndex:=tco[XClicCell,yClicCell].repr; + end; + actualize:=false; +end; + +procedure TFormConfCellTCO.ButtonOkClick(Sender: TObject); +begin + close; +end; + +procedure TFormConfCellTCO.EditTypeImageKeyPress(Sender: TObject; var Key: Char); +var Bimage,erreur : integer; +begin + if ord(Key)=VK_RETURN then + begin + Key:=#0; // évite beeping + Val(EditTypeImage.Text,Bimage,erreur); + //Affiche('Keypressed / Bimage='+IntToSTR(bimage),clyellow); + if (erreur<>0) or not(Bimage in[0..23,30]) then + begin + EditTypeImage.text:=intToSTR(tco[XClicCell,YClicCell].BImage); + exit; + end; + TCO_modifie:=true; + tco[XClicCell,YClicCell].Bimage:=Bimage; + + if not(selectionaffichee) then efface_entoure; + affiche_cellule(XClicCell,YClicCell); + formTCO.editTypeImage.Text:=editTypeImage.Text; + actualise; + if not(selectionaffichee) then _entoure_cell_clic; + end; +end; + +procedure TFormConfCellTCO.EditAdrElementChange(Sender: TObject); +var Adr,erreur,index : integer; +begin + //Affiche('Chgt adresse',clyellow); + + Val(EditAdrElement.Text,Adr,erreur); + if (erreur<>0) or (Adr<0) or (Adr>2048) then Adr:=0; + + if Adr=0 then tco[XClicCell,YClicCell].repr:=2; + + tco[XClicCell,YClicCell].Adresse:=Adr; + + if tco[XClicCell,YClicCell].BImage=30 then + begin + index:=Index_feu(adr); + if index=0 then exit + else + begin + //Affiche('Feu '+intToSTR(Adr),clyellow); + affiche_tco; + end; + end; + if not(selectionaffichee) then efface_entoure; + Affiche_cellule(XclicCell,YclicCell); + if not(selectionaffichee) then _entoure_cell_clic; + +end; + +procedure TFormConfCellTCO.EditTexteChange(Sender: TObject); +begin + PCanvasTCO.Brush.Color:=fond; + + if Tco[XClicCell,YClicCell].texte='' then + begin + Tco[XClicCell,YClicCell].CoulFonte:=clTexte; + Tco[XClicCell,YClicCell].TailleFonte:=8; + end; + Tco[XClicCell,YClicCell].Texte:=EditTexte.Text; + TCO_modifie:=true; + if not(selectionaffichee) then efface_entoure; + affiche_texte(XClicCell,YClicCell); + formTCO.EditTexte.Text:=EditTexte.text; + if not(selectionaffichee) then _entoure_cell_clic; +end; + +procedure TFormConfCellTCO.ButtonFonteClick(Sender: TObject); +begin + change_fonte; +end; + +procedure TFormConfCellTCO.FormCreate(Sender: TObject); +var i,x,y : integer; + image,imagesrc : Timage; +begin + // fenetre toujours dessus + actualize:=false; + SetWindowPos(Handle, HWND_TOPMOST,0,0,0,0,SWP_NoMove or SWP_NoSize); + exit; + + // dessine les composants - non utilisé + i:=1; + //Affiche('formconfcellTCO create',clYellow); + begin + for y:=1 to 5 do + for x:=1 to 5 do + begin + if i<25 then + begin + image:=Timage.create(FormConfCellTCO); + with image do + begin + Parent:=FormConfCellTCO; + Name:='i'+IntToSTR(i); // nom de l'image - sert à identifier le composant si on fait clic droit. + case i of + 1 : ImageSRC:=FormTCO.ImagePalette1; + 2 : ImageSRC:=FormTCO.ImagePalette2; + 3 : ImageSRC:=FormTCO.ImagePalette3; + 4 : ImageSRC:=FormTCO.ImagePalette4; + 5 : ImageSRC:=FormTCO.ImagePalette5; + 6 : ImageSRC:=FormTCO.ImagePalette6; + 7 : ImageSRC:=FormTCO.ImagePalette7; + 8 : ImageSRC:=FormTCO.ImagePalette8; + 9 : ImageSRC:=FormTCO.ImagePalette9; + 10 : ImageSRC:=FormTCO.ImagePalette10; + 11 : ImageSRC:=FormTCO.ImagePalette11; + 12 : ImageSRC:=FormTCO.ImagePalette12; + 13 : ImageSRC:=FormTCO.ImagePalette13; + 14 : ImageSRC:=FormTCO.ImagePalette14; + 15 : ImageSRC:=FormTCO.ImagePalette15; + 16 : ImageSRC:=FormTCO.ImagePalette16; + 17 : ImageSRC:=FormTCO.ImagePalette17; + 18 : ImageSRC:=FormTCO.ImagePalette18; + 19 : ImageSRC:=FormTCO.ImagePalette19; + 20 : ImageSRC:=FormTCO.ImagePalette20; + 21 : ImageSRC:=FormTCO.ImagePalette21; + 22 : ImageSRC:=FormTCO.ImagePalette22; + 23 : ImageSRC:=FormTCO.ImagePalette23; + 24 : ImageSRC:=FormTCO.ImagePalette30; + end; + picture.Bitmap:=ImageSRC.picture.BitMap; + width:=ImageSRC.Width; + height:=ImageSRC.Height; + Stretch:=true; + Transparent:=false; + picture.Bitmap.Transparentmode:=tmfixed; + Top:=(y-1)*(height+3)+5; + Left:=GroupBox2.Width+(x-1)*(41+3)+15; + end; + inc(i); + end; + end; + end; +end; + + + +procedure TFormConfCellTCO.ComboReprChange(Sender: TObject); +begin + tco[XClicCell,YClicCell].Repr:=comborepr.ItemIndex; + efface_entoure;SelectionAffichee:=false; + sourisclic:=false; + FormTCO.ComboRepr.ItemIndex:=ComboRepr.ItemIndex; + //affiche_cellule(XClicCell,yClicCell); + affiche_tco; +end; + +procedure TFormConfCellTCO.CheckPinvClick(Sender: TObject); +var Bimage : integer; +begin + if (xClicCell=0) or (xClicCell>NbreCellX) or (yClicCell=0) or (yClicCell>NbreCelly) then exit; + Bimage:=Tco[xClicCell,yClicCell].Bimage; + if (bimage=2) or (bimage=3) or (bimage=4) or (bimage=5) or (bimage=12) or (bimage=13) + or (bimage=14) or (bimage=15) then + begin + TCO[xClicCell,yClicCell].inverse:=CheckPinv.checked; + TCO_modifie:=true; + end; +end; + +procedure TFormConfCellTCO.RadioButtonVClick(Sender: TObject); +begin + Vertical; +end; + +procedure TFormConfCellTCO.RadioButtonHGClick(Sender: TObject); +begin + tourne90G; +end; + +procedure TFormConfCellTCO.RadioButtonHDClick(Sender: TObject); +begin + tourne90D; +end; + +procedure TFormConfCellTCO.RadioButtonGClick(Sender: TObject); +begin + signalG; +end; + +procedure TFormConfCellTCO.RadioButtonDClick(Sender: TObject); +begin + signalD; +end; + + +procedure TFormConfCellTCO.EditAdrElementKeyPress(Sender: TObject; var Key: Char); +var Adr,erreur : integer; +begin + if ord(Key)=VK_RETURN then + begin + Key:=#0; // évite beeping + Val(EditAdrElement.Text,Adr,erreur); + //Affiche('Keypressed / Bimage='+IntToSTR(bimage),clyellow); + if (erreur<>0) then + begin + EditAdrElement.text:=intToSTR(tco[XClicCell,YClicCell].Adresse); + exit; + end; + TCO_modifie:=true; + tco[XClicCell,YClicCell].Adresse:=Adr; + + if not(selectionaffichee) then efface_entoure; + affiche_cellule(XClicCell,YClicCell); + formTCO.EditAdrElement.Text:=EditAdrElement.Text; + actualise; + if not(selectionaffichee) then _entoure_cell_clic; + end; +end; + +end. diff --git a/UnitConfigTCO.dcu b/UnitConfigTCO.dcu index 982749c..5fca3bc 100644 Binary files a/UnitConfigTCO.dcu and b/UnitConfigTCO.dcu differ diff --git a/UnitPrinc.dcu b/UnitPrinc.dcu index 10bb54f..75d0210 100644 Binary files a/UnitPrinc.dcu and b/UnitPrinc.dcu differ diff --git a/UnitPrinc.pas b/UnitPrinc.pas index 6212991..50dd593 100644 --- a/UnitPrinc.pas +++ b/UnitPrinc.pas @@ -18,6 +18,15 @@ Unit UnitPrinc; // En mode RUN: // CDM renvoie le nom des trains sur les actionneurs à 1, jamais à 0 // et quelquefois (pas toujours!) sur les détecteurs à 1, jamais à 0 +// +// En simulation: +// CDM Rail ne renvoie pas les états des aiguillages en début de simu +// Les aiguillages sont renvoyés quand on clique dessus +// Les actionneurs fonctionnent. Les détecteurs ne sont pas renvoyés. +// +// En mode centrale connectée à signaux complexes (autonome) si on bouge un +// aiguillage à la raquette, on récupère bien sa position par XpressNet. + interface @@ -1269,9 +1278,8 @@ begin with Formpilote do begin - TFormPilote.Create(Self); + TFormPilote.Create(Self); // rajouté show; - ImagePilote.Parent:=FormPilote; ImagePilote.Picture.Bitmap.TransparentMode:=tmAuto; ImagePilote.Picture.Bitmap.TransparentColor:=clblue; @@ -1774,8 +1782,8 @@ begin end; if cdm_connecte then begin - //s:=chaine_CDM_vitesseST(vitesse,nom_train); // par nom du train - s:=chaine_CDM_vitesseINT(vitesse,loco); // par adresse du train + s:=chaine_CDM_vitesseST(vitesse,nom_train); // par nom du train + //s:=chaine_CDM_vitesseINT(vitesse,loco); // par adresse du train envoi_CDM(s); //affiche(s,clLime); end; @@ -2892,7 +2900,7 @@ begin Dessine_feu_mx(Feux[i].Img.Canvas,0,0,1,1,adr,1); // allume les signaux du feu dans le TCO - if AvecTCO then + if formTCO.Showing then begin for y:=1 to NbreCellY do for x:=1 to NbreCellX do @@ -5945,7 +5953,7 @@ begin AfficheDebug(intToSTR(event_det_train[i].det[1]),clyellow); AfficheDebug(intToSTR(event_det_train[i].det[2]),clyellow); end; - if avecTCO then + if formTCO.Showing then begin zone_TCO(det2,det3,0); // désactivation // activation @@ -6425,7 +6433,7 @@ begin // attention à partir de cette section le code est susceptible de ne pas être exécuté?? // Mettre à jour le TCO - if AvecTCO then + if formTCO.Showing then begin formTCO.Maj_TCO(Adresse); end; @@ -6487,7 +6495,7 @@ begin event_det_tick[N_event_tick].etat:=pos; // Mettre à jour le TCO - if AvecTCO then formTCO.Maj_TCO(Adresse); + if formTCO.Showing then formTCO.Maj_TCO(Adresse); // l'évaluation des routes est à faire selon conditions if faire_event and not(confignulle) then evalue; @@ -6999,17 +7007,17 @@ begin s:=#$f0; s:=checksum(s); envoi_ss_ack(s); - + application.processMessages; s:='Port com'+intToSTR(port)+' ouvert '; temp:=0; repeat sleep(100); inc(temp); - Application.processmessages; - until (version_Interface<>'') or (temp>10); + // Application.processmessages; // provoque violation + until (version_Interface<>'') or (temp>2); - if (temp>10) then + if (temp>2) then begin Affiche(s+' mais l''interface n''a pas répondu',clyellow); portCommOuvert:=false; // refermer le port @@ -7032,7 +7040,6 @@ begin end; end else inc(port); - Application.processMessages; until (port=10) or trouve; end; @@ -7080,7 +7087,7 @@ begin begin portCommOuvert:=false; //Affiche('Détection automatique du port de l''interface Xpressnet',clyellow); - NumPort:=trouve_USB; + NumPort:=trouve_USB; portCommOuvert:=NumPort<>0; end; @@ -7433,7 +7440,6 @@ begin LabelEtat.Caption:='Initialisations en cours'; //Menu_interface(devalide); - // créée la fenetre debug FormDebug:=TFormDebug.Create(Self); FormDebug.Caption:=AF+' debug'; @@ -7447,10 +7453,9 @@ begin Option_demarrage:=false; // démarrage des trains après tempo, pas encore au point Diffusion:=AvecInit; // mode diffusion publique - Application.processMessages; - // créée la fenetre vérification de version + // créée la fenetre vérification de version FormVersion:=TformVersion.Create(Self); - + ferme:=false; CDM_connecte:=false; pasreponse:=0; @@ -7462,13 +7467,13 @@ begin NumTrameCDM:=0; Application.HintHidePause:=30000; - // lecture fichiers de configuration - lit_config; - Application.processMessages; + // lecture fichiers de configuration + lit_config; + Application.ProcessMessages; // lancer CDM rail et le connecte si on le demande + if LanceCDM then Lance_CDM; - ButtonAffTCO.visible:=AvecTCO; Loco.Visible:=true; // tenter la liaison vers CDM rail @@ -7535,11 +7540,10 @@ begin GroupBox3.visible:=true; // TCO - if avectco then begin //créée la fenêtre TCO non modale FormTCO:=TformTCO.Create(nil); - FormTCO.show; + if avecTCO then FormTCO.show; end; Affiche('Fin des initialisations',clyellow); @@ -7745,7 +7749,7 @@ begin end; // feux du TCO - if avecTCO then + if TCOouvert then // évite d'accéder à la variable FormTCO si elle est pas encore ouverte begin // parcourir les feux du TCO for y:=1 to NbreCellY do @@ -9152,7 +9156,6 @@ end; procedure TFormPrinc.ConfigClick(Sender: TObject); begin - Tformconfig.create(nil); FormConfig.PageControl.ActivePage:=Formconfig.TabSheetCDM; // force le premier onglet sur la page formconfig.showmodal; // ne pas faire close : déja provoqué par le self de la fermeture @@ -9270,6 +9273,7 @@ end; procedure TFormPrinc.ButtonAffTCOClick(Sender: TObject); begin formTCO.windowState:=wsNormal; //Maximized; + formTCO.show; formTCO.BringToFront; end; @@ -9295,8 +9299,8 @@ begin s:=editVitesse.Text; val(s,vit,erreur); if (erreur<>0) or (vit<0) then exit; - Affiche('Commande vitesse train '+s+ ' à '+IntToSTR(vit)+'%',cllime); s:=trains[combotrains.itemindex+1].nom_train; + Affiche('Commande vitesse train '+s+' ('+intToSTR(adr)+') à '+IntToSTR(vit)+'%',cllime); vitesse_loco(s,adr,vit,true); if s='' then s:=intToSTR(adr); end; @@ -9392,7 +9396,6 @@ begin s:=((Tpopupmenu(Tmenuitem(sender).GetParentMenu).PopupComponent) as TImage).name; // nom du composant, pout récupérer l'adresse du feu (ex: ImageFeu260) //Affiche(s,clOrange); // nom de l'image du signal (ex: ImageFeu260) adresseFeuClic:=extract_int(s); // extraire l'adresse (ex 260) - Tformconfig.create(nil); formconfig.PageControl.ActivePage:=formconfig.TabSheetSig; clicproprietes:=true; formconfig.showmodal; diff --git a/UnitTCO.dcu b/UnitTCO.dcu index c6dfa35..49a1932 100644 Binary files a/UnitTCO.dcu and b/UnitTCO.dcu differ diff --git a/UnitTCO.dfm b/UnitTCO.dfm index 08cfe2e..da19bae 100644 --- a/UnitTCO.dfm +++ b/UnitTCO.dfm @@ -1,6 +1,6 @@ object FormTCO: TFormTCO - Left = 151 - Top = 72 + Left = 155 + Top = 94 Width = 1139 Height = 694 VertScrollBar.Visible = False @@ -16,7 +16,6 @@ object FormTCO: TFormTCO OldCreateOrder = False Position = poScreenCenter OnActivate = FormActivate - OnClose = FormClose OnCreate = FormCreate OnDockOver = FormDockOver OnKeyDown = FormKeyDown @@ -164,32 +163,6 @@ object FormTCO: TFormTCO DesignSize = ( 1100 166) - object Label4: TLabel - Left = 8 - Top = 16 - Width = 103 - Height = 16 - Caption = 'Adresse de l'#39#233'l'#233'ment: ' - Font.Charset = ANSI_CHARSET - Font.Color = clWindowText - Font.Height = -13 - Font.Name = 'Arial Narrow' - Font.Style = [] - ParentFont = False - end - object Label15: TLabel - Left = 8 - Top = 38 - Width = 93 - Height = 16 - Caption = 'Image de l'#39#233'l'#233'ment: ' - Font.Charset = ANSI_CHARSET - Font.Color = clWindowText - Font.Height = -13 - Font.Name = 'Arial Narrow' - Font.Style = [] - ParentFont = False - end object ImagePalette5: TImage Left = 504 Top = 8 @@ -564,19 +537,6 @@ object FormTCO: TFormTCO OnEndDrag = ImagePalette15EndDrag OnMouseDown = ImagePalette15MouseDown end - object Label23: TLabel - Left = 56 - Top = 64 - Width = 27 - Height = 16 - Caption = 'Texte' - Font.Charset = ANSI_CHARSET - Font.Color = clWindowText - Font.Height = -13 - Font.Name = 'Arial Narrow' - Font.Style = [] - ParentFont = False - end object ImagePalette16: TImage Left = 504 Top = 56 @@ -744,19 +704,6 @@ object FormTCO: TFormTCO Font.Style = [fsBold] ParentFont = False end - object Label1: TLabel - Left = 8 - Top = 88 - Width = 75 - Height = 16 - Caption = 'position du texte' - Font.Charset = ANSI_CHARSET - Font.Color = clBlack - Font.Height = -13 - Font.Name = 'Arial Narrow' - Font.Style = [] - ParentFont = False - end object ImagePalette23: TImage Left = 360 Top = 104 @@ -783,35 +730,6 @@ object FormTCO: TFormTCO Font.Style = [fsBold] ParentFont = False end - object EditAdrElement: TEdit - Left = 144 - Top = 16 - Width = 33 - Height = 21 - Font.Charset = ANSI_CHARSET - Font.Color = clWindowText - Font.Height = -9 - Font.Name = 'MS Sans Serif' - Font.Style = [] - ParentFont = False - TabOrder = 0 - OnChange = EditAdrElementChange - OnKeyDown = EditAdrElementKeyDown - end - object EditTypeImage: TEdit - Left = 144 - Top = 40 - Width = 33 - Height = 21 - Font.Charset = ANSI_CHARSET - Font.Color = clWindowText - Font.Height = -9 - Font.Name = 'MS Sans Serif' - Font.Style = [] - ParentFont = False - TabOrder = 1 - OnKeyPress = EditTypeImageKeyPress - end object ButtonSauveTCO: TButton Left = 992 Top = 48 @@ -819,7 +737,7 @@ object FormTCO: TFormTCO Height = 33 Anchors = [akTop, akRight] Caption = 'Sauvegarder TCO' - TabOrder = 2 + TabOrder = 0 WordWrap = True OnClick = ButtonSauveTCOClick end @@ -830,7 +748,7 @@ object FormTCO: TFormTCO Height = 33 Anchors = [akTop, akRight] Caption = 'Redessine' - TabOrder = 3 + TabOrder = 1 OnClick = ButtonRedessineClick end object Button1: TButton @@ -839,7 +757,7 @@ object FormTCO: TFormTCO Width = 89 Height = 25 Caption = 'Simu det 1' - TabOrder = 4 + TabOrder = 2 OnClick = Button1Click end object Button2: TButton @@ -848,7 +766,7 @@ object FormTCO: TFormTCO Width = 89 Height = 25 Caption = 'Simu Det 0' - TabOrder = 5 + TabOrder = 3 OnClick = Button2Click end object ButtonConfigTCO: TButton @@ -858,44 +776,18 @@ object FormTCO: TFormTCO Height = 33 Anchors = [akTop, akRight] Caption = 'Configuration TCO' - TabOrder = 6 + TabOrder = 4 OnClick = ButtonConfigTCOClick end - object EditTexte: TEdit - Left = 88 - Top = 64 - Width = 89 - Height = 21 - TabOrder = 7 - OnChange = EditTexteChange - end object ButtonSimu: TButton Left = 864 Top = 80 Width = 113 Height = 25 Caption = 'Simu canton occup'#233 - TabOrder = 8 + TabOrder = 5 OnClick = ButtonSimuClick end - object CheckPinv: TCheckBox - Left = 16 - Top = 112 - Width = 161 - Height = 17 - Hint = 'Cocher si l'#39'aiguillage est repr'#233'sent'#233' invers'#233 - Caption = 'aiguillage invers'#233 - Font.Charset = ANSI_CHARSET - Font.Color = clWindowText - Font.Height = -9 - Font.Name = 'MS Sans Serif' - Font.Style = [] - ParentFont = False - ParentShowHint = False - ShowHint = True - TabOrder = 9 - OnClick = CheckPinvClick - end object ButtonMasquer: TButton Left = 992 Top = 128 @@ -903,32 +795,153 @@ object FormTCO: TFormTCO Height = 33 Anchors = [akTop, akRight] Caption = 'Masquer bandeau' - TabOrder = 10 + TabOrder = 6 WordWrap = True OnClick = ButtonMasquerClick end - object ComboRepr: TComboBox - Left = 88 - Top = 88 - Width = 89 - Height = 21 - ItemHeight = 13 - TabOrder = 11 - OnChange = ComboReprChange - Items.Strings = ( - 'Sans' - 'Centrale' - 'Haut' - 'Bas') - end - object ButtonFonte: TButton - Left = 8 - Top = 64 - Width = 41 - Height = 17 - Caption = 'Fonte' - TabOrder = 12 - OnClick = ButtonFonteClick + object GroupBox1: TGroupBox + Left = 0 + Top = 8 + Width = 185 + Height = 137 + Caption = 'Configuration cellule' + Font.Charset = ANSI_CHARSET + Font.Color = clBackground + Font.Height = -9 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + TabOrder = 7 + object Label4: TLabel + Left = 8 + Top = 16 + Width = 103 + Height = 16 + Caption = 'Adresse de l'#39#233'l'#233'ment: ' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Arial Narrow' + Font.Style = [] + ParentFont = False + end + object Label15: TLabel + Left = 8 + Top = 38 + Width = 93 + Height = 16 + Caption = 'Image de l'#39#233'l'#233'ment: ' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Arial Narrow' + Font.Style = [] + ParentFont = False + end + object Label23: TLabel + Left = 56 + Top = 64 + Width = 27 + Height = 16 + Caption = 'Texte' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Arial Narrow' + Font.Style = [] + ParentFont = False + end + object Label1: TLabel + Left = 8 + Top = 88 + Width = 75 + Height = 16 + Caption = 'position du texte' + Font.Charset = ANSI_CHARSET + Font.Color = clBlack + Font.Height = -13 + Font.Name = 'Arial Narrow' + Font.Style = [] + ParentFont = False + end + object EditAdrElement: TEdit + Left = 144 + Top = 16 + Width = 33 + Height = 21 + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -9 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + TabOrder = 0 + OnChange = EditAdrElementChange + OnKeyDown = EditAdrElementKeyDown + end + object EditTypeImage: TEdit + Left = 144 + Top = 40 + Width = 33 + Height = 21 + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -9 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + TabOrder = 1 + OnKeyPress = EditTypeImageKeyPress + end + object ButtonFonte: TButton + Left = 8 + Top = 64 + Width = 41 + Height = 17 + Caption = 'Fonte' + TabOrder = 2 + OnClick = ButtonFonteClick + end + object EditTexte: TEdit + Left = 88 + Top = 64 + Width = 89 + Height = 21 + TabOrder = 3 + OnChange = EditTexteChange + end + object ComboRepr: TComboBox + Left = 88 + Top = 84 + Width = 89 + Height = 21 + ItemHeight = 13 + TabOrder = 4 + OnChange = ComboReprChange + Items.Strings = ( + 'Sans' + 'Centrale' + 'Haut' + 'Bas') + end + object CheckPinv: TCheckBox + Left = 16 + Top = 112 + Width = 161 + Height = 17 + Hint = 'Cocher si l'#39'aiguillage est repr'#233'sent'#233' invers'#233 + Caption = 'aiguillage invers'#233 + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -9 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + ParentShowHint = False + ShowHint = True + TabOrder = 5 + OnClick = CheckPinvClick + end end end object ButtonAfficheBandeau: TButton @@ -943,6 +956,7 @@ object FormTCO: TFormTCO OnClick = ButtonAfficheBandeauClick end object PopupMenu1: TPopupMenu + OnPopup = PopupMenu1Popup Left = 360 object MenuCouper: TMenuItem Caption = 'Couper' @@ -966,28 +980,38 @@ object FormTCO: TFormTCO object N1: TMenuItem Caption = '-' end - object Tourner90G: TMenuItem - Caption = 'Positionner signal 90'#176' '#224' gauche' - OnClick = Tourner90GClick - end - object Tourner90D: TMenuItem - Caption = 'Positionner signal 90'#176' '#224' droite' - OnClick = Tourner90DClick - end - object Pos_vert: TMenuItem - Caption = 'Positionner signal verticalement' - OnClick = Pos_vertClick + object Signal1: TMenuItem + Caption = 'Signal' + object Tourner90G: TMenuItem + Caption = 'Signal 90'#176' '#224' gauche' + OnClick = Tourner90GClick + end + object Tourner90D: TMenuItem + Caption = 'Signal 90'#176' '#224' droite' + OnClick = Tourner90DClick + end + object Pos_vert: TMenuItem + Caption = 'Signal vertical' + OnClick = Pos_vertClick + end + object N4: TMenuItem + Caption = '-' + end + object Signalgauchedelavoie1: TMenuItem + Caption = 'Signal '#224' gauche de la voie' + OnClick = Signalgauchedelavoie1Click + end + object Signaldroitedelavoie1: TMenuItem + Caption = 'Signal '#224' droite de la voie' + OnClick = Signaldroitedelavoie1Click + end end object N2: TMenuItem Caption = '-' end - object Signalgauchedelavoie1: TMenuItem - Caption = 'Signal '#224' gauche de la voie' - OnClick = Signalgauchedelavoie1Click - end - object Signaldroitedelavoie1: TMenuItem - Caption = 'Signal '#224' droite de la voie' - OnClick = Signaldroitedelavoie1Click + object N3: TMenuItem + Caption = 'Propri'#233't'#233's' + OnClick = N3Click end end object FontDialog1: TFontDialog diff --git a/UnitTCO.pas b/UnitTCO.pas index 60d7cf1..1bc7c19 100644 --- a/UnitTCO.pas +++ b/UnitTCO.pas @@ -26,10 +26,6 @@ type Pos_vert: TMenuItem; TrackBarZoom: TTrackBar; Panel1: TPanel; - Label4: TLabel; - Label15: TLabel; - EditAdrElement: TEdit; - EditTypeImage: TEdit; ImageTemp: TImage; ImagePalette5: TImage; Label6: TLabel; @@ -71,10 +67,7 @@ type ImagePalette14: TImage; Label22: TLabel; ImagePalette15: TImage; - Label23: TLabel; - EditTexte: TEdit; ButtonSimu: TButton; - CheckPinv: TCheckBox; ImagePalette16: TImage; Label24: TLabel; ImagePalette17: TImage; @@ -91,15 +84,26 @@ type Label29: TLabel; ImagePalette22: TImage; Label30: TLabel; - ComboRepr: TComboBox; - Label1: TLabel; ImagePalette23: TImage; Label31: TLabel; FontDialog1: TFontDialog; - ButtonFonte: TButton; N2: TMenuItem; Signalgauchedelavoie1: TMenuItem; Signaldroitedelavoie1: TMenuItem; + N3: TMenuItem; + Signal1: TMenuItem; + N4: TMenuItem; + GroupBox1: TGroupBox; + Label4: TLabel; + EditAdrElement: TEdit; + EditTypeImage: TEdit; + Label15: TLabel; + ButtonFonte: TButton; + Label23: TLabel; + EditTexte: TEdit; + ComboRepr: TComboBox; + Label1: TLabel; + CheckPinv: TCheckBox; procedure FormCreate(Sender: TObject); procedure ImageTCOClick(Sender: TObject); procedure FormActivate(Sender: TObject); @@ -145,7 +149,6 @@ type Y: Integer); procedure ImageTCOMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - procedure Efface_Cellule(Canvas : Tcanvas;x,y : integer; couleur : Tcolor;Mode : TPenMode); procedure MenuCopierClick(Sender: TObject); procedure MenuCollerClick(Sender: TObject); procedure ButtonRedessineClick(Sender: TObject); @@ -170,7 +173,6 @@ type procedure Pos_vertClick(Sender: TObject); procedure TrackBarZoomChange(Sender: TObject); procedure AnnulercouperClick(Sender: TObject); - procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure ImagePalette12EndDrag(Sender, Target: TObject; X, Y: Integer); procedure ImagePalette12MouseDown(Sender: TObject; @@ -280,6 +282,8 @@ type procedure FontDialog1Show(Sender: TObject); procedure Signaldroitedelavoie1Click(Sender: TObject); procedure Signalgauchedelavoie1Click(Sender: TObject); + procedure PopupMenu1Popup(Sender: TObject); + procedure N3Click(Sender: TObject); private { Déclarations privées } @@ -316,7 +320,7 @@ type FontStyle : string[4]; // GSIB (Gras Souligné Italique Barré) coulFonte : Tcolor; TailleFonte : integer; - Couleur : Tcolor; // couleur de fond de la cellule + Couleur : Tcolor; // couleur non utilisée // pour les feux seulement PiedFeu : integer; // type de pied au feu : signal à gauche=1 ou à droite=2 de la voie x,y : integer ; // coordonnées pixels relativés du coin sup gauche du feu pour le décalage par rapport à la cellule @@ -327,7 +331,7 @@ var clAllume,clVoies,Fond,couleurAdresse,clGrille,cltexte,clQuai,CoulFonte,ClCanton : Tcolor; FormTCO: TFormTCO; Forminit,sourisclic,SelectionAffichee,TamponAffecte,entoure,Diffusion,TCO_modifie, - piloteAig,BandeauMasque,eval_format : boolean; + piloteAig,BandeauMasque,eval_format,TCOouvert : boolean; HtImageTCO,LargImageTCO,XclicCell,YclicCell,XminiSel,YminiSel,XCoupe,Ycoupe,Temposouris, XmaxiSel,YmaxiSel,AncienXMiniSel,AncienXMaxiSel ,AncienYMiniSel,AncienYMaxiSel, Xclic,Yclic,XClicCellInserer,YClicCellInserer,Xentoure,Yentoure,RatioC,ModeCouleurCanton, @@ -351,10 +355,19 @@ procedure sauve_fichier_tco; procedure zone_TCO(det1,det2,mode: integer); procedure efface_entoure; procedure affiche_TCO; +procedure affiche_cellule(x,y : integer); +procedure _entoure_cell_clic; +procedure affiche_texte(x,y : integer); +procedure change_fonte; +procedure Tourne90G; +procedure Tourne90D; +procedure Vertical; +procedure signalG; +procedure signalD; implementation -uses UnitConfigTCO, Unit_Pilote_aig; +uses UnitConfigTCO, Unit_Pilote_aig, UnitConfigCellTCO; {$R *.dfm} @@ -1162,7 +1175,7 @@ begin jy2:=y0+(HauteurCell div 2)+round(3*FrYGlob); // pos Y de la bande inf inverse:=tco[x,y].inverse; position:=positionTCO(x,y); - + with canvas do begin Brush.Color:=Fond; @@ -2453,7 +2466,7 @@ begin moveTo( x+round((x1+0)*frX),y+round(y1*frY) ); LineTo( x+round((x1+0)*frX),y+round((y1+7)*frY) ); - if pied=1 then LineTo( x+round((x1+50)*frX),y+round((y1+7)*frY) ) else + if pied=1 then LineTo( x+round((x1+50)*frX),y+round((y1+7)*frY) ) else LineTo( x+round((x1-50)*frX),y+round((y1+7)*frY) ); moveTo( x+round((x1+1)*frX),y+round((y1+0)*frY) ); @@ -2698,7 +2711,7 @@ begin dessine_feu_mx(canvasDest,x0,y0,frX,frY,adresse,orientation); end; -procedure TformTCO.Efface_Cellule(Canvas : Tcanvas;x,y : integer; couleur : Tcolor;Mode : TPenMode); +procedure Efface_Cellule(Canvas : Tcanvas;x,y : integer; couleur : Tcolor;Mode : TPenMode); var x0,y0 : integer; r : TRect; begin @@ -2952,10 +2965,11 @@ end; procedure _entoure_cell_clic; begin - if not(entoure) then + if not(entoure) then begin Entoure_cell(XclicCell,YclicCell); - Xentoure:=XClicCell;Yentoure:=YclicCell;entoure:=true; + Xentoure:=XClicCell;Yentoure:=YclicCell; + entoure:=true; end else begin @@ -2981,7 +2995,7 @@ begin if ss='' then ss:='Arial'; PcanvasTCO.Font.Name:=ss; ss:=tco[x,y].FontStyle; - + PcanvasTCO.Font.Style:=style(ss); repr:=tco[x,y].repr; @@ -2996,7 +3010,7 @@ begin if taillefonte=0 then taillefonte:=8; PCanvasTCO.font.Size:=(taillefonte*LargeurCell) div 40; - s:=tco[x,y].Texte; + s:=tco[x,y].Texte+' '; PcanvasTCO.Textout(x0+2,y0+yt,s); end; @@ -3087,6 +3101,9 @@ begin // évite le clignotement pendant les affichages mais ne marche pas //DoubleBuffered:=true; comborepr.Enabled:=false; + ImageTCO.Top:=0; + ImageTCO.Left:=0; + TCOouvert:=true; //controlStyle:=controlStyle+[csOpaque]; end; @@ -3097,7 +3114,7 @@ var Position: TPoint; s : string; begin //Affiche('Clic gauche',clLime); - + GetCursorPos(Position); { Menuitem:=TmenuItem.Create(popupMenu1); @@ -3120,11 +3137,21 @@ begin if (bimage=2) or (bimage=3) or (bimage=4) or (bimage=5) or (bimage=12) or (bimage=13) or (bimage=14) or (bimage=15) then begin - CheckPinv.enabled:=true ; + + with FormConfCellTCO.CheckPinv do + begin + enabled:=true; + checked:=TCO[XClicCell,YClicCell].inverse; + end; CheckPinv.checked:=TCO[XClicCell,YClicCell].inverse; + CheckPinv.enabled:=true ; end - else CheckPinv.enabled:=false; - + else + begin + CheckPinv.enabled:=false; + FormConfCellTCO.checkPinv.enabled:=false; + end; + if (Bimage=1) or (Bimage=0) or (Bimage=23) then begin s:=Tco[XClicCell,YClicCell].Texte; @@ -3149,6 +3176,8 @@ begin ComboRepr.ItemIndex:=tco[XClicCell,yClicCell].repr; if not(selectionaffichee) then _entoure_cell_clic; + + actualise; end; // trouve le détecteur det dans le TCO et renvoie X et Y @@ -3157,7 +3186,7 @@ var xc,yc : integer; trouve : boolean; begin yc:=1; - repeat + repeat xc:=0; repeat inc(xc); @@ -3496,7 +3525,7 @@ begin dec(ir); for i:=1 to ir do Affiche_cellule(routeTCO[i].x,routeTCO[i].y); - + end; procedure TFormTCO.FormActivate(Sender: TObject); @@ -3514,7 +3543,6 @@ begin ButtonAfficheBandeau.visible:=false; TrackBarZoom.Max:=ZoomMax; TrackBarZoom.Min:=ZoomMin; - PScrollBoxTCO:=FormTCO.ScrollBox; @@ -3596,7 +3624,7 @@ procedure TFormTCO.ImageTCOContextPopup(Sender: TObject; MousePos: TPoint; var H var Position: TPoint; begin - //Affiche('Clic droit',clyellow); + // Affiche('Clic droit',clyellow); // efface le carré pointeur //Entoure_cell(XclicCell,YclicCell); GetCursorPos(Position); @@ -3606,7 +3634,7 @@ begin XclicCell:=Xclic div largeurCell +1; YclicCell:=Yclic div hauteurCell +1; - // _entoure_cell_clic; + _entoure_cell_clic; LabelX.caption:=IntToSTR(XclicCell); LabelY.caption:=IntToSTR(YclicCell); @@ -3799,7 +3827,7 @@ begin dessin_4(ImageTCO.Canvas,XClicCell,YClicCell,0); tco[XClicCell,YClicCell].BImage:=4; // image 4 tco[xClicCell,YClicCell].CoulFonte:=clYellow; - entoure_cell_grille(XClicCell,YClicCell); + entoure_cell_grille(XClicCell,YClicCell); _entoure_cell_clic; EditAdrElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Adresse); EdittypeImage.Text:=IntToSTR(tco[XClicCell,YClicCell].BImage); @@ -3828,7 +3856,7 @@ begin _entoure_cell_clic; EditAdrElement.Text:=IntToSTR(tco[XClicCell,YClicCell].Adresse); EdittypeImage.Text:=IntToSTR(tco[XClicCell,YClicCell].BImage); - + end; procedure TFormTCO.ImagePalette1MouseDown(Sender: TObject; @@ -4073,7 +4101,7 @@ begin tco[XClicCell,YClicCell].BImage:=14; // image 14 tco[XClicCell,YClicCell].Adresse:=0; // rien tco[xClicCell,YClicCell].CoulFonte:=clYellow; - entoure_cell_grille(XClicCell,YClicCell); + entoure_cell_grille(XClicCell,YClicCell); _entoure_cell_clic; EditAdrElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Adresse); EdittypeImage.Text:=IntToSTR(tco[XClicCell,YClicCell].BImage); @@ -4280,9 +4308,9 @@ begin 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; + TamponAffecte:=true; end; - + end; procedure TFormTCO.MenuCopierClick(Sender: TObject); @@ -4389,7 +4417,7 @@ begin Rectangle(rAncien); end; SelectionAffichee:=false; - end; + end; end; if button=mbRight then @@ -4526,10 +4554,11 @@ begin Val(EditAdrElement.Text,Adr,erreur); if (erreur<>0) or (Adr<0) or (Adr>2048) then Adr:=0; - + if Adr=0 then tco[XClicCell,YClicCell].repr:=2; tco[XClicCell,YClicCell].Adresse:=Adr; + formConfCellTCO.editAdrElement.Text:=intToSTR(Adr); if tco[XClicCell,YClicCell].BImage=30 then begin @@ -4549,29 +4578,32 @@ end; procedure TFormTCO.EditAdrElementKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin - if key=VK_RETURN then + if key=VK_RETURN then begin efface_entoure; affiche_cellule(XClicCell,YClicCell); - end; + end; end; procedure TFormTCO.EditTypeImageKeyPress(Sender: TObject; var Key: Char); -var Bimage,erreur : integer; +var Bimage,erreur,i : integer; begin + if actualize then exit; if ord(Key)=VK_RETURN then begin Key:=#0; // évite beeping Val(EditTypeImage.Text,Bimage,erreur); //Affiche('Keypressed / Bimage='+IntToSTR(bimage),clyellow); - if (erreur<>0) or (Bimage<0) or (Bimage>15) then + if (erreur<>0) or not(Bimage in[0..23,30]) then begin EditTypeImage.text:=intToSTR(tco[XClicCell,YClicCell].BImage); exit; - end; + end; TCO_modifie:=true; tco[XClicCell,YClicCell].Bimage:=Bimage; - + formConfCellTCO.EditTypeImage.Text:=intToSTR(Bimage); + actualise; // pour mise à jour de l'image de la fenetre FormConfCellTCO + efface_entoure; affiche_cellule(XClicCell,YClicCell); end; end; @@ -4703,10 +4735,10 @@ begin ImagePalette30.BeginDrag(true); end; - -procedure TFormTCO.Tourner90GClick(Sender: TObject); +procedure Tourne90G; var BImage : integer; begin + if actualize then exit; BImage:=TCO[XClicCell,YClicCell].Bimage; if Bimage<>30 then exit; @@ -4734,11 +4766,18 @@ begin tco[XClicCell,YClicCell].FeuOriente:=2; // feu orienté à 90° gauche Affiche_TCO; + actualise; // met à jour la fenetre de config de la cellule end; -procedure TFormTCO.Tourner90DClick(Sender: TObject); +procedure TFormTCO.Tourner90GClick(Sender: TObject); +begin + tourne90G; +end; + +procedure tourne90D; var BImage ,aspect,adresse : integer; begin + if actualize then exit; BImage:=TCO[XClicCell,YClicCell].Bimage; if Bimage<>30 then exit; @@ -4772,12 +4811,18 @@ begin tco[XClicCell,YClicCell].FeuOriente:=3; // feu orienté à 90° droit //dessin_feu(PCanvasTCO,XclicCell,YClicCell); Affiche_TCO; + actualise; // met à jour la fenetre de config de la cellule end; +procedure TFormTCO.Tourner90DClick(Sender: TObject); +begin + tourne90D; +end; -procedure TFormTCO.Pos_vertClick(Sender: TObject); +procedure vertical; var BImage ,aspect,Adresse : integer; begin + if actualize then exit; BImage:=TCO[XClicCell,YClicCell].Bimage; // si c'est autre chose qu'un feu, sortir if Bimage<>30 then exit; @@ -4815,9 +4860,14 @@ begin tco[XClicCell,YClicCell].FeuOriente:=1; // feu orienté à 180° //dessin_feu(PCanvasTCO,XclicCell,YClicCell); affiche_tco; - + actualise; // met à jour la fenetre de config de la cellule end; +procedure TFormTCO.Pos_vertClick(Sender: TObject); +begin + vertical; +end; + procedure TFormTCO.TrackBarZoomChange(Sender: TObject); begin calcul_cellules; @@ -4827,22 +4877,18 @@ begin end; -// interdire la fermeture de la fenêtre tco -procedure TFormTCO.FormClose(Sender: TObject; var Action: TCloseAction); -begin - action:=tCloseAction(caNone); -end; - procedure TFormTCO.EditTexteChange(Sender: TObject); begin PCanvasTCO.Brush.Color:=fond; - + efface_entoure; if Tco[XClicCell,YClicCell].texte='' then begin Tco[XClicCell,YClicCell].CoulFonte:=clTexte; Tco[XClicCell,YClicCell].TailleFonte:=8; end; + Tco[XClicCell,YClicCell].Texte:=EditTexte.Text; + formConfCellTCO.EditTexte.Text:=EditTexte.Text; TCO_modifie:=true; affiche_texte(XClicCell,YClicCell); end; @@ -4875,6 +4921,7 @@ end; procedure TFormTCO.CheckPinvClick(Sender: TObject); var Bimage : integer; begin + if actualize then exit; if (xClicCell=0) or (xClicCell>NbreCellX) or (yClicCell=0) or (yClicCell>NbreCelly) then exit; Bimage:=Tco[xClicCell,yClicCell].Bimage; if (bimage=2) or (bimage=3) or (bimage=4) or (bimage=5) or (bimage=12) or (bimage=13) @@ -4882,7 +4929,7 @@ begin begin TCO[xClicCell,yClicCell].inverse:=CheckPinv.checked; TCO_modifie:=true; - end; + end; end; procedure TFormTCO.ButtonMasquerClick(Sender: TObject); @@ -4982,7 +5029,9 @@ end; procedure TFormTCO.ComboReprChange(Sender: TObject); begin tco[XClicCell,YClicCell].Repr:=comborepr.ItemIndex; - efface_entoure;SelectionAffichee:=false; + efface_entoure; + SelectionAffichee:=false; + formConfCellTCO.ComboRepr.ItemIndex:=ComboRepr.ItemIndex; sourisclic:=false; //affiche_cellule(XClicCell,yClicCell); affiche_tco; @@ -5157,66 +5206,144 @@ begin accept:=true; end; -procedure TFormTCO.ButtonFonteClick(Sender: TObject); +procedure change_fonte; var s,ss : string; fs : TFontStyles; begin s:='Fonte et couleur pour la cellule ('+intToSTR(xClicCell)+','+intToSTR(YClicCell)+') Texte: '; ss:=tco[xClicCell,YClicCell].Texte; if ss='' then s:=s+inttoSTR(tco[xClicCell,YClicCell].Adresse) else s:=s+ss; - + titre_fonte:=s; - FontDialog1.Font.Name:=tco[XclicCell,YclicCell].Fonte; - FontDialog1.Font.Color:=tco[XclicCell,YclicCell].CoulFonte; - FontDialog1.Font.Size:=tco[XclicCell,YclicCell].taillefonte; - - fs:=[]; - s:=tco[XclicCell,YclicCell].FontStyle; - if pos('G',s)<>0 then fs:=fs+[fsbold]; - if pos('I',s)<>0 then fs:=fs+[fsItalic]; - if pos('S',s)<>0 then fs:=fs+[fsUnderline]; - if pos('B',s)<>0 then fs:=fs+[fsStrikeout]; - FontDialog1.Font.Style:=fs; - - if FontDialog1.execute then + With FormTCO do begin - tco[XclicCell,YclicCell].Fonte:=FontDialog1.Font.Name; - tco[XclicCell,YclicCell].CoulFonte:=FontDialog1.Font.Color; - tco[XclicCell,YclicCell].taillefonte:=FontDialog1.Font.Size; - fs:=FontDialog1.Font.Style; - s:=''; - if fsBold in fs then s:=s+'G'; - if fsItalic in fs then s:=s+'I'; - if fsUnderline in fs then s:=s+'S'; - if fsStrikeout in fs then s:=s+'B'; - tco[XclicCell,YclicCell].FontStyle:=s; - affiche_tco; + FontDialog1.Font.Name:=tco[XclicCell,YclicCell].Fonte; + FontDialog1.Font.Color:=tco[XclicCell,YclicCell].CoulFonte; + FontDialog1.Font.Size:=tco[XclicCell,YclicCell].taillefonte; + + fs:=[]; + s:=tco[XclicCell,YclicCell].FontStyle; + if pos('G',s)<>0 then fs:=fs+[fsbold]; + if pos('I',s)<>0 then fs:=fs+[fsItalic]; + if pos('S',s)<>0 then fs:=fs+[fsUnderline]; + if pos('B',s)<>0 then fs:=fs+[fsStrikeout]; + FontDialog1.Font.Style:=fs; + + if FontDialog1.execute then + begin + tco[XclicCell,YclicCell].Fonte:=FontDialog1.Font.Name; + tco[XclicCell,YclicCell].CoulFonte:=FontDialog1.Font.Color; + tco[XclicCell,YclicCell].taillefonte:=FontDialog1.Font.Size; + fs:=FontDialog1.Font.Style; + s:=''; + if fsBold in fs then s:=s+'G'; + if fsItalic in fs then s:=s+'I'; + if fsUnderline in fs then s:=s+'S'; + if fsStrikeout in fs then s:=s+'B'; + tco[XclicCell,YclicCell].FontStyle:=s; + affiche_tco; + end; end; end; +procedure TFormTCO.ButtonFonteClick(Sender: TObject); +begin + change_fonte; +end; + procedure TFormTCO.FontDialog1Show(Sender: TObject); begin SetWindowText(FontDialog1.Handle,pchar(titre_Fonte)); end; -procedure TFormTCO.Signaldroitedelavoie1Click(Sender: TObject); +procedure signalD; begin + if actualize then exit; if TCO[XClicCell,YClicCell].Bimage=30 then begin TCO[XClicCell,YClicCell].PiedFeu:=2; Affiche_TCO; + TCO_modifie:=true; + actualise; // met à jour la fenetre de config de la cellule + end; +end; + +procedure TFormTCO.Signaldroitedelavoie1Click(Sender: TObject); +begin + signalD; +end; + +procedure signalG; +begin + if actualize then exit; + if TCO[XClicCell,YClicCell].Bimage=30 then + begin + TCO[XClicCell,YClicCell].PiedFeu:=1; + Affiche_TCO; + TCO_modifie:=true; + actualise; // met à jour la fenetre de config de la cellule end; end; procedure TFormTCO.Signalgauchedelavoie1Click(Sender: TObject); begin - if TCO[XClicCell,YClicCell].Bimage=30 then + signalG; +end; + +procedure TFormTCO.PopupMenu1Popup(Sender: TObject); +var oriente,piedFeu : integer; +begin + //Affiche('on popup',clyellow); + // grise ou non l'entrée signal du menu + if tco[XClicCell,YClicCell].Bimage=30 then begin - TCO[XClicCell,YClicCell].PiedFeu:=1; - Affiche_TCO; - end; + PopUpMenu1.Items[6].Enabled:=true; + oriente:=tco[XClicCell,YClicCell].Feuoriente; + if oriente=1 then + begin + PopUpMenu1.Items[6][0].checked:=false; + PopUpMenu1.Items[6][1].checked:=false; + PopUpMenu1.Items[6][2].checked:=true; + end; + if oriente=2 then + begin + PopUpMenu1.Items[6][0].checked:=true; + PopUpMenu1.Items[6][1].checked:=false; + PopUpMenu1.Items[6][2].checked:=false; + end; + if oriente=3 then + begin + PopUpMenu1.Items[6][0].checked:=false; + PopUpMenu1.Items[6][1].checked:=true; + PopUpMenu1.Items[6][2].checked:=false; + end; + PiedFeu:=tco[XClicCell,YClicCell].PiedFeu; + if PiedFeu=1 then + begin + PopUpMenu1.Items[6][4].checked:=true; + PopUpMenu1.Items[6][5].checked:=false; + end; + if PiedFeu=2 then + begin + PopUpMenu1.Items[6][4].checked:=false; + PopUpMenu1.Items[6][5].checked:=true; + end; + + + end + else + PopUpMenu1.Items[6].Enabled:=false; + end; + +procedure TFormTCO.N3Click(Sender: TObject); +begin + actualise; + FormConfCellTCO.show; + FormConfCellTCO.BringToFront; +end; + begin end. diff --git a/verif_version.pas b/verif_version.pas index 1c6d9a7..3022558 100644 --- a/verif_version.pas +++ b/verif_version.pas @@ -23,7 +23,7 @@ var Lance_verif : integer; verifVersion,notificationVersion : boolean; -Const Version='4.6'; // sert à la comparaison de la version publiée +Const Version='4.7'; // sert à la comparaison de la version publiée SousVersion=' '; // en cas d'absence de sous version mettre un espace implementation diff --git a/versions.txt b/versions.txt index 76f6c0e..3001bf2 100644 --- a/versions.txt +++ b/versions.txt @@ -118,6 +118,9 @@ version 4.4 : Possibilit version 4.5 : Correction champ "déclencheur" pour son. version 4.6 : Correction TJD 2/4 états dans le changement de sélection. Gestion des panneaux directionnels dans le TCO. +version 4.7 : Réorganisation du menu et du panneau de configuration des cellules du TCO. + Amélioration du séquenceur de connexion à l'interface. +