|
#include "stdafx.h"
#include "DoubleClickWinsill.h"
#include "tyWinsillCom.h"
CDoubleClickWinsill::CDoubleClickWinsill(void)
{
}
CDoubleClickWinsill::~CDoubleClickWinsill(void)
{
}
void CDoubleClickWinsill::startEdit(AcDbEntity *pEnt, AcGePoint3d pt)
{
//acutPrintf(_T("123\n"));
if(pEnt->isKindOf(tyWinsillCom::desc()))
{
tyWinsillCom* pWinsill = tyWinsillCom::cast(pEnt);
//获取当前文档
AcApDocument *pDoc = acDocManager->curDocument();
//锁文档
acDocManager->lockDocument(pDoc);
//升级为可写
pWinsill->upgradeOpen();
pWinsill->setDir(pWinsill->getDir() * (-1));
pWinsill->close();
pWinsill->draw(); //在关闭之后还能使用
//解锁文档
acDocManager->unlockDocument(pDoc);
//清理PickFirst选择集中的内容
acedSSSetFirst(NULL, NULL);
}
}
void CDoubleClickWinsill::finishEdit(void)
{
}
然后在acrxEntryPoint.cpp中 添加
virtual AcRx::AppRetCode On_kInitAppMsg (void *pkt) {
// TODO: Load dependencies here
// You *must* call On_kInitAppMsg here
AcRx::AppRetCode retCode =AcRxArxApp::On_kInitAppMsg (pkt) ;
// TODO: Add your initialization code here
//为tyWinsillCom类添加协议扩展
CDoubleClickWinsill *pWinsillEdit = new CDoubleClickWinsill;
tyWinsillCom::desc()->addX(AcDbDoubleClickEdit::desc(), pWinsillEdit);
return (retCode) ;
}
virtual AcRx::AppRetCode On_kUnloadAppMsg (void *pkt) {
// TODO: Add your code here
// You *must* call On_kUnloadAppMsg here
AcRx::AppRetCode retCode =AcRxArxApp::On_kUnloadAppMsg (pkt) ;
// TODO: Unload dependencies here
//删除tyWinsillCom类的协议扩展
tyWinsillCom::desc()->delX(AcDbDoubleClickEdit::desc());
return (retCode) ;
} |
|