diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2013-10-31 13:16:51 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2013-10-31 13:16:51 -0400 |
commit | ea1ccb869a152d7344f498d2a062867f5bcf9d0b (patch) | |
tree | ef3b8dc9d60cd7d1da9ba439384336c1b0009ca2 /gtk2_ardour/ardour_ui.cc | |
parent | b80ae88154fbc1b23c97fe60192a304280c8542c (diff) | |
parent | f2300164d7a89c5e433d3293dfed4c1ab77f0553 (diff) |
fix merge with master
Diffstat (limited to 'gtk2_ardour/ardour_ui.cc')
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 101 |
1 files changed, 84 insertions, 17 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 7921dc4274..78b2963f2d 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -722,7 +722,7 @@ int ARDOUR_UI::starting () { Application* app = Application::instance (); - char *nsm_url; + const char *nsm_url; bool brand_new_user = ArdourStartup::required (); app->ShouldQuit.connect (sigc::mem_fun (*this, &ARDOUR_UI::queue_finish)); @@ -734,9 +734,17 @@ ARDOUR_UI::starting () app->ready (); - nsm_url = getenv ("NSM_URL"); + /* we need to create this early because it may need to set the + * audio backend end up. + */ + + try { + audio_midi_setup.get (true); + } catch (...) { + return -1; + } - if (nsm_url) { + if ((nsm_url = g_getenv ("NSM_URL")) != 0) { nsm = new NSM_Client; if (!nsm->init (nsm_url)) { nsm->announce (PROGRAM_NAME, ":dirty:", "ardour3"); @@ -746,19 +754,33 @@ ARDOUR_UI::starting () for ( i = 0; i < 5000; ++i) { nsm->check (); usleep (i); - if (nsm->is_active()) + if (nsm->is_active()) { break; + } + } + if (i == 5000) { + error << _("NSM server did not announce itself") << endmsg; + return -1; } // wait for open command from nsm server for ( i = 0; i < 5000; ++i) { nsm->check (); usleep (1000); - if (nsm->client_id ()) + if (nsm->client_id ()) { break; + } + } + + if (i == 5000) { + error << _("NSM: no client ID provided") << endmsg; + return -1; } if (_session && nsm) { _session->set_nsm_state( nsm->is_active() ); + } else { + error << _("NSM: no session created") << endmsg; + return -1; } // nsm requires these actions disabled @@ -777,10 +799,11 @@ ARDOUR_UI::starting () } } - } - else { + } else { delete nsm; nsm = 0; + error << _("NSM: initialization failed") << endmsg; + return -1; } } else { @@ -798,16 +821,6 @@ ARDOUR_UI::starting () } } - /* we need to create this early because it may need to set the - * audio backend end up. - */ - - try { - audio_midi_setup.get (true); - } catch (...) { - return -1; - } - /* go get a session */ const bool new_session_required = (ARDOUR_COMMAND_LINE::new_session || brand_new_user); @@ -3227,6 +3240,57 @@ ARDOUR_UI::flush_trash () } 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). + */ + if (add_route_dialog->get_transient_for () == mixer->get_toplevel()) { + 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(); + } + } + + if (!mixer->selection().routes.empty()) { + order_hint++; + } + + } else { + 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 (!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) { int count; @@ -3241,6 +3305,7 @@ ARDOUR_UI::add_route (Gtk::Window* float_window) } if (float_window) { + add_route_dialog->unset_transient_for (); add_route_dialog->set_transient_for (*float_window); } @@ -3260,6 +3325,8 @@ ARDOUR_UI::add_route (Gtk::Window* float_window) return; } + setup_order_hint(); + PBD::ScopedConnection idle_connection; if (count > 8) { |