void CuListCtrlLoggedEvent::NewUserMessage ( int nPane, UINT nAction, CTreeCtrl* pTree, CaMessageNode* pNodeTarget, CListCtrl* pListCtrl) { if (!m_pEventSettingFrame) m_pEventSettingFrame = (CfEventSetting*)GetParentFrame(); if (!m_pEventSettingFrame) return; CaMessageNodeInfo& nodeInfo = pNodeTarget->GetNodeInformation(); MSGSourceTarget t = nodeInfo.GetMsgSourceTarget(); CaMessage* pNewMessage = NULL; CaMessageNodeTree* pNewMessageNodeTree = NULL; CaLoggedEvent* pMsg = (CaLoggedEvent*)pListCtrl->GetItemData (m_iItemDrag); if (nAction & DD_ACTION_MOVE) { // // Classify the new message and retain its original class: if (NewMessageRetainState (pNodeTarget, pMsg)) { pTree->GetParent()->SendMessage (WMUSRMSG_IVM_PAGE_UPDATING, 0, 0); GetParent()->SendMessage (WMUSRMSG_IVM_PAGE_UPDATING, (WPARAM)pMsg->GetCatType(), (LPARAM)pMsg->GetCode()); } return; } if ((nAction & DD_ACTION_ALERT) || (nAction & DD_ACTION_NOTIFY) || (nAction & DD_ACTION_DISCARD)) NewMessageNewState (pNodeTarget, pMsg, pTree); }
CaLoggedEvent* CuDlgEventSettingBottom::ExistMessage (CaLoggedEvent* pEv, int& nIndex) { int i, nCount = m_cListCtrlGroupBy.GetItemCount(); CaLoggedEvent* pItemData = NULL; for (i=0; i<nCount; i++) { pItemData = (CaLoggedEvent*)m_cListCtrlGroupBy.GetItemData(i); if (pItemData->GetCode() == pEv->GetCode()) { nIndex = i; return pItemData; } } return NULL; }
void CuListCtrlLoggedEvent::OnBegindrag(NMHDR* pNMHDR, LRESULT* pResult) { NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; CPoint p, ptItem, ptAction, ptImage; UINT nFlags; GetCursorPos(&ptAction); p = ptAction; ScreenToClient(&p); m_iItemDrag = HitTest(p, &nFlags); if (!(m_iItemDrag != -1 || (nFlags&TVHT_ONITEM))) { m_iItemDrag = -1; m_bDragging = FALSE; return; } if (!m_pEventSettingFrame) m_pEventSettingFrame = (CfEventSetting*)GetParentFrame(); CvEventSettingBottom* pBottomView= m_pEventSettingFrame->GetBottomView(); CListCtrl* pListCtrl = pBottomView->GetListCtrl();; CaLoggedEvent* pMsg = (CaLoggedEvent*)pListCtrl->GetItemData (m_iItemDrag); if (pMsg->IsNotFirstLine()) { m_iItemDrag = -1; m_bDragging = FALSE; return; } ASSERT(!m_bDragging); m_bDragging = TRUE; ASSERT(m_pImageListDrag == NULL); m_pImageListDrag = CreateDragImage(m_iItemDrag, &ptImage); GetItemPosition(m_iItemDrag, &ptItem); // ptItem is relative to (0,0) and not the view origin m_sizeDelta = ptAction - ptImage; // difference between cursor pos and image pos m_ptHotSpot = ptAction - ptItem + m_ptOrigin; // calculate hotspot for the cursor m_pImageListDrag->DragShowNolock(TRUE); // lock updates and show drag image m_pImageListDrag->SetDragCursorImage(0, CPoint(0, 0) /*m_ptHotSpot*/); // define the hot spot for the new cursor image m_pImageListDrag->BeginDrag(0, CPoint(0, 0)); m_pImageListDrag->DragEnter(/*this*/GetParentFrame(), ptAction); m_pImageListDrag->DragMove(ptAction); // move image to overlap original icon SetCapture(); }
void CuDlgEventSettingBottom::ShowMessageDescriptionFrame(NMLISTVIEW* pNMListView, CuListCtrlLoggedEvent* pCtrl, BOOL bCreate, BOOL bUpdate) { if (!pCtrl) return; if (!IsWindow(pCtrl->m_hWnd)) return; int nPos = -1; if (bUpdate) { int i, nCount = pCtrl->GetItemCount(); for (i=0; i<nCount; i++) { if (pCtrl->GetItemState (i, LVIS_SELECTED)&LVIS_SELECTED) { nPos = i; break; } } } else { if (pNMListView) nPos = pNMListView->iItem; } if (nPos >= 0 && (pCtrl->GetItemState (nPos, LVIS_SELECTED)&LVIS_SELECTED)) { CfMainFrame* pFmain = (CfMainFrame*)AfxGetMainWnd(); if (pFmain) { CaLoggedEvent* pEvent = (CaLoggedEvent*)pCtrl->GetItemData(nPos); if (!pEvent) return; MSGCLASSANDID msg; msg.lMsgClass = pEvent->GetCatType(); msg.lMsgFullID= pEvent->GetCode(); pFmain->ShowMessageDescriptionFrame(bCreate, &msg); } } }
void CuDlgEventSettingBottom::OnSelchangeComboIngresCategory() { CWaitCursor doWaitcursor; int nRadio = GetCheckedRadioButton (IDC_RADIO1, IDC_RADIO2); if (nRadio != IDC_RADIO2) return; int nSel = m_cComboIngresCategory.GetCurSel(); if (nSel == CB_ERR) return; CaMessageEntry* pEntry = (CaMessageEntry*)m_cComboIngresCategory.GetItemData (nSel); if (!pEntry) return; CfEventSetting* pFrame = (CfEventSetting*)GetParentFrame(); ASSERT (pFrame); if (!pFrame) return; CaMessageManager* pMessageManager = pFrame->GetMessageManager(); if (!pMessageManager) return; CListCtrl* pListCtrl = &m_cListCtrlIngres; CTypedPtrList<CObList, CaLoggedEvent*> lsMsg; BOOL bOk = IVM_QueryIngresMessage (pEntry, lsMsg); if (!(bOk && pListCtrl)) return; CleanListMessage(pListCtrl); CaMessage* pMsg = NULL; POSITION pos = lsMsg.GetHeadPosition(); if (lsMsg.GetCount() > 100) pListCtrl->SetItemCount ((int)lsMsg.GetCount()); while (!lsMsg.IsEmpty()) { CaLoggedEvent* pObj = lsMsg.RemoveHead(); pMsg = IVM_LookupMessage (pObj->GetCatType(), pObj->GetCode(), pMessageManager); if (pMsg) pObj->SetClass (pMsg->GetClass()); else pObj->SetClass (pEntry->GetClass()); pObj->SetClassify(pMsg? TRUE: FALSE); AddEventToIngresMessage (pObj); } EnableButtonFind(); }
void CuDlgEventSettingBottom::ClassifyIngresMessages(long lCat, long lCode) { int nImage = 0; CListCtrl* pCtrl = &m_cListCtrlIngres; if (!pCtrl) return; CfEventSetting* pFrame = (CfEventSetting*)GetParentFrame(); ASSERT (pFrame); if (!pFrame) return; CaMessageManager* pMessageManager = pFrame->GetMessageManager(); if (!pMessageManager) return; Imsgclass nc = IMSG_NOTIFY; BOOL bAll = (lCat == -1)? TRUE: FALSE; LV_ITEM item; memset (&item, 0, sizeof(item)); item.mask = LVIF_IMAGE; CaLoggedEvent* pMsg = NULL; CaMessage* pMsgState = NULL; int i, nCount = pCtrl->GetItemCount(); for (i=0; i<nCount; i++) { pMsg = (CaLoggedEvent*)pCtrl->GetItemData (i); if (!bAll) { if (pMsg->GetCatType() != lCat) continue; if (pMsg->GetCode() != lCode) continue; } item.iItem = i; pMsgState = IVM_LookupMessage (pMsg->GetCatType(), pMsg->GetCode(), pMessageManager); if (!pMsgState) { pMsg->SetClassify(FALSE); nc = IMSG_NOTIFY; } else { pMsg->SetClassify(TRUE); nc = pMsgState->GetClass(); } pMsg->SetClass(nc); switch (nc) { case IMSG_ALERT: item.iImage = pMsg->IsClassified()? IM_ALERT: IM_ALERT_U; break; case IMSG_NOTIFY: item.iImage = pMsg->IsClassified()? IM_NOTIFY: IM_NOTIFY_U; break; case IMSG_DISCARD: item.iImage = pMsg->IsClassified()? IM_DISCARD: IM_DISCARD_U; break; } pCtrl->SetItem (&item); } }
void CuDlgEventSettingBottom::ClassifyMessages(long lCat, long lCode, BOOL bActualMessage) { int nImage = 0; CfEventSetting* pFrame = (CfEventSetting*)GetParentFrame(); ASSERT (pFrame); if (!pFrame) return; CaMessageManager* pMessageManager = pFrame->GetMessageManager(); if (!pMessageManager) return; Imsgclass nc = IMSG_NOTIFY; BOOL bAll = (lCat == -1)? TRUE: FALSE; LV_ITEM item; memset (&item, 0, sizeof(item)); item.mask = LVIF_IMAGE; CaLoggedEvent* pMsg = NULL; CaMessage* pMsgState = NULL; BOOL bLookUp = FALSE; CaIvmEvent& loggedEvent = theApp.GetEventData(); CTypedPtrList<CObList, CaLoggedEvent*>& le = loggedEvent.Get(); POSITION pos = le.GetHeadPosition(); while (pos != NULL) { CaLoggedEvent* pEv = le.GetNext (pos); if (!bAll) { if (pEv->GetCatType() != lCat) continue; if (pEv->GetCode() != lCode) continue; if (!bLookUp) { pMsgState = IVM_LookupMessage (lCat, lCode, pMessageManager); bLookUp = TRUE; } } else { pMsgState = IVM_LookupMessage (pEv->GetCatType(), pEv->GetCode(), pMessageManager); } if (!pMsgState) { pEv->SetClassify (FALSE); pEv->SetClass (IMSG_NOTIFY); } else { pEv->SetClassify (TRUE); pEv->SetClass (pMsgState->GetClass()); } } int i, nCount = m_cListCtrlGroupBy.GetItemCount(); for (i=0; i<nCount; i++) { pMsg = (CaLoggedEvent*)m_cListCtrlGroupBy.GetItemData (i); if (!bAll) { if (pMsg->GetCatType() != lCat) continue; if (pMsg->GetCode() != lCode) continue; } item.iItem = i; nc = pMsg->GetClass(); switch (nc) { case IMSG_ALERT: item.iImage = pMsg->IsClassified()? IM_ALERT: IM_ALERT_U; break; case IMSG_NOTIFY: item.iImage = pMsg->IsClassified()? IM_NOTIFY: IM_NOTIFY_U; break; case IMSG_DISCARD: item.iImage = pMsg->IsClassified()? IM_DISCARD: IM_DISCARD_U; break; } m_cListCtrlGroupBy.SetItem (&item); } nCount = m_cListCtrlFullDesc.GetItemCount(); for (i=0; i<nCount; i++) { pMsg = (CaLoggedEvent*)m_cListCtrlFullDesc.GetItemData (i); if (!bAll) { if (pMsg->GetCatType() != lCat) continue; if (pMsg->GetCode() != lCode) continue; } item.iItem = i; nc = pMsg->GetClass(); switch (nc) { case IMSG_ALERT: item.iImage = pMsg->IsClassified()? IM_ALERT: IM_ALERT_U; break; case IMSG_NOTIFY: item.iImage = pMsg->IsClassified()? IM_NOTIFY: IM_NOTIFY_U; break; case IMSG_DISCARD: item.iImage = pMsg->IsClassified()? IM_DISCARD: IM_DISCARD_U; break; } m_cListCtrlFullDesc.SetItem (&item); } }
void CuDlgEventSettingBottom::HandleActualMessage() { CWaitCursor doWaitCursor; CfEventSetting* pFrame = (CfEventSetting*)GetParentFrame(); ASSERT (pFrame); if (!pFrame) return; CaMessageEntry* pEntry = NULL; CaMessageManager* pMessageManager = pFrame->GetMessageManager(); if (!pMessageManager) return; ResizeControls(); EnableControls(); int nGroup = m_cGroupByMessageID.GetCheck(); if (m_nCurrentGroup == nGroup) return; m_nCurrentGroup = nGroup; int nIndex; Imsgclass nClass; CaLoggedEvent* pExistMessage = NULL; CaMessage* pMsg; CaLoggedEvent* pEv; CaIvmEvent& loggedEvent = theApp.GetEventData(); CTypedPtrList<CObList, CaLoggedEvent*>& le = loggedEvent.Get(); POSITION pos = le.GetHeadPosition(); // // Group by: BOOL bGroupBy = FALSE; if (m_nCurrentGroup == 1) { bGroupBy = TRUE; // // Messages have been queried and ready to be used: if (m_bActualMessageGroup) return; // // Initialize the Group Message: m_bActualMessageGroup = TRUE; m_cListCtrlGroupBy.LockWindowUpdate(); while (pos != NULL) { pEv = le.GetNext (pos); pEv->SetClassify(FALSE); // // Check to see if the list of Group By Event containts already // an event whose m_lCode = pEv->m_lCode. // If exist, just increase the count number !! pExistMessage = ExistMessage (pEv, nIndex); if (pExistMessage) { int iCount,iCountExtra; CString strCount; iCount = pExistMessage->GetCount(); iCountExtra = pExistMessage->GetExtraCount(); if (pEv->IsNotFirstLine()) { iCountExtra++; pExistMessage->SetExtraCount(iCountExtra); } else { iCount++; pExistMessage->SetCount(iCount); } if (iCountExtra == 0) strCount.Format (_T("%d"),iCount); else strCount.Format (_T("%d(+%d)"),iCount,iCountExtra); m_cListCtrlGroupBy.SetItemText (nIndex, 1, strCount); continue; } // // The event has not been yet added to the list of Group By Event. // Mark this event as classified or not due to the Entry of Message Manager: pEntry = pMessageManager->FindEntry (pEv->GetCatType()); ASSERT (pEntry); if (!pEntry) continue; pMsg = pEntry->Search(pEv->GetCode()); nClass = pEv->GetClass(); if (pMsg) pEv->SetClass (pMsg->GetClass()); else pEv->SetClass (pEntry->GetClass()); pEv->SetClassify(pMsg? TRUE: FALSE); if (pEv->IsNotFirstLine()) { pEv->SetCount(0); pEv->SetExtraCount(1); } else { pEv->SetCount(1); pEv->SetExtraCount(0); } AddEventToGroupByList(pEv); } m_cListCtrlGroupBy.SortItems(CompareSubItem, (LPARAM)&m_sortListCtrl3); m_cListCtrlGroupBy.UnlockWindowUpdate(); } // // Full description: if (m_nCurrentGroup != 1) { // // Messages have been queried and ready to be used: if (m_bActualMessageAll) return; // // Initialize the Full Description Message: m_bActualMessageAll = TRUE; if (!m_listLoggedEvent.IsEmpty()) m_listLoggedEvent.RemoveAll(); loggedEvent.GetAll (m_listLoggedEvent); INT_PTR nCount = m_listLoggedEvent.GetCount(); pos = m_listLoggedEvent.GetHeadPosition(); while (pos != NULL) { pEv = m_listLoggedEvent.GetNext (pos); pEv->SetClassify(FALSE); // // The event has not been yet added to the list of Group By Event. // Mark this event as classified or not due to the Entry of Message Manager: pEntry = pMessageManager->FindEntry (pEv->GetCatType()); ASSERT (pEntry); if (!pEntry) continue; pMsg = pEntry->Search(pEv->GetCode()); nClass = pEv->GetClass(); if (pMsg) pEv->SetClass (pMsg->GetClass()); else pEv->SetClass (pEntry->GetClass()); pEv->SetClassify(pMsg? TRUE: FALSE); } int nCountPerPage = m_cListCtrlFullDesc.GetCountPerPage(); if (nCount < theApp.GetScrollManagementLimit()) { m_cListCtrlFullDesc.SetListCtrlScrollManagement(FALSE); m_cVerticalScroll.SetScrollRange (0, 0); } else { m_cListCtrlFullDesc.SetListCtrlScrollManagement(TRUE); m_cVerticalScroll.SetScrollRange (0, 0); } ResizeControls(); EnableControls(); m_cVerticalScroll.SetListCtrl (&m_cListCtrlFullDesc); m_cVerticalScroll.SetScrollRange (0, (int)(nCount - nCountPerPage)); m_cVerticalScroll.SetScrollPos (0); m_cListCtrlFullDesc.SetListEvent(&m_listLoggedEvent); m_cListCtrlFullDesc.InitializeItems (GLAYOUT_NUMBER); } EnableButtonFind(); }