2005-09-25 14:42:24 -04:00
|
|
|
/*
|
2005-11-14 03:38:16 -05:00
|
|
|
Copyright (C) 2005 Paul Davis
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2008-01-12 18:45:50 -05:00
|
|
|
#include <pbd/error.h>
|
|
|
|
|
2006-04-24 17:34:23 -04:00
|
|
|
#include <ardour/recent_sessions.h>
|
2007-09-04 01:26:26 -04:00
|
|
|
#include <ardour/session_state_utils.h>
|
2007-06-16 20:52:51 -04:00
|
|
|
#include <ardour/template_utils.h>
|
2007-10-11 18:07:47 -04:00
|
|
|
#include <ardour/session.h>
|
|
|
|
#include <ardour/profile.h>
|
2006-04-24 17:34:23 -04:00
|
|
|
|
2005-11-28 23:41:15 -05:00
|
|
|
#include <gtkmm/entry.h>
|
|
|
|
#include <gtkmm/filechooserbutton.h>
|
|
|
|
#include <gtkmm/spinbutton.h>
|
|
|
|
#include <gtkmm/checkbutton.h>
|
|
|
|
#include <gtkmm/radiobutton.h>
|
2006-04-24 17:34:23 -04:00
|
|
|
#include <gtkmm/filefilter.h>
|
|
|
|
#include <gtkmm/stock.h>
|
2006-08-30 16:48:16 -04:00
|
|
|
#include <gdkmm/cursor.h>
|
2006-04-24 17:34:23 -04:00
|
|
|
|
2007-04-11 09:07:51 -04:00
|
|
|
#include <gtkmm2ext/window_title.h>
|
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
using namespace Gtk;
|
2007-04-11 09:07:51 -04:00
|
|
|
using namespace Gtkmm2ext;
|
2007-06-16 20:52:51 -04:00
|
|
|
using namespace PBD;
|
2008-01-12 18:45:50 -05:00
|
|
|
using namespace ARDOUR;
|
2007-04-11 09:07:51 -04:00
|
|
|
|
2006-08-08 17:27:41 -04:00
|
|
|
#include "opts.h"
|
2008-01-10 17:22:29 -05:00
|
|
|
#include "utils.h"
|
2008-12-12 09:43:24 -05:00
|
|
|
#include "i18n.h"
|
|
|
|
#include "new_session_dialog.h"
|
2005-11-28 23:41:15 -05:00
|
|
|
|
2006-05-11 19:44:20 -04:00
|
|
|
NewSessionDialog::NewSessionDialog()
|
2006-10-05 10:43:25 -04:00
|
|
|
: ArdourDialog ("session control")
|
2005-11-14 03:38:16 -05:00
|
|
|
{
|
2007-10-11 18:07:47 -04:00
|
|
|
in_destructor = false;
|
2009-01-02 22:34:41 -05:00
|
|
|
session_name_label = new Gtk::Label(_("Name:"));
|
2008-03-17 16:54:03 -04:00
|
|
|
m_name = new Gtk::Entry();
|
2007-10-11 18:07:47 -04:00
|
|
|
m_name->set_text(ARDOUR_COMMAND_LINE::session_name);
|
2006-08-08 17:27:41 -04:00
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
chan_count_label_1 = new Gtk::Label(_("channels"));
|
|
|
|
chan_count_label_2 = new Gtk::Label(_("channels"));
|
|
|
|
chan_count_label_3 = new Gtk::Label(_("channels"));
|
|
|
|
chan_count_label_4 = new Gtk::Label(_("channels"));
|
2006-10-05 10:43:25 -04:00
|
|
|
|
|
|
|
chan_count_label_1->set_alignment(0,0.5);
|
|
|
|
chan_count_label_1->set_padding(0,0);
|
|
|
|
chan_count_label_1->set_line_wrap(false);
|
|
|
|
|
|
|
|
chan_count_label_2->set_alignment(0,0.5);
|
|
|
|
chan_count_label_2->set_padding(0,0);
|
|
|
|
chan_count_label_2->set_line_wrap(false);
|
|
|
|
|
|
|
|
chan_count_label_3->set_alignment(0,0.5);
|
|
|
|
chan_count_label_3->set_padding(0,0);
|
|
|
|
chan_count_label_3->set_line_wrap(false);
|
|
|
|
|
|
|
|
chan_count_label_4->set_alignment(0,0.5);
|
|
|
|
chan_count_label_4->set_padding(0,0);
|
|
|
|
chan_count_label_4->set_line_wrap(false);
|
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
bus_label = new Gtk::Label(_("<b>Busses</b>"));
|
|
|
|
input_label = new Gtk::Label(_("<b>Inputs</b>"));
|
|
|
|
output_label = new Gtk::Label(_("<b>Outputs</b>"));
|
2006-10-05 10:43:25 -04:00
|
|
|
|
2009-01-02 22:34:41 -05:00
|
|
|
session_location_label = new Gtk::Label(_("Create folder in:"));
|
2008-03-17 16:54:03 -04:00
|
|
|
m_folder = new Gtk::FileChooserButton(Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER);
|
2009-01-02 22:34:41 -05:00
|
|
|
session_template_label = new Gtk::Label(_("Template:"));
|
2008-03-17 16:54:03 -04:00
|
|
|
m_template = new Gtk::FileChooserButton();
|
2009-01-02 22:34:41 -05:00
|
|
|
m_create_control_bus = new Gtk::CheckButton(_("Create monitor bus"));
|
2006-05-12 08:41:43 -04:00
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
Gtk::Adjustment *m_control_bus_channel_count_adj = Gtk::manage(new Gtk::Adjustment(2, 0, 100, 1, 10, 10));
|
|
|
|
m_control_bus_channel_count = new Gtk::SpinButton(*m_control_bus_channel_count_adj, 1, 0);
|
2006-05-12 08:41:43 -04:00
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
Gtk::Adjustment *m_master_bus_channel_count_adj = Gtk::manage(new Gtk::Adjustment(2, 0, 100, 1, 10, 10));
|
|
|
|
m_master_bus_channel_count = new Gtk::SpinButton(*m_master_bus_channel_count_adj, 1, 0);
|
2009-01-02 22:34:41 -05:00
|
|
|
m_create_master_bus = new Gtk::CheckButton(_("Create master bus"));
|
2008-03-17 16:54:03 -04:00
|
|
|
advanced_table = new Gtk::Table(2, 2, true);
|
2009-01-02 22:34:41 -05:00
|
|
|
m_connect_inputs = new Gtk::CheckButton(_("Automatically connect to physical inputs"));
|
2008-03-17 16:54:03 -04:00
|
|
|
m_limit_input_ports = new Gtk::CheckButton(_("Use only"));
|
2006-05-12 08:41:43 -04:00
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
Gtk::Adjustment *m_input_limit_count_adj = Gtk::manage(new Gtk::Adjustment(1, 0, 100, 1, 10, 10));
|
|
|
|
m_input_limit_count = new Gtk::SpinButton(*m_input_limit_count_adj, 1, 0);
|
|
|
|
input_port_limit_hbox = new Gtk::HBox(false, 0);
|
|
|
|
input_port_vbox = new Gtk::VBox(false, 0);
|
|
|
|
input_table = new Gtk::Table(2, 2, false);
|
|
|
|
|
|
|
|
bus_frame = new Gtk::Frame();
|
|
|
|
bus_table = new Gtk::Table (2, 3, false);
|
2006-05-12 08:41:43 -04:00
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
input_frame = new Gtk::Frame();
|
2009-01-02 22:34:41 -05:00
|
|
|
m_connect_outputs = new Gtk::CheckButton(_("Automatically connect outputs"));
|
2008-03-17 16:54:03 -04:00
|
|
|
m_limit_output_ports = new Gtk::CheckButton(_("Use only"));
|
|
|
|
|
|
|
|
Gtk::Adjustment *m_output_limit_count_adj = Gtk::manage(new Gtk::Adjustment(1, 0, 100, 1, 10, 10));
|
|
|
|
m_output_limit_count = new Gtk::SpinButton(*m_output_limit_count_adj, 1, 0);
|
|
|
|
output_port_limit_hbox = new Gtk::HBox(false, 0);
|
|
|
|
output_port_vbox = new Gtk::VBox(false, 0);
|
2006-05-12 08:41:43 -04:00
|
|
|
|
|
|
|
Gtk::RadioButton::Group _RadioBGroup_m_connect_outputs_to_master;
|
2009-01-02 22:34:41 -05:00
|
|
|
m_connect_outputs_to_master = new Gtk::RadioButton(_RadioBGroup_m_connect_outputs_to_master, _("... to master bus"));
|
|
|
|
m_connect_outputs_to_physical = new Gtk::RadioButton(_RadioBGroup_m_connect_outputs_to_master, _("... to physical outputs"));
|
2008-03-17 16:54:03 -04:00
|
|
|
output_conn_vbox = new Gtk::VBox(false, 0);
|
|
|
|
output_vbox = new Gtk::VBox(false, 0);
|
|
|
|
|
|
|
|
output_frame = new Gtk::Frame();
|
|
|
|
advanced_vbox = new Gtk::VBox(false, 0);
|
2009-01-02 22:34:41 -05:00
|
|
|
advanced_label = new Gtk::Label(_("Advanced options"));
|
2008-03-17 16:54:03 -04:00
|
|
|
advanced_expander = new Gtk::Expander();
|
|
|
|
new_session_table = new Gtk::Table(2, 2, false);
|
|
|
|
m_open_filechooser = new Gtk::FileChooserButton();
|
|
|
|
open_session_hbox = new Gtk::HBox(false, 0);
|
|
|
|
m_treeview = new Gtk::TreeView();
|
|
|
|
recent_scrolledwindow = new Gtk::ScrolledWindow();
|
|
|
|
|
|
|
|
recent_sesion_label = new Gtk::Label(_("Recent:"));
|
|
|
|
recent_frame = new Gtk::Frame();
|
|
|
|
open_session_vbox = new Gtk::VBox(false, 0);
|
|
|
|
m_notebook = new Gtk::Notebook();
|
2006-05-12 15:51:40 -04:00
|
|
|
session_name_label->set_alignment(0, 0.5);
|
2006-10-05 10:43:25 -04:00
|
|
|
session_name_label->set_padding(6,0);
|
2006-05-12 08:41:43 -04:00
|
|
|
session_name_label->set_line_wrap(false);
|
|
|
|
session_name_label->set_selectable(false);
|
|
|
|
m_name->set_editable(true);
|
|
|
|
m_name->set_max_length(0);
|
|
|
|
m_name->set_has_frame(true);
|
2006-05-12 15:51:40 -04:00
|
|
|
m_name->set_activates_default(true);
|
2006-10-05 10:43:25 -04:00
|
|
|
m_name->set_width_chars (40);
|
2006-05-12 15:51:40 -04:00
|
|
|
session_location_label->set_alignment(0,0.5);
|
2006-10-05 10:43:25 -04:00
|
|
|
session_location_label->set_padding(6,0);
|
2006-05-12 08:41:43 -04:00
|
|
|
session_location_label->set_line_wrap(false);
|
|
|
|
session_location_label->set_selectable(false);
|
2006-05-12 15:51:40 -04:00
|
|
|
session_template_label->set_alignment(0,0.5);
|
2006-10-05 10:43:25 -04:00
|
|
|
session_template_label->set_padding(6,0);
|
2006-05-12 08:41:43 -04:00
|
|
|
session_template_label->set_line_wrap(false);
|
|
|
|
session_template_label->set_selectable(false);
|
|
|
|
m_create_control_bus->set_flags(Gtk::CAN_FOCUS);
|
|
|
|
m_create_control_bus->set_relief(Gtk::RELIEF_NORMAL);
|
|
|
|
m_create_control_bus->set_mode(true);
|
|
|
|
m_create_control_bus->set_active(false);
|
2006-05-14 04:53:28 -04:00
|
|
|
m_create_control_bus->set_border_width(0);
|
2006-05-12 08:41:43 -04:00
|
|
|
m_control_bus_channel_count->set_flags(Gtk::CAN_FOCUS);
|
|
|
|
m_control_bus_channel_count->set_update_policy(Gtk::UPDATE_ALWAYS);
|
|
|
|
m_control_bus_channel_count->set_numeric(true);
|
|
|
|
m_control_bus_channel_count->set_digits(0);
|
|
|
|
m_control_bus_channel_count->set_wrap(false);
|
2006-05-14 04:53:28 -04:00
|
|
|
m_control_bus_channel_count->set_sensitive(false);
|
2006-05-12 08:41:43 -04:00
|
|
|
m_master_bus_channel_count->set_flags(Gtk::CAN_FOCUS);
|
|
|
|
m_master_bus_channel_count->set_update_policy(Gtk::UPDATE_ALWAYS);
|
|
|
|
m_master_bus_channel_count->set_numeric(true);
|
|
|
|
m_master_bus_channel_count->set_digits(0);
|
|
|
|
m_master_bus_channel_count->set_wrap(false);
|
2008-03-17 16:54:03 -04:00
|
|
|
open_session_file_label = new Gtk::Label(_("Browse:"));
|
2006-05-14 04:53:28 -04:00
|
|
|
open_session_file_label->set_alignment(0, 0.5);
|
2006-05-12 08:41:43 -04:00
|
|
|
m_create_master_bus->set_flags(Gtk::CAN_FOCUS);
|
|
|
|
m_create_master_bus->set_relief(Gtk::RELIEF_NORMAL);
|
|
|
|
m_create_master_bus->set_mode(true);
|
|
|
|
m_create_master_bus->set_active(true);
|
2006-05-14 04:53:28 -04:00
|
|
|
m_create_master_bus->set_border_width(0);
|
2006-05-12 08:41:43 -04:00
|
|
|
advanced_table->set_row_spacings(0);
|
|
|
|
advanced_table->set_col_spacings(0);
|
2008-03-17 16:54:03 -04:00
|
|
|
|
2006-05-12 08:41:43 -04:00
|
|
|
m_connect_inputs->set_flags(Gtk::CAN_FOCUS);
|
|
|
|
m_connect_inputs->set_relief(Gtk::RELIEF_NORMAL);
|
|
|
|
m_connect_inputs->set_mode(true);
|
2006-08-10 10:41:53 -04:00
|
|
|
m_connect_inputs->set_active(true);
|
2006-05-14 04:53:28 -04:00
|
|
|
m_connect_inputs->set_border_width(0);
|
2006-08-10 10:41:53 -04:00
|
|
|
|
2006-05-12 08:41:43 -04:00
|
|
|
m_limit_input_ports->set_flags(Gtk::CAN_FOCUS);
|
|
|
|
m_limit_input_ports->set_relief(Gtk::RELIEF_NORMAL);
|
|
|
|
m_limit_input_ports->set_mode(true);
|
2006-08-10 10:41:53 -04:00
|
|
|
m_limit_input_ports->set_sensitive(true);
|
2006-05-14 04:53:28 -04:00
|
|
|
m_limit_input_ports->set_border_width(0);
|
2006-05-12 08:41:43 -04:00
|
|
|
m_input_limit_count->set_flags(Gtk::CAN_FOCUS);
|
|
|
|
m_input_limit_count->set_update_policy(Gtk::UPDATE_ALWAYS);
|
|
|
|
m_input_limit_count->set_numeric(true);
|
|
|
|
m_input_limit_count->set_digits(0);
|
|
|
|
m_input_limit_count->set_wrap(false);
|
2006-05-14 04:53:28 -04:00
|
|
|
m_input_limit_count->set_sensitive(false);
|
2006-08-10 10:41:53 -04:00
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
bus_hbox = new Gtk::HBox (false, 0);
|
2006-10-05 10:43:25 -04:00
|
|
|
bus_hbox->pack_start (*bus_table, Gtk::PACK_SHRINK, 18);
|
|
|
|
|
|
|
|
bus_label->set_alignment(0, 0.5);
|
|
|
|
bus_label->set_padding(0,0);
|
|
|
|
bus_label->set_line_wrap(false);
|
|
|
|
bus_label->set_selectable(false);
|
|
|
|
bus_label->set_use_markup(true);
|
|
|
|
bus_frame->set_shadow_type(Gtk::SHADOW_NONE);
|
|
|
|
bus_frame->set_label_align(0,0.5);
|
|
|
|
bus_frame->add(*bus_hbox);
|
|
|
|
bus_frame->set_label_widget(*bus_label);
|
|
|
|
|
|
|
|
bus_table->set_row_spacings (0);
|
|
|
|
bus_table->set_col_spacings (0);
|
|
|
|
bus_table->attach (*m_create_master_bus, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
|
|
|
|
bus_table->attach (*m_master_bus_channel_count, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
|
|
|
|
bus_table->attach (*chan_count_label_1, 2, 3, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 6, 0);
|
|
|
|
bus_table->attach (*m_create_control_bus, 0, 1, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
|
|
|
|
bus_table->attach (*m_control_bus_channel_count, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
|
|
|
|
bus_table->attach (*chan_count_label_2, 2, 3, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 6, 0);
|
|
|
|
|
2006-05-14 04:53:28 -04:00
|
|
|
input_port_limit_hbox->pack_start(*m_limit_input_ports, Gtk::PACK_SHRINK, 6);
|
2006-10-05 10:43:25 -04:00
|
|
|
input_port_limit_hbox->pack_start(*m_input_limit_count, Gtk::PACK_SHRINK, 0);
|
|
|
|
input_port_limit_hbox->pack_start(*chan_count_label_3, Gtk::PACK_SHRINK, 6);
|
2006-05-14 04:53:28 -04:00
|
|
|
input_port_vbox->pack_start(*m_connect_inputs, Gtk::PACK_SHRINK, 0);
|
|
|
|
input_port_vbox->pack_start(*input_port_limit_hbox, Gtk::PACK_EXPAND_PADDING, 0);
|
2006-05-12 08:41:43 -04:00
|
|
|
input_table->set_row_spacings(0);
|
|
|
|
input_table->set_col_spacings(0);
|
2006-05-14 04:53:28 -04:00
|
|
|
input_table->attach(*input_port_vbox, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 6, 6);
|
2006-08-30 16:48:16 -04:00
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
input_hbox = new Gtk::HBox (false, 0);
|
2006-10-05 10:43:25 -04:00
|
|
|
input_hbox->pack_start (*input_table, Gtk::PACK_SHRINK, 18);
|
|
|
|
|
2006-05-12 15:51:40 -04:00
|
|
|
input_label->set_alignment(0, 0.5);
|
2006-05-12 08:41:43 -04:00
|
|
|
input_label->set_padding(0,0);
|
|
|
|
input_label->set_line_wrap(false);
|
|
|
|
input_label->set_selectable(false);
|
2006-05-14 04:53:28 -04:00
|
|
|
input_label->set_use_markup(true);
|
2006-05-12 08:41:43 -04:00
|
|
|
input_frame->set_shadow_type(Gtk::SHADOW_NONE);
|
|
|
|
input_frame->set_label_align(0,0.5);
|
2006-10-05 10:43:25 -04:00
|
|
|
input_frame->add(*input_hbox);
|
2006-05-12 08:41:43 -04:00
|
|
|
input_frame->set_label_widget(*input_label);
|
2006-10-05 10:43:25 -04:00
|
|
|
|
2006-05-12 08:41:43 -04:00
|
|
|
m_connect_outputs->set_flags(Gtk::CAN_FOCUS);
|
|
|
|
m_connect_outputs->set_relief(Gtk::RELIEF_NORMAL);
|
|
|
|
m_connect_outputs->set_mode(true);
|
2006-08-10 10:41:53 -04:00
|
|
|
m_connect_outputs->set_active(true);
|
2006-05-14 04:53:28 -04:00
|
|
|
m_connect_outputs->set_border_width(0);
|
2006-05-12 08:41:43 -04:00
|
|
|
m_limit_output_ports->set_flags(Gtk::CAN_FOCUS);
|
|
|
|
m_limit_output_ports->set_relief(Gtk::RELIEF_NORMAL);
|
|
|
|
m_limit_output_ports->set_mode(true);
|
2006-08-10 10:41:53 -04:00
|
|
|
m_limit_output_ports->set_sensitive(true);
|
2006-05-14 04:53:28 -04:00
|
|
|
m_limit_output_ports->set_border_width(0);
|
2006-05-12 08:41:43 -04:00
|
|
|
m_output_limit_count->set_flags(Gtk::CAN_FOCUS);
|
|
|
|
m_output_limit_count->set_update_policy(Gtk::UPDATE_ALWAYS);
|
|
|
|
m_output_limit_count->set_numeric(false);
|
|
|
|
m_output_limit_count->set_digits(0);
|
|
|
|
m_output_limit_count->set_wrap(false);
|
2006-05-14 04:53:28 -04:00
|
|
|
m_output_limit_count->set_sensitive(false);
|
|
|
|
output_port_limit_hbox->pack_start(*m_limit_output_ports, Gtk::PACK_SHRINK, 6);
|
2006-10-05 10:43:25 -04:00
|
|
|
output_port_limit_hbox->pack_start(*m_output_limit_count, Gtk::PACK_SHRINK, 0);
|
|
|
|
output_port_limit_hbox->pack_start(*chan_count_label_4, Gtk::PACK_SHRINK, 6);
|
2006-05-12 08:41:43 -04:00
|
|
|
m_connect_outputs_to_master->set_flags(Gtk::CAN_FOCUS);
|
|
|
|
m_connect_outputs_to_master->set_relief(Gtk::RELIEF_NORMAL);
|
|
|
|
m_connect_outputs_to_master->set_mode(true);
|
|
|
|
m_connect_outputs_to_master->set_active(false);
|
2006-05-14 04:53:28 -04:00
|
|
|
m_connect_outputs_to_master->set_border_width(0);
|
2006-05-12 08:41:43 -04:00
|
|
|
m_connect_outputs_to_physical->set_flags(Gtk::CAN_FOCUS);
|
|
|
|
m_connect_outputs_to_physical->set_relief(Gtk::RELIEF_NORMAL);
|
|
|
|
m_connect_outputs_to_physical->set_mode(true);
|
|
|
|
m_connect_outputs_to_physical->set_active(false);
|
2006-05-14 04:53:28 -04:00
|
|
|
m_connect_outputs_to_physical->set_border_width(0);
|
2006-10-05 10:43:25 -04:00
|
|
|
output_conn_vbox->pack_start(*m_connect_outputs, Gtk::PACK_SHRINK, 0);
|
2006-05-12 08:41:43 -04:00
|
|
|
output_conn_vbox->pack_start(*m_connect_outputs_to_master, Gtk::PACK_SHRINK, 0);
|
|
|
|
output_conn_vbox->pack_start(*m_connect_outputs_to_physical, Gtk::PACK_SHRINK, 0);
|
2006-05-14 04:53:28 -04:00
|
|
|
output_vbox->set_border_width(6);
|
2006-10-05 10:43:25 -04:00
|
|
|
|
|
|
|
output_port_vbox->pack_start(*output_port_limit_hbox, Gtk::PACK_SHRINK, 0);
|
|
|
|
|
2006-05-12 08:41:43 -04:00
|
|
|
output_vbox->pack_start(*output_conn_vbox);
|
2006-10-05 10:43:25 -04:00
|
|
|
output_vbox->pack_start(*output_port_vbox);
|
2006-08-30 16:48:16 -04:00
|
|
|
|
2006-05-12 15:51:40 -04:00
|
|
|
output_label->set_alignment(0, 0.5);
|
2006-05-12 08:41:43 -04:00
|
|
|
output_label->set_padding(0,0);
|
|
|
|
output_label->set_line_wrap(false);
|
|
|
|
output_label->set_selectable(false);
|
2006-05-14 04:53:28 -04:00
|
|
|
output_label->set_use_markup(true);
|
2006-05-12 08:41:43 -04:00
|
|
|
output_frame->set_shadow_type(Gtk::SHADOW_NONE);
|
|
|
|
output_frame->set_label_align(0,0.5);
|
2006-10-05 10:43:25 -04:00
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
output_hbox = new Gtk::HBox (false, 0);
|
2006-10-05 10:43:25 -04:00
|
|
|
output_hbox->pack_start (*output_vbox, Gtk::PACK_SHRINK, 18);
|
|
|
|
|
|
|
|
output_frame->add(*output_hbox);
|
2006-05-12 08:41:43 -04:00
|
|
|
output_frame->set_label_widget(*output_label);
|
2006-10-05 10:43:25 -04:00
|
|
|
|
2006-05-12 08:41:43 -04:00
|
|
|
advanced_vbox->pack_start(*advanced_table, Gtk::PACK_SHRINK, 0);
|
2006-10-05 10:43:25 -04:00
|
|
|
advanced_vbox->pack_start(*bus_frame, Gtk::PACK_SHRINK, 6);
|
|
|
|
advanced_vbox->pack_start(*input_frame, Gtk::PACK_SHRINK, 6);
|
2006-05-14 04:53:28 -04:00
|
|
|
advanced_vbox->pack_start(*output_frame, Gtk::PACK_SHRINK, 0);
|
2006-05-12 08:41:43 -04:00
|
|
|
advanced_label->set_padding(0,0);
|
|
|
|
advanced_label->set_line_wrap(false);
|
|
|
|
advanced_label->set_selectable(false);
|
2006-05-14 04:53:28 -04:00
|
|
|
advanced_label->set_alignment(0, 0.5);
|
2006-05-12 08:41:43 -04:00
|
|
|
advanced_expander->set_flags(Gtk::CAN_FOCUS);
|
2006-05-14 04:53:28 -04:00
|
|
|
advanced_expander->set_border_width(0);
|
2006-05-12 15:51:40 -04:00
|
|
|
advanced_expander->set_expanded(false);
|
2006-05-12 08:41:43 -04:00
|
|
|
advanced_expander->set_spacing(0);
|
|
|
|
advanced_expander->add(*advanced_vbox);
|
|
|
|
advanced_expander->set_label_widget(*advanced_label);
|
2006-05-14 04:53:28 -04:00
|
|
|
new_session_table->set_border_width(12);
|
2006-10-05 10:43:25 -04:00
|
|
|
new_session_table->set_row_spacings(6);
|
2006-05-12 15:51:40 -04:00
|
|
|
new_session_table->set_col_spacings(0);
|
2006-05-14 04:53:28 -04:00
|
|
|
new_session_table->attach(*session_name_label, 0, 1, 0, 1, Gtk::FILL, Gtk::FILL, 0, 0);
|
2006-05-12 15:51:40 -04:00
|
|
|
new_session_table->attach(*m_name, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::FILL, 0, 0);
|
2006-05-14 04:53:28 -04:00
|
|
|
new_session_table->attach(*session_location_label, 0, 1, 1, 2, Gtk::FILL, Gtk::FILL, 0, 0);
|
2006-05-12 15:51:40 -04:00
|
|
|
new_session_table->attach(*m_folder, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::FILL, 0, 0);
|
2006-05-14 04:53:28 -04:00
|
|
|
new_session_table->attach(*session_template_label, 0, 1, 2, 3, Gtk::FILL, Gtk::FILL, 0, 0);
|
2006-05-12 15:51:40 -04:00
|
|
|
new_session_table->attach(*m_template, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::FILL, 0, 0);
|
2006-10-05 10:43:25 -04:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
if (!ARDOUR::Profile->get_sae()) {
|
|
|
|
new_session_table->attach(*advanced_expander, 0, 2, 3, 4, Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 6);
|
|
|
|
}
|
|
|
|
|
2006-10-05 10:43:25 -04:00
|
|
|
open_session_hbox->pack_start(*open_session_file_label, false, false, 12);
|
2006-05-12 15:51:40 -04:00
|
|
|
open_session_hbox->pack_start(*m_open_filechooser, true, true, 12);
|
2006-05-12 08:41:43 -04:00
|
|
|
m_treeview->set_flags(Gtk::CAN_FOCUS);
|
|
|
|
m_treeview->set_headers_visible(true);
|
|
|
|
m_treeview->set_rules_hint(false);
|
|
|
|
m_treeview->set_reorderable(false);
|
|
|
|
m_treeview->set_enable_search(true);
|
|
|
|
m_treeview->set_fixed_height_mode(false);
|
|
|
|
m_treeview->set_hover_selection(false);
|
2006-05-12 15:51:40 -04:00
|
|
|
m_treeview->set_size_request(-1, 150);
|
2006-05-12 08:41:43 -04:00
|
|
|
recent_scrolledwindow->set_flags(Gtk::CAN_FOCUS);
|
2006-05-14 04:53:28 -04:00
|
|
|
recent_scrolledwindow->set_border_width(6);
|
2006-05-12 08:41:43 -04:00
|
|
|
recent_scrolledwindow->set_shadow_type(Gtk::SHADOW_IN);
|
|
|
|
recent_scrolledwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
|
|
|
|
recent_scrolledwindow->property_window_placement().set_value(Gtk::CORNER_TOP_LEFT);
|
|
|
|
recent_scrolledwindow->add(*m_treeview);
|
2006-08-30 16:48:16 -04:00
|
|
|
|
2006-05-12 08:41:43 -04:00
|
|
|
recent_sesion_label->set_padding(0,0);
|
|
|
|
recent_sesion_label->set_line_wrap(false);
|
|
|
|
recent_sesion_label->set_selectable(false);
|
2006-05-14 04:53:28 -04:00
|
|
|
recent_frame->set_border_width(12);
|
2006-10-05 10:43:25 -04:00
|
|
|
recent_frame->set_shadow_type(Gtk::SHADOW_NONE);
|
2006-08-30 16:48:16 -04:00
|
|
|
recent_frame->add(*recent_scrolledwindow);
|
2006-05-12 08:41:43 -04:00
|
|
|
recent_frame->set_label_widget(*recent_sesion_label);
|
2006-05-12 15:51:40 -04:00
|
|
|
open_session_vbox->pack_start(*recent_frame, Gtk::PACK_EXPAND_WIDGET, 0);
|
2006-10-05 10:43:25 -04:00
|
|
|
open_session_vbox->pack_start(*open_session_hbox, Gtk::PACK_SHRINK, 12);
|
2006-05-12 08:41:43 -04:00
|
|
|
m_notebook->set_flags(Gtk::CAN_FOCUS);
|
2006-05-12 15:51:40 -04:00
|
|
|
m_notebook->set_scrollable(true);
|
2006-05-12 08:41:43 -04:00
|
|
|
get_vbox()->set_homogeneous(false);
|
|
|
|
get_vbox()->set_spacing(0);
|
|
|
|
get_vbox()->pack_start(*m_notebook, Gtk::PACK_SHRINK, 0);
|
2007-04-11 09:07:51 -04:00
|
|
|
|
2008-01-10 17:22:29 -05:00
|
|
|
/*
|
|
|
|
icon setting is done again in the editor (for the whole app),
|
|
|
|
but its all chickens and eggs at this point.
|
|
|
|
*/
|
|
|
|
|
|
|
|
list<Glib::RefPtr<Gdk::Pixbuf> > window_icons;
|
|
|
|
Glib::RefPtr<Gdk::Pixbuf> icon;
|
|
|
|
|
|
|
|
if ((icon = ::get_icon ("ardour_icon_16px")) != 0) {
|
|
|
|
window_icons.push_back (icon);
|
|
|
|
}
|
|
|
|
if ((icon = ::get_icon ("ardour_icon_22px")) != 0) {
|
|
|
|
window_icons.push_back (icon);
|
|
|
|
}
|
|
|
|
if ((icon = ::get_icon ("ardour_icon_32px")) != 0) {
|
|
|
|
window_icons.push_back (icon);
|
|
|
|
}
|
|
|
|
if ((icon = ::get_icon ("ardour_icon_48px")) != 0) {
|
|
|
|
window_icons.push_back (icon);
|
|
|
|
}
|
|
|
|
if (!window_icons.empty()) {
|
|
|
|
set_icon_list (window_icons);
|
|
|
|
}
|
|
|
|
|
2007-04-11 09:07:51 -04:00
|
|
|
WindowTitle title(Glib::get_application_name());
|
|
|
|
title += _("Session Control");
|
|
|
|
set_title(title.get_string());
|
|
|
|
|
2008-01-18 22:49:52 -05:00
|
|
|
set_position (Gtk::WIN_POS_MOUSE);
|
2006-05-12 08:41:43 -04:00
|
|
|
set_resizable(false);
|
2006-05-12 15:51:40 -04:00
|
|
|
set_has_separator(false);
|
2009-01-02 22:34:41 -05:00
|
|
|
quit_or_cancel_button = add_button(Gtk::Stock::QUIT, Gtk::RESPONSE_CANCEL);
|
2006-05-12 08:41:43 -04:00
|
|
|
add_button(Gtk::Stock::CLEAR, Gtk::RESPONSE_NONE);
|
2008-01-10 17:22:29 -05:00
|
|
|
m_okbutton = add_button(Gtk::Stock::NEW, Gtk::RESPONSE_OK);
|
2006-05-10 06:22:38 -04:00
|
|
|
|
2006-05-12 15:51:40 -04:00
|
|
|
recent_model = Gtk::TreeStore::create (recent_columns);
|
|
|
|
m_treeview->set_model (recent_model);
|
2009-01-02 22:34:41 -05:00
|
|
|
m_treeview->append_column (_("Recent sessions"), recent_columns.visible_name);
|
2006-05-12 15:51:40 -04:00
|
|
|
m_treeview->set_headers_visible (false);
|
|
|
|
m_treeview->get_selection()->set_mode (Gtk::SELECTION_SINGLE);
|
2006-05-11 19:44:20 -04:00
|
|
|
|
2007-06-16 20:52:51 -04:00
|
|
|
if (is_directory (user_template_directory ()))
|
|
|
|
{
|
|
|
|
m_template->set_current_folder (user_template_directory().to_string());
|
2006-05-11 14:37:40 -04:00
|
|
|
}
|
2007-06-16 20:52:51 -04:00
|
|
|
else if (is_directory (system_template_directory ()))
|
|
|
|
{
|
|
|
|
m_template->set_current_folder (system_template_directory().to_string());
|
2006-05-11 05:25:51 -04:00
|
|
|
}
|
2006-06-15 02:37:32 -04:00
|
|
|
|
2007-06-16 20:52:51 -04:00
|
|
|
if (is_directory (system_template_directory ()))
|
2006-12-20 16:54:39 -05:00
|
|
|
{
|
2007-06-16 20:52:51 -04:00
|
|
|
m_template->add_shortcut_folder (system_template_directory().to_string());
|
2006-12-20 16:54:39 -05:00
|
|
|
}
|
|
|
|
|
2006-05-14 04:53:28 -04:00
|
|
|
m_template->set_title(_("select template"));
|
2006-05-12 15:51:40 -04:00
|
|
|
Gtk::FileFilter* session_filter = manage (new (Gtk::FileFilter));
|
|
|
|
session_filter->add_pattern(X_("*.ardour"));
|
|
|
|
session_filter->add_pattern(X_("*.ardour.bak"));
|
|
|
|
m_open_filechooser->set_filter (*session_filter);
|
|
|
|
m_open_filechooser->set_current_folder(getenv ("HOME"));
|
2006-05-14 04:53:28 -04:00
|
|
|
m_open_filechooser->set_title(_("select session file"));
|
2006-05-12 15:51:40 -04:00
|
|
|
|
|
|
|
Gtk::FileFilter* template_filter = manage (new (Gtk::FileFilter));
|
|
|
|
template_filter->add_pattern(X_("*.template"));
|
|
|
|
m_template->set_filter (*template_filter);
|
|
|
|
|
|
|
|
m_folder->set_current_folder(getenv ("HOME"));
|
2006-05-14 04:53:28 -04:00
|
|
|
m_folder->set_title(_("select directory"));
|
2006-05-12 15:51:40 -04:00
|
|
|
|
2006-04-24 17:34:23 -04:00
|
|
|
m_notebook->set_current_page(0);
|
2006-05-12 15:51:40 -04:00
|
|
|
m_notebook->show();
|
|
|
|
m_notebook->show_all_children();
|
2006-04-24 17:34:23 -04:00
|
|
|
|
2008-12-12 09:43:24 -05:00
|
|
|
engine_page_session_folder = X_("");
|
|
|
|
engine_page_session_name = X_("");
|
2006-08-08 17:27:41 -04:00
|
|
|
|
|
|
|
set_default_response (Gtk::RESPONSE_OK);
|
2007-10-11 18:07:47 -04:00
|
|
|
if (!ARDOUR_COMMAND_LINE::session_name.length()) {
|
2006-08-08 17:27:41 -04:00
|
|
|
set_response_sensitive (Gtk::RESPONSE_OK, false);
|
|
|
|
set_response_sensitive (Gtk::RESPONSE_NONE, false);
|
|
|
|
} else {
|
|
|
|
set_response_sensitive (Gtk::RESPONSE_OK, true);
|
|
|
|
set_response_sensitive (Gtk::RESPONSE_NONE, true);
|
|
|
|
}
|
|
|
|
|
2006-05-12 15:51:40 -04:00
|
|
|
///@ connect some signals
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-05-14 04:53:28 -04:00
|
|
|
m_connect_inputs->signal_clicked().connect (mem_fun (*this, &NewSessionDialog::connect_inputs_clicked));
|
|
|
|
m_connect_outputs->signal_clicked().connect (mem_fun (*this, &NewSessionDialog::connect_outputs_clicked));
|
|
|
|
m_limit_input_ports->signal_clicked().connect (mem_fun (*this, &NewSessionDialog::limit_inputs_clicked));
|
|
|
|
m_limit_output_ports->signal_clicked().connect (mem_fun (*this, &NewSessionDialog::limit_outputs_clicked));
|
|
|
|
m_create_master_bus->signal_clicked().connect (mem_fun (*this, &NewSessionDialog::master_bus_button_clicked));
|
|
|
|
m_create_control_bus->signal_clicked().connect (mem_fun (*this, &NewSessionDialog::monitor_bus_button_clicked));
|
2007-05-15 22:40:55 -04:00
|
|
|
m_name->signal_changed().connect(mem_fun (*this, &NewSessionDialog::on_new_session_name_entry_changed));
|
2006-04-24 17:34:23 -04:00
|
|
|
m_notebook->signal_switch_page().connect (mem_fun (*this, &NewSessionDialog::notebook_page_changed));
|
|
|
|
m_treeview->get_selection()->signal_changed().connect (mem_fun (*this, &NewSessionDialog::treeview_selection_changed));
|
|
|
|
m_treeview->signal_row_activated().connect (mem_fun (*this, &NewSessionDialog::recent_row_activated));
|
|
|
|
m_open_filechooser->signal_selection_changed ().connect (mem_fun (*this, &NewSessionDialog::file_chosen));
|
2006-05-11 05:25:51 -04:00
|
|
|
m_template->signal_selection_changed ().connect (mem_fun (*this, &NewSessionDialog::template_chosen));
|
2008-01-10 16:20:59 -05:00
|
|
|
|
|
|
|
page_set = Pages (0);
|
2005-11-14 03:38:16 -05:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
NewSessionDialog::~NewSessionDialog()
|
|
|
|
{
|
|
|
|
in_destructor = true;
|
|
|
|
}
|
|
|
|
|
2008-01-10 16:20:59 -05:00
|
|
|
int
|
|
|
|
NewSessionDialog::run ()
|
|
|
|
{
|
|
|
|
if (!page_set) {
|
|
|
|
/* nothing to display */
|
|
|
|
return Gtk::RESPONSE_OK;
|
|
|
|
}
|
2008-12-12 09:43:24 -05:00
|
|
|
if (!(page_set & NewPage) && !(page_set & OpenPage)) {
|
|
|
|
set_response_sensitive (Gtk::RESPONSE_OK, true);
|
|
|
|
}
|
2008-01-10 16:20:59 -05:00
|
|
|
return ArdourDialog::run ();
|
|
|
|
}
|
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
void
|
|
|
|
NewSessionDialog::set_have_engine (bool yn)
|
|
|
|
{
|
2008-01-10 16:20:59 -05:00
|
|
|
if (yn) {
|
|
|
|
m_notebook->remove_page (engine_control);
|
|
|
|
page_set = Pages (page_set & ~EnginePage);
|
|
|
|
} else {
|
|
|
|
if (!(page_set & EnginePage)) {
|
|
|
|
m_notebook->append_page (engine_control, _("Audio Setup"));
|
|
|
|
m_notebook->show_all_children();
|
|
|
|
page_set = Pages (page_set | EnginePage);
|
|
|
|
}
|
|
|
|
}
|
2007-10-11 18:07:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-14 03:38:16 -05:00
|
|
|
void
|
2008-01-10 16:20:59 -05:00
|
|
|
NewSessionDialog::set_existing_session (bool yn)
|
|
|
|
{
|
|
|
|
if (yn) {
|
|
|
|
|
|
|
|
if (page_set & NewPage) {
|
|
|
|
m_notebook->remove_page (*new_session_table);
|
|
|
|
page_set = Pages (page_set & ~NewPage);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (page_set & OpenPage) {
|
|
|
|
m_notebook->remove_page (*open_session_vbox);
|
|
|
|
page_set = Pages (page_set & ~OpenPage);
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
if (!(page_set & NewPage)) {
|
|
|
|
m_notebook->append_page(*new_session_table, _("New Session"));
|
|
|
|
m_notebook->pages().back().set_tab_label_packing(false, true, Gtk::PACK_START);
|
|
|
|
page_set = Pages (page_set | NewPage);
|
|
|
|
}
|
|
|
|
if (!(page_set & OpenPage)) {
|
|
|
|
m_notebook->append_page(*open_session_vbox, _("Open Session"));
|
|
|
|
m_notebook->pages().back().set_tab_label_packing(false, true, Gtk::PACK_START);
|
|
|
|
page_set = Pages (page_set | OpenPage);
|
|
|
|
}
|
|
|
|
|
|
|
|
m_notebook->show_all_children();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
NewSessionDialog::set_session_name (const Glib::ustring& name)
|
2005-11-14 03:38:16 -05:00
|
|
|
{
|
2008-01-10 16:20:59 -05:00
|
|
|
m_name->set_text (name);
|
2008-12-12 09:43:24 -05:00
|
|
|
engine_page_session_name = name;
|
2005-11-14 03:38:16 -05:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
void
|
|
|
|
NewSessionDialog::set_session_folder(const Glib::ustring& dir)
|
|
|
|
{
|
2008-01-12 18:45:50 -05:00
|
|
|
Glib::ustring realdir = dir;
|
|
|
|
|
|
|
|
/* this little tangled mess is a result of 4 things:
|
|
|
|
|
|
|
|
1) GtkFileChooser vomits when given a non-absolute directory
|
|
|
|
argument to set_current_folder()
|
|
|
|
2) canonicalize_file_name() doesn't exist on OS X
|
|
|
|
3) linux man page for realpath() says "do not use this function"
|
|
|
|
4) canonicalize_file_name() & realpath() have entirely
|
|
|
|
different semantics on OS X and Linux when given
|
|
|
|
a non-existent path.
|
|
|
|
|
|
|
|
as result of all this, we take two distinct pathways through the code.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __APPLE__
|
|
|
|
|
|
|
|
char buf[PATH_MAX];
|
|
|
|
|
2008-12-12 09:43:24 -05:00
|
|
|
if(realpath (dir.c_str(), buf) != 0) {
|
2008-01-12 18:45:50 -05:00
|
|
|
if (!Glib::file_test (dir, Glib::FILE_TEST_IS_DIR)) {
|
|
|
|
realdir = Glib::path_get_dirname (realdir);
|
|
|
|
}
|
|
|
|
m_folder->set_current_folder (realdir);
|
2008-12-12 09:43:24 -05:00
|
|
|
engine_page_session_folder = realdir;
|
2008-01-12 18:45:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#else
|
2008-12-12 09:43:24 -05:00
|
|
|
char* res;
|
2008-01-12 18:45:50 -05:00
|
|
|
if (!Glib::file_test (dir, Glib::FILE_TEST_IS_DIR)) {
|
|
|
|
realdir = Glib::path_get_dirname (realdir);
|
|
|
|
cerr << "didn't exist, use " << realdir << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((res = canonicalize_file_name (realdir.c_str())) != 0) {
|
|
|
|
cerr << "canonical, use " << res << endl;
|
|
|
|
m_folder->set_current_folder (res);
|
2009-01-06 20:38:33 -05:00
|
|
|
engine_page_session_folder = res;
|
2008-01-12 18:45:50 -05:00
|
|
|
free (res);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
}
|
|
|
|
|
2005-11-14 03:38:16 -05:00
|
|
|
std::string
|
|
|
|
NewSessionDialog::session_name() const
|
|
|
|
{
|
2007-05-17 22:40:57 -04:00
|
|
|
std::string str = Glib::filename_from_utf8(m_open_filechooser->get_filename());
|
2006-04-24 17:34:23 -04:00
|
|
|
std::string::size_type position = str.find_last_of ('/');
|
|
|
|
str = str.substr (position+1);
|
|
|
|
position = str.find_last_of ('.');
|
|
|
|
str = str.substr (0, position);
|
|
|
|
|
|
|
|
/*
|
|
|
|
XXX what to do if it's a .bak file?
|
|
|
|
load_session doesn't allow it!
|
|
|
|
|
|
|
|
if ((position = str.rfind(".bak")) != string::npos) {
|
|
|
|
str = str.substr (0, position);
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2008-01-12 18:45:50 -05:00
|
|
|
switch (which_page()) {
|
|
|
|
case NewPage:
|
|
|
|
case EnginePage:
|
2008-01-10 17:22:29 -05:00
|
|
|
/* new or audio setup pages */
|
2008-12-12 09:43:24 -05:00
|
|
|
if (!(page_set & OpenPage) && !(page_set & NewPage)) {
|
|
|
|
return Glib::filename_from_utf8(engine_page_session_name);
|
|
|
|
}
|
2006-04-24 17:34:23 -04:00
|
|
|
return Glib::filename_from_utf8(m_name->get_text());
|
2008-01-12 18:45:50 -05:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_treeview->get_selection()->count_selected_rows() == 0) {
|
|
|
|
return Glib::filename_from_utf8(str);
|
2006-04-24 17:34:23 -04:00
|
|
|
}
|
2008-01-12 18:45:50 -05:00
|
|
|
Gtk::TreeModel::iterator i = m_treeview->get_selection()->get_selected();
|
|
|
|
return (*i)[recent_columns.visible_name];
|
2005-11-14 03:38:16 -05:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-11-14 03:38:16 -05:00
|
|
|
std::string
|
|
|
|
NewSessionDialog::session_folder() const
|
|
|
|
{
|
2008-01-12 18:45:50 -05:00
|
|
|
switch (which_page()) {
|
|
|
|
case NewPage:
|
2008-01-10 17:22:29 -05:00
|
|
|
return Glib::filename_from_utf8(m_folder->get_filename());
|
2008-01-12 18:45:50 -05:00
|
|
|
|
|
|
|
case EnginePage:
|
2008-12-12 09:43:24 -05:00
|
|
|
if (!(page_set & OpenPage) && !(page_set & NewPage)) {
|
|
|
|
/* just engine page, nothing else */
|
|
|
|
return Glib::filename_from_utf8(engine_page_session_folder);
|
|
|
|
}
|
2008-01-12 18:45:50 -05:00
|
|
|
if (page_set == EnginePage) {
|
2008-12-12 09:43:24 -05:00
|
|
|
/* use m_folder since it should be set */
|
2008-01-12 18:45:50 -05:00
|
|
|
return Glib::filename_from_utf8(m_folder->get_filename());
|
2006-04-24 17:34:23 -04:00
|
|
|
}
|
2008-01-12 18:45:50 -05:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2006-04-24 17:34:23 -04:00
|
|
|
}
|
2008-01-12 18:45:50 -05:00
|
|
|
|
|
|
|
if (m_treeview->get_selection()->count_selected_rows() == 0) {
|
|
|
|
const string filename(Glib::filename_from_utf8(m_open_filechooser->get_filename()));
|
|
|
|
return Glib::path_get_dirname(filename);
|
|
|
|
}
|
|
|
|
|
|
|
|
Gtk::TreeModel::iterator i = m_treeview->get_selection()->get_selected();
|
|
|
|
return (*i)[recent_columns.fullpath];
|
2005-11-14 03:38:16 -05:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-11-14 03:38:16 -05:00
|
|
|
bool
|
|
|
|
NewSessionDialog::use_session_template() const
|
|
|
|
{
|
2008-01-12 18:45:50 -05:00
|
|
|
if (m_template->get_filename().empty() && (which_page() == NewPage))
|
|
|
|
return false;
|
2005-11-14 03:38:16 -05:00
|
|
|
return true;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-11-14 03:38:16 -05:00
|
|
|
std::string
|
|
|
|
NewSessionDialog::session_template_name() const
|
|
|
|
{
|
|
|
|
return Glib::filename_from_utf8(m_template->get_filename());
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-11-14 03:38:16 -05:00
|
|
|
bool
|
2005-11-28 00:04:14 -05:00
|
|
|
NewSessionDialog::create_master_bus() const
|
2005-11-14 03:38:16 -05:00
|
|
|
{
|
2005-11-28 00:04:14 -05:00
|
|
|
return m_create_master_bus->get_active();
|
2005-11-14 03:38:16 -05:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-11-14 03:38:16 -05:00
|
|
|
int
|
|
|
|
NewSessionDialog::master_channel_count() const
|
|
|
|
{
|
2005-11-28 00:04:14 -05:00
|
|
|
return m_master_bus_channel_count->get_value_as_int();
|
2005-11-14 03:38:16 -05:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-11-14 03:38:16 -05:00
|
|
|
bool
|
2005-11-28 00:04:14 -05:00
|
|
|
NewSessionDialog::create_control_bus() const
|
2005-11-14 03:38:16 -05:00
|
|
|
{
|
2005-11-28 00:04:14 -05:00
|
|
|
return m_create_control_bus->get_active();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2005-11-14 03:38:16 -05:00
|
|
|
int
|
|
|
|
NewSessionDialog::control_channel_count() const
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2005-11-28 00:04:14 -05:00
|
|
|
return m_control_bus_channel_count->get_value_as_int();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2005-11-14 03:38:16 -05:00
|
|
|
bool
|
|
|
|
NewSessionDialog::connect_inputs() const
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2005-11-14 03:38:16 -05:00
|
|
|
return m_connect_inputs->get_active();
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-11-14 03:38:16 -05:00
|
|
|
bool
|
|
|
|
NewSessionDialog::limit_inputs_used_for_connection() const
|
|
|
|
{
|
|
|
|
return m_limit_input_ports->get_active();
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-11-14 03:38:16 -05:00
|
|
|
int
|
|
|
|
NewSessionDialog::input_limit_count() const
|
|
|
|
{
|
|
|
|
return m_input_limit_count->get_value_as_int();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2005-11-14 03:38:16 -05:00
|
|
|
bool
|
|
|
|
NewSessionDialog::connect_outputs() const
|
|
|
|
{
|
|
|
|
return m_connect_outputs->get_active();
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-11-14 03:38:16 -05:00
|
|
|
bool
|
|
|
|
NewSessionDialog::limit_outputs_used_for_connection() const
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2005-11-14 03:38:16 -05:00
|
|
|
return m_limit_output_ports->get_active();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2005-11-14 03:38:16 -05:00
|
|
|
int
|
|
|
|
NewSessionDialog::output_limit_count() const
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2005-11-14 03:38:16 -05:00
|
|
|
return m_output_limit_count->get_value_as_int();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2005-11-14 03:38:16 -05:00
|
|
|
bool
|
|
|
|
NewSessionDialog::connect_outs_to_master() const
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2005-11-14 03:38:16 -05:00
|
|
|
return m_connect_outputs_to_master->get_active();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2005-11-14 03:38:16 -05:00
|
|
|
bool
|
|
|
|
NewSessionDialog::connect_outs_to_physical() const
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2005-11-14 03:38:16 -05:00
|
|
|
return m_connect_outputs_to_physical->get_active();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
int
|
2008-01-12 18:45:50 -05:00
|
|
|
NewSessionDialog::get_current_page()
|
2007-10-11 18:07:47 -04:00
|
|
|
{
|
|
|
|
return m_notebook->get_current_page();
|
2007-04-26 16:54:31 -04:00
|
|
|
}
|
|
|
|
|
2008-01-10 17:22:29 -05:00
|
|
|
NewSessionDialog::Pages
|
2008-01-12 18:45:50 -05:00
|
|
|
NewSessionDialog::which_page () const
|
2008-01-10 17:22:29 -05:00
|
|
|
{
|
|
|
|
int num = m_notebook->get_current_page();
|
|
|
|
|
|
|
|
if (page_set == NewPage) {
|
|
|
|
return NewPage;
|
|
|
|
|
|
|
|
} else if (page_set == OpenPage) {
|
|
|
|
return OpenPage;
|
|
|
|
|
|
|
|
} else if (page_set == EnginePage) {
|
|
|
|
return EnginePage;
|
|
|
|
|
2008-05-02 14:35:05 -04:00
|
|
|
} else if (page_set == (NewPage|OpenPage)) {
|
2008-01-10 17:22:29 -05:00
|
|
|
switch (num) {
|
|
|
|
case 0:
|
|
|
|
return NewPage;
|
|
|
|
default:
|
|
|
|
return OpenPage;
|
|
|
|
}
|
|
|
|
|
2008-05-02 14:35:05 -04:00
|
|
|
} else if (page_set == (NewPage|EnginePage)) {
|
2008-01-10 17:22:29 -05:00
|
|
|
switch (num) {
|
|
|
|
case 0:
|
|
|
|
return NewPage;
|
|
|
|
default:
|
|
|
|
return EnginePage;
|
|
|
|
}
|
|
|
|
|
2008-05-02 14:35:05 -04:00
|
|
|
} else if (page_set == (NewPage|EnginePage|OpenPage)) {
|
2008-01-10 17:22:29 -05:00
|
|
|
switch (num) {
|
|
|
|
case 0:
|
|
|
|
return NewPage;
|
|
|
|
case 1:
|
|
|
|
return OpenPage;
|
|
|
|
default:
|
|
|
|
return EnginePage;
|
|
|
|
}
|
|
|
|
|
2008-05-02 14:35:05 -04:00
|
|
|
} else if (page_set == (OpenPage|EnginePage)) {
|
2008-01-10 17:22:29 -05:00
|
|
|
switch (num) {
|
|
|
|
case 0:
|
|
|
|
return OpenPage;
|
|
|
|
default:
|
|
|
|
return EnginePage;
|
|
|
|
}
|
|
|
|
}
|
2008-05-02 14:35:05 -04:00
|
|
|
|
|
|
|
return NewPage; /* shouldn't get here */
|
2008-01-10 17:22:29 -05:00
|
|
|
}
|
|
|
|
|
2007-04-26 16:54:31 -04:00
|
|
|
void
|
|
|
|
NewSessionDialog::set_current_page(int page)
|
|
|
|
{
|
|
|
|
return m_notebook->set_current_page (page);
|
2006-04-24 17:34:23 -04:00
|
|
|
}
|
2005-11-14 03:38:16 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
2005-11-14 03:38:16 -05:00
|
|
|
NewSessionDialog::reset_name()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2006-05-12 08:41:43 -04:00
|
|
|
m_name->set_text("");
|
|
|
|
set_response_sensitive (Gtk::RESPONSE_OK, false);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2007-05-15 22:40:55 -04:00
|
|
|
void
|
|
|
|
NewSessionDialog::on_new_session_name_entry_changed ()
|
2006-04-24 17:34:23 -04:00
|
|
|
{
|
2006-08-08 17:27:41 -04:00
|
|
|
if (m_name->get_text() != "") {
|
|
|
|
set_response_sensitive (Gtk::RESPONSE_OK, true);
|
2006-05-12 08:41:43 -04:00
|
|
|
set_response_sensitive (Gtk::RESPONSE_NONE, true);
|
2006-04-24 17:34:23 -04:00
|
|
|
} else {
|
2006-08-08 17:27:41 -04:00
|
|
|
set_response_sensitive (Gtk::RESPONSE_OK, false);
|
2006-04-24 17:34:23 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
NewSessionDialog::notebook_page_changed (GtkNotebookPage* np, uint pagenum)
|
|
|
|
{
|
2007-10-11 18:07:47 -04:00
|
|
|
if (in_destructor) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-01-10 17:22:29 -05:00
|
|
|
switch (which_page()) {
|
|
|
|
case OpenPage:
|
|
|
|
on_new_session_page = false;
|
2006-08-08 17:27:41 -04:00
|
|
|
m_okbutton->set_label(_("Open"));
|
2008-01-10 17:22:29 -05:00
|
|
|
m_okbutton->set_image (*(manage (new Gtk::Image (Gtk::Stock::OPEN, Gtk::ICON_SIZE_BUTTON))));
|
2006-08-08 17:27:41 -04:00
|
|
|
set_response_sensitive (Gtk::RESPONSE_NONE, false);
|
|
|
|
if (m_treeview->get_selection()->count_selected_rows() == 0) {
|
|
|
|
set_response_sensitive (Gtk::RESPONSE_OK, false);
|
2006-04-24 17:34:23 -04:00
|
|
|
} else {
|
2006-08-08 17:27:41 -04:00
|
|
|
set_response_sensitive (Gtk::RESPONSE_OK, true);
|
2006-04-24 17:34:23 -04:00
|
|
|
}
|
2008-01-10 17:22:29 -05:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EnginePage:
|
|
|
|
on_new_session_page = false;
|
|
|
|
m_okbutton->set_label(_("Open"));
|
|
|
|
m_okbutton->set_image (*(manage (new Gtk::Image (Gtk::Stock::OPEN, Gtk::ICON_SIZE_BUTTON))));
|
|
|
|
set_response_sensitive (Gtk::RESPONSE_NONE, false);
|
|
|
|
set_response_sensitive (Gtk::RESPONSE_OK, true);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2008-01-12 18:45:50 -05:00
|
|
|
on_new_session_page = true;
|
2006-08-08 17:27:41 -04:00
|
|
|
m_okbutton->set_label(_("New"));
|
|
|
|
m_okbutton->set_image (*(new Gtk::Image (Gtk::Stock::NEW, Gtk::ICON_SIZE_BUTTON)));
|
2006-04-24 17:34:23 -04:00
|
|
|
if (m_name->get_text() == "") {
|
2006-08-08 17:27:41 -04:00
|
|
|
set_response_sensitive (Gtk::RESPONSE_OK, false);
|
2008-01-10 17:22:29 -05:00
|
|
|
m_name->grab_focus();
|
2006-04-24 17:34:23 -04:00
|
|
|
} else {
|
2006-08-08 17:27:41 -04:00
|
|
|
set_response_sensitive (Gtk::RESPONSE_OK, true);
|
2006-04-24 17:34:23 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
NewSessionDialog::treeview_selection_changed ()
|
|
|
|
{
|
2006-05-12 15:51:40 -04:00
|
|
|
if (m_treeview->get_selection()->count_selected_rows() == 0) {
|
2006-08-08 17:27:41 -04:00
|
|
|
if (!m_open_filechooser->get_filename().empty()) {
|
|
|
|
set_response_sensitive (Gtk::RESPONSE_OK, true);
|
2006-05-12 15:51:40 -04:00
|
|
|
} else {
|
2006-08-08 17:27:41 -04:00
|
|
|
set_response_sensitive (Gtk::RESPONSE_OK, false);
|
2006-05-12 15:51:40 -04:00
|
|
|
}
|
|
|
|
} else {
|
2006-08-08 17:27:41 -04:00
|
|
|
set_response_sensitive (Gtk::RESPONSE_OK, true);
|
2006-05-12 15:51:40 -04:00
|
|
|
}
|
2006-04-24 17:34:23 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
NewSessionDialog::file_chosen ()
|
|
|
|
{
|
2008-01-10 17:22:29 -05:00
|
|
|
switch (which_page()) {
|
|
|
|
case OpenPage:
|
|
|
|
break;
|
|
|
|
case NewPage:
|
|
|
|
case EnginePage:
|
|
|
|
return;
|
|
|
|
}
|
2006-08-08 17:27:41 -04:00
|
|
|
|
|
|
|
m_treeview->get_selection()->unselect_all();
|
2006-05-12 15:51:40 -04:00
|
|
|
|
2008-01-10 17:22:29 -05:00
|
|
|
Glib::RefPtr<Gdk::Window> win (get_window());
|
|
|
|
|
|
|
|
if (win) {
|
|
|
|
win->set_cursor(Gdk::Cursor(Gdk::WATCH));
|
|
|
|
}
|
2006-08-30 16:48:16 -04:00
|
|
|
|
2006-05-12 15:51:40 -04:00
|
|
|
if (!m_open_filechooser->get_filename().empty()) {
|
2006-08-30 16:48:16 -04:00
|
|
|
set_response_sensitive (Gtk::RESPONSE_OK, true);
|
|
|
|
response (Gtk::RESPONSE_OK);
|
2006-05-12 15:51:40 -04:00
|
|
|
} else {
|
2006-08-30 16:48:16 -04:00
|
|
|
set_response_sensitive (Gtk::RESPONSE_OK, false);
|
2006-04-24 17:34:23 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-11 05:25:51 -04:00
|
|
|
void
|
|
|
|
NewSessionDialog::template_chosen ()
|
|
|
|
{
|
2006-08-08 17:27:41 -04:00
|
|
|
if (m_template->get_filename() != "" ) {;
|
|
|
|
set_response_sensitive (Gtk::RESPONSE_NONE, true);
|
2006-05-12 15:51:40 -04:00
|
|
|
} else {
|
2006-08-08 17:27:41 -04:00
|
|
|
set_response_sensitive (Gtk::RESPONSE_NONE, false);
|
2006-05-12 15:51:40 -04:00
|
|
|
}
|
2006-05-11 05:25:51 -04:00
|
|
|
}
|
|
|
|
|
2006-04-24 17:34:23 -04:00
|
|
|
void
|
|
|
|
NewSessionDialog::recent_row_activated (const Gtk::TreePath& path, Gtk::TreeViewColumn* col)
|
|
|
|
{
|
2008-01-18 22:49:52 -05:00
|
|
|
response (Gtk::RESPONSE_OK);
|
2006-04-24 17:34:23 -04:00
|
|
|
}
|
|
|
|
|
2006-05-14 04:53:28 -04:00
|
|
|
void
|
|
|
|
NewSessionDialog::connect_inputs_clicked ()
|
|
|
|
{
|
2007-05-17 22:40:57 -04:00
|
|
|
m_limit_input_ports->set_sensitive(m_connect_inputs->get_active());
|
2006-08-10 10:41:53 -04:00
|
|
|
|
2007-05-17 22:40:57 -04:00
|
|
|
if (m_connect_inputs->get_active() && m_limit_input_ports->get_active()) {
|
|
|
|
m_input_limit_count->set_sensitive(true);
|
|
|
|
} else {
|
|
|
|
m_input_limit_count->set_sensitive(false);
|
|
|
|
}
|
2006-05-14 04:53:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
NewSessionDialog::connect_outputs_clicked ()
|
|
|
|
{
|
2007-05-17 22:40:57 -04:00
|
|
|
m_limit_output_ports->set_sensitive(m_connect_outputs->get_active());
|
2006-08-10 10:41:53 -04:00
|
|
|
|
2007-05-17 22:40:57 -04:00
|
|
|
if (m_connect_outputs->get_active() && m_limit_output_ports->get_active()) {
|
|
|
|
m_output_limit_count->set_sensitive(true);
|
|
|
|
} else {
|
|
|
|
m_output_limit_count->set_sensitive(false);
|
|
|
|
}
|
2006-05-14 04:53:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
NewSessionDialog::limit_inputs_clicked ()
|
|
|
|
{
|
2007-05-17 22:40:57 -04:00
|
|
|
m_input_limit_count->set_sensitive(m_limit_input_ports->get_active());
|
2006-05-14 04:53:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
NewSessionDialog::limit_outputs_clicked ()
|
|
|
|
{
|
2007-05-17 22:40:57 -04:00
|
|
|
m_output_limit_count->set_sensitive(m_limit_output_ports->get_active());
|
2006-05-14 04:53:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
NewSessionDialog::master_bus_button_clicked ()
|
|
|
|
{
|
2007-05-17 22:40:57 -04:00
|
|
|
m_master_bus_channel_count->set_sensitive(m_create_master_bus->get_active());
|
2006-05-14 04:53:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
NewSessionDialog::monitor_bus_button_clicked ()
|
|
|
|
{
|
2007-05-17 22:40:57 -04:00
|
|
|
m_control_bus_channel_count->set_sensitive(m_create_control_bus->get_active());
|
2006-05-14 04:53:28 -04:00
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
2005-11-14 03:38:16 -05:00
|
|
|
NewSessionDialog::reset_template()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2008-01-12 18:45:50 -05:00
|
|
|
m_template->unselect_all ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2006-05-10 06:22:38 -04:00
|
|
|
void
|
|
|
|
NewSessionDialog::reset_recent()
|
|
|
|
{
|
2008-02-16 17:43:18 -05:00
|
|
|
/* Shamelessly ripped from ardour_ui.cc */
|
|
|
|
std::vector<string *> *sessions;
|
|
|
|
std::vector<string *>::iterator i;
|
2006-05-12 08:41:43 -04:00
|
|
|
RecentSessionsSorter cmp;
|
|
|
|
|
|
|
|
recent_model->clear ();
|
2006-08-30 16:48:16 -04:00
|
|
|
|
2006-05-12 08:41:43 -04:00
|
|
|
ARDOUR::RecentSessions rs;
|
|
|
|
ARDOUR::read_recent_sessions (rs);
|
|
|
|
|
2008-02-16 17:43:18 -05:00
|
|
|
/* sort them alphabetically */
|
2006-05-12 08:41:43 -04:00
|
|
|
sort (rs.begin(), rs.end(), cmp);
|
2008-02-16 17:43:18 -05:00
|
|
|
sessions = new std::vector<std::string*>;
|
2006-05-12 08:41:43 -04:00
|
|
|
|
|
|
|
for (ARDOUR::RecentSessions::iterator i = rs.begin(); i != rs.end(); ++i) {
|
2008-02-16 17:43:18 -05:00
|
|
|
sessions->push_back (new string ((*i).second));
|
2006-05-12 08:41:43 -04:00
|
|
|
}
|
|
|
|
|
2008-02-16 17:43:18 -05:00
|
|
|
for (i = sessions->begin(); i != sessions->end(); ++i) {
|
2007-09-04 01:26:26 -04:00
|
|
|
|
2008-02-16 17:43:18 -05:00
|
|
|
std::vector<std::string*>* states;
|
|
|
|
std::vector<const gchar*> item;
|
|
|
|
std::string fullpath = *(*i);
|
|
|
|
|
|
|
|
/* remove any trailing / */
|
|
|
|
|
|
|
|
if (fullpath[fullpath.length()-1] == '/') {
|
|
|
|
fullpath = fullpath.substr (0, fullpath.length()-1);
|
2006-05-12 08:41:43 -04:00
|
|
|
}
|
2008-02-02 12:22:04 -05:00
|
|
|
|
|
|
|
/* check whether session still exists */
|
|
|
|
if (!Glib::file_test(fullpath, Glib::FILE_TEST_EXISTS)) {
|
|
|
|
/* session doesn't exist */
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* now get available states for this session */
|
|
|
|
|
|
|
|
if ((states = ARDOUR::Session::possible_states (fullpath)) == 0) {
|
2008-02-16 17:43:18 -05:00
|
|
|
/* no state file? */
|
|
|
|
continue;
|
2008-02-02 12:22:04 -05:00
|
|
|
}
|
|
|
|
|
2006-05-12 08:41:43 -04:00
|
|
|
Gtk::TreeModel::Row row = *(recent_model->append());
|
|
|
|
|
2006-06-07 10:54:12 -04:00
|
|
|
row[recent_columns.visible_name] = Glib::path_get_basename (fullpath);
|
2006-05-12 08:41:43 -04:00
|
|
|
row[recent_columns.fullpath] = fullpath;
|
|
|
|
|
2008-02-02 12:22:04 -05:00
|
|
|
if (states->size()) {
|
|
|
|
|
|
|
|
/* add the children */
|
|
|
|
|
|
|
|
for (std::vector<std::string*>::iterator i2 = states->begin(); i2 != states->end(); ++i2) {
|
|
|
|
|
|
|
|
Gtk::TreeModel::Row child_row = *(recent_model->append (row.children()));
|
|
|
|
|
|
|
|
child_row[recent_columns.visible_name] = **i2;
|
2006-05-12 08:41:43 -04:00
|
|
|
child_row[recent_columns.fullpath] = fullpath;
|
2008-02-02 12:22:04 -05:00
|
|
|
|
|
|
|
delete *i2;
|
2006-05-12 08:41:43 -04:00
|
|
|
}
|
2006-05-10 06:22:38 -04:00
|
|
|
}
|
2008-02-16 17:43:18 -05:00
|
|
|
|
|
|
|
delete states;
|
2006-05-12 08:41:43 -04:00
|
|
|
}
|
2008-02-16 17:43:18 -05:00
|
|
|
delete sessions;
|
2006-05-10 06:22:38 -04:00
|
|
|
}
|
|
|
|
|
2005-11-14 03:38:16 -05:00
|
|
|
void
|
|
|
|
NewSessionDialog::reset()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2005-11-14 03:38:16 -05:00
|
|
|
reset_name();
|
|
|
|
reset_template();
|
2006-05-12 08:41:43 -04:00
|
|
|
set_response_sensitive (Gtk::RESPONSE_NONE, false);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2009-01-02 22:34:41 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
NewSessionDialog::set_offer_cancel (bool yn)
|
|
|
|
{
|
|
|
|
if (yn) {
|
|
|
|
quit_or_cancel_button->set_label (X_("gtk-cancel"));
|
|
|
|
} else {
|
|
|
|
quit_or_cancel_button->set_label (X_("gtk-quit"));
|
|
|
|
}
|
|
|
|
}
|