You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

512 lines
17 KiB
C++

#include "stdafx.h"
#include "LaiPuLaser.h"
#include "afxdialogex.h"
#include "DlgOffsetTable.h"
#include "GlobalFunction.h"
#include "LogMgr.h"
#include "FileMgr.h"
#include "CStringFuc.h"
#include "WorkFileMgr.h"
#include "RecipeMgr.h"
#include "WaferRecipeDataMgr.h"
#include "MsgBox.h"
#include "DlgCreatOffsetTable.h"
#include "AuthorityMgr.h"
#define Data_List_Item_Cnt 4
IMPLEMENT_DYNAMIC(CDlgOffsetTable, CDialogEx)
BEGIN_MESSAGE_MAP(CDlgOffsetTable, CDialogEx)
ON_NOTIFY(TVN_ITEMEXPANDED, IDC_DATA_FOLDE_TREE, &CDlgOffsetTable::OnTvnItemexpandedDataFoldeTree)
ON_NOTIFY(TVN_SELCHANGED, IDC_DATA_FOLDE_TREE, &CDlgOffsetTable::OnTvnSelchangedDataFoldeTree)
ON_BN_CLICKED(IDC_SEARCH_TAB_BY_NAME, &CDlgOffsetTable::OnBnClickedSearchByName)
ON_BN_CLICKED(IDC_UPDATE_TAB_LIST, &CDlgOffsetTable::OnBnClickedUpdateTabList)
ON_BN_CLICKED(IDC_SAVE_CUR_OFFSET_TAB, &CDlgOffsetTable::OnBnClickedSaveCurOffsetTab)
ON_BN_CLICKED(IDC_DEL_OFFSET_TAB, &CDlgOffsetTable::OnBnClickedDelOffsetTab)
ON_BN_CLICKED(IDC_CREAT_OFFSET_TAB, &CDlgOffsetTable::OnBnClickedCreatOffsetTab)
ON_NOTIFY(NM_CLICK, NEW_EDIT_INFO_LIST, &CDlgOffsetTable::OnNMClickEditInfoList)
ON_EN_KILLFOCUS(IDC_EDIT_PAR_DOUBLE, &CDlgOffsetTable::OnEnKillfocusDoubleEdit)
END_MESSAGE_MAP()
CDlgOffsetTable::CDlgOffsetTable(CWnd* pParent /*=NULL*/)
: CDialogEx(CDlgOffsetTable::IDD, pParent)
{
m_EditDoubleParVal = 0;
}
CDlgOffsetTable::~CDlgOffsetTable()
{
}
void CDlgOffsetTable::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, IDC_DATA_FOLDE_TREE, m_MonitorDataTree);
DDX_Control(pDX, NEW_HISTORY_LIST, m_OffsetTableHistoryList);
DDX_Control(pDX, NEW_EDIT_INFO_LIST, m_OffsetList);
DDX_Control(pDX, IDC_EDIT_PAR_DOUBLE, m_DoubleParEdit);
DDX_Text(pDX,IDC_EDIT_PAR_DOUBLE,m_EditDoubleParVal);
}
BOOL CDlgOffsetTable::OnInitDialog()
{
CDialogEx::OnInitDialog();
CTreeCtrl &m_tree = m_MonitorDataTree;
m_tree.ModifyStyle(NULL,TVS_HASBUTTONS|TVS_HASLINES|TVS_LINESATROOT|TVS_EDITLABELS);
InitDataList();
gWaferRecipeDataMgr->InitOffsetTableList(m_OffsetList);
OnBnClickedUpdateTabList();
UpdateData(FALSE);
return TRUE;
}
void CDlgOffsetTable::InitDataList()
{
//<2F><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>
m_OffsetTableHistoryList.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CString s;
for(int k=0;k<Data_List_Item_Cnt;k++)
{
s.Format("Col%d",k+1);
m_OffsetTableHistoryList.InsertColumn(k,s,LVCFMT_CENTER,150,-1);
}
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><><C2B7><EFBFBD><EFBFBD>
void CDlgOffsetTable::GetLogicalDrives(HTREEITEM hParent)
{
CTreeCtrl &m_tree = m_MonitorDataTree;
CString path = m_FindFilePath;
m_tree.InsertItem(path,hParent); //<2F>ڸ<EFBFBD><DAB8>ڵ<EFBFBD>hParent<6E><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̷<EFBFBD>
}
void CDlgOffsetTable::GetLogicalDrives(HTREEITEM hParent, COleDateTime SelDate,bool bByMonth)
{
CTreeCtrl &m_tree = m_MonitorDataTree;
CString path = m_FindFilePath;
CString DateStr;
if(bByMonth)
DateStr = SelDate.Format("%Y\\%m\\");
else
DateStr = SelDate.Format("%Y\\%m\\%d\\");
m_tree.InsertItem(path+ DateStr, hParent); //<2F>ڸ<EFBFBD><DAB8>ڵ<EFBFBD>hParent<6E><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̷<EFBFBD>
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>̷<EFBFBD><CCB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
void CDlgOffsetTable::GetDriveDir(HTREEITEM hParent)
{
CTreeCtrl &m_tree = m_MonitorDataTree;
HTREEITEM hChild = m_tree.GetChildItem(hParent); //<2F><>ȡָ<C8A1><D6B8>λ<EFBFBD><CEBB><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
while(hChild)
{
CString strText = m_tree.GetItemText(hChild); //<2F><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>
if(strText.Right(1) != "\\") //<2F><><EFBFBD>ұ<EFBFBD>1<EFBFBD><31>ʼ<EFBFBD><CABC>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>nCount<6E><74><EFBFBD>ַ<EFBFBD>
strText += _T("\\");
strText += "*.*";
//<2F><><EFBFBD><EFBFBD>ǰĿ¼<C4BF><C2BC><EFBFBD>ļ<EFBFBD>ö<EFBFBD>ٲ<EFBFBD>InsertItem<65><6D>״<EFBFBD><D7B4>ʾ
CFileFind file; //<2F><><EFBFBD><EFBFBD><E5B1BE><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
BOOL bContinue = file.FindFile(strText); //<2F><><EFBFBD>Ұ<EFBFBD><D2B0><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
while(bContinue)
{
bContinue = file.FindNextFile(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ļ<EFBFBD>
if(file.IsDirectory() && !file.IsDots()) //<2F>ҵ<EFBFBD><D2B5>ļ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD>Ϊ<EFBFBD><CEAA>"."
{
CString Name = file.GetFileName();
if(!m_bHistoryMode && Name.Find("TableHistory")!=-1)
continue;
m_tree.InsertItem(Name,hChild); //<2F><><EFBFBD><EFBFBD><EFBFBD>̷<EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
}
}
GetDriveDir(hChild); //<2F>ݹ<EFBFBD><DDB9><EFBFBD><EFBFBD><EFBFBD>
hChild = m_tree.GetNextItem(hChild,TVGN_NEXT); //<2F><>ȡ<EFBFBD><C8A1><EFBFBD>οؼ<CEBF>TVGN_NEXT<58><54><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>
}
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>Ŀȫ<C4BF><C8AB>·<EFBFBD><C2B7>
CString CDlgOffsetTable::GetFullPath(HTREEITEM hCurrent)
{
CTreeCtrl &m_tree = m_MonitorDataTree;
CString strTemp;
CString strReturn = "";
while(hCurrent != m_hRoot)
{
strTemp = m_tree.GetItemText(hCurrent); //<2F><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>
if(strTemp.Right(1) != "\\")
strTemp += "\\";
strReturn = strTemp + strReturn;
hCurrent = m_tree.GetParentItem(hCurrent); //<2F><><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>
}
return strReturn;
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼
void CDlgOffsetTable::AddSubDir(HTREEITEM hParent)
{
CTreeCtrl &m_tree = m_MonitorDataTree;
CString strPath = GetFullPath(hParent); //<2F><>ȡȫ·<C8AB><C2B7>
if(strPath.Find(m_FindFileSuffix)!=-1)
{
int len = strPath.GetLength();
strPath.Delete(len-1,1);//ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>'\'
return;
}
if(strPath.Right(1) != "\\")
strPath += "\\";
strPath += "*.*";
CFileFind file;
BOOL bContinue = file.FindFile(strPath); //<2F><><EFBFBD>Ұ<EFBFBD><D2B0><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
while(bContinue)
{
bContinue = file.FindNextFile(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ļ<EFBFBD>
//if(file.IsDirectory() && !file.IsDots())
if(!file.IsDots())
{
m_tree.InsertItem(file.GetFileName(),hParent);
}
}
}
//ɾ<><C9BE>hItem <20><><EFBFBD><EFBFBD><EFBFBD>ӽڵ<D3BD>
void CDlgOffsetTable::DelAllChildOfItem(HTREEITEM hItem)
{
CTreeCtrl &m_Tree = m_MonitorDataTree;
{
HTREEITEM hNextItem=NULL;
HTREEITEM hChildItem=m_Tree.GetChildItem(hItem);
while (hChildItem!=NULL)
{
hNextItem=m_Tree.GetNextItem(hChildItem,TVGN_NEXT);
m_Tree.DeleteItem(hChildItem);
hChildItem=hNextItem;
}
}
}
//<2F><>Ӧ<EFBFBD>ڵ<EFBFBD>չ<EFBFBD><D5B9><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
void CDlgOffsetTable::OnTvnItemexpandedDataFoldeTree(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
CTreeCtrl &m_tree = m_MonitorDataTree;
TVITEM item = pNMTreeView->itemNew; //<2F><><EFBFBD><EFBFBD>\<5C><><EFBFBD>ܹ<EFBFBD><DCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>Ŀ<EFBFBD><C4BF>Ϣ
if(item.hItem == m_hRoot)
return;
//<2F><>ȡitem.hItem <20>ĵ<EFBFBD>һ<EFBFBD><D2BB>ChildItem
HTREEITEM hChild = m_tree.GetChildItem(item.hItem);
//ɾ<><C9BE><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>ӽڵ<D3BD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1>ֵ㿪<D6B5><E3BFAA>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬)
if(m_tree.ItemHasChildren(hChild))
return;
//<2F><><EFBFBD><EFBFBD><EFBFBD>ӽڵ<D3BD>
while(hChild)
{
AddSubDir(hChild); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼
hChild = m_tree.GetNextItem(hChild,TVGN_NEXT); //<2F><>ȡ<EFBFBD><C8A1><EFBFBD>οؼ<CEBF>TVGN_NEXT<58><54><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>
}
*pResult = 0;
}
//<2F><><EFBFBD><EFBFBD>
void CDlgOffsetTable::UpdateOffsetTableTree()
{
CTreeCtrl &m_tree = m_MonitorDataTree;
m_tree.DeleteItem(m_hRoot);//ȫ<><C8AB>ɾ<EFBFBD><C9BE>
m_hRoot = m_tree.InsertItem("root"); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>
GetLogicalDrives(m_hRoot); //<2F>Զ<EFBFBD><D4B6><EFBFBD><E5BAAF> <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
GetDriveDir(m_hRoot); //<2F>Զ<EFBFBD><D4B6><EFBFBD><E5BAAF> <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//m_tree.Expand(m_hRoot,TVE_EXPAND); //չ<><D5B9><EFBFBD><EFBFBD><EFBFBD>۵<EFBFBD><DBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD> TVE_EXPANDչ<44><D5B9><EFBFBD>б<EFBFBD>
ExpandTree(&m_tree,m_hRoot);//չ<><D5B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>нڵ<D0BD>
}
void CDlgOffsetTable::OnTvnSelchangedDataFoldeTree(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
// NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
TVITEM item = pNMTreeView->itemNew;
if(item.hItem == m_hRoot)
return;
CString strPath = GetFullPath(item.hItem);
int len = strPath.GetLength();
strPath.Delete(len-1,1);//ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>'\'
gLogMgr->WriteDebugLog(strPath);
m_CurSelPath = strPath;
if(strPath.Find(m_FindFileSuffix)!=-1)
{
if(m_bHistoryMode)
{
UpdateHistoryList(strPath);
}
else
{
CFileMgr FileMgr;
CString FileName = FileMgr.GetFileNameFromPath(strPath,true);
GetDlgItem(IDC_SEARCH_NAME_EDIT)->SetWindowText(FileName);
gWaferRecipeDataMgr->UpdateOffsetTableList(m_OffsetList,strPath);
}
}
*pResult = 0;
}
//<2F><><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD>µĽڵ<C4BD>,<2C>ݹ麯<DDB9><E9BAAF>
void CDlgOffsetTable::GetDriveDir_ByPath(HTREEITEM hParent,CString FindPath,CString SearchName)
{
CFileMgr FileMgr;
vector<CString> DirPathVec;//<2F><>Ŀ¼·<C2BC><C2B7>
FileMgr.GetChildFileOrDirName(true,FindPath,DirPathVec,"");
//û<><C3BB><EFBFBD><EFBFBD>Ŀ¼<C4BF><C2BC>ʾ<EFBFBD><CABE>Ŀ¼
if(DirPathVec.empty())
{
CString DataPath = gProgramLaserTuiHuo->GetLaipuLaserDataDir(OFFSET_TAB_HISTORY_PATH);
int FindPathLen = FindPath.GetLength();
int DataPathLen = DataPath.GetLength();
if(DataPathLen>=FindPathLen)
return;
CString ChildDirName = FindPath.Right(FindPathLen-DataPathLen);//<2F>ӽڵ<D3BD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CTreeCtrl &m_tree = m_MonitorDataTree;
HTREEITEM hChild = m_tree.GetChildItem(hParent); //<2F><>ȡָ<C8A1><D6B8>λ<EFBFBD><CEBB><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
bool bChild2Creat = false;
vector<CString> FilePathVec;//<2F>ļ<EFBFBD>·<EFBFBD><C2B7>
FileMgr.GetChildFileOrDirName(false,FindPath,FilePathVec,m_FindFileSuffix);
int size = FilePathVec.size();
for(int k=0;k<size;k++)
{
CString FileName = FileMgr.GetFileNameFromPath(FilePathVec[k],false);
gLogMgr->WriteDebugLog(FileName);
//<2F><>SearchName ɸѡ
if(SearchName!="" && FileName.Find(SearchName)==-1)
continue;
if(!bChild2Creat)//<2F><><EFBFBD><EFBFBD>Child2 <20>ڵ<EFBFBD>
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>
m_tree.InsertItem(ChildDirName, hChild);
if(m_bFirstDir)
{
m_hChild2 = m_tree.GetChildItem(hChild);
m_bFirstDir = false;
}
else
{
m_hChild2 = m_tree.GetNextItem(m_hChild2,TVGN_NEXT);
}
bChild2Creat = true;
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
m_tree.InsertItem(FileName,m_hChild2);
}
}
else//<2F>ݹ<EFBFBD><DDB9><EFBFBD><EFBFBD><EFBFBD>
{
int size = DirPathVec.size();
for(int k=0;k<size;k++)
{
CString ChildPath = DirPathVec[k]+"\\";
GetDriveDir_ByPath(hParent,ChildPath,SearchName);
}
}
}
//չ<><D5B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>нڵ<D0BD>
void CDlgOffsetTable::ExpandTree(CTreeCtrl* pTreeCtrl,HTREEITEM hItem)
{
HTREEITEM hChild,hNext,hParent;
if((!hItem)||(!pTreeCtrl))
return;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><D5B9><EFBFBD>ڵ<EFBFBD>
pTreeCtrl->Expand(hItem,TVE_EXPAND);
hChild = pTreeCtrl->GetNextItem(hItem,TVGN_CHILD);
if(hChild)
{//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽڵ㣬չ<E3A3AC><D5B9><EFBFBD>ӽڵ<D3BD>
ExpandTree(pTreeCtrl,hChild);
}
else
{//û<><C3BB><EFBFBD>ӽڵ㣬Ѱ<E3A3AC><D1B0><EFBFBD><EFBFBD><EFBFBD>ֵܽڵ<DCBD>
hNext = pTreeCtrl->GetNextItem(hItem,TVGN_NEXT);
if(hNext)
{//<2F><><EFBFBD><EFBFBD><EFBFBD>ֵܽڵ<DCBD>
ExpandTree(pTreeCtrl,hNext);
}
else
{//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵܽڵ㣬<DAB5><E3A3AC><EFBFBD><EFBFBD><EFBFBD>Ҹ<EFBFBD><D2B8>ڵ<EFBFBD>
hParent = pTreeCtrl->GetParentItem(hItem);
hNext = pTreeCtrl->GetNextItem(hParent,TVGN_NEXT);
if(hNext)
ExpandTree(pTreeCtrl,hNext);
}
}
}
void CDlgOffsetTable::SearchByName(CString SearchName)
{
GetDlgItem(IDC_SEARCH_NAME_EDIT)->SetWindowText(SearchName);
OnBnClickedSearchByName();
}
void CDlgOffsetTable::UpdateHistoryList(CString strPath)
{
m_OffsetTableHistoryList.DeleteAllItems();
vector<vector<CString>> StrVec;
CString log("ReadFile : ");
log += strPath;
gLogMgr->WriteDebugLog(log);
CFileMgr FileMgr;
FileMgr.ReadFileToStrVec(strPath,StrVec,true);
int size = StrVec.size();
for(int k=0;k<size;k++)
{
int size1 = StrVec[k].size();
m_OffsetTableHistoryList.InsertItem(k," ");//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
for(int i=0;i<size1;i++)
{
if(i>=Data_List_Item_Cnt)
break;
m_OffsetTableHistoryList.SetItemText(k,i,StrVec[k][i]);//<2F><><EFBFBD><EFBFBD>
}
}
}
//<2F><><EFBFBD><EFBFBD>recipe <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
void CDlgOffsetTable::OnNMClickEditInfoList(NMHDR *pNMHDR, LRESULT *pResult)
{
*pResult = 0;
if(!gAuthorityMgr->CheckAuthorityByName("AUTHORITY_EditRecipe",false))
return;
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
int Row = pNMListView->iItem;
if(Row >= 0)//<2F>к<EFBFBD>
{
CListCtrl &ListCtrl = m_OffsetList;
int Col = pNMListView->iSubItem;
if(Col == OffsetTab_List_Val_Col)
{
//<2F><>¼<EFBFBD><C2BC>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD>
m_row = Row;
m_col = Col;
CRect rc;
ListCtrl.GetSubItemRect(Row,Col, LVIR_LABEL, rc);//ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>
ListCtrl.ClientToScreen(&rc);
ScreenToClient(&rc);
CString s = ListCtrl.GetItemText(Row,Col);//ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
CEdit &Edit = m_DoubleParEdit;
Edit.SetWindowText(s);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><E0BCAD><EFBFBD><EFBFBD>
Edit.MoveWindow(&rc);//<2F><><EFBFBD><EFBFBD><E0BCAD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E6A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Edit.ShowWindow(SW_SHOW);//<2F><>ʾ<EFBFBD><EFBFBD><E0BCAD>
Edit.SetFocus();//ʹ<><EFBFBD><E0BCAD>ȡ<EFBFBD>ý<EFBFBD><C3BD><EFBFBD>
Edit.CreateSolidCaret(1, rc.Height() - 5);//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Edit.ShowCaret();//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
Edit.SetSel(0, -1);//ʹ<><CAB9><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}
}
}
}
//Edit <20><EFBFBD><EBBDB9>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊlist <20><>ֵ
void CDlgOffsetTable::OnEnKillfocusDoubleEdit()
{
m_DoubleParEdit.ShowWindow(SW_HIDE);
if(m_col < 0 || m_row < 0)
return;
CString key;
m_DoubleParEdit.GetWindowText(key);
m_OffsetList.SetItemText(m_row, m_col, key);
}
#if 1
void CDlgOffsetTable::SetHistoryMode(bool bHistoryMode)
{
m_bHistoryMode = bHistoryMode;//<2F><>ǰ<EFBFBD>Dz鿴<C7B2><E9BFB4>ʷ<EFBFBD><CAB7>¼<EFBFBD><C2BC>ģʽ
if(bHistoryMode)
{
m_FindFileSuffix = OFFSET_TAB_HISTORY_SUFFIX;//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>׺
m_FindFilePath = gProgramLaserTuiHuo->GetLaipuLaserDataDir(OFFSET_TAB_HISTORY_PATH);//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>׺
GetDlgItem(IDC_SAVE_CUR_OFFSET_TAB)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_DEL_OFFSET_TAB)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_CREAT_OFFSET_TAB)->ShowWindow(SW_HIDE);
GetDlgItem(NEW_EDIT_INFO_LIST)->ShowWindow(SW_HIDE);
GetDlgItem(NEW_HISTORY_LIST)->ShowWindow(SW_SHOW);
}
else
{
m_FindFileSuffix = OFFSET_TAB_FILE_SUFFIX;//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>׺
m_FindFilePath = gProgramLaserTuiHuo->GetLaipuLaserDataDir(OFFSET_TAB_PATH);//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>׺
GetDlgItem(IDC_SAVE_CUR_OFFSET_TAB)->ShowWindow(SW_SHOW);
GetDlgItem(IDC_DEL_OFFSET_TAB)->ShowWindow(SW_SHOW);
GetDlgItem(IDC_CREAT_OFFSET_TAB)->ShowWindow(SW_SHOW);
GetDlgItem(NEW_EDIT_INFO_LIST)->ShowWindow(SW_SHOW);
GetDlgItem(NEW_HISTORY_LIST)->ShowWindow(SW_HIDE);
}
}
void CDlgOffsetTable::OnBnClickedUpdateTabList()
{
SetHistoryMode(false);
UpdateOffsetTableTree();
}
void CDlgOffsetTable::OnBnClickedSearchByName()
{
gLogMgr->WriteDebugLog("Func-->OnBnClickedSearchByName");
SetHistoryMode(true);
CString SearchName;
GetDlgItem(IDC_SEARCH_NAME_EDIT)->GetWindowText(SearchName);
if(SearchName=="")
{
UpdateOffsetTableTree();
return;
}
CTreeCtrl &m_tree = m_MonitorDataTree;
m_tree.DeleteItem(m_hRoot);//ȫ<><C8AB>ɾ<EFBFBD><C9BE>
m_hRoot = m_tree.InsertItem("root");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>
CString path = m_FindFilePath;
m_tree.InsertItem(path, m_hRoot);//<2F>ڸ<EFBFBD><DAB8>ڵ<EFBFBD>hParent<6E><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̷<EFBFBD>
m_bFirstDir = true;//<2F><>һ<EFBFBD><D2BB>Ŀ¼
GetDriveDir_ByPath(m_hRoot,path,SearchName);//<2F>Զ<EFBFBD><D4B6><EFBFBD><E5BAAF> <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ExpandTree(&m_tree,m_hRoot);//չ<><D5B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>нڵ<D0BD>
}
void CDlgOffsetTable::OnBnClickedSaveCurOffsetTab()
{
if(!gAuthorityMgr->CheckAuthorityByName("AUTHORITY_EditRecipe",true))
return;
if(!UpdateData(TRUE))
return;
gWaferRecipeDataMgr->SaveRcpOffsetTable(m_OffsetList,m_CurSelPath);
}
void CDlgOffsetTable::OnBnClickedDelOffsetTab()
{
if(!gAuthorityMgr->CheckAuthorityByName("AUTHORITY_EditRecipe",true))
return;
gWaferRecipeDataMgr->DelOffsetTable(m_CurSelPath);
OnBnClickedUpdateTabList();
}
void CDlgOffsetTable::OnBnClickedCreatOffsetTab()
{
if(!gAuthorityMgr->CheckAuthorityByName("AUTHORITY_EditRecipe",true))
return;
CString SearchName;
GetDlgItem(IDC_SEARCH_NAME_EDIT)->GetWindowText(SearchName);
CDlgCreatOffsetTable dlg;
dlg.SetEditName(SearchName);//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>Ĭ<EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD>
if(dlg.DoModal() == IDOK)
{
CString Name = dlg.GetEditName();
gWaferRecipeDataMgr->CreateNewOffsetTable(Name);
OnBnClickedUpdateTabList();
}
}
#endif