New routes are placed after highest selected route.
This commit is contained in:
parent
75271a17d8
commit
be69bf15dd
|
@ -3222,6 +3222,51 @@ ARDOUR_UI::flush_trash ()
|
|||
display_cleanup_results (rep, _("deleted file"), true);
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::setup_order_hint ()
|
||||
{
|
||||
uint32_t order_hint = 0;
|
||||
|
||||
/*
|
||||
we want the new routes to have their order keys set starting from
|
||||
the highest order key in the selection + 1 (if available).
|
||||
*/
|
||||
|
||||
for (RouteUISelection::iterator s = mixer->selection().routes.begin(); s != mixer->selection().routes.end(); ++s) {
|
||||
if ((*s)->route()->order_key() > order_hint) {
|
||||
order_hint = (*s)->route()->order_key();
|
||||
}
|
||||
}
|
||||
|
||||
for (TrackSelection::iterator s = editor->get_selection().tracks.begin(); s != editor->get_selection().tracks.end(); ++s) {
|
||||
RouteTimeAxisView* tav = dynamic_cast<RouteTimeAxisView*> (*s);
|
||||
if (tav->route()->order_key() > order_hint) {
|
||||
order_hint = tav->route()->order_key();
|
||||
}
|
||||
}
|
||||
|
||||
if (!mixer->selection().routes.empty() || !editor->get_selection().tracks.empty()) {
|
||||
order_hint++;
|
||||
}
|
||||
|
||||
_session->set_order_hint (order_hint);
|
||||
|
||||
/* create a gap in the existing route order keys to accomodate new routes.*/
|
||||
|
||||
boost::shared_ptr <RouteList> rd = _session->get_routes();
|
||||
for (RouteList::iterator ri = rd->begin(); ri != rd->end(); ++ri) {
|
||||
boost::shared_ptr<Route> rt (*ri);
|
||||
|
||||
if (rt->is_monitor()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (rt->order_key () >= order_hint) {
|
||||
rt->set_order_key (rt->order_key () + add_route_dialog->count());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::add_route (Gtk::Window* float_window)
|
||||
{
|
||||
|
@ -3256,6 +3301,8 @@ ARDOUR_UI::add_route (Gtk::Window* float_window)
|
|||
return;
|
||||
}
|
||||
|
||||
setup_order_hint();
|
||||
|
||||
PBD::ScopedConnection idle_connection;
|
||||
|
||||
if (count > 8) {
|
||||
|
|
|
@ -582,6 +582,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
|||
|
||||
void snapshot_session (bool switch_to_it);
|
||||
void rename_session ();
|
||||
void setup_order_hint ();
|
||||
|
||||
Mixer_UI *mixer;
|
||||
int create_mixer ();
|
||||
|
|
|
@ -600,9 +600,24 @@ EditorRoutes::active_changed (std::string const & path)
|
|||
void
|
||||
EditorRoutes::routes_added (list<RouteTimeAxisView*> routes)
|
||||
{
|
||||
TreeModel::Row row;
|
||||
PBD::Unwinder<bool> at (_adding_routes, true);
|
||||
|
||||
bool from_scratch = (_model->children().size() == 0);
|
||||
Gtk::TreeModel::Children::iterator insert_iter = _model->children().end();
|
||||
|
||||
for (Gtk::TreeModel::Children::iterator it = _model->children().begin(); it != _model->children().end(); ++it) {
|
||||
boost::shared_ptr<Route> r = (*it)[_columns.route];
|
||||
|
||||
if (r->order_key() == (routes.front()->route()->order_key() + routes.size())) {
|
||||
insert_iter = it;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!from_scratch) {
|
||||
_editor->selection->tracks.clear();
|
||||
}
|
||||
|
||||
suspend_redisplay ();
|
||||
|
||||
_display.set_model (Glib::RefPtr<ListStore>());
|
||||
|
@ -611,7 +626,7 @@ EditorRoutes::routes_added (list<RouteTimeAxisView*> routes)
|
|||
|
||||
boost::shared_ptr<MidiTrack> midi_trk = boost::dynamic_pointer_cast<MidiTrack> ((*x)->route());
|
||||
|
||||
row = *(_model->append ());
|
||||
TreeModel::Row row = *(_model->insert (insert_iter));
|
||||
|
||||
row[_columns.text] = (*x)->route()->name();
|
||||
row[_columns.visible] = (*x)->marked_for_display();
|
||||
|
@ -635,6 +650,10 @@ EditorRoutes::routes_added (list<RouteTimeAxisView*> routes)
|
|||
row[_columns.solo_safe_state] = (*x)->route()->solo_safe();
|
||||
row[_columns.name_editable] = true;
|
||||
|
||||
if (!from_scratch) {
|
||||
_editor->selection->add(*x);
|
||||
}
|
||||
|
||||
boost::weak_ptr<Route> wr ((*x)->route());
|
||||
|
||||
(*x)->route()->gui_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::handle_gui_changes, this, _1, _2), gui_context());
|
||||
|
|
|
@ -313,6 +313,22 @@ Mixer_UI::hide_window (GdkEventAny *ev)
|
|||
void
|
||||
Mixer_UI::add_strips (RouteList& routes)
|
||||
{
|
||||
bool from_scratch = track_model->children().size() == 0;
|
||||
Gtk::TreeModel::Children::iterator insert_iter = track_model->children().end();
|
||||
|
||||
for (Gtk::TreeModel::Children::iterator it = track_model->children().begin(); it != track_model->children().end(); ++it) {
|
||||
boost::shared_ptr<Route> r = (*it)[track_columns.route];
|
||||
|
||||
if (r->order_key() == (routes.front()->order_key() + routes.size())) {
|
||||
insert_iter = it;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!from_scratch) {
|
||||
_selection.clear_routes ();
|
||||
}
|
||||
|
||||
MixerStrip* strip;
|
||||
|
||||
try {
|
||||
|
@ -359,11 +375,15 @@ Mixer_UI::add_strips (RouteList& routes)
|
|||
|
||||
show_strip (strip);
|
||||
|
||||
TreeModel::Row row = *(track_model->append());
|
||||
TreeModel::Row row = *(track_model->insert(insert_iter));
|
||||
row[track_columns.text] = route->name();
|
||||
row[track_columns.visible] = strip->route()->is_master() ? true : strip->marked_for_display();
|
||||
row[track_columns.route] = route;
|
||||
row[track_columns.strip] = strip;
|
||||
|
||||
if (!from_scratch) {
|
||||
_selection.add (strip);
|
||||
}
|
||||
|
||||
route->PropertyChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::strip_property_changed, this, _1, strip), gui_context());
|
||||
|
||||
|
|
|
@ -241,6 +241,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
|
|||
bool operator() (boost::shared_ptr<Route>, boost::shared_ptr<Route> b);
|
||||
};
|
||||
|
||||
void set_order_hint (uint32_t order_hint) {_order_hint = order_hint;};
|
||||
void notify_remote_id_change ();
|
||||
void sync_order_keys ();
|
||||
|
||||
|
@ -1594,6 +1595,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
|
|||
GraphEdges _current_route_graph;
|
||||
|
||||
uint32_t next_control_id () const;
|
||||
uint32_t _order_hint;
|
||||
bool ignore_route_processor_changes;
|
||||
|
||||
MidiClockTicker* midi_clock;
|
||||
|
|
|
@ -257,6 +257,7 @@ Session::Session (AudioEngine &eng,
|
|||
, _step_editors (0)
|
||||
, _suspend_timecode_transmission (0)
|
||||
, _speakers (new Speakers)
|
||||
, _order_hint (0)
|
||||
, ignore_route_processor_changes (false)
|
||||
, _midi_ports (0)
|
||||
, _mmc (0)
|
||||
|
@ -2335,6 +2336,11 @@ Session::add_routes_inner (RouteList& new_routes, bool input_auto_connect, bool
|
|||
ChanCount existing_outputs;
|
||||
uint32_t order = next_control_id();
|
||||
|
||||
if (_order_hint != 0) {
|
||||
order = _order_hint;
|
||||
_order_hint = 0;
|
||||
}
|
||||
|
||||
count_existing_track_channels (existing_inputs, existing_outputs);
|
||||
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue