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