// Dlg_AddOpenings.cpp : implementation file
//

#include "stdafx.h"
#include "SAPP1.h"
#include "SAPP1Dlg.h"
#include "Dlg_AddOpenings.h"
#include <vector>

using namespace std;

// CDlg_AddOpenings dialog

IMPLEMENT_DYNAMIC(CDlg_AddOpenings, CDialog)
CDlg_AddOpenings::CDlg_AddOpenings(CWnd* pParent /*=NULL*/)
	: CDialog(CDlg_AddOpenings::IDD, pParent)
	, m_btnWall(0)
	, m_btnRoof(0)
	, str_editWall1Name(_T(""))
	, str_editWall2Name(_T(""))
	, str_editWall3Name(_T(""))
	, str_editWall4Name(_T(""))
	, str_editWall5Name(_T(""))
	, str_editWall6Name(_T(""))
	, str_editWall7Name(_T(""))
	, str_editWall8Name(_T(""))
	, str_editWall9Name(_T(""))
	, str_editWall10Name(_T(""))
	, str_editNumofOpeningsWall1(_T(""))
	, str_editNumofOpeningsWall2(_T(""))
	, str_editNumofOpeningsWall3(_T(""))
	, str_editNumofOpeningsWall4(_T(""))
	, str_editNumofOpeningsWall5(_T(""))
	, str_editNumofOpeningsWall6(_T(""))
	, str_editNumofOpeningsWall7(_T(""))
	, str_editNumofOpeningsWall8(_T(""))
	, str_editNumofOpeningsWall9(_T(""))
	, str_editNumofOpeningsWall10(_T(""))
	, str_editRoof1Name(_T(""))
	, str_editRoof2Name(_T(""))
	, str_editRoof3Name(_T(""))
	, str_editRoof4Name(_T(""))
	, str_editRoof5Name(_T(""))
	, str_editRoof6Name(_T(""))
	, str_editRoof7Name(_T(""))
	, str_editRoof8Name(_T(""))
	, str_editRoof9Name(_T(""))
	, str_editRoof10Name(_T(""))
	, str_editNumofOpeningsRoof1(_T(""))
	, str_editNumofOpeningsRoof2(_T(""))
	, str_editNumofOpeningsRoof3(_T(""))
	, str_editNumofOpeningsRoof4(_T(""))
	, str_editNumofOpeningsRoof5(_T(""))
	, str_editNumofOpeningsRoof6(_T(""))
	, str_editNumofOpeningsRoof7(_T(""))
	, str_editNumofOpeningsRoof8(_T(""))
	, str_editNumofOpeningsRoof9(_T(""))
	, str_editNumofOpeningsRoof10(_T(""))
	, str_editOpeningName(_T(""))
	, str_comboListOpenings(_T(""))
{
}

CDlg_AddOpenings::~CDlg_AddOpenings()
{
}

