summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2008-06-17 21:47:40 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2008-06-17 21:47:40 +0000
commitc05d4751f936833ded835e357a1879f0b017425f (patch)
tree37b28509b3d03417e8438d05677f070a4bed819f /gtk2_ardour
parent5b578911083910b5d3c20b939884a2c5972f3d89 (diff)
initial implementation of "make range to next marker" and "export range" context menu item for range markers
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3470 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/editor.h2
-rw-r--r--gtk2_ardour/editor_markers.cc57
2 files changed, 59 insertions, 0 deletions
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 4b0faa0055..0099bb3fc5 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -1454,6 +1454,8 @@ public:
void marker_menu_set_playhead ();
void marker_menu_set_from_playhead ();
void marker_menu_set_from_selection ();
+ void marker_menu_range_to_next ();
+ void marker_menu_export_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_markers.cc b/gtk2_ardour/editor_markers.cc
index b905e3a6a9..d3e9548b8f 100644
--- a/gtk2_ardour/editor_markers.cc
+++ b/gtk2_ardour/editor_markers.cc
@@ -597,6 +597,8 @@ Editor::build_marker_menu (bool start_or_end)
items.push_back (SeparatorElem());
+ items.push_back (MenuElem (_("Create range to next marker"), mem_fun(*this, &Editor::marker_menu_range_to_next)));
+
items.push_back (MenuElem (_("Hide"), mem_fun(*this, &Editor::marker_menu_hide)));
if (start_or_end) return;
items.push_back (MenuElem (_("Rename"), mem_fun(*this, &Editor::marker_menu_rename)));
@@ -636,6 +638,10 @@ Editor::build_range_marker_menu (bool loop_or_punch)
items.push_back (SeparatorElem());
+ items.push_back (MenuElem (_("Export Range"), mem_fun(*this, &Editor::marker_menu_export_range)));
+
+ items.push_back (SeparatorElem());
+
if (!loop_or_punch) {
items.push_back (MenuElem (_("Hide Range"), mem_fun(*this, &Editor::marker_menu_hide)));
items.push_back (MenuElem (_("Rename Range"), mem_fun(*this, &Editor::marker_menu_rename)));
@@ -812,6 +818,57 @@ Editor::marker_menu_set_playhead ()
}
void
+Editor::marker_menu_export_range ()
+{
+ Marker* marker;
+
+ if ((marker = reinterpret_cast<Marker *> (marker_menu_item->get_data ("marker"))) == 0) {
+ fatal << _("programming error: marker canvas item has no marker object pointer!") << endmsg;
+ /*NOTREACHED*/
+ }
+
+ Location* l;
+ bool is_start;
+
+ if ((l = find_location_from_marker (marker, is_start)) != 0) {
+ if (l->is_range_marker()) {
+ export_range (l->start(), l->end());
+ }
+ }
+}
+
+void
+Editor::marker_menu_range_to_next ()
+{
+ Marker* marker;
+ if (!session) {
+ return;
+ }
+
+ if ((marker = reinterpret_cast<Marker *> (marker_menu_item->get_data ("marker"))) == 0) {
+ fatal << _("programming error: marker canvas item has no marker object pointer!") << endmsg;
+ /*NOTREACHED*/
+ }
+
+ Location* l;
+ bool is_start;
+
+ if ((l = find_location_from_marker (marker, is_start)) == 0) {
+ return;
+ }
+
+ nframes_t end = session->locations()->first_mark_after (marker->position());
+
+ if (end != max_frames) {
+ string range_name = l->name();
+ range_name += "-range";
+
+ Location* newrange = new Location (marker->position(), end, range_name, Location::IsRangeMarker);
+ session->locations()->add (newrange);
+ }
+}
+
+void
Editor::marker_menu_set_from_playhead ()
{
Marker* marker;