// RecognizePage.cpp : implementation file // #include "stdafx.h" #include "msvc5ocr.h" #include "RecognizePage.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CRecognizePage dialog CRecognizePage::CRecognizePage(CString csRDFFileName, int nPageCount, int nZoneCount, CWnd* pParent /*=NULL*/) : CDialog(CRecognizePage::IDD, pParent) { //{{AFX_DATA_INIT(CRecognizePage) m_nStartPage = 1; m_nPageCount = 0; m_bShowVerificationDlg = FALSE; m_csRDFileName = csRDFFileName; //}}AFX_DATA_INIT m_nTotPageCount = nPageCount; m_nZoneCount = nZoneCount; } void CRecognizePage::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CRecognizePage) DDX_Control(pDX, IDC_CHK_SHOW_VERIFICATION_DLG, m_chkShowVr); DDX_Control(pDX, IDC_EDIT_RD_FILE_NAME, m_edtRDFileName); DDX_Control(pDX, IDOK, m_btnOK); DDX_Control(pDX, IDC_EDIT_PAGE_COUNT, m_edtPageCount); DDX_Control(pDX, IDC_EDIT_START_PAGE, m_edtStartPage); DDX_Text(pDX, IDC_EDIT_START_PAGE, m_nStartPage); DDX_Text(pDX, IDC_EDIT_PAGE_COUNT, m_nPageCount); DDX_Check(pDX, IDC_CHK_SHOW_VERIFICATION_DLG, m_bShowVerificationDlg); DDX_Text(pDX, IDC_EDIT_RD_FILE_NAME, m_csRDFileName); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CRecognizePage, CDialog) //{{AFX_MSG_MAP(CRecognizePage) ON_EN_CHANGE(IDC_EDIT_START_PAGE, OnChangeEditStartPage) ON_EN_CHANGE(IDC_EDIT_PAGE_COUNT, OnChangeEditPageCount) ON_BN_CLICKED(IDC_BUTTON_BROWSE_RDFILE, OnButtonBrowseRDFile) ON_EN_CHANGE(IDC_EDIT_RD_FILE_NAME, OnChangeEditRdFileName) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CRecognizePage message handlers BOOL CRecognizePage::OnInitDialog() { CDialog::OnInitDialog(); CString csText; csText.Format(_TEXT("%d"), m_nTotPageCount); m_edtStartPage.SetWindowText(_TEXT("1")); m_edtPageCount.SetWindowText(csText); m_chkShowVr.EnableWindow(m_nZoneCount); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CRecognizePage::OnChangeEditStartPage() { CheckOKButton(); } void CRecognizePage::OnChangeEditPageCount() { CheckOKButton(); } void CRecognizePage::CheckOKButton() { CString csStart, csCount, csFile; m_edtStartPage.GetWindowText(csStart); m_edtPageCount.GetWindowText(csCount); m_edtRDFileName.GetWindowText(csFile); m_btnOK.EnableWindow(!csStart.IsEmpty() && !csCount.IsEmpty() && !csFile.IsEmpty()); } void CRecognizePage::OnButtonBrowseRDFile() { CFileDialog FileDlg(FALSE, _TEXT("RDF"), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, _TEXT("Recognition Data Files (*.RDF)|*.RDF|")); if (FileDlg.DoModal() == IDOK) m_edtRDFileName.SetWindowText(FileDlg.GetPathName()); } void CRecognizePage::OnChangeEditRdFileName() { CheckOKButton(); }