summaryrefslogtreecommitdiff
path: root/gtk2_ardour/new_session_dialog.cc
blob: 7bdd6d4e485061a006d5e926c1633935d654f564 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/*
    Copyright (C) 2005 Paul Davis 

    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.

    $Id$
*/

#include "i18n.h"
#include "new_session_dialog.h"
#include "glade_path.h"

const char* NewSessionDialogFactory::s_m_top_level_widget_name = X_("new_session_dialog");
const char* NewSessionDialogFactory::top_level_widget_name() { return s_m_top_level_widget_name; }

Glib::RefPtr<Gnome::Glade::Xml>
NewSessionDialogFactory::create()
{
	return GladeFactory::create(GladePath::path(X_("new_session_dialog.glade")));
}


NewSessionDialog::NewSessionDialog(BaseObjectType* cobject,
				   const Glib::RefPtr<Gnome::Glade::Xml>& xml)
	: Gtk::Dialog(cobject)	  
{
	// look up the widgets we care about.

	xml->get_widget(X_("SessionName"), m_name);
	xml->get_widget(X_("SessionFolder"), m_folder);
	xml->get_widget(X_("SessionTemplate"), m_template);
	
	xml->get_widget(X_("CreateMasterTrack"), m_create_master_track);
	xml->get_widget(X_("MasterChannelCount"), m_master_track_channel_count);
	
	xml->get_widget(X_("CreateControlTrack"), m_create_control_track);
	xml->get_widget(X_("ControlChannelCount"), m_control_track_channel_count);

	xml->get_widget(X_("ConnectInputs"), m_connect_inputs);
	xml->get_widget(X_("LimitInputPorts"), m_limit_input_ports);
	xml->get_widget(X_("InputLimitCount"), m_input_limit_count);

	xml->get_widget(X_("ConnectOutputs"), m_connect_outputs);
	xml->get_widget(X_("LimitOutputPorts"), m_limit_output_ports);
	xml->get_widget(X_("OutputLimitCount"), m_output_limit_count);	
	xml->get_widget(X_("ConnectOutsToMaster"), m_connect_outputs_to_master);
	xml->get_widget(X_("ConnectOutsToPhysical"), m_connect_outputs_to_physical);

	///@ todo connect some signals

}

void
NewSessionDialog::set_session_name(const Glib::ustring& name)
{
	m_name->set_text(name);
}

std::string
NewSessionDialog::session_name() const
{
	return Glib::filename_from_utf8(m_name->get_text());
}

std::string
NewSessionDialog::session_folder() const
{
	return Glib::filename_from_utf8(m_folder->get_current_folder());
}

bool
NewSessionDialog::use_session_template() const
{
	if(m_template->get_filename().empty()) return false;
	return true;
}

std::string
NewSessionDialog::session_template_name() const
{
	return Glib::filename_from_utf8(m_template->get_filename());
}

bool
NewSessionDialog::create_master_track() const
{
	return m_create_master_track->get_active();
}

int
NewSessionDialog::master_channel_count() const
{
	return m_master_track_channel_count->get_value_as_int();
}

bool
NewSessionDialog::create_control_track() const
{
	return m_create_control_track->get_active();
}

int
NewSessionDialog::control_channel_count() const
{
	return m_control_track_channel_count->get_value_as_int();
}

bool
NewSessionDialog::connect_inputs() const
{
	return m_connect_inputs->get_active();
}

bool
NewSessionDialog::limit_inputs_used_for_connection() const
{
	return m_limit_input_ports->get_active();
}

int
NewSessionDialog::input_limit_count() const
{
	return m_input_limit_count->get_value_as_int();
}

bool
NewSessionDialog::connect_outputs() const
{
	return m_connect_outputs->get_active();
}

bool
NewSessionDialog::limit_outputs_used_for_connection() const
{
	return m_limit_output_ports->get_active();
}

int
NewSessionDialog::output_limit_count() const
{
	return m_output_limit_count->get_value_as_int();
}

bool
NewSessionDialog::connect_outs_to_master() const
{
	return m_connect_outputs_to_master->get_active();
}

bool
NewSessionDialog::connect_outs_to_physical() const
{
	return m_connect_outputs_to_physical->get_active();
}


void
NewSessionDialog::reset_name()
{
	m_name->set_text(Glib::ustring());
	
}

/// @todo
void
NewSessionDialog::reset_template()
{

}

void
NewSessionDialog::reset()
{
	reset_name();
	reset_template();
}