basic -T <load_template> option
[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         void set_load_template( std::string load_template );
34
35         Glib::ustring session_name (bool& should_be_new);
36         Glib::ustring session_folder ();
37
38         bool use_session_template();
39         Glib::ustring session_template_name();
40
41         EngineControl* engine_control() { return engine_dialog; }
42
43         // advanced session options
44
45         bool create_master_bus() const;
46         int master_channel_count() const;
47
48         bool connect_inputs() const;
49         bool limit_inputs_used_for_connection() const;
50         int input_limit_count() const;
51
52         bool connect_outputs() const;
53         bool limit_outputs_used_for_connection() const;
54         int output_limit_count() const;
55
56         bool connect_outs_to_master() const;
57         bool connect_outs_to_physical() const;
58
59         gint response () const { 
60                 return  _response;
61         }
62
63   private:
64         gint _response;
65         bool config_modified;
66         bool new_user;
67         bool new_only;
68
69         void on_apply ();
70         void on_cancel ();
71         bool on_delete_event (GdkEventAny*);
72         void on_prepare (Gtk::Widget*);
73
74         static ArdourStartup *the_startup;
75
76         Glib::RefPtr<Gdk::Pixbuf> icon_pixbuf;
77
78         void setup_new_user_page ();
79         Glib::RefPtr<Gdk::Pixbuf> splash_pixbuf;
80         Gtk::DrawingArea splash_area;
81         bool splash_expose (GdkEventExpose* ev);
82
83         void setup_first_time_config_page ();
84         void config_changed ();
85
86         /* first page */
87         Gtk::FileChooserButton* default_dir_chooser;
88         void default_dir_changed();
89         void setup_first_page ();
90
91         /* initial choice page */
92
93         void setup_initial_choice_page ();
94         Gtk::VBox ic_vbox;
95         Gtk::RadioButton ic_new_session_button;
96         Gtk::RadioButton ic_existing_session_button;
97         bool initial_button_press(GdkEventButton *);
98         void initial_button_activated();
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         /* monitor section choices */
109
110         Gtk::VBox mon_sec_vbox;
111         Gtk::Label monitor_section_label;
112         Gtk::RadioButton use_monitor_section_button;
113         Gtk::RadioButton no_monitor_section_button;
114         void setup_monitor_section_choice_page ();
115
116         /* session page (could be new or existing) */
117
118         void setup_session_page ();
119         Gtk::VBox session_vbox;
120         Gtk::HBox session_hbox;
121
122         /* recent sessions */
123
124         void setup_existing_session_page ();
125
126         struct RecentSessionsSorter {
127             bool operator() (std::pair<std::string,std::string> a, std::pair<std::string,std::string> b) const {
128                     return cmp_nocase(a.first, b.first) == -1;
129             }
130         };
131
132         struct RecentSessionModelColumns : public Gtk::TreeModel::ColumnRecord {
133             RecentSessionModelColumns() {
134                     add (visible_name);
135                     add (fullpath);
136             }
137             Gtk::TreeModelColumn<Glib::ustring> visible_name;
138             Gtk::TreeModelColumn<Glib::ustring> fullpath;
139         };
140
141         RecentSessionModelColumns    recent_session_columns;
142         Gtk::TreeView                recent_session_display;
143         Glib::RefPtr<Gtk::TreeStore> recent_session_model;
144         Gtk::ScrolledWindow          recent_scroller;
145         int redisplay_recent_sessions ();
146         void recent_session_row_selected ();
147         void recent_row_activated (const Gtk::TreePath& path, Gtk::TreeViewColumn* col);
148
149         /* audio setup page */
150
151         void setup_audio_page ();
152         EngineControl* engine_dialog;
153
154         /* new sessions */
155
156         void setup_new_session_page ();
157         Gtk::Entry new_name_entry;
158         Gtk::FileChooserButton new_folder_chooser;
159         Gtk::FileChooserButton session_template_chooser;
160         void new_name_mapped ();
161
162         struct SessionTemplateColumns : public Gtk::TreeModel::ColumnRecord {
163                 SessionTemplateColumns () {
164                         add (name);
165                         add (path);
166                 }
167
168                 Gtk::TreeModelColumn<std::string> name;
169                 Gtk::TreeModelColumn<std::string> path;
170         };
171
172         SessionTemplateColumns session_template_columns;
173         Glib::RefPtr<Gtk::ListStore>  template_model;
174         Gtk::ComboBox template_chooser;
175
176         Gtk::VBox session_new_vbox;
177         Gtk::CheckButton more_new_session_options_button;
178         Gtk::RadioButtonGroup session_template_group;
179         Gtk::RadioButton use_session_as_template_button;
180         Gtk::RadioButton use_template_button;
181         std::string load_template_override;
182
183         void more_new_session_options_button_clicked();
184         void new_name_changed ();
185         void populate_session_templates ();
186
187         /* more options for new sessions */
188
189         Gtk::VBox more_options_vbox;
190
191         Gtk::Label chan_count_label_1;
192         Gtk::Label chan_count_label_3;
193         Gtk::Label chan_count_label_4;
194         Gtk::Table advanced_table;
195         Gtk::HBox input_port_limit_hbox;
196         Gtk::VBox input_port_vbox;
197         Gtk::Table input_table;
198         Gtk::HBox input_hbox;
199
200         Gtk::Label bus_label;
201         Gtk::Frame bus_frame;
202         Gtk::Table bus_table;
203         Gtk::HBox bus_hbox;
204
205         Gtk::Label input_label;
206         Gtk::Frame input_frame;
207         Gtk::HBox output_port_limit_hbox;
208         Gtk::VBox output_port_vbox;
209         Gtk::VBox output_conn_vbox;
210         Gtk::VBox output_vbox;
211         Gtk::HBox output_hbox;
212
213         Gtk::Label output_label;
214         Gtk::Frame output_frame;
215         Gtk::VBox advanced_vbox;
216         Gtk::Label advanced_label;
217
218         Gtk::CheckButton _create_master_bus;
219         Gtk::SpinButton _master_bus_channel_count;
220
221         Gtk::CheckButton _connect_inputs;
222         Gtk::CheckButton _limit_input_ports;
223         Gtk::SpinButton _input_limit_count;
224
225         Gtk::CheckButton _connect_outputs;
226         Gtk::CheckButton _limit_output_ports;
227         Gtk::SpinButton _output_limit_count;
228
229         Gtk::RadioButtonGroup connect_outputs_group;
230         Gtk::RadioButton _connect_outputs_to_master;
231         Gtk::RadioButton _connect_outputs_to_physical;
232
233         Gtk::Adjustment _output_limit_count_adj;
234         Gtk::Adjustment _input_limit_count_adj;
235         Gtk::Adjustment _master_bus_channel_count_adj;
236
237         void connect_inputs_clicked ();
238         void connect_outputs_clicked ();
239         void limit_inputs_clicked ();
240         void limit_outputs_clicked ();
241         void master_bus_button_clicked ();
242         void setup_more_options_page ();
243
244         /* final page */
245
246         void setup_final_page ();
247         Gtk::Label final_page;
248
249         /* always there */
250
251         Glib::RefPtr<Pango::Layout> layout;
252
253         /* page indices */
254
255         gint audio_page_index;
256         gint new_user_page_index;
257         gint default_folder_page_index;
258         gint monitoring_page_index;
259         gint monitor_section_page_index;
260         gint session_page_index;
261         gint initial_choice_index;
262         gint final_page_index;
263         gint session_options_page_index;
264
265         void move_along_now ();
266
267 };
268
269 #endif /* __gtk2_ardour_startup_h__ */