|
|
This is the base class for all addons. If you want to write an own addon, derive from this class. Before you start, you have to decide on the following topics:
1. Shall the user of your operation be able to undo that operation? This only makes sense if your operation modifies the song. If your operation writes output to disk (like tex or pdf, etc), or plays the song in a sophisticated way, there is nothing to be undone after the operation. But if your operation changes e.g. the note pitches or velocities, you want to provide a possibility to undo that operation. In this case you have to make sure to set the TO_BE_UNDONE flag (see below) and to implement the undo() and redo() methods. Beware: If your addon is of the type TO_BE_UNDONE, don't use other operations within your addon!
2. Which scope shall your operation operate on. The following constants are defined to specify the scope:
TREAT_SELECTION - lets the operation act on the selection TREAT_PART - lets the operation act on a part TREAT_TRACK - lets the operation act on a track TREAT_SONG - lets the operation act on the song TREAT_GLOBAL - lets the operation act without a song context |
You can add these constants, or use:
TREAT_ALL = TREAT_SELECTION + TREAT_PART + TREAT_TRACK + TREAT_SONG + TREAT_GLOBAL; |
to indicate that your addon acts on all scopes.
Element * _target | _target |
[protected]
int _context | _context |
[protected]
static const bool TO_BE_UNDONE | TO_BE_UNDONE |
static const int TREAT_SELECTION | TREAT_SELECTION |
static const int TREAT_PART | TREAT_PART |
static const int TREAT_TRACK | TREAT_TRACK |
static const int TREAT_SONG | TREAT_SONG |
static const int TREAT_GLOBAL | TREAT_GLOBAL |
static const int TREAT_ALL | TREAT_ALL |
Addon (char*,Element*,bool,int)
| Addon |
Default Constructor
~Addon ()
| ~Addon |
[virtual]
Make sure to implement the destructor to free memory and avoid memory leaks!
void undo ()
| undo |
[virtual]
You need to implement this method only if your operation is of the type TO_BE_UNDONE
Reimplemented from Operation.
void redo ()
| redo |
[virtual]
You need to implement this method only if your operation is of the type TO_BE_UNDONE
Reimplemented from Operation.
void selection (Table * selection)
| selection |
[virtual]
Implement this method if your operation acts on selections
void part (Part * part)
| part |
[virtual]
Implement this method if your operation acts on parts
void track (Track * track)
| track |
[virtual]
Implement this method if your operation acts on tracks
void song (Song * song)
| song |
[virtual]
Implement this method if your operation acts on the song
void global ()
| global |
[virtual]
Implement this method if your operation acts without song context
void run ()
| run |
This method is already implemented. You have to call it from your constructor
int context ()
| context |
This method returns the context
bool context (int context)
| context |
This method returns true if the operation supports the context given as a parameter
ostream & print (int,ostream&)
|
[const virtual]
Implementation of the print method
Reimplemented from Atoma.
void flush (const char*)
| flush |
[const virtual]
Implementation of the flush method
Reimplemented from Atoma.
Element * copy ()
| copy |
[const virtual]
Implementation of the copy method
Reimplemented from Atoma.
Generated by: wuerthne on al on Sun Jan 6 22:32:42 2002, using kdoc 2.0a53. |