Make summary display optional.
[ardour.git] / gtk2_ardour / editor.h
index 87e738fc7602dd8011f64cdc6f8b381399fa96e0..fcfcd4bdb9af853007ecc15536d508673a9f423d 100644 (file)
@@ -63,7 +63,7 @@
 #include "editor_items.h"
 #include "region_selection.h"
 #include "canvas.h"
-#include "draginfo.h"
+#include "editor_summary.h"
 
 namespace Gtkmm2ext {
        class TearOff;
@@ -98,6 +98,7 @@ class AutomationTimeAxisView;
 class BundleManager;
 class ControlPoint;
 class CrossfadeView;
+class Drag;
 class GlobalPortMatrixWindow;
 class GroupedButtons;
 class Marker;
@@ -124,6 +125,20 @@ class ImageFrameSocketHandler ;
 class TimeAxisViewItem ;
 /* </CMT Additions> */
 
+struct EditorCursor {
+       Editor&               editor;
+       ArdourCanvas::Points  points;
+       ArdourCanvas::Line    canvas_item;
+       nframes64_t           current_frame;
+       double            length;
+       
+       EditorCursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
+       ~EditorCursor ();
+       
+       void set_position (nframes64_t);
+       void set_length (double units);
+       void set_y_axis (double position);
+};
 
 class Editor : public PublicEditor
 {
@@ -137,8 +152,13 @@ class Editor : public PublicEditor
        virtual bool     have_idled () const { return _have_idled; }
 
        nframes64_t leftmost_position() const { return leftmost_frame; }
+
        nframes64_t current_page_frames() const {
-               return (nframes64_t) floor (canvas_width * frames_per_unit);
+               return (nframes64_t) floor (_canvas_width * frames_per_unit);
+       }
+       
+       double canvas_height () const {
+               return _canvas_height;
        }
 
        void cycle_snap_mode ();
@@ -184,11 +204,6 @@ class Editor : public PublicEditor
 
        /* option editor-access */
 
-       void set_show_waveforms (bool yn);
-       bool show_waveforms() const { return _show_waveforms; }
-
-       void set_waveform_scale (Editing::WaveformScale);
-
        void set_show_waveforms_recording (bool yn);
        bool show_waveforms_recording() const { return _show_waveforms_recording; }
        
@@ -324,9 +339,9 @@ class Editor : public PublicEditor
        bool follow_playhead() const { return _follow_playhead; }
        bool dragging_playhead () const { return _dragging_playhead; }
 
-       void toggle_waveform_visibility ();
        void toggle_zero_line_visibility ();
        void toggle_waveforms_while_recording ();
+       void set_summary ();
        void toggle_measure_visibility ();
        void toggle_logo_visibility ();
 
@@ -334,36 +349,12 @@ class Editor : public PublicEditor
        double physical_screen_width;
        double physical_screen_height;
 
-       /* SMPTE timecode & video sync */
-
-       void smpte_fps_chosen (ARDOUR::SmpteFormat format);
-       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_subframes_per_frame ();
-
        /* fades/xfades */
 
-       void toggle_region_fades ();
-       void toggle_region_fades_visible ();
        void toggle_selected_region_fades (int dir);
        void update_region_fade_visibility ();
-       void toggle_auto_xfade ();
-       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);
-
-       /* layers */
-       void set_layer_model (ARDOUR::LayerModel);
-       void update_layering_model ();
-       
-       void toggle_link_region_and_track_selection ();
-       void toggle_automation_follows_regions ();
 
        /* redirect shared ops menu. caller must free returned menu */
 
@@ -388,6 +379,7 @@ class Editor : public PublicEditor
        void restore_editing_space();
 
        void reset_x_origin (nframes64_t);
+       void reset_y_origin (double);
        void reset_zoom (double);
        void reposition_and_zoom (nframes64_t, double);
 
@@ -616,11 +608,10 @@ class Editor : public PublicEditor
 
        ArdourCanvas::Canvas* track_canvas;
 
-       ArdourCanvas::Text* first_action_message;
        ArdourCanvas::Text* verbose_canvas_cursor;
        bool                 verbose_cursor_visible;
 
-       void parameter_changed (const char *);
+       void parameter_changed (std::string);
        
        bool track_canvas_motion (GdkEvent*);
 
@@ -706,7 +697,6 @@ class Editor : public PublicEditor
        gint ruler_mouse_motion (GdkEventMotion*);
        bool ruler_scroll (GdkEventScroll* event);
 
-       gint          ruler_pressed_button;
        Gtk::Widget * ruler_grabbed_widget;
        
        void initialize_rulers ();
@@ -820,22 +810,9 @@ class Editor : public PublicEditor
        Gtk::VBox          time_button_vbox;
        Gtk::HBox          time_button_hbox;
 
-       struct Cursor {
-           Editor&               editor;
-           ArdourCanvas::Points  points;
-           ArdourCanvas::Line    canvas_item;
-           nframes64_t           current_frame;
-           double                length;
-
-           Cursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
-           ~Cursor ();
-
-           void set_position (nframes64_t);
-           void set_length (double units);
-           void set_y_axis (double position);
-       };
-
-       Cursor*              playhead_cursor;
+       friend class EditorCursor;
+       
+       EditorCursor*        playhead_cursor;
        ArdourCanvas::Group* cursor_group;
 
        nframes64_t get_region_boundary (nframes64_t pos, int32_t dir, bool with_selection, bool only_onscreen);
@@ -843,11 +820,11 @@ class Editor : public PublicEditor
        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    cursor_to_next_region_point (EditorCursor*, ARDOUR::RegionPoint);
+       void    cursor_to_previous_region_point (EditorCursor*, ARDOUR::RegionPoint);
+       void    cursor_to_region_point (EditorCursor*, ARDOUR::RegionPoint, int32_t dir);
+       void    cursor_to_selection_start (EditorCursor *);
+       void    cursor_to_selection_end   (EditorCursor *);
 
        void    selected_marker_to_region_boundary (bool with_selection, int32_t dir);
        void    selected_marker_to_next_region_boundary (bool with_selection);
@@ -858,7 +835,7 @@ class Editor : public PublicEditor
        void    selected_marker_to_selection_start ();
        void    selected_marker_to_selection_end   ();
 
-       void    select_all_selectables_using_cursor (Cursor *, bool);
+       void    select_all_selectables_using_cursor (EditorCursor *, bool);
        void    select_all_selectables_using_edit (bool);
        void    select_all_selectables_between (bool within);
        void    select_range_between ();
@@ -892,8 +869,8 @@ class Editor : public PublicEditor
        bool hscrollbar_button_release (GdkEventButton*);
        void hscrollbar_allocate (Gtk::Allocation &alloc);
 
-       double canvas_width;
-       double canvas_height;
+       double _canvas_width;
+       double _canvas_height;
        double full_canvas_height;
 
        bool track_canvas_map_handler (GdkEventAny*);
@@ -921,18 +898,18 @@ class Editor : public PublicEditor
        void tie_vertical_scrolling ();
        void scroll_canvas_horizontally ();
        void scroll_canvas_vertically ();
-       void canvas_horizontally_scrolled ();
-       void canvas_scroll_to (nframes64_t);
 
        struct VisualChange {
            enum Type { 
                    TimeOrigin = 0x1,
-                   ZoomLevel = 0x2
+                   ZoomLevel = 0x2,
+                   YOrigin = 0x4
            };
 
            Type pending;
            nframes64_t time_origin;
            double frames_per_unit;
+           double y_origin;
 
            int idle_handler_id;
 
@@ -947,6 +924,7 @@ class Editor : public PublicEditor
 
        void queue_visual_change (nframes64_t);
        void queue_visual_change (double);
+       void queue_visual_change_y (double);
 
        void end_location_changed (ARDOUR::Location*);
 
@@ -1079,7 +1057,7 @@ class Editor : public PublicEditor
        void named_selection_display_selection_changed ();
 
        /* track views */
-       TrackViewList  track_views;
+       TrackViewList track_views;
        std::pair<TimeAxisView*, ARDOUR::layer_t> trackview_by_y_position (double);
 
        static Gdk::Cursor* cross_hair_cursor;
@@ -1116,7 +1094,7 @@ class Editor : public PublicEditor
        bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
        bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
        bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
-       bool motion_handler (ArdourCanvas::Item*, GdkEvent*, ItemType, bool from_autoscroll = false);
+       bool motion_handler (ArdourCanvas::Item*, GdkEvent*, bool from_autoscroll = false);
        bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
        bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
        
@@ -1198,7 +1176,7 @@ class Editor : public PublicEditor
        void quantize_region ();
 
        void do_insert_time ();
-       void insert_time (nframes64_t pos, nframes64_t distance, Editing::InsertTimeOption opt, bool ignore_music_glue, bool markers_too);
+       void insert_time (nframes64_t, nframes64_t, Editing::InsertTimeOption, bool, bool, bool);
 
        void tab_to_transient (bool forward);
 
@@ -1390,7 +1368,6 @@ class Editor : public PublicEditor
        void start_scrolling ();
        void stop_scrolling ();
 
-       bool _scrubbing;
        double last_scrub_x;
        int scrubbing_direction;
        int scrub_reversals;
@@ -1417,27 +1394,13 @@ class Editor : public PublicEditor
 
        void    hide_all_tracks (bool with_select);
 
-       DragInfo drag_info;
-       LineDragInfo current_line_drag_info;
+       Drag* _drag;
 
-       void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0);
-       bool end_grab (ArdourCanvas::Item*, GdkEvent*);
-       void swap_grab (ArdourCanvas::Item*, Gdk::Cursor* cursor, uint32_t time);
        void break_drag ();
-       void finalize_drag ();
 
        Gtk::Menu fade_context_menu;
        void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
 
-       void region_gain_motion_callback (ArdourCanvas::Item*, GdkEvent*);
-
-       void start_fade_in_grab (ArdourCanvas::Item*, GdkEvent*);
-       void start_fade_out_grab (ArdourCanvas::Item*, GdkEvent*);
-       void fade_in_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
-       void fade_out_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
-       void fade_in_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
-       void fade_out_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
-
        void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape);
        void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape);
        
