|
|
|
|
#include "StdAfx.h"
|
|
|
|
|
#include "PropertieMgr.h"
|
|
|
|
|
#include "Propertie.h"
|
|
|
|
|
#include "LogMgr.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CPropertieMgr gDevicePropertieMgr;//<2F>豸<EFBFBD><E8B1B8><EFBFBD>Թ<EFBFBD><D4B9><EFBFBD>
|
|
|
|
|
CPropertieMgr gDrawPropertieMgr;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Թ<EFBFBD><D4B9><EFBFBD>
|
|
|
|
|
|
|
|
|
|
CPropertieMgr::CPropertieMgr(void)
|
|
|
|
|
{
|
|
|
|
|
m_bSaveAllPropertie = true;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>洢<EFBFBD><E6B4A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
CPropertieMgr::~CPropertieMgr(void)
|
|
|
|
|
{
|
|
|
|
|
//ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
DelAllPropertie();
|
|
|
|
|
DelAllPropertieVec();
|
|
|
|
|
}
|
|
|
|
|
//<2F><>Ӧ<EFBFBD><D3A6><EFBFBD>Ա仯-->֪ͨ<CDA8><D6AA>Ӧ<EFBFBD><D3A6>ģ<EFBFBD><C4A3>
|
|
|
|
|
void CPropertieMgr::OnPropertyChanged(LPARAM lParam)
|
|
|
|
|
{
|
|
|
|
|
CMFCPropertyGridProperty*pProp = (CMFCPropertyGridProperty*)lParam;
|
|
|
|
|
//ȡ<><C8A1>ӳ<EFBFBD><D3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if (m_PropertieValMap.count(pProp))
|
|
|
|
|
{
|
|
|
|
|
CPropertie *pPropertie = m_PropertieValMap[pProp];
|
|
|
|
|
pPropertie->PropertyChangeVal(pProp->GetValue());//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ӳ<EFBFBD><D3B3>
|
|
|
|
|
void CPropertieMgr::Insert(CMFCPropertyGridProperty* p1,CPropertie* p2)
|
|
|
|
|
{
|
|
|
|
|
if(m_bSaveAllPropertie)
|
|
|
|
|
{
|
|
|
|
|
m_AllPropertieVec.push_back(p2);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_PropertieValMap.insert(make_pair(p1, p2));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void CPropertieMgr::DelAllPropertieVec()
|
|
|
|
|
{
|
|
|
|
|
vector<CPropertie*>::iterator iter = m_AllPropertieVec.begin();
|
|
|
|
|
vector<CPropertie*>::iterator iter_end = m_AllPropertieVec.end();
|
|
|
|
|
for(;iter!=iter_end;iter++)
|
|
|
|
|
{
|
|
|
|
|
CPropertie *pPropertie = (*iter);
|
|
|
|
|
if(pPropertie)
|
|
|
|
|
{
|
|
|
|
|
delete pPropertie;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void CPropertieMgr::DelAllPropertie()
|
|
|
|
|
{
|
|
|
|
|
map<CMFCPropertyGridProperty*,CPropertie*>::iterator iter = m_PropertieValMap.begin();
|
|
|
|
|
map<CMFCPropertyGridProperty*,CPropertie*>::iterator iter_end = m_PropertieValMap.end();
|
|
|
|
|
for(;iter!=iter_end;iter++)
|
|
|
|
|
{
|
|
|
|
|
if((*iter).second)
|
|
|
|
|
{
|
|
|
|
|
delete (*iter).second;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
m_PropertieValMap.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>ֵIJ<D6B5><C4B2><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ĵIJ<C4B5><C4B2><EFBFBD>)
|
|
|
|
|
void CPropertieMgr::SavePropertieByName(vector<CString> &PropertieNameVec)
|
|
|
|
|
{
|
|
|
|
|
vector<CPropertie*>::iterator iter = m_AllPropertieVec.begin();
|
|
|
|
|
vector<CPropertie*>::iterator iter_end = m_AllPropertieVec.end();
|
|
|
|
|
for(;iter!=iter_end;iter++)
|
|
|
|
|
{
|
|
|
|
|
CPropertie *pPropertie = (*iter);
|
|
|
|
|
if(pPropertie)
|
|
|
|
|
{
|
|
|
|
|
int size = PropertieNameVec.size();
|
|
|
|
|
for(int k=0;k<size;k++)
|
|
|
|
|
{
|
|
|
|
|
if(pPropertie->GetPropertieName()==PropertieNameVec[k])
|
|
|
|
|
{
|
|
|
|
|
pPropertie->WriteRead(false);
|
|
|
|
|
CString s;
|
|
|
|
|
s = "Par---->Save Par By Name: "+PropertieNameVec[k];
|
|
|
|
|
gLogMgr->WriteDebugLog(s);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#if 1
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ե<EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ı<EFBFBD><C4B1>ļ<EFBFBD>
|
|
|
|
|
void CPropertieMgr::SaveAllPropertieToTxtFile(CString FilePath)
|
|
|
|
|
{
|
|
|
|
|
gLogMgr->WriteDebugLog("Func---->SaveAllPropertieToTxtFile");
|
|
|
|
|
ofstream FileStream;
|
|
|
|
|
FileStream.open(FilePath);
|
|
|
|
|
set<void *> PropertieSet;
|
|
|
|
|
|
|
|
|
|
CString CurGroupName;
|
|
|
|
|
CString NewGroupName;
|
|
|
|
|
CString CurModuleName;
|
|
|
|
|
CString NewModuleName;
|
|
|
|
|
|
|
|
|
|
vector<CPropertie*>::iterator iter = m_AllPropertieVec.begin();
|
|
|
|
|
vector<CPropertie*>::iterator iter_end = m_AllPropertieVec.end();
|
|
|
|
|
for(;iter!=iter_end;iter++)
|
|
|
|
|
{
|
|
|
|
|
CPropertie *pPropertie = (*iter);
|
|
|
|
|
if(PropertieSet.count(pPropertie->m_pVal))//<2F><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8>IJ<EFBFBD><C4B2><EFBFBD>
|
|
|
|
|
continue;
|
|
|
|
|
PropertieSet.insert(pPropertie->m_pVal);
|
|
|
|
|
|
|
|
|
|
if(pPropertie && pPropertie->m_ShowName !="")
|
|
|
|
|
{
|
|
|
|
|
NewModuleName = (pPropertie->m_ModuleName);
|
|
|
|
|
if(NewModuleName != "" && CurGroupName != NewModuleName)
|
|
|
|
|
{
|
|
|
|
|
CurModuleName = NewModuleName;
|
|
|
|
|
FileStream<<"<--------------------------["<<NewModuleName<<"]-------------------------->\n";
|
|
|
|
|
}
|
|
|
|
|
NewGroupName = (pPropertie->m_GroupName);
|
|
|
|
|
if(NewGroupName != "" && CurGroupName != NewGroupName)
|
|
|
|
|
{
|
|
|
|
|
CurGroupName = NewGroupName;
|
|
|
|
|
FileStream<<"<---------------["<<NewGroupName<<"]--------------->\n";
|
|
|
|
|
}
|
|
|
|
|
FileStream<<"["<<(pPropertie->m_ShowName)<<"]";
|
|
|
|
|
FileStream<<"[";
|
|
|
|
|
pPropertie->WriteToStream(FileStream);
|
|
|
|
|
FileStream<<"]\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|