diff options
author | Robin Gareus <robin@gareus.org> | 2020-03-25 02:43:20 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2020-03-25 02:43:20 +0100 |
commit | 4d9017a1fb3d51a8f96f3655e6ed6892c2913c2f (patch) | |
tree | 80c0368d429f68169bbce457bc16363901fc4b2c | |
parent | 993cba5a7ccaaba69e10b8ee41aedf14c4e12b6f (diff) |
Also allow scratch sessions via Session > New
-rw-r--r-- | gtk2_ardour/session_dialog.cc | 31 | ||||
-rw-r--r-- | gtk2_ardour/session_dialog.h | 2 |
2 files changed, 23 insertions, 10 deletions
diff --git a/gtk2_ardour/session_dialog.cc b/gtk2_ardour/session_dialog.cc index 00523d4a29..6cacbdec0f 100644 --- a/gtk2_ardour/session_dialog.cc +++ b/gtk2_ardour/session_dialog.cc @@ -142,6 +142,10 @@ SessionDialog::SessionDialog (bool require_new, const std::string& session_name, } inital_height = get_height(); inital_width = get_width(); + + if (require_new) { + setup_untitled_session (); + } } SessionDialog::SessionDialog () @@ -509,17 +513,8 @@ SessionDialog::new_session_button_clicked () get_vbox()->remove (ic_vbox); get_vbox()->pack_start (session_new_vbox, true, true); - time_t n; - time (&n); - struct tm* now = localtime (&n); - Glib::DateTime tm (Glib::DateTime::create_now_local (mktime (now))); - - new_name_entry.set_text (string_compose (_("Untitled-%1"), tm.format ("%F-%H-%M-%S"))); - new_name_entry.select_region (0, -1); - new_name_was_edited = false; - back_button->set_sensitive (true); - new_name_entry.grab_focus (); + setup_untitled_session (); } bool @@ -544,6 +539,22 @@ SessionDialog::open_button_pressed (GdkEventButton* ev) } void +SessionDialog::setup_untitled_session () +{ + time_t n; + time (&n); + struct tm* now = localtime (&n); + Glib::DateTime tm (Glib::DateTime::create_now_local (mktime (now))); + + new_name_entry.set_text (string_compose (_("Untitled-%1"), tm.format ("%F-%H-%M-%S"))); + new_name_entry.select_region (0, -1); + new_name_was_edited = false; + + back_button->set_sensitive (true); + new_name_entry.grab_focus (); +} + +void SessionDialog::populate_session_templates () { vector<TemplateInfo> templates; diff --git a/gtk2_ardour/session_dialog.h b/gtk2_ardour/session_dialog.h index 728572bee7..91199f1cf5 100644 --- a/gtk2_ardour/session_dialog.h +++ b/gtk2_ardour/session_dialog.h @@ -147,6 +147,8 @@ private: bool new_name_was_edited; bool new_name_edited (GdkEventKey*); + void setup_untitled_session (); + Gtk::FileChooserButton new_folder_chooser; struct SessionTemplateColumns : public Gtk::TreeModel::ColumnRecord { |