Editor zoom: add zoom_to_extents()
[ardour.git] / gtk2_ardour / editor.cc
index 38fad22ddf9cc2f6e297562d49120e1ea9d80f11..210f6350befe8e38c7ab4f938a0f15c9987b69e8 100644 (file)
@@ -1132,7 +1132,7 @@ Editor::deferred_control_scroll (framepos_t /*target*/)
 }
 
 void
-Editor::access_action (std::string action_group, std::string action_item)
+Editor::access_action (const std::string& action_group, const std::string& action_item)
 {
        if (!_session) {
                return;
@@ -1148,6 +1148,12 @@ Editor::access_action (std::string action_group, std::string action_item)
        }
 }
 
+void
+Editor::set_toggleaction (const std::string& action_group, const std::string& action_item, bool s)
+{
+       ActionManager::set_toggleaction_state (action_group.c_str(), action_item.c_str(), s);
+}
+
 void
 Editor::on_realize ()
 {
@@ -1313,6 +1319,10 @@ Editor::set_session (Session *t)
                return;
        }
 
+       //initialize leftmost_frame to the extents of the session
+       //this prevents a bogus setting of leftmost = "0" if the summary view asks for the leftmost frame before the visible state has been loaded from instant.xml
+       leftmost_frame = session_gui_extents().first;
+       
        _playlist_selector->set_session (_session);
        nudge_clock->set_session (_session);
        _summary->set_session (_session);
@@ -3772,6 +3782,7 @@ Editor::build_track_count_menu ()
                zoom_preset_selector.AddMenuElem (MenuElem (_("Zoom to 8 hours"), sigc::bind (sigc::mem_fun(*this, &Editor::set_zoom_preset), 8 * 60 * 60 * 1000)));
                zoom_preset_selector.AddMenuElem (MenuElem (_("Zoom to 24 hours"), sigc::bind (sigc::mem_fun(*this, &Editor::set_zoom_preset), 24 * 60 * 60 * 1000)));
                zoom_preset_selector.AddMenuElem (MenuElem (_("Zoom to Session"), sigc::mem_fun(*this, &Editor::temporal_zoom_session)));
+               zoom_preset_selector.AddMenuElem (MenuElem (_("Zoom to Extents"), sigc::mem_fun(*this, &Editor::temporal_zoom_extents)));
                zoom_preset_selector.AddMenuElem (MenuElem (_("Zoom to Range/Region Selection"), sigc::bind (sigc::mem_fun(*this, &Editor::temporal_zoom_selection), Horizontal)));
        }
 }