当前位置: 首页>>代码示例>>C++>>正文


C++ CFunctionEditorDoc::UpdateAllViews方法代码示例

本文整理汇总了C++中CFunctionEditorDoc::UpdateAllViews方法的典型用法代码示例。如果您正苦于以下问题:C++ CFunctionEditorDoc::UpdateAllViews方法的具体用法?C++ CFunctionEditorDoc::UpdateAllViews怎么用?C++ CFunctionEditorDoc::UpdateAllViews使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFunctionEditorDoc的用法示例。


在下文中一共展示了CFunctionEditorDoc::UpdateAllViews方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnCbtnMsgHandlerApply


//.........这里部分代码省略.........
        bValidateSelection = bValidateUserSelection(pDoc); 
        if (bValidateSelection == TRUE)
        {
            CString omFunc = CGlobalObj::omGetBusSpecMsgHndlrName(m_eBus);;
            // Add to function editor
            CString omSelectedText = _T("");

            omSelectedText = BUS_FN_HDR; // Start comment section: init
            omSelectedText.Replace(_T("PLACE_HODLER_FOR_BUSNAME"), 
                             sBusSpecInfo.m_omBusName); // Replace the bus name

            omFunc += m_omStrSelectedItemText;
            omSelectedText.Replace( _T("PLACE_HODLER_FOR_FUNCTIONNAME"),
                omFunc );
            pDoc->m_omSourceCodeTextList.AddTail( omSelectedText );
            // Form the function prototype
            omSelectedText  = m_omStrSelectedItemText;
            int nIndex = -1;
            

            // Get the type and set the parameter type
            BOOL bIsMsgSpecificHandler = FALSE;
            //Find out whether the Msg handler is DatabaseMsgName type or ID type
            CString omMsgHandlerType = CGlobalObj::ouGetObj(m_eBus).m_omMsgStructName;
            nIndex = omSelectedText.Find(defSTR_MSG_SPECIFIC_HANDLER);
            
            if( nIndex != -1 )
            {
                bIsMsgSpecificHandler = TRUE;
                // For database message type is equal same as msg name
                omMsgHandlerType = omSelectedText.Mid( nIndex +
                                                     defMESSAGE_NAME_INDEX );
            }
            CString omStrParamtype;
            
            if (bIsMsgSpecificHandler == TRUE && (m_eBus == CAN))
            {
                omStrParamtype = omMsgHandlerType;
            }
            else// For Msg ID, Range and generic messages the type is sTCANDATA
            {
                omStrParamtype = CGlobalObj::ouGetObj(m_eBus).m_omMsgStructName;
            }
            CString omFormatString = m_eBus == CAN ? defDEFAULT_MSG_HANDLER_CODE_CAN : defDEFAULT_MSG_HANDLER_CODE;
            omSelectedText.Format(  omFormatString,
                                    CGlobalObj::omGetBusSpecMsgHndlrName(sBusSpecInfo.m_eBus),
                                    omSelectedText,   // Fun name
                                    omStrParamtype ); // Parameter type

            pDoc->m_omSourceCodeTextList.AddTail( omSelectedText );

            CString omStrPrototype = omSelectedText;
            // Add to tree view
            CFnsTreeView* pomTreeView = CGlobalObj::ouGetObj(m_eBus).podGetFuncsTreeViewPtr();
            if(pomTreeView != NULL )
            {
                // Add the prototype to the tree view
                CTreeCtrl& omTree = pomTreeView->GetTreeCtrl();
                HTREEITEM hItem = omTree.GetSelectedItem();
                HTREEITEM hNew = 
                    omTree.InsertItem( omSelectedText, hItem);
                omTree.SetItemImage( hNew, 5, 5 );
                omTree.SelectItem( hNew );
                // Form the body of the function
                omSelectedText = "{";
                pDoc->m_omSourceCodeTextList.AddTail( omSelectedText );
                if (CGlobalObj::ouGetObj(m_eBus).m_omMsgStructName.IsEmpty())
                {
                    ASSERT(FALSE);
                }
                omSelectedText = defTODO;
                pDoc->m_omSourceCodeTextList.AddTail( omSelectedText );

                // Form the function footer
                omSelectedText = BUS_FN_FOOTER;
                omSelectedText.Replace(_T("PLACE_HODLER_FOR_BUSNAME"), sBusSpecInfo.m_omBusName);
                omSelectedText.Replace( _T("PLACE_HODLER_FOR_FUNCTIONNAME"),
                    omFunc );

                pDoc->m_omSourceCodeTextList.AddTail( omSelectedText );

                CStringArray* pMsgArray = 
                    pDoc->omStrGetMessageHandlerPrototypes();
                if ( pMsgArray != NULL )
                {
                    pMsgArray->Add( omStrPrototype );
                }
                pDoc->UpdateAllViews( NULL );
                pDoc->SetModifiedFlag( TRUE );
            }
        }
    }
    m_omStrSelectedItemText = _T("");
    BOOL bButtonChecked  = FALSE;
    bButtonChecked =  IsDlgButtonChecked(IDC_RBTN_MSG_NAME);
    if(bButtonChecked != FALSE )
    {
         m_omListMsgName.SetCurSel(-1);
    }
}
开发者ID:Fetze,项目名称:busmaster,代码行数:101,代码来源:MsgHandlerDlg.cpp


注:本文中的CFunctionEditorDoc::UpdateAllViews方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。