Ardour  9.0-pre0-582-g084a23a80d
PBD::HistoryOwner Class Reference

#include <history_owner.h>

Inheritance diagram for PBD::HistoryOwner:
[legend]

Public Member Functions

 HistoryOwner (std::string const &name)
 
virtual ~HistoryOwner ()
 
void begin_reversible_command (const std::string &cmd_name)
 
void begin_reversible_command (GQuark)
 
void abort_reversible_command ()
 
void commit_reversible_command (PBD::Command *cmd=0)
 
void add_command (PBD::Command *const cmd)
 
PBD::StatefulDiffCommandadd_stateful_diff_command (std::shared_ptr< PBD::StatefulDestructible > sfd)
 
std::list< GQuark > const & current_operations ()
 
bool operation_in_progress (GQuark) const
 
bool collected_undo_commands () const
 
PBD::UndoTransactioncurrent_reversible_command ()
 
bool abort_empty_reversible_command ()
 
void add_commands (std::vector< PBD::Command * > const &cmds)
 
PBD::UndoHistoryundo_redo ()
 

Protected Attributes

std::string _name
 
PBD::UndoHistory _history
 
PBD::UndoTransaction_current_trans
 
std::list< GQuark > _current_trans_quarks
 

Detailed Description

Definition at line 16 of file history_owner.h.

Constructor & Destructor Documentation

◆ HistoryOwner()

PBD::HistoryOwner::HistoryOwner ( std::string const &  name)

◆ ~HistoryOwner()

virtual PBD::HistoryOwner::~HistoryOwner ( )
virtual

Member Function Documentation

◆ abort_empty_reversible_command()

bool PBD::HistoryOwner::abort_empty_reversible_command ( )

Abort reversible command IFF no undo changes have been collected.

Returns
true if undo operation was aborted.

◆ abort_reversible_command()

void PBD::HistoryOwner::abort_reversible_command ( )

abort an open undo command This must only be called after begin_reversible_command ()

◆ add_command()

void PBD::HistoryOwner::add_command ( PBD::Command *const  cmd)

◆ add_commands()

void PBD::HistoryOwner::add_commands ( std::vector< PBD::Command * > const &  cmds)

◆ add_stateful_diff_command()

PBD::StatefulDiffCommand* PBD::HistoryOwner::add_stateful_diff_command ( std::shared_ptr< PBD::StatefulDestructible sfd)

create an StatefulDiffCommand from the given object and add it to the stack.

This function must only be called after begin_reversible_command. Failing to do so may lead to a crash.

Parameters
sfdthe object to diff
Returns
the allocated StatefulDiffCommand (already added via add_command)

◆ begin_reversible_command() [1/2]

void PBD::HistoryOwner::begin_reversible_command ( const std::string &  cmd_name)

begin collecting undo information

This call must always be followed by either begin_reversible_command() or commit_reversible_command()

Parameters
cmd_namehuman readable name for the undo operation

◆ begin_reversible_command() [2/2]

void PBD::HistoryOwner::begin_reversible_command ( GQuark  )

◆ collected_undo_commands()

bool PBD::HistoryOwner::collected_undo_commands ( ) const
inline

Test if any undo commands were added since the call to begin_reversible_command ()

This is useful to determine if an undoable action was performed before adding additional information (e.g. selection changes) to the undo transaction.

Returns
true if undo operation is valid but empty

Definition at line 72 of file history_owner.h.

◆ commit_reversible_command()

void PBD::HistoryOwner::commit_reversible_command ( PBD::Command cmd = 0)

finalize an undo command and commit pending transactions

This must only be called after begin_reversible_command ()

Parameters
cmd(additional) command to add

◆ current_operations()

std::list<GQuark> const& PBD::HistoryOwner::current_operations ( )
inline
Returns
The list of operations that are currently in progress

Definition at line 55 of file history_owner.h.

◆ current_reversible_command()

PBD::UndoTransaction* PBD::HistoryOwner::current_reversible_command ( )
inline

Definition at line 76 of file history_owner.h.

◆ operation_in_progress()

bool PBD::HistoryOwner::operation_in_progress ( GQuark  ) const

◆ undo_redo()

PBD::UndoHistory& PBD::HistoryOwner::undo_redo ( )
inline

Definition at line 87 of file history_owner.h.

Member Data Documentation

◆ _current_trans

PBD::UndoTransaction* PBD::HistoryOwner::_current_trans
protected

current undo transaction, or 0

Definition at line 93 of file history_owner.h.

◆ _current_trans_quarks

std::list<GQuark> PBD::HistoryOwner::_current_trans_quarks
protected

GQuarks to describe the reversible commands that are currently in progress. These may be nested, in which case more recently-started commands are toward the front of the list.

Definition at line 98 of file history_owner.h.

◆ _history

PBD::UndoHistory PBD::HistoryOwner::_history
protected

Definition at line 91 of file history_owner.h.

◆ _name

std::string PBD::HistoryOwner::_name
protected

Definition at line 90 of file history_owner.h.


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