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/PartSelection.h

Go to the documentation of this file.
00001 /*
00002  * @(#)app/PartSelection.h 1.00 18 June 2000
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_PARTSELECTION_H
00018 #define TSE3_APP_PARTSELECTION_H
00019 
00020 #include "tse3/listen/app/PartSelection.h"
00021 
00022 #include "tse3/Notifier.h"
00023 #include "tse3/Part.h"
00024 #include "tse3/Midi.h"
00025 #include "tse3/listen/app/TrackSelection.h"
00026 
00027 #include <vector>
00028 #include <cstddef>
00029 
00030 namespace TSE3
00031 {
00032     class Phrase;
00033     class Song;
00034     class Track;
00035 
00036     namespace App
00037     {
00088         class PartSelection : public TSE3::Listener<TSE3::PartListener>,
00089                               public TSE3::Listener<TrackSelectionListener>,
00090                               public TSE3::Notifier<PartSelectionListener>
00091         {
00092             public:
00093 
00097                 PartSelection();
00098                 ~PartSelection();
00099                 PartSelection(const PartSelection &);
00100 
00101                 /**************************************************************
00102                  * Setting the selection
00103                  *************************************************************/
00104 
00113                 TSE3::Clock earliest() const { return _earliest; }
00114 
00123                 TSE3::Clock latest() const { return _latest; }
00124 
00133                 size_t minTrack() const { return _minTrack; }
00134 
00143                 size_t maxTrack() const { return _maxTrack; }
00144 
00156                 void select(TSE3::Part *part, bool add);
00157 
00164                 void deselect(TSE3::Part *part);
00165 
00169                 void clear();
00170 
00179                 void selectAll(TSE3::Song *song);
00180 
00188                 void selectAll(TSE3::Track *track);
00189 
00198                 void invert(TSE3::Song *song);
00199 
00213                 void selectBetween(TSE3::Song *song,
00214                                    TSE3::Clock start, TSE3::Clock end,
00215                                    bool inside = true);
00216 
00230                 void selectBetween(TSE3::Track *track,
00231                                    TSE3::Clock start, TSE3::Clock end,
00232                                    bool inside = true);
00233 
00237                 PartSelection &operator=(const PartSelection &);
00238 
00239                 /**************************************************************
00240                  * Access to the selected Parts
00241                  *************************************************************/
00242 
00248                 size_t size() const { return parts.size(); }
00249 
00256                 bool isSelected(TSE3::Part *part) const;
00257 
00258                 typedef std::vector<TSE3::Part*>::const_iterator iterator_t;
00259 
00266                 Part *front() const
00267                 {
00268                     return parts.size() ? parts.front() : 0;
00269                 }
00270 
00277                 Part *back() const
00278                 {
00279                     return parts.size() ? parts.back() : 0;
00280                 }
00281 
00288                 iterator_t begin() const { return parts.begin(); }
00289 
00296                 iterator_t end() const { return parts.end(); }
00297 
00301                 virtual void Part_StartAltered(Part *, Clock start);
00302 
00306                 virtual void Part_EndAltered(Part *, Clock end);
00307 
00311                 virtual void Part_Reparented(Part *);
00312 
00316                 virtual void Notifier_Deleted(Part *);
00317 
00321                 virtual void TrackSelection_Selected
00322                     (TrackSelection *, TSE3::Track *, bool);
00323 
00324             private:
00325 
00331                 void addPart(TSE3::Part *part);
00332 
00338                 void removePart(TSE3::Part *part);
00339 
00343                 void recalculateEnds();
00344 
00345                 std::vector<TSE3::Part*> parts;
00346                 bool        timesValid;
00347                 TSE3::Clock _earliest;
00348                 TSE3::Clock _latest;
00349                 bool        tracksValid;
00350                 size_t      _minTrack;
00351                 size_t      _maxTrack;
00352         };
00353     }
00354 }
00355 
00356 #endif

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