@@ -1448,51 +1411,20 @@ class Editor : public PublicEditor
        
        std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
        RegionSelection pre_drag_region_selection;
-       void region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
-       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**, 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*);
 
        bool _dragging_playhead;
        bool _dragging_edit_point;
 
-       void cursor_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
-       void cursor_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
-       void cursor_drag_finished_ensure_locate_callback (ArdourCanvas::Item*, GdkEvent*);
-       void marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
-       void marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
-       void control_point_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
-       void control_point_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
-       void line_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
-       void line_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
-
-       void tempo_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
-       void tempo_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
-       void meter_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
-       void meter_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
+       void marker_drag_motion_callback (GdkEvent*);
+       void marker_drag_finished_callback (GdkEvent*);
 
        gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
 
-       void start_region_grab (ArdourCanvas::Item*, GdkEvent*);
+       void start_region_grab (ArdourCanvas::Item*, GdkEvent*, RegionView*);
        void start_create_region_grab (ArdourCanvas::Item*, GdkEvent*);
-       void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*);
-       void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*);
+       void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*, RegionView*);
+       void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*, RegionView*);
        void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
-       void start_cursor_grab (ArdourCanvas::Item*, GdkEvent*);
-       void start_cursor_grab_no_stop (ArdourCanvas::Item*, GdkEvent*);
-       void start_marker_grab (ArdourCanvas::Item*, GdkEvent*);
-       void start_control_point_grab (ArdourCanvas::Item*, GdkEvent*);
-       void start_line_grab_from_regionview (ArdourCanvas::Item*, GdkEvent*);
-       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*);
 
