Fix vst typo
[ardour.git] / gtk2_ardour / editor.h
index ccd1ddb0fae1054511b01122fd147894b70db84b..3e080415c06ed82987fef850fb5e59ed8b2cb799 100644 (file)
@@ -33,8 +33,6 @@
 
 #include <cmath>
 
-#include <sndfile.h>
-
 #include <gtkmm/layout.h>
 #include <gtkmm/comboboxtext.h>
 
@@ -47,6 +45,7 @@
 #include <ardour/tempo.h>
 #include <ardour/location.h>
 #include <ardour/region.h>
+#include <ardour/externalsource.h>
 
 #include "audio_clock.h"
 #include "gtk-custom-ruler.h"
@@ -56,6 +55,7 @@
 #include "enums.h"
 #include "region_selection.h"
 #include "canvas.h"
+#include "draginfo.h"
 
 namespace Gtkmm2ext {
        class TearOff;
@@ -102,6 +102,9 @@ class AutomationSelection;
 class MixerStrip;
 class StreamView;
 class ControlPoint;
+#ifdef FFT_ANALYSIS
+class AnalysisWindow;
+#endif
 
 /* <CMT Additions> */
 class ImageFrameView;
@@ -147,7 +150,6 @@ class Editor : public PublicEditor
        void connect_to_image_compositor() ;
        void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
        TimeAxisView* get_named_time_axis(const string & name) ;
-       /* </CMT Additions> */
 
        void consider_auditioning (ARDOUR::Region&);
        void hide_a_region (ARDOUR::Region&);
@@ -165,6 +167,7 @@ class Editor : public PublicEditor
 
        void new_region_from_selection ();
        void separate_region_from_selection ();
+       void separate_regions_using_location (ARDOUR::Location&);
        void toggle_playback (bool with_abort);
 
        /* undo related */
@@ -215,8 +218,8 @@ class Editor : public PublicEditor
        Selection& get_cut_buffer() const { return *cut_buffer; }
 
        void play_selection ();
-       void select_all_in_track (bool add);
-       void select_all (bool add);
+       void select_all_in_track (Selection::Operation op);
+       void select_all (Selection::Operation op);
        void invert_selection_in_track ();
        void invert_selection ();
 
@@ -225,6 +228,12 @@ class Editor : public PublicEditor
        void set_show_measures (bool yn);
        bool show_measures () const { return _show_measures; }
 
+#ifdef FFT_ANALYSIS
+       /* analysis window */
+       void analyze_region_selection();
+       void analyze_range_selection();
+#endif
+
        /* export */
 
        /* these initiate export ... */
@@ -254,6 +263,10 @@ class Editor : public PublicEditor
        jack_nframes_t leftmost_frame;
        void clear_playlist (ARDOUR::Playlist&);
 
+       void new_playlists ();
+       void copy_playlists ();
+       void clear_playlists ();
+
        TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
 
        Width editor_mixer_strip_width;
@@ -287,10 +300,17 @@ class Editor : public PublicEditor
 
        /* xfades */
 
-       void toggle_xfades_active();
+       void toggle_auto_xfade ();
+       void toggle_xfades_active ();
        void toggle_xfade_visibility ();
-       void set_xfade_visibility (bool yn);
        bool xfade_visibility() const { return _xfade_visibility; }
+       void update_crossfade_model ();
+       void set_crossfade_model (ARDOUR::CrossfadeModel);
+
+       /* layers */
+
+       void set_layer_model (ARDOUR::Session::LayerModel);
+       void update_layering_model ();
 
        /* redirect shared ops menu. caller must free returned menu */
 
@@ -301,7 +321,7 @@ class Editor : public PublicEditor
        void ensure_float (Gtk::Window&);
 
        void show_window ();
-       
+
        void scroll_tracks_down_line ();
        void scroll_tracks_up_line ();
 
@@ -310,6 +330,9 @@ class Editor : public PublicEditor
 
        void reposition_x_origin (jack_nframes_t sample);
 
+       void maximise_editing_space();
+       void restore_editing_space();
+
   protected:
        void map_transport_state ();
        void map_position_change (jack_nframes_t);
@@ -380,6 +403,7 @@ class Editor : public PublicEditor
        Editing::MouseMode mouse_mode;
        void      mouse_insert (GdkEventButton *);
 
+       int  pre_maximal_pane_position;
        void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
 
        Gtk::Notebook the_notebook;
@@ -438,11 +462,22 @@ class Editor : public PublicEditor
        CrossfadeView*     clicked_crossfadeview;
        ControlPoint*      clicked_control_point;
 
+       void mapover_audio_tracks (sigc::slot<void,AudioTimeAxisView&,uint32_t> sl);
+
+       /* functions to be passed to mapover_audio_tracks(), possibly with sigc::bind()-supplied arguments */
+
+       void mapped_set_selected_regionview_from_click (AudioTimeAxisView&, uint32_t, AudioRegionView*, vector<AudioRegionView*>*);
+       void mapped_use_new_playlist (AudioTimeAxisView&, uint32_t);
+       void mapped_use_copy_playlist (AudioTimeAxisView&, uint32_t);
+       void mapped_clear_playlist (AudioTimeAxisView&, uint32_t);
+
+       /* end */
+
        void catch_vanishing_audio_regionview (AudioRegionView *);
-       void set_selected_control_point_from_click (bool add = false, bool with_undo = true, bool no_remove=false);
-       void set_selected_track_from_click (bool add = false, bool with_undo = true, bool no_remove=false);
-       void set_selected_regionview_from_click (bool add = false, bool no_track_remove=false);
-       void set_selected_regionview_from_region_list (ARDOUR::Region& region, bool add = false);
+       void set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool with_undo = true, bool no_remove=false);
+       void set_selected_track_from_click (Selection::Operation op = Selection::Set, bool with_undo = true, bool no_remove=false);
+       void set_selected_regionview_from_click (Selection::Operation op = Selection::Set, bool no_track_remove=false);
+       void set_selected_regionview_from_region_list (ARDOUR::Region& region, Selection::Operation op = Selection::Set);
        bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, ARDOUR::Region*);
        void collect_new_region_view (AudioRegionView *);
 
