Fly my pretties!
[ardour.git] / gtk2_ardour / ardour_ui_dependents.cc
1 /*
2     Copyright (C) 2000 Paul Davis 
3
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.
8
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.
13
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.
17
18     $Id$
19 */
20
21 /* this file exists solely to break compilation dependencies that
22    would connect changes to the mixer or editor objects.
23 */
24
25 #include <cstdio>
26 #include <pbd/error.h>
27 #include "ardour_ui.h"
28 #include "public_editor.h"
29 #include "mixer_ui.h"
30 #include "meter_bridge.h"
31 #include "keyboard.h"
32 #include "route_params_ui.h"
33 #include "i18n.h"
34
35 using namespace sigc;
36
37
38 namespace ARDOUR {
39         class Session;
40         class Route;
41 }
42
43 void
44 ARDOUR_UI::shutdown ()
45 {
46         if (session) {
47                 delete session;
48                 session = 0;
49         }
50
51 }
52
53 void
54 ARDOUR_UI::we_have_dependents ()
55 {
56         setup_keybindings ();
57 }
58
59 void
60 ARDOUR_UI::setup_keybindings ()
61 {
62         /* install default bindings */
63
64         KeyboardTarget *defaults = new KeyboardTarget (editor->window(), X_("default"));
65
66         XMLNode* keynode = ARDOUR::Config->get_keys();
67
68         if (keynode != 0) {
69                 defaults->set_binding_state (*keynode);
70                 editor->set_binding_state (*keynode);
71                 mixer->set_binding_state (*keynode);
72                 meter_bridge->set_binding_state (*keynode);
73         } else {
74                 error << _("keyboard_target: error setting binding state: invalid node") << endmsg;
75         }
76         
77         /* use the default keyboard target for now */
78
79         keyboard->set_default_target (defaults);
80 }
81
82 void
83 ARDOUR_UI::connect_dependents_to_session (ARDOUR::Session *s)
84 {
85         editor->connect_to_session (s);
86         mixer->connect_to_session (s);
87
88         meter_bridge->set_session (s);
89 }
90
91 void
92 ARDOUR_UI::goto_editor_window ()
93 {
94         editor->show_window ();
95         editor->window().get_window().raise ();
96 }
97 void
98 ARDOUR_UI::goto_mixer_window ()
99 {
100         mixer->show_window ();
101         mixer->get_window().raise ();
102 }
103
104 gint
105 ARDOUR_UI::exit_on_main_window_close (GdkEventAny *ev)
106 {
107         finish();
108         return TRUE;
109 }