move advanced new session options into an expander, change some wording
[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/expander.h>
30 #include <gtkmm/box.h>
31 #include <gtkmm/radiobutton.h>
32 #include <gtkmm/filechooserbutton.h>
33 #include <gtkmm/scrolledwindow.h>
34 #include <gtkmm/treeview.h>
35 #include <gtkmm/treestore.h>
36 #include <gtkmm/checkbutton.h>
37 #include <gtkmm/table.h>
38 #include <gtkmm/frame.h>
39 #include <gtkmm/spinbutton.h>
40 #include <gtkmm/liststore.h>
41 #include <gtkmm/combobox.h>
42
43 #include "ardour/utils.h"
44
45 class EngineControl;
46
47 class ArdourStartup : public Gtk::Assistant {
48   public:
49         ArdourStartup (bool require_new, const std::string& session_name, const std::string& session_path, const std::string& template_name);
50         ~ArdourStartup ();
51
52         bool ready_without_display () const;
53
54         std::string session_name (bool& should_be_new);
55         std::string session_folder ();
56
57         bool use_session_template();
58         std::string session_template_name();
59
60         // advanced session options
61
62         bool create_master_bus() const;
63         int master_channel_count() const;
64
65         bool connect_inputs() const;
66         bool limit_inputs_used_for_connection() const;
67         int input_limit_count() const;
68
69         bool connect_outputs() const;
70         bool limit_outputs_used_for_connection() const;
71         int output_limit_count() const;
72
73         bool connect_outs_to_master() const;
74         bool connect_outs_to_physical() const;
75
76         gint response () const {
77                 return  _response;
78         }
79
80   private:
81         gint _response;
82         bool config_modified;
83         bool new_user;
84         bool need_session_info;
85         bool new_only;
86         std::string _provided_session_name;
87         std::string _provided_session_path;
88
89         std::string been_here_before_path () const;
90
91         void on_apply ();
92         void on_cancel ();
93         bool on_delete_event (GdkEventAny*);
94         void on_prepare (Gtk::Widget*);
95
96         static ArdourStartup *the_startup;
97
98         Glib::RefPtr<Gdk::Pixbuf> icon_pixbuf;
99
100         void setup_new_user_page ();
101         Glib::RefPtr<Gdk::Pixbuf> splash_pixbuf;
102         Gtk::DrawingArea splash_area;
103         bool splash_expose (GdkEventExpose* ev);
104
105         void setup_first_time_config_page ();
106         void config_changed ();
107
108         /* first page */
109         Gtk::FileChooserButton* default_dir_chooser;
110         void default_dir_changed();
111         void setup_first_page ();
112
113         /* initial choice page */
114
115         void setup_initial_choice_page ();
116         Gtk::VBox ic_vbox;
117         Gtk::Button ic_new_session_button;
118         void new_session_button_clicked ();
119
120         /* monitoring choices */
121
122         Gtk::VBox mon_vbox;
123         Gtk::Label monitor_label;
124         Gtk::RadioButton monitor_via_hardware_button;
125         Gtk::RadioButton monitor_via_ardour_button;
126         void setup_monitoring_choice_page ();
127
128         /* monitor section choices */
129
130         Gtk::VBox mon_sec_vbox;
131         Gtk::Label monitor_section_label;
132         Gtk::RadioButton use_monitor_section_button;
133         Gtk::RadioButton no_monitor_section_button;
134         void setup_monitor_section_choice_page ();
135
136
137         /* recent sessions */
138
139         void setup_existing_session_page ();
140
141         struct RecentSessionsSorter {
142             bool operator() (std::pair<std::string,std::string> a, std::pair<std::string,std::string> b) const {
143                     return cmp_nocase(a.first, b.first) == -1;
144             }
145         };
146
147         struct RecentSessionModelColumns : public Gtk::TreeModel::ColumnRecord {
148             RecentSessionModelColumns() {
149                     add (visible_name);
150                     add (tip);
151                     add (fullpath);
152             }
153             Gtk::TreeModelColumn<std::string> visible_name;
154             Gtk::TreeModelColumn<std::string> tip;
155             Gtk::TreeModelColumn<std::string> fullpath;
156         };
157
158         RecentSessionModelColumns    recent_session_columns;
159         Gtk::TreeView                recent_session_display;
160         Glib::RefPtr<Gtk::TreeStore> recent_session_model;
161         Gtk::ScrolledWindow          recent_scroller;
162         Gtk::FileChooserButton       existing_session_chooser;
163         int redisplay_recent_sessions ();
164         void recent_session_row_selected ();
165         void recent_row_activated (const Gtk::TreePath& path, Gtk::TreeViewColumn* col);
166
167         void existing_session_selected ();
168         void session_selected ();
169
170         /* new sessions */
171
172         void setup_new_session_page ();
173         Gtk::Entry new_name_entry;
174         Gtk::FileChooserButton new_folder_chooser;
175         Gtk::FileChooserButton session_template_chooser;
176
177         struct SessionTemplateColumns : public Gtk::TreeModel::ColumnRecord {
178                 SessionTemplateColumns () {
179                         add (name);
180                         add (path);
181                 }
182
183                 Gtk::TreeModelColumn<std::string> name;
184                 Gtk::TreeModelColumn<std::string> path;
185         };
186
187         SessionTemplateColumns session_template_columns;
188         Glib::RefPtr<Gtk::ListStore>  template_model;
189         Gtk::ComboBox template_chooser;
190
191         Gtk::VBox session_new_vbox;
192         Gtk::VBox session_existing_vbox;
193         Gtk::Expander more_new_session_options_button;
194         Gtk::RadioButtonGroup session_template_group;
195         Gtk::RadioButton use_session_as_template_button;
196         Gtk::RadioButton use_template_button;
197         std::string load_template_override;
198
199         void more_new_session_options_button_clicked();
200         void new_name_changed ();
201         void populate_session_templates ();
202
203         /* more options for new sessions */
204
205         Gtk::VBox more_options_vbox;
206
207         Gtk::Label chan_count_label_1;
208         Gtk::Label chan_count_label_3;
209         Gtk::Label chan_count_label_4;
210         Gtk::Table advanced_table;
211         Gtk::HBox input_port_limit_hbox;
212         Gtk::VBox input_port_vbox;
213         Gtk::Table input_table;
214         Gtk::HBox input_hbox;
215
216         Gtk::Label bus_label;
217         Gtk::Frame bus_frame;
218         Gtk::Table bus_table;
219         Gtk::HBox bus_hbox;
220
221         Gtk::Label input_label;
222         Gtk::Frame input_frame;
223         Gtk::HBox output_port_limit_hbox;
224         Gtk::VBox output_port_vbox;
225         Gtk::VBox output_conn_vbox;
226         Gtk::VBox output_vbox;
227         Gtk::HBox output_hbox;
228
229         Gtk::Label output_label;
230         Gtk::Frame output_frame;
231         Gtk::VBox advanced_vbox;
232         Gtk::Label advanced_label;
233
234         Gtk::CheckButton _create_master_bus;
235         Gtk::SpinButton _master_bus_channel_count;
236
237         Gtk::CheckButton _connect_inputs;
238         Gtk::CheckButton _limit_input_ports;
239         Gtk::SpinButton _input_limit_count;
240
241         Gtk::CheckButton _connect_outputs;
242         Gtk::CheckButton _limit_output_ports;
243         Gtk::SpinButton _output_limit_count;
244
245         Gtk::RadioButtonGroup connect_outputs_group;
246         Gtk::RadioButton _connect_outputs_to_master;
247         Gtk::RadioButton _connect_outputs_to_physical;
248
249         Gtk::Adjustment _output_limit_count_adj;
250         Gtk::Adjustment _input_limit_count_adj;
251         Gtk::Adjustment _master_bus_channel_count_adj;
252
253         void connect_inputs_clicked ();
254         void connect_outputs_clicked ();
255         void limit_inputs_clicked ();
256         void limit_outputs_clicked ();
257         void master_bus_button_clicked ();
258         void setup_more_options_box ();
259
260         /* final page */
261
262         void setup_final_page ();
263         Gtk::Label final_page;
264
265         /* always there */
266
267         Glib::RefPtr<Pango::Layout> layout;
268
269         /* page indices */
270
271         gint audio_page_index;
272         gint new_user_page_index;
273         gint default_folder_page_index;
274         gint monitoring_page_index;
275         gint monitor_section_page_index;
276         gint new_session_page_index;
277         gint initial_choice_index;
278         gint final_page_index;
279         gint session_options_page_index;
280
281         void move_along_now ();
282
283         bool _existing_session_chooser_used; ///< set to true when the existing session chooser has been used
284         void setup_prerelease_page ();
285
286         Gtk::Label info_scroller_label;
287         std::string::size_type info_scroller_count;
288         bool info_scroller_update();
289         sigc::connection info_scroller_connection;
290         void updates_button_clicked ();
291 };
292
293 #endif /* __gtk2_ardour_startup_h__ */