255 lines
6.7 KiB
C++
255 lines
6.7 KiB
C++
// navspt2ddlg.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "geomative.h"
|
|
#include "navspt2ddlg.h"
|
|
#include "Constant.h"
|
|
#include "MainFrm.h"
|
|
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
extern int g_iCurrListColIndex;
|
|
extern int g_iCurrListColOrder;
|
|
extern int CALLBACK ListStrCompare(LPARAM lParam1, LPARAM lParam2, LPARAM lSortObject);
|
|
extern int g_UIOffset;
|
|
extern int g_iTransFileMode;
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CNavSpt2DDlg dialog
|
|
|
|
|
|
CNavSpt2DDlg::CNavSpt2DDlg(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CNavSpt2DDlg::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CNavSpt2DDlg)
|
|
// NOTE: the ClassWizard will add member initialization here
|
|
//}}AFX_DATA_INIT
|
|
}
|
|
|
|
|
|
void CNavSpt2DDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CNavSpt2DDlg)
|
|
DDX_Control(pDX, IDC_LIST_EXEC_2D, m_2dList);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CNavSpt2DDlg, CDialog)
|
|
//{{AFX_MSG_MAP(CNavSpt2DDlg)
|
|
ON_WM_SIZE()
|
|
ON_NOTIFY(LVN_COLUMNCLICK, IDC_LIST_EXEC_2D, OnColumnclickListExec2d)
|
|
ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST_EXEC_2D, OnItemchangedListExec2d)
|
|
ON_NOTIFY(NM_RCLICK, IDC_LIST_EXEC_2D, OnRclickListExec2d)
|
|
ON_WM_SHOWWINDOW()
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CNavSpt2DDlg message handlers
|
|
|
|
void CNavSpt2DDlg::OnSize(UINT nType, int cx, int cy)
|
|
{
|
|
CDialog::OnSize(nType, cx, cy);
|
|
|
|
// TODO: Add your message handler code here
|
|
CListCtrl* pNav2DList = NULL;
|
|
pNav2DList = (CListCtrl*)(this->GetDlgItem(IDC_LIST_EXEC_2D));
|
|
|
|
if (pNav2DList != NULL)
|
|
{
|
|
CRect rect;
|
|
GetClientRect(&rect);
|
|
pNav2DList->MoveWindow(&rect);
|
|
}
|
|
|
|
pNav2DList = NULL;
|
|
}
|
|
|
|
BOOL CNavSpt2DDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
// TODO: Add extra initialization here
|
|
CString strColTitle;
|
|
|
|
m_2dList.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP
|
|
| LVS_EX_ONECLICKACTIVATE | LVS_EX_GRIDLINES);
|
|
|
|
g_iCurrListColIndex = (int)VAL_ZERO;
|
|
g_iCurrListColOrder = (int)VAL_ZERO;
|
|
|
|
strColTitle.Empty();
|
|
strColTitle.LoadString(IDS_DB_SCON_SNAME+g_UIOffset);
|
|
m_2dList.InsertColumn(0, strColTitle, LVCFMT_LEFT, 150);
|
|
|
|
strColTitle.Empty();
|
|
strColTitle.LoadString(IDS_DB_SCON_DEFINER+g_UIOffset);
|
|
m_2dList.InsertColumn(1, strColTitle, LVCFMT_LEFT, 80);
|
|
|
|
strColTitle.Empty();
|
|
strColTitle.LoadString(IDS_DB_SCON_DEDATE+g_UIOffset);
|
|
m_2dList.InsertColumn(2, strColTitle, LVCFMT_LEFT, 80);
|
|
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
void CNavSpt2DDlg::Schedule()
|
|
{
|
|
int iSptRecIndex = (int)VAL_ZERO;
|
|
POSITION posSptRec;
|
|
|
|
DWORD dwItemHandle = (DWORD)VAL_ZERO;
|
|
DWORD dwImageState = (DWORD)VAL_ZERO;
|
|
DWORD dwTempStyle = (DWORD)VAL_ZERO;
|
|
|
|
posSptRec = m_2dList.GetFirstSelectedItemPosition();
|
|
iSptRecIndex = m_2dList.GetNextSelectedItem(posSptRec);
|
|
|
|
if (VAL_MINUS_ONE != iSptRecIndex)
|
|
{
|
|
dwItemHandle = m_2dList.GetItemData(iSptRecIndex);
|
|
dwImageState = m_2dList.GetItemState(iSptRecIndex, TVIS_STATEIMAGEMASK);
|
|
}
|
|
else
|
|
{
|
|
dwTempStyle = PZ_STYLE_SCON_2D;
|
|
dwTempStyle <<= HANDLE_OFFSET;
|
|
dwItemHandle |= dwTempStyle;
|
|
}
|
|
|
|
if ((EN_TRANSFER_FILE_BY_CLOUND == g_iTransFileMode && TAB_INDEX_CE == ((CTabCtrl*)GetParent())->GetCurSel())
|
|
|| TAB_INDEX_2D == ((CTabCtrl*)GetParent())->GetCurSel())
|
|
{
|
|
::SendMessage(GetParentFrame()->m_hWnd, WM_SCHEDULE, (WPARAM)dwItemHandle, (LPARAM)dwImageState);
|
|
}
|
|
}
|
|
|
|
void CNavSpt2DDlg::OnColumnclickListExec2d(NMHDR* pNMHDR, LRESULT* pResult)
|
|
{
|
|
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
|
|
// TODO: Add your control notification handler code here
|
|
|
|
g_iCurrListColIndex = pNMListView->iSubItem;
|
|
g_iCurrListColOrder = !g_iCurrListColOrder;
|
|
m_2dList.SortItems(ListStrCompare, (LPARAM)&m_2dList);
|
|
|
|
*pResult = 0;
|
|
}
|
|
|
|
void CNavSpt2DDlg::OnItemchangedListExec2d(NMHDR* pNMHDR, LRESULT* pResult)
|
|
{
|
|
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
|
|
// TODO: Add your control notification handler code here
|
|
if (((pNMListView->uOldState & LVIS_SELECTED) == LVIS_SELECTED) && ((pNMListView->uNewState & LVIS_SELECTED) == VAL_ZERO))
|
|
{
|
|
Schedule();
|
|
}
|
|
else if (((pNMListView->uOldState & LVIS_SELECTED) == VAL_ZERO) && ((pNMListView->uNewState & LVIS_SELECTED) == LVIS_SELECTED))
|
|
{
|
|
Schedule();
|
|
}
|
|
|
|
*pResult = 0;
|
|
}
|
|
|
|
void CNavSpt2DDlg::OnRclickListExec2d(NMHDR* pNMHDR, LRESULT* pResult)
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
CMainFrame* pMainFrm = NULL;
|
|
|
|
int iSptRecIndex = 0;
|
|
|
|
UINT uFlags;
|
|
CPoint listPoint;
|
|
|
|
GetCursorPos(&listPoint);
|
|
m_2dList.ScreenToClient(&listPoint);
|
|
|
|
MapWindowPoints(&m_2dList, &listPoint, 1);
|
|
iSptRecIndex = m_2dList.HitTest(listPoint, &uFlags);
|
|
m_2dList.ClientToScreen(&listPoint);
|
|
|
|
// Schedule();
|
|
|
|
pMainFrm = (CMainFrame*)AfxGetMainWnd();
|
|
ASSERT(NULL != pMainFrm);
|
|
|
|
if (pMainFrm->MDIGetActive()->IsZoomed()) //当子窗口尺寸为max时,之前主框架中的菜单位置编号递增1
|
|
{
|
|
if ((VAL_MINUS_ONE != iSptRecIndex) && (LVHT_ONITEM & uFlags))
|
|
{
|
|
if (NULL != pMainFrm->GetMenu()->GetSubMenu(3)->GetSubMenu(2))
|
|
{
|
|
pMainFrm->GetMenu()->GetSubMenu(3)->GetSubMenu(2)->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
|
|
listPoint.x, listPoint.y, GetParentFrame());
|
|
}
|
|
}
|
|
else
|
|
{//here
|
|
if (NULL != pMainFrm->GetMenu()->GetSubMenu(3)->GetSubMenu(2))
|
|
{
|
|
GetCursorPos(&listPoint);
|
|
pMainFrm->GetMenu()->GetSubMenu(3)->GetSubMenu(2)->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
|
|
listPoint.x, listPoint.y, GetParentFrame());
|
|
}
|
|
}
|
|
}
|
|
else //当子窗口尺寸为max时,之前主框架中的菜单位置编号递减1
|
|
{
|
|
if ((VAL_MINUS_ONE != iSptRecIndex) && (LVHT_ONITEM & uFlags))
|
|
{
|
|
if (NULL != pMainFrm->GetMenu()->GetSubMenu(2)->GetSubMenu(2))
|
|
{
|
|
pMainFrm->GetMenu()->GetSubMenu(2)->GetSubMenu(2)->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
|
|
listPoint.x, listPoint.y, GetParentFrame());
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (NULL != pMainFrm->GetMenu()->GetSubMenu(2)->GetSubMenu(2))
|
|
{
|
|
GetCursorPos(&listPoint);
|
|
pMainFrm->GetMenu()->GetSubMenu(2)->GetSubMenu(2)->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
|
|
listPoint.x, listPoint.y, GetParentFrame());
|
|
}
|
|
}
|
|
}
|
|
*pResult = 0;
|
|
}
|
|
|
|
void CNavSpt2DDlg::OnShowWindow(BOOL bShow, UINT nStatus)
|
|
{
|
|
CDialog::OnShowWindow(bShow, nStatus);
|
|
|
|
// TODO: Add your message handler code here
|
|
if (TRUE == bShow)
|
|
{
|
|
Schedule();
|
|
}
|
|
}
|
|
|
|
BOOL CNavSpt2DDlg::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);
|
|
}
|