4 #include <gtkmm/main.h>
5 #include <gtkmm/filechooser.h>
7 #include "pbd/failed_constructor.h"
8 #include "pbd/file_utils.h"
9 #include "pbd/filesystem.h"
10 #include "pbd/replace_all.h"
12 #include "ardour/filesystem_paths.h"
13 #include "ardour/recent_sessions.h"
14 #include "ardour/session.h"
15 #include "ardour/session_state_utils.h"
16 #include "ardour/template_utils.h"
20 #include "engine_dialog.h"
28 using namespace ARDOUR;
30 ArdourStartup* ArdourStartup::the_startup = 0;
32 static string poor_mans_glob (string path)
35 replace_all (copy, "~", Glib::get_home_dir());
40 ArdourStartup::ArdourStartup ()
42 , ic_new_session_button (_("Open a new session"))
43 , ic_existing_session_button (_("Open an existing session"))
44 , monitor_via_hardware_button (_("Use an external mixer or the hardware mixer of your audio interface.\n\
45 Ardour will play NO role in monitoring"))
46 , monitor_via_ardour_button (_("Ask Ardour to playback material as it is being recorded"))
47 , new_folder_chooser (FILE_CHOOSER_ACTION_SELECT_FOLDER)
48 , more_new_session_options_button (_("I'd like more options for this session"))
49 , _output_limit_count_adj (1, 0, 100, 1, 10, 0)
50 , _input_limit_count_adj (1, 0, 100, 1, 10, 0)
51 , _control_bus_channel_count_adj (2, 0, 100, 1, 10, 0)
52 , _master_bus_channel_count_adj (2, 0, 100, 1, 10, 0)
55 audio_page_index = -1;
56 initial_choice_index = -1;
57 new_user_page_index = -1;
58 default_folder_page_index = -1;
59 monitoring_page_index = -1;
60 session_page_index = -1;
61 final_page_index = -1;
62 session_options_page_index = -1;
66 config_modified = false;
67 default_dir_chooser = 0;
69 use_template_button.set_group (session_template_group);
70 use_session_as_template_button.set_group (session_template_group);
72 set_keep_above (true);
73 set_resizable (false);
74 set_position (WIN_POS_CENTER);
75 set_border_width (12);
79 if (!find_file_in_search_path (ardour_search_path() + system_data_search_path().add_subdirectory_to_paths("icons"), "ardour_icon_48px.png", icon_file)) {
80 throw failed_constructor();
84 icon_pixbuf = Gdk::Pixbuf::create_from_file (icon_file.to_string());
88 throw failed_constructor();
91 sys::path been_here_before = user_config_directory();
92 been_here_before /= ".a3"; // XXXX use more specific version so we can catch upgrades
93 new_user = !exists (been_here_before);
95 bool need_audio_setup = !EngineControl::engine_running();
98 /* "touch" the file */
99 ofstream fout (been_here_before.to_string().c_str());
100 setup_new_user_page ();
101 setup_first_time_config_page ();
102 setup_monitoring_choice_page ();
104 if (need_audio_setup) {
110 if (need_audio_setup) {
114 setup_initial_choice_page ();
117 setup_session_page ();
118 setup_more_options_page ();
127 ArdourStartup::~ArdourStartup ()
132 ArdourStartup::set_new_only (bool yn)
144 ArdourStartup::use_session_template ()
146 if (use_template_button.get_active()) {
147 return template_chooser.get_active_row_number() > 0;
149 return !session_template_chooser.get_filename().empty();
154 ArdourStartup::session_template_name ()
156 if (ic_existing_session_button.get_active()) {
160 if (use_template_button.get_active()) {
161 TreeModel::iterator iter = template_chooser.get_active ();
162 TreeModel::Row row = (*iter);
163 string s = row[session_template_columns.path];
166 return session_template_chooser.get_filename();
172 ArdourStartup::session_name (bool& should_be_new)
174 if (ic_new_session_button.get_active()) {
175 should_be_new = true;
176 return new_name_entry.get_text ();
178 should_be_new = false;
180 TreeIter iter = recent_session_display.get_selection()->get_selected();
183 return (*iter)[recent_session_columns.visible_name];
191 ArdourStartup::session_folder ()
193 if (ic_new_session_button.get_active()) {
194 Glib::ustring legal_session_folder_name = legalize_for_path (new_name_entry.get_text());
195 return Glib::build_filename (new_folder_chooser.get_current_folder(), legal_session_folder_name);
197 TreeIter iter = recent_session_display.get_selection()->get_selected();
200 return (*iter)[recent_session_columns.fullpath];
207 ArdourStartup::setup_audio_page ()
209 engine_dialog = manage (new EngineControl);
211 engine_dialog->set_border_width (12);
213 engine_dialog->show_all ();
215 audio_page_index = append_page (*engine_dialog);
216 set_page_type (*engine_dialog, ASSISTANT_PAGE_CONTENT);
217 set_page_title (*engine_dialog, _("Audio Setup"));
219 /* the default parameters should work, so the page is potentially complete */
221 set_page_complete (*engine_dialog, true);
225 ArdourStartup::setup_new_user_page ()
227 Label* foomatic = manage (new Label);
229 foomatic->set_markup (_("\
230 <span size=\"larger\">Ardour is a digital audio workstation. You can use it to\n\
231 record, edit and mix multi-track audio. You can produce your\n\
232 own CDs, mix video soundtracks, or just experiment with new\n\
233 ideas about music and sound.\n\
235 There are a few things that need to configured before you start\n\
236 using the program.</span>\
239 HBox* hbox = manage (new HBox);
240 HBox* vbox = manage (new HBox);
242 vbox->set_border_width (24);
244 hbox->pack_start (*foomatic, true, true);
245 vbox->pack_start (*hbox, true, true);
251 new_user_page_index = append_page (*vbox);
252 set_page_type (*vbox, ASSISTANT_PAGE_INTRO);
253 set_page_title (*vbox, _("Welcome to Ardour"));
254 set_page_header_image (*vbox, icon_pixbuf);
255 set_page_complete (*vbox, true);
259 ArdourStartup::default_dir_changed ()
261 Config->set_default_session_parent_dir (default_dir_chooser->get_current_folder());
262 config_modified = true;
266 ArdourStartup::setup_first_time_config_page ()
268 default_dir_chooser = manage (new FileChooserButton (_("Default folder for Ardour sessions"),
269 FILE_CHOOSER_ACTION_SELECT_FOLDER));
270 Gtk::Label* txt = manage (new Label);
271 HBox* hbox = manage (new HBox);
272 VBox* vbox = manage (new VBox);
274 txt->set_markup (_("\
275 Each project that you work on with Ardour has its own folder.\n\
276 These can require a lot of disk space if you are recording audio.\n\
278 Where would you like new Ardour sessions to be stored by default?\n\n\
279 <i>(You can put new sessions anywhere, this is just a default)</i>"));
280 txt->set_alignment (0.0, 0.0);
282 vbox->set_spacing (18);
283 vbox->set_border_width (24);
285 hbox->pack_start (*default_dir_chooser, false, true, 8);
286 vbox->pack_start (*txt, false, false);
287 vbox->pack_start (*hbox, false, true);
289 default_dir_chooser->set_current_folder (poor_mans_glob (Config->get_default_session_parent_dir()));
290 default_dir_chooser->signal_current_folder_changed().connect (mem_fun (*this, &ArdourStartup::default_dir_changed));
291 default_dir_chooser->show ();
295 default_folder_page_index = append_page (*vbox);
296 set_page_title (*vbox, _("Default folder for new sessions"));
297 set_page_header_image (*vbox, icon_pixbuf);
298 set_page_type (*vbox, ASSISTANT_PAGE_CONTENT);
300 /* user can just skip all these settings if they want to */
302 set_page_complete (*vbox, true);
306 ArdourStartup::setup_monitoring_choice_page ()
308 mon_vbox.set_spacing (18);
309 mon_vbox.set_border_width (24);
311 HBox* hbox = manage (new HBox);
312 VBox* vbox = manage (new VBox);
313 RadioButton::Group g (monitor_via_hardware_button.get_group());
314 monitor_via_ardour_button.set_group (g);
316 monitor_label.set_markup("\
317 While recording instruments or vocals, you probably want to listen to the\n\
318 signal as well as record it. This is called \"monitoring\". There are\n\
319 different ways to do this depending on the equipment you have and the\n\
320 configuration of that equipment. The two most common are presented here.\n\
321 Please choose whichever one is right for your setup.\n\n\
322 <i>(You can change this preference at any time, via the Options menu)</i>");
323 monitor_label.set_alignment (0.0, 0.0);
325 vbox->set_spacing (6);
327 vbox->pack_start (monitor_via_hardware_button, false, true);
328 vbox->pack_start (monitor_via_ardour_button, false, true);
329 hbox->pack_start (*vbox, true, true, 8);
330 mon_vbox.pack_start (monitor_label, false, false);
331 mon_vbox.pack_start (*hbox, false, false);
333 mon_vbox.show_all ();
335 monitoring_page_index = append_page (mon_vbox);
336 set_page_title (mon_vbox, _("Monitoring Choices"));
337 set_page_header_image (mon_vbox, icon_pixbuf);
339 /* user could just click on "Forward" if default
343 set_page_complete (mon_vbox, true);
347 ArdourStartup::setup_initial_choice_page ()
349 ic_vbox.set_spacing (6);
350 ic_vbox.set_border_width (24);
352 RadioButton::Group g (ic_new_session_button.get_group());
353 ic_existing_session_button.set_group (g);
355 HBox* centering_hbox = manage (new HBox);
356 VBox* centering_vbox = manage (new VBox);
358 centering_vbox->set_spacing (6);
360 centering_vbox->pack_start (ic_new_session_button, false, true);
361 centering_vbox->pack_start (ic_existing_session_button, false, true);
363 centering_hbox->pack_start (*centering_vbox, true, true);
365 ic_vbox.pack_start (*centering_hbox, true, true);
369 initial_choice_index = append_page (ic_vbox);
370 set_page_title (ic_vbox, _("What would you like to do ?"));
371 set_page_header_image (ic_vbox, icon_pixbuf);
373 /* user could just click on "Forward" if default
377 set_page_complete (ic_vbox, true);
381 ArdourStartup::setup_session_page ()
383 session_vbox.set_border_width (24);
385 session_vbox.pack_start (session_hbox, true, true);
386 session_vbox.show_all ();
388 session_page_index = append_page (session_vbox);
389 /* initial setting */
390 set_page_type (session_vbox, ASSISTANT_PAGE_CONFIRM);
394 ArdourStartup::setup_final_page ()
396 final_page.set_text ("Ardour is ready for use");
398 final_page_index = append_page (final_page);
399 set_page_complete (final_page, true);
400 set_page_header_image (final_page, icon_pixbuf);
401 set_page_type (final_page, ASSISTANT_PAGE_CONFIRM);
405 ArdourStartup::on_cancel ()
411 ArdourStartup::on_close ()
419 ArdourStartup::on_apply ()
423 // XXX do stuff and then ....
426 engine_dialog->setup_engine ();
429 if (config_modified) {
431 if (default_dir_chooser) {
432 Config->set_default_session_parent_dir (default_dir_chooser->get_current_folder());
435 if (monitor_via_hardware_button.get_active()) {
436 Config->set_monitoring_model (ExternalMonitoring);
437 } else if (monitor_via_ardour_button.get_active()) {
438 Config->set_monitoring_model (SoftwareMonitoring);
441 Config->save_state ();
448 ArdourStartup::on_prepare (Gtk::Widget* page)
450 if (page == &session_vbox) {
452 if (ic_new_session_button.get_active()) {
453 /* new session requested */
454 setup_new_session_page ();
456 /* existing session requested */
457 setup_existing_session_page ();
463 ArdourStartup::populate_session_templates ()
465 vector<TemplateInfo> templates;
467 find_session_templates (templates);
469 template_model->clear ();
471 for (vector<TemplateInfo>::iterator x = templates.begin(); x != templates.end(); ++x) {
474 row = *(template_model->append ());
476 row[session_template_columns.name] = (*x).name;
477 row[session_template_columns.path] = (*x).path;
482 ArdourStartup::setup_new_session_page ()
484 if (!session_hbox.get_children().empty()) {
485 session_hbox.remove (**session_hbox.get_children().begin());
488 session_new_vbox.set_spacing (18);
490 if (session_new_vbox.get_children().empty()) {
491 VBox *vbox1 = manage (new VBox);
492 HBox* hbox1 = manage (new HBox);
493 Label* label1 = manage (new Label);
495 vbox1->set_spacing (6);
497 hbox1->set_spacing (6);
498 hbox1->pack_start (*label1, false, false);
499 hbox1->pack_start (new_name_entry, true, true);
501 label1->set_text (_("Session name:"));
504 if (!ARDOUR_COMMAND_LINE::session_name.empty()) {
505 new_name_entry.set_text (Glib::path_get_basename (ARDOUR_COMMAND_LINE::session_name));
506 /* name provided - they can move right along */
507 set_page_complete (session_vbox, true);
510 new_name_entry.signal_changed().connect (mem_fun (*this, &ArdourStartup::new_name_changed));
511 new_name_entry.signal_activate().connect (mem_fun (*this, &ArdourStartup::move_along_now));
513 vbox1->pack_start (*hbox1, true, true);
517 HBox* hbox2 = manage (new HBox);
518 Label* label2 = manage (new Label);
520 hbox2->set_spacing (6);
521 hbox2->pack_start (*label2, false, false);
522 hbox2->pack_start (new_folder_chooser, true, true);
524 label2->set_text (_("Create session folder in:"));
526 if (!ARDOUR_COMMAND_LINE::session_name.empty()) {
527 new_folder_chooser.set_current_folder (poor_mans_glob (Glib::path_get_dirname (ARDOUR_COMMAND_LINE::session_name)));
529 new_folder_chooser.set_current_folder (poor_mans_glob (Config->get_default_session_parent_dir()));
531 new_folder_chooser.set_title (_("Select folder for session"));
533 vbox1->pack_start (*hbox2, false, false);
535 session_new_vbox.pack_start (*vbox1, false, false);
539 VBox *vbox2 = manage (new VBox);
540 HBox* hbox3 = manage (new HBox);
541 Label* label3 = manage (new Label);
542 template_model = ListStore::create (session_template_columns);
543 populate_session_templates ();
545 vbox2->set_spacing (6);
547 label3->set_markup (_("<b>Options</b>"));
548 label3->set_alignment (0.0, 0.0);
550 vbox2->pack_start (*label3, false, true);
552 VBox *vbox3 = manage (new VBox);
554 vbox3->set_spacing (6);
556 if (!template_model->children().empty()) {
558 HBox* hbox4a = manage (new HBox);
559 use_template_button.set_label (_("Use this template"));
561 TreeModel::Row row = *template_model->prepend ();
562 row[session_template_columns.name] = (_("no template"));
563 row[session_template_columns.path] = string();
565 hbox4a->set_spacing (6);
566 hbox4a->pack_start (use_template_button, false, false);
567 hbox4a->pack_start (template_chooser, true, true);
569 template_chooser.set_model (template_model);
571 Gtk::CellRendererText* text_renderer = Gtk::manage (new Gtk::CellRendererText);
572 text_renderer->property_editable() = false;
574 template_chooser.pack_start (*text_renderer);
575 template_chooser.add_attribute (text_renderer->property_text(), session_template_columns.name);
576 template_chooser.set_active (0);
578 use_template_button.show();
579 template_chooser.show ();
581 vbox3->pack_start (*hbox4a, false, false);
587 session_template_chooser.set_current_folder (poor_mans_glob (Config->get_default_session_parent_dir()));
589 HBox* hbox4b = manage (new HBox);
590 use_session_as_template_button.set_label (_("Use an existing session as a template:"));
592 hbox4b->set_spacing (6);
593 hbox4b->pack_start (use_session_as_template_button, false, false);
594 hbox4b->pack_start (session_template_chooser, true, true);
596 use_session_as_template_button.show ();
597 session_template_chooser.show ();
599 Gtk::FileFilter* template_filter = manage (new (Gtk::FileFilter));
600 template_filter->add_pattern(X_("*.template"));
601 session_template_chooser.set_filter (*template_filter);
602 session_template_chooser.set_title (_("Select template"));
604 vbox3->pack_start (*hbox4b, false, false);
609 HBox* hbox5 = manage (new HBox);
611 hbox5->set_spacing (6);
612 hbox5->pack_start (more_new_session_options_button, false, false);
614 more_new_session_options_button.show ();
615 more_new_session_options_button.signal_clicked().connect (mem_fun (*this, &ArdourStartup::more_new_session_options_button_clicked));
617 vbox3->pack_start (*hbox5, false, false);
618 hbox3->pack_start (*vbox3, true, true, 8);
619 vbox2->pack_start (*hbox3, false, false);
623 session_new_vbox.pack_start (*vbox2, false, false);
626 session_new_vbox.show_all ();
627 session_hbox.pack_start (session_new_vbox, true, true);
628 set_page_title (session_vbox, _("New Session"));
629 set_page_type (session_vbox, ASSISTANT_PAGE_CONFIRM);
631 new_name_entry.grab_focus ();
635 ArdourStartup::new_name_changed ()
637 if (!new_name_entry.get_text().empty()) {
638 set_page_complete (session_vbox, true);
640 set_page_complete (session_vbox, false);
645 ArdourStartup::redisplay_recent_sessions ()
647 std::vector<sys::path> session_directories;
648 RecentSessionsSorter cmp;
650 recent_session_display.set_model (Glib::RefPtr<TreeModel>(0));
651 recent_session_model->clear ();
653 ARDOUR::RecentSessions rs;
654 ARDOUR::read_recent_sessions (rs);
657 recent_session_display.set_model (recent_session_model);
661 // sort them alphabetically
662 sort (rs.begin(), rs.end(), cmp);
664 for (ARDOUR::RecentSessions::iterator i = rs.begin(); i != rs.end(); ++i) {
665 session_directories.push_back ((*i).second);
668 for (vector<sys::path>::const_iterator i = session_directories.begin(); i != session_directories.end(); ++i)
670 std::vector<sys::path> state_file_paths;
672 // now get available states for this session
674 get_state_files_in_directory (*i, state_file_paths);
676 vector<string*>* states;
677 vector<const gchar*> item;
678 string fullpath = (*i).to_string();
680 /* remove any trailing / */
682 if (fullpath[fullpath.length()-1] == '/') {
683 fullpath = fullpath.substr (0, fullpath.length()-1);
686 /* check whether session still exists */
687 if (!Glib::file_test(fullpath.c_str(), Glib::FILE_TEST_EXISTS)) {
688 /* session doesn't exist */
692 /* now get available states for this session */
694 if ((states = Session::possible_states (fullpath)) == 0) {
699 std::vector<string> state_file_names(get_file_names_no_extension (state_file_paths));
701 Gtk::TreeModel::Row row = *(recent_session_model->append());
703 row[recent_session_columns.visible_name] = Glib::path_get_basename (fullpath);
704 row[recent_session_columns.fullpath] = fullpath;
706 if (state_file_names.size() > 1) {
710 for (std::vector<std::string>::iterator i2 = state_file_names.begin();
711 i2 != state_file_names.end(); ++i2)
714 Gtk::TreeModel::Row child_row = *(recent_session_model->append (row.children()));
716 child_row[recent_session_columns.visible_name] = *i2;
717 child_row[recent_session_columns.fullpath] = fullpath;
722 recent_session_display.set_model (recent_session_model);
726 ArdourStartup::recent_session_row_selected ()
728 if (recent_session_display.get_selection()->count_selected_rows() > 0) {
729 set_page_complete (session_vbox, true);
731 set_page_complete (session_vbox, false);
736 ArdourStartup::setup_existing_session_page ()
738 if (!session_hbox.get_children().empty()) {
739 session_hbox.remove (**session_hbox.get_children().begin());
742 if (recent_scroller.get_children().empty()) {
744 recent_session_model = TreeStore::create (recent_session_columns);
745 recent_session_display.set_model (recent_session_model);
746 recent_session_display.append_column (_("Recent Sessions"), recent_session_columns.visible_name);
747 recent_session_display.set_headers_visible (false);
748 recent_session_display.get_selection()->set_mode (SELECTION_BROWSE);
750 recent_session_display.get_selection()->signal_changed().connect (mem_fun (*this, &ArdourStartup::recent_session_row_selected));
752 recent_scroller.add (recent_session_display);
753 recent_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
754 recent_scroller.set_shadow_type (Gtk::SHADOW_IN);
756 recent_session_display.show();
759 recent_scroller.show();
760 redisplay_recent_sessions ();
761 recent_session_display.signal_row_activated().connect (mem_fun (*this, &ArdourStartup::recent_row_activated));
763 session_hbox.pack_start (recent_scroller, true, true);
764 set_page_title (session_vbox, _("Select a session"));
765 set_page_type (session_vbox, ASSISTANT_PAGE_CONFIRM);
769 ArdourStartup::more_new_session_options_button_clicked ()
771 if (more_new_session_options_button.get_active()) {
772 more_options_vbox.show_all ();
773 set_page_type (more_options_vbox, ASSISTANT_PAGE_CONFIRM);
774 set_page_type (session_vbox, ASSISTANT_PAGE_CONTENT);
776 set_page_type (session_vbox, ASSISTANT_PAGE_CONFIRM);
777 more_options_vbox.hide ();
782 ArdourStartup::setup_more_options_page ()
784 more_options_vbox.set_border_width (24);
786 _output_limit_count.set_adjustment (_output_limit_count_adj);
787 _input_limit_count.set_adjustment (_input_limit_count_adj);
788 _control_bus_channel_count.set_adjustment (_control_bus_channel_count_adj);
789 _master_bus_channel_count.set_adjustment (_master_bus_channel_count_adj);
791 chan_count_label_1.set_text (_("channels"));
792 chan_count_label_2.set_text (_("channels"));
793 chan_count_label_3.set_text (_("channels"));
794 chan_count_label_4.set_text (_("channels"));
796 chan_count_label_1.set_alignment(0,0.5);
797 chan_count_label_1.set_padding(0,0);
798 chan_count_label_1.set_line_wrap(false);
800 chan_count_label_2.set_alignment(0,0.5);
801 chan_count_label_2.set_padding(0,0);
802 chan_count_label_2.set_line_wrap(false);
804 chan_count_label_3.set_alignment(0,0.5);
805 chan_count_label_3.set_padding(0,0);
806 chan_count_label_3.set_line_wrap(false);
808 chan_count_label_4.set_alignment(0,0.5);
809 chan_count_label_4.set_padding(0,0);
810 chan_count_label_4.set_line_wrap(false);
812 bus_label.set_markup (_("<b>Busses</b>"));
813 input_label.set_markup (_("<b>Inputs</b>"));
814 output_label.set_markup (_("<b>Outputs</b>"));
816 _create_control_bus.set_label (_("Create monitor bus"));
817 _create_control_bus.set_flags(Gtk::CAN_FOCUS);
818 _create_control_bus.set_relief(Gtk::RELIEF_NORMAL);
819 _create_control_bus.set_mode(true);
820 _create_control_bus.set_active(false);
821 _create_control_bus.set_border_width(0);
823 _control_bus_channel_count.set_flags(Gtk::CAN_FOCUS);
824 _control_bus_channel_count.set_update_policy(Gtk::UPDATE_ALWAYS);
825 _control_bus_channel_count.set_numeric(true);
826 _control_bus_channel_count.set_digits(0);
827 _control_bus_channel_count.set_wrap(false);
828 _control_bus_channel_count.set_sensitive(false);
830 _master_bus_channel_count.set_flags(Gtk::CAN_FOCUS);
831 _master_bus_channel_count.set_update_policy(Gtk::UPDATE_ALWAYS);
832 _master_bus_channel_count.set_numeric(true);
833 _master_bus_channel_count.set_digits(0);
834 _master_bus_channel_count.set_wrap(false);
836 _create_master_bus.set_label (_("Create master bus"));
837 _create_master_bus.set_flags(Gtk::CAN_FOCUS);
838 _create_master_bus.set_relief(Gtk::RELIEF_NORMAL);
839 _create_master_bus.set_mode(true);
840 _create_master_bus.set_active(true);
841 _create_master_bus.set_border_width(0);
843 advanced_table.set_row_spacings(0);
844 advanced_table.set_col_spacings(0);
846 _connect_inputs.set_label (_("Automatically connect to physical_inputs"));
847 _connect_inputs.set_flags(Gtk::CAN_FOCUS);
848 _connect_inputs.set_relief(Gtk::RELIEF_NORMAL);
849 _connect_inputs.set_mode(true);
850 _connect_inputs.set_active(true);
851 _connect_inputs.set_border_width(0);
853 _limit_input_ports.set_label (_("Use only"));
854 _limit_input_ports.set_flags(Gtk::CAN_FOCUS);
855 _limit_input_ports.set_relief(Gtk::RELIEF_NORMAL);
856 _limit_input_ports.set_mode(true);
857 _limit_input_ports.set_sensitive(true);
858 _limit_input_ports.set_border_width(0);
860 _input_limit_count.set_flags(Gtk::CAN_FOCUS);
861 _input_limit_count.set_update_policy(Gtk::UPDATE_ALWAYS);
862 _input_limit_count.set_numeric(true);
863 _input_limit_count.set_digits(0);
864 _input_limit_count.set_wrap(false);
865 _input_limit_count.set_sensitive(false);
867 bus_hbox.pack_start (bus_table, Gtk::PACK_SHRINK, 18);
869 bus_label.set_alignment(0, 0.5);
870 bus_label.set_padding(0,0);
871 bus_label.set_line_wrap(false);
872 bus_label.set_selectable(false);
873 bus_label.set_use_markup(true);
874 bus_frame.set_shadow_type(Gtk::SHADOW_NONE);
875 bus_frame.set_label_align(0,0.5);
876 bus_frame.add(bus_hbox);
877 bus_frame.set_label_widget(bus_label);
879 bus_table.set_row_spacings (0);
880 bus_table.set_col_spacings (0);
881 bus_table.attach (_create_master_bus, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
882 bus_table.attach (_master_bus_channel_count, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
883 bus_table.attach (chan_count_label_1, 2, 3, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 6, 0);
884 bus_table.attach (_create_control_bus, 0, 1, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
885 bus_table.attach (_control_bus_channel_count, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
886 bus_table.attach (chan_count_label_2, 2, 3, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 6, 0);
888 input_port_limit_hbox.pack_start(_limit_input_ports, Gtk::PACK_SHRINK, 6);
889 input_port_limit_hbox.pack_start(_input_limit_count, Gtk::PACK_SHRINK, 0);
890 input_port_limit_hbox.pack_start(chan_count_label_3, Gtk::PACK_SHRINK, 6);
891 input_port_vbox.pack_start(_connect_inputs, Gtk::PACK_SHRINK, 0);
892 input_port_vbox.pack_start(input_port_limit_hbox, Gtk::PACK_EXPAND_PADDING, 0);
893 input_table.set_row_spacings(0);
894 input_table.set_col_spacings(0);
895 input_table.attach(input_port_vbox, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 6, 6);
897 input_hbox.pack_start (input_table, Gtk::PACK_SHRINK, 18);
899 input_label.set_alignment(0, 0.5);
900 input_label.set_padding(0,0);
901 input_label.set_line_wrap(false);
902 input_label.set_selectable(false);
903 input_label.set_use_markup(true);
904 input_frame.set_shadow_type(Gtk::SHADOW_NONE);
905 input_frame.set_label_align(0,0.5);
906 input_frame.add(input_hbox);
907 input_frame.set_label_widget(input_label);
909 _connect_outputs.set_label (_("Automatically connect outputs"));
910 _connect_outputs.set_flags(Gtk::CAN_FOCUS);
911 _connect_outputs.set_relief(Gtk::RELIEF_NORMAL);
912 _connect_outputs.set_mode(true);
913 _connect_outputs.set_active(true);
914 _connect_outputs.set_border_width(0);
915 _limit_output_ports.set_label (_("Use only"));
916 _limit_output_ports.set_flags(Gtk::CAN_FOCUS);
917 _limit_output_ports.set_relief(Gtk::RELIEF_NORMAL);
918 _limit_output_ports.set_mode(true);
919 _limit_output_ports.set_sensitive(true);
920 _limit_output_ports.set_border_width(0);
921 _output_limit_count.set_flags(Gtk::CAN_FOCUS);
922 _output_limit_count.set_update_policy(Gtk::UPDATE_ALWAYS);
923 _output_limit_count.set_numeric(false);
924 _output_limit_count.set_digits(0);
925 _output_limit_count.set_wrap(false);
926 _output_limit_count.set_sensitive(false);
927 output_port_limit_hbox.pack_start(_limit_output_ports, Gtk::PACK_SHRINK, 6);
928 output_port_limit_hbox.pack_start(_output_limit_count, Gtk::PACK_SHRINK, 0);
929 output_port_limit_hbox.pack_start(chan_count_label_4, Gtk::PACK_SHRINK, 6);
931 _connect_outputs_to_master.set_label (_("... to master bus"));
932 _connect_outputs_to_master.set_flags(Gtk::CAN_FOCUS);
933 _connect_outputs_to_master.set_relief(Gtk::RELIEF_NORMAL);
934 _connect_outputs_to_master.set_mode(true);
935 _connect_outputs_to_master.set_active(false);
936 _connect_outputs_to_master.set_border_width(0);
938 _connect_outputs_to_master.set_group (connect_outputs_group);
939 _connect_outputs_to_physical.set_group (connect_outputs_group);
941 _connect_outputs_to_physical.set_label (_("... to physical outputs"));
942 _connect_outputs_to_physical.set_flags(Gtk::CAN_FOCUS);
943 _connect_outputs_to_physical.set_relief(Gtk::RELIEF_NORMAL);
944 _connect_outputs_to_physical.set_mode(true);
945 _connect_outputs_to_physical.set_active(false);
946 _connect_outputs_to_physical.set_border_width(0);
948 output_conn_vbox.pack_start(_connect_outputs, Gtk::PACK_SHRINK, 0);
949 output_conn_vbox.pack_start(_connect_outputs_to_master, Gtk::PACK_SHRINK, 0);
950 output_conn_vbox.pack_start(_connect_outputs_to_physical, Gtk::PACK_SHRINK, 0);
951 output_vbox.set_border_width(6);
953 output_port_vbox.pack_start(output_port_limit_hbox, Gtk::PACK_SHRINK, 0);
955 output_vbox.pack_start(output_conn_vbox);
956 output_vbox.pack_start(output_port_vbox);
958 output_label.set_alignment(0, 0.5);
959 output_label.set_padding(0,0);
960 output_label.set_line_wrap(false);
961 output_label.set_selectable(false);
962 output_label.set_use_markup(true);
963 output_frame.set_shadow_type(Gtk::SHADOW_NONE);
964 output_frame.set_label_align(0,0.5);
966 output_hbox.pack_start (output_vbox, Gtk::PACK_SHRINK, 18);
968 output_frame.add(output_hbox);
969 output_frame.set_label_widget(output_label);
971 more_options_vbox.pack_start(advanced_table, Gtk::PACK_SHRINK, 0);
972 more_options_vbox.pack_start(bus_frame, Gtk::PACK_SHRINK, 6);
973 more_options_vbox.pack_start(input_frame, Gtk::PACK_SHRINK, 6);
974 more_options_vbox.pack_start(output_frame, Gtk::PACK_SHRINK, 0);
978 _connect_inputs.signal_clicked().connect (mem_fun (*this, &ArdourStartup::connect_inputs_clicked));
979 _connect_outputs.signal_clicked().connect (mem_fun (*this, &ArdourStartup::connect_outputs_clicked));
980 _limit_input_ports.signal_clicked().connect (mem_fun (*this, &ArdourStartup::limit_inputs_clicked));
981 _limit_output_ports.signal_clicked().connect (mem_fun (*this, &ArdourStartup::limit_outputs_clicked));
982 _create_master_bus.signal_clicked().connect (mem_fun (*this, &ArdourStartup::master_bus_button_clicked));
983 _create_control_bus.signal_clicked().connect (mem_fun (*this, &ArdourStartup::monitor_bus_button_clicked));
985 /* note that more_options_vbox is NOT visible by
986 * default. this is entirely by design - this page
987 * should be skipped unless explicitly requested.
990 session_options_page_index = append_page (more_options_vbox);
991 set_page_title (more_options_vbox, _("Advanced Session Options"));
992 set_page_complete (more_options_vbox, true);
996 ArdourStartup::create_master_bus() const
998 return _create_master_bus.get_active();
1002 ArdourStartup::master_channel_count() const
1004 return _master_bus_channel_count.get_value_as_int();
1008 ArdourStartup::create_control_bus() const
1010 return _create_control_bus.get_active();
1014 ArdourStartup::control_channel_count() const
1016 return _control_bus_channel_count.get_value_as_int();
1020 ArdourStartup::connect_inputs() const
1022 return _connect_inputs.get_active();
1026 ArdourStartup::limit_inputs_used_for_connection() const
1028 return _limit_input_ports.get_active();
1032 ArdourStartup::input_limit_count() const
1034 return _input_limit_count.get_value_as_int();
1038 ArdourStartup::connect_outputs() const
1040 return _connect_outputs.get_active();
1044 ArdourStartup::limit_outputs_used_for_connection() const
1046 return _limit_output_ports.get_active();
1050 ArdourStartup::output_limit_count() const
1052 return _output_limit_count.get_value_as_int();
1056 ArdourStartup::connect_outs_to_master() const
1058 return _connect_outputs_to_master.get_active();
1062 ArdourStartup::connect_outs_to_physical() const
1064 return _connect_outputs_to_physical.get_active();
1068 ArdourStartup::connect_inputs_clicked ()
1070 _limit_input_ports.set_sensitive(_connect_inputs.get_active());
1072 if (_connect_inputs.get_active() && _limit_input_ports.get_active()) {
1073 _input_limit_count.set_sensitive(true);
1075 _input_limit_count.set_sensitive(false);
1080 ArdourStartup::connect_outputs_clicked ()
1082 _limit_output_ports.set_sensitive(_connect_outputs.get_active());
1084 if (_connect_outputs.get_active() && _limit_output_ports.get_active()) {
1085 _output_limit_count.set_sensitive(true);
1087 _output_limit_count.set_sensitive(false);
1092 ArdourStartup::limit_inputs_clicked ()
1094 _input_limit_count.set_sensitive(_limit_input_ports.get_active());
1098 ArdourStartup::limit_outputs_clicked ()
1100 _output_limit_count.set_sensitive(_limit_output_ports.get_active());
1104 ArdourStartup::master_bus_button_clicked ()
1106 _master_bus_channel_count.set_sensitive(_create_master_bus.get_active());
1110 ArdourStartup::monitor_bus_button_clicked ()
1112 _control_bus_channel_count.set_sensitive(_create_control_bus.get_active());
1116 ArdourStartup::move_along_now ()
1118 gint cur = get_current_page ();
1120 if (cur == session_page_index) {
1121 if (more_new_session_options_button.get_active()) {
1122 set_current_page (session_options_page_index);
1130 ArdourStartup::recent_row_activated (const Gtk::TreePath& path, Gtk::TreeViewColumn* col)
1132 set_page_complete (session_vbox, true);