wxMaxima
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions
TreeUndoManager Class Reference

Owns the cell-tree undo/redo stacks and the active-cell snapshot. More...

#include <TreeUndoManager.h>

Public Member Functions

UndoActionsUndoStack ()
 The list of tree actions that can be undone.
 
const UndoActionsUndoStack () const
 
UndoActionsRedoStack ()
 The list of undone tree actions that can be redone.
 
const UndoActionsRedoStack () const
 
void AppendAction ()
 Mark the newest undo action as part of the following atomic action.
 
void ClearRedoActionList ()
 Clear the list of actions that can be redone.
 
void ClearUndoActionList ()
 Clear the list of actions that can be undone.
 
void ClearBuffers ()
 Clear both action lists and forget the active-cell snapshot.
 
void LimitUndoBuffer (long undoLimit)
 Drop actions from the back of the undo list until it is within the limit.
 
void CellEntered (GroupCell *group, const wxString &text, long long selStart, long long selEnd)
 The cursor has entered a cell: snapshot its contents.
 
bool CellLeft (GroupCell *activeCell, const wxString &currentText, long undoLimit)
 The cursor is leaving a cell: record a text-change undo action if needed.
 
void ForgetActiveCell ()
 Forget the active-cell snapshot (e.g. the next change must not be undoable).
 
GroupCellActiveCell () const
 The cell the cursor is in, as recorded by CellEntered().
 

Static Public Member Functions

static void DiscardAction (UndoActions *actionList)
 Remove one action from an action list.
 
static void AppendAction (UndoActions *actionList)
 Mark the newest action of the list as part of the following atomic action.
 

Detailed Description

Owns the cell-tree undo/redo stacks and the active-cell snapshot.

Pure state + bookkeeping: this class never touches the worksheet's cell tree itself. Applying an action (the tree surgery) is Worksheet's job; it reaches the stacks via UndoStack()/RedoStack().

The "active cell snapshot" is the text and selection an EditorCell had when the cursor entered it; when the cursor leaves the cell again, the snapshot is compared against the current text to decide whether a text-change undo action has to be recorded (see CellLeft()).

Member Function Documentation

◆ CellEntered()

void TreeUndoManager::CellEntered ( GroupCell group,
const wxString &  text,
long long  selStart,
long long  selEnd 
)
inline

The cursor has entered a cell: snapshot its contents.

Parameters
groupThe group cell that was entered
textThe text its editor currently contains
selStartThe editor's selection start (or cursor position)
selEndThe editor's selection end (or cursor position)

◆ CellLeft()

bool TreeUndoManager::CellLeft ( GroupCell activeCell,
const wxString &  currentText,
long  undoLimit 
)
inline

The cursor is leaving a cell: record a text-change undo action if needed.

Compares the entry snapshot with the cell's current text; if the text has genuinely changed (more than just appending a ";"), an undo action with the old text and selection is pushed, the undo buffer is limited and the redo list is cleared.

Parameters
activeCellThe group cell being left
currentTextThe text its editor contains now
undoLimitThe undo-buffer limit to enforce (0 = unlimited)
Returns
true if a text-change action was recorded

◆ DiscardAction()

static void TreeUndoManager::DiscardAction ( UndoActions actionList)
inlinestatic

Remove one action from an action list.

Removes the whole atomic group: trailing actions that are marked as m_partOfAtomicAction belong to the action in front of them and are dropped along with it.

◆ LimitUndoBuffer()

void TreeUndoManager::LimitUndoBuffer ( long  undoLimit)
inline

Drop actions from the back of the undo list until it is within the limit.

Parameters
undoLimitThe maximum number of undo actions to keep; 0 = unlimited.

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