// ChooseLayer.cpp : implementation file
//

#include "stdafx.h"
#include "UnsDis.h"
#include "UnsDisDoc.h"
#include "ChooseLayer.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CChooseLayer dialog


CChooseLayer::CChooseLayer(CWnd* pParent /*=NULL*/)
	: CDialog(CChooseLayer::IDD, pParent)
{
	//{{AFX_DATA_INIT(CChooseLayer)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	pDoc=NULL;nchos=-1;
}


void CChooseLayer::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CChooseLayer)
	DDX_Control(pDX, IDC_LIST1, m_list);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CChooseLayer, CDialog)
	//{{AFX_MSG_MAP(CChooseLayer)
	ON_LBN_DBLCLK(IDC_LIST1, OnDblclkList1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CChooseLayer message handlers

BOOL CChooseLayer::OnInitDialog() 
{
	CDialog::OnInitDialog();
	if (pDoc!=NULL)
	{
		int i;
		CString msg;
		m_list.ResetContent();
		for (i=0;i<pDoc->Layers.GetSize();i++)
		{
			CLayer* lr=pDoc->GetLayer(i);
			msg.Format("From %8.2f to %8.2f",lr->zbeg,lr->zend);
			m_list.AddString(msg);
		}
	}
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CChooseLayer::OnOK() 
{
	nchos=m_list.GetCurSel();
	CDialog::OnOK();
}

void CChooseLayer::OnDblclkList1() 
{
	OnOK();	
}
