void ArxDbgUiTdcWblockClone::doInsertOption(AcDbDatabase* tmpDb) { AcDbDatabase* destDb = getDestDb(); if (destDb == NULL) { ArxDbgUiTdmDatabase dbox(tmpDb, this, _T("Wblock'd Database")); dbox.DoModal(); doSaveOption(tmpDb); } else { Acad::ErrorStatus es; // lock the document we are inserting into ArxDbgDocLockWrite docLock(destDb); if (docLock.lockAndSetCurrent() != Acad::eOk) return; es = destDb->insert(AcGeMatrix3d::kIdentity, tmpDb, false); if (es == Acad::eOk) { ArxDbgUiTdmDatabase dbox(destDb, this, _T("Wblock/Insert Database")); dbox.DoModal(); doSaveOption(destDb); } else { CString str; str.Format(_T("Insert failed: %s"), ArxDbgUtils::rxErrorStr(es)); ArxDbgUtils::stopAlertBox(str); } } }
void ArxDbgUiTdcInsert::OnInsertBlkDef() { CString blkName; m_ebDestName1.GetWindowText(blkName); if (!acdbSNValid(blkName, false)) { CString str; str.Format(_T("%s is not a valid block name."), blkName); ArxDbgUtils::alertBox(str); return; } UpdateData(TRUE); bool isExternal; AcDbDatabase* sourceDb = getSourceDb(isExternal); AcDbDatabase* destDb = getDestDb(); ASSERT(sourceDb != destDb); Acad::ErrorStatus es; // lock the document we are inserting into ArxDbgDocLockWrite docLock(destDb); if (docLock.lockAndSetCurrent() != Acad::eOk) return; bool preserveSrcDb = intToBool(m_preserveOriginalDb); if (!preserveSrcDb && !isExternal) { ArxDbgUtils::alertBox(_T("Ignoring setting of \"Preserve source database\" since destroying\na database associated with a Document would be harsh.")); preserveSrcDb = true; } AcDbObjectId blkId; es = destDb->insert(blkId, blkName, sourceDb, preserveSrcDb); if (es == Acad::eOk) { ArxDbgUiTdmDatabase dbox(destDb, this, _T("Inserted Database")); dbox.DoModal(); doSaveOption(destDb); if (isExternal && !preserveSrcDb) reloadRaidedExternalDwg(sourceDb); } else { CString str; str.Format(_T("Insert failed: %s"), ArxDbgUtils::rxErrorStr(es)); ArxDbgUtils::stopAlertBox(str); } }
void ArxDbgUiTdcInsert::OnInsertDb() { UpdateData(TRUE); bool isExternal; AcDbDatabase* sourceDb = getSourceDb(isExternal); AcDbDatabase* destDb = getDestDb(); ASSERT(sourceDb != destDb); Acad::ErrorStatus es; // lock the document we are inserting into ArxDbgDocLockWrite docLock(destDb); if (docLock.lockAndSetCurrent() != Acad::eOk) return; bool preserveSrcDb = intToBool(m_preserveOriginalDb); if (!preserveSrcDb && !isExternal) { ArxDbgUtils::alertBox(_T("Ignoring setting of \"Preserve source database\" since destroying\na database associated with a Document would be harsh.")); preserveSrcDb = true; } es = destDb->insert(AcGeMatrix3d::kIdentity, sourceDb, preserveSrcDb); if (es == Acad::eOk) { ArxDbgUiTdmDatabase dbox(destDb, this, _T("Inserted Database")); dbox.DoModal(); doSaveOption(destDb); if (isExternal && !preserveSrcDb) reloadRaidedExternalDwg(sourceDb); } else { CString str; str.Format(_T("Insert failed: %s"), ArxDbgUtils::rxErrorStr(es)); ArxDbgUtils::stopAlertBox(str); } }
void ArxDbgUiTdcInsert::OnTransferBlkDef() { // get the block we're suppose to be wblocking int index = m_puBlockDef.GetCurSel(); ASSERT(index != CB_ERR); CString srcBlkName; AcDbObjectId blkDefId; if (!m_blockList.GetAtIndex(index, srcBlkName, blkDefId)) { ASSERT(0); return; } // get name of destination block name CString destBlkName; m_ebDestName2.GetWindowText(destBlkName); if (!acdbSNValid(destBlkName, false)) { CString str; str.Format(_T("%s is not a valid block name."), destBlkName); ArxDbgUtils::alertBox(str); return; } UpdateData(TRUE); bool isExternal; AcDbDatabase* sourceDb = getSourceDb(isExternal); AcDbDatabase* destDb = getDestDb(); ASSERT(sourceDb != destDb); // lock the document we are inserting into ArxDbgDocLockWrite docLock(destDb); if (docLock.lockAndSetCurrent() != Acad::eOk) return; // lock the document we are inserting from ArxDbgDocLockWrite docLock2(sourceDb); if (docLock2.lock() != Acad::eOk) return; bool preserveSrcDb = intToBool(m_preserveOriginalDb); if (!preserveSrcDb && !isExternal) { ArxDbgUtils::alertBox(_T("Ignoring setting of \"Preserve source database\" since destroying\na database associated with a Document would be harsh.")); preserveSrcDb = true; } AcDbObjectId blkId; Acad::ErrorStatus es; es = destDb->insert(blkId, srcBlkName, destBlkName, sourceDb, preserveSrcDb); if (es == Acad::eOk) { ArxDbgUiTdmDatabase dbox(destDb, this, _T("Inserted Database")); dbox.DoModal(); doSaveOption(destDb); if (isExternal && !preserveSrcDb) reloadRaidedExternalDwg(sourceDb); } else { CString str; str.Format(_T("Insert failed: %s"), ArxDbgUtils::rxErrorStr(es)); ArxDbgUtils::stopAlertBox(str); } }