a) add "Add Range Markers" to region context menu
b) add "Set Range" to region context menu git-svn-id: svn://localhost/trunk/ardour2@437 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
1bde5eabc6
commit
2aced5ff65
@ -1822,6 +1822,13 @@ Editor::add_region_context_items (StreamView* sv, Region* region, Menu_Helpers::
|
||||
items.push_back (MenuElem (_("Reverse"), mem_fun(*this, &Editor::reverse_region)));
|
||||
items.push_back (SeparatorElem());
|
||||
|
||||
|
||||
/* range related stuff */
|
||||
|
||||
items.push_back (MenuElem (_("Add Range Markers"), mem_fun (*this, &Editor::add_location_from_audio_region)));
|
||||
items.push_back (MenuElem (_("Set Range"), mem_fun (*this, &Editor::set_selection_from_audio_region)));
|
||||
items.push_back (SeparatorElem());
|
||||
|
||||
/* Nudge region */
|
||||
|
||||
Menu *nudge_menu = manage (new Menu());
|
||||
@ -2091,43 +2098,6 @@ Editor::set_snap_mode (SnapMode mode)
|
||||
instant_save ();
|
||||
}
|
||||
|
||||
void
|
||||
Editor::add_location_from_selection ()
|
||||
{
|
||||
if (selection->time.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (session == 0 || clicked_trackview == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
jack_nframes_t start = selection->time[clicked_selection].start;
|
||||
jack_nframes_t end = selection->time[clicked_selection].end;
|
||||
|
||||
Location *location = new Location (start, end, "selection");
|
||||
|
||||
session->begin_reversible_command (_("add marker"));
|
||||
session->add_undo (session->locations()->get_memento());
|
||||
session->locations()->add (location, true);
|
||||
session->add_redo_no_execute (session->locations()->get_memento());
|
||||
session->commit_reversible_command ();
|
||||
}
|
||||
|
||||
void
|
||||
Editor::add_location_from_playhead_cursor ()
|
||||
{
|
||||
jack_nframes_t where = session->audible_frame();
|
||||
|
||||
Location *location = new Location (where, where, "mark", Location::IsMark);
|
||||
session->begin_reversible_command (_("add marker"));
|
||||
session->add_undo (session->locations()->get_memento());
|
||||
session->locations()->add (location, true);
|
||||
session->add_redo_no_execute (session->locations()->get_memento());
|
||||
session->commit_reversible_command ();
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
Editor::set_state (const XMLNode& node)
|
||||
{
|
||||
|
@ -1039,7 +1039,9 @@ class Editor : public PublicEditor
|
||||
void set_selection_from_range (ARDOUR::Location&);
|
||||
void set_selection_from_punch ();
|
||||
void set_selection_from_loop ();
|
||||
void set_selection_from_audio_region ();
|
||||
|
||||
void add_location_from_audio_region ();
|
||||
void add_location_from_selection ();
|
||||
void set_route_loop_selection ();
|
||||
|
||||
|
@ -1192,6 +1192,60 @@ Editor::temporal_zoom_to_frame (bool coarser, jack_nframes_t frame)
|
||||
reposition_and_zoom (new_leftmost, new_fpu);
|
||||
}
|
||||
|
||||
void
|
||||
Editor::add_location_from_selection ()
|
||||
{
|
||||
if (selection->time.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (session == 0 || clicked_trackview == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
jack_nframes_t start = selection->time[clicked_selection].start;
|
||||
jack_nframes_t end = selection->time[clicked_selection].end;
|
||||
|
||||
Location *location = new Location (start, end, "selection");
|
||||
|
||||
session->begin_reversible_command (_("add marker"));
|
||||
session->add_undo (session->locations()->get_memento());
|
||||
session->locations()->add (location, true);
|
||||
session->add_redo_no_execute (session->locations()->get_memento());
|
||||
session->commit_reversible_command ();
|
||||
}
|
||||
|
||||
void
|
||||
Editor::add_location_from_playhead_cursor ()
|
||||
{
|
||||
jack_nframes_t where = session->audible_frame();
|
||||
|
||||
Location *location = new Location (where, where, "mark", Location::IsMark);
|
||||
session->begin_reversible_command (_("add marker"));
|
||||
session->add_undo (session->locations()->get_memento());
|
||||
session->locations()->add (location, true);
|
||||
session->add_redo_no_execute (session->locations()->get_memento());
|
||||
session->commit_reversible_command ();
|
||||
}
|
||||
|
||||
void
|
||||
Editor::add_location_from_audio_region ()
|
||||
{
|
||||
if (selection->audio_regions.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
AudioRegionView* rv = *(selection->audio_regions.begin());
|
||||
Region& region = rv->region;
|
||||
|
||||
Location *location = new Location (region.position(), region.last_frame(), region.name());
|
||||
session->begin_reversible_command (_("add marker"));
|
||||
session->add_undo (session->locations()->get_memento());
|
||||
session->locations()->add (location, true);
|
||||
session->add_redo_no_execute (session->locations()->get_memento());
|
||||
session->commit_reversible_command ();
|
||||
}
|
||||
|
||||
void
|
||||
Editor::select_all_in_track (Selection::Operation op)
|
||||
{
|
||||
@ -1297,6 +1351,23 @@ Editor::select_all_within (jack_nframes_t start, jack_nframes_t end, double top,
|
||||
return !touched.empty();
|
||||
}
|
||||
|
||||
void
|
||||
Editor::set_selection_from_audio_region ()
|
||||
{
|
||||
if (selection->audio_regions.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
AudioRegionView* rv = *(selection->audio_regions.begin());
|
||||
Region& region = rv->region;
|
||||
|
||||
begin_reversible_command (_("set selection from region"));
|
||||
selection->set (0, region.position(), region.last_frame());
|
||||
commit_reversible_command ();
|
||||
|
||||
set_mouse_mode (Editing::MouseRange, false);
|
||||
}
|
||||
|
||||
void
|
||||
Editor::set_selection_from_punch()
|
||||
{
|
||||
@ -1330,6 +1401,8 @@ Editor::set_selection_from_range (Location& loc)
|
||||
begin_reversible_command (_("set selection from range"));
|
||||
selection->set (0, loc.start(), loc.end());
|
||||
commit_reversible_command ();
|
||||
|
||||
set_mouse_mode (Editing::MouseRange, false);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user