本文整理汇总了C++中Operation::Undo方法的典型用法代码示例。如果您正苦于以下问题:C++ Operation::Undo方法的具体用法?C++ Operation::Undo怎么用?C++ Operation::Undo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Operation
的用法示例。
在下文中一共展示了Operation::Undo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UndoPrev
BOOL OperationHistory::UndoPrev()
{
//TRACE( _T("Called Undo\n"));
if (NowPtr != NULL) // Check if there is an operation to UNDO
{
// Tell the world that the op is about to be undone
BROADCAST_TO_ALL(OpMsg(((Operation*)NowPtr),OpMsg::BEFORE_UNDO));
Operation* pOp = (Operation*)NowPtr;
if (pOp->Undo()) // Undo the operation
{
ERROR3IF(NowPtr == NULL, "The operation which has just been undone has been deleted");
if (NowPtr != NULL)
{
// We used to find the prev op before the undo, this was wrong because it may have been deleted.
NowPtr = OpHistoryList.GetPrev(NowPtr);
}
Operation* NextOp;
if (NowPtr != NULL)
{
NextOp = ((Operation*)OpHistoryList.GetNext(NowPtr));
}
else
{
NextOp = ((Operation*)OpHistoryList.GetHead());
}
BROADCAST_TO_ALL(OpMsg(NextOp,OpMsg::AFTER_UNDO));
return (TRUE);
}
}
return (FALSE); // There are no operations to UNDO, or the Operation failed to undo
}
示例2: Undo
void ManipulatorOperation::Undo()
{
if (!m_lstUndo.empty())
{
Operation* op = m_lstUndo.back();
op->Undo();
m_lstUndo.pop_back();
m_lstRedo.push_back(op);
++m_snapshot;
}
}