// CellPropeDlg.cpp : implementation file // #include "stdafx.h" #include "MSVC5conview.h" #include "CellPropeDlg.h" #include "leadrastercontainercell.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CCellPropeDlg dialog CCellPropeDlg::CCellPropeDlg(CWnd* pParent /*=NULL*/) : CDialog(CCellPropeDlg::IDD, pParent) { //{{AFX_DATA_INIT(CCellPropeDlg) m_ApplyCellType = -1; m_bShowTag = FALSE; m_bFitImage = TRUE; m_uCols = 0; m_uRows = 0; m_bMove = FALSE; m_bApplyWAll = FALSE; //}}AFX_DATA_INIT } void CCellPropeDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CCellPropeDlg) DDX_Control(pDX, IDC_CELLPROP_ROWS_EDT, m_edtRows); DDX_Control(pDX, IDC_CELLPROP_COLS_EDT, m_edtCols); DDX_Control(pDX, IDC_CELLPROP_SHOWRULER_COM, m_cmbShowRuler); DDX_Radio(pDX, IDC_CELLPROP_ALLCELLS_CHK, m_ApplyCellType); DDX_Check(pDX, IDC_CELLPROP_SHOWTAG_CHK, m_bShowTag); DDX_Check(pDX, IDC_CELLPROP_FITIMG_CHK, m_bFitImage); DDX_Text(pDX, IDC_CELLPROP_COLS_EDT, m_uCols); DDX_Text(pDX, IDC_CELLPROP_ROWS_EDT, m_uRows); DDX_Check(pDX, IDC_CELLPROP_ONMOVE_CHK, m_bMove); DDX_Check(pDX, IDC_CELLPROP_APPLYONALL_CHK, m_bApplyWAll); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CCellPropeDlg, CDialog) //{{AFX_MSG_MAP(CCellPropeDlg) ON_BN_CLICKED(IDAPPLY, OnApply) ON_BN_CLICKED(IDREST, OnRest) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CCellPropeDlg message handlers BOOL CCellPropeDlg::OnInitDialog() { CDialog::OnInitDialog(); CConViewApp * pTheApp = (CConViewApp *)AfxGetApp(); INT nIndex = pTheApp->SearchForFirstSelectedCell(); nIndex = max(0, nIndex); m_uRows = m_pView->m_ConView.Cell(nIndex).GetSubRowCount(); m_uCols = m_pView->m_ConView.Cell(nIndex).GetSubColumnCount(); m_bShowTag = !m_pView->m_ConView.Cell(nIndex).GetShowTags(); m_bFitImage = m_pView->m_ConView.Cell(nIndex).GetIsFit(); m_bMove = m_pView->m_ConView.Cell(nIndex).GetEnableChangeOnMove(); m_bApplyWAll = !m_pView->m_ConView.Cell(nIndex).GetIndividual(); m_cmbShowRuler.AddString(TEXT("None"));; m_cmbShowRuler.AddString(TEXT("Both"));; m_cmbShowRuler.AddString(TEXT("Vertical"));; m_cmbShowRuler.AddString(TEXT("Horizontal"));; m_cmbShowRuler.SetCurSel(m_pView->m_ConView.Cell(nIndex).GetShowRuler()); m_edtRows.SetNumericEditBox(1, 4, 1, 0, 0); m_edtCols.SetNumericEditBox(1, 8, 1, 0, 0); if (pTheApp->SearchForFirstSelectedCell() < 0) { m_ApplyCellType = 0; ::EnableWindow((this->GetDlgItem(IDC_CELLPROP_SELECTED_CHK))->m_hWnd, FALSE); } else m_ApplyCellType = 1; UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } VOID CCellPropeDlg::SetCellProp(INT nIndex) { m_pView->m_ConView.Cell(nIndex).SetShowRuler(m_cmbShowRuler.GetCurSel()); m_pView->m_ConView.Cell(nIndex).SetSubRowCount(m_uRows); m_pView->m_ConView.Cell(nIndex).SetSubColumnCount(m_uCols); m_pView->m_ConView.Cell(nIndex).SetIndividual(!m_bApplyWAll); m_pView->m_ConView.Cell(nIndex).SetIsFit(m_bFitImage); m_pView->m_ConView.Cell(nIndex).SetEnableChangeOnMove(m_bMove); m_pView->m_ConView.Cell(nIndex).SetShowTags(!m_bShowTag); } VOID CCellPropeDlg::Apply() { if(m_ApplyCellType) { INT nCount = m_pView->m_ConView.GetCellCount(); for (INT nI = 0; nI < nCount; nI++) { if (m_pView->m_ConView.Cell(nI).GetSelect()) SetCellProp(nI); } } else { SetCellProp(-1); } } void CCellPropeDlg::OnApply() { UpdateData(); Apply(); } void CCellPropeDlg::OnOK() { UpdateData(); Apply(); CDialog::OnOK(); } void CCellPropeDlg::OnRest() { m_cmbShowRuler.SetCurSel(CONVIEW_SHOWRULER_BOTH); m_uRows = 1; m_uCols = 1; m_bApplyWAll = TRUE; m_bFitImage = FALSE; m_bMove = FALSE; m_bShowTag = TRUE; m_cmbShowRuler.SetCurSel(CONVIEW_SHOWRULER_BOTH) ; UpdateData(FALSE); Apply(); }