Move Diskstream ownership to Track, so that Session no longer holds lists of Diskstre...
[ardour.git] / gtk2_ardour / streamview.h
index 24a81f4847c0ee31426b9503684e840abaa4de48..14b30a42fcb99f9875c7f96e521d60c5f3fdba2d 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2001, 2006 Paul Davis 
+    Copyright (C) 2001, 2006 Paul Davis
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -22,6 +22,8 @@
 #include <list>
 #include <cmath>
 
+#include "pbd/signals.h"
+
 #include "ardour/location.h"
 #include "enums.h"
 #include "simplerect.h"
@@ -33,11 +35,11 @@ namespace Gdk {
 
 namespace ARDOUR {
        class Route;
-       class Diskstream;
        class Crossfade;
        class PeakData;
        class Region;
        class Source;
+       class Track;
 }
 
 struct RecBoxInfo {
@@ -46,7 +48,6 @@ struct RecBoxInfo {
        nframes_t                 length;
 };
 
-class PublicEditor;
 class Selectable;
 class RouteTimeAxisView;
 class RegionView;
@@ -54,7 +55,7 @@ class RegionSelection;
 class CrossfadeView;
 class Selection;
 
-class StreamView : public sigc::trackable
+class StreamView : public sigc::trackable, public PBD::ScopedConnectionList
 {
 public:
        virtual ~StreamView ();
@@ -86,48 +87,56 @@ public:
        Gdk::Color get_region_color () const { return region_color; }
        void       apply_color (Gdk::Color&, ColorTarget t);
 
+       uint32_t     num_selected_regionviews () const;
+
        RegionView*  find_view (boost::shared_ptr<const ARDOUR::Region>);
        void         foreach_regionview (sigc::slot<void,RegionView*> slot);
+       void         foreach_selected_regionview (sigc::slot<void,RegionView*> slot);
 
        void set_selected_regionviews (RegionSelection&);
-       void get_selectables (nframes_t start, nframes_t end, list<Selectable* >&);
-       void get_inverted_selectables (Selection&, list<Selectable* >& results);
+       void get_selectables (nframes_t, nframes_t, double, double, std::list<Selectable* >&);
+       void get_inverted_selectables (Selection&, std::list<Selectable* >& results);
+
+       virtual void update_contents_metrics(boost::shared_ptr<ARDOUR::Region>) {}
+
+       void add_region_view (boost::weak_ptr<ARDOUR::Region>);
 
-       virtual void update_contents_metrics(boost::shared_ptr<ARDOUR::Region> r) {}
-       void add_region_view (boost::shared_ptr<ARDOUR::Region>);
        void region_layered (RegionView*);
        virtual void update_contents_height ();
-       
-       virtual void redisplay_diskstream () = 0;
+
+       virtual void redisplay_track () = 0;
        double child_height () const;
        ARDOUR::layer_t layers () const { return _layers; }
-       
+
+       virtual RegionView* create_region_view (boost::shared_ptr<ARDOUR::Region>, bool, bool) {
+               return 0;
+       }
+
        sigc::signal<void,RegionView*> RegionViewAdded;
+       sigc::signal<void> HeightChanged;
 
 protected:
        StreamView (RouteTimeAxisView&, ArdourCanvas::Group* group = NULL);
-       
+
        void         transport_changed();
        void         transport_looped();
        void         rec_enable_changed();
        void         sess_rec_enable_changed();
        virtual void setup_rec_box () = 0;
        void         update_rec_box ();
-       
+
        virtual RegionView* add_region_view_internal (boost::shared_ptr<ARDOUR::Region>,
-                       bool wait_for_waves, bool recording = false) = 0;
+                     bool wait_for_waves, bool recording = false) = 0;
        virtual void remove_region_view (boost::weak_ptr<ARDOUR::Region> );
 
-       void         display_diskstream (boost::shared_ptr<ARDOUR::Diskstream>);
-       virtual void undisplay_diskstream ();
+       void         display_track (boost::shared_ptr<ARDOUR::Track>);
+       virtual void undisplay_track ();
        void         diskstream_changed ();
        void         layer_regions ();
-       
-       virtual void playlist_changed_weak (boost::weak_ptr<ARDOUR::Diskstream>);
-       virtual void playlist_changed (boost::shared_ptr<ARDOUR::Diskstream>);
-       virtual void playlist_modified_weak (boost::weak_ptr<ARDOUR::Diskstream>);
-       virtual void playlist_modified (boost::shared_ptr<ARDOUR::Diskstream>);
-       
+
+       virtual void playlist_switched (boost::weak_ptr<ARDOUR::Track>);
+       virtual void playlist_layered (boost::weak_ptr<ARDOUR::Track>);
+
        virtual void color_handler () = 0;
 
        RouteTimeAxisView&        _trackview;
@@ -136,31 +145,30 @@ protected:
        ArdourCanvas::Group*      canvas_group;
        ArdourCanvas::SimpleRect* canvas_rect; /* frame around the whole thing */
 
-       typedef list<RegionView* > RegionViewList;
+       typedef std::list<RegionView* > RegionViewList;
        RegionViewList  region_views;
 
        double _samples_per_unit;
 
        sigc::connection       screen_update_connection;
-       vector<RecBoxInfo>     rec_rects;
-       list< std::pair<boost::shared_ptr<ARDOUR::Region>,RegionView* > > rec_regions;
+       std::vector<RecBoxInfo>     rec_rects;
+       std::list< std::pair<boost::shared_ptr<ARDOUR::Region>,RegionView* > > rec_regions;
        bool                   rec_updating;
        bool                   rec_active;
-       bool                   use_rec_regions;
-       
+
        Gdk::Color region_color;      ///< Contained region color
        uint32_t   stream_base_color; ///< Background color
 
-       vector<sigc::connection> playlist_connections;
-       sigc::connection         playlist_change_connection;
+       PBD::ScopedConnectionList playlist_connections;
+       PBD::ScopedConnection playlist_switched_connection;
 
        ARDOUR::layer_t _layers;
        LayerDisplay    _layer_display;
-       
+
        double height;
 
-       list<sigc::connection> rec_data_ready_connections;
-       jack_nframes_t         last_rec_data_frame;
+       PBD::ScopedConnectionList rec_data_ready_connections;
+       nframes_t                 last_rec_data_frame;
 
 private:
        void update_coverage_frames ();