Remove close/OK buttons from engine dialog
authorRobin Gareus <robin@gareus.org>
Wed, 30 Nov 2016 13:44:36 +0000 (14:44 +0100)
committerRobin Gareus <robin@gareus.org>
Wed, 30 Nov 2016 13:44:36 +0000 (14:44 +0100)
gtk2_ardour/ardour_ui.cc
gtk2_ardour/engine_dialog.cc
gtk2_ardour/engine_dialog.h

index 49e1665188f0cd711db9619c626eb2f2f1010bca..224ffef9dd0e42dd140513317a2919210264eab8 100644 (file)
@@ -5347,16 +5347,16 @@ ARDOUR_UI::do_audio_midi_setup (uint32_t desired_sample_rate)
 
        while (true) {
                int response = audio_midi_setup->run();
+               printf("RESPONSE %d\n", response);
                switch (response) {
-               case Gtk::RESPONSE_OK:
+               case Gtk::RESPONSE_DELETE_EVENT:
+                       return -1;
+               default:
                        if (!AudioEngine::instance()->running()) {
                                continue;
-                       } else {
-                               return 0;
                        }
+                       audio_midi_setup->hide ();
                        return 0;
-               default:
-                       return -1;
                }
        }
 }
index 192c7501318e1c563a90bec328fd9a42e69f28a3..63883eb7c9a57481536d4db0c00a83d605f58f19 100644 (file)
@@ -276,6 +276,7 @@ EngineControl::EngineControl ()
        start_stop_button.set_sensitive (false);
        start_stop_button.set_name ("generic button");
        start_stop_button.set_can_focus(true);
+       start_stop_button.set_can_default(true);
 
        update_devices_button.signal_clicked.connect (mem_fun (*this, &EngineControl::update_devices_button_clicked));
        update_devices_button.set_sensitive (false);
@@ -287,9 +288,6 @@ EngineControl::EngineControl ()
        use_buffered_io_button.set_name ("generic button");
        use_buffered_io_button.set_can_focus(true);
 
-       cancel_button = add_button (Gtk::Stock::CLOSE, Gtk::RESPONSE_CANCEL);
-       ok_button = add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK);
-
        /* Pick up any existing audio setup configuration, if appropriate */
 
        XMLNode* audio_setup = ARDOUR::Config->extra_xml ("AudioMIDISetup");
@@ -420,7 +418,7 @@ EngineControl::on_show ()
                backend_changed ();
        }
        device_changed ();
-       ok_button->grab_focus();
+       start_stop_button.grab_focus();
 }
 
 bool
@@ -459,49 +457,6 @@ EngineControl::stop_engine (bool for_latency)
        return true;
 }
 
-void
-EngineControl::on_response (int response_id)
-{
-       ArdourDialog::on_response (response_id);
-
-       switch (response_id) {
-       case RESPONSE_OK:
-               hide();
-               if (!start_engine()) {
-                       show();
-                       return;
-               }
-#ifdef PLATFORM_WINDOWS
-
-               // But if there's no session open, this can produce
-               // a long gap when nothing appears to be happening.
-               // Let's show the splash image while we're waiting.
-               if (!ARDOUR_COMMAND_LINE::no_splash) {
-                       if (ARDOUR_UI::instance()) {
-                               if (!ARDOUR_UI::instance()->session_loaded) {
-                                       ARDOUR_UI::instance()->show_splash();
-                               }
-                       }
-               }
-#endif
-               break;
-       case RESPONSE_DELETE_EVENT: {
-               GdkEventButton ev;
-               ev.type = GDK_BUTTON_PRESS;
-               ev.button = 1;
-               on_delete_event((GdkEventAny*)&ev);
-               break;
-       }
-       case RESPONSE_CANCEL:
-               if (ARDOUR_UI::instance() && ARDOUR_UI::instance()->session_loaded) {
-                       ARDOUR_UI::instance()->check_audioengine(*this);
-               }
-       // fall through
-       default:
-               hide();
-       }
-}
-
 void
 EngineControl::build_notebook ()
 {
@@ -798,7 +753,6 @@ EngineControl::update_sensitivity ()
 {
        boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();
        if (!backend) {
-               ok_button->set_sensitive (false);
                start_stop_button.set_sensitive (false);
                return;
        }
@@ -924,12 +878,6 @@ EngineControl::update_sensitivity ()
                        driver_combo.set_sensitive (false);
                }
        }
-
-       if (valid || !_have_control) {
-               ok_button->set_sensitive (true);
-       } else {
-               ok_button->set_sensitive (false);
-       }
 }
 
 void
@@ -2758,7 +2706,13 @@ EngineControl::start_stop_button_clicked ()
        if (ARDOUR::AudioEngine::instance()->running()) {
                ARDOUR::AudioEngine::instance()->stop ();
        } else {
+               if (!ARDOUR_UI::instance()->session_loaded) {
+                       hide ();
+               }
                start_engine ();
+               if (!ARDOUR_UI::instance()->session_loaded) {
+                       ArdourDialog::on_response (RESPONSE_OK);
+               }
        }
 }
 
@@ -2823,12 +2777,8 @@ void
 EngineControl::on_switch_page (GtkNotebookPage*, guint page_num)
 {
        if (page_num == 0) {
-               cancel_button->set_sensitive (true);
                _measure_midi.reset();
                update_sensitivity ();
-       } else {
-               cancel_button->set_sensitive (false);
-               ok_button->set_sensitive (false);
        }
 
        if (page_num == midi_tab) {
@@ -3169,7 +3119,13 @@ EngineControl::connect_disconnect_click()
        if (ARDOUR::AudioEngine::instance()->running()) {
                stop_engine ();
        } else {
+               if (!ARDOUR_UI::instance()->session_loaded) {
+                       hide ();
+               }
                start_engine ();
+               if (!ARDOUR_UI::instance()->session_loaded) {
+                       ArdourDialog::on_response (RESPONSE_OK);
+               }
        }
 }
 
index 8f47f2b5a35d3668cc7c5f4adf0f7754999e13bf..af13c3f78cb453c233b2d40e8956b42173ae05d3 100644 (file)
@@ -109,9 +109,6 @@ class EngineControl : public ArdourDialog, public PBD::ScopedConnectionList {
     bool              have_lm_results;
     bool              lm_running;
 
-    Gtk::Button* cancel_button;
-    Gtk::Button* ok_button;
-
     /* MIDI Tab */
 
     Gtk::VBox midi_vbox;
@@ -307,7 +304,6 @@ class EngineControl : public ArdourDialog, public PBD::ScopedConnectionList {
        sigc::connection output_channels_connection;
 
     void on_show ();
-    void on_response (int);
     void control_app_button_clicked ();
     void start_stop_button_clicked ();
     void update_devices_button_clicked ();