@@ -1566,6 +1498,7 @@ public:
        Gtk::Allocation canvas_allocation;
        void track_canvas_allocate (Gtk::Allocation alloc);
        bool track_canvas_size_allocated ();
+       bool track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const &, int, int, guint);
 
        void set_playhead_cursor ();
 
@@ -1582,8 +1515,6 @@ public:
        /* display control */
        
        bool _show_measures;
-       /// true to show waveforms, otherwise false
-       bool _show_waveforms;
        /// true if the editor should follow the playhead, otherwise false
        bool _follow_playhead;
        /// true if waveforms should be shown while recording audio tracks, otherwise false
@@ -1788,16 +1719,6 @@ public:
        void point_selection_changed ();
        void marker_selection_changed ();
 
-       enum SelectionOp {
-               CreateSelection,
-               SelectionStartTrim,
-               SelectionEndTrim,
-               SelectionMove
-       } selection_op;
-
-       void start_selection_op (ArdourCanvas::Item* item, GdkEvent* event, SelectionOp);
-       void drag_selection (ArdourCanvas::Item* item, GdkEvent* event);
-       void end_selection_op (ArdourCanvas::Item* item, GdkEvent* event);
        void cancel_selection ();
 
        void region_selection_op (void (ARDOUR::Region::*pmf)(void));
