ardour
session_dialog.h
Go to the documentation of this file.
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_session_dialog_h__
21 #define __gtk2_ardour_session_dialog_h__
22 
23 #include <string>
24 
25 #include <gdkmm/pixbuf.h>
26 #include <gtkmm/label.h>
27 #include <gtkmm/drawingarea.h>
28 #include <gtkmm/expander.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 "ardour/utils.h"
43 
44 #include "ardour_dialog.h"
45 
46 class EngineControl;
47 
48 class SessionDialog : public ArdourDialog {
49  public:
50  SessionDialog (bool require_new, const std::string& session_name, const std::string& session_path,
51  const std::string& template_name, bool cancel_not_quit);
52  ~SessionDialog ();
53 
54  void clear_given ();
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  // advanced session options
63 
64  bool create_master_bus() const;
65  int master_channel_count() const;
66 
67  bool connect_inputs() const;
69  int input_limit_count() const;
70 
71  bool connect_outputs() const;
73  int output_limit_count() const;
74 
75  bool connect_outs_to_master() const;
76  bool connect_outs_to_physical() const;
77 
78  private:
79  bool new_only;
82 
83  bool on_delete_event (GdkEventAny*);
84 
85  Gtk::Button* cancel_button;
86  Gtk::Button* open_button;
87  Gtk::Button* back_button;
88  Gtk::Button* quit_button;
89 
90  bool back_button_pressed (GdkEventButton*);
91 
92  Gtk::Frame info_frame;
93 
94  /* initial choice page */
95 
97  Gtk::VBox ic_vbox;
98  Gtk::Button ic_new_session_button;
100 
101  /* recent sessions */
102 
104 
106  bool operator() (std::pair<std::string,std::string> a, std::pair<std::string,std::string> b) const {
107  return ARDOUR::cmp_nocase(a.first, b.first) == -1;
108  }
109  };
110 
111  struct RecentSessionModelColumns : public Gtk::TreeModel::ColumnRecord {
113  add (visible_name);
114  add (tip);
115  add (fullpath);
116  add (sample_rate);
117  add (disk_format);
118  }
119  Gtk::TreeModelColumn<std::string> visible_name;
120  Gtk::TreeModelColumn<std::string> tip;
121  Gtk::TreeModelColumn<std::string> fullpath;
122  Gtk::TreeModelColumn<std::string> sample_rate;
123  Gtk::TreeModelColumn<std::string> disk_format;
124  };
125 
127  Gtk::TreeView recent_session_display;
128  Glib::RefPtr<Gtk::TreeStore> recent_session_model;
129  Gtk::ScrolledWindow recent_scroller;
130  Gtk::Label recent_label;
131  Gtk::FileChooserButton existing_session_chooser;
134  void recent_row_activated (const Gtk::TreePath& path, Gtk::TreeViewColumn* col);
135 
137  void session_selected ();
138 
139  /* new sessions */
140 
141  void setup_new_session_page ();
142  Gtk::Entry new_name_entry;
143  Gtk::FileChooserButton new_folder_chooser;
144 
145  struct SessionTemplateColumns : public Gtk::TreeModel::ColumnRecord {
147  add (name);
148  add (path);
149  }
150 
151  Gtk::TreeModelColumn<std::string> name;
152  Gtk::TreeModelColumn<std::string> path;
153  };
154 
156  Glib::RefPtr<Gtk::ListStore> template_model;
157  Gtk::ComboBox template_chooser;
158 
159  Gtk::VBox session_new_vbox;
162  Gtk::CheckButton use_template_button;
164 
166  void new_name_changed ();
167  void new_name_activated ();
169 
170  /* more options for new sessions */
171 
172  Gtk::VBox more_options_vbox;
173 
174  Gtk::Label chan_count_label_1;
175  Gtk::Label chan_count_label_3;
176  Gtk::Label chan_count_label_4;
177  Gtk::Table advanced_table;
179  Gtk::VBox input_port_vbox;
180  Gtk::Table input_table;
181  Gtk::HBox input_hbox;
182 
183  Gtk::Label bus_label;
184  Gtk::Frame bus_frame;
185  Gtk::Table bus_table;
186  Gtk::HBox bus_hbox;
187 
188  Gtk::Label input_label;
189  Gtk::Frame input_frame;
191  Gtk::VBox output_port_vbox;
192  Gtk::VBox output_conn_vbox;
193  Gtk::VBox output_vbox;
194  Gtk::HBox output_hbox;
195 
196  Gtk::Label output_label;
197  Gtk::Frame output_frame;
198  Gtk::VBox advanced_vbox;
199  Gtk::Label advanced_label;
200 
201  Gtk::CheckButton _create_master_bus;
202  Gtk::SpinButton _master_bus_channel_count;
203 
204  Gtk::CheckButton _connect_inputs;
205  Gtk::CheckButton _limit_input_ports;
206  Gtk::SpinButton _input_limit_count;
207 
208  Gtk::CheckButton _connect_outputs;
209  Gtk::CheckButton _limit_output_ports;
210  Gtk::SpinButton _output_limit_count;
211 
212  Gtk::RadioButtonGroup connect_outputs_group;
213  Gtk::RadioButton _connect_outputs_to_master;
215 
216  Gtk::Adjustment _output_limit_count_adj;
217  Gtk::Adjustment _input_limit_count_adj;
219 
220  void connect_inputs_clicked ();
221  void connect_outputs_clicked ();
222  void limit_inputs_clicked ();
223  void limit_outputs_clicked ();
225  void setup_more_options_box ();
226 
227  /* always there */
228 
229  Glib::RefPtr<Pango::Layout> layout;
230 
232 
234  std::string::size_type info_scroller_count;
235  bool info_scroller_update();
236  sigc::connection info_scroller_connection;
237  void updates_button_clicked ();
238 };
239 
240 #endif /* __gtk2_ardour_session_dialog_h__ */
bool use_session_template()
Gtk::Button * open_button
bool limit_inputs_used_for_connection() const
Gtk::ComboBox template_chooser
bool _existing_session_chooser_used
set to true when the existing session chooser has been used
Gtk::TreeModelColumn< std::string > tip
Gtk::TreeModelColumn< std::string > path
Gtk::ScrolledWindow recent_scroller
bool create_master_bus() const
Gtk::Label chan_count_label_1
Gtk::Frame bus_frame
std::string _provided_session_name
Gtk::Label chan_count_label_4
void session_selected()
Gtk::Label output_label
Gtk::VBox session_existing_vbox
bool connect_outs_to_master() const
Gtk::Label chan_count_label_3
void new_name_changed()
SessionTemplateColumns session_template_columns
Gtk::Label bus_label
int output_limit_count() const
void master_bus_button_clicked()
Gtk::FileChooserButton new_folder_chooser
Gtk::HBox input_port_limit_hbox
Gtk::Label input_label
void connect_inputs_clicked()
Gtk::Frame output_frame
Gtk::Entry new_name_entry
void limit_outputs_clicked()
Gtk::Label info_scroller_label
Gtk::VBox input_port_vbox
Gtk::VBox advanced_vbox
Gtk::VBox output_port_vbox
void recent_session_row_selected()
SessionDialog(bool require_new, const std::string &session_name, const std::string &session_path, const std::string &template_name, bool cancel_not_quit)
Glib::RefPtr< Gtk::TreeStore > recent_session_model
Gtk::SpinButton _input_limit_count
bool connect_outs_to_physical() const
Gtk::FileChooserButton existing_session_chooser
void existing_session_selected()
Gtk::VBox ic_vbox
Gtk::Frame info_frame
bool limit_outputs_used_for_connection() const
Gtk::CheckButton _create_master_bus
int input_limit_count() const
Gtk::VBox session_new_vbox
void setup_more_options_box()
Gtk::VBox more_options_vbox
Gtk::SpinButton _output_limit_count
Glib::RefPtr< Pango::Layout > layout
std::string load_template_override
Gtk::Adjustment _output_limit_count_adj
Gtk::TreeModelColumn< std::string > sample_rate
Gtk::TreeModelColumn< std::string > visible_name
Gtk::CheckButton use_template_button
int master_channel_count() const
bool back_button_pressed(GdkEventButton *)
Gtk::HBox input_hbox
void recent_row_activated(const Gtk::TreePath &path, Gtk::TreeViewColumn *col)
Gtk::Button * back_button
bool on_delete_event(GdkEventAny *)
Gtk::Label advanced_label
void limit_inputs_clicked()
bool connect_outputs() const
Gtk::CheckButton _connect_inputs
Gtk::Label recent_label
Gtk::Button ic_new_session_button
void setup_initial_choice_box()
Gtk::Button * quit_button
Gtk::RadioButtonGroup connect_outputs_group
bool connect_inputs() const
Gtk::HBox output_port_limit_hbox
Gtk::Table advanced_table
LIBARDOUR_API int cmp_nocase(const std::string &s, const std::string &s2)
Gtk::Adjustment _master_bus_channel_count_adj
Gtk::Adjustment _input_limit_count_adj
std::string _provided_session_path
Gtk::CheckButton _limit_output_ports
Gtk::RadioButton _connect_outputs_to_master
RecentSessionModelColumns recent_session_columns
Gtk::Table input_table
std::string::size_type info_scroller_count
Gtk::Frame input_frame
Gtk::RadioButton _connect_outputs_to_physical
Gtk::HBox output_hbox
Gtk::Table bus_table
Gtk::VBox output_vbox
Gtk::TreeModelColumn< std::string > fullpath
Gtk::Expander more_new_session_options_button
void connect_outputs_clicked()
Gtk::Button * cancel_button
Gtk::VBox output_conn_vbox
int redisplay_recent_sessions()
void setup_existing_session_page()
bool operator()(std::pair< std::string, std::string > a, std::pair< std::string, std::string > b) const
sigc::connection info_scroller_connection
void populate_session_templates()
std::string session_folder()
Glib::RefPtr< Gtk::ListStore > template_model
Gtk::TreeView recent_session_display
void new_name_activated()
Gtk::CheckButton _limit_input_ports
void updates_button_clicked()
Gtk::TreeModelColumn< std::string > disk_format
std::string session_name(bool &should_be_new)
void more_new_session_options_button_clicked()
Gtk::SpinButton _master_bus_channel_count
void new_session_button_clicked()
bool info_scroller_update()
void setup_new_session_page()
Gtk::HBox bus_hbox
Gtk::TreeModelColumn< std::string > name
Gtk::CheckButton _connect_outputs
std::string session_template_name()