Remove erroneous assert which I added earlier.
[ardour2.git] / gtk2_ardour / ardour_ui_dependents.cc
blob3f819829b90fac55d0e350739a845a8503138a02
1 /*
2 Copyright (C) 2000 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifdef WAF_BUILD
21 #include "gtk2ardour-config.h"
22 #endif
24 /* this file exists solely to break compilation dependencies that
25 would connect changes to the mixer or editor objects.
28 #include <cstdio>
30 #include "pbd/error.h"
32 #include "ardour/session.h"
34 #include "ardour_ui.h"
35 #include "public_editor.h"
36 #include "mixer_ui.h"
37 #include "keyboard.h"
38 #include "splash.h"
39 #include "route_params_ui.h"
40 #include "opts.h"
41 #include "i18n.h"
43 using namespace Gtk;
44 using namespace PBD;
46 namespace ARDOUR {
47 class Session;
48 class Route;
51 using namespace ARDOUR;
53 void
54 ARDOUR_UI::shutdown ()
56 ui_config->save_state();
59 void
60 ARDOUR_UI::we_have_dependents ()
62 install_actions ();
63 ProcessorBox::register_actions ();
64 keyboard->setup_keybindings ();
65 editor->setup_tooltips ();
66 editor->UpdateAllTransportClocks.connect (sigc::mem_fun (*this, &ARDOUR_UI::update_transport_clocks));
69 void
70 ARDOUR_UI::connect_dependents_to_session (ARDOUR::Session *s)
72 BootMessage (_("Setup Editor"));
73 editor->set_session (s);
74 BootMessage (_("Setup Mixer"));
75 mixer->set_session (s);
77 /* its safe to do this now */
79 BootMessage (_("Reload Session History"));
80 s->restore_history ("");
83 static bool
84 _hide_splash (gpointer arg)
86 ((ARDOUR_UI*)arg)->hide_splash();
87 return false;
90 void
91 ARDOUR_UI::goto_editor_window ()
93 if (splash && splash->is_visible()) {
94 // in 2 seconds, hide the splash screen
95 Glib::signal_timeout().connect (sigc::bind (sigc::ptr_fun (_hide_splash), this), 2000);
98 editor->show_window ();
99 editor->present ();
100 flush_pending ();
103 void
104 ARDOUR_UI::goto_mixer_window ()
106 mixer->show_window ();
107 mixer->present ();
108 flush_pending ();
111 void
112 ARDOUR_UI::toggle_mixer_window ()
114 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("toggle-mixer"));
115 if (!act) {
116 return;
119 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
121 if (tact->get_active()) {
122 goto_mixer_window ();
123 } else {
124 mixer->hide ();
128 void
129 ARDOUR_UI::toggle_mixer_on_top ()
131 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("toggle-mixer-on-top"));
132 if (!act) {
133 return;
136 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
138 if (tact->get_active()) {
140 /* Toggle the mixer to `visible' if required */
141 act = ActionManager::get_action (X_("Common"), X_("toggle-mixer"));
142 if (act) {
143 tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
145 if (!tact->get_active()) {
146 tact->set_active ();
150 goto_mixer_window ();
151 } else {
152 goto_editor_window ();
156 /** The main editor window has been closed */
157 gint
158 ARDOUR_UI::exit_on_main_window_close (GdkEventAny * /*ev*/)
160 #ifdef TOP_MENUBAR
161 /* just hide the window, and return - the top menu stays up */
162 editor->hide ();
163 return TRUE;
164 #else
165 /* time to get out of here */
166 finish();
167 return TRUE;
168 #endif