/******************************************************************************* Function Name : vDelSelSubEntries Input(s) : bAllSignals - Delete All Signals Flag Output : Functionality : This function will be called to delete the selected signals from the temporary signal list. It will delete all messages if the bool bAllSignals is true. Member of : CSigWatchAddDelDlg Friend of : - Author(s) : Raja N Date Created : 25.03.2004 Modification By : Modification on : *******************************************************************************/ void CSigWatchAddDelDlg::vDelSelSubEntries(BOOL bAllEntries) { // Get the data from GUI interface vUpdateSelSubEntryList(bAllEntries); if(bAllEntries == FALSE) { UINT unSelCount = (UINT)m_omCSAData.GetSize(); for(UINT index = 0; index < unSelCount; index++) { CString omSelMainSubEntry, omMainEntry, omSubEntry; omSelMainSubEntry = m_omCSAData.GetAt(index); if( bGetMainSubName( omSelMainSubEntry, omMainEntry, omSubEntry) == TRUE ) { UINT unMainEntryID = unGetMainEntryIDFromName(omMainEntry); if ( bDeleteSubEntry(unMainEntryID, omSubEntry) != TRUE) { CString omError; omError.Format(defSTR_SW_DELETE_SIG_ERROR, omSubEntry ,omMainEntry); AfxMessageBox(omError); } } else { CString omError; omError.Format(defSTR_SW_PARSE_ERROR, omSelMainSubEntry); AfxMessageBox(omError); } } } else { if (m_podTempCallerList != NULL) { POSITION pos = m_podTempCallerList->GetHeadPosition(); while (pos) { SMAINENTRY& sMainEntry = m_podTempCallerList->GetNext(pos); POSITION SubPos = sMainEntry.m_odSelEntryList.GetHeadPosition(); while (SubPos != NULL) { POSITION TempPos = SubPos; SSUBENTRY& sSubEntry = sMainEntry.m_odSelEntryList.GetNext(SubPos); sMainEntry.m_odUnSelEntryList.AddTail(sSubEntry); sMainEntry.m_odSelEntryList.RemoveAt(TempPos); } } } } vPopulateUnSelSubEntryList(unGetSelectedMainEntryID()); }
/******************************************************************************* Function Name : OnRClickSelSubEntryList Input(s) : NMHDR* pNMHDR, LRESULT* pResult - Handler parameter Output : - Functionality : This function will be called by framework when the user clicks the right mouse button in Signal Watch List box. This will popup the menu item. The irrevelent menu items will be disabled. If there is not item in the list box the popup menu will not be displayed. Member of : CSigWatchAddDelDlg Friend of : - Author(s) : Raja N Date Created : 25.03.2004 Modification By : Modification on : *******************************************************************************/ void CSigWatchAddDelDlg::OnRClickSelSubEntryList(NMHDR* /*pNMHDR*/, LRESULT* pResult) { CMenu omCtxMenu; CPoint point(0,0); // Enable buttons in sync with the menu status vEnableDisableButtons(); GetCursorPos(&point); // Popup only if there is atleast one entry in the list if( m_omListCtrlSignalWatch.GetItemCount() > 0) { if (omCtxMenu.LoadMenu(IDM_MENU_SIGNAL_WATCH)) { CMenu* pomCtxMenu = omCtxMenu.GetSubMenu(2); if (pomCtxMenu != NULL) { UINT unSelCount; unSelCount = m_omListCtrlSignalWatch.GetSelectedCount(); // Disable Delete Operations pomCtxMenu->EnableMenuItem(IDM_SIGNALDLG_ADD, MF_DISABLED | MF_GRAYED); pomCtxMenu->EnableMenuItem(IDM_SIGNALDLG_ADDALL, MF_DISABLED | MF_GRAYED); if(unSelCount == 0) { // Disable selection operations pomCtxMenu->EnableMenuItem(IDM_SIGNALDLG_DELETE, MF_DISABLED | MF_GRAYED); } // Enable Signal Details only if one item got selected if(unSelCount == 1) { // Copy the Message Name and Signal Name for Signal Details m_omCSAData.RemoveAll(); CString omMainEntry, omSubEntry, omMainSub; POSITION pos = m_omListCtrlSignalWatch.GetFirstSelectedItemPosition(); UINT unIndex = m_omListCtrlSignalWatch.GetNextSelectedItem(pos); omMainSub = m_omListCtrlSignalWatch.GetItemText(unIndex,0); if (bGetMainSubName(omMainSub, omMainEntry, omSubEntry) == TRUE) { // Message Name First m_omCSAData.Add(omMainEntry); // Signal Name Next m_omCSAData.Add(omSubEntry); } } // Multiple Selection else { // Disable Details Menu Item pomCtxMenu->EnableMenuItem(IDM_SIGNALDLG_SIGNALDETAILS, MF_DISABLED | MF_GRAYED); } pomCtxMenu->TrackPopupMenu(TPM_RIGHTBUTTON | TPM_LEFTALIGN, point.x, point.y, this); } } } *pResult = 0; }