// InsertPage.cpp : implementation file // #include "stdafx.h" #include "msvc5ocr.h" #include "InsertPage.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CInsertPage dialog CInsertPage::CInsertPage(CWnd* pParent /*=NULL*/) : CDialog(CInsertPage::IDD, pParent) { //{{AFX_DATA_INIT(CInsertPage) m_bInsertAll = FALSE; m_csFileName = _T(""); m_nIndex = 1; //}}AFX_DATA_INIT } void CInsertPage::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CInsertPage) DDX_Control(pDX, IDOK, m_btnOK); DDX_Control(pDX, IDC_EDIT_INDEX, m_edtIndex); DDX_Control(pDX, IDC_EDIT_FILE_NAME, m_edtFileName); DDX_Check(pDX, IDC_CHECK_INSERT_ALL, m_bInsertAll); DDX_Text(pDX, IDC_EDIT_FILE_NAME, m_csFileName); DDX_Text(pDX, IDC_EDIT_INDEX, m_nIndex); // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CInsertPage, CDialog) //{{AFX_MSG_MAP(CInsertPage) ON_EN_CHANGE(IDC_EDIT_FILE_NAME, OnChangeEditFileName) ON_EN_CHANGE(IDC_EDIT_INDEX, OnChangeEditIndex) ON_BN_CLICKED(IDC_BUTTON_BROWSE, OnBrowse) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CInsertPage message handlers BOOL CInsertPage::OnInitDialog() { CDialog::OnInitDialog(); m_edtIndex.SetWindowText(_TEXT("1")); m_edtFileName.SetWindowText(_TEXT("")); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CInsertPage::OnChangeEditFileName() { CheckOkButton(); } void CInsertPage::CheckOkButton() { CString csIndex, csFileName; m_edtIndex.GetWindowText(csIndex); m_edtFileName.GetWindowText(csFileName); m_btnOK.EnableWindow(!csIndex.IsEmpty() && !csFileName.IsEmpty()); } void CInsertPage::OnChangeEditIndex() { CheckOkButton(); } void CInsertPage::OnBrowse() { CMSVC5OCRApp * pTheApp = (CMSVC5OCRApp *)AfxGetApp(); pTheApp->m_pRasterDlgFile->PutUIFlags( OPEN_SHOW_PROGRESSIVE | OPEN_SHOW_MULTIPAGE | OPEN_SHOW_LOADROTATED | OPEN_SHOW_LOADCOMPRESSED | OPEN_SHOW_FILEINFO | OPEN_SHOW_PREVIEW | OPEN_SHOW_DELPAGE | OPEN_SHOW_LOADOPTIONS | OPEN_SHOW_RASTEROPTIONS | OPEN_SHOW_PDFOPTIONS | OPEN_SHOW_VECTOROPTIONS | OPEN_VIEWTOTALPAGES | OPEN_ENABLESIZING | OPEN_NOFILEMUSTEXIST | OPEN_NOPATHMUSTEXIST | OPEN_USEFILESTAMP); int nRet = pTheApp->m_pRasterDlgFile->ShowOpenDlg((long)GetSafeHwnd()); if (pTheApp->m_pRasterDlgFile->GetDialogStatus() == DLG_OK) { m_nPageNumber = pTheApp->m_pRasterDlgFile->PageNumber; m_edtFileName.SetWindowText(pTheApp->m_pRasterDlgFile->FileName); } }