0d4124f8cc9f1eac93bb940d3f7f526aa91d1bee
[ardour.git] / gtk2_ardour / new_session_dialog.h
1 /*
2     Copyright (C) 2005 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 // -*- c++ -*-
21
22 #ifndef NEW_SESSION_DIALOG_H
23 #define NEW_SESSION_DIALOG_H
24
25 #include <string>
26 #include <gtkmm/treeview.h>
27 #include <gtkmm/treestore.h>
28 #include <gtkmm/treepath.h>
29 #include <gtkmm/scrolledwindow.h>
30 #include <gtkmm/notebook.h>
31 #include <gtkmm/table.h>
32 #include <gtkmm/alignment.h>
33 #include <gtkmm/frame.h>
34 #include <gtkmm/expander.h>
35
36 #include <ardour/utils.h>
37
38 #include <glibmm/refptr.h>
39
40 #include "ardour_dialog.h"
41
42 namespace Gtk {
43         class Entry;
44         class FileChooserButton;
45         class SpinButton;
46         class CheckButton;
47         class RadioButton;
48         class TreeView;
49         class Notebook;
50 }
51
52 class NewSessionDialog : public ArdourDialog
53 {
54 public:
55                 
56         NewSessionDialog();
57
58         void set_session_name(const Glib::ustring& name);
59
60         std::string session_name() const;
61         std::string session_folder() const;
62         
63         bool use_session_template() const;
64         std::string session_template_name() const;
65
66         // advanced.
67
68         bool create_master_bus() const;
69         int master_channel_count() const;
70
71         bool create_control_bus() const;
72         int control_channel_count() const;
73
74         bool connect_inputs() const;
75         bool limit_inputs_used_for_connection() const;
76         int input_limit_count() const;
77
78         bool connect_outputs() const;
79         bool limit_outputs_used_for_connection() const;
80         int output_limit_count() const;
81
82         bool connect_outs_to_master() const;
83         bool connect_outs_to_physical() const ;
84         int get_current_page();
85         void reset_recent();
86
87         // reset everything to default values.
88         void reset();
89
90 protected:
91
92         void reset_name();
93         void reset_template();
94
95         Gtk::Label * session_name_label;
96         Gtk::Label * session_location_label;
97         Gtk::Label * session_template_label;
98         Gtk::Label * chan_count_label_1;
99         Gtk::Label * chan_count_label_2;
100         Gtk::Label * chan_count_label_3;
101         Gtk::Label * chan_count_label_4;
102         Gtk::Table * advanced_table;
103         Gtk::HBox * input_port_limit_hbox;
104         Gtk::VBox * input_port_vbox;
105         Gtk::Table * input_table;
106         Gtk::HBox * input_hbox;
107
108         Gtk::Label * bus_label;
109         Gtk::Frame * bus_frame;
110         Gtk::Table * bus_table;
111         Gtk::HBox * bus_hbox;
112
113         Gtk::Label * input_label;
114         Gtk::Frame * input_frame;
115         Gtk::HBox * output_port_limit_hbox;
116         Gtk::VBox * output_port_vbox;
117         Gtk::VBox * output_conn_vbox;
118         Gtk::VBox * output_vbox;
119         Gtk::HBox * output_hbox;
120
121         Gtk::Label * output_label;
122         Gtk::Frame * output_frame;
123         Gtk::VBox * advanced_vbox;
124         Gtk::Label * advanced_label;
125         Gtk::Expander * advanced_expander;
126         Gtk::Table * new_session_table;
127         Gtk::HBox * open_session_hbox;
128         Gtk::ScrolledWindow * recent_scrolledwindow;
129
130         Gtk::Label * recent_sesion_label;
131         Gtk::Frame * recent_frame;
132         Gtk::VBox * open_session_vbox;
133         Gtk::Entry*  m_name;
134         Gtk::FileChooserButton* m_folder;
135         Gtk::FileChooserButton* m_template;
136         Gtk::Label * open_session_file_label;
137
138         Gtk::CheckButton* m_create_master_bus;
139         Gtk::SpinButton* m_master_bus_channel_count;
140         
141         Gtk::CheckButton* m_create_control_bus;
142         Gtk::SpinButton* m_control_bus_channel_count;
143
144         Gtk::CheckButton* m_connect_inputs;
145         Gtk::CheckButton* m_limit_input_ports;
146         Gtk::SpinButton* m_input_limit_count;
147
148         Gtk::CheckButton* m_connect_outputs;    
149         Gtk::CheckButton* m_limit_output_ports;
150         Gtk::SpinButton* m_output_limit_count;
151
152         Gtk::RadioButton* m_connect_outputs_to_master;
153         Gtk::RadioButton* m_connect_outputs_to_physical;
154         Gtk::Button* m_okbutton;
155
156         Gtk::FileChooserButton* m_open_filechooser;
157         Gtk::TreeView* m_treeview;
158         Gtk::Notebook* m_notebook;
159
160  private:
161         struct RecentSessionModelColumns : public Gtk::TreeModel::ColumnRecord {
162             RecentSessionModelColumns() { 
163                     add (visible_name);
164                     add (fullpath);
165             }
166           Gtk::TreeModelColumn<std::string> visible_name;
167           Gtk::TreeModelColumn<std::string> fullpath;
168         };
169
170         RecentSessionModelColumns    recent_columns;
171         Glib::RefPtr<Gtk::TreeStore> recent_model;
172
173         void recent_session_selection_changed ();
174         void nsd_redisplay_recent_sessions();
175         void nsd_recent_session_row_activated (const Gtk::TreePath& path, Gtk::TreeViewColumn* col);
176         struct RecentSessionsSorter {
177           bool operator() (std::pair<std::string,std::string> a, std::pair<std::string,std::string> b) const {
178                     return cmp_nocase(a.first, b.first) == -1;
179             }
180         };
181         bool entry_key_release (GdkEventKey*);
182         void notebook_page_changed (GtkNotebookPage*, uint);
183         void treeview_selection_changed ();
184         void file_chosen ();
185         void template_chosen ();
186         void recent_row_activated (const Gtk::TreePath&, Gtk::TreeViewColumn*);
187         void connect_inputs_clicked ();
188         void connect_outputs_clicked ();
189         void limit_inputs_clicked ();
190         void limit_outputs_clicked ();
191         void master_bus_button_clicked ();
192         void monitor_bus_button_clicked ();
193
194         bool on_new_session_page;
195
196         
197 };
198
199 #endif // NEW_SESSION_DIALOG_H