本文整理汇总了C++中Undo函数的典型用法代码示例。如果您正苦于以下问题:C++ Undo函数的具体用法?C++ Undo怎么用?C++ Undo使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Undo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Undo
void CUndo::UndoOne(CBaseView * pLeft, CBaseView * pRight, CBaseView * pBottom)
{
allviewstate allstate = m_viewstates.back();
POINT pt = m_caretpoints.back();
Undo(allstate.left, pLeft, pt);
Undo(allstate.right, pRight, pt);
Undo(allstate.bottom, pBottom, pt);
m_viewstates.pop_back();
m_caretpoints.pop_back();
}
示例2: Undo
bool mitk::LimitedLinearUndo::Undo(bool fine)
{
if (fine)
{
// undo one object event ID
return Undo();
}
else
{
// undo one group event ID
int oeid = FirstObjectEventIdOfCurrentGroup(m_UndoList); // get the Object Event ID of the first item with a differnt Group ID (as seen from the end of stack)
return Undo(oeid);
}
}
示例3: MainLineIterate
static void MainLineIterate(typePos *Position)
{
int va, v2, cp;
uint32 m;
(Position->Dyn + 1)->move = MoveNone;
Mobility(Position);
if (!RobboTotalBaseScore(Position, &va))
{
if (VerboseRobboBases)
{
Send("info string Failure in MainLine\n");
#ifdef Log
if (WriteLog)
{
log_file = fopen(log_filename, "a");
fprintf(log_file, "info string Failure in MainLine\n");
close_log();
}
#endif
}
(Position->Dyn + 1)->move = MoveNone;
Position->StackHeight = 0;
return;
}
if (!RobboMove(Position, &m, &v2, &cp))
{
(Position->Dyn + 1)->move = MoveNone;
Position->StackHeight = 0;
return;
}
if (va == dDraw)
{
Position->StackHeight = 0;
Make(Position, m);
Position->StackHeight = 1;
Undo(Position, m);
return;
}
m &= 0x7fff;
Position->StackHeight = 0;
Make(Position, m);
Position->StackHeight = 1;
MainLineIterate(Position);
Undo(Position, m);
Position->StackHeight = 1;
}
示例4: PERFD
uint64 PERFD (typePOS* POSITION, int n)
{
int i;
uint64 TOTAL = 0, TIME;
typeMoveList LM[256], *lm;
DrawBoard (POSITION);
TIME = GetClock();
Mobility (POSITION);
if (IN_CHECK)
lm = EvasionMoves (POSITION, LM, 0xffffffffffffffff);
else
{
lm = CaptureMoves (POSITION, LM, POSITION->OccupiedBW);
lm = OrdinaryMoves (POSITION, lm);
}
for (i = 0; i < lm - LM; i++)
{
Make (POSITION, LM[i].move);
Mobility (POSITION);
if (!ILLEGAL)
{
printf ("%s ",Notate (LM[i].move, STRING1[POSITION->cpu]));
PERFT (POSITION, n - 1);
TOTAL += CNT[n - 1];
}
Undo (POSITION, LM[i].move);
}
printf ("TOTAL %lld moves %ld time: %lld us\n",
TOTAL, lm - LM, GetClock() - TIME);
return TOTAL;
}
示例5: InitIO
void ImageGroundTruthPanelViewer::on_key_down(wxKeyEvent & event)
{
if(event.ControlDown() && event.GetUnicodeKey() == 'O')
{
InitIO();
return;
}
if(mp_ground_truth_manager->IsEmpty())
{
return ;
}
try
{
switch(event.GetKeyCode())
{
case WXK_PAGEUP: LoadNextImage(); break;
case WXK_PAGEDOWN: LoadPreviousImage(); break;
}
if(event.ControlDown())
{
switch(event.GetUnicodeKey())
{
case 'S': Save(); break;
case 'Z': Undo(); break;
case 'Y': Redo(); break;
case 'A': MarkAsBlind(); break;
case 'I': MarkAsUnknown(); break;
case 'R': Reject(); break;
}
}
}
JPB_wx_CATCH("échec de l'ajout d'une boîtes englobante d'occlusion");
}
示例6: a
/* function : rollBack ()
UNDO all actions that occured after the last leap of faith.
in other words : rollback until you reach a leap of faith action.
if this action reaches a (BOARD_INITIALIZED) action before reaching
a (LEAP_OF_FAITH) action, it considers that the initial state of
the board is an invalid state and impossible to solve.
in the later case, this function sets the state flag (_BAD_INITIALIZATION).
return type :
- if rolled back successfully : true.
- otherwise : false.
*/
bool actionCourse::rollBack()
{
do
{
if( lastAction() . act == actionRecord::BOARD_INITIALIZED)
{
// if reached the BOARD_INITIALIZED action ...
// set the state flag _BAD_INITIALIZATION
dynamic_cast<sudokuBoard*>(this)->state |= sudokuState::_BAD_INITIALIZATION;
return false;
}
else
Undo();
}
// keep rolling back until you reach a LEAP_OF_FAITH action.
while( Tracker.top() != actionRecord::LEAP_OF_FAITH );
// signal the current value as faulty and shouldn't be used for future leaps.
Tracker.top().faultyValues.push_back(*(lastAction().subject));
if( Tracker.top().faultyValues.size() < (unsigned)Tracker.top().subject->countPossibilities() )
//correct the value taken by the leap
return Correct_LeapOfFaith();
else if(Tracker.top().subject->countPossibilities() == Tracker.top().faultyValues.size() )
return rollBack(); //if all the possibilities are tried, then a previuos leap is the mistake, roll back another time.
else
return false; // report failure.
}
示例7: RicochetNext
static void
RicochetNext (void)
{
if (!Solved ())
while (Undo());
NextTarget ();
}
示例8: renormalize
void Application::renormalize(HiddenMarkovModel &hmm,
int state,
const TigrString &ngram,
int changedSymbol,
double changedP)
{
throw "OBSOLETE";
TigrString history=ngram.substr(1,ngram.length()-1);
double sum=0;
for(int base=0 ; base<alphabetSize ; ++base)
{
char c=alphabet.lookup(base);
TigrString ngram=history+c;
int symbol=hoa->lookup(ngram);
double p=hmm.getEmissionProb(state,symbol);
undoables.push_back(Undo(&hmm,state,symbol,p));
if(symbol==changedSymbol) p=changedP;
sum+=p;
}
for(int base=0 ; base<alphabetSize ; ++base)
{
char c=alphabet.lookup(base);
TigrString ngram=history+c;
int symbol=hoa->lookup(ngram);
double p=
(symbol==changedSymbol ?
changedP :
hmm.getEmissionProb(state,symbol));
hmm.setEmissionProb(state,symbol,p/sum);
}
}
示例9: Undo
/**
* Destroys the Memento and reverts the Recorder back to the remembered state.
*
* @note The undo action will not be done if you have released the Memento.
*/
~Memento()
{
if (m_needRollback)
{
Undo();
}
}
示例10: switch
void CColorEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
switch (nChar)
{
case 0x01:// Ctrl-A => handle SELECT_ALL
SetSel(0, -1);
return;
case 0x03:// Ctrl-C => handle WM_COPY
Copy();
return;
case 0x16:// Ctrl-V => handle WM_PASTE
Paste();
return;
case 0x18:// Ctrl-X => handle WM_CUT
Cut();
return;
case 0x1A:// Ctrl-Z => handle ID_EDIT_UNDO (EM_UNDO)
if(CanUndo())
Undo();
return;
}
CEdit::OnChar(nChar, nRepCnt, nFlags);
}
示例11: QAction
void
MainWindow::InitEditMenu()
///
/// Initializes the edit menu and it's associated actions
///
/// @return
/// Nothing
///
{
mUndoAction = new QAction( tr("&Undo"), this);
mRedoAction = new QAction( tr("&Redo"), this);
mEditMenu = menuBar()->addMenu( tr("&Edit") );
mEditMenu->addAction( mUndoAction );
mEditMenu->addAction( mRedoAction );
// Connect the menu actions to their respective slots
connect( mUndoAction, SIGNAL( triggered() ), this, SLOT( Undo() ) );
connect( mRedoAction, SIGNAL( triggered() ), this, SLOT( Redo() ) );
// Disable the actions until the main window broadcasts for them to be active
mUndoAction->setDisabled( true );
mRedoAction->setDisabled( true );
connect( this, SIGNAL( UndoIsActive(bool) ), mUndoAction, SLOT( setEnabled(bool) ) );
connect( this, SIGNAL( RedoIsActive(bool) ), mRedoAction, SLOT( setEnabled(bool) ) );
}
示例12: Project_new
void MainWindow::CreateProjectNew(bool newProjectFile)
{
if (newProject)
delete newProject;
if (newProjectFile)
{
newProject = new Project_new(this);
} else {
QStringList selections;
QFileDialog dialog(0, "Open an ADCIRC Subdomain Project", QDir::homePath());
dialog.setModal(true);
dialog.setNameFilter("ADCIRC Subdomain Projects (*.spf)");
dialog.setFileMode(QFileDialog::ExistingFile);
if (dialog.exec())
{
selections = dialog.selectedFiles();
if (!selections.isEmpty())
{
newProject = new Project_new(selections.first(), this);
}
} else {
return;
}
}
newProject->SetOpenGLPanel(ui->GLPanel);
newProject->SetProgressBar(ui->progressBar);
newProject->SetProjectTree(ui->projectTree);
/* Subdomain Creation */
connect(ui->createSubdomainButton, SIGNAL(clicked()), newProject, SLOT(CreateNewSubdomain()));
/* Selection Tools */
connect(ui->selectNodesCircle, SIGNAL(clicked()), newProject, SLOT(SelectFullDomainCircleElements()));
connect(ui->selectElementSingle, SIGNAL(clicked()), newProject, SLOT(SelectFullDomainClickElements()));
connect(ui->selectNodeSingle, SIGNAL(clicked()), newProject, SLOT(SelectFullDomainPolygonElements()));
connect(ui->selectNodesSquare, SIGNAL(clicked()), newProject, SLOT(SelectFullDomainRectangleElements()));
connect(ui->undoButton, SIGNAL(clicked()), newProject, SLOT(Undo()));
connect(ui->redoButton, SIGNAL(clicked()), newProject, SLOT(Redo()));
/* U/I Updates */
connect(newProject, SIGNAL(mouseX(float)), this, SLOT(showMouseX(float)));
connect(newProject, SIGNAL(mouseY(float)), this, SLOT(showMouseY(float)));
connect(newProject, SIGNAL(undoAvailable(bool)), ui->undoButton, SLOT(setEnabled(bool)));
connect(newProject, SIGNAL(redoAvailable(bool)), ui->redoButton, SLOT(setEnabled(bool)));
connect(newProject, SIGNAL(numElements(int)), this, SLOT(showNumElements(int)));
connect(newProject, SIGNAL(numNodes(int)), this, SLOT(showNumNodes(int)));
connect(newProject, SIGNAL(numElementsSelected(int)), this, SLOT(showNumSelectedElements(int)));
connect(newProject, SIGNAL(numNodesSelected(int)), this, SLOT(showNumSelectedNodes(int)));
connect(newProject, SIGNAL(maxSelectedZ(float)), this, SLOT(showMaxSelectedZ(float)));
connect(newProject, SIGNAL(minSelectedZ(float)), this, SLOT(showMinSelectedZ(float)));
connect(newProject, SIGNAL(showProjectView()), this, SLOT(showProjectExplorerPane()));
/* Running ADCIRC */
connect(ui->actionFull_Domain, SIGNAL(triggered()), newProject, SLOT(RunFullDomain()));
}
示例13: noRedo
void PaintArea::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::RightButton)
_right = true;
else
_right = false;
if (_tool != 0)
{
_redo.clear();
emit noRedo();
}
if (_isselect)
{
Undo();
_isselect = false;
emit noCopy();
}
lastPoint = event->pos();
if (_tool == 7)
{
_history.push_back(image);
emit enableUndo();
drawWord(lastPoint);
}
else if (_tool == 6)
{
_history.push_back(image);
emit enableUndo();
drawBucket(event->pos());
}
else if (_tool == 10)
{
_history.push_back(image);
emit enableUndo();
Paste(event->pos());
}
else if (_tool == 12)
{
if (event->button() == Qt::LeftButton)
zoomIn();
else
zoomOut();
}
else
{
_history.push_back(image);
emit enableUndo();
_scroll = image;
scribbling = true;
if (_tool == 1)
drawLineTo(event->pos());
else if (_tool == 2)
drawEraser(event->pos());
else if (_tool == 11)
drawSpray(event->pos());
}
}
示例14: select
void PaintArea::Copy()
{
QRect select(_select.x() + 1, _select.y() + 1, _select.width() - 1, _select.height() - 1);
_copy = image.copy(select);
Undo();
_history.push_back(image);
emit enableUndo();
emit canPaste();
emit noCopy();
}
示例15: Redo
void CEditWnd::OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
CTextWnd::OnSysKeyDown(nChar, nRepCnt, nFlags);
bool isAlt = (GetKeyState(VK_MENU) & 0xF0) != 0;
bool isShift = (GetKeyState(VK_SHIFT) & 0xF0) != 0;
bool isCtrl = (GetKeyState(VK_CONTROL) & 0xF0) != 0;
if (nChar == VK_BACK && isShift && isAlt)
Redo();
if ((nChar == VK_BACK && isAlt))
Undo();
}