unit Unit4;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
  ExtCtrls,AccPampa, Refinar;

type

  { TForm4 }    {PARAMETROS GLOBALES}

  TForm4 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    CheckGroup1: TCheckGroup;
    CheckGroup2: TCheckGroup;
    CheckGroup3: TCheckGroup;
    CheckGroup4: TCheckGroup;
    CheckGroup5: TCheckGroup;
    CheckGroup6: TCheckGroup;
    Edit1: TEdit;
    Edit10: TEdit;
    Edit11: TEdit;
    Edit12: TEdit;
    Edit13: TEdit;
    Edit14: TEdit;
    Edit15: TEdit;
    Edit16: TEdit;
    Edit17: TEdit;
    Edit18: TEdit;
    Edit19: TEdit;
    Edit2: TEdit;
    Edit20: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    Edit5: TEdit;
    Edit6: TEdit;
    Edit7: TEdit;
    Edit8: TEdit;
    Edit9: TEdit;
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    OpenDialog1: TOpenDialog;
    RadioGroup1: TRadioGroup;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Form4Activate(Sender: TObject);
    procedure Form4new();

  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Form4: TForm4;

implementation

{$R *.lfm}

{ TForm4 }



procedure TForm4.Button1Click(Sender: TObject);    {Aceptar}
begin
  Einc := StrToFloat(Edit1.Text);
  Toff := StrToFloat(Edit2.Text);
  Titer := StrToFloat(Edit3.Text);
  Canali := StrToInt(Edit4.Text);
  Canalf := StrToInt(Edit5.Text);
  Detector:=RadioGroup1.ItemIndex+1;
  P0[1]:=StrToFloat(Edit6.Text); {Ganancia}
  if CheckGroup1.Checked[0]=True then  Cod[1]:=1
  else Cod[1]:=0;
  P0[2]:=StrToFloat(Edit7.Text); {Cero}
  if CheckGroup1.Checked[1]=True then Cod[2]:=1
  else Cod[2]:=0;
  P0[3]:=StrToFloat(Edit8.Text); {Espesores detector}
  if CheckGroup2.Checked[0]=True then  Cod[3]:=1
  else Cod[3]:=0;
  P0[4]:= StrToFloat(Edit9.Text );
  if CheckGroup2.Checked[1]=True then  Cod[4]:=1
  else  Cod[4]:=0;
  P0[5]:=StrToFloat(Edit10.Text);
  if CheckGroup2.Checked[2]=True then  Cod[5]:=1
  else  Cod[5]:=0;
  P0[6] := StrToFloat(Edit11.Text); {Fondo}
  if CheckGroup3.Checked[0]=True then  Cod[6]:=1
  else  Cod[6]:=0;
  P0[7] := StrToFloat(Edit12.Text); {Fondo}
  if CheckGroup3.Checked[1]=True then  Cod[7]:=1
  else  Cod[7]:=0;
  P0[8] := StrToFloat(Edit18.Text); {Fondo}
  if CheckGroup3.Checked[2]=True then  Cod[8]:=1
  else  Cod[8]:=0;
  P0[9] := StrToFloat(Edit13.Text); {Noise}
  if CheckGroup4.Checked[0]=True then  Cod[9]:=1
  else  Cod[9]:=0;
  P0[10] := StrToFloat(Edit14.Text); {Fano}
  if CheckGroup4.Checked[1]=True then  Cod[10]:=1
  else  Cod[10]:=0;
  P0[11] := StrToFloat(Edit15.Text); {Pico suma}
  if CheckGroup5.Checked[0]=True then  Cod[11]:=1
  else  Cod[11]:=0;
  P0[12] := StrToFloat(Edit16.Text); {Pico suma}
  if CheckGroup5.Checked[1]=True then  Cod[12]:=1
  else  Cod[12]:=0;
  P0[13] := StrToFloat(Edit17.Text); {Pico suma}
  if CheckGroup5.Checked[2]=True then  Cod[13]:=1
  else  Cod[13]:=0;
  P0[14] := StrToFloat(Edit20.Text); {Pico suma}
  if CheckGroup6.Checked[0]=True then  Cod[14]:=1
  else  Cod[14]:=0;
  ContNPR;
  Form4.Close;
