From 27d0b67b8f2b9b1d3550a191d8df0de13e2af532 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 30 Nov 2016 14:44:36 +0100 Subject: Remove close/OK buttons from engine dialog --- gtk2_ardour/ardour_ui.cc | 10 +++--- gtk2_ardour/engine_dialog.cc | 72 +++++++++----------------------------------- gtk2_ardour/engine_dialog.h | 4 --- 3 files changed, 19 insertions(+), 67 deletions(-) diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 49e1665188..224ffef9dd 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -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; } } } diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc index 192c750131..63883eb7c9 100644 --- a/gtk2_ardour/engine_dialog.cc +++ b/gtk2_ardour/engine_dialog.cc @@ -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 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); + } } } diff --git a/gtk2_ardour/engine_dialog.h b/gtk2_ardour/engine_dialog.h index 8f47f2b5a3..af13c3f78c 100644 --- a/gtk2_ardour/engine_dialog.h +++ b/gtk2_ardour/engine_dialog.h @@ -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 (); -- cgit v1.2.3