add GUI support to create tape/destructive tracks
[ardour.git] / gtk2_ardour / new_session_dialog.cc
1 /*
2     Copyright (C) 2005 Paul Davis 
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18     $Id$
19 */
20
21 #include "i18n.h"
22 #include "new_session_dialog.h"
23 #include "glade_path.h"
24
25 #include <gtkmm/entry.h>
26 #include <gtkmm/filechooserbutton.h>
27 #include <gtkmm/spinbutton.h>
28 #include <gtkmm/checkbutton.h>
29 #include <gtkmm/radiobutton.h>
30
31 const char* NewSessionDialogFactory::s_m_top_level_widget_name = X_("NewSessionDialog");
32 const char* NewSessionDialogFactory::top_level_widget_name() { return s_m_top_level_widget_name; }
33
34 Glib::RefPtr<Gnome::Glade::Xml>
35 NewSessionDialogFactory::create()
36 {
37         return GladeFactory::create(GladePath::path(X_("new_session_dialog.glade")));
38 }
39
40
41 NewSessionDialog::NewSessionDialog(BaseObjectType* cobject,
42                                    const Glib::RefPtr<Gnome::Glade::Xml>& xml)
43         : Gtk::Dialog(cobject)    
44 {
45         // look up the widgets we care about.
46
47         xml->get_widget(X_("SessionNameEntry"), m_name);
48         xml->get_widget(X_("SessionFolderChooser"), m_folder);
49         xml->get_widget(X_("SessionTemplateChooser"), m_template);
50         
51         xml->get_widget(X_("CreateMasterBus"), m_create_master_bus);
52         xml->get_widget(X_("MasterChannelCount"), m_master_bus_channel_count);
53         
54         xml->get_widget(X_("CreateControlBus"), m_create_control_bus);
55         xml->get_widget(X_("ControlChannelCount"), m_control_bus_channel_count);
56
57         xml->get_widget(X_("ConnectInputs"), m_connect_inputs);
58         xml->get_widget(X_("LimitInputPorts"), m_limit_input_ports);
59         xml->get_widget(X_("InputLimitCount"), m_input_limit_count);
60
61         xml->get_widget(X_("ConnectOutputs"), m_connect_outputs);
62         xml->get_widget(X_("LimitOutputPorts"), m_limit_output_ports);
63         xml->get_widget(X_("OutputLimitCount"), m_output_limit_count);  
64         xml->get_widget(X_("ConnectOutsToMaster"), m_connect_outputs_to_master);
65         xml->get_widget(X_("ConnectOutsToPhysical"), m_connect_outputs_to_physical);
66
67         ///@ todo connect some signals
68
69 }
70
71 void
72 NewSessionDialog::set_session_name(const Glib::ustring& name)
73 {
74         m_name->set_text(name);
75 }
76
77 std::string
78 NewSessionDialog::session_name() const
79 {
80         return Glib::filename_from_utf8(m_name->get_text());
81 }
82
83 std::string
84 NewSessionDialog::session_folder() const
85 {
86         return Glib::filename_from_utf8(m_folder->get_current_folder());
87 }
88
89 bool
90 NewSessionDialog::use_session_template() const
91 {
92         if(m_template->get_filename().empty()) return false;
93         return true;
94 }
95
96 std::string
97 NewSessionDialog::session_template_name() const
98 {
99         return Glib::filename_from_utf8(m_template->get_filename());
100 }
101
102 bool
103 NewSessionDialog::create_master_bus() const
104 {
105         return m_create_master_bus->get_active();
106 }
107
108 int
109 NewSessionDialog::master_channel_count() const
110 {
111         return m_master_bus_channel_count->get_value_as_int();
112 }
113
114 bool
115 NewSessionDialog::create_control_bus() const
116 {
117         return m_create_control_bus->get_active();
118 }
119
120 int
121 NewSessionDialog::control_channel_count() const
122 {
123         return m_control_bus_channel_count->get_value_as_int();
124 }
125
126 bool
127 NewSessionDialog::connect_inputs() const
128 {
129         return m_connect_inputs->get_active();
130 }
131
132 bool
133 NewSessionDialog::limit_inputs_used_for_connection() const
134 {
135         return m_limit_input_ports->get_active();
136 }
137
138 int
139 NewSessionDialog::input_limit_count() const
140 {
141         return m_input_limit_count->get_value_as_int();
142 }
143
144 bool
145 NewSessionDialog::connect_outputs() const
146 {
147         return m_connect_outputs->get_active();
148 }
149
150 bool
151 NewSessionDialog::limit_outputs_used_for_connection() const
152 {
153         return m_limit_output_ports->get_active();
154 }
155
156 int
157 NewSessionDialog::output_limit_count() const
158 {
159         return m_output_limit_count->get_value_as_int();
160 }
161
162 bool
163 NewSessionDialog::connect_outs_to_master() const
164 {
165         return m_connect_outputs_to_master->get_active();
166 }
167
168 bool
169 NewSessionDialog::connect_outs_to_physical() const
170 {
171         return m_connect_outputs_to_physical->get_active();
172 }
173
174
175 void
176 NewSessionDialog::reset_name()
177 {
178         m_name->set_text(Glib::ustring());
179         
180 }
181
182 /// @todo
183 void
184 NewSessionDialog::reset_template()
185 {
186
187 }
188
189 void
190 NewSessionDialog::reset()
191 {
192         reset_name();
193         reset_template();
194 }