/////////////////////////////////////////////////////////////////////////////////
//
// This file is part of SACAMOS, cable models for EMI simulations in SPICE.
// It was developed by the University of Nottingham and the Netherlands Aerospace
// Centre (NLR) for ESA under contract number 4000112765/14/NL/HK.
//
// Copyright (C) 2015 - 2018 University of Nottingham
//
// SACAMOS is free software: you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software
// Foundation, either version 3 of the License, or (at your option) any later
// version.
//
// SACAMOS is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
// for more details.
//
// A copy of the GNU General Public License version 3 can be found in the
// file GNU_GPL_v3 in the root or at <http://www.gnu.org/licenses/>.
//
// wxWidgets is currently licenced under the "wxWindows Library Licence".
// A copy of the wxWindows Library Licence, Version 3.1 can be found in the file
// wxWindows_Library_Licence_v3-1 in the root or at:
// <https://www.wxwidgets.org/about/licence/>
//
// The University of Nottingham can be contacted at: ggiemr@nottingham.ac.uk
//
// File Contents:
//
// NAME
//     FD_ESR.cpp
//
// DESCRIPTION
//     GUI for the definition of 2 sets of frequency dependent parameters
//
// AUTHOR(S)
//     Steve Greedy
//
/////////////////////////////////////////////////////////////////////////////////
#include "FD_ESR.h"

//(*InternalHeaders(FD_ESR)
#include <wx/settings.h>
#include <wx/intl.h>
#include <wx/string.h>
//*)

//(*IdInit(FD_ESR)
const long FD_ESR::ID_STATICTEXT1 = wxNewId();
const long FD_ESR::ID_TEXTCTRL1 = wxNewId();
const long FD_ESR::ID_STATICLINE1 = wxNewId();
const long FD_ESR::ID_STATICLINE2 = wxNewId();
const long FD_ESR::ID_STATICTEXT2 = wxNewId();
const long FD_ESR::ID_TEXTCTRL2 = wxNewId();
const long FD_ESR::ID_STATICTEXT3 = wxNewId();
const long FD_ESR::ID_TEXTCTRL3 = wxNewId();
const long FD_ESR::ID_STATICLINE3 = wxNewId();
const long FD_ESR::ID_STATICLINE4 = wxNewId();
const long FD_ESR::ID_STATICTEXT4 = wxNewId();
const long FD_ESR::ID_TEXTCTRL4 = wxNewId();
const long FD_ESR::ID_STATICTEXT5 = wxNewId();
const long FD_ESR::ID_TEXTCTRL5 = wxNewId();
const long FD_ESR::ID_STATICTEXT6 = wxNewId();
const long FD_ESR::ID_TEXTCTRL6 = wxNewId();
const long FD_ESR::ID_STATICLINE5 = wxNewId();
const long FD_ESR::ID_STATICLINE6 = wxNewId();
const long FD_ESR::ID_STATICTEXT7 = wxNewId();
const long FD_ESR::ID_TEXTCTRL7 = wxNewId();
const long FD_ESR::ID_STATICTEXT8 = wxNewId();
const long FD_ESR::ID_TEXTCTRL8 = wxNewId();
const long FD_ESR::ID_STATICLINE7 = wxNewId();
const long FD_ESR::ID_STATICLINE8 = wxNewId();
const long FD_ESR::ID_STATICTEXT9 = wxNewId();
const long FD_ESR::ID_TEXTCTRL9 = wxNewId();
const long FD_ESR::ID_STATICTEXT10 = wxNewId();
const long FD_ESR::ID_TEXTCTRL10 = wxNewId();
const long FD_ESR::ID_CHECKBOX1 = wxNewId();
const long FD_ESR::ID_STATICTEXT13 = wxNewId();
const long FD_ESR::ID_TEXTCTRL12 = wxNewId();
const long FD_ESR::ID_STATICTEXT14 = wxNewId();
const long FD_ESR::ID_TEXTCTRL13 = wxNewId();
const long FD_ESR::ID_STATICTEXT15 = wxNewId();
const long FD_ESR::ID_TEXTCTRL14 = wxNewId();
const long FD_ESR::ID_STATICTEXT12 = wxNewId();
const long FD_ESR::ID_RADIOBUTTON1 = wxNewId();
const long FD_ESR::ID_RADIOBUTTON2 = wxNewId();
const long FD_ESR::ID_STATICTEXT11 = wxNewId();
const long FD_ESR::ID_TEXTCTRL11 = wxNewId();
const long FD_ESR::ID_BUTTON1 = wxNewId();
const long FD_ESR::ID_BUTTON2 = wxNewId();
//*)

