Ardour  9.0-pre0-2141-g48f625e7ef
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>
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);
88 
89 private:
91 
95 
100 
102 
104 
108 
110 
112 
114 
115  /* initial choice page */
116 
120 
122 
123 #ifdef MIXBUS
124  Gtk::Button _license_button;
125  Gtk::Label _license_label;
126  void license_button_clicked ();
127 #endif
128 
129  /* recent sessions */
130 
132 
134  {
135  bool operator() (std::pair<std::string,std::string> a, std::pair<std::string,std::string> b) const {
136  return ARDOUR::cmp_nocase(a.first, b.first) == -1;
137  }
138  };
139 
142  {
143  add (visible_name);
144  add (tip);
145  add (fullpath);
146  add (sample_rate);
147  add (disk_format);
148  add (modified_with);
149  add (time_modified);
151  }
160  };
161 
164  Glib::RefPtr<Gtk::TreeStore> recent_session_model;
175 
177 
180 
181  /* new sessions */
182 
187 
189 
191 
194  add (name);
195  add (path);
196  add (description);
199  add (removable);
200  }
201 
208  };
209 
211 
212  Glib::RefPtr<Gtk::TreeStore> template_model;
215 
217 
220 
223 
227 
228  void tab_page_switched(GtkNotebookPage*, guint page_number);
229 
230  /* --disable plugins UI */
233 
234  /* meta-template */
235  static uint32_t meta_master_bus_profile (std::string script);
236 
237  /* always there */
238 
239  Glib::RefPtr<Pango::Layout> layout;
240 
242  std::string::size_type info_scroller_count;
244  sigc::connection info_scroller_connection;
246 
248 
249  Glib::RefPtr<Gtk::ActionGroup> action_group;
250  Glib::RefPtr<Gtk::Action> new_session_action;
251  Glib::RefPtr<Gtk::Action> recent_session_action;
252  Glib::RefPtr<Gtk::Action> existing_session_action;
253 };
254 
255 #endif /* __gtk2_ardour_session_dialog_h__ */
void add(TreeModelColumnBase &column)
void path(Glib::ustring &path, Glib::ustring &path_reversed)
Compute a widget's path of the form "GtkWindow.MyLabel".
Gtk::ComboBoxText timebase_chooser
bool template_button_press(GdkEventButton *)
void setup_existing_session_page()
bool new_name_was_edited
Glib::RefPtr< Gtk::ActionGroup > action_group
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
void new_button_choice_action()
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()
Glib::RefPtr< Gtk::Action > recent_session_action
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
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()
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)
Glib::RefPtr< Gtk::Action > existing_session_action
std::string::size_type info_scroller_count
Gtk::ScrolledWindow template_scroller
Glib::RefPtr< Gtk::Action > new_session_action
bool on_delete_event(GdkEventAny *)
This is a default handler for the signal signal_delete_event().
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)
void on_show()
This is a default handler for the signal signal_show().
Gtk::FileChooserWidget existing_session_chooser
void existing_button_choice_action()
Gtk::CheckButton _disable_plugins
Gtk::Button * quit_button
void recent_button_choice_action()
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 *)
GtkImageIconNameData name
Definition: gtkimage.h:6
struct _GtkNotebookPage GtkNotebookPage
Definition: gtknotebook.h:58
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