678 lines
17 KiB
C++
678 lines
17 KiB
C++
// opcreatesptreclistview.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "geomative.h"
|
|
#include "opcreatesptreclistview.h"
|
|
#include "opcreatesptgndlg.h"
|
|
#include <vector>
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// COpCreateSptRecListView
|
|
extern int g_iUILanguage;
|
|
IMPLEMENT_DYNCREATE(COpCreateSptRecListView, CListView)
|
|
|
|
COpCreateSptRecListView::COpCreateSptRecListView()
|
|
{
|
|
m_bSelRec = FALSE;
|
|
m_bRBDown = FALSE;
|
|
m_pNewChannel = NULL;
|
|
|
|
m_pCurSptRecord = NULL;
|
|
}
|
|
|
|
COpCreateSptRecListView::~COpCreateSptRecListView()
|
|
{
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(COpCreateSptRecListView, CListView)
|
|
//{{AFX_MSG_MAP(COpCreateSptRecListView)
|
|
ON_NOTIFY_REFLECT(NM_CLICK, OnClick)
|
|
ON_WM_LBUTTONDOWN()
|
|
ON_NOTIFY_REFLECT(LVN_ITEMCHANGED, OnItemchanged)
|
|
ON_COMMAND(IDM_OP_SPT_TP_GN, OnOpSptTpGn)
|
|
ON_NOTIFY_REFLECT(NM_RCLICK, OnRclick)
|
|
ON_NOTIFY_REFLECT(LVN_KEYDOWN, OnKeydown)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// COpCreateSptRecListView drawing
|
|
|
|
void COpCreateSptRecListView::OnDraw(CDC* pDC)
|
|
{
|
|
CDocument* pDoc = GetDocument();
|
|
// TODO: add draw code here
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// COpCreateSptRecListView diagnostics
|
|
|
|
#ifdef _DEBUG
|
|
void COpCreateSptRecListView::AssertValid() const
|
|
{
|
|
CListView::AssertValid();
|
|
}
|
|
|
|
void COpCreateSptRecListView::Dump(CDumpContext& dc) const
|
|
{
|
|
CListView::Dump(dc);
|
|
}
|
|
#endif //_DEBUG
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// COpCreateSptRecListView message handlers
|
|
|
|
void COpCreateSptRecListView::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_CHECKBOXES);
|
|
|
|
// m_pSptMngFrm = ((CMainFrame*)AfxGetMainWnd())->m_pSptMngFrm;
|
|
|
|
iColIndex++;
|
|
strColTitle.Empty();
|
|
strColTitle.LoadString(IDS_DB_SCRIPT_TSN);
|
|
GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_CENTER, 60);
|
|
|
|
iColIndex++;
|
|
strColTitle.Empty();
|
|
strColTitle.LoadString(IDS_DB_SCRIPT_C1);
|
|
GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_CENTER, 30);
|
|
|
|
iColIndex++;
|
|
strColTitle.Empty();
|
|
strColTitle.LoadString(IDS_DB_SCRIPT_C2);
|
|
GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_CENTER, 30);
|
|
|
|
iColIndex++;
|
|
strColTitle.Empty();
|
|
strColTitle.LoadString(IDS_DB_SCRIPT_P1);
|
|
GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_CENTER, 30);
|
|
|
|
iColIndex++;
|
|
strColTitle.Empty();
|
|
strColTitle.LoadString(IDS_DB_SCRIPT_P2);
|
|
GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_CENTER, 30);
|
|
|
|
iColIndex++;
|
|
strColTitle.Empty();
|
|
strColTitle.LoadString(IDS_DB_SCRIPT_K);
|
|
GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_RIGHT, 70);
|
|
|
|
iColIndex++;
|
|
strColTitle.Empty();
|
|
strColTitle.LoadString(IDS_DB_SCRIPT_N);
|
|
GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_CENTER, 60);
|
|
|
|
iColIndex++;
|
|
strColTitle.Empty();
|
|
strColTitle.LoadString(IDS_DB_SCRIPT_LEVEL);
|
|
GetListCtrl().InsertColumn(iColIndex, strColTitle, LVCFMT_CENTER, 30);
|
|
|
|
}
|
|
|
|
BOOL COpCreateSptRecListView::PreCreateWindow(CREATESTRUCT& cs)
|
|
{
|
|
// TODO: Add your specialized code here and/or call the base class
|
|
cs.style &= ~LVS_TYPEMASK;
|
|
cs.style |= LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS;
|
|
return CListView::PreCreateWindow(cs);
|
|
}
|
|
|
|
void COpCreateSptRecListView::OnClick(NMHDR* pNMHDR, LRESULT* pResult)
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
|
|
DWORD dwPos = GetMessagePos();
|
|
CString szLabel = _T("");
|
|
|
|
CPoint point(LOWORD(dwPos), HIWORD(dwPos));
|
|
|
|
GetListCtrl().ScreenToClient(&point);
|
|
|
|
LVHITTESTINFO lvinfo;
|
|
lvinfo.pt = point;
|
|
lvinfo.flags = LVHT_ABOVE;
|
|
|
|
UINT uFlag;
|
|
int iItem = GetListCtrl().HitTest(point, &uFlag);
|
|
|
|
if ((uFlag == LVHT_ONITEMSTATEICON) && (iItem != (int)VAL_MINUS_ONE))
|
|
{
|
|
GetListCtrl().SetItemState(iItem, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
|
|
}
|
|
|
|
/*
|
|
CSptRecord* pSptRecord = NULL;
|
|
|
|
CBrush BshPt;
|
|
CBrush* pOldBshPt = NULL;
|
|
|
|
CFont ftPt;
|
|
CFont* pOldFtPt = NULL;
|
|
|
|
CRect rectView;
|
|
|
|
int iMul = (int)VAL_ZERO;
|
|
|
|
DWORD dwPos = GetMessagePos();
|
|
CString szLabel = _T("");
|
|
|
|
CPoint point(LOWORD(dwPos), HIWORD(dwPos));
|
|
|
|
GetListCtrl().ScreenToClient(&point);
|
|
|
|
LVHITTESTINFO lvinfo;
|
|
lvinfo.pt = point;
|
|
lvinfo.flags = LVHT_ABOVE;
|
|
|
|
UINT uFlag;
|
|
int iItem = GetListCtrl().HitTest(point, &uFlag);
|
|
|
|
if (uFlag == LVHT_ONITEMSTATEICON)
|
|
{
|
|
if (TRUE == GetListCtrl().GetCheck(iItem))
|
|
{
|
|
pSptRecord = (CSptRecord*)GetListCtrl().GetItemData(iItem);
|
|
|
|
BshPt.CreateSolidBrush(RGB(150, 255, 255));
|
|
pSptRecord->m_colorREF = RGB(150, 255, 255);
|
|
pSptRecord->m_bIsSel = FALSE;
|
|
}
|
|
else
|
|
{
|
|
pSptRecord = (CSptRecord*)GetListCtrl().GetItemData(iItem);
|
|
|
|
BshPt.CreateSolidBrush(RGB(0, 255, 0));
|
|
pSptRecord->m_colorREF = RGB(0, 255, 0);
|
|
pSptRecord->m_bIsSel = TRUE;
|
|
}
|
|
|
|
((COpCreateSptFrame*)GetParentFrame())->m_pOpCreateSptView->SetScrollPos(SB_HORZ, pSptRecord->m_recPtArea.left);
|
|
((COpCreateSptFrame*)GetParentFrame())->m_pOpCreateSptView->SetScrollPos(SB_VERT, pSptRecord->m_recPtArea.top);
|
|
|
|
((COpCreateSptFrame*)GetParentFrame())->m_pOpCreateSptView->Invalidate();
|
|
}
|
|
*/
|
|
*pResult = 0;
|
|
}
|
|
|
|
void COpCreateSptRecListView::OnLButtonDown(UINT nFlags, CPoint point)
|
|
{
|
|
|
|
// TODO: Add your message handler code here and/or call default
|
|
/*
|
|
CSptRecord* pSptRecord = NULL;
|
|
|
|
CBrush BshPt;
|
|
CBrush* pOldBshPt = NULL;
|
|
|
|
CFont ftPt;
|
|
CFont* pOldFtPt = NULL;
|
|
|
|
CRect rectView;
|
|
|
|
int iMul = (int)VAL_ZERO;
|
|
|
|
// DWORD dwPos = GetMessagePos();
|
|
CString szLabel = _T("");
|
|
|
|
// CPoint point(LOWORD(dwPos), HIWORD(dwPos));
|
|
|
|
// GetListCtrl().ScreenToClient(&point);
|
|
|
|
LVHITTESTINFO lvinfo;
|
|
lvinfo.pt = point;
|
|
lvinfo.flags = LVHT_ABOVE;
|
|
|
|
UINT uFlag;
|
|
|
|
int iItem = GetListCtrl().HitTest(point, &uFlag);
|
|
|
|
if (uFlag == LVHT_ONITEMSTATEICON)
|
|
{
|
|
if (TRUE == GetListCtrl().GetCheck(iItem))
|
|
{
|
|
pSptRecord = (CSptRecord*)GetListCtrl().GetItemData(iItem);
|
|
|
|
BshPt.CreateSolidBrush(RGB(150, 255, 255));
|
|
pSptRecord->m_colorREF = RGB(150, 255, 255);
|
|
pSptRecord->m_bIsSel = FALSE;
|
|
}
|
|
else
|
|
{
|
|
pSptRecord = (CSptRecord*)GetListCtrl().GetItemData(iItem);
|
|
|
|
BshPt.CreateSolidBrush(RGB(0, 255, 0));
|
|
pSptRecord->m_colorREF = RGB(0, 255, 0);
|
|
pSptRecord->m_bIsSel = TRUE;
|
|
}
|
|
|
|
((COpCreateSptFrame*)GetParentFrame())->m_pOpCreateSptView->SetScrollPos(SB_HORZ, pSptRecord->m_recPtArea.left);
|
|
((COpCreateSptFrame*)GetParentFrame())->m_pOpCreateSptView->SetScrollPos(SB_VERT, pSptRecord->m_recPtArea.top);
|
|
|
|
((COpCreateSptFrame*)GetParentFrame())->m_pOpCreateSptView->Invalidate();
|
|
|
|
}
|
|
*/
|
|
CListView::OnLButtonDown(nFlags, point);
|
|
}
|
|
|
|
void COpCreateSptRecListView::OnItemchanged(NMHDR* pNMHDR, LRESULT* pResult)
|
|
{
|
|
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
|
|
// TODO: Add your control notification handler code here
|
|
CDC* pSptViewDC = NULL;
|
|
CSptRecord* pSptRecord = NULL;
|
|
|
|
CBrush BshPt;
|
|
CBrush* pOldBshPt = NULL;
|
|
|
|
CFont ftPt;
|
|
CFont* pOldFtPt = NULL;
|
|
|
|
CRect rectView;
|
|
CRect recPtArea;
|
|
|
|
int iMul = (int)VAL_ZERO;
|
|
|
|
DWORD dwPos = (DWORD)VAL_ZERO;
|
|
CString szLabel = _T("");
|
|
|
|
LVHITTESTINFO lvinfo;
|
|
|
|
UINT uFlag;
|
|
int iItem = (int)VAL_ZERO;
|
|
POSITION posRec;
|
|
|
|
dwPos = GetMessagePos();
|
|
CPoint point(LOWORD(dwPos), HIWORD(dwPos));
|
|
|
|
GetListCtrl().ScreenToClient(&point);
|
|
|
|
lvinfo.pt = point;
|
|
lvinfo.flags = LVHT_ABOVE;
|
|
|
|
if (FALSE == m_bSelRec)
|
|
{
|
|
iItem = GetListCtrl().HitTest(point, &uFlag);
|
|
}
|
|
else
|
|
{
|
|
posRec = GetListCtrl().GetFirstSelectedItemPosition();
|
|
iItem = GetListCtrl().GetNextSelectedItem(posRec);
|
|
}
|
|
|
|
if (iItem != (int)VAL_MINUS_ONE)
|
|
{
|
|
pSptRecord = (CSptRecord*)GetListCtrl().GetItemData(iItem);
|
|
// ((COpCreateSptFrame*)GetParentFrame())->m_pOpCreateSptInfoView->m_pCurSptRecord = pSptRecord;
|
|
// ((COpCreateSptFrame*)GetParentFrame())->m_pOpCreateSptInfoView->Invalidate();
|
|
}
|
|
|
|
if ((uFlag == LVHT_ONITEMSTATEICON) && (iItem != (int)VAL_MINUS_ONE) || (TRUE == m_bSelRec))
|
|
{
|
|
if (TRUE == GetListCtrl().GetCheck(iItem))
|
|
{
|
|
// pSptRecord = (CSptRecord*)GetListCtrl().GetItemData(iItem);
|
|
BshPt.CreateSolidBrush(RGB(0, 255, 0));
|
|
pSptRecord->m_colorREF = RGB(0, 255, 0);
|
|
pSptRecord->m_bIsSel = TRUE;
|
|
}
|
|
else
|
|
{
|
|
// pSptRecord = (CSptRecord*)GetListCtrl().GetItemData(iItem);
|
|
BshPt.CreateSolidBrush(RGB(150, 255, 255));
|
|
pSptRecord->m_colorREF = RGB(150, 255, 255);
|
|
pSptRecord->m_bIsSel = FALSE;
|
|
|
|
pSptRecord->m_iN = (int)VAL_ONE;
|
|
|
|
if (iItem != (int)VAL_MINUS_ONE)
|
|
{
|
|
szLabel.Empty();
|
|
szLabel.Format(_T("%d"), pSptRecord->m_iN);
|
|
GetListCtrl().SetItemText(iItem, 6, szLabel);
|
|
}
|
|
|
|
}
|
|
|
|
pSptViewDC = ((COpCreateSptFrame*)GetParentFrame())->m_pOpCreateSptView->GetDC();
|
|
|
|
pSptViewDC->SetBkMode(TRANSPARENT);
|
|
|
|
pOldBshPt = pSptViewDC->SelectObject(&BshPt);
|
|
|
|
iMul = ((COpCreateSptFrame*)GetParentFrame())->m_pOpCreateSptView->m_iMul;
|
|
|
|
ftPt.CreatePointFont(20+10*iMul, _T("Tahoma"));
|
|
pOldFtPt = pSptViewDC->SelectObject(&ftPt);
|
|
|
|
//-(GetScrollPos(SB_HORZ)), -(GetScrollPos(SB_VERT))
|
|
|
|
recPtArea = pSptRecord->m_recPtArea;
|
|
recPtArea.left -= ((COpCreateSptFrame*)GetParentFrame())->m_pOpCreateSptView->GetScrollPos(SB_HORZ);
|
|
recPtArea.right -= ((COpCreateSptFrame*)GetParentFrame())->m_pOpCreateSptView->GetScrollPos(SB_HORZ);
|
|
|
|
recPtArea.top -= ((COpCreateSptFrame*)GetParentFrame())->m_pOpCreateSptView->GetScrollPos(SB_VERT);
|
|
recPtArea.bottom -= ((COpCreateSptFrame*)GetParentFrame())->m_pOpCreateSptView->GetScrollPos(SB_VERT);
|
|
|
|
pSptViewDC->Ellipse(recPtArea);
|
|
|
|
szLabel.Empty();
|
|
szLabel.Format(_T("%d"), pSptRecord->m_iTsn);
|
|
pSptViewDC->DrawText(szLabel, recPtArea, DT_SINGLELINE | DT_VCENTER | DT_CENTER);
|
|
|
|
pSptViewDC->SelectObject(pOldBshPt);
|
|
pSptViewDC->SelectObject(pOldFtPt);
|
|
|
|
((COpCreateSptFrame*)GetParentFrame())->m_pOpCreateSptView->GetClientRect(&rectView);
|
|
|
|
if (((recPtArea.right < (int)VAL_ZERO) || (recPtArea.bottom < (int)VAL_ZERO)) || ((recPtArea.right > rectView.right) || (recPtArea.bottom > rectView.bottom))) // 动态移动显示区
|
|
{
|
|
((COpCreateSptFrame*)GetParentFrame())->m_pOpCreateSptView->SetScrollPos(SB_HORZ, pSptRecord->m_recPtArea.left);
|
|
((COpCreateSptFrame*)GetParentFrame())->m_pOpCreateSptView->SetScrollPos(SB_VERT, pSptRecord->m_recPtArea.top);
|
|
((COpCreateSptFrame*)GetParentFrame())->m_pOpCreateSptView->Invalidate();
|
|
}
|
|
|
|
m_bSelRec = FALSE;
|
|
}
|
|
|
|
*pResult = 0;
|
|
}
|
|
|
|
void COpCreateSptRecListView::OnOpSptTpGn()
|
|
{
|
|
// TODO: Add your command handler code here
|
|
COpCreateSptGNDlg opCreateSptGNDlg;
|
|
|
|
INT_PTR nRet = -1;
|
|
|
|
if (NULL != m_pCurSptRecord)
|
|
{
|
|
opCreateSptGNDlg.m_iN = m_pCurSptRecord->m_iN-1;
|
|
opCreateSptGNDlg.m_iCurLevel = m_pCurSptRecord->m_iLevel;
|
|
opCreateSptGNDlg.m_iMaxLevel = m_pNewChannel->m_iMaxLevel;
|
|
|
|
if (IDOK == opCreateSptGNDlg.DoModal())
|
|
{
|
|
switch (opCreateSptGNDlg.m_iEf)
|
|
{
|
|
case 0:
|
|
SetNToPoint(opCreateSptGNDlg.m_iN);
|
|
break;
|
|
case 1:
|
|
SetNToLevel(opCreateSptGNDlg.m_iN);
|
|
break;
|
|
case 2:
|
|
SetNUnderCurLevel(opCreateSptGNDlg.m_iN);
|
|
break;
|
|
case 3:
|
|
SetNToSelLevel(opCreateSptGNDlg.m_iN, opCreateSptGNDlg.m_iSelLevel);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
m_pCurSptRecord = NULL;
|
|
}
|
|
}
|
|
|
|
void COpCreateSptRecListView::OnRclick(NMHDR* pNMHDR, LRESULT* pResult)
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
|
|
|
|
CString szLabel = _T("");
|
|
CSptRecord* pSptRecord = NULL;
|
|
|
|
CMenu gnMenu;
|
|
CMenu* pPopGnMenu = NULL;
|
|
|
|
int iSubItem = pNMListView->iSubItem;
|
|
|
|
POSITION posRec;
|
|
|
|
DWORD dwPos = GetMessagePos();
|
|
CPoint point(LOWORD(dwPos), HIWORD(dwPos));
|
|
|
|
GetListCtrl().ScreenToClient(&point);
|
|
|
|
LVHITTESTINFO lvinfo;
|
|
lvinfo.pt = point;
|
|
lvinfo.flags = LVHT_ABOVE;
|
|
|
|
UINT uFlag;
|
|
int iItem = GetListCtrl().HitTest(point, &uFlag);
|
|
|
|
if ((uFlag == LVHT_ONITEMSTATEICON) && (iItem != (int)VAL_MINUS_ONE))
|
|
{
|
|
GetListCtrl().SetItemState(iItem, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
|
|
}
|
|
|
|
posRec = GetListCtrl().GetFirstSelectedItemPosition();
|
|
iItem = GetListCtrl().GetNextSelectedItem(posRec);
|
|
|
|
if (iItem != (int)VAL_MINUS_ONE)
|
|
{
|
|
pSptRecord = (CSptRecord*)(GetListCtrl().GetItemData(iItem));
|
|
}
|
|
|
|
if (((uFlag != LVHT_ONITEMSTATEICON) || ((int)VAL_MINUS_ONE) == iItem) && (NULL != pSptRecord)) //当右键未单击checkbox时,弹出菜单
|
|
{
|
|
if (TRUE == pSptRecord ->m_bIsSel)
|
|
{
|
|
m_pCurSptRecord = pSptRecord;
|
|
|
|
GetListCtrl().ClientToScreen(&point);
|
|
gnMenu.LoadMenu(IDR_GN);
|
|
pPopGnMenu = gnMenu.GetSubMenu(0);
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
pPopGnMenu->ModifyMenu(0, MF_BYPOSITION, IDM_OP_SPT_TP_GN, _T("修改迭代数"));
|
|
else
|
|
pPopGnMenu->ModifyMenu(0, MF_BYPOSITION, IDM_OP_SPT_TP_GN, _T("modify stacking"));
|
|
pPopGnMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
|
|
}
|
|
}
|
|
|
|
*pResult = 0;
|
|
}
|
|
|
|
void COpCreateSptRecListView::OnKeydown(NMHDR* pNMHDR, LRESULT* pResult)
|
|
{
|
|
LV_KEYDOWN* pLVKeyDow = (LV_KEYDOWN*)pNMHDR;
|
|
// TODO: Add your control notification handler code here
|
|
if ((VK_SPACE == pLVKeyDow->wVKey) && (NULL != m_pNewChannel))
|
|
{
|
|
if (m_pNewChannel->m_sptRecArray.GetSize() != (int)VAL_ZERO)
|
|
{
|
|
m_bSelRec = TRUE;
|
|
}
|
|
}
|
|
|
|
*pResult = 0;
|
|
}
|
|
|
|
void COpCreateSptRecListView::SetNToPoint(int iN)
|
|
{
|
|
CString szLabel = _T("");
|
|
LVFINDINFO info;
|
|
int iIndex = (int)VAL_ZERO;
|
|
|
|
m_pCurSptRecord->m_iN = iN;
|
|
info.flags = LVFI_PARTIAL | LVFI_PARAM;
|
|
info.lParam = (long)m_pCurSptRecord;
|
|
|
|
iIndex = GetListCtrl().FindItem(&info);
|
|
|
|
if (iIndex != (int)VAL_MINUS_ONE)
|
|
{
|
|
szLabel.Empty();
|
|
szLabel.Format(_T("%d"), iN);
|
|
GetListCtrl().SetItemText(iIndex, 6, szLabel);
|
|
}
|
|
|
|
}
|
|
|
|
void COpCreateSptRecListView::SetNToLevel(int iN)
|
|
{
|
|
CSptRecord* pSptRecord = NULL;
|
|
int iRecIndex = (int)VAL_ZERO;
|
|
int iRecCount = (int)VAL_ZERO;
|
|
|
|
int iIndex = (int)VAL_ZERO;
|
|
|
|
LVFINDINFO info;
|
|
CString szLabel = _T("");
|
|
|
|
iRecCount = m_pNewChannel->m_sptRecArray.GetSize();
|
|
|
|
for (iRecIndex = (int)VAL_ZERO; iRecIndex < iRecCount; iRecIndex++)
|
|
{
|
|
pSptRecord = (CSptRecord*)m_pNewChannel->m_sptRecArray.GetAt(iRecIndex);
|
|
|
|
if ((TRUE == pSptRecord->m_bIsSel) && (pSptRecord->m_iLevel == m_pCurSptRecord->m_iLevel))
|
|
{
|
|
pSptRecord->m_iN = iN;
|
|
info.flags = LVFI_PARTIAL | LVFI_PARAM;
|
|
info.lParam = (long)pSptRecord;
|
|
|
|
iIndex = GetListCtrl().FindItem(&info);
|
|
|
|
if (iIndex != (int)VAL_MINUS_ONE)
|
|
{
|
|
szLabel.Empty();
|
|
szLabel.Format(_T("%d"), iN);
|
|
GetListCtrl().SetItemText(iIndex, 6, szLabel);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void COpCreateSptRecListView::SetNUnderCurLevel(int iN)
|
|
{
|
|
CSptRecord* pSptRecord = NULL;
|
|
int iRecIndex = (int)VAL_ZERO;
|
|
int iRecCount = (int)VAL_ZERO;
|
|
|
|
int iIndex = (int)VAL_ZERO;
|
|
|
|
LVFINDINFO info;
|
|
CString szLabel = _T("");
|
|
|
|
iRecCount = m_pNewChannel->m_sptRecArray.GetSize();
|
|
|
|
for (iRecIndex = (int)VAL_ZERO; iRecIndex < iRecCount; iRecIndex++)
|
|
{
|
|
pSptRecord = (CSptRecord*)m_pNewChannel->m_sptRecArray.GetAt(iRecIndex);
|
|
|
|
if ((TRUE == pSptRecord->m_bIsSel) && (pSptRecord->m_iLevel >= m_pCurSptRecord->m_iLevel))
|
|
{
|
|
pSptRecord->m_iN = iN;
|
|
info.flags = LVFI_PARTIAL | LVFI_PARAM;
|
|
info.lParam = (long)pSptRecord;
|
|
|
|
iIndex = GetListCtrl().FindItem(&info);
|
|
|
|
if (iIndex != (int)VAL_MINUS_ONE)
|
|
{
|
|
szLabel.Empty();
|
|
szLabel.Format(_T("%d"), iN);
|
|
GetListCtrl().SetItemText(iIndex, 6, szLabel);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void COpCreateSptRecListView::SetNToSelLevel(int iN, int iSelLevel)
|
|
{
|
|
CSptRecord* pSptRecord = NULL;
|
|
int iRecIndex = (int)VAL_ZERO;
|
|
int iRecCount = (int)VAL_ZERO;
|
|
|
|
int iIndex = (int)VAL_ZERO;
|
|
|
|
LVFINDINFO info;
|
|
CString szLabel = _T("");
|
|
|
|
iRecCount = m_pNewChannel->m_sptRecArray.GetSize();
|
|
|
|
for (iRecIndex = (int)VAL_ZERO; iRecIndex < iRecCount; iRecIndex++)
|
|
{
|
|
pSptRecord = (CSptRecord*)m_pNewChannel->m_sptRecArray.GetAt(iRecIndex);
|
|
|
|
if ((TRUE == pSptRecord->m_bIsSel) && (pSptRecord->m_iLevel >= m_pCurSptRecord->m_iLevel) && (pSptRecord->m_iLevel <= iSelLevel))
|
|
{
|
|
pSptRecord->m_iN = iN;
|
|
info.flags = LVFI_PARTIAL | LVFI_PARAM;
|
|
info.lParam = (long)pSptRecord;
|
|
|
|
iIndex = GetListCtrl().FindItem(&info);
|
|
|
|
if (iIndex != (int)VAL_MINUS_ONE)
|
|
{
|
|
szLabel.Empty();
|
|
szLabel.Format(_T("%d"), iN);
|
|
GetListCtrl().SetItemText(iIndex, 6, szLabel);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void COpCreateSptRecListView::ChangeListHeaderOrder(std::vector<int> vtOrder)
|
|
{
|
|
if (4 != vtOrder.size())
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("输入列表头数据错误"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Input list header data error"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return;
|
|
}
|
|
CHeaderCtrl* pHeaderCtrl = GetListCtrl().GetHeaderCtrl();
|
|
|
|
if (pHeaderCtrl != NULL)
|
|
{
|
|
int nColumnCount = pHeaderCtrl->GetItemCount();
|
|
LPINT pnOrder = (LPINT) malloc(nColumnCount*sizeof(int));
|
|
ASSERT(pnOrder != NULL);
|
|
//获得列顺序到数组
|
|
GetListCtrl().GetColumnOrderArray(pnOrder, nColumnCount);
|
|
if (nColumnCount < 5)
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("解析列表列错误"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Parser list column error."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
free(pnOrder);
|
|
return;
|
|
}
|
|
int temp ;
|
|
for (int i = 0; i < vtOrder.size(); i++)
|
|
{
|
|
// temp = pnOrder[i+1];
|
|
// pnOrder[i+1] = pnOrder[vtOrder[i]];
|
|
// pnOrder[vtOrder[i]] = temp;
|
|
temp = vtOrder[i];
|
|
pnOrder[i+1] =temp;
|
|
}
|
|
|
|
//设置列顺序
|
|
GetListCtrl().SetColumnOrderArray(nColumnCount, pnOrder);
|
|
free(pnOrder);
|
|
}
|
|
|
|
} |