@@ -631,6 +666,8 @@ class Editor : public PublicEditor
        void    cursor_to_region_point (Cursor*, ARDOUR::RegionPoint, int32_t dir);
        void    cursor_to_selection_start (Cursor *);
        void    cursor_to_selection_end   (Cursor *);
+       void    select_all_selectables_using_cursor (Cursor *, bool);
+       void    select_all_selectables_between_cursors (Cursor *, Cursor *);
 
        ARDOUR::Region* find_next_region (jack_nframes_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
 
@@ -643,7 +680,6 @@ class Editor : public PublicEditor
        Gtk::HBox           bottom_hbox;
        
        Gtk::Table          edit_packer;
-       Gtk::Frame          edit_frame;
        Gtk::VScrollbar     edit_vscrollbar;
 
        Gtk::Adjustment     vertical_adjustment;
@@ -655,6 +691,8 @@ class Editor : public PublicEditor
 
        Gtk::HScrollbar     edit_hscrollbar;
        bool                edit_hscroll_dragging;
+
+       void reset_hscrollbar_stepping ();
        
        bool hscrollbar_button_press (GdkEventButton*);
        bool hscrollbar_button_release (GdkEventButton*);
@@ -678,6 +716,10 @@ class Editor : public PublicEditor
        Gtk::VBox           edit_controls_vbox;
        Gtk::HBox           edit_controls_hbox;
 
+       void control_scroll (float);
+       bool deferred_control_scroll (jack_nframes_t);
+       sigc::connection control_scroll_connection;
+
        void tie_vertical_scrolling ();
        void canvas_horizontally_scrolled ();
        void reposition_and_zoom (jack_nframes_t sample, double fpu);
@@ -859,6 +901,7 @@ class Editor : public PublicEditor
        void split_region_at (jack_nframes_t);
        void split_regions_at (jack_nframes_t, AudioRegionSelection&);
        void crop_region_to_selection ();
+       void set_a_regions_sync_position (ARDOUR::Region&, jack_nframes_t);
        void set_region_sync_from_edit_cursor ();
        void remove_region_sync();
        void align_selection (ARDOUR::RegionPoint, jack_nframes_t position);
@@ -931,18 +974,15 @@ class Editor : public PublicEditor
        void insert_region_list_drag (ARDOUR::AudioRegion&, int x, int y);
        void insert_region_list_selection (float times);
 
-       void insert_sndfile (bool as_tracks);
-       void embed_audio ();    // inserts into region list
-       int  reject_because_rate_differs (const string & path, SF_INFO& finfo, const string & action, bool multiple_pending);
+       void add_external_audio_action (Editing::ImportMode);
 
-       void do_embed_sndfiles (vector<string> paths, bool split);
-       void embed_sndfile (string path, bool split, bool multiple_files, bool& check_sr);
-
-       void do_insert_sndfile (vector<string> path, bool multi, jack_nframes_t frame);
-       void insert_paths_as_new_tracks (std::vector<std::string> paths, bool multi); // inserts files as new tracks
-       void insert_sndfile_into (const string & path, bool multi, AudioTimeAxisView* tv, jack_nframes_t& frame, bool prompt=true);
-       static void* _insert_sndfile_thread (void*);
-       void*  insert_sndfile_thread (void*);
+       void bring_in_external_audio (Editing::ImportMode mode, ARDOUR::AudioTrack*, jack_nframes_t& pos, bool prompt);
+       void do_import (vector<Glib::ustring> paths, bool split, Editing::ImportMode mode, ARDOUR::AudioTrack*, jack_nframes_t&, bool);
+       void do_embed (vector<Glib::ustring> paths, bool split, Editing::ImportMode mode, ARDOUR::AudioTrack*, jack_nframes_t&, bool);
+       int  import_sndfile (Glib::ustring path, Editing::ImportMode mode, ARDOUR::AudioTrack* track, jack_nframes_t& pos);
+       int  embed_sndfile (Glib::ustring path, bool split, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode, 
+                           ARDOUR::AudioTrack* track, jack_nframes_t& pos, bool prompt);
+       int finish_bringing_in_audio (ARDOUR::AudioRegion& region, uint32_t, uint32_t, ARDOUR::AudioTrack* track, jack_nframes_t& pos, Editing::ImportMode mode);
 
        /* generic interthread progress window */
        
@@ -957,14 +997,16 @@ class Editor : public PublicEditor
        void build_interthread_progress_window ();
        ARDOUR::InterThreadInfo* current_interthread_info;
 
+#ifdef FFT_ANALYSIS
+       AnalysisWindow* analysis_window;
+#endif
+
        /* import specific info */
 
        ARDOUR::Session::import_status import_status;
        gint import_progress_timeout (void *);
        static void *_import_thread (void *);
        void* import_thread ();
-       void catch_new_audio_region (ARDOUR::AudioRegion*);
-       ARDOUR::AudioRegion* last_audio_region;
 
        /* to support this ... */
 
@@ -998,11 +1040,15 @@ class Editor : public PublicEditor
        void cursor_align (bool playhead_to_edit);
 
        void remove_last_capture ();
-
+       void select_all_selectables_using_time_selection ();
+       void select_all_selectables_using_loop();
+       void select_all_selectables_using_punch();
        void set_selection_from_range (ARDOUR::Location&);
        void set_selection_from_punch ();
        void set_selection_from_loop ();
+       void set_selection_from_audio_region ();
 
+       void add_location_from_audio_region ();
        void add_location_from_selection ();
        void set_route_loop_selection ();
 
@@ -1035,37 +1081,7 @@ class Editor : public PublicEditor
 
        void    hide_all_tracks (bool with_select);
 
-       struct DragInfo {
-         ArdourCanvas::Item* item;
-           void* data;
-           jack_nframes_t last_frame_position;
-           int32_t pointer_frame_offset;
-           jack_nframes_t grab_frame;
-           jack_nframes_t last_pointer_frame;
-           jack_nframes_t current_pointer_frame;
-           double grab_x, grab_y;
-           double cumulative_x_drag;
-           double cumulative_y_drag;
-           double current_pointer_x;
-           double current_pointer_y;
-         void (Editor::*motion_callback)(ArdourCanvas::Item*, GdkEvent*);
-         void (Editor::*finished_callback)(ArdourCanvas::Item*, GdkEvent*);
-           TimeAxisView* last_trackview;
-           bool x_constrained;
-           bool copy;
-           bool was_rolling;
-           bool first_move;
-           bool move_threshold_passsed;
-           bool want_move_threshold;
-           bool brushing;
-           ARDOUR::Location* copied_location;
-       } drag_info;
-
-       struct LineDragInfo {
-           uint32_t before;
-           uint32_t after;
-       };
-
+       DragInfo drag_info;
        LineDragInfo current_line_drag_info;
 
        void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0);
