#include "ardour/midi_ui.h"
#include "ardour/operations.h"
#include "ardour/playlist.h"
+#include "ardour/playlist_factory.h"
#include "ardour/plugin.h"
#include "ardour/plugin_insert.h"
#include "ardour/process_thread.h"
/* set this name in the XML description that we are about to use */
- bool rename_playlist;
- switch (pd) {
- case NewPlaylist:
- case CopyPlaylist:
- rename_playlist = true;
- break;
- default:
- case SharePlaylist:
- rename_playlist = false;
+ if (pd == CopyPlaylist) {
+ XMLNode* ds_node = find_named_node (node_copy, "Diskstream");
+ if (ds_node) {
+ const std::string playlist_name = ds_node->property (X_("playlist"))->value ();
+ boost::shared_ptr<Playlist> playlist = playlists->by_name (playlist_name);
+ // Use same name as Route::set_name_in_state so playlist copy
+ // is picked up when creating the Route in XMLRouteFactory below
+ PlaylistFactory::create (playlist, string_compose ("%1.1", name));
+ }
}
+ bool rename_playlist = (pd == CopyPlaylist || pd == NewPlaylist);
+
Route::set_name_in_state (node_copy, name, rename_playlist);
/* trim bitslots from listen sends so that new ones are used */
route->output()->changed (change, this);
}
- boost::shared_ptr<Track> track;
-
- if ((track = boost::dynamic_pointer_cast<Track> (route))) {
- switch (pd) {
- case NewPlaylist:
- break;
- case CopyPlaylist:
- track->use_copy_playlist ();
- break;
- case SharePlaylist:
- break;
- }
- };
-
ret.push_back (route);
}