summaryrefslogtreecommitdiffstats
path: root/Source/MFCDialog/PropertyList.cpp
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2001-04-24 18:19:13 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2001-04-24 18:19:13 (GMT)
commitb5746484e4c396489b707e0f8b4d1f539e62a965 (patch)
treef61bc5000e702fa75ecdd7a77e3490ba946f0264 /Source/MFCDialog/PropertyList.cpp
parent37468fad3aed3eb5116e42362d1b6f37adde595f (diff)
downloadCMake-b5746484e4c396489b707e0f8b4d1f539e62a965.zip
CMake-b5746484e4c396489b707e0f8b4d1f539e62a965.tar.gz
CMake-b5746484e4c396489b707e0f8b4d1f539e62a965.tar.bz2
BUG: fix duplicate property items
Diffstat (limited to 'Source/MFCDialog/PropertyList.cpp')
-rw-r--r--Source/MFCDialog/PropertyList.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/Source/MFCDialog/PropertyList.cpp b/Source/MFCDialog/PropertyList.cpp
index a4b2aea..b798e10 100644
--- a/Source/MFCDialog/PropertyList.cpp
+++ b/Source/MFCDialog/PropertyList.cpp
@@ -20,7 +20,7 @@ CPropertyList::CPropertyList()
CPropertyList::~CPropertyList()
{
- for(std::list<CPropertyItem*>::iterator i = m_PropertyItems.begin();
+ for(std::set<CPropertyItem*>::iterator i = m_PropertyItems.begin();
i != m_PropertyItems.end(); ++i)
{
delete *i;
@@ -118,7 +118,7 @@ int CPropertyList::AddPropItem(CPropertyItem* pItem)
{
int nIndex = AddString(_T(""));
SetItemDataPtr(nIndex,pItem);
- m_PropertyItems.push_back(pItem);
+ m_PropertyItems.insert(pItem);
return nIndex;
}
@@ -143,8 +143,25 @@ int CPropertyList::AddProperty(const char* name,
return i;
}
}
+ // if it is not in the displayed list, then
+ // check for it in the m_PropertyItems list as
+ // a removed item
+ for(std::set<CPropertyItem*>::iterator
+ p = m_PropertyItems.begin();
+ p != m_PropertyItems.end(); ++p)
+ {
+ if((*p)->m_propName == name)
+ {
+ pItem = *p;
+ pItem->m_Removed = false;
+ }
+ }
// if it is not found, then create a new one
- pItem = new CPropertyItem(name, value, type, comboItems);
+ if(!pItem)
+ {
+ pItem = new CPropertyItem(name, value, type, comboItems);
+ }
+
return this->AddPropItem(pItem);
}