Shut up.
[ardour.git] / gtk2_ardour / editor.h
index 4ce8b1bcd234ddf5d4d36b77b17e675f5d79a36b..167ad65b1f0ebd7647d2b0f29b48e6e14268053e 100644 (file)
@@ -25,6 +25,7 @@
 #include <set>
 #include <string>
 #include <sys/time.h>
+#include <bitset>
 
 #include <glibmm/ustring.h>
 
 #include <gtkmm2ext/click_box.h>
 #include <gtkmm2ext/dndtreeview.h>
 
-#include <pbd/stateful.h>
-#include <ardour/session.h>
-#include <ardour/tempo.h>
-#include <ardour/stretch.h>
-#include <ardour/location.h>
-#include <ardour/audioregion.h>
-#include <ardour/track.h>
+#include "pbd/stateful.h"
+#include "ardour/session.h"
+#include "ardour/tempo.h"
+#include "ardour/stretch.h"
+#include "ardour/location.h"
+#include "ardour/audioregion.h"
+#include "ardour/track.h"
+#include "ardour/types.h"
 
 #include "audio_clock.h"
 #include "gtk-custom-ruler.h"
@@ -86,28 +88,31 @@ namespace LADSPA {
        class Plugin;
 }
 
-class TimeAxisView;
+class AnalysisWindow;
+class AudioRegionView;
+class AudioStreamView;
 class AudioTimeAxisView;
+class AutomationLine;
+class AutomationSelection;
 class AutomationTimeAxisView;
-class AudioRegionView;
+class BundleManager;
+class ControlPoint;
 class CrossfadeView;
-class PluginSelector;
-class PlaylistSelector;
-class Marker;
+class GlobalPortMatrixWindow;
 class GroupedButtons;
-class AutomationLine;
+class Marker;
+class MixerStrip;
+class PlaylistSelector;
+class PluginSelector;
+class RhythmFerret;
 class Selection;
+class SoundFileOmega;
+class StreamView;
 class TempoLines;
+class TimeAxisView;
+class TimeFXDialog;
 class TimeSelection;
 class TrackSelection;
-class AutomationSelection;
-class MixerStrip;
-class StreamView;
-class AudioStreamView;
-class ControlPoint;
-class SoundFileOmega;
-class RhythmFerret;
-class AnalysisWindow;
 
 /* <CMT Additions> */
 class ImageFrameView;
@@ -129,7 +134,7 @@ class Editor : public PublicEditor
        void             connect_to_session (ARDOUR::Session *);
        ARDOUR::Session* current_session() const { return session; }
        void             first_idle ();
