ObjectARX, AutoCAD. Среда программирования библиотеки C++


         

Iterate through the list until


}
void
AsdkDocReactor::documentToBeDestroyed(AcApDocument *pDoc)
{
gpAsdkAppDocGlobals->removeDocGlobals(pDoc);
}
AsdkPerDocData::AsdkPerDocData(AcApDocument *pDoc)
{
m_pDoc = pDoc;
m_pNext = NULL;
m_EntAcc = 0;
m_pDbr = NULL;
}
AsdkAppDocGlobals::AsdkAppDocGlobals(AcApDocument *pDoc)
{
m_pData = m_pHead = NULL;
m_pDocReactor = new AsdkDocReactor();
acDocManager->addReactor(m_pDocReactor);
}
// Iterate through the list until the documents’s global data is
// found. If it is not found, create a new set of document globals.
//
void
AsdkAppDocGlobals::setGlobals(AcApDocument *pDoc)
{
AsdkPerDocData *p_data = m_pHead, *prev_data = m_pHead;
while (p_data != NULL)
{
if (p_data->m_pDoc == pDoc)
{
m_pData = p_data;
break;
}
prev_data = p_data;
p_data = p_data->m_pNext;
}
if (p_data == NULL)
{
if (m_pHead == NULL)
m_pHead = m_pData = new AsdkPerDocData(pDoc);
else
prev_data->m_pNext = m_pData = new AsdkPerDocData(pDoc);
}
}
 
// Delete the globals associated with pDoc.
//
void
AsdkAppDocGlobals::removeDocGlobals(AcApDocument *pDoc)
{
AsdkPerDocData *p_data = m_pHead, *prev_data = m_pHead;
while (p_data != NULL)
{
if (p_data->m_pDoc == pDoc)
{
if (p_data == m_pHead)
m_pHead = p_data->m_pNext;
else
prev_data->m_pNext = p_data->m_pNext;
if (m_pData == p_data)
m_pData = m_pHead;
delete p_data;
break;
}
prev_data = p_data;
p_data = p_data->m_pNext;
}
}
// Delete all the doc globals in the list (recursively).
//
void
AsdkAppDocGlobals::removeAllDocGlobals(AsdkPerDocData *p_target)
{
if (p_target == NULL)
return;
if (p_target->m_pNext != NULL)
removeAllDocGlobals(p_target->m_pNext);
if (p_target->m_pDbr != NULL)
{
acdbHostApplicationServices()->
workingDatabase()->removeReactor(p_target->m_pDbr);
delete p_target->m_pDbr;
p_target->m_pDbr = NULL;
}
delete p_target;
}
 
// Application was unloaded - delete everything associated with this

Содержание  Назад  Вперед