CSplitterWnd* PASCAL CView::GetParentSplitter(const CWnd* pWnd, BOOL bAnyState) { CSplitterWnd* pSplitter = (CSplitterWnd*)pWnd->GetParent(); if (!pSplitter->IsKindOf(RUNTIME_CLASS(CSplitterWnd))) return NULL; // not a splitter if (!bAnyState) { // ignore splitters in minimized (iconic) windows while ((pWnd = pWnd->GetParent()) != NULL) if (pWnd->IsIconic()) return NULL; } return pSplitter; }
long CCompileEditView::OnSendAddStr(WPARAM wParam /*= 0*/, LPARAM lParam /*= 0*/) { if(lParam == NULL) return 0; if( IsCompileEdit(COMPILE) ) { HSAddStrCompileEdit* pData = (HSAddStrCompileEdit*)lParam; CString strRep; long nStartChar; long nEndChar; GetRichEditCtrl().GetSel( nStartChar, nEndChar ); if(wParam == HX_EXPRESSSENTENCE) { CExpression* pExpression = (CExpression*)pData->m_strText; pData->m_strText = NULL; strRep.Format(_T("\n\n{ 插入%s公式体开始 }\n\n %s \n\n{ 插入%s公式体结束 }\n"), pExpression->GetName(),pExpression->GetSource(),pExpression->GetName()); GetRichEditCtrl().SetSel (-1,-1); // 插入到最后 GetRichEditCtrl().ReplaceSel(strRep,TRUE); if( m_pParentDlg->m_WndGridCtrl.GetSafeHwnd() ) { //m_pParentDlg->m_WndGridCtrl.SetParamer(pExpression->GetParamVar(),TRUE); CMapVariabile* pVarsMap = pExpression->GetParamVar(); int nRow = m_pParentDlg->m_WndGridCtrl.GetFixedRowCount(); if ( pVarsMap ==NULL ) { for(;nRow < m_pParentDlg->m_WndGridCtrl.GetRowCount(); nRow++) { m_pParentDlg->m_WndGridCtrl.SetItemText(nRow,1,""); m_pParentDlg->m_WndGridCtrl.SetItemText(nRow,2,""); m_pParentDlg->m_WndGridCtrl.SetItemText(nRow,3,""); m_pParentDlg->m_WndGridCtrl.SetItemText(nRow,4,""); m_pParentDlg->m_WndGridCtrl.SetItemText(nRow,5,""); } } CNumericValue* pValue; CArray<class CValue*,class CValue*>* pArray = pVarsMap->GetObjArray(); CString sName; CString strRetName; for(int nObj = 0; pArray != NULL && nObj < pArray->GetSize(); nObj++) { pValue = (CNumericValue*)pArray->GetAt(nObj); if( !pValue->IsStyle(HX_EXPRESSNUMBER) ) continue; CString strValue; sName = pVarsMap->GetObjectName(pValue); strRetName.Format("%s",sName); m_pParentDlg->m_WndGridCtrl.SetItemText(nRow,1,strRetName); strValue.Format("%d", pValue->GetMinValue()); m_pParentDlg->m_WndGridCtrl.SetItemText(nRow,2,strValue); strValue.Format("%d", pValue->GetMaxValue()); m_pParentDlg->m_WndGridCtrl.SetItemText(nRow,3,strValue); strValue.Format("%d", pValue->GetValue()); m_pParentDlg->m_WndGridCtrl.SetItemText(nRow,4,strValue); strValue.Format("%d", pValue->GetTestStepValue()); m_pParentDlg->m_WndGridCtrl.SetItemText(nRow,5,strValue); nRow++; } m_pParentDlg->m_WndGridCtrl.Invalidate(); } } else { strRep.Format("%s",*pData->m_strText); GetRichEditCtrl().ReplaceSel(strRep,FALSE); GetRichEditCtrl().SetSel( nStartChar+pData->m_nCharPos, nStartChar+pData->m_nCharPos ); } SetFocus(); } else if( IsCompileEdit(HELP) ) { CString* str = (CString*)lParam; GetRichEditCtrl().SetWindowText(*str); int nCount = GetRichEditCtrl().GetLineCount(); CDC* pDC = GetRichEditCtrl().GetDC(); if(pDC != NULL) { nCount = pDC->GetTextExtent("A").cy * (nCount + 1); GetRichEditCtrl().ReleaseDC(pDC); } CSplitterWnd* pWnd = (CSplitterWnd*)this->GetParent(); if( pWnd != NULL && pWnd->IsKindOf(RUNTIME_CLASS(CSplitterWnd)) ) { CRect rect; pWnd->GetClientRect(rect); int nHeight = rect.Height() - nCount; if(nHeight < 0) nHeight = rect.Height(); pWnd->SetRowInfo(0,nHeight,0); pWnd->SetRowInfo(1,nCount,0); pWnd->RecalcLayout(); } } return 0; }