Remove internal edit mode and add "content" tool.
[ardour.git] / gtk2_ardour / editor.h
index 75b66d6f047c7a3047a0fff6c25aa347a0a69a5c..168f3dcc90a4eb321655e472306dd962ae68db41 100644 (file)
@@ -58,6 +58,7 @@
 #include "enums.h"
 #include "editor_items.h"
 #include "region_selection.h"
+#include "selection_memento.h"
 
 namespace Gtkmm2ext {
        class TearOff;
@@ -149,6 +150,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        double visible_canvas_height () const {
                return _visible_canvas_height;
        }
+       double trackviews_height () const;
 
        void cycle_snap_mode ();
        void next_snap_choice ();
@@ -176,11 +178,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        Editing::MidiEditMode current_midi_edit_mode () const;
        void remove_midi_note (ArdourCanvas::Item *, GdkEvent *);
 
-       bool internal_editing() const { return _internal_editing ; }
-       void set_internal_edit (bool yn);
-       bool toggle_internal_editing_from_double_click (GdkEvent*);
+       bool internal_editing() const;
 
-        void _ensure_time_axis_view_is_visible (TimeAxisView const & tav, bool at_top);
        void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
        void add_to_idle_resize (TimeAxisView*, int32_t);
 
@@ -277,7 +276,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void export_range ();
        void export_region ();
 
-       void add_toplevel_controls (Gtk::Container&);
+       void add_transport_frame (Gtk::Container&);
+       void add_toplevel_menu (Gtk::Container&);
        Gtk::HBox& get_status_bar_packer()  { return status_bar_hpacker; }
 
        void               set_zoom_focus (Editing::ZoomFocus);
@@ -285,6 +285,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        framecnt_t         get_current_zoom () const { return samples_per_pixel; }
         void               cycle_zoom_focus ();
        void temporal_zoom_step (bool coarser);
+        void ensure_time_axis_view_is_visible (TimeAxisView const & tav, bool at_top);
        void tav_zoom_step (bool coarser);
        void tav_zoom_smooth (bool coarser, bool force_all);
 
@@ -311,6 +312,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        /* nudge is initiated by transport controls owned by ARDOUR_UI */
 
        framecnt_t get_nudge_distance (framepos_t pos, framecnt_t& next);
+       framecnt_t get_paste_offset (framepos_t pos, unsigned paste_count, framecnt_t duration);
        Evoral::MusicalTime get_grid_type_as_beats (bool& success, framepos_t position);
 
        void nudge_forward (bool next, bool force_playhead);
@@ -367,7 +369,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void restore_editing_space();
 
        void update_tearoff_visibility();
+       void reattach_all_tearoffs ();
 
+       double get_y_origin () const;
        void reset_x_origin (framepos_t);
        void reset_x_origin_to_follow_playhead ();
        void reset_y_origin (double);
@@ -401,6 +405,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
         void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions, bool src_comparison);
 
+       void get_regionviews_by_id (PBD::ID const & id, RegionSelection & regions) const;
+
        void center_screen (framepos_t);
 
        TrackViewList axis_views_from_routes (boost::shared_ptr<ARDOUR::RouteList>) const;
@@ -408,9 +414,19 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        Gtkmm2ext::TearOff* mouse_mode_tearoff () const { return _mouse_mode_tearoff; }
        Gtkmm2ext::TearOff* tools_tearoff () const { return _tools_tearoff; }
 
-       void snap_to (framepos_t& first, int32_t direction = 0, bool for_mark = false);
-       void snap_to_with_modifier (framepos_t& first, GdkEvent const *, int32_t direction = 0, bool for_mark = false);
-       void snap_to (framepos_t& first, framepos_t& last, int32_t direction = 0, bool for_mark = false);
+       void snap_to (framepos_t&       first,
+                     ARDOUR::RoundMode direction = ARDOUR::RoundNearest,
+                     bool              for_mark  = false);
+
+       void snap_to_with_modifier (framepos_t&       first,
+                                   GdkEvent const *  ev,
+                                   ARDOUR::RoundMode direction = ARDOUR::RoundNearest,
+                                   bool              for_mark  = false);
+
+       void snap_to (framepos_t&       first,
+                     framepos_t&       last,
+                     ARDOUR::RoundMode direction = ARDOUR::RoundNearest,
+                     bool              for_mark  = false);
 
        void begin_reversible_command (std::string cmd_name);
        void begin_reversible_command (GQuark);
