48 lines
920 B
C++
48 lines
920 B
C++
#include "stdafx.h"
|
|
#include "TReactorAssociate.h"
|
|
|
|
#ifdef _DEBUG
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[]=__FILE__;
|
|
#define new DEBUG_NEW
|
|
#endif
|
|
|
|
TReactorAssociate::TReactorAssociate(AcDbDatabase* pOwnerDb, AcDbDatabaseReactor* pReactor)
|
|
{
|
|
m_pOwnerDb = pOwnerDb;
|
|
m_pReactor = pReactor;
|
|
|
|
if (m_pOwnerDb != NULL && m_pReactor != NULL)
|
|
{
|
|
m_pOwnerDb->removeReactor(m_pReactor);
|
|
}
|
|
}
|
|
|
|
TReactorAssociate::~TReactorAssociate()
|
|
{
|
|
if (m_pOwnerDb != NULL && m_pReactor != NULL)
|
|
{
|
|
m_pOwnerDb->addReactor(m_pReactor);
|
|
}
|
|
}
|
|
|
|
//TCurDocumentLock
|
|
//////////////////////////////////////////////////////////////////////////
|
|
TCurDocumentLock::TCurDocumentLock()
|
|
{
|
|
m_pDoc = acDocManager->curDocument();
|
|
if (acDocManager->lockDocument(m_pDoc, AcAp::kWrite) != Acad::eOk)
|
|
{
|
|
// 锁定失败
|
|
m_pDoc = NULL;
|
|
}
|
|
}
|
|
|
|
TCurDocumentLock::~TCurDocumentLock()
|
|
{
|
|
if (m_pDoc != NULL)
|
|
{
|
|
acDocManager->unlockDocument(m_pDoc);
|
|
}
|
|
}
|