|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
//<2F>ļ<EFBFBD> ActionDeleteLayerItem.h
|
|
|
|
|
|
//<2F><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>:
|
|
|
|
|
|
//
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д: 2006-12-07
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
#include "StdAfx.h"
|
|
|
|
|
|
#include ".\actiondeletelayeritem.h"
|
|
|
|
|
|
#include "SigmaDoc.h"
|
|
|
|
|
|
#include "SigmaView.h"
|
|
|
|
|
|
#include "Visitor.h"
|
|
|
|
|
|
|
|
|
|
|
|
NAction::CActionLayerDeleteItem::CActionLayerDeleteItem()
|
|
|
|
|
|
: CActionDeleteItem(nullptr, 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CActionLayerDeleteItem::CActionLayerDeleteItem(CSigmaDoc * ppDoc, CLayer* pLayer)
|
|
|
|
|
|
: CActionDeleteItem(ppDoc, ActionType::ActionTypeLayerDelete)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(pLayer)
|
|
|
|
|
|
{
|
|
|
|
|
|
LayerList.AddTail(pLayer);
|
|
|
|
|
|
pLayer->GetParentClass()->RemoveAt(pLayer);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CActionLayerDeleteItem::CActionLayerDeleteItem(CSigmaDoc * ppDoc, const CPositionList& ElementList, CPtrList& cLayerList)
|
|
|
|
|
|
: CActionDeleteItem(ppDoc, ActionTypeLayerDelete, ElementList)
|
|
|
|
|
|
{
|
|
|
|
|
|
CLayer* pv;
|
|
|
|
|
|
POSITION pos=cLayerList.GetHeadPosition();
|
|
|
|
|
|
while(pos)
|
|
|
|
|
|
{
|
|
|
|
|
|
pv=(CLayer*)cLayerList.GetNext(pos);
|
|
|
|
|
|
if(pv==NULL) continue;
|
|
|
|
|
|
LayerList.AddTail(pv);
|
|
|
|
|
|
pv->GetParentClass()->RemoveAt(pv);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CActionLayerDeleteItem::~CActionLayerDeleteItem(void)
|
|
|
|
|
|
{
|
|
|
|
|
|
Clear();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void NAction::CActionLayerDeleteItem::Clear(void)
|
|
|
|
|
|
{
|
|
|
|
|
|
CActionDeleteItem::Clear();
|
|
|
|
|
|
if(m_bDeleted)
|
|
|
|
|
|
{
|
|
|
|
|
|
CLayer* pv;
|
|
|
|
|
|
POSITION pos=LayerList.GetHeadPosition();
|
|
|
|
|
|
while(pos)
|
|
|
|
|
|
{
|
|
|
|
|
|
pv=(CLayer*)LayerList.GetNext(pos);
|
|
|
|
|
|
delete pv;
|
|
|
|
|
|
pv = nullptr;
|
|
|
|
|
|
}
|
|
|
|
|
|
LayerList.RemoveAll();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CActionLayerDeleteItem::Undo()
|
|
|
|
|
|
{
|
|
|
|
|
|
CLayer* pLayer;
|
|
|
|
|
|
POSITION pos=LayerList.GetHeadPosition();
|
|
|
|
|
|
while(pos)
|
|
|
|
|
|
{
|
|
|
|
|
|
pLayer=(CLayer*)LayerList.GetNext(pos);
|
|
|
|
|
|
GetDoc()->GetDraw()->AddLayer(pLayer);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//Undo<64><6F>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>λ<EFBFBD>µ<EFBFBD>Ԫ<EFBFBD><D4AA>
|
|
|
|
|
|
CActionDeleteItem::Undo();
|
|
|
|
|
|
|
|
|
|
|
|
ReflashLayer();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CActionLayerDeleteItem::Redo()
|
|
|
|
|
|
{
|
|
|
|
|
|
//Redo<64><6F>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>λ<EFBFBD>µ<EFBFBD>Ԫ<EFBFBD><D4AA>
|
|
|
|
|
|
CActionDeleteItem::Redo();
|
|
|
|
|
|
|
|
|
|
|
|
CLayer* pLayer;
|
|
|
|
|
|
POSITION pos=LayerList.GetHeadPosition();
|
|
|
|
|
|
while(pos)
|
|
|
|
|
|
{
|
|
|
|
|
|
pLayer=(CLayer*)LayerList.GetNext(pos);
|
|
|
|
|
|
pLayer->GetParentClass()->RemoveAt(pLayer);
|
|
|
|
|
|
}
|
|
|
|
|
|
ReflashLayer();
|
|
|
|
|
|
|
|
|
|
|
|
CXy* pXy = GetDoc()->GetDraw();
|
|
|
|
|
|
if (pXy->GetLayerCount() == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
pXy->InitLayerClass();
|
|
|
|
|
|
}
|
|
|
|
|
|
pXy->SetCurrentLayer(pXy->GetClassList()->GetHead()->GetHead());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void NAction::CActionLayerDeleteItem::accept(CActionVisitor& visitor)
|
|
|
|
|
|
{
|
|
|
|
|
|
visitor.visit(*this);
|
|
|
|
|
|
}
|