@@ -1113,7 +1129,9 @@ class Editor : public PublicEditor
        void start_line_grab_from_line (ArdourCanvas::Item*, GdkEvent*);
        void start_line_grab (AutomationLine *, GdkEvent*);
        void start_tempo_marker_grab (ArdourCanvas::Item*, GdkEvent*);
+       void start_tempo_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
        void start_meter_marker_grab (ArdourCanvas::Item*, GdkEvent*);
+       void start_meter_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
 
        void region_view_item_click (AudioRegionView&, GdkEventButton*);
 
@@ -1182,13 +1200,16 @@ class Editor : public PublicEditor
        void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
        void kbd_set_playhead_cursor ();
        void kbd_set_edit_cursor ();
+       void kbd_mute_unmute_region ();
        void kbd_split ();
+       void kbd_set_sync_position ();
        void kbd_align (ARDOUR::RegionPoint);
        void kbd_align_relative (ARDOUR::RegionPoint);
        void kbd_brush ();
        void kbd_audition ();
 
        void kbd_do_split (GdkEvent*);
+       void kbd_do_set_sync_position (GdkEvent* ev);
        void kbd_do_align (GdkEvent*, ARDOUR::RegionPoint);
        void kbd_do_align_relative (GdkEvent*, ARDOUR::RegionPoint);
        void kbd_do_brush (GdkEvent*);
