From 2e8d0b6534bc3d2264e07d87c63981f678f13463 Mon Sep 17 00:00:00 2001 From: Nikolay Date: Wed, 17 Dec 2014 20:55:30 +0200 Subject: [PATCH] [Summary] Bug fix. Quit form Track Live on Quit button pressed or close button in Session Dialog in the next workflow (Open session -> Close session -> press Quit button in Session Dialog) [Reviewed] VKamyshniy --- gtk2_ardour/ardour_ui.cc | 26 +++++++++++++++++--------- gtk2_ardour/session_dialog.logic.cc | 17 ++++++++++++++++- gtk2_ardour/session_dialog.logic.h | 2 ++ 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index cb697065bd..3bfcafdf84 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -2777,15 +2777,23 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri if (should_be_new || session_name.empty()) { /* need the dialog to get info from user */ - switch (session_dialog.run()) { - case RESPONSE_ACCEPT: - break; - default: - if (quit_on_cancel) { - exit (1); - } else { - return ret; - } + int response = session_dialog.run(); + switch (response) { + case Gtk::RESPONSE_ACCEPT: // existed session was choosen or new session was created + break; + case Gtk::RESPONSE_CANCEL: // cancel was pressed + case WavesDialog::RESPONSE_DEFAULT: // enter was pressed + continue; // do not act on Esc or Enter button pressed + case Gtk::RESPONSE_REJECT: // quit button pressed + UI::quit (); + return ret; + default: // this happens on Close Button pressed (at the top left corner only on Mac) + if (quit_on_cancel) { + exit (1); + } else { + UI::quit (); + return ret; + } } session_dialog.hide (); diff --git a/gtk2_ardour/session_dialog.logic.cc b/gtk2_ardour/session_dialog.logic.cc index 0138cf1670..f35a1f3b45 100644 --- a/gtk2_ardour/session_dialog.logic.cc +++ b/gtk2_ardour/session_dialog.logic.cc @@ -286,7 +286,7 @@ void SessionDialog::on_quit (WavesButton*) { hide(); - response (Gtk::RESPONSE_CANCEL); + response (Gtk::RESPONSE_REJECT); } void @@ -360,3 +360,18 @@ SessionDialog::on_system_configuration (WavesButton* clicked_button) redisplay_system_configuration (); set_keep_above(true); } + +bool +SessionDialog::on_key_press_event (GdkEventKey* ev) +{ + switch (ev->keyval) + { + case GDK_Return: + return true; + case GDK_Escape: + return true; + } + + return WavesDialog::on_key_press_event (ev); +} + diff --git a/gtk2_ardour/session_dialog.logic.h b/gtk2_ardour/session_dialog.logic.h index d9666e18d8..d0b3bd8289 100644 --- a/gtk2_ardour/session_dialog.logic.h +++ b/gtk2_ardour/session_dialog.logic.h @@ -81,6 +81,8 @@ void on_system_configuration (WavesButton*); bool on_delete_event (GdkEventAny*); + bool on_key_press_event (GdkEventKey*); + void on_system_configuration_change(); void redisplay_system_configuration(); int redisplay_recent_sessions ();