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 | |
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')
-rw-r--r-- | gtk2_ardour/editor.h | 3 | ||||
-rw-r--r-- | gtk2_ardour/editor_drag.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/editor_markers.cc | 29 | ||||
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 8 |
4 files changed, 37 insertions, 7 deletions
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index b02ef1452b..d5b2cb9172 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1201,7 +1201,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void zoom_to_region (bool both_axes); void temporal_zoom_session (); void temporal_zoom (gdouble scale); - void temporal_zoom_by_frame (framepos_t start, framepos_t end, const std::string & op); + void temporal_zoom_by_frame (framepos_t start, framepos_t end); void temporal_zoom_to_frame (bool coarser, framepos_t frame); void insert_region_list_drag (boost::shared_ptr<ARDOUR::Region>, int x, int y); @@ -1501,6 +1501,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void marker_menu_set_from_playhead (); void marker_menu_set_from_selection (); void marker_menu_range_to_next (); + void marker_menu_zoom_to_range (); void new_transport_marker_menu_set_loop (); void new_transport_marker_menu_set_punch (); void update_loop_range_view (bool visibility=false); diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 04c6494d9d..21b47c388f 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -3915,9 +3915,9 @@ MouseZoomDrag::finished (GdkEvent* event, bool movement_occurred) motion (event, false); if (grab_frame() < last_pointer_frame()) { - _editor->temporal_zoom_by_frame (grab_frame(), last_pointer_frame(), "mouse zoom"); + _editor->temporal_zoom_by_frame (grab_frame(), last_pointer_frame()); } else { - _editor->temporal_zoom_by_frame (last_pointer_frame(), grab_frame(), "mouse zoom"); + _editor->temporal_zoom_by_frame (last_pointer_frame(), grab_frame()); } } else { if (Keyboard::the_keyboard().key_is_down (GDK_Shift_L)) { 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 { diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index bcc596a352..1dbad3ac2e 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -1493,7 +1493,7 @@ Editor::temporal_zoom_region (bool both_axes) PBD::Unwinder<bool> nsv (no_save_visual, true); - temporal_zoom_by_frame (start, end, "zoom to region"); + temporal_zoom_by_frame (start, end); if (both_axes) { uint32_t per_track_height = (uint32_t) floor ((_canvas_height - canvas_timebars_vsize - 10.0) / tracks.size()); @@ -1540,7 +1540,7 @@ Editor::temporal_zoom_selection () framepos_t start = selection->time[clicked_selection].start; framepos_t end = selection->time[clicked_selection].end; - temporal_zoom_by_frame (start, end, "zoom to selection"); + temporal_zoom_by_frame (start, end); } void @@ -1555,12 +1555,12 @@ Editor::temporal_zoom_session () s = 0; } framecnt_t const e = _session->current_end_frame() + l * 0.01; - temporal_zoom_by_frame (framecnt_t (s), e, "zoom to _session"); + temporal_zoom_by_frame (framecnt_t (s), e); } } void -Editor::temporal_zoom_by_frame (framepos_t start, framepos_t end, const string & /*op*/) +Editor::temporal_zoom_by_frame (framepos_t start, framepos_t end) { if (!_session) return; |