本文整理汇总了C++中UndoTransaction::pushUndoer方法的典型用法代码示例。如果您正苦于以下问题:C++ UndoTransaction::pushUndoer方法的具体用法?C++ UndoTransaction::pushUndoer怎么用?C++ UndoTransaction::pushUndoer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UndoTransaction
的用法示例。
在下文中一共展示了UndoTransaction::pushUndoer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: remove_cel
static void remove_cel(Sprite* sprite, UndoTransaction& undo, LayerImage *layer, Cel *cel)
{
Image *image;
Cel *it;
bool used;
if (sprite != NULL && layer->isImage() && cel != NULL) {
/* find if the image that use the cel to remove, is used by
another cels */
used = false;
for (FrameNumber frame(0); frame<sprite->getTotalFrames(); ++frame) {
it = layer->getCel(frame);
if (it != NULL && it != cel && it->getImage() == cel->getImage()) {
used = true;
break;
}
}
if (!used) {
// If the image is only used by this cel, we can remove the
// image from the stock.
image = sprite->getStock()->getImage(cel->getImage());
if (undo.isEnabled())
undo.pushUndoer(new undoers::RemoveImage(undo.getObjects(),
sprite->getStock(), cel->getImage()));
sprite->getStock()->removeImage(image);
image_free(image);
}
if (undo.isEnabled()) {
undo.pushUndoer(new undoers::RemoveCel(undo.getObjects(), layer, cel));
}
// Remove the cel
layer->removeCel(cel);
delete cel;
}
}