Trim session.h include dependency tree.
[ardour.git] / gtk2_ardour / startup.h
1 #ifndef __gtk2_ardour_startup_h__
2 #define __gtk2_ardour_startup_h__
3
4 #include <string>
5
6 #include <gdkmm/pixbuf.h>
7 #include <gtkmm/assistant.h>
8 #include <gtkmm/label.h>
9 #include <gtkmm/drawingarea.h>
10 #include <gtkmm/box.h>
11 #include <gtkmm/radiobutton.h>
12 #include <gtkmm/filechooserbutton.h>
13 #include <gtkmm/scrolledwindow.h>
14 #include <gtkmm/treeview.h>
15 #include <gtkmm/treestore.h>
16 #include <gtkmm/checkbutton.h>
17 #include <gtkmm/table.h>
18 #include <gtkmm/frame.h>
19 #include <gtkmm/spinbutton.h>
20 #include <gtkmm/liststore.h>
21 #include <gtkmm/combobox.h>
22
23 #include "ardour/utils.h"
24
25 class EngineControl;
26
27 class ArdourStartup : public Gtk::Assistant {
28   public:
29         ArdourStartup ();
30         ~ArdourStartup ();
31
32         void set_new_only (bool);
33
34         Glib::ustring session_name (bool& should_be_new);
35         Glib::ustring session_folder ();
36
37         bool use_session_template();
38         Glib::ustring session_template_name();
39
40         EngineControl* engine_control() { return engine_dialog; }
41
42         // advanced session options
43
44         bool create_master_bus() const;
45         int master_channel_count() const;
46
47         bool create_control_bus() const;
48         int control_channel_count() const;
49
50         bool connect_inputs() const;
51         bool limit_inputs_used_for_connection() const;
52         int input_limit_count() const;
53
54         bool connect_outputs() const;
55         bool limit_outputs_used_for_connection() const;
56         int output_limit_count() const;
57
58         bool connect_outs_to_master() const;
59         bool connect_outs_to_physical() const;
60
61         bool applying () const {
62                 return _applying;
63         }
64
65   private:
66         bool _applying;
67         bool config_modified;
68         bool new_user;
69         bool new_only;
70
71         void on_apply ();
72         void on_cancel ();
73         void on_close ();
74         void on_prepare (Gtk::Widget*);
75
76         static ArdourStartup *the_startup;
77
78         Glib::RefPtr<Gdk::Pixbuf> icon_pixbuf;
79
80         void setup_new_user_page ();
81         Glib::RefPtr<Gdk::Pixbuf> splash_pixbuf;
82         Gtk::DrawingArea splash_area;
83         bool splash_expose (GdkEventExpose* ev);
84
85         void setup_first_time_config_page ();
86
87         /* first page */
88         Gtk::FileChooserButton* default_dir_chooser;
89         void default_dir_changed();
90         void setup_first_page ();
91
92         /* initial choice page */
93
94         void setup_initial_choice_page ();
95         Gtk::VBox ic_vbox;
96         Gtk::RadioButton ic_new_session_button;
97         Gtk::RadioButton ic_existing_session_button;
98         bool initial_choice_activated(GdkEventButton *);
99
100         /* monitoring choices */
101
102         Gtk::VBox mon_vbox;
103         Gtk::Label monitor_label;
104         Gtk::RadioButton monitor_via_hardware_button;
105         Gtk::RadioButton monitor_via_ardour_button;
106         void setup_monitoring_choice_page ();
107
108         /* session page (could be new or existing) */
109
110         void setup_session_page ();
111         Gtk::VBox session_vbox;
112         Gtk::HBox session_hbox;
113
114         /* recent sessions */
115
116         void setup_existing_session_page ();
117
118         struct RecentSessionsSorter {
119             bool operator() (std::pair<std::string,std::string> a, std::pair<std::string,std::string> b) const {
120                     return cmp_nocase(a.first, b.first) == -1;
121             }
122         };
123
124         struct RecentSessionModelColumns : public Gtk::TreeModel::ColumnRecord {
125             RecentSessionModelColumns() {
126                     add (visible_name);
127                     add (fullpath);
128             }
129             Gtk::TreeModelColumn<Glib::ustring> visible_name;
130             Gtk::TreeModelColumn<Glib::ustring> fullpath;
131         };
132
133         RecentSessionModelColumns    recent_session_columns;
134         Gtk::TreeView                recent_session_display;
135         Glib::RefPtr<Gtk::TreeStore> recent_session_model;
136         Gtk::ScrolledWindow          recent_scroller;
137         void redisplay_recent_sessions ();
138         void recent_session_row_selected ();
139         void recent_row_activated (const Gtk::TreePath& path, Gtk::TreeViewColumn* col);
140
141         /* audio setup page */
142
143         void setup_audio_page ();
144         EngineControl* engine_dialog;
145
146         /* new sessions */
147
148         void setup_new_session_page ();
149         Gtk::Entry new_name_entry;
150         Gtk::FileChooserButton new_folder_chooser;
151         Gtk::FileChooserButton session_template_chooser;
152
153         struct SessionTemplateColumns : public Gtk::TreeModel::ColumnRecord {
154                 SessionTemplateColumns () {
155                         add (name);
156                         add (path);
157                 }
158
159                 Gtk::TreeModelColumn<std::string> name;
160                 Gtk::TreeModelColumn<std::string> path;
161         };
162
163         SessionTemplateColumns session_template_columns;
164         Glib::RefPtr<Gtk::ListStore>  template_model;
165         Gtk::ComboBox template_chooser;
166
167         Gtk::VBox session_new_vbox;
168         Gtk::CheckButton more_new_session_options_button;
169         Gtk::RadioButtonGroup session_template_group;
170         Gtk::RadioButton use_session_as_template_button;
171         Gtk::RadioButton use_template_button;
172
173         void more_new_session_options_button_clicked();
174         void new_name_changed ();
175         void populate_session_templates ();
176
177         /* more options for new sessions */
178
179         Gtk::VBox more_options_vbox;
180
181         Gtk::Label chan_count_label_1;
182         Gtk::Label chan_count_label_2;
183         Gtk::Label chan_count_label_3;
184         Gtk::Label chan_count_label_4;
185         Gtk::Table advanced_table;
186         Gtk::HBox input_port_limit_hbox;
187         Gtk::VBox input_port_vbox;
188         Gtk::Table input_table;
189         Gtk::HBox input_hbox;
190
191         Gtk::Label bus_label;
192         Gtk::Frame bus_frame;
193         Gtk::Table bus_table;
194         Gtk::HBox bus_hbox;
195
196         Gtk::Label input_label;
197         Gtk::Frame input_frame;
198         Gtk::HBox output_port_limit_hbox;
199         Gtk::VBox output_port_vbox;
200         Gtk::VBox output_conn_vbox;
201         Gtk::VBox output_vbox;
202         Gtk::HBox output_hbox;
203
204         Gtk::Label output_label;
205         Gtk::Frame output_frame;
206         Gtk::VBox advanced_vbox;
207         Gtk::Label advanced_label;
208
209         Gtk::CheckButton _create_master_bus;
210         Gtk::SpinButton _master_bus_channel_count;
211
212         Gtk::CheckButton _create_control_bus;
213         Gtk::SpinButton _control_bus_channel_count;
214
215         Gtk::CheckButton _connect_inputs;
216         Gtk::CheckButton _limit_input_ports;
217         Gtk::SpinButton _input_limit_count;
218
219         Gtk::CheckButton _connect_outputs;
220         Gtk::CheckButton _limit_output_ports;
221         Gtk::SpinButton _output_limit_count;
222
223         Gtk::RadioButtonGroup connect_outputs_group;
224         Gtk::RadioButton _connect_outputs_to_master;
225         Gtk::RadioButton _connect_outputs_to_physical;
226
227         Gtk::Adjustment _output_limit_count_adj;
228         Gtk::Adjustment _input_limit_count_adj;
229         Gtk::Adjustment _control_bus_channel_count_adj;
230         Gtk::Adjustment _master_bus_channel_count_adj;
231
232         void connect_inputs_clicked ();
233         void connect_outputs_clicked ();
234         void limit_inputs_clicked ();
235         void limit_outputs_clicked ();
236         void master_bus_button_clicked ();
237         void monitor_bus_button_clicked ();
238         void setup_more_options_page ();
239
240         /* final page */
241
242         void setup_final_page ();
243         Gtk::Label final_page;
244
245         /* always there */
246
247         Glib::RefPtr<Pango::Layout> layout;
248
249         /* page indices */
250
251         gint audio_page_index;
252         gint new_user_page_index;
253         gint default_folder_page_index;
254         gint monitoring_page_index;
255         gint session_page_index;
256         gint initial_choice_index;
257         gint final_page_index;
258         gint session_options_page_index;
259
260         void move_along_now ();
261
262 };
263
264 #endif /* __gtk2_ardour_startup_h__ */