@@ -474,7 +490,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void mouse_add_new_marker (framepos_t where, bool is_cd=false, bool is_xrun=false);
        void split_regions_at (framepos_t, RegionSelection&);
        void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false);
-       RegionSelection get_regions_from_selection_and_mouse ();
+       RegionSelection get_regions_from_selection_and_mouse (framepos_t);
        
   protected:
        void map_transport_state ();
@@ -528,12 +544,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void set_samples_per_pixel (framecnt_t);
 
        Editing::MouseMode mouse_mode;
-       Editing::MouseMode pre_internal_mouse_mode;
-       Editing::SnapType  pre_internal_snap_type;
-       Editing::SnapMode  pre_internal_snap_mode;
-       Editing::SnapType  internal_snap_type;
-       Editing::SnapMode  internal_snap_mode;
-       bool _internal_editing;
        Editing::MouseMode effective_mouse_mode () const;
 
        enum JoinObjectRangeState {
@@ -567,9 +577,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        Gtk::VBox     scrollers_rulers_markers_box;
 
        void location_changed (ARDOUR::Location *);
-       void location_flags_changed (ARDOUR::Location *, void *);
+       void location_flags_changed (ARDOUR::Location *);
        void refresh_location_display ();
-       void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
+       void refresh_location_display_internal (const ARDOUR::Locations::LocationList&);
        void add_new_location (ARDOUR::Location *);
        ArdourCanvas::Container* add_new_location_internal (ARDOUR::Location *);
        void location_gone (ARDOUR::Location *);
@@ -829,11 +839,14 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void store_ruler_visibility ();
        void restore_ruler_visibility ();
 
-       enum MinsecRulerScale {
+
+
+               enum MinsecRulerScale {
+               minsec_show_msecs,
                minsec_show_seconds,
                minsec_show_minutes,
                minsec_show_hours,
-               minsec_show_frames
+               minsec_show_many_hours
        };
 
        MinsecRulerScale minsec_ruler_scale;
@@ -848,7 +861,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
                timecode_show_frames,
                timecode_show_seconds,
                timecode_show_minutes,
-               timecode_show_hours
+               timecode_show_hours,
+               timecode_show_many_hours
        };
 
        TimecodeRulerScale timecode_ruler_scale;
@@ -861,7 +875,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void set_samples_ruler_scale (framepos_t, framepos_t);
 
        enum BBTRulerScale {
-               bbt_over,
+               bbt_show_many,
                bbt_show_64,
                bbt_show_16,
                bbt_show_4,
@@ -968,6 +982,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        std::vector<ARDOUR::framepos_t> region_boundary_cache;
        void build_region_boundary_cache ();
 
+       Gtk::HBox           toplevel_hpacker;
+
        Gtk::HBox           top_hbox;
        Gtk::HBox           bottom_hbox;
 
@@ -1104,9 +1120,14 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
         Gtkmm2ext::ActionMap editor_action_map;
         Gtkmm2ext::Bindings  key_bindings;
 
+       /* CUT/COPY/PASTE */
+
+       framepos_t last_paste_pos;
+       unsigned   paste_count;
+
        void cut_copy (Editing::CutCopyOp);
        bool can_cut_copy () const;
-       void cut_copy_points (Editing::CutCopyOp);
+       void cut_copy_points (Editing::CutCopyOp, Evoral::MusicalTime earliest=Evoral::MusicalTime(), bool midi=false);
        void cut_copy_regions (Editing::CutCopyOp, RegionSelection&);
        void cut_copy_ranges (Editing::CutCopyOp);
        void cut_copy_midi (Editing::CutCopyOp);
@@ -1169,6 +1190,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void reset_region_scale_amplitude ();
        void adjust_region_gain (bool up);
        void quantize_region ();
+       void legatize_region (bool shrink_only);
        void insert_patch_change (bool from_context);
        void fork_region ();
 
@@ -1215,7 +1237,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void play_location (ARDOUR::Location&);
        void loop_location (ARDOUR::Location&);
 
-       void temporal_zoom_selection ();
+       void calc_extra_zoom_edges(framepos_t &start, framepos_t &end);
+       void temporal_zoom_selection (bool both_axes = false);
        void temporal_zoom_region (bool both_axes);
        void zoom_to_region (bool both_axes);
        void temporal_zoom_session ();
@@ -1305,6 +1328,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void jump_forward_to_mark ();
        void jump_backward_to_mark ();
        void cursor_align (bool playhead_to_edit);
+       void toggle_skip_playback ();
 
        void remove_last_capture ();
        void select_all_selectables_using_time_selection ();
@@ -1323,6 +1347,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void set_punch_from_selection ();
        void set_punch_from_region ();
 
+       void set_session_extents_from_selection ();
+
        void set_loop_from_edit_range (bool play);
        void set_loop_from_region (bool play);
        void set_punch_from_edit_range ();
@@ -1385,6 +1411,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void set_fade_in_active (bool);
        void set_fade_out_active (bool);
 
+       void fade_range ();
+
        std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
 
        bool _dragging_playhead;
@@ -1430,7 +1458,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        bool canvas_feature_line_event (GdkEvent* event, ArdourCanvas::Item*, RegionView*);
        bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
        bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
-       bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
        bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
        bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
        bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*);
@@ -1588,10 +1615,13 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        ArdourButton              tav_expand_button;
        ArdourButton              tav_shrink_button;
        ArdourDropdown            visible_tracks_selector;
+       ArdourDropdown            zoom_preset_selector;
 
     int32_t                   _visible_track_count;
     void build_track_count_menu ();
     void set_visible_track_count (int32_t);
+    
+    void set_zoom_preset(int64_t);
 
        Gtk::VBox                toolbar_clock_vbox;
        Gtk::VBox                toolbar_selection_clock_vbox;
@@ -1602,9 +1632,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        ArdourButton mouse_select_button;
        ArdourButton mouse_draw_button;
        ArdourButton mouse_move_button;
-       ArdourButton mouse_gain_button;
-       ArdourButton mouse_zoom_button;
        ArdourButton mouse_timefx_button;
+       ArdourButton mouse_content_button;
        ArdourButton mouse_audition_button;
        ArdourButton mouse_cut_button;
 
@@ -1615,9 +1644,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void                     mouse_mode_object_range_toggled ();
        bool                     ignore_mouse_mode_toggle;
 
-       ArdourButton internal_edit_button;
-       void         toggle_internal_editing ();
-
        bool                     mouse_select_button_release (GdkEventButton*);
 
        Gtk::VBox                automation_box;
@@ -1684,6 +1710,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        Selection* selection;
        Selection* cut_buffer;
+       SelectionMemento* _selection_memento;
 
        void time_selection_changed ();
         void update_time_selection_display ();
@@ -1702,6 +1729,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void point_selection_changed ();
        void marker_selection_changed ();
 
+       bool _ignore_follow_edits;
+
        void cancel_selection ();
        void cancel_time_selection ();
 
@@ -1739,11 +1768,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        ArdourCanvas::Rectangle   *rubberband_rect;
 
-       /* mouse zoom process */
-
-       ArdourCanvas::Rectangle   *zoom_rect;
-       void reposition_zoom_rect (framepos_t start, framepos_t end);
-
        EditorRouteGroups* _route_groups;
        EditorRoutes* _routes;
        EditorRegions* _regions;
@@ -1846,7 +1870,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        void write_selection ();
 
-       XMLNode *before; /* used in *_reversible_command */
+       std::list<XMLNode *> before; /* used in *_reversible_command */
 
        void update_title ();
        void update_title_s (const std::string & snapshot_name);
@@ -1986,6 +2010,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void edit_point_chosen (Editing::EditPoint);
        Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint);
        std::vector<std::string> edit_point_strings;
