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

/home/pete/Work/TSE3.svn/tse3/src/tse3/app/TrackSelection.h

Go to the documentation of this file.
00001 /*
00002  * @(#)app/TrackSelection.h 1.00 17 January 2001
00003  *
00004  * Copyright (c) 2000 Pete Goodliffe (pete@cthree.org)
00005  *
00006  * This file is part of TSE3 - the Trax Sequencer Engine version 3.00.
00007  *
00008  * This library is modifiable/redistributable under the terms of the GNU
00009  * General Public License.
00010  *
00011  * You should have received a copy of the GNU General Public License along
00012  * with this program; see the file COPYING. If not, write to the Free Software
00013  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00014  *
00015  */
00016 
00017 #ifndef TSE3_APP_TRACKSELECTION_H
00018 #define TSE3_APP_TRACKSELECTION_H
00019 
00020 #include "tse3/listen/app/TrackSelection.h"
00021 
00022 #include "tse3/Notifier.h"
00023 #include "tse3/Track.h"
00024 #include "tse3/listen/app/PartSelection.h"
00025 
00026 #include <vector>
00027 #include <cstddef>
00028 
00029 namespace TSE3
00030 {
00031     class Phrase;
00032     class Song;
00033     class Track;
00034 
00035     namespace App
00036     {
00087         class TrackSelection : public TSE3::Listener<TSE3::TrackListener>,
00088                                public TSE3::Listener<PartSelectionListener>,
00089                                public TSE3::Notifier<TrackSelectionListener>
00090         {
00091             public:
00092 
00096                 TrackSelection();
00097                 ~TrackSelection();
00098                 TrackSelection(const TrackSelection &);
00099 
00100                 /**************************************************************
00101                  * Setting the selection
00102                  *************************************************************/
00103 
00115                 void select(TSE3::Track *track, bool add);
00116 
00123                 void deselect(TSE3::Track *track);
00124 
00128                 void clear();
00129 
00138                 void selectAll(TSE3::Song *song);
00139 
00148                 void invert(TSE3::Song *song);
00149 
00153                 TrackSelection &operator=(const TrackSelection &);
00154 
00155                 /**************************************************************
00156                  * Access to the selected Tracks
00157                  *************************************************************/
00158 
00164                 size_t size() const { return tracks.size(); }
00165 
00172                 bool isSelected(TSE3::Track *track) const;
00173 
00174                 typedef std::vector<TSE3::Track*>::const_iterator iterator_t;
00175 
00182                 Track *front() const
00183                 {
00184                     return tracks.size() ? tracks.front() : 0;
00185                 }
00186 
00193                 Track *back() const
00194                 {
00195                     return tracks.size() ? tracks.back() : 0;
00196                 }
00197 
00204                 iterator_t begin() const { return tracks.begin(); }
00205 
00212                 iterator_t end() const { return tracks.end(); }
00213 
00217                 virtual void Track_Reparented(Track *);
00218 
00222                 virtual void Notifier_Deleted(Track *);
00223 
00227                 virtual void PartSelection_Selected
00228                     (PartSelection *, TSE3::Part *, bool);
00229 
00230             private:
00231 
00236                 void addTrack(TSE3::Track *track);
00237 
00242                 void removeTrack(TSE3::Track *part);
00243 
00247                 void recalculateEnds();
00248 
00249                 std::vector<TSE3::Track*>  tracks;
00250                 bool                       tracksValid;
00251                 TSE3::Track               *minTrack;
00252                 TSE3::Track               *maxTrack;
00253         };
00254     }
00255 }
00256 
00257 #endif

Generated on Wed May 25 14:45:05 2005 for TSE3 by doxygen 1.3.2