From c937a67f6ee7e9f280a097683528201489ae6930 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 30 May 2011 11:57:12 +0000 Subject: do not offer combine operation for MIDI (see comment in libs/ardour/midi_playlist_source.cc for an explanation) git-svn-id: svn://localhost/ardour2/branches/3.0@9630 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor_selection.cc | 6 +++++- gtk2_ardour/midi_list_editor.cc | 6 ++++++ gtk2_ardour/route_time_axis.cc | 13 +++++++++++-- libs/ardour/midi_playlist_source.cc | 21 +++++++++++++++------ 4 files changed, 37 insertions(+), 9 deletions(-) diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc index 6e81801096..d81b8a4351 100644 --- a/gtk2_ardour/editor_selection.cc +++ b/gtk2_ardour/editor_selection.cc @@ -1067,7 +1067,11 @@ Editor::sensitize_the_right_region_actions () _region_actions->get_action("show-region-list-editor")->set_sensitive (false); _region_actions->get_action("show-region-properties")->set_sensitive (false); _region_actions->get_action("rename-region")->set_sensitive (false); - _region_actions->get_action("combine-regions")->set_sensitive (true); + if (have_audio) { + _region_actions->get_action("combine-regions")->set_sensitive (true); + } else { + _region_actions->get_action("combine-regions")->set_sensitive (false); + } } else if (rs.size() == 1) { _region_actions->get_action("add-range-markers-from-region")->set_sensitive (false); _region_actions->get_action("close-region-gaps")->set_sensitive (false); diff --git a/gtk2_ardour/midi_list_editor.cc b/gtk2_ardour/midi_list_editor.cc index de1331674e..c8c016d9a8 100644 --- a/gtk2_ardour/midi_list_editor.cc +++ b/gtk2_ardour/midi_list_editor.cc @@ -38,6 +38,12 @@ MidiListEditor::MidiListEditor (Session* s, boost::shared_ptr r) : ArdourDialog (r->name(), false, false) , region (r) { + /* We do not handle nested sources/regions. Caller should have tackled this */ + + if (r->max_source_level() > 0) { + throw failed_constructor(); + } + set_session (s); model = ListStore::create (columns); diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 86832de764..1c9b02ba95 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -2488,7 +2488,12 @@ void add_region_to_list (RegionView* rv, Playlist::RegionList* l) RegionView* RouteTimeAxisView::combine_regions () { - assert (is_track()); + /* as of may 2011, we do not offer uncombine for MIDI tracks + */ + + if (!is_audio_track()) { + return 0; + } if (!_view) { return 0; @@ -2515,7 +2520,11 @@ RouteTimeAxisView::combine_regions () void RouteTimeAxisView::uncombine_regions () { - assert (is_track()); + /* as of may 2011, we do not offer uncombine for MIDI tracks + */ + if (!is_audio_track()) { + return; + } if (!_view) { return; diff --git a/libs/ardour/midi_playlist_source.cc b/libs/ardour/midi_playlist_source.cc index 713aadf5b1..bdf642281a 100644 --- a/libs/ardour/midi_playlist_source.cc +++ b/libs/ardour/midi_playlist_source.cc @@ -46,11 +46,22 @@ using namespace std; using namespace ARDOUR; using namespace PBD; +/******************************************************************************* +As of May 2011, it appears too complex to support compound regions for MIDI +because of the need to be able to edit the data represented by the region. It +seems that it would be a better idea to render the consituent regions into a +new MIDI file and create a new region based on that, an operation we have been +calling "consolidate" + +This code has been in place as a stub in case anyone gets any brilliant ideas +on other ways to approach this issue. +********************************************************************************/ + MidiPlaylistSource::MidiPlaylistSource (Session& s, const ID& orig, const std::string& name, boost::shared_ptr p, uint32_t chn, frameoffset_t begin, framecnt_t len, Source::Flag flags) - : Source (s, DataType::AUDIO, name) + : Source (s, DataType::MIDI, name) , MidiSource (s, name, flags) - , PlaylistSource (s, orig, name, p, DataType::AUDIO, begin, len, flags) + , PlaylistSource (s, orig, name, p, DataType::MIDI, begin, len, flags) { } @@ -157,15 +168,13 @@ MidiPlaylistSource::append_event_unlocked_frames(const Evoral::Event void MidiPlaylistSource::load_model (bool, bool) { - fatal << string_compose (_("programming error: %1"), "MidiPlaylistSource::load_model() called - should be impossible") << endmsg; - /*NOTREACHED*/ + /* nothing to do */ } void MidiPlaylistSource::destroy_model () { - fatal << string_compose (_("programming error: %1"), "MidiPlaylistSource::destroy_model() called - should be impossible") << endmsg; - /*NOTREACHED*/ + /* nothing to do */ } void -- cgit v1.2.3