use CoreSelection for track selection
[ardour.git] / gtk2_ardour / public_editor.h
index 5cfedb11f14e7c47d4dfe02aadcfd753e956cd4f..f0ed177500a125075e10ffbdc4cb22ce02ccd388 100644 (file)
@@ -40,6 +40,8 @@
 
 #include "pbd/statefuldestructible.h"
 
+#include "ardour/session_handle.h"
+
 #include "canvas/fwd.h"
 
 #include "gtkmm2ext/actions.h"
@@ -47,6 +49,7 @@
 #include "gtkmm2ext/tabbable.h"
 #include "gtkmm2ext/visibility_tracker.h"
 
+#include "axis_provider.h"
 #include "editing.h"
 #include "selection.h"
 
@@ -55,9 +58,9 @@ namespace ARDOUR {
        class Region;
        class Playlist;
        class RouteGroup;
-        class Trimmable;
-        class Movable;
-        class Stripable;
+       class Trimmable;
+       class Movable;
+       class Stripable;
 }
 
 namespace Gtk {
@@ -105,7 +108,7 @@ using ARDOUR::framecnt_t;
  * of PublicEditor need not be recompiled if private methods or member variables
  * change.
  */
-class PublicEditor : public Gtkmm2ext::Tabbable {
+class PublicEditor : public Gtkmm2ext::Tabbable,  public ARDOUR::SessionHandlePtr, public AxisViewProvider {
   public:
        PublicEditor (Gtk::Widget& content);
        virtual ~PublicEditor ();
@@ -123,9 +126,6 @@ class PublicEditor : public Gtkmm2ext::Tabbable {
         */
        virtual void set_session (ARDOUR::Session* s) = 0;
 
-       /** @return The Session that we are editing, or 0 */
-       virtual ARDOUR::Session* session () const = 0;
-
        /** Set the snap type.
         * @param t Snap type (defined in editing_syms.h)
         */
@@ -204,9 +204,13 @@ class PublicEditor : public Gtkmm2ext::Tabbable {
        virtual framepos_t playhead_cursor_sample () const = 0;
        virtual double sample_to_pixel (framepos_t frame) const = 0;
        virtual double sample_to_pixel_unrounded (framepos_t frame) const = 0;
+
        virtual Selection& get_selection () const = 0;
        virtual bool get_selection_extents (framepos_t &start, framepos_t &end) const = 0;
        virtual Selection& get_cut_buffer () const = 0;
+
+       virtual void set_selection (std::list<Selectable*>, Selection::Operation) = 0;
+
        virtual bool extend_selection_to_track (TimeAxisView&) = 0;
        virtual void play_selection () = 0;
        virtual void play_with_preroll () = 0;
@@ -282,6 +286,7 @@ class PublicEditor : public Gtkmm2ext::Tabbable {
        virtual void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove = false) = 0;
        virtual void set_selected_mixer_strip (TimeAxisView&) = 0;
        virtual void hide_track_in_display (TimeAxisView* tv, bool apply_to_selection = false) = 0;
+       virtual void show_track_in_display (TimeAxisView* tv, bool move_into_view = false) = 0;
 
        virtual void set_stationary_playhead (bool yn) = 0;
        virtual void toggle_stationary_playhead () = 0;
@@ -305,12 +310,13 @@ class PublicEditor : public Gtkmm2ext::Tabbable {
        virtual framecnt_t current_page_samples() const = 0;
        virtual double visible_canvas_height () const = 0;
        virtual void temporal_zoom_step (bool coarser) = 0;
-        virtual void ensure_time_axis_view_is_visible (TimeAxisView const & tav, bool at_top = false) = 0;
-        virtual void override_visible_track_count () = 0;
+       virtual void ensure_time_axis_view_is_visible (TimeAxisView const & tav, bool at_top = false) = 0;
+       virtual void override_visible_track_count () = 0;
        virtual void scroll_tracks_down_line () = 0;
        virtual void scroll_tracks_up_line () = 0;
-        virtual bool scroll_down_one_track (bool skip_child_views = false) = 0;
-        virtual bool scroll_up_one_track (bool skip_child_views = false) = 0;
+       virtual bool scroll_down_one_track (bool skip_child_views = false) = 0;
+       virtual bool scroll_up_one_track (bool skip_child_views = false) = 0;
+       virtual void select_topmost_track () = 0;
        virtual void prepare_for_cleanup () = 0;
        virtual void finish_cleanup () = 0;
        virtual void reset_x_origin (framepos_t frame) = 0;
@@ -347,13 +353,17 @@ class PublicEditor : public Gtkmm2ext::Tabbable {
 
        virtual RouteTimeAxisView* get_route_view_by_route_id (const PBD::ID& id) const = 0;
 
+       virtual TimeAxisView* time_axis_view_from_stripable (boost::shared_ptr<ARDOUR::Stripable> s) const = 0;
+
        virtual void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&, PBD::PropertyID) const = 0;
+       virtual RegionView* regionview_from_region (boost::shared_ptr<ARDOUR::Region>) const = 0;
+       virtual RouteTimeAxisView* rtav_from_route (boost::shared_ptr<ARDOUR::Route>) const = 0;
 
        sigc::signal<void> ZoomChanged;
        sigc::signal<void> Realized;
        sigc::signal<void,framepos_t> UpdateAllTransportClocks;
 
-        static sigc::signal<void> DropDownKeys;
+       static sigc::signal<void> DropDownKeys;
 
        struct RegionAction {
                Glib::RefPtr<Gtk::Action> action;
@@ -412,22 +422,20 @@ class PublicEditor : public Gtkmm2ext::Tabbable {
        virtual ArdourCanvas::ScrollGroup* get_hvscroll_group () const = 0;
        virtual ArdourCanvas::ScrollGroup* get_cursor_scroll_group () const = 0;
 
-        virtual ArdourCanvas::GtkCanvasViewport* get_track_canvas() const = 0;
-
-       virtual TimeAxisView* axis_view_from_stripable (boost::shared_ptr<ARDOUR::Stripable>) const = 0;
+       virtual ArdourCanvas::GtkCanvasViewport* get_track_canvas() const = 0;
 
-        virtual void set_current_trimmable (boost::shared_ptr<ARDOUR::Trimmable>) = 0;
-        virtual void set_current_movable (boost::shared_ptr<ARDOUR::Movable>) = 0;
+       virtual void set_current_trimmable (boost::shared_ptr<ARDOUR::Trimmable>) = 0;
+       virtual void set_current_movable (boost::shared_ptr<ARDOUR::Movable>) = 0;
 
        virtual void center_screen (framepos_t) = 0;
 
        virtual TrackViewList axis_views_from_routes (boost::shared_ptr<ARDOUR::RouteList>) const = 0;
-       virtual TrackViewList const & get_track_views () = 0;
+       virtual TrackViewList const & get_track_views () const = 0;
 
        virtual DragManager* drags () const = 0;
-        virtual void maybe_autoscroll (bool, bool, bool from_headers) = 0;
+       virtual void maybe_autoscroll (bool, bool, bool from_headers) = 0;
        virtual void stop_canvas_autoscroll () = 0;
-        virtual bool autoscroll_active() const = 0;
+       virtual bool autoscroll_active() const = 0;
 
        virtual void begin_reversible_selection_op (std::string cmd_name) = 0;
        virtual void commit_reversible_selection_op () = 0;
@@ -476,7 +484,7 @@ class PublicEditor : public Gtkmm2ext::Tabbable {
 
        Gtkmm2ext::Bindings* bindings;
 
-  protected:
+protected:
        friend class DisplaySuspender;
        virtual void suspend_route_redisplay () = 0;
        virtual void resume_route_redisplay () = 0;