Exemple #1
0
void CMainFrame::OnRegRightFlush() 
{
	CTreeCtrl * pList = &pRegTreeView->GetTreeCtrl();
	HTREEITEM hItem = pList->GetSelectedItem();
	if(hItem == NULL) return;
	PostMessage(WM_REGLEFTDBCLICK,(WPARAM) hItem,NULL);
}
void TreeDlg::OnExpandOrCollapse() {
  CTreeCtrl *ctrl = getTreeCtrl();
  HTREEITEM item = ctrl->GetSelectedItem();
  UINT state;
  if((state = ctrl->GetItemState(item, TVIS_EXPANDED)) & TVIS_EXPANDED) {
    OnCollapse();
  } else {
    OnExpand();
  }
}
void CSiteView::OnAddRecorder()
{
	CTreeCtrl* pWndTree = (CTreeCtrl*)&m_wndSiteView;
	HTREEITEM hTreeItem = pWndTree->GetSelectedItem();
	SITE_T * site = (SITE_T*)pWndTree->GetItemData(hTreeItem);

	RecorderDlg dlg(site->uuid);
	dlg.DoModal();
	FillSiteView();
}
void CSiteView::OnRemoveRecorder()
{
	CTreeCtrl* pWndTree = (CTreeCtrl*)&m_wndSiteView;
	HTREEITEM hTreeItem = pWndTree->GetSelectedItem();
	RECORDER_T * recorder = (RECORDER_T*)pWndTree->GetItemData(hTreeItem);

	RecorderDAO recorderDao;
	recorderDao.DeleteRecorder(recorder->parent, recorder);

	FillSiteView();
}
void CSiteView::OnRemoveSite()
{
	CTreeCtrl* pWndTree = (CTreeCtrl*)&m_wndSiteView;
	HTREEITEM hTreeItem = pWndTree->GetSelectedItem();
	SITE_T * site = (SITE_T*)pWndTree->GetItemData(hTreeItem);

	SiteDAO siteDao;
	siteDao.DeleteSite(site);

	FillSiteView();
}
Exemple #6
0
CTreeItem* CdIpmDoc::GetSelectedTreeItem()
{
	CTreeCtrl* pTree = m_pTreeGD->GetPTree();
	HTREEITEM hItem  = pTree->GetSelectedItem();
	if (hItem) 
	{
		CTreeItem* pItem = (CTreeItem*)pTree->GetItemData(hItem);
		return pItem;
	}
	return NULL;
}
void CSiteView::OnPlayRelay()
{
	CFrameWnd * pFrame = (CFrameWnd *)(AfxGetApp()->m_pMainWnd);
	CHTRecorderManagerView * videoView = (CHTRecorderManagerView*)pFrame->GetActiveView();
	if (videoView)
	{
		CTreeCtrl* pWndTree = (CTreeCtrl*)&m_wndSiteView;
		HTREEITEM hTreeItem = pWndTree->GetSelectedItem();
		CAMERA_T * camera = (CAMERA_T*)pWndTree->GetItemData(hTreeItem);
		
		videoView->StartRelay(camera->parent->uuid, camera->parent->address, camera->parent->username, camera->parent->pwd, camera->uuid, camera->key, 0);
	}
}
Exemple #8
0
void CMainFrame::OnUpdateRegRightDelete(CCmdUI* pCmdUI) 
{
	BOOL IsEnable = FALSE;
	int nItem = -1;
	CTreeCtrl * pList = &pRegTreeView->GetTreeCtrl();
	CListCtrl * pRightList = &pRegListView->GetListCtrl();
	HTREEITEM hItem = pList->GetSelectedItem();
	nItem = pRightList->GetNextItem(nItem,LVNI_SELECTED);
	if(hItem != NULL && hItem != pList->GetRootItem() &&
		pRightList->GetSelectedCount() == 1 &&
		pRightList->GetItemText(nItem,0) != "(默认)")
		IsEnable = TRUE;
	pCmdUI->Enable(IsEnable);	
}
Exemple #9
0
LRESULT CMainFrame::OnRegLeftRClick(WPARAM wParam,LPARAM lParam)
{
	CTreeCtrl * pList = &pRegTreeView->GetTreeCtrl();
	HTREEITEM hItem = pList->GetSelectedItem();
	if(hItem == NULL || hItem == pList->GetRootItem())
	{
		return FALSE;
	}
	CPoint m_point;
	CMenu m_menu;
	m_menu.LoadMenu(IDR_MENU_REGEDIT_LEFT);
	GetCursorPos(&m_point);
	SetForegroundWindow();   
	m_menu.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN|
		TPM_RIGHTBUTTON,m_point.x,m_point.y,this);
	m_menu.DestroyMenu();
	return TRUE;
}
void CDlgSelectUser::OnBnClickedBtnOk()
{
	UpdateData(TRUE);

	CTreeCtrl *pList = (CTreeCtrl *)GetDlgItem(IDC_TREE_USER);
	if (pList == NULL)
		return;

	HTREEITEM hItem = pList->GetSelectedItem();
	if (hItem == NULL)
		return;

	m_strUserName = m_treeUser.GetItemText(hItem);

	UpdateData(FALSE);

	OnOK();
}
void CDlgSelectUser::OnNMDblclkTreeUser(NMHDR *pNMHDR, LRESULT *pResult)
{
	//////////////////////////////////////////////////////////////////////////
	CTreeCtrl *pList = (CTreeCtrl *)GetDlgItem(IDC_TREE_USER);
	if (pList == NULL)
		return;

	HTREEITEM hItem = pList->GetSelectedItem();
	if (hItem == NULL)
		return;

	m_strUserName = m_treeUser.GetItemText(hItem);

	UpdateData(FALSE);

	//////////////////////////////////////////////////////////////////////////
	*pResult = 0;
}
Exemple #12
0
BOOL CTestTreeView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
	// TODO: Add your specialized code here and/or call the base class

	NMHDR* pNMHDR = (NMHDR*)lParam;
	ASSERT(pNMHDR != NULL);
	switch (pNMHDR->code)
	{
 	case TVN_SELCHANGED:
 		{
 			//OnNotifySelChanged(wParam, lParam, pResult); 
 			//AfxMessageBox(_T("Slect..."));
			//showData->helpDescription;
			//showData->setting = false;
			//showData->property = &((*testIt).property);
			


 			break;
 		}
	case NM_DBLCLK:
		{
			//m_wndFileView.GetItem();
			//OnNotifyDBClick(wParam, lParam, pResult);
			CTreeCtrl* pWndTree = (CTreeCtrl*) &m_wndTestTreeView;

			HTREEITEM ht = pWndTree->GetSelectedItem();
			CTlsData *showData = (CTlsData*)pWndTree->GetItemData(ht);


			CMainFrame* pMainFrame= (CMainFrame*)AfxGetMainWnd();
			pMainFrame->SetPropertiesWnd(showData);
			//AfxMessageBox(_T("Double Clieck..."));
		
			break;
		}
	default:
		break;
	}

	return CDockablePane::OnNotify(wParam, lParam, pResult);
}
Exemple #13
0
void CdIpmDoc::ItemCollapseOne()
{
	try
	{
		CTreeCtrl* pTree = m_pTreeGD->GetPTree();
		HTREEITEM hItem  = pTree->GetSelectedItem();
		if (hItem) 
		{
			pTree->Expand(hItem, TVE_COLLAPSE);
		}
	}
	catch (CeIpmException e)
	{
		AfxMessageBox (e.GetReason(), MB_ICONEXCLAMATION|MB_OK);
	}
	catch (...)
	{
		TRACE0("Exception in: CdIpmDoc::ItemCollapseOne\n");
	}
}
void CSiteView::OnContextMenu(CWnd* pWnd, CPoint point)
{
	CTreeCtrl* pWndTree = (CTreeCtrl*)&m_wndSiteView;
	ASSERT_VALID(pWndTree);

	if (pWnd != pWndTree)
	{
		CDockablePane::OnContextMenu(pWnd, point);
		return;
	}

	if (point != CPoint(-1, -1))
	{
		// Select clicked item:
		CPoint ptTree = point;
		pWndTree->ScreenToClient(&ptTree);

		UINT flags = 0;
		HTREEITEM hTreeItem = pWndTree->HitTest(ptTree, &flags);
		if (hTreeItem != NULL)
		{
			pWndTree->SelectItem(hTreeItem);
		}
	}
	HTREEITEM item = pWndTree->GetSelectedItem();
	TREE_T * item_data = (TREE_T*)pWndTree->GetItemData(item);
	pWndTree->SetFocus();

	if (item_data == NULL)
		theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_ROOT, point.x, point.y, this, TRUE);
	else if (item_data->tree_level == TREE_LEVEL_SITE)
		theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_SITES, point.x, point.y, this, TRUE);
	else if (item_data->tree_level == TREE_LEVEL_RECORDER)
		theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_RECORDER, point.x, point.y, this, TRUE);
	else if (item_data->tree_level==TREE_LEVEL_CAMERA)
		theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_CAMERA, point.x, point.y, this, TRUE);

}
Exemple #15
0
BOOL CdIpmDoc::ItemShutdown()
{
	try
	{
		CTreeCtrl* pTree = m_pTreeGD->GetPTree();
		HTREEITEM hItem  = pTree->GetSelectedItem();
		if (hItem) 
		{
			CTreeItem* pItem = (CTreeItem*)pTree->GetItemData(hItem);
			ASSERT (pItem);
			if (pItem)
				return pItem->TreeKillShutdown();
		}
	}
	catch (CeIpmException e)
	{
		AfxMessageBox (e.GetReason(), MB_ICONEXCLAMATION|MB_OK);
	}
	catch (...)
	{
		TRACE0("Exception in: CdIpmDoc::ItemShutdown\n");
	}
	return FALSE;
}
Exemple #16
0
void CSpriteListView::OnAddSprite()
{
	CTreeCtrl* pWndTree = (CTreeCtrl*)&m_wndSpriteView;
	ASSERT_VALID(pWndTree);

	CString strSpriteType = "";
	HTREEITEM hTreeItem = pWndTree->GetSelectedItem();
	if(hTreeItem)
	{
		strSpriteType = pWndTree->GetItemText(hTreeItem);		
	}

	CSpriteSet SpriteSetDlg(strSpriteType);
	if(SpriteSetDlg.DoModal() == IDOK)
	{
		TSpriteTree treeNode;
				
		treeNode.setName(SpriteSetDlg.m_strSurfaceName);
		treeNode.setType(SpriteSetDlg.m_strSpriteType);

		if(SpriteSetDlg.m_strFileName != "")
		{
			treeNode.setPath(SpriteSetDlg.m_strFileName);
			treeNode.setRow(SpriteSetDlg.m_nRow);
			treeNode.setCol(SpriteSetDlg.m_nCol);
		}

		g_spriteTree.addASprite(treeNode);
		m_pMainFrm = (CMainFrame *)theApp.m_pMainWnd;
		if(m_pMainFrm)
		{
			m_pMainFrm->BuildSceneTree();
			m_pMainFrm->UpdateSceneView(TRUE);
		}
	}
}
void RenameVolumeDialog::OnSelChanged(NMHDR* pnmh, LRESULT* pResult)
{
    CTreeCtrl* pTree = (CTreeCtrl*) GetDlgItem(IDC_RENAMEVOL_TREE);
    HTREEITEM selected;
    CString newText;

    selected = pTree->GetSelectedItem();
    if (selected != NULL) {
        DiskFSTree::TargetData* pTargetData;
        pTargetData = (DiskFSTree::TargetData*) pTree->GetItemData(selected);
        if (pTargetData->selectable) {
            newText = pTargetData->pDiskFS->GetBareVolumeName();
        } else {
            newText = "";
        }
    }
    
    CEdit* pEdit = (CEdit*) GetDlgItem(IDC_RENAMEVOL_NEW);
    ASSERT(pEdit != NULL);
    pEdit->SetWindowText(newText);
    pEdit->SetSel(0, -1);

    *pResult = 0;
}
void RenameVolumeDialog::DoDataExchange(CDataExchange* pDX)
{
    CString msg, failed;
    //DiskImgLib::DiskFS*   pDiskFS = fpArchive->GetDiskFS();

    CheckedLoadString(&failed, IDS_MB_APP_NAME);

    /* put fNewName last so it gets the focus after failure */
    DDX_Text(pDX, IDC_RENAMEVOL_NEW, fNewName);

    /* validate the path field */
    if (pDX->m_bSaveAndValidate) {
        /*
         * Make sure they chose a volume that can be modified.
         */
        CTreeCtrl* pTree = (CTreeCtrl*) GetDlgItem(IDC_RENAMEVOL_TREE);
        CString errMsg, appName;
        CheckedLoadString(&appName, IDS_MB_APP_NAME);

        HTREEITEM selected;
        selected = pTree->GetSelectedItem();
        if (selected == NULL) {
            errMsg = "Please select a disk to rename.";
            MessageBox(errMsg, appName, MB_OK);
            pDX->Fail();
            return;
        }

        DiskFSTree::TargetData* pTargetData;
        pTargetData = (DiskFSTree::TargetData*) pTree->GetItemData(selected);
        if (!pTargetData->selectable) {
            errMsg = "You can't rename that volume.";
            MessageBox(errMsg, appName, MB_OK);
            pDX->Fail();
            return;
        }
        ASSERT(pTargetData->kind == DiskFSTree::kTargetDiskFS);

        /*
         * Verify that the new name is okay.  (Do this *after* checking the
         * volume above to avoid spurious complaints about unsupported
         * filesystems.)
         */
        if (fNewName.IsEmpty()) {
            msg = "You must specify a new name.";
            goto fail;
        }
        msg = fpArchive->TestVolumeName(pTargetData->pDiskFS, fNewName);
        if (!msg.IsEmpty())
            goto fail;


        /*
         * Looks good.  Fill in the answer.
         */
        fpChosenDiskFS = pTargetData->pDiskFS;
    }

    return;

fail:
    ASSERT(!msg.IsEmpty());
    MessageBox(msg, failed, MB_OK);
    pDX->Fail();
    return;
}
void TreeDlg::OnExpand() {
  CTreeCtrl *ctrl = getTreeCtrl();
  ctrl->Expand(ctrl->GetSelectedItem(), TVE_EXPAND);
  ctrl->SetFocus();
}
void TreeDlg::OnCollapse() {
  CTreeCtrl *ctrl = getTreeCtrl();
  ctrl->Expand(ctrl->GetSelectedItem(), TVE_COLLAPSE);
  ctrl->SetFocus();
}
void TreeDlg::OnButtonExpand() {
  CTreeCtrl *ctrl = getTreeCtrl();
  TreeItemExpander(true).visitAllItems(ctrl, ctrl->GetSelectedItem());
  ctrl->SetFocus();
}
Exemple #22
0
BOOL CdIpmDoc::UpdateDisplay()
{
	TRACE0("CdIpmDoc::UpdateDisplay()\n");
	try
	{
		m_pTreeGD->RefreshAllTreeBranches(); // refresh left pane
		
		IPMUPDATEPARAMS ups;
		memset (&ups, 0, sizeof (ups));
		CTreeItem* pItem = NULL;
		CTreeCtrl* pTree = m_pTreeGD->GetPTree();
		ASSERT (pTree);
		HTREEITEM hSelectedItem = pTree->GetSelectedItem();
		if (!hSelectedItem)
			return FALSE;
		pItem = (CTreeItem*)pTree->GetItemData(hSelectedItem);
		ASSERT (pItem);
		if (pItem->IsNoItem() || pItem->IsErrorItem())
		{
			m_pTabDialog->DisplayPage (NULL);
		}
		else 
		if (pItem->ItemDisplaysNoPage()) 
		{
			CString caption = pItem->ItemNoPageCaption();
			m_pTabDialog->DisplayPage (NULL, caption);
		}
		else 
		{
			int nImage = -1, nSelectedImage = -1;
			CImageList* pImageList = pTree->GetImageList (TVSIL_NORMAL);
			HICON hIcon = NULL;
			int nImageCount = pImageList? pImageList->GetImageCount(): 0;
			if (pImageList && pTree->GetItemImage(hSelectedItem, nImage, nSelectedImage))
			{
				if (nImage < nImageCount)
					hIcon = pImageList->ExtractIcon(nImage);
			}
			CuPageInformation* pPageInfo = pItem->GetPageInformation();
			CString strItem = pItem->GetRightPaneTitle();

			ups.nType   = pItem->GetType();
			ups.pStruct = pItem->GetPTreeItemData()? pItem->GetPTreeItemData()->GetDataPtr(): NULL;
			ups.pSFilter= m_pTreeGD->GetPSFilter();
			pPageInfo->SetUpdateParam (&ups);
			pPageInfo->SetTitle ((LPCTSTR)strItem, pItem, this);

			pPageInfo->SetImage  (hIcon);
			m_pTabDialog->DisplayPage (pPageInfo);
		}

		// Replicator Monitor special management
		// ASSUMES we did not change the current item!
		BOOL bReplMonWasOn = (m_hReplMonHandle != -1) ? TRUE: FALSE;
		BOOL bReplMonToBeOn = pItem->HasReplicMonitor();
		// 3 cases :
		//    - on to off ---> replicator has been uninstalled
		//    - off to on ---> replicator has been installed
		//    - on to on, or off to off: state has not changed
		if (bReplMonWasOn && !bReplMonToBeOn) 
		{
			BOOL bOK = TerminateReplicator();
			ASSERT (bOK);
		}
		else 
		if (!bReplMonWasOn && bReplMonToBeOn)
		{
			CString csDbName = pItem->GetDBName();
			BOOL bOK = InitializeReplicator(csDbName);
			ASSERT (bOK);
		}
		//
		// Refresh right pane
		CfIpmFrame* pIpmFrame = (CfIpmFrame*)pTree->GetParentFrame();
		UpdateAllViews((CView *)pIpmFrame->GetLeftPane());
	}
	catch(CMemoryException* e)
	{
		theApp.OutOfMemoryMessage();
		e->Delete();
		return FALSE;
	}
	catch(CResourceException* e)
	{
		//_T("Cannot load dialog box");
		AfxMessageBox (IDS_E_LOAD_DLG);
		e->Delete();
		return FALSE;
	}
	catch(...)
	{
		//_T("Cannot construct the property pane");
		AfxMessageBox (IDS_E_CONSTRUCT_PROPERTY);
		return FALSE;
	}

	return TRUE;
}
Exemple #23
0
BOOL CIpmCtrl::SelectItem(LPCTSTR lpszNode, LPCTSTR lpszServer, LPCTSTR lpszUser, LPCTSTR lpszKey, VARIANT FAR* pArrayItem, short nShowTree)
{
	class CaLockDisplayRightPaneProperty
	{
	public:
		CaLockDisplayRightPaneProperty(CdIpmDoc* pDoc):m_pDoc(pDoc), m_bLock(FALSE){}
		~CaLockDisplayRightPaneProperty(){UnLock();}

		void Lock(){m_pDoc->SetLockDisplayRightPane(TRUE);}
		void UnLock(){m_pDoc->SetLockDisplayRightPane(FALSE);}

	protected:
		BOOL m_bLock;
		CdIpmDoc* m_pDoc;
	};

	CWaitCursor doWaitCursor ;
	BOOL bOK = FALSE;
	try 
	{
		CdIpmDoc* pDoc = new CdIpmDoc(lpszKey, pArrayItem, (BOOL)nShowTree);

		if (m_pIpmFrame)
		{
			m_pIpmFrame->ShowWindow (SW_HIDE);
			m_pIpmFrame->DestroyWindow();
			m_pIpmFrame = NULL;
		}

		CaIpmProperty& property = pDoc->GetProperty();
		ConstructPropertySet (property);

		SFILTER* pFilter = theApp.GetFilter();
		SFILTER* pDocFilter = pDoc->GetFilter();
		memcpy (pDocFilter, pFilter, sizeof(SFILTER));
		CaLockDisplayRightPaneProperty lock(pDoc);
		if (nShowTree == 1)
		{
			//
			// During the process of expanding tree up to search item,
			// prohibit the display of the properties of the selected tree item
			lock.Lock();
		}

		CWnd* pParent = this;
		CRect r;
		GetClientRect (r);
		m_pIpmFrame = new CfIpmFrame(pDoc);
		m_pIpmFrame->Create (
			NULL,
			NULL,
			WS_CHILD,
			r,
			pParent);
		if (!m_pIpmFrame)
			return FALSE;

		m_pIpmFrame->InitialUpdateFrame(NULL, TRUE);
		m_pIpmFrame->ShowWindow(SW_SHOW);
		bOK = pDoc->Initiate(lpszNode, lpszServer, lpszUser, NULL);
		if (!bOK)
			return FALSE;

		CTypedPtrList<CObList, CuIpmTreeFastItem*> listItemPath;
		bOK = IPM_BuildItemPath (pDoc, listItemPath);
		if (!bOK)
		{
			while (!listItemPath.IsEmpty())
				delete listItemPath.RemoveHead();
			return FALSE;
		}
		ExpandUpToSearchedItem(m_pIpmFrame, listItemPath, TRUE);
		lock.UnLock();
		//
		// Cleanup:
		while (!listItemPath.IsEmpty())
			delete listItemPath.RemoveHead();

		//
		// Fetch the selected tree item and display the corresponding right pane:
		IPMUPDATEPARAMS ups;
		CTreeGlobalData* pGD = pDoc->GetPTreeGD();
		ASSERT (pGD);
		if (!pGD)
			return FALSE;
		CTreeCtrl* pTree = pGD->GetPTree();
		ASSERT (pTree);
		if (!pTree)
			return FALSE;
		CuDlgIpmTabCtrl* pTabDlg  = (CuDlgIpmTabCtrl*)m_pIpmFrame->GetTabDialog();
		if (!pTabDlg)
			return FALSE;
		HTREEITEM hSelected = pTree->GetSelectedItem();
		if (!hSelected)
			return FALSE;
		//
		// Notify the container of sel change:
		ContainerNotifySelChange();
		memset (&ups, 0, sizeof (ups));
		CTreeItem* pItem = (CTreeItem*)pTree->GetItemData (hSelected);
		if (pItem->IsNoItem() || pItem->IsErrorItem())
		{
			pTabDlg->DisplayPage (NULL);
			return TRUE;
		}
		if (pItem->ItemDisplaysNoPage()) 
		{
			CString caption = pItem->ItemNoPageCaption();
			pTabDlg->DisplayPage (NULL, caption);
			return TRUE;
		}

		if (pItem->HasReplicMonitor())
		{
			pDoc->InitializeReplicator(pItem->GetDBName());
		}

		int nImage = -1, nSelectedImage = -1;
		CImageList* pImageList = pTree->GetImageList (TVSIL_NORMAL);
		HICON hIcon = NULL;
		int nImageCount = pImageList? pImageList->GetImageCount(): 0;
		if (pImageList && pTree->GetItemImage(hSelected, nImage, nSelectedImage))
		{
			if (nImage < nImageCount)
				hIcon = pImageList->ExtractIcon(nImage);
		}
		CuPageInformation* pPageInfo = pItem->GetPageInformation();
		ASSERT(pPageInfo);
		if (!pPageInfo)
			return FALSE;
		int nSelectTab = GetDefaultSelectTab (pDoc);

		CString strItem = pItem->GetRightPaneTitle();
		pItem->UpdateDataWhenSelChange(); // Has an effect only if the class has specialied the method.
		ups.nType   = pItem->GetType();
		ups.pStruct = pItem->GetPTreeItemData()? pItem->GetPTreeItemData()->GetDataPtr(): NULL;
		ups.pSFilter= pDoc->GetPTreeGD()->GetPSFilter();
		pPageInfo->SetUpdateParam (&ups);
		pPageInfo->SetTitle ((LPCTSTR)strItem, pItem, pDoc);
		pPageInfo->SetImage  (hIcon);
		pTabDlg->DisplayPage (pPageInfo, NULL, nSelectTab);

		return TRUE;
	}
	catch(CMemoryException* e)
	{
		theApp.OutOfMemoryMessage();
		e->Delete();
	}
	catch(CResourceException* e)
	{
		AfxMessageBox (IDS_E_LOAD_DLG);
		e->Delete();
	}
	catch(...)
	{
		AfxMessageBox (IDS_E_CONSTRUCT_PROPERTY);
	}
	return FALSE;
}