-       virtual bool have_idled() const { return _have_idled; }
+       virtual bool     have_idled () const { return _have_idled; }
 
        nframes64_t leftmost_position() const { return leftmost_frame; }
        nframes64_t current_page_frames() const {
@@ -260,6 +265,7 @@ class Editor : public PublicEditor
        bool show_measures () const { return _show_measures; }
 
        /* analysis window */
+
        void analyze_region_selection();
        void analyze_range_selection();
 
@@ -273,9 +279,9 @@ class Editor : public PublicEditor
        void add_toplevel_controls (Gtk::Container&);
        Gtk::HBox& get_status_bar_packer()  { return status_bar_hpacker; }
 
-       void      set_zoom_focus (Editing::ZoomFocus);
+       void               set_zoom_focus (Editing::ZoomFocus);
        Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
-       double   get_current_zoom () const { return frames_per_unit; }
+       double             get_current_zoom () const { return frames_per_unit; }
 
        void temporal_zoom_step (bool coarser);
 
@@ -290,6 +296,7 @@ class Editor : public PublicEditor
        void clear_playlists (TimeAxisView* v);
 
        TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
+       void get_onscreen_tracks (TrackViewList&);
 
        Width editor_mixer_strip_width;
        void maybe_add_mixer_strip_width (XMLNode&);
@@ -333,8 +340,8 @@ class Editor : public PublicEditor
        void video_pullup_chosen (ARDOUR::Session::PullupFormat pullup);
        void subframes_per_frame_chosen (uint32_t);
 
-       void update_smpte_mode();
-       void update_video_pullup();
+       void update_smpte_mode ();
+       void update_video_pullup ();
        void update_subframes_per_frame ();
 
        /* fades/xfades */
@@ -392,6 +399,8 @@ class Editor : public PublicEditor
        void toggle_meter_updating();
 
        void show_rhythm_ferret();
+       void show_bundle_manager ();
+       void show_global_port_matrix (ARDOUR::DataType);
 
        void goto_visual_state (uint32_t);
        void save_visual_state (uint32_t);
@@ -519,10 +528,10 @@ class Editor : public PublicEditor
 
        TimeAxisView*      clicked_axisview;
        RouteTimeAxisView* clicked_routeview;
-        /** The last RegionView that was clicked on, or 0 if the last click was not
-         * on a RegionView.  This is set up by the canvas event handlers in
-         * editor_canvas_events.cc
-         */
+       /** The last RegionView that was clicked on, or 0 if the last click was not
+        * on a RegionView.  This is set up by the canvas event handlers in
+        * editor_canvas_events.cc
+        */
        RegionView*        clicked_regionview;
        RegionSelection    latest_regionviews;
        uint32_t           clicked_selection;
@@ -589,7 +598,7 @@ class Editor : public PublicEditor
 
        void add_item_with_sensitivity (Gtk::Menu_Helpers::MenuList&, Gtk::Menu_Helpers::MenuElem, bool) const;
 
-       void handle_new_route (ARDOUR::Session::RouteList&);
+       void handle_new_route (ARDOUR::RouteList&);
        void remove_route (TimeAxisView *);
        bool route_removal;
 
@@ -622,10 +631,10 @@ class Editor : public PublicEditor
 
        bool verbose_cursor_on; // so far unused
 
-       Gtk::EventBox      time_canvas_event_box;
-       Gtk::EventBox      track_canvas_event_box;
-       Gtk::EventBox      time_button_event_box;
-       Gtk::EventBox      ruler_label_event_box;
+       Gtk::EventBox             time_canvas_event_box;
+       Gtk::EventBox             track_canvas_event_box;
+       Gtk::EventBox             time_button_event_box;
+       Gtk::EventBox             ruler_label_event_box;
 
        ArdourCanvas::Group      *minsec_group;
        ArdourCanvas::Pixbuf     *logo_item;
@@ -690,14 +699,14 @@ class Editor : public PublicEditor
        Glib::RefPtr<Gtk::ToggleAction> ruler_range_action;
        Glib::RefPtr<Gtk::ToggleAction> ruler_loop_punch_action;
        Glib::RefPtr<Gtk::ToggleAction> ruler_cd_marker_action;
-       bool                   no_ruler_shown_update;
+       bool                            no_ruler_shown_update;
        
        gint ruler_button_press (GdkEventButton*);
        gint ruler_button_release (GdkEventButton*);
        gint ruler_mouse_motion (GdkEventMotion*);
        bool ruler_scroll (GdkEventScroll* event);
 
-       gint ruler_pressed_button;
+       gint          ruler_pressed_button;
        Gtk::Widget * ruler_grabbed_widget;
        
        void initialize_rulers ();
@@ -807,7 +816,6 @@ class Editor : public PublicEditor
        Gtk::Label  range_mark_label;
        Gtk::Label  transport_mark_label;
        Gtk::Label  cd_mark_label;
-       
 
        Gtk::VBox          time_button_vbox;
        Gtk::HBox          time_button_hbox;
@@ -827,25 +835,23 @@ class Editor : public PublicEditor
            void set_y_axis (double position);
        };
 
-       friend struct Cursor; /* it needs access to several private
-                                fields. XXX fix me.
-                             */
-
-       Cursor* playhead_cursor;
+       Cursor*              playhead_cursor;
        ArdourCanvas::Group* cursor_group;
 
-       void    cursor_to_region_boundary (Cursor*, int32_t dir);
-       void    cursor_to_next_region_boundary (Cursor*);
-       void    cursor_to_previous_region_boundary (Cursor*);
+       nframes64_t get_region_boundary (nframes64_t pos, int32_t dir, bool with_selection, bool only_onscreen);
+
+       void    cursor_to_region_boundary (bool with_selection, int32_t dir);
+       void    cursor_to_next_region_boundary (bool with_selection);
+       void    cursor_to_previous_region_boundary (bool with_selection);
        void    cursor_to_next_region_point (Cursor*, ARDOUR::RegionPoint);
        void    cursor_to_previous_region_point (Cursor*, ARDOUR::RegionPoint);
        void    cursor_to_region_point (Cursor*, ARDOUR::RegionPoint, int32_t dir);
        void    cursor_to_selection_start (Cursor *);
        void    cursor_to_selection_end   (Cursor *);
 
