X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fardour_dialog.cc;h=c5162919d405337eeee1864c2936e0d5cb271913;hb=fc7a2e9ee1616cdcb78d6b60804baff336ad07ee;hp=dba574540e1adec87dfde805464720435a1f3cdc;hpb=e493b2b7c4fbbbfc457f02babf9546289b430177;p=ardour.git diff --git a/gtk2_ardour/ardour_dialog.cc b/gtk2_ardour/ardour_dialog.cc index dba574540e..c5162919d4 100644 --- a/gtk2_ardour/ardour_dialog.cc +++ b/gtk2_ardour/ardour_dialog.cc @@ -26,144 +26,34 @@ #include "ardour_ui.h" -ArdourDialog::ArdourDialog (string name) - : Gtk::Window (GTK_WINDOW_TOPLEVEL), - KeyboardTarget (*this, name) +ArdourDialog::ArdourDialog (string title, bool modal, bool use_seperator) + : Dialog (title, modal, use_seperator) { session = 0; - kbd_input = false; - running = false; - _run_status = 0; - _within_hiding = false; - hide_on_stop = true; -} - -ArdourDialog::~ArdourDialog () -{ -} - -gint -ArdourDialog::enter_notify_event_impl (GdkEventCrossing *ev) -{ - if (ev->detail != GDK_NOTIFY_INFERIOR) { - Keyboard::the_keyboard().set_current_dialog (this); - } - return FALSE; -} - -gint -ArdourDialog::leave_notify_event_impl (GdkEventCrossing *ev) -{ - if (ev->detail != GDK_NOTIFY_INFERIOR) { - Keyboard::the_keyboard().set_current_dialog (0); - } - return FALSE; -} - -gint -ArdourDialog::unmap_event_impl (GdkEventAny *ev) -{ - _within_hiding = true; - Hiding (); /* EMIT_SIGNAL */ - _within_hiding = false; - return Gtk::Window::unmap_event_impl (ev); -} - -void -ArdourDialog::wm_close() -{ - stop (-1); - ARDOUR_UI::instance()->allow_focus(false); -} - -void -ArdourDialog::wm_doi () -{ - if (!hide_on_stop) { - Hiding (); /* EMIT_SIGNAL */ - } - stop (-1); - delete_when_idle (this); -} - -gint -ArdourDialog::wm_close_event (GdkEventAny* ev) -{ - wm_close (); - return TRUE; -} -gint -ArdourDialog::wm_doi_event (GdkEventAny* ev) -{ - wm_doi (); - return TRUE; + set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG); } -gint -ArdourDialog::wm_doi_event_stop (GdkEventAny* ev) +ArdourDialog::~ArdourDialog () { - stop (-1); - return TRUE; } -void -ArdourDialog::set_hide_on_stop (bool yn) +bool +ArdourDialog::on_enter_notify_event (GdkEventCrossing *ev) { - hide_on_stop = yn; + Keyboard::the_keyboard().enter_window (ev, this); + return false; } -void -ArdourDialog::close () +bool +ArdourDialog::on_leave_notify_event (GdkEventCrossing *ev) { - hide_all (); - - if (kbd_input) { - ARDOUR_UI::instance()->allow_focus (false); - } + Keyboard::the_keyboard().leave_window (ev, this); + return false; } void -ArdourDialog::stop (int rr) -{ - _run_status = rr; - - if (hide_on_stop) { - Hiding (); /* EMIT_SIGNAL */ - hide_all (); - - if (kbd_input) { - ARDOUR_UI::instance()->allow_focus (false); - } - } - - if (running) { - Gtk::Main::quit (); - running = false; - } -} - -void -ArdourDialog::run () -{ - show_all (); - - if (kbd_input) { - ARDOUR_UI::instance()->allow_focus (true); - } - - running = true; - Gtk::Main::run (); -} - -void -ArdourDialog::set_keyboard_input (bool yn) -{ - kbd_input = yn; -} - -int -ArdourDialog::run_status () +ArdourDialog::on_unmap () { - return _run_status; + Dialog::on_unmap (); }