当前位置: 首页>>代码示例>>C++>>正文


C++ Operation::Undo方法代码示例

本文整理汇总了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
}
开发者ID:vata,项目名称:xarino,代码行数:32,代码来源:ophist.cpp

示例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;
	}
}
开发者ID:mavaL,项目名称:MiniCraft,代码行数:11,代码来源:ManipulatorOperation.cpp


注:本文中的Operation::Undo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。