-       void    selected_marker_to_region_boundary (int32_t dir);
-       void    selected_marker_to_next_region_boundary ();
-       void    selected_marker_to_previous_region_boundary ();
+       void    selected_marker_to_region_boundary (bool with_selection, int32_t dir);
+       void    selected_marker_to_next_region_boundary (bool with_selection);
+       void    selected_marker_to_previous_region_boundary (bool with_selection);
        void    selected_marker_to_next_region_point (ARDOUR::RegionPoint);
        void    selected_marker_to_previous_region_point (ARDOUR::RegionPoint);
        void    selected_marker_to_region_point (ARDOUR::RegionPoint, int32_t dir);
@@ -988,6 +994,9 @@ class Editor : public PublicEditor
 
        void region_list_region_changed (ARDOUR::Change, boost::weak_ptr<ARDOUR::Region>);
        void region_list_selection_changed ();
+       sigc::connection region_list_change_connection;
+       void set_selected_in_region_list(RegionSelection&);
+       bool set_selected_in_region_list_subrow(boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &, int);
        bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
        void region_name_edit (const Glib::ustring&, const Glib::ustring&);
        void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions);
@@ -1071,7 +1080,7 @@ class Editor : public PublicEditor
 
        /* track views */
        TrackViewList  track_views;
-       TimeAxisView     *trackview_by_y_position (double ypos);
+       std::pair<TimeAxisView*, ARDOUR::layer_t> trackview_by_y_position (double);
 
        static Gdk::Cursor* cross_hair_cursor;
        static Gdk::Cursor* trimmer_cursor;
@@ -1182,6 +1191,7 @@ class Editor : public PublicEditor
        void audition_playlist_region_via_route (boost::shared_ptr<ARDOUR::Region>, ARDOUR::Route&);
        void split_multichannel_region();
        void reverse_region ();
+       void strip_region_silence ();
        void normalize_region ();
        void denormalize_region ();
        void adjust_region_scale_amplitude (bool up);
@@ -1296,7 +1306,7 @@ class Editor : public PublicEditor
 
        /* import specific info */
 
