2005-09-25 14:42:24 -04:00
|
|
|
/*
|
|
|
|
Copyright (C) 2002 Paul Davis
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <iostream>
|
2008-12-12 09:43:24 -05:00
|
|
|
#include <sigc++/bind.h>
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-09-25 16:33:00 -04:00
|
|
|
#include <gtkmm2ext/doi.h>
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#include "ardour_dialog.h"
|
2013-05-02 21:13:36 -04:00
|
|
|
#include "ardour_ui.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "keyboard.h"
|
2008-02-02 12:22:04 -05:00
|
|
|
#include "splash.h"
|
2013-05-06 10:55:40 -04:00
|
|
|
#include "utils.h"
|
2013-05-07 22:09:16 -04:00
|
|
|
#include "window_manager.h"
|
2008-12-12 09:43:24 -05:00
|
|
|
|
2009-05-12 13:03:42 -04:00
|
|
|
using namespace std;
|
2008-12-12 09:43:24 -05:00
|
|
|
using namespace Gtk;
|
2009-12-04 17:51:32 -05:00
|
|
|
using namespace Gtkmm2ext;
|
2008-12-12 09:43:24 -05:00
|
|
|
|
2005-12-02 14:18:26 -05:00
|
|
|
ArdourDialog::ArdourDialog (string title, bool modal, bool use_seperator)
|
|
|
|
: Dialog (title, modal, use_seperator)
|
2013-05-07 22:09:16 -04:00
|
|
|
, proxy (0)
|
2013-04-30 13:50:15 -04:00
|
|
|
, _splash_pushed (false)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2008-09-17 04:44:51 -04:00
|
|
|
init ();
|
2013-05-02 18:13:35 -04:00
|
|
|
set_position (Gtk::WIN_POS_MOUSE);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
ArdourDialog::ArdourDialog (Gtk::Window& parent, string title, bool modal, bool use_seperator)
|
|
|
|
: Dialog (title, parent, modal, use_seperator)
|
2013-04-30 13:50:15 -04:00
|
|
|
, _splash_pushed (false)
|
2007-10-11 18:07:47 -04:00
|
|
|
{
|
2008-09-17 04:44:51 -04:00
|
|
|
init ();
|
2007-10-11 18:07:47 -04:00
|
|
|
set_position (Gtk::WIN_POS_CENTER_ON_PARENT);
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
ArdourDialog::~ArdourDialog ()
|
|
|
|
{
|
2013-04-30 13:50:15 -04:00
|
|
|
if (_splash_pushed) {
|
|
|
|
Splash* spl = Splash::instance();
|
|
|
|
|
|
|
|
if (spl) {
|
|
|
|
spl->pop_front();
|
|
|
|
}
|
|
|
|
}
|
2013-05-07 22:09:16 -04:00
|
|
|
WM::Manager::instance().remove (proxy);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2013-05-06 10:55:40 -04:00
|
|
|
bool
|
|
|
|
ArdourDialog::on_key_press_event (GdkEventKey* ev)
|
|
|
|
{
|
|
|
|
return relay_key_press (ev, this);
|
|
|
|
}
|
|
|
|
|
2005-09-26 10:33:53 -04:00
|
|
|
bool
|
2005-09-25 22:48:59 -04:00
|
|
|
ArdourDialog::on_enter_notify_event (GdkEventCrossing *ev)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2005-12-24 13:25:26 -05:00
|
|
|
Keyboard::the_keyboard().enter_window (ev, this);
|
2011-11-18 16:03:21 -05:00
|
|
|
return Dialog::on_enter_notify_event (ev);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2005-09-26 10:33:53 -04:00
|
|
|
bool
|
2005-09-25 22:48:59 -04:00
|
|
|
ArdourDialog::on_leave_notify_event (GdkEventCrossing *ev)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2005-12-24 13:25:26 -05:00
|
|
|
Keyboard::the_keyboard().leave_window (ev, this);
|
2011-11-18 16:03:21 -05:00
|
|
|
return Dialog::on_leave_notify_event (ev);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2005-09-26 10:33:53 -04:00
|
|
|
void
|
|
|
|
ArdourDialog::on_unmap ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2008-12-12 09:43:24 -05:00
|
|
|
Keyboard::the_keyboard().leave_window (0, this);
|
2005-09-26 10:33:53 -04:00
|
|
|
Dialog::on_unmap ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2008-02-02 12:22:04 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
ArdourDialog::on_show ()
|
|
|
|
{
|
2013-04-30 13:50:15 -04:00
|
|
|
Dialog::on_show ();
|
|
|
|
|
2008-02-02 12:22:04 -05:00
|
|
|
// never allow the splash screen to obscure any dialog
|
|
|
|
|
|
|
|
Splash* spl = Splash::instance();
|
|
|
|
|
2013-04-30 13:50:15 -04:00
|
|
|
if (spl && spl->is_visible()) {
|
2012-01-10 13:21:39 -05:00
|
|
|
spl->pop_back_for (*this);
|
2013-04-30 13:50:15 -04:00
|
|
|
_splash_pushed = true;
|
2008-02-02 12:22:04 -05:00
|
|
|
}
|
|
|
|
}
|
2008-09-17 04:44:51 -04:00
|
|
|
|
2013-05-05 16:10:54 -04:00
|
|
|
bool
|
|
|
|
ArdourDialog::on_delete_event (GdkEventAny*)
|
|
|
|
{
|
|
|
|
hide ();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
void
|
2008-12-12 09:43:24 -05:00
|
|
|
ArdourDialog::init ()
|
2008-09-17 04:44:51 -04:00
|
|
|
{
|
|
|
|
set_border_width (10);
|
2013-05-07 18:09:12 -04:00
|
|
|
|
|
|
|
set_type_hint (Gdk::WINDOW_TYPE_HINT_DIALOG);
|
|
|
|
|
2013-05-07 22:09:16 -04:00
|
|
|
Gtk::Window* parent = WM::Manager::instance().transient_parent();
|
2013-05-07 18:09:12 -04:00
|
|
|
|
|
|
|
if (parent) {
|
|
|
|
set_transient_for (*parent);
|
|
|
|
}
|
|
|
|
|
2013-05-02 21:13:36 -04:00
|
|
|
ARDOUR_UI::CloseAllDialogs.connect (sigc::bind (sigc::mem_fun (*this, &ArdourDialog::response), RESPONSE_CANCEL));
|
2013-05-07 22:09:16 -04:00
|
|
|
|
|
|
|
proxy = new WM::ProxyTemporary (get_title(), this);
|
|
|
|
WM::Manager::instance().register_window (proxy);
|
2008-12-12 09:43:24 -05:00
|
|
|
}
|