XII Release 0.1.0
Loading...
Searching...
No Matches
xiiCommandHistory Class Reference

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

#include <CommandHistory.h>

Classes

class  Storage

Public Member Functions

 xiiCommandHistory (xiiDocument *pDocument)
const xiiDocument * GetDocument () const
xiiStatus Undo (xiiUInt32 uiNumEntries=1)
xiiStatus Redo (xiiUInt32 uiNumEntries=1)
bool CanUndo () const
bool CanRedo () const
xiiStringView GetUndoDisplayString () const
xiiStringView GetRedoDisplayString () const
void StartTransaction (const xiiFormatString &displayString)
void CancelTransaction ()
void FinishTransaction ()
bool IsInTransaction () const
 Returns true, if between StartTransaction / EndTransaction. False during Undo/Redo.
bool IsInUndoRedo () const
void BeginTemporaryCommands (xiiStringView sDisplayString, bool bFireEventsWhenUndoingTempCommands=false)
void CancelTemporaryCommands ()
void FinishTemporaryCommands ()
bool InTemporaryTransaction () const
void SuspendTemporaryTransaction ()
void ResumeTemporaryTransaction ()
xiiStatus AddCommand (xiiCommand &ref_command)
void ClearUndoHistory ()
void ClearRedoHistory ()
void MergeLastTwoTransactions ()
xiiUInt32 GetUndoStackSize () const
xiiUInt32 GetRedoStackSize () const
const xiiCommandTransaction * GetUndoStackEntry (xiiUInt32 uiIndex) const
const xiiCommandTransaction * GetRedoStackEntry (xiiUInt32 uiIndex) const
xiiSharedPtr< xiiCommandHistory::Storage > SwapStorage (xiiSharedPtr< xiiCommandHistory::Storage > pNewStorage)
xiiSharedPtr< xiiCommandHistory::Storage > GetStorage ()

Public Attributes

xiiEvent< const xiiCommandHistoryEvent &, xiiMutex > m_Events

Friends

class xiiCommand

Detailed Description

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

Member Function Documentation

◆ BeginTemporaryCommands()

void xiiCommandHistory::BeginTemporaryCommands ( xiiStringView 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.

◆ MergeLastTwoTransactions()

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

◆ StartTransaction()

void xiiCommandHistory::StartTransaction ( const xiiFormatString & 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:
  • /home/runner/work/XII/XII/Source/Tools/Libs/ToolsFoundation/CommandHistory/CommandHistory.h
  • /home/runner/work/XII/XII/Source/Tools/Libs/ToolsFoundation/CommandHistory/Implementation/CommandHistory.cpp