region list patch #2 from chris g, slightly reworked by me; sv_se po changes, possibl...
[ardour.git] / gtk2_ardour / region_selection.h
index 2192442cb0cbdf5ac0eb53435f1af27c5fdd3716..084345a76d4b16009b85bee2d6c9b6e6ee5232f8 100644 (file)
@@ -29,11 +29,11 @@ using std::set;
 
 class RegionView;
 
-struct RegionComparator {
-    bool operator() (const RegionView* a, const RegionView* b) const;
-};
+/**
+ *  Class to represent list of selected regions.
+ */
 
-class RegionSelection : public set<RegionView*, RegionComparator>, public sigc::trackable
+class RegionSelection : public std::list<RegionView*>, public sigc::trackable
 {
   public:
        RegionSelection();
@@ -41,34 +41,38 @@ class RegionSelection : public set<RegionView*, RegionComparator>, public sigc::
 
        RegionSelection& operator= (const RegionSelection&);
 
-       void add (RegionView*, bool dosort = true);
+       bool add (RegionView*);
        bool remove (RegionView*);
-       bool contains (RegionView*);
+       void sort_by_position_and_track ();
+
+       bool contains (RegionView*) const;
+       bool involves (const TimeAxisView&) const;
 
        void clear_all();
        
-       jack_nframes_t start () const {
+       nframes_t start () const {
                return _current_start;
        }
 
-       /* collides with list<>::end */
+       /* "end" collides with list<>::end */
 
-       jack_nframes_t end_frame () const { 
+       nframes_t end_frame () const { 
                return _current_end;
        }
 
-       const list<RegionView *> & by_layer() const { return _bylayer; }
-       void  by_position (list<RegionView*>&) const;
+       const std::list<RegionView *>& by_layer() const { return _bylayer; }
+       void  by_position (std::list<RegionView*>&) const;
+       void  by_track (std::list<RegionView*>&) const;
        
   private:
        void remove_it (RegionView*);
 
        void add_to_layer (RegionView *);
        
-       jack_nframes_t _current_start;
-       jack_nframes_t _current_end;
+       nframes_t _current_start; ///< start position for the selection
+       nframes_t _current_end; ///< end position for the selection
 
-       list<RegionView *> _bylayer;
+       list<RegionView *> _bylayer; ///< list of regions sorted by layer
 };
 
 #endif /* __ardour_gtk_region_selection_h__ */