void CDlg_AddOpenings::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_EDIT1, m_editWall1Name);
	DDX_Control(pDX, IDC_EDIT2, m_editWall2Name);
	DDX_Control(pDX, IDC_EDIT3, m_editWall3Name);
	DDX_Control(pDX, IDC_EDIT4, m_editWall4Name);
	DDX_Control(pDX, IDC_EDIT5, m_editWall5Name);
	DDX_Control(pDX, IDC_EDIT6, m_editWall6Name);
	DDX_Control(pDX, IDC_EDIT7, m_editWall7Name);
	DDX_Control(pDX, IDC_EDIT8, m_editWall8Name);
	DDX_Control(pDX, IDC_EDIT9, m_editWall9Name);
	DDX_Control(pDX, IDC_EDIT10, m_editWall10Name);
	DDX_Control(pDX, IDC_EDIT12, m_editRoof1Name);
	DDX_Control(pDX, IDC_EDIT13, m_editRoof2Name);
	DDX_Control(pDX, IDC_EDIT14, m_editRoof3Name);
	DDX_Control(pDX, IDC_EDIT15, m_editRoof4Name);
	DDX_Control(pDX, IDC_EDIT16, m_editRoof5Name);
	DDX_Control(pDX, IDC_EDIT17, m_editRoof6Name);
	DDX_Control(pDX, IDC_EDIT18, m_editRoof7Name);
	DDX_Control(pDX, IDC_EDIT19, m_editRoof8Name);
	DDX_Control(pDX, IDC_EDIT20, m_editRoof9Name);
	DDX_Control(pDX, IDC_EDIT21, m_editRoof10Name);
	DDX_Control(pDX, IDC_CHECK1, m_btnWall1);
	DDX_Control(pDX, IDC_CHECK2, m_btnWall2);
	DDX_Control(pDX, IDC_CHECK3, m_btnWall3);
	DDX_Control(pDX, IDC_CHECK4, m_btnWall4);
	DDX_Control(pDX, IDC_CHECK5, m_btnWall5);
	DDX_Control(pDX, IDC_CHECK6, m_btnWall6);
	DDX_Control(pDX, IDC_CHECK13, m_btnWall7);
	DDX_Control(pDX, IDC_CHECK7, m_btnWall8);
	DDX_Control(pDX, IDC_CHECK8, m_btnWall9);
	DDX_Control(pDX, IDC_CHECK14, m_btnWall10);
	DDX_Control(pDX, IDC_CHECK9, m_btnRoof1);
	DDX_Control(pDX, IDC_CHECK10, m_btnRoof2);
	DDX_Control(pDX, IDC_CHECK15, m_btnRoof3);
	DDX_Control(pDX, IDC_CHECK11, m_btnRoof4);
	DDX_Control(pDX, IDC_CHECK16, m_btnRoof5);
	DDX_Control(pDX, IDC_CHECK12, m_btnRoof6);
	DDX_Control(pDX, IDC_CHECK17, m_btnRoof7);
	DDX_Control(pDX, IDC_CHECK18, m_btnRoof8);
	DDX_Control(pDX, IDC_CHECK19, m_btnRoof9);
	DDX_Control(pDX, IDC_CHECK21, m_btnRoof10);
	DDX_Control(pDX, IDC_EDIT11, m_editNumofOpeningsWall1);
	DDX_Control(pDX, IDC_EDIT22, m_editNumofOpeningsWall2);
	DDX_Control(pDX, IDC_EDIT23, m_editNumofOpeningsWall3);
	DDX_Control(pDX, IDC_EDIT27, m_editNumofOpeningsWall4);
	DDX_Control(pDX, IDC_EDIT28, m_editNumofOpeningsWall5);
	DDX_Control(pDX, IDC_EDIT29, m_editNumofOpeningsWall6);
	DDX_Control(pDX, IDC_EDIT30, m_editNumofOpeningsWall7);
	DDX_Control(pDX, IDC_EDIT31, m_editNumofOpeningsWall8);
	DDX_Control(pDX, IDC_EDIT33, m_editNumofOpeningsWall9);
	DDX_Control(pDX, IDC_EDIT32, m_editNumofOpeningsWall10);
	DDX_Control(pDX, IDC_EDIT34, m_editNumofOpeningsRoof1);
	DDX_Control(pDX, IDC_EDIT43, m_editNumofOpeningsRoof2);
	DDX_Control(pDX, IDC_EDIT44, m_editNumofOpeningsRoof3);
	DDX_Control(pDX, IDC_EDIT45, m_editNumofOpeningsRoof4);
	DDX_Control(pDX, IDC_EDIT46, m_editNumofOpeningsRoof5);
	DDX_Control(pDX, IDC_EDIT47, m_editNumofOpeningsRoof6);
	DDX_Control(pDX, IDC_EDIT48, m_editNumofOpeningsRoof7);
	DDX_Control(pDX, IDC_EDIT49, m_editNumofOpeningsRoof9);
	DDX_Control(pDX, IDC_EDIT51, m_editNumofOpeningsRoof8);
	DDX_Control(pDX, IDC_EDIT50, m_editNumofOpeningsRoof10);
	DDX_Control(pDX, IDC_EDIT25, m_editOpeningName);
	DDX_Text(pDX, IDC_EDIT1, str_editWall1Name);
	DDX_Text(pDX, IDC_EDIT2, str_editWall2Name);
	DDX_Text(pDX, IDC_EDIT3, str_editWall3Name);
	DDX_Text(pDX, IDC_EDIT4, str_editWall4Name);
	DDX_Text(pDX, IDC_EDIT5, str_editWall5Name);
	DDX_Text(pDX, IDC_EDIT6, str_editWall6Name);
	DDX_Text(pDX, IDC_EDIT7, str_editWall7Name);
	DDX_Text(pDX, IDC_EDIT8, str_editWall8Name);
	DDX_Text(pDX, IDC_EDIT9, str_editWall9Name);
	DDX_Text(pDX, IDC_EDIT10, str_editWall10Name);
	DDX_Text(pDX, IDC_EDIT11, str_editNumofOpeningsWall1);
	DDX_Text(pDX, IDC_EDIT22, str_editNumofOpeningsWall2);
	DDX_Text(pDX, IDC_EDIT23, str_editNumofOpeningsWall3);
	DDX_Text(pDX, IDC_EDIT27, str_editNumofOpeningsWall4);
	DDX_Text(pDX, IDC_EDIT28, str_editNumofOpeningsWall5);
	DDX_Text(pDX, IDC_EDIT29, str_editNumofOpeningsWall6);
	DDX_Text(pDX, IDC_EDIT30, str_editNumofOpeningsWall7);
	DDX_Text(pDX, IDC_EDIT31, str_editNumofOpeningsWall8);
	DDX_Text(pDX, IDC_EDIT33, str_editNumofOpeningsWall9);
	DDX_Text(pDX, IDC_EDIT32, str_editNumofOpeningsWall10);
	DDX_Text(pDX, IDC_EDIT12, str_editRoof1Name);
	DDX_Text(pDX, IDC_EDIT13, str_editRoof2Name);
	DDX_Text(pDX, IDC_EDIT14, str_editRoof3Name);
	DDX_Text(pDX, IDC_EDIT15, str_editRoof4Name);
	DDX_Text(pDX, IDC_EDIT16, str_editRoof5Name);
	DDX_Text(pDX, IDC_EDIT17, str_editRoof6Name);
	DDX_Text(pDX, IDC_EDIT18, str_editRoof7Name);
	DDX_Text(pDX, IDC_EDIT19, str_editRoof8Name);
	DDX_Text(pDX, IDC_EDIT20, str_editRoof9Name);
	DDX_Text(pDX, IDC_EDIT21, str_editRoof10Name);
	DDX_Text(pDX, IDC_EDIT34, str_editNumofOpeningsRoof1);
	DDX_Text(pDX, IDC_EDIT43, str_editNumofOpeningsRoof2);
	DDX_Text(pDX, IDC_EDIT44, str_editNumofOpeningsRoof3);
	DDX_Text(pDX, IDC_EDIT45, str_editNumofOpeningsRoof4);
	DDX_Text(pDX, IDC_EDIT46, str_editNumofOpeningsRoof5);
	DDX_Text(pDX, IDC_EDIT47, str_editNumofOpeningsRoof6);
	DDX_Text(pDX, IDC_EDIT48, str_editNumofOpeningsRoof7);
	DDX_Text(pDX, IDC_EDIT51, str_editNumofOpeningsRoof8);
	DDX_Text(pDX, IDC_EDIT49, str_editNumofOpeningsRoof9);
	DDX_Text(pDX, IDC_EDIT50, str_editNumofOpeningsRoof10);
	DDX_Text(pDX, IDC_EDIT25, str_editOpeningName);
	DDX_Control(pDX, IDC_COMBO5, m_comboListOpenings);
	DDX_CBString(pDX, IDC_COMBO5, str_comboListOpenings);
}


