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;
79 void set_provided_session(const std::string& session_name, const std::string& session_path) {
80 _provided_session_name = session_name;
81 _provided_session_path = session_path;
86 std::string _provided_session_name;
87 std::string _provided_session_path;
89 bool on_delete_event (GdkEventAny*);
91 Gtk::Button* cancel_button;
92 Gtk::Button* open_button;
93 Gtk::Button* back_button;
94 Gtk::Button* quit_button;
96 bool back_button_pressed (GdkEventButton*);
97 bool open_button_pressed (GdkEventButton*);
99 Gtk::Frame info_frame;
101 /* initial choice page */
103 void setup_initial_choice_box ();
104 void setup_recent_sessions ();
106 Gtk::Button ic_new_session_button;
107 void new_session_button_clicked ();
109 /* recent sessions */
111 void setup_existing_session_page ();
113 struct RecentSessionsSorter {
114 bool operator() (std::pair<std::string,std::string> a, std::pair<std::string,std::string> b) const {
115 return ARDOUR::cmp_nocase(a.first, b.first) == -1;
119 struct RecentSessionModelColumns : public Gtk::TreeModel::ColumnRecord {
120 RecentSessionModelColumns() {
127 add (time_formatted);
129 Gtk::TreeModelColumn<std::string> visible_name;
130 Gtk::TreeModelColumn<std::string> tip;
131 Gtk::TreeModelColumn<std::string> fullpath;
132 Gtk::TreeModelColumn<std::string> sample_rate;
133 Gtk::TreeModelColumn<std::string> disk_format;
134 Gtk::TreeModelColumn<int64_t> time_modified;
135 Gtk::TreeModelColumn<std::string> time_formatted;
138 RecentSessionModelColumns recent_session_columns;
139 Gtk::TreeView recent_session_display;
140 Glib::RefPtr<Gtk::TreeStore> recent_session_model;
141 Gtk::ScrolledWindow recent_scroller;
142 Gtk::Label recent_label;
143 Gtk::FileChooserButton existing_session_chooser;
144 int redisplay_recent_sessions ();
145 void recent_session_row_selected ();
146 void recent_session_sort_changed ();
147 void recent_row_activated (const Gtk::TreePath& path, Gtk::TreeViewColumn* col);
148 bool recent_button_press (GdkEventButton*);
149 void recent_context_mennu (GdkEventButton*);
150 void recent_remove_selected ();
152 void existing_session_selected ();
153 void session_selected ();
157 void setup_new_session_page ();
158 Gtk::Entry new_name_entry;
159 Gtk::FileChooserButton new_folder_chooser;
161 struct SessionTemplateColumns : public Gtk::TreeModel::ColumnRecord {
162 SessionTemplateColumns () {
167 Gtk::TreeModelColumn<std::string> name;
168 Gtk::TreeModelColumn<std::string> path;
171 SessionTemplateColumns session_template_columns;
172 Glib::RefPtr<Gtk::ListStore> template_model;
173 Gtk::ComboBox template_chooser;
175 Gtk::VBox session_new_vbox;
176 Gtk::VBox session_existing_vbox;
177 Gtk::Expander more_new_session_options_button;
178 Gtk::CheckButton use_template_button;
179 std::string load_template_override;
181 void more_new_session_options_button_clicked();
182 void new_name_changed ();
183 void new_name_activated ();
184 void populate_session_templates ();
186 /* more options for new sessions */
188 Gtk::VBox more_options_vbox;
190 Gtk::Label chan_count_label_1;
191 Gtk::Label chan_count_label_3;
192 Gtk::Label chan_count_label_4;
193 Gtk::Table advanced_table;
194 Gtk::HBox input_port_limit_hbox;
195 Gtk::VBox input_port_vbox;
196 Gtk::Table input_table;
197 Gtk::HBox input_hbox;
199 Gtk::Label bus_label;
200 Gtk::Frame bus_frame;
201 Gtk::Table bus_table;
204 Gtk::Label input_label;
205 Gtk::Frame input_frame;
206 Gtk::HBox output_port_limit_hbox;
207 Gtk::VBox output_port_vbox;
208 Gtk::VBox output_conn_vbox;
209 Gtk::VBox output_vbox;
210 Gtk::HBox output_hbox;
212 Gtk::Label output_label;
213 Gtk::Frame output_frame;
214 Gtk::VBox advanced_vbox;
215 Gtk::Label advanced_label;
217 Gtk::CheckButton _create_master_bus;
218 Gtk::SpinButton _master_bus_channel_count;
220 Gtk::CheckButton _connect_inputs;
221 Gtk::CheckButton _limit_input_ports;
222 Gtk::SpinButton _input_limit_count;
224 Gtk::CheckButton _connect_outputs;
225 Gtk::CheckButton _limit_output_ports;
226 Gtk::SpinButton _output_limit_count;
228 Gtk::RadioButtonGroup connect_outputs_group;
229 Gtk::RadioButton _connect_outputs_to_master;
230 Gtk::RadioButton _connect_outputs_to_physical;
232 Gtk::Adjustment _output_limit_count_adj;
233 Gtk::Adjustment _input_limit_count_adj;
234 Gtk::Adjustment _master_bus_channel_count_adj;
236 void connect_inputs_clicked ();
237 void connect_outputs_clicked ();
238 void limit_inputs_clicked ();
239 void limit_outputs_clicked ();
240 void master_bus_button_clicked ();
241 void setup_more_options_box ();
243 /* --disable plugins UI */
244 Gtk::CheckButton _disable_plugins;
245 void disable_plugins_clicked ();
249 Glib::RefPtr<Pango::Layout> layout;
251 bool _existing_session_chooser_used; ///< set to true when the existing session chooser has been used
253 Gtk::Label info_scroller_label;
254 std::string::size_type info_scroller_count;
255 bool info_scroller_update();
256 sigc::connection info_scroller_connection;
257 void updates_button_clicked ();
260 #endif /* __gtk2_ardour_session_dialog_h__ */