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);
60 std::string session_name (bool& should_be_new);
61 std::string session_folder ();
63 bool use_session_template() const;
64 std::string session_template_name();
66 uint32_t master_channel_count();
68 void set_provided_session(const std::string& session_name, const std::string& session_path) {
69 _provided_session_name = session_name;
70 _provided_session_path = session_path;
75 std::string _provided_session_name;
76 std::string _provided_session_path;
78 bool on_delete_event (GdkEventAny*);
80 Gtk::Button* cancel_button;
81 Gtk::Button* open_button;
82 Gtk::Button* back_button;
83 Gtk::Button* quit_button;
85 bool back_button_pressed (GdkEventButton*);
86 bool open_button_pressed (GdkEventButton*);
88 Gtk::Frame info_frame;
90 /* initial choice page */
92 void setup_initial_choice_box ();
93 void setup_recent_sessions ();
95 Gtk::Button ic_new_session_button;
96 void new_session_button_clicked ();
100 void setup_existing_session_page ();
102 struct RecentSessionsSorter
104 bool operator() (std::pair<std::string,std::string> a, std::pair<std::string,std::string> b) const {
105 return ARDOUR::cmp_nocase(a.first, b.first) == -1;
109 struct RecentSessionModelColumns : public Gtk::TreeModel::ColumnRecord {
110 RecentSessionModelColumns()
119 add (time_formatted);
121 Gtk::TreeModelColumn<std::string> visible_name;
122 Gtk::TreeModelColumn<std::string> tip;
123 Gtk::TreeModelColumn<std::string> fullpath;
124 Gtk::TreeModelColumn<std::string> sample_rate;
125 Gtk::TreeModelColumn<std::string> disk_format;
126 Gtk::TreeModelColumn<std::string> modified_with;
127 Gtk::TreeModelColumn<int64_t> time_modified;
128 Gtk::TreeModelColumn<std::string> time_formatted;
131 RecentSessionModelColumns recent_session_columns;
132 Gtk::TreeView recent_session_display;
133 Glib::RefPtr<Gtk::TreeStore> recent_session_model;
134 Gtk::ScrolledWindow recent_scroller;
135 Gtk::Label recent_label;
136 Gtk::FileChooserButton existing_session_chooser;
137 int redisplay_recent_sessions ();
138 void recent_session_row_selected ();
139 void recent_session_sort_changed ();
140 void recent_row_activated (const Gtk::TreePath& path, Gtk::TreeViewColumn* col);
141 bool recent_button_press (GdkEventButton*);
142 void recent_context_mennu (GdkEventButton*);
143 void recent_remove_selected ();
145 void existing_session_selected ();
146 void session_selected ();
150 void setup_new_session_page ();
151 Gtk::Entry new_name_entry;
152 Gtk::FileChooserButton new_folder_chooser;
154 struct SessionTemplateColumns : public Gtk::TreeModel::ColumnRecord {
155 SessionTemplateColumns () {
159 add (modified_with_short);
160 add (modified_with_long);
163 Gtk::TreeModelColumn<std::string> name;
164 Gtk::TreeModelColumn<std::string> path;
165 Gtk::TreeModelColumn<std::string> description;
166 Gtk::TreeModelColumn<std::string> modified_with_short;
167 Gtk::TreeModelColumn<std::string> modified_with_long;
170 SessionTemplateColumns session_template_columns;
172 Glib::RefPtr<Gtk::TreeStore> template_model;
173 Gtk::TreeView template_chooser;
174 Gtk::ScrolledWindow template_scroller;
176 void template_row_selected ();
178 Gtk::TextView template_desc;
179 Gtk::Frame template_desc_frame;
181 Gtk::VBox session_new_vbox;
182 Gtk::VBox session_existing_vbox;
183 std::string load_template_override;
185 void new_name_changed ();
186 void new_name_activated ();
187 void populate_session_templates ();
189 /* --disable plugins UI */
190 Gtk::CheckButton _disable_plugins;
191 void disable_plugins_clicked ();
194 uint32_t meta_master_bus_profile (std::string script) const;
198 Glib::RefPtr<Pango::Layout> layout;
200 bool _existing_session_chooser_used; ///< set to true when the existing session chooser has been used
202 Gtk::Label info_scroller_label;
203 std::string::size_type info_scroller_count;
204 bool info_scroller_update();
205 sigc::connection info_scroller_connection;
206 void updates_button_clicked ();
209 #endif /* __gtk2_ardour_session_dialog_h__ */