X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fardour_dialog.cc;h=7c78677d3ebde3d341d462c15388268cb7f612ab;hb=a0b9c52a5e781f4b1514ffe8c21d2250b5c0ebaf;hp=030be0486e4bf3e11a66a0c9917e1dca55cffc29;hpb=fb45ffea71d345ced0cfbb12b9dcd89ecb1e8dbf;p=ardour.git diff --git a/gtk2_ardour/ardour_dialog.cc b/gtk2_ardour/ardour_dialog.cc index 030be0486e..7c78677d3e 100644 --- a/gtk2_ardour/ardour_dialog.cc +++ b/gtk2_ardour/ardour_dialog.cc @@ -18,23 +18,34 @@ */ #include +#include #include #include "ardour_dialog.h" #include "keyboard.h" #include "ardour_ui.h" +#include "splash.h" +#include "public_editor.h" +#include "utils.h" +using namespace std; +using namespace sigc; +using namespace Gtk; -ArdourDialog::ArdourDialog (string name) - : Dialog (name) +sigc::signal ArdourDialog::CloseAllDialogs; + +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; + init (); +} + +ArdourDialog::ArdourDialog (Gtk::Window& parent, string title, bool modal, bool use_seperator) + : Dialog (title, parent, modal, use_seperator) +{ + init (); + set_position (Gtk::WIN_POS_CENTER_ON_PARENT); } ArdourDialog::~ArdourDialog () @@ -44,84 +55,49 @@ ArdourDialog::~ArdourDialog () bool ArdourDialog::on_enter_notify_event (GdkEventCrossing *ev) { - if (ev->detail != GDK_NOTIFY_INFERIOR) { - // GTK2FIX - //Keyboard::the_keyboard().set_current_dialog (this); - } + Keyboard::the_keyboard().enter_window (ev, this); return false; } bool ArdourDialog::on_leave_notify_event (GdkEventCrossing *ev) { - if (ev->detail != GDK_NOTIFY_INFERIOR) { - // GTK2FIX - //Keyboard::the_keyboard().set_current_dialog (0); - } + Keyboard::the_keyboard().leave_window (ev, this); return false; } void ArdourDialog::on_unmap () { - _within_hiding = true; - _within_hiding = false; + Keyboard::the_keyboard().leave_window (0, this); Dialog::on_unmap (); } void -ArdourDialog::set_hide_on_stop (bool yn) +ArdourDialog::on_show () { - hide_on_stop = yn; -} + // never allow the splash screen to obscure any dialog -void -ArdourDialog::stop (int rr) -{ - if (hide_on_stop) { - hide_all (); - } + Splash* spl = Splash::instance(); - if (running) { - if (rr == 0) { - response (GTK_RESPONSE_ACCEPT); - } else { - response (GTK_RESPONSE_CANCEL); - } - running = false; + if (spl) { + spl->pop_back (); } -} -void -ArdourDialog::run () -{ - show_all (); - - running = true; - switch (Dialog::run ()) { - case GTK_RESPONSE_ACCEPT: - _run_status = 0; - break; - - case GTK_RESPONSE_DELETE_EVENT: - _run_status = -1; - break; - - default: - _run_status = -1; - } - - hide_all (); + Dialog::on_show (); } -void -ArdourDialog::set_keyboard_input (bool yn) +void +ArdourDialog::init () { - kbd_input = yn; + session = 0; + set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG); + set_border_width (10); + CloseAllDialogs.connect (bind (mem_fun (*this, &ArdourDialog::response), RESPONSE_CANCEL)); } -int -ArdourDialog::run_status () +bool +ArdourDialog::on_key_press_event (GdkEventKey* key) { - return _run_status; + return Gtk::Dialog::on_key_press_event (key); }