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_startup_h__
21 #define __gtk2_ardour_startup_h__
25 #include <gdkmm/pixbuf.h>
26 #include <gtkmm/assistant.h>
27 #include <gtkmm/label.h>
28 #include <gtkmm/drawingarea.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 "pbd/filesystem.h"
44 #include "ardour/utils.h"
48 class ArdourStartup : public Gtk::Assistant {
53 void set_new_only (bool);
54 void set_load_template( std::string load_template );
56 std::string session_name (bool& should_be_new);
57 std::string session_folder ();
59 bool use_session_template();
60 std::string session_template_name();
62 EngineControl* engine_control() { return engine_dialog; }
64 // advanced session options
66 bool create_master_bus() const;
67 int master_channel_count() const;
69 bool connect_inputs() const;
70 bool limit_inputs_used_for_connection() const;
71 int input_limit_count() const;
73 bool connect_outputs() const;
74 bool limit_outputs_used_for_connection() const;
75 int output_limit_count() const;
77 bool connect_outs_to_master() const;
78 bool connect_outs_to_physical() const;
80 gint response () const {
90 PBD::sys::path been_here_before_path () const;
94 bool on_delete_event (GdkEventAny*);
95 void on_prepare (Gtk::Widget*);
97 static ArdourStartup *the_startup;
99 Glib::RefPtr<Gdk::Pixbuf> icon_pixbuf;
101 void setup_new_user_page ();
102 Glib::RefPtr<Gdk::Pixbuf> splash_pixbuf;
103 Gtk::DrawingArea splash_area;
104 bool splash_expose (GdkEventExpose* ev);
106 void setup_first_time_config_page ();
107 void config_changed ();
110 Gtk::FileChooserButton* default_dir_chooser;
111 void default_dir_changed();
112 void setup_first_page ();
114 /* initial choice page */
116 void setup_initial_choice_page ();
118 Gtk::RadioButton ic_new_session_button;
119 Gtk::RadioButton ic_existing_session_button;
120 bool initial_button_press(GdkEventButton *);
121 void initial_button_activated();
123 /* monitoring choices */
126 Gtk::Label monitor_label;
127 Gtk::RadioButton monitor_via_hardware_button;
128 Gtk::RadioButton monitor_via_ardour_button;
129 void setup_monitoring_choice_page ();
131 /* monitor section choices */
133 Gtk::VBox mon_sec_vbox;
134 Gtk::Label monitor_section_label;
135 Gtk::RadioButton use_monitor_section_button;
136 Gtk::RadioButton no_monitor_section_button;
137 void setup_monitor_section_choice_page ();
139 /* new session page */
141 void setup_new_session_page ();
142 Gtk::VBox new_session_vbox;
143 Gtk::HBox new_session_hbox;
145 struct RecentSessionsSorter {
146 bool operator() (std::pair<std::string,std::string> a, std::pair<std::string,std::string> b) const {
147 return cmp_nocase(a.first, b.first) == -1;
151 struct RecentSessionModelColumns : public Gtk::TreeModel::ColumnRecord {
152 RecentSessionModelColumns() {
156 Gtk::TreeModelColumn<std::string> visible_name;
157 Gtk::TreeModelColumn<std::string> fullpath;
160 RecentSessionModelColumns recent_session_columns;
161 Gtk::TreeView recent_session_display;
162 Glib::RefPtr<Gtk::TreeStore> recent_session_model;
163 Gtk::ScrolledWindow recent_scroller;
164 Gtk::FileChooserButton existing_session_chooser;
165 int redisplay_recent_sessions ();
166 void recent_session_row_selected ();
167 void recent_row_activated (const Gtk::TreePath& path, Gtk::TreeViewColumn* col);
169 void existing_session_selected ();
171 /* audio setup page */
173 void setup_audio_page ();
174 EngineControl* engine_dialog;
178 Gtk::Entry new_name_entry;
179 Gtk::FileChooserButton new_folder_chooser;
180 Gtk::FileChooserButton session_template_chooser;
181 void new_name_mapped ();
183 struct SessionTemplateColumns : public Gtk::TreeModel::ColumnRecord {
184 SessionTemplateColumns () {
189 Gtk::TreeModelColumn<std::string> name;
190 Gtk::TreeModelColumn<std::string> path;
193 SessionTemplateColumns session_template_columns;
194 Glib::RefPtr<Gtk::ListStore> template_model;
195 Gtk::ComboBox template_chooser;
197 Gtk::VBox session_new_vbox;
198 Gtk::VBox session_existing_vbox;
199 Gtk::CheckButton more_new_session_options_button;
200 Gtk::RadioButtonGroup session_template_group;
201 Gtk::RadioButton use_session_as_template_button;
202 Gtk::RadioButton use_template_button;
203 std::string load_template_override;
205 void more_new_session_options_button_clicked();
206 void new_name_changed ();
207 void populate_session_templates ();
209 /* more options for new sessions */
211 Gtk::VBox more_options_vbox;
213 Gtk::Label chan_count_label_1;
214 Gtk::Label chan_count_label_3;
215 Gtk::Label chan_count_label_4;
216 Gtk::Table advanced_table;
217 Gtk::HBox input_port_limit_hbox;
218 Gtk::VBox input_port_vbox;
219 Gtk::Table input_table;
220 Gtk::HBox input_hbox;
222 Gtk::Label bus_label;
223 Gtk::Frame bus_frame;
224 Gtk::Table bus_table;
227 Gtk::Label input_label;
228 Gtk::Frame input_frame;
229 Gtk::HBox output_port_limit_hbox;
230 Gtk::VBox output_port_vbox;
231 Gtk::VBox output_conn_vbox;
232 Gtk::VBox output_vbox;
233 Gtk::HBox output_hbox;
235 Gtk::Label output_label;
236 Gtk::Frame output_frame;
237 Gtk::VBox advanced_vbox;
238 Gtk::Label advanced_label;
240 Gtk::CheckButton _create_master_bus;
241 Gtk::SpinButton _master_bus_channel_count;
243 Gtk::CheckButton _connect_inputs;
244 Gtk::CheckButton _limit_input_ports;
245 Gtk::SpinButton _input_limit_count;
247 Gtk::CheckButton _connect_outputs;
248 Gtk::CheckButton _limit_output_ports;
249 Gtk::SpinButton _output_limit_count;
251 Gtk::RadioButtonGroup connect_outputs_group;
252 Gtk::RadioButton _connect_outputs_to_master;
253 Gtk::RadioButton _connect_outputs_to_physical;
255 Gtk::Adjustment _output_limit_count_adj;
256 Gtk::Adjustment _input_limit_count_adj;
257 Gtk::Adjustment _master_bus_channel_count_adj;
259 void connect_inputs_clicked ();
260 void connect_outputs_clicked ();
261 void limit_inputs_clicked ();
262 void limit_outputs_clicked ();
263 void master_bus_button_clicked ();
264 void setup_more_options_page ();
268 void setup_final_page ();
269 Gtk::Label final_page;
273 Glib::RefPtr<Pango::Layout> layout;
277 gint audio_page_index;
278 gint new_user_page_index;
279 gint default_folder_page_index;
280 gint monitoring_page_index;
281 gint monitor_section_page_index;
282 gint new_session_page_index;
283 gint initial_choice_index;
284 gint final_page_index;
285 gint session_options_page_index;
287 void move_along_now ();
289 bool _existing_session_chooser_used; ///< set to true when the existing session chooser has been used
290 void setup_prerelease_page ();
293 #endif /* __gtk2_ardour_startup_h__ */