Ardour  9.0-pre0-822-g12e3bc5c20
session_dialog.h
Go to the documentation of this file.
1 /*
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>
5  *
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.
10  *
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.
15  *
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.
19  */
20 
21 #ifndef __gtk2_ardour_session_dialog_h__
22 #define __gtk2_ardour_session_dialog_h__
23 
24 #include <string>
25 
26 #include <ydkmm/pixbuf.h>
27 #include <ytkmm/label.h>
28 #include <ytkmm/drawingarea.h>
29 #include <ytkmm/expander.h>
30 #include <ytkmm/box.h>
31 #include <ytkmm/radiobutton.h>
32 #include <ytkmm/filechooserbutton.h>
33 #include <ytkmm/filechooserwidget.h>
34 #include <ytkmm/scrolledwindow.h>
35 #include <ytkmm/textview.h>
36 #include <ytkmm/treeview.h>
37 #include <ytkmm/treestore.h>
38 #include <ytkmm/checkbutton.h>
39 #include <ytkmm/table.h>
40 #include <ytkmm/frame.h>
41 #include <ytkmm/spinbutton.h>
42 #include <ytkmm/liststore.h>
43 #include <ytkmm/combobox.h>
44 #include <ytkmm/comboboxtext.h>
45 
47 
48 #include "ardour/utils.h"
49 
50 #include "ardour_dialog.h"
51 #include "option_editor.h"
52 
53 class EngineControl;
54 
56 {
57 public:
58  enum DialogTab
59  {
60  New = 0,
63  Prefs
64  };
65 
66  SessionDialog (DialogTab initial_tab, const std::string& session_name, const std::string& session_path,
67  const std::string& template_name, bool cancel_not_quit);
69 
70  std::string session_name (bool& should_be_new);
71  std::string session_folder ();
72 
74 
75  bool use_session_template() const;
76  std::string session_template_name();
77 
79  void on_show ();
80 
81  void set_provided_session (std::string const & name, std::string const & path);
82  void clear_name ();
83  bool was_new_name_edited() const { return new_name_was_edited; }
84 
86  void show_template_context_menu (int button, int time);
87  bool template_button_press (GdkEventButton*);
88 
89 private:
90  bool on_delete_event (GdkEventAny*);
91 
92  Gtk::Button* cancel_button;
93  Gtk::Button* open_button;
94  Gtk::Button* quit_button;
95 
100 
101  Gtk::ComboBoxText timebase_chooser;
102 
103  bool new_button_pressed (GdkEventButton*);
104  bool recent_button_pressed (GdkEventButton*);
105  bool existing_button_pressed (GdkEventButton*);
106  bool prefs_button_pressed (GdkEventButton*);
107 
108  bool open_button_pressed (GdkEventButton*);
109 
110  Gtk::HBox _info_box;
111 
113 
114  /* initial choice page */
115 
118  Gtk::VBox recent_vbox;
119 
121 
122 #ifdef MIXBUS
123  Gtk::Button _license_button;
124  Gtk::Label _license_label;
125  void license_button_clicked ();
126 #endif
127 
128  /* recent sessions */
129 
131 
133  {
134  bool operator() (std::pair<std::string,std::string> a, std::pair<std::string,std::string> b) const {
135  return ARDOUR::cmp_nocase(a.first, b.first) == -1;
136  }
137  };
138 
139  struct RecentSessionModelColumns : public Gtk::TreeModel::ColumnRecord {
141  {
142  add (visible_name);
143  add (tip);
144  add (fullpath);
145  add (sample_rate);
146  add (disk_format);
147  add (modified_with);
148  add (time_modified);
149  add (time_formatted);
150  }
151  Gtk::TreeModelColumn<std::string> visible_name;
152  Gtk::TreeModelColumn<std::string> tip;
153  Gtk::TreeModelColumn<std::string> fullpath;
154  Gtk::TreeModelColumn<std::string> sample_rate;
155  Gtk::TreeModelColumn<std::string> disk_format;
156  Gtk::TreeModelColumn<std::string> modified_with;
157  Gtk::TreeModelColumn<int64_t> time_modified;
158  Gtk::TreeModelColumn<std::string> time_formatted;
159  };
160 
162  Gtk::TreeView recent_session_display;
163  Glib::RefPtr<Gtk::TreeStore> recent_session_model;
164  Gtk::ScrolledWindow recent_scroller;
165  Gtk::Label recent_label;
166  Gtk::FileChooserWidget existing_session_chooser;
170  void recent_row_activated (const Gtk::TreePath& path, Gtk::TreeViewColumn* col);
171  bool recent_button_press (GdkEventButton*);
172  void recent_context_mennu (GdkEventButton*);
174 
176 
179 
180  /* new sessions */
181 
183  Gtk::Entry new_name_entry;
185  bool new_name_edited (GdkEventKey*);
186 
188 
189  Gtk::FileChooserButton new_folder_chooser;
190 
191  struct SessionTemplateColumns : public Gtk::TreeModel::ColumnRecord {
193  add (name);
194  add (path);
195  add (description);
196  add (modified_with_short);
197  add (modified_with_long);
198  add (removable);
199  }
200 
201  Gtk::TreeModelColumn<std::string> name;
202  Gtk::TreeModelColumn<std::string> path;
203  Gtk::TreeModelColumn<std::string> description;
204  Gtk::TreeModelColumn<std::string> modified_with_short;
205  Gtk::TreeModelColumn<std::string> modified_with_long;
206  Gtk::TreeModelColumn<bool> removable;
207  };
208 
210 
211  Glib::RefPtr<Gtk::TreeStore> template_model;
212  Gtk::TreeView template_chooser;
213  Gtk::ScrolledWindow template_scroller;
214 
216 
217  Gtk::TextView template_desc;
219 
220  Gtk::VBox session_new_vbox;
222 
226 
227  void tab_page_switched(GtkNotebookPage*, guint page_number);
228 
229  /* --disable plugins UI */
230  Gtk::CheckButton _disable_plugins;
232 
233  /* meta-template */
234  static uint32_t meta_master_bus_profile (std::string script);
235 
236  /* always there */
237 
238  Glib::RefPtr<Pango::Layout> layout;
239 
241  std::string::size_type info_scroller_count;
243  sigc::connection info_scroller_connection;
245 
246  Gtk::Notebook _tabs;
247 };
248 
249 #endif /* __gtk2_ardour_session_dialog_h__ */
Gtk::ComboBoxText timebase_chooser
bool template_button_press(GdkEventButton *)
void setup_existing_session_page()
bool new_name_was_edited
void recent_session_sort_changed()
void setup_new_session_page()
Glib::RefPtr< Gtk::TreeStore > template_model
ArdourWidgets::ArdourButton new_button
void template_row_selected()
bool open_button_pressed(GdkEventButton *)
void clear_name()
sigc::connection info_scroller_connection
std::string session_template_name()
void delete_selected_template()
Temporal::TimeDomain session_domain() const
void session_selected()
Gtk::VBox recent_vbox
void recent_row_activated(const Gtk::TreePath &path, Gtk::TreeViewColumn *col)
Glib::RefPtr< Pango::Layout > layout
Gtk::Button * open_button
Gtk::TreeView recent_session_display
void disable_plugins_clicked()
void recent_context_mennu(GdkEventButton *)
void show_template_context_menu(int button, int time)
RecentSessionModelColumns recent_session_columns
Gtk::FileChooserButton new_folder_chooser
std::string session_folder()
Gtk::VBox session_new_vbox
bool prefs_button_pressed(GdkEventButton *)
std::string load_template_override
Gtk::Button * cancel_button
void tab_page_switched(GtkNotebookPage *, guint page_number)
void set_provided_session(std::string const &name, std::string const &path)
Gtk::Notebook _tabs
Gtk::TreeView template_chooser
std::string session_name(bool &should_be_new)
Gtk::TextView template_desc
Gtk::Table _open_table
void recent_remove_selected()
void populate_session_templates()
bool recent_button_pressed(GdkEventButton *)
bool use_session_template() const
Gtk::HBox _info_box
void existing_file_activated()
Gtk::ScrolledWindow recent_scroller
ArdourWidgets::ArdourButton prefs_button
void new_name_activated()
ArdourWidgets::ArdourButton recent_button
Glib::RefPtr< Gtk::TreeStore > recent_session_model
bool new_button_pressed(GdkEventButton *)
Gtk::Frame template_desc_frame
uint32_t master_channel_count()
bool was_new_name_edited() const
Gtk::Label info_scroller_label
void recent_session_row_selected()
bool existing_button_pressed(GdkEventButton *)
void setup_recent_sessions()
bool info_scroller_update()
void new_name_changed()
void existing_file_selected()
void setup_existing_box()
static uint32_t meta_master_bus_profile(std::string script)
std::string::size_type info_scroller_count
Gtk::ScrolledWindow template_scroller
bool on_delete_event(GdkEventAny *)
bool recent_button_press(GdkEventButton *)
void setup_untitled_session()
void updates_button_clicked()
SessionDialog(DialogTab initial_tab, const std::string &session_name, const std::string &session_path, const std::string &template_name, bool cancel_not_quit)
Gtk::FileChooserWidget existing_session_chooser
Gtk::CheckButton _disable_plugins
Gtk::Button * quit_button
Gtk::Entry new_name_entry
Gtk::Label recent_label
int redisplay_recent_sessions()
DialogTab _initial_tab
ArdourWidgets::ArdourButton existing_button
SessionTemplateColumns session_template_columns
bool new_name_edited(GdkEventKey *)
struct Table Table
PBD::PropertyDescriptor< std::string > name
int cmp_nocase(const std::string &s, const std::string &s2)
Base class for option editing dialog boxes.
Gtk::TreeModelColumn< std::string > fullpath
Gtk::TreeModelColumn< std::string > tip
Gtk::TreeModelColumn< std::string > sample_rate
Gtk::TreeModelColumn< std::string > disk_format
Gtk::TreeModelColumn< std::string > visible_name
Gtk::TreeModelColumn< int64_t > time_modified
Gtk::TreeModelColumn< std::string > time_formatted
Gtk::TreeModelColumn< std::string > modified_with
bool operator()(std::pair< std::string, std::string > a, std::pair< std::string, std::string > b) const
Gtk::TreeModelColumn< bool > removable
Gtk::TreeModelColumn< std::string > modified_with_short
Gtk::TreeModelColumn< std::string > description
Gtk::TreeModelColumn< std::string > name
Gtk::TreeModelColumn< std::string > path
Gtk::TreeModelColumn< std::string > modified_with_long