@@ -1241,6 +1262,8 @@ class Editor : public PublicEditor
        void marker_menu_rename ();
        void marker_menu_hide ();
        void marker_menu_loop_range ();
+       void marker_menu_select_all_selectables_using_range ();
+       void marker_menu_separate_regions_using_location ();
        void marker_menu_play_from ();
        void marker_menu_set_playhead ();
        void marker_menu_set_from_playhead ();
@@ -1254,6 +1277,7 @@ class Editor : public PublicEditor
        void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
        void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
        void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
+       void build_range_marker_menu ();
        void build_marker_menu ();
        void build_tm_marker_menu ();
        void build_transport_marker_menu ();
@@ -1261,6 +1285,7 @@ class Editor : public PublicEditor
 
        Gtk::Menu* tm_marker_menu;
        Gtk::Menu* marker_menu;
+       Gtk::Menu* range_marker_menu;
        Gtk::Menu* transport_marker_menu;
        Gtk::Menu* new_transport_marker_menu;
        ArdourCanvas::Item* marker_menu_item;
@@ -1427,7 +1452,7 @@ class Editor : public PublicEditor
        void drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
        void end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
 
-       bool select_all_within (jack_nframes_t start, jack_nframes_t end, gdouble topy, gdouble boty, bool add);
+       bool select_all_within (jack_nframes_t start, jack_nframes_t end, gdouble topy, gdouble boty, Selection::Operation op);
        
        ArdourCanvas::SimpleRect   *rubberband_rect;
        
@@ -1514,14 +1539,18 @@ class Editor : public PublicEditor
        void activate_all_edit_groups ();
        void disable_all_edit_groups ();
 
+       bool in_edit_group_row_change;
        void edit_group_row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
-       
+       void edit_group_name_edit (const Glib::ustring&, const Glib::ustring&);
        void new_edit_group ();
        void edit_group_list_button_clicked ();
        gint edit_group_list_button_press_event (GdkEventButton* ev);
        void edit_group_selection_changed ();
        void fake_add_edit_group (ARDOUR::RouteGroup* group);
+       void fake_remove_edit_group (ARDOUR::RouteGroup* group);
        void add_edit_group (ARDOUR::RouteGroup* group);
+       void remove_selected_edit_group ();
+       void edit_groups_changed ();
        void group_flags_changed (void*, ARDOUR::RouteGroup*);
 
        Gtk::VBox           list_vpacker;
@@ -1563,7 +1592,7 @@ class Editor : public PublicEditor
 
        /* Drag-n-Drop */
 
-       int convert_drop_to_paths (std::vector<std::string>& paths,
+       int convert_drop_to_paths (std::vector<Glib::ustring>& paths,
                                   const Glib::RefPtr<Gdk::DragContext>& context,
                                   gint                x,
                                   gint                y,
@@ -1603,7 +1632,10 @@ class Editor : public PublicEditor
        /* audio export */
 
        ExportDialog *export_dialog;
+       ExportDialog *export_range_markers_dialog;
+       
        void export_range (jack_nframes_t start, jack_nframes_t end);
+       void export_range_markers ();
 
        int  write_region_selection(AudioRegionSelection&);
        bool write_region (string path, ARDOUR::AudioRegion&);
@@ -1824,9 +1856,6 @@ class Editor : public PublicEditor
        void toggle_gain_envelope_visibility ();
        void toggle_gain_envelope_active ();
        
-       typedef std::map<Editing::ColorID,std::string> ColorStyleMap;
-       void init_colormap ();
-
        bool on_key_press_event (GdkEventKey*);
 
        void session_state_saved (string);