X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Feditor.h;h=ca4a3ec87a977fe9ff5a01354288af66b8be872e;hb=0b55529ec42c7130421ba37f0762cec83e1e4df3;hp=553f4c7e7e1752f98f82a95ba8121a5c87faf0a0;hpb=efab36a85e4a462716f2d7f4d0f12a12e45b4a75;p=ardour.git diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 553f4c7e7e..ca4a3ec87a 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -63,9 +63,12 @@ #include "canvas.h" #include "window_proxy.h" -namespace Gnome { namespace Canvas { - class NoEventText; -} } +namespace Gnome { + namespace Canvas { + class NoEventText; + class CanvasNoteEvent; + } +} namespace Gtkmm2ext { class TearOff; @@ -80,10 +83,8 @@ namespace ARDOUR { class Region; class Location; class TempoSection; - class NamedSelection; class Session; class Filter; - class Crossfade; class ChanCount; class MidiOperator; class Track; @@ -104,8 +105,8 @@ class AutomationLine; class AutomationSelection; class AutomationTimeAxisView; class BundleManager; +class ButtonJoiner; class ControlPoint; -class CrossfadeView; class DragManager; class GroupedButtons; class GUIObjectState; @@ -168,7 +169,12 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD } 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;} @@ -235,6 +241,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD return rint ((double) frame / (double) frames_per_unit); } + double frame_to_unit_unrounded (framepos_t frame) const { + return frame / frames_per_unit; + } + double frame_to_unit (double frame) const { return rint (frame / frames_per_unit); } @@ -276,11 +286,15 @@ 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 (); void invert_selection (); void deselect_all (); + long select_range (framepos_t, framepos_t); void set_selected_regionview_from_region_list (boost::shared_ptr region, Selection::Operation op = Selection::Set); @@ -311,6 +325,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD 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 */ @@ -362,12 +377,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 */ @@ -389,6 +402,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); @@ -440,7 +455,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD return _drags; } - void maybe_autoscroll (bool, bool); + void maybe_autoscroll (bool, bool, bool, bool); Gdk::Cursor* get_canvas_cursor () const { return current_canvas_cursor; } void set_canvas_cursor (Gdk::Cursor*, bool save=false); @@ -457,6 +472,14 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD 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; + } + protected: void map_transport_state (); void map_position_change (framepos_t); @@ -477,7 +500,7 @@ 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; @@ -496,20 +519,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; Editing::ZoomFocus zoom_focus; void set_frames_per_unit (double); - void post_zoom (); + bool clamp_frames_per_unit (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; @@ -525,14 +550,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void update_join_object_range_location (double, double); - int post_maximal_editor_width; - int post_maximal_editor_height; - int post_maximal_horizontal_pane_position; - int post_maximal_vertical_pane_position; - int pre_maximal_horizontal_pane_position; - int pre_maximal_vertical_pane_position; - int pre_maximal_editor_width; - int pre_maximal_editor_height; + boost::optional pre_notebook_shrink_pane_width; + void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*); Gtk::Notebook _the_notebook; @@ -543,8 +562,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD Gtk::HPaned edit_pane; Gtk::VPaned editor_summary_pane; - bool idle_reset_vertical_pane_position (int); - Gtk::EventBox meter_base; Gtk::HBox meter_box; Gtk::EventBox marker_base; @@ -617,6 +634,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); @@ -630,7 +648,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&); @@ -641,14 +658,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; @@ -658,21 +672,18 @@ 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 force = false); - bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_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); bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::weak_ptr); void collect_new_region_view (RegionView *); void collect_and_select_new_region_view (RegionView *); - long select_range_around_region (RegionView *); - 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; @@ -686,19 +697,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; @@ -710,6 +719,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void set_canvas_cursor (); ArdourCanvas::Canvas* track_canvas; + bool within_track_canvas; friend class VerboseCursor; VerboseCursor* _verbose_cursor; @@ -984,8 +994,16 @@ 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; @@ -1013,22 +1031,19 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD 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), frames_per_unit (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 */ @@ -1197,8 +1212,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); @@ -1235,6 +1250,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; @@ -1339,6 +1356,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); @@ -1376,7 +1399,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*); @@ -1451,6 +1475,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD bool _follow_playhead; /// true if we scroll the tracks rather than the playhead bool _stationary_playhead; + /// 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; @@ -1478,7 +1504,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 &); void marker_menu_edit (); void marker_menu_remove (); @@ -1496,6 +1522,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void marker_menu_set_from_playhead (); void marker_menu_set_from_selection (); 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); @@ -1538,9 +1565,9 @@ 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 zoom_in_button; + Gtk::Button zoom_out_button; + Gtk::Button zoom_out_full_button; Gtk::Button tav_expand_button; Gtk::Button tav_shrink_button; @@ -1558,7 +1585,9 @@ 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; + + ButtonJoiner* smart_mode_joiner; + Glib::RefPtr smart_mode_action; void mouse_mode_toggled (Editing::MouseMode m); void mouse_mode_object_range_toggled () {} @@ -1647,6 +1676,9 @@ 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); @@ -1799,14 +1831,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; @@ -1822,7 +1846,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD /* duplication */ - void duplicate_dialog (bool with_dialog); + void duplicate_range (bool with_dialog); framepos_t event_frame (GdkEvent const *, double* px = 0, double* py = 0) const; @@ -1830,17 +1854,13 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD */ 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); void pitch_shift_region (); - int time_fx (RegionSelection&, float val, bool pitching); void transpose_region (); @@ -1861,10 +1881,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) ; @@ -1906,12 +1922,6 @@ 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; @@ -1952,8 +1962,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*); @@ -1963,7 +1971,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 (); @@ -2076,6 +2085,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 &); @@ -2087,6 +2098,34 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void follow_mixer_selection (); bool _following_mixer_selection; + 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; friend class RegionMoveDrag;