// StatisticsDlg.cpp : implementation file // #include "stdafx.h" #include "MSVC5conview.h" #include "StatisticsDlg.h" #include "leadrastercontainercell.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CStatisticsDlg dialog CStatisticsDlg::CStatisticsDlg(CWnd* pParent /*=NULL*/) : CDialog(CStatisticsDlg::IDD, pParent) { //{{AFX_DATA_INIT(CStatisticsDlg) m_uActionCounts = 0; m_SFreeze = _T(""); m_SCellSelect = _T(""); m_uCellCount = 0; m_ConBBounds = 0; m_ConLBounds = 0; m_ConRBounds = 0; m_ConTBounds = 0; m_uColPosition = 0; m_uRowPosition = 0; m_uCellBBounds = 0.0f; m_uCellLBounds = 0.0f; m_uCellRBounds = 0.0f; m_uCellTBounds = 0.0f; //}}AFX_DATA_INIT } void CStatisticsDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CStatisticsDlg) DDX_Control(pDX, IDC_STATS_INDEX_COM, m_cmbComIndex); DDX_Text(pDX, IDC_STATS_ACTIONCOUNT_TXT, m_uActionCounts); DDX_Text(pDX, IDC_STATS_CELL_FRZ_TXT, m_SFreeze); DDX_Text(pDX, IDC_STATS_CELL_SEL_TXT, m_SCellSelect); DDX_Text(pDX, IDC_STATS_CELLCOUNT_TXT, m_uCellCount); DDX_Text(pDX, IDC_STATS_CNTR_BNDB_TXT, m_ConBBounds); DDX_Text(pDX, IDC_STATS_CNTR_BNDL_TXT, m_ConLBounds); DDX_Text(pDX, IDC_STATS_CNTR_BNDR_TXT, m_ConRBounds); DDX_Text(pDX, IDC_STATS_CNTR_BNDT_TXT, m_ConTBounds); DDX_Text(pDX, IDC_STATS_COLPOS_TXT, m_uColPosition); DDX_Text(pDX, IDC_STATS_ROWPOS_TXT, m_uRowPosition); DDX_Text(pDX, IDC_STATS_CELL_BNDB_TXT, m_uCellBBounds); DDX_Text(pDX, IDC_STATS_CELL_BNDL_TXT, m_uCellLBounds); DDX_Text(pDX, IDC_STATS_CELL_BNDR_TXT, m_uCellRBounds); DDX_Text(pDX, IDC_STATS_CELL_BNDT_TXT, m_uCellTBounds); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CStatisticsDlg, CDialog) //{{AFX_MSG_MAP(CStatisticsDlg) ON_CBN_SELCHANGE(IDC_STATS_INDEX_COM, OnSelchangeStatsIndexCom) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CStatisticsDlg message handlers VOID CStatisticsDlg::SetCellProperites(INT nIndex) { m_uCellBBounds = m_pView->m_ConView.Cell(nIndex).GetTop() + m_pView->m_ConView.Cell(nIndex).GetHeight(); m_uCellRBounds = m_pView->m_ConView.Cell(nIndex).GetLeft() + m_pView->m_ConView.Cell(nIndex).GetWidth();; m_uCellLBounds = m_pView->m_ConView.Cell(nIndex).GetLeft(); m_uCellTBounds = m_pView->m_ConView.Cell(nIndex).GetTop(); m_SFreeze = m_pView->m_ConView.Cell(nIndex).GetFreeze() ? _T("Yes") : _T("No"); m_SCellSelect = m_pView->m_ConView.Cell(nIndex).GetSelect() ? _T("Yes") : _T("No"); m_uColPosition = m_pView->m_ConView.Cell(nIndex).GetColumnPosition(); m_uRowPosition = m_pView->m_ConView.Cell(nIndex).GetRowPosition(); } BOOL CStatisticsDlg::OnInitDialog() { CDialog::OnInitDialog(); CConViewApp * pTheApp = (CConViewApp *)AfxGetApp(); INT nIndex = pTheApp->SearchForFirstSelectedCell(); nIndex = max(0, nIndex); RECT ClientRect; m_pView->m_ConView.GetClientRect(&ClientRect); m_uActionCounts = m_pView->m_ConView.GetActiveActionCount(); m_uCellCount = m_pView->m_ConView.GetCellCount(); m_ConBBounds = ClientRect.bottom; m_ConLBounds = ClientRect.left; m_ConRBounds = ClientRect.right; m_ConTBounds = ClientRect.top; if (m_uCellCount == 0) (this->GetDlgItem(IDC_STATS_INDEX_COM))->EnableWindow(FALSE); else { SetCellProperites(nIndex); UCHAR szText[20] = "\0"; for (INT nI = 0; nI < m_uCellCount; nI++) { itoa(nI, (CHAR *)szText, 10); m_cmbComIndex.AddString((TCHAR *)szText); } m_cmbComIndex.SetCurSel(nIndex); } UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CStatisticsDlg::OnSelchangeStatsIndexCom() { SetCellProperites(m_cmbComIndex.GetCurSel()); UpdateData(FALSE); }