2 Copyright (C) 2010 Paul Davis
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.
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.
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.
20 #ifndef __gtk2_ardour_session_dialog_h__
21 #define __gtk2_ardour_session_dialog_h__
25 #include <gdkmm/pixbuf.h>
26 #include <gtkmm/label.h>
27 #include <gtkmm/drawingarea.h>
28 #include <gtkmm/expander.h>
29 #include <gtkmm/box.h>
30 #include <gtkmm/radiobutton.h>
31 #include <gtkmm/filechooserbutton.h>
32 #include <gtkmm/scrolledwindow.h>
33 #include <gtkmm/treeview.h>
34 #include <gtkmm/treestore.h>
35 #include <gtkmm/checkbutton.h>
36 #include <gtkmm/table.h>
37 #include <gtkmm/frame.h>
38 #include <gtkmm/spinbutton.h>
39 #include <gtkmm/liststore.h>
40 #include <gtkmm/combobox.h>
42 #include "ardour/utils.h"
44 #include "ardour_dialog.h"
48 class SessionDialog : public ArdourDialog {
50 SessionDialog (bool require_new, const std::string& session_name, const std::string& session_path,
51 const std::string& template_name, bool cancel_not_quit);
57 std::string session_name (bool& should_be_new);
58 std::string session_folder ();
60 bool use_session_template();
61 std::string session_template_name();
63 // advanced session options
65 bool create_master_bus() const;
66 int master_channel_count() const;
68 bool connect_inputs() const;
69 bool limit_inputs_used_for_connection() const;
70 int input_limit_count() const;
72 bool connect_outputs() const;
73 bool limit_outputs_used_for_connection() const;
74 int output_limit_count() const;
76 bool connect_outs_to_master() const;
77 bool connect_outs_to_physical() const;
81 std::string _provided_session_name;
82 std::string _provided_session_path;
84 bool on_delete_event (GdkEventAny*);
86 Gtk::Button* cancel_button;
87 Gtk::Button* open_button;
88 Gtk::Button* back_button;
89 Gtk::Button* quit_button;
91 bool back_button_pressed (GdkEventButton*);
93 Gtk::Frame info_frame;
95 /* initial choice page */
97 void setup_initial_choice_box ();
98 void setup_recent_sessions ();
100 Gtk::Button ic_new_session_button;
101 void new_session_button_clicked ();
103 /* recent sessions */
105 void setup_existing_session_page ();
107 struct RecentSessionsSorter {
108 bool operator() (std::pair<std::string,std::string> a, std::pair<std::string,std::string> b) const {
109 return ARDOUR::cmp_nocase(a.first, b.first) == -1;
113 struct RecentSessionModelColumns : public Gtk::TreeModel::ColumnRecord {
114 RecentSessionModelColumns() {
121 add (time_formatted);
123 Gtk::TreeModelColumn<std::string> visible_name;
124 Gtk::TreeModelColumn<std::string> tip;
125 Gtk::TreeModelColumn<std::string> fullpath;
126 Gtk::TreeModelColumn<std::string> sample_rate;
127 Gtk::TreeModelColumn<std::string> disk_format;
128 Gtk::TreeModelColumn<int64_t> time_modified;
129 Gtk::TreeModelColumn<std::string> time_formatted;
132 RecentSessionModelColumns recent_session_columns;
133 Gtk::TreeView recent_session_display;
134 Glib::RefPtr<Gtk::TreeStore> recent_session_model;
135 Gtk::ScrolledWindow recent_scroller;
136 Gtk::Label recent_label;
137 Gtk::FileChooserButton existing_session_chooser;
138 int redisplay_recent_sessions ();
139 void recent_session_row_selected ();
140 void recent_session_sort_changed ();
141 void recent_row_activated (const Gtk::TreePath& path, Gtk::TreeViewColumn* col);
143 void existing_session_selected ();
144 void session_selected ();
148 void setup_new_session_page ();
149 Gtk::Entry new_name_entry;
150 Gtk::FileChooserButton new_folder_chooser;
152 struct SessionTemplateColumns : public Gtk::TreeModel::ColumnRecord {
153 SessionTemplateColumns () {
158 Gtk::TreeModelColumn<std::string> name;
159 Gtk::TreeModelColumn<std::string> path;
162 SessionTemplateColumns session_template_columns;
163 Glib::RefPtr<Gtk::ListStore> template_model;
164 Gtk::ComboBox template_chooser;
166 Gtk::VBox session_new_vbox;
167 Gtk::VBox session_existing_vbox;
168 Gtk::Expander more_new_session_options_button;
169 Gtk::CheckButton use_template_button;
170 std::string load_template_override;
172 void more_new_session_options_button_clicked();
173 void new_name_changed ();
174 void new_name_activated ();
175 void populate_session_templates ();
177 /* more options for new sessions */
179 Gtk::VBox more_options_vbox;
181 Gtk::Label chan_count_label_1;
182 Gtk::Label chan_count_label_3;
183 Gtk::Label chan_count_label_4;
184 Gtk::Table advanced_table;
185 Gtk::HBox input_port_limit_hbox;
186 Gtk::VBox input_port_vbox;
187 Gtk::Table input_table;
188 Gtk::HBox input_hbox;
190 Gtk::Label bus_label;
191 Gtk::Frame bus_frame;
192 Gtk::Table bus_table;
195 Gtk::Label input_label;
196 Gtk::Frame input_frame;
197 Gtk::HBox output_port_limit_hbox;
198 Gtk::VBox output_port_vbox;
199 Gtk::VBox output_conn_vbox;
200 Gtk::VBox output_vbox;
201 Gtk::HBox output_hbox;
203 Gtk::Label output_label;
204 Gtk::Frame output_frame;
205 Gtk::VBox advanced_vbox;
206 Gtk::Label advanced_label;
208 Gtk::CheckButton _create_master_bus;
209 Gtk::SpinButton _master_bus_channel_count;
211 Gtk::CheckButton _connect_inputs;
212 Gtk::CheckButton _limit_input_ports;
213 Gtk::SpinButton _input_limit_count;
215 Gtk::CheckButton _connect_outputs;
216 Gtk::CheckButton _limit_output_ports;
217 Gtk::SpinButton _output_limit_count;
219 Gtk::RadioButtonGroup connect_outputs_group;
220 Gtk::RadioButton _connect_outputs_to_master;
221 Gtk::RadioButton _connect_outputs_to_physical;
223 Gtk::Adjustment _output_limit_count_adj;
224 Gtk::Adjustment _input_limit_count_adj;
225 Gtk::Adjustment _master_bus_channel_count_adj;
227 void connect_inputs_clicked ();
228 void connect_outputs_clicked ();
229 void limit_inputs_clicked ();
230 void limit_outputs_clicked ();
231 void master_bus_button_clicked ();
232 void setup_more_options_box ();
236 Glib::RefPtr<Pango::Layout> layout;
238 bool _existing_session_chooser_used; ///< set to true when the existing session chooser has been used
240 Gtk::Label info_scroller_label;
241 std::string::size_type info_scroller_count;
242 bool info_scroller_update();
243 sigc::connection info_scroller_connection;
244 void updates_button_clicked ();
247 #endif /* __gtk2_ardour_session_dialog_h__ */