wxMaxima
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
TreeUndoAction Class Reference

The description of one action for the undo (or redo) command. More...

#include <TreeUndoAction.h>

Collaboration diagram for TreeUndoAction:
[legend]

Public Member Functions

 TreeUndoAction (GroupCell *start, const wxString &oldText, long long oldSelStart=-1, long long oldSelEnd=-1)
 
 TreeUndoAction (GroupCell *start, GroupCell *end)
 
 TreeUndoAction (GroupCell *start, GroupCell *end, GroupCell *oldCells)
 

Data Fields

bool m_partOfAtomicAction = false
 True = This undo action is only part of an atomic undo action.
 
CellPtr< GroupCellm_start
 The position this action started at.
 
const wxString m_oldText
 The old contents of the cell start.
 
const long long m_oldSelStart = -1
 The old cursor/selection range in the EditorCell pointed to by m_start.
 
const long long m_oldSelEnd = -1
 
CellPtr< GroupCellm_newCellsEnd
 This action inserted all cells from start to newCellsEnd.
 
std::unique_ptr< GroupCellm_oldCells
 Cells that were deleted in this action.
 

Detailed Description

The description of one action for the undo (or redo) command.

This object is immutable - the undo/redo buffer cannot be modified.

Field Documentation

◆ m_newCellsEnd

CellPtr<GroupCell> TreeUndoAction::m_newCellsEnd

This action inserted all cells from start to newCellsEnd.

To undo it these cells have to be deleted again.

If this field's value is NULL no cells have to be deleted to undo this action.

A CellPtr for the same reason as m_start: it auto-nulls if the referenced GroupCell is destroyed before this action is undone.

◆ m_oldCells

std::unique_ptr<GroupCell> TreeUndoAction::m_oldCells

Cells that were deleted in this action.

This field will have to contain the cells themselves, not a copy of them because the latter might break consecutive undos.

If this field's value is NULL no cells have to be added to undo this action.

◆ m_oldSelStart

const long long TreeUndoAction::m_oldSelStart = -1

The old cursor/selection range in the EditorCell pointed to by m_start.

-1 means "not recorded". Both fields store the selection endpoints; when they are equal the value represents a plain cursor position (no selection). The convention matches EditorCell::SelectionStart()/SelectionEnd().

◆ m_oldText

const wxString TreeUndoAction::m_oldText

The old contents of the cell start.

if this field != wxEmptyString this field contains the old contents of the text cell pointed to by the field start.

◆ m_partOfAtomicAction

bool TreeUndoAction::m_partOfAtomicAction = false

True = This undo action is only part of an atomic undo action.

This is the only mutable part of this action: is is used to indicate its relation to other actions in the undo list.

◆ m_start

CellPtr<GroupCell> TreeUndoAction::m_start

The position this action started at.

NULL = At the begin of the document.

A CellPtr (not a raw pointer) so that it auto-nulls if the GroupCell it refers to is destroyed while this action still sits in the undo/redo list - otherwise invoking the action would dereference freed memory. The consumer code already null-checks this field, so auto-nulling makes those checks correct instead of relying on the freed pointer's stale value.


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