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.

117 lines
3.7 KiB
C++

#include "StdAfx.h"
#include "ParMappingTab.h"
#include "Propertie.h"
#include "PropertieMgr.h"
CParMappingTab::CParMappingTab(void)
{
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
for(int i=0;i<VAR_PAR_CNT;i++)
{
m_CurCtrlParVec.push_back("NULL");
}
}
CParMappingTab::~CParMappingTab(void)
{
}
void CParMappingTab::CreatGridProperty(CMFCPropertyGridProperty* pGroup,CString Path,CModule *pModule)
{
CMFCPropertyGridProperty* pGroup1 = new CMFCPropertyGridProperty(_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
{
for(int i=0;i<VAR_PAR_CNT;i++)
{
CString str;
str.Format("%ld",i+1);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ӳ<EFBFBD><D3B3>
CString Name = "m_CurCtrlParVec" + str;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&(m_CurCtrlParVec[i]));
pPropertie->SetType(_PROP_TYPE_STRING);
pPropertie->SetpModule(pModule);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
str.Format("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>%ld",i+1);
CString PropertyName = str;
str += "<EFBFBD><EFBFBD>Ӧ<EFBFBD>ĺ<EFBFBD><EFBFBD><EFBFBD>(<28>޸<EFBFBD><DEB8><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч)";
CString Description = str;
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName,(_variant_t)m_CurCtrlParVec[i], Description);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
InsertPenParName(p1);
p1->AllowEdit(FALSE);//<2F><><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
pGroup->AddSubItem(pGroup1);
}
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><CBB3>(ʹ<>õIJ<C3B5><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>),<2C><><EFBFBD><EFBFBD>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵIJ<DAB5><C4B2><EFBFBD>
void CParMappingTab::AdjustParOrder()
{
vector<CString> Vec;
for(int i=0;i<VAR_PAR_CNT;i++)
{
if(m_CurCtrlParVec[i]!="NULL")
{
bool flg = false;
int size = m_AllCtrlParList.size();
for(int k=0;k<size;k++)
{
if(m_CurCtrlParVec[i] == m_AllCtrlParList[k])//<2F><><EFBFBD><EFBFBD>
{
flg = true;
break;
}
}
if(flg)//ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵIJ<DAB5><C4B2><EFBFBD><EFBFBD><EFBFBD>
{
Vec.push_back(m_CurCtrlParVec[i]);
}
m_CurCtrlParVec[i] = "NULL";
}
}
int size = Vec.size();
for(int k=0;k<size;k++)
{
m_CurCtrlParVec[k] = Vec[k];
}
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void CParMappingTab::InsertPenParName(CMFCPropertyGridProperty* p)
{
vector<CString>::iterator iter = m_AllCtrlParList.begin();
vector<CString>::iterator iter_end = m_AllCtrlParList.end();
for(int i=0;iter!=iter_end;iter++,i++)
{
p->AddOption(*iter);
}
}
//ͨ<><CDA8><><C4A3><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>par <20><><EFBFBD><EFBFBD>ö<EFBFBD><C3B6>ֵ)<29><><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF>ӳ<EFBFBD><D3B3><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>ֵidx
//ģ<><C4A3><EFBFBD>õ<EFBFBD>idx <20><>,<2C>ٵ<EFBFBD><D9B5>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥ<EFBFBD><C8A5><EFBFBD>Ҷ<EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool CParMappingTab::GetMappingTabParIdx(int EnumParType,int &ParIdx)
{
int size = m_AllCtrlParList.size();
if(EnumParType<size)
{
CString ParName = m_AllCtrlParList[EnumParType];//<2F><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
size = m_CurCtrlParVec.size();
for(int k=0;k<size;k++)
{
if(ParName == m_CurCtrlParVec[k])//<2F><><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>Ե<EFBFBD>һ<EFBFBD><D2BB>Ϊ׼)
{
ParIdx = k;
return true;
}
}
}
ParIdx = -1;
return false;//û<><C3BB>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD>
}