2005-09-25 14:42:24 -04:00
|
|
|
/*
|
2009-10-14 12:10:01 -04:00
|
|
|
Copyright (C) 2000 Paul Davis
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2010-11-13 00:14:48 -05:00
|
|
|
#ifdef WAF_BUILD
|
|
|
|
#include "gtk2ardour-config.h"
|
|
|
|
#endif
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
/* this file exists solely to break compilation dependencies that
|
|
|
|
would connect changes to the mixer or editor objects.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <cstdio>
|
2005-11-29 17:48:54 -05:00
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "pbd/error.h"
|
2007-01-03 13:48:27 -05:00
|
|
|
|
2009-10-30 11:30:22 -04:00
|
|
|
#include "ardour/session.h"
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "ardour_ui.h"
|
|
|
|
#include "public_editor.h"
|
|
|
|
#include "mixer_ui.h"
|
|
|
|
#include "keyboard.h"
|
2008-01-19 00:06:33 -05:00
|
|
|
#include "splash.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "route_params_ui.h"
|
2008-02-16 17:43:18 -05:00
|
|
|
#include "opts.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "i18n.h"
|
|
|
|
|
2005-11-29 17:48:54 -05:00
|
|
|
using namespace Gtk;
|
2006-06-21 19:01:03 -04:00
|
|
|
using namespace PBD;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
namespace ARDOUR {
|
|
|
|
class Session;
|
|
|
|
class Route;
|
|
|
|
}
|
|
|
|
|
2008-02-16 17:43:18 -05:00
|
|
|
using namespace ARDOUR;
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
|
|
|
ARDOUR_UI::shutdown ()
|
|
|
|
{
|
2011-10-26 17:01:14 -04:00
|
|
|
if (ui_config->dirty()) {
|
|
|
|
ui_config->save_state();
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ARDOUR_UI::we_have_dependents ()
|
|
|
|
{
|
2005-11-28 10:29:49 -05:00
|
|
|
install_actions ();
|
2007-06-27 16:23:48 -04:00
|
|
|
ProcessorBox::register_actions ();
|
2009-12-04 17:51:32 -05:00
|
|
|
keyboard->setup_keybindings ();
|
2010-02-08 19:50:24 -05:00
|
|
|
editor->setup_tooltips ();
|
2009-12-11 18:29:48 -05:00
|
|
|
editor->UpdateAllTransportClocks.connect (sigc::mem_fun (*this, &ARDOUR_UI::update_transport_clocks));
|
2011-11-15 14:33:09 -05:00
|
|
|
|
|
|
|
editor->track_mixer_selection ();
|
|
|
|
mixer->track_editor_selection ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ARDOUR_UI::connect_dependents_to_session (ARDOUR::Session *s)
|
|
|
|
{
|
2008-02-16 17:43:18 -05:00
|
|
|
BootMessage (_("Setup Editor"));
|
2009-12-17 13:24:23 -05:00
|
|
|
editor->set_session (s);
|
2008-02-16 17:43:18 -05:00
|
|
|
BootMessage (_("Setup Mixer"));
|
2009-12-17 13:24:23 -05:00
|
|
|
mixer->set_session (s);
|
2006-12-18 21:41:19 -05:00
|
|
|
|
|
|
|
/* its safe to do this now */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-02-16 17:43:18 -05:00
|
|
|
BootMessage (_("Reload Session History"));
|
2006-12-18 21:41:19 -05:00
|
|
|
s->restore_history ("");
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2008-01-19 00:06:33 -05:00
|
|
|
static bool
|
|
|
|
_hide_splash (gpointer arg)
|
|
|
|
{
|
|
|
|
((ARDOUR_UI*)arg)->hide_splash();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
|
|
|
ARDOUR_UI::goto_editor_window ()
|
|
|
|
{
|
2008-01-19 00:06:33 -05:00
|
|
|
if (splash && splash->is_visible()) {
|
2009-10-14 12:10:01 -04:00
|
|
|
// in 2 seconds, hide the splash screen
|
2009-12-11 18:29:48 -05:00
|
|
|
Glib::signal_timeout().connect (sigc::bind (sigc::ptr_fun (_hide_splash), this), 2000);
|
2008-01-19 00:06:33 -05:00
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
editor->show_window ();
|
2007-10-11 18:07:47 -04:00
|
|
|
editor->present ();
|
2008-01-18 22:49:52 -05:00
|
|
|
flush_pending ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2008-01-18 22:49:52 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
|
|
|
ARDOUR_UI::goto_mixer_window ()
|
|
|
|
{
|
|
|
|
mixer->show_window ();
|
2007-10-11 18:07:47 -04:00
|
|
|
mixer->present ();
|
2008-01-18 22:49:52 -05:00
|
|
|
flush_pending ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2008-12-12 09:43:24 -05:00
|
|
|
void
|
2010-09-21 20:41:25 -04:00
|
|
|
ARDOUR_UI::toggle_mixer_window ()
|
2008-12-12 09:43:24 -05:00
|
|
|
{
|
2010-09-21 20:41:25 -04:00
|
|
|
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("toggle-mixer"));
|
|
|
|
if (!act) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-09-21 20:41:25 -04:00
|
|
|
if (tact->get_active()) {
|
|
|
|
goto_mixer_window ();
|
2008-12-12 09:43:24 -05:00
|
|
|
} else {
|
2010-09-21 20:41:25 -04:00
|
|
|
mixer->hide ();
|
|
|
|
}
|
2011-06-01 13:00:29 -04:00
|
|
|
}
|
2010-09-21 20:41:25 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
ARDOUR_UI::toggle_mixer_on_top ()
|
|
|
|
{
|
|
|
|
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("toggle-mixer-on-top"));
|
|
|
|
if (!act) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-09-21 20:41:25 -04:00
|
|
|
if (tact->get_active()) {
|
|
|
|
|
|
|
|
/* Toggle the mixer to `visible' if required */
|
|
|
|
act = ActionManager::get_action (X_("Common"), X_("toggle-mixer"));
|
|
|
|
if (act) {
|
|
|
|
tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-09-21 20:41:25 -04:00
|
|
|
if (!tact->get_active()) {
|
|
|
|
tact->set_active ();
|
|
|
|
}
|
|
|
|
}
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2008-12-12 09:43:24 -05:00
|
|
|
goto_mixer_window ();
|
2010-09-21 20:41:25 -04:00
|
|
|
} else {
|
|
|
|
goto_editor_window ();
|
2008-12-12 09:43:24 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-26 08:26:30 -05:00
|
|
|
/** The main editor window has been closed */
|
2005-09-25 14:42:24 -04:00
|
|
|
gint
|
2009-07-21 11:55:17 -04:00
|
|
|
ARDOUR_UI::exit_on_main_window_close (GdkEventAny * /*ev*/)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2008-12-12 09:43:24 -05:00
|
|
|
#ifdef TOP_MENUBAR
|
|
|
|
/* just hide the window, and return - the top menu stays up */
|
|
|
|
editor->hide ();
|
|
|
|
return TRUE;
|
|
|
|
#else
|
|
|
|
/* time to get out of here */
|
2005-09-25 14:42:24 -04:00
|
|
|
finish();
|
|
|
|
return TRUE;
|
2008-12-12 09:43:24 -05:00
|
|
|
#endif
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2010-03-18 22:49:01 -04:00
|
|
|
|