void CvIpmLeft::OnItemexpanding(NMHDR* pNMHDR, LRESULT* pResult) { CTreeCtrl& tree = GetTreeCtrl(); *pResult = 0; // default to allow expanding CdIpmDoc* pDoc = (CdIpmDoc*)GetDocument(); ASSERT(pDoc); if (!pDoc) return; // Manage "update all after load on first action" if (pDoc->GetPTreeGD()->CurrentlyLoading()) return; if (pDoc->ManageMonSpecialState() || m_bProhibitActionOnTreeCtrl) { *pResult = 1; // do not allow expanding return; } NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR; if (pNMTreeView->action == TVE_EXPAND) { HTREEITEM hItem = pNMTreeView->itemNew.hItem; CTreeItem *pItem; pItem = (CTreeItem *)tree.GetItemData(hItem); if (pItem && !pItem->IsAlreadyExpanded()) { if (pItem->CreateSubBranches(hItem)) pItem->SetAlreadyExpanded(TRUE); else *pResult = 1; // prevent expanding } } }
void CvIpmLeft::OnMenuReplicationChangeRunNode() { CdIpmDoc* pDoc = (CdIpmDoc *)GetDocument(); ASSERT(pDoc); if (!pDoc) return; pDoc->ItemReplicationServerChangeNode(); }
void CvIpmLeft::OnMenuForceRefresh() { CdIpmDoc* pDoc = (CdIpmDoc *)GetDocument(); ASSERT(pDoc); if (!pDoc) return; pDoc->ForceRefresh(); }
void CvIpmLeft::OnMenuOpenServer() { CdIpmDoc* pDoc = (CdIpmDoc *)GetDocument(); ASSERT(pDoc); if (!pDoc) return; pDoc->ItemOpenServer(); }
void CvIpmLeft::OnMenuShutdown() { CdIpmDoc* pDoc = (CdIpmDoc *)GetDocument(); ASSERT(pDoc); if (!pDoc) return; pDoc->ItemShutdown(); }
void CvIpmLeft::OnUpdateMenuReplicationChangeRunNode(CCmdUI* pCmdUI) { CdIpmDoc* pDoc = (CdIpmDoc *)GetDocument(); ASSERT(pDoc); if (!pDoc) return; BOOL bEnable = pDoc->IsEnabledItemReplicationServerChangeNode(); pCmdUI->Enable(bEnable); }
void CvIpmLeft::OnUpdateMenuShutdown(CCmdUI* pCmdUI) { CdIpmDoc* pDoc = (CdIpmDoc *)GetDocument(); ASSERT(pDoc); if (!pDoc) return; BOOL bEnable = pDoc->IsEnabledItemShutdown(); pCmdUI->Enable(bEnable); }
BOOL CIpmCtrl::Initiate(LPCTSTR lpszNode, LPCTSTR lpszServer, LPCTSTR lpszUser, LPCTSTR lpszOption) { BOOL bOK = FALSE; if (m_pIpmFrame) { m_pIpmFrame->ShowWindow (SW_HIDE); m_pIpmFrame->DestroyWindow(); m_pIpmFrame = NULL; } CWnd* pParent = this; CRect r; GetClientRect (r); m_pIpmFrame = new CfIpmFrame(); m_pIpmFrame->Create ( NULL, NULL, WS_CHILD, r, pParent); m_pIpmFrame->InitialUpdateFrame(NULL, TRUE); m_pIpmFrame->ShowWindow(SW_HIDE); CdIpmDoc* pDoc = m_pIpmFrame->GetIpmDoc(); ASSERT(pDoc); if (pDoc) { CaIpmProperty& property = pDoc->GetProperty(); ConstructPropertySet (property); UINT nMask = IPMMASK_TIMEOUT|IPMMASK_BKREFRESH|IPMMASK_SHOWGRID|IPMMASK_FONT|IPMMASK_MAXSESSION; IPM_PropertiesChange((WPARAM)nMask, (LPARAM)&property); theApp.SetRefreshFrequency(m_refreshFrequency); theApp.SetActivateBkRefresh(m_activateRefresh); theApp.StartBackgroundRefreshThread(); } ASSERT(m_pIpmFrame); // Must create the window first if (!m_pIpmFrame) return FALSE; if (pDoc) { SFILTER* pFilter = theApp.GetFilter(); SFILTER* pDocFilter = pDoc->GetFilter(); memcpy (pDocFilter, pFilter, sizeof(SFILTER)); bOK = pDoc->Initiate(lpszNode, lpszServer, lpszUser, lpszOption); } if (!bOK) { m_pIpmFrame->ShowWindow (SW_HIDE); m_pIpmFrame->DestroyWindow(); m_pIpmFrame = NULL; return bOK; } m_pIpmFrame->ShowWindow(SW_SHOW); return bOK; }
void CIpmCtrl::CollapseOne() { ASSERT(m_pIpmFrame); // Must create the window first if (!m_pIpmFrame) return; CdIpmDoc* pDoc = m_pIpmFrame->GetIpmDoc(); ASSERT(pDoc); if (pDoc) pDoc->ItemCollapseOne(); }
void CIpmCtrl::ExpandBranch() { ASSERT(m_pIpmFrame); // Must create the window first if (!m_pIpmFrame) return; CdIpmDoc* pDoc = m_pIpmFrame->GetIpmDoc(); ASSERT(pDoc); if (pDoc) pDoc->ItemExpandBranch(); }
void CvIpmLeft::OnDestroy() { CdIpmDoc* pDoc = (CdIpmDoc *)GetDocument(); ASSERT(pDoc); // delete itemdata associated with each item pDoc->GetPTreeGD()->FreeAllTreeItemsData(); // standard management CTreeView::OnDestroy(); }
BOOL CIpmCtrl::IsEnabledCloseServer() { ASSERT(m_pIpmFrame); // Must create the window first if (!m_pIpmFrame) return FALSE; CdIpmDoc* pDoc = m_pIpmFrame->GetIpmDoc(); ASSERT(pDoc); if (!pDoc) return FALSE; return pDoc->IsEnabledItemCloseServer(); }
BOOL CIpmCtrl::InactiveTransaction(short bSet) { ASSERT(m_pIpmFrame); // Must create the window first if (!m_pIpmFrame) return FALSE; CdIpmDoc* pDoc = m_pIpmFrame->GetIpmDoc(); ASSERT(pDoc); if (!pDoc) return FALSE; return pDoc->FilterChange(FILTER_INACTIVE_TRANSACTIONS, (BOOL)bSet); }
BOOL CIpmCtrl::SystemLockList(short bSet) { ASSERT(m_pIpmFrame); // Must create the window first if (!m_pIpmFrame) return FALSE; CdIpmDoc* pDoc = m_pIpmFrame->GetIpmDoc(); ASSERT(pDoc); if (!pDoc) return FALSE; return pDoc->FilterChange(FILTER_SYSTEM_LOCK_LISTS, (BOOL)bSet); }
BOOL CIpmCtrl::InternalSession(short bSet) { ASSERT(m_pIpmFrame); // Must create the window first if (!m_pIpmFrame) return FALSE; CdIpmDoc* pDoc = m_pIpmFrame->GetIpmDoc(); ASSERT(pDoc); if (!pDoc) return FALSE; return pDoc->FilterChange(FILTER_INTERNAL_SESSIONS, (BOOL)bSet); }
BOOL CIpmCtrl::NullResource(short bSet) { ASSERT(m_pIpmFrame); // Must create the window first if (!m_pIpmFrame) return FALSE; CdIpmDoc* pDoc = m_pIpmFrame->GetIpmDoc(); ASSERT(pDoc); if (!pDoc) return FALSE; return pDoc->FilterChange(FILTER_NULL_RESOURCES, (BOOL)bSet); }
void CIpmCtrl::SearchItem() { ASSERT(m_pIpmFrame); // Must create the window first if (!m_pIpmFrame) return; CdIpmDoc* pDoc = m_pIpmFrame->GetIpmDoc(); ASSERT(pDoc); if (!pDoc) return; pDoc->SearchItem(); }
BOOL CIpmCtrl::ForceRefresh() { ASSERT(m_pIpmFrame); // Must create the window first if (!m_pIpmFrame) return FALSE; CdIpmDoc* pDoc = m_pIpmFrame->GetIpmDoc(); ASSERT(pDoc); if (!pDoc) return FALSE; return pDoc->ForceRefresh(); }
BOOL CIpmCtrl::IsEnabledReplicationChangeNode() { ASSERT(m_pIpmFrame); // Must create the window first if (!m_pIpmFrame) return FALSE; CdIpmDoc* pDoc = m_pIpmFrame->GetIpmDoc(); ASSERT(pDoc); if (!pDoc) return FALSE; return pDoc->IsEnabledItemReplicationServerChangeNode(); }
BOOL CIpmCtrl::ResourceTypeChange(short nResType) { ASSERT(m_pIpmFrame); // Must create the window first if (!m_pIpmFrame) return FALSE; CdIpmDoc* pDoc = m_pIpmFrame->GetIpmDoc(); ASSERT(pDoc); if (!pDoc) return FALSE; return pDoc->ResourceTypeChange(nResType); }
void CIpmCtrl::ProhibitActionOnTreeCtrl(short nYes) { BOOL bProhibit = (BOOL)nYes; ASSERT(m_pIpmFrame); // Must create the window first if (!m_pIpmFrame) return; CdIpmDoc* pDoc = m_pIpmFrame->GetIpmDoc(); ASSERT(pDoc); if (!pDoc) return; pDoc->ProhibitActionOnTreeCtrl(bProhibit); }
BOOL CuDlgReplicationStaticPageCollision::OnInitDialog() { CDialog::OnInitDialog(); m_cEdit1.ShowWindow (SW_HIDE); try { CRect r; GetClientRect (r); m_pFrameLayout = new CfReplicationPageCollision (); m_pFrameLayout->Create ( NULL, NULL, WS_CHILD, r, this); m_pFrameLayout->InitialUpdateFrame(NULL, FALSE); if (m_pFrameLayout && IsWindow (m_pFrameLayout->m_hWnd)) { CvReplicationPageCollisionViewLeft* pView = (CvReplicationPageCollisionViewLeft*)m_pFrameLayout->GetLeftPane(); ASSERT (pView); if (pView) { CfIpmFrame* pIpmFrame = (CfIpmFrame*)GetParentFrame(); ASSERT(pIpmFrame); if (pIpmFrame) { CdIpmDoc* pIpmDoc = (CdIpmDoc*)pIpmFrame->GetIpmDoc(); if (pIpmDoc) { CTreeCtrl& treeCtrl = pView->GetTreeCtrl(); CaIpmProperty& property = pIpmDoc->GetProperty(); treeCtrl.SetFont (CFont::FromHandle(property.GetFont())); } } } } } catch (CMemoryException* e) { theApp.OutOfMemoryMessage(); e->Delete(); } catch (...) { if (m_pFrameLayout) m_pFrameLayout->DestroyWindow(); m_pFrameLayout = NULL; TRACE0 ("Cannot allocate frame (collision page new design)\n"); } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL CuDlgIpmTabCtrl::ChangeTab() { int nSel; CRect r; CWnd* pNewPage; CuPageInformation* pPageInfo; CWnd* pParent1 = GetParent(); // The view: CImView2 ASSERT (pParent1); CfIpmFrame* pFrame = (CfIpmFrame*)GetParentFrame(); // The Frame Window ASSERT (pFrame); CdIpmDoc* pDoc = (CdIpmDoc*)((CView*)pParent1)->GetDocument(); ASSERT (pDoc); if (!pFrame->IsAllViewCreated()) return FALSE; if (!m_pCurrentProperty) return FALSE; CWaitCursor doWaitCursor; m_cTab1.GetClientRect (r); m_cTab1.AdjustRect (FALSE, r); nSel = m_cTab1.GetCurSel(); m_pCurrentProperty->SetCurSel(nSel); pPageInfo = m_pCurrentProperty->GetPageInfo(); try { pNewPage = GetPage (pPageInfo->GetDlgID (nSel)); } catch (CMemoryException* e) { theApp.OutOfMemoryMessage(); e->Delete(); return FALSE; } catch (CResourceException* e) { AfxMessageBox (IDS_E_LOAD_RESOURCE);//"Fail to load resource" e->Delete(); return FALSE; } if (m_pCurrentPage) m_pCurrentPage->ShowWindow (SW_HIDE); m_pCurrentPage = pNewPage; m_pCurrentPage->MoveWindow (r); m_pCurrentPage->ShowWindow(SW_SHOW); // // Properties: UINT nMask = IPMMASK_FONT|IPMMASK_SHOWGRID; m_pCurrentPage->SendMessage (WMUSRMSG_CHANGE_SETTING, (WPARAM)nMask, (LPARAM)&(pDoc->GetProperty())); // // Update Data: m_pCurrentPage->SendMessage (WM_USER_IPMPAGE_UPDATEING, (WPARAM)pDoc, (LPARAM)pPageInfo->GetUpdateParam()); return TRUE; }
void CvIpmLeft::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) { CdIpmDoc* pDoc = (CdIpmDoc*)GetDocument(); ASSERT (pDoc); if (!pDoc) return; CaIpmProperty& property = pDoc->GetProperty(); BOOL bSetToDefaultPercentage = FALSE; //UKS BOOL bRegularStaticSet = TRUE; int nHint = (int)lHint; switch (nHint) { case 1: // Invoked by CdIpmDoc::Initiate() GetTreeCtrl().SendMessage (WM_SETFONT, (WPARAM)property.GetFont(), MAKELPARAM(TRUE, 0)); if (bSetToDefaultPercentage) { CRect rcClient; CfIpmFrame* pFrame = (CfIpmFrame*)GetParentFrame(); ASSERT (pFrame); CSplitterWnd* pSplit = (CSplitterWnd *)pFrame->GetSplitterWnd(); ASSERT (pSplit); pFrame->GetClientRect (rcClient); pSplit->SetColumnInfo(0, (int) (0.4 * (double)rcClient.Width()), 10); pSplit->RecalcLayout(); } // Create regular static set, if needed if (bRegularStaticSet) { CuTMServerStatic *pItem1 = new CuTMServerStatic (pDoc->GetPTreeGD()); CuTMLockinfoStatic *pItem3 = new CuTMLockinfoStatic (pDoc->GetPTreeGD()); CuTMLoginfoStatic *pItem4 = new CuTMLoginfoStatic (pDoc->GetPTreeGD()); CuTMAllDbStatic *pItem5 = new CuTMAllDbStatic (pDoc->GetPTreeGD()); CuTMActiveUsrStatic *pItem6 = new CuTMActiveUsrStatic(pDoc->GetPTreeGD()); CuTMReplAllDbStatic *pItem7 = new CuTMReplAllDbStatic(pDoc->GetPTreeGD()); HTREEITEM hItem1 = pItem1->CreateTreeLine(); HTREEITEM hItem2 = pItem3->CreateTreeLine(); HTREEITEM hItem3 = pItem4->CreateTreeLine(); HTREEITEM hItem4 = pItem5->CreateTreeLine(); HTREEITEM hItem5 = pItem6->CreateTreeLine(); HTREEITEM hItem6 = pItem7->CreateTreeLine(); ASSERT (hItem1 && hItem2 && hItem3 && hItem4 && hItem5 && hItem6); CTreeCtrl& cTree = GetTreeCtrl(); cTree.SelectItem(hItem1); } break; default: break; } }
SCODE CIpmCtrl::Storing(LPUNKNOWN FAR* ppStream) { ASSERT(m_pIpmFrame); // Must create the window first if (!m_pIpmFrame) return S_FALSE; CdIpmDoc* pDoc = m_pIpmFrame->GetIpmDoc(); ASSERT(pDoc); if (!pDoc) return S_FALSE; IStream* pSream = NULL; BOOL bOK = pDoc->GetData(&pSream); *ppStream = (LPUNKNOWN)pSream; return bOK? S_OK: S_FALSE; }
SCODE CIpmCtrl::Loading(LPUNKNOWN pStream) { // // 1) Destroy the old frame first: // m_pIpmFrame->ShowWindow (SW_HIDE) // m_pIpmFrame->DestroyWindow(); // delete m_pIpmFrame ? // 2) Construct the Document from Stream. // CdIpmDoc* pLoadedDoc = new CdIpmDoc(); // pLoadedDoc->SetData(pSream); // 3) Create new Frame associated with the new Doc // m_pIpmFrame = new CfIpmFrame (pLoadedDoc); // m_pIpmFrame->Create (...) // ... // m_pIpmFrame->ShowWindow (SW_SHOW) if (m_pIpmFrame && IsWindow(m_pIpmFrame->m_hWnd)) { m_pIpmFrame->ShowWindow (SW_HIDE); m_pIpmFrame->DestroyWindow(); m_pIpmFrame = NULL; } CdIpmDoc* pDoc = new CdIpmDoc(); IStream* pSream = (IStream*)pStream; BOOL bOK = pDoc->SetData(pSream); if (!bOK) { delete pDoc; return S_FALSE; } CaIpmProperty& property = pDoc->GetProperty(); ConstructPropertySet (property); CWnd* pParent = this; CRect r; GetWindowRect (r); m_pIpmFrame = new CfIpmFrame(pDoc); m_pIpmFrame->Create ( NULL, NULL, WS_CHILD, r, pParent); m_pIpmFrame->InitialUpdateFrame(pDoc, TRUE); m_pIpmFrame->ShowWindow(SW_SHOW); return bOK? S_OK: S_FALSE; }
void CuDlgIpmDetailNetTrafic::OnButtonStartup() { m_cEditTimeStamp.SetWindowText("Startup"); m_bStartup = TRUE; if (m_bRefresh) { CWnd* pParent1 = GetParentFrame(); // Frame of CFormView CfIpmFrame* pParent2 = (CfIpmFrame*)pParent1->GetParentFrame(); CdIpmDoc* pDoc = pParent2->GetIpmDoc(); if (pDoc) { if (!pDoc->ManageMonSpecialState()) pDoc->ForceRefresh(); } } UpdateData(FALSE); }
void CvIpmLeft::OnInitialUpdate() { CTreeView::OnInitialUpdate(); CdIpmDoc* pDoc = (CdIpmDoc *)GetDocument(); ASSERT(pDoc); CTreeCtrl &tree = GetTreeCtrl(); pDoc->GetPTreeGD()->SetPTree(&tree); CaIpmProperty& property = pDoc->GetProperty(); tree.SendMessage (WM_SETFONT, (WPARAM)property.GetFont(), MAKELPARAM(TRUE, 0)); if (pDoc->IsLoadedDoc()) { // // Recreate tree lines from serialization data pDoc->GetPTreeGD()->FillTreeFromSerialList(); } }
void CIpmCtrl::NotifySettingChange(UINT nMask) { FirePropertyChange(); if (m_pIpmFrame && IsWindow (m_pIpmFrame->m_hWnd)) { CdIpmDoc* pDoc = m_pIpmFrame->GetIpmDoc(); ASSERT(pDoc); if (pDoc) { CaIpmProperty& property = pDoc->GetProperty(); ConstructPropertySet (property); m_pIpmFrame->PostMessage(WMUSRMSG_CHANGE_SETTING, (WPARAM)nMask, (LPARAM)&property); } return; } CaIpmProperty property; ConstructPropertySet (property); IPM_PropertiesChange((WPARAM)nMask, (LPARAM)&property); }
void CvIpmLeft::OnRButtonDown(UINT nFlags, CPoint point) { CTreeCtrl& tree = GetTreeCtrl(); if (m_bProhibitActionOnTreeCtrl) { CTreeView::OnRButtonDown(nFlags, point); return; } HTREEITEM hHit = tree.HitTest (point, &nFlags); if (hHit) tree.SelectItem(hHit); CTreeView::OnRButtonDown(nFlags, point); // popup menu if (hHit) { CdIpmDoc* pDoc = (CdIpmDoc *)GetDocument(); ASSERT(pDoc); if (!pDoc) return; // get menu id according to current menuitem UINT menuId = pDoc->GetPTreeGD()->GetContextMenuId(); if (!menuId) return; // load menu CMenu menu; BOOL bSuccess = menu.LoadMenu (menuId); // Note : DestroyMenu automatic in CMenu destructor ASSERT (bSuccess); if (!bSuccess) return; CMenu* pPopup = menu.GetSubMenu(0); ASSERT(pPopup != NULL); CfIpmFrame* pFrame = (CfIpmFrame*)GetParent()->GetParent(); // 2 levels due to splitter wnd ASSERT (pFrame); CWnd* pWndPopupOwner = pFrame; ClientToScreen(&point); pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, pWndPopupOwner); } }