diff options
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/ardour.menus.in | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor_actions.cc | 1 | ||||
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 27 | ||||
-rw-r--r-- | gtk2_ardour/editor_selection.cc | 9 | ||||
-rw-r--r-- | gtk2_ardour/route_time_axis.cc | 31 | ||||
-rw-r--r-- | gtk2_ardour/route_time_axis.h | 2 |
6 files changed, 71 insertions, 1 deletions
diff --git a/gtk2_ardour/ardour.menus.in b/gtk2_ardour/ardour.menus.in index 5fad03a1c1..af423cbb23 100644 --- a/gtk2_ardour/ardour.menus.in +++ b/gtk2_ardour/ardour.menus.in @@ -229,6 +229,7 @@ <menuitem action='export-region'/> <menuitem action='bounce-region'/> <menuitem action='combine-regions'/> + <menuitem action='uncombine-regions'/> <menuitem action='analyze-region'/> <menuitem action='toggle-region-lock'/> <menuitem action='toggle-region-lock-style'/> @@ -590,6 +591,7 @@ <menuitem action='transpose-region'/> <menuitem action='naturalize-region'/> <menuitem action='combine-regions'/> + <menuitem action='uncombine-regions'/> <menuitem action='split-region'/> <menuitem action='split-multichannel-region'/> <menuitem action='remove-region'/> diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index a45279b6bb..74cc69e6db 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -1373,6 +1373,7 @@ Editor::register_region_actions () reg_sens (_region_actions, "bounce-region", _("Bounce"), sigc::mem_fun (*this, &Editor::bounce_region_selection)); reg_sens (_region_actions, "combine-regions", _("Combine"), sigc::mem_fun (*this, &Editor::combine_regions)); + reg_sens (_region_actions, "uncombine-regions", _("Uncombine"), sigc::mem_fun (*this, &Editor::uncombine_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 a6bba7d76c..02bf220b4d 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -6434,3 +6434,30 @@ Editor::combine_regions () commit_reversible_command (); } +void +Editor::uncombine_regions () +{ + typedef set<RouteTimeAxisView*> RTVS; + RTVS tracks; + + if (selection->regions.empty()) { + return; + } + + 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); + } + } + + begin_reversible_command (_("uncombine regions")); + + for (RTVS::iterator i = tracks.begin(); i != tracks.end(); ++i) { + (*i)->uncombine_regions (); + } + + commit_reversible_command (); +} + diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc index 3ec11ea410..38ee5dff3c 100644 --- a/gtk2_ardour/editor_selection.cc +++ b/gtk2_ardour/editor_selection.cc @@ -989,6 +989,7 @@ Editor::sensitize_the_right_region_actions () bool have_envelope_active = false; bool have_envelope_inactive = false; bool have_non_unity_scale_amplitude = false; + bool have_compound_regions = false; for (list<RegionView*>::const_iterator i = rs.begin(); i != rs.end(); ++i) { @@ -1003,6 +1004,10 @@ Editor::sensitize_the_right_region_actions () have_midi = true; } + if (r->is_compound()) { + have_compound_regions = true; + } + if (r->locked()) { have_locked = true; } else { @@ -1084,6 +1089,10 @@ Editor::sensitize_the_right_region_actions () _region_actions->get_action("place-transient")->set_sensitive (false); } + if (have_compound_regions) { + _region_actions->get_action("uncombine-regions")->set_sensitive (true); + } + if (have_audio) { if (have_envelope_visible && !have_envelope_invisible) { diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 2dbc8635f7..16e1d72d53 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -2503,6 +2503,35 @@ RouteTimeAxisView::combine_regions () string name = string_compose (_("%1 compound-%2 (%3)"), playlist->name(), playlist->combine_ops()+1, max_level+1); playlist->clear_changes (); - playlist->join (selected_regions, name); + playlist->combine (selected_regions, name); _session->add_command (new StatefulDiffCommand (playlist)); } + +void +RouteTimeAxisView::uncombine_regions () +{ + assert (is_track()); + + if (!_view) { + return; + } + + Playlist::RegionList selected_regions; + boost::shared_ptr<Playlist> playlist = track()->playlist(); + uint32_t max_level = 0; + + /* have to grab selected regions first because the uncombine is going + * to change that in the middle of the list traverse + */ + + _view->foreach_selected_regionview (sigc::bind (sigc::ptr_fun (add_region_to_list), &selected_regions, &max_level)); + + playlist->clear_changes (); + + for (Playlist::RegionList::iterator i = selected_regions.begin(); i != selected_regions.end(); ++i) { + playlist->uncombine (*i); + } + + _session->add_command (new StatefulDiffCommand (playlist)); +} + diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h index b06b56fc67..27e816738f 100644 --- a/gtk2_ardour/route_time_axis.h +++ b/gtk2_ardour/route_time_axis.h @@ -95,6 +95,8 @@ public: void cut_copy_clear (Selection&, Editing::CutCopyOp); bool paste (ARDOUR::framepos_t, float times, Selection&, size_t nth); void combine_regions (); + void uncombine_regions (); + void uncombine_region (RegionView*); void toggle_automation_track (const Evoral::Parameter& param); /* The editor calls these when mapping an operation across multiple tracks */ |