remove beta page from startup wizard; use dbl-click to activate "what would you like...
[ardour.git] / gtk2_ardour / startup.h
1 /*
2     Copyright (C) 2010 Paul Davis
3
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.
8
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.
13
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.
17
18 */
19
20 #ifndef __gtk2_ardour_startup_h__
21 #define __gtk2_ardour_startup_h__
22
23 #include <string>
24
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>
41
42 #include "pbd/filesystem.h"
43
44 #include "ardour/utils.h"
45
46 class EngineControl;
47
48 class ArdourStartup : public Gtk::Assistant {
49   public:
50         ArdourStartup ();
51         ~ArdourStartup ();
52
53         void set_new_only (bool);
54         void set_load_template( std::string load_template );
55
56         std::string session_name (bool& should_be_new);
57         std::string session_folder ();
58
59         bool use_session_template();
60         std::string session_template_name();
61
62         EngineControl* engine_control() { return engine_dialog; }
63
64         // advanced session options
65
66         bool create_master_bus() const;
67         int master_channel_count() const;
68
69         bool connect_inputs() const;
70         bool limit_inputs_used_for_connection() const;
71         int input_limit_count() const;
72
73         bool connect_outputs() const;
74         bool limit_outputs_used_for_connection() const;
75         int output_limit_count() const;
76
77         bool connect_outs_to_master() const;
78         bool connect_outs_to_physical() const;
79
80         gint response () const {
81                 return  _response;
82         }
83
84   private:
85         gint _response;
86         bool config_modified;
87         bool new_user;
88         bool new_only;
89
90         PBD::sys::path been_here_before_path () const;
91
92         void on_apply ();
93         void on_cancel ();
94         bool on_delete_event (GdkEventAny*);
95         void on_prepare (Gtk::Widget*);
96
97         static ArdourStartup *the_startup;
98
99         Glib::RefPtr<Gdk::Pixbuf> icon_pixbuf;
100
101         void setup_new_user_page ();
102         Glib::RefPtr<Gdk::Pixbuf> splash_pixbuf;
103         Gtk::DrawingArea splash_area;
104         bool splash_expose (GdkEventExpose* ev);
105
106         void setup_first_time_config_page ();
107         void config_changed ();
108
109         /* first page */
110         Gtk::FileChooserButton* default_dir_chooser;
111         void default_dir_changed();
112         void setup_first_page ();
113
114         /* initial choice page */
115
116         void setup_initial_choice_page ();
117         Gtk::VBox ic_vbox;
118         Gtk::RadioButton ic_new_session_button;
119         Gtk::RadioButton ic_existing_session_button;
120         bool initial_button_clicked(GdkEventButton*);
121         void initial_button_activated();
122
123         /* monitoring choices */
124
125         Gtk::VBox mon_vbox;
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 ();
130
131         /* monitor section choices */
132
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 ();
138
139         /* session page (could be new or existing) */
140
141         void setup_session_page ();
142         Gtk::VBox session_vbox;
143         Gtk::HBox session_hbox;
144
145         /* recent sessions */
146
147         void setup_existing_session_page ();
148
149         struct RecentSessionsSorter {
150             bool operator() (std::pair<std::string,std::string> a, std::pair<std::string,std::string> b) const {
151                     return cmp_nocase(a.first, b.first) == -1;
152             }
153         };
154
155         struct RecentSessionModelColumns : public Gtk::TreeModel::ColumnRecord {
156             RecentSessionModelColumns() {
157                     add (visible_name);
158                     add (fullpath);
159             }
160             Gtk::TreeModelColumn<std::string> visible_name;
161             Gtk::TreeModelColumn<std::string> fullpath;
162         };
163
164         RecentSessionModelColumns    recent_session_columns;
165         Gtk::TreeView                recent_session_display;
166         Glib::RefPtr<Gtk::TreeStore> recent_session_model;
167         Gtk::ScrolledWindow          recent_scroller;
168         Gtk::FileChooserButton       existing_session_chooser;
169         int redisplay_recent_sessions ();
170         void recent_session_row_selected ();
171         void recent_row_activated (const Gtk::TreePath& path, Gtk::TreeViewColumn* col);
172
173         void existing_session_selected ();
174
175         /* audio setup page */
176
177         void setup_audio_page ();
178         EngineControl* engine_dialog;
179
180         /* new sessions */
181
182         void setup_new_session_page ();
183         Gtk::Entry new_name_entry;
184         Gtk::FileChooserButton new_folder_chooser;
185         Gtk::FileChooserButton session_template_chooser;
186         void new_name_mapped ();
187
188         struct SessionTemplateColumns : public Gtk::TreeModel::ColumnRecord {
189                 SessionTemplateColumns () {
190                         add (name);
191                         add (path);
192                 }
193
194                 Gtk::TreeModelColumn<std::string> name;
195                 Gtk::TreeModelColumn<std::string> path;
196         };
197
198         SessionTemplateColumns session_template_columns;
199         Glib::RefPtr<Gtk::ListStore>  template_model;
200         Gtk::ComboBox template_chooser;
201
202         Gtk::VBox session_new_vbox;
203         Gtk::VBox session_existing_vbox;
204         Gtk::CheckButton more_new_session_options_button;
205         Gtk::RadioButtonGroup session_template_group;
206         Gtk::RadioButton use_session_as_template_button;
207         Gtk::RadioButton use_template_button;
208         std::string load_template_override;
209
210         void more_new_session_options_button_clicked();
211         void new_name_changed ();
212         void populate_session_templates ();
213
214         /* more options for new sessions */
215
216         Gtk::VBox more_options_vbox;
217
218         Gtk::Label chan_count_label_1;
219         Gtk::Label chan_count_label_3;
220         Gtk::Label chan_count_label_4;
221         Gtk::Table advanced_table;
222         Gtk::HBox input_port_limit_hbox;
223         Gtk::VBox input_port_vbox;
224         Gtk::Table input_table;
225         Gtk::HBox input_hbox;
226
227         Gtk::Label bus_label;
228         Gtk::Frame bus_frame;
229         Gtk::Table bus_table;
230         Gtk::HBox bus_hbox;
231
232         Gtk::Label input_label;
233         Gtk::Frame input_frame;
234         Gtk::HBox output_port_limit_hbox;
235         Gtk::VBox output_port_vbox;
236         Gtk::VBox output_conn_vbox;
237         Gtk::VBox output_vbox;
238         Gtk::HBox output_hbox;
239
240         Gtk::Label output_label;
241         Gtk::Frame output_frame;
242         Gtk::VBox advanced_vbox;
243         Gtk::Label advanced_label;
244
245         Gtk::CheckButton _create_master_bus;
246         Gtk::SpinButton _master_bus_channel_count;
247
248         Gtk::CheckButton _connect_inputs;
249         Gtk::CheckButton _limit_input_ports;
250         Gtk::SpinButton _input_limit_count;
251
252         Gtk::CheckButton _connect_outputs;
253         Gtk::CheckButton _limit_output_ports;
254         Gtk::SpinButton _output_limit_count;
255
256         Gtk::RadioButtonGroup connect_outputs_group;
257         Gtk::RadioButton _connect_outputs_to_master;
258         Gtk::RadioButton _connect_outputs_to_physical;
259
260         Gtk::Adjustment _output_limit_count_adj;
261         Gtk::Adjustment _input_limit_count_adj;
262         Gtk::Adjustment _master_bus_channel_count_adj;
263
264         void connect_inputs_clicked ();
265         void connect_outputs_clicked ();
266         void limit_inputs_clicked ();
267         void limit_outputs_clicked ();
268         void master_bus_button_clicked ();
269         void setup_more_options_page ();
270
271         /* final page */
272
273         void setup_final_page ();
274         Gtk::Label final_page;
275
276         /* always there */
277
278         Glib::RefPtr<Pango::Layout> layout;
279
280         /* page indices */
281
282         gint audio_page_index;
283         gint new_user_page_index;
284         gint default_folder_page_index;
285         gint monitoring_page_index;
286         gint monitor_section_page_index;
287         gint session_page_index;
288         gint initial_choice_index;
289         gint final_page_index;
290         gint session_options_page_index;
291
292         void move_along_now ();
293
294         bool _existing_session_chooser_used; ///< set to true when the existing session chooser has been used
295         void setup_prerelease_page ();
296 };
297
298 #endif /* __gtk2_ardour_startup_h__ */