BEGIN_MESSAGE_MAP(CDlg_AddOpenings, CDialog)
	ON_EN_CHANGE(IDC_EDIT25, OnEnChangeEdit25)
	ON_BN_CLICKED(IDC_CHECK1, OnBnClickedCheck1)
	ON_BN_CLICKED(IDC_CHECK2, OnBnClickedCheck2)
	ON_BN_CLICKED(IDC_CHECK3, OnBnClickedCheck3)
	ON_BN_CLICKED(IDC_CHECK4, OnBnClickedCheck4)
	ON_BN_CLICKED(IDC_CHECK5, OnBnClickedCheck5)
	ON_BN_CLICKED(IDC_CHECK6, OnBnClickedCheck6)
	ON_BN_CLICKED(IDC_CHECK13, OnBnClickedCheck13)
	ON_BN_CLICKED(IDC_CHECK7, OnBnClickedCheck7)
	ON_BN_CLICKED(IDC_CHECK8, OnBnClickedCheck8)
	ON_BN_CLICKED(IDC_CHECK14, OnBnClickedCheck14)
	ON_EN_CHANGE(IDC_EDIT11, OnEnChangeEdit11)
	ON_EN_CHANGE(IDC_EDIT22, OnEnChangeEdit22)
	ON_EN_CHANGE(IDC_EDIT23, OnEnChangeEdit23)
	ON_EN_CHANGE(IDC_EDIT27, OnEnChangeEdit27)
	ON_EN_CHANGE(IDC_EDIT28, OnEnChangeEdit28)
	ON_EN_CHANGE(IDC_EDIT29, OnEnChangeEdit29)
	ON_EN_CHANGE(IDC_EDIT30, OnEnChangeEdit30)
	ON_EN_CHANGE(IDC_EDIT31, OnEnChangeEdit31)
	ON_EN_CHANGE(IDC_EDIT33, OnEnChangeEdit33)
	ON_EN_CHANGE(IDC_EDIT32, OnEnChangeEdit32)
	ON_BN_CLICKED(IDC_CHECK9, OnBnClickedCheck9)
	ON_BN_CLICKED(IDC_CHECK10, OnBnClickedCheck10)
	ON_BN_CLICKED(IDC_CHECK15, OnBnClickedCheck15)
	ON_BN_CLICKED(IDC_CHECK11, OnBnClickedCheck11)
	ON_BN_CLICKED(IDC_CHECK16, OnBnClickedCheck16)
	ON_BN_CLICKED(IDC_CHECK12, OnBnClickedCheck12)
	ON_BN_CLICKED(IDC_CHECK17, OnBnClickedCheck17)
	ON_BN_CLICKED(IDC_CHECK18, OnBnClickedCheck18)
	ON_BN_CLICKED(IDC_CHECK19, OnBnClickedCheck19)
	ON_BN_CLICKED(IDC_CHECK21, OnBnClickedCheck21)
	ON_EN_CHANGE(IDC_EDIT34, OnEnChangeEdit34)
	ON_EN_CHANGE(IDC_EDIT43, OnEnChangeEdit43)
	ON_EN_CHANGE(IDC_EDIT44, OnEnChangeEdit44)
	ON_EN_CHANGE(IDC_EDIT45, OnEnChangeEdit45)
	ON_EN_CHANGE(IDC_EDIT46, OnEnChangeEdit46)
	ON_EN_CHANGE(IDC_EDIT47, OnEnChangeEdit47)
	ON_EN_CHANGE(IDC_EDIT48, OnEnChangeEdit48)
	ON_EN_CHANGE(IDC_EDIT51, OnEnChangeEdit51)
	ON_EN_CHANGE(IDC_EDIT49, OnEnChangeEdit49)
	ON_EN_CHANGE(IDC_EDIT50, OnEnChangeEdit50)
	ON_BN_CLICKED(IDOK, OnBnClickedOk)
	ON_CBN_SELCHANGE(IDC_COMBO5, OnCbnSelchangeCombo5)
