handle multiple imports of the same file better (via better source naming); make...
[ardour2.git] / gtk2_ardour / ardour_ui_dependents.cc
blob4d38c51e2071c53eeb2b3091ec72cd40ab213db1
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 /* this file exists solely to break compilation dependencies that
21 would connect changes to the mixer or editor objects.
24 #include <cstdio>
26 #include "pbd/error.h"
28 #include "ardour/session.h"
30 #include "ardour_ui.h"
31 #include "public_editor.h"
32 #include "mixer_ui.h"
33 #include "keyboard.h"
34 #include "splash.h"
35 #include "route_params_ui.h"
36 #include "opts.h"
37 #include "i18n.h"
39 using namespace Gtk;
40 using namespace PBD;
42 namespace ARDOUR {
43 class Session;
44 class Route;
47 using namespace ARDOUR;
49 void
50 ARDOUR_UI::shutdown ()
52 ui_config->save_state();
55 void
56 ARDOUR_UI::we_have_dependents ()
58 install_actions ();
59 ProcessorBox::register_actions ();
60 keyboard->setup_keybindings ();
61 editor->setup_tooltips ();
62 editor->UpdateAllTransportClocks.connect (sigc::mem_fun (*this, &ARDOUR_UI::update_transport_clocks));
65 void
66 ARDOUR_UI::connect_dependents_to_session (ARDOUR::Session *s)
68 BootMessage (_("Setup Editor"));
69 editor->set_session (s);
70 BootMessage (_("Setup Mixer"));
71 mixer->set_session (s);
73 /* its safe to do this now */
75 BootMessage (_("Reload Session History"));
76 s->restore_history ("");
79 static bool
80 _hide_splash (gpointer arg)
82 ((ARDOUR_UI*)arg)->hide_splash();
83 return false;
86 void
87 ARDOUR_UI::goto_editor_window ()
89 if (splash && splash->is_visible()) {
90 // in 2 seconds, hide the splash screen
91 Glib::signal_timeout().connect (sigc::bind (sigc::ptr_fun (_hide_splash), this), 2000);
94 editor->show_window ();
95 editor->present ();
96 flush_pending ();
99 void
100 ARDOUR_UI::goto_mixer_window ()
102 mixer->show_window ();
103 mixer->present ();
104 flush_pending ();
107 void
108 ARDOUR_UI::toggle_mixer_window ()
110 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("toggle-mixer"));
111 if (!act) {
112 return;
115 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
117 if (tact->get_active()) {
118 goto_mixer_window ();
119 } else {
120 mixer->hide ();
124 void
125 ARDOUR_UI::toggle_mixer_on_top ()
127 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("toggle-mixer-on-top"));
128 if (!act) {
129 return;
132 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
134 if (tact->get_active()) {
136 /* Toggle the mixer to `visible' if required */
137 act = ActionManager::get_action (X_("Common"), X_("toggle-mixer"));
138 if (act) {
139 tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
141 if (!tact->get_active()) {
142 tact->set_active ();
146 goto_mixer_window ();
147 } else {
148 goto_editor_window ();
152 /** The main editor window has been closed */
153 gint
154 ARDOUR_UI::exit_on_main_window_close (GdkEventAny * /*ev*/)
156 #ifdef TOP_MENUBAR
157 /* just hide the window, and return - the top menu stays up */
158 editor->hide ();
159 return TRUE;
160 #else
161 /* time to get out of here */
162 finish();
163 return TRUE;
164 #endif