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