// AlignPage.cpp : implementation file
//

#include "stdafx.h"
#include "..\at3ddll.h"
#include "MSVC_Test_At3dx_Dll.h"
#include "AlignPage.h"
#include "At3dData.h"

extern CAt3dData* at3dData;

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

/////////////////////////////////////////////////////////////////////////////
// CAlignPage property page

IMPLEMENT_DYNCREATE(CAlignPage, CPropertyPage)

CAlignPage::CAlignPage() : CPropertyPage(CAlignPage::IDD)
{
	//{{AFX_DATA_INIT(CAlignPage)
	m_AlignName = _T("");
	//}}AFX_DATA_INIT
}

CAlignPage::~CAlignPage()
{
}

void CAlignPage::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAlignPage)
	DDX_Text(pDX, IDC_ALIGNNAME, m_AlignName);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CAlignPage, CPropertyPage)
	//{{AFX_MSG_MAP(CAlignPage)
	ON_BN_CLICKED(IDC_ALIGNACTIVATE, OnAlignactivate)
	ON_BN_CLICKED(IDC_PRESETNORMALS, OnPresetnormals)
	ON_BN_CLICKED(IDC_ALIGNSHOWALL, OnAlignshowall)
	ON_BN_CLICKED(IDC_ALIGNFLIPONE, OnAlignflipone)
	ON_BN_CLICKED(IDC_SETALIGNLAYER, OnSetalignlayer)	
	ON_BN_CLICKED(IDC_DOLAYERFLIP, OnDolayerflip)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAlignPage message handlers

void CAlignPage::OnAlignactivate() 
{
	at3dData->StartStopAlign();

  // display layer name in edit box
  //
  m_AlignName = at3dData->alignName;
	UpdateData(FALSE);
}

void CAlignPage::OnPresetnormals() 
{
	At3d_AlignPresetNormals();
}

void CAlignPage::OnAlignshowall() 
{
	At3d_AlignShowAll();
}

void CAlignPage::OnAlignflipone() 
{
	At3d_AlignFlipOne();
}

void CAlignPage::OnSetalignlayer() 
{
	at3dData->SelectAlignLayer();
	m_AlignName = at3dData->alignName;
	UpdateData(FALSE);
}

void CAlignPage::OnDolayerflip() 
{
	at3dData->FlipAlignLayer();
}
