#include <PartSelection.h>
Inheritance diagram for TSE3::App::PartSelection:
Public Types | |
typedef std::vector< TSE3::Part * >::const_iterator | iterator_t |
Public Member Functions | |
PartSelection () | |
~PartSelection () | |
PartSelection (const PartSelection &) | |
TSE3::Clock | earliest () const |
TSE3::Clock | latest () const |
size_t | minTrack () const |
size_t | maxTrack () const |
void | select (TSE3::Part *part, bool add) |
void | deselect (TSE3::Part *part) |
void | clear () |
void | selectAll (TSE3::Song *song) |
void | selectAll (TSE3::Track *track) |
void | invert (TSE3::Song *song) |
void | selectBetween (TSE3::Song *song, TSE3::Clock start, TSE3::Clock end, bool inside=true) |
void | selectBetween (TSE3::Track *track, TSE3::Clock start, TSE3::Clock end, bool inside=true) |
PartSelection & | operator= (const PartSelection &) |
size_t | size () const |
bool | isSelected (TSE3::Part *part) const |
Part * | front () const |
Part * | back () const |
iterator_t | begin () const |
iterator_t | end () const |
virtual void | Part_StartAltered (Part *, Clock start) |
virtual void | Part_EndAltered (Part *, Clock end) |
virtual void | Part_Reparented (Part *) |
virtual void | Notifier_Deleted (Part *) |
virtual void | TrackSelection_Selected (TrackSelection *, TSE3::Track *, bool) |
The PartSelection class allows an Application to provide the facility to 'select' one or more TSE3::Part in a TSE3::Song. These TSE3::Part objects must be held in a TSE3::Track. As soon as a TSE3::Part is removed from a TSE3::Track, it is removed from the selection.
This behviour is useful when using the command history system in the TSE3::Cmd namespace where undoing a TSE3::Part add, for example, may cause a selected Part to be removed from the TSE3::Song.
Internally, the Parts are held in an STL vector of type <Part*>. In order to get access to the contents of this vector, access is provided to it's iterator.
If you are using the iterators and performing any operations that may affect the PartSelection (i.e. removing a TSE3::Part from it's TSE3::Track and reinserting it elsewhere) then you will invalidate the iterator.
A method of avoiding this would be to, rather than iterate over each Part, to remove a Part from the head of the list, work on it, and place it into a second PartSelection. Do this for each Part in the PartSelection, and when finished, copy the new PartSelection into the old one.
To facilitate this, the PartSelection is a TrackSelectionListener. You can attach it to a TrackSelection object, and whenever the TrackSelection has a TSE3::Track selected the PartSelection will be cleared.
You will need to use an attach like this:
PartSelection ps; TrackSelection *ts = someTrackSelection(); ps.TSE3::Listener<TSE3::App::TrackSelectionListener>::attachTo(ts);
|
|
|
The PartSelection begins with no Part selected. |
|
|
|
|
|
Returns the earliest start time of any TSE3::Part in the selection. If there is no selection, this will return -1.
|
|
Returns the latest end time of any TSE3::Part in the selection. If there is no selection, this will return -1.
|
|
Returns the lowest TSE3::Track index that any selected TSE3::Part is in. If there is no selection, this will return 0.
|
|
Returns the greatest TSE3::Track index that any selected TSE3::Part is in. If there is no selection, this will return 0.
|
|
Selects a TSE3::Part. If the TSE3::Part is not in a TSE3::Track, it will not be selected.
|
|
Deselects a Part. If the Part is not selected, then nothing will happen.
|
|
Clears the entire selection. |
|
Selects all the TSE3::Part objects in the given TSE3::Song (this 'should' include any Parts alreadys selected!).
|
|
Adds to the selection all the TSE3::Part objects in the given TSE3::Track.
|
|
Inverts the selection for all the TSE3::Part objects in the given TSE3::Song (i.e. all selected Parts are deselected and all deselected Parts are selected).
|
|
Adds to the selection all the Parts which have a section lying either inside or outside the window between a
|
|
Adds to the selection all the Parts which have a section lying either inside or outside the window between a
|
|
Copy PartSelection contents. |
|
Returns how many TSE3::Part objects are selected.
|
|
Returns whether a particular TSE3::Part is selected.
|
|
Returns the first item in the PartSelection, or zero if there are no selected Parts.
|
|
Returns the last item in the PartSelection, or zero if there are no selected Parts.
|
|
Returns an iterator pointing to the first TSE3::Part in this selection.
|
|
Returns an iterator pointing to the last TSE3::Part in this selection.
|
|
Reimplemented from TSE3::PartListener. |
|
Reimplemented from TSE3::PartListener. |
|
Reimplemented from TSE3::PartListener. |
|
|
|
|