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;
|
2014-06-25 15:27:37 -04:00
|
|
|
using namespace ARDOUR_UI_UTILS;
|
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 ();
|
2015-10-15 12:06:49 -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();
|
2015-10-04 14:51:05 -04:00
|
|
|
|
2013-04-30 13:50:15 -04:00
|
|
|
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
|
2015-04-01 11:41:49 -04:00
|
|
|
ArdourDialog::on_focus_in_event (GdkEventFocus *ev)
|
2013-05-06 10:55:40 -04:00
|
|
|
{
|
2015-04-01 11:41:49 -04:00
|
|
|
Keyboard::the_keyboard().focus_in_window (ev, this);
|
|
|
|
return Dialog::on_focus_in_event (ev);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2005-09-26 10:33:53 -04:00
|
|
|
bool
|
2015-04-01 11:41:49 -04:00
|
|
|
ArdourDialog::on_focus_out_event (GdkEventFocus *ev)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2015-04-01 11:41:49 -04:00
|
|
|
if (!get_modal()) {
|
|
|
|
Keyboard::the_keyboard().focus_out_window (ev, this);
|
|
|
|
}
|
|
|
|
return Dialog::on_focus_out_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);
|
2015-04-01 11:41:49 -04:00
|
|
|
add_events (Gdk::FOCUS_CHANGE_MASK);
|
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
|
|
|
}
|