You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.6 KiB
C++

#include "StdAfx.h"
#include "CommandCut.h"
#include "Layer.h"
#include "GlobalFunction.h"
CCommandCut::CCommandCut(void)
{
}
CCommandCut::~CCommandCut(void)
{
}
//m_ObjContainer <20>ĵ<EFBFBD>һ<EFBFBD><D2BB>Ϊ<EFBFBD><CEAA><EFBFBD>е<EFBFBD>obj
//<2F><><EFBFBD>к<EFBFBD><D0BA><EFBFBD>obj <20><><EFBFBD><EFBFBD>Ϊ0~2 <20><>
void CCommandCut::ExcuteExt()
{
CLayer &layer = gLayer;
vector<Sptr<CObjBase>> &vec = m_ObjContainer.GetObjVec();
vector<Sptr<CObjBase>>::iterator iter = vec.begin();
vector<Sptr<CObjBase>>::iterator iter_end = vec.end();
for(;iter!=iter_end;iter++)
{
if((*iter).IsNull()==false)
{
(*iter)->SetSelected(false);
if((*iter).IsNull()==false)
{
if(iter == vec.begin())
{
layer.DelObj((*iter));
}
else
{
layer.AddObject((*iter));
}
}
}
}
}
void CCommandCut::UndoExt()
{
CLayer &layer = gLayer;
vector<Sptr<CObjBase>> &vec = m_ObjContainer.GetObjVec();
vector<Sptr<CObjBase>>::iterator iter = vec.begin();
vector<Sptr<CObjBase>>::iterator iter_end = vec.end();
for(;iter!=iter_end;iter++)
{
if((*iter).IsNull()==false)
{
if(iter == vec.begin())
{
layer.AddObject((*iter));
}
else
{
layer.DelObj((*iter));
}
}
}
}
CString CCommandCut::GetStr()
{
CString str = "_cut <20>޼<EFBFBD>-----";
return str;
}