a
This commit is contained in:
@@ -0,0 +1,217 @@
|
||||
// navdataprodlg.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "geomative.h"
|
||||
#include "navdataprodlg.h"
|
||||
#include "Constant.h"
|
||||
#include "MainFrm.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CNavDataProDlg dialog
|
||||
|
||||
|
||||
CNavDataProDlg::CNavDataProDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CNavDataProDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CNavDataProDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CNavDataProDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CNavDataProDlg)
|
||||
DDX_Control(pDX, IDC_TREE_DATA_P, m_proTree);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CNavDataProDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CNavDataProDlg)
|
||||
ON_WM_SIZE()
|
||||
ON_WM_SHOWWINDOW()
|
||||
ON_NOTIFY(NM_RCLICK, IDC_TREE_DATA_P, OnRclickTreeDataP)
|
||||
ON_NOTIFY(TVN_SELCHANGED, IDC_TREE_DATA_P, OnSelchangedTreeDataP)
|
||||
ON_NOTIFY(TVN_SELCHANGING, IDC_TREE_DATA_P, OnSelchangingTreeDataP)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CNavDataProDlg message handlers
|
||||
|
||||
void CNavDataProDlg::OnSize(UINT nType, int cx, int cy)
|
||||
{
|
||||
CDialog::OnSize(nType, cx, cy);
|
||||
|
||||
// TODO: Add your message handler code here
|
||||
CTreeCtrl* pNavProTree = NULL;
|
||||
pNavProTree = (CTreeCtrl*)(this->GetDlgItem(IDC_TREE_DATA_P));
|
||||
|
||||
if (pNavProTree != NULL)
|
||||
{
|
||||
CRect rect;
|
||||
GetClientRect(&rect);
|
||||
pNavProTree->MoveWindow(&rect);
|
||||
}
|
||||
pNavProTree = NULL;
|
||||
}
|
||||
|
||||
void CNavDataProDlg::OnShowWindow(BOOL bShow, UINT nStatus)
|
||||
{
|
||||
CDialog::OnShowWindow(bShow, nStatus);
|
||||
|
||||
// TODO: Add your message handler code here
|
||||
if (TRUE == bShow)
|
||||
{
|
||||
Schedule();
|
||||
}
|
||||
}
|
||||
|
||||
void CNavDataProDlg::OnRclickTreeDataP(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
CMainFrame* pMainFrm = NULL;
|
||||
HTREEITEM hHitItem = NULL;
|
||||
|
||||
UINT uFlags;
|
||||
CPoint treePoint;
|
||||
GetCursorPos(&treePoint);
|
||||
m_proTree.ScreenToClient(&treePoint);
|
||||
// MapWindowPoints(&m_proTree, &treePoint, 1);
|
||||
hHitItem = m_proTree.HitTest(treePoint, &uFlags);
|
||||
m_proTree.SelectItem(hHitItem);
|
||||
m_proTree.ClientToScreen(&treePoint);
|
||||
|
||||
// Schedule();
|
||||
|
||||
pMainFrm = (CMainFrame*)AfxGetMainWnd();
|
||||
if (pMainFrm->MDIGetActive()->IsZoomed())
|
||||
{
|
||||
if ((NULL != hHitItem) && (TVHT_ONITEM & uFlags))
|
||||
{
|
||||
if (NULL != pMainFrm->GetMenu()->GetSubMenu(2)->GetSubMenu(0)->GetSubMenu(2))
|
||||
{
|
||||
pMainFrm->GetMenu()->GetSubMenu(2)->GetSubMenu(0)->GetSubMenu(2)->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
|
||||
treePoint.x, treePoint.y, GetParentFrame());
|
||||
}
|
||||
}
|
||||
else if (NULL == hHitItem)
|
||||
{
|
||||
if (NULL != pMainFrm->GetMenu()->GetSubMenu(2)->GetSubMenu(0)->GetSubMenu(2))
|
||||
{
|
||||
GetCursorPos(&treePoint);
|
||||
pMainFrm->GetMenu()->GetSubMenu(2)->GetSubMenu(0)->GetSubMenu(2)->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
|
||||
treePoint.x, treePoint.y, GetParentFrame());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((NULL != hHitItem) && (TVHT_ONITEM & uFlags))
|
||||
{
|
||||
if (NULL != pMainFrm->GetMenu()->GetSubMenu(1)->GetSubMenu(0)->GetSubMenu(2))
|
||||
{
|
||||
pMainFrm->GetMenu()->GetSubMenu(1)->GetSubMenu(0)->GetSubMenu(2)->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
|
||||
treePoint.x, treePoint.y, GetParentFrame());
|
||||
}
|
||||
}
|
||||
else if (NULL == hHitItem)
|
||||
{
|
||||
if (NULL != pMainFrm->GetMenu()->GetSubMenu(1)->GetSubMenu(0)->GetSubMenu(2))
|
||||
{
|
||||
GetCursorPos(&treePoint);
|
||||
pMainFrm->GetMenu()->GetSubMenu(1)->GetSubMenu(0)->GetSubMenu(2)->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
|
||||
treePoint.x, treePoint.y, GetParentFrame());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
void CNavDataProDlg::OnSelchangedTreeDataP(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
|
||||
// TODO: Add your control notification handler code here
|
||||
Schedule();
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
BOOL CNavDataProDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// TODO: Add extra initialization here
|
||||
m_proTree.ModifyStyle(0, TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS | TVS_SHOWSELALWAYS | TVS_NOHSCROLL);
|
||||
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
void CNavDataProDlg::Schedule()
|
||||
{
|
||||
HTREEITEM hProItem = NULL;
|
||||
DWORD dwItemHandle = (DWORD)VAL_ZERO;
|
||||
DWORD dwImageState = (DWORD)VAL_ZERO;
|
||||
DWORD dwTempStyle = (DWORD)VAL_ZERO;
|
||||
|
||||
hProItem = m_proTree.GetSelectedItem();
|
||||
|
||||
if (NULL != hProItem)
|
||||
{
|
||||
dwItemHandle = m_proTree.GetItemData(hProItem);
|
||||
dwImageState = m_proTree.GetItemState(hProItem, TVIS_STATEIMAGEMASK);
|
||||
}
|
||||
else
|
||||
{
|
||||
dwTempStyle = PZ_STYLE_PRO;
|
||||
dwTempStyle <<= HANDLE_OFFSET;
|
||||
dwItemHandle |= dwTempStyle;
|
||||
}
|
||||
|
||||
if (TAB_INDEX_PRO == ((CTabCtrl*)GetParent())->GetCurSel())
|
||||
{
|
||||
::SendMessage(GetParentFrame()->m_hWnd, WM_SCHEDULE, (WPARAM)dwItemHandle, (LPARAM)dwImageState);
|
||||
}
|
||||
}
|
||||
|
||||
void CNavDataProDlg::OnSelchangingTreeDataP(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
|
||||
// TODO: Add your control notification handler code here
|
||||
if (0x1000 == pNMTreeView->action)
|
||||
{
|
||||
*pResult = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*pResult = 0;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CNavDataProDlg::PreTranslateMessage(MSG* pMsg)
|
||||
{
|
||||
// TODO: Add your specialized code here and/or call the base class
|
||||
|
||||
if(pMsg->message==WM_KEYDOWN && pMsg->wParam==VK_RETURN)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if(pMsg->message==WM_KEYDOWN && pMsg->wParam==VK_ESCAPE)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return CDialog::PreTranslateMessage(pMsg);
|
||||
}
|
||||
Reference in New Issue
Block a user