+       std::vector<std::string> edit_mode_strings;
 
        void selected_marker_moved (ARDOUR::Location*);
 
@@ -2004,8 +2029,13 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void select_next_route ();
        void select_prev_route ();
 
-       void snap_to_internal (framepos_t& first, int32_t direction = 0, bool for_mark = false);
-       void timecode_snap_to_internal (framepos_t& first, int32_t direction = 0, bool for_mark = false);
+       void snap_to_internal (framepos_t&       first,
+                              ARDOUR::RoundMode direction = ARDOUR::RoundNearest,
+                              bool              for_mark  = false);
+
+       void timecode_snap_to_internal (framepos_t&       first,
+                                       ARDOUR::RoundMode direction = ARDOUR::RoundNearest,
+                                       bool              for_mark  = false);
 
        RhythmFerret* rhythm_ferret;
 
@@ -2099,6 +2129,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        TimeAxisView* _stepping_axis_view;
        void zoom_vertical_modifier_released();
 
+       void bring_in_callback (Gtk::Label*, uint32_t n, uint32_t total, std::string name);
+       void update_bring_in_message (Gtk::Label* label, uint32_t n, uint32_t total, std::string name);
+       void bring_all_sources_into_session ();
+
        friend class Drag;
        friend class RegionDrag;
        friend class RegionMoveDrag;