Editor zoom: add zoom_to_extents()
This commit is contained in:
parent
1c145ccfc3
commit
631629b8e7
@ -449,6 +449,7 @@
|
||||
<menuitem action='temporal-zoom-in'/>
|
||||
<menuitem action='temporal-zoom-out'/>
|
||||
<menuitem action='zoom-to-session'/>
|
||||
<menuitem action='zoom-to-extents'/>
|
||||
<menuitem action='zoom-to-selection'/>
|
||||
<menuitem action='zoom-to-selection-horiz'/>
|
||||
<menuitem action='fit-selection'/>
|
||||
|
@ -3782,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)));
|
||||
}
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ public:
|
||||
void toggle_measure_visibility ();
|
||||
|
||||
/* returns the left-most and right-most time that the gui should allow the user to scroll to */
|
||||
std::pair <framepos_t,framepos_t> session_gui_extents() const;
|
||||
std::pair <framepos_t,framepos_t> session_gui_extents( bool use_extra = true ) const;
|
||||
|
||||
/* fades */
|
||||
|
||||
@ -1342,6 +1342,7 @@ private:
|
||||
void calc_extra_zoom_edges(framepos_t &start, framepos_t &end);
|
||||
void temporal_zoom_selection (Editing::ZoomAxis);
|
||||
void temporal_zoom_session ();
|
||||
void temporal_zoom_extents ();
|
||||
void temporal_zoom (framecnt_t samples_per_pixel);
|
||||
void temporal_zoom_by_frame (framepos_t start, framepos_t end);
|
||||
void temporal_zoom_to_frame (bool coarser, framepos_t frame);
|
||||
|
@ -276,6 +276,7 @@ Editor::register_actions ()
|
||||
reg_sens (editor_actions, "temporal-zoom-out", _("Zoom Out"), sigc::bind (sigc::mem_fun(*this, &Editor::temporal_zoom_step), true));
|
||||
reg_sens (editor_actions, "temporal-zoom-in", _("Zoom In"), sigc::bind (sigc::mem_fun(*this, &Editor::temporal_zoom_step), false));
|
||||
reg_sens (editor_actions, "zoom-to-session", _("Zoom to Session"), sigc::mem_fun(*this, &Editor::temporal_zoom_session));
|
||||
reg_sens (editor_actions, "zoom-to-extents", _("Zoom to Extents"), sigc::mem_fun(*this, &Editor::temporal_zoom_extents));
|
||||
reg_sens (editor_actions, "zoom-to-selection", _("Zoom to Selection"), sigc::bind (sigc::mem_fun(*this, &Editor::temporal_zoom_selection), Both));
|
||||
reg_sens (editor_actions, "zoom-to-selection-horiz", _("Zoom to Selection (Horizontal)"), sigc::bind (sigc::mem_fun(*this, &Editor::temporal_zoom_selection), Horizontal));
|
||||
reg_sens (editor_actions, "toggle-zoom", _("Toggle Zoom State"), sigc::mem_fun(*this, &Editor::swap_visual_state));
|
||||
|
@ -582,7 +582,7 @@ Editor::autoscroll_active () const
|
||||
}
|
||||
|
||||
std::pair <framepos_t,framepos_t>
|
||||
Editor::session_gui_extents () const
|
||||
Editor::session_gui_extents ( bool use_extra ) const
|
||||
{
|
||||
if (!_session) {
|
||||
return std::pair <framepos_t,framepos_t>(max_framepos,0);
|
||||
@ -616,10 +616,12 @@ Editor::session_gui_extents () const
|
||||
//ToDo: also incorporate automation regions (in case the session has no audio/midi but is just used for automating plugins or the like)
|
||||
|
||||
//add additional time to the ui extents ( user-defined in config )
|
||||
framecnt_t const extra = UIConfiguration::instance().get_extra_ui_extents_time() * 60 * _session->nominal_frame_rate();
|
||||
session_extent_end += extra;
|
||||
session_extent_start -= extra;
|
||||
|
||||
if (use_extra) {
|
||||
framecnt_t const extra = UIConfiguration::instance().get_extra_ui_extents_time() * 60 * _session->nominal_frame_rate();
|
||||
session_extent_end += extra;
|
||||
session_extent_start -= extra;
|
||||
}
|
||||
|
||||
//range-check
|
||||
if (session_extent_end > max_framepos) {
|
||||
session_extent_end = max_framepos;
|
||||
|
@ -2058,6 +2058,39 @@ Editor::temporal_zoom_session ()
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user