21 #include "gtk2ardour-config.h"
27 #include <gtkmm/filechooser.h>
62 , new_only (require_new)
63 , _provided_session_name (session_name)
64 , _provided_session_path (session_path)
65 , new_folder_chooser (FILE_CHOOSER_ACTION_SELECT_FOLDER)
66 , more_new_session_options_button (
_(
"Advanced options ..."))
67 , _output_limit_count_adj (1, 0, 100, 1, 10, 0)
68 , _input_limit_count_adj (1, 0, 100, 1, 10, 0)
69 , _master_bus_channel_count_adj (2, 0, 100, 1, 10, 0)
70 , _existing_session_chooser_used (false)
72 set_position (WIN_POS_CENTER);
73 get_vbox()->set_spacing (6);
75 cancel_button = add_button ((cancel_not_quit ? Stock::CANCEL : Stock::QUIT), RESPONSE_CANCEL);
76 back_button = add_button (Stock::GO_BACK, RESPONSE_NO);
77 open_button = add_button (Stock::OPEN, RESPONSE_ACCEPT);
91 get_vbox()->pack_start (
info_frame,
false,
false);
97 get_vbox()->pack_start (
ic_vbox,
true,
true);
102 if (!template_name.empty()) {
107 get_vbox()->show_all ();
144 if (!session_name.empty() && !require_new) {
145 response (RESPONSE_OK);
185 TreeModel::Row row = (*iter);
197 should_be_new =
false;
206 should_be_new =
false;
212 should_be_new =
false;
215 should_be_new =
true;
235 if (Glib::file_test (s, Glib::FILE_TEST_IS_REGULAR)) {
236 return Glib::path_get_dirname (s);
248 return Glib::build_filename (
new_folder_chooser.get_filename (), legal_session_folder_name);
257 HBox* centering_hbox = manage (
new HBox);
258 VBox* centering_vbox = manage (
new VBox);
260 centering_vbox->set_spacing (6);
262 Label* new_label = manage (
new Label);
263 new_label->set_markup (
string_compose (
"<span weight=\"bold\" size=\"large\">%1</span>",
_(
"New Session")));
264 new_label->set_justify (JUSTIFY_CENTER);
269 Gtk::HBox* hbox = manage (
new HBox);
270 Gtk::VBox* vbox = manage (
new VBox);
271 hbox->set_spacing (12);
272 vbox->set_spacing (12);
278 if ((image = manage (
new Gtk::Image (image_path))) != 0) {
279 hbox->pack_start (*image,
false,
false);
284 hbox->pack_start (*vbox,
true,
true, 20);
286 centering_vbox->pack_start (*hbox,
false,
false);
292 Box *info_box = manage (
new VBox);
293 info_box->set_border_width (12);
294 info_box->set_spacing (6);
301 Gtk::Button *updates_button = manage (
new Gtk::Button (
_(
"Check the website for more...")));
306 info_box->pack_start (*updates_button,
false,
false);
309 info_box->show_all ();
338 centering_vbox->pack_start (
recent_label,
false,
false, 12);
347 FileFilter session_filter;
349 session_filter.set_name (
string_compose (
_(
"%1 sessions"), PROGRAM_NAME));
357 Label* browse_label = manage (
new Label);
358 browse_label->set_markup (
string_compose (
"<span weight=\"bold\" size=\"large\">%1</span>",
_(
"Other Sessions")));
360 centering_vbox->pack_start (*browse_label,
false,
false, 12);
365 centering_hbox->pack_start (*centering_vbox,
true,
true);
366 ic_vbox.pack_start (*centering_hbox,
true,
true);
377 Gtk::Widget* tl =
ic_vbox.get_toplevel();
379 if ((win = dynamic_cast<Gtk::Window*>(tl)) != 0) {
381 Gtk::Widget* def = wrap (gtk_window_get_default_widget (win->gobj()));
383 if ((button = dynamic_cast<Gtk::Button*>(def)) != 0) {
384 button->set_label (
_(
"Open"));
406 get_vbox()->pack_start (
ic_vbox);
414 vector<TemplateInfo> templates;
420 for (vector<TemplateInfo>::iterator x = templates.begin(); x != templates.end(); ++x) {
429 if (!templates.empty()) {
441 VBox *vbox1 = manage (
new VBox);
442 HBox* hbox1 = manage (
new HBox);
443 Label* label1 = manage (
new Label);
445 vbox1->set_spacing (6);
447 hbox1->set_spacing (6);
448 hbox1->pack_start (*label1,
false,
false);
451 label1->set_text (
_(
"Session name:"));
462 vbox1->pack_start (*hbox1,
true,
true);
466 HBox* hbox2 = manage (
new HBox);
467 Label* label2 = manage (
new Label);
469 hbox2->set_spacing (6);
470 hbox2->pack_start (*label2,
false,
false);
473 label2->set_text (
_(
"Create session folder in:"));
479 string session_parent_dir = Glib::path_get_dirname(
ARDOUR_UI::instance()->the_session()->path());
480 string::size_type last_dir_sep = session_parent_dir.rfind(G_DIR_SEPARATOR);
481 session_parent_dir = session_parent_dir.substr(0, last_dir_sep);
489 catch (Glib::Error & e) {
490 std::cerr <<
"new_folder_chooser.add_shortcut_folder (" << default_session_folder <<
") threw Glib::Error " << e.what() << std::endl;
502 vbox1->pack_start (*hbox2,
false,
false);
508 VBox *vbox2 = manage (
new VBox);
509 HBox* hbox3 = manage (
new HBox);
512 vbox2->set_spacing (6);
514 VBox *vbox3 = manage (
new VBox);
516 vbox3->set_spacing (6);
524 HBox* hbox4a = manage (
new HBox);
531 hbox4a->set_spacing (6);
537 Gtk::CellRendererText* text_renderer = Gtk::manage (
new Gtk::CellRendererText);
538 text_renderer->property_editable() =
false;
544 vbox3->pack_start (*hbox4a,
false,
false);
548 HBox* hbox5 = manage (
new HBox);
550 hbox5->set_spacing (6);
556 vbox3->pack_start (*hbox5,
false,
false);
557 hbox3->pack_start (*vbox3,
true,
true, 8);
558 vbox2->pack_start (*hbox3,
false,
false);
580 response (RESPONSE_ACCEPT);
586 std::vector<std::string> session_directories;
601 sort (rs.begin(), rs.end(), cmp);
603 for (ARDOUR::RecentSessions::iterator i = rs.begin(); i != rs.end(); ++i) {
604 session_directories.push_back ((*i).second);
607 int session_snapshot_count = 0;
609 for (vector<std::string>::const_iterator i = session_directories.begin(); i != session_directories.end(); ++i)
611 std::vector<std::string> state_file_paths;
617 vector<string> states;
618 vector<const gchar*> item;
623 if (dirname[dirname.length()-1] ==
'/') {
624 dirname = dirname.substr (0, dirname.length()-1);
628 if (!Glib::file_test(dirname.c_str(), Glib::FILE_TEST_EXISTS)) {
635 states = Session::possible_states (dirname);
637 if (states.empty()) {
644 if (state_file_names.empty()) {
652 std::string state_file_basename = state_file_names.front();
654 std::string s = Glib::build_filename (dirname, state_file_basename +
statefile_suffix);
659 if (Session::get_info_from_path (s, sr, sf) == 0) {
677 ++session_snapshot_count;
679 if (state_file_names.size() > 1) {
687 for (std::vector<std::string>::iterator i2 = state_file_names.begin(); i2 != state_file_names.end(); ++i2) {
695 if (Session::get_info_from_path (s, sr, sf) == 0) {
714 ++session_snapshot_count;
724 return session_snapshot_count;
811 bus_frame.set_shadow_type(Gtk::SHADOW_NONE);
1036 response (RESPONSE_ACCEPT);
1048 response (RESPONSE_ACCEPT);
1079 response (RESPONSE_CANCEL);
bool use_session_template()
Gtk::Button * open_button
bool limit_inputs_used_for_connection() const
Gtk::ComboBox template_chooser
bool _existing_session_chooser_used
set to true when the existing session chooser has been used
Gtk::TreeModelColumn< std::string > tip
Gtk::TreeModelColumn< std::string > path
Gtk::ScrolledWindow recent_scroller
bool create_master_bus() const
Gtk::Label chan_count_label_1
LIBARDOUR_API std::string legalize_for_path(const std::string &str)
std::string _provided_session_name
Gtk::Label chan_count_label_4
static ARDOUR_UI * instance()
bool connect_outs_to_master() const
std::deque< std::pair< std::string, std::string > > RecentSessions
Gtk::Label chan_count_label_3
SessionTemplateColumns session_template_columns
int output_limit_count() const
void master_bus_button_clicked()
Gtk::FileChooserButton new_folder_chooser
Gtk::HBox input_port_limit_hbox
void connect_inputs_clicked()
Gtk::Entry new_name_entry
LIBPBD_API void strip_whitespace_edges(std::string &str)
void limit_outputs_clicked()
Gtk::Label info_scroller_label
bool find_file(const Searchpath &search_path, const string &filename, std::string &result)
Gtk::VBox input_port_vbox
Gtk::VBox output_port_vbox
void recent_session_row_selected()
SessionDialog(bool require_new, const std::string &session_name, const std::string &session_path, const std::string &template_name, bool cancel_not_quit)
Glib::RefPtr< Gtk::TreeStore > recent_session_model
Gtk::SpinButton _input_limit_count
bool connect_outs_to_physical() const
Gtk::FileChooserButton existing_session_chooser
void existing_session_selected()
bool limit_outputs_used_for_connection() const
LIBARDOUR_API RCConfiguration * Config
Gtk::CheckButton _create_master_bus
int input_limit_count() const
Gtk::VBox session_new_vbox
void setup_more_options_box()
Gtk::VBox more_options_vbox
Gtk::SpinButton _output_limit_count
std::string load_template_override
Gtk::Adjustment _output_limit_count_adj
Gtk::TreeModelColumn< std::string > sample_rate
Gtk::TreeModelColumn< std::string > visible_name
Gtk::CheckButton use_template_button
int master_channel_count() const
bool back_button_pressed(GdkEventButton *)
LIBARDOUR_API std::string user_template_directory()
void recent_row_activated(const Gtk::TreePath &path, Gtk::TreeViewColumn *col)
Gtk::Button * back_button
bool on_delete_event(GdkEventAny *)
void limit_inputs_clicked()
bool connect_outputs() const
Gtk::CheckButton _connect_inputs
Gtk::Button ic_new_session_button
std::string rate_as_string(float r)
void setup_initial_choice_box()
Gtk::RadioButtonGroup connect_outputs_group
LIBPBD_API std::string poor_mans_glob(std::string path)
bool connect_inputs() const
Gtk::HBox output_port_limit_hbox
Gtk::Tooltips & tooltips()
Gtk::Table advanced_table
Gtk::Adjustment _master_bus_channel_count_adj
Gtk::Adjustment _input_limit_count_adj
LIBARDOUR_API std::vector< std::string > get_file_names_no_extension(const std::vector< std::string > &file_paths)
std::string _provided_session_path
LIBPBD_API bool open_uri(const char *)
Gtk::CheckButton _limit_output_ports
Gtk::RadioButton _connect_outputs_to_master
LIBARDOUR_API const char *const statefile_suffix
LIBARDOUR_API const char *const template_suffix
RecentSessionModelColumns recent_session_columns
std::string::size_type info_scroller_count
Gtk::RadioButton _connect_outputs_to_physical
LIBARDOUR_API int read_recent_sessions(RecentSessions &rs)
LIBARDOUR_API void get_state_files_in_directory(const std::string &directory_path, std::vector< std::string > &result)
Gtk::TreeModelColumn< std::string > fullpath
Gtk::Expander more_new_session_options_button
void connect_outputs_clicked()
Gtk::Button * cancel_button
Gtk::VBox output_conn_vbox
int redisplay_recent_sessions()
bool on_delete_event(GdkEventAny *)
sigc::connection info_scroller_connection
void populate_session_templates()
std::string session_folder()
Glib::RefPtr< Gtk::ListStore > template_model
Gtk::TreeView recent_session_display
LIBARDOUR_API void find_session_templates(std::vector< TemplateInfo > &template_names)
void new_name_activated()
Gtk::CheckButton _limit_input_ports
void updates_button_clicked()
LIBARDOUR_API PBD::Searchpath ardour_data_search_path()
Gtk::TreeModelColumn< std::string > disk_format
std::string session_name(bool &should_be_new)
Gtk::SpinButton _master_bus_channel_count
void new_session_button_clicked()
bool info_scroller_update()
void setup_new_session_page()
std::string string_compose(const std::string &fmt, const T1 &o1)
Gtk::TreeModelColumn< std::string > name
Gtk::CheckButton _connect_outputs
LIBARDOUR_API PBD::PropertyDescriptor< framecnt_t > length
std::string session_template_name()