// CurvePage.cpp : implementation file
//

#include "stdafx.h"
#include "IDE.h"
#include "CurveDlg.h"


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


extern void DrawColorButton(LPDRAWITEMSTRUCT lpDIS,COLORREF clrButton);

/////////////////////////////////////////////////////////////////////////////
// CCurveDlg dialog
IMPLEMENT_DYNCREATE(CurvePage, CPropertyPage)

CurvePage::CurvePage(): CPropertyPage(CurvePage::IDD)
{
	//{{AFX_DATA_INIT(CurvePage)
	m_strVar1 = _T("");
	m_strVar2 = _T("");
	m_strVar3 = _T("");
	m_nLowwer = 0;
	m_nUpper = 0;
	//}}AFX_DATA_INIT
}


CurvePage::~CurvePage()
{
}


void CurvePage::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CurvePage)
	DDX_Text(pDX, IDC_VAR1, m_strVar1);
	DDX_Text(pDX, IDC_VAR2, m_strVar2);
	DDX_Text(pDX, IDC_VAR3, m_strVar3);
	DDX_Text(pDX, IDC_LOWWER, m_nLowwer);
	DDX_Text(pDX, IDC_UPPER, m_nUpper);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CurvePage, CPropertyPage)
	//{{AFX_MSG_MAP(CurvePage)
	ON_WM_DRAWITEM()
	ON_BN_CLICKED(IDC_CURVE1COLOR, OnCurve1color)
	ON_BN_CLICKED(IDC_CURVE2COLOR, OnCurve2color)
	ON_BN_CLICKED(IDC_CURVE3COLOR, OnCurve3color)
	ON_BN_CLICKED(IDC_SELVAR1, OnSelvar1)
	ON_BN_CLICKED(IDC_SELVAR2, OnSelvar2)
	ON_BN_CLICKED(IDC_SELVAR3, OnSelvar3)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CurvePage message handlers

void CurvePage::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) 
{
	switch(nIDCtl)
	{
	case IDC_CURVE1COLOR: 
		DrawColorButton(lpDrawItemStruct,m_clrCurve1);
		break;
	case IDC_CURVE2COLOR:
		DrawColorButton(lpDrawItemStruct,m_clrCurve2);
		break;
	case IDC_CURVE3COLOR:
		DrawColorButton(lpDrawItemStruct,m_clrCurve3);
		break;
	}
	CPropertyPage::OnDrawItem(nIDCtl, lpDrawItemStruct);
}


void CurvePage::OnCurve1color() 
{
	CColorDialog dlg(m_clrCurve1);
	if(dlg.DoModal()==IDOK)
	{
		m_clrCurve1 = dlg.GetColor();
		CButton* pButton = (CButton *)GetDlgItem(IDC_CURVE1COLOR);
		pButton->ShowWindow(SW_HIDE);
		pButton->ShowWindow(SW_SHOW);
	}
}

void CurvePage::OnCurve2color() 
{
	CColorDialog dlg(m_clrCurve2);
	if(dlg.DoModal()==IDOK)
	{
		m_clrCurve2 = dlg.GetColor();
		CButton* pButton = (CButton *)GetDlgItem(IDC_CURVE2COLOR);
		pButton->ShowWindow(SW_HIDE);
		pButton->ShowWindow(SW_SHOW);
	}
}

void CurvePage::OnCurve3color() 
{
	CColorDialog dlg(m_clrCurve3);
	if(dlg.DoModal()==IDOK)
	{
		m_clrCurve3 = dlg.GetColor();
		CButton* pButton = (CButton *)GetDlgItem(IDC_CURVE3COLOR);
		pButton->ShowWindow(SW_HIDE);
		pButton->ShowWindow(SW_SHOW);
	}
}

void CurvePage::OnSelvar1() 
{
}

void CurvePage::OnSelvar2() 
{
	
}

void CurvePage::OnSelvar3() 
{
	
}