initial (incomplete) framework for DiskIOPoint manipulation
[ardour.git] / gtk2_ardour / editor.cc
index 27b0d1b08cf271f5541f6513efc222929fc5be31..1701c3841178cf2e6d05a1be63cb4308da5ca20a 100644 (file)
@@ -353,7 +353,7 @@ Editor::Editor ()
        , cut_buffer_start (0)
        , cut_buffer_length (0)
        , button_bindings (0)
-       , last_paste_pos (0)
+       , last_paste_pos (-1)
        , paste_count (0)
        , sfbrowser (0)
        , current_interthread_info (0)
@@ -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)));
        }
 }
@@ -4842,8 +4853,7 @@ Editor::get_regions_at (RegionSelection& rs, framepos_t where, const TrackViewLi
 
                        if ((tr = rtv->track()) && ((pl = tr->playlist()))) {
 
-                               boost::shared_ptr<RegionList> regions = pl->regions_at (
-                                               (framepos_t) floor ( (double) where * tr->speed()));
+                               boost::shared_ptr<RegionList> regions = pl->regions_at (where);
 
                                for (RegionList::iterator i = regions->begin(); i != regions->end(); ++i) {
                                        RegionView* rv = rtv->view()->find_view (*i);
@@ -4875,8 +4885,7 @@ Editor::get_regions_after (RegionSelection& rs, framepos_t where, const TrackVie
 
                        if ((tr = rtv->track()) && ((pl = tr->playlist()))) {
 
-                               boost::shared_ptr<RegionList> regions = pl->regions_touched (
-                                       (framepos_t) floor ( (double)where * tr->speed()), max_framepos);
+                               boost::shared_ptr<RegionList> regions = pl->regions_touched (where, max_framepos);
 
                                for (RegionList::iterator i = regions->begin(); i != regions->end(); ++i) {
 
@@ -5499,6 +5508,10 @@ Editor::hide_track_in_display (TimeAxisView* tv, bool apply_to_selection)
        if (!tv) {
                return;
        }
+
+       DisplaySuspender ds;
+       PresentationInfo::ChangeSuspender cs;
+
        if (apply_to_selection) {
                for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ) {
 
@@ -5552,15 +5565,15 @@ Editor::foreach_time_axis_view (sigc::slot<void,TimeAxisView&> theslot)
        }
 }
 
-/** Find a RouteTimeAxisView by the ID of its route */
-RouteTimeAxisView*
-Editor::get_route_view_by_route_id (const PBD::ID& id) const
+/** Find a StripableTimeAxisView by the ID of its stripable */
+StripableTimeAxisView*
+Editor::get_stripable_time_axis_by_id (const PBD::ID& id) const
 {
-       RouteTimeAxisView* v;
+       StripableTimeAxisView* v;
 
        for (TrackViewList::const_iterator i = track_views.begin(); i != track_views.end(); ++i) {
-               if((v = dynamic_cast<RouteTimeAxisView*>(*i)) != 0) {
-                       if(v->route()->id() == id) {
+               if((v = dynamic_cast<StripableTimeAxisView*>(*i)) != 0) {
+                       if(v->stripable()->id() == id) {
                                return v;
                        }
                }