END_MESSAGE_MAP()



//---------------------------------------------
// ADD OPENINGS VARIABLES
//---------------------------------------------
CString isOpeningRoof1Selected;
CString isOpeningRoof2Selected;
CString isOpeningRoof3Selected;
CString isOpeningRoof4Selected;
CString isOpeningRoof5Selected;
CString isOpeningRoof6Selected;
CString isOpeningRoof7Selected;
CString isOpeningRoof8Selected;
CString isOpeningRoof9Selected;
CString isOpeningRoof10Selected;

CString isOpeningWall1Selected;
CString isOpeningWall2Selected;
CString isOpeningWall3Selected;
CString isOpeningWall4Selected;
CString isOpeningWall5Selected;
CString isOpeningWall6Selected;
CString isOpeningWall7Selected;
CString isOpeningWall8Selected;
CString isOpeningWall9Selected;
CString isOpeningWall10Selected;

int multiplierOpeningRoof1 = 0;
int multiplierOpeningRoof2 = 0;
int multiplierOpeningRoof3 = 0;
int multiplierOpeningRoof4 = 0;
int multiplierOpeningRoof5 = 0;
int multiplierOpeningRoof6 = 0;
int multiplierOpeningRoof7 = 0;
int multiplierOpeningRoof8 = 0;
int multiplierOpeningRoof9 = 0;
int multiplierOpeningRoof10 = 0;

int multiplierOpeningWall1 = 0;
int multiplierOpeningWall2 = 0;
int multiplierOpeningWall3 = 0;
int multiplierOpeningWall4 = 0;
int multiplierOpeningWall5 = 0;
int multiplierOpeningWall6 = 0;
int multiplierOpeningWall7 = 0;
int multiplierOpeningWall8 = 0;
int multiplierOpeningWall9 = 0;
int multiplierOpeningWall10 = 0;



