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.
201 lines
4.6 KiB
C++
201 lines
4.6 KiB
C++
#include "StdAfx.h"
|
|
#include ".\ActionListItem.h"
|
|
#include "SigmaDoc.h"
|
|
#include "SigmaView.h"
|
|
#include "actionadditem.h"
|
|
#include ".\actiondeleteitem.h"
|
|
#include ".\actionmodifieditem.h"
|
|
#include "ActionBackupItem.h"
|
|
#include ".\actionembellishitem.h"
|
|
#include "ActionAddLayerItem.h"
|
|
#include "ActionChangeLayerItem.h"
|
|
#include "ActionReplaceColorItem.h"
|
|
#include ".\actionmarkdeleteitem.h"
|
|
#include "Visitor.h"
|
|
|
|
NAction::CActionListItem::CActionListItem()
|
|
: CActionItem(nullptr, 0)
|
|
{
|
|
}
|
|
|
|
CActionListItem::CActionListItem(CSigmaDoc * ppDoc, UINT actionType)
|
|
:CActionItem(ppDoc, actionType)
|
|
{
|
|
}
|
|
|
|
CActionListItem::~CActionListItem(void)
|
|
{
|
|
Clear();
|
|
}
|
|
|
|
void CActionListItem::Clear()
|
|
{
|
|
CActionItem* pItem;
|
|
POSITION pos=ActionList.GetHeadPosition();
|
|
while(pos)
|
|
{
|
|
pItem=(CActionItem*)ActionList.GetNext(pos);
|
|
delete pItem;
|
|
}
|
|
}
|
|
|
|
void CActionListItem::Undo()
|
|
{
|
|
CActionItem::Undo();
|
|
|
|
CActionItem* pItem;
|
|
POSITION pos=ActionList.GetHeadPosition();
|
|
while(pos)
|
|
{
|
|
pItem=(CActionItem*)ActionList.GetNext(pos);
|
|
pItem->Undo();
|
|
}
|
|
}
|
|
|
|
void CActionListItem::Redo()
|
|
{
|
|
CActionItem::Redo();
|
|
|
|
CActionItem* pItem;
|
|
POSITION pos=ActionList.GetTailPosition();
|
|
while(pos)
|
|
{
|
|
pItem=(CActionItem*)ActionList.GetPrev(pos);
|
|
pItem->Redo();
|
|
}
|
|
}
|
|
|
|
void CActionListItem::Finish()
|
|
{
|
|
CActionItem::Finish(); //Notify Manager
|
|
|
|
CActionItem* pItem;
|
|
POSITION pos=ActionList.GetHeadPosition();
|
|
while(pos)
|
|
{
|
|
pItem=(CActionItem*)ActionList.GetNext(pos);
|
|
pItem->Finish();
|
|
}
|
|
}
|
|
|
|
void NAction::CActionListItem::accept(CActionVisitor& visitor)
|
|
{
|
|
visitor.visit(*this);
|
|
}
|
|
|
|
POSITION CActionListItem::AddLayerAddItem(CLayer* pAddedLayer, const CString curLayerName)
|
|
{
|
|
CActionLayerAddItem* pItem = new CActionLayerAddItem(GetDoc(), pAddedLayer, curLayerName);
|
|
return AddItem(pItem);
|
|
}
|
|
|
|
POSITION CActionListItem::AddChangeLayerItem(CPositionList& list, CString strOldLayer, CString strNewLayer)
|
|
{
|
|
CActionChangeLayerItem* pItem = new CActionChangeLayerItem(GetDoc(), 0, list, strOldLayer, strNewLayer);
|
|
return AddItem(pItem);
|
|
}
|
|
|
|
POSITION CActionListItem::AddItem(CActionItem* pItem)
|
|
{
|
|
return AddTailItem(pItem);
|
|
}
|
|
|
|
POSITION CActionListItem::AddTailItem(CActionItem* pItem)
|
|
{
|
|
return ActionList.AddTail(pItem);
|
|
}
|
|
|
|
POSITION CActionListItem::AddHeadItem(CActionItem* pItem)
|
|
{
|
|
return ActionList.AddHead(pItem);
|
|
}
|
|
|
|
POSITION CActionListItem::AddAddItem(const CPositionList& AddList)
|
|
{
|
|
CActionAddItem* pItem=new CActionAddItem(GetDoc(), 0, AddList);
|
|
return AddItem(pItem);
|
|
}
|
|
|
|
POSITION CActionListItem::AddAddItem(COne* pOne)
|
|
{
|
|
CActionAddItem* pItem=new CActionAddItem(GetDoc(), 0, pOne);
|
|
return AddItem(pItem);
|
|
}
|
|
|
|
POSITION CActionListItem::AddDeleteItem(const CPositionList& DelList, BOOL bPerformOperation)
|
|
{
|
|
CActionDeleteItem* pItem=new CActionDeleteItem(GetDoc(),0,DelList);
|
|
pItem->m_bPerformOperation=bPerformOperation;
|
|
if(bPerformOperation)
|
|
pItem->RemoveOperation();
|
|
return AddItem(pItem);
|
|
}
|
|
|
|
POSITION CActionListItem::AddDeleteItem(POSITION posElement)
|
|
{
|
|
CPositionList delList;
|
|
delList.AddTail(posElement);
|
|
return AddDeleteItem(delList);
|
|
}
|
|
|
|
POSITION CActionListItem::AddBackupItem(const CPositionList& bakList)
|
|
{
|
|
CActionBackupItem* pItem=new CActionBackupItem(GetDoc(),0,bakList);
|
|
return AddItem(pItem);
|
|
}
|
|
|
|
POSITION CActionListItem::AddBackupItem(POSITION pos)
|
|
{
|
|
CActionBackupItem* pItem=new CActionBackupItem(GetDoc(),0);
|
|
pItem->Backup(pos);
|
|
return AddItem(pItem);
|
|
}
|
|
|
|
POSITION CActionListItem::AddBackupItem(COne* pOne)
|
|
{
|
|
CActionBackupItem* pItem=new CActionBackupItem(GetDoc(),0);
|
|
pItem->Backup(pOne);
|
|
return AddItem(pItem);
|
|
}
|
|
|
|
POSITION NAction::CActionListItem::AddMarkAddItem(CXy * pxy)
|
|
{
|
|
if (pxy == NULL) return NULL;
|
|
CActionMarkAddItem* pMark = new CActionMarkAddItem(GetDoc(), 0);
|
|
pMark->AddMark(pxy);
|
|
return AddItem(pMark);
|
|
}
|
|
|
|
POSITION NAction::CActionListItem::AddMarkDeleteItem(CXy * pxy)
|
|
{
|
|
if (pxy == NULL) return NULL;
|
|
CActionMarkDeleteItem* pMark = new CActionMarkDeleteItem(GetDoc(), 0);
|
|
pMark->AddMark(pxy);
|
|
return AddItem(pMark);
|
|
}
|
|
|
|
POSITION CActionListItem::AddChangeNameItem(POSITION pos, CString oldName, CString newName)
|
|
{
|
|
//CActionChangeNameItem(CDocument* ppDoc, UINT actionType, POSITION pos, CString oldName, CString newName);
|
|
CActionChangeNameItem* pItem = new CActionChangeNameItem(GetDoc(), 0, pos, oldName, newName);
|
|
return AddItem(pItem);
|
|
}
|
|
|
|
POSITION CActionListItem::AddModifiedItem(const CPositionList& list)
|
|
{
|
|
CActionModifiedItem* pItem=new CActionModifiedItem(GetDoc(),0,list);
|
|
return AddItem(pItem);
|
|
}
|
|
|
|
POSITION CActionListItem::AddModifiedItem(POSITION pos, COne* pOne)
|
|
{
|
|
CActionModifiedItem* pItem=new CActionModifiedItem(GetDoc(),0);
|
|
pItem->BackupOldItem(pos, pOne);
|
|
return AddItem(pItem);
|
|
}
|
|
|
|
int NAction::CActionListItem::GetCount(void)
|
|
{
|
|
return (int)ActionList.GetCount();
|
|
}
|