end;

procedure TForm4.Button2Click(Sender: TObject);
begin
     if OpenDialog1.Execute then
     begin
          Dieff := OpenDialog1.Filename;
     end;
     Edit19.Text:=Dieff;
end;

procedure TForm4.Form4Activate(Sender: TObject);
begin
  Edit1.Text := FloatToStr(Einc);
  Edit2.Text := FloatToStr(Toff);
  Edit3.Text := FloatToStr(Titer);
  Edit4.Text := FloatToStr(Canali);
  Edit5.Text := FloatToStr(Canalf);
  RadioGroup1.ItemIndex:=Detector-1;
  Edit6.Text := FloatToStr(P0[1]); {Ganancia}
  If(Detector=2) then CheckGroup2.Items[1]:='Al:';
  if Cod[1] = 1 then CheckGroup1.Checked[0]:=True
  else Checkgroup1.Checked[0] := False;
  Edit7.Text := FloatToStr(P0[2]); {Cero}
  if Cod[2] = 1 then CheckGroup1.Checked[1] := True
  else CheckGroup1.Checked[1] := False;
  Edit8.Text := FloatToStr(P0[3]); {Espesores detector}
  if Cod[3] = 1 then CheckGroup2.Checked[0] := True
  else CheckGroup2.Checked[0] := False;
  Edit9.Text := FloatToStr(P0[4]);
  if Cod[4] = 1 then CheckGroup2.Checked[1] := True
  else  CheckGroup2.Checked[1] := False;
  Edit10.Text := FloatToStr(P0[5]);
  if Cod[5] = 1 then  CheckGroup2.Checked[2] := True
  else  CheckGroup2.Checked[2] := False;
  Edit11.Text := FloatToStr(P0[6]); {Fondo}
  if Cod[6] = 1 then  CheckGroup3.Checked[0] := True
  else   CheckGroup3.Checked[0] := False;
  Edit12.Text := FloatToStr(P0[7]); {Fondo}
  if Cod[7] = 1 then   CheckGroup3.Checked[1] := True
  else   CheckGroup3.Checked[1] := False;
  Edit18.Text := FloatToStr(P0[8]); {Fondo}
  if Cod[8] = 1 then   CheckGroup3.Checked[2] := True
  else   CheckGroup3.Checked[2] := False;
  Edit13.Text := FloatToStr(P0[9]); {Noise}
  if Cod[9] = 1 then   CheckGroup4.Checked[0] := True
  else  CheckGroup4.Checked[0] := False;
  Edit14.Text := FloatToStr(P0[10]); {Fano}
  if Cod[10] = 1 then  CheckGroup4.Checked[1] := True
  else  CheckGroup4.Checked[1] := False;
  Edit15.Text := FloatToStr(P0[11]); {Pico suma}
  if Cod[11] = 1 then  CheckGroup5.Checked[0] := True
  else  CheckGroup5.Checked[0] := False;
  Edit16.Text := FloatToStr(P0[12]); {Pico suma}
  if Cod[12] = 1 then  CheckGroup5.Checked[1] := True
  else  CheckGroup5.Checked[1] := False;
  Edit17.Text := FloatToStr(P0[13]); {Pico suma}
  if Cod[13] = 1 then  CheckGroup5.Checked[2] := True
  else  CheckGroup5.Checked[2] := False;
  Edit20.Text := FloatToStr(P0[14]); {Pico suma}
  if Cod[14] = 1 then  CheckGroup6.Checked[0] := True
  else  CheckGroup6.Checked[0] := False;
end;

procedure TForm4.Form4new();
  Var i:Integer;
begin
  Einc:=0;
  Toff:=0;
  Titer:=0;
  Canali:=0;
  Canalf:=0;
  For i:=1 To 14 Do Begin
    P0[i]:=0;
    Cod[i]:=0;
  end;
end;

end.