-       struct EditorImportStatus : public ARDOUR::Session::import_status {
+       struct EditorImportStatus : public ARDOUR::Session::ImportStatus {
            Editing::ImportMode mode;
            nframes64_t pos;
            int target_tracks;
@@ -1442,7 +1452,7 @@ class Editor : public PublicEditor
        void region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
        void create_region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
        void create_region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
-       bool check_region_drag_possible (RouteTimeAxisView**);
+       bool check_region_drag_possible (RouteTimeAxisView**, ARDOUR::layer_t*);
        void possibly_copy_regions_during_grab (GdkEvent*);
        void region_drag_splice_motion_callback (ArdourCanvas::Item*, GdkEvent*);
        void region_drag_splice_finished_callback (ArdourCanvas::Item*, GdkEvent*);
@@ -1603,6 +1613,7 @@ public:
        void edit_meter_section (ARDOUR::MeterSection*);
        void edit_tempo_marker (ArdourCanvas::Item*);
        void edit_meter_marker (ArdourCanvas::Item*);
+       void edit_control_point (ArdourCanvas::Item*);
        
        void marker_menu_edit ();
        void marker_menu_remove ();
@@ -1748,9 +1759,13 @@ public:
        Gtk::ToggleButton        midi_tool_select_button;
        Gtk::ToggleButton        midi_tool_resize_button;
        Gtk::ToggleButton        midi_tool_erase_button;
-       Gtk::ToggleButton        midi_panic_button;
+       Gtk::Button              midi_panic_button;
+       Gtk::ToggleButton        midi_sound_notes;
        GroupedButtons          *midi_tool_button_set;
        void                     midi_edit_mode_toggled (Editing::MidiEditMode m);
+       void                     midi_panic_button_pressed ();
+       bool                     sound_notes () const { return midi_sound_notes.get_active(); }
+       
        bool                     ignore_midi_edit_mode_toggle;
 
        Gtkmm2ext::TearOff* midi_tools_tearoff;
@@ -1758,7 +1773,6 @@ public:
        Gtk::EventBox       midi_toolbar_base;
        Gtk::Frame          midi_toolbar_frame;
        
-       void midi_panic_toggle ();
        void setup_midi_toolbar ();
 
        /* selection process */
@@ -1769,6 +1783,7 @@ public:
        void time_selection_changed ();
        void track_selection_changed ();
        void region_selection_changed ();
+       sigc::connection editor_regions_selection_changed_connection;
        void sensitize_the_right_region_actions (bool have_selected_regions);
        void point_selection_changed ();
        void marker_selection_changed ();
@@ -1897,6 +1912,7 @@ public:
        void route_list_reordered (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* what);
        bool ignore_route_list_reorder;
        bool no_route_list_redisplay;
+       bool sync_track_view_list_and_route_list ();
 
        void build_route_list_menu ();
        void show_route_list_menu ();
@@ -1982,8 +1998,8 @@ public:
        void point_trim (GdkEvent*);
        void trim_motion_callback (ArdourCanvas::Item*, GdkEvent*);
        void single_contents_trim (RegionView&, nframes64_t, bool, bool, bool);
-       void single_start_trim (RegionView&, nframes64_t, bool, bool);
-       void single_end_trim (RegionView&, nframes64_t, bool, bool);
+       void single_start_trim (RegionView&, nframes64_t, bool, bool, bool);
+       void single_end_trim (RegionView&, nframes64_t, bool, bool, bool);
 
        void trim_finished_callback (ArdourCanvas::Item*, GdkEvent*);
        void thaw_region_after_trim (RegionView& rv);
@@ -1998,59 +2014,69 @@ public:
        void trim_region_to_punch ();
        void trim_region_to_location (const ARDOUR::Location&, const char* cmd);
 
+       void trim_to_region(bool forward);
+       void trim_region_to_previous_region_end();
+       void trim_region_to_next_region_start();
+
        bool show_gain_after_trim;
 
        /* Drag-n-Drop */
 
-       int convert_drop_to_paths (std::vector<Glib::ustring>& paths,
-                                  const Glib::RefPtr<Gdk::DragContext>& context,
-                                  gint                x,
-                                  gint                y,
-                                  const Gtk::SelectionData& data,
-                                  guint               info,
-                                  guint               time);
-
-       void  track_canvas_drag_data_received  (const Glib::RefPtr<Gdk::DragContext>& context,
-                                               gint                x,
-                                               gint                y,
-                                               const Gtk::SelectionData& data,
-                                               guint               info,
-                                               guint               time);
+       int convert_drop_to_paths (
+                       std::vector<Glib::ustring>&           paths,
+                       const Glib::RefPtr<Gdk::DragContext>& context,
+                       gint                                  x,
+                       gint                                  y,
+                       const Gtk::SelectionData&             data,
+                       guint                                 info,
+                       guint                                 time);
+
+       void track_canvas_drag_data_received (
+                       const Glib::RefPtr<Gdk::DragContext>& context,
+                       gint                                  x,
+                       gint                                  y,
+                       const Gtk::SelectionData&             data,
+                       guint                                 info,
+                       guint                                 time);
        
-       void  region_list_display_drag_data_received  (const Glib::RefPtr<Gdk::DragContext>& context,
-                                                      gint                x,
-                                                      gint                y,
-                                                      const Gtk::SelectionData& data,
-                                                      guint               info,
-                                                      guint               time);
-
-       void  drop_paths  (const Glib::RefPtr<Gdk::DragContext>& context,
-                          gint                x,
-                          gint                y,
-                          const Gtk::SelectionData& data,
-                          guint               info,
-                          guint               time);
-
-       void  drop_regions  (const Glib::RefPtr<Gdk::DragContext>& context,
-                            gint                x,
-                            gint                y,
-                            const Gtk::SelectionData& data,
-                            guint               info,
-                            guint               time);
-
-       void  drop_routes (const Glib::RefPtr<Gdk::DragContext>& context,
-                          gint                x,
-                          gint                y,
-                          const Gtk::SelectionData& data,
-                          guint               info,
-                          guint               time);
+       void region_list_display_drag_data_received (
+                       const Glib::RefPtr<Gdk::DragContext>& context,
+                       gint                                  x,
+                       gint                                  y,
+                       const Gtk::SelectionData&             data,
+                       guint                                 info,
+                       guint                                 time);
+
+       void drop_paths (
+                       const Glib::RefPtr<Gdk::DragContext>& context,
+                       gint                                  x,
+                       gint                                  y,
+                       const Gtk::SelectionData&             data,
+                       guint                                 info,
+                       guint                                 time);
+
+       void drop_regions (
+                       const Glib::RefPtr<Gdk::DragContext>& context,
+                       gint                                  x,
+                       gint                                  y,
+                       const Gtk::SelectionData&             data,
+                       guint                                 info,
+                       guint                                 time);
+
+       void drop_routes (
+                       const Glib::RefPtr<Gdk::DragContext>& context,
+                       gint                x,
+                       gint                y,
+                       const Gtk::SelectionData& data,
+                       guint               info,
+                       guint               time);
 
        /* audio export */
 
        int  write_region_selection(RegionSelection&);
        bool write_region (string path, boost::shared_ptr<ARDOUR::AudioRegion>);
        void bounce_region_selection ();
-       void bounce_range_selection (bool replace);
+       void bounce_range_selection (bool replace, bool enable_processing);
        void external_edit_region ();
 
        int write_audio_selection (TimeSelection&);
@@ -2058,10 +2084,6 @@ public:
 
        void write_selection ();
 
-       /* history */
-
-       UndoAction get_memento() const;
-
        XMLNode *before; /* used in *_reversible_command */
 
        void begin_reversible_command (string cmd_name);
@@ -2114,49 +2136,8 @@ public:
        void start_time_fx (ArdourCanvas::Item*, GdkEvent*);
        void end_time_fx (ArdourCanvas::Item*, GdkEvent*);
 
-       struct TimeFXDialog : public ArdourDialog {
-           ARDOUR::TimeFXRequest request;
-           Editor&               editor;
-           bool                  pitching;
-           Gtk::Adjustment       pitch_octave_adjustment;
-           Gtk::Adjustment       pitch_semitone_adjustment;
-           Gtk::Adjustment       pitch_cent_adjustment;
-           Gtk::SpinButton       pitch_octave_spinner;
-           Gtk::SpinButton       pitch_semitone_spinner;
-           Gtk::SpinButton       pitch_cent_spinner;
-           RegionSelection       regions;
-           Gtk::ProgressBar      progress_bar;
-
-           /* SoundTouch */
-           Gtk::ToggleButton     quick_button;
-           Gtk::ToggleButton     antialias_button;
-           Gtk::HBox             upper_button_box;
-
-           /* RubberBand */
-           Gtk::ComboBoxText     stretch_opts_selector;
-           Gtk::Label            stretch_opts_label;
-           Gtk::ToggleButton     precise_button;
-           Gtk::ToggleButton     preserve_formants_button;
-           Gtk::HBox             opts_box;
-
-           Gtk::Button*          cancel_button;
-           Gtk::Button*          action_button;
-           Gtk::VBox             packer;
-           int                   status;
-
-           TimeFXDialog (Editor& e, bool for_pitch);
-
-           gint update_progress ();
-           sigc::connection first_cancel;
-           sigc::connection first_delete;
-           void cancel_in_progress ();
-           gint delete_in_progress (GdkEventAny*);
-       };
-
        /* "whats mine is yours" */
 
-       friend class TimeFXDialog;
-
        TimeFXDialog* current_timefx;
 
        static void* timefx_thread (void *arg);
@@ -2337,15 +2318,11 @@ public:
        void snap_to_internal (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
 
        RhythmFerret* rhythm_ferret;
+       BundleManager* _bundle_manager;
+       GlobalPortMatrixWindow* _global_port_matrix[ARDOUR::DataType::num_types];
 
        void fit_tracks ();
        void set_track_height (uint32_t h);
-       void set_track_height_largest ();
-       void set_track_height_large ();
-       void set_track_height_larger ();
-       void set_track_height_normal ();
-       void set_track_height_smaller ();
-       void set_track_height_small ();
 
        void remove_tracks ();
        void toggle_tracks_active ();
@@ -2357,6 +2334,12 @@ public:
        bool idle_resize();
        friend gboolean _idle_resize (gpointer);
        std::vector<TimeAxisView*> pending_resizes;
+
+       void visible_order_range (int*, int*) const;
+       bool y_movement_disallowed (int, int, int, int, int, std::bitset<512> const &, std::vector<int32_t> const &) const;
+
+       void located ();
+       bool _pending_locate_request;
 };
 
 #endif /* __ardour_editor_h__ */