// CDlg_AddOpenings message handlers
BOOL CDlg_AddOpenings::OnInitDialog()
{
	CDialog::OnInitDialog();

	CFont *m_Font1 = new CFont;
	m_Font1->CreatePointFont(90, "Arial Bold");	

	AddStringsToAddOpeningsDlg();
	ReadPreviousInputsFromAddOpeningsDlg();
	return TRUE;
}

void CDlg_AddOpenings::AddStringsToAddOpeningsDlg()
{
	// Populate list of openings
	unsigned int i = 0;
	unsigned int j = 0;
	int index = 0;

	if(openingRoofWall == "Wall")
	{
		m_editNumofOpeningsWall1.SetReadOnly(FALSE);
		m_editNumofOpeningsWall2.SetReadOnly(FALSE);
		m_editNumofOpeningsWall3.SetReadOnly(FALSE);
		m_editNumofOpeningsWall4.SetReadOnly(FALSE);
		m_editNumofOpeningsWall5.SetReadOnly(FALSE);
		m_editNumofOpeningsWall6.SetReadOnly(FALSE);
		m_editNumofOpeningsWall7.SetReadOnly(FALSE);
		m_editNumofOpeningsWall8.SetReadOnly(FALSE);
		m_editNumofOpeningsWall9.SetReadOnly(FALSE);
		m_editNumofOpeningsWall10.SetReadOnly(FALSE);
	}
	else
	{
		m_editNumofOpeningsWall1.SetReadOnly(TRUE);
		m_editNumofOpeningsWall2.SetReadOnly(TRUE);
		m_editNumofOpeningsWall3.SetReadOnly(TRUE);
		m_editNumofOpeningsWall4.SetReadOnly(TRUE);
		m_editNumofOpeningsWall5.SetReadOnly(TRUE);
		m_editNumofOpeningsWall6.SetReadOnly(TRUE);
		m_editNumofOpeningsWall7.SetReadOnly(TRUE);
		m_editNumofOpeningsWall8.SetReadOnly(TRUE);
		m_editNumofOpeningsWall9.SetReadOnly(TRUE);
		m_editNumofOpeningsWall10.SetReadOnly(TRUE);
	}

	if(openingRoofWall == "Roof")
	{
		m_editNumofOpeningsRoof1.SetReadOnly(FALSE);
		m_editNumofOpeningsRoof2.SetReadOnly(FALSE);
		m_editNumofOpeningsRoof3.SetReadOnly(FALSE);
		m_editNumofOpeningsRoof4.SetReadOnly(FALSE);
		m_editNumofOpeningsRoof5.SetReadOnly(FALSE);
		m_editNumofOpeningsRoof6.SetReadOnly(FALSE);
		m_editNumofOpeningsRoof7.SetReadOnly(FALSE);
		m_editNumofOpeningsRoof8.SetReadOnly(FALSE);
		m_editNumofOpeningsRoof9.SetReadOnly(FALSE);
		m_editNumofOpeningsRoof10.SetReadOnly(FALSE);
	}
	else
	{
		m_editNumofOpeningsRoof1.SetReadOnly(TRUE);
		m_editNumofOpeningsRoof2.SetReadOnly(TRUE);
		m_editNumofOpeningsRoof3.SetReadOnly(TRUE);
		m_editNumofOpeningsRoof4.SetReadOnly(TRUE);
		m_editNumofOpeningsRoof5.SetReadOnly(TRUE);
		m_editNumofOpeningsRoof6.SetReadOnly(TRUE);
		m_editNumofOpeningsRoof7.SetReadOnly(TRUE);
		m_editNumofOpeningsRoof8.SetReadOnly(TRUE);
		m_editNumofOpeningsRoof9.SetReadOnly(TRUE);
		m_editNumofOpeningsRoof10.SetReadOnly(TRUE);
	}


	// Write Names for walls and roon
	str_editWall1Name.Format("%s", wall1Name);
	str_editWall2Name.Format("%s", wall2Name);
	str_editWall3Name.Format("%s", wall3Name);
	str_editWall4Name.Format("%s", wall4Name);
	str_editWall5Name.Format("%s", wall5Name);
	str_editWall6Name.Format("%s", wall6Name);
	str_editWall7Name.Format("%s", wall7Name);
	str_editWall8Name.Format("%s", wall8Name);
	str_editWall9Name.Format("%s", wall9Name);
	str_editWall10Name.Format("%s", wall10Name);

	str_editRoof1Name.Format("%s", roof1Name);
	str_editRoof2Name.Format("%s", roof2Name);
	str_editRoof3Name.Format("%s", roof3Name);
	str_editRoof4Name.Format("%s", roof4Name);
	str_editRoof5Name.Format("%s", roof5Name);
	str_editRoof6Name.Format("%s", roof6Name);
	str_editRoof7Name.Format("%s", roof7Name);
	str_editRoof8Name.Format("%s", roof8Name);
	str_editRoof9Name.Format("%s", roof9Name);
	str_editRoof10Name.Format("%s", roof10Name);

	str_editNumofOpeningsWall1.Format("%d", 0);
	str_editNumofOpeningsWall2.Format("%d", 0);
	str_editNumofOpeningsWall3.Format("%d", 0);
	str_editNumofOpeningsWall4.Format("%d", 0);
	str_editNumofOpeningsWall5.Format("%d", 0);
	str_editNumofOpeningsWall6.Format("%d", 0);
	str_editNumofOpeningsWall7.Format("%d", 0);
	str_editNumofOpeningsWall8.Format("%d", 0);
	str_editNumofOpeningsWall9.Format("%d", 0);
	str_editNumofOpeningsWall10.Format("%d", 0);

	str_editNumofOpeningsRoof1.Format("%d", 0);
	str_editNumofOpeningsRoof2.Format("%d", 0);
	str_editNumofOpeningsRoof3.Format("%d", 0);
	str_editNumofOpeningsRoof4.Format("%d", 0);
	str_editNumofOpeningsRoof5.Format("%d", 0);
	str_editNumofOpeningsRoof6.Format("%d", 0);
	str_editNumofOpeningsRoof7.Format("%d", 0);
	str_editNumofOpeningsRoof8.Format("%d", 0);
	str_editNumofOpeningsRoof9.Format("%d", 0);
	str_editNumofOpeningsRoof10.Format("%d", 0);

	 UpdateData(FALSE);
}

