}
}
- // ToDo: encapsulate all of this into something like editor::get_session_extents() or editor::leftmost(), rightmost()
- {
- //ToDo: also incorporate automation regions (in case the session has no audio/midi but is just used for automating plugins or the like)
-
- //calculate the extents of all regions in every playlist
- framecnt_t session_extent_start = 0;
- framecnt_t session_extent_end = 0;
- {
- boost::shared_ptr<RouteList> rl = _session->get_routes();
- for (RouteList::iterator r = rl->begin(); r != rl->end(); ++r) {
- boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*r);
- if (tr) {
- boost::shared_ptr<Playlist> pl = tr->playlist();
- if (pl) {
- pair<framepos_t, framepos_t> e;
- e = pl->get_extent();
- if (e.first < session_extent_start) {
- session_extent_start = e.first;
- }
- if (e.second > session_extent_end) {
- session_extent_end = e.second;
- }
- }
- }
- }
- }
- framecnt_t session_extents = session_extent_end - session_extent_start;
-
- //in a session with no regions, use the start/end markers to set max zoom
- framecnt_t const session_length = _session->current_end_frame() - _session->current_start_frame ();
- if ( session_length > session_extents )
- session_extents = session_length;
-
- //in a session with no regions or start/end markers, use 2 minutes to set max zoom
- framecnt_t const min_length = _session->nominal_frame_rate()*60*2;
- if ( min_length > session_extents )
- session_extents = min_length;
-
- //convert to samples-per-pixel and limit our zoom to this value
- framecnt_t session_extents_pp = session_extents / _visible_canvas_width;
- if (nspp > session_extents_pp)
- nspp = session_extents_pp;
- }
+ //zoom-behavior-tweaks
+ //limit our maximum zoom to the session gui extents value
+ std::pair<framepos_t, framepos_t> ext = session_gui_extents();
+ framecnt_t session_extents_pp = ( ext.second - ext.first ) / _visible_canvas_width;
+ if (nspp > session_extents_pp)
+ nspp = session_extents_pp;
temporal_zoom (nspp);
}
}
}
+void
+Editor::temporal_zoom_extents ()
+{
+ ENSURE_GUI_THREAD (*this, &Editor::temporal_zoom_extents)
+
+ if (_session) {
+ std::pair<framepos_t, framepos_t> ext = session_gui_extents( false ); //in this case we want to zoom to the extents explicitly; ignore the users prefs for extra padding
+
+ framecnt_t start = ext.first;
+ framecnt_t end = ext.second;
+
+ if (_session->actively_recording () ) {
+ framepos_t cur = playhead_cursor->current_frame ();
+ if (cur > end) {
+ /* recording beyond the end marker; zoom out
+ * by 5 seconds more so that if 'follow
+ * playhead' is active we don't immediately
+ * scroll.
+ */
+ end = cur + _session->frame_rate() * 5;
+ }
+ }
+
+ if ((start == 0 && end == 0) || end < start) {
+ return;
+ }
+
+ calc_extra_zoom_edges(start, end);
+
+ temporal_zoom_by_frame (start, end);
+ }
+}
+
void
Editor::temporal_zoom_by_frame (framepos_t start, framepos_t end)
{
vector< boost::shared_ptr<Region> > v;
for (list<RegionView*>::iterator x = rs.begin(); x != rs.end(); ++x) {
- (*x)->region()->separate_by_channel (*_session, v);
+ (*x)->region()->separate_by_channel (v);
}
}
if (in_command) {
commit_reversible_command ();
+ _session->set_dirty ();
}
}
boost::shared_ptr<ControlList> cl (new ControlList);
for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
- RouteTimeAxisView *rtav = dynamic_cast<RouteTimeAxisView *>(*i);
+ StripableTimeAxisView *stav = dynamic_cast<StripableTimeAxisView *>(*i);
- if (!rtav) {
+ if (!stav || !stav->stripable()->solo_control()) {
continue;
}
if (first) {
- new_state = !rtav->route()->soloed ();
+ new_state = !stav->stripable()->solo_control()->soloed ();
first = false;
}
- cl->push_back (rtav->route()->solo_control());
+ cl->push_back (stav->stripable()->solo_control());
}
_session->set_controls (cl, new_state ? 1.0 : 0.0, Controllable::UseGroup);
{
bool new_state = false;
bool first = true;
- boost::shared_ptr<RouteList> rl (new RouteList);
+ boost::shared_ptr<ControlList> cl (new ControlList);
for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
- RouteTimeAxisView *rtav = dynamic_cast<RouteTimeAxisView *>(*i);
+ StripableTimeAxisView *stav = dynamic_cast<StripableTimeAxisView *>(*i);
- if (!rtav) {
+ if (!stav || !stav->stripable()->mute_control()) {
continue;
}
if (first) {
- new_state = !rtav->route()->muted();
+ new_state = !stav->stripable()->mute_control()->muted();
first = false;
}
- rl->push_back (rtav->route());
+ cl->push_back (stav->stripable()->mute_control());
}
- _session->set_controls (route_list_to_control_list (rl, &Stripable::mute_control), new_state, Controllable::UseGroup);
+ _session->set_controls (cl, new_state, Controllable::UseGroup);
}
void