X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Feditor.h;h=2da7650ce5c12fa7fa830d79621c4e62e26cd790;hb=05caa9caa1ace0cfa029f034345eb1a0602b86a4;hp=7c681cfaf3250dc0b277fa8b47ab62fa76981da7;hpb=7629120cda89dd4ec1b03ba4ddcc6f5dd1b0ca5a;p=ardour.git diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 7c681cfaf3..2da7650ce5 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -25,16 +25,10 @@ #include #include #include +#include #include -#include -#include -#include -#include - -#include - #include #include @@ -52,6 +46,8 @@ #include "ardour/location.h" #include "ardour/types.h" +#include "canvas/fwd.h" + #include "gtk-custom-ruler.h" #include "ardour_button.h" #include "ardour_dialog.h" @@ -60,13 +56,8 @@ #include "enums.h" #include "editor_items.h" #include "region_selection.h" -#include "canvas.h" #include "window_proxy.h" -namespace Gnome { namespace Canvas { - class NoEventText; -} } - namespace Gtkmm2ext { class TearOff; class Bindings; @@ -80,10 +71,8 @@ namespace ARDOUR { class Region; class Location; class TempoSection; - class NamedSelection; class Session; class Filter; - class Crossfade; class ChanCount; class MidiOperator; class Track; @@ -104,14 +93,15 @@ class AutomationLine; class AutomationSelection; class AutomationTimeAxisView; class BundleManager; +class ButtonJoiner; class ControlPoint; -class CrossfadeView; class DragManager; class GroupedButtons; class GUIObjectState; class Marker; class MidiRegionView; class MixerStrip; +class NoteBase; class PlaylistSelector; class PluginSelector; class RhythmFerret; @@ -157,18 +147,23 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void first_idle (); virtual bool have_idled () const { return _have_idled; } - framepos_t leftmost_position() const { return leftmost_frame; } + framepos_t leftmost_sample() const { return leftmost_frame; } - framecnt_t current_page_frames() const { - return (framecnt_t) floor (_canvas_width * frames_per_unit); + framecnt_t current_page_samples() const { + return (framecnt_t) floor (_visible_canvas_width * samples_per_pixel); } - double canvas_height () const { - return _canvas_height; + double visible_canvas_height () const { + return _visible_canvas_height; } void cycle_snap_mode (); - void cycle_snap_choice (); + void next_snap_choice (); + void next_snap_choice_music_only (); + void next_snap_choice_music_and_time (); + void prev_snap_choice (); + void prev_snap_choice_music_only (); + void prev_snap_choice_music_and_time (); void set_snap_to (Editing::SnapType); void set_snap_mode (Editing::SnapMode); void set_snap_threshold (double pixel_distance) {snap_threshold = pixel_distance;} @@ -225,28 +220,12 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void separate_regions_using_location (ARDOUR::Location&); void transition_to_rolling (bool forward); - /* undo related */ - - framepos_t unit_to_frame (double unit) const { - return (framepos_t) rint (unit * frames_per_unit); - } - - double frame_to_unit (framepos_t frame) const { - return rint ((double) frame / (double) frames_per_unit); - } - - double frame_to_unit (double frame) const { - return rint (frame / frames_per_unit); - } - /* NOTE: these functions assume that the "pixel" coordinate is - the result of using the world->canvas affine transform on a - world coordinate. These coordinates already take into - account any scrolling carried out by adjusting the - xscroll_adjustment. + in canvas coordinates. These coordinates already take into + account any scrolling offsets. */ - framepos_t pixel_to_frame (double pixel) const { + framepos_t pixel_to_sample (double pixel) const { /* pixel can be less than zero when motion events are processed. since we've already run the world->canvas @@ -255,17 +234,19 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD */ if (pixel >= 0) { - return (framepos_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit); + return (framepos_t) rint (pixel * samples_per_pixel); } else { return 0; } } - gulong frame_to_pixel (framepos_t frame) const { - return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit))); + double sample_to_pixel (framepos_t sample) const { + return rint (sample / samples_per_pixel); } - void flush_canvas (); + double sample_to_pixel_unrounded (framepos_t sample) const { + return sample / samples_per_pixel; + } /* selection */ @@ -276,6 +257,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD bool extend_selection_to_track (TimeAxisView&); void play_selection (); + framepos_t get_preroll (); + void maybe_locate_with_edit_preroll (framepos_t); + void play_with_preroll (); void select_all_in_track (Selection::Operation op); void select_all (Selection::Operation op); void invert_selection_in_track (); @@ -308,10 +292,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD 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 samples_per_pixel; } + void cycle_zoom_focus (); void temporal_zoom_step (bool coarser); void tav_zoom_step (bool coarser); + void tav_zoom_smooth (bool coarser, bool force_all); /* stuff that AudioTimeAxisView and related classes use */ @@ -363,12 +348,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void toggle_measure_visibility (); void toggle_logo_visibility (); - /* fades/xfades */ + /* fades */ void toggle_region_fades (int dir); void update_region_fade_visibility (); - bool xfade_visibility() const { return _xfade_visibility; } - void update_xfade_visibility (); /* redirect shared ops menu. caller must free returned menu */ @@ -390,6 +373,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void maximise_editing_space(); void restore_editing_space(); + void update_tearoff_visibility(); + void reset_x_origin (framepos_t); void reset_x_origin_to_follow_playhead (); void reset_y_origin (double); @@ -421,7 +406,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void do_import (std::vector paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, framepos_t&); void do_embed (std::vector paths, Editing::ImportDisposition, Editing::ImportMode mode, framepos_t&); - void get_regions_corresponding_to (boost::shared_ptr region, std::vector& regions); + void get_regions_corresponding_to (boost::shared_ptr region, std::vector& regions, bool src_comparison); void center_screen (framepos_t); @@ -456,8 +441,21 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD return _verbose_cursor; } + double clamp_verbose_cursor_x (double); + double clamp_verbose_cursor_y (double); + void get_pointer_position (double &, double &) const; + TimeAxisView* stepping_axis_view () { + return _stepping_axis_view; + } + + void set_stepping_axis_view (TimeAxisView* v) { + _stepping_axis_view = v; + } + + void save_canvas_state (); + protected: void map_transport_state (); void map_position_change (framepos_t); @@ -478,10 +476,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD typedef std::pair TAVState; struct VisualState { - VisualState(); + VisualState (bool with_tracks); ~VisualState (); double y_position; - double frames_per_unit; + double samples_per_pixel; framepos_t leftmost_frame; Editing::ZoomFocus zoom_focus; GUIObjectState* gui_state; @@ -497,20 +495,22 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void swap_visual_state (); std::vector visual_states; - sigc::connection visual_state_op_connection; void start_visual_state_op (uint32_t n); void cancel_visual_state_op (uint32_t n); - bool end_visual_state_op (uint32_t n); framepos_t leftmost_frame; - double frames_per_unit; + double samples_per_pixel; Editing::ZoomFocus zoom_focus; - void set_frames_per_unit (double); - void post_zoom (); + void set_samples_per_pixel (double); + bool clamp_samples_per_pixel (double &) const; 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; @@ -610,6 +610,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void hide_marker (ArdourCanvas::Item*, GdkEvent*); void clear_marker_display (); void mouse_add_new_marker (framepos_t where, bool is_cd=false, bool is_xrun=false); + void mouse_add_new_range (framepos_t); bool choose_new_marker_name(std::string &name); void update_cd_marker_display (); void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location); @@ -623,7 +624,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD RegionView* clicked_regionview; RegionSelection latest_regionviews; uint32_t clicked_selection; - CrossfadeView* clicked_crossfadeview; ControlPoint* clicked_control_point; void sort_track_selection (TrackViewList&); @@ -634,14 +634,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void mapover_tracks_with_unique_playlists (sigc::slot sl, TimeAxisView*, PBD::PropertyID) const; /* functions to be passed to mapover_tracks(), possibly with sigc::bind()-supplied arguments */ - void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView *, std::vector*) const; void mapped_use_new_playlist (RouteTimeAxisView&, uint32_t, std::vector > const &); void mapped_use_copy_playlist (RouteTimeAxisView&, uint32_t, std::vector > const &); void mapped_clear_playlist (RouteTimeAxisView&, uint32_t); - - /* end */ - + void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type); bool button_release_can_deselect; @@ -651,7 +648,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void select_all_tracks (); void select_all_internal_edit (Selection::Operation); - bool set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool no_remove=false); + bool set_selected_control_point_from_click (bool press, Selection::Operation op = Selection::Set); void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false); void set_selected_track_as_side_effect (Selection::Operation op); bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set); @@ -663,7 +660,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD Gtk::Menu track_context_menu; Gtk::Menu track_region_context_menu; Gtk::Menu track_selection_context_menu; - Gtk::Menu track_crossfade_context_menu; Gtk::MenuItem* region_edit_menu_split_item; Gtk::MenuItem* region_edit_menu_split_multichannel_item; @@ -677,19 +673,17 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD Gtk::Menu* build_track_context_menu (); Gtk::Menu* build_track_bus_context_menu (); Gtk::Menu* build_track_region_context_menu (); - Gtk::Menu* build_track_crossfade_context_menu (); Gtk::Menu* build_track_selection_context_menu (); void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&); void add_bus_context_items (Gtk::Menu_Helpers::MenuList&); void add_region_context_items (Gtk::Menu_Helpers::MenuList&, boost::shared_ptr); - void add_crossfade_context_items (AudioStreamView*, boost::shared_ptr, Gtk::Menu_Helpers::MenuList&, bool many); void add_selection_context_items (Gtk::Menu_Helpers::MenuList&); Gtk::MenuItem* _popup_region_menu_item; void popup_control_point_context_menu (ArdourCanvas::Item *, GdkEvent *); Gtk::Menu _control_point_context_menu; - void handle_new_route (ARDOUR::RouteList&); + void add_routes (ARDOUR::RouteList&); void timeaxisview_deleted (TimeAxisView *); Gtk::HBox global_hpacker; @@ -700,7 +694,14 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD Gdk::Cursor* which_grabber_cursor (); void set_canvas_cursor (); - ArdourCanvas::Canvas* track_canvas; + ArdourCanvas::GtkCanvas* _track_canvas; + ArdourCanvas::GtkCanvasViewport* _track_canvas_viewport; + + ArdourCanvas::GtkCanvas* _time_bars_canvas; + ArdourCanvas::GtkCanvasViewport* _time_bars_canvas_viewport; + Gtk::Adjustment* _time_bars_canvas_vadj; + + bool within_track_canvas; friend class VerboseCursor; VerboseCursor* _verbose_cursor; @@ -710,8 +711,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD bool track_canvas_motion (GdkEvent*); Gtk::EventBox time_canvas_event_box; - Gtk::EventBox track_canvas_event_box; - Gtk::EventBox time_button_event_box; + Gtk::EventBox time_bars_event_box; Gtk::EventBox ruler_label_event_box; ArdourCanvas::Group *minsec_group; @@ -726,9 +726,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD ArdourCanvas::Group *transport_marker_group; ArdourCanvas::Group* cd_marker_group; - ArdourCanvas::Group* timebar_group; + /* parent for groups which themselves contain time markers */ + ArdourCanvas::Group* _time_markers_group; - /* These bars never need to be scrolled */ ArdourCanvas::Group* meter_bar_group; ArdourCanvas::Group* tempo_bar_group; ArdourCanvas::Group* marker_bar_group; @@ -764,6 +764,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD ruler_time_range_marker = 7, ruler_time_transport_marker = 8, ruler_time_cd_marker = 9, + ruler_video_timeline = 10, }; static GtkCustomMetric ruler_metrics[4]; @@ -790,7 +791,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void update_just_timecode (); void compute_fixed_ruler_scale (); //calculates the RulerScale of the fixed rulers void update_fixed_rulers (); - void update_tempo_based_rulers (); + void update_tempo_based_rulers (ARDOUR::TempoMap::BBTPointList::const_iterator& begin, + ARDOUR::TempoMap::BBTPointList::const_iterator& end); void popup_ruler_menu (framepos_t where = 0, ItemType type = RegionItem); void update_ruler_visibility (); void set_ruler_visible (RulerType, bool); @@ -854,7 +856,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD gint bbt_nmarks; uint32_t bbt_bar_helper_on; uint32_t bbt_accent_modulo; - void compute_bbt_ruler_scale (framepos_t lower, framepos_t upper); + void compute_bbt_ruler_scale (framepos_t lower, framepos_t upper, + ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_begin, + ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_end); gint metric_get_timecode (GtkCustomRulerMark **, gdouble, gdouble, gint); gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint); @@ -874,16 +878,14 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD static const double timebar_height; guint32 visible_timebars; - gdouble canvas_timebars_vsize; - gdouble get_canvas_timebars_vsize () const { return canvas_timebars_vsize; } Gtk::Menu *editor_ruler_menu; - ArdourCanvas::SimpleRect* tempo_bar; - ArdourCanvas::SimpleRect* meter_bar; - ArdourCanvas::SimpleRect* marker_bar; - ArdourCanvas::SimpleRect* range_marker_bar; - ArdourCanvas::SimpleRect* transport_marker_bar; - ArdourCanvas::SimpleRect* cd_marker_bar; + ArdourCanvas::Rectangle* tempo_bar; + ArdourCanvas::Rectangle* meter_bar; + ArdourCanvas::Rectangle* marker_bar; + ArdourCanvas::Rectangle* range_marker_bar; + ArdourCanvas::Rectangle* transport_marker_bar; + ArdourCanvas::Rectangle* cd_marker_bar; Gtk::Label minsec_label; Gtk::Label bbt_label; @@ -896,13 +898,36 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD Gtk::Label transport_mark_label; Gtk::Label cd_mark_label; - Gtk::VBox time_button_vbox; - Gtk::HBox time_button_hbox; + /* videtimline related actions */ + ArdourCanvas::Rectangle* videotl_bar; + Gtk::Label videotl_label; + ArdourCanvas::Group* videotl_bar_group; + ArdourCanvas::Group* videotl_group; + Glib::RefPtr ruler_video_action; + Glib::RefPtr xjadeo_proc_action; + Glib::RefPtr xjadeo_ontop_action; + Glib::RefPtr xjadeo_timecode_action; + Glib::RefPtr xjadeo_frame_action; + Glib::RefPtr xjadeo_osdbg_action; + Glib::RefPtr xjadeo_fullscreen_action; + Glib::RefPtr xjadeo_letterbox_action; + Glib::RefPtr xjadeo_zoom_100; + void set_xjadeo_proc (); + void toggle_xjadeo_proc (int state=-1); + void set_xjadeo_sensitive (bool onoff); + void set_xjadeo_viewoption (int); + void toggle_xjadeo_viewoption (int what, int state=-1); + void toggle_ruler_video (bool onoff) {ruler_video_action->set_active(onoff);} + int videotl_bar_height; /* in units of timebar_height; default: 4 */ + int get_videotl_bar_height () const { return videotl_bar_height; } + void export_video (); + void toggle_region_video_lock (); + + Gtk::VBox time_bars_vbox; friend class EditorCursor; EditorCursor* playhead_cursor; - ArdourCanvas::Group* cursor_group; framepos_t get_region_boundary (framepos_t pos, int32_t dir, bool with_selection, bool only_onscreen); @@ -940,8 +965,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD Gtk::Table edit_packer; + /** the adjustment that controls the overall editor vertical scroll position */ Gtk::Adjustment vertical_adjustment; + Gtk::Adjustment horizontal_adjustment; + Gtk::Adjustment unused_adjustment; // yes, really; Gtk::Layout constructor requires refs Gtk::Layout controls_layout; bool control_layout_scroll (GdkEventScroll* ev); void reset_controls_layout_width (); @@ -959,9 +987,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD sigc::connection _scroll_connection; int _scroll_callbacks; - double _canvas_width; - double _canvas_height; ///< height of the visible area of the track canvas - double full_canvas_height; ///< full height of the canvas + double _visible_canvas_width; + double _visible_canvas_height; ///< height of the visible area of the track canvas + double _full_canvas_height; ///< full height of the canvas bool track_canvas_map_handler (GdkEventAny*); @@ -975,21 +1003,27 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD Gtk::VBox edit_controls_vbox; Gtk::HBox edit_controls_hbox; + void control_vertical_zoom_in_all (); + void control_vertical_zoom_out_all (); + void control_vertical_zoom_in_selected (); + void control_vertical_zoom_out_selected (); + void control_step_tracks_up (); + void control_step_tracks_down (); + void control_view (uint32_t); void control_scroll (float); - void control_select (uint32_t rid); + void control_select (uint32_t rid, Selection::Operation); + void control_unselect (); void access_action (std::string,std::string); bool deferred_control_scroll (framepos_t); sigc::connection control_scroll_connection; - gdouble get_trackview_group_vertical_offset () const { return vertical_adjustment.get_value () - canvas_timebars_vsize;} + gdouble get_trackview_group_vertical_offset () const { return vertical_adjustment.get_value (); } ArdourCanvas::Group* get_background_group () const { return _background_group; } ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; } - double last_trackview_group_vertical_offset; void tie_vertical_scrolling (); void set_horizontal_position (double); double horizontal_position () const; - void scroll_canvas_vertically (); struct VisualChange { enum Type { @@ -1000,26 +1034,23 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD Type pending; framepos_t time_origin; - double frames_per_unit; + double samples_per_pixel; double y_origin; int idle_handler_id; + /** true if we are currently in the idle handler */ + bool being_handled; - VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1) {} + VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), samples_per_pixel (0), idle_handler_id (-1), being_handled (false) {} void add (Type t) { pending = Type (pending | t); } }; - VisualChange pending_visual_change; static int _idle_visual_changer (void *arg); int idle_visual_changer (); - - void queue_visual_change (framepos_t); - void queue_visual_change (double); - void queue_visual_change_y (double); void ensure_visual_change_idle_handler (); /* track views */ @@ -1188,8 +1219,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void temporal_zoom_region (bool both_axes); void zoom_to_region (bool both_axes); void temporal_zoom_session (); - void temporal_zoom (gdouble scale); - void temporal_zoom_by_frame (framepos_t start, framepos_t end, const std::string & op); + void temporal_zoom (double scale); + void temporal_zoom_by_frame (framepos_t start, framepos_t end); void temporal_zoom_to_frame (bool coarser, framepos_t frame); void insert_region_list_drag (boost::shared_ptr, int x, int y); @@ -1210,8 +1241,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void bring_in_external_audio (Editing::ImportMode mode, framepos_t& pos); - bool idle_drop_paths (std::vector paths, framepos_t frame, double ypos); - void drop_paths_part_two (const std::vector& paths, framepos_t frame, double ypos); + bool idle_drop_paths (std::vector paths, framepos_t frame, double ypos, bool copy); + void drop_paths_part_two (const std::vector& paths, framepos_t frame, double ypos, bool copy); int import_sndfiles (std::vector paths, Editing::ImportMode mode, ARDOUR::SrcQuality, framepos_t& pos, int target_regions, int target_tracks, boost::shared_ptr&, bool); @@ -1226,6 +1257,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD boost::shared_ptr get_nth_selected_audio_track (int nth) const; boost::shared_ptr get_nth_selected_midi_track (int nth) const; + void toggle_midi_input_active (bool flip_others); + ARDOUR::InterThreadInfo* current_interthread_info; AnalysisWindow* analysis_window; @@ -1330,6 +1363,12 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD Gtk::Menu fade_context_menu; void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType); + Gtk::Menu xfade_in_context_menu; + Gtk::Menu xfade_out_context_menu; + void popup_xfade_in_context_menu (int, int, ArdourCanvas::Item*, ItemType); + void popup_xfade_out_context_menu (int, int, ArdourCanvas::Item*, ItemType); + void fill_xfade_menu (Gtk::Menu_Helpers::MenuList& items, bool start); + void set_fade_in_shape (ARDOUR::FadeShape); void set_fade_out_shape (ARDOUR::FadeShape); @@ -1367,7 +1406,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*); bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*); bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*); - bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*); + bool canvas_start_xfade_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*); + bool canvas_end_xfade_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*); bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*); bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*); bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*); @@ -1382,8 +1422,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD 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*) ; - bool canvas_note_event (GdkEvent* event, ArdourCanvas::Item*); + bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*); + bool canvas_note_event (GdkEvent* event, ArdourCanvas::Item *); bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*); bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*); @@ -1392,6 +1432,15 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*); bool canvas_cd_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*); + bool canvas_videotl_bar_event (GdkEvent* event, ArdourCanvas::Item*); + void update_video_timeline (bool flush = false); + void set_video_timeline_height (const int); + bool is_video_timeline_locked (); + void toggle_video_timeline_locked (); + void set_video_timeline_locked (const bool); + void queue_visual_videotimeline_update (); + void embed_audio_from_video (std::string, framepos_t n = 0); + bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*); bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*); bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*); @@ -1422,9 +1471,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD bool track_canvas_button_release_event (GdkEventButton* event); bool track_canvas_motion_notify_event (GdkEventMotion* event); - Gtk::Allocation canvas_allocation; - void track_canvas_allocate (Gtk::Allocation alloc); - bool track_canvas_size_allocated (); + Gtk::Allocation _canvas_viewport_allocation; + void track_canvas_viewport_allocate (Gtk::Allocation alloc); + bool track_canvas_viewport_size_allocated (); bool track_canvas_drag_motion (Glib::RefPtr const &, int, int, guint); bool track_canvas_key_press (GdkEventKey *); bool track_canvas_key_release (GdkEventKey *); @@ -1445,15 +1494,13 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD /// true if we are in fullscreen mode bool _maximised; - ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_begin; - ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_end; - TempoLines* tempo_lines; ArdourCanvas::Group* time_line_group; void hide_measures (); - void draw_measures (); + void draw_measures (ARDOUR::TempoMap::BBTPointList::const_iterator& begin, + ARDOUR::TempoMap::BBTPointList::const_iterator& end); bool redraw_measures (); void new_tempo_section (); @@ -1471,7 +1518,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void edit_tempo_marker (ArdourCanvas::Item*); void edit_meter_marker (ArdourCanvas::Item*); void edit_control_point (ArdourCanvas::Item*); - void edit_note (ArdourCanvas::Item *); + void edit_notes (std::set const & s); void marker_menu_edit (); void marker_menu_remove (); @@ -1487,8 +1534,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void marker_menu_play_range (); void marker_menu_set_playhead (); void marker_menu_set_from_playhead (); - void marker_menu_set_from_selection (); + void marker_menu_set_from_selection (bool force_regions); void marker_menu_range_to_next (); + void marker_menu_zoom_to_range (); void new_transport_marker_menu_set_loop (); void new_transport_marker_menu_set_punch (); void update_loop_range_view (bool visibility=false); @@ -1517,7 +1565,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void remove_metric_marks (); void draw_metric_marks (const ARDOUR::Metrics& metrics); - void compute_current_bbt_points (framepos_t left, framepos_t right); + void compute_current_bbt_points (framepos_t left, framepos_t right, + ARDOUR::TempoMap::BBTPointList::const_iterator& begin, + ARDOUR::TempoMap::BBTPointList::const_iterator& end); + void tempo_map_changed (const PBD::PropertyChange&); void redisplay_tempo (bool immediate_redraw); @@ -1531,12 +1582,13 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void editor_list_button_toggled (); AudioClock* zoom_range_clock; + ArdourButton zoom_in_button; ArdourButton zoom_out_button; ArdourButton zoom_out_full_button; - Gtk::Button tav_expand_button; - Gtk::Button tav_shrink_button; + ArdourButton tav_expand_button; + ArdourButton tav_shrink_button; Gtk::VBox toolbar_clock_vbox; Gtk::VBox toolbar_selection_clock_vbox; @@ -1551,10 +1603,12 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD ArdourButton mouse_zoom_button; ArdourButton mouse_timefx_button; ArdourButton mouse_audition_button; - ArdourButton join_object_range_button; + + ArdourButton smart_mode_button; + Glib::RefPtr smart_mode_action; void mouse_mode_toggled (Editing::MouseMode m); - void mouse_mode_object_range_toggled () {} + void mouse_mode_object_range_toggled (); bool ignore_mouse_mode_toggle; ArdourButton internal_edit_button; @@ -1640,27 +1694,30 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void marker_selection_changed (); void cancel_selection (); + void cancel_time_selection (); + + bool get_smart_mode() const; bool audio_region_selection_covers (framepos_t where); /* transport range select process */ - ArdourCanvas::SimpleRect* cd_marker_bar_drag_rect; - ArdourCanvas::SimpleRect* range_bar_drag_rect; - ArdourCanvas::SimpleRect* transport_bar_drag_rect; + ArdourCanvas::Rectangle* cd_marker_bar_drag_rect; + ArdourCanvas::Rectangle* range_bar_drag_rect; + ArdourCanvas::Rectangle* transport_bar_drag_rect; #ifdef GTKOSX - ArdourCanvas::SimpleRect *bogus_background_rect; + ArdourCanvas::Rectangle *bogus_background_rect; #endif - ArdourCanvas::SimpleRect *transport_bar_range_rect; - ArdourCanvas::SimpleRect *transport_bar_preroll_rect; - ArdourCanvas::SimpleRect *transport_bar_postroll_rect; - ArdourCanvas::SimpleRect *transport_loop_range_rect; - ArdourCanvas::SimpleRect *transport_punch_range_rect; - ArdourCanvas::SimpleLine *transport_punchin_line; - ArdourCanvas::SimpleLine *transport_punchout_line; - ArdourCanvas::SimpleRect *transport_preroll_rect; - ArdourCanvas::SimpleRect *transport_postroll_rect; + ArdourCanvas::Rectangle *transport_bar_range_rect; + ArdourCanvas::Rectangle *transport_bar_preroll_rect; + ArdourCanvas::Rectangle *transport_bar_postroll_rect; + ArdourCanvas::Rectangle *transport_loop_range_rect; + ArdourCanvas::Rectangle *transport_punch_range_rect; + ArdourCanvas::Line *transport_punchin_line; + ArdourCanvas::Line *transport_punchout_line; + ArdourCanvas::Rectangle *transport_preroll_rect; + ArdourCanvas::Rectangle *transport_postroll_rect; ARDOUR::Location* transport_loop_location(); ARDOUR::Location* transport_punch_location(); @@ -1671,11 +1728,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void select_all_within (framepos_t, framepos_t, double, double, TrackViewList const &, Selection::Operation, bool); - ArdourCanvas::SimpleRect *rubberband_rect; + ArdourCanvas::Rectangle *rubberband_rect; /* mouse zoom process */ - ArdourCanvas::SimpleRect *zoom_rect; + ArdourCanvas::Rectangle *zoom_rect; void reposition_zoom_rect (framepos_t start, framepos_t end); EditorRouteGroups* _route_groups; @@ -1792,14 +1849,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void update_title (); void update_title_s (const std::string & snapshot_name); - struct State { - Selection* selection; - double frames_per_unit; - - State (PublicEditor const * e); - ~State (); - }; - void instant_save (); boost::shared_ptr last_audition_region; @@ -1815,20 +1864,25 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD /* duplication */ - void duplicate_dialog (bool with_dialog); + void duplicate_range (bool with_dialog); + + /** computes the timeline frame (sample) of an event whose coordinates + * are in canvas units (pixels, scroll offset included). + */ + framepos_t canvas_event_frame (GdkEvent const *, double* px = 0, double* py = 0) const; - framepos_t event_frame (GdkEvent const *, double* px = 0, double* py = 0) const; + /** computes the timeline frame (sample) of an event whose coordinates + * are in window units (pixels, no scroll offset). + */ + framepos_t window_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 (framepos_t&, bool& in_track_canvas) const; - /* "whats mine is yours" */ - TimeFXDialog* current_timefx; - static void* timefx_thread (void *arg); - void do_timefx (TimeFXDialog&); + void do_timefx (); int time_stretch (RegionSelection&, float fraction); int pitch_shift (RegionSelection&, float cents); @@ -1853,10 +1907,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void nudge_track (bool use_edit_point, bool forwards); - /* xfades */ - - bool _xfade_visibility; - #ifdef WITH_CMT void handle_new_imageframe_time_axis_view(const std::string & track_name, void* src) ; void handle_new_imageframe_marker_time_axis_view(const std::string & track_name, TimeAxisView* marked_track) ; @@ -1898,19 +1948,13 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD ImageFrameSocketHandler* image_socket_listener ; #endif - void toggle_xfade_active (boost::weak_ptr); - void toggle_xfade_length (boost::weak_ptr); - void edit_xfade (boost::weak_ptr); - void xfade_edit_left_region (); - void xfade_edit_right_region (); - static const int32_t default_width = 995; static const int32_t default_height = 765; /* nudge */ - Gtk::Button nudge_forward_button; - Gtk::Button nudge_backward_button; + ArdourButton nudge_forward_button; + ArdourButton nudge_backward_button; Gtk::HBox nudge_hbox; Gtk::VBox nudge_vbox; AudioClock* nudge_clock; @@ -1944,8 +1988,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD */ RegionView* entered_regionview; - - void ensure_entered_track_selected (bool op_acts_on_objects = false); bool clear_entered_track; bool left_track_canvas (GdkEventCrossing*); bool entered_track_canvas (GdkEventCrossing*); @@ -1955,7 +1997,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD gint left_automation_track (); void reset_canvas_action_sensitivity (bool); - void toggle_gain_envelope_visibility (); + void set_gain_envelope_visibility (); + void set_region_gain_visibility (RegionView*); void toggle_gain_envelope_active (); void reset_region_gain_envelopes (); @@ -1990,7 +2033,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void get_regions_at (RegionSelection&, framepos_t where, const TrackViewList& ts) const; void get_regions_after (RegionSelection&, framepos_t where, const TrackViewList& ts) const; - RegionSelection get_regions_from_selection (); RegionSelection get_regions_from_selection_and_edit_point (); RegionSelection get_regions_from_selection_and_entered (); @@ -2039,8 +2081,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void region_view_added (RegionView *); void region_view_removed (); - void update_canvas_now (); - EditorGroupTabs* _group_tabs; void fit_route_group (ARDOUR::RouteGroup *); @@ -2068,6 +2108,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void setup_fade_images (); std::map _fade_in_images; std::map _fade_out_images; + std::map _xfade_in_images; + std::map _xfade_out_images; Gtk::MenuItem& action_menu_item (std::string const &); void action_pre_activated (Glib::RefPtr const &); @@ -2081,15 +2123,21 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD int time_fx (ARDOUR::RegionList&, float val, bool pitching); - bool doing_range_stuff() const { - return (mouse_mode == Editing::MouseRange && (_join_object_range_state == JOIN_OBJECT_RANGE_NONE)) || - _join_object_range_state == JOIN_OBJECT_RANGE_RANGE; - } - - bool doing_object_stuff() const { - return (mouse_mode == Editing::MouseObject && (_join_object_range_state == JOIN_OBJECT_RANGE_NONE)) || - _join_object_range_state == JOIN_OBJECT_RANGE_OBJECT; - } + void toggle_sound_midi_notes (); + + /** Flag for a bit of a hack wrt control point selection; see set_selected_control_point_from_click */ + bool _control_point_toggled_on_press; + + /** This is used by TimeAxisView to keep a track of the TimeAxisView that is currently being + stepped in height using Shift-Scrollwheel. When a scroll event occurs, we do the step on + this _stepping_axis_view if it is non-0 (and we set up this _stepping_axis_view with the + TimeAxisView underneath the mouse if it is 0). Then Editor resets _stepping_axis_view when + the shift key is released. In this (hacky) way, pushing shift and moving the scroll wheel + will operate on the same track until shift is released (rather than skipping about to whatever + happens to be underneath the mouse at the time). + */ + TimeAxisView* _stepping_axis_view; + void shift_key_released (); friend class Drag; friend class RegionDrag; @@ -2115,6 +2163,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD friend class RegionCreateDrag; friend class RegionMotionDrag; friend class RegionInsertDrag; + friend class VideoTimeLineDrag; friend class EditorSummary; friend class EditorGroupTabs;