summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/editor.h1
-rw-r--r--gtk2_ardour/editor_actions.cc1
-rw-r--r--gtk2_ardour/editor_ops.cc24
-rw-r--r--gtk2_ardour/route_time_axis.cc21
-rw-r--r--gtk2_ardour/route_time_axis.h2
5 files changed, 48 insertions, 1 deletions
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 8150f44ae3..83d8b394c3 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -1099,6 +1099,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void duplicate_some_regions (RegionSelection&, float times);
void duplicate_selection (float times);
void region_fill_selection ();
+ void join_regions ();
void region_fill_track ();
void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc
index bf2af13f52..0081a806aa 100644
--- a/gtk2_ardour/editor_actions.cc
+++ b/gtk2_ardour/editor_actions.cc
@@ -1372,6 +1372,7 @@ Editor::register_region_actions ()
reg_sens (_region_actions, "play-selected-regions", _("Play"), sigc::mem_fun(*this, &Editor::play_selected_region));
reg_sens (_region_actions, "bounce-region", _("Bounce"), sigc::mem_fun (*this, &Editor::bounce_region_selection));
+ reg_sens (_region_actions, "join-regions", _("Join"), sigc::mem_fun (*this, &Editor::join_regions));
reg_sens (_region_actions, "analyze-region", _("Spectral Analysis..."), sigc::mem_fun (*this, &Editor::analyze_region_selection));
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 935694a640..5f361ae153 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -6401,3 +6401,27 @@ Editor::toggle_region_mute ()
commit_reversible_command ();
}
+void
+Editor::join_regions ()
+{
+ /* foreach track with selected regions, take all selected regions
+ and join them into a new region containing the subregions (as a
+ playlist)
+ */
+
+ typedef set<RouteTimeAxisView*> RTVS;
+ RTVS tracks;
+
+ for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) {
+ RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(&(*i)->get_time_axis_view());
+
+ if (rtv) {
+ tracks.insert (rtv);
+ }
+ }
+
+ for (RTVS::iterator i = tracks.begin(); i != tracks.end(); ++i) {
+ (*i)->join_regions ();
+ }
+}
+
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc
index 8871b7bbe1..449718d15a 100644
--- a/gtk2_ardour/route_time_axis.cc
+++ b/gtk2_ardour/route_time_axis.cc
@@ -2477,3 +2477,24 @@ RouteTimeAxisView::create_gain_automation_child (const Evoral::Parameter& param,
add_automation_child (Evoral::Parameter(GainAutomation), gain_track, show);
}
+
+static
+void add_region_to_list (RegionView* rv, Playlist::RegionList* l)
+{
+ l->push_back (rv->region());
+}
+
+void
+RouteTimeAxisView::join_regions ()
+{
+ assert (is_track());
+
+ if (!_view) {
+ return;
+ }
+
+ Playlist::RegionList selected_regions;
+
+ _view->foreach_selected_regionview (sigc::bind (sigc::ptr_fun (add_region_to_list), &selected_regions));
+ track()->playlist()->join (selected_regions, "foshizzle");
+}
diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h
index c68dc573ea..d596de3df7 100644
--- a/gtk2_ardour/route_time_axis.h
+++ b/gtk2_ardour/route_time_axis.h
@@ -94,7 +94,7 @@ public:
/* Editing operations */
void cut_copy_clear (Selection&, Editing::CutCopyOp);
bool paste (ARDOUR::framepos_t, float times, Selection&, size_t nth);
-
+ void join_regions ();
void toggle_automation_track (const Evoral::Parameter& param);
/* The editor calls these when mapping an operation across multiple tracks */