BEGIN_EVENT_TABLE(FD_ESR,wxDialog)
	//(*EventTable(FD_ESR)
	//*)
END_EVENT_TABLE()

FD_ESR::FD_ESR(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
{
	//(*Initialize(FD_ESR)
	wxStaticBoxSizer* StaticBoxSizer2;
	wxFlexGridSizer* FlexGridSizer4;
	wxFlexGridSizer* FlexGridSizer3;
	wxFlexGridSizer* FlexGridSizer5;
	wxFlexGridSizer* FlexGridSizer2;
	wxFlexGridSizer* FlexGridSizer7;
	wxStaticBoxSizer* StaticBoxSizer3;
	wxGridSizer* GridSizer3;
	wxFlexGridSizer* FlexGridSizer8;
	wxFlexGridSizer* FlexGridSizer6;
	wxStaticBoxSizer* StaticBoxSizer1;
	wxFlexGridSizer* FlexGridSizer1;
	wxGridSizer* GridSizer2;

	Create(parent, wxID_ANY, _("Frequency Dependent Dielectric"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY"));
	FlexGridSizer1 = new wxFlexGridSizer(0, 1, 0, 0);
	FlexGridSizer1->AddGrowableCol(0);
	FlexGridSizer1->AddGrowableRow(0);
	FlexGridSizer5 = new wxFlexGridSizer(0, 2, 0, 0);
	StaticBoxSizer1 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Inner Dielectric"));
	FlexGridSizer2 = new wxFlexGridSizer(0, 2, 0, 0);
	StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Normalisation Constant"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1"));
	FlexGridSizer2->Add(StaticText1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl1 = new wxTextCtrl(this, ID_TEXTCTRL1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL1"));
	TextCtrl1->SetToolTip(_("Normalisation costant"));
	FlexGridSizer2->Add(TextCtrl1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticLine1 = new wxStaticLine(this, ID_STATICLINE1, wxDefaultPosition, wxSize(10,-1), wxLI_HORIZONTAL, _T("ID_STATICLINE1"));
	FlexGridSizer2->Add(StaticLine1, 1, wxALL|wxEXPAND, 0);
	StaticLine2 = new wxStaticLine(this, ID_STATICLINE2, wxDefaultPosition, wxSize(10,-1), wxLI_HORIZONTAL, _T("ID_STATICLINE2"));
	FlexGridSizer2->Add(StaticLine2, 1, wxALL|wxEXPAND, 0);
	StaticText2 = new wxStaticText(this, ID_STATICTEXT2, _("a order"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT2"));
	FlexGridSizer2->Add(StaticText2, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl2 = new wxTextCtrl(this, ID_TEXTCTRL2, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL2"));
	TextCtrl2->SetToolTip(_("a order"));
	FlexGridSizer2->Add(TextCtrl2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText3 = new wxStaticText(this, ID_STATICTEXT3, _("a coefficients"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT3"));
	FlexGridSizer2->Add(StaticText3, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl3 = new wxTextCtrl(this, ID_TEXTCTRL3, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL3"));
	TextCtrl3->SetToolTip(_("a coefficient - space seperated list"));
	FlexGridSizer2->Add(TextCtrl3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticLine3 = new wxStaticLine(this, ID_STATICLINE3, wxDefaultPosition, wxSize(10,-1), wxLI_HORIZONTAL, _T("ID_STATICLINE3"));
	FlexGridSizer2->Add(StaticLine3, 1, wxALL|wxEXPAND, 0);
	StaticLine4 = new wxStaticLine(this, ID_STATICLINE4, wxDefaultPosition, wxSize(10,-1), wxLI_HORIZONTAL, _T("ID_STATICLINE4"));
	FlexGridSizer2->Add(StaticLine4, 1, wxALL|wxEXPAND, 0);
	StaticText4 = new wxStaticText(this, ID_STATICTEXT4, _("b order"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT4"));
	FlexGridSizer2->Add(StaticText4, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl4 = new wxTextCtrl(this, ID_TEXTCTRL4, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL4"));
	TextCtrl4->SetToolTip(_("b order"));
	FlexGridSizer2->Add(TextCtrl4, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText5 = new wxStaticText(this, ID_STATICTEXT5, _("b coefficients"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT5"));
	FlexGridSizer2->Add(StaticText5, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl5 = new wxTextCtrl(this, ID_TEXTCTRL5, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL5"));
	TextCtrl5->SetToolTip(_("b coefficient - space seperated list"));
	FlexGridSizer2->Add(TextCtrl5, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticBoxSizer1->Add(FlexGridSizer2, 1, wxALL, 5);
	FlexGridSizer5->Add(StaticBoxSizer1, 1, wxALL|wxEXPAND, 5);
	StaticBoxSizer2 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Outer Dielectric"));
	FlexGridSizer3 = new wxFlexGridSizer(0, 2, 0, 0);
	StaticText6 = new wxStaticText(this, ID_STATICTEXT6, _("Normalisation Constant"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT6"));
	FlexGridSizer3->Add(StaticText6, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl6 = new wxTextCtrl(this, ID_TEXTCTRL6, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL6"));
	TextCtrl6->SetToolTip(_("Normalisation costant"));
	FlexGridSizer3->Add(TextCtrl6, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticLine5 = new wxStaticLine(this, ID_STATICLINE5, wxDefaultPosition, wxSize(10,-1), wxLI_HORIZONTAL, _T("ID_STATICLINE5"));
	FlexGridSizer3->Add(StaticLine5, 1, wxALL|wxEXPAND, 0);
	StaticLine6 = new wxStaticLine(this, ID_STATICLINE6, wxDefaultPosition, wxSize(10,-1), wxLI_HORIZONTAL, _T("ID_STATICLINE6"));
	FlexGridSizer3->Add(StaticLine6, 1, wxALL|wxEXPAND, 0);
	StaticText7 = new wxStaticText(this, ID_STATICTEXT7, _("a order"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT7"));
	FlexGridSizer3->Add(StaticText7, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl7 = new wxTextCtrl(this, ID_TEXTCTRL7, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL7"));
	TextCtrl7->SetToolTip(_("a order"));
	FlexGridSizer3->Add(TextCtrl7, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText8 = new wxStaticText(this, ID_STATICTEXT8, _("a coefficients"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT8"));
	FlexGridSizer3->Add(StaticText8, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl8 = new wxTextCtrl(this, ID_TEXTCTRL8, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL8"));
	TextCtrl8->SetToolTip(_("a coefficient - space seperated list"));
	FlexGridSizer3->Add(TextCtrl8, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticLine7 = new wxStaticLine(this, ID_STATICLINE7, wxDefaultPosition, wxSize(10,-1), wxLI_HORIZONTAL, _T("ID_STATICLINE7"));
	FlexGridSizer3->Add(StaticLine7, 1, wxALL|wxEXPAND, 0);
	StaticLine8 = new wxStaticLine(this, ID_STATICLINE8, wxDefaultPosition, wxSize(10,-1), wxLI_HORIZONTAL, _T("ID_STATICLINE8"));
	FlexGridSizer3->Add(StaticLine8, 1, wxALL|wxEXPAND, 0);
	StaticText9 = new wxStaticText(this, ID_STATICTEXT9, _("b order"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT9"));
	FlexGridSizer3->Add(StaticText9, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl9 = new wxTextCtrl(this, ID_TEXTCTRL9, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL9"));
	TextCtrl9->SetToolTip(_("b order"));
	FlexGridSizer3->Add(TextCtrl9, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText10 = new wxStaticText(this, ID_STATICTEXT10, _("b coefficients"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT10"));
	FlexGridSizer3->Add(StaticText10, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl10 = new wxTextCtrl(this, ID_TEXTCTRL10, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL10"));
	TextCtrl10->SetToolTip(_("b coefficient - space seperated list"));
	FlexGridSizer3->Add(TextCtrl10, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticBoxSizer2->Add(FlexGridSizer3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	FlexGridSizer5->Add(StaticBoxSizer2, 1, wxALL|wxEXPAND, 5);
	FlexGridSizer1->Add(FlexGridSizer5, 1, wxALL|wxEXPAND, 5);
	StaticBoxSizer3 = new wxStaticBoxSizer(wxVERTICAL, this, _("Filter Fitting Parameters"));
	FlexGridSizer6 = new wxFlexGridSizer(0, 1, 0, 0);
	FlexGridSizer8 = new wxFlexGridSizer(0, 3, 0, 0);
	CheckBox1 = new wxCheckBox(this, ID_CHECKBOX1, _("Use Defaults"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX1"));
	CheckBox1->SetValue(true);
	FlexGridSizer8->Add(CheckBox1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	FlexGridSizer6->Add(FlexGridSizer8, 1, wxALL|wxEXPAND, 5);
	GridSizer3 = new wxGridSizer(0, 2, 0, 0);
	StaticText13 = new wxStaticText(this, ID_STATICTEXT13, _("Frequency min (Hz)"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT13"));
	GridSizer3->Add(StaticText13, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl12 = new wxTextCtrl(this, ID_TEXTCTRL12, _("1e3"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL12"));
	TextCtrl12->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT));
	GridSizer3->Add(TextCtrl12, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText14 = new wxStaticText(this, ID_STATICTEXT14, _("Frequecy max (Hz)"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT14"));
	GridSizer3->Add(StaticText14, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl13 = new wxTextCtrl(this, ID_TEXTCTRL13, _("1e9"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL13"));
	TextCtrl13->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT));
	GridSizer3->Add(TextCtrl13, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText15 = new wxStaticText(this, ID_STATICTEXT15, _("Number of Frequencies"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT15"));
	GridSizer3->Add(StaticText15, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl14 = new wxTextCtrl(this, ID_TEXTCTRL14, _("12"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL14"));
	TextCtrl14->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT));
	GridSizer3->Add(TextCtrl14, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	FlexGridSizer6->Add(GridSizer3, 1, wxALL|wxEXPAND, 5);
	GridSizer2 = new wxGridSizer(0, 3, 0, 0);
	StaticText12 = new wxStaticText(this, ID_STATICTEXT12, _("Range Type"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT12"));
	GridSizer2->Add(StaticText12, 2, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	RadioButton1 = new wxRadioButton(this, ID_RADIOBUTTON1, _("Lin"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_RADIOBUTTON1"));
	RadioButton1->SetValue(true);
	GridSizer2->Add(RadioButton1, 1, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
	RadioButton2 = new wxRadioButton(this, ID_RADIOBUTTON2, _("Log"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_RADIOBUTTON2"));
	GridSizer2->Add(RadioButton2, 1, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
	FlexGridSizer6->Add(GridSizer2, 1, wxALL|wxEXPAND, 5);
	FlexGridSizer7 = new wxFlexGridSizer(0, 2, 0, 0);
	StaticText11 = new wxStaticText(this, ID_STATICTEXT11, _("Order for Filter Fitting "), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT11"));
	FlexGridSizer7->Add(StaticText11, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl11 = new wxTextCtrl(this, ID_TEXTCTRL11, _("-10"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL11"));
	TextCtrl11->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT));
	FlexGridSizer7->Add(TextCtrl11, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	FlexGridSizer6->Add(FlexGridSizer7, 1, wxALL|wxEXPAND, 5);
	StaticBoxSizer3->Add(FlexGridSizer6, 1, wxALL|wxEXPAND, 5);
	FlexGridSizer1->Add(StaticBoxSizer3, 1, wxALL|wxEXPAND, 5);
	FlexGridSizer4 = new wxFlexGridSizer(0, 5, 0, 0);
	FlexGridSizer4->AddGrowableCol(0);
	FlexGridSizer4->AddGrowableCol(1);
	Button1 = new wxButton(this, ID_BUTTON1, _("OK"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1"));
	FlexGridSizer4->Add(Button1, 1, wxALL|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
	Button2 = new wxButton(this, ID_BUTTON2, _("CLOSE"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2"));
	FlexGridSizer4->Add(Button2, 1, wxALL|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
	FlexGridSizer1->Add(FlexGridSizer4, 5, wxALL|wxALIGN_RIGHT, 5);
	SetSizer(FlexGridSizer1);
	FlexGridSizer1->Fit(this);
	FlexGridSizer1->SetSizeHints(this);

	Connect(ID_TEXTCTRL1,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&FD_ESR::OnTextCtrl1Text);
	Connect(ID_TEXTCTRL2,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&FD_ESR::OnTextCtrl2Text);
	Connect(ID_TEXTCTRL3,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&FD_ESR::OnTextCtrl3Text);
	Connect(ID_TEXTCTRL4,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&FD_ESR::OnTextCtrl4Text);
	Connect(ID_TEXTCTRL5,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&FD_ESR::OnTextCtrl5Text);
	Connect(ID_TEXTCTRL6,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&FD_ESR::OnTextCtrl6Text);
	Connect(ID_TEXTCTRL7,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&FD_ESR::OnTextCtrl7Text);
	Connect(ID_TEXTCTRL8,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&FD_ESR::OnTextCtrl8Text);
	Connect(ID_TEXTCTRL9,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&FD_ESR::OnTextCtrl9Text);
	Connect(ID_TEXTCTRL10,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&FD_ESR::OnTextCtrl10Text);
	Connect(ID_TEXTCTRL13,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&FD_ESR::OnTextCtrl13Text);
	Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&FD_ESR::OnButton1Click1);
	Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&FD_ESR::OnButton2Click1);
	Connect(wxID_ANY,wxEVT_INIT_DIALOG,(wxObjectEventFunction)&FD_ESR::OnInit);
	//*)

}

FD_ESR::~FD_ESR()
{
	//(*Destroy(FD_ESR)
	//*)
}

void FD_ESR::OnButton1Click1(wxCommandEvent& event)
{
    SetReturnCode(wxID_OK);
    EndModal(wxID_OK);
}

void FD_ESR::OnButton2Click1(wxCommandEvent& event)
{
    SetReturnCode(wxID_CANCEL);
    EndModal(wxID_OK);
}

void FD_ESR::OnTextCtrl1Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric(TextCtrl2, &IsError);
}

void FD_ESR::OnTextCtrl2Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric(TextCtrl2, &IsError);
}

void FD_ESR::OnTextCtrl3Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric_list(TextCtrl3, &IsError);
}

void FD_ESR::OnTextCtrl4Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric(TextCtrl4, &IsError);
}

void FD_ESR::OnTextCtrl5Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric_list(TextCtrl5, &IsError);
}

void FD_ESR::OnTextCtrl6Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric(TextCtrl6, &IsError);
}

void FD_ESR::OnTextCtrl7Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric(TextCtrl7, &IsError);
}

void FD_ESR::OnTextCtrl8Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric_list(TextCtrl8, &IsError);
}

void FD_ESR::OnTextCtrl9Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric(TextCtrl9, &IsError);
}

void FD_ESR::OnTextCtrl10Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric_list(TextCtrl10, &IsError);
}

void FD_ESR::OnInit(wxInitDialogEvent& event)
{
    if (formtype == 1)
    {
        TextCtrl1->Enable(false);
        TextCtrl2->Enable(false);
        TextCtrl3->Enable(false);
        TextCtrl4->Enable(false);
        TextCtrl5->Enable(false);

        TextCtrl11->Enable(false);
        RadioButton1->Enable(false);
        RadioButton2->Enable(false);
        TextCtrl12->Enable(false);
        TextCtrl13->Enable(false);
        TextCtrl14->Enable(false);
    }

    if (formtype == 2)
    {
        TextCtrl11->Enable(false);
        RadioButton1->Enable(false);
        RadioButton2->Enable(false);
        TextCtrl12->Enable(false);
        TextCtrl13->Enable(false);
        TextCtrl14->Enable(false);
    }

}

void FD_ESR::OnTextCtrl14Text(wxCommandEvent& event)
{
}

void FD_ESR::OnTextCtrl13Text(wxCommandEvent& event)
{
}
