Make foldback bus match foldback sends namewise
[ardour.git] / gtk2_ardour / region_selection.h
1 /*
2     Copyright (C) 2006 Paul Davis
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19 #ifndef __ardour_gtk_region_selection_h__
20 #define __ardour_gtk_region_selection_h__
21
22 #include <set>
23 #include <list>
24
25 #include "pbd/signals.h"
26 #include "ardour/types.h"
27
28 namespace ARDOUR {
29         class Playlist;
30 }
31
32 class RegionView;
33 class TimeAxisView;
34
35 /** Class to represent list of selected regions.
36  */
37 class RegionSelection : public std::list<RegionView*>
38 {
39 public:
40         RegionSelection();
41         RegionSelection (const RegionSelection&);
42
43         RegionSelection& operator= (const RegionSelection&);
44
45         bool add (RegionView*);
46         bool remove (RegionView*);
47         void sort_by_position_and_track ();
48
49         bool contains (RegionView*) const;
50         bool contains (boost::shared_ptr<ARDOUR::Region>) const;
51         bool involves (const TimeAxisView&) const;
52
53         void clear_all();
54
55         samplepos_t start () const;
56
57         /* "end" collides with list<>::end */
58
59         samplepos_t end_sample () const;
60
61         const std::list<RegionView *>& by_layer() const { return _bylayer; }
62         void  by_position (std::list<RegionView*>&) const;
63         void  by_track (std::list<RegionView*>&) const;
64
65         size_t n_midi_regions() const;
66
67         std::set<boost::shared_ptr<ARDOUR::Playlist> > playlists () const;
68         std::list<PBD::ID> pending;
69
70         ARDOUR::RegionList regionlist () const;
71
72 private:
73         void remove_it (RegionView*);
74
75         void add_to_layer (RegionView *);
76
77         std::list<RegionView *> _bylayer; ///< list of regions sorted by layer
78         PBD::ScopedConnection death_connection;
79 };
80
81 #endif /* __ardour_gtk_region_selection_h__ */