diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-03-31 23:00:40 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-03-31 23:00:40 +0000 |
commit | 2aced5ff6515cc3222e0b09e55dbc35c23ba7fb1 (patch) | |
tree | 7fe29220e7f12a1490c01dfbfd9e818e15a800e5 /gtk2_ardour | |
parent | 1bde5eabc6258655c1f3baeca61d79f32d270914 (diff) |
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
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/editor.cc | 44 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 73 |
3 files changed, 82 insertions, 37 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index bdb8e841cb..f17da2b31c 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -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) { diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 632b52832c..578fb80aba 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -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 (); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index d5a87594c3..7ce6f46577 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -1193,6 +1193,60 @@ Editor::temporal_zoom_to_frame (bool coarser, jack_nframes_t frame) } 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) { list<Selectable *> touched; @@ -1298,6 +1352,23 @@ Editor::select_all_within (jack_nframes_t start, jack_nframes_t end, double top, } 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() { Location* location; @@ -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 |