From 4d9017a1fb3d51a8f96f3655e6ed6892c2913c2f Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 25 Mar 2020 02:43:20 +0100 Subject: Also allow scratch sessions via Session > New --- gtk2_ardour/session_dialog.cc | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'gtk2_ardour/session_dialog.cc') 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 @@ -543,6 +538,22 @@ SessionDialog::open_button_pressed (GdkEventButton* ev) return true; } +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 () { -- cgit v1.2.3