@@ -1807,24 +1728,11 @@ public:
        bool audio_region_selection_covers (nframes64_t where);
 
        /* transport range select process */
-       enum RangeMarkerOp {
-               CreateRangeMarker,
-               CreateTransportMarker,
-               CreateCDMarker
-       } range_marker_op;
-
-       void start_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event, RangeMarkerOp);
-       void drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
-       void end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
 
        ArdourCanvas::SimpleRect*  cd_marker_bar_drag_rect;
        ArdourCanvas::SimpleRect*  range_bar_drag_rect;
        ArdourCanvas::SimpleRect*  transport_bar_drag_rect;
-       ArdourCanvas::Line*        marker_drag_line;
-       ArdourCanvas::Points       marker_drag_line_points;
-       ArdourCanvas::SimpleRect*  range_marker_drag_rect;
 
-       void update_marker_drag_item (ARDOUR::Location *);
 #ifdef GTKOSX
        ArdourCanvas::SimpleRect     *bogus_background_rect;
 #endif
@@ -1845,20 +1753,12 @@ public:
        
        /* object rubberband select process */
        
-       void start_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
-       void drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
-       void end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
-
        bool select_all_within (nframes64_t start, nframes64_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op);
        
        ArdourCanvas::SimpleRect   *rubberband_rect;
        
        /* mouse zoom process */
 
-       void start_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
-       void drag_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
-       void end_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
-
        ArdourCanvas::SimpleRect   *zoom_rect;
        void reposition_zoom_rect (nframes64_t start, nframes64_t end);
        
@@ -1983,25 +1883,15 @@ public:
        bool autoscroll_canvas ();
        void start_canvas_autoscroll (int x, int y);
        void stop_canvas_autoscroll ();
-       void maybe_autoscroll (GdkEventMotion*);
-       void maybe_autoscroll_horizontally (GdkEventMotion*);
+       void maybe_autoscroll (GdkEventMotion*, bool);
        bool allow_vertical_scroll;
 
        /* trimming */
-       enum TrimOp {
-               StartTrim,
-               EndTrim,
-               ContentsTrim,
-       } trim_op;
-
-       void start_trim (ArdourCanvas::Item*, GdkEvent*);
        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, 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);
 
        void trim_region_front();
@@ -2126,16 +2016,12 @@ public:
 
        void duplicate_dialog (bool with_dialog);
        
-       nframes64_t event_frame (GdkEvent*, double* px = 0, double* py = 0) const;
+       nframes64_t event_frame (GdkEvent const *, double* px = 0, double* py = 0) const;
 
        /* returns false if mouse pointer is not in track or marker canvas
         */
        bool mouse_frame (nframes64_t&, bool& in_track_canvas) const;
 
-       void time_fx_motion (ArdourCanvas::Item*, GdkEvent*);
-       void start_time_fx (ArdourCanvas::Item*, GdkEvent*);
-       void end_time_fx (ArdourCanvas::Item*, GdkEvent*);
-
        /* "whats mine is yours" */
 
        TimeFXDialog* current_timefx;
@@ -2326,7 +2212,6 @@ public:
 
        void remove_tracks ();
        void toggle_tracks_active ();
-       void waveform_scale_chosen (Editing::WaveformScale);
 
        bool _have_idled;
        int resize_idle_id;
@@ -2336,10 +2221,41 @@ public:
        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;
+
+       EditorSummary* _summary;
+       void region_view_added (RegionView *);
+
+       void update_canvas_now ();
+       void streamview_height_changed ();
+
+       friend class Drag;
+       friend class RegionDrag;
+       friend class RegionMoveDrag;
+       friend class RegionSpliceDrag;
+       friend class TrimDrag;
+       friend class MeterMarkerDrag;
+       friend class TempoMarkerDrag;
+       friend class CursorDrag;
+       friend class FadeInDrag;
+       friend class FadeOutDrag;
+       friend class MarkerDrag;
+       friend class RegionGainDrag;
+       friend class ControlPointDrag;
+       friend class LineDrag;
+       friend class RubberbandSelectDrag;
+        friend class TimeFXDrag;
+        friend class ScrubDrag;
+       friend class SelectionDrag;
+       friend class RangeMarkerBarDrag;
+       friend class MouseZoomDrag;
+       friend class RegionCreateDrag;
+       friend class RegionMotionDrag;
+       friend class RegionInsertDrag;
+
+       friend class EditorSummary;
 };
 
 #endif /* __ardour_editor_h__ */