diff options
author | Carl Hetherington <carl@carlh.net> | 2012-03-22 16:41:44 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2012-03-22 16:41:44 +0000 |
commit | 64425f77e71833d913a5834ed13354b4199c40d2 (patch) | |
tree | dde559eee69fd3a4e43a4ac4761afe3d3e246c46 /gtk2_ardour/editor_markers.cc | |
parent | 3120bae8b41f3eecad25534ab6953e1b123ab9de (diff) |
Remove unused op parameter to temporal_zoom_by_frame. Add Zoom to Range option to range marker context menu (#4778).
git-svn-id: svn://localhost/ardour2/branches/3.0@11750 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_markers.cc')
-rw-r--r-- | gtk2_ardour/editor_markers.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index f66b7d02c6..96ae8e66e0 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -879,6 +879,8 @@ Editor::build_range_marker_menu (bool loop_or_punch, bool session) items.push_back (MenuElem (_("Set Range from Range Selection"), sigc::mem_fun(*this, &Editor::marker_menu_set_from_selection))); } + items.push_back (MenuElem (_("Zoom to Range"), sigc::mem_fun (*this, &Editor::marker_menu_zoom_to_range))); + items.push_back (SeparatorElem()); items.push_back (MenuElem (_("Export Range..."), sigc::mem_fun(*this, &Editor::export_range))); items.push_back (SeparatorElem()); @@ -1215,6 +1217,33 @@ Editor::marker_menu_loop_range () } } +/** Temporal zoom to the range of the marker_menu_item (plus 5% either side) */ +void +Editor::marker_menu_zoom_to_range () +{ + Marker* marker = reinterpret_cast<Marker *> (marker_menu_item->get_data ("marker")); + assert (marker); + + bool is_start; + Location* l = find_location_from_marker (marker, is_start); + if (l == 0) { + return; + } + + framecnt_t const extra = l->length() * 0.05; + framepos_t a = l->start (); + if (a >= extra) { + a -= extra; + } + + framepos_t b = l->end (); + if (b < (max_framepos - extra)) { + b += extra; + } + + temporal_zoom_by_frame (a, b); +} + void Editor::dynamic_cast_marker_object (void* p, MeterMarker** m, TempoMarker** t) const { |