2 Copyright (C) 20002-2004 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.
21 /* This file contains any ARDOUR_UI methods that require knowledge of
22 the editor, and exists so that no compilation dependency exists
23 between the main ARDOUR_UI modules and the PublicEditor class. This
24 is to cut down on the nasty compile times for both these classes.
27 #include <pbd/pathscanner.h>
29 #include "ardour_ui.h"
30 #include "public_editor.h"
31 #include "audio_clock.h"
34 #include <ardour/session.h>
38 using namespace ARDOUR;
40 using namespace Gtkmmext;
43 ARDOUR_UI::create_editor ()
47 editor = new Editor (*engine);
50 catch (failed_constructor& err) {
54 editor->DisplayControlChanged.connect (slot (*this, &ARDOUR_UI::editor_display_control_changed));
60 ARDOUR_UI::build_menu_bar ()
63 using namespace Menu_Helpers;
65 menu_bar.set_name ("MainMenuBar");
67 MenuList& items = menu_bar.items();
71 Menu *session_menu = manage (new Menu);
72 MenuList& session_items = session_menu->items();
73 session_menu->set_name ("ArdourContextMenu");
75 session_items.push_back (MenuElem (_("New"), bind (slot (*this, &ARDOUR_UI::new_session), false, string ())));
76 session_items.push_back (MenuElem (_("Open"), slot (*this, &ARDOUR_UI::open_session)));
77 session_items.push_back (MenuElem (_("Recent"), slot (*this, &ARDOUR_UI::open_recent_session)));
78 session_items.push_back (MenuElem (_("Close"), slot (*this, &ARDOUR_UI::close_session)));
79 close_item = session_items.back();
80 close_item->set_sensitive (false);
82 session_items.push_back (SeparatorElem());
84 session_items.push_back (MenuElem (_("Add Track/Bus"), slot (*this, &ARDOUR_UI::add_route)));
85 add_track_item = session_items.back ();
86 add_track_item->set_sensitive (false);
88 session_items.push_back (SeparatorElem());
93 vector<string*>* results = scanner (getenv ("PATH"), "AniComp", false, false);
95 if (results && !results->empty()) {
96 Menu* image_compositor_menu = manage(new Menu());
97 MenuList& image_compositor_items = image_compositor_menu->items();
98 image_compositor_menu->set_name ("ArdourContextMenu");
99 image_compositor_items.push_back(MenuElem (_("Connect"), (slot (editor, &PublicEditor::connect_to_image_compositor)))) ;
100 session_items.push_back(MenuElem (_("Image Compositor"), *image_compositor_menu)) ;
101 image_compositor_item = session_items.back() ;
102 image_compositor_item->set_sensitive(false) ;
103 session_items.push_back (SeparatorElem());
105 image_compositor_item = 0;
112 /* </CMT Additions> */
114 session_items.push_back (MenuElem (_("Save"), bind (slot (*this, &ARDOUR_UI::save_state), string(""))));
115 save_item = session_items.back();
116 save_item->set_sensitive (false);
118 session_items.push_back (MenuElem (_("Snapshot"), slot (*this, &ARDOUR_UI::snapshot_session)));
119 snapshot_item = session_items.back();
120 snapshot_item->set_sensitive (false);
122 session_items.push_back (MenuElem (_("Save as...")));
123 save_as_item = session_items.back();
124 save_as_item->set_sensitive (false);
126 session_items.push_back (MenuElem (_("Save Template..."), slot (*this, &ARDOUR_UI::save_template)));
127 save_template_item = session_items.back();
128 save_template_item->set_sensitive (false);
130 Menu *export_menu = manage (new Menu);
131 MenuList& export_items = export_menu->items();
132 export_menu->set_name ("ArdourContextMenu");
133 export_items.push_back (MenuElem (_("Export session to audiofile..."), slot (*editor, &PublicEditor::export_session)));
134 export_items.push_back (MenuElem (_("Export range to audiofile..."), slot (*editor, &PublicEditor::export_selection)));
135 // export_items.back()->set_sensitive (false);
137 session_items.push_back (MenuElem (_("Export"), *export_menu));
138 export_item = session_items.back();
139 export_item->set_sensitive (false);
141 session_items.push_back (SeparatorElem());
143 Menu *cleanup_menu = manage (new Menu);
144 MenuList& cleanup_items = cleanup_menu->items();
145 cleanup_menu->set_name ("ArdourContextMenu");
146 cleanup_items.push_back (MenuElem (_("Cleanup unused sources"), slot (*(ARDOUR_UI::instance()), &ARDOUR_UI::cleanup)));
147 cleanup_items.push_back (MenuElem (_("Flush wastebasket"), slot (*(ARDOUR_UI::instance()), &ARDOUR_UI::flush_trash)));
149 session_items.push_back (MenuElem (_("Cleanup"), *cleanup_menu));
150 cleanup_item = session_items.back ();
151 cleanup_item->set_sensitive (false);
153 session_items.push_back (SeparatorElem());
155 session_items.push_back (MenuElem (_("Quit"), slot (*(ARDOUR_UI::instance()), &ARDOUR_UI::finish)));
157 items.push_back (MenuElem (_("Session"), *session_menu));
159 /* edit menu; the editor is responsible for the contents */
161 Menu *edit_menu = manage (new Menu);
162 editor->set_edit_menu (*edit_menu);
163 items.push_back (MenuElem (_("Edit"), *edit_menu));
164 edit_menu->set_name ("ArdourContextMenu");
166 /* JACK menu for controlling ... JACK */
168 Menu* jack_menu = manage (new Menu);
169 MenuList& jack_items = jack_menu->items();
170 jack_menu->set_name ("ArdourContextMenu");
172 jack_items.push_back (MenuElem (_("Disconnect"), slot (*(ARDOUR_UI::instance()), &ARDOUR_UI::disconnect_from_jack)));
173 jack_disconnect_item = jack_items.back();
174 jack_disconnect_item->set_sensitive (false);
175 jack_items.push_back (MenuElem (_("Reconnect"), slot (*(ARDOUR_UI::instance()), &ARDOUR_UI::reconnect_to_jack)));
176 jack_reconnect_item = jack_items.back();
177 jack_reconnect_item->set_sensitive (false);
179 jack_bufsize_menu = manage (new Menu);
180 MenuList& jack_bufsize_items = jack_bufsize_menu->items();
181 jack_bufsize_menu->set_name ("ArdourContextMenu");
183 jack_bufsize_items.push_back (MenuElem (X_("32"), bind (slot (*this, &ARDOUR_UI::set_jack_buffer_size), (jack_nframes_t) 32)));
184 jack_bufsize_items.push_back (MenuElem (X_("64"), bind (slot (*this, &ARDOUR_UI::set_jack_buffer_size), (jack_nframes_t) 64)));
185 jack_bufsize_items.push_back (MenuElem (X_("128"), bind (slot (*this, &ARDOUR_UI::set_jack_buffer_size), (jack_nframes_t) 128)));
186 jack_bufsize_items.push_back (MenuElem (X_("256"), bind (slot (*this, &ARDOUR_UI::set_jack_buffer_size), (jack_nframes_t) 256)));
187 jack_bufsize_items.push_back (MenuElem (X_("512"), bind (slot (*this, &ARDOUR_UI::set_jack_buffer_size), (jack_nframes_t) 512)));
188 jack_bufsize_items.push_back (MenuElem (X_("1024"), bind (slot (*this, &ARDOUR_UI::set_jack_buffer_size), (jack_nframes_t) 1024)));
189 jack_bufsize_items.push_back (MenuElem (X_("2048"), bind (slot (*this, &ARDOUR_UI::set_jack_buffer_size), (jack_nframes_t) 2048)));
190 jack_bufsize_items.push_back (MenuElem (X_("4096"), bind (slot (*this, &ARDOUR_UI::set_jack_buffer_size), (jack_nframes_t) 4096)));
191 jack_bufsize_items.push_back (MenuElem (X_("8192"), bind (slot (*this, &ARDOUR_UI::set_jack_buffer_size), (jack_nframes_t) 8192)));
193 jack_items.push_back (MenuElem (_("Latency"), *jack_bufsize_menu));
194 jack_bufsize_menu->set_sensitive (false);
196 items.push_back (MenuElem (_("JACK"), *jack_menu));
200 Menu *window_menu = new Menu();
201 MenuList& window_items = window_menu->items();
202 window_menu->set_name ("ArdourContextMenu");
204 window_items.push_back (TearoffMenuElem());
206 window_items.push_back (MenuElem (_("Editor"), slot (*this, &ARDOUR_UI::goto_editor_window)));
207 window_items.push_back (MenuElem (_("Mixer"), slot (*this, &ARDOUR_UI::goto_mixer_window)));
209 window_items.push_back (SeparatorElem());
211 window_items.push_back
213 (_("Options Editor"),
214 slot (*this, &ARDOUR_UI::toggle_options_window)));
215 options_window_check = dynamic_cast<CheckMenuItem*>(window_items.back());
216 // options_window_check->set_sensitive (false);
218 window_items.push_back
221 slot (*this, &ARDOUR_UI::toggle_sfdb_window)));
222 sfdb_check = dynamic_cast<CheckMenuItem*>(window_items.back());
224 window_items.push_back
226 (_("Track/Bus Inspector"),
227 slot (*this, &ARDOUR_UI::toggle_route_params_window)));
228 route_params_check = dynamic_cast<CheckMenuItem*>(window_items.back());
229 route_params_check->set_sensitive (false);
231 window_items.push_back
234 slot (*this, &ARDOUR_UI::toggle_connection_editor)));
235 connection_editor_check = dynamic_cast<CheckMenuItem*>(window_items.back());
236 connection_editor_check->set_sensitive (false);
239 window_items.push_back
242 slot (*this, &ARDOUR_UI::toggle_meter_bridge_window)));
243 meter_bridge_dialog_check = dynamic_cast<CheckMenuItem*>(window_items.back());
244 meter_bridge_dialog_check->set_sensitive (false);
247 window_items.push_back
250 slot (*this, &ARDOUR_UI::toggle_location_window)));
251 locations_dialog_check = dynamic_cast<CheckMenuItem*>(window_items.back());
252 locations_dialog_check->set_sensitive (false);
254 window_items.push_back
257 slot (*this, &ARDOUR_UI::toggle_big_clock_window)));
258 big_clock_check = dynamic_cast<CheckMenuItem*>(window_items.back());
260 window_items.push_back (SeparatorElem());
262 window_items.push_back (MenuElem (_("About"), slot (*this, &ARDOUR_UI::show_splash)));
265 items.push_back (MenuElem (_("Windows"), *window_menu));
267 wall_clock_box.add (wall_clock_label);
268 wall_clock_box.set_name ("WallClock");
269 wall_clock_label.set_name ("WallClock");
271 disk_space_box.add (disk_space_label);
272 disk_space_box.set_name ("WallClock");
273 disk_space_label.set_name ("WallClock");
275 cpu_load_box.add (cpu_load_label);
276 cpu_load_box.set_name ("CPULoad");
277 cpu_load_label.set_name ("CPULoad");
279 buffer_load_box.add (buffer_load_label);
280 buffer_load_box.set_name ("BufferLoad");
281 buffer_load_label.set_name ("BufferLoad");
283 // disk_rate_box.add (disk_rate_label);
284 // disk_rate_box.set_name ("DiskRate");
285 // disk_rate_label.set_name ("DiskRate");
287 sample_rate_box.add (sample_rate_label);
288 sample_rate_box.set_name ("SampleRate");
289 sample_rate_label.set_name ("SampleRate");
291 menu_hbox.pack_start (menu_bar, true, true);
292 menu_hbox.pack_end (wall_clock_box, false, false, 10);
293 menu_hbox.pack_end (disk_space_box, false, false, 10);
294 menu_hbox.pack_end (cpu_load_box, false, false, 10);
295 // menu_hbox.pack_end (disk_rate_box, false, false, 10);
296 menu_hbox.pack_end (buffer_load_box, false, false, 10);
297 menu_hbox.pack_end (sample_rate_box, false, false, 10);
299 menu_bar_base.set_name ("MainMenuBar");
300 menu_bar_base.add (menu_hbox);
305 ARDOUR_UI::editor_display_control_changed (Editing::DisplayControl c)
308 case Editing::FollowPlayhead:
309 follow_button.set_active (editor->follow_playhead ());