a
This commit is contained in:
@@ -0,0 +1,288 @@
|
||||
// AppDataRsp3DTdConListView.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "geomative.h"
|
||||
#include "AppDataRsp3DTdConListView.h"
|
||||
#include "delelectrode.h"
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CAppDataRsp3DTdConListView
|
||||
extern int g_iCurrListColIndex;
|
||||
extern int g_iCurrListColOrder;
|
||||
extern int CALLBACK ListStrCompare(LPARAM lParam1, LPARAM lParam2, LPARAM lSortObject);
|
||||
extern int g_iUILanguage;
|
||||
extern UINT32 g_ui32PageCount;
|
||||
IMPLEMENT_DYNCREATE(CAppDataRsp3DTdConListView, CListView)
|
||||
|
||||
CAppDataRsp3DTdConListView::CAppDataRsp3DTdConListView()
|
||||
{
|
||||
m_pMngFrm = NULL;
|
||||
}
|
||||
|
||||
CAppDataRsp3DTdConListView::~CAppDataRsp3DTdConListView()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CAppDataRsp3DTdConListView, CListView)
|
||||
//{{AFX_MSG_MAP(CAppDataRsp3DTdConListView)
|
||||
ON_NOTIFY_REFLECT(LVN_COLUMNCLICK, OnColumnclick)
|
||||
ON_WM_LBUTTONDBLCLK()
|
||||
ON_NOTIFY_REFLECT(NM_RCLICK, OnRclick)
|
||||
ON_COMMAND(IDM_OP_DATA_REMOVE, OnOpDataRemove)
|
||||
ON_COMMAND(IDM_OP_REMOVE_ELECTRODE,OnOpDeleteElectrode)
|
||||
//}}AFX_MSG_MAP
|
||||
ON_WM_VSCROLL()
|
||||
ON_WM_MOUSEWHEEL()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CAppDataRsp3DTdConListView drawing
|
||||
|
||||
void CAppDataRsp3DTdConListView::OnDraw(CDC* pDC)
|
||||
{
|
||||
CDocument* pDoc = GetDocument();
|
||||
// TODO: add draw code here
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CAppDataRsp3DTdConListView diagnostics
|
||||
|
||||
#ifdef _DEBUG
|
||||
void CAppDataRsp3DTdConListView::AssertValid() const
|
||||
{
|
||||
CListView::AssertValid();
|
||||
}
|
||||
|
||||
void CAppDataRsp3DTdConListView::Dump(CDumpContext& dc) const
|
||||
{
|
||||
CListView::Dump(dc);
|
||||
}
|
||||
#endif //_DEBUG
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CAppDataRsp3DTdConListView message handlers
|
||||
|
||||
void CAppDataRsp3DTdConListView::OnColumnclick(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;
|
||||
GetListCtrl().SortItems(ListStrCompare, (LPARAM)&GetListCtrl());
|
||||
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
void CAppDataRsp3DTdConListView::OnInitialUpdate()
|
||||
{
|
||||
CListView::OnInitialUpdate();
|
||||
|
||||
// TODO: Add your specialized code here and/or call the base class
|
||||
CString strColTitle;
|
||||
int iColIndex = (int)VAL_ZERO;
|
||||
|
||||
GetListCtrl().SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP
|
||||
| LVS_EX_ONECLICKACTIVATE | LVS_EX_GRIDLINES | LVS_EX_MULTIWORKAREAS);
|
||||
|
||||
m_pMngFrm = (CMDIChildWnd*)GetParentFrame();
|
||||
|
||||
g_iCurrListColIndex = (int)VAL_ZERO;
|
||||
g_iCurrListColOrder = (int)VAL_ZERO;
|
||||
/*
|
||||
strColTitle.Empty();
|
||||
strColTitle.LoadString(IDS_DB_TD2DCON_TSN);
|
||||
GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_LEFT, 100);
|
||||
|
||||
iColIndex++;
|
||||
*/
|
||||
strColTitle.Empty();
|
||||
strColTitle.LoadString(IDS_DB_TD2DCON_C1);
|
||||
GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_LEFT, 65);
|
||||
|
||||
iColIndex++;
|
||||
strColTitle.Empty();
|
||||
strColTitle.LoadString(IDS_DB_TD2DCON_C2);
|
||||
GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_LEFT, 65);
|
||||
|
||||
iColIndex++;
|
||||
strColTitle.Empty();
|
||||
strColTitle.LoadString(IDS_DB_TD2DCON_P1);
|
||||
GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_LEFT, 65);
|
||||
|
||||
iColIndex++;
|
||||
strColTitle.Empty();
|
||||
strColTitle.LoadString(IDS_DB_TD2DCON_P2);
|
||||
GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_LEFT, 65);
|
||||
|
||||
iColIndex++;
|
||||
strColTitle.Empty();
|
||||
strColTitle.LoadString(IDS_DB_TD2DCON_N);
|
||||
GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_LEFT, 70);
|
||||
|
||||
iColIndex++;
|
||||
strColTitle.Empty();
|
||||
strColTitle.LoadString(IDS_DB_TD2DCON_K);
|
||||
GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_RIGHT, 100);
|
||||
|
||||
iColIndex++;
|
||||
strColTitle.Empty();
|
||||
strColTitle.LoadString(IDS_DB_TD2DCON_I);
|
||||
GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_RIGHT, 100);
|
||||
|
||||
iColIndex++;
|
||||
strColTitle.Empty();
|
||||
strColTitle.LoadString(IDS_DB_TD2DCON_V);
|
||||
GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_RIGHT, 100);
|
||||
|
||||
iColIndex++;
|
||||
strColTitle.Empty();
|
||||
strColTitle.LoadString(IDS_DB_TD2DCON_R);
|
||||
GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_RIGHT, 100);
|
||||
|
||||
iColIndex++;
|
||||
strColTitle.Empty();
|
||||
strColTitle.LoadString(IDS_DB_TD2DCON_R0);
|
||||
GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_RIGHT, 100);
|
||||
|
||||
iColIndex++;
|
||||
strColTitle.Empty();
|
||||
strColTitle.LoadString(IDS_DB_TD2DCON_SP);
|
||||
GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_RIGHT, 100);
|
||||
}
|
||||
|
||||
BOOL CAppDataRsp3DTdConListView::PreCreateWindow(CREATESTRUCT& cs)
|
||||
{
|
||||
// TODO: Add your specialized code here and/or call the base class
|
||||
cs.style &= ~LVS_TYPEMASK;
|
||||
cs.style |= LVS_REPORT | LVS_SHOWSELALWAYS;
|
||||
|
||||
return CListView::PreCreateWindow(cs);
|
||||
}
|
||||
|
||||
void CAppDataRsp3DTdConListView::OnLButtonDblClk(UINT nFlags, CPoint point)
|
||||
{
|
||||
// TODO: Add your message handler code here and/or call default
|
||||
DWORD dwTSN = (DWORD)VAL_ZERO;
|
||||
int iItemIndex = (DWORD)VAL_ZERO;
|
||||
|
||||
iItemIndex = this->GetListCtrl().HitTest(point);
|
||||
|
||||
if ((-1 != iItemIndex) && (MK_LBUTTON == nFlags))
|
||||
{
|
||||
dwTSN = this->GetListCtrl().GetItemData(iItemIndex);
|
||||
::SendMessage(m_pMngFrm->m_hWnd, WM_DRAWTPSPLINES, (WPARAM)dwTSN, (LPARAM)VAL_ZERO);
|
||||
}
|
||||
|
||||
|
||||
CListView::OnLButtonDblClk(nFlags, point);
|
||||
}
|
||||
|
||||
void CAppDataRsp3DTdConListView::OnRclick(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
CMenu gnMenu;
|
||||
CMenu* pPopGnMenu = NULL;
|
||||
|
||||
gnMenu.LoadMenu(IDR_EDIT_DATA);
|
||||
pPopGnMenu = gnMenu.GetSubMenu(0);
|
||||
|
||||
CPoint point(GetMessagePos());
|
||||
GetListCtrl().ScreenToClient(&point);
|
||||
|
||||
int item = GetListCtrl().HitTest(point, NULL);
|
||||
if (item == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
DWORD dwTSN = this->GetListCtrl().GetItemData(item);
|
||||
|
||||
|
||||
|
||||
GetListCtrl().ClientToScreen(&point);
|
||||
pPopGnMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
|
||||
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
void CAppDataRsp3DTdConListView::OnOpDataRemove()
|
||||
{
|
||||
// TODO: Add your command handler code here
|
||||
int nRet = 0;
|
||||
if (LANG_ZHCN == g_iUILanguage)
|
||||
nRet = AfxMessageBox(_T("确定删除?"), MB_OKCANCEL);
|
||||
else
|
||||
nRet = MessageBoxEx(NULL, _T("Remove it?"), STRING_MESSAGEBOXEX_TITLE, MB_OKCANCEL, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||||
|
||||
if (IDOK != nRet)
|
||||
return;
|
||||
POSITION pos = NULL;
|
||||
DWORD dwTSN = 0;
|
||||
int iItemIndex = -1;
|
||||
bool bRealDelete = false;
|
||||
|
||||
while((pos = this->GetListCtrl().GetFirstSelectedItemPosition()))
|
||||
{
|
||||
iItemIndex = this->GetListCtrl().GetNextSelectedItem(pos);
|
||||
if(iItemIndex >= 0 && iItemIndex < this->GetListCtrl().GetItemCount())
|
||||
{
|
||||
bRealDelete = true;
|
||||
dwTSN = this->GetListCtrl().GetItemData(iItemIndex);
|
||||
::SendMessage(m_pMngFrm->m_hWnd, WM_REMOVE_3D_DATA, (WPARAM)dwTSN, (LPARAM)1);
|
||||
this->GetListCtrl().DeleteItem(iItemIndex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (bRealDelete)
|
||||
{
|
||||
::SendMessage(m_pMngFrm->m_hWnd, WM_REFRESH_CONLIST, (WPARAM)VAL_ZERO, (LPARAM)VAL_ZERO);
|
||||
}
|
||||
}
|
||||
|
||||
void CAppDataRsp3DTdConListView::OnOpDeleteElectrode()
|
||||
{
|
||||
CDelElectrode DeleteElecDial;
|
||||
STDelElectInfo stDelElecInfo;
|
||||
if (IDOK == DeleteElecDial.DoModal())
|
||||
{
|
||||
DeleteElecDial.GetElectrodeIDInfo(stDelElecInfo);
|
||||
if (!stDelElecInfo.vtElectID.empty())
|
||||
{
|
||||
::SendMessage(m_pMngFrm->m_hWnd, WM_DELETE_3D_ELECTRODE, (WPARAM)VAL_ZERO, (LPARAM)(&(stDelElecInfo.vtElectID)));
|
||||
Sleep(100);
|
||||
::SendMessage(m_pMngFrm->m_hWnd, WM_REFRESH_CONLIST, (WPARAM)VAL_ZERO, (LPARAM)VAL_ZERO);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CAppDataRsp3DTdConListView::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
|
||||
{
|
||||
// TODO: 在此添加消息处理程序代码和/或调用默认值
|
||||
g_ui32PageCount++;
|
||||
CString strLog;
|
||||
strLog.Format(_T("zm:OnVScroll Page=%u\n"), g_ui32PageCount);
|
||||
OutputDebugString(strLog);
|
||||
::SendMessage(m_pMngFrm->m_hWnd, WM_LOADING_2D_DATA, (WPARAM)g_ui32PageCount, (LPARAM)VAL_ZERO);
|
||||
CListView::OnVScroll(nSBCode, nPos, pScrollBar);
|
||||
}
|
||||
|
||||
|
||||
BOOL CAppDataRsp3DTdConListView::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
|
||||
{
|
||||
// TODO: 在此添加消息处理程序代码和/或调用默认值
|
||||
g_ui32PageCount++;
|
||||
CString strLog;
|
||||
strLog.Format(_T("zm:鼠标Page=%u\n"), g_ui32PageCount);
|
||||
OutputDebugString(strLog);
|
||||
::SendMessage(m_pMngFrm->m_hWnd, WM_LOADING_2D_DATA, (WPARAM)g_ui32PageCount, (LPARAM)VAL_ZERO);
|
||||
return CListView::OnMouseWheel(nFlags, zDelta, pt);
|
||||
}
|
||||
Reference in New Issue
Block a user