Move Diskstream ownership to Track, so that Session no longer holds lists of Diskstre...
[ardour.git] / gtk2_ardour / editor.h
index 74f3ab04489b73c1bae4c308d8b4fa15319dfea6..ebd735e335ef439f346eb794c6730fe99cf487b9 100644 (file)
@@ -76,7 +76,6 @@ namespace Gtkmm2ext {
 }
 
 namespace ARDOUR {
-       class AudioDiskstream;
        class RouteGroup;
        class Playlist;
        class AudioPlaylist;
@@ -107,7 +106,7 @@ class AutomationTimeAxisView;
 class BundleManager;
 class ControlPoint;
 class CrossfadeView;
-class Drag;
+class DragManager;
 class GlobalPortMatrixWindow;
 class GroupedButtons;
 class Marker;
@@ -217,17 +216,12 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
        void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
-       void remove_a_region (boost::shared_ptr<ARDOUR::Region>);
+       void show_a_region (boost::shared_ptr<ARDOUR::Region>);
 
 #ifdef USE_RUBBERBAND
        std::vector<std::string> rb_opt_strings;
 #endif
 
-       /* option editor-access */
-
-       void set_show_waveforms_recording (bool yn);
-       bool show_waveforms_recording() const { return _show_waveforms_recording; }
-
        /* things that need to be public to be used in the main menubar */
 
        void new_region_from_selection ();
@@ -357,13 +351,16 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        /* playhead/screen stuff */
 
+        void set_stationary_playhead (bool yn);
+        void toggle_stationary_playhead ();
+        bool stationary_playhead() const { return _stationary_playhead; }
+        
        void set_follow_playhead (bool yn);
        void toggle_follow_playhead ();
        bool follow_playhead() const { return _follow_playhead; }
        bool dragging_playhead () const { return _dragging_playhead; }
 
        void toggle_zero_line_visibility ();
-       void toggle_waveforms_while_recording ();
        void set_summary ();
        void set_group_tabs ();
        void toggle_measure_visibility ();
@@ -401,6 +398,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void restore_editing_space();
 
        void reset_x_origin (nframes64_t);
+       void reset_x_origin_to_follow_playhead ();
        void reset_y_origin (double);
        void reset_zoom (double);
        void reposition_and_zoom (nframes64_t, double);
@@ -418,6 +416,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void goto_visual_state (uint32_t);
        void save_visual_state (uint32_t);
 
+       void queue_draw_resize_line (int at);
+       void start_resize_line_ops ();
+       void end_resize_line_ops ();
+
        TrackViewList const & get_track_views () {
                return track_views;
        }
@@ -435,6 +437,15 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void center_screen (nframes64_t);
 
        TrackViewList axis_views_from_routes (boost::shared_ptr<ARDOUR::RouteList>) const;
+       Gtkmm2ext::TearOff* mouse_mode_tearoff () const { return _mouse_mode_tearoff; }
+       Gtkmm2ext::TearOff* tools_tearoff () const { return _tools_tearoff; }
+
+       void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
+       void snap_to_with_modifier (nframes64_t& first, GdkEvent const *, int32_t direction = 0, bool for_mark = false);
+       void snap_to (nframes64_t& first, nframes64_t& last, int32_t direction = 0, bool for_mark = false);
+
+       void begin_reversible_command (std::string cmd_name);
+       void commit_reversible_command ();
 
   protected:
        void map_transport_state ();
@@ -519,7 +530,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void location_changed (ARDOUR::Location *);
        void location_flags_changed (ARDOUR::Location *, void *);
        void refresh_location_display ();
-       void refresh_location_display_s (ARDOUR::Change);
+       void refresh_location_display_s (const PBD::PropertyChange&);
        void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
        void add_new_location (ARDOUR::Location *);
        void location_gone (ARDOUR::Location *);
@@ -577,9 +588,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        void sort_track_selection (TrackViewList* sel = 0);
 
-       void get_equivalent_regions (RegionView* rv, std::vector<RegionView*> &, ARDOUR::RouteGroup::Property) const;
-       RegionSelection get_equivalent_regions (RegionSelection &, ARDOUR::RouteGroup::Property) const;
-       void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*, ARDOUR::RouteGroup::Property) const;
+       void get_equivalent_regions (RegionView* rv, std::vector<RegionView*> &, PBD::PropertyID) const;
+       RegionSelection get_equivalent_regions (RegionSelection &, PBD::PropertyID) const;
+       void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*, PBD::PropertyID) const;
 
        /* functions to be passed to mapover_tracks(), possibly with sigc::bind()-supplied arguments */
 
@@ -607,7 +618,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void collect_new_region_view (RegionView *);
        void collect_and_select_new_region_view (RegionView *);
 
-       void select_range_around_region (RegionView *);
+       long select_range_around_region (RegionView *);
 
        Gtk::Menu track_context_menu;
        Gtk::Menu track_region_context_menu;
@@ -959,7 +970,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void queue_visual_change_y (double);
        void ensure_visual_change_idle_handler ();
 
-       void end_location_changed (ARDOUR::Location*);
+       void session_range_location_changed (ARDOUR::Location*);
 
        /* track views */
        TrackViewList track_views;
@@ -987,11 +998,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        static void build_cursors ();
 
-       sigc::connection scroll_connection;
+       sigc::connection super_rapid_screen_update_connection;
        nframes64_t last_update_frame;
        void center_screen_internal (nframes64_t, float);
 
-       void update_current_screen ();
+       void super_rapid_screen_update ();
 
        void session_going_away ();
 
@@ -1080,6 +1091,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        void audition_region_from_region_list ();
        void hide_region_from_region_list ();
+       void show_region_in_region_list ();
 
        void align (ARDOUR::RegionPoint);
        void align_relative (ARDOUR::RegionPoint);
@@ -1143,7 +1155,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void  drop_paths_part_two  (const std::vector<Glib::ustring>& paths, nframes64_t frame, double ypos);
 
        int  import_sndfiles (std::vector<Glib::ustring> paths, Editing::ImportMode mode,  ARDOUR::SrcQuality, nframes64_t& pos,
-                             int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>, bool, uint32_t total);
+                             int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&, bool);
        int  embed_sndfiles (std::vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
                             nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&);
 
@@ -1155,17 +1167,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        boost::shared_ptr<ARDOUR::AudioTrack> get_nth_selected_audio_track (int nth) const;
        boost::shared_ptr<ARDOUR::MidiTrack> get_nth_selected_midi_track (int nth) const;
 
-       /* generic interthread progress window */
-
-       ArdourDialog* interthread_progress_window;
-       Gtk::Label interthread_progress_label;
-       Gtk::VBox interthread_progress_vbox;
-       Gtk::ProgressBar interthread_progress_bar;
-       Gtk::Button interthread_cancel_button;
-       Gtk::Label interthread_cancel_label;
-       sigc::connection  interthread_progress_connection;
-       void interthread_cancel_clicked ();
-       void build_interthread_progress_window ();
        ARDOUR::InterThreadInfo* current_interthread_info;
 
        AnalysisWindow* analysis_window;
@@ -1182,7 +1183,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        };
 
        EditorImportStatus import_status;
-       gint import_progress_timeout (void *);
        static void *_import_thread (void *);
        void* import_thread ();
        void finish_import ();
@@ -1253,14 +1253,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void reverse_selection ();
        void edit_envelope ();
 
-       void start_scrolling ();
-       void stop_scrolling ();
-
        double last_scrub_x;
        int scrubbing_direction;
        int scrub_reversals;
        int scrub_reverse_distance;
-       void scrub ();
+       void scrub (nframes64_t, double);
 
        void keyboard_selection_begin ();
        void keyboard_selection_finish (bool add);
@@ -1279,9 +1276,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        bool ignore_gui_changes;
 
-       Drag* _drag;
+       DragManager* _drags;
 
-       void break_drag ();
        void escape ();
 
        Gtk::Menu fade_context_menu;
@@ -1305,10 +1301,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
 
-       void start_region_grab (ArdourCanvas::Item*, GdkEvent*, RegionView*);
+       void add_region_drag (ArdourCanvas::Item*, GdkEvent*, RegionView*);
        void start_create_region_grab (ArdourCanvas::Item*, GdkEvent*);
-       void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*, RegionView*);
-       void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*, RegionView*);
+       void add_region_copy_drag (ArdourCanvas::Item*, GdkEvent*, RegionView*);
+       void add_region_brush_drag (ArdourCanvas::Item*, GdkEvent*, RegionView*);
        void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
 
        void region_view_item_click (AudioRegionView&, GdkEventButton*);
@@ -1342,8 +1338,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 private:
        ArdourCanvas::Item *last_item_entered;
        int last_item_entered_n;
-public:
 
+public:
        bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
        bool canvas_frame_handle_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
        bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
@@ -1372,6 +1368,11 @@ public:
        bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
        bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
 
+  private:
+        friend class DragManager;
+        friend class EditorRouteGroups;
+        friend class EditorRegions;
+
        /* non-public event handlers */
 
        bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
@@ -1404,8 +1405,8 @@ public:
        bool _show_measures;
        /// true if the editor should follow the playhead, otherwise false
        bool _follow_playhead;
-       /// true if waveforms should be shown while recording audio tracks, otherwise false
-       bool _show_waveforms_recording;
+        /// true if we scroll the tracks rather than the playhead
+        bool _stationary_playhead;
 
        ARDOUR::TempoMap::BBTPointList *current_bbt_points;
 
@@ -1458,13 +1459,13 @@ public:
        void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
        void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
        void build_range_marker_menu (bool loop_or_punch);
-       void build_marker_menu (bool start_or_end);
+       void build_marker_menu (bool);
        void build_tm_marker_menu ();
        void build_new_transport_marker_menu ();
 
        Gtk::Menu* tm_marker_menu;
        Gtk::Menu* marker_menu;
-       Gtk::Menu* start_end_marker_menu;
+       Gtk::Menu* session_range_marker_menu;
        Gtk::Menu* range_marker_menu;
        Gtk::Menu* transport_marker_menu;
        Gtk::Menu* new_transport_marker_menu;
@@ -1478,13 +1479,9 @@ public:
        void draw_metric_marks (const ARDOUR::Metrics& metrics);
 
        void compute_current_bbt_points (nframes_t left, nframes_t right);
-       void tempo_map_changed (ARDOUR::Change);
+       void tempo_map_changed (const PBD::PropertyChange&);
        void redisplay_tempo (bool immediate_redraw);
 
-       void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
-       void snap_to_with_modifier (nframes64_t& first, GdkEvent const *, int32_t direction = 0, bool for_mark = false);
-       void snap_to (nframes64_t& first, nframes64_t& last, int32_t direction = 0, bool for_mark = false);
-
        uint32_t bbt_beat_subdivision;
 
        /* toolbar */
@@ -1508,7 +1505,7 @@ public:
        Gtk::Table               toolbar_selection_clock_table;
        Gtk::Label               toolbar_selection_cursor_label;
 
-       Gtkmm2ext::TearOff*      mouse_mode_tearoff;
+       Gtkmm2ext::TearOff*      _mouse_mode_tearoff;
        Gtk::ToggleButton         mouse_select_button;
        Gtk::ToggleButton         mouse_move_button;
        Gtk::ToggleButton         mouse_gain_button;
@@ -1569,7 +1566,9 @@ public:
 
        void setup_toolbar ();
 
-       Gtkmm2ext::TearOff*      tools_tearoff;
+       void setup_tooltips ();
+
+       Gtkmm2ext::TearOff*     _tools_tearoff;
        Gtk::HBox                toolbar_hbox;
        Gtk::EventBox            toolbar_base;
        Gtk::Frame               toolbar_frame;
@@ -1676,7 +1675,7 @@ public:
        bool allow_vertical_scroll;
 
        /* trimming */
-       void point_trim (GdkEvent*);
+       void point_trim (GdkEvent *, nframes64_t);
        void single_contents_trim (RegionView&, nframes64_t, bool, bool, bool);
        void single_start_trim (RegionView&, nframes64_t, bool, bool, bool);
        void single_end_trim (RegionView&, nframes64_t, bool, bool, bool);
@@ -1757,9 +1756,6 @@ public:
 
        XMLNode *before; /* used in *_reversible_command */
 
-       void begin_reversible_command (std::string cmd_name);
-       void commit_reversible_command ();
-
        void update_title ();
        void update_title_s (const std::string & snapshot_name);
 
@@ -1778,7 +1774,6 @@ public:
        /* freeze operations */
 
        ARDOUR::InterThreadInfo freeze_status;
-       gint freeze_progress_timeout (void *);
        static void* _freeze_thread (void*);
        void* freeze_thread ();
 
@@ -1967,10 +1962,8 @@ public:
 
        void get_regions_for_action (RegionSelection&, bool allow_entered = false, bool allow_edit_position = true);
 
-       sigc::connection fast_screen_update_connection;
-       gint start_updating ();
-       gint stop_updating ();
-       void fast_update_strips ();
+       void start_updating_meters ();
+       void stop_updating_meters ();
        bool meters_running;
 
        void select_next_route ();
@@ -1992,15 +1985,23 @@ public:
 
        bool _have_idled;
        int resize_idle_id;
+       static gboolean _idle_resize (gpointer);
        bool idle_resize();
-       friend gboolean _idle_resize (gpointer);
        int32_t _pending_resize_amount;
        TimeAxisView* _pending_resize_view;
 
        void visible_order_range (int*, int*) const;
 
        void located ();
+       
+       /** true if we've made a locate request that hasn't yet been processed */
        bool _pending_locate_request;
+       
+       /** if true, there is a pending Session locate which is the initial one when loading a session;
+           we need to know this so that we don't (necessarily) set the viewport to show the playhead
+           initially.
+       */
+       bool _pending_initial_locate;
 
        Gtk::HBox _summary_hbox;
        EditorSummary* _summary;