{Copyright or © or Copr. :

CNRS - Laboratoire Mouvement & Perception
franck.buloup@univmed.fr

This software is a computer program whose purpose is to highly simplify  
the use of ADwinPro realtime systems when you develop experimental
protocols  on life's sciences area.

This software is governed by the CeCILL  license under French law and
abiding by the rules of distribution of free software.  You can  use, 
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info". 

As a counterpart to the access to the source code and  rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty  and the software's author,  the holder of the
economic rights,  and the successive licensors  have only  limited
liability. 

In this respect, the user's attention is drawn to the risks associated
with loading,  using,  modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean  that it is complicated to manipulate,  and  that  also
therefore means  that it is reserved for developers  and  experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or 
data to be ensured and,  more generally, to use and operate it in the 
same conditions as regards security. 

The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.}
unit UConfigHardwareFrame;

interface
                                                                                                
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
  Dialogs, ExtCtrls, StdCtrls, ToolWin, ComCtrls, ActnMan, ActnCtrls, Grids,
  ActnList;

type
  TConfigHardFrame = class(TFrame)
    Panel1: TPanel;
    Shape1: TShape;
    PageControl1: TPageControl;
    EanTabSheet: TTabSheet;
    SanTabSheet: TTabSheet;
    EANGroupBox: TGroupBox;
    Panel3: TPanel;
    Label7: TLabel;
    Label8: TLabel;
    SuppEANButton: TButton;
    AjoutEANButton: TButton;
    AmplitudeEAN: TComboBox;
    SEDIFFEAN: TComboBox;
    SANGroupBox: TGroupBox;
    Panel2: TPanel;
    Label3: TLabel;
    SuppSANButton: TButton;
    AjoutSANButton: TButton;
    AmplitudeSAN: TComboBox;
    SanStringGrid: TStringGrid;
    EnumSnumTabSheet: TTabSheet;
    EanStringGrid: TStringGrid;
    PSerieTabSheet: TTabSheet;
    CanintTabSheet: TTabSheet;
    ESNUMGroupBox: TGroupBox;
    Panel4: TPanel;
    ENUMGroupBox: TGroupBox;
    SNUMGroupBox: TGroupBox;
    Panel5: TPanel;
    SuppENUMButton: TButton;
    AjoutENUMButton: TButton;
    Panel6: TPanel;
    SuppSNUMButton: TButton;
    AjoutSNUMButton: TButton;
    EnumStringGrid: TStringGrid;
    SnumStringGrid: TStringGrid;
    Label1: TLabel;
    FeESNUM: TComboBox;
    CanIntGroupBox: TGroupBox;
    Panel7: TPanel;
    SuppCanIntButton: TButton;
    AjoutCanIntButton: TButton;
    CanIntStringGrid: TStringGrid;
    PS1GroupBox: TGroupBox;
    PS2GroupBox: TGroupBox;
    UsePS1CheckBox: TCheckBox;
    PS1Panel: TPanel;
    Label2: TLabel;
    Label13: TLabel;
    PS1NomEdit: TEdit;
    PS1SousGroupBox: TGroupBox;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label9: TLabel;
    Label11: TLabel;
    Label12: TLabel;
    Label17: TLabel;
    Label18: TLabel;
    PS1BaudRateComboBox: TComboBox;
    PS1NbBitDataComboBox: TComboBox;
    PS1NbBitStopComboBox: TComboBox;
    PS1PariteComboBox: TComboBox;
    PS1FluxComboBox: TComboBox;
    PS1NbCaptComboBox: TComboBox;
    PS1ModeComboBox: TComboBox;
    PS1FreqComboBox: TComboBox;
    PS1TypeComboBox: TComboBox;
    UsePS2CheckBox: TCheckBox;
    PS2Panel: TPanel;
    Label10: TLabel;
    Label14: TLabel;
    PS2NomEdit: TEdit;
    PS2SousGroupBox: TGroupBox;
    Label15: TLabel;
    Label16: TLabel;
    Label19: TLabel;
    Label20: TLabel;
    Label21: TLabel;
    Label22: TLabel;
    Label23: TLabel;
    Label24: TLabel;
    PS2BaudRateComboBox: TComboBox;
    PS2NbBitDataComboBox: TComboBox;
    PS2NbBitStopComboBox: TComboBox;
    PS2PariteComboBox: TComboBox;
    PS2FluxComboBox: TComboBox;
    PS2NbCaptComboBox: TComboBox;
    PS2ModeComboBox: TComboBox;
    PS2FreqComboBox: TComboBox;
    PS2TypeComboBox: TComboBox;
    PS1AppliquerButton: TButton;
    PS2AppliquerButton: TButton;
    Image1: TImage;
    Shape2: TShape;
    ActionList1: TActionList;
    AddEanActionForMainMenu: TAction;
    SuppEanActionForMainMenu: TAction;
    AddSanActionForMainMenu: TAction;
    SuppSanActionForMainMenu: TAction;
    AddEnumActionForMainMenu: TAction;
    SuppEnumActionForMainMenu: TAction;
    AddSnumActionForMainMenu: TAction;
    SuppSnumActionForMainMenu: TAction;
    AddCanIntActionForMainMenu: TAction;
    SuppCanIntActionForMainMenu: TAction;
    UsePS1ActionForMainMenu: TAction;
    UsePS2ActionForMainMenu: TAction;
    procedure StringGridDrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
    procedure EanStringGridMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure SanStringGridMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure EnumStringGridMouseDown(Sender: TObject;
      Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
    procedure SnumStringGridMouseDown(Sender: TObject;
      Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
    procedure AjoutEANButtonClick(Sender: TObject);
    procedure AjoutSANButtonClick(Sender: TObject);
    procedure AjoutENUMButtonClick(Sender: TObject);
    procedure AjoutSNUMButtonClick(Sender: TObject);
    procedure CanIntStringGridMouseDown(Sender: TObject;
      Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
    procedure AjoutCanIntButtonClick(Sender: TObject);
    procedure UsePS1CheckBoxClick(Sender: TObject);
    procedure UsePS2CheckBoxClick(Sender: TObject);
    procedure SuppEANButtonClick(Sender: TObject);
    procedure ModifEanDblClick(Sender: TObject);
    procedure AmplitudeEANChange(Sender: TObject);
    procedure SEDIFFEANChange(Sender: TObject);
    procedure AmplitudeSANChange(Sender: TObject);
    procedure SuppSANButtonClick(Sender: TObject);
    procedure ModifSanDblClick(Sender: TObject);
    procedure ModifEnumDblClick(Sender: TObject);
    procedure SuppENUMButtonClick(Sender: TObject);
    procedure ModifSnumDblClick(Sender: TObject);
    procedure SuppSNUMButtonClick(Sender: TObject);
    procedure FeESNUMChange(Sender: TObject);
    procedure SuppCanIntButtonClick(Sender: TObject);
    procedure ModifCanIntDblClick(Sender: TObject);
    procedure PS1TypeComboBoxChange(Sender: TObject);
    procedure PS2TypeComboBoxChange(Sender: TObject);
    procedure PS1AppliquerButtonClick(Sender: TObject);
    procedure PS2AppliquerButtonClick(Sender: TObject);
    procedure PS1Change(Sender: TObject);
    procedure PS2Change(Sender: TObject);
    procedure HelpImageClick(Sender: TObject);
    procedure AddEanActionForMainMenuExecute(Sender: TObject);
    procedure SuppEanActionForMainMenuExecute(Sender: TObject);
    procedure AddSanActionForMainMenuExecute(Sender: TObject);
    procedure SuppSanActionForMainMenuExecute(Sender: TObject);
    procedure AddEnumActionForMainMenuExecute(Sender: TObject);
    procedure SuppEnumActionForMainMenuExecute(Sender: TObject);
    procedure AddSnumActionForMainMenuExecute(Sender: TObject);
    procedure SuppSnumActionForMainMenuExecute(Sender: TObject);
    procedure AddCanIntActionForMainMenuExecute(Sender: TObject);
    procedure SuppCanIntActionForMainMenuExecute(Sender: TObject);
    procedure UsePS1ActionForMainMenuExecute(Sender: TObject);
    procedure UsePS2ActionForMainMenuExecute(Sender: TObject);
  private
    { Déclarations privées }
  public
		{ Déclarations publiques }
    SelectedEANRow : Longint;
    SelectedSANRow : Longint;
    SelectedSNUMRow : Longint;
		SelectedENUMRow : Longint;
		SelectedCanIntRow : Longint;
		SelectedCol : Longint;
    procedure MajPresentationESAnNumCanIntGridPS;
		procedure MAJIHM;
		procedure MAJMAIMENU;
		procedure ClearIHM;
  end;

implementation

uses UDocometre, XMLClasses, UEan, USan, UEnum, USnum, UCanInt;

{$R *.dfm}

procedure TConfigHardFrame.MAJMAIMENU;
{var newCategorie : TActionClientItem;
		newAction : TActionClientItem;
		newBasicActionLink : TActionClientLink;
		i:integer;   }
begin
	//Creation catégorie
 {	newCategorie := DocoForm.ActionManager.AddCategory('Outils',DocoForm.ActionManager.ActionBars[0].Items[0]);
	for i := 0 to 16 do
	begin
		case i of
		2:DocoForm.ActionManager.AddSeparator(newAction);
		5:DocoForm.ActionManager.AddSeparator(newAction);
		8:DocoForm.ActionManager.AddSeparator(newAction);
		11:DocoForm.ActionManager.AddSeparator(newAction);
		14:DocoForm.ActionManager.AddSeparator(newAction);
		else
			//Ajout des actions ds la catégorie
			newAction := newCategorie.Items.Add();
			//Creation du lien vers la liste d'action existante facon ancienne
			newBasicActionLink := TActionClientLink.Create(newAction);
			case i of
				0:newBasicActionLink.Action := Self.AddEanActionForMainMenu;
				1:newBasicActionLink.Action := Self.SuppEanActionForMainMenu;
				3:newBasicActionLink.Action := Self.AddSanActionForMainMenu;
				4:newBasicActionLink.Action := Self.SuppSanActionForMainMenu;
				6:newBasicActionLink.Action := Self.AddEnumActionForMainMenu;
				7:newBasicActionLink.Action := Self.SuppEnumActionForMainMenu;
				9:newBasicActionLink.Action := Self.AddSnumActionForMainMenu;
				10:newBasicActionLink.Action := Self.SuppSnumActionForMainMenu;
				12:begin
						 if DocDOCOMETRE.PSERIE.Count> 0 then
						 begin
							 if DocDOCOMETRE.PSERIE[0].NUMERO = 1
							 then UsePS1ActionForMainMenu.Checked := true;
						 end;
						 newBasicActionLink.Action := Self.UsePS1ActionForMainMenu;
					 end;
				13:begin
						 if DocDOCOMETRE.PSERIE.Count> 0 then
						 begin
							 if DocDOCOMETRE.PSERIE[0].NUMERO = 2
							 then UsePS1ActionForMainMenu.Checked := true;
						 end;
						 newBasicActionLink.Action := Self.UsePS2ActionForMainMenu;
					 end;
				15:newBasicActionLink.Action := Self.AddCanIntActionForMainMenu;
				16:newBasicActionLink.Action := Self.SuppCanIntActionForMainMenu;
			end;
			//Affectation du lien a l'action
			newAction.ActionLink := newBasicActionLink;
		end;
	end;         }
end;

procedure TConfigHardFrame.MajPresentationESAnNumCanIntGridPS;
begin
	EanStringGrid.Cells[0,0] := 'Nom';
	EanStringGrid.Cells[1,0] := 'Fe';
	EanStringGrid.Cells[2,0] := 'Gain';
  EanStringGrid.Cells[3,0] := 'Numéro';
  EanStringGrid.Cells[4,0] := 'Unité';
  EanStringGrid.DefaultColWidth := (EanStringGrid.Width div 5) - 1;
  SanStringGrid.Cells[0,0] := 'Nom';
  SanStringGrid.Cells[1,0] := 'Fe';
  SanStringGrid.Cells[2,0] := 'Numéro';
  SanStringGrid.DefaultColWidth := (EanStringGrid.Width div 3);
  ENumStringGrid.Cells[0,0] := 'Nom';
  ENumStringGrid.Cells[1,0] := 'Bit n°';
  ENumStringGrid.DefaultColWidth := (ENumStringGrid.Width div 2);
  SNumStringGrid.Cells[0,0] := 'Nom';
  SNumStringGrid.Cells[1,0] := 'Bit n°';
  SNumStringGrid.DefaultColWidth := (SNumStringGrid.Width div 2);
  ENUMGroupBox.Width := ESNUMGroupBox.ClientWidth div 2;
  CanIntStringGrid.Cells[0,0] := 'Nom';
  CanIntStringGrid.Cells[1,0] := 'Type';
  CanIntStringGrid.Cells[2,0] := 'FE / Num. Param.';
  CanIntStringGrid.Cells[3,0] := 'Taille';
  CanIntStringGrid.Cells[4,0] := 'Format';
  CanIntStringGrid.DefaultColWidth := (CanIntStringGrid.Width div 5);
  PS1GroupBox.Width := PSerieTabSheet.Width div 2;
  PS1Panel.Left := (PS1GroupBox.Width - PS1Panel.Width) div 2;
  PS2Panel.Left := (PS2GroupBox.Width - PS2Panel.Width) div 2;
  PS1Panel.Top := (PS1GroupBox.Height - PS1Panel.Height) div 2 + UsePS1CheckBox.Height;
  PS2Panel.Top := (PS2GroupBox.Height - PS2Panel.Height) div 2 + UsePS2CheckBox.Height;
  PS1AppliquerButton.Top := PS1Panel.Top + PS1Panel.Height - 2;
  PS1AppliquerButton.Left := PS1Panel.Left + PS1Panel.Width - PS1AppliquerButton.Width - 8;
  PS2AppliquerButton.Top := PS2Panel.Top + PS2Panel.Height - 2;
  PS2AppliquerButton.Left := PS2Panel.Left + PS2Panel.Width - PS2AppliquerButton.Width - 8;
end;

procedure TConfigHardFrame.StringGridDrawCell(Sender: TObject; ACol,
  ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
  with (Sender as TStringGrid) do
  begin
    Canvas.Brush.Color := clWhite;
    if ARow > 0 then
    begin
      if (ARow mod 2) = 0 then Canvas.Brush.Color := $DDEEFF;
      if ((Sender as TStringGrid).Name = 'EanStringGrid')
      then if (ARow = SelectedEANRow) then Canvas.Brush.Color := $FFF8DF;
      if ((Sender as TStringGrid).Name = 'SanStringGrid')
      then if (ARow = SelectedSANRow) then Canvas.Brush.Color := $FFF8DF;
      if ((Sender as TStringGrid).Name =  'EnumStringGrid')
      then if (ARow = SelectedENUMRow) then Canvas.Brush.Color := $FFF8DF;
      if ((Sender as TStringGrid).Name =  'SnumStringGrid')
      then if (ARow = SelectedSNUMRow) then Canvas.Brush.Color := $FFF8DF;
      if ((Sender as TStringGrid).Name =  'CanIntStringGrid')
      then if (ARow = SelectedCANINTRow) then Canvas.Brush.Color := $FFF8DF;
    end else Canvas.Brush.Color := clBtnFace;
    Canvas.FillRect(Rect);
    DrawText(Canvas.Handle, PChar(Cells[ACol,ARow]), -1, Rect ,
                DT_CENTER or DT_VCENTER or DT_SINGLELINE	 );

  end;
end;

procedure TConfigHardFrame.EanStringGridMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  EanStringGrid.MouseToCell(X,Y,SelectedCol,SelectedEANRow);
end;

procedure TConfigHardFrame.SanStringGridMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  SanStringGrid.MouseToCell(X,Y,SelectedCol,SelectedSANRow);
end;

procedure TConfigHardFrame.EnumStringGridMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  EnumStringGrid.MouseToCell(X,Y,SelectedCol,SelectedENUMRow);
end;

procedure TConfigHardFrame.SnumStringGridMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  SnumStringGrid.MouseToCell(X,Y,SelectedCol,SelectedSNUMRow);
end;

procedure TConfigHardFrame.CanIntStringGridMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  CanIntStringGrid.MouseToCell(X,Y,SelectedCol,SelectedCANINTRow);
end;

procedure TConfigHardFrame.ClearIHM;
begin
  EanStringGrid.RowCount := 1;
  AmplitudeEAN.ItemIndex := 0;
  SEDIFFEAN.ItemIndex := 0;
  SanStringGrid.RowCount := 1;
  AmplitudeSAN.ItemIndex := 0;
  FeESNUM.Clear;
  EnumStringGrid.RowCount := 1;
  SnumStringGrid.RowCount := 1;
  
  PS1NomEdit.Text := '';
  PS1TypeComboBox.ItemIndex := -1;
  PS1BaudRateComboBox.ItemIndex := -1;
  PS1NbBitDataComboBox.ItemIndex := -1;
  PS1NbBitStopComboBox.ItemIndex := -1;
  PS1PariteComboBox.ItemIndex := -1;
  PS1FluxComboBox.ItemIndex := -1;
  PS1ModeComboBox.ItemIndex := -1;
  PS1FreqComboBox.ItemIndex := -1;
  PS1NbCaptComboBox.ItemIndex := -1;

  PS2NomEdit.Text := '';
  PS2TypeComboBox.ItemIndex := -1;
  PS2BaudRateComboBox.ItemIndex := -1;
  PS2NbBitDataComboBox.ItemIndex := -1;
  PS2NbBitStopComboBox.ItemIndex := -1;
  PS2PariteComboBox.ItemIndex := -1;
  PS2FluxComboBox.ItemIndex := -1;
  PS2ModeComboBox.ItemIndex := -1;
  PS2FreqComboBox.ItemIndex := -1;
  PS2NbCaptComboBox.ItemIndex := -1;

  CanIntStringGrid.RowCount := 1;
end;

procedure TConfigHardFrame.MAJIHM;
var AEAN : IXMLEANType;
    ASAN : IXMLSANType;
    AENUM : IXMLENUMType;
    ASNUM : IXMLSNUMType;
    ACANINT : IXMLCANINTType;
    APS : IXMLPSERIEType;
    i : integer;
    F : double;
begin
  //MAJ EAN
  EanStringGrid.RowCount := 1;
  for i := 0 to DocDOCOMETRE.EAN.Count - 1 do
  begin
    AEAN := DocDOCOMETRE.EAN.Items[i];
    EanStringGrid.RowCount := EanStringGrid.RowCount + 1;
    EanStringGrid.Cells[0,i+1] := AEAN.NOM;
    EanStringGrid.Cells[1,i+1] := floattostr(AEAN.FE);
    EanStringGrid.Cells[2,i+1] := inttostr(AEAN.GAIN);
    EanStringGrid.Cells[3,i+1] := inttostr(AEAN.NUMERO);
    EanStringGrid.Cells[4,i+1] := AEAN.UNITE;
  end;
  if DocDOCOMETRE.CTRLEAN.AMPLITUDE = '-10-10V'
  then AmplitudeEAN.ItemIndex := 0;
  if DocDOCOMETRE.CTRLEAN.AMPLITUDE = '-5-5V'
  then AmplitudeEAN.ItemIndex := 1;
  if DocDOCOMETRE.CTRLEAN.AMPLITUDE = '0-10V'
  then AmplitudeEAN.ItemIndex := 2;
  if DocDOCOMETRE.CTRLEAN.SEDIFF = 'SE'
  then SEDIFFEAN.ItemIndex := 0
  else SEDIFFEAN.ItemIndex := 1;
  //MAJ SAN
  SanStringGrid.RowCount := 1;
  for i := 0 to DocDOCOMETRE.SAN.Count - 1 do
  begin
    ASAN := DocDOCOMETRE.SAN.Items[i];
    SanStringGrid.RowCount := SanStringGrid.RowCount + 1;
    SanStringGrid.Cells[0,i+1] := ASAN.NOM;
    SanStringGrid.Cells[1,i+1] := floattostr(ASAN.FE);
    SanStringGrid.Cells[2,i+1] := inttostr(ASAN.NUMERO);
  end;
  if DocDOCOMETRE.CTRLSAN.AMPLITUDE = '-10-10V'
  then AmplitudeSAN.ItemIndex := 0;
  if DocDOCOMETRE.CTRLSAN.AMPLITUDE = '-5-5V'
  then AmplitudeSAN.ItemIndex := 1;
  if DocDOCOMETRE.CTRLSAN.AMPLITUDE = '0-10V'
  then AmplitudeSAN.ItemIndex := 2;
  //MAJ FE ESNUM
  FeESNUM.Clear;
  i := 1;
  repeat
    F := DocDocometre.EXPERIENCE.FEG / i;
    FeESNUM.Items.Add(floattostr(F));
    inc(i);
  until F < 100;
  FeESNUM.ItemIndex := round(DocDOCOMETRE.EXPERIENCE.FEG / DocDOCOMETRE.CTRLESNUM.FE) - 1;
  //MAJ ENUM
  EnumStringGrid.RowCount := 1;
  for i := 0 to DocDOCOMETRE.ENUM.Count - 1 do
  begin
    AENUM := DocDOCOMETRE.ENUM.Items[i];
    EnumStringGrid.RowCount := EnumStringGrid.RowCount + 1;
    EnumStringGrid.Cells[0,i+1] := AENUM.NOM;
    EnumStringGrid.Cells[1,i+1] := inttostr(AENUM.NUMERO);
  end;
  //MAJ SNUM
  SnumStringGrid.RowCount := 1;
  for i := 0 to DocDOCOMETRE.SNUM.Count - 1 do
  begin
    ASNUM := DocDOCOMETRE.SNUM.Items[i];
    SnumStringGrid.RowCount := SnumStringGrid.RowCount + 1;
    SnumStringGrid.Cells[0,i+1] := ASNUM.NOM;
    SnumStringGrid.Cells[1,i+1] := inttostr(ASNUM.NUMERO);
  end;
  //MAJ PSERIE
  for i := 0 to DocDOCOMETRE.PSERIE.Count - 1 do
  begin
    APS := DocDOCOMETRE.PSERIE.Items[i];
    if APS.NUMERO = 1 then
    begin
      UsePS1CheckBox.Checked := true;
      PS1NomEdit.Text := APS.NOM;
      PS1TypeCombobox.ItemIndex := PS1TypeCombobox.Items.IndexOf(APS.SYSTEME);

      if PS1TypeCombobox.ItemIndex = 1 then //ICE
      begin
        PS1ModeComboBox.ItemIndex := 1;
        PS1ModeComboBox.Enabled := false;
        PS1FreqCombobox.Enabled := true;
        PS1FreqCombobox.Style := csDropDown;
        PS1FreqCombobox.Text := '100';
        PS1NbCaptCombobox.Enabled := false;
      end;

      PS1BaudRateCombobox.ItemIndex := PS1BaudRateCombobox.Items.IndexOf(inttostr(APS.BAUDRATE));
      PS1NbBitDataCombobox.ItemIndex := PS1NbBitDataCombobox.Items.IndexOf(inttostr(APS.NBBITDATA));
      PS1NbBitStopCombobox.ItemIndex := PS1NbBitStopCombobox.Items.IndexOf(floattostr(APS.NBBITSTOP));
      PS1PariteCombobox.ItemIndex := PS1PariteCombobox.Items.IndexOf(APS.PARITE);
      PS1FluxCombobox.ItemIndex := PS1FluxCombobox.Items.IndexOf(APS.FLUX);
      PS1ModeCombobox.ItemIndex := PS1ModeCombobox.Items.IndexOf(APS.MODE);
      if PS1FreqCombobox.Items.IndexOf(floattostr(APS.FREQUENCE)) <> -1
      then PS1FreqCombobox.ItemIndex := PS1FreqCombobox.Items.IndexOf(floattostr(APS.FREQUENCE))
      else begin
        PS1FreqComboBox.Style := csDropDown;
        PS1FreqCombobox.Text := floattostr(APS.FREQUENCE);
      end;
      PS1NbCaptCombobox.ItemIndex := PS1NbCaptCombobox.Items.IndexOf(inttostr(APS.NBCAPTEURS));
      if PS1ModeComboBox.ItemIndex = 0 then
      begin
        PS1FreqCombobox.Style := csDropDownList;
        PS1FreqCombobox.ItemIndex := PS1NbCaptComboBox.ItemIndex;
        PS1FreqCombobox.Enabled := false;
      end else
      begin
        PS1FreqCombobox.Style := csDropDown;
        PS1FreqCombobox.Enabled := true;
        PS1FreqCombobox.Text := floattostr(APS.FREQUENCE);
      end;
      //PS1TypeComboBoxChange(self);

      if PS1TypeCombobox.ItemIndex = 2 then //Bird
      begin
        PS1NbCaptComboBox.Enabled := false;
        PS1ModeComboBox.Enabled := false;
        PS1FreqComboBox.Enabled := false;
      end;

      if PS1TypeCombobox.ItemIndex = 3 then //SUMMA
      begin
        PS1BaudRateCombobox.ItemIndex := 3;
        PS1NbCaptComboBox.Enabled := false;
        PS1ModeComboBox.Enabled := false;
      end;

      if PS1TypeCombobox.ItemIndex = 5 then //CODAmotion
      begin
        PS1ModeComboBox.Enabled := false;
        PS1FreqComboBox.Enabled := true;
        PS1NbCaptComboBox.Enabled := true;
      end;

      {
      if PS1TypeCombobox.ItemIndex = 4 then //BERGERLAHR
      begin
        PS1BaudRateCombobox.ItemIndex := 4;
        PS1NbBitDataCombobox.ItemIndex := 1;
        PS1PariteCombobox.ItemIndex := 1;
        PS1FreqCombobox.Style := csDropDown;
        PS1FreqCombobox.Text := inttostr(DocDOCOMETRE.EXPERIENCE.FEG)
      end;
      }


      PS1AppliquerButton.Enabled := false;
    end;
    if APS.NUMERO = 2 then
    begin
      UsePS2CheckBox.Checked := true;
      PS2NomEdit.Text := APS.NOM;
      PS2TypeCombobox.ItemIndex := PS2TypeCombobox.Items.IndexOf(APS.SYSTEME);

      if PS2TypeCombobox.ItemIndex = 1 then //ICE
      begin
        PS2ModeComboBox.ItemIndex := 1;
        PS2ModeComboBox.Enabled := false;
        PS2FreqCombobox.Enabled := true;
        PS2FreqCombobox.Style := csDropDown;
        PS2FreqCombobox.Text := '100';
        PS2NbCaptCombobox.Enabled := false;
      end;

      PS2BaudRateCombobox.ItemIndex := PS2BaudRateCombobox.Items.IndexOf(inttostr(APS.BAUDRATE));
      PS2NbBitDataCombobox.ItemIndex := PS2NbBitDataCombobox.Items.IndexOf(inttostr(APS.NBBITDATA));
      PS2NbBitStopCombobox.ItemIndex := PS2NbBitStopCombobox.Items.IndexOf(floattostr(APS.NBBITSTOP));
      PS2PariteCombobox.ItemIndex := PS2PariteCombobox.Items.IndexOf(APS.PARITE);
      PS2FluxCombobox.ItemIndex := PS2FluxCombobox.Items.IndexOf(APS.FLUX);
      PS2ModeCombobox.ItemIndex := PS2ModeCombobox.Items.IndexOf(APS.MODE);
      if PS2FreqCombobox.Items.IndexOf(floattostr(APS.FREQUENCE)) <> -1
      then PS2FreqCombobox.ItemIndex := PS2FreqCombobox.Items.IndexOf(floattostr(APS.FREQUENCE))
      else begin
        PS2FreqComboBox.Style := csDropDown;
        PS2FreqCombobox.Text := floattostr(APS.FREQUENCE);
      end;
      PS2NbCaptCombobox.ItemIndex := PS2NbCaptCombobox.Items.IndexOf(inttostr(APS.NBCAPTEURS));
      if PS2ModeComboBox.ItemIndex = 0 then
      begin
        PS2FreqCombobox.Style := csDropDownList;
        PS2FreqCombobox.ItemIndex := PS2NbCaptComboBox.ItemIndex;
        PS2FreqCombobox.Enabled := false;
      end else
      begin
        PS2FreqCombobox.Style := csDropDown;
        PS2FreqCombobox.Enabled := true;
        PS2FreqCombobox.Text := floattostr(APS.FREQUENCE);
      end;
      //PS2TypeComboBoxChange(self);

      if PS2TypeCombobox.ItemIndex = 2 then //Bird
      begin
        PS2NbCaptComboBox.Enabled := false;
        PS2ModeComboBox.Enabled := false;
        PS2FreqComboBox.Enabled := false;
      end;

      if PS2TypeCombobox.ItemIndex = 3 then
      begin
        PS2BaudRateCombobox.ItemIndex := 3; //SUMMA
        PS2NbCaptComboBox.Enabled := false;
        PS2ModeComboBox.Enabled := false;
      end;

      if PS2TypeCombobox.ItemIndex = 5 then //CODAmotion
      begin
        PS2ModeComboBox.Enabled := false;
        PS2FreqComboBox.Enabled := true;
        PS2NbCaptComboBox.Enabled := true;
      end;

      {
      if PS2TypeCombobox.ItemIndex = 4 then //BERGERLAHR
      begin
        PS2BaudRateCombobox.ItemIndex := 4;
        PS2NbBitDataCombobox.ItemIndex := 1;
        PS2PariteCombobox.ItemIndex := 1;
        PS2FreqCombobox.Style := csDropDown;
        PS2FreqCombobox.Text := inttostr(DocDOCOMETRE.EXPERIENCE.FEG)
      end;
      }

      PS2AppliquerButton.Enabled := false;
    end;
  end;
  //MAJ CANINT
  CanIntStringGrid.RowCount := 1;
  for i := 0 to DocDOCOMETRE.CANINT.Count - 1 do
  begin
    ACANINT := DocDOCOMETRE.CANINT.Items[i];
    CanIntStringGrid.RowCount := CanIntStringGrid.RowCount + 1;
    CanIntStringGrid.Cells[0,i+1] := ACANINT.NOM;
    CanIntStringGrid.Cells[1,i+1] := ACANINT.GENRE;
    CanIntStringGrid.Cells[2,i+1] := floattostr(ACANINT.FENUMPAR);
    CanIntStringGrid.Cells[3,i+1] := inttostr(ACANINT.TAILLE);
    CanIntStringGrid.Cells[4,i+1] := ACANINT.FORMAT;
  end;
end;

//************
//GESTION EAN
procedure TConfigHardFrame.AmplitudeEANChange(Sender: TObject);
begin
  case AmplitudeEAN.ItemIndex of
    0:DocDOCOMETRE.CTRLEAN.AMPLITUDE := '-10-10V';
    1:DocDOCOMETRE.CTRLEAN.AMPLITUDE := '-5-5V';
    2:DocDOCOMETRE.CTRLEAN.AMPLITUDE := '0-10V';
  end;
end;

procedure TConfigHardFrame.SEDIFFEANChange(Sender: TObject);
begin
  DocDOCOMETRE.CTRLEAN.SEDIFF := SEDIFFEAN.Text;
end;

procedure TConfigHardFrame.AjoutEANButtonClick(Sender: TObject);
var NewEAN : IXMLEANType;
    n : integer;
		InfoCanaux : TInfoCanaux;
begin
  //Creation d'une EAN
  EanDLGForm.Operation := 'C';
  if EanDLGForm.ShowModal = mrOK then
  begin
    //Ajout EAN dans DocDOCOMETRE
    NewEAN := DocDOCOMETRE.EAN.Add;
    NewEAN.NOM := EanDLGForm.NomEAN.Text;
    NewEAN.FE := strtofloat(EanDLGForm.FeEAN.Text);
    NewEAN.UNITE := EanDLGForm.UniteEAN.Text;
    NewEAN.GAIN := strtoint(EanDLGForm.GainEAN.Text);
    NewEAN.NUMERO := strtoint(EanDLGForm.NumeroEAN.Text);
    if DocDOCOMETRE.CTRLEAN.AMPLITUDE = '-10-10V' then
    begin
      NewEAN.AMIN := -10.0;
      NewEAN.AMAX := 10.0;
      NewEAN.UMIN := -10.0;
      NewEAN.UMAX := 10.0;
    end;
    if DocDOCOMETRE.CTRLEAN.AMPLITUDE = '-5-5V' then
    begin
      NewEAN.AMIN := -5.0;
      NewEAN.AMAX := 5.0;
      NewEAN.UMIN := -5.0;
      NewEAN.UMAX := 5.0;
    end;
    if DocDOCOMETRE.CTRLEAN.AMPLITUDE = '0-10V' then
    begin
      NewEAN.AMIN := 0.0;
      NewEAN.AMAX := 10.0;
      NewEAN.UMIN := 0.0;
      NewEAN.UMAX := 10.0;
    end;
    
    //Ajout d'une ligne a EanStringGrid
    EanStringGrid.RowCount := EanStringGrid.RowCount + 1;
    EanStringGrid.FixedRows := 1;
    n := EanStringGrid.RowCount - 1;
    //Ajout de la nouvelle entrée
    EanStringGrid.Cells[0,n] := NewEAN.NOM;
    EanStringGrid.Cells[1,n] := floattostr(NewEAN.FE);
    EanStringGrid.Cells[2,n] := inttostr(NewEAN.GAIN);
    EanStringGrid.Cells[3,n] := inttostr(NewEAN.NUMERO);
    EanStringGrid.Cells[4,n] := NewEAN.UNITE;

    //Modif dans Toutes les Sequences Type, Blocs et Functions
  	InfoCanaux := DocDOCOMETRE.RendreListeInfoCanaux();
		DocDOCOMETRE.ST.ChangeChannelName('',NewEAN.NOM,'',InfoCanaux);
		InfoCanaux.free;
    MAJIHM;
    DocoForm.DescriptFrame.MAJIHM;
    DocoForm.SimulFrame.MAJIHM
  end;
end;

procedure TConfigHardFrame.ModifEanDblClick(Sender: TObject);
var i : integer;
    AEAN : IXMLEANType;
		oldName : string;
		InfoCanaux : TInfoCanaux;
begin
  i := DocoForm.ConfigHardFrame.SelectedEANRow - 1;
  if i > -1 then
  begin
    //Modif d'une EAN
    EanDLGForm.Operation := 'M';
    if EanDLGForm.ShowModal = mrOK then
    begin
      //Modif dans DocDOCOMETRE
      AEAN := DocDOCOMETRE.EAN.Items[i];
      oldName := AEAN.NOM;
      AEAN.NOM := EanDLGForm.NomEAN.Text;
      AEAN.FE := strtofloat(EanDLGForm.FeEAN.Text);
      AEAN.UNITE := EanDLGForm.UniteEAN.Text;
      AEAN.GAIN := strtoint(EanDLGForm.GainEAN.Text);
			AEAN.NUMERO := strtoint(EanDLGForm.NumeroEAN.Text);
			//Modif dans Toutes les Sequences Type, Blocs et Functions
			InfoCanaux := DocDOCOMETRE.RendreListeInfoCanaux();
			DocDOCOMETRE.ST.ChangeChannelName(OldName,EanDLGForm.NomEAN.Text,'',InfoCanaux);
			InfoCanaux.free;
      MAJIHM;
      DocoForm.DescriptFrame.MAJIHM;
      DocoForm.SimulFrame.MAJIHM;
    end;
  end;
end;

procedure TConfigHardFrame.SuppEANButtonClick(Sender: TObject);
var i : integer;
		InfoCanaux : TInfoCanaux;
    oldName : string;
begin
  i := DocoForm.ConfigHardFrame.SelectedEANRow - 1;
	if i > -1 then
  begin
    //Supprimer ds le modele objet
		//Modif dans Toutes les Sequences Type, Blocs et Functions ...
    oldName :=  DocDOCOMETRE.EAN.Items[i].NOM;
    DocDocometre.EAN.Delete(i);
		InfoCanaux := DocDOCOMETRE.RendreListeInfoCanaux;
		DocDOCOMETRE.ST.ChangeChannelName(oldName,'','',InfoCanaux);
		InfoCanaux.Free;
    MAJIHM;
    DocoForm.DescriptFrame.MAJIHM;
    DocoForm.SimulFrame.MAJIHM
  end;
end;

//************
//GESTION SAN
procedure TConfigHardFrame.AmplitudeSANChange(Sender: TObject);
begin
  case AmplitudeSAN.ItemIndex of
    0:DocDOCOMETRE.CTRLSAN.AMPLITUDE := '-10-10V';
    1:DocDOCOMETRE.CTRLSAN.AMPLITUDE := '-5-5V';
    2:DocDOCOMETRE.CTRLSAN.AMPLITUDE := '0-10V';
  end;
end;

procedure TConfigHardFrame.AjoutSANButtonClick(Sender: TObject);
var NewSAN : IXMLSANType;
		n : integer;
    InfoCanaux : TInfoCanaux;
begin
	//Creation d'une SAN
  SanDLGForm.Operation := 'C';
  if SanDLGForm.ShowModal = mrOK then
  begin
    //Ajout SAN dans DocDOCOMETRE
    NewSAN := DocDOCOMETRE.SAN.Add;
    NewSAN.NOM := SanDLGForm.NomSAN.Text;
    NewSAN.FE := strtofloat(SanDLGForm.FeSAN.Text);
    NewSAN.NUMERO := strtoint(SanDLGForm.NumeroSAN.Text);
    //Ajout d'une ligne a EanStringGrid
    SanStringGrid.RowCount := SanStringGrid.RowCount + 1;
    SanStringGrid.FixedRows := 1;
    n := SanStringGrid.RowCount - 1;
    //Ajout de la nouvelle entrée
    SanStringGrid.Cells[0,n] := NewSAN.NOM;
    SanStringGrid.Cells[1,n] := floattostr(NewSAN.FE);
    SanStringGrid.Cells[2,n] := inttostr(NewSAN.NUMERO);


    InfoCanaux := DocDOCOMETRE.RendreListeInfoCanaux();
		DocDOCOMETRE.ST.ChangeChannelName('',NewSAN.NOM,'',InfoCanaux);
		InfoCanaux.free;


    MAJIHM;
    DocoForm.DescriptFrame.MAJIHM;
    DocoForm.SimulFrame.MAJIHM

  end;
end;

procedure TConfigHardFrame.ModifSanDblClick(Sender: TObject);
var i : integer;
		ASAN : IXMLSANType;
		OldName : string;
		InfoCAnaux : TInfoCanaux;
begin
  //Modif d'une SAN
  i := DocoForm.ConfigHardFrame.SelectedSANRow - 1;
  if i > -1 then
  begin
    SanDLGForm.Operation := 'M';
    if SanDLGForm.ShowModal = mrOK then
    begin
      //Modif dans DocDOCOMETRE
      ASAN := DocDOCOMETRE.SAN.Items[i];
      oldName := ASAN.NOM;
      ASAN.NOM := SanDLGForm.NomSAN.Text;
      ASAN.FE := strtofloat(SanDLGForm.FeSAN.Text);;
			ASAN.NUMERO := strtoint(SanDLGForm.NumeroSAN.Text);
			//Modif dans Toutes les Sequences Type, Blocs et Functions
			InfoCanaux := DocDOCOMETRE.RendreListeInfoCanaux;
			DocDOCOMETRE.ST.ChangeChannelName(OldName,SanDLGForm.NomSAN.Text,'',InfoCanaux);
			InfoCanaux.free;

      MAJIHM;
      DocoForm.DescriptFrame.MAJIHM;
      DocoForm.SimulFrame.MAJIHM;
		end;
	end;
end;

procedure TConfigHardFrame.SuppSANButtonClick(Sender: TObject);
var i,j : integer;
		ListeCanauxStim : TStringList;
		usedByStim : boolean;
		InFoCanaux : TInfoCanaux;
    oldName : string;
begin
  i := DocoForm.ConfigHardFrame.SelectedSANRow - 1;
  if i > -1 then
  begin
    //Recherche du canal ds un stim d'une des ST
    usedByStim := false;
    ListeCanauxStim := TStringList.Create;
    for j := 0 to DocDOCOMETRE.ST.Count - 1 do
    begin
      DocDOCOMETRE.ST[j].RendreListeCanauxTransfertPCKeithley(ListeCanauxStim);
      if ListeCanauxStim.IndexOf(DocDOCOMETRE.SAN[i].NOM) > - 1 then
      begin
        usedByStim := true;
        break;
      end;
      ListeCanauxStim.Clear;
    end;
    ListeCanauxStim.Free;

    //Modif dans Toutes les Sequences Type, Blocs et Functions si pas ds un stim
    if not usedByStim then
		begin
      oldName :=  DocDOCOMETRE.SAN.Items[i].NOM;
      DocDocometre.SAN.Delete(i);
			InfoCanaux := DocDOCOMETRE.RendreListeInfoCanaux;
			DocDOCOMETRE.ST.ChangeChannelName(oldName,'','',InfoCanaux);
			InfoCanaux.Free;
      MAJIHM;
      DocoForm.DescriptFrame.MAJIHM;
      DocoForm.SimulFrame.MAJIHM;
    end else
    begin
      showmessage('Ce canal est utilisé dans un Stimulus d''une des Séquences types.');
      showmessage('Veuillez modifier ce stimulus avant de supprimer le canal.');
    end;
  end;
end;

//*************
//GESTION ESNUM
procedure TConfigHardFrame.FeESNUMChange(Sender: TObject);
var i : integer;
		InfoCanaux: TInfoCanaux;
begin
	DocDOCOMETRE.CTRLESNUM.Set_fe(strtofloat(FeESNUM.Text));
	//Astuce !!!!! on utilise ChangeChannelName  avec les même noms pour mettre
	//à jour les RF dans les générations de code ...
	InfoCAnaux := DocDOCOMETRE.RendreListeInfoCanaux;
	for i := 0 to DocDOCOMETRE.ENUM.Count - 1
	do DocDOCOMETRE.ST.ChangeChannelName(DocDOCOMETRE.ENUM[i].NOM,DocDOCOMETRE.ENUM[i].NOM,'',InfoCanaux);
	for i := 0 to DocDOCOMETRE.SNUM.Count - 1
  do DocDOCOMETRE.ST.ChangeChannelName(DocDOCOMETRE.SNUM[i].NOM,DocDOCOMETRE.SNUM[i].NOM,'',InfoCanaux);
end;

//************
//GESTION ENUM
procedure TConfigHardFrame.AjoutENUMButtonClick(Sender: TObject);
var NewENUM : IXMLENUMType;
    n : integer;
    InfoCanaux : TInfoCanaux;
begin
  //Creation d'une ENUM
  EnumDLGForm.Operation := 'C';
  if EnumDLGForm.ShowModal = mrOK then
  begin
    //Ajout ENUM dans DocDOCOMETRE
    NewENUM := DocDOCOMETRE.ENUM.Add;
    NewENUM.NOM := EnumDLGForm.NomENUM.Text;
		NewENUM.NUMERO := strtoint(EnumDLGForm.NumeroENUM.Text);
    //Ajout d'une ligne a ENUMStringGrid
    EnumStringGrid.RowCount := EnumStringGrid.RowCount + 1;
    EnumStringGrid.FixedRows := 1;
    n := EnumStringGrid.RowCount - 1;
    //Ajout de la nouvelle entrée
    EnumStringGrid.Cells[0,n] := NewENUM.NOM;
    EnumStringGrid.Cells[1,n] := inttostr(NewENUM.NUMERO);

    InfoCanaux := DocDOCOMETRE.RendreListeInfoCanaux();
		DocDOCOMETRE.ST.ChangeChannelName('',NewENUM.NOM,'',InfoCanaux);
		InfoCanaux.free;

    DocoForm.DescriptFrame.MAJIHM;
    DocoForm.SimulFrame.MAJIHM

  end;
end;

procedure TConfigHardFrame.ModifEnumDblClick(Sender: TObject);
var i : integer;
    AENUM : IXMLENUMType;
		oldName : string;
		InfoCanaux : TInfoCanaux;
begin
  //Modif d'une ENUM
  i := DocoForm.ConfigHardFrame.SelectedENUMRow - 1;
  if i > -1 then
  begin
    EnumDLGForm.Operation := 'M';
    if EnumDLGForm.ShowModal = mrOK then
    begin
      //Modif dans DocDOCOMETRE
      AENUM := DocDOCOMETRE.ENUM.Items[i];
      OldName := AENUM.NOM;
      AENUM.NOM := EnumDLGForm.NomENUM.Text;
      AENUM.NUMERO := strtoint(EnumDLGForm.NumeroENUM.Text);
			//Modif dans Toutes les Sequences Type, Blocs et Functions
			InfoCAnaux :=DocDOCOMETRE.RendreListeInfoCanaux;
			DocDOCOMETRE.ST.ChangeChannelName(oldName,EnumDLGForm.NomENUM.Text,'',InfoCanaux);
			InfoCanaux.Free;
      MAJIHM;
      DocoForm.DescriptFrame.MAJIHM;
      DocoForm.SimulFrame.MAJIHM;
    end;
  end;
end;

procedure TConfigHardFrame.SuppENUMButtonClick(Sender: TObject);
var i : integer;
		InfoCanaux : TInfoCAnaux;
    oldName : string;
begin
  i := DocoForm.ConfigHardFrame.SelectedENUMRow - 1;
  if i > -1 then
  begin
		//Modif dans Toutes les Sequences Type, Blocs et Functions
    oldName := DocDOCOMETRE.ENUM.Items[i].NOM;
    DocDocometre.ENUM.Delete(i);
		InfoCanaux := DocDOCOMETRE.RendreListeInfoCanaux;
		DocDOCOMETRE.ST.ChangeChannelName(oldName,'','',InfoCanaux);
		InfoCanaux.Free;
    MAJIHM;
    DocoForm.DescriptFrame.MAJIHM;
    DocoForm.SimulFrame.MAJIHM;

  end;
end;

//************
//GESTION SNUM
procedure TConfigHardFrame.AjoutSNUMButtonClick(Sender: TObject);
var NewSNUM : IXMLSNUMType;
    n : integer;
    InfoCanaux : TInfoCanaux;
begin
  //Creation d'une SNUM
  SnumDLGForm.Operation := 'C';
  if SnumDLGForm.ShowModal = mrOK then
  begin
    //Ajout SNUM dans DocDOCOMETRE
    NewSNUM := DocDOCOMETRE.SNUM.Add;
    NewSNUM.NOM := SnumDLGForm.NomSNUM.Text;
    NewSNUM.NUMERO := strtoint(SnumDLGForm.NumeroSNUM.Text);
    //Ajout d'une ligne a SnumStringGrid
    SnumStringGrid.RowCount := SnumStringGrid.RowCount + 1;
    SnumStringGrid.FixedRows := 1;
    n := SnumStringGrid.RowCount - 1;
    //Ajout de la nouvelle entrée
    SnumStringGrid.Cells[0,n] := NewSNUM.NOM;
    SnumStringGrid.Cells[1,n] := inttostr(NewSNUM.NUMERO);

    InfoCanaux := DocDOCOMETRE.RendreListeInfoCanaux();
		DocDOCOMETRE.ST.ChangeChannelName('',NewSNUM.NOM,'',InfoCanaux);
		InfoCanaux.free;
    
    DocoForm.DescriptFrame.MAJIHM;
    DocoForm.SimulFrame.MAJIHM;
	end;
end;

procedure TConfigHardFrame.ModifSnumDblClick(Sender: TObject);
var i : integer;
    ASNUM : IXMLSNUMType;
		oldName : string;
		InfoCanaux : TInfoCanaux;
begin
	//Modif d'une SNUM
	i := DocoForm.ConfigHardFrame.SelectedSNUMRow - 1;
  if i > -1 then
  begin
    SnumDLGForm.Operation := 'M';
    if SnumDLGForm.ShowModal = mrOK then
    begin
      //Modif dans DocDOCOMETRE
      ASNUM := DocDOCOMETRE.SNUM.Items[i];
      oldName := ASNUM.NOM;
      ASNUM.NOM := SnumDLGForm.NomSNUM.Text;
      ASNUM.NUMERO := strtoint(SnumDLGForm.NumeroSNUM.Text);
			//Modif dans Toutes les Sequences Type, Blocs et Functions
			InFoCAnaux := DocDOCOMETRE.RendreListeInfoCanaux;
			DocDOCOMETRE.ST.ChangeChannelName(oldName,SnumDLGForm.NomSNUM.Text,'',InfoCanaux);
			InfoCanaux.free;
			MAJIHM;
      DocoForm.DescriptFrame.MAJIHM;
      DocoForm.SimulFrame.MAJIHM;
    end;
  end;
end;

procedure TConfigHardFrame.SuppSNUMButtonClick(Sender: TObject);
var i : integer;
		InfoCAnaux : TInfoCanaux;
    oldName : string;
begin
	i := DocoForm.ConfigHardFrame.SelectedSNUMRow - 1;
	if i > -1 then
	begin
		//Modif dans Toutes les Sequences Type, Blocs et Functions
    oldName := DocDOCOMETRE.SNUM.Items[i].NOM;        
		DocDocometre.SNUM.Delete(i);
		InfoCanaux := DocDOCOMETRE.RendreListeInfoCanaux;
		DocDOCOMETRE.ST.ChangeChannelName(oldName,'','',InfoCanaux);
		InfoCanaux.Free;
    MAJIHM;
    DocoForm.DescriptFrame.MAJIHM;
    DocoForm.SimulFrame.MAJIHM;
  end
end;

//**************
//GESTION CANINT
procedure TConfigHardFrame.AjoutCanIntButtonClick(Sender: TObject);
var NewCanInt : IXMLCANINTType;
		n : integer;
    InfoCanaux : TInfoCanaux;
begin
  //Creation d'un canal interne
  CanIntDLGForm.Operation := 'C';
  if CanIntDLGForm.ShowModal = mrOK then
  begin
    //Ajout CanInt dans DocDOCOMETRE
    NewCanInt := DocDOCOMETRE.CANINT.Add;
    NewCanInt.NOM := CanIntDLGForm.NomCANINT.Text;
    NewCanInt.GENRE := CanIntDLGForm.TypeCANINT.Text;
    NewCanInt.FENUMPAR := strtofloat(CanIntDLGForm.FeNumParamCANINT.Text);
    NewCanInt.TAILLE := strtoint(CanIntDLGForm.TailleCANINT.Text); //CanIntDLGForm.TailleCANINT.ItemIndex + 1;
    NewCanInt.FORMAT := CanIntDLGForm.FormatCANINT.Text;
    NewCanInt.VALEUR := 0.0;
    if CanIntDLGForm.PropagerParamCheckBox.Checked
    then NewCanInt.PROPAG := 1
    else NewCanInt.PROPAG := 0;
    //Ajout d'une ligne a CanIntStringGrid
    CanIntStringGrid.RowCount := CanIntStringGrid.RowCount + 1;
    CanIntStringGrid.FixedRows := 1;
    n := CanIntStringGrid.RowCount - 1;
    //Ajout du nouveau canint
    CanIntStringGrid.Cells[0,n] := NewCanInt.NOM;
    CanIntStringGrid.Cells[1,n] := NewCanInt.GENRE;
    CanIntStringGrid.Cells[2,n] := floattostr(NewCanInt.FENUMPAR);
    CanIntStringGrid.Cells[3,n] := inttostr(NewCanInt.TAILLE);
    CanIntStringGrid.Cells[4,n] := NewCanInt.FORMAT;


    InfoCanaux := DocDOCOMETRE.RendreListeInfoCanaux();
		DocDOCOMETRE.ST.ChangeChannelName('',NewCanInt.NOM,'',InfoCanaux);
		InfoCanaux.free;

    DocoForm.DescriptFrame.MAJIHM;
    DocoForm.SimulFrame.MAJIHM;
  end;
end;

procedure TConfigHardFrame.ModifCanIntDblClick(Sender: TObject);
var i : integer;
		ACANINT : IXMLCANINTType;
		oldName : string;
		InfoCanaux : TInfoCanaux;
begin
	//Modif d'un CANINT
	i := DocoForm.ConfigHardFrame.SelectedCANINTRow - 1;
	if i > -1 then
	begin
		CanIntDLGForm.Operation := 'M';
		if CanIntDLGForm.ShowModal = mrOK then
		begin
			//Modif dans DocDOCOMETRE
			ACANINT := DocDOCOMETRE.CANINT.Items[i];
			oldName := ACANINT.NOM;
			ACANINT.NOM := CanIntDLGForm.NomCANINT.Text;
			ACANINT.GENRE := CanIntDLGForm.TypeCANINT.Text;
			ACANINT.FENUMPAR := strtofloat(CanIntDLGForm.FeNumParamCANINT.Text);
			ACANINT.TAILLE := strtoint(CanIntDLGForm.TailleCANINT.Text);//CanIntDLGForm.TailleCANINT.ItemIndex + 1;
			ACANINT.FORMAT := CanIntDLGForm.FormatCANINT.Text;
			if CanIntDLGForm.PropagerParamCheckBox.Checked
			then ACANINT.PROPAG := 1
			else ACANINT.PROPAG := 0;
			//Modif dans Toutes les Sequences Type, Blocs et Functions
			InfoCanaux := DocDOCOMETRE.RendreListeInfoCanaux();
			DocDOCOMETRE.ST.ChangeChannelName(OldName,CanIntDLGForm.NomCANINT.Text,'',InfoCanaux);
			InfoCanaux.Free;
			MAJIHM;
			DocoForm.DescriptFrame.MAJIHM;
			DocoForm.SimulFrame.MAJIHM;
		end;
	end;
end;

procedure TConfigHardFrame.SuppCanIntButtonClick(Sender: TObject);
var i,j : integer;
		ListeCanauxStim : TStringList;
		usedByStim : boolean;
		InfoCanaux : TInfoCanaux;
    oldName : string;
begin
  i := DocoForm.ConfigHardFrame.SelectedCANINTRow - 1;
  if i > -1 then
  begin
    //Recherche du canal ds un stim d'une des ST
    usedByStim := false;
    ListeCanauxStim := TStringList.Create;
    for j := 0 to DocDOCOMETRE.ST.Count - 1 do
    begin
      DocDOCOMETRE.ST[j].RendreListeCanauxTransfertPCKeithley(ListeCanauxStim);
      if ListeCanauxStim.IndexOf(DocDOCOMETRE.CANINT[i].NOM) > - 1 then
      begin
        usedByStim := true;
        break;
      end;
      ListeCanauxStim.Clear;
    end;
    ListeCanauxStim.Free;

    //Modif dans Toutes les Sequences Type, Blocs et Functions si pas ds un stim
    if not usedByStim then
		begin
      oldName := DocDOCOMETRE.CANINT.Items[i].NOM;
      DocDocometre.CANINT.Delete(i);
			InfoCanaux := DocDOCOMETRE.RendreListeInfoCanaux;
			DocDOCOMETRE.ST.ChangeChannelName(oldName,'','',InfoCanaux);
			InfoCanaux.Free;
      MAJIHM;
      DocoForm.DescriptFrame.MAJIHM;
      DocoForm.SimulFrame.MAJIHM;
    end else
    begin
      showmessage('Ce canal est utilisé dans un Stimulus d''une des Séquences types.');
      showmessage('Veuillez modifier ce stimulus avant de supprimer le canal.');
    end;
  end
end;
    
//***************
//GESTION PSERIEs
procedure TConfigHardFrame.UsePS1CheckBoxClick(Sender: TObject);
var i : integer;
		OldName,OldSystem : string;
		InfoCanaux : TInfoCAnaux;
begin
  PS1ModeCombobox.Visible := true;
  PS1FreqCombobox.Visible := true;
  PS1NbCaptCombobox.Visible := true;
  Label12.Visible := true;
  Label17.Visible := true;
  Label18.Visible := true;
  PS1SousGroupBox.Height := 217;
  PS1Panel.Enabled := UsePS1CheckBox.Checked;
  if not PS1Panel.Enabled then
  begin
    //On deselectionne port serie
    PS1NomEdit.Text := '';
    PS1TypeComboBox.ItemIndex := -1;
    PS1BaudRateComboBox.ItemIndex := -1;
    PS1NbBitDataComboBox.ItemIndex := -1;
    PS1NbBitStopComboBox.ItemIndex := -1;
    PS1PariteComboBox.ItemIndex := -1;
    PS1FluxComboBox.ItemIndex := -1;
    PS1ModeComboBox.ItemIndex := -1;
    PS1FreqComboBox.ItemIndex := -1;
    PS1NbCaptComboBox.ItemIndex := -1;
    //Supprimer PS1 du modele
    for i := 0 to DocDOCOMETRE.PSERIE.Count - 1 do
    begin
      if DocDOCOMETRE.PSERIE.Items[i].NUMERO = 1 then
      begin
        OldName := DocDOCOMETRE.PSERIE[i].NOM;
				OldSystem := DocDOCOMETRE.PSERIE[i].SYSTEME;
				InfoCanaux := DocDOCOMETRE.RendreListeInfoCanaux;
				DocDOCOMETRE.ST.ChangeChannelName(OldName,'',OldSystem,InfoCanaux);
				InfoCanaux.Free;
        DocDOCOMETRE.PSERIE.Delete(i);
        break;
      end;
    end;
  end else
  begin
    Try
      PS1NomEdit.Text := 'PS1';
      PS1NomEdit.SetFocus;
      PS1NomEdit.SelectAll;
    Except
      On EInvalidOperation do;
    end;
  end;
  DocoForm.DescriptFrame.MAJIHM;
  DocoForm.SimulFrame.MAJIHM;
  PS1AppliquerButton.Enabled := false;
end;

procedure TConfigHardFrame.PS1TypeComboBoxChange(Sender: TObject);
begin
  if Sender is TCombobox then
  begin
  PS1BaudRateCombobox.ItemIndex := 0;
  PS1NbBitDataCombobox.ItemIndex := 0;
  PS1NbBitStopCombobox.ItemIndex := 0;
  PS1PariteCombobox.ItemIndex := 0;
  PS1FluxCombobox.ItemIndex := 0;
  PS1ModeCombobox.ItemIndex := 0;
  PS1FreqCombobox.ItemIndex := 0;
  PS1NbCaptCombobox.ItemIndex := 0;
  PS1FreqCombobox.Style := csDropDownList;
  PS1ModeCombobox.Enabled := false;
  PS1FreqCombobox.Enabled := false;
  PS1NbCaptCombobox.Enabled := false;
  end;
  if PS1TypeCombobox.ItemIndex = 0 then //Polhemus
  begin
    PS1ModeCombobox.Enabled := true;
    PS1FreqCombobox.Enabled := false;
    PS1NbCaptCombobox.Enabled := true;
  end;
  if PS1TypeCombobox.ItemIndex = 1 then //ICE
  begin
    PS1ModeComboBox.ItemIndex := 1;
    PS1ModeComboBox.Enabled := false;
    PS1FreqCombobox.Enabled := true;
    PS1FreqCombobox.Style := csDropDown;
    PS1FreqCombobox.Text := '100';
  end;
  if PS1TypeCombobox.ItemIndex = 2 then //Bird                     
  begin
    PS1ModeComboBox.ItemIndex := 1;
    PS1ModeComboBox.Enabled := false;
    PS1FreqCombobox.Style := csDropDown;
    PS1FreqCombobox.Text := '100';
  end;
  if PS1TypeCombobox.ItemIndex = 3 then
  begin
    PS1BaudRateCombobox.ItemIndex := 3; //SUMMA
    PS1ModeComboBox.ItemIndex := 1;
    PS1FreqCombobox.Enabled := true;
    PS1FreqCombobox.Style := csDropDown;
    PS1FreqCombobox.Text := '100';
  end;
  if PS1TypeCombobox.ItemIndex = 4 then //BERGERLAHR
  begin
    PS1BaudRateCombobox.ItemIndex := 4;
    PS1NbBitDataCombobox.ItemIndex := 1;
    PS1PariteCombobox.ItemIndex := 1;
    PS1FreqCombobox.Style := csDropDown;
    PS1FreqCombobox.Text := inttostr(DocDOCOMETRE.EXPERIENCE.FEG)
  end;

  if PS1TypeCombobox.ItemIndex = 5 then //CODAmotion
  begin
    PS1ModeComboBox.ItemIndex := 2;
    PS1NbCaptCombobox.Enabled := true;
    PS1FreqComboBox.Style := csDropDown;      
    PS1FreqCombobox.Enabled := true;
    PS1FreqComboBox.Text := inttostr(DocDOCOMETRE.EXPERIENCE.FEG)//'500';
  end;

  PS1Change(Self);
end;

procedure TConfigHardFrame.UsePS2CheckBoxClick(Sender: TObject);
var i : integer;
		OldName,OldSystem : string;
		InfoCanaux : TInfoCAnaux;
begin
	PS2ModeCombobox.Visible := true;
	PS2FreqCombobox.Visible := true;
	PS2NbCaptCombobox.Visible := true;
	Label22.Visible := true;
	Label23.Visible := true;
	Label24.Visible := true;
	PS2SousGroupBox.Height := 217;
  PS2Panel.Enabled := UsePS2CheckBox.Checked;
  if not PS2Panel.Enabled then
  begin
    PS2NomEdit.Text := '';
    PS2TypeComboBox.ItemIndex := -1;
    PS2BaudRateComboBox.ItemIndex := -1;
    PS2NbBitDataComboBox.ItemIndex := -1;
    PS2NbBitStopComboBox.ItemIndex := -1;
    PS2PariteComboBox.ItemIndex := -1;
    PS2FluxComboBox.ItemIndex := -1;
    PS2ModeComboBox.ItemIndex := -1;
    PS2FreqComboBox.ItemIndex := -1;
    PS2NbCaptComboBox.ItemIndex := -1;
    //Supprimer PS2 du modele
    for i := 0 to DocDOCOMETRE.PSERIE.Count - 1 do
    begin
      if DocDOCOMETRE.PSERIE.Items[i].NUMERO = 2 then
      begin
        OldName := DocDOCOMETRE.PSERIE[i].NOM;
				OldSystem := DocDOCOMETRE.PSERIE[i].SYSTEME;
				InfoCanaux := DocDOCOMETRE.RendreListeInfoCanaux;
				DocDOCOMETRE.ST.ChangeChannelName(OldName,'',OldSystem,InfoCanaux);
				InfoCanaux.Free;
        DocDOCOMETRE.PSERIE.Delete(i);
        break;
      end;
    end;
  end else
  begin
    try
      PS2NomEdit.Text := 'PS2';
      PS2NomEdit.SetFocus;
      PS2NomEdit.SelectAll;
    Except
      on EInvalidOperation do;
    end;
  end;
  DocoForm.DescriptFrame.MAJIHM;
  DocoForm.SimulFrame.MAJIHM;
  PS2AppliquerButton.Enabled := false;
end;

procedure TConfigHardFrame.PS2TypeComboBoxChange(Sender: TObject);
begin
  if Sender is TCombobox then
  begin
  PS2BaudRateCombobox.ItemIndex := 0;
  PS2NbBitDataCombobox.ItemIndex := 0;
  PS2NbBitStopCombobox.ItemIndex := 0;
  PS2PariteCombobox.ItemIndex := 0;
  PS2FluxCombobox.ItemIndex := 0;
  PS2ModeCombobox.ItemIndex := 0;
  PS2FreqCombobox.ItemIndex := 0;
  PS2NbCaptCombobox.ItemIndex := 0;
  PS2ModeCombobox.Enabled := false;
  PS2FreqCombobox.Enabled := false;
  PS2NbCaptCombobox.Enabled := false;
  PS2FreqCombobox.Style := csDropDownList;
  end;
  if PS2TypeCombobox.ItemIndex = 0 then //Polhemus
  begin
    PS2ModeCombobox.Enabled := true;
    PS2FreqCombobox.Enabled := false;
    PS2NbCaptCombobox.Enabled := true;
  end;
  if PS2TypeCombobox.ItemIndex = 1 then //ICE
  begin
    PS2ModeComboBox.ItemIndex := 1;
    PS2ModeComboBox.Enabled := false;
    PS2FreqCombobox.Enabled := true;
    PS2FreqCombobox.Style := csDropDown;
    PS2FreqCombobox.Text := '100';
  end;
  if PS2TypeCombobox.ItemIndex = 2 then //Bird
  begin
    PS2ModeComboBox.ItemIndex := 1;
    PS2ModeComboBox.Enabled := false;
    PS2FreqCombobox.Style := csDropDown;
    PS2FreqCombobox.Text := '100';
  end;
  if PS2TypeCombobox.ItemIndex = 3 then
  begin
    PS2BaudRateCombobox.ItemIndex := 3; //SUMMA
    PS2ModeComboBox.ItemIndex := 1;
    PS2FreqCombobox.Enabled := true;
    PS2FreqCombobox.Style := csDropDown;
    PS2FreqCombobox.Text := '100';
  end;
  if PS2TypeCombobox.ItemIndex = 4 then //BERGERLAHR
  begin
    PS2BaudRateCombobox.ItemIndex := 4;
    PS2NbBitDataCombobox.ItemIndex := 1;
    PS2PariteCombobox.ItemIndex := 1;
    PS2FreqCombobox.Style := csDropDown;
    PS2FreqCombobox.Text := inttostr(DocDOCOMETRE.EXPERIENCE.FEG);
  end;

  if PS2TypeCombobox.ItemIndex = 5 then //CODAmotion
  begin
    PS2ModeComboBox.ItemIndex := 2;
    PS2NbCaptCombobox.Enabled := true;
    PS2FreqComboBox.Style := csDropDown;  
    PS2FreqCombobox.Enabled := true;
    PS2FreqComboBox.Text := inttostr(DocDOCOMETRE.EXPERIENCE.FEG)//'500';
  end;

  PS2Change(Self);  
end;

procedure TConfigHardFrame.PS1AppliquerButtonClick(Sender: TObject);
var i : integer;
    PS1 : IXMLPSERIEType;
		OldName : string;
		InfoCanaux : TInfoCanaux;
begin
  //Supprimer PS1 du modele si existe
  for i := 0 to DocDOCOMETRE.PSERIE.Count - 1 do
  begin
    if DocDOCOMETRE.PSERIE.Items[i].NUMERO = 1 then
    begin
      OldName := DocDOCOMETRE.PSERIE[i].NOM;
      DocDOCOMETRE.PSERIE.Delete(i);
      break;
    end;
  end;
  if UsePS1CheckBox.Checked then
  begin
    //MAJ PS1
    PS1 := DocDOCOMETRE.PSERIE.Add;
    PS1.NUMERO := 1;
    PS1.NOM := PS1NomEdit.Text;
    PS1.SYSTEME := PS1TypeCombobox.Text;
    PS1.BAUDRATE := strtoint(PS1BaudRateCombobox.Text);
    PS1.NBBITDATA := strtoint(PS1NbBitDataCombobox.Text);
    PS1.NBBITSTOP := strtofloat(PS1NbBitStopCombobox.Text);
    PS1.PARITE := PS1PariteCombobox.Text;
    PS1.FLUX := PS1FluxCombobox.Text;
    PS1.MODE := PS1ModeCombobox.Text;
    PS1.FREQUENCE := strtoint(PS1FreqCombobox.Text);
		PS1.NBCAPTEURS := strtoint(PS1NbCaptCombobox.Text);
		InfoCanaux := DocDOCOMETRE.RendreListeInfoCanaux;
		DocDOCOMETRE.ST.ChangeChannelName(OldName,PS1.NOM,PS1.SYSTEME,InfoCanaux);
		InfoCanaux.Free;
  end;
  DocoForm.DescriptFrame.MAJIHM;
  DocoForm.SimulFrame.MAJIHM;
  PS1AppliquerButton.Enabled := false;
end;

procedure TConfigHardFrame.PS2AppliquerButtonClick(Sender: TObject);
var i : integer;
    PS2 : IXMLPSERIEType;
		OldName : string;
		InfoCanaux : TInfoCanaux;
begin
  //Supprimer PS2 du modele si existe
  for i := 0 to DocDOCOMETRE.PSERIE.Count - 1 do
  begin
    if DocDOCOMETRE.PSERIE.Items[i].NUMERO = 2 then
    begin
      OldName := DocDOCOMETRE.PSERIE[i].NOM;
      DocDOCOMETRE.PSERIE.Delete(i);
      break;
    end;
  end;
  if UsePS2CheckBox.Checked then
  begin
    //MAJ PS2
    PS2 := DocDOCOMETRE.PSERIE.Add;
    PS2.NUMERO := 2;
    PS2.NOM := PS2NomEdit.Text;
    PS2.SYSTEME := PS2TypeCombobox.Text;
    PS2.BAUDRATE := strtoint(PS2BaudRateCombobox.Text);
    PS2.NBBITDATA := strtoint(PS2NbBitDataCombobox.Text);
    PS2.NBBITSTOP := strtofloat(PS2NbBitStopCombobox.Text);
    PS2.PARITE := PS2PariteCombobox.Text;
    PS2.FLUX := PS2FluxCombobox.Text;
    PS2.MODE := PS2ModeCombobox.Text;
    PS2.FREQUENCE := strtoint(PS2FreqCombobox.Text);
		PS2.NBCAPTEURS := strtoint(PS2NbCaptCombobox.Text);
		InfoCanaux := DocDOCOMETRE.RendreListeInfoCanaux;
		DocDOCOMETRE.ST.ChangeChannelName(OldName,PS2.NOM,PS2.SYSTEME,InfoCanaux);
		InfoCanaux.Free;
  end;
  DocoForm.DescriptFrame.MAJIHM;
  DocoForm.SimulFrame.MAJIHM;
  PS2AppliquerButton.Enabled := false;
end;

procedure TConfigHardFrame.PS1Change(Sender: TObject);
begin
  PS1AppliquerButton.Enabled := true;
  if (Sender as TComponent).Name = 'PS1ModeComboBox' then
  begin
    if PS1ModeComboBox.ItemIndex = 0 then
    begin
      PS1FreqCombobox.Style := csDropDownList;
      PS1FreqCombobox.ItemIndex := PS1NbCaptComboBox.ItemIndex;
      PS1FreqCombobox.Enabled := false;
    end else
    begin
      PS1FreqCombobox.Style := csDropDown;
      PS1FreqCombobox.Enabled := true;
    end;
  end;
  if (Sender as TComponent).Name = 'PS1NbCaptComboBox' then
  begin
    if PS1ModeComboBox.ItemIndex = 0
    then PS1FreqCombobox.ItemIndex := PS1NbCaptComboBox.ItemIndex
  end;
end;

procedure TConfigHardFrame.PS2Change(Sender: TObject);
begin
  PS2AppliquerButton.Enabled := true;
  if (Sender as TComponent).Name = 'PS2ModeComboBox' then
  begin
    if PS2ModeComboBox.ItemIndex = 0 then
    begin
      PS2FreqCombobox.Style := csDropDownList;
      PS2FreqCombobox.ItemIndex := PS2NbCaptComboBox.ItemIndex;
      PS2FreqCombobox.Enabled := false;
    end else
    begin
      PS2FreqCombobox.Style := csDropDown;
			PS2FreqCombobox.Enabled := true;
    end;
  end;
  if (Sender as TComponent).Name = 'PS2NbCaptComboBox' then
  begin
    if PS2ModeComboBox.ItemIndex = 0
    then PS2FreqCombobox.ItemIndex := PS2NbCaptComboBox.ItemIndex
  end;
end;

procedure TConfigHardFrame.HelpImageClick(Sender: TObject);
begin
	DocoForm.ShowHelp((Sender as TImage).Tag);
end;

procedure TConfigHardFrame.AddEanActionForMainMenuExecute(Sender: TObject);
begin
	Self.PageControl1.ActivePage := EanTabSheet;
	AjoutEANButtonClick(Self);
end;

procedure TConfigHardFrame.SuppEanActionForMainMenuExecute(Sender: TObject);
begin
	Self.PageControl1.ActivePage := EanTabSheet;
	SuppEANButtonClick(Self);
end;

procedure TConfigHardFrame.AddSanActionForMainMenuExecute(Sender: TObject);
begin
	Self.PageControl1.ActivePage := SanTabSheet;
	AjoutSANButtonClick(Self)
end;

procedure TConfigHardFrame.SuppSanActionForMainMenuExecute(Sender: TObject);
begin
	Self.PageControl1.ActivePage := SanTabSheet;
	SuppSANButtonClick(Self)
end;

procedure TConfigHardFrame.AddEnumActionForMainMenuExecute(
  Sender: TObject);
begin
	Self.PageControl1.ActivePage := EnumSnumTabSheet;
	AjoutENUMButtonClick(Self)
end;

procedure TConfigHardFrame.SuppEnumActionForMainMenuExecute(
  Sender: TObject);
begin
	Self.PageControl1.ActivePage := EnumSnumTabSheet;
	SuppENUMButtonClick(Self)
end;

procedure TConfigHardFrame.AddSnumActionForMainMenuExecute(
	Sender: TObject);
begin
	Self.PageControl1.ActivePage := EnumSnumTabSheet;
	AjoutSNUMButtonClick(Self)
end;

procedure TConfigHardFrame.SuppSnumActionForMainMenuExecute(
	Sender: TObject);
begin
	Self.PageControl1.ActivePage := EnumSnumTabSheet;
	SuppSNUMButtonClick(Self)
end;

procedure TConfigHardFrame.AddCanIntActionForMainMenuExecute(
  Sender: TObject);
begin
	Self.PageControl1.ActivePage := CanIntTabSheet;
	AjoutCanIntButtonClick(Self)
end;

procedure TConfigHardFrame.SuppCanIntActionForMainMenuExecute(
	Sender: TObject);
begin
	Self.PageControl1.ActivePage := CanIntTabSheet;
	SuppCanIntButtonClick(Self)
end;

procedure TConfigHardFrame.UsePS1ActionForMainMenuExecute(Sender: TObject);
begin
	Self.PageControl1.ActivePage := PSerieTabSheet;
	UsePS1CheckBox.Checked := not UsePS1CheckBox.Checked;
end;

procedure TConfigHardFrame.UsePS2ActionForMainMenuExecute(Sender: TObject);
begin
	Self.PageControl1.ActivePage := PSerieTabSheet;
	UsePS2CheckBox.Checked := not UsePS2CheckBox.Checked;
end;

end.
