// RepositionCellDlg.cpp : implementation file // #include "stdafx.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CRepositionCellDlg dialog CRepositionCellDlg::CRepositionCellDlg(LImageViewer *pImageViewer, CWnd* pParent /*=NULL*/) : CDialog(CRepositionCellDlg::IDD, pParent) { //{{AFX_DATA_INIT(CRepositionCellDlg) m_pImageViewer = pImageViewer; //}}AFX_DATA_INIT } void CRepositionCellDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CRepositionCellDlg) DDX_Control(pDX, IDEDT_ACTION_TARGETINDEX, m_edtTargetIndex); DDX_Control(pDX, IDEDT_ACTION_CELLINDEX, m_edtCellIndex); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CRepositionCellDlg, CDialog) //{{AFX_MSG_MAP(CRepositionCellDlg) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CRepositionCellDlg message handlers void CRepositionCellDlg::OnOK() { CString strVal; m_edtCellIndex.GetWindowText(strVal); m_uCellIndex = _ttoi(strVal); m_edtTargetIndex.GetWindowText(strVal); m_uTargetIndex = _ttoi(strVal); CDialog::OnOK(); } BOOL CRepositionCellDlg::OnInitDialog() { CDialog::OnInitDialog(); L_INT nCount = (m_pImageViewer ? m_pImageViewer->GetCellCount(0) : 0); L_INT nIndex; CString strVal; for (nIndex = 0; nIndex < nCount; nIndex++) { if(m_pImageViewer) { if (m_pImageViewer->IsCellSelected(nIndex,0)) break; } } if (nIndex == nCount) nIndex = -1; strVal.Format(TEXT("%d"), max(0,nIndex)); m_edtCellIndex.SetNumericEditBox(0, nCount - 1, 1, 0, 0); m_edtTargetIndex.SetNumericEditBox(0, nCount - 1, 1, 0, 0); m_edtCellIndex.SetWindowText(strVal); m_edtTargetIndex.SetWindowText(strVal); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }