Changes to Editor::visual_changer to support Item/Canvas::prepare_for_render
[ardour.git] / gtk2_ardour / editor.h
index fa5ed9057a2cc67309683414c19b5b5d581dc430..633329541e883bd32276957f276b363c60805516 100644 (file)
@@ -140,14 +140,13 @@ class TimeSelection;
 class RegionLayeringOrderEditor;
 class VerboseCursor;
 
-class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr
+class Editor : public PublicEditor, public PBD::ScopedConnectionList
 {
- public:
+public:
        Editor ();
        ~Editor ();
 
        void             set_session (ARDOUR::Session *);
-       ARDOUR::Session* session() const { return _session; }
 
        Gtk::Window* use_own_window (bool and_fill_it);
 
@@ -243,8 +242,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
                return pixel * samples_per_pixel;
        }
 
-        double sample_to_pixel (framepos_t sample) const {
-               return round (sample / (double) samples_per_pixel);
+       double sample_to_pixel (framepos_t sample) const {
+               return round (sample / (double) samples_per_pixel);
        }
 
        double sample_to_pixel_unrounded (framepos_t sample) const {
@@ -257,12 +256,15 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        bool get_selection_extents (framepos_t &start, framepos_t &end) const;  // the time extents of the current selection, whether Range, Region(s), Control Points, or Notes
        Selection& get_cut_buffer() const { return *cut_buffer; }
 
+       void set_selection (std::list<Selectable*>, Selection::Operation);
+
        bool extend_selection_to_track (TimeAxisView&);
 
        void play_selection ();
        void maybe_locate_with_edit_preroll (framepos_t);
        void play_with_preroll ();
        void rec_with_preroll ();
+       void rec_with_count_in ();
        void select_all_in_track (Selection::Operation op);
        void select_all_objects (Selection::Operation op);
        void invert_selection_in_track ();
@@ -328,6 +330,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void set_selected_mixer_strip (TimeAxisView&);
        void mixer_strip_width_changed ();
        void hide_track_in_display (TimeAxisView* tv, bool apply_to_selection = false);
+       void show_track_in_display (TimeAxisView* tv, bool move_into_view = false);
+       void tempo_curve_selected (ARDOUR::TempoSection* ts, bool yn);
 
        /* nudge is initiated by transport controls owned by ARDOUR_UI */
 
@@ -389,6 +393,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void scroll_left_half_page ();
        void scroll_right_half_page ();
 
+       void select_topmost_track ();
+
        void prepare_for_cleanup ();
        void finish_cleanup ();
 
@@ -420,7 +426,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void start_resize_line_ops ();
        void end_resize_line_ops ();
 
-       TrackViewList const & get_track_views () {
+       TrackViewList const & get_track_views () const {
                return track_views;
        }
 
@@ -551,16 +557,17 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void edit_tempo_section (ARDOUR::TempoSection*);
        void edit_meter_section (ARDOUR::MeterSection*);
 
-  protected:
+protected:
        void map_transport_state ();
        void map_position_change (framepos_t);
+       void transport_looped ();
 
        void on_realize();
 
        void suspend_route_redisplay ();
        void resume_route_redisplay ();
 
-  private:
+private:
 
        void color_handler ();
 
@@ -603,6 +610,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        Editing::ZoomFocus zoom_focus;
 
        void set_samples_per_pixel (framecnt_t);
+       void on_samples_per_pixel_changed ();
 
        Editing::MouseMode mouse_mode;
        Editing::SnapType  pre_internal_snap_type;
@@ -731,6 +739,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        void get_equivalent_regions (RegionView* rv, std::vector<RegionView*> &, PBD::PropertyID) const;
        RegionSelection get_equivalent_regions (RegionSelection &, PBD::PropertyID) const;
+       RegionView* regionview_from_region (boost::shared_ptr<ARDOUR::Region>) const;
+       RouteTimeAxisView* rtav_from_route (boost::shared_ptr<ARDOUR::Route>) const;
+
        void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*, PBD::PropertyID) const;
        void mapover_tracks_with_unique_playlists (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*, PBD::PropertyID) const;
 
@@ -1138,6 +1149,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        };
 
        VisualChange pending_visual_change;
+       bool visual_change_queued;
+
+       void pre_render ();
 
        static int _idle_visual_changer (void *arg);
        int idle_visual_changer ();
@@ -1147,16 +1161,24 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        /* track views */
        TrackViewList track_views;
        std::pair<TimeAxisView*, double> trackview_by_y_position (double, bool trackview_relative_offset = true) const;
-       TimeAxisView* axis_view_from_stripable (boost::shared_ptr<ARDOUR::Stripable>) const;
+
+       AxisView* axis_view_by_stripable (boost::shared_ptr<ARDOUR::Stripable>) const;
+       AxisView* axis_view_by_control (boost::shared_ptr<ARDOUR::AutomationControl>) const;
+
+       TimeAxisView* time_axis_view_from_stripable (boost::shared_ptr<ARDOUR::Stripable> s) const {
+               return dynamic_cast<TimeAxisView*> (axis_view_by_stripable (s));
+       }
 
        TrackViewList get_tracks_for_range_action () const;
 
        sigc::connection super_rapid_screen_update_connection;
-       framepos_t last_update_frame;
        void center_screen_internal (framepos_t, float);
 
        void super_rapid_screen_update ();
 
+       int64_t _last_update_time;
+       double _err_screen_engine;
+
        void session_going_away ();
 
        framepos_t cut_buffer_start;
@@ -1259,6 +1281,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void normalize_region ();
        void reset_region_scale_amplitude ();
        void adjust_region_gain (bool up);
+       void reset_region_gain ();
        void quantize_region ();
        void quantize_regions (const RegionSelection& rs);
        void legatize_region (bool shrink_only);
@@ -1605,10 +1628,14 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void queue_visual_videotimeline_update ();
        void embed_audio_from_video (std::string, framepos_t n = 0, bool lock_position_to_video = true);
 
+       bool track_selection_change_without_scroll () const {
+               return _track_selection_change_without_scroll;
+       }
+
        PBD::Signal0<void> EditorFreeze;
        PBD::Signal0<void> EditorThaw;
 
-  private:
+private:
        friend class DragManager;
        friend class EditorRouteGroups;
        friend class EditorRegions;
@@ -1635,8 +1662,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        void initialize_canvas ();
 
-       void set_script_action_name (int i, const std::string&);
-
        /* display control */
 
        bool _show_measures;
@@ -1677,7 +1702,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void marker_menu_rename ();
        void rename_marker (ArdourMarker *marker);
        void toggle_marker_lock_style ();
+       void toggle_tempo_clamped ();
        void toggle_tempo_type ();
+       void continue_previous_tempo ();
+       void ramp_to_next_tempo ();
        void toggle_marker_menu_lock ();
        void toggle_marker_menu_glue ();
        void marker_menu_hide ();
@@ -1830,8 +1858,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        void setup_midi_toolbar ();
 
-       void presentation_info_changed (PBD::PropertyChange const &);
-
        /* selection process */
 
        Selection* selection;
@@ -1840,11 +1866,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        void time_selection_changed ();
        void update_time_selection_display ();
-       void track_selection_changed ();
+       void presentation_info_changed (PBD::PropertyChange const &);
        void region_selection_changed ();
        sigc::connection editor_regions_selection_changed_connection;
        void sensitize_all_region_actions (bool);
-       void sensitize_the_right_region_actions ();
+       void sensitize_the_right_region_actions (bool because_canvas_crossing);
        bool _all_region_actions_sensitized;
        /** Flag to block region action handlers from doing what they normally do;
         *  I tried Gtk::Action::block_activate() but this doesn't work (ie it doesn't
@@ -1855,6 +1881,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void point_selection_changed ();
        void marker_selection_changed ();
 
+       bool _track_selection_change_without_scroll;
+
        void cancel_selection ();
        void cancel_time_selection ();
 
@@ -2142,7 +2170,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void get_regions_at (RegionSelection&, framepos_t where, const TrackViewList& ts) const;
        void get_regions_after (RegionSelection&, framepos_t where, const TrackViewList& ts) const;
 
-       RegionSelection get_regions_from_selection_and_edit_point ();
+       RegionSelection get_regions_from_selection_and_edit_point (Editing::EditIgnoreOption = Editing::EDIT_IGNORE_NONE,
+                                                                  bool use_context_click = false,
+                                                                  bool from_outside_canvas = false);
        RegionSelection get_regions_from_selection_and_entered () const;
 
        void start_updating_meters ();
@@ -2259,7 +2289,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        QuantizeDialog* quantize_dialog;
        MainMenuDisabler* _main_menu_disabler;
 
-       /* private helper functions to help with registering axis */
+       /* private helper functions to help with registering region actions */
+
+       Glib::RefPtr<Gtk::Action> register_region_action (Glib::RefPtr<Gtk::ActionGroup> group, Editing::RegionActionTarget, char const * name, char const * label, sigc::slot<void> slot);
+       void register_toggle_region_action (Glib::RefPtr<Gtk::ActionGroup> group, Editing::RegionActionTarget, char const * name, char const * label, sigc::slot<void> slot);
 
        Glib::RefPtr<Gtk::Action> reg_sens (Glib::RefPtr<Gtk::ActionGroup> group, char const * name, char const * label, sigc::slot<void> slot);
        void toggle_reg_sens (Glib::RefPtr<Gtk::ActionGroup> group, char const * name, char const * label, sigc::slot<void> slot);