本文整理汇总了C++中CFunctionEditorDoc类的典型用法代码示例。如果您正苦于以下问题:C++ CFunctionEditorDoc类的具体用法?C++ CFunctionEditorDoc怎么用?C++ CFunctionEditorDoc使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CFunctionEditorDoc类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bOpenFunctioneditorfile
BOOL CGlobalObj::bOpenFunctioneditorfile(CString omStrNewCFileName)
{
BOOL bFileFound = TRUE;
CFunctionEditorDoc* pDoc = CFunctionEditorBase::pCreateNewDocument(m_eBus);
// file-attribute information
if (pDoc != nullptr)
{
CEditFrameWnd::sm_eBus = m_eBus;
struct _tfinddata_t fileinfo;
// Check if file exists
if (_tfindfirst( omStrNewCFileName.GetBuffer(MAX_PATH), &fileinfo) == -1L)
{
bFileFound = pDoc->bCreateNewDocument(omStrNewCFileName);
}
if (bFileFound == TRUE)
{
//// Now open the selected file
pDoc->OnOpenDocument(omStrNewCFileName);
CMultiDocTemplate* pTemplate = m_pEditorDocTemplate;
m_pEditFrameWnd = (CEditFrameWnd*)(pTemplate->CreateNewFrame(pDoc, nullptr));
//If null is passed as parameter the m_pdoc->GetNextView(pos) will
// give null value
if (m_pEditFrameWnd != nullptr)
{
ASSERT_KINDOF(CEditFrameWnd, m_pEditFrameWnd);
pTemplate->InitialUpdateFrame(m_pEditFrameWnd, /*nullptr*/pDoc);
}
}
}
return bFileFound;
}
示例2: EnumChildProc
/**
* \brief Callback function which can be used to close windows during configuration switching
* \param[in] HWND hwnd, LPARAM lParam
* \return TRUE
* \authors Arunkumar Karri
* \date 14.02.2013 Created
*/
BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM /* lParam */)
{
if ( hwnd )
{
CWnd* pWnd = CWnd::FromHandle(hwnd);
if ( pWnd )
{
CRuntimeClass* pRunTimeClass = pWnd->GetRuntimeClass();
if ( pRunTimeClass )
{
if ( pRunTimeClass == RUNTIME_CLASS(CEditFrameWnd) || pRunTimeClass == RUNTIME_CLASS(COutWnd) )
{
/* If any function editor window is open */
if ( pRunTimeClass == RUNTIME_CLASS(CEditFrameWnd) )
{
CEditFrameWnd* pEditWnd = (CEditFrameWnd*)pWnd;
CFunctionEditorDoc* pDoc = (CFunctionEditorDoc*)pEditWnd->GetActiveDocument();
/* If a function editor window is modified */
if ( nullptr != pDoc && pDoc->IsModified() )
{
/* take confirmation from user for the first time only */
if ( g_bReqUserConfirmation )
{
g_bReqUserConfirmation = false;
INT nSelection = ::MessageBox( hwnd, _("Simulation files have been modified. Do You Want to save the Changes?"), _("Modified"), MB_YESNO | MB_ICONQUESTION);
switch(nSelection)
{
case IDYES:
g_bQueryConfirm = true;
break;
case IDNO:
g_bQueryConfirm = false;
break;
}
}
/* Based on user response, save the simulation files */
if ( g_bQueryConfirm )
{
if (pDoc != nullptr)
{
pDoc->OnSaveDocument(pDoc->GetPathName());
}
}
}
}
/* Destroy the window */
pWnd->DestroyWindow();
}
}
}
}
return TRUE;
}
示例3: pCreateNewDocument
CFunctionEditorDoc* CFunctionEditorBase::pCreateNewDocument(eTYPE_BUS eBus)
{
CMultiDocTemplate* pTemplate = CGlobalObj::ouGetObj(eBus).m_pEditorDocTemplate;
// Now open the selected file
CFunctionEditorDoc *pDoc = (CFunctionEditorDoc*)pTemplate->CreateNewDocument();
if (pDoc != NULL)
{
SBUS_SPECIFIC_INFO sInfo;
if (bInitBusInfo(sInfo, eBus))
{
pDoc->bInitBusSpecificInfo(sInfo);
}
}
return pDoc;
}
示例4: while
void CGlobalObj::vCloseAllActiveFunctionEditors()
{
//CFunctionEditorDoc* pDocRet = nullptr;
CFunctionEditorDoc* pDoc = nullptr;
if (m_pEditorDocTemplate != nullptr)
{
POSITION pos = m_pEditorDocTemplate->GetFirstDocPosition();
while (pos/*&& !pDocRet*/)
{
pDoc = (CFunctionEditorDoc*)m_pEditorDocTemplate->GetNextDoc(pos);
if (pDoc->IsKindOf(RUNTIME_CLASS(CFunctionEditorDoc)))
{
pDoc->OnCloseDocument();
}
}
}
}
示例5: UpdateFileViewAndSetModified
void CFunctionView::UpdateFileViewAndSetModified()
{
// If document is updated successfully then,
// update the view
if ( UpdateFunctionInDocument())
{
CFunctionEditorDoc* pDoc = (CFunctionEditorDoc*)CView::GetDocument();
if ( pDoc != NULL )
{
//pomMainFrm->CGlobalObj::podGetFunctionEditorDoc()->Invalidate();
CFileView* pFileView = CGlobalObj::ouGetObj(m_eBus).podGetFileViewPtr();
if (pFileView != NULL)
{
pFileView->OnUpdate( NULL, 0, NULL );
pFileView->vGoToLine( m_nStartingLine + m_nCurrentLine );
}
pDoc->SetModifiedFlag( TRUE );
}
}
}
示例6: podGetFunctionEditorDoc
CFileView* CGlobalObj::podGetFileViewPtr()
{
CFileView* pFileView = nullptr;
CView* pTempView = nullptr;
BOOL bFound = FALSE;
//Get the active document and find the CFileView attached to it
CFunctionEditorDoc* pDoc = podGetFunctionEditorDoc();
if (pDoc != nullptr)
{
POSITION pos = pDoc->GetFirstViewPosition();
while (pos && !bFound)
{
pTempView = pDoc->GetNextView(pos);
if (pTempView->IsKindOf(RUNTIME_CLASS(CFileView)))
{
pFileView = (CFileView*)pTempView;
bFound = TRUE;
}
}
}
return pFileView;
}
示例7: while
CFunctionEditorDoc* CGlobalObj::pGetDocPtrOfFile(CString strTempName)
{
CString strPath = "";
CFunctionEditorDoc* pDocRet = nullptr;
CFunctionEditorDoc* pDoc = nullptr;
if (m_pEditorDocTemplate != nullptr)
{
POSITION pos = m_pEditorDocTemplate->GetFirstDocPosition();
while (pos && !pDocRet)
{
pDoc = (CFunctionEditorDoc*)m_pEditorDocTemplate->GetNextDoc(pos);
if (pDoc->IsKindOf(RUNTIME_CLASS(CFunctionEditorDoc)))
{
strPath = pDoc->GetPathName();
if (!(strPath.Compare(strTempName)))
{
pDocRet = pDoc;
}
}
}
}
return pDocRet;
}
示例8: UpdateData
void CExploreMsgSg::OnSelect()
{
UpdateData(TRUE);
// Get Main Frame Window Pointer
CFunctionEditorDoc* pDoc = nullptr;
// For global variable addition structure is required
if( m_eSelectType == SEL_GLOBAL_MESSAGE)
{
// Same as select message
m_eSelectType = SEL_MESSAGE;
// Enable structure definition
m_bWantStructure = TRUE;
}
// Get the Document Object
if (m_bWantStructure == TRUE)
{
pDoc = m_pDoc;
}
if ( m_eSelectType == SEL_MESSAGE )
{
// Get selected message text
m_omStrMessageName = m_omStrSelectedItemText =
m_omMsgList.GetItemText( m_nMsgIndex, 0);
UINT unMsgID = (COMMANUINT)m_omMsgList.GetItemData(m_nMsgIndex);
if (m_bWantStructure == TRUE)
{
// Get the Initialised string from document
if (pDoc != nullptr)
{
//To pass the actual name of message
int nIndex = m_omStrMessageName.ReverseFind(defMSGID_NAME_START_CHAR);
if(nIndex != -1)
{
m_omStrSelectedItemText = m_omStrMessageName.Left(nIndex);
m_omStrMessageName = m_omStrSelectedItemText;
}
CString omStrMsgStructure =
pDoc->omStrGetInitialisedMessage(unMsgID,
m_omStrSelectedItemText,
MSG_STRUCT_VAR,TRUE,nGetSelChannel(), nGetSelChannel());
m_omStrSelectedItemText = omStrMsgStructure;
}
}
}
else
{
// User wants signal to be selected
CString omStrMsg = m_omMsgList.GetItemText(m_nMsgIndex, 0);
UINT unMsgID = (COMMANUINT)m_omMsgList.GetItemData(m_nMsgIndex);
int nSgIndex = (COMMANUINT)m_omSignalListBox.GetCurSel();
if ( nSgIndex != -1 )
{
// Get selected signal text
CString omStrSgName = "";
m_omSignalListBox.GetText( nSgIndex, omStrSgName );
if ( m_bWantStructure )
{
omStrSgName.Insert( 0, (char)PERIOD );
////To pass the actual name of message
int nIndex = omStrMsg.ReverseFind(defMSGID_NAME_START_CHAR);
if( nIndex!=0 )
{
omStrMsg = omStrMsg.Left(nIndex);
}
if(nullptr != pDoc)
{
// Get the Initialised string from document
CString omStrMsgStructure =
pDoc->omStrGetInitialisedMessage(unMsgID,
omStrMsg,
MSG_STRUCT_VAR,TRUE,nGetSelChannel());
// Form the declaration and signal access statements
m_omStrSelectedItemText.Format(defFNS_INIT_SIG_FORMAT,
omStrMsgStructure,
MSG_STRUCT_VAR,
defSIGNALMEMBER);
}
}
m_omStrSelectedItemText += omStrSgName;
}
}
CDialog::OnOK();
}
示例9: UpdateFunctionInDocument
BOOL CFunctionView::UpdateFunctionInDocument()
{
BOOL bRetVal = FALSE;
POSITION sStart = m_sStartPos;
if ( sStart != NULL )
{
CFunctionEditorDoc* pDoc = (CFunctionEditorDoc*)CView::GetDocument();
if ( pDoc != NULL )
{
SBUS_SPECIFIC_INFO sBusSpecInfo;
pDoc->bGetBusSpecificInfo(sBusSpecInfo);
//Construct the Function Footer
CString omStrFnFooter;
// If it is global variable then select Global variable footer
if( m_omStrFnName == GLOBAL_VARIABLES )
{
omStrFnFooter = BUS_VAR_FOOTER;
omStrFnFooter.Replace("PLACE_HODLER_FOR_BUSNAME", sBusSpecInfo.m_omBusName);
}
else
{
// Select function common footer
omStrFnFooter = EDITOR_BUS_FN_FOOTER;
// Form function specific footer
omStrFnFooter.Replace("PLACE_HODLER_FOR_BUSNAME", sBusSpecInfo.m_omBusName);
omStrFnFooter.Replace( "PLACE_HODLER_FOR_FUNCTIONNAME",
m_omStrFnName );
}
CString omStrLine("");
// Get the Edit control ref.
CRichEditCtrl& romEditCtrl = GetRichEditCtrl();
// get the total lines of code in the rich edit control
int nLineCount = romEditCtrl.GetLineCount();
long lStart, lEnd;
// Get the cursor position
romEditCtrl.GetSel(lStart, lEnd);
// Get the cursor line and save
m_nCurrentLine = (int) romEditCtrl.LineFromChar(lStart);
BOOL bDone = FALSE;
pDoc->m_omSourceCodeTextList.GetNext(sStart);
POSITION sPos1 = NULL;
POSITION sPos2 = NULL;
for( sPos1 = sStart; ( ((sPos2 = sPos1) != NULL) && (!bDone) ); )
{
CString omStrDel =
pDoc->m_omSourceCodeTextList.GetNext( sPos1 );
if( omStrDel.Find(omStrFnFooter) >= 0 )
{
bDone = TRUE;
}
else
{
pDoc->m_omSourceCodeTextList.RemoveAt( sPos2 );
}
}
BOOL bFirst = TRUE;
POSITION sPos = m_sStartPos;
for (int nLineIndex = 0; nLineIndex < nLineCount; nLineIndex++)
{
CString omStrNewItem("");
int nCharIndex = GetRichEditCtrl().LineIndex(nLineIndex);
int nLineLength = GetRichEditCtrl().LineLength(nCharIndex);
nLineLength = ( nLineLength < 4 ) ? 4 : nLineLength;
GetRichEditCtrl().GetLine(nLineIndex,
omStrNewItem.GetBuffer(nLineLength),
nLineLength);
omStrNewItem.ReleaseBuffer(nLineLength);
omStrNewItem.TrimRight();
if ( bFirst )
{
pDoc->m_omSourceCodeTextList.SetAt(sPos, omStrNewItem);
bFirst = FALSE;
}
else
{
pDoc->m_omSourceCodeTextList.InsertAfter(
sPos, omStrNewItem);
pDoc->m_omSourceCodeTextList.GetNext(sPos);
}
}
bRetVal = TRUE;
}
}
//.........这里部分代码省略.........
示例10: omStrFnBody
void CFunctionView::vSetFunctionToEdit(const CString& omStrFunction)
{
m_omStrFnName = omStrFunction;
CString omStrFnBody("");
BOOL bGlobalVar = FALSE;
m_bIsValidFunction = FALSE;
m_sStartPos = NULL;
CFunctionEditorDoc* pDoc = NULL;
pDoc = (CFunctionEditorDoc*)CView::GetDocument();
if ( pDoc != NULL )
{
SBUS_SPECIFIC_INFO sBusSpecInfo;
pDoc->bGetBusSpecificInfo(sBusSpecInfo);
CString omStrFnHeader, omStrFnFooter;
// If it is a global variable block then set the block
// with global variable boundary
if( omStrFunction == GLOBAL_VARIABLES )
{
omStrFnHeader = BUS_VAR_HDR;
omStrFnHeader.Replace("PLACE_HODLER_FOR_BUSNAME", sBusSpecInfo.m_omBusName);
omStrFnFooter = BUS_VAR_FOOTER;
omStrFnFooter.Replace("PLACE_HODLER_FOR_BUSNAME", sBusSpecInfo.m_omBusName);
bGlobalVar = TRUE;
}
else
{
//Construct the Function Header
omStrFnHeader = BUS_FN_HDR;
omStrFnHeader.Replace("PLACE_HODLER_FOR_BUSNAME", sBusSpecInfo.m_omBusName);
omStrFnHeader.Replace( "PLACE_HODLER_FOR_FUNCTIONNAME",
omStrFunction );
//Construct the Function Footer
omStrFnFooter = EDITOR_BUS_FN_FOOTER;
omStrFnFooter.Replace(_T("PLACE_HODLER_FOR_BUSNAME"), sBusSpecInfo.m_omBusName);
omStrFnFooter.Replace( _T("PLACE_HODLER_FOR_FUNCTIONNAME"),
omStrFunction );
}
POSITION sPos = pDoc->m_omSourceCodeTextList.GetHeadPosition();
int nLineNumber = 0;
while ( sPos != NULL )
{
//Iterate through the Source Code String-List
CString omStrLine = pDoc->m_omSourceCodeTextList.GetNext(sPos);
// Increment the line count
nLineNumber++;
//If the current line matches the Function Header...
//(means the starting of the function we are looking for)
if ( omStrLine == omStrFnHeader )
{
if( bGlobalVar == FALSE)
{
m_nStartingLine = nLineNumber;
//Skip Function name and parameters line
omStrLine = pDoc->m_omSourceCodeTextList.GetNext(sPos);
if (sPos != NULL)
{
//Get Next line
omStrLine = pDoc->m_omSourceCodeTextList.GetNext(sPos);
if (sPos != NULL)
{
//Opening brace indicates start of function body
if ( omStrLine.Find('{') != -1 )
{
//Store the start for later use
m_sStartPos = sPos;
//Loop through the function body till we encounter
//the function footer
while ( (sPos != NULL) && ( m_bIsValidFunction != TRUE) )
{
omStrLine = pDoc->m_omSourceCodeTextList.GetNext(sPos);
if ( omStrLine.Find(omStrFnFooter) >= 0 )
{
m_bIsValidFunction = TRUE;
}
else
{
omStrFnBody += omStrLine;
omStrFnBody += '\n';
}
}
}
}
}
}
else
{
//Store the start for later use
m_sStartPos = sPos;
m_nStartingLine = nLineNumber;
//.........这里部分代码省略.........
示例11: while
void COutWnd::OnDbClick()
{
INT nSelectIndex;
CString omStrSelectedItem;
nSelectIndex = m_omListBox.GetCurSel();
if(nSelectIndex!=LB_ERR )
{
CString omStrLineNumber = "";
INT nIndex = 0;
UINT unLineNumber = 0;
char* pcStopStr = nullptr;
m_omListBox.GetText(nSelectIndex,omStrSelectedItem);
CString omStrFilePath;
CString omStrFileName;
omStrFilePath=omStrSelectedItem;
while(!(nSelectIndex==0||omStrFilePath==defSTR_BUILD_TRACE_LINE_MARK))
{
--nSelectIndex;
m_omListBox.GetText(nSelectIndex,omStrFilePath);
}
if(omStrFilePath==defSTR_BUILD_TRACE_LINE_MARK)
{
++nSelectIndex;
m_omListBox.GetText(nSelectIndex,omStrFilePath);
int nNameIndex = omStrFilePath.ReverseFind('\\');
if(nNameIndex != -1)
{
//pGetBusSpecificFunctionEditorDoc(omStrFilePath);
CFunctionEditorDoc* pDoc = m_pGlobalObj->pGetDocPtrOfFile(omStrFilePath);
if (pDoc != nullptr)
{
//If file is opened then get its frame and activate it
{
POSITION pos = pDoc->GetFirstViewPosition();
if (pos)
{
pDoc->GetNextView(pos)->GetParentFrame()->ActivateFrame();
}
}
}
else
{
//If file is not opened then open it
if ( !m_pGlobalObj->bOpenFunctioneditorfile(omStrFilePath) )
{
AfxMessageBox("Specified filename not found!",
MB_OK|MB_ICONINFORMATION);
}
}
// Find the ':' to get the number after second ':'
nIndex = omStrSelectedItem.Find(":");
if(nIndex!=-1)
{
omStrLineNumber = omStrSelectedItem.Right(
omStrSelectedItem.GetLength()-nIndex-1);
nIndex = omStrLineNumber.Find(":");
omStrLineNumber = omStrLineNumber.Right(
omStrLineNumber.GetLength()-nIndex-1);
omStrLineNumber.TrimLeft();
omStrLineNumber.TrimRight();
omStrLineNumber = omStrLineNumber.SpanExcluding(":");
unLineNumber = _tcstol((LPCTSTR)omStrLineNumber,
&pcStopStr,10);
// Call this function only if the line number is valid
if(unLineNumber!=0)
{
CFileView* pFileView = m_pGlobalObj->podGetFileViewPtr();
if(pFileView != nullptr)
{
pFileView->vDisplayWarningLineNumber(OUTWND,unLineNumber);
}
}
}
else
{
nIndex = omStrSelectedItem.Find(":");
if(nIndex!=-1)
{
nIndex = omStrSelectedItem.Find(":");
omStrLineNumber = omStrSelectedItem.Right(
omStrSelectedItem.GetLength()-nIndex-1);
omStrLineNumber.TrimLeft();
omStrLineNumber.TrimRight();
omStrLineNumber = omStrLineNumber.
SpanExcluding("\t ");
unLineNumber = _tcstol((LPCTSTR)omStrLineNumber,
&pcStopStr,
10);
if(unLineNumber!=0)
{
CFileView* pFileView = m_pGlobalObj->podGetFileViewPtr();
if(nullptr != pFileView)
{
pFileView->vDisplayWarningLineNumber(OUTWND,
//.........这里部分代码省略.........
示例12: Input
/******************************************************************************
Function Name : OnDraw
Input(s) : CDC* pomDC
Output : -
Functionality : Called by the frame work to update the view.
This function gets source code from the document
and displays on the view.
If warning is specified, it highlight that line
with different color.
If single line of comment is found, it displays the line
with differet color.
Member of : CFileView
Friend of : -
Author(s) :
Date Created :
******************************************************************************/
void CFileView::OnDraw(CDC* pDC)
{
// Get document
CFunctionEditorDoc* pomDoc = omGetDocument();
ASSERT_VALID(pomDoc);
// Initialise backend Buffer
// Get Client rectangle
// This will give the starting point and size
CRect omRect;
GetClientRect(&omRect);
// Get current scroll position
CPoint omPoint = GetScrollPosition();
// Add this walue with Client Rect
// to get rect from the starting point to the end of scrolling point
omRect.right += omPoint.x;
omRect.bottom += omPoint.y;
// Create Backend Buffer
/*************************************************************/
// If backend buffer creation failed it will use Screen DC
// Directly to avoid showing blank screen
// The Flag m_bCreateSuccess gives an indication of which DC
// it is using. If it is TRUE then that is Buffer. If it is
// FALSE then it is directly drawing on the pDC (screen pr printer DC).
// No extra check is required to handle create failure
/************************************************************/
COffScreenDC omMemDC(pDC, &omRect);
CDC* pomDC = nullptr;
pomDC = &omMemDC;
if(pomDoc != nullptr)
{
char acSourceLineNo[10] = "";
long lLineCount = LONG_INIT;
long lCurrentWarnLineNum = LONG_INIT;
int nTabStopPositions = INT_INIT;
BOOL bWarningLine = FALSE;
COLORREF CurrentTextColor = DWORD_INIT,
CurrentBkColor = DWORD_INIT;
// Change Font
CFont omNewFont;
CFont* pomOldFont=nullptr;
BOOL bCommentFound = FALSE;
BOOL bWithInComment = FALSE;
// Create font
BOOL bSuccess = omNewFont.CreateFont(m_nCharHeight,
m_nCharWidth,
DEFAULT_FONT_ESCAPEMENT,
DEFAULT_FONT_ORIENTATION,
FW_NORMAL,
NOT_ITALIC,
NO_UNDERLINE,
NO_STRIKEOUT,
DEFAULT_CHARSET,
OUT_CHARACTER_PRECIS,
CLIP_CHARACTER_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH | FF_MODERN,
DEFAULT_FONT);
if(bSuccess == TRUE)
{
// Select the new font object
pomOldFont = pomDC -> SelectObject(&omNewFont);
// Get line count
lLineCount = pomDoc->dwGetLineCount ();
// Get warning line number
lCurrentWarnLineNum = pomDoc->m_lCurrentWarningLineNum;
nTabStopPositions = defNO_OF_CHARS_IN_TAB * m_nCharWidth;
if(lLineCount > defCOUNT_INIT)
{
POSITION Position = pomDoc -> SetPosToFirstLine();
if( Position!= nullptr)
{
for(long lInt = defCOUNT_INIT; lInt < lLineCount ; lInt++)
{
int nMargin = MARGIN_FOR_FILE_VIEW;
bCommentFound = FALSE;
// Set the background mix mode to
//.........这里部分代码省略.........
示例13: vInitDlgWithBusSpecNames
BOOL CMsgHandlerDlg::OnInitDialog()
{
CDialog::OnInitDialog();
vInitDlgWithBusSpecNames();
m_odEditMsgIDTo.EnableWindow(FALSE);
m_omListMsgName.EnableWindow(FALSE);
m_odEditMsgIDFrom.EnableWindow(FALSE);
m_odEditMsgID.EnableWindow(TRUE);
m_omButtonApply.EnableWindow(FALSE);
m_omButtonOK.EnableWindow(FALSE);
m_odEditMsgID.vSetSigned(FALSE);
m_odEditMsgIDTo.vSetSigned(FALSE);
m_odEditMsgIDFrom.vSetSigned(FALSE);
CheckDlgButton(IDC_RBTN_MSG_ID,BST_CHECKED);
// Get all the message names of active DB
CFunctionEditorDoc* pDoc = CGlobalObj::ouGetObj(m_eBus).podGetFunctionEditorDoc();
CStringArray* pomStrArray = NULL;
if (pDoc != NULL)
{
pomStrArray = pDoc->omStrGetMessageHandlerPrototypes();
}
if(pomStrArray != NULL )
{
POSITION pos = CGlobalObj::ouGetObj(m_eBus).m_odMsgNameMsgCodeList.GetHeadPosition();
//UINT unNoOfMessages = ouGetMsgSignal().unGetNumerOfMessages();
while (pos != NULL)
{
SMSG_NAME_CODE& sMsgNameCode = CGlobalObj::ouGetObj(m_eBus).m_odMsgNameMsgCodeList.
GetNext(pos);
bAddMessageNameInListBox(pomStrArray, sMsgNameCode.m_omMsgName);
}
}
//if ( unNoOfMessages > 0 )
{
//COMMENTED BY AK******************
//ouGetMsgSignal().omStrListGetMessageNames(omMessageNames);
//CMainFrame* pMainFrame = NULL;
//pMainFrame = (CMainFrame*)AfxGetMainWnd();
//if(pMainFrame != NULL )
//{
// CFunctionEditorDoc* pDoc = pMainFrame->CGlobalObj::podGetFunctionEditorDoc();
// if(pDoc != NULL )
// {
// CStringArray* pomStrArray = NULL;
// pomStrArray = pDoc->omStrGetMessageHandlerPrototypes();
// if(pomStrArray != NULL )
// {
// POSITION pos = omMessageNames.GetHeadPosition();
// // Insert every message name into the message list box
// CString omStrMsgName = _T("");
// while ( pos != NULL )
// {
//
// omStrMsgName = omMessageNames.GetNext(pos);
// bAddMessageNameInListBox(pomStrArray,omStrMsgName);
//
// }
// }
// }
//}
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例14: UpdateData
void CMsgHandlerDlg::OnCbtnMsgHandlerApply()
{
BOOL bValidateSelection = FALSE;
UpdateData(TRUE);
m_omButtonApply.EnableWindow(FALSE);
m_omButtonOK.EnableWindow(FALSE);
// Get document pointer
CFunctionEditorDoc* pDoc = CGlobalObj::ouGetObj(m_eBus).podGetFunctionEditorDoc();
if (NULL != pDoc)
{
SBUS_SPECIFIC_INFO sBusSpecInfo;
pDoc->bGetBusSpecificInfo(sBusSpecInfo);
// Validate user selections
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 );
//.........这里部分代码省略.........