tweak duplicate routes dialog appearance depending on whether or not busses/tracks are the target
This commit is contained in:
parent
7598520fa6
commit
456b6adf2b
|
@ -3760,6 +3760,36 @@ ARDOUR_UI::start_duplicate_routes ()
|
|||
duplicate_routes_dialog->signal_response().connect (sigc::mem_fun (*this, &ARDOUR_UI::finish_duplicate_routes));
|
||||
}
|
||||
|
||||
TrackSelection& tracks (editor->get_selection().tracks);
|
||||
uint32_t ntracks = 0;
|
||||
uint32_t nbusses = 0;
|
||||
|
||||
for (TrackSelection::iterator t = tracks.begin(); t != tracks.end(); ++t) {
|
||||
|
||||
RouteUI* rui = dynamic_cast<RouteUI*> (*t);
|
||||
|
||||
if (!rui) {
|
||||
/* some other type of timeaxis view, not a route */
|
||||
continue;
|
||||
}
|
||||
|
||||
boost::shared_ptr<Route> r (rui->route());
|
||||
|
||||
if (boost::dynamic_pointer_cast<Track> (r)) {
|
||||
ntracks++;
|
||||
} else {
|
||||
if (!r->is_master() && !r->is_monitor()) {
|
||||
nbusses++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ntracks == 0 && nbusses == 0) {
|
||||
cerr << "You can't do this\n";
|
||||
return;
|
||||
}
|
||||
|
||||
duplicate_routes_dialog->setup (ntracks, nbusses);
|
||||
duplicate_routes_dialog->present ();
|
||||
}
|
||||
|
||||
|
@ -3793,6 +3823,11 @@ ARDOUR_UI::finish_duplicate_routes (int response)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (rui->route()->is_master() || rui->route()->is_monitor()) {
|
||||
/* no option to duplicate these */
|
||||
continue;
|
||||
}
|
||||
|
||||
XMLNode& state (rui->route()->get_state());
|
||||
RouteList rl = _session->new_route_from_template (count, state, string(), playlist_disposition);
|
||||
|
||||
|
|
|
@ -32,16 +32,14 @@ DuplicateRouteDialog::DuplicateRouteDialog ()
|
|||
, count_spinner (count_adjustment)
|
||||
, count_label (_("Duplicate each track/bus this number of times"))
|
||||
{
|
||||
count_box.pack_start (count_label, false, false);
|
||||
count_box.pack_start (count_spinner, false, false);
|
||||
get_vbox()->pack_start (count_box, false, false, 20);
|
||||
|
||||
playlist_button_box.pack_start (copy_playlists_button, false, false);
|
||||
playlist_button_box.pack_start (new_playlists_button, false, false);
|
||||
playlist_button_box.pack_start (share_playlists_button, false, false);
|
||||
|
||||
get_vbox()->pack_start (playlist_button_box, false, false);
|
||||
|
||||
count_box.pack_start (count_label, false, false);
|
||||
count_box.pack_start (count_spinner, false, false);
|
||||
|
||||
get_vbox()->pack_start (count_box, false, false, 20);
|
||||
playlist_button_box.show_all ();
|
||||
|
||||
get_vbox()->show_all ();
|
||||
|
||||
|
@ -53,6 +51,20 @@ DuplicateRouteDialog::~DuplicateRouteDialog ()
|
|||
{
|
||||
}
|
||||
|
||||
void
|
||||
DuplicateRouteDialog::setup (uint32_t ntracks, uint32_t nbusses)
|
||||
{
|
||||
/* XXX grrr. Gtk Boxes do not shrink when children are removed,
|
||||
which is what we really want to happen here.
|
||||
*/
|
||||
|
||||
if (ntracks == 0) {
|
||||
get_vbox()->remove (playlist_button_box);
|
||||
} else {
|
||||
get_vbox()->pack_end (playlist_button_box, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t
|
||||
DuplicateRouteDialog::count() const
|
||||
{
|
||||
|
|
|
@ -38,6 +38,8 @@ class DuplicateRouteDialog : public ArdourDialog
|
|||
DuplicateRouteDialog ();
|
||||
~DuplicateRouteDialog ();
|
||||
|
||||
void setup (uint32_t ntracks, uint32_t nbusses);
|
||||
|
||||
uint32_t count() const;
|
||||
ARDOUR::PlaylistDisposition playlist_disposition() const;
|
||||
|
||||
|
|
Loading…
Reference in New Issue