2 Copyright (C) 2010 Paul Davis
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.
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.
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.
20 #ifndef __gtk2_ardour_session_dialog_h__
21 #define __gtk2_ardour_session_dialog_h__
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/textview.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>
43 #include "ardour/utils.h"
45 #include "ardour_dialog.h"
49 class SessionDialog : public ArdourDialog
52 SessionDialog (bool require_new, const std::string& session_name, const std::string& session_path,
53 const std::string& template_name, bool cancel_not_quit);
59 std::string session_name (bool& should_be_new);
60 std::string session_folder ();
62 bool use_session_template() const;
63 std::string session_template_name();
65 uint32_t master_channel_count();
67 void set_provided_session(const std::string& session_name, const std::string& session_path) {
68 _provided_session_name = session_name;
69 _provided_session_path = session_path;
74 std::string _provided_session_name;
75 std::string _provided_session_path;
77 bool on_delete_event (GdkEventAny*);
79 Gtk::Button* cancel_button;
80 Gtk::Button* open_button;
81 Gtk::Button* back_button;
82 Gtk::Button* quit_button;
84 bool back_button_pressed (GdkEventButton*);
85 bool open_button_pressed (GdkEventButton*);
87 Gtk::Frame info_frame;
89 /* initial choice page */
91 void setup_initial_choice_box ();
92 void setup_recent_sessions ();
94 Gtk::Button ic_new_session_button;
95 void new_session_button_clicked ();
99 void setup_existing_session_page ();
101 struct RecentSessionsSorter
103 bool operator() (std::pair<std::string,std::string> a, std::pair<std::string,std::string> b) const {
104 return ARDOUR::cmp_nocase(a.first, b.first) == -1;
108 struct RecentSessionModelColumns : public Gtk::TreeModel::ColumnRecord {
109 RecentSessionModelColumns()
118 add (time_formatted);
120 Gtk::TreeModelColumn<std::string> visible_name;
121 Gtk::TreeModelColumn<std::string> tip;
122 Gtk::TreeModelColumn<std::string> fullpath;
123 Gtk::TreeModelColumn<std::string> sample_rate;
124 Gtk::TreeModelColumn<std::string> disk_format;
125 Gtk::TreeModelColumn<std::string> modified_with;
126 Gtk::TreeModelColumn<int64_t> time_modified;
127 Gtk::TreeModelColumn<std::string> time_formatted;
130 RecentSessionModelColumns recent_session_columns;
131 Gtk::TreeView recent_session_display;
132 Glib::RefPtr<Gtk::TreeStore> recent_session_model;
133 Gtk::ScrolledWindow recent_scroller;
134 Gtk::Label recent_label;
135 Gtk::FileChooserButton existing_session_chooser;
136 int redisplay_recent_sessions ();
137 void recent_session_row_selected ();
138 void recent_session_sort_changed ();
139 void recent_row_activated (const Gtk::TreePath& path, Gtk::TreeViewColumn* col);
140 bool recent_button_press (GdkEventButton*);
141 void recent_context_mennu (GdkEventButton*);
142 void recent_remove_selected ();
144 void existing_session_selected ();
145 void session_selected ();
149 void setup_new_session_page ();
150 Gtk::Entry new_name_entry;
151 Gtk::FileChooserButton new_folder_chooser;
153 struct SessionTemplateColumns : public Gtk::TreeModel::ColumnRecord {
154 SessionTemplateColumns () {
158 add (modified_with_short);
159 add (modified_with_long);
162 Gtk::TreeModelColumn<std::string> name;
163 Gtk::TreeModelColumn<std::string> path;
164 Gtk::TreeModelColumn<std::string> description;
165 Gtk::TreeModelColumn<std::string> modified_with_short;
166 Gtk::TreeModelColumn<std::string> modified_with_long;
169 SessionTemplateColumns session_template_columns;
171 Glib::RefPtr<Gtk::TreeStore> template_model;
172 Gtk::TreeView template_chooser;
173 Gtk::ScrolledWindow template_scroller;
175 void template_row_selected ();
177 Gtk::TextView template_desc;
178 Gtk::Frame template_desc_frame;
180 Gtk::VBox session_new_vbox;
181 Gtk::VBox session_existing_vbox;
182 std::string load_template_override;
184 void new_name_changed ();
185 void new_name_activated ();
186 void populate_session_templates ();
188 /* --disable plugins UI */
189 Gtk::CheckButton _disable_plugins;
190 void disable_plugins_clicked ();
193 uint32_t meta_master_bus_profile (std::string script) const;
197 Glib::RefPtr<Pango::Layout> layout;
199 bool _existing_session_chooser_used; ///< set to true when the existing session chooser has been used
201 Gtk::Label info_scroller_label;
202 std::string::size_type info_scroller_count;
203 bool info_scroller_update();
204 sigc::connection info_scroller_connection;
205 void updates_button_clicked ();
208 #endif /* __gtk2_ardour_session_dialog_h__ */