diff --git a/gtk2_ardour/add_route_dialog.cc b/gtk2_ardour/add_route_dialog.cc index 2728e7687e..1b78e01c35 100644 --- a/gtk2_ardour/add_route_dialog.cc +++ b/gtk2_ardour/add_route_dialog.cc @@ -67,6 +67,15 @@ AddRouteDialog::AddRouteDialog () { if (channel_combo_strings.empty()) { channel_combo_strings = I18N (channel_setup_names); + + if (ARDOUR::Profile->get_sae()) { + /* remove all but the first two (Mono & Stereo) */ + + while (track_mode_strings.size() > 2) { + track_mode_strings.pop_back(); + } + } + } if (track_mode_strings.empty()) { diff --git a/gtk2_ardour/ardour-sae.bindings.in b/gtk2_ardour/ardour-sae.bindings.in index e9e51ce50b..0662f85a92 100644 --- a/gtk2_ardour/ardour-sae.bindings.in +++ b/gtk2_ardour/ardour-sae.bindings.in @@ -96,7 +96,7 @@ ; (gtk_accel_path "/Editor/Layering" "") ; (gtk_accel_path "/JACK/JACKLatency4096" "") (gtk_accel_path "/Editor/scroll-tracks-up" "Page_Up") -(gtk_accel_path "/Editor/set-edit-point" "o") +(gtk_accel_path "/Editor/set-edit-point" "g") ; (gtk_accel_path "/Editor/Smpte30drop" "") ; (gtk_accel_path "/Zoom/zoom-focus-edit" "") (gtk_accel_path "/Editor/playhead-to-previous-region-boundary" "leftarrow") @@ -123,7 +123,8 @@ ; (gtk_accel_path "/Editor/snap-magnetic" "") ; (gtk_accel_path "/Editor/playhead-to-range-end" "") (gtk_accel_path "/Editor/scroll-playhead-forward" "<%TERTIARY%>rightarrow") -(gtk_accel_path "/Editor/align-regions-sync-relative" "y") +(gtk_accel_path "/Editor/align-regions-sync-relative" "<%SECONDARY%>less") +(gtk_accel_path "/Editor/align-regions-sync" "less") ; (gtk_accel_path "/Editor/EditSelectRegionOptions" "") (gtk_accel_path "/Editor/crop" "c") ; (gtk_accel_path "/redirectmenu/newsend" "") @@ -137,7 +138,6 @@ ; (gtk_accel_path "/Transport/ToggleAutoInput" "") ; (gtk_accel_path "/Snap/snap-to-thirtyseconds" "") ; (gtk_accel_path "/Snap/snap-to-minutes" "") -(gtk_accel_path "/Editor/align-regions-sync" "less") ; (gtk_accel_path "/Main/Windows" "") ; (gtk_accel_path "/Main/CleanupUnused" "") ; (gtk_accel_path "/redirectmenu/deselectall" "") @@ -252,7 +252,7 @@ ; (gtk_accel_path "/redirectmenu/newinsert" "") ; (gtk_accel_path "/options/UseMMC" "") ; (gtk_accel_path "/options/MeterFalloffOff" "") -(gtk_accel_path "/MouseMode/set-mouse-mode-object" "o") +;(gtk_accel_path "/MouseMode/set-mouse-mode-object" "o") ; (gtk_accel_path "/Editor/PullupMinus4Plus1" "") ; (gtk_accel_path "/Editor/MeterHold" "") ; (gtk_accel_path "/Snap/snap-to-cd-frame" "") @@ -315,7 +315,9 @@ ; (gtk_accel_path "/options/MeterHoldLong" "") ; (gtk_accel_path "/Snap/snap-to-seconds" "") (gtk_accel_path "/Editor/set-fade-in-length" "q") +(gtk_accel_path "/Editor/toggle-fade-in-active" "<%SECONDARY%>q") (gtk_accel_path "/Editor/set-fade-out-length" "e") +(gtk_accel_path "/Editor/toggle-fade-out-active" "<%SECONDARY%>e") (gtk_accel_path "/Editor/trim-from-start" "<%TERTIARY%>braceleft") (gtk_accel_path "/Editor/trim-to-end" "<%TERTIARY%>braceright") (gtk_accel_path "/Editor/trim-front" "a") @@ -336,4 +338,7 @@ (gtk_accel_path "/Editor/set-punch-from-edit-range" "bracketleft") (gtk_accel_path "/Editor/set-loop-from-region" "<%PRIMARY%><%SECONDARY%>bracketright") (gtk_accel_path "/Editor/loop-region" "<%PRIMARY%>bracketright") +(gtk_accel_path "/Editor/toggle-zoom" "o") +(gtk_accel_path "/Editor/zoom-to-region" "y") + diff --git a/gtk2_ardour/ardour-sae.menus b/gtk2_ardour/ardour-sae.menus index d1bd55e90b..62d3447920 100644 --- a/gtk2_ardour/ardour-sae.menus +++ b/gtk2_ardour/ardour-sae.menus @@ -140,7 +140,9 @@ + + @@ -184,10 +186,11 @@ - + + diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 9a0c1fbb5b..e3b5796045 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -329,6 +329,8 @@ Editor::Editor () set_mouse_mode (MouseObject, true); + last_visual_state.frames_per_unit = 0; + frames_per_unit = 2048; /* too early to use reset_zoom () */ reset_hscrollbar_stepping (); @@ -3962,11 +3964,26 @@ Editor::reposition_and_zoom (nframes_t frame, double fpu) reset_zoom (fpu); } +void +Editor::swap_visual_state () +{ + if (last_visual_state.frames_per_unit == 0) { + // never set + return; + } + + /* note: the correct functionality here is very dependent on the ordering of + setting zoom focus, horizontal position and finally zoom. this is because + it is set_frames_per_unit() that overwrites last_visual_state. + */ + + set_zoom_focus (last_visual_state.zoom_focus); + reposition_and_zoom (last_visual_state.leftmost_frame, last_visual_state.frames_per_unit); +} + void Editor::set_frames_per_unit (double fpu) { - nframes_t frames; - /* this is the core function that controls the zoom level of the canvas. it is called whenever one or more calls are made to reset_zoom(). it executes in an idle handler. */ @@ -3979,9 +3996,6 @@ Editor::set_frames_per_unit (double fpu) fpu = 2.0; } - // convert fpu to frame count - - frames = (nframes_t) floor (fpu * canvas_width); /* don't allow zooms that fit more than the maximum number of frames into an 800 pixel wide space. @@ -3994,10 +4008,23 @@ Editor::set_frames_per_unit (double fpu) if (fpu == frames_per_unit) { return; } + + last_visual_state.frames_per_unit = frames_per_unit; + last_visual_state.leftmost_frame = leftmost_frame; + last_visual_state.zoom_focus = zoom_focus; frames_per_unit = fpu; + post_zoom (); +} - if (frames != zoom_range_clock.current_duration()) { +void +Editor::post_zoom () +{ + // convert fpu to frame count + + nframes_t frames = (nframes_t) floor (frames_per_unit * canvas_width); + + if (frames_per_unit != zoom_range_clock.current_duration()) { zoom_range_clock.set (frames); } @@ -4028,7 +4055,7 @@ Editor::queue_visual_change (nframes_t where) { pending_visual_change.pending = VisualChange::Type (pending_visual_change.pending | VisualChange::TimeOrigin); pending_visual_change.time_origin = where; - + if (pending_visual_change.idle_handler_id < 0) { pending_visual_change.idle_handler_id = g_idle_add (_idle_visual_changer, this); } diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 4b7829f92f..63a19e0d3e 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -257,7 +257,7 @@ class Editor : public PublicEditor void set_zoom_focus (Editing::ZoomFocus); Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; } - gdouble get_current_zoom () { return frames_per_unit; } + double get_current_zoom () const { return frames_per_unit; } void temporal_zoom_step (bool coarser); @@ -265,8 +265,6 @@ class Editor : public PublicEditor PlaylistSelector& playlist_selector() const; void route_name_changed (TimeAxisView *); - gdouble frames_per_unit; - nframes_t leftmost_frame; void clear_playlist (boost::shared_ptr); void new_playlists (TimeAxisView*); @@ -371,7 +369,22 @@ class Editor : public PublicEditor PlaylistSelector* _playlist_selector; - void set_frames_per_unit (double); + struct VisualState { + double frames_per_unit; + nframes_t leftmost_frame; + Editing::ZoomFocus zoom_focus; + }; + + VisualState last_visual_state; + + nframes_t leftmost_frame; + double frames_per_unit; + Editing::ZoomFocus zoom_focus; + + void use_visual_state (const VisualState&); + void set_frames_per_unit (double); + void swap_visual_state (); + void post_zoom (); Editing::MouseMode mouse_mode; @@ -990,9 +1003,8 @@ class Editor : public PublicEditor void play_location (ARDOUR::Location&); void loop_location (ARDOUR::Location&); - Editing::ZoomFocus zoom_focus; - void temporal_zoom_selection (); + void temporal_zoom_region (); void temporal_zoom_session (); void temporal_zoom (gdouble scale); void temporal_zoom_by_frame (nframes_t start, nframes_t end, const string & op); @@ -1162,7 +1174,7 @@ class Editor : public PublicEditor void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape); void set_fade_length (bool in); - + void toggle_fade_active (bool in); void set_fade_in_active (bool); void set_fade_out_active (bool); diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index e54f0e86b9..eb6c29b242 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -201,12 +201,17 @@ Editor::register_actions () act = ActionManager::register_action (editor_actions, "nudge-next-backward", _("Nudge Next Backward"), bind (mem_fun(*this, &Editor::nudge_backward), true)); ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "temporal-zoom-out", _("Zoom Out"), bind (mem_fun(*this, &Editor::temporal_zoom_step), true)); ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "temporal-zoom-in", _("Zoom In"), bind (mem_fun(*this, &Editor::temporal_zoom_step), false)); ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "zoom-to-session", _("Zoom to Session"), mem_fun(*this, &Editor::temporal_zoom_session)); ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "zoom-to-region", _("Zoom to Session"), mem_fun(*this, &Editor::temporal_zoom_region)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "toggle-zoom", _("Toggle Zoom State"), mem_fun(*this, &Editor::swap_visual_state)); + ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "scroll-tracks-up", _("Scroll Tracks Up"), mem_fun(*this, &Editor::scroll_tracks_up)); ActionManager::session_sensitive_actions.push_back (act); @@ -264,8 +269,12 @@ Editor::register_actions () act = ActionManager::register_action (editor_actions, "set-fade-in-length", _("Set Fade In Length"), bind (mem_fun(*this, &Editor::set_fade_length), true)); ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "toggle-fade-in-active", _("Toggle Fade In Active"), bind (mem_fun(*this, &Editor::toggle_fade_active), true)); + ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "set-fade-out-length", _("Set Fade Out Length"), bind (mem_fun(*this, &Editor::set_fade_length), false)); ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "toggle-fade-out-active", _("Toggle Fade Out Active"), bind (mem_fun(*this, &Editor::toggle_fade_active), false)); + ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "align-regions-start", _("Align Regions Start"), bind (mem_fun(*this, &Editor::align), ARDOUR::Start)); ActionManager::session_sensitive_actions.push_back (act); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 05695e5db5..5edd0e15c4 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -1540,6 +1540,32 @@ Editor::temporal_zoom (gdouble fpu) reposition_and_zoom (leftmost_after_zoom, nfpu); } +void +Editor::temporal_zoom_region () +{ + + nframes64_t start = max_frames; + nframes64_t end = 0; + + ensure_entered_region_selected (true); + + if (selection->regions.empty()) { + info << _("cannot set loop: no region selected") << endmsg; + return; + } + + for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) { + if ((*i)->region()->position() < start) { + start = (*i)->region()->position(); + } + if ((*i)->region()->last_frame() + 1 > end) { + end = (*i)->region()->last_frame() + 1; + } + } + + temporal_zoom_by_frame (start, end, "zoom to region"); +} + void Editor::temporal_zoom_selection () { @@ -4055,7 +4081,7 @@ Editor::toggle_region_opaque () void Editor::set_fade_length (bool in) { - ensure_entered_region_selected (); + ensure_entered_region_selected (true); /* we need a region to measure the offset from the start */ @@ -4116,6 +4142,44 @@ Editor::set_fade_length (bool in) commit_reversible_command (); } + +void +Editor::toggle_fade_active (bool in) +{ + ensure_entered_region_selected (true); + + if (selection->regions.empty()) { + return; + } + + const char* cmd = (in ? _("toggle fade in active") : _("toggle fade out active")); + + begin_reversible_command (cmd); + + for (RegionSelection::iterator x = selection->regions.begin(); x != selection->regions.end(); ++x) { + AudioRegionView* tmp = dynamic_cast (*x); + + if (!tmp) { + return; + } + + boost::shared_ptr region (tmp->audio_region()); + + XMLNode &before = region->get_state(); + + if (in) { + region->set_fade_in_active (!region->fade_in_active()); + } else { + region->set_fade_out_active (!region->fade_out_active()); + } + + XMLNode &after = region->get_state(); + session->add_command(new MementoCommand(*region.get(), &before, &after)); + } + + commit_reversible_command (); +} + void Editor::set_fade_in_shape (AudioRegion::FadeShape shape) { diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index ef6c0a1de6..797ff72d42 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -125,7 +125,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway virtual Gtk::HBox& get_status_bar_packer() = 0; virtual void set_zoom_focus (Editing::ZoomFocus) = 0; virtual Editing::ZoomFocus get_zoom_focus () const = 0; - virtual gdouble get_current_zoom () = 0; + virtual gdouble get_current_zoom () const = 0; virtual PlaylistSelector& playlist_selector() const = 0; virtual void route_name_changed (TimeAxisView *) = 0; virtual void clear_playlist (boost::shared_ptr) = 0; diff --git a/gtk2_ardour/tempo_dialog.cc b/gtk2_ardour/tempo_dialog.cc index d69acf7ef1..aee3dc44e6 100644 --- a/gtk2_ardour/tempo_dialog.cc +++ b/gtk2_ardour/tempo_dialog.cc @@ -70,7 +70,7 @@ void TempoDialog::init (const BBT_Time& when, double bpm, bool movable) { bpm_spinner.set_numeric (true); - bpm_spinner.set_digits (1); + bpm_spinner.set_digits (2); bpm_spinner.set_wrap (true); bpm_spinner.set_value (bpm);