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