From 786028a20a2a83bbcc2eebe457353b221d57d10a Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 2 Mar 2011 02:46:19 +0000 Subject: [PATCH] make fit-selected-tracks operate on tracks with selected regions IF no tracks are selected git-svn-id: svn://localhost/ardour2/branches/3.0@9026 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor_actions.cc | 2 +- gtk2_ardour/editor_ops.cc | 16 +++++++++++++++- gtk2_ardour/panner_ui.cc | 3 +-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 57754298f8..4c640c87f6 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -420,7 +420,7 @@ Editor::register_actions () act = ActionManager::register_action (editor_actions, "fit-tracks", _("Fit Selected Tracks"), sigc::mem_fun(*this, &Editor::fit_selected_tracks)); ActionManager::session_sensitive_actions.push_back (act); - ActionManager::track_selection_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "track-height-largest", _("Largest"), sigc::bind ( sigc::mem_fun(*this, &Editor::set_track_height), HeightLargest)); ActionManager::session_sensitive_actions.push_back (act); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index a20bb23348..bcb1fd5f4a 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -6214,7 +6214,21 @@ Editor::insert_time (framepos_t pos, framecnt_t frames, InsertTimeOption opt, void Editor::fit_selected_tracks () { - fit_tracks (selection->tracks); + if (!selection->tracks.empty()) { + fit_tracks (selection->tracks); + } else { + TrackViewList tvl; + + /* no selected tracks - use tracks with selected regions */ + + for (RegionSelection::iterator r = selection->regions.begin(); r != selection->regions.end(); ++r) { + tvl.push_back (&(*r)->get_time_axis_view ()); + } + + if (!tvl.empty()) { + fit_tracks (tvl); + } + } } void diff --git a/gtk2_ardour/panner_ui.cc b/gtk2_ardour/panner_ui.cc index 2a69d73251..3ec24251ec 100644 --- a/gtk2_ardour/panner_ui.cc +++ b/gtk2_ardour/panner_ui.cc @@ -435,9 +435,8 @@ PannerUI::update_pan_sensitive () { bool const sensitive = !(_panner->pannable()->automation_state() & Play); -#ifdef PANNER_HACKS pan_vbox.set_sensitive (sensitive); -#endif + if (big_window) { big_window->set_sensitive (sensitive); }