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

TSE3::App::PartSelection Class Reference

Support class for selecting one or more Part object. More...

#include <PartSelection.h>

Inheritance diagram for TSE3::App::PartSelection:

Inheritance graph
[legend]
Collaboration diagram for TSE3::App::PartSelection:

Collaboration graph
[legend]
List of all members.

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)
PartSelectionoperator= (const PartSelection &)
size_t size () const
bool isSelected (TSE3::Part *part) const
Partfront () const
Partback () 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)

Detailed Description

Support class for selecting one or more Part object.

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.

Interaction with TrackSelection
You may want to use this selection utility in connection with the TrackSelection class to ensure that the user has only selected one type of object at any time.

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);

Author:
Pete Goodliffe
Version:
1.00
See also:
TSE3


Member Typedef Documentation

typedef std::vector<TSE3::Part*>::const_iterator TSE3::App::PartSelection::iterator_t
 


Constructor & Destructor Documentation

TSE3::App::PartSelection::PartSelection  ) 
 

The PartSelection begins with no Part selected.

TSE3::App::PartSelection::~PartSelection  ) 
 

TSE3::App::PartSelection::PartSelection const PartSelection  ) 
 


Member Function Documentation

TSE3::Clock TSE3::App::PartSelection::earliest  )  const [inline]
 

Returns the earliest start time of any TSE3::Part in the selection.

If there is no selection, this will return -1.

Returns:
Earliest TSE3::Part start time

TSE3::Clock TSE3::App::PartSelection::latest  )  const [inline]
 

Returns the latest end time of any TSE3::Part in the selection.

If there is no selection, this will return -1.

Returns:
Latest TSE3::Part start time

size_t TSE3::App::PartSelection::minTrack  )  const [inline]
 

Returns the lowest TSE3::Track index that any selected TSE3::Part is in.

If there is no selection, this will return 0.

Returns:
Lowest TSE3::Track index.

size_t TSE3::App::PartSelection::maxTrack  )  const [inline]
 

Returns the greatest TSE3::Track index that any selected TSE3::Part is in.

If there is no selection, this will return 0.

Returns:
Greatest TSE3::Track index.

void TSE3::App::PartSelection::select TSE3::Part part,
bool  add
 

Selects a TSE3::Part.

If the TSE3::Part is not in a TSE3::Track, it will not be selected.

Parameters:
part The Part to select
add Whether to add the TSE3::Part to the selection (true) or to replace the current selection (false).

void TSE3::App::PartSelection::deselect TSE3::Part part  ) 
 

Deselects a Part. If the Part is not selected, then nothing will happen.

Parameters:
part The Part to deselect

void TSE3::App::PartSelection::clear  ) 
 

Clears the entire selection.

void TSE3::App::PartSelection::selectAll TSE3::Song song  ) 
 

Selects all the TSE3::Part objects in the given TSE3::Song (this 'should' include any Parts alreadys selected!).

Parameters:
song TSE3::Song whose TSE3::Part objects are all to be selected

void TSE3::App::PartSelection::selectAll TSE3::Track track  ) 
 

Adds to the selection all the TSE3::Part objects in the given TSE3::Track.

Parameters:
track TSE3::Track whose TSE3::Part objects are all to be selected

void TSE3::App::PartSelection::invert TSE3::Song song  ) 
 

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).

Parameters:
song TSE3::Song whose TSE3::Part objects are all to be inverted

void TSE3::App::PartSelection::selectBetween TSE3::Song song,
TSE3::Clock  start,
TSE3::Clock  end,
bool  inside = true
 

Adds to the selection all the Parts which have a section lying either inside or outside the window between a start time and an end time.

Parameters:
song TSE3::Song whose TSE3::Part objects are all to be operated on
start Start of selection window
end End of selection window
inside If true, select TSE3::Part objects between start and end, else select Parts NOT between these times

void TSE3::App::PartSelection::selectBetween TSE3::Track track,
TSE3::Clock  start,
TSE3::Clock  end,
bool  inside = true
 

Adds to the selection all the Parts which have a section lying either inside or outside the window between a start time and an end time.

Parameters:
track TSE3::Track whose TSE3::Part objects are all to be operated on
start Start of selection window
end End of selection window
inside If true, select TSE3::Part objects between start and end, else select Parts NOT between these times

PartSelection& TSE3::App::PartSelection::operator= const PartSelection  ) 
 

Copy PartSelection contents.

size_t TSE3::App::PartSelection::size  )  const [inline]
 

Returns how many TSE3::Part objects are selected.

Returns:
No of selected TSE3::Part objects

bool TSE3::App::PartSelection::isSelected TSE3::Part part  )  const
 

Returns whether a particular TSE3::Part is selected.

Parameters:
part The TSE3::Part to run selection test on
Returns:
Whether the TSE3::Part is selected

Part* TSE3::App::PartSelection::front  )  const [inline]
 

Returns the first item in the PartSelection, or zero if there are no selected Parts.

Returns:
First selected TSE3::Part

Part* TSE3::App::PartSelection::back  )  const [inline]
 

Returns the last item in the PartSelection, or zero if there are no selected Parts.

Returns:
Last selected TSE3::Part

iterator_t TSE3::App::PartSelection::begin  )  const [inline]
 

Returns an iterator pointing to the first TSE3::Part in this selection.

Returns:
Iterator pointing to first selected TSE3::Part

iterator_t TSE3::App::PartSelection::end  )  const [inline]
 

Returns an iterator pointing to the last TSE3::Part in this selection.

Returns:
Iterator pointing to last selected TSE3::Part

virtual void TSE3::App::PartSelection::Part_StartAltered Part ,
Clock  start
[virtual]
 

Reimplemented from TSE3::PartListener.

virtual void TSE3::App::PartSelection::Part_EndAltered Part ,
Clock  end
[virtual]
 

Reimplemented from TSE3::PartListener.

virtual void TSE3::App::PartSelection::Part_Reparented Part  )  [virtual]
 

Reimplemented from TSE3::PartListener.

virtual void TSE3::App::PartSelection::Notifier_Deleted Part  )  [virtual]
 

virtual void TSE3::App::PartSelection::TrackSelection_Selected TrackSelection ,
TSE3::Track ,
bool 
[virtual]
 


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