Prefer testing the session instead of using a global variable
This commit is contained in:
parent
bf874562ef
commit
4dc65e6613
@ -272,7 +272,6 @@ libxml_structured_error_func (void* /* parsing_context*/,
|
|||||||
|
|
||||||
ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
|
ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
|
||||||
: Gtkmm2ext::UI (PROGRAM_NAME, X_("gui"), argcp, argvp)
|
: Gtkmm2ext::UI (PROGRAM_NAME, X_("gui"), argcp, argvp)
|
||||||
, session_loaded (false)
|
|
||||||
, session_load_in_progress (false)
|
, session_load_in_progress (false)
|
||||||
, gui_object_state (new GUIObjectState)
|
, gui_object_state (new GUIObjectState)
|
||||||
, primary_clock (new MainClock (X_("primary"), X_("transport"), true ))
|
, primary_clock (new MainClock (X_("primary"), X_("transport"), true ))
|
||||||
@ -3547,8 +3546,6 @@ ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
session_loaded = false;
|
|
||||||
|
|
||||||
loading_message (string_compose (_("Please wait while %1 loads your session"), PROGRAM_NAME));
|
loading_message (string_compose (_("Please wait while %1 loads your session"), PROGRAM_NAME));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -3658,8 +3655,6 @@ ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name,
|
|||||||
|
|
||||||
set_session (new_session);
|
set_session (new_session);
|
||||||
|
|
||||||
session_loaded = true;
|
|
||||||
|
|
||||||
if (_session) {
|
if (_session) {
|
||||||
_session->set_clean ();
|
_session->set_clean ();
|
||||||
}
|
}
|
||||||
@ -3703,7 +3698,6 @@ ARDOUR_UI::build_session (const std::string& path, const std::string& snap_name,
|
|||||||
Session *new_session;
|
Session *new_session;
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
session_loaded = false;
|
|
||||||
x = unload_session ();
|
x = unload_session ();
|
||||||
|
|
||||||
if (x < 0) {
|
if (x < 0) {
|
||||||
@ -3768,8 +3762,6 @@ ARDOUR_UI::build_session (const std::string& path, const std::string& snap_name,
|
|||||||
|
|
||||||
set_session (new_session);
|
set_session (new_session);
|
||||||
|
|
||||||
session_loaded = true;
|
|
||||||
|
|
||||||
new_session->save_state(new_session->name());
|
new_session->save_state(new_session->name());
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -195,7 +195,6 @@ public:
|
|||||||
void finish();
|
void finish();
|
||||||
|
|
||||||
int load_session (const std::string& path, const std::string& snapshot, std::string mix_template = std::string());
|
int load_session (const std::string& path, const std::string& snapshot, std::string mix_template = std::string());
|
||||||
bool session_loaded;
|
|
||||||
bool session_load_in_progress;
|
bool session_load_in_progress;
|
||||||
int build_session (const std::string& path, const std::string& snapshot, ARDOUR::BusProfile*);
|
int build_session (const std::string& path, const std::string& snapshot, ARDOUR::BusProfile*);
|
||||||
bool session_is_new() const { return _session_is_new; }
|
bool session_is_new() const { return _session_is_new; }
|
||||||
|
@ -337,10 +337,9 @@ ARDOUR_UI::unload_session (bool hide_stuff)
|
|||||||
|
|
||||||
blink_connection.disconnect ();
|
blink_connection.disconnect ();
|
||||||
|
|
||||||
delete _session;
|
ARDOUR::Session* session_to_delete = _session;
|
||||||
_session = 0;
|
_session = 0;
|
||||||
|
delete session_to_delete;
|
||||||
session_loaded = false;
|
|
||||||
|
|
||||||
update_title ();
|
update_title ();
|
||||||
|
|
||||||
|
@ -983,7 +983,7 @@ Editor::set_entered_track (TimeAxisView* tav)
|
|||||||
void
|
void
|
||||||
Editor::instant_save ()
|
Editor::instant_save ()
|
||||||
{
|
{
|
||||||
if (!constructed || !ARDOUR_UI::instance()->session_loaded || no_save_instant) {
|
if (!constructed || no_save_instant) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -666,7 +666,7 @@ SessionDialog::setup_new_session_page ()
|
|||||||
//determine the text in the new folder selector
|
//determine the text in the new folder selector
|
||||||
if (!ARDOUR_COMMAND_LINE::session_name.empty()) {
|
if (!ARDOUR_COMMAND_LINE::session_name.empty()) {
|
||||||
new_folder_chooser.set_current_folder (poor_mans_glob (Glib::path_get_dirname (ARDOUR_COMMAND_LINE::session_name)));
|
new_folder_chooser.set_current_folder (poor_mans_glob (Glib::path_get_dirname (ARDOUR_COMMAND_LINE::session_name)));
|
||||||
} else if (ARDOUR_UI::instance()->session_loaded) {
|
} else if (ARDOUR_UI::instance()->the_session ()) {
|
||||||
// point the new session file chooser at the parent directory of the current session
|
// point the new session file chooser at the parent directory of the current session
|
||||||
string session_parent_dir = Glib::path_get_dirname(ARDOUR_UI::instance()->the_session()->path());
|
string session_parent_dir = Glib::path_get_dirname(ARDOUR_UI::instance()->the_session()->path());
|
||||||
new_folder_chooser.set_current_folder (session_parent_dir);
|
new_folder_chooser.set_current_folder (session_parent_dir);
|
||||||
|
Loading…
Reference in New Issue
Block a user