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
This commit is contained in:
Carl Hetherington 2012-03-22 16:41:44 +00:00
parent 3120bae8b4
commit 64425f77e7
4 changed files with 37 additions and 7 deletions

View File

@ -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);

View File

@ -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)) {

View File

@ -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
{

View File

@ -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;