|
|
|
|
#include "StdAfx.h"
|
|
|
|
|
#include "PropertieMgr.h"
|
|
|
|
|
#include "Propertie.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();
|
|
|
|
|
}
|
|
|
|
|
//ǿ<>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD>Ե<EFBFBD><D4B5>ļ<EFBFBD>
|
|
|
|
|
void CPropertieMgr::SaveAllPropertie()
|
|
|
|
|
{
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
pPropertie->WriteRead(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|