void CvReplicationPageCollisionViewLeft::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult) { NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR; CaCollisionItem* pItem = NULL; CTreeCtrl& treeCtrl = GetTreeCtrl(); CString strItemText = treeCtrl.GetItemText(pNMTreeView->itemNew.hItem); CfReplicationPageCollision* pFrame = (CfReplicationPageCollision*)GetParentFrame(); ASSERT (pFrame); if (pFrame) { if (pNMTreeView->itemOld.hItem != NULL) { pItem = (CaCollisionItem*)treeCtrl.GetItemData (pNMTreeView->itemOld.hItem); pItem->SetSelected (FALSE); } CvReplicationPageCollisionViewRight* pViewR = (CvReplicationPageCollisionViewRight*)pFrame->GetRightPane(); ASSERT (pViewR); if (pViewR) { pItem = (CaCollisionItem*)treeCtrl.GetItemData (pNMTreeView->itemNew.hItem); pItem->SetSelected (TRUE); pViewR->SendMessage (WM_USER_IPMPAGE_UPDATEING, (WPARAM)pNMTreeView->itemNew.hItem, (LPARAM)pItem); } } *pResult = 0; }
LONG CvReplicationPageCollisionViewRight::OnUpdateData (WPARAM wParam, LPARAM lParam) { HTREEITEM hSelected = (HTREEITEM)wParam; CaCollisionItem* pItem = (CaCollisionItem*)lParam; if (!pItem) { if (m_pDlg && IsWindow (m_pDlg->m_hWnd)) m_pDlg->ShowWindow (SW_HIDE); m_pDlg2->DisplayData (NULL); m_pDlg2->ShowWindow (SW_SHOW); return 0; } m_bTransaction = pItem->IsTransaction(); if (m_bTransaction) { if (m_pDlg && IsWindow (m_pDlg->m_hWnd)) m_pDlg->ShowWindow (SW_HIDE); m_pDlg2->DisplayData ((CaCollisionTransaction*)pItem); m_pDlg2->ShowWindow (SW_SHOW); } else { if (m_pDlg2 && IsWindow (m_pDlg2->m_hWnd)) m_pDlg2->ShowWindow (SW_HIDE); m_pDlg->DisplayData ((CaCollisionSequence*)pItem); m_pDlg->ShowWindow (SW_SHOW); } return 0; }
void CvReplicationPageCollisionViewLeft::CurrentSelectedUpdateImage() { CTreeCtrl& treectrl = GetTreeCtrl(); HTREEITEM hCurrentSelected = treectrl.GetSelectedItem(); if (!hCurrentSelected) return; CaCollisionItem* pItem = (CaCollisionItem*)treectrl.GetItemData(hCurrentSelected); if (pItem) treectrl.SetItemImage (hCurrentSelected, pItem->GetImageType(), pItem->GetImageType()); }
void CvReplicationPageCollisionViewLeft::ResolveCurrentTransaction() { CTreeCtrl& treectrl = GetTreeCtrl(); HTREEITEM hCurrentSelected = treectrl.GetSelectedItem(); if (!hCurrentSelected) return; HTREEITEM hSaveSelected = hCurrentSelected; CaCollisionItem* pItem = (CaCollisionItem*)treectrl.GetItemData(hCurrentSelected); if (!pItem) return; if (!pItem->IsTransaction()) { hCurrentSelected = treectrl.GetParentItem(hCurrentSelected); pItem = (CaCollisionItem*)treectrl.GetItemData(hCurrentSelected); } if (pItem && pItem->IsTransaction()) { CFrameWnd* pParent = (CFrameWnd*)GetParentFrame(); CfIpmFrame* pFrame = (CfIpmFrame*)pParent->GetParentFrame(); ASSERT(pFrame); if (!pFrame) return; CdIpmDoc* pDoc = pFrame->GetIpmDoc(); CaCollisionTransaction* pTrans = (CaCollisionTransaction*)pItem; IPM_ResolveCurrentTransaction(pDoc, pItem); treectrl.SetItemImage (hCurrentSelected, pTrans->GetImageType(), pTrans->GetImageType()); } CfReplicationPageCollision* pFrame = (CfReplicationPageCollision*)GetParentFrame(); ASSERT (pFrame); if (pFrame) { CvReplicationPageCollisionViewRight* pViewR = (CvReplicationPageCollisionViewRight*)pFrame->GetRightPane(); ASSERT (pViewR); if (pViewR) { CaCollisionItem* pItem = (CaCollisionItem*)treectrl.GetItemData (hSaveSelected); pViewR->SendMessage (WM_USER_IPMPAGE_UPDATEING, (WPARAM)hSaveSelected, (LPARAM)pItem); } } }
void CvReplicationPageCollisionViewLeft::OnItemexpanded(NMHDR* pNMHDR, LRESULT* pResult) { NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR; CaCollisionItem* pItem = NULL; CTreeCtrl& treectrl = GetTreeCtrl(); if (pNMTreeView->action & TVE_EXPAND) { pItem = (CaCollisionItem*)treectrl.GetItemData (pNMTreeView->itemNew.hItem); if (pItem) pItem->SetExpanded (TRUE); } else if (pNMTreeView->action & TVE_COLLAPSE) { pItem = (CaCollisionItem*)treectrl.GetItemData (pNMTreeView->itemNew.hItem); if (pItem) pItem->SetExpanded (FALSE); } *pResult = 0; }
BOOL CvReplicationPageCollisionViewLeft::CheckResolveCurrentTransaction() { CTreeCtrl& treectrl = GetTreeCtrl(); HTREEITEM hCurrentSelected = treectrl.GetSelectedItem(); if (!hCurrentSelected) return FALSE; HTREEITEM hSaveSelected = hCurrentSelected; CaCollisionItem* pItem = (CaCollisionItem*)treectrl.GetItemData(hCurrentSelected); if (!pItem) return FALSE; if (!pItem->IsTransaction()) { hCurrentSelected = treectrl.GetParentItem(hCurrentSelected); pItem = (CaCollisionItem*)treectrl.GetItemData(hCurrentSelected); } if (pItem && pItem->IsTransaction()) { CaCollisionTransaction* pTrans = (CaCollisionTransaction*)pItem; CTypedPtrList<CObList, CaCollisionSequence*>& listSeq = pTrans->GetListCollisionSequence(); POSITION pos = listSeq.GetHeadPosition(); while (pos != NULL) { CaCollisionSequence* pSeq = listSeq.GetNext (pos); switch (pSeq->GetImageType()) { case CaCollisionItem::PREVAIL_SOURCE: case CaCollisionItem::PREVAIL_TARGET: break; default: return FALSE; } } return TRUE; } return FALSE; }