ezEngine  Release 25.03
ezCommandHistory Class Reference

Stores the undo / redo stacks of transactions done on a document. More...

#include <CommandHistory.h>

Classes

class  Storage
 

Public Member Functions

 ezCommandHistory (ezDocument *pDocument)
 
const ezDocumentGetDocument () const
 
ezStatus Undo (ezUInt32 uiNumEntries=1)
 
ezStatus Redo (ezUInt32 uiNumEntries=1)
 
bool CanUndo () const
 
bool CanRedo () const
 
ezStringView GetUndoDisplayString () const
 
ezStringView GetRedoDisplayString () const
 
void StartTransaction (const ezFormatString &displayString)
 
void CancelTransaction ()
 
void FinishTransaction ()
 
bool IsInTransaction () const
 Returns true, if between StartTransaction / EndTransaction. False during Undo/Redo.
 
bool IsInUndoRedo () const
 
void BeginTemporaryCommands (ezStringView sDisplayString, bool bFireEventsWhenUndoingTempCommands=false)
 Call this to start a series of transactions that typically change the same value over and over (e.g. dragging an object to a position). Every time a new transaction is started, the previous one is undone first. At the end of a series of temporary transactions, only the last transaction will be stored as a single undo step. Call this first and then start a transaction inside it.
 
void CancelTemporaryCommands ()
 
void FinishTemporaryCommands ()
 
bool InTemporaryTransaction () const
 
void SuspendTemporaryTransaction ()
 
void ResumeTemporaryTransaction ()
 
ezStatus AddCommand (ezCommand &ref_command)
 
void ClearUndoHistory ()
 
void ClearRedoHistory ()
 
void MergeLastTwoTransactions ()
 
ezUInt32 GetUndoStackSize () const
 
ezUInt32 GetRedoStackSize () const
 
const ezCommandTransactionGetUndoStackEntry (ezUInt32 uiIndex) const
 
const ezCommandTransactionGetRedoStackEntry (ezUInt32 uiIndex) const
 
ezSharedPtr< ezCommandHistory::StorageSwapStorage (ezSharedPtr< ezCommandHistory::Storage > pNewStorage)
 
ezSharedPtr< ezCommandHistory::StorageGetStorage ()
 

Public Attributes

ezEvent< const ezCommandHistoryEvent &, ezMutexm_Events
 

Friends

class ezCommand
 

Detailed Description

Stores the undo / redo stacks of transactions done on a document.

Member Function Documentation

◆ MergeLastTwoTransactions()

void ezCommandHistory::MergeLastTwoTransactions ( )
Todo:
This would not be necessary, if hierarchical transactions would not crash

◆ StartTransaction()

void ezCommandHistory::StartTransaction ( const ezFormatString displayString)
Todo:
Allow to have a limited transaction history and clean up transactions after a while

The documentation for this class was generated from the following files: