// Record.cpp : implementation file
//

#include "stdafx.h"
#include "app-2255-demo.h"
#include "Record.h"
#include <assert.h>

#define FROM_CONTROLS TRUE
#define TO_CONTROLS FALSE

// CRecord dialog

IMPLEMENT_DYNAMIC(CRecord, CPropertyPage)

CRecord::CRecord()
	: CPropertyPage(CRecord::IDD)
    , m_bRecord(FALSE)
    , m_sRecordFilename(_T(""))
{

}

CRecord::~CRecord()
{
}

void CRecord::DoDataExchange(CDataExchange* pDX)
{
    CPropertyPage::DoDataExchange(pDX);
    DDX_Control(pDX, IDC_BUTTON_HELPTEXT, m_btnHelp);
    DDX_Check(pDX, IDC_CHECK_RECORD, m_bRecord);
    DDX_Control(pDX, IDC_CHECK_RECORD, m_btnRecord);
    DDX_Text(pDX, IDC_EDIT_RECORD, m_sRecordFilename);
}

	
    

BEGIN_MESSAGE_MAP(CRecord, CPropertyPage)
    ON_BN_CLICKED(IDC_BUTTON_HELPRECORD, &CRecord::OnBnClickedButtonHelprecord)
    ON_BN_CLICKED(IDC_BUTTON_BROWSE, &CRecord::OnBnClickedButtonBrowse)
    ON_BN_CLICKED(IDC_CHECK_RECORD, &CRecord::OnBnClickedCheckRecord)
END_MESSAGE_MAP()


// CRecord message handlers

void CRecord::OnBnClickedButtonHelprecord()
{
    AfxMessageBox(TEXT("This demo limits recording to one channel at a time."));
}

BOOL CRecord::OnInitDialog()
{
    BOOL bres = CPropertyPage::OnInitDialog();
    m_btnHelp.SetIcon(::LoadIcon(NULL, IDI_QUESTION));
    if (pDoc->m_bRecording && (m_channel != pDoc->m_record_channel)) {
        m_btnRecord.EnableWindow(0);
    } else {
        m_btnRecord.EnableWindow(1);
    }
    if (m_channel < 0)
        m_btnRecord.EnableWindow(0);
    UpdateData(TO_CONTROLS);
    return bres;
}
void CRecord::OnBnClickedButtonBrowse()
{
}

void CRecord::OnBnClickedCheckRecord()
{
    UpdateData(FROM_CONTROLS);
    /*
    if (m_bRecord) {
        pDoc->StopRecord(m_channel);
    } else {
        pDoc->StartRecord(m_channel);
    }
    */
    UpdateData(TO_CONTROLS);
    
}
