Fix editor sizing issue introduced in 4dc65e66
[ardour.git] / gtk2_ardour / ardour_ui.cc
index 1e762b29e3edf23418f6a9bac7f670214472e67b..6dd659420c84eff9c5ff9039dfb0ddbcec4c558b 100644 (file)
@@ -272,7 +272,6 @@ libxml_structured_error_func (void* /* parsing_context*/,
 
 ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
        : Gtkmm2ext::UI (PROGRAM_NAME, X_("gui"), argcp, argvp)
-       , session_loaded (false)
        , session_load_in_progress (false)
        , gui_object_state (new GUIObjectState)
        , primary_clock   (new MainClock (X_("primary"),   X_("transport"), true ))
@@ -1595,7 +1594,7 @@ ARDOUR_UI::update_sample_rate (samplecnt_t)
 
        ENSURE_GUI_THREAD (*this, &ARDOUR_UI::update_sample_rate, ignored)
 
-       if (!AudioEngine::instance()->connected()) {
+       if (!AudioEngine::instance()->running()) {
 
                snprintf (buf, sizeof (buf), "%s", _("Audio: <span foreground=\"red\">none</span>"));
 
@@ -1661,6 +1660,9 @@ ARDOUR_UI::update_format ()
        case MBWF:
                s << _("MBWF");
                break;
+       case FLAC:
+               s << _("FLAC");
+               break;
        }
 
        s << " ";
@@ -1895,7 +1897,7 @@ ARDOUR_UI::open_recent_session ()
 bool
 ARDOUR_UI::check_audioengine (Gtk::Window& parent)
 {
-       if (!AudioEngine::instance()->connected()) {
+       if (!AudioEngine::instance()->running()) {
                MessageDialog msg (parent, string_compose (
                                           _("%1 is not connected to any audio backend.\n"
                                           "You cannot open or close sessions in this condition"),
@@ -2119,6 +2121,32 @@ ARDOUR_UI::session_add_audio_route (
        }
 }
 
+void
+ARDOUR_UI::session_add_foldback_bus (uint32_t how_many, string const & name_template)
+{
+       RouteList routes;
+
+       assert (_session);
+
+       try {
+               routes = _session->new_audio_route (2, 2, 0, how_many, name_template, PresentationInfo::FoldbackBus, -1);
+
+               if (routes.size() != how_many) {
+                       error << string_compose (P_("could not create %1 new foldback bus", "could not create %1 new foldback busses", how_many), how_many)
+                             << endmsg;
+               }
+       }
+
+       catch (...) {
+               display_insufficient_ports_message ();
+               return;
+       }
+
+       for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
+               (*i)->set_strict_io (true);
+       }
+}
+
 void
 ARDOUR_UI::display_insufficient_ports_message ()
 {
@@ -2684,7 +2712,7 @@ If you still wish to proceed, please use the\n\n\
                                        msg.run ();
                                        return;
                                }
-                               // no break
+                               /* fall through */
                        case 0:
                                _session->remove_pending_capture_state ();
                                break;
@@ -2880,7 +2908,7 @@ If you still wish to proceed, please use the\n\n\
                                        msg.run ();
                                        return;
                                }
-                               // no break
+                               /* fall through */
                        case 0:
                                _session->remove_pending_capture_state ();
                                break;
@@ -3518,8 +3546,6 @@ ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name,
                }
        }
 
-       session_loaded = false;
-
        loading_message (string_compose (_("Please wait while %1 loads your session"), PROGRAM_NAME));
 
        try {
@@ -3629,8 +3655,6 @@ ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name,
 
        set_session (new_session);
 
-       session_loaded = true;
-
        if (_session) {
                _session->set_clean ();
        }
@@ -3674,7 +3698,6 @@ ARDOUR_UI::build_session (const std::string& path, const std::string& snap_name,
        Session *new_session;
        int x;
 
-       session_loaded = false;
        x = unload_session ();
 
        if (x < 0) {
@@ -3739,8 +3762,6 @@ ARDOUR_UI::build_session (const std::string& path, const std::string& snap_name,
 
        set_session (new_session);
 
-       session_loaded = true;
-
        new_session->save_state(new_session->name());
 
        return 0;
@@ -4324,6 +4345,19 @@ ARDOUR_UI::add_route_dialog_response (int r)
                return;
        }
 
+       if (!AudioEngine::instance()->running ()) {
+               switch (r) {
+                       case AddRouteDialog::Add:
+                       case AddRouteDialog::AddAndClose:
+                               break;
+                       default:
+                               return;
+               }
+               add_route_dialog->ArdourDialog::on_response (r);
+               ARDOUR_UI_UTILS::engine_is_running ();
+               return;
+       }
+
        int count;
 
        switch (r) {
@@ -4398,6 +4432,9 @@ ARDOUR_UI::add_route_dialog_response (int r)
        case AddRouteDialog::VCAMaster:
                _session->vca_manager().create_vca (count, name_template);
                break;
+       case AddRouteDialog::FoldbackBus:
+               session_add_foldback_bus (count, name_template);
+               break;
        }
 }