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