support DnD in native/gtk-quartz implementation (note: multifile DnD requires a patch...
[ardour.git] / gtk2_ardour / editor.h
index 2d44538cb7d16b8e38425a96497af704ca57ce1f..c5a99d44ca8e3b392e869096547c8aa96f50032b 100644 (file)
@@ -15,7 +15,6 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id$
 */
 
 #ifndef __ardour_editor_h__
@@ -27,6 +26,8 @@
 #include <string>
 #include <sys/time.h>
 
+#include <boost/optional.hpp>
+
 #include <libgnomecanvasmm/canvas.h>
 #include <libgnomecanvasmm/group.h>
 #include <libgnomecanvasmm/line.h>
@@ -61,10 +62,6 @@ namespace Gtkmm2ext {
        class TearOff;
 }
 
-namespace LinuxAudioSystems {
-       class AudioEngine;
-}
-
 namespace ARDOUR {
        class AudioDiskstream;
        class RouteGroup;
@@ -122,7 +119,7 @@ class TimeAxisViewItem ;
 class Editor : public PublicEditor
 {
   public:
-       Editor (ARDOUR::AudioEngine&);
+       Editor ();
        ~Editor ();
 
        void             connect_to_session (ARDOUR::Session *);
@@ -269,6 +266,7 @@ class Editor : public PublicEditor
        TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
 
        Width editor_mixer_strip_width;
+       void maybe_add_mixer_strip_width (XMLNode&);
        void show_editor_mixer (bool yn);
        void set_selected_mixer_strip (TimeAxisView&);
        void hide_track_in_display (TimeAxisView& tv);
@@ -310,6 +308,7 @@ class Editor : public PublicEditor
        void toggle_xfades_active ();
        void toggle_xfade_visibility ();
        bool xfade_visibility() const { return _xfade_visibility; }
+       void update_xfade_visibility ();
        void update_crossfade_model ();
        void set_crossfade_model (ARDOUR::CrossfadeModel);
 
@@ -340,6 +339,8 @@ class Editor : public PublicEditor
        void reset_zoom (double);
        void reposition_and_zoom (nframes_t, double);
 
+       nframes_t edit_cursor_position(bool);
+
   protected:
        void map_transport_state ();
        void map_position_change (nframes_t);
@@ -349,8 +350,10 @@ class Editor : public PublicEditor
   private:
        
        ARDOUR::Session     *session;
-       ARDOUR::AudioEngine& engine;
        bool                 constructed;
+  
+       // to keep track of the playhead position for control_scroll
+       boost::optional<nframes_t> _control_scroll_target;
 
        PlaylistSelector* _playlist_selector;
 
@@ -505,6 +508,7 @@ class Editor : public PublicEditor
        Gtk::EventBox      time_canvas_event_box;
        Gtk::EventBox      track_canvas_event_box;
        Gtk::EventBox      time_button_event_box;
+       Gtk::Frame         time_button_frame;
 
        ArdourCanvas::Group      *minsec_group;
        ArdourCanvas::Group      *bbt_group;
@@ -561,6 +565,7 @@ class Editor : public PublicEditor
        gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
        gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
 
+       Gtk::Widget        *_ruler_separator;
        GtkWidget          *_smpte_ruler;
        GtkWidget          *_bbt_ruler;
        GtkWidget          *_frames_ruler;
@@ -609,7 +614,7 @@ class Editor : public PublicEditor
            nframes_t        current_frame;
            double                length;
 
-           Cursor (Editor&, const string& color, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
+           Cursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
            ~Cursor ();
 
            void set_position (nframes_t);
@@ -772,10 +777,12 @@ class Editor : public PublicEditor
        SnapshotDisplayModelColumns snapshot_display_columns;
        Glib::RefPtr<Gtk::ListStore> snapshot_display_model;
        Gtk::TreeView snapshot_display;
+       Gtk::Menu snapshot_context_menu;
 
        bool snapshot_display_button_press (GdkEventButton*);
        void snapshot_display_selection_changed ();
        void redisplay_snapshots();
+       void popup_snapshot_context_menu (int, int32_t, Glib::ustring);
 
        /* named selections */
 
@@ -797,6 +804,8 @@ class Editor : public PublicEditor
        void create_named_selection ();
        void paste_named_selection (float times);
        void remove_selected_named_selections ();
+       void remove_snapshot (Glib::ustring);
+       void rename_snapshot (Glib::ustring);
 
        void handle_new_named_selection ();
        void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
@@ -807,7 +816,6 @@ class Editor : public PublicEditor
        void named_selection_display_selection_changed ();
 
        /* track views */
-       int track_spacing;
        TrackViewList  track_views;
        TimeAxisView     *trackview_by_y_position (double ypos);
 
@@ -956,7 +964,11 @@ class Editor : public PublicEditor
 
        void bring_in_external_audio (Editing::ImportMode mode, ARDOUR::AudioTrack*, nframes_t& pos, bool prompt);
        void do_import (vector<Glib::ustring> paths, bool split, Editing::ImportMode mode, ARDOUR::AudioTrack*, nframes_t&, bool);
+
+       void _do_embed (vector<Glib::ustring> paths, bool split, Editing::ImportMode mode, ARDOUR::AudioTrack*, nframes_t&, bool);
        void do_embed (vector<Glib::ustring> paths, bool split, Editing::ImportMode mode, ARDOUR::AudioTrack*, nframes_t&, bool);
+       bool idle_do_embed (vector<Glib::ustring> paths, bool split, Editing::ImportMode mode, ARDOUR::AudioTrack*, nframes_t&, bool);
+
        int  import_sndfile (vector<Glib::ustring> paths, Editing::ImportMode mode, ARDOUR::AudioTrack* track, nframes_t& pos);
        int  embed_sndfile (vector<Glib::ustring> paths, bool split, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode, 
                            ARDOUR::AudioTrack* track, nframes_t& pos, bool prompt);
@@ -1031,7 +1043,11 @@ class Editor : public PublicEditor
 
        void add_location_from_audio_region ();
        void add_location_from_selection ();
-       void set_route_loop_selection ();
+       void set_loop_from_selection (bool play);
+       void set_punch_from_selection ();
+
+       void set_loop_range (nframes_t start, nframes_t end, std::string cmd);
+       void set_punch_range (nframes_t start, nframes_t end, std::string cmd);
 
        void add_location_from_playhead_cursor ();
 
@@ -1170,9 +1186,13 @@ class Editor : public PublicEditor
 
        bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
        bool canvas_edit_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
-       bool track_canvas_event (GdkEvent* event, ArdourCanvas::Item*);
        bool track_canvas_scroll (GdkEventScroll* event);
 
+       bool track_canvas_scroll_event (GdkEventScroll* event);
+       bool track_canvas_button_press_event (GdkEventButton* event);
+       bool track_canvas_button_release_event (GdkEventButton* event);
+       bool track_canvas_motion_notify_event (GdkEventMotion* event);
+
        Gtk::Allocation canvas_allocation;
        bool canvas_idle_queued;
        void track_canvas_allocate (Gtk::Allocation alloc);
@@ -1243,6 +1263,7 @@ class Editor : public PublicEditor
        void marker_menu_hide ();
        void marker_menu_loop_range ();
        void marker_menu_select_all_selectables_using_range ();
+       void marker_menu_select_using_range ();
        void marker_menu_separate_regions_using_location ();
        void marker_menu_play_from ();
        void marker_menu_play_range ();
@@ -1277,10 +1298,17 @@ class Editor : public PublicEditor
        void remove_metric_marks ();
        void draw_metric_marks (const ARDOUR::Metrics& metrics);
 
-       void tempo_map_changed (ARDOUR::Change, bool immediate_redraw);
-       void redisplay_tempo ();
+       void tempo_map_changed (ARDOUR::Change);
+       void redisplay_tempo (bool immediate_redraw);
        
-       void snap_to (nframes_t& first, int32_t direction = 0, bool for_mark = false);
+       void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
+       void snap_to (nframes_t& first, int32_t direction = 0, bool for_mark = false) {
+               /* XXX remove this function when everything moves to 64 bit frame counts */
+               nframes64_t first64 = first;
+               snap_to (first64, direction, for_mark);
+               first = (nframes_t) first64;
+       }
+
        uint32_t bbt_beat_subdivision;
 
        /* toolbar */
@@ -1429,7 +1457,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 (nframes_t start, nframes_t end, gdouble topy, gdouble boty, Selection::Operation op);
+       bool select_all_within (nframes_t start, nframes_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op);
        
        ArdourCanvas::SimpleRect   *rubberband_rect;
        
@@ -1836,6 +1864,7 @@ class Editor : public PublicEditor
        Glib::RefPtr<Gtk::Action>              redo_action;
 
        void history_changed ();
+       void color_handler ();
 };
 
 #endif /* __ardour_editor_h__ */