Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

TSE3::Cmd::CommandHistory Class Reference

History of which Command objects have been executed. More...

#include <CommandHistory.h>

Inheritance diagram for TSE3::Cmd::CommandHistory:

Inheritance graph
[legend]
Collaboration diagram for TSE3::Cmd::CommandHistory:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 CommandHistory (int limit=defaultLimit)
void add (Command *command)
bool undos () const
void undo ()
CommandundoCommand (size_t pos)
bool redos () const
void redo ()
CommandredoCommand (size_t pos)
int limit () const
void setLimit (int limit)
void clear ()
void clearUndos ()
void clearRedos ()

Static Public Attributes

const int defaultLimit = 20

Detailed Description

History of which Command objects have been executed.

The history of which Command objects have been executed. Once a Command has been executed, it should be placed into the CommandHistory so that an undo/redo mechanism can be operated by the user.

In the TSE3 system there could be be one CommandHistroy object per TSE3::Song or one global CommandHistory.

When the availablity of either undos or redos changes, a notification is sent.

The CommandHistory class has a size limit facility. When either the undo or redo list goes over a certain threshold (see limit) will be deleted. This can be set to 'infinite'.

Author:
Pete Goodliffe
Version:
3.00
See also:
Command


Constructor & Destructor Documentation

TSE3::Cmd::CommandHistory::CommandHistory int  limit = defaultLimit  ) 
 

Create a CommandHistory with the given limit size. This limit defaults to the value of defaultLimit.

Parameters:
limit CommandHistory size limit


Member Function Documentation

void TSE3::Cmd::CommandHistory::add Command command  ) 
 

Adds a Command to the CommandHistory. The Command must have been executed. Placing it in the CommandHistory ties it's lifetime to that of the CommandHistory object.

Adding a Command will wipe any redos that may have been possible.

Parameters:
command New Command to add

bool TSE3::Cmd::CommandHistory::undos  )  const
 

Returns whether there are any Command objects that can be undone.

When this information changes a notification will be sent.

Returns:
True if there are any undos

void TSE3::Cmd::CommandHistory::undo  ) 
 

Undoes the last Command, and places it on the redo list.

Command* TSE3::Cmd::CommandHistory::undoCommand size_t  pos  ) 
 

Returns the command places down in the undo history. For example, undoCommand(0) returns the next Command to be undone.

If there is no command to be undone at this pos then returns zero.

Parameters:
pos Index into undo history
Returns:
Command at this position

bool TSE3::Cmd::CommandHistory::redos  )  const
 

Returns whether there are any Command objects that can be redone.

When this information changes a notification will be sent.

Returns:
True if there are any redos

void TSE3::Cmd::CommandHistory::redo  ) 
 

Redoes the last undone Command.

Command* TSE3::Cmd::CommandHistory::redoCommand size_t  pos  ) 
 

Returns the command places down in the redo history. For example, redoCommand(0) returns the next Command to be redone.

If there is no command to be redone at this pos then returns zero.

Parameters:
pos Index into redo history
Returns:
Command at this position

int TSE3::Cmd::CommandHistory::limit  )  const
 

Returns the value of the history size limit. This is the number of Command objects that are stored.

If the value is -1 then the number of undos is unlimited.

Clearly, if the value is 0 then undo is effectively 'off'.

Returns:
CommandHistory size limit

void TSE3::Cmd::CommandHistory::setLimit int  limit  ) 
 

Sets the CommandHistory limit value. If there are more Command objects than the new limit currently in the CommandHistory, they will be removed.

Parameters:
limit New CommandHistory size limit

void TSE3::Cmd::CommandHistory::clear  )  [inline]
 

Clears all undo and redo actions in the CommandHistory.

See also:
clearUndos

clearRedos

void TSE3::Cmd::CommandHistory::clearUndos  ) 
 

Clears all undo actions in the CommandHistory.

See also:
clear

clearRedos

void TSE3::Cmd::CommandHistory::clearRedos  ) 
 

Clears all redo actions in the CommandHistory.

See also:
clear

clearUndos


Member Data Documentation

const int TSE3::Cmd::CommandHistory::defaultLimit = 20 [static]
 

The default CommandHistory limit size.


The documentation for this class was generated from the following file:
Generated on Wed May 25 14:47:34 2005 for TSE3 by doxygen 1.3.2