namespace Cmd

TSE3 library undo/redoable commands. More...

Full nameTSE3::Cmd
List of all Methods
Annotated List

Public Types

Detailed Description

The Cmd namespace contains classes that implement the Command pattern (GoF book). They use the TSE3 API to provide undo/redoable commands objects for all commonly performed operations.

There are a large number of commands that can be used for different purposes. The base class for all TSE3 commands is the Command. There exists one command class for every useful operation on the TSE3::Song data structure and it's subcomponents.

There is one proviso with using commands: if you manipulate some of a TSE3::Song with commands, for the undo/redo to work you must (logically) manipulate the TSE3::Song entirely through Command objects. Otherwise the undo/redo system will be faced with complicated inconsistencies which cannot be resolved.

You can store executed Command objects on the CommandHistory buffer to automate the undo/redo process.

Command subclasses are easy to write, so it's not difficult to add your own commands and use them with the CommandHistory. See the notes in the main TSE3 library documentation for more information.

See also: TSE3

CommandHistory (class)


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) Commands will be deleted. This can be set to 'infinite'.

See also: Command

Command (class)


A base class for implementing the 'Command' design pattern [Gof]

If you are implementing a new Command then inherit publicly from this class, implement the executeImpl() and undoImpl() methods and ensure that your constructor calls the Command protected constructor.

VariableSetCommand (class)


A template class for implementing Command objects that set a particular class' variable state.

The template takes five parameters:

CommandGroup (class)


A class that groups Command object together so you can pretend that several commands are one.

The commands will be executed in the order that they are added to the CommandGroup (see add). They will be undone in the reverse order.

FlagTrack_Add (class)


Command to add a TSE3::Flag to a TSE3::FlagTrack.

See also: Command

Part_SetInfo (class)


Command to set a TSE3::Part's info (the TSE3::Phrase, it's TSE3::MidiParams setup, the TSE3::DisplayParams and it's TSE3::MidiFilter setup).

If you just want to set the TSE3::Phrase, use Part_SetPhrase.

See also: Command

Part_SetPhrase (class)


Command to set a TSE3::Part's TSE3::Phrase.

See also: Command

Part_Move (class)


Command to move a TSE3::Part's from it's current position (which may be in a TSE3::Track or not - in which case the TSE3::Part is being 'inserted') to another position in a (possibly different) TSE3::Track.

See also: Command

Phrase_SetInfo (class)


Command to set a TSE3::Phrase's info (the title and its TSE3::DisplayParams setup).

If the TSE3::Phrase is parented in a TSE3::PhraseList and you change the title to an invalid name, then the exception generated by TSE3::PhraseList::insert() will be propragated back to you.

See also: Command

Phrase_Create (class)


Command to insert a TSE3::Phrase into a TSE3::Song by creating it from a TSE3::PhraseEdit.

This object may propagate the TSE3::PhraseListError exception if the Phrase name already exists.

See also: Command

Phrase_Erase (class)


Command to erase a TSE3::Phrase from a TSE3::PhraseList.

See also: Command

Phrase_Replace (class)


Song_SetInfo (class)


Command to set a Song's info (the title, author, copyright and date strings).

See also: Command

Song_SetTitle (class)


Command to set a Song's title.

See also: Command

Song_SetAuthor (class)


Command to set a Song's author.

See also: Command

Song_SetCopyright (class)


Command to set a Song's copyright.

See also: Command

Song_SetDate (class)


Command to set a Song's date.

See also: Command

Song_InsertTrack (class)


Command to insert a new blank Track into a Song.

See also: Command

Song_RemoveTrack (class)


Command to remove a Track from a Song.

See also: Command

Song_SoloTrack (class)


Command to set the solo Track in a Song.

See also: Command

Track_SetInfo (class)


Command to set a TSE3::Track's info (the title, it's TSE3::MidiParams setup and it's TSE3::MidiFilter setup).

See also: Command

Track_Snip (class)


Command to snip a TSE3::Part in a TSE3::Track.

If there is no TSE3::Part at the specified time, then nothing will happen, and no error will be raised. It is suggested that you check that the command is worthwhile before you perform it.

See also: Command

Track_Glue (class)


Command to glue two TSE3::Part objects in a TSE3::Track.

If there is no TSE3::Part at the specified time or it is not directly adjacent to another TSE3::part, then nothing will happen, and no error will be raised. It is suggested that you check that the command is worthwhile before you perform it. You can use the static valid() method to find out whether this command is valid before performing it.

See also: Command

Track_RemovePart (class)


Command to remove a TSE3::Part from a TSE3::Track.

(Too insert a TSE3::Part use Part_Move.)

See also: Command

Track_Sort (class)


Command to sort a;; TSE3::Track objects in a TSE3::Song.

See also: Command