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/textview.h>
34 #include <gtkmm/treeview.h>
35 #include <gtkmm/treestore.h>
36 #include <gtkmm/checkbutton.h>
37 #include <gtkmm/table.h>
38 #include <gtkmm/frame.h>
39 #include <gtkmm/spinbutton.h>
40 #include <gtkmm/liststore.h>
41 #include <gtkmm/combobox.h>
43 #include "ardour/utils.h"
45 #include "ardour_dialog.h"
49 class SessionDialog : public ArdourDialog
52 SessionDialog (bool require_new, const std::string& session_name, const std::string& session_path,
53 const std::string& template_name, bool cancel_not_quit);
59 std::string session_name (bool& should_be_new);
60 std::string session_folder ();
62 bool use_session_template();
63 std::string session_template_name();
65 // advanced session options
67 bool create_master_bus() const;
68 int master_channel_count() const;
70 bool connect_inputs() const;
71 bool limit_inputs_used_for_connection() const;
72 int input_limit_count() const;
74 bool connect_outputs() const;
75 bool limit_outputs_used_for_connection() const;
76 int output_limit_count() const;
78 bool connect_outs_to_master() const;
79 bool connect_outs_to_physical() const;
81 void set_provided_session(const std::string& session_name, const std::string& session_path) {
82 _provided_session_name = session_name;
83 _provided_session_path = session_path;
88 std::string _provided_session_name;
89 std::string _provided_session_path;
91 bool on_delete_event (GdkEventAny*);
93 Gtk::Button* cancel_button;
94 Gtk::Button* open_button;
95 Gtk::Button* back_button;
96 Gtk::Button* quit_button;
98 bool back_button_pressed (GdkEventButton*);
99 bool open_button_pressed (GdkEventButton*);
101 Gtk::Frame info_frame;
103 /* initial choice page */
105 void setup_initial_choice_box ();
106 void setup_recent_sessions ();
108 Gtk::Button ic_new_session_button;
109 void new_session_button_clicked ();
111 /* recent sessions */
113 void setup_existing_session_page ();
115 struct RecentSessionsSorter
117 bool operator() (std::pair<std::string,std::string> a, std::pair<std::string,std::string> b) const {
118 return ARDOUR::cmp_nocase(a.first, b.first) == -1;
122 struct RecentSessionModelColumns : public Gtk::TreeModel::ColumnRecord {
123 RecentSessionModelColumns()
131 add (time_formatted);
133 Gtk::TreeModelColumn<std::string> visible_name;
134 Gtk::TreeModelColumn<std::string> tip;
135 Gtk::TreeModelColumn<std::string> fullpath;
136 Gtk::TreeModelColumn<std::string> sample_rate;
137 Gtk::TreeModelColumn<std::string> disk_format;
138 Gtk::TreeModelColumn<int64_t> time_modified;
139 Gtk::TreeModelColumn<std::string> time_formatted;
142 RecentSessionModelColumns recent_session_columns;
143 Gtk::TreeView recent_session_display;
144 Glib::RefPtr<Gtk::TreeStore> recent_session_model;
145 Gtk::ScrolledWindow recent_scroller;
146 Gtk::Label recent_label;
147 Gtk::FileChooserButton existing_session_chooser;
148 int redisplay_recent_sessions ();
149 void recent_session_row_selected ();
150 void recent_session_sort_changed ();
151 void recent_row_activated (const Gtk::TreePath& path, Gtk::TreeViewColumn* col);
152 bool recent_button_press (GdkEventButton*);
153 void recent_context_mennu (GdkEventButton*);
154 void recent_remove_selected ();
156 void existing_session_selected ();
157 void session_selected ();
161 void setup_new_session_page ();
162 Gtk::Entry new_name_entry;
163 Gtk::FileChooserButton new_folder_chooser;
165 struct SessionTemplateColumns : public Gtk::TreeModel::ColumnRecord {
166 SessionTemplateColumns () {
173 Gtk::TreeModelColumn<std::string> name;
174 Gtk::TreeModelColumn<std::string> path;
175 Gtk::TreeModelColumn<std::string> description;
176 Gtk::TreeModelColumn<std::string> created_with;
179 SessionTemplateColumns session_template_columns;
181 Glib::RefPtr<Gtk::TreeStore> template_model;
182 Gtk::TreeView template_chooser;
183 Gtk::ScrolledWindow template_scroller;
185 void template_row_selected ();
187 Gtk::TextView template_desc;
189 Gtk::VBox session_new_vbox;
190 Gtk::VBox session_existing_vbox;
191 Gtk::Expander more_new_session_options_button;
192 std::string load_template_override;
194 void more_new_session_options_button_clicked();
195 void new_name_changed ();
196 void new_name_activated ();
197 void populate_session_templates ();
199 /* more options for new sessions */
201 Gtk::VBox more_options_vbox;
203 Gtk::Label chan_count_label_1;
204 Gtk::Label chan_count_label_3;
205 Gtk::Label chan_count_label_4;
206 Gtk::Table advanced_table;
207 Gtk::HBox input_port_limit_hbox;
208 Gtk::VBox input_port_vbox;
209 Gtk::Table input_table;
210 Gtk::HBox input_hbox;
212 Gtk::Label bus_label;
213 Gtk::Frame bus_frame;
214 Gtk::Table bus_table;
217 Gtk::Label input_label;
218 Gtk::Frame input_frame;
219 Gtk::HBox output_port_limit_hbox;
220 Gtk::VBox output_port_vbox;
221 Gtk::VBox output_conn_vbox;
222 Gtk::VBox output_vbox;
223 Gtk::HBox output_hbox;
225 Gtk::Label output_label;
226 Gtk::Frame output_frame;
227 Gtk::VBox advanced_vbox;
228 Gtk::Label advanced_label;
230 Gtk::CheckButton _create_master_bus;
231 Gtk::SpinButton _master_bus_channel_count;
233 Gtk::CheckButton _connect_inputs;
234 Gtk::CheckButton _limit_input_ports;
235 Gtk::SpinButton _input_limit_count;
237 Gtk::CheckButton _connect_outputs;
238 Gtk::CheckButton _limit_output_ports;
239 Gtk::SpinButton _output_limit_count;
241 Gtk::RadioButtonGroup connect_outputs_group;
242 Gtk::RadioButton _connect_outputs_to_master;
243 Gtk::RadioButton _connect_outputs_to_physical;
245 Gtk::Adjustment _output_limit_count_adj;
246 Gtk::Adjustment _input_limit_count_adj;
247 Gtk::Adjustment _master_bus_channel_count_adj;
249 void connect_inputs_clicked ();
250 void connect_outputs_clicked ();
251 void limit_inputs_clicked ();
252 void limit_outputs_clicked ();
253 void master_bus_button_clicked ();
254 void setup_more_options_box ();
256 /* --disable plugins UI */
257 Gtk::CheckButton _disable_plugins;
258 void disable_plugins_clicked ();
262 Glib::RefPtr<Pango::Layout> layout;
264 bool _existing_session_chooser_used; ///< set to true when the existing session chooser has been used
266 Gtk::Label info_scroller_label;
267 std::string::size_type info_scroller_count;
268 bool info_scroller_update();
269 sigc::connection info_scroller_connection;
270 void updates_button_clicked ();
273 #endif /* __gtk2_ardour_session_dialog_h__ */