allow button release events to be processed for region selection ops
[ardour.git] / gtk2_ardour / ardour_dialog.cc
index bc24389948cfb993118a1fa082ed1cbfb9636f1a..c0e17087818cf9d98498a85f4390d66792a2641c 100644 (file)
 */
 
 #include <iostream>
+#include <sigc++/bind.h>
 
 #include <gtkmm2ext/doi.h>
 
 #include "ardour_dialog.h"
 #include "keyboard.h"
-#include "ardour_ui.h"
 #include "splash.h"
 
+using namespace std;
+using namespace Gtk;
+using namespace Gtkmm2ext;
+
+sigc::signal<void> ArdourDialog::CloseAllDialogs;
+
 ArdourDialog::ArdourDialog (string title, bool modal, bool use_seperator)
        : Dialog (title, modal, use_seperator)
 {
-       session = 0;
-
-       set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG);
+       init ();
 }
 
 ArdourDialog::ArdourDialog (Gtk::Window& parent, string title, bool modal, bool use_seperator)
        : Dialog (title, parent, modal, use_seperator)
 {
-       session = 0;
-
-       set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG);
+       init ();
        set_position (Gtk::WIN_POS_CENTER_ON_PARENT);
 }
 
@@ -51,19 +53,20 @@ bool
 ArdourDialog::on_enter_notify_event (GdkEventCrossing *ev)
 {
        Keyboard::the_keyboard().enter_window (ev, this);
-       return false;
+       return Dialog::on_enter_notify_event (ev);
 }
 
 bool
 ArdourDialog::on_leave_notify_event (GdkEventCrossing *ev)
 {
        Keyboard::the_keyboard().leave_window (ev, this);
-       return false;
+       return Dialog::on_leave_notify_event (ev);
 }
 
 void
 ArdourDialog::on_unmap ()
 {
+       Keyboard::the_keyboard().leave_window (0, this);
        Dialog::on_unmap ();
 }
 
@@ -75,8 +78,18 @@ ArdourDialog::on_show ()
        Splash* spl = Splash::instance();
 
        if (spl) {
-               spl->pop_back ();
+               spl->pop_back_for (*this);
        }
 
        Dialog::on_show ();
 }
+
+void
+ArdourDialog::init ()
+{
+       set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG);
+       set_border_width (10);
+       CloseAllDialogs.connect (
+               sigc::bind (sigc::mem_fun (*this, &ArdourDialog::response),
+                           RESPONSE_CANCEL));
+}