void CDlg_AddOpenings::ReadPreviousInputsFromAddOpeningsDlg()
{
}
void CDlg_AddOpenings::ReadInputsFromAddOpeningsDlg()
{
	UpdateData(TRUE);

	//------------------------------------------------------
	// NUMBER OF OPENINGS WALL
	//------------------------------------------------------
	multiplierOpeningWall1 = atoi(str_editNumofOpeningsWall1);
	multiplierOpeningWall2 = atoi(str_editNumofOpeningsWall2);
	multiplierOpeningWall3 = atoi(str_editNumofOpeningsWall3);
	multiplierOpeningWall4 = atoi(str_editNumofOpeningsWall4);
	multiplierOpeningWall5 = atoi(str_editNumofOpeningsWall5);
	multiplierOpeningWall6 = atoi(str_editNumofOpeningsWall6);
	multiplierOpeningWall7 = atoi(str_editNumofOpeningsWall7);
	multiplierOpeningWall8 = atoi(str_editNumofOpeningsWall8);
	multiplierOpeningWall9 = atoi(str_editNumofOpeningsWall9);
	multiplierOpeningWall10 = atoi(str_editNumofOpeningsWall10);

	//------------------------------------------------------
	// NUMBER OF OPENINGS ROOF
	//------------------------------------------------------
	multiplierOpeningRoof1 = atoi(str_editNumofOpeningsRoof1);
	multiplierOpeningRoof2 = atoi(str_editNumofOpeningsRoof2);
	multiplierOpeningRoof3 = atoi(str_editNumofOpeningsRoof3);
	multiplierOpeningRoof4 = atoi(str_editNumofOpeningsRoof4);
	multiplierOpeningRoof5 = atoi(str_editNumofOpeningsRoof5);
	multiplierOpeningRoof6 = atoi(str_editNumofOpeningsRoof6);
	multiplierOpeningRoof7 = atoi(str_editNumofOpeningsRoof7);
	multiplierOpeningRoof8 = atoi(str_editNumofOpeningsRoof8);
	multiplierOpeningRoof9 = atoi(str_editNumofOpeningsRoof9);
	multiplierOpeningRoof10 = atoi(str_editNumofOpeningsRoof10);

	
}
void CDlg_AddOpenings::OnEnChangeEdit25()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnBnClickedCheck1()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnBnClickedCheck2()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnBnClickedCheck3()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnBnClickedCheck4()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnBnClickedCheck5()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnBnClickedCheck6()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnBnClickedCheck13()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnBnClickedCheck7()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnBnClickedCheck8()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnBnClickedCheck14()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnEnChangeEdit11()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnEnChangeEdit22()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnEnChangeEdit23()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnEnChangeEdit27()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnEnChangeEdit28()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnEnChangeEdit29()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnEnChangeEdit30()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnEnChangeEdit31()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnEnChangeEdit33()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnEnChangeEdit32()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnBnClickedCheck9()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnBnClickedCheck10()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnBnClickedCheck15()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnBnClickedCheck11()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnBnClickedCheck16()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnBnClickedCheck12()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnBnClickedCheck17()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnBnClickedCheck18()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnBnClickedCheck19()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnBnClickedCheck21()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnEnChangeEdit34()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnEnChangeEdit43()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnEnChangeEdit44()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnEnChangeEdit45()
{
	ReadInputsFromAddOpeningsDlg();	
}

