2 * Copyright (C) 2013-2017 Paul Davis <paul@linuxaudiosystems.com>
3 * Copyright (C) 2014-2017 Robin Gareus <robin@gareus.org>
4 * Copyright (C) 2017 Ben Loftis <ben@harrisonconsoles.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #ifndef __gtk2_ardour_session_dialog_h__
22 #define __gtk2_ardour_session_dialog_h__
26 #include <gdkmm/pixbuf.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/textview.h>
35 #include <gtkmm/treeview.h>
36 #include <gtkmm/treestore.h>
37 #include <gtkmm/checkbutton.h>
38 #include <gtkmm/table.h>
39 #include <gtkmm/frame.h>
40 #include <gtkmm/spinbutton.h>
41 #include <gtkmm/liststore.h>
42 #include <gtkmm/combobox.h>
44 #include "ardour/utils.h"
46 #include "ardour_dialog.h"
50 class SessionDialog : public ArdourDialog
53 SessionDialog (bool require_new, const std::string& session_name, const std::string& session_path,
54 const std::string& template_name, bool cancel_not_quit);
58 std::string session_name (bool& should_be_new);
59 std::string session_folder ();
61 bool use_session_template() const;
62 std::string session_template_name();
64 uint32_t master_channel_count();
66 void set_provided_session (std::string const & name, std::string const & path);
72 bool on_delete_event (GdkEventAny*);
74 Gtk::Button* cancel_button;
75 Gtk::Button* open_button;
76 Gtk::Button* back_button;
77 Gtk::Button* quit_button;
79 bool back_button_pressed (GdkEventButton*);
80 bool open_button_pressed (GdkEventButton*);
82 Gtk::Frame info_frame;
84 /* initial choice page */
86 void setup_initial_choice_box ();
87 void setup_recent_sessions ();
89 Gtk::Button ic_new_session_button;
90 void new_session_button_clicked ();
94 void setup_existing_session_page ();
96 struct RecentSessionsSorter
98 bool operator() (std::pair<std::string,std::string> a, std::pair<std::string,std::string> b) const {
99 return ARDOUR::cmp_nocase(a.first, b.first) == -1;
103 struct RecentSessionModelColumns : public Gtk::TreeModel::ColumnRecord {
104 RecentSessionModelColumns()
113 add (time_formatted);
115 Gtk::TreeModelColumn<std::string> visible_name;
116 Gtk::TreeModelColumn<std::string> tip;
117 Gtk::TreeModelColumn<std::string> fullpath;
118 Gtk::TreeModelColumn<std::string> sample_rate;
119 Gtk::TreeModelColumn<std::string> disk_format;
120 Gtk::TreeModelColumn<std::string> modified_with;
121 Gtk::TreeModelColumn<int64_t> time_modified;
122 Gtk::TreeModelColumn<std::string> time_formatted;
125 RecentSessionModelColumns recent_session_columns;
126 Gtk::TreeView recent_session_display;
127 Glib::RefPtr<Gtk::TreeStore> recent_session_model;
128 Gtk::ScrolledWindow recent_scroller;
129 Gtk::Label recent_label;
130 Gtk::FileChooserButton existing_session_chooser;
131 int redisplay_recent_sessions ();
132 void recent_session_row_selected ();
133 void recent_session_sort_changed ();
134 void recent_row_activated (const Gtk::TreePath& path, Gtk::TreeViewColumn* col);
135 bool recent_button_press (GdkEventButton*);
136 void recent_context_mennu (GdkEventButton*);
137 void recent_remove_selected ();
139 void existing_session_selected ();
140 void session_selected ();
144 void setup_new_session_page ();
145 Gtk::Entry new_name_entry;
146 Gtk::FileChooserButton new_folder_chooser;
148 struct SessionTemplateColumns : public Gtk::TreeModel::ColumnRecord {
149 SessionTemplateColumns () {
153 add (modified_with_short);
154 add (modified_with_long);
157 Gtk::TreeModelColumn<std::string> name;
158 Gtk::TreeModelColumn<std::string> path;
159 Gtk::TreeModelColumn<std::string> description;
160 Gtk::TreeModelColumn<std::string> modified_with_short;
161 Gtk::TreeModelColumn<std::string> modified_with_long;
164 SessionTemplateColumns session_template_columns;
166 Glib::RefPtr<Gtk::TreeStore> template_model;
167 Gtk::TreeView template_chooser;
168 Gtk::ScrolledWindow template_scroller;
170 void template_row_selected ();
172 Gtk::TextView template_desc;
173 Gtk::Frame template_desc_frame;
175 Gtk::VBox session_new_vbox;
176 Gtk::VBox session_existing_vbox;
177 std::string load_template_override;
179 void new_name_changed ();
180 void new_name_activated ();
181 void populate_session_templates ();
183 /* --disable plugins UI */
184 Gtk::CheckButton _disable_plugins;
185 void disable_plugins_clicked ();
188 static uint32_t meta_master_bus_profile (std::string script);
192 Glib::RefPtr<Pango::Layout> layout;
194 bool _existing_session_chooser_used; ///< set to true when the existing session chooser has been used
196 Gtk::Label info_scroller_label;
197 std::string::size_type info_scroller_count;
198 bool info_scroller_update();
199 sigc::connection info_scroller_connection;
200 void updates_button_clicked ();
203 #endif /* __gtk2_ardour_session_dialog_h__ */