void CDlg_AddOpenings::OnEnChangeEdit46()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnEnChangeEdit47()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnEnChangeEdit48()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnEnChangeEdit51()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnEnChangeEdit49()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnEnChangeEdit50()
{
	ReadInputsFromAddOpeningsDlg();
}

void CDlg_AddOpenings::OnBnClickedOk()
{
	openingsData tempEntry;
	unsigned int sizeOfVector;
	unsigned int i = 0;

	// Add opening to the list
	addOpening++;

	// WALL
	if (multiplierOpeningWall1 >0)
	{
		strcpy(tempEntry.openingName,newOpeningName);
		strcpy(tempEntry.parentSurface,wall1Name);
		tempEntry.multipier = multiplierOpeningWall1;
		//-------------------------------------------------	
		// Enter this information in the appropriate vector
		openingsData_New.push_back(tempEntry);
	}
	if (multiplierOpeningWall2 >0)
	{
		strcpy(tempEntry.openingName,newOpeningName);
		strcpy(tempEntry.parentSurface,wall2Name);
		tempEntry.multipier = multiplierOpeningWall2;
		//-------------------------------------------------	
		// Enter this information in the appropriate vector
		openingsData_New.push_back(tempEntry);
	}
	if (multiplierOpeningWall3 >0)
	{
		strcpy(tempEntry.openingName,newOpeningName);
		strcpy(tempEntry.parentSurface,wall3Name);
		tempEntry.multipier = multiplierOpeningWall3;
		//-------------------------------------------------	
		// Enter this information in the appropriate vector
		openingsData_New.push_back(tempEntry);
	}
	if (multiplierOpeningWall4 >0)
	{
		strcpy(tempEntry.openingName,newOpeningName);
		strcpy(tempEntry.parentSurface,wall4Name);
		tempEntry.multipier = multiplierOpeningWall4;
		//-------------------------------------------------	
		// Enter this information in the appropriate vector
		openingsData_New.push_back(tempEntry);
	}
	if (multiplierOpeningWall5 >0)
	{
		strcpy(tempEntry.openingName,newOpeningName);
		strcpy(tempEntry.parentSurface,wall5Name);
		tempEntry.multipier = multiplierOpeningWall5;
		//-------------------------------------------------	
		// Enter this information in the appropriate vector
		openingsData_New.push_back(tempEntry);
	}
	if (multiplierOpeningWall6 >0)
	{
		strcpy(tempEntry.openingName,newOpeningName);
		strcpy(tempEntry.parentSurface,wall6Name);
		tempEntry.multipier = multiplierOpeningWall6;
		//-------------------------------------------------	
		// Enter this information in the appropriate vector
		openingsData_New.push_back(tempEntry);
	}
	if (multiplierOpeningWall7 >0)
	{
		strcpy(tempEntry.openingName,newOpeningName);
		strcpy(tempEntry.parentSurface,wall7Name);
		tempEntry.multipier = multiplierOpeningWall7;
		//-------------------------------------------------	
		// Enter this information in the appropriate vector
		openingsData_New.push_back(tempEntry);
	}
	if (multiplierOpeningWall8 >0)
	{
		strcpy(tempEntry.openingName,newOpeningName);
		strcpy(tempEntry.parentSurface,wall8Name);
		tempEntry.multipier = multiplierOpeningWall8;
		//-------------------------------------------------	
		// Enter this information in the appropriate vector
		openingsData_New.push_back(tempEntry);
	}
	if (multiplierOpeningWall9 >0)
	{
		strcpy(tempEntry.openingName,newOpeningName);
		strcpy(tempEntry.parentSurface,wall9Name);
		tempEntry.multipier = multiplierOpeningWall9;
		//-------------------------------------------------	
		// Enter this information in the appropriate vector
		openingsData_New.push_back(tempEntry);
	}
	if (multiplierOpeningWall10 >0)
	{
		strcpy(tempEntry.openingName,newOpeningName);
		strcpy(tempEntry.parentSurface,wall10Name);
		tempEntry.multipier = multiplierOpeningWall10;
		//-------------------------------------------------	
		// Enter this information in the appropriate vector
		openingsData_New.push_back(tempEntry);
	}

	// ROOF
	if (multiplierOpeningRoof1>0)
	{
		strcpy(tempEntry.openingName,newOpeningName);
		strcpy(tempEntry.parentSurface,roof1Name);
		tempEntry.multipier = multiplierOpeningRoof1;
		//-------------------------------------------------	
		// Enter this information in the appropriate vector
		openingsData_New.push_back(tempEntry);
	}

	if (multiplierOpeningRoof2>0)
	{
		strcpy(tempEntry.openingName,newOpeningName);
		strcpy(tempEntry.parentSurface,roof2Name);
		tempEntry.multipier = multiplierOpeningRoof2;
		//-------------------------------------------------	
		// Enter this information in the appropriate vector
		openingsData_New.push_back(tempEntry);
	}

	if (multiplierOpeningRoof3>0)
	{
		strcpy(tempEntry.openingName,newOpeningName);
		strcpy(tempEntry.parentSurface,roof3Name);
		tempEntry.multipier = multiplierOpeningRoof3;
		//-------------------------------------------------	
		// Enter this information in the appropriate vector
		openingsData_New.push_back(tempEntry);
	}
	if (multiplierOpeningRoof4>0)
	{
		strcpy(tempEntry.openingName,newOpeningName);
		strcpy(tempEntry.parentSurface,roof4Name);
		tempEntry.multipier = multiplierOpeningRoof4;
		//-------------------------------------------------	
		// Enter this information in the appropriate vector
		openingsData_New.push_back(tempEntry);
	}
	if (multiplierOpeningRoof5>0)
	{
		strcpy(tempEntry.openingName,newOpeningName);
		strcpy(tempEntry.parentSurface,roof5Name);
		tempEntry.multipier = multiplierOpeningRoof5;
		//-------------------------------------------------	
		// Enter this information in the appropriate vector
		openingsData_New.push_back(tempEntry);
	}
	if (multiplierOpeningRoof6>0)
	{
		strcpy(tempEntry.openingName,newOpeningName);
		strcpy(tempEntry.parentSurface,roof6Name);
		tempEntry.multipier = multiplierOpeningRoof6;
		//-------------------------------------------------	
		// Enter this information in the appropriate vector
		openingsData_New.push_back(tempEntry);
	}
	if (multiplierOpeningRoof7>0)
	{
		strcpy(tempEntry.openingName,newOpeningName);
		strcpy(tempEntry.parentSurface,roof7Name);
		tempEntry.multipier = multiplierOpeningRoof7;
		//-------------------------------------------------	
		// Enter this information in the appropriate vector
		openingsData_New.push_back(tempEntry);
	}
	if (multiplierOpeningRoof8>0)
	{
		strcpy(tempEntry.openingName,newOpeningName);
		strcpy(tempEntry.parentSurface,roof8Name);
		tempEntry.multipier = multiplierOpeningRoof8;
		//-------------------------------------------------	
		// Enter this information in the appropriate vector
		openingsData_New.push_back(tempEntry);
	}
	if (multiplierOpeningRoof9>0)
	{
		strcpy(tempEntry.openingName,newOpeningName);
		strcpy(tempEntry.parentSurface,roof9Name);
		tempEntry.multipier = multiplierOpeningRoof9;
		//-------------------------------------------------	
		// Enter this information in the appropriate vector
		openingsData_New.push_back(tempEntry);
	}
	if (multiplierOpeningRoof10>0)
	{
		strcpy(tempEntry.openingName,newOpeningName);
		strcpy(tempEntry.parentSurface,roof10Name);
		tempEntry.multipier = multiplierOpeningRoof10;
		//-------------------------------------------------	
		// Enter this information in the appropriate vector
		openingsData_New.push_back(tempEntry);
	}	

	sizeOfVector= openingsData_New.size();
	
	is_new_opeing_added = true;

	OnOK();
}

void CDlg_AddOpenings::OnCbnSelchangeCombo5()